index.full.js 2.0 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113331143311533116331173311833119331203312133122331233312433125331263312733128331293313033131331323313333134331353313633137331383313933140331413314233143331443314533146331473314833149331503315133152331533315433155331563315733158331593316033161331623316333164331653316633167331683316933170331713317233173331743317533176331773317833179331803318133182331833318433185331863318733188331893319033191331923319333194331953319633197331983319933200332013320233203332043320533206332073320833209332103321133212332133321433215332163321733218332193322033221332223322333224332253322633227332283322933230332313323233233332343323533236332373323833239332403324133242332433324433245332463324733248332493325033251332523325333254332553325633257332583325933260332613326233263332643326533266332673326833269332703327133272332733327433275332763327733278332793328033281332823328333284332853328633287332883328933290332913329233293332943329533296332973329833299333003330133302333033330433305333063330733308333093331033311333123331333314333153331633317333183331933320333213332233323333243332533326333273332833329333303333133332333333333433335333363333733338333393334033341333423334333344333453334633347333483334933350333513335233353333543335533356333573335833359333603336133362333633336433365333663336733368333693337033371333723337333374333753337633377333783337933380333813338233383333843338533386333873338833389333903339133392333933339433395333963339733398333993340033401334023340333404334053340633407334083340933410334113341233413334143341533416334173341833419334203342133422334233342433425334263342733428334293343033431334323343333434334353343633437334383343933440334413344233443334443344533446334473344833449334503345133452334533345433455334563345733458334593346033461334623346333464334653346633467334683346933470334713347233473334743347533476334773347833479334803348133482334833348433485334863348733488334893349033491334923349333494334953349633497334983349933500335013350233503335043350533506335073350833509335103351133512335133351433515335163351733518335193352033521335223352333524335253352633527335283352933530335313353233533335343353533536335373353833539335403354133542335433354433545335463354733548335493355033551335523355333554335553355633557335583355933560335613356233563335643356533566335673356833569335703357133572335733357433575335763357733578335793358033581335823358333584335853358633587335883358933590335913359233593335943359533596335973359833599336003360133602336033360433605336063360733608336093361033611336123361333614336153361633617336183361933620336213362233623336243362533626336273362833629336303363133632336333363433635336363363733638336393364033641336423364333644336453364633647336483364933650336513365233653336543365533656336573365833659336603366133662336633366433665336663366733668336693367033671336723367333674336753367633677336783367933680336813368233683336843368533686336873368833689336903369133692336933369433695336963369733698336993370033701337023370333704337053370633707337083370933710337113371233713337143371533716337173371833719337203372133722337233372433725337263372733728337293373033731337323373333734337353373633737337383373933740337413374233743337443374533746337473374833749337503375133752337533375433755337563375733758337593376033761337623376333764337653376633767337683376933770337713377233773337743377533776337773377833779337803378133782337833378433785337863378733788337893379033791337923379333794337953379633797337983379933800338013380233803338043380533806338073380833809338103381133812338133381433815338163381733818338193382033821338223382333824338253382633827338283382933830338313383233833338343383533836338373383833839338403384133842338433384433845338463384733848338493385033851338523385333854338553385633857338583385933860338613386233863338643386533866338673386833869338703387133872338733387433875338763387733878338793388033881338823388333884338853388633887338883388933890338913389233893338943389533896338973389833899339003390133902339033390433905339063390733908339093391033911339123391333914339153391633917339183391933920339213392233923339243392533926339273392833929339303393133932339333393433935339363393733938339393394033941339423394333944339453394633947339483394933950339513395233953339543395533956339573395833959339603396133962339633396433965339663396733968339693397033971339723397333974339753397633977339783397933980339813398233983339843398533986339873398833989339903399133992339933399433995339963399733998339993400034001340023400334004340053400634007340083400934010340113401234013340143401534016340173401834019340203402134022340233402434025340263402734028340293403034031340323403334034340353403634037340383403934040340413404234043340443404534046340473404834049340503405134052340533405434055340563405734058340593406034061340623406334064340653406634067340683406934070340713407234073340743407534076340773407834079340803408134082340833408434085340863408734088340893409034091340923409334094340953409634097340983409934100341013410234103341043410534106341073410834109341103411134112341133411434115341163411734118341193412034121341223412334124341253412634127341283412934130341313413234133341343413534136341373413834139341403414134142341433414434145341463414734148341493415034151341523415334154341553415634157341583415934160341613416234163341643416534166341673416834169341703417134172341733417434175341763417734178341793418034181341823418334184341853418634187341883418934190341913419234193341943419534196341973419834199342003420134202342033420434205342063420734208342093421034211342123421334214342153421634217342183421934220342213422234223342243422534226342273422834229342303423134232342333423434235342363423734238342393424034241342423424334244342453424634247342483424934250342513425234253342543425534256342573425834259342603426134262342633426434265342663426734268342693427034271342723427334274342753427634277342783427934280342813428234283342843428534286342873428834289342903429134292342933429434295342963429734298342993430034301343023430334304343053430634307343083430934310343113431234313343143431534316343173431834319343203432134322343233432434325343263432734328343293433034331343323433334334343353433634337343383433934340343413434234343343443434534346343473434834349343503435134352343533435434355343563435734358343593436034361343623436334364343653436634367343683436934370343713437234373343743437534376343773437834379343803438134382343833438434385343863438734388343893439034391343923439334394343953439634397343983439934400344013440234403344043440534406344073440834409344103441134412344133441434415344163441734418344193442034421344223442334424344253442634427344283442934430344313443234433344343443534436344373443834439344403444134442344433444434445344463444734448344493445034451344523445334454344553445634457344583445934460344613446234463344643446534466344673446834469344703447134472344733447434475344763447734478344793448034481344823448334484344853448634487344883448934490344913449234493344943449534496344973449834499345003450134502345033450434505345063450734508345093451034511345123451334514345153451634517345183451934520345213452234523345243452534526345273452834529345303453134532345333453434535345363453734538345393454034541345423454334544345453454634547345483454934550345513455234553345543455534556345573455834559345603456134562345633456434565345663456734568345693457034571345723457334574345753457634577345783457934580345813458234583345843458534586345873458834589345903459134592345933459434595345963459734598345993460034601346023460334604346053460634607346083460934610346113461234613346143461534616346173461834619346203462134622346233462434625346263462734628346293463034631346323463334634346353463634637346383463934640346413464234643346443464534646346473464834649346503465134652346533465434655346563465734658346593466034661346623466334664346653466634667346683466934670346713467234673346743467534676346773467834679346803468134682346833468434685346863468734688346893469034691346923469334694346953469634697346983469934700347013470234703347043470534706347073470834709347103471134712347133471434715347163471734718347193472034721347223472334724347253472634727347283472934730347313473234733347343473534736347373473834739347403474134742347433474434745347463474734748347493475034751347523475334754347553475634757347583475934760347613476234763347643476534766347673476834769347703477134772347733477434775347763477734778347793478034781347823478334784347853478634787347883478934790347913479234793347943479534796347973479834799348003480134802348033480434805348063480734808348093481034811348123481334814348153481634817348183481934820348213482234823348243482534826348273482834829348303483134832348333483434835348363483734838348393484034841348423484334844348453484634847348483484934850348513485234853348543485534856348573485834859348603486134862348633486434865348663486734868348693487034871348723487334874348753487634877348783487934880348813488234883348843488534886348873488834889348903489134892348933489434895348963489734898348993490034901349023490334904349053490634907349083490934910349113491234913349143491534916349173491834919349203492134922349233492434925349263492734928349293493034931349323493334934349353493634937349383493934940349413494234943349443494534946349473494834949349503495134952349533495434955349563495734958349593496034961349623496334964349653496634967349683496934970349713497234973349743497534976349773497834979349803498134982349833498434985349863498734988349893499034991349923499334994349953499634997349983499935000350013500235003350043500535006350073500835009350103501135012350133501435015350163501735018350193502035021350223502335024350253502635027350283502935030350313503235033350343503535036350373503835039350403504135042350433504435045350463504735048350493505035051350523505335054350553505635057350583505935060350613506235063350643506535066350673506835069350703507135072350733507435075350763507735078350793508035081350823508335084350853508635087350883508935090350913509235093350943509535096350973509835099351003510135102351033510435105351063510735108351093511035111351123511335114351153511635117351183511935120351213512235123351243512535126351273512835129351303513135132351333513435135351363513735138351393514035141351423514335144351453514635147351483514935150351513515235153351543515535156351573515835159351603516135162351633516435165351663516735168351693517035171351723517335174351753517635177351783517935180351813518235183351843518535186351873518835189351903519135192351933519435195351963519735198351993520035201352023520335204352053520635207352083520935210352113521235213352143521535216352173521835219352203522135222352233522435225352263522735228352293523035231352323523335234352353523635237352383523935240352413524235243352443524535246352473524835249352503525135252352533525435255352563525735258352593526035261352623526335264352653526635267352683526935270352713527235273352743527535276352773527835279352803528135282352833528435285352863528735288352893529035291352923529335294352953529635297352983529935300353013530235303353043530535306353073530835309353103531135312353133531435315353163531735318353193532035321353223532335324353253532635327353283532935330353313533235333353343533535336353373533835339353403534135342353433534435345353463534735348353493535035351353523535335354353553535635357353583535935360353613536235363353643536535366353673536835369353703537135372353733537435375353763537735378353793538035381353823538335384353853538635387353883538935390353913539235393353943539535396353973539835399354003540135402354033540435405354063540735408354093541035411354123541335414354153541635417354183541935420354213542235423354243542535426354273542835429354303543135432354333543435435354363543735438354393544035441354423544335444354453544635447354483544935450354513545235453354543545535456354573545835459354603546135462354633546435465354663546735468354693547035471354723547335474354753547635477354783547935480354813548235483354843548535486354873548835489354903549135492354933549435495354963549735498354993550035501355023550335504355053550635507355083550935510355113551235513355143551535516355173551835519355203552135522355233552435525355263552735528355293553035531355323553335534355353553635537355383553935540355413554235543355443554535546355473554835549355503555135552355533555435555355563555735558355593556035561355623556335564355653556635567355683556935570355713557235573355743557535576355773557835579355803558135582355833558435585355863558735588355893559035591355923559335594355953559635597355983559935600356013560235603356043560535606356073560835609356103561135612356133561435615356163561735618356193562035621356223562335624356253562635627356283562935630356313563235633356343563535636356373563835639356403564135642356433564435645356463564735648356493565035651356523565335654356553565635657356583565935660356613566235663356643566535666356673566835669356703567135672356733567435675356763567735678356793568035681356823568335684356853568635687356883568935690356913569235693356943569535696356973569835699357003570135702357033570435705357063570735708357093571035711357123571335714357153571635717357183571935720357213572235723357243572535726357273572835729357303573135732357333573435735357363573735738357393574035741357423574335744357453574635747357483574935750357513575235753357543575535756357573575835759357603576135762357633576435765357663576735768357693577035771357723577335774357753577635777357783577935780357813578235783357843578535786357873578835789357903579135792357933579435795357963579735798357993580035801358023580335804358053580635807358083580935810358113581235813358143581535816358173581835819358203582135822358233582435825358263582735828358293583035831358323583335834358353583635837358383583935840358413584235843358443584535846358473584835849358503585135852358533585435855358563585735858358593586035861358623586335864358653586635867358683586935870358713587235873358743587535876358773587835879358803588135882358833588435885358863588735888358893589035891358923589335894358953589635897358983589935900359013590235903359043590535906359073590835909359103591135912359133591435915359163591735918359193592035921359223592335924359253592635927359283592935930359313593235933359343593535936359373593835939359403594135942359433594435945359463594735948359493595035951359523595335954359553595635957359583595935960359613596235963359643596535966359673596835969359703597135972359733597435975359763597735978359793598035981359823598335984359853598635987359883598935990359913599235993359943599535996359973599835999360003600136002360033600436005360063600736008360093601036011360123601336014360153601636017360183601936020360213602236023360243602536026360273602836029360303603136032360333603436035360363603736038360393604036041360423604336044360453604636047360483604936050360513605236053360543605536056360573605836059360603606136062360633606436065360663606736068360693607036071360723607336074360753607636077360783607936080360813608236083360843608536086360873608836089360903609136092360933609436095360963609736098360993610036101361023610336104361053610636107361083610936110361113611236113361143611536116361173611836119361203612136122361233612436125361263612736128361293613036131361323613336134361353613636137361383613936140361413614236143361443614536146361473614836149361503615136152361533615436155361563615736158361593616036161361623616336164361653616636167361683616936170361713617236173361743617536176361773617836179361803618136182361833618436185361863618736188361893619036191361923619336194361953619636197361983619936200362013620236203362043620536206362073620836209362103621136212362133621436215362163621736218362193622036221362223622336224362253622636227362283622936230362313623236233362343623536236362373623836239362403624136242362433624436245362463624736248362493625036251362523625336254362553625636257362583625936260362613626236263362643626536266362673626836269362703627136272362733627436275362763627736278362793628036281362823628336284362853628636287362883628936290362913629236293362943629536296362973629836299363003630136302363033630436305363063630736308363093631036311363123631336314363153631636317363183631936320363213632236323363243632536326363273632836329363303633136332363333633436335363363633736338363393634036341363423634336344363453634636347363483634936350363513635236353363543635536356363573635836359363603636136362363633636436365363663636736368363693637036371363723637336374363753637636377363783637936380363813638236383363843638536386363873638836389363903639136392363933639436395363963639736398363993640036401364023640336404364053640636407364083640936410364113641236413364143641536416364173641836419364203642136422364233642436425364263642736428364293643036431364323643336434364353643636437364383643936440364413644236443364443644536446364473644836449364503645136452364533645436455364563645736458364593646036461364623646336464364653646636467364683646936470364713647236473364743647536476364773647836479364803648136482364833648436485364863648736488364893649036491364923649336494364953649636497364983649936500365013650236503365043650536506365073650836509365103651136512365133651436515365163651736518365193652036521365223652336524365253652636527365283652936530365313653236533365343653536536365373653836539365403654136542365433654436545365463654736548365493655036551365523655336554365553655636557365583655936560365613656236563365643656536566365673656836569365703657136572365733657436575365763657736578365793658036581365823658336584365853658636587365883658936590365913659236593365943659536596365973659836599366003660136602366033660436605366063660736608366093661036611366123661336614366153661636617366183661936620366213662236623366243662536626366273662836629366303663136632366333663436635366363663736638366393664036641366423664336644366453664636647366483664936650366513665236653366543665536656366573665836659366603666136662366633666436665366663666736668366693667036671366723667336674366753667636677366783667936680366813668236683366843668536686366873668836689366903669136692366933669436695366963669736698366993670036701367023670336704367053670636707367083670936710367113671236713367143671536716367173671836719367203672136722367233672436725367263672736728367293673036731367323673336734367353673636737367383673936740367413674236743367443674536746367473674836749367503675136752367533675436755367563675736758367593676036761367623676336764367653676636767367683676936770367713677236773367743677536776367773677836779367803678136782367833678436785367863678736788367893679036791367923679336794367953679636797367983679936800368013680236803368043680536806368073680836809368103681136812368133681436815368163681736818368193682036821368223682336824368253682636827368283682936830368313683236833368343683536836368373683836839368403684136842368433684436845368463684736848368493685036851368523685336854368553685636857368583685936860368613686236863368643686536866368673686836869368703687136872368733687436875368763687736878368793688036881368823688336884368853688636887368883688936890368913689236893368943689536896368973689836899369003690136902369033690436905369063690736908369093691036911369123691336914369153691636917369183691936920369213692236923369243692536926369273692836929369303693136932369333693436935369363693736938369393694036941369423694336944369453694636947369483694936950369513695236953369543695536956369573695836959369603696136962369633696436965369663696736968369693697036971369723697336974369753697636977369783697936980369813698236983369843698536986369873698836989369903699136992369933699436995369963699736998369993700037001370023700337004370053700637007370083700937010370113701237013370143701537016370173701837019370203702137022370233702437025370263702737028370293703037031370323703337034370353703637037370383703937040370413704237043370443704537046370473704837049370503705137052370533705437055370563705737058370593706037061370623706337064370653706637067370683706937070370713707237073370743707537076370773707837079370803708137082370833708437085370863708737088370893709037091370923709337094370953709637097370983709937100371013710237103371043710537106371073710837109371103711137112371133711437115371163711737118371193712037121371223712337124371253712637127371283712937130371313713237133371343713537136371373713837139371403714137142371433714437145371463714737148371493715037151371523715337154371553715637157371583715937160371613716237163371643716537166371673716837169371703717137172371733717437175371763717737178371793718037181371823718337184371853718637187371883718937190371913719237193371943719537196371973719837199372003720137202372033720437205372063720737208372093721037211372123721337214372153721637217372183721937220372213722237223372243722537226372273722837229372303723137232372333723437235372363723737238372393724037241372423724337244372453724637247372483724937250372513725237253372543725537256372573725837259372603726137262372633726437265372663726737268372693727037271372723727337274372753727637277372783727937280372813728237283372843728537286372873728837289372903729137292372933729437295372963729737298372993730037301373023730337304373053730637307373083730937310373113731237313373143731537316373173731837319373203732137322373233732437325373263732737328373293733037331373323733337334373353733637337373383733937340373413734237343373443734537346373473734837349373503735137352373533735437355373563735737358373593736037361373623736337364373653736637367373683736937370373713737237373373743737537376373773737837379373803738137382373833738437385373863738737388373893739037391373923739337394373953739637397373983739937400374013740237403374043740537406374073740837409374103741137412374133741437415374163741737418374193742037421374223742337424374253742637427374283742937430374313743237433374343743537436374373743837439374403744137442374433744437445374463744737448374493745037451374523745337454374553745637457374583745937460374613746237463374643746537466374673746837469374703747137472374733747437475374763747737478374793748037481374823748337484374853748637487374883748937490374913749237493374943749537496374973749837499375003750137502375033750437505375063750737508375093751037511375123751337514375153751637517375183751937520375213752237523375243752537526375273752837529375303753137532375333753437535375363753737538375393754037541375423754337544375453754637547375483754937550375513755237553375543755537556375573755837559375603756137562375633756437565375663756737568375693757037571375723757337574375753757637577375783757937580375813758237583375843758537586375873758837589375903759137592375933759437595375963759737598375993760037601376023760337604376053760637607376083760937610376113761237613376143761537616376173761837619376203762137622376233762437625376263762737628376293763037631376323763337634376353763637637376383763937640376413764237643376443764537646376473764837649376503765137652376533765437655376563765737658376593766037661376623766337664376653766637667376683766937670376713767237673376743767537676376773767837679376803768137682376833768437685376863768737688376893769037691376923769337694376953769637697376983769937700377013770237703377043770537706377073770837709377103771137712377133771437715377163771737718377193772037721377223772337724377253772637727377283772937730377313773237733377343773537736377373773837739377403774137742377433774437745377463774737748377493775037751377523775337754377553775637757377583775937760377613776237763377643776537766377673776837769377703777137772377733777437775377763777737778377793778037781377823778337784377853778637787377883778937790377913779237793377943779537796377973779837799378003780137802378033780437805378063780737808378093781037811378123781337814378153781637817378183781937820378213782237823378243782537826378273782837829378303783137832378333783437835378363783737838378393784037841378423784337844378453784637847378483784937850378513785237853378543785537856378573785837859378603786137862378633786437865378663786737868378693787037871378723787337874378753787637877378783787937880378813788237883378843788537886378873788837889378903789137892378933789437895378963789737898378993790037901379023790337904379053790637907379083790937910379113791237913379143791537916379173791837919379203792137922379233792437925379263792737928379293793037931379323793337934379353793637937379383793937940379413794237943379443794537946379473794837949379503795137952379533795437955379563795737958379593796037961379623796337964379653796637967379683796937970379713797237973379743797537976379773797837979379803798137982379833798437985379863798737988379893799037991379923799337994379953799637997379983799938000380013800238003380043800538006380073800838009380103801138012380133801438015380163801738018380193802038021380223802338024380253802638027380283802938030380313803238033380343803538036380373803838039380403804138042380433804438045380463804738048380493805038051380523805338054380553805638057380583805938060380613806238063380643806538066380673806838069380703807138072380733807438075380763807738078380793808038081380823808338084380853808638087380883808938090380913809238093380943809538096380973809838099381003810138102381033810438105381063810738108381093811038111381123811338114381153811638117381183811938120381213812238123381243812538126381273812838129381303813138132381333813438135381363813738138381393814038141381423814338144381453814638147381483814938150381513815238153381543815538156381573815838159381603816138162381633816438165381663816738168381693817038171381723817338174381753817638177381783817938180381813818238183381843818538186381873818838189381903819138192381933819438195381963819738198381993820038201382023820338204382053820638207382083820938210382113821238213382143821538216382173821838219382203822138222382233822438225382263822738228382293823038231382323823338234382353823638237382383823938240382413824238243382443824538246382473824838249382503825138252382533825438255382563825738258382593826038261382623826338264382653826638267382683826938270382713827238273382743827538276382773827838279382803828138282382833828438285382863828738288382893829038291382923829338294382953829638297382983829938300383013830238303383043830538306383073830838309383103831138312383133831438315383163831738318383193832038321383223832338324383253832638327383283832938330383313833238333383343833538336383373833838339383403834138342383433834438345383463834738348383493835038351383523835338354383553835638357383583835938360383613836238363383643836538366383673836838369383703837138372383733837438375383763837738378383793838038381383823838338384383853838638387383883838938390383913839238393383943839538396383973839838399384003840138402384033840438405384063840738408384093841038411384123841338414384153841638417384183841938420384213842238423384243842538426384273842838429384303843138432384333843438435384363843738438384393844038441384423844338444384453844638447384483844938450384513845238453384543845538456384573845838459384603846138462384633846438465384663846738468384693847038471384723847338474384753847638477384783847938480384813848238483384843848538486384873848838489384903849138492384933849438495384963849738498384993850038501385023850338504385053850638507385083850938510385113851238513385143851538516385173851838519385203852138522385233852438525385263852738528385293853038531385323853338534385353853638537385383853938540385413854238543385443854538546385473854838549385503855138552385533855438555385563855738558385593856038561385623856338564385653856638567385683856938570385713857238573385743857538576385773857838579385803858138582385833858438585385863858738588385893859038591385923859338594385953859638597385983859938600386013860238603386043860538606386073860838609386103861138612386133861438615386163861738618386193862038621386223862338624386253862638627386283862938630386313863238633386343863538636386373863838639386403864138642386433864438645386463864738648386493865038651386523865338654386553865638657386583865938660386613866238663386643866538666386673866838669386703867138672386733867438675386763867738678386793868038681386823868338684386853868638687386883868938690386913869238693386943869538696386973869838699387003870138702387033870438705387063870738708387093871038711387123871338714387153871638717387183871938720387213872238723387243872538726387273872838729387303873138732387333873438735387363873738738387393874038741387423874338744387453874638747387483874938750387513875238753387543875538756387573875838759387603876138762387633876438765387663876738768387693877038771387723877338774387753877638777387783877938780387813878238783387843878538786387873878838789387903879138792387933879438795387963879738798387993880038801388023880338804388053880638807388083880938810388113881238813388143881538816388173881838819388203882138822388233882438825388263882738828388293883038831388323883338834388353883638837388383883938840388413884238843388443884538846388473884838849388503885138852388533885438855388563885738858388593886038861388623886338864388653886638867388683886938870388713887238873388743887538876388773887838879388803888138882388833888438885388863888738888388893889038891388923889338894388953889638897388983889938900389013890238903389043890538906389073890838909389103891138912389133891438915389163891738918389193892038921389223892338924389253892638927389283892938930389313893238933389343893538936389373893838939389403894138942389433894438945389463894738948389493895038951389523895338954389553895638957389583895938960389613896238963389643896538966389673896838969389703897138972389733897438975389763897738978389793898038981389823898338984389853898638987389883898938990389913899238993389943899538996389973899838999390003900139002390033900439005390063900739008390093901039011390123901339014390153901639017390183901939020390213902239023390243902539026390273902839029390303903139032390333903439035390363903739038390393904039041390423904339044390453904639047390483904939050390513905239053390543905539056390573905839059390603906139062390633906439065390663906739068390693907039071390723907339074390753907639077390783907939080390813908239083390843908539086390873908839089390903909139092390933909439095390963909739098390993910039101391023910339104391053910639107391083910939110391113911239113391143911539116391173911839119391203912139122391233912439125391263912739128391293913039131391323913339134391353913639137391383913939140391413914239143391443914539146391473914839149391503915139152391533915439155391563915739158391593916039161391623916339164391653916639167391683916939170391713917239173391743917539176391773917839179391803918139182391833918439185391863918739188391893919039191391923919339194391953919639197391983919939200392013920239203392043920539206392073920839209392103921139212392133921439215392163921739218392193922039221392223922339224392253922639227392283922939230392313923239233392343923539236392373923839239392403924139242392433924439245392463924739248392493925039251392523925339254392553925639257392583925939260392613926239263392643926539266392673926839269392703927139272392733927439275392763927739278392793928039281392823928339284392853928639287392883928939290392913929239293392943929539296392973929839299393003930139302393033930439305393063930739308393093931039311393123931339314393153931639317393183931939320393213932239323393243932539326393273932839329393303933139332393333933439335393363933739338393393934039341393423934339344393453934639347393483934939350393513935239353393543935539356393573935839359393603936139362393633936439365393663936739368393693937039371393723937339374393753937639377393783937939380393813938239383393843938539386393873938839389393903939139392393933939439395393963939739398393993940039401394023940339404394053940639407394083940939410394113941239413394143941539416394173941839419394203942139422394233942439425394263942739428394293943039431394323943339434394353943639437394383943939440394413944239443394443944539446394473944839449394503945139452394533945439455394563945739458394593946039461394623946339464394653946639467394683946939470394713947239473394743947539476394773947839479394803948139482394833948439485394863948739488394893949039491394923949339494394953949639497394983949939500395013950239503395043950539506395073950839509395103951139512395133951439515395163951739518395193952039521395223952339524395253952639527395283952939530395313953239533395343953539536395373953839539395403954139542395433954439545395463954739548395493955039551395523955339554395553955639557395583955939560395613956239563395643956539566395673956839569395703957139572395733957439575395763957739578395793958039581395823958339584395853958639587395883958939590395913959239593395943959539596395973959839599396003960139602396033960439605396063960739608396093961039611396123961339614396153961639617396183961939620396213962239623396243962539626396273962839629396303963139632396333963439635396363963739638396393964039641396423964339644396453964639647396483964939650396513965239653396543965539656396573965839659396603966139662396633966439665396663966739668396693967039671396723967339674396753967639677396783967939680396813968239683396843968539686396873968839689396903969139692396933969439695396963969739698396993970039701397023970339704397053970639707397083970939710397113971239713397143971539716397173971839719397203972139722397233972439725397263972739728397293973039731397323973339734397353973639737397383973939740397413974239743397443974539746397473974839749397503975139752397533975439755397563975739758397593976039761397623976339764397653976639767397683976939770397713977239773397743977539776397773977839779397803978139782397833978439785397863978739788397893979039791397923979339794397953979639797397983979939800398013980239803398043980539806398073980839809398103981139812398133981439815398163981739818398193982039821398223982339824398253982639827398283982939830398313983239833398343983539836398373983839839398403984139842398433984439845398463984739848398493985039851398523985339854398553985639857398583985939860398613986239863398643986539866398673986839869398703987139872398733987439875398763987739878398793988039881398823988339884398853988639887398883988939890398913989239893398943989539896398973989839899399003990139902399033990439905399063990739908399093991039911399123991339914399153991639917399183991939920399213992239923399243992539926399273992839929399303993139932399333993439935399363993739938399393994039941399423994339944399453994639947399483994939950399513995239953399543995539956399573995839959399603996139962399633996439965399663996739968399693997039971399723997339974399753997639977399783997939980399813998239983399843998539986399873998839989399903999139992399933999439995399963999739998399994000040001400024000340004400054000640007400084000940010400114001240013400144001540016400174001840019400204002140022400234002440025400264002740028400294003040031400324003340034400354003640037400384003940040400414004240043400444004540046400474004840049400504005140052400534005440055400564005740058400594006040061400624006340064400654006640067400684006940070400714007240073400744007540076400774007840079400804008140082400834008440085400864008740088400894009040091400924009340094400954009640097400984009940100401014010240103401044010540106401074010840109401104011140112401134011440115401164011740118401194012040121401224012340124401254012640127401284012940130401314013240133401344013540136401374013840139401404014140142401434014440145401464014740148401494015040151401524015340154401554015640157401584015940160401614016240163401644016540166401674016840169401704017140172401734017440175401764017740178401794018040181401824018340184401854018640187401884018940190401914019240193401944019540196401974019840199402004020140202402034020440205402064020740208402094021040211402124021340214402154021640217402184021940220402214022240223402244022540226402274022840229402304023140232402334023440235402364023740238402394024040241402424024340244402454024640247402484024940250402514025240253402544025540256402574025840259402604026140262402634026440265402664026740268402694027040271402724027340274402754027640277402784027940280402814028240283402844028540286402874028840289402904029140292402934029440295402964029740298402994030040301403024030340304403054030640307403084030940310403114031240313403144031540316403174031840319403204032140322403234032440325403264032740328403294033040331403324033340334403354033640337403384033940340403414034240343403444034540346403474034840349403504035140352403534035440355403564035740358403594036040361403624036340364403654036640367403684036940370403714037240373403744037540376403774037840379403804038140382403834038440385403864038740388403894039040391403924039340394403954039640397403984039940400404014040240403404044040540406404074040840409404104041140412404134041440415404164041740418404194042040421404224042340424404254042640427404284042940430404314043240433404344043540436404374043840439404404044140442404434044440445404464044740448404494045040451404524045340454404554045640457404584045940460404614046240463404644046540466404674046840469404704047140472404734047440475404764047740478404794048040481404824048340484404854048640487404884048940490404914049240493404944049540496404974049840499405004050140502405034050440505405064050740508405094051040511405124051340514405154051640517405184051940520405214052240523405244052540526405274052840529405304053140532405334053440535405364053740538405394054040541405424054340544405454054640547405484054940550405514055240553405544055540556405574055840559405604056140562405634056440565405664056740568405694057040571405724057340574405754057640577405784057940580405814058240583405844058540586405874058840589405904059140592405934059440595405964059740598405994060040601406024060340604406054060640607406084060940610406114061240613406144061540616406174061840619406204062140622406234062440625406264062740628406294063040631406324063340634406354063640637406384063940640406414064240643406444064540646406474064840649406504065140652406534065440655406564065740658406594066040661406624066340664406654066640667406684066940670406714067240673406744067540676406774067840679406804068140682406834068440685406864068740688406894069040691406924069340694406954069640697406984069940700407014070240703407044070540706407074070840709407104071140712407134071440715407164071740718407194072040721407224072340724407254072640727407284072940730407314073240733407344073540736407374073840739407404074140742407434074440745407464074740748407494075040751407524075340754407554075640757407584075940760407614076240763407644076540766407674076840769407704077140772407734077440775407764077740778407794078040781407824078340784407854078640787407884078940790407914079240793407944079540796407974079840799408004080140802408034080440805408064080740808408094081040811408124081340814408154081640817408184081940820408214082240823408244082540826408274082840829408304083140832408334083440835408364083740838408394084040841408424084340844408454084640847408484084940850408514085240853408544085540856408574085840859408604086140862408634086440865408664086740868408694087040871408724087340874408754087640877408784087940880408814088240883408844088540886408874088840889408904089140892408934089440895408964089740898408994090040901409024090340904409054090640907409084090940910409114091240913409144091540916409174091840919409204092140922409234092440925409264092740928409294093040931409324093340934409354093640937409384093940940409414094240943409444094540946409474094840949409504095140952409534095440955409564095740958409594096040961409624096340964409654096640967409684096940970409714097240973409744097540976409774097840979409804098140982409834098440985409864098740988409894099040991409924099340994409954099640997409984099941000410014100241003410044100541006410074100841009410104101141012410134101441015410164101741018410194102041021410224102341024410254102641027410284102941030410314103241033410344103541036410374103841039410404104141042410434104441045410464104741048410494105041051410524105341054410554105641057410584105941060410614106241063410644106541066410674106841069410704107141072410734107441075410764107741078410794108041081410824108341084410854108641087410884108941090410914109241093410944109541096410974109841099411004110141102411034110441105411064110741108411094111041111411124111341114411154111641117411184111941120411214112241123411244112541126411274112841129411304113141132411334113441135411364113741138411394114041141411424114341144411454114641147411484114941150411514115241153411544115541156411574115841159411604116141162411634116441165411664116741168411694117041171411724117341174411754117641177411784117941180411814118241183411844118541186411874118841189411904119141192411934119441195411964119741198411994120041201412024120341204412054120641207412084120941210412114121241213412144121541216412174121841219412204122141222412234122441225412264122741228412294123041231412324123341234412354123641237412384123941240412414124241243412444124541246412474124841249412504125141252412534125441255412564125741258412594126041261412624126341264412654126641267412684126941270412714127241273412744127541276412774127841279412804128141282412834128441285412864128741288412894129041291412924129341294412954129641297412984129941300413014130241303413044130541306413074130841309413104131141312413134131441315413164131741318413194132041321413224132341324413254132641327413284132941330413314133241333413344133541336413374133841339413404134141342413434134441345413464134741348413494135041351413524135341354413554135641357413584135941360413614136241363413644136541366413674136841369413704137141372413734137441375413764137741378413794138041381413824138341384413854138641387413884138941390413914139241393413944139541396413974139841399414004140141402414034140441405414064140741408414094141041411414124141341414414154141641417414184141941420414214142241423414244142541426414274142841429414304143141432414334143441435414364143741438414394144041441414424144341444414454144641447414484144941450414514145241453414544145541456414574145841459414604146141462414634146441465414664146741468414694147041471414724147341474414754147641477414784147941480414814148241483414844148541486414874148841489414904149141492414934149441495414964149741498414994150041501415024150341504415054150641507415084150941510415114151241513415144151541516415174151841519415204152141522415234152441525415264152741528415294153041531415324153341534415354153641537415384153941540415414154241543415444154541546415474154841549415504155141552415534155441555415564155741558415594156041561415624156341564415654156641567415684156941570415714157241573415744157541576415774157841579415804158141582415834158441585415864158741588415894159041591415924159341594415954159641597415984159941600416014160241603416044160541606416074160841609416104161141612416134161441615416164161741618416194162041621416224162341624416254162641627416284162941630416314163241633416344163541636416374163841639416404164141642416434164441645416464164741648416494165041651416524165341654416554165641657416584165941660416614166241663416644166541666416674166841669416704167141672416734167441675416764167741678416794168041681416824168341684416854168641687416884168941690416914169241693416944169541696416974169841699417004170141702417034170441705417064170741708417094171041711417124171341714417154171641717417184171941720417214172241723417244172541726417274172841729417304173141732417334173441735417364173741738417394174041741417424174341744417454174641747417484174941750417514175241753417544175541756417574175841759417604176141762417634176441765417664176741768417694177041771417724177341774417754177641777417784177941780417814178241783417844178541786417874178841789417904179141792417934179441795417964179741798417994180041801418024180341804418054180641807418084180941810418114181241813418144181541816418174181841819418204182141822418234182441825418264182741828418294183041831418324183341834418354183641837418384183941840418414184241843418444184541846418474184841849418504185141852418534185441855418564185741858418594186041861418624186341864418654186641867418684186941870418714187241873418744187541876418774187841879418804188141882418834188441885418864188741888418894189041891418924189341894418954189641897418984189941900419014190241903419044190541906419074190841909419104191141912419134191441915419164191741918419194192041921419224192341924419254192641927419284192941930419314193241933419344193541936419374193841939419404194141942419434194441945419464194741948419494195041951419524195341954419554195641957419584195941960419614196241963419644196541966419674196841969419704197141972419734197441975419764197741978419794198041981419824198341984419854198641987419884198941990419914199241993419944199541996419974199841999420004200142002420034200442005420064200742008420094201042011420124201342014420154201642017420184201942020420214202242023420244202542026420274202842029420304203142032420334203442035420364203742038420394204042041420424204342044420454204642047420484204942050420514205242053420544205542056420574205842059420604206142062420634206442065420664206742068420694207042071420724207342074420754207642077420784207942080420814208242083420844208542086420874208842089420904209142092420934209442095420964209742098420994210042101421024210342104421054210642107421084210942110421114211242113421144211542116421174211842119421204212142122421234212442125421264212742128421294213042131421324213342134421354213642137421384213942140421414214242143421444214542146421474214842149421504215142152421534215442155421564215742158421594216042161421624216342164421654216642167421684216942170421714217242173421744217542176421774217842179421804218142182421834218442185421864218742188421894219042191421924219342194421954219642197421984219942200422014220242203422044220542206422074220842209422104221142212422134221442215422164221742218422194222042221422224222342224422254222642227422284222942230422314223242233422344223542236422374223842239422404224142242422434224442245422464224742248422494225042251422524225342254422554225642257422584225942260422614226242263422644226542266422674226842269422704227142272422734227442275422764227742278422794228042281422824228342284422854228642287422884228942290422914229242293422944229542296422974229842299423004230142302423034230442305423064230742308423094231042311423124231342314423154231642317423184231942320423214232242323423244232542326423274232842329423304233142332423334233442335423364233742338423394234042341423424234342344423454234642347423484234942350423514235242353423544235542356423574235842359423604236142362423634236442365423664236742368423694237042371423724237342374423754237642377423784237942380423814238242383423844238542386423874238842389423904239142392423934239442395423964239742398423994240042401424024240342404424054240642407424084240942410424114241242413424144241542416424174241842419424204242142422424234242442425424264242742428424294243042431424324243342434424354243642437424384243942440424414244242443424444244542446424474244842449424504245142452424534245442455424564245742458424594246042461424624246342464424654246642467424684246942470424714247242473424744247542476424774247842479424804248142482424834248442485424864248742488424894249042491424924249342494424954249642497424984249942500425014250242503425044250542506425074250842509425104251142512425134251442515425164251742518425194252042521425224252342524425254252642527425284252942530425314253242533425344253542536425374253842539425404254142542425434254442545425464254742548425494255042551425524255342554425554255642557425584255942560425614256242563425644256542566425674256842569425704257142572425734257442575425764257742578425794258042581425824258342584425854258642587425884258942590425914259242593425944259542596425974259842599426004260142602426034260442605426064260742608426094261042611426124261342614426154261642617426184261942620426214262242623426244262542626426274262842629426304263142632426334263442635426364263742638426394264042641426424264342644426454264642647426484264942650426514265242653426544265542656426574265842659426604266142662426634266442665426664266742668426694267042671426724267342674426754267642677426784267942680426814268242683426844268542686426874268842689426904269142692426934269442695426964269742698426994270042701427024270342704427054270642707427084270942710427114271242713427144271542716427174271842719427204272142722427234272442725427264272742728427294273042731427324273342734427354273642737427384273942740427414274242743427444274542746427474274842749427504275142752427534275442755427564275742758427594276042761427624276342764427654276642767427684276942770427714277242773427744277542776427774277842779427804278142782427834278442785427864278742788427894279042791427924279342794427954279642797427984279942800428014280242803428044280542806428074280842809428104281142812428134281442815428164281742818428194282042821428224282342824428254282642827428284282942830428314283242833428344283542836428374283842839428404284142842428434284442845428464284742848428494285042851428524285342854428554285642857428584285942860428614286242863428644286542866428674286842869428704287142872428734287442875428764287742878428794288042881428824288342884428854288642887428884288942890428914289242893428944289542896428974289842899429004290142902429034290442905429064290742908429094291042911429124291342914429154291642917429184291942920429214292242923429244292542926429274292842929429304293142932429334293442935429364293742938429394294042941429424294342944429454294642947429484294942950429514295242953429544295542956429574295842959429604296142962429634296442965429664296742968429694297042971429724297342974429754297642977429784297942980429814298242983429844298542986429874298842989429904299142992429934299442995429964299742998429994300043001430024300343004430054300643007430084300943010430114301243013430144301543016430174301843019430204302143022430234302443025430264302743028430294303043031430324303343034430354303643037430384303943040430414304243043430444304543046430474304843049430504305143052430534305443055430564305743058430594306043061430624306343064430654306643067430684306943070430714307243073430744307543076430774307843079430804308143082430834308443085430864308743088430894309043091430924309343094430954309643097430984309943100431014310243103431044310543106431074310843109431104311143112431134311443115431164311743118431194312043121431224312343124431254312643127431284312943130431314313243133431344313543136431374313843139431404314143142431434314443145431464314743148431494315043151431524315343154431554315643157431584315943160431614316243163431644316543166431674316843169431704317143172431734317443175431764317743178431794318043181431824318343184431854318643187431884318943190431914319243193431944319543196431974319843199432004320143202432034320443205432064320743208432094321043211432124321343214432154321643217432184321943220432214322243223432244322543226432274322843229432304323143232432334323443235432364323743238432394324043241432424324343244432454324643247432484324943250432514325243253432544325543256432574325843259432604326143262432634326443265432664326743268432694327043271432724327343274432754327643277432784327943280432814328243283432844328543286432874328843289432904329143292432934329443295432964329743298432994330043301433024330343304433054330643307433084330943310433114331243313433144331543316433174331843319433204332143322433234332443325433264332743328433294333043331433324333343334433354333643337433384333943340433414334243343433444334543346433474334843349433504335143352433534335443355433564335743358433594336043361433624336343364433654336643367433684336943370433714337243373433744337543376433774337843379433804338143382433834338443385433864338743388433894339043391433924339343394433954339643397433984339943400434014340243403434044340543406434074340843409434104341143412434134341443415434164341743418434194342043421434224342343424434254342643427434284342943430434314343243433434344343543436434374343843439434404344143442434434344443445434464344743448434494345043451434524345343454434554345643457434584345943460434614346243463434644346543466434674346843469434704347143472434734347443475434764347743478434794348043481434824348343484434854348643487434884348943490434914349243493434944349543496434974349843499435004350143502435034350443505435064350743508435094351043511435124351343514435154351643517435184351943520435214352243523435244352543526435274352843529435304353143532435334353443535435364353743538435394354043541435424354343544435454354643547435484354943550435514355243553435544355543556435574355843559435604356143562435634356443565435664356743568435694357043571435724357343574435754357643577435784357943580435814358243583435844358543586435874358843589435904359143592435934359443595435964359743598435994360043601436024360343604436054360643607436084360943610436114361243613436144361543616436174361843619436204362143622436234362443625436264362743628436294363043631436324363343634436354363643637436384363943640436414364243643436444364543646436474364843649436504365143652436534365443655436564365743658436594366043661436624366343664436654366643667436684366943670436714367243673436744367543676436774367843679436804368143682436834368443685436864368743688436894369043691436924369343694436954369643697436984369943700437014370243703437044370543706437074370843709437104371143712437134371443715437164371743718437194372043721437224372343724437254372643727437284372943730437314373243733437344373543736437374373843739437404374143742437434374443745437464374743748437494375043751437524375343754437554375643757437584375943760437614376243763437644376543766437674376843769437704377143772437734377443775437764377743778437794378043781437824378343784437854378643787437884378943790437914379243793437944379543796437974379843799438004380143802438034380443805438064380743808438094381043811438124381343814438154381643817438184381943820438214382243823438244382543826438274382843829438304383143832438334383443835438364383743838438394384043841438424384343844438454384643847438484384943850438514385243853438544385543856438574385843859438604386143862438634386443865438664386743868438694387043871438724387343874438754387643877438784387943880438814388243883438844388543886438874388843889438904389143892438934389443895438964389743898438994390043901439024390343904439054390643907439084390943910439114391243913439144391543916439174391843919439204392143922439234392443925439264392743928439294393043931439324393343934439354393643937439384393943940439414394243943439444394543946439474394843949439504395143952439534395443955439564395743958439594396043961439624396343964439654396643967439684396943970439714397243973439744397543976439774397843979439804398143982439834398443985439864398743988439894399043991439924399343994439954399643997439984399944000440014400244003440044400544006440074400844009440104401144012440134401444015440164401744018440194402044021440224402344024440254402644027440284402944030440314403244033440344403544036440374403844039440404404144042440434404444045440464404744048440494405044051440524405344054440554405644057440584405944060440614406244063440644406544066440674406844069440704407144072440734407444075440764407744078440794408044081440824408344084440854408644087440884408944090440914409244093440944409544096440974409844099441004410144102441034410444105441064410744108441094411044111441124411344114441154411644117441184411944120441214412244123441244412544126441274412844129441304413144132441334413444135441364413744138441394414044141441424414344144441454414644147441484414944150441514415244153441544415544156441574415844159441604416144162441634416444165441664416744168441694417044171441724417344174441754417644177441784417944180441814418244183441844418544186441874418844189441904419144192441934419444195441964419744198441994420044201442024420344204442054420644207442084420944210442114421244213442144421544216442174421844219442204422144222442234422444225442264422744228442294423044231442324423344234442354423644237442384423944240442414424244243442444424544246442474424844249442504425144252442534425444255442564425744258442594426044261442624426344264442654426644267442684426944270442714427244273442744427544276442774427844279442804428144282442834428444285442864428744288442894429044291442924429344294442954429644297442984429944300443014430244303443044430544306443074430844309443104431144312443134431444315443164431744318443194432044321443224432344324443254432644327443284432944330443314433244333443344433544336443374433844339443404434144342443434434444345443464434744348443494435044351443524435344354443554435644357443584435944360443614436244363443644436544366443674436844369443704437144372443734437444375443764437744378443794438044381443824438344384443854438644387443884438944390443914439244393443944439544396443974439844399444004440144402444034440444405444064440744408444094441044411444124441344414444154441644417444184441944420444214442244423444244442544426444274442844429444304443144432444334443444435444364443744438444394444044441444424444344444444454444644447444484444944450444514445244453444544445544456444574445844459444604446144462444634446444465444664446744468444694447044471444724447344474444754447644477444784447944480444814448244483444844448544486444874448844489444904449144492444934449444495444964449744498444994450044501445024450344504445054450644507445084450944510445114451244513445144451544516445174451844519445204452144522445234452444525445264452744528445294453044531445324453344534445354453644537445384453944540445414454244543445444454544546445474454844549445504455144552445534455444555445564455744558445594456044561445624456344564445654456644567445684456944570445714457244573445744457544576445774457844579445804458144582445834458444585445864458744588445894459044591445924459344594445954459644597445984459944600446014460244603446044460544606446074460844609446104461144612446134461444615446164461744618446194462044621446224462344624446254462644627446284462944630446314463244633446344463544636446374463844639446404464144642446434464444645446464464744648446494465044651446524465344654446554465644657446584465944660446614466244663446644466544666446674466844669446704467144672446734467444675446764467744678446794468044681446824468344684446854468644687446884468944690446914469244693446944469544696446974469844699447004470144702447034470444705447064470744708447094471044711447124471344714447154471644717447184471944720447214472244723447244472544726447274472844729447304473144732447334473444735447364473744738447394474044741447424474344744447454474644747447484474944750447514475244753447544475544756447574475844759447604476144762447634476444765447664476744768447694477044771447724477344774447754477644777447784477944780447814478244783447844478544786447874478844789447904479144792447934479444795447964479744798447994480044801448024480344804448054480644807448084480944810448114481244813448144481544816448174481844819448204482144822448234482444825448264482744828448294483044831448324483344834448354483644837448384483944840448414484244843448444484544846448474484844849448504485144852448534485444855448564485744858448594486044861448624486344864448654486644867448684486944870448714487244873448744487544876448774487844879448804488144882448834488444885448864488744888448894489044891448924489344894448954489644897448984489944900449014490244903449044490544906449074490844909449104491144912449134491444915449164491744918449194492044921449224492344924449254492644927449284492944930449314493244933449344493544936449374493844939449404494144942449434494444945449464494744948449494495044951449524495344954449554495644957449584495944960449614496244963449644496544966449674496844969449704497144972449734497444975449764497744978449794498044981449824498344984449854498644987449884498944990449914499244993449944499544996449974499844999450004500145002450034500445005450064500745008450094501045011450124501345014450154501645017450184501945020450214502245023450244502545026450274502845029450304503145032450334503445035450364503745038450394504045041450424504345044450454504645047450484504945050450514505245053450544505545056450574505845059450604506145062450634506445065450664506745068450694507045071450724507345074450754507645077450784507945080450814508245083450844508545086450874508845089450904509145092450934509445095450964509745098450994510045101451024510345104451054510645107451084510945110451114511245113451144511545116451174511845119451204512145122451234512445125451264512745128451294513045131451324513345134451354513645137451384513945140451414514245143451444514545146451474514845149451504515145152451534515445155451564515745158451594516045161451624516345164451654516645167451684516945170451714517245173451744517545176451774517845179451804518145182451834518445185451864518745188451894519045191451924519345194451954519645197451984519945200452014520245203452044520545206452074520845209452104521145212452134521445215452164521745218452194522045221452224522345224452254522645227452284522945230452314523245233452344523545236452374523845239452404524145242452434524445245452464524745248452494525045251452524525345254452554525645257452584525945260452614526245263452644526545266452674526845269452704527145272452734527445275452764527745278452794528045281452824528345284452854528645287452884528945290452914529245293452944529545296452974529845299453004530145302453034530445305453064530745308453094531045311453124531345314453154531645317453184531945320453214532245323453244532545326453274532845329453304533145332453334533445335453364533745338453394534045341453424534345344453454534645347453484534945350453514535245353453544535545356453574535845359453604536145362453634536445365453664536745368453694537045371453724537345374453754537645377453784537945380453814538245383453844538545386453874538845389453904539145392453934539445395453964539745398453994540045401454024540345404454054540645407454084540945410454114541245413454144541545416454174541845419454204542145422454234542445425454264542745428454294543045431454324543345434454354543645437454384543945440454414544245443454444544545446454474544845449454504545145452454534545445455454564545745458454594546045461454624546345464454654546645467454684546945470454714547245473454744547545476454774547845479454804548145482454834548445485454864548745488454894549045491454924549345494454954549645497454984549945500455014550245503455044550545506455074550845509455104551145512455134551445515455164551745518455194552045521455224552345524455254552645527455284552945530455314553245533455344553545536455374553845539455404554145542455434554445545455464554745548455494555045551455524555345554455554555645557455584555945560455614556245563455644556545566455674556845569455704557145572455734557445575455764557745578455794558045581455824558345584455854558645587455884558945590455914559245593455944559545596455974559845599456004560145602456034560445605456064560745608456094561045611456124561345614456154561645617456184561945620456214562245623456244562545626456274562845629456304563145632456334563445635456364563745638456394564045641456424564345644456454564645647456484564945650456514565245653456544565545656456574565845659456604566145662456634566445665456664566745668456694567045671456724567345674456754567645677456784567945680456814568245683456844568545686456874568845689456904569145692456934569445695456964569745698456994570045701457024570345704457054570645707457084570945710457114571245713457144571545716457174571845719457204572145722457234572445725457264572745728457294573045731457324573345734457354573645737457384573945740457414574245743457444574545746457474574845749457504575145752457534575445755457564575745758457594576045761457624576345764457654576645767457684576945770457714577245773457744577545776457774577845779457804578145782457834578445785457864578745788457894579045791457924579345794457954579645797457984579945800458014580245803458044580545806458074580845809458104581145812458134581445815458164581745818458194582045821458224582345824458254582645827458284582945830458314583245833458344583545836458374583845839458404584145842458434584445845458464584745848458494585045851458524585345854458554585645857458584585945860458614586245863458644586545866458674586845869458704587145872458734587445875458764587745878458794588045881458824588345884458854588645887458884588945890458914589245893458944589545896458974589845899459004590145902459034590445905459064590745908459094591045911459124591345914459154591645917459184591945920459214592245923459244592545926459274592845929459304593145932459334593445935459364593745938459394594045941459424594345944459454594645947459484594945950459514595245953459544595545956459574595845959459604596145962459634596445965459664596745968459694597045971459724597345974459754597645977459784597945980459814598245983459844598545986459874598845989459904599145992459934599445995459964599745998459994600046001460024600346004460054600646007460084600946010460114601246013460144601546016460174601846019460204602146022460234602446025460264602746028460294603046031460324603346034460354603646037460384603946040460414604246043460444604546046460474604846049460504605146052460534605446055460564605746058460594606046061460624606346064460654606646067460684606946070460714607246073460744607546076460774607846079460804608146082460834608446085460864608746088460894609046091460924609346094460954609646097460984609946100461014610246103461044610546106461074610846109461104611146112461134611446115461164611746118461194612046121461224612346124461254612646127461284612946130461314613246133461344613546136461374613846139461404614146142461434614446145461464614746148461494615046151461524615346154461554615646157461584615946160461614616246163461644616546166461674616846169461704617146172461734617446175461764617746178461794618046181461824618346184461854618646187461884618946190461914619246193461944619546196461974619846199462004620146202462034620446205462064620746208462094621046211462124621346214462154621646217462184621946220462214622246223462244622546226462274622846229462304623146232462334623446235462364623746238462394624046241462424624346244462454624646247462484624946250462514625246253462544625546256462574625846259462604626146262462634626446265462664626746268462694627046271462724627346274462754627646277462784627946280462814628246283462844628546286462874628846289462904629146292462934629446295462964629746298462994630046301463024630346304463054630646307463084630946310463114631246313463144631546316463174631846319463204632146322463234632446325463264632746328463294633046331463324633346334463354633646337463384633946340463414634246343463444634546346463474634846349463504635146352463534635446355463564635746358463594636046361463624636346364463654636646367463684636946370463714637246373463744637546376463774637846379463804638146382463834638446385463864638746388463894639046391463924639346394463954639646397463984639946400464014640246403464044640546406464074640846409464104641146412464134641446415464164641746418464194642046421464224642346424464254642646427464284642946430464314643246433464344643546436464374643846439464404644146442464434644446445464464644746448464494645046451464524645346454464554645646457464584645946460464614646246463464644646546466464674646846469464704647146472464734647446475464764647746478464794648046481464824648346484464854648646487464884648946490464914649246493464944649546496464974649846499465004650146502465034650446505465064650746508465094651046511465124651346514465154651646517465184651946520465214652246523465244652546526465274652846529465304653146532465334653446535465364653746538465394654046541465424654346544465454654646547465484654946550465514655246553465544655546556465574655846559465604656146562465634656446565465664656746568465694657046571465724657346574465754657646577465784657946580465814658246583465844658546586465874658846589465904659146592465934659446595465964659746598465994660046601466024660346604466054660646607466084660946610466114661246613466144661546616466174661846619466204662146622466234662446625466264662746628466294663046631466324663346634466354663646637466384663946640466414664246643466444664546646466474664846649466504665146652466534665446655466564665746658466594666046661466624666346664466654666646667466684666946670466714667246673466744667546676466774667846679466804668146682466834668446685466864668746688466894669046691466924669346694466954669646697466984669946700467014670246703467044670546706467074670846709467104671146712467134671446715467164671746718467194672046721467224672346724467254672646727467284672946730467314673246733467344673546736467374673846739467404674146742467434674446745467464674746748467494675046751467524675346754467554675646757467584675946760467614676246763467644676546766467674676846769467704677146772467734677446775467764677746778467794678046781467824678346784467854678646787467884678946790467914679246793467944679546796467974679846799468004680146802468034680446805468064680746808468094681046811468124681346814468154681646817468184681946820468214682246823468244682546826468274682846829468304683146832468334683446835468364683746838468394684046841468424684346844468454684646847468484684946850468514685246853468544685546856468574685846859468604686146862468634686446865468664686746868468694687046871468724687346874468754687646877468784687946880468814688246883468844688546886468874688846889468904689146892468934689446895468964689746898468994690046901469024690346904469054690646907469084690946910469114691246913469144691546916469174691846919469204692146922469234692446925469264692746928469294693046931469324693346934469354693646937469384693946940469414694246943469444694546946469474694846949469504695146952469534695446955469564695746958469594696046961469624696346964469654696646967469684696946970469714697246973469744697546976469774697846979469804698146982469834698446985469864698746988469894699046991469924699346994469954699646997469984699947000470014700247003470044700547006470074700847009470104701147012470134701447015470164701747018470194702047021470224702347024470254702647027470284702947030470314703247033470344703547036470374703847039470404704147042470434704447045470464704747048470494705047051470524705347054470554705647057470584705947060470614706247063470644706547066470674706847069470704707147072470734707447075470764707747078470794708047081470824708347084470854708647087470884708947090470914709247093470944709547096470974709847099471004710147102471034710447105471064710747108471094711047111471124711347114471154711647117471184711947120471214712247123471244712547126471274712847129471304713147132471334713447135471364713747138471394714047141471424714347144471454714647147471484714947150471514715247153471544715547156471574715847159471604716147162471634716447165471664716747168471694717047171471724717347174471754717647177471784717947180471814718247183471844718547186471874718847189471904719147192471934719447195471964719747198471994720047201472024720347204472054720647207472084720947210472114721247213472144721547216472174721847219472204722147222472234722447225472264722747228472294723047231472324723347234472354723647237472384723947240472414724247243472444724547246472474724847249472504725147252472534725447255472564725747258472594726047261472624726347264472654726647267472684726947270472714727247273472744727547276472774727847279472804728147282472834728447285472864728747288472894729047291472924729347294472954729647297472984729947300473014730247303473044730547306473074730847309473104731147312473134731447315473164731747318473194732047321473224732347324473254732647327473284732947330473314733247333473344733547336473374733847339473404734147342473434734447345473464734747348473494735047351473524735347354473554735647357473584735947360473614736247363473644736547366473674736847369473704737147372473734737447375473764737747378473794738047381473824738347384473854738647387473884738947390473914739247393473944739547396473974739847399474004740147402474034740447405474064740747408474094741047411474124741347414474154741647417474184741947420474214742247423474244742547426474274742847429474304743147432474334743447435474364743747438474394744047441474424744347444474454744647447474484744947450474514745247453474544745547456474574745847459474604746147462474634746447465474664746747468474694747047471474724747347474474754747647477474784747947480474814748247483474844748547486474874748847489474904749147492474934749447495474964749747498474994750047501475024750347504475054750647507475084750947510475114751247513475144751547516475174751847519475204752147522475234752447525475264752747528475294753047531475324753347534475354753647537475384753947540475414754247543475444754547546475474754847549475504755147552475534755447555475564755747558475594756047561475624756347564475654756647567475684756947570475714757247573475744757547576475774757847579475804758147582475834758447585475864758747588475894759047591475924759347594475954759647597475984759947600476014760247603476044760547606476074760847609476104761147612476134761447615476164761747618476194762047621476224762347624476254762647627476284762947630476314763247633476344763547636476374763847639476404764147642476434764447645476464764747648476494765047651476524765347654476554765647657476584765947660476614766247663476644766547666476674766847669476704767147672476734767447675476764767747678476794768047681476824768347684476854768647687476884768947690476914769247693476944769547696476974769847699477004770147702477034770447705477064770747708477094771047711477124771347714477154771647717477184771947720477214772247723477244772547726477274772847729477304773147732477334773447735477364773747738477394774047741477424774347744477454774647747477484774947750477514775247753477544775547756477574775847759477604776147762477634776447765477664776747768477694777047771477724777347774477754777647777477784777947780477814778247783477844778547786477874778847789477904779147792477934779447795477964779747798477994780047801478024780347804478054780647807478084780947810478114781247813478144781547816478174781847819478204782147822478234782447825478264782747828478294783047831478324783347834478354783647837478384783947840478414784247843478444784547846478474784847849478504785147852478534785447855478564785747858478594786047861478624786347864478654786647867478684786947870478714787247873478744787547876478774787847879478804788147882478834788447885478864788747888478894789047891478924789347894478954789647897478984789947900479014790247903479044790547906479074790847909479104791147912479134791447915479164791747918479194792047921479224792347924479254792647927479284792947930479314793247933479344793547936479374793847939479404794147942479434794447945479464794747948479494795047951479524795347954479554795647957479584795947960479614796247963479644796547966479674796847969479704797147972479734797447975479764797747978479794798047981479824798347984479854798647987479884798947990479914799247993479944799547996479974799847999480004800148002480034800448005480064800748008480094801048011480124801348014480154801648017480184801948020480214802248023480244802548026480274802848029480304803148032480334803448035480364803748038480394804048041480424804348044480454804648047480484804948050480514805248053480544805548056480574805848059480604806148062480634806448065480664806748068480694807048071480724807348074480754807648077480784807948080480814808248083480844808548086480874808848089480904809148092480934809448095480964809748098480994810048101481024810348104481054810648107481084810948110481114811248113481144811548116481174811848119481204812148122481234812448125481264812748128481294813048131481324813348134481354813648137481384813948140481414814248143481444814548146481474814848149481504815148152481534815448155481564815748158481594816048161481624816348164481654816648167481684816948170481714817248173481744817548176481774817848179481804818148182481834818448185481864818748188481894819048191481924819348194481954819648197481984819948200482014820248203482044820548206482074820848209482104821148212482134821448215482164821748218482194822048221482224822348224482254822648227482284822948230482314823248233482344823548236482374823848239482404824148242482434824448245482464824748248482494825048251482524825348254482554825648257482584825948260482614826248263482644826548266482674826848269482704827148272482734827448275482764827748278482794828048281482824828348284482854828648287482884828948290482914829248293482944829548296482974829848299483004830148302483034830448305483064830748308483094831048311483124831348314483154831648317483184831948320483214832248323483244832548326483274832848329483304833148332483334833448335483364833748338483394834048341483424834348344483454834648347483484834948350483514835248353483544835548356483574835848359483604836148362483634836448365483664836748368483694837048371483724837348374483754837648377483784837948380483814838248383483844838548386483874838848389483904839148392483934839448395483964839748398483994840048401484024840348404484054840648407484084840948410484114841248413484144841548416484174841848419484204842148422484234842448425484264842748428484294843048431484324843348434484354843648437484384843948440484414844248443484444844548446484474844848449484504845148452484534845448455484564845748458484594846048461484624846348464484654846648467484684846948470484714847248473484744847548476484774847848479484804848148482484834848448485484864848748488484894849048491484924849348494484954849648497484984849948500485014850248503485044850548506485074850848509485104851148512485134851448515485164851748518485194852048521485224852348524485254852648527485284852948530485314853248533485344853548536485374853848539485404854148542485434854448545485464854748548485494855048551485524855348554485554855648557485584855948560485614856248563485644856548566485674856848569485704857148572485734857448575485764857748578485794858048581485824858348584485854858648587485884858948590485914859248593485944859548596485974859848599486004860148602486034860448605486064860748608486094861048611486124861348614486154861648617486184861948620486214862248623486244862548626486274862848629486304863148632486334863448635486364863748638486394864048641486424864348644486454864648647486484864948650486514865248653486544865548656486574865848659486604866148662486634866448665486664866748668486694867048671486724867348674486754867648677486784867948680486814868248683486844868548686486874868848689486904869148692486934869448695486964869748698486994870048701487024870348704487054870648707487084870948710487114871248713487144871548716487174871848719487204872148722487234872448725487264872748728487294873048731487324873348734487354873648737487384873948740487414874248743487444874548746487474874848749487504875148752487534875448755487564875748758487594876048761487624876348764487654876648767487684876948770487714877248773487744877548776487774877848779487804878148782487834878448785487864878748788487894879048791487924879348794487954879648797487984879948800488014880248803488044880548806488074880848809488104881148812488134881448815488164881748818488194882048821488224882348824488254882648827488284882948830488314883248833488344883548836488374883848839488404884148842488434884448845488464884748848488494885048851488524885348854488554885648857488584885948860488614886248863488644886548866488674886848869488704887148872488734887448875488764887748878488794888048881488824888348884488854888648887488884888948890488914889248893488944889548896488974889848899489004890148902489034890448905489064890748908489094891048911489124891348914489154891648917489184891948920489214892248923489244892548926489274892848929489304893148932489334893448935489364893748938489394894048941489424894348944489454894648947489484894948950489514895248953489544895548956489574895848959489604896148962489634896448965489664896748968489694897048971489724897348974489754897648977489784897948980489814898248983489844898548986489874898848989489904899148992489934899448995489964899748998489994900049001490024900349004490054900649007490084900949010490114901249013490144901549016490174901849019490204902149022490234902449025490264902749028490294903049031490324903349034490354903649037490384903949040490414904249043490444904549046490474904849049490504905149052490534905449055490564905749058490594906049061490624906349064490654906649067490684906949070490714907249073490744907549076490774907849079490804908149082490834908449085490864908749088490894909049091490924909349094490954909649097490984909949100491014910249103491044910549106491074910849109491104911149112491134911449115491164911749118491194912049121491224912349124491254912649127491284912949130491314913249133491344913549136491374913849139491404914149142491434914449145491464914749148491494915049151491524915349154491554915649157491584915949160491614916249163491644916549166491674916849169491704917149172491734917449175491764917749178491794918049181491824918349184491854918649187491884918949190491914919249193491944919549196491974919849199492004920149202492034920449205492064920749208492094921049211492124921349214492154921649217492184921949220492214922249223492244922549226492274922849229492304923149232492334923449235492364923749238492394924049241492424924349244492454924649247492484924949250492514925249253492544925549256492574925849259492604926149262492634926449265492664926749268492694927049271492724927349274492754927649277492784927949280492814928249283492844928549286492874928849289492904929149292492934929449295492964929749298492994930049301493024930349304493054930649307493084930949310493114931249313493144931549316493174931849319493204932149322493234932449325493264932749328493294933049331493324933349334493354933649337493384933949340493414934249343493444934549346493474934849349493504935149352493534935449355493564935749358493594936049361493624936349364493654936649367493684936949370493714937249373493744937549376493774937849379493804938149382493834938449385493864938749388493894939049391493924939349394493954939649397493984939949400494014940249403494044940549406494074940849409494104941149412494134941449415494164941749418494194942049421494224942349424494254942649427494284942949430494314943249433494344943549436494374943849439494404944149442494434944449445494464944749448494494945049451494524945349454494554945649457494584945949460494614946249463494644946549466494674946849469494704947149472494734947449475494764947749478494794948049481494824948349484494854948649487494884948949490494914949249493494944949549496494974949849499495004950149502495034950449505495064950749508495094951049511495124951349514495154951649517495184951949520495214952249523495244952549526495274952849529495304953149532495334953449535495364953749538495394954049541495424954349544495454954649547495484954949550495514955249553495544955549556495574955849559495604956149562495634956449565495664956749568495694957049571495724957349574495754957649577495784957949580495814958249583495844958549586495874958849589495904959149592495934959449595495964959749598495994960049601496024960349604496054960649607496084960949610496114961249613496144961549616496174961849619496204962149622496234962449625496264962749628496294963049631496324963349634496354963649637496384963949640496414964249643496444964549646496474964849649496504965149652496534965449655496564965749658496594966049661496624966349664496654966649667496684966949670496714967249673496744967549676496774967849679496804968149682496834968449685496864968749688496894969049691496924969349694496954969649697496984969949700497014970249703497044970549706497074970849709497104971149712497134971449715497164971749718497194972049721497224972349724497254972649727497284972949730497314973249733497344973549736497374973849739497404974149742497434974449745497464974749748497494975049751497524975349754497554975649757497584975949760497614976249763497644976549766497674976849769497704977149772497734977449775497764977749778497794978049781497824978349784497854978649787497884978949790497914979249793497944979549796497974979849799498004980149802498034980449805498064980749808498094981049811498124981349814498154981649817498184981949820498214982249823498244982549826498274982849829498304983149832498334983449835498364983749838498394984049841498424984349844498454984649847498484984949850498514985249853498544985549856498574985849859498604986149862498634986449865498664986749868498694987049871498724987349874498754987649877498784987949880498814988249883498844988549886498874988849889498904989149892498934989449895498964989749898498994990049901499024990349904499054990649907499084990949910499114991249913499144991549916499174991849919499204992149922499234992449925499264992749928499294993049931499324993349934499354993649937499384993949940499414994249943499444994549946499474994849949499504995149952499534995449955499564995749958499594996049961499624996349964499654996649967499684996949970499714997249973499744997549976499774997849979499804998149982499834998449985499864998749988499894999049991499924999349994499954999649997499984999950000500015000250003500045000550006500075000850009500105001150012500135001450015500165001750018500195002050021500225002350024500255002650027500285002950030500315003250033500345003550036500375003850039500405004150042500435004450045500465004750048500495005050051500525005350054500555005650057500585005950060500615006250063500645006550066500675006850069500705007150072500735007450075500765007750078500795008050081500825008350084500855008650087500885008950090500915009250093500945009550096500975009850099501005010150102501035010450105501065010750108501095011050111501125011350114501155011650117501185011950120501215012250123501245012550126501275012850129501305013150132501335013450135501365013750138501395014050141501425014350144501455014650147501485014950150501515015250153501545015550156501575015850159501605016150162501635016450165501665016750168501695017050171501725017350174501755017650177501785017950180501815018250183501845018550186501875018850189501905019150192501935019450195501965019750198501995020050201502025020350204502055020650207502085020950210502115021250213502145021550216502175021850219502205022150222502235022450225502265022750228502295023050231502325023350234502355023650237502385023950240502415024250243502445024550246502475024850249502505025150252502535025450255502565025750258502595026050261502625026350264502655026650267502685026950270502715027250273502745027550276502775027850279502805028150282502835028450285502865028750288502895029050291502925029350294502955029650297502985029950300503015030250303503045030550306503075030850309503105031150312503135031450315503165031750318503195032050321503225032350324503255032650327503285032950330503315033250333503345033550336503375033850339503405034150342503435034450345503465034750348503495035050351503525035350354503555035650357503585035950360503615036250363503645036550366503675036850369503705037150372503735037450375503765037750378503795038050381503825038350384503855038650387503885038950390503915039250393503945039550396503975039850399504005040150402504035040450405504065040750408504095041050411504125041350414504155041650417504185041950420504215042250423504245042550426504275042850429504305043150432504335043450435504365043750438504395044050441504425044350444504455044650447504485044950450504515045250453504545045550456504575045850459504605046150462504635046450465504665046750468504695047050471504725047350474504755047650477504785047950480504815048250483504845048550486504875048850489504905049150492504935049450495504965049750498504995050050501505025050350504505055050650507505085050950510505115051250513505145051550516505175051850519505205052150522505235052450525505265052750528505295053050531505325053350534505355053650537505385053950540505415054250543505445054550546505475054850549505505055150552505535055450555505565055750558505595056050561505625056350564505655056650567505685056950570505715057250573505745057550576505775057850579505805058150582505835058450585505865058750588505895059050591505925059350594505955059650597505985059950600506015060250603506045060550606506075060850609506105061150612506135061450615506165061750618506195062050621506225062350624506255062650627506285062950630506315063250633506345063550636506375063850639506405064150642506435064450645506465064750648506495065050651506525065350654506555065650657506585065950660506615066250663506645066550666506675066850669506705067150672506735067450675506765067750678506795068050681506825068350684506855068650687506885068950690506915069250693506945069550696506975069850699507005070150702507035070450705507065070750708507095071050711507125071350714507155071650717507185071950720507215072250723507245072550726507275072850729507305073150732507335073450735507365073750738507395074050741507425074350744507455074650747507485074950750507515075250753507545075550756507575075850759507605076150762507635076450765507665076750768507695077050771507725077350774507755077650777507785077950780507815078250783507845078550786507875078850789507905079150792507935079450795507965079750798507995080050801508025080350804508055080650807508085080950810508115081250813508145081550816508175081850819508205082150822508235082450825508265082750828508295083050831508325083350834508355083650837508385083950840508415084250843508445084550846508475084850849508505085150852508535085450855508565085750858508595086050861508625086350864508655086650867508685086950870508715087250873508745087550876508775087850879508805088150882508835088450885508865088750888508895089050891508925089350894508955089650897508985089950900509015090250903509045090550906509075090850909509105091150912509135091450915509165091750918509195092050921509225092350924509255092650927509285092950930509315093250933509345093550936509375093850939509405094150942509435094450945509465094750948509495095050951509525095350954509555095650957509585095950960509615096250963509645096550966509675096850969509705097150972509735097450975509765097750978509795098050981509825098350984509855098650987509885098950990509915099250993509945099550996509975099850999510005100151002510035100451005510065100751008510095101051011510125101351014510155101651017510185101951020510215102251023510245102551026510275102851029510305103151032510335103451035510365103751038510395104051041510425104351044510455104651047510485104951050510515105251053510545105551056510575105851059510605106151062510635106451065510665106751068510695107051071510725107351074510755107651077510785107951080510815108251083510845108551086510875108851089510905109151092510935109451095510965109751098510995110051101511025110351104511055110651107511085110951110511115111251113511145111551116511175111851119511205112151122511235112451125511265112751128511295113051131511325113351134511355113651137511385113951140511415114251143511445114551146511475114851149511505115151152511535115451155511565115751158511595116051161511625116351164511655116651167511685116951170511715117251173511745117551176511775117851179511805118151182511835118451185511865118751188511895119051191511925119351194511955119651197511985119951200512015120251203512045120551206512075120851209512105121151212512135121451215512165121751218512195122051221512225122351224512255122651227512285122951230512315123251233512345123551236512375123851239512405124151242512435124451245512465124751248512495125051251512525125351254512555125651257512585125951260512615126251263512645126551266512675126851269512705127151272512735127451275512765127751278512795128051281512825128351284512855128651287512885128951290512915129251293512945129551296512975129851299513005130151302513035130451305513065130751308513095131051311513125131351314513155131651317513185131951320513215132251323513245132551326513275132851329513305133151332513335133451335513365133751338513395134051341513425134351344513455134651347513485134951350513515135251353513545135551356513575135851359513605136151362513635136451365513665136751368513695137051371513725137351374513755137651377513785137951380513815138251383513845138551386513875138851389513905139151392513935139451395513965139751398513995140051401514025140351404514055140651407514085140951410514115141251413514145141551416514175141851419514205142151422514235142451425514265142751428514295143051431514325143351434514355143651437514385143951440514415144251443514445144551446514475144851449514505145151452514535145451455514565145751458514595146051461514625146351464514655146651467514685146951470514715147251473514745147551476514775147851479514805148151482514835148451485514865148751488514895149051491514925149351494514955149651497514985149951500515015150251503515045150551506515075150851509515105151151512515135151451515515165151751518515195152051521515225152351524515255152651527515285152951530515315153251533515345153551536515375153851539515405154151542515435154451545515465154751548515495155051551515525155351554515555155651557515585155951560515615156251563515645156551566515675156851569515705157151572515735157451575515765157751578515795158051581515825158351584515855158651587515885158951590515915159251593515945159551596515975159851599516005160151602516035160451605516065160751608516095161051611516125161351614516155161651617516185161951620516215162251623516245162551626516275162851629516305163151632516335163451635516365163751638516395164051641516425164351644516455164651647516485164951650516515165251653516545165551656516575165851659516605166151662516635166451665516665166751668516695167051671516725167351674516755167651677516785167951680516815168251683516845168551686516875168851689516905169151692516935169451695516965169751698516995170051701517025170351704517055170651707517085170951710517115171251713517145171551716517175171851719517205172151722517235172451725517265172751728517295173051731517325173351734517355173651737517385173951740517415174251743517445174551746517475174851749517505175151752517535175451755517565175751758517595176051761517625176351764517655176651767517685176951770517715177251773517745177551776517775177851779517805178151782517835178451785517865178751788517895179051791517925179351794517955179651797517985179951800518015180251803518045180551806518075180851809518105181151812518135181451815518165181751818518195182051821518225182351824518255182651827518285182951830518315183251833518345183551836518375183851839518405184151842518435184451845518465184751848518495185051851518525185351854518555185651857518585185951860518615186251863518645186551866518675186851869518705187151872518735187451875518765187751878518795188051881518825188351884518855188651887518885188951890518915189251893518945189551896518975189851899519005190151902519035190451905519065190751908519095191051911519125191351914519155191651917519185191951920519215192251923519245192551926519275192851929519305193151932519335193451935519365193751938519395194051941519425194351944519455194651947519485194951950519515195251953519545195551956519575195851959519605196151962519635196451965519665196751968519695197051971519725197351974519755197651977519785197951980519815198251983519845198551986519875198851989519905199151992519935199451995519965199751998519995200052001520025200352004520055200652007520085200952010520115201252013520145201552016520175201852019520205202152022520235202452025520265202752028520295203052031520325203352034520355203652037520385203952040520415204252043520445204552046520475204852049520505205152052520535205452055520565205752058520595206052061520625206352064520655206652067520685206952070520715207252073520745207552076520775207852079520805208152082520835208452085520865208752088520895209052091520925209352094520955209652097520985209952100521015210252103521045210552106521075210852109521105211152112521135211452115521165211752118521195212052121521225212352124521255212652127521285212952130521315213252133521345213552136521375213852139521405214152142521435214452145521465214752148521495215052151521525215352154521555215652157521585215952160521615216252163521645216552166521675216852169521705217152172521735217452175521765217752178521795218052181521825218352184521855218652187521885218952190521915219252193521945219552196521975219852199522005220152202522035220452205522065220752208522095221052211522125221352214522155221652217522185221952220522215222252223522245222552226522275222852229522305223152232522335223452235522365223752238522395224052241522425224352244522455224652247522485224952250522515225252253522545225552256522575225852259522605226152262522635226452265522665226752268522695227052271522725227352274522755227652277522785227952280522815228252283522845228552286522875228852289522905229152292522935229452295522965229752298522995230052301523025230352304523055230652307523085230952310523115231252313523145231552316523175231852319523205232152322523235232452325523265232752328523295233052331523325233352334523355233652337523385233952340523415234252343523445234552346523475234852349523505235152352523535235452355523565235752358523595236052361523625236352364523655236652367523685236952370523715237252373523745237552376523775237852379523805238152382523835238452385523865238752388523895239052391523925239352394523955239652397523985239952400524015240252403524045240552406524075240852409524105241152412524135241452415524165241752418524195242052421524225242352424524255242652427524285242952430524315243252433524345243552436524375243852439524405244152442524435244452445524465244752448524495245052451524525245352454524555245652457524585245952460524615246252463524645246552466524675246852469524705247152472524735247452475524765247752478524795248052481524825248352484524855248652487524885248952490524915249252493524945249552496524975249852499525005250152502525035250452505525065250752508525095251052511525125251352514525155251652517525185251952520525215252252523525245252552526525275252852529525305253152532525335253452535525365253752538525395254052541525425254352544525455254652547525485254952550525515255252553525545255552556525575255852559525605256152562525635256452565525665256752568525695257052571525725257352574525755257652577525785257952580525815258252583525845258552586525875258852589525905259152592525935259452595525965259752598525995260052601526025260352604526055260652607526085260952610526115261252613526145261552616526175261852619526205262152622526235262452625526265262752628526295263052631526325263352634526355263652637526385263952640526415264252643526445264552646526475264852649526505265152652526535265452655526565265752658526595266052661526625266352664526655266652667526685266952670526715267252673526745267552676526775267852679526805268152682526835268452685526865268752688526895269052691526925269352694526955269652697526985269952700527015270252703527045270552706527075270852709527105271152712527135271452715527165271752718527195272052721527225272352724527255272652727527285272952730527315273252733527345273552736527375273852739527405274152742527435274452745527465274752748527495275052751527525275352754527555275652757527585275952760527615276252763527645276552766527675276852769527705277152772527735277452775527765277752778527795278052781527825278352784527855278652787527885278952790527915279252793527945279552796527975279852799528005280152802528035280452805528065280752808528095281052811528125281352814528155281652817528185281952820528215282252823528245282552826528275282852829528305283152832528335283452835528365283752838528395284052841528425284352844528455284652847528485284952850528515285252853528545285552856528575285852859528605286152862528635286452865528665286752868528695287052871528725287352874528755287652877528785287952880528815288252883528845288552886528875288852889528905289152892528935289452895528965289752898528995290052901529025290352904529055290652907529085290952910529115291252913529145291552916529175291852919529205292152922529235292452925529265292752928529295293052931529325293352934529355293652937529385293952940529415294252943529445294552946529475294852949529505295152952529535295452955529565295752958529595296052961529625296352964529655296652967529685296952970529715297252973529745297552976529775297852979529805298152982529835298452985529865298752988529895299052991529925299352994529955299652997529985299953000530015300253003530045300553006530075300853009530105301153012530135301453015530165301753018530195302053021530225302353024530255302653027530285302953030530315303253033530345303553036530375303853039530405304153042530435304453045530465304753048530495305053051530525305353054530555305653057530585305953060530615306253063530645306553066530675306853069530705307153072530735307453075530765307753078530795308053081530825308353084530855308653087530885308953090530915309253093530945309553096530975309853099531005310153102531035310453105531065310753108531095311053111531125311353114531155311653117531185311953120531215312253123531245312553126531275312853129531305313153132531335313453135531365313753138531395314053141531425314353144531455314653147531485314953150531515315253153531545315553156531575315853159531605316153162531635316453165531665316753168531695317053171531725317353174531755317653177531785317953180531815318253183531845318553186531875318853189531905319153192531935319453195531965319753198531995320053201532025320353204532055320653207532085320953210532115321253213532145321553216532175321853219532205322153222532235322453225532265322753228532295323053231532325323353234532355323653237532385323953240532415324253243532445324553246532475324853249532505325153252532535325453255532565325753258532595326053261532625326353264532655326653267532685326953270532715327253273532745327553276532775327853279532805328153282532835328453285532865328753288532895329053291532925329353294532955329653297532985329953300533015330253303533045330553306533075330853309533105331153312533135331453315533165331753318533195332053321533225332353324533255332653327533285332953330533315333253333533345333553336533375333853339533405334153342533435334453345533465334753348533495335053351533525335353354533555335653357533585335953360533615336253363533645336553366533675336853369533705337153372533735337453375533765337753378533795338053381533825338353384533855338653387533885338953390533915339253393533945339553396533975339853399534005340153402534035340453405534065340753408534095341053411534125341353414534155341653417534185341953420534215342253423534245342553426534275342853429534305343153432534335343453435534365343753438534395344053441534425344353444534455344653447534485344953450534515345253453534545345553456534575345853459534605346153462534635346453465534665346753468534695347053471534725347353474534755347653477534785347953480534815348253483534845348553486534875348853489534905349153492534935349453495534965349753498534995350053501535025350353504535055350653507535085350953510535115351253513535145351553516535175351853519535205352153522535235352453525535265352753528535295353053531535325353353534535355353653537535385353953540535415354253543535445354553546535475354853549535505355153552535535355453555535565355753558535595356053561535625356353564535655356653567535685356953570535715357253573535745357553576535775357853579535805358153582535835358453585535865358753588535895359053591535925359353594535955359653597535985359953600536015360253603536045360553606536075360853609536105361153612536135361453615536165361753618536195362053621536225362353624536255362653627536285362953630536315363253633536345363553636536375363853639536405364153642536435364453645536465364753648536495365053651536525365353654536555365653657536585365953660536615366253663536645366553666536675366853669536705367153672536735367453675536765367753678536795368053681536825368353684536855368653687536885368953690536915369253693536945369553696536975369853699537005370153702537035370453705537065370753708537095371053711537125371353714537155371653717537185371953720537215372253723537245372553726537275372853729537305373153732537335373453735537365373753738537395374053741537425374353744537455374653747537485374953750537515375253753537545375553756537575375853759537605376153762537635376453765537665376753768537695377053771537725377353774537755377653777537785377953780537815378253783537845378553786537875378853789537905379153792537935379453795537965379753798537995380053801538025380353804538055380653807538085380953810538115381253813538145381553816538175381853819538205382153822538235382453825538265382753828538295383053831538325383353834538355383653837538385383953840538415384253843538445384553846538475384853849538505385153852538535385453855538565385753858538595386053861538625386353864538655386653867538685386953870538715387253873538745387553876538775387853879538805388153882538835388453885538865388753888538895389053891538925389353894538955389653897538985389953900539015390253903539045390553906539075390853909539105391153912539135391453915539165391753918539195392053921539225392353924539255392653927539285392953930539315393253933539345393553936539375393853939539405394153942539435394453945539465394753948539495395053951539525395353954539555395653957539585395953960539615396253963539645396553966539675396853969539705397153972539735397453975539765397753978539795398053981539825398353984539855398653987539885398953990539915399253993539945399553996539975399853999540005400154002540035400454005540065400754008540095401054011540125401354014540155401654017540185401954020540215402254023540245402554026540275402854029540305403154032540335403454035540365403754038540395404054041540425404354044540455404654047540485404954050540515405254053540545405554056540575405854059540605406154062540635406454065540665406754068540695407054071540725407354074540755407654077540785407954080540815408254083540845408554086540875408854089540905409154092540935409454095540965409754098540995410054101541025410354104541055410654107541085410954110541115411254113541145411554116541175411854119541205412154122541235412454125541265412754128541295413054131541325413354134541355413654137541385413954140541415414254143541445414554146541475414854149541505415154152541535415454155541565415754158541595416054161541625416354164541655416654167541685416954170541715417254173541745417554176541775417854179541805418154182541835418454185541865418754188541895419054191541925419354194541955419654197541985419954200542015420254203542045420554206542075420854209542105421154212542135421454215542165421754218542195422054221542225422354224542255422654227542285422954230542315423254233542345423554236542375423854239542405424154242542435424454245542465424754248542495425054251542525425354254542555425654257542585425954260542615426254263542645426554266542675426854269542705427154272542735427454275542765427754278542795428054281542825428354284542855428654287542885428954290542915429254293542945429554296542975429854299543005430154302543035430454305543065430754308543095431054311543125431354314543155431654317543185431954320543215432254323543245432554326543275432854329543305433154332543335433454335543365433754338543395434054341543425434354344543455434654347543485434954350543515435254353543545435554356543575435854359543605436154362543635436454365543665436754368543695437054371543725437354374543755437654377543785437954380543815438254383543845438554386543875438854389543905439154392543935439454395543965439754398543995440054401544025440354404544055440654407544085440954410544115441254413544145441554416544175441854419544205442154422544235442454425544265442754428544295443054431544325443354434544355443654437544385443954440544415444254443544445444554446544475444854449544505445154452544535445454455544565445754458544595446054461544625446354464544655446654467544685446954470544715447254473544745447554476544775447854479544805448154482544835448454485544865448754488544895449054491544925449354494544955449654497544985449954500545015450254503545045450554506545075450854509545105451154512545135451454515545165451754518545195452054521545225452354524545255452654527545285452954530545315453254533545345453554536545375453854539545405454154542545435454454545545465454754548545495455054551545525455354554545555455654557545585455954560545615456254563545645456554566545675456854569545705457154572545735457454575545765457754578545795458054581545825458354584545855458654587545885458954590545915459254593545945459554596545975459854599546005460154602546035460454605546065460754608546095461054611546125461354614546155461654617546185461954620546215462254623546245462554626546275462854629546305463154632546335463454635546365463754638546395464054641546425464354644546455464654647546485464954650546515465254653546545465554656546575465854659546605466154662546635466454665546665466754668546695467054671546725467354674546755467654677546785467954680546815468254683546845468554686546875468854689546905469154692546935469454695546965469754698546995470054701547025470354704547055470654707547085470954710547115471254713547145471554716547175471854719547205472154722547235472454725547265472754728547295473054731547325473354734547355473654737547385473954740547415474254743547445474554746547475474854749547505475154752547535475454755547565475754758547595476054761547625476354764547655476654767547685476954770547715477254773547745477554776547775477854779547805478154782547835478454785547865478754788547895479054791547925479354794547955479654797547985479954800548015480254803548045480554806548075480854809548105481154812548135481454815548165481754818548195482054821548225482354824548255482654827548285482954830548315483254833548345483554836548375483854839548405484154842548435484454845548465484754848548495485054851548525485354854548555485654857548585485954860548615486254863548645486554866548675486854869548705487154872548735487454875548765487754878548795488054881548825488354884548855488654887548885488954890548915489254893548945489554896548975489854899549005490154902549035490454905549065490754908549095491054911549125491354914549155491654917549185491954920549215492254923549245492554926549275492854929549305493154932549335493454935549365493754938549395494054941549425494354944549455494654947549485494954950549515495254953549545495554956549575495854959549605496154962549635496454965549665496754968549695497054971549725497354974549755497654977549785497954980549815498254983549845498554986549875498854989549905499154992549935499454995549965499754998549995500055001550025500355004550055500655007550085500955010550115501255013550145501555016550175501855019550205502155022550235502455025550265502755028550295503055031550325503355034550355503655037550385503955040550415504255043550445504555046550475504855049550505505155052550535505455055550565505755058550595506055061550625506355064550655506655067550685506955070550715507255073550745507555076550775507855079550805508155082550835508455085550865508755088550895509055091550925509355094550955509655097550985509955100551015510255103551045510555106551075510855109551105511155112551135511455115551165511755118551195512055121551225512355124551255512655127551285512955130551315513255133551345513555136551375513855139551405514155142551435514455145551465514755148551495515055151551525515355154551555515655157551585515955160551615516255163551645516555166551675516855169551705517155172551735517455175551765517755178551795518055181551825518355184551855518655187551885518955190551915519255193551945519555196551975519855199552005520155202552035520455205552065520755208552095521055211552125521355214552155521655217552185521955220552215522255223552245522555226552275522855229552305523155232552335523455235552365523755238552395524055241552425524355244552455524655247552485524955250552515525255253552545525555256552575525855259552605526155262552635526455265552665526755268552695527055271552725527355274552755527655277552785527955280552815528255283552845528555286552875528855289552905529155292552935529455295552965529755298552995530055301553025530355304553055530655307553085530955310553115531255313553145531555316553175531855319553205532155322553235532455325553265532755328553295533055331553325533355334553355533655337553385533955340553415534255343553445534555346553475534855349553505535155352553535535455355553565535755358553595536055361553625536355364553655536655367553685536955370553715537255373553745537555376553775537855379553805538155382553835538455385553865538755388553895539055391553925539355394553955539655397553985539955400554015540255403554045540555406554075540855409554105541155412554135541455415554165541755418554195542055421554225542355424554255542655427554285542955430554315543255433554345543555436554375543855439554405544155442554435544455445554465544755448554495545055451554525545355454554555545655457554585545955460554615546255463554645546555466554675546855469554705547155472554735547455475554765547755478554795548055481554825548355484554855548655487554885548955490554915549255493554945549555496554975549855499555005550155502555035550455505555065550755508555095551055511555125551355514555155551655517555185551955520555215552255523555245552555526555275552855529555305553155532555335553455535555365553755538555395554055541555425554355544555455554655547555485554955550555515555255553555545555555556555575555855559555605556155562555635556455565555665556755568555695557055571555725557355574555755557655577555785557955580555815558255583555845558555586555875558855589555905559155592555935559455595555965559755598555995560055601556025560355604556055560655607556085560955610556115561255613556145561555616556175561855619556205562155622556235562455625556265562755628556295563055631556325563355634556355563655637556385563955640556415564255643556445564555646556475564855649556505565155652556535565455655556565565755658556595566055661556625566355664556655566655667556685566955670556715567255673556745567555676556775567855679556805568155682556835568455685556865568755688556895569055691556925569355694556955569655697556985569955700557015570255703557045570555706557075570855709557105571155712557135571455715557165571755718557195572055721557225572355724557255572655727557285572955730557315573255733557345573555736557375573855739557405574155742557435574455745557465574755748557495575055751557525575355754557555575655757557585575955760557615576255763557645576555766557675576855769557705577155772557735577455775557765577755778557795578055781557825578355784557855578655787557885578955790557915579255793557945579555796557975579855799558005580155802558035580455805558065580755808558095581055811558125581355814558155581655817558185581955820558215582255823558245582555826558275582855829558305583155832558335583455835558365583755838558395584055841558425584355844558455584655847558485584955850558515585255853558545585555856558575585855859558605586155862558635586455865558665586755868558695587055871558725587355874558755587655877558785587955880558815588255883558845588555886558875588855889558905589155892558935589455895558965589755898558995590055901559025590355904559055590655907559085590955910559115591255913559145591555916559175591855919559205592155922559235592455925559265592755928559295593055931559325593355934559355593655937559385593955940559415594255943559445594555946559475594855949559505595155952559535595455955559565595755958559595596055961559625596355964559655596655967559685596955970559715597255973559745597555976559775597855979559805598155982559835598455985559865598755988559895599055991559925599355994559955599655997559985599956000560015600256003560045600556006560075600856009560105601156012560135601456015560165601756018560195602056021560225602356024560255602656027560285602956030560315603256033560345603556036560375603856039560405604156042560435604456045560465604756048560495605056051560525605356054560555605656057560585605956060560615606256063560645606556066560675606856069560705607156072560735607456075560765607756078560795608056081560825608356084560855608656087560885608956090560915609256093560945609556096560975609856099561005610156102561035610456105561065610756108561095611056111561125611356114561155611656117561185611956120561215612256123561245612556126561275612856129561305613156132561335613456135561365613756138561395614056141561425614356144561455614656147561485614956150561515615256153561545615556156561575615856159561605616156162561635616456165561665616756168561695617056171561725617356174561755617656177561785617956180561815618256183561845618556186561875618856189561905619156192561935619456195561965619756198561995620056201562025620356204562055620656207562085620956210562115621256213562145621556216562175621856219562205622156222562235622456225562265622756228562295623056231562325623356234562355623656237562385623956240562415624256243562445624556246562475624856249562505625156252562535625456255562565625756258562595626056261562625626356264562655626656267562685626956270562715627256273562745627556276562775627856279562805628156282562835628456285562865628756288562895629056291562925629356294562955629656297562985629956300563015630256303563045630556306563075630856309563105631156312563135631456315563165631756318563195632056321563225632356324563255632656327563285632956330563315633256333563345633556336563375633856339563405634156342563435634456345563465634756348563495635056351563525635356354563555635656357563585635956360563615636256363563645636556366563675636856369563705637156372563735637456375563765637756378563795638056381563825638356384563855638656387563885638956390563915639256393563945639556396563975639856399564005640156402564035640456405564065640756408564095641056411564125641356414564155641656417564185641956420564215642256423564245642556426564275642856429564305643156432564335643456435564365643756438564395644056441564425644356444564455644656447564485644956450564515645256453564545645556456564575645856459564605646156462564635646456465564665646756468564695647056471564725647356474564755647656477564785647956480564815648256483564845648556486564875648856489564905649156492564935649456495564965649756498564995650056501565025650356504565055650656507565085650956510565115651256513565145651556516565175651856519565205652156522565235652456525565265652756528565295653056531565325653356534565355653656537565385653956540565415654256543565445654556546565475654856549565505655156552565535655456555565565655756558565595656056561565625656356564565655656656567565685656956570565715657256573565745657556576565775657856579565805658156582565835658456585565865658756588565895659056591565925659356594565955659656597565985659956600566015660256603566045660556606566075660856609566105661156612566135661456615566165661756618566195662056621566225662356624566255662656627566285662956630566315663256633566345663556636566375663856639566405664156642566435664456645566465664756648566495665056651566525665356654566555665656657566585665956660566615666256663566645666556666566675666856669566705667156672566735667456675566765667756678566795668056681566825668356684566855668656687566885668956690566915669256693566945669556696566975669856699567005670156702567035670456705567065670756708567095671056711567125671356714567155671656717567185671956720567215672256723567245672556726567275672856729567305673156732567335673456735567365673756738567395674056741567425674356744567455674656747567485674956750567515675256753567545675556756567575675856759567605676156762567635676456765567665676756768567695677056771567725677356774567755677656777567785677956780567815678256783567845678556786567875678856789567905679156792567935679456795567965679756798567995680056801568025680356804568055680656807568085680956810568115681256813568145681556816568175681856819568205682156822568235682456825568265682756828568295683056831568325683356834568355683656837568385683956840568415684256843568445684556846568475684856849568505685156852568535685456855568565685756858568595686056861568625686356864568655686656867568685686956870568715687256873568745687556876568775687856879568805688156882568835688456885568865688756888568895689056891568925689356894568955689656897568985689956900569015690256903569045690556906569075690856909569105691156912569135691456915569165691756918569195692056921569225692356924569255692656927569285692956930569315693256933569345693556936569375693856939569405694156942569435694456945569465694756948569495695056951569525695356954569555695656957569585695956960569615696256963569645696556966569675696856969569705697156972569735697456975569765697756978569795698056981569825698356984569855698656987569885698956990569915699256993569945699556996569975699856999570005700157002570035700457005570065700757008570095701057011570125701357014570155701657017570185701957020570215702257023570245702557026570275702857029570305703157032570335703457035570365703757038570395704057041570425704357044570455704657047570485704957050570515705257053570545705557056570575705857059570605706157062570635706457065570665706757068570695707057071570725707357074570755707657077570785707957080570815708257083570845708557086570875708857089570905709157092570935709457095570965709757098570995710057101571025710357104571055710657107571085710957110571115711257113571145711557116571175711857119571205712157122571235712457125571265712757128571295713057131571325713357134571355713657137571385713957140571415714257143571445714557146571475714857149571505715157152571535715457155571565715757158571595716057161571625716357164571655716657167571685716957170571715717257173571745717557176571775717857179571805718157182571835718457185571865718757188571895719057191571925719357194571955719657197571985719957200572015720257203572045720557206572075720857209572105721157212572135721457215572165721757218572195722057221572225722357224572255722657227572285722957230572315723257233572345723557236572375723857239572405724157242572435724457245572465724757248572495725057251572525725357254572555725657257572585725957260572615726257263572645726557266572675726857269572705727157272572735727457275572765727757278572795728057281572825728357284572855728657287572885728957290572915729257293572945729557296572975729857299573005730157302573035730457305573065730757308573095731057311573125731357314573155731657317573185731957320573215732257323573245732557326573275732857329573305733157332573335733457335573365733757338573395734057341573425734357344573455734657347573485734957350573515735257353573545735557356573575735857359573605736157362573635736457365573665736757368573695737057371573725737357374573755737657377573785737957380573815738257383573845738557386573875738857389573905739157392573935739457395573965739757398573995740057401574025740357404574055740657407574085740957410574115741257413574145741557416574175741857419574205742157422574235742457425574265742757428574295743057431574325743357434574355743657437574385743957440574415744257443574445744557446574475744857449574505745157452574535745457455574565745757458574595746057461574625746357464574655746657467574685746957470574715747257473574745747557476574775747857479574805748157482574835748457485574865748757488574895749057491574925749357494574955749657497574985749957500575015750257503575045750557506575075750857509575105751157512575135751457515575165751757518575195752057521575225752357524575255752657527575285752957530575315753257533575345753557536575375753857539575405754157542575435754457545575465754757548575495755057551575525755357554575555755657557575585755957560575615756257563575645756557566575675756857569575705757157572575735757457575575765757757578575795758057581575825758357584575855758657587575885758957590575915759257593575945759557596575975759857599576005760157602576035760457605576065760757608576095761057611576125761357614576155761657617576185761957620576215762257623576245762557626576275762857629576305763157632576335763457635576365763757638576395764057641576425764357644576455764657647576485764957650576515765257653576545765557656576575765857659576605766157662576635766457665576665766757668576695767057671576725767357674576755767657677576785767957680576815768257683576845768557686576875768857689576905769157692576935769457695576965769757698576995770057701577025770357704577055770657707577085770957710577115771257713577145771557716577175771857719577205772157722577235772457725577265772757728577295773057731577325773357734577355773657737577385773957740577415774257743577445774557746577475774857749577505775157752577535775457755577565775757758577595776057761577625776357764577655776657767577685776957770577715777257773577745777557776577775777857779577805778157782577835778457785577865778757788577895779057791577925779357794577955779657797577985779957800578015780257803578045780557806578075780857809578105781157812578135781457815578165781757818578195782057821578225782357824578255782657827578285782957830578315783257833578345783557836578375783857839578405784157842578435784457845578465784757848578495785057851578525785357854578555785657857578585785957860578615786257863578645786557866578675786857869578705787157872578735787457875578765787757878578795788057881578825788357884578855788657887578885788957890578915789257893578945789557896578975789857899579005790157902579035790457905579065790757908579095791057911579125791357914579155791657917579185791957920579215792257923579245792557926579275792857929579305793157932579335793457935579365793757938579395794057941579425794357944579455794657947579485794957950579515795257953579545795557956579575795857959579605796157962579635796457965579665796757968579695797057971579725797357974579755797657977579785797957980579815798257983579845798557986579875798857989579905799157992579935799457995579965799757998579995800058001580025800358004580055800658007580085800958010580115801258013580145801558016580175801858019580205802158022580235802458025580265802758028580295803058031580325803358034580355803658037580385803958040580415804258043580445804558046580475804858049580505805158052580535805458055580565805758058580595806058061580625806358064580655806658067580685806958070580715807258073580745807558076580775807858079580805808158082580835808458085580865808758088580895809058091580925809358094580955809658097580985809958100581015810258103581045810558106581075810858109581105811158112581135811458115581165811758118581195812058121581225812358124581255812658127581285812958130581315813258133581345813558136581375813858139581405814158142581435814458145581465814758148581495815058151581525815358154581555815658157581585815958160581615816258163581645816558166581675816858169581705817158172581735817458175581765817758178581795818058181581825818358184581855818658187581885818958190581915819258193581945819558196581975819858199582005820158202582035820458205582065820758208582095821058211582125821358214582155821658217582185821958220582215822258223582245822558226582275822858229582305823158232582335823458235582365823758238582395824058241582425824358244582455824658247582485824958250582515825258253582545825558256582575825858259582605826158262582635826458265582665826758268582695827058271582725827358274582755827658277582785827958280582815828258283582845828558286582875828858289582905829158292582935829458295582965829758298582995830058301583025830358304583055830658307583085830958310583115831258313583145831558316583175831858319583205832158322583235832458325583265832758328583295833058331583325833358334583355833658337583385833958340583415834258343583445834558346583475834858349583505835158352583535835458355583565835758358583595836058361583625836358364583655836658367583685836958370583715837258373583745837558376583775837858379583805838158382583835838458385583865838758388583895839058391583925839358394583955839658397583985839958400584015840258403584045840558406584075840858409584105841158412584135841458415584165841758418584195842058421584225842358424584255842658427584285842958430584315843258433584345843558436584375843858439584405844158442584435844458445584465844758448584495845058451584525845358454584555845658457584585845958460584615846258463584645846558466584675846858469584705847158472584735847458475584765847758478584795848058481584825848358484584855848658487584885848958490584915849258493584945849558496584975849858499585005850158502585035850458505585065850758508585095851058511585125851358514585155851658517585185851958520585215852258523585245852558526585275852858529585305853158532585335853458535585365853758538585395854058541585425854358544585455854658547585485854958550585515855258553585545855558556585575855858559585605856158562585635856458565585665856758568585695857058571585725857358574585755857658577585785857958580585815858258583585845858558586585875858858589585905859158592585935859458595585965859758598585995860058601586025860358604586055860658607586085860958610586115861258613586145861558616586175861858619586205862158622586235862458625586265862758628586295863058631586325863358634586355863658637586385863958640586415864258643586445864558646586475864858649586505865158652586535865458655586565865758658586595866058661586625866358664586655866658667586685866958670586715867258673586745867558676586775867858679586805868158682586835868458685586865868758688586895869058691586925869358694586955869658697586985869958700587015870258703587045870558706587075870858709587105871158712587135871458715587165871758718587195872058721587225872358724587255872658727587285872958730587315873258733587345873558736587375873858739587405874158742587435874458745587465874758748587495875058751587525875358754587555875658757587585875958760587615876258763587645876558766587675876858769587705877158772587735877458775587765877758778587795878058781587825878358784587855878658787587885878958790587915879258793587945879558796587975879858799588005880158802588035880458805588065880758808588095881058811588125881358814588155881658817588185881958820588215882258823588245882558826588275882858829588305883158832588335883458835588365883758838588395884058841588425884358844588455884658847588485884958850588515885258853588545885558856588575885858859588605886158862588635886458865588665886758868588695887058871588725887358874588755887658877588785887958880588815888258883588845888558886588875888858889588905889158892588935889458895588965889758898588995890058901589025890358904589055890658907589085890958910589115891258913589145891558916589175891858919589205892158922589235892458925589265892758928589295893058931589325893358934589355893658937589385893958940589415894258943589445894558946589475894858949589505895158952589535895458955589565895758958589595896058961589625896358964589655896658967589685896958970589715897258973589745897558976589775897858979589805898158982589835898458985589865898758988589895899058991589925899358994589955899658997589985899959000590015900259003590045900559006590075900859009590105901159012590135901459015590165901759018590195902059021590225902359024590255902659027590285902959030590315903259033590345903559036590375903859039590405904159042590435904459045590465904759048590495905059051590525905359054590555905659057590585905959060590615906259063590645906559066590675906859069590705907159072590735907459075590765907759078590795908059081590825908359084590855908659087590885908959090590915909259093590945909559096590975909859099591005910159102591035910459105591065910759108591095911059111591125911359114591155911659117591185911959120591215912259123591245912559126591275912859129591305913159132591335913459135591365913759138591395914059141591425914359144591455914659147591485914959150591515915259153591545915559156591575915859159591605916159162591635916459165591665916759168591695917059171591725917359174591755917659177591785917959180591815918259183591845918559186591875918859189591905919159192591935919459195591965919759198591995920059201592025920359204592055920659207592085920959210592115921259213592145921559216592175921859219592205922159222592235922459225592265922759228592295923059231592325923359234592355923659237592385923959240592415924259243592445924559246592475924859249592505925159252592535925459255592565925759258592595926059261592625926359264592655926659267592685926959270592715927259273592745927559276592775927859279592805928159282592835928459285592865928759288592895929059291592925929359294592955929659297592985929959300593015930259303593045930559306593075930859309593105931159312593135931459315593165931759318593195932059321593225932359324593255932659327593285932959330593315933259333593345933559336593375933859339593405934159342593435934459345593465934759348593495935059351593525935359354593555935659357593585935959360593615936259363593645936559366593675936859369593705937159372593735937459375593765937759378593795938059381593825938359384593855938659387593885938959390593915939259393593945939559396593975939859399594005940159402594035940459405594065940759408594095941059411594125941359414594155941659417594185941959420594215942259423594245942559426594275942859429594305943159432594335943459435594365943759438594395944059441594425944359444594455944659447594485944959450594515945259453594545945559456594575945859459594605946159462594635946459465594665946759468594695947059471594725947359474594755947659477594785947959480594815948259483594845948559486594875948859489594905949159492594935949459495594965949759498594995950059501595025950359504595055950659507595085950959510595115951259513595145951559516595175951859519595205952159522595235952459525595265952759528595295953059531595325953359534595355953659537595385953959540595415954259543595445954559546595475954859549595505955159552595535955459555595565955759558595595956059561595625956359564595655956659567595685956959570595715957259573595745957559576595775957859579595805958159582595835958459585595865958759588595895959059591595925959359594595955959659597595985959959600596015960259603596045960559606596075960859609596105961159612596135961459615596165961759618596195962059621596225962359624596255962659627596285962959630596315963259633596345963559636596375963859639596405964159642596435964459645596465964759648596495965059651596525965359654596555965659657596585965959660596615966259663596645966559666596675966859669596705967159672596735967459675596765967759678596795968059681596825968359684596855968659687596885968959690596915969259693596945969559696596975969859699597005970159702597035970459705597065970759708597095971059711597125971359714597155971659717597185971959720597215972259723597245972559726597275972859729597305973159732597335973459735597365973759738597395974059741597425974359744597455974659747597485974959750597515975259753597545975559756597575975859759597605976159762597635976459765597665976759768597695977059771597725977359774597755977659777597785977959780597815978259783597845978559786597875978859789597905979159792597935979459795597965979759798597995980059801598025980359804598055980659807598085980959810598115981259813598145981559816598175981859819598205982159822598235982459825598265982759828598295983059831598325983359834598355983659837598385983959840598415984259843598445984559846598475984859849598505985159852598535985459855598565985759858598595986059861598625986359864598655986659867598685986959870598715987259873598745987559876598775987859879598805988159882598835988459885598865988759888598895989059891598925989359894598955989659897598985989959900599015990259903599045990559906599075990859909599105991159912599135991459915599165991759918599195992059921599225992359924599255992659927599285992959930599315993259933599345993559936599375993859939599405994159942599435994459945599465994759948599495995059951599525995359954599555995659957599585995959960599615996259963599645996559966599675996859969599705997159972599735997459975599765997759978599795998059981599825998359984599855998659987599885998959990599915999259993599945999559996599975999859999600006000160002600036000460005600066000760008600096001060011600126001360014600156001660017600186001960020600216002260023600246002560026600276002860029600306003160032600336003460035600366003760038600396004060041600426004360044600456004660047600486004960050600516005260053600546005560056600576005860059600606006160062600636006460065600666006760068600696007060071600726007360074600756007660077600786007960080600816008260083600846008560086600876008860089600906009160092600936009460095600966009760098600996010060101601026010360104601056010660107601086010960110601116011260113601146011560116601176011860119601206012160122601236012460125601266012760128601296013060131601326013360134601356013660137601386013960140601416014260143601446014560146601476014860149601506015160152601536015460155601566015760158601596016060161601626016360164601656016660167601686016960170601716017260173601746017560176601776017860179601806018160182601836018460185601866018760188601896019060191601926019360194601956019660197601986019960200602016020260203602046020560206602076020860209602106021160212602136021460215602166021760218602196022060221602226022360224602256022660227602286022960230602316023260233602346023560236602376023860239602406024160242602436024460245602466024760248602496025060251602526025360254602556025660257602586025960260602616026260263602646026560266602676026860269602706027160272602736027460275602766027760278602796028060281602826028360284602856028660287602886028960290602916029260293602946029560296602976029860299603006030160302603036030460305603066030760308603096031060311603126031360314603156031660317603186031960320603216032260323603246032560326603276032860329603306033160332603336033460335603366033760338603396034060341603426034360344603456034660347603486034960350603516035260353603546035560356603576035860359603606036160362603636036460365603666036760368603696037060371603726037360374603756037660377603786037960380603816038260383603846038560386603876038860389603906039160392603936039460395603966039760398603996040060401604026040360404604056040660407604086040960410604116041260413604146041560416604176041860419604206042160422604236042460425604266042760428604296043060431604326043360434604356043660437604386043960440604416044260443604446044560446604476044860449604506045160452604536045460455604566045760458604596046060461604626046360464604656046660467604686046960470604716047260473604746047560476604776047860479604806048160482604836048460485604866048760488604896049060491604926049360494604956049660497604986049960500605016050260503605046050560506605076050860509605106051160512605136051460515605166051760518605196052060521605226052360524605256052660527605286052960530605316053260533605346053560536605376053860539605406054160542605436054460545605466054760548605496055060551605526055360554605556055660557605586055960560605616056260563605646056560566605676056860569605706057160572605736057460575605766057760578605796058060581605826058360584605856058660587605886058960590605916059260593605946059560596605976059860599606006060160602606036060460605606066060760608606096061060611606126061360614606156061660617606186061960620606216062260623606246062560626606276062860629606306063160632606336063460635606366063760638606396064060641606426064360644606456064660647606486064960650606516065260653606546065560656606576065860659606606066160662606636066460665606666066760668606696067060671606726067360674606756067660677606786067960680606816068260683606846068560686606876068860689606906069160692606936069460695606966069760698606996070060701607026070360704607056070660707607086070960710607116071260713607146071560716607176071860719607206072160722607236072460725607266072760728607296073060731607326073360734607356073660737607386073960740607416074260743607446074560746607476074860749607506075160752607536075460755607566075760758607596076060761607626076360764607656076660767607686076960770607716077260773607746077560776607776077860779607806078160782607836078460785607866078760788607896079060791607926079360794607956079660797607986079960800608016080260803608046080560806608076080860809608106081160812608136081460815608166081760818608196082060821608226082360824608256082660827608286082960830608316083260833608346083560836608376083860839608406084160842608436084460845608466084760848608496085060851608526085360854608556085660857608586085960860608616086260863608646086560866608676086860869608706087160872608736087460875608766087760878608796088060881608826088360884608856088660887608886088960890608916089260893608946089560896608976089860899609006090160902609036090460905609066090760908609096091060911609126091360914609156091660917609186091960920609216092260923609246092560926609276092860929609306093160932609336093460935609366093760938609396094060941609426094360944609456094660947609486094960950609516095260953609546095560956609576095860959609606096160962609636096460965609666096760968609696097060971609726097360974609756097660977609786097960980609816098260983609846098560986609876098860989609906099160992609936099460995609966099760998609996100061001610026100361004610056100661007610086100961010610116101261013610146101561016610176101861019610206102161022610236102461025610266102761028610296103061031610326103361034610356103661037610386103961040610416104261043610446104561046610476104861049610506105161052610536105461055610566105761058610596106061061610626106361064610656106661067610686106961070610716107261073610746107561076610776107861079610806108161082610836108461085610866108761088610896109061091610926109361094610956109661097610986109961100611016110261103611046110561106611076110861109611106111161112611136111461115611166111761118611196112061121611226112361124611256112661127611286112961130611316113261133611346113561136611376113861139611406114161142611436114461145611466114761148611496115061151611526115361154611556115661157611586115961160611616116261163611646116561166611676116861169611706117161172611736117461175611766117761178611796118061181611826118361184611856118661187611886118961190611916119261193611946119561196611976119861199612006120161202612036120461205612066120761208612096121061211612126121361214612156121661217612186121961220612216122261223612246122561226612276122861229612306123161232612336123461235612366123761238612396124061241612426124361244612456124661247612486124961250612516125261253612546125561256612576125861259612606126161262612636126461265612666126761268612696127061271612726127361274612756127661277612786127961280612816128261283612846128561286612876128861289612906129161292612936129461295612966129761298612996130061301613026130361304613056130661307613086130961310613116131261313613146131561316613176131861319613206132161322613236132461325613266132761328613296133061331613326133361334613356133661337613386133961340613416134261343613446134561346613476134861349613506135161352613536135461355613566135761358613596136061361613626136361364613656136661367613686136961370613716137261373613746137561376613776137861379613806138161382
  1. /*! Element Plus v2.9.1 */
  2. (function (global, factory) {
  3. typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue')) :
  4. typeof define === 'function' && define.amd ? define(['exports', 'vue'], factory) :
  5. (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.ElementPlus = {}, global.Vue));
  6. })(this, (function (exports, vue) { 'use strict';
  7. const FOCUSABLE_ELEMENT_SELECTORS = `a[href],button:not([disabled]),button:not([hidden]),:not([tabindex="-1"]),input:not([disabled]),input:not([type="hidden"]),select:not([disabled]),textarea:not([disabled])`;
  8. const isVisible = (element) => {
  9. const computed = getComputedStyle(element);
  10. return computed.position === "fixed" ? false : element.offsetParent !== null;
  11. };
  12. const obtainAllFocusableElements$1 = (element) => {
  13. return Array.from(element.querySelectorAll(FOCUSABLE_ELEMENT_SELECTORS)).filter((item) => isFocusable(item) && isVisible(item));
  14. };
  15. const isFocusable = (element) => {
  16. if (element.tabIndex > 0 || element.tabIndex === 0 && element.getAttribute("tabIndex") !== null) {
  17. return true;
  18. }
  19. if (element.tabIndex < 0 || element.hasAttribute("disabled") || element.getAttribute("aria-disabled") === "true") {
  20. return false;
  21. }
  22. switch (element.nodeName) {
  23. case "A": {
  24. return !!element.href && element.rel !== "ignore";
  25. }
  26. case "INPUT": {
  27. return !(element.type === "hidden" || element.type === "file");
  28. }
  29. case "BUTTON":
  30. case "SELECT":
  31. case "TEXTAREA": {
  32. return true;
  33. }
  34. default: {
  35. return false;
  36. }
  37. }
  38. };
  39. const triggerEvent = function(elm, name, ...opts) {
  40. let eventName;
  41. if (name.includes("mouse") || name.includes("click")) {
  42. eventName = "MouseEvents";
  43. } else if (name.includes("key")) {
  44. eventName = "KeyboardEvent";
  45. } else {
  46. eventName = "HTMLEvents";
  47. }
  48. const evt = document.createEvent(eventName);
  49. evt.initEvent(name, ...opts);
  50. elm.dispatchEvent(evt);
  51. return elm;
  52. };
  53. const isLeaf = (el) => !el.getAttribute("aria-owns");
  54. const getSibling = (el, distance, elClass) => {
  55. const { parentNode } = el;
  56. if (!parentNode)
  57. return null;
  58. const siblings = parentNode.querySelectorAll(elClass);
  59. const index = Array.prototype.indexOf.call(siblings, el);
  60. return siblings[index + distance] || null;
  61. };
  62. const focusNode = (el) => {
  63. if (!el)
  64. return;
  65. el.focus();
  66. !isLeaf(el) && el.click();
  67. };
  68. const composeEventHandlers = (theirsHandler, oursHandler, { checkForDefaultPrevented = true } = {}) => {
  69. const handleEvent = (event) => {
  70. const shouldPrevent = theirsHandler == null ? void 0 : theirsHandler(event);
  71. if (checkForDefaultPrevented === false || !shouldPrevent) {
  72. return oursHandler == null ? void 0 : oursHandler(event);
  73. }
  74. };
  75. return handleEvent;
  76. };
  77. const whenMouse = (handler) => {
  78. return (e) => e.pointerType === "mouse" ? handler(e) : void 0;
  79. };
  80. var __defProp$9 = Object.defineProperty;
  81. var __defProps$6 = Object.defineProperties;
  82. var __getOwnPropDescs$6 = Object.getOwnPropertyDescriptors;
  83. var __getOwnPropSymbols$b = Object.getOwnPropertySymbols;
  84. var __hasOwnProp$b = Object.prototype.hasOwnProperty;
  85. var __propIsEnum$b = Object.prototype.propertyIsEnumerable;
  86. var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
  87. var __spreadValues$9 = (a, b) => {
  88. for (var prop in b || (b = {}))
  89. if (__hasOwnProp$b.call(b, prop))
  90. __defNormalProp$9(a, prop, b[prop]);
  91. if (__getOwnPropSymbols$b)
  92. for (var prop of __getOwnPropSymbols$b(b)) {
  93. if (__propIsEnum$b.call(b, prop))
  94. __defNormalProp$9(a, prop, b[prop]);
  95. }
  96. return a;
  97. };
  98. var __spreadProps$6 = (a, b) => __defProps$6(a, __getOwnPropDescs$6(b));
  99. function computedEager(fn, options) {
  100. var _a;
  101. const result = vue.shallowRef();
  102. vue.watchEffect(() => {
  103. result.value = fn();
  104. }, __spreadProps$6(__spreadValues$9({}, options), {
  105. flush: (_a = options == null ? void 0 : options.flush) != null ? _a : "sync"
  106. }));
  107. return vue.readonly(result);
  108. }
  109. var _a;
  110. const isClient = typeof window !== "undefined";
  111. const isDef = (val) => typeof val !== "undefined";
  112. const isString$2 = (val) => typeof val === "string";
  113. const noop$1 = () => {
  114. };
  115. const isIOS = isClient && ((_a = window == null ? void 0 : window.navigator) == null ? void 0 : _a.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
  116. function resolveUnref(r) {
  117. return typeof r === "function" ? r() : vue.unref(r);
  118. }
  119. function createFilterWrapper(filter, fn) {
  120. function wrapper(...args) {
  121. filter(() => fn.apply(this, args), { fn, thisArg: this, args });
  122. }
  123. return wrapper;
  124. }
  125. function debounceFilter(ms, options = {}) {
  126. let timer;
  127. let maxTimer;
  128. const filter = (invoke) => {
  129. const duration = resolveUnref(ms);
  130. const maxDuration = resolveUnref(options.maxWait);
  131. if (timer)
  132. clearTimeout(timer);
  133. if (duration <= 0 || maxDuration !== void 0 && maxDuration <= 0) {
  134. if (maxTimer) {
  135. clearTimeout(maxTimer);
  136. maxTimer = null;
  137. }
  138. return invoke();
  139. }
  140. if (maxDuration && !maxTimer) {
  141. maxTimer = setTimeout(() => {
  142. if (timer)
  143. clearTimeout(timer);
  144. maxTimer = null;
  145. invoke();
  146. }, maxDuration);
  147. }
  148. timer = setTimeout(() => {
  149. if (maxTimer)
  150. clearTimeout(maxTimer);
  151. maxTimer = null;
  152. invoke();
  153. }, duration);
  154. };
  155. return filter;
  156. }
  157. function throttleFilter(ms, trailing = true, leading = true) {
  158. let lastExec = 0;
  159. let timer;
  160. let isLeading = true;
  161. const clear = () => {
  162. if (timer) {
  163. clearTimeout(timer);
  164. timer = void 0;
  165. }
  166. };
  167. const filter = (invoke) => {
  168. const duration = resolveUnref(ms);
  169. const elapsed = Date.now() - lastExec;
  170. clear();
  171. if (duration <= 0) {
  172. lastExec = Date.now();
  173. return invoke();
  174. }
  175. if (elapsed > duration && (leading || !isLeading)) {
  176. lastExec = Date.now();
  177. invoke();
  178. } else if (trailing) {
  179. timer = setTimeout(() => {
  180. lastExec = Date.now();
  181. isLeading = true;
  182. clear();
  183. invoke();
  184. }, duration);
  185. }
  186. if (!leading && !timer)
  187. timer = setTimeout(() => isLeading = true, duration);
  188. isLeading = false;
  189. };
  190. return filter;
  191. }
  192. function identity$1(arg) {
  193. return arg;
  194. }
  195. function tryOnScopeDispose(fn) {
  196. if (vue.getCurrentScope()) {
  197. vue.onScopeDispose(fn);
  198. return true;
  199. }
  200. return false;
  201. }
  202. function useDebounceFn(fn, ms = 200, options = {}) {
  203. return createFilterWrapper(debounceFilter(ms, options), fn);
  204. }
  205. function refDebounced(value, ms = 200, options = {}) {
  206. if (ms <= 0)
  207. return value;
  208. const debounced = vue.ref(value.value);
  209. const updater = useDebounceFn(() => {
  210. debounced.value = value.value;
  211. }, ms, options);
  212. vue.watch(value, () => updater());
  213. return debounced;
  214. }
  215. function useThrottleFn(fn, ms = 200, trailing = false, leading = true) {
  216. return createFilterWrapper(throttleFilter(ms, trailing, leading), fn);
  217. }
  218. function tryOnMounted(fn, sync = true) {
  219. if (vue.getCurrentInstance())
  220. vue.onMounted(fn);
  221. else if (sync)
  222. fn();
  223. else
  224. vue.nextTick(fn);
  225. }
  226. function useTimeoutFn(cb, interval, options = {}) {
  227. const {
  228. immediate = true
  229. } = options;
  230. const isPending = vue.ref(false);
  231. let timer = null;
  232. function clear() {
  233. if (timer) {
  234. clearTimeout(timer);
  235. timer = null;
  236. }
  237. }
  238. function stop() {
  239. isPending.value = false;
  240. clear();
  241. }
  242. function start(...args) {
  243. clear();
  244. isPending.value = true;
  245. timer = setTimeout(() => {
  246. isPending.value = false;
  247. timer = null;
  248. cb(...args);
  249. }, resolveUnref(interval));
  250. }
  251. if (immediate) {
  252. isPending.value = true;
  253. if (isClient)
  254. start();
  255. }
  256. tryOnScopeDispose(stop);
  257. return {
  258. isPending,
  259. start,
  260. stop
  261. };
  262. }
  263. function unrefElement(elRef) {
  264. var _a;
  265. const plain = resolveUnref(elRef);
  266. return (_a = plain == null ? void 0 : plain.$el) != null ? _a : plain;
  267. }
  268. const defaultWindow = isClient ? window : void 0;
  269. const defaultDocument = isClient ? window.document : void 0;
  270. function useEventListener(...args) {
  271. let target;
  272. let event;
  273. let listener;
  274. let options;
  275. if (isString$2(args[0])) {
  276. [event, listener, options] = args;
  277. target = defaultWindow;
  278. } else {
  279. [target, event, listener, options] = args;
  280. }
  281. if (!target)
  282. return noop$1;
  283. let cleanup = noop$1;
  284. const stopWatch = vue.watch(() => unrefElement(target), (el) => {
  285. cleanup();
  286. if (!el)
  287. return;
  288. el.addEventListener(event, listener, options);
  289. cleanup = () => {
  290. el.removeEventListener(event, listener, options);
  291. cleanup = noop$1;
  292. };
  293. }, { immediate: true, flush: "post" });
  294. const stop = () => {
  295. stopWatch();
  296. cleanup();
  297. };
  298. tryOnScopeDispose(stop);
  299. return stop;
  300. }
  301. function onClickOutside(target, handler, options = {}) {
  302. const { window = defaultWindow, ignore, capture = true, detectIframe = false } = options;
  303. if (!window)
  304. return;
  305. const shouldListen = vue.ref(true);
  306. let fallback;
  307. const listener = (event) => {
  308. window.clearTimeout(fallback);
  309. const el = unrefElement(target);
  310. const composedPath = event.composedPath();
  311. if (!el || el === event.target || composedPath.includes(el) || !shouldListen.value)
  312. return;
  313. if (ignore && ignore.length > 0) {
  314. if (ignore.some((target2) => {
  315. const el2 = unrefElement(target2);
  316. return el2 && (event.target === el2 || composedPath.includes(el2));
  317. }))
  318. return;
  319. }
  320. handler(event);
  321. };
  322. const cleanup = [
  323. useEventListener(window, "click", listener, { passive: true, capture }),
  324. useEventListener(window, "pointerdown", (e) => {
  325. const el = unrefElement(target);
  326. shouldListen.value = !!el && !e.composedPath().includes(el);
  327. }, { passive: true }),
  328. useEventListener(window, "pointerup", (e) => {
  329. if (e.button === 0) {
  330. const path = e.composedPath();
  331. e.composedPath = () => path;
  332. fallback = window.setTimeout(() => listener(e), 50);
  333. }
  334. }, { passive: true }),
  335. detectIframe && useEventListener(window, "blur", (event) => {
  336. var _a;
  337. const el = unrefElement(target);
  338. if (((_a = document.activeElement) == null ? void 0 : _a.tagName) === "IFRAME" && !(el == null ? void 0 : el.contains(document.activeElement)))
  339. handler(event);
  340. })
  341. ].filter(Boolean);
  342. const stop = () => cleanup.forEach((fn) => fn());
  343. return stop;
  344. }
  345. function useActiveElement(options = {}) {
  346. const { window = defaultWindow } = options;
  347. const counter = vue.ref(0);
  348. if (window) {
  349. useEventListener(window, "blur", () => counter.value += 1, true);
  350. useEventListener(window, "focus", () => counter.value += 1, true);
  351. }
  352. return vue.computed(() => {
  353. counter.value;
  354. return window == null ? void 0 : window.document.activeElement;
  355. });
  356. }
  357. function useSupported(callback, sync = false) {
  358. const isSupported = vue.ref();
  359. const update = () => isSupported.value = Boolean(callback());
  360. update();
  361. tryOnMounted(update, sync);
  362. return isSupported;
  363. }
  364. const _global = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
  365. const globalKey = "__vueuse_ssr_handlers__";
  366. _global[globalKey] = _global[globalKey] || {};
  367. _global[globalKey];
  368. function useCssVar(prop, target, { window = defaultWindow, initialValue = "" } = {}) {
  369. const variable = vue.ref(initialValue);
  370. const elRef = vue.computed(() => {
  371. var _a;
  372. return unrefElement(target) || ((_a = window == null ? void 0 : window.document) == null ? void 0 : _a.documentElement);
  373. });
  374. vue.watch([elRef, () => resolveUnref(prop)], ([el, prop2]) => {
  375. var _a;
  376. if (el && window) {
  377. const value = (_a = window.getComputedStyle(el).getPropertyValue(prop2)) == null ? void 0 : _a.trim();
  378. variable.value = value || initialValue;
  379. }
  380. }, { immediate: true });
  381. vue.watch(variable, (val) => {
  382. var _a;
  383. if ((_a = elRef.value) == null ? void 0 : _a.style)
  384. elRef.value.style.setProperty(resolveUnref(prop), val);
  385. });
  386. return variable;
  387. }
  388. function useDocumentVisibility({ document = defaultDocument } = {}) {
  389. if (!document)
  390. return vue.ref("visible");
  391. const visibility = vue.ref(document.visibilityState);
  392. useEventListener(document, "visibilitychange", () => {
  393. visibility.value = document.visibilityState;
  394. });
  395. return visibility;
  396. }
  397. var __getOwnPropSymbols$f = Object.getOwnPropertySymbols;
  398. var __hasOwnProp$f = Object.prototype.hasOwnProperty;
  399. var __propIsEnum$f = Object.prototype.propertyIsEnumerable;
  400. var __objRest$2 = (source, exclude) => {
  401. var target = {};
  402. for (var prop in source)
  403. if (__hasOwnProp$f.call(source, prop) && exclude.indexOf(prop) < 0)
  404. target[prop] = source[prop];
  405. if (source != null && __getOwnPropSymbols$f)
  406. for (var prop of __getOwnPropSymbols$f(source)) {
  407. if (exclude.indexOf(prop) < 0 && __propIsEnum$f.call(source, prop))
  408. target[prop] = source[prop];
  409. }
  410. return target;
  411. };
  412. function useResizeObserver(target, callback, options = {}) {
  413. const _a = options, { window = defaultWindow } = _a, observerOptions = __objRest$2(_a, ["window"]);
  414. let observer;
  415. const isSupported = useSupported(() => window && "ResizeObserver" in window);
  416. const cleanup = () => {
  417. if (observer) {
  418. observer.disconnect();
  419. observer = void 0;
  420. }
  421. };
  422. const stopWatch = vue.watch(() => unrefElement(target), (el) => {
  423. cleanup();
  424. if (isSupported.value && window && el) {
  425. observer = new ResizeObserver(callback);
  426. observer.observe(el, observerOptions);
  427. }
  428. }, { immediate: true, flush: "post" });
  429. const stop = () => {
  430. cleanup();
  431. stopWatch();
  432. };
  433. tryOnScopeDispose(stop);
  434. return {
  435. isSupported,
  436. stop
  437. };
  438. }
  439. function useElementBounding(target, options = {}) {
  440. const {
  441. reset = true,
  442. windowResize = true,
  443. windowScroll = true,
  444. immediate = true
  445. } = options;
  446. const height = vue.ref(0);
  447. const bottom = vue.ref(0);
  448. const left = vue.ref(0);
  449. const right = vue.ref(0);
  450. const top = vue.ref(0);
  451. const width = vue.ref(0);
  452. const x = vue.ref(0);
  453. const y = vue.ref(0);
  454. function update() {
  455. const el = unrefElement(target);
  456. if (!el) {
  457. if (reset) {
  458. height.value = 0;
  459. bottom.value = 0;
  460. left.value = 0;
  461. right.value = 0;
  462. top.value = 0;
  463. width.value = 0;
  464. x.value = 0;
  465. y.value = 0;
  466. }
  467. return;
  468. }
  469. const rect = el.getBoundingClientRect();
  470. height.value = rect.height;
  471. bottom.value = rect.bottom;
  472. left.value = rect.left;
  473. right.value = rect.right;
  474. top.value = rect.top;
  475. width.value = rect.width;
  476. x.value = rect.x;
  477. y.value = rect.y;
  478. }
  479. useResizeObserver(target, update);
  480. vue.watch(() => unrefElement(target), (ele) => !ele && update());
  481. if (windowScroll)
  482. useEventListener("scroll", update, { passive: true });
  483. if (windowResize)
  484. useEventListener("resize", update, { passive: true });
  485. tryOnMounted(() => {
  486. if (immediate)
  487. update();
  488. });
  489. return {
  490. height,
  491. bottom,
  492. left,
  493. right,
  494. top,
  495. width,
  496. x,
  497. y,
  498. update
  499. };
  500. }
  501. var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols;
  502. var __hasOwnProp$7 = Object.prototype.hasOwnProperty;
  503. var __propIsEnum$7 = Object.prototype.propertyIsEnumerable;
  504. var __objRest$1 = (source, exclude) => {
  505. var target = {};
  506. for (var prop in source)
  507. if (__hasOwnProp$7.call(source, prop) && exclude.indexOf(prop) < 0)
  508. target[prop] = source[prop];
  509. if (source != null && __getOwnPropSymbols$7)
  510. for (var prop of __getOwnPropSymbols$7(source)) {
  511. if (exclude.indexOf(prop) < 0 && __propIsEnum$7.call(source, prop))
  512. target[prop] = source[prop];
  513. }
  514. return target;
  515. };
  516. function useMutationObserver(target, callback, options = {}) {
  517. const _a = options, { window = defaultWindow } = _a, mutationOptions = __objRest$1(_a, ["window"]);
  518. let observer;
  519. const isSupported = useSupported(() => window && "MutationObserver" in window);
  520. const cleanup = () => {
  521. if (observer) {
  522. observer.disconnect();
  523. observer = void 0;
  524. }
  525. };
  526. const stopWatch = vue.watch(() => unrefElement(target), (el) => {
  527. cleanup();
  528. if (isSupported.value && window && el) {
  529. observer = new MutationObserver(callback);
  530. observer.observe(el, mutationOptions);
  531. }
  532. }, { immediate: true });
  533. const stop = () => {
  534. cleanup();
  535. stopWatch();
  536. };
  537. tryOnScopeDispose(stop);
  538. return {
  539. isSupported,
  540. stop
  541. };
  542. }
  543. var SwipeDirection;
  544. (function(SwipeDirection2) {
  545. SwipeDirection2["UP"] = "UP";
  546. SwipeDirection2["RIGHT"] = "RIGHT";
  547. SwipeDirection2["DOWN"] = "DOWN";
  548. SwipeDirection2["LEFT"] = "LEFT";
  549. SwipeDirection2["NONE"] = "NONE";
  550. })(SwipeDirection || (SwipeDirection = {}));
  551. var __defProp = Object.defineProperty;
  552. var __getOwnPropSymbols = Object.getOwnPropertySymbols;
  553. var __hasOwnProp = Object.prototype.hasOwnProperty;
  554. var __propIsEnum = Object.prototype.propertyIsEnumerable;
  555. var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
  556. var __spreadValues = (a, b) => {
  557. for (var prop in b || (b = {}))
  558. if (__hasOwnProp.call(b, prop))
  559. __defNormalProp(a, prop, b[prop]);
  560. if (__getOwnPropSymbols)
  561. for (var prop of __getOwnPropSymbols(b)) {
  562. if (__propIsEnum.call(b, prop))
  563. __defNormalProp(a, prop, b[prop]);
  564. }
  565. return a;
  566. };
  567. const _TransitionPresets = {
  568. easeInSine: [0.12, 0, 0.39, 0],
  569. easeOutSine: [0.61, 1, 0.88, 1],
  570. easeInOutSine: [0.37, 0, 0.63, 1],
  571. easeInQuad: [0.11, 0, 0.5, 0],
  572. easeOutQuad: [0.5, 1, 0.89, 1],
  573. easeInOutQuad: [0.45, 0, 0.55, 1],
  574. easeInCubic: [0.32, 0, 0.67, 0],
  575. easeOutCubic: [0.33, 1, 0.68, 1],
  576. easeInOutCubic: [0.65, 0, 0.35, 1],
  577. easeInQuart: [0.5, 0, 0.75, 0],
  578. easeOutQuart: [0.25, 1, 0.5, 1],
  579. easeInOutQuart: [0.76, 0, 0.24, 1],
  580. easeInQuint: [0.64, 0, 0.78, 0],
  581. easeOutQuint: [0.22, 1, 0.36, 1],
  582. easeInOutQuint: [0.83, 0, 0.17, 1],
  583. easeInExpo: [0.7, 0, 0.84, 0],
  584. easeOutExpo: [0.16, 1, 0.3, 1],
  585. easeInOutExpo: [0.87, 0, 0.13, 1],
  586. easeInCirc: [0.55, 0, 1, 0.45],
  587. easeOutCirc: [0, 0.55, 0.45, 1],
  588. easeInOutCirc: [0.85, 0, 0.15, 1],
  589. easeInBack: [0.36, 0, 0.66, -0.56],
  590. easeOutBack: [0.34, 1.56, 0.64, 1],
  591. easeInOutBack: [0.68, -0.6, 0.32, 1.6]
  592. };
  593. __spreadValues({
  594. linear: identity$1
  595. }, _TransitionPresets);
  596. function useVModel(props, key, emit, options = {}) {
  597. var _a, _b, _c;
  598. const {
  599. passive = false,
  600. eventName,
  601. deep = false,
  602. defaultValue
  603. } = options;
  604. const vm = vue.getCurrentInstance();
  605. const _emit = emit || (vm == null ? void 0 : vm.emit) || ((_a = vm == null ? void 0 : vm.$emit) == null ? void 0 : _a.bind(vm)) || ((_c = (_b = vm == null ? void 0 : vm.proxy) == null ? void 0 : _b.$emit) == null ? void 0 : _c.bind(vm == null ? void 0 : vm.proxy));
  606. let event = eventName;
  607. if (!key) {
  608. {
  609. key = "modelValue";
  610. }
  611. }
  612. event = eventName || event || `update:${key.toString()}`;
  613. const getValue = () => isDef(props[key]) ? props[key] : defaultValue;
  614. if (passive) {
  615. const proxy = vue.ref(getValue());
  616. vue.watch(() => props[key], (v) => proxy.value = v);
  617. vue.watch(proxy, (v) => {
  618. if (v !== props[key] || deep)
  619. _emit(event, v);
  620. }, {
  621. deep
  622. });
  623. return proxy;
  624. } else {
  625. return vue.computed({
  626. get() {
  627. return getValue();
  628. },
  629. set(value) {
  630. _emit(event, value);
  631. }
  632. });
  633. }
  634. }
  635. function useWindowFocus({ window = defaultWindow } = {}) {
  636. if (!window)
  637. return vue.ref(false);
  638. const focused = vue.ref(window.document.hasFocus());
  639. useEventListener(window, "blur", () => {
  640. focused.value = false;
  641. });
  642. useEventListener(window, "focus", () => {
  643. focused.value = true;
  644. });
  645. return focused;
  646. }
  647. function useWindowSize(options = {}) {
  648. const {
  649. window = defaultWindow,
  650. initialWidth = Infinity,
  651. initialHeight = Infinity,
  652. listenOrientation = true
  653. } = options;
  654. const width = vue.ref(initialWidth);
  655. const height = vue.ref(initialHeight);
  656. const update = () => {
  657. if (window) {
  658. width.value = window.innerWidth;
  659. height.value = window.innerHeight;
  660. }
  661. };
  662. update();
  663. tryOnMounted(update);
  664. useEventListener("resize", update, { passive: true });
  665. if (listenOrientation)
  666. useEventListener("orientationchange", update, { passive: true });
  667. return { width, height };
  668. }
  669. const isFirefox = () => isClient && /firefox/i.test(window.navigator.userAgent);
  670. const isInContainer = (el, container) => {
  671. if (!isClient || !el || !container)
  672. return false;
  673. const elRect = el.getBoundingClientRect();
  674. let containerRect;
  675. if (container instanceof Element) {
  676. containerRect = container.getBoundingClientRect();
  677. } else {
  678. containerRect = {
  679. top: 0,
  680. right: window.innerWidth,
  681. bottom: window.innerHeight,
  682. left: 0
  683. };
  684. }
  685. return elRect.top < containerRect.bottom && elRect.bottom > containerRect.top && elRect.right > containerRect.left && elRect.left < containerRect.right;
  686. };
  687. const getOffsetTop = (el) => {
  688. let offset = 0;
  689. let parent = el;
  690. while (parent) {
  691. offset += parent.offsetTop;
  692. parent = parent.offsetParent;
  693. }
  694. return offset;
  695. };
  696. const getOffsetTopDistance = (el, containerEl) => {
  697. return Math.abs(getOffsetTop(el) - getOffsetTop(containerEl));
  698. };
  699. const getClientXY = (event) => {
  700. let clientX;
  701. let clientY;
  702. if (event.type === "touchend") {
  703. clientY = event.changedTouches[0].clientY;
  704. clientX = event.changedTouches[0].clientX;
  705. } else if (event.type.startsWith("touch")) {
  706. clientY = event.touches[0].clientY;
  707. clientX = event.touches[0].clientX;
  708. } else {
  709. clientY = event.clientY;
  710. clientX = event.clientX;
  711. }
  712. return {
  713. clientX,
  714. clientY
  715. };
  716. };
  717. function easeInOutCubic(t, b, c, d) {
  718. const cc = c - b;
  719. t /= d / 2;
  720. if (t < 1) {
  721. return cc / 2 * t * t * t + b;
  722. }
  723. return cc / 2 * ((t -= 2) * t * t + 2) + b;
  724. }
  725. const NOOP = () => {
  726. };
  727. const hasOwnProperty$p = Object.prototype.hasOwnProperty;
  728. const hasOwn = (val, key) => hasOwnProperty$p.call(val, key);
  729. const isArray$1 = Array.isArray;
  730. const isDate$1 = (val) => toTypeString(val) === "[object Date]";
  731. const isFunction$1 = (val) => typeof val === "function";
  732. const isString$1 = (val) => typeof val === "string";
  733. const isObject$1 = (val) => val !== null && typeof val === "object";
  734. const isPromise = (val) => {
  735. return isObject$1(val) && isFunction$1(val.then) && isFunction$1(val.catch);
  736. };
  737. const objectToString$1 = Object.prototype.toString;
  738. const toTypeString = (value) => objectToString$1.call(value);
  739. const isPlainObject$1 = (val) => toTypeString(val) === "[object Object]";
  740. const cacheStringFunction = (fn) => {
  741. const cache = /* @__PURE__ */ Object.create(null);
  742. return (str) => {
  743. const hit = cache[str];
  744. return hit || (cache[str] = fn(str));
  745. };
  746. };
  747. const camelizeRE = /-(\w)/g;
  748. const camelize = cacheStringFunction((str) => {
  749. return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
  750. });
  751. const hyphenateRE = /\B([A-Z])/g;
  752. const hyphenate = cacheStringFunction((str) => str.replace(hyphenateRE, "-$1").toLowerCase());
  753. const capitalize$2 = cacheStringFunction((str) => str.charAt(0).toUpperCase() + str.slice(1));
  754. var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
  755. var freeSelf = typeof self == "object" && self && self.Object === Object && self;
  756. var root = freeGlobal || freeSelf || Function("return this")();
  757. var Symbol$1 = root.Symbol;
  758. var objectProto$s = Object.prototype;
  759. var hasOwnProperty$o = objectProto$s.hasOwnProperty;
  760. var nativeObjectToString$3 = objectProto$s.toString;
  761. var symToStringTag$1 = Symbol$1 ? Symbol$1.toStringTag : void 0;
  762. function getRawTag(value) {
  763. var isOwn = hasOwnProperty$o.call(value, symToStringTag$1), tag = value[symToStringTag$1];
  764. try {
  765. value[symToStringTag$1] = void 0;
  766. var unmasked = true;
  767. } catch (e) {
  768. }
  769. var result = nativeObjectToString$3.call(value);
  770. if (unmasked) {
  771. if (isOwn) {
  772. value[symToStringTag$1] = tag;
  773. } else {
  774. delete value[symToStringTag$1];
  775. }
  776. }
  777. return result;
  778. }
  779. var objectProto$r = Object.prototype;
  780. var nativeObjectToString$2 = objectProto$r.toString;
  781. function objectToString(value) {
  782. return nativeObjectToString$2.call(value);
  783. }
  784. var nullTag = "[object Null]";
  785. var undefinedTag = "[object Undefined]";
  786. var symToStringTag = Symbol$1 ? Symbol$1.toStringTag : void 0;
  787. function baseGetTag(value) {
  788. if (value == null) {
  789. return value === void 0 ? undefinedTag : nullTag;
  790. }
  791. return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
  792. }
  793. function isObjectLike(value) {
  794. return value != null && typeof value == "object";
  795. }
  796. var symbolTag$3 = "[object Symbol]";
  797. function isSymbol(value) {
  798. return typeof value == "symbol" || isObjectLike(value) && baseGetTag(value) == symbolTag$3;
  799. }
  800. var NAN$2 = 0 / 0;
  801. function baseToNumber(value) {
  802. if (typeof value == "number") {
  803. return value;
  804. }
  805. if (isSymbol(value)) {
  806. return NAN$2;
  807. }
  808. return +value;
  809. }
  810. function arrayMap(array, iteratee) {
  811. var index = -1, length = array == null ? 0 : array.length, result = Array(length);
  812. while (++index < length) {
  813. result[index] = iteratee(array[index], index, array);
  814. }
  815. return result;
  816. }
  817. var isArray = Array.isArray;
  818. var INFINITY$5 = 1 / 0;
  819. var symbolProto$2 = Symbol$1 ? Symbol$1.prototype : void 0;
  820. var symbolToString = symbolProto$2 ? symbolProto$2.toString : void 0;
  821. function baseToString(value) {
  822. if (typeof value == "string") {
  823. return value;
  824. }
  825. if (isArray(value)) {
  826. return arrayMap(value, baseToString) + "";
  827. }
  828. if (isSymbol(value)) {
  829. return symbolToString ? symbolToString.call(value) : "";
  830. }
  831. var result = value + "";
  832. return result == "0" && 1 / value == -INFINITY$5 ? "-0" : result;
  833. }
  834. function createMathOperation(operator, defaultValue) {
  835. return function(value, other) {
  836. var result;
  837. if (value === void 0 && other === void 0) {
  838. return defaultValue;
  839. }
  840. if (value !== void 0) {
  841. result = value;
  842. }
  843. if (other !== void 0) {
  844. if (result === void 0) {
  845. return other;
  846. }
  847. if (typeof value == "string" || typeof other == "string") {
  848. value = baseToString(value);
  849. other = baseToString(other);
  850. } else {
  851. value = baseToNumber(value);
  852. other = baseToNumber(other);
  853. }
  854. result = operator(value, other);
  855. }
  856. return result;
  857. };
  858. }
  859. var add = createMathOperation(function(augend, addend) {
  860. return augend + addend;
  861. }, 0);
  862. var reWhitespace = /\s/;
  863. function trimmedEndIndex(string) {
  864. var index = string.length;
  865. while (index-- && reWhitespace.test(string.charAt(index))) {
  866. }
  867. return index;
  868. }
  869. var reTrimStart$2 = /^\s+/;
  870. function baseTrim(string) {
  871. return string ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart$2, "") : string;
  872. }
  873. function isObject(value) {
  874. var type = typeof value;
  875. return value != null && (type == "object" || type == "function");
  876. }
  877. var NAN$1 = 0 / 0;
  878. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  879. var reIsBinary = /^0b[01]+$/i;
  880. var reIsOctal = /^0o[0-7]+$/i;
  881. var freeParseInt = parseInt;
  882. function toNumber(value) {
  883. if (typeof value == "number") {
  884. return value;
  885. }
  886. if (isSymbol(value)) {
  887. return NAN$1;
  888. }
  889. if (isObject(value)) {
  890. var other = typeof value.valueOf == "function" ? value.valueOf() : value;
  891. value = isObject(other) ? other + "" : other;
  892. }
  893. if (typeof value != "string") {
  894. return value === 0 ? value : +value;
  895. }
  896. value = baseTrim(value);
  897. var isBinary = reIsBinary.test(value);
  898. return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN$1 : +value;
  899. }
  900. var INFINITY$4 = 1 / 0;
  901. var MAX_INTEGER = 17976931348623157e292;
  902. function toFinite(value) {
  903. if (!value) {
  904. return value === 0 ? value : 0;
  905. }
  906. value = toNumber(value);
  907. if (value === INFINITY$4 || value === -INFINITY$4) {
  908. var sign = value < 0 ? -1 : 1;
  909. return sign * MAX_INTEGER;
  910. }
  911. return value === value ? value : 0;
  912. }
  913. function toInteger(value) {
  914. var result = toFinite(value), remainder = result % 1;
  915. return result === result ? remainder ? result - remainder : result : 0;
  916. }
  917. var FUNC_ERROR_TEXT$b = "Expected a function";
  918. function after(n, func) {
  919. if (typeof func != "function") {
  920. throw new TypeError(FUNC_ERROR_TEXT$b);
  921. }
  922. n = toInteger(n);
  923. return function() {
  924. if (--n < 1) {
  925. return func.apply(this, arguments);
  926. }
  927. };
  928. }
  929. function identity(value) {
  930. return value;
  931. }
  932. var asyncTag = "[object AsyncFunction]";
  933. var funcTag$2 = "[object Function]";
  934. var genTag$1 = "[object GeneratorFunction]";
  935. var proxyTag = "[object Proxy]";
  936. function isFunction(value) {
  937. if (!isObject(value)) {
  938. return false;
  939. }
  940. var tag = baseGetTag(value);
  941. return tag == funcTag$2 || tag == genTag$1 || tag == asyncTag || tag == proxyTag;
  942. }
  943. var coreJsData = root["__core-js_shared__"];
  944. var maskSrcKey = function() {
  945. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || "");
  946. return uid ? "Symbol(src)_1." + uid : "";
  947. }();
  948. function isMasked(func) {
  949. return !!maskSrcKey && maskSrcKey in func;
  950. }
  951. var funcProto$2 = Function.prototype;
  952. var funcToString$2 = funcProto$2.toString;
  953. function toSource(func) {
  954. if (func != null) {
  955. try {
  956. return funcToString$2.call(func);
  957. } catch (e) {
  958. }
  959. try {
  960. return func + "";
  961. } catch (e) {
  962. }
  963. }
  964. return "";
  965. }
  966. var reRegExpChar$1 = /[\\^$.*+?()[\]{}|]/g;
  967. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  968. var funcProto$1 = Function.prototype;
  969. var objectProto$q = Object.prototype;
  970. var funcToString$1 = funcProto$1.toString;
  971. var hasOwnProperty$n = objectProto$q.hasOwnProperty;
  972. var reIsNative = RegExp("^" + funcToString$1.call(hasOwnProperty$n).replace(reRegExpChar$1, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$");
  973. function baseIsNative(value) {
  974. if (!isObject(value) || isMasked(value)) {
  975. return false;
  976. }
  977. var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
  978. return pattern.test(toSource(value));
  979. }
  980. function getValue$1(object, key) {
  981. return object == null ? void 0 : object[key];
  982. }
  983. function getNative(object, key) {
  984. var value = getValue$1(object, key);
  985. return baseIsNative(value) ? value : void 0;
  986. }
  987. var WeakMap = getNative(root, "WeakMap");
  988. var metaMap = WeakMap && new WeakMap();
  989. var baseSetData = !metaMap ? identity : function(func, data) {
  990. metaMap.set(func, data);
  991. return func;
  992. };
  993. var objectCreate = Object.create;
  994. var baseCreate = function() {
  995. function object() {
  996. }
  997. return function(proto) {
  998. if (!isObject(proto)) {
  999. return {};
  1000. }
  1001. if (objectCreate) {
  1002. return objectCreate(proto);
  1003. }
  1004. object.prototype = proto;
  1005. var result = new object();
  1006. object.prototype = void 0;
  1007. return result;
  1008. };
  1009. }();
  1010. function createCtor(Ctor) {
  1011. return function() {
  1012. var args = arguments;
  1013. switch (args.length) {
  1014. case 0:
  1015. return new Ctor();
  1016. case 1:
  1017. return new Ctor(args[0]);
  1018. case 2:
  1019. return new Ctor(args[0], args[1]);
  1020. case 3:
  1021. return new Ctor(args[0], args[1], args[2]);
  1022. case 4:
  1023. return new Ctor(args[0], args[1], args[2], args[3]);
  1024. case 5:
  1025. return new Ctor(args[0], args[1], args[2], args[3], args[4]);
  1026. case 6:
  1027. return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
  1028. case 7:
  1029. return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
  1030. }
  1031. var thisBinding = baseCreate(Ctor.prototype), result = Ctor.apply(thisBinding, args);
  1032. return isObject(result) ? result : thisBinding;
  1033. };
  1034. }
  1035. var WRAP_BIND_FLAG$8 = 1;
  1036. function createBind(func, bitmask, thisArg) {
  1037. var isBind = bitmask & WRAP_BIND_FLAG$8, Ctor = createCtor(func);
  1038. function wrapper() {
  1039. var fn = this && this !== root && this instanceof wrapper ? Ctor : func;
  1040. return fn.apply(isBind ? thisArg : this, arguments);
  1041. }
  1042. return wrapper;
  1043. }
  1044. function apply(func, thisArg, args) {
  1045. switch (args.length) {
  1046. case 0:
  1047. return func.call(thisArg);
  1048. case 1:
  1049. return func.call(thisArg, args[0]);
  1050. case 2:
  1051. return func.call(thisArg, args[0], args[1]);
  1052. case 3:
  1053. return func.call(thisArg, args[0], args[1], args[2]);
  1054. }
  1055. return func.apply(thisArg, args);
  1056. }
  1057. var nativeMax$g = Math.max;
  1058. function composeArgs(args, partials, holders, isCurried) {
  1059. var argsIndex = -1, argsLength = args.length, holdersLength = holders.length, leftIndex = -1, leftLength = partials.length, rangeLength = nativeMax$g(argsLength - holdersLength, 0), result = Array(leftLength + rangeLength), isUncurried = !isCurried;
  1060. while (++leftIndex < leftLength) {
  1061. result[leftIndex] = partials[leftIndex];
  1062. }
  1063. while (++argsIndex < holdersLength) {
  1064. if (isUncurried || argsIndex < argsLength) {
  1065. result[holders[argsIndex]] = args[argsIndex];
  1066. }
  1067. }
  1068. while (rangeLength--) {
  1069. result[leftIndex++] = args[argsIndex++];
  1070. }
  1071. return result;
  1072. }
  1073. var nativeMax$f = Math.max;
  1074. function composeArgsRight(args, partials, holders, isCurried) {
  1075. var argsIndex = -1, argsLength = args.length, holdersIndex = -1, holdersLength = holders.length, rightIndex = -1, rightLength = partials.length, rangeLength = nativeMax$f(argsLength - holdersLength, 0), result = Array(rangeLength + rightLength), isUncurried = !isCurried;
  1076. while (++argsIndex < rangeLength) {
  1077. result[argsIndex] = args[argsIndex];
  1078. }
  1079. var offset = argsIndex;
  1080. while (++rightIndex < rightLength) {
  1081. result[offset + rightIndex] = partials[rightIndex];
  1082. }
  1083. while (++holdersIndex < holdersLength) {
  1084. if (isUncurried || argsIndex < argsLength) {
  1085. result[offset + holders[holdersIndex]] = args[argsIndex++];
  1086. }
  1087. }
  1088. return result;
  1089. }
  1090. function countHolders(array, placeholder) {
  1091. var length = array.length, result = 0;
  1092. while (length--) {
  1093. if (array[length] === placeholder) {
  1094. ++result;
  1095. }
  1096. }
  1097. return result;
  1098. }
  1099. function baseLodash() {
  1100. }
  1101. var MAX_ARRAY_LENGTH$6 = 4294967295;
  1102. function LazyWrapper(value) {
  1103. this.__wrapped__ = value;
  1104. this.__actions__ = [];
  1105. this.__dir__ = 1;
  1106. this.__filtered__ = false;
  1107. this.__iteratees__ = [];
  1108. this.__takeCount__ = MAX_ARRAY_LENGTH$6;
  1109. this.__views__ = [];
  1110. }
  1111. LazyWrapper.prototype = baseCreate(baseLodash.prototype);
  1112. LazyWrapper.prototype.constructor = LazyWrapper;
  1113. function noop() {
  1114. }
  1115. var getData = !metaMap ? noop : function(func) {
  1116. return metaMap.get(func);
  1117. };
  1118. var realNames = {};
  1119. var objectProto$p = Object.prototype;
  1120. var hasOwnProperty$m = objectProto$p.hasOwnProperty;
  1121. function getFuncName(func) {
  1122. var result = func.name + "", array = realNames[result], length = hasOwnProperty$m.call(realNames, result) ? array.length : 0;
  1123. while (length--) {
  1124. var data = array[length], otherFunc = data.func;
  1125. if (otherFunc == null || otherFunc == func) {
  1126. return data.name;
  1127. }
  1128. }
  1129. return result;
  1130. }
  1131. function LodashWrapper(value, chainAll) {
  1132. this.__wrapped__ = value;
  1133. this.__actions__ = [];
  1134. this.__chain__ = !!chainAll;
  1135. this.__index__ = 0;
  1136. this.__values__ = void 0;
  1137. }
  1138. LodashWrapper.prototype = baseCreate(baseLodash.prototype);
  1139. LodashWrapper.prototype.constructor = LodashWrapper;
  1140. function copyArray(source, array) {
  1141. var index = -1, length = source.length;
  1142. array || (array = Array(length));
  1143. while (++index < length) {
  1144. array[index] = source[index];
  1145. }
  1146. return array;
  1147. }
  1148. function wrapperClone(wrapper) {
  1149. if (wrapper instanceof LazyWrapper) {
  1150. return wrapper.clone();
  1151. }
  1152. var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
  1153. result.__actions__ = copyArray(wrapper.__actions__);
  1154. result.__index__ = wrapper.__index__;
  1155. result.__values__ = wrapper.__values__;
  1156. return result;
  1157. }
  1158. var objectProto$o = Object.prototype;
  1159. var hasOwnProperty$l = objectProto$o.hasOwnProperty;
  1160. function lodash(value) {
  1161. if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
  1162. if (value instanceof LodashWrapper) {
  1163. return value;
  1164. }
  1165. if (hasOwnProperty$l.call(value, "__wrapped__")) {
  1166. return wrapperClone(value);
  1167. }
  1168. }
  1169. return new LodashWrapper(value);
  1170. }
  1171. lodash.prototype = baseLodash.prototype;
  1172. lodash.prototype.constructor = lodash;
  1173. function isLaziable(func) {
  1174. var funcName = getFuncName(func), other = lodash[funcName];
  1175. if (typeof other != "function" || !(funcName in LazyWrapper.prototype)) {
  1176. return false;
  1177. }
  1178. if (func === other) {
  1179. return true;
  1180. }
  1181. var data = getData(other);
  1182. return !!data && func === data[0];
  1183. }
  1184. var HOT_COUNT = 800;
  1185. var HOT_SPAN = 16;
  1186. var nativeNow = Date.now;
  1187. function shortOut(func) {
  1188. var count = 0, lastCalled = 0;
  1189. return function() {
  1190. var stamp = nativeNow(), remaining = HOT_SPAN - (stamp - lastCalled);
  1191. lastCalled = stamp;
  1192. if (remaining > 0) {
  1193. if (++count >= HOT_COUNT) {
  1194. return arguments[0];
  1195. }
  1196. } else {
  1197. count = 0;
  1198. }
  1199. return func.apply(void 0, arguments);
  1200. };
  1201. }
  1202. var setData = shortOut(baseSetData);
  1203. var reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/;
  1204. var reSplitDetails = /,? & /;
  1205. function getWrapDetails(source) {
  1206. var match = source.match(reWrapDetails);
  1207. return match ? match[1].split(reSplitDetails) : [];
  1208. }
  1209. var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/;
  1210. function insertWrapDetails(source, details) {
  1211. var length = details.length;
  1212. if (!length) {
  1213. return source;
  1214. }
  1215. var lastIndex = length - 1;
  1216. details[lastIndex] = (length > 1 ? "& " : "") + details[lastIndex];
  1217. details = details.join(length > 2 ? ", " : " ");
  1218. return source.replace(reWrapComment, "{\n/* [wrapped with " + details + "] */\n");
  1219. }
  1220. function constant(value) {
  1221. return function() {
  1222. return value;
  1223. };
  1224. }
  1225. var defineProperty = function() {
  1226. try {
  1227. var func = getNative(Object, "defineProperty");
  1228. func({}, "", {});
  1229. return func;
  1230. } catch (e) {
  1231. }
  1232. }();
  1233. var baseSetToString = !defineProperty ? identity : function(func, string) {
  1234. return defineProperty(func, "toString", {
  1235. "configurable": true,
  1236. "enumerable": false,
  1237. "value": constant(string),
  1238. "writable": true
  1239. });
  1240. };
  1241. var setToString = shortOut(baseSetToString);
  1242. function arrayEach(array, iteratee) {
  1243. var index = -1, length = array == null ? 0 : array.length;
  1244. while (++index < length) {
  1245. if (iteratee(array[index], index, array) === false) {
  1246. break;
  1247. }
  1248. }
  1249. return array;
  1250. }
  1251. function baseFindIndex(array, predicate, fromIndex, fromRight) {
  1252. var length = array.length, index = fromIndex + (fromRight ? 1 : -1);
  1253. while (fromRight ? index-- : ++index < length) {
  1254. if (predicate(array[index], index, array)) {
  1255. return index;
  1256. }
  1257. }
  1258. return -1;
  1259. }
  1260. function baseIsNaN(value) {
  1261. return value !== value;
  1262. }
  1263. function strictIndexOf(array, value, fromIndex) {
  1264. var index = fromIndex - 1, length = array.length;
  1265. while (++index < length) {
  1266. if (array[index] === value) {
  1267. return index;
  1268. }
  1269. }
  1270. return -1;
  1271. }
  1272. function baseIndexOf(array, value, fromIndex) {
  1273. return value === value ? strictIndexOf(array, value, fromIndex) : baseFindIndex(array, baseIsNaN, fromIndex);
  1274. }
  1275. function arrayIncludes(array, value) {
  1276. var length = array == null ? 0 : array.length;
  1277. return !!length && baseIndexOf(array, value, 0) > -1;
  1278. }
  1279. var WRAP_BIND_FLAG$7 = 1;
  1280. var WRAP_BIND_KEY_FLAG$6 = 2;
  1281. var WRAP_CURRY_FLAG$6 = 8;
  1282. var WRAP_CURRY_RIGHT_FLAG$3 = 16;
  1283. var WRAP_PARTIAL_FLAG$6 = 32;
  1284. var WRAP_PARTIAL_RIGHT_FLAG$3 = 64;
  1285. var WRAP_ARY_FLAG$4 = 128;
  1286. var WRAP_REARG_FLAG$3 = 256;
  1287. var WRAP_FLIP_FLAG$2 = 512;
  1288. var wrapFlags = [
  1289. ["ary", WRAP_ARY_FLAG$4],
  1290. ["bind", WRAP_BIND_FLAG$7],
  1291. ["bindKey", WRAP_BIND_KEY_FLAG$6],
  1292. ["curry", WRAP_CURRY_FLAG$6],
  1293. ["curryRight", WRAP_CURRY_RIGHT_FLAG$3],
  1294. ["flip", WRAP_FLIP_FLAG$2],
  1295. ["partial", WRAP_PARTIAL_FLAG$6],
  1296. ["partialRight", WRAP_PARTIAL_RIGHT_FLAG$3],
  1297. ["rearg", WRAP_REARG_FLAG$3]
  1298. ];
  1299. function updateWrapDetails(details, bitmask) {
  1300. arrayEach(wrapFlags, function(pair) {
  1301. var value = "_." + pair[0];
  1302. if (bitmask & pair[1] && !arrayIncludes(details, value)) {
  1303. details.push(value);
  1304. }
  1305. });
  1306. return details.sort();
  1307. }
  1308. function setWrapToString(wrapper, reference, bitmask) {
  1309. var source = reference + "";
  1310. return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
  1311. }
  1312. var WRAP_BIND_FLAG$6 = 1;
  1313. var WRAP_BIND_KEY_FLAG$5 = 2;
  1314. var WRAP_CURRY_BOUND_FLAG$1 = 4;
  1315. var WRAP_CURRY_FLAG$5 = 8;
  1316. var WRAP_PARTIAL_FLAG$5 = 32;
  1317. var WRAP_PARTIAL_RIGHT_FLAG$2 = 64;
  1318. function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
  1319. var isCurry = bitmask & WRAP_CURRY_FLAG$5, newHolders = isCurry ? holders : void 0, newHoldersRight = isCurry ? void 0 : holders, newPartials = isCurry ? partials : void 0, newPartialsRight = isCurry ? void 0 : partials;
  1320. bitmask |= isCurry ? WRAP_PARTIAL_FLAG$5 : WRAP_PARTIAL_RIGHT_FLAG$2;
  1321. bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG$2 : WRAP_PARTIAL_FLAG$5);
  1322. if (!(bitmask & WRAP_CURRY_BOUND_FLAG$1)) {
  1323. bitmask &= ~(WRAP_BIND_FLAG$6 | WRAP_BIND_KEY_FLAG$5);
  1324. }
  1325. var newData = [
  1326. func,
  1327. bitmask,
  1328. thisArg,
  1329. newPartials,
  1330. newHolders,
  1331. newPartialsRight,
  1332. newHoldersRight,
  1333. argPos,
  1334. ary,
  1335. arity
  1336. ];
  1337. var result = wrapFunc.apply(void 0, newData);
  1338. if (isLaziable(func)) {
  1339. setData(result, newData);
  1340. }
  1341. result.placeholder = placeholder;
  1342. return setWrapToString(result, func, bitmask);
  1343. }
  1344. function getHolder(func) {
  1345. var object = func;
  1346. return object.placeholder;
  1347. }
  1348. var MAX_SAFE_INTEGER$5 = 9007199254740991;
  1349. var reIsUint = /^(?:0|[1-9]\d*)$/;
  1350. function isIndex(value, length) {
  1351. var type = typeof value;
  1352. length = length == null ? MAX_SAFE_INTEGER$5 : length;
  1353. return !!length && (type == "number" || type != "symbol" && reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length);
  1354. }
  1355. var nativeMin$e = Math.min;
  1356. function reorder(array, indexes) {
  1357. var arrLength = array.length, length = nativeMin$e(indexes.length, arrLength), oldArray = copyArray(array);
  1358. while (length--) {
  1359. var index = indexes[length];
  1360. array[length] = isIndex(index, arrLength) ? oldArray[index] : void 0;
  1361. }
  1362. return array;
  1363. }
  1364. var PLACEHOLDER$1 = "__lodash_placeholder__";
  1365. function replaceHolders(array, placeholder) {
  1366. var index = -1, length = array.length, resIndex = 0, result = [];
  1367. while (++index < length) {
  1368. var value = array[index];
  1369. if (value === placeholder || value === PLACEHOLDER$1) {
  1370. array[index] = PLACEHOLDER$1;
  1371. result[resIndex++] = index;
  1372. }
  1373. }
  1374. return result;
  1375. }
  1376. var WRAP_BIND_FLAG$5 = 1;
  1377. var WRAP_BIND_KEY_FLAG$4 = 2;
  1378. var WRAP_CURRY_FLAG$4 = 8;
  1379. var WRAP_CURRY_RIGHT_FLAG$2 = 16;
  1380. var WRAP_ARY_FLAG$3 = 128;
  1381. var WRAP_FLIP_FLAG$1 = 512;
  1382. function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
  1383. var isAry = bitmask & WRAP_ARY_FLAG$3, isBind = bitmask & WRAP_BIND_FLAG$5, isBindKey = bitmask & WRAP_BIND_KEY_FLAG$4, isCurried = bitmask & (WRAP_CURRY_FLAG$4 | WRAP_CURRY_RIGHT_FLAG$2), isFlip = bitmask & WRAP_FLIP_FLAG$1, Ctor = isBindKey ? void 0 : createCtor(func);
  1384. function wrapper() {
  1385. var length = arguments.length, args = Array(length), index = length;
  1386. while (index--) {
  1387. args[index] = arguments[index];
  1388. }
  1389. if (isCurried) {
  1390. var placeholder = getHolder(wrapper), holdersCount = countHolders(args, placeholder);
  1391. }
  1392. if (partials) {
  1393. args = composeArgs(args, partials, holders, isCurried);
  1394. }
  1395. if (partialsRight) {
  1396. args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
  1397. }
  1398. length -= holdersCount;
  1399. if (isCurried && length < arity) {
  1400. var newHolders = replaceHolders(args, placeholder);
  1401. return createRecurry(func, bitmask, createHybrid, wrapper.placeholder, thisArg, args, newHolders, argPos, ary, arity - length);
  1402. }
  1403. var thisBinding = isBind ? thisArg : this, fn = isBindKey ? thisBinding[func] : func;
  1404. length = args.length;
  1405. if (argPos) {
  1406. args = reorder(args, argPos);
  1407. } else if (isFlip && length > 1) {
  1408. args.reverse();
  1409. }
  1410. if (isAry && ary < length) {
  1411. args.length = ary;
  1412. }
  1413. if (this && this !== root && this instanceof wrapper) {
  1414. fn = Ctor || createCtor(fn);
  1415. }
  1416. return fn.apply(thisBinding, args);
  1417. }
  1418. return wrapper;
  1419. }
  1420. function createCurry(func, bitmask, arity) {
  1421. var Ctor = createCtor(func);
  1422. function wrapper() {
  1423. var length = arguments.length, args = Array(length), index = length, placeholder = getHolder(wrapper);
  1424. while (index--) {
  1425. args[index] = arguments[index];
  1426. }
  1427. var holders = length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder ? [] : replaceHolders(args, placeholder);
  1428. length -= holders.length;
  1429. if (length < arity) {
  1430. return createRecurry(func, bitmask, createHybrid, wrapper.placeholder, void 0, args, holders, void 0, void 0, arity - length);
  1431. }
  1432. var fn = this && this !== root && this instanceof wrapper ? Ctor : func;
  1433. return apply(fn, this, args);
  1434. }
  1435. return wrapper;
  1436. }
  1437. var WRAP_BIND_FLAG$4 = 1;
  1438. function createPartial(func, bitmask, thisArg, partials) {
  1439. var isBind = bitmask & WRAP_BIND_FLAG$4, Ctor = createCtor(func);
  1440. function wrapper() {
  1441. var argsIndex = -1, argsLength = arguments.length, leftIndex = -1, leftLength = partials.length, args = Array(leftLength + argsLength), fn = this && this !== root && this instanceof wrapper ? Ctor : func;
  1442. while (++leftIndex < leftLength) {
  1443. args[leftIndex] = partials[leftIndex];
  1444. }
  1445. while (argsLength--) {
  1446. args[leftIndex++] = arguments[++argsIndex];
  1447. }
  1448. return apply(fn, isBind ? thisArg : this, args);
  1449. }
  1450. return wrapper;
  1451. }
  1452. var PLACEHOLDER = "__lodash_placeholder__";
  1453. var WRAP_BIND_FLAG$3 = 1;
  1454. var WRAP_BIND_KEY_FLAG$3 = 2;
  1455. var WRAP_CURRY_BOUND_FLAG = 4;
  1456. var WRAP_CURRY_FLAG$3 = 8;
  1457. var WRAP_ARY_FLAG$2 = 128;
  1458. var WRAP_REARG_FLAG$2 = 256;
  1459. var nativeMin$d = Math.min;
  1460. function mergeData(data, source) {
  1461. var bitmask = data[1], srcBitmask = source[1], newBitmask = bitmask | srcBitmask, isCommon = newBitmask < (WRAP_BIND_FLAG$3 | WRAP_BIND_KEY_FLAG$3 | WRAP_ARY_FLAG$2);
  1462. var isCombo = srcBitmask == WRAP_ARY_FLAG$2 && bitmask == WRAP_CURRY_FLAG$3 || srcBitmask == WRAP_ARY_FLAG$2 && bitmask == WRAP_REARG_FLAG$2 && data[7].length <= source[8] || srcBitmask == (WRAP_ARY_FLAG$2 | WRAP_REARG_FLAG$2) && source[7].length <= source[8] && bitmask == WRAP_CURRY_FLAG$3;
  1463. if (!(isCommon || isCombo)) {
  1464. return data;
  1465. }
  1466. if (srcBitmask & WRAP_BIND_FLAG$3) {
  1467. data[2] = source[2];
  1468. newBitmask |= bitmask & WRAP_BIND_FLAG$3 ? 0 : WRAP_CURRY_BOUND_FLAG;
  1469. }
  1470. var value = source[3];
  1471. if (value) {
  1472. var partials = data[3];
  1473. data[3] = partials ? composeArgs(partials, value, source[4]) : value;
  1474. data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
  1475. }
  1476. value = source[5];
  1477. if (value) {
  1478. partials = data[5];
  1479. data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
  1480. data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
  1481. }
  1482. value = source[7];
  1483. if (value) {
  1484. data[7] = value;
  1485. }
  1486. if (srcBitmask & WRAP_ARY_FLAG$2) {
  1487. data[8] = data[8] == null ? source[8] : nativeMin$d(data[8], source[8]);
  1488. }
  1489. if (data[9] == null) {
  1490. data[9] = source[9];
  1491. }
  1492. data[0] = source[0];
  1493. data[1] = newBitmask;
  1494. return data;
  1495. }
  1496. var FUNC_ERROR_TEXT$a = "Expected a function";
  1497. var WRAP_BIND_FLAG$2 = 1;
  1498. var WRAP_BIND_KEY_FLAG$2 = 2;
  1499. var WRAP_CURRY_FLAG$2 = 8;
  1500. var WRAP_CURRY_RIGHT_FLAG$1 = 16;
  1501. var WRAP_PARTIAL_FLAG$4 = 32;
  1502. var WRAP_PARTIAL_RIGHT_FLAG$1 = 64;
  1503. var nativeMax$e = Math.max;
  1504. function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
  1505. var isBindKey = bitmask & WRAP_BIND_KEY_FLAG$2;
  1506. if (!isBindKey && typeof func != "function") {
  1507. throw new TypeError(FUNC_ERROR_TEXT$a);
  1508. }
  1509. var length = partials ? partials.length : 0;
  1510. if (!length) {
  1511. bitmask &= ~(WRAP_PARTIAL_FLAG$4 | WRAP_PARTIAL_RIGHT_FLAG$1);
  1512. partials = holders = void 0;
  1513. }
  1514. ary = ary === void 0 ? ary : nativeMax$e(toInteger(ary), 0);
  1515. arity = arity === void 0 ? arity : toInteger(arity);
  1516. length -= holders ? holders.length : 0;
  1517. if (bitmask & WRAP_PARTIAL_RIGHT_FLAG$1) {
  1518. var partialsRight = partials, holdersRight = holders;
  1519. partials = holders = void 0;
  1520. }
  1521. var data = isBindKey ? void 0 : getData(func);
  1522. var newData = [
  1523. func,
  1524. bitmask,
  1525. thisArg,
  1526. partials,
  1527. holders,
  1528. partialsRight,
  1529. holdersRight,
  1530. argPos,
  1531. ary,
  1532. arity
  1533. ];
  1534. if (data) {
  1535. mergeData(newData, data);
  1536. }
  1537. func = newData[0];
  1538. bitmask = newData[1];
  1539. thisArg = newData[2];
  1540. partials = newData[3];
  1541. holders = newData[4];
  1542. arity = newData[9] = newData[9] === void 0 ? isBindKey ? 0 : func.length : nativeMax$e(newData[9] - length, 0);
  1543. if (!arity && bitmask & (WRAP_CURRY_FLAG$2 | WRAP_CURRY_RIGHT_FLAG$1)) {
  1544. bitmask &= ~(WRAP_CURRY_FLAG$2 | WRAP_CURRY_RIGHT_FLAG$1);
  1545. }
  1546. if (!bitmask || bitmask == WRAP_BIND_FLAG$2) {
  1547. var result = createBind(func, bitmask, thisArg);
  1548. } else if (bitmask == WRAP_CURRY_FLAG$2 || bitmask == WRAP_CURRY_RIGHT_FLAG$1) {
  1549. result = createCurry(func, bitmask, arity);
  1550. } else if ((bitmask == WRAP_PARTIAL_FLAG$4 || bitmask == (WRAP_BIND_FLAG$2 | WRAP_PARTIAL_FLAG$4)) && !holders.length) {
  1551. result = createPartial(func, bitmask, thisArg, partials);
  1552. } else {
  1553. result = createHybrid.apply(void 0, newData);
  1554. }
  1555. var setter = data ? baseSetData : setData;
  1556. return setWrapToString(setter(result, newData), func, bitmask);
  1557. }
  1558. var WRAP_ARY_FLAG$1 = 128;
  1559. function ary(func, n, guard) {
  1560. n = guard ? void 0 : n;
  1561. n = func && n == null ? func.length : n;
  1562. return createWrap(func, WRAP_ARY_FLAG$1, void 0, void 0, void 0, void 0, n);
  1563. }
  1564. function baseAssignValue(object, key, value) {
  1565. if (key == "__proto__" && defineProperty) {
  1566. defineProperty(object, key, {
  1567. "configurable": true,
  1568. "enumerable": true,
  1569. "value": value,
  1570. "writable": true
  1571. });
  1572. } else {
  1573. object[key] = value;
  1574. }
  1575. }
  1576. function eq(value, other) {
  1577. return value === other || value !== value && other !== other;
  1578. }
  1579. var objectProto$n = Object.prototype;
  1580. var hasOwnProperty$k = objectProto$n.hasOwnProperty;
  1581. function assignValue(object, key, value) {
  1582. var objValue = object[key];
  1583. if (!(hasOwnProperty$k.call(object, key) && eq(objValue, value)) || value === void 0 && !(key in object)) {
  1584. baseAssignValue(object, key, value);
  1585. }
  1586. }
  1587. function copyObject(source, props, object, customizer) {
  1588. var isNew = !object;
  1589. object || (object = {});
  1590. var index = -1, length = props.length;
  1591. while (++index < length) {
  1592. var key = props[index];
  1593. var newValue = customizer ? customizer(object[key], source[key], key, object, source) : void 0;
  1594. if (newValue === void 0) {
  1595. newValue = source[key];
  1596. }
  1597. if (isNew) {
  1598. baseAssignValue(object, key, newValue);
  1599. } else {
  1600. assignValue(object, key, newValue);
  1601. }
  1602. }
  1603. return object;
  1604. }
  1605. var nativeMax$d = Math.max;
  1606. function overRest(func, start, transform) {
  1607. start = nativeMax$d(start === void 0 ? func.length - 1 : start, 0);
  1608. return function() {
  1609. var args = arguments, index = -1, length = nativeMax$d(args.length - start, 0), array = Array(length);
  1610. while (++index < length) {
  1611. array[index] = args[start + index];
  1612. }
  1613. index = -1;
  1614. var otherArgs = Array(start + 1);
  1615. while (++index < start) {
  1616. otherArgs[index] = args[index];
  1617. }
  1618. otherArgs[start] = transform(array);
  1619. return apply(func, this, otherArgs);
  1620. };
  1621. }
  1622. function baseRest(func, start) {
  1623. return setToString(overRest(func, start, identity), func + "");
  1624. }
  1625. var MAX_SAFE_INTEGER$4 = 9007199254740991;
  1626. function isLength(value) {
  1627. return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER$4;
  1628. }
  1629. function isArrayLike(value) {
  1630. return value != null && isLength(value.length) && !isFunction(value);
  1631. }
  1632. function isIterateeCall(value, index, object) {
  1633. if (!isObject(object)) {
  1634. return false;
  1635. }
  1636. var type = typeof index;
  1637. if (type == "number" ? isArrayLike(object) && isIndex(index, object.length) : type == "string" && index in object) {
  1638. return eq(object[index], value);
  1639. }
  1640. return false;
  1641. }
  1642. function createAssigner(assigner) {
  1643. return baseRest(function(object, sources) {
  1644. var index = -1, length = sources.length, customizer = length > 1 ? sources[length - 1] : void 0, guard = length > 2 ? sources[2] : void 0;
  1645. customizer = assigner.length > 3 && typeof customizer == "function" ? (length--, customizer) : void 0;
  1646. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  1647. customizer = length < 3 ? void 0 : customizer;
  1648. length = 1;
  1649. }
  1650. object = Object(object);
  1651. while (++index < length) {
  1652. var source = sources[index];
  1653. if (source) {
  1654. assigner(object, source, index, customizer);
  1655. }
  1656. }
  1657. return object;
  1658. });
  1659. }
  1660. var objectProto$m = Object.prototype;
  1661. function isPrototype(value) {
  1662. var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto$m;
  1663. return value === proto;
  1664. }
  1665. function baseTimes(n, iteratee) {
  1666. var index = -1, result = Array(n);
  1667. while (++index < n) {
  1668. result[index] = iteratee(index);
  1669. }
  1670. return result;
  1671. }
  1672. var argsTag$3 = "[object Arguments]";
  1673. function baseIsArguments(value) {
  1674. return isObjectLike(value) && baseGetTag(value) == argsTag$3;
  1675. }
  1676. var objectProto$l = Object.prototype;
  1677. var hasOwnProperty$j = objectProto$l.hasOwnProperty;
  1678. var propertyIsEnumerable$1 = objectProto$l.propertyIsEnumerable;
  1679. var isArguments = baseIsArguments(function() {
  1680. return arguments;
  1681. }()) ? baseIsArguments : function(value) {
  1682. return isObjectLike(value) && hasOwnProperty$j.call(value, "callee") && !propertyIsEnumerable$1.call(value, "callee");
  1683. };
  1684. function stubFalse() {
  1685. return false;
  1686. }
  1687. var freeExports$2 = typeof exports == "object" && exports && !exports.nodeType && exports;
  1688. var freeModule$2 = freeExports$2 && typeof module == "object" && module && !module.nodeType && module;
  1689. var moduleExports$2 = freeModule$2 && freeModule$2.exports === freeExports$2;
  1690. var Buffer$1 = moduleExports$2 ? root.Buffer : void 0;
  1691. var nativeIsBuffer = Buffer$1 ? Buffer$1.isBuffer : void 0;
  1692. var isBuffer = nativeIsBuffer || stubFalse;
  1693. var argsTag$2 = "[object Arguments]";
  1694. var arrayTag$2 = "[object Array]";
  1695. var boolTag$4 = "[object Boolean]";
  1696. var dateTag$4 = "[object Date]";
  1697. var errorTag$3 = "[object Error]";
  1698. var funcTag$1 = "[object Function]";
  1699. var mapTag$9 = "[object Map]";
  1700. var numberTag$4 = "[object Number]";
  1701. var objectTag$4 = "[object Object]";
  1702. var regexpTag$4 = "[object RegExp]";
  1703. var setTag$9 = "[object Set]";
  1704. var stringTag$4 = "[object String]";
  1705. var weakMapTag$3 = "[object WeakMap]";
  1706. var arrayBufferTag$4 = "[object ArrayBuffer]";
  1707. var dataViewTag$4 = "[object DataView]";
  1708. var float32Tag$2 = "[object Float32Array]";
  1709. var float64Tag$2 = "[object Float64Array]";
  1710. var int8Tag$2 = "[object Int8Array]";
  1711. var int16Tag$2 = "[object Int16Array]";
  1712. var int32Tag$2 = "[object Int32Array]";
  1713. var uint8Tag$2 = "[object Uint8Array]";
  1714. var uint8ClampedTag$2 = "[object Uint8ClampedArray]";
  1715. var uint16Tag$2 = "[object Uint16Array]";
  1716. var uint32Tag$2 = "[object Uint32Array]";
  1717. var typedArrayTags = {};
  1718. typedArrayTags[float32Tag$2] = typedArrayTags[float64Tag$2] = typedArrayTags[int8Tag$2] = typedArrayTags[int16Tag$2] = typedArrayTags[int32Tag$2] = typedArrayTags[uint8Tag$2] = typedArrayTags[uint8ClampedTag$2] = typedArrayTags[uint16Tag$2] = typedArrayTags[uint32Tag$2] = true;
  1719. typedArrayTags[argsTag$2] = typedArrayTags[arrayTag$2] = typedArrayTags[arrayBufferTag$4] = typedArrayTags[boolTag$4] = typedArrayTags[dataViewTag$4] = typedArrayTags[dateTag$4] = typedArrayTags[errorTag$3] = typedArrayTags[funcTag$1] = typedArrayTags[mapTag$9] = typedArrayTags[numberTag$4] = typedArrayTags[objectTag$4] = typedArrayTags[regexpTag$4] = typedArrayTags[setTag$9] = typedArrayTags[stringTag$4] = typedArrayTags[weakMapTag$3] = false;
  1720. function baseIsTypedArray(value) {
  1721. return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
  1722. }
  1723. function baseUnary(func) {
  1724. return function(value) {
  1725. return func(value);
  1726. };
  1727. }
  1728. var freeExports$1 = typeof exports == "object" && exports && !exports.nodeType && exports;
  1729. var freeModule$1 = freeExports$1 && typeof module == "object" && module && !module.nodeType && module;
  1730. var moduleExports$1 = freeModule$1 && freeModule$1.exports === freeExports$1;
  1731. var freeProcess = moduleExports$1 && freeGlobal.process;
  1732. var nodeUtil = function() {
  1733. try {
  1734. var types = freeModule$1 && freeModule$1.require && freeModule$1.require("util").types;
  1735. if (types) {
  1736. return types;
  1737. }
  1738. return freeProcess && freeProcess.binding && freeProcess.binding("util");
  1739. } catch (e) {
  1740. }
  1741. }();
  1742. var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
  1743. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  1744. var objectProto$k = Object.prototype;
  1745. var hasOwnProperty$i = objectProto$k.hasOwnProperty;
  1746. function arrayLikeKeys(value, inherited) {
  1747. var isArr = isArray(value), isArg = !isArr && isArguments(value), isBuff = !isArr && !isArg && isBuffer(value), isType = !isArr && !isArg && !isBuff && isTypedArray(value), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes(value.length, String) : [], length = result.length;
  1748. for (var key in value) {
  1749. if ((inherited || hasOwnProperty$i.call(value, key)) && !(skipIndexes && (key == "length" || isBuff && (key == "offset" || key == "parent") || isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || isIndex(key, length)))) {
  1750. result.push(key);
  1751. }
  1752. }
  1753. return result;
  1754. }
  1755. function overArg(func, transform) {
  1756. return function(arg) {
  1757. return func(transform(arg));
  1758. };
  1759. }
  1760. var nativeKeys = overArg(Object.keys, Object);
  1761. var objectProto$j = Object.prototype;
  1762. var hasOwnProperty$h = objectProto$j.hasOwnProperty;
  1763. function baseKeys(object) {
  1764. if (!isPrototype(object)) {
  1765. return nativeKeys(object);
  1766. }
  1767. var result = [];
  1768. for (var key in Object(object)) {
  1769. if (hasOwnProperty$h.call(object, key) && key != "constructor") {
  1770. result.push(key);
  1771. }
  1772. }
  1773. return result;
  1774. }
  1775. function keys(object) {
  1776. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  1777. }
  1778. var objectProto$i = Object.prototype;
  1779. var hasOwnProperty$g = objectProto$i.hasOwnProperty;
  1780. var assign = createAssigner(function(object, source) {
  1781. if (isPrototype(source) || isArrayLike(source)) {
  1782. copyObject(source, keys(source), object);
  1783. return;
  1784. }
  1785. for (var key in source) {
  1786. if (hasOwnProperty$g.call(source, key)) {
  1787. assignValue(object, key, source[key]);
  1788. }
  1789. }
  1790. });
  1791. function nativeKeysIn(object) {
  1792. var result = [];
  1793. if (object != null) {
  1794. for (var key in Object(object)) {
  1795. result.push(key);
  1796. }
  1797. }
  1798. return result;
  1799. }
  1800. var objectProto$h = Object.prototype;
  1801. var hasOwnProperty$f = objectProto$h.hasOwnProperty;
  1802. function baseKeysIn(object) {
  1803. if (!isObject(object)) {
  1804. return nativeKeysIn(object);
  1805. }
  1806. var isProto = isPrototype(object), result = [];
  1807. for (var key in object) {
  1808. if (!(key == "constructor" && (isProto || !hasOwnProperty$f.call(object, key)))) {
  1809. result.push(key);
  1810. }
  1811. }
  1812. return result;
  1813. }
  1814. function keysIn(object) {
  1815. return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
  1816. }
  1817. var assignIn = createAssigner(function(object, source) {
  1818. copyObject(source, keysIn(source), object);
  1819. });
  1820. var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
  1821. copyObject(source, keysIn(source), object, customizer);
  1822. });
  1823. var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
  1824. copyObject(source, keys(source), object, customizer);
  1825. });
  1826. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/;
  1827. var reIsPlainProp = /^\w*$/;
  1828. function isKey(value, object) {
  1829. if (isArray(value)) {
  1830. return false;
  1831. }
  1832. var type = typeof value;
  1833. if (type == "number" || type == "symbol" || type == "boolean" || value == null || isSymbol(value)) {
  1834. return true;
  1835. }
  1836. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object(object);
  1837. }
  1838. var nativeCreate = getNative(Object, "create");
  1839. function hashClear() {
  1840. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  1841. this.size = 0;
  1842. }
  1843. function hashDelete(key) {
  1844. var result = this.has(key) && delete this.__data__[key];
  1845. this.size -= result ? 1 : 0;
  1846. return result;
  1847. }
  1848. var HASH_UNDEFINED$2 = "__lodash_hash_undefined__";
  1849. var objectProto$g = Object.prototype;
  1850. var hasOwnProperty$e = objectProto$g.hasOwnProperty;
  1851. function hashGet(key) {
  1852. var data = this.__data__;
  1853. if (nativeCreate) {
  1854. var result = data[key];
  1855. return result === HASH_UNDEFINED$2 ? void 0 : result;
  1856. }
  1857. return hasOwnProperty$e.call(data, key) ? data[key] : void 0;
  1858. }
  1859. var objectProto$f = Object.prototype;
  1860. var hasOwnProperty$d = objectProto$f.hasOwnProperty;
  1861. function hashHas(key) {
  1862. var data = this.__data__;
  1863. return nativeCreate ? data[key] !== void 0 : hasOwnProperty$d.call(data, key);
  1864. }
  1865. var HASH_UNDEFINED$1 = "__lodash_hash_undefined__";
  1866. function hashSet(key, value) {
  1867. var data = this.__data__;
  1868. this.size += this.has(key) ? 0 : 1;
  1869. data[key] = nativeCreate && value === void 0 ? HASH_UNDEFINED$1 : value;
  1870. return this;
  1871. }
  1872. function Hash(entries) {
  1873. var index = -1, length = entries == null ? 0 : entries.length;
  1874. this.clear();
  1875. while (++index < length) {
  1876. var entry = entries[index];
  1877. this.set(entry[0], entry[1]);
  1878. }
  1879. }
  1880. Hash.prototype.clear = hashClear;
  1881. Hash.prototype["delete"] = hashDelete;
  1882. Hash.prototype.get = hashGet;
  1883. Hash.prototype.has = hashHas;
  1884. Hash.prototype.set = hashSet;
  1885. function listCacheClear() {
  1886. this.__data__ = [];
  1887. this.size = 0;
  1888. }
  1889. function assocIndexOf(array, key) {
  1890. var length = array.length;
  1891. while (length--) {
  1892. if (eq(array[length][0], key)) {
  1893. return length;
  1894. }
  1895. }
  1896. return -1;
  1897. }
  1898. var arrayProto$5 = Array.prototype;
  1899. var splice$2 = arrayProto$5.splice;
  1900. function listCacheDelete(key) {
  1901. var data = this.__data__, index = assocIndexOf(data, key);
  1902. if (index < 0) {
  1903. return false;
  1904. }
  1905. var lastIndex = data.length - 1;
  1906. if (index == lastIndex) {
  1907. data.pop();
  1908. } else {
  1909. splice$2.call(data, index, 1);
  1910. }
  1911. --this.size;
  1912. return true;
  1913. }
  1914. function listCacheGet(key) {
  1915. var data = this.__data__, index = assocIndexOf(data, key);
  1916. return index < 0 ? void 0 : data[index][1];
  1917. }
  1918. function listCacheHas(key) {
  1919. return assocIndexOf(this.__data__, key) > -1;
  1920. }
  1921. function listCacheSet(key, value) {
  1922. var data = this.__data__, index = assocIndexOf(data, key);
  1923. if (index < 0) {
  1924. ++this.size;
  1925. data.push([key, value]);
  1926. } else {
  1927. data[index][1] = value;
  1928. }
  1929. return this;
  1930. }
  1931. function ListCache(entries) {
  1932. var index = -1, length = entries == null ? 0 : entries.length;
  1933. this.clear();
  1934. while (++index < length) {
  1935. var entry = entries[index];
  1936. this.set(entry[0], entry[1]);
  1937. }
  1938. }
  1939. ListCache.prototype.clear = listCacheClear;
  1940. ListCache.prototype["delete"] = listCacheDelete;
  1941. ListCache.prototype.get = listCacheGet;
  1942. ListCache.prototype.has = listCacheHas;
  1943. ListCache.prototype.set = listCacheSet;
  1944. var Map$1 = getNative(root, "Map");
  1945. function mapCacheClear() {
  1946. this.size = 0;
  1947. this.__data__ = {
  1948. "hash": new Hash(),
  1949. "map": new (Map$1 || ListCache)(),
  1950. "string": new Hash()
  1951. };
  1952. }
  1953. function isKeyable(value) {
  1954. var type = typeof value;
  1955. return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null;
  1956. }
  1957. function getMapData(map, key) {
  1958. var data = map.__data__;
  1959. return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
  1960. }
  1961. function mapCacheDelete(key) {
  1962. var result = getMapData(this, key)["delete"](key);
  1963. this.size -= result ? 1 : 0;
  1964. return result;
  1965. }
  1966. function mapCacheGet(key) {
  1967. return getMapData(this, key).get(key);
  1968. }
  1969. function mapCacheHas(key) {
  1970. return getMapData(this, key).has(key);
  1971. }
  1972. function mapCacheSet(key, value) {
  1973. var data = getMapData(this, key), size = data.size;
  1974. data.set(key, value);
  1975. this.size += data.size == size ? 0 : 1;
  1976. return this;
  1977. }
  1978. function MapCache(entries) {
  1979. var index = -1, length = entries == null ? 0 : entries.length;
  1980. this.clear();
  1981. while (++index < length) {
  1982. var entry = entries[index];
  1983. this.set(entry[0], entry[1]);
  1984. }
  1985. }
  1986. MapCache.prototype.clear = mapCacheClear;
  1987. MapCache.prototype["delete"] = mapCacheDelete;
  1988. MapCache.prototype.get = mapCacheGet;
  1989. MapCache.prototype.has = mapCacheHas;
  1990. MapCache.prototype.set = mapCacheSet;
  1991. var FUNC_ERROR_TEXT$9 = "Expected a function";
  1992. function memoize(func, resolver) {
  1993. if (typeof func != "function" || resolver != null && typeof resolver != "function") {
  1994. throw new TypeError(FUNC_ERROR_TEXT$9);
  1995. }
  1996. var memoized = function() {
  1997. var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache;
  1998. if (cache.has(key)) {
  1999. return cache.get(key);
  2000. }
  2001. var result = func.apply(this, args);
  2002. memoized.cache = cache.set(key, result) || cache;
  2003. return result;
  2004. };
  2005. memoized.cache = new (memoize.Cache || MapCache)();
  2006. return memoized;
  2007. }
  2008. memoize.Cache = MapCache;
  2009. var MAX_MEMOIZE_SIZE = 500;
  2010. function memoizeCapped(func) {
  2011. var result = memoize(func, function(key) {
  2012. if (cache.size === MAX_MEMOIZE_SIZE) {
  2013. cache.clear();
  2014. }
  2015. return key;
  2016. });
  2017. var cache = result.cache;
  2018. return result;
  2019. }
  2020. var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  2021. var reEscapeChar = /\\(\\)?/g;
  2022. var stringToPath = memoizeCapped(function(string) {
  2023. var result = [];
  2024. if (string.charCodeAt(0) === 46) {
  2025. result.push("");
  2026. }
  2027. string.replace(rePropName, function(match, number, quote, subString) {
  2028. result.push(quote ? subString.replace(reEscapeChar, "$1") : number || match);
  2029. });
  2030. return result;
  2031. });
  2032. function toString(value) {
  2033. return value == null ? "" : baseToString(value);
  2034. }
  2035. function castPath(value, object) {
  2036. if (isArray(value)) {
  2037. return value;
  2038. }
  2039. return isKey(value, object) ? [value] : stringToPath(toString(value));
  2040. }
  2041. var INFINITY$3 = 1 / 0;
  2042. function toKey(value) {
  2043. if (typeof value == "string" || isSymbol(value)) {
  2044. return value;
  2045. }
  2046. var result = value + "";
  2047. return result == "0" && 1 / value == -INFINITY$3 ? "-0" : result;
  2048. }
  2049. function baseGet(object, path) {
  2050. path = castPath(path, object);
  2051. var index = 0, length = path.length;
  2052. while (object != null && index < length) {
  2053. object = object[toKey(path[index++])];
  2054. }
  2055. return index && index == length ? object : void 0;
  2056. }
  2057. function get(object, path, defaultValue) {
  2058. var result = object == null ? void 0 : baseGet(object, path);
  2059. return result === void 0 ? defaultValue : result;
  2060. }
  2061. function baseAt(object, paths) {
  2062. var index = -1, length = paths.length, result = Array(length), skip = object == null;
  2063. while (++index < length) {
  2064. result[index] = skip ? void 0 : get(object, paths[index]);
  2065. }
  2066. return result;
  2067. }
  2068. function arrayPush(array, values) {
  2069. var index = -1, length = values.length, offset = array.length;
  2070. while (++index < length) {
  2071. array[offset + index] = values[index];
  2072. }
  2073. return array;
  2074. }
  2075. var spreadableSymbol = Symbol$1 ? Symbol$1.isConcatSpreadable : void 0;
  2076. function isFlattenable(value) {
  2077. return isArray(value) || isArguments(value) || !!(spreadableSymbol && value && value[spreadableSymbol]);
  2078. }
  2079. function baseFlatten(array, depth, predicate, isStrict, result) {
  2080. var index = -1, length = array.length;
  2081. predicate || (predicate = isFlattenable);
  2082. result || (result = []);
  2083. while (++index < length) {
  2084. var value = array[index];
  2085. if (depth > 0 && predicate(value)) {
  2086. if (depth > 1) {
  2087. baseFlatten(value, depth - 1, predicate, isStrict, result);
  2088. } else {
  2089. arrayPush(result, value);
  2090. }
  2091. } else if (!isStrict) {
  2092. result[result.length] = value;
  2093. }
  2094. }
  2095. return result;
  2096. }
  2097. function flatten(array) {
  2098. var length = array == null ? 0 : array.length;
  2099. return length ? baseFlatten(array, 1) : [];
  2100. }
  2101. function flatRest(func) {
  2102. return setToString(overRest(func, void 0, flatten), func + "");
  2103. }
  2104. var at$1 = flatRest(baseAt);
  2105. var getPrototype = overArg(Object.getPrototypeOf, Object);
  2106. var objectTag$3 = "[object Object]";
  2107. var funcProto = Function.prototype;
  2108. var objectProto$e = Object.prototype;
  2109. var funcToString = funcProto.toString;
  2110. var hasOwnProperty$c = objectProto$e.hasOwnProperty;
  2111. var objectCtorString = funcToString.call(Object);
  2112. function isPlainObject(value) {
  2113. if (!isObjectLike(value) || baseGetTag(value) != objectTag$3) {
  2114. return false;
  2115. }
  2116. var proto = getPrototype(value);
  2117. if (proto === null) {
  2118. return true;
  2119. }
  2120. var Ctor = hasOwnProperty$c.call(proto, "constructor") && proto.constructor;
  2121. return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString;
  2122. }
  2123. var domExcTag = "[object DOMException]";
  2124. var errorTag$2 = "[object Error]";
  2125. function isError(value) {
  2126. if (!isObjectLike(value)) {
  2127. return false;
  2128. }
  2129. var tag = baseGetTag(value);
  2130. return tag == errorTag$2 || tag == domExcTag || typeof value.message == "string" && typeof value.name == "string" && !isPlainObject(value);
  2131. }
  2132. var attempt = baseRest(function(func, args) {
  2133. try {
  2134. return apply(func, void 0, args);
  2135. } catch (e) {
  2136. return isError(e) ? e : new Error(e);
  2137. }
  2138. });
  2139. var FUNC_ERROR_TEXT$8 = "Expected a function";
  2140. function before(n, func) {
  2141. var result;
  2142. if (typeof func != "function") {
  2143. throw new TypeError(FUNC_ERROR_TEXT$8);
  2144. }
  2145. n = toInteger(n);
  2146. return function() {
  2147. if (--n > 0) {
  2148. result = func.apply(this, arguments);
  2149. }
  2150. if (n <= 1) {
  2151. func = void 0;
  2152. }
  2153. return result;
  2154. };
  2155. }
  2156. var WRAP_BIND_FLAG$1 = 1;
  2157. var WRAP_PARTIAL_FLAG$3 = 32;
  2158. var bind = baseRest(function(func, thisArg, partials) {
  2159. var bitmask = WRAP_BIND_FLAG$1;
  2160. if (partials.length) {
  2161. var holders = replaceHolders(partials, getHolder(bind));
  2162. bitmask |= WRAP_PARTIAL_FLAG$3;
  2163. }
  2164. return createWrap(func, bitmask, thisArg, partials, holders);
  2165. });
  2166. bind.placeholder = {};
  2167. var bindAll = flatRest(function(object, methodNames) {
  2168. arrayEach(methodNames, function(key) {
  2169. key = toKey(key);
  2170. baseAssignValue(object, key, bind(object[key], object));
  2171. });
  2172. return object;
  2173. });
  2174. var WRAP_BIND_FLAG = 1;
  2175. var WRAP_BIND_KEY_FLAG$1 = 2;
  2176. var WRAP_PARTIAL_FLAG$2 = 32;
  2177. var bindKey = baseRest(function(object, key, partials) {
  2178. var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG$1;
  2179. if (partials.length) {
  2180. var holders = replaceHolders(partials, getHolder(bindKey));
  2181. bitmask |= WRAP_PARTIAL_FLAG$2;
  2182. }
  2183. return createWrap(key, bitmask, object, partials, holders);
  2184. });
  2185. bindKey.placeholder = {};
  2186. function baseSlice(array, start, end) {
  2187. var index = -1, length = array.length;
  2188. if (start < 0) {
  2189. start = -start > length ? 0 : length + start;
  2190. }
  2191. end = end > length ? length : end;
  2192. if (end < 0) {
  2193. end += length;
  2194. }
  2195. length = start > end ? 0 : end - start >>> 0;
  2196. start >>>= 0;
  2197. var result = Array(length);
  2198. while (++index < length) {
  2199. result[index] = array[index + start];
  2200. }
  2201. return result;
  2202. }
  2203. function castSlice(array, start, end) {
  2204. var length = array.length;
  2205. end = end === void 0 ? length : end;
  2206. return !start && end >= length ? array : baseSlice(array, start, end);
  2207. }
  2208. var rsAstralRange$3 = "\\ud800-\\udfff";
  2209. var rsComboMarksRange$4 = "\\u0300-\\u036f";
  2210. var reComboHalfMarksRange$4 = "\\ufe20-\\ufe2f";
  2211. var rsComboSymbolsRange$4 = "\\u20d0-\\u20ff";
  2212. var rsComboRange$4 = rsComboMarksRange$4 + reComboHalfMarksRange$4 + rsComboSymbolsRange$4;
  2213. var rsVarRange$3 = "\\ufe0e\\ufe0f";
  2214. var rsZWJ$3 = "\\u200d";
  2215. var reHasUnicode = RegExp("[" + rsZWJ$3 + rsAstralRange$3 + rsComboRange$4 + rsVarRange$3 + "]");
  2216. function hasUnicode(string) {
  2217. return reHasUnicode.test(string);
  2218. }
  2219. function asciiToArray(string) {
  2220. return string.split("");
  2221. }
  2222. var rsAstralRange$2 = "\\ud800-\\udfff";
  2223. var rsComboMarksRange$3 = "\\u0300-\\u036f";
  2224. var reComboHalfMarksRange$3 = "\\ufe20-\\ufe2f";
  2225. var rsComboSymbolsRange$3 = "\\u20d0-\\u20ff";
  2226. var rsComboRange$3 = rsComboMarksRange$3 + reComboHalfMarksRange$3 + rsComboSymbolsRange$3;
  2227. var rsVarRange$2 = "\\ufe0e\\ufe0f";
  2228. var rsAstral$1 = "[" + rsAstralRange$2 + "]";
  2229. var rsCombo$3 = "[" + rsComboRange$3 + "]";
  2230. var rsFitz$2 = "\\ud83c[\\udffb-\\udfff]";
  2231. var rsModifier$2 = "(?:" + rsCombo$3 + "|" + rsFitz$2 + ")";
  2232. var rsNonAstral$2 = "[^" + rsAstralRange$2 + "]";
  2233. var rsRegional$2 = "(?:\\ud83c[\\udde6-\\uddff]){2}";
  2234. var rsSurrPair$2 = "[\\ud800-\\udbff][\\udc00-\\udfff]";
  2235. var rsZWJ$2 = "\\u200d";
  2236. var reOptMod$2 = rsModifier$2 + "?";
  2237. var rsOptVar$2 = "[" + rsVarRange$2 + "]?";
  2238. var rsOptJoin$2 = "(?:" + rsZWJ$2 + "(?:" + [rsNonAstral$2, rsRegional$2, rsSurrPair$2].join("|") + ")" + rsOptVar$2 + reOptMod$2 + ")*";
  2239. var rsSeq$2 = rsOptVar$2 + reOptMod$2 + rsOptJoin$2;
  2240. var rsSymbol$1 = "(?:" + [rsNonAstral$2 + rsCombo$3 + "?", rsCombo$3, rsRegional$2, rsSurrPair$2, rsAstral$1].join("|") + ")";
  2241. var reUnicode$1 = RegExp(rsFitz$2 + "(?=" + rsFitz$2 + ")|" + rsSymbol$1 + rsSeq$2, "g");
  2242. function unicodeToArray(string) {
  2243. return string.match(reUnicode$1) || [];
  2244. }
  2245. function stringToArray(string) {
  2246. return hasUnicode(string) ? unicodeToArray(string) : asciiToArray(string);
  2247. }
  2248. function createCaseFirst(methodName) {
  2249. return function(string) {
  2250. string = toString(string);
  2251. var strSymbols = hasUnicode(string) ? stringToArray(string) : void 0;
  2252. var chr = strSymbols ? strSymbols[0] : string.charAt(0);
  2253. var trailing = strSymbols ? castSlice(strSymbols, 1).join("") : string.slice(1);
  2254. return chr[methodName]() + trailing;
  2255. };
  2256. }
  2257. var upperFirst = createCaseFirst("toUpperCase");
  2258. function capitalize$1(string) {
  2259. return upperFirst(toString(string).toLowerCase());
  2260. }
  2261. function arrayReduce(array, iteratee, accumulator, initAccum) {
  2262. var index = -1, length = array == null ? 0 : array.length;
  2263. if (initAccum && length) {
  2264. accumulator = array[++index];
  2265. }
  2266. while (++index < length) {
  2267. accumulator = iteratee(accumulator, array[index], index, array);
  2268. }
  2269. return accumulator;
  2270. }
  2271. function basePropertyOf(object) {
  2272. return function(key) {
  2273. return object == null ? void 0 : object[key];
  2274. };
  2275. }
  2276. var deburredLetters = {
  2277. "\xC0": "A",
  2278. "\xC1": "A",
  2279. "\xC2": "A",
  2280. "\xC3": "A",
  2281. "\xC4": "A",
  2282. "\xC5": "A",
  2283. "\xE0": "a",
  2284. "\xE1": "a",
  2285. "\xE2": "a",
  2286. "\xE3": "a",
  2287. "\xE4": "a",
  2288. "\xE5": "a",
  2289. "\xC7": "C",
  2290. "\xE7": "c",
  2291. "\xD0": "D",
  2292. "\xF0": "d",
  2293. "\xC8": "E",
  2294. "\xC9": "E",
  2295. "\xCA": "E",
  2296. "\xCB": "E",
  2297. "\xE8": "e",
  2298. "\xE9": "e",
  2299. "\xEA": "e",
  2300. "\xEB": "e",
  2301. "\xCC": "I",
  2302. "\xCD": "I",
  2303. "\xCE": "I",
  2304. "\xCF": "I",
  2305. "\xEC": "i",
  2306. "\xED": "i",
  2307. "\xEE": "i",
  2308. "\xEF": "i",
  2309. "\xD1": "N",
  2310. "\xF1": "n",
  2311. "\xD2": "O",
  2312. "\xD3": "O",
  2313. "\xD4": "O",
  2314. "\xD5": "O",
  2315. "\xD6": "O",
  2316. "\xD8": "O",
  2317. "\xF2": "o",
  2318. "\xF3": "o",
  2319. "\xF4": "o",
  2320. "\xF5": "o",
  2321. "\xF6": "o",
  2322. "\xF8": "o",
  2323. "\xD9": "U",
  2324. "\xDA": "U",
  2325. "\xDB": "U",
  2326. "\xDC": "U",
  2327. "\xF9": "u",
  2328. "\xFA": "u",
  2329. "\xFB": "u",
  2330. "\xFC": "u",
  2331. "\xDD": "Y",
  2332. "\xFD": "y",
  2333. "\xFF": "y",
  2334. "\xC6": "Ae",
  2335. "\xE6": "ae",
  2336. "\xDE": "Th",
  2337. "\xFE": "th",
  2338. "\xDF": "ss",
  2339. "\u0100": "A",
  2340. "\u0102": "A",
  2341. "\u0104": "A",
  2342. "\u0101": "a",
  2343. "\u0103": "a",
  2344. "\u0105": "a",
  2345. "\u0106": "C",
  2346. "\u0108": "C",
  2347. "\u010A": "C",
  2348. "\u010C": "C",
  2349. "\u0107": "c",
  2350. "\u0109": "c",
  2351. "\u010B": "c",
  2352. "\u010D": "c",
  2353. "\u010E": "D",
  2354. "\u0110": "D",
  2355. "\u010F": "d",
  2356. "\u0111": "d",
  2357. "\u0112": "E",
  2358. "\u0114": "E",
  2359. "\u0116": "E",
  2360. "\u0118": "E",
  2361. "\u011A": "E",
  2362. "\u0113": "e",
  2363. "\u0115": "e",
  2364. "\u0117": "e",
  2365. "\u0119": "e",
  2366. "\u011B": "e",
  2367. "\u011C": "G",
  2368. "\u011E": "G",
  2369. "\u0120": "G",
  2370. "\u0122": "G",
  2371. "\u011D": "g",
  2372. "\u011F": "g",
  2373. "\u0121": "g",
  2374. "\u0123": "g",
  2375. "\u0124": "H",
  2376. "\u0126": "H",
  2377. "\u0125": "h",
  2378. "\u0127": "h",
  2379. "\u0128": "I",
  2380. "\u012A": "I",
  2381. "\u012C": "I",
  2382. "\u012E": "I",
  2383. "\u0130": "I",
  2384. "\u0129": "i",
  2385. "\u012B": "i",
  2386. "\u012D": "i",
  2387. "\u012F": "i",
  2388. "\u0131": "i",
  2389. "\u0134": "J",
  2390. "\u0135": "j",
  2391. "\u0136": "K",
  2392. "\u0137": "k",
  2393. "\u0138": "k",
  2394. "\u0139": "L",
  2395. "\u013B": "L",
  2396. "\u013D": "L",
  2397. "\u013F": "L",
  2398. "\u0141": "L",
  2399. "\u013A": "l",
  2400. "\u013C": "l",
  2401. "\u013E": "l",
  2402. "\u0140": "l",
  2403. "\u0142": "l",
  2404. "\u0143": "N",
  2405. "\u0145": "N",
  2406. "\u0147": "N",
  2407. "\u014A": "N",
  2408. "\u0144": "n",
  2409. "\u0146": "n",
  2410. "\u0148": "n",
  2411. "\u014B": "n",
  2412. "\u014C": "O",
  2413. "\u014E": "O",
  2414. "\u0150": "O",
  2415. "\u014D": "o",
  2416. "\u014F": "o",
  2417. "\u0151": "o",
  2418. "\u0154": "R",
  2419. "\u0156": "R",
  2420. "\u0158": "R",
  2421. "\u0155": "r",
  2422. "\u0157": "r",
  2423. "\u0159": "r",
  2424. "\u015A": "S",
  2425. "\u015C": "S",
  2426. "\u015E": "S",
  2427. "\u0160": "S",
  2428. "\u015B": "s",
  2429. "\u015D": "s",
  2430. "\u015F": "s",
  2431. "\u0161": "s",
  2432. "\u0162": "T",
  2433. "\u0164": "T",
  2434. "\u0166": "T",
  2435. "\u0163": "t",
  2436. "\u0165": "t",
  2437. "\u0167": "t",
  2438. "\u0168": "U",
  2439. "\u016A": "U",
  2440. "\u016C": "U",
  2441. "\u016E": "U",
  2442. "\u0170": "U",
  2443. "\u0172": "U",
  2444. "\u0169": "u",
  2445. "\u016B": "u",
  2446. "\u016D": "u",
  2447. "\u016F": "u",
  2448. "\u0171": "u",
  2449. "\u0173": "u",
  2450. "\u0174": "W",
  2451. "\u0175": "w",
  2452. "\u0176": "Y",
  2453. "\u0177": "y",
  2454. "\u0178": "Y",
  2455. "\u0179": "Z",
  2456. "\u017B": "Z",
  2457. "\u017D": "Z",
  2458. "\u017A": "z",
  2459. "\u017C": "z",
  2460. "\u017E": "z",
  2461. "\u0132": "IJ",
  2462. "\u0133": "ij",
  2463. "\u0152": "Oe",
  2464. "\u0153": "oe",
  2465. "\u0149": "'n",
  2466. "\u017F": "s"
  2467. };
  2468. var deburrLetter = basePropertyOf(deburredLetters);
  2469. var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
  2470. var rsComboMarksRange$2 = "\\u0300-\\u036f";
  2471. var reComboHalfMarksRange$2 = "\\ufe20-\\ufe2f";
  2472. var rsComboSymbolsRange$2 = "\\u20d0-\\u20ff";
  2473. var rsComboRange$2 = rsComboMarksRange$2 + reComboHalfMarksRange$2 + rsComboSymbolsRange$2;
  2474. var rsCombo$2 = "[" + rsComboRange$2 + "]";
  2475. var reComboMark = RegExp(rsCombo$2, "g");
  2476. function deburr(string) {
  2477. string = toString(string);
  2478. return string && string.replace(reLatin, deburrLetter).replace(reComboMark, "");
  2479. }
  2480. var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
  2481. function asciiWords(string) {
  2482. return string.match(reAsciiWord) || [];
  2483. }
  2484. var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;
  2485. function hasUnicodeWord(string) {
  2486. return reHasUnicodeWord.test(string);
  2487. }
  2488. var rsAstralRange$1 = "\\ud800-\\udfff";
  2489. var rsComboMarksRange$1 = "\\u0300-\\u036f";
  2490. var reComboHalfMarksRange$1 = "\\ufe20-\\ufe2f";
  2491. var rsComboSymbolsRange$1 = "\\u20d0-\\u20ff";
  2492. var rsComboRange$1 = rsComboMarksRange$1 + reComboHalfMarksRange$1 + rsComboSymbolsRange$1;
  2493. var rsDingbatRange = "\\u2700-\\u27bf";
  2494. var rsLowerRange = "a-z\\xdf-\\xf6\\xf8-\\xff";
  2495. var rsMathOpRange = "\\xac\\xb1\\xd7\\xf7";
  2496. var rsNonCharRange = "\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf";
  2497. var rsPunctuationRange = "\\u2000-\\u206f";
  2498. var rsSpaceRange = " \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000";
  2499. var rsUpperRange = "A-Z\\xc0-\\xd6\\xd8-\\xde";
  2500. var rsVarRange$1 = "\\ufe0e\\ufe0f";
  2501. var rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
  2502. var rsApos$1 = "['\u2019]";
  2503. var rsBreak = "[" + rsBreakRange + "]";
  2504. var rsCombo$1 = "[" + rsComboRange$1 + "]";
  2505. var rsDigits = "\\d+";
  2506. var rsDingbat = "[" + rsDingbatRange + "]";
  2507. var rsLower = "[" + rsLowerRange + "]";
  2508. var rsMisc = "[^" + rsAstralRange$1 + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + "]";
  2509. var rsFitz$1 = "\\ud83c[\\udffb-\\udfff]";
  2510. var rsModifier$1 = "(?:" + rsCombo$1 + "|" + rsFitz$1 + ")";
  2511. var rsNonAstral$1 = "[^" + rsAstralRange$1 + "]";
  2512. var rsRegional$1 = "(?:\\ud83c[\\udde6-\\uddff]){2}";
  2513. var rsSurrPair$1 = "[\\ud800-\\udbff][\\udc00-\\udfff]";
  2514. var rsUpper = "[" + rsUpperRange + "]";
  2515. var rsZWJ$1 = "\\u200d";
  2516. var rsMiscLower = "(?:" + rsLower + "|" + rsMisc + ")";
  2517. var rsMiscUpper = "(?:" + rsUpper + "|" + rsMisc + ")";
  2518. var rsOptContrLower = "(?:" + rsApos$1 + "(?:d|ll|m|re|s|t|ve))?";
  2519. var rsOptContrUpper = "(?:" + rsApos$1 + "(?:D|LL|M|RE|S|T|VE))?";
  2520. var reOptMod$1 = rsModifier$1 + "?";
  2521. var rsOptVar$1 = "[" + rsVarRange$1 + "]?";
  2522. var rsOptJoin$1 = "(?:" + rsZWJ$1 + "(?:" + [rsNonAstral$1, rsRegional$1, rsSurrPair$1].join("|") + ")" + rsOptVar$1 + reOptMod$1 + ")*";
  2523. var rsOrdLower = "\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])";
  2524. var rsOrdUpper = "\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])";
  2525. var rsSeq$1 = rsOptVar$1 + reOptMod$1 + rsOptJoin$1;
  2526. var rsEmoji = "(?:" + [rsDingbat, rsRegional$1, rsSurrPair$1].join("|") + ")" + rsSeq$1;
  2527. var reUnicodeWord = RegExp([
  2528. rsUpper + "?" + rsLower + "+" + rsOptContrLower + "(?=" + [rsBreak, rsUpper, "$"].join("|") + ")",
  2529. rsMiscUpper + "+" + rsOptContrUpper + "(?=" + [rsBreak, rsUpper + rsMiscLower, "$"].join("|") + ")",
  2530. rsUpper + "?" + rsMiscLower + "+" + rsOptContrLower,
  2531. rsUpper + "+" + rsOptContrUpper,
  2532. rsOrdUpper,
  2533. rsOrdLower,
  2534. rsDigits,
  2535. rsEmoji
  2536. ].join("|"), "g");
  2537. function unicodeWords(string) {
  2538. return string.match(reUnicodeWord) || [];
  2539. }
  2540. function words(string, pattern, guard) {
  2541. string = toString(string);
  2542. pattern = guard ? void 0 : pattern;
  2543. if (pattern === void 0) {
  2544. return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
  2545. }
  2546. return string.match(pattern) || [];
  2547. }
  2548. var rsApos = "['\u2019]";
  2549. var reApos = RegExp(rsApos, "g");
  2550. function createCompounder(callback) {
  2551. return function(string) {
  2552. return arrayReduce(words(deburr(string).replace(reApos, "")), callback, "");
  2553. };
  2554. }
  2555. var camelCase = createCompounder(function(result, word, index) {
  2556. word = word.toLowerCase();
  2557. return result + (index ? capitalize$1(word) : word);
  2558. });
  2559. function castArray$1() {
  2560. if (!arguments.length) {
  2561. return [];
  2562. }
  2563. var value = arguments[0];
  2564. return isArray(value) ? value : [value];
  2565. }
  2566. var nativeIsFinite$1 = root.isFinite;
  2567. var nativeMin$c = Math.min;
  2568. function createRound(methodName) {
  2569. var func = Math[methodName];
  2570. return function(number, precision) {
  2571. number = toNumber(number);
  2572. precision = precision == null ? 0 : nativeMin$c(toInteger(precision), 292);
  2573. if (precision && nativeIsFinite$1(number)) {
  2574. var pair = (toString(number) + "e").split("e"), value = func(pair[0] + "e" + (+pair[1] + precision));
  2575. pair = (toString(value) + "e").split("e");
  2576. return +(pair[0] + "e" + (+pair[1] - precision));
  2577. }
  2578. return func(number);
  2579. };
  2580. }
  2581. var ceil = createRound("ceil");
  2582. function chain(value) {
  2583. var result = lodash(value);
  2584. result.__chain__ = true;
  2585. return result;
  2586. }
  2587. var nativeCeil$3 = Math.ceil;
  2588. var nativeMax$c = Math.max;
  2589. function chunk(array, size, guard) {
  2590. if (guard ? isIterateeCall(array, size, guard) : size === void 0) {
  2591. size = 1;
  2592. } else {
  2593. size = nativeMax$c(toInteger(size), 0);
  2594. }
  2595. var length = array == null ? 0 : array.length;
  2596. if (!length || size < 1) {
  2597. return [];
  2598. }
  2599. var index = 0, resIndex = 0, result = Array(nativeCeil$3(length / size));
  2600. while (index < length) {
  2601. result[resIndex++] = baseSlice(array, index, index += size);
  2602. }
  2603. return result;
  2604. }
  2605. function baseClamp(number, lower, upper) {
  2606. if (number === number) {
  2607. if (upper !== void 0) {
  2608. number = number <= upper ? number : upper;
  2609. }
  2610. if (lower !== void 0) {
  2611. number = number >= lower ? number : lower;
  2612. }
  2613. }
  2614. return number;
  2615. }
  2616. function clamp(number, lower, upper) {
  2617. if (upper === void 0) {
  2618. upper = lower;
  2619. lower = void 0;
  2620. }
  2621. if (upper !== void 0) {
  2622. upper = toNumber(upper);
  2623. upper = upper === upper ? upper : 0;
  2624. }
  2625. if (lower !== void 0) {
  2626. lower = toNumber(lower);
  2627. lower = lower === lower ? lower : 0;
  2628. }
  2629. return baseClamp(toNumber(number), lower, upper);
  2630. }
  2631. function stackClear() {
  2632. this.__data__ = new ListCache();
  2633. this.size = 0;
  2634. }
  2635. function stackDelete(key) {
  2636. var data = this.__data__, result = data["delete"](key);
  2637. this.size = data.size;
  2638. return result;
  2639. }
  2640. function stackGet(key) {
  2641. return this.__data__.get(key);
  2642. }
  2643. function stackHas(key) {
  2644. return this.__data__.has(key);
  2645. }
  2646. var LARGE_ARRAY_SIZE$2 = 200;
  2647. function stackSet(key, value) {
  2648. var data = this.__data__;
  2649. if (data instanceof ListCache) {
  2650. var pairs = data.__data__;
  2651. if (!Map$1 || pairs.length < LARGE_ARRAY_SIZE$2 - 1) {
  2652. pairs.push([key, value]);
  2653. this.size = ++data.size;
  2654. return this;
  2655. }
  2656. data = this.__data__ = new MapCache(pairs);
  2657. }
  2658. data.set(key, value);
  2659. this.size = data.size;
  2660. return this;
  2661. }
  2662. function Stack(entries) {
  2663. var data = this.__data__ = new ListCache(entries);
  2664. this.size = data.size;
  2665. }
  2666. Stack.prototype.clear = stackClear;
  2667. Stack.prototype["delete"] = stackDelete;
  2668. Stack.prototype.get = stackGet;
  2669. Stack.prototype.has = stackHas;
  2670. Stack.prototype.set = stackSet;
  2671. function baseAssign(object, source) {
  2672. return object && copyObject(source, keys(source), object);
  2673. }
  2674. function baseAssignIn(object, source) {
  2675. return object && copyObject(source, keysIn(source), object);
  2676. }
  2677. var freeExports = typeof exports == "object" && exports && !exports.nodeType && exports;
  2678. var freeModule = freeExports && typeof module == "object" && module && !module.nodeType && module;
  2679. var moduleExports = freeModule && freeModule.exports === freeExports;
  2680. var Buffer = moduleExports ? root.Buffer : void 0;
  2681. var allocUnsafe = Buffer ? Buffer.allocUnsafe : void 0;
  2682. function cloneBuffer(buffer, isDeep) {
  2683. if (isDeep) {
  2684. return buffer.slice();
  2685. }
  2686. var length = buffer.length, result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
  2687. buffer.copy(result);
  2688. return result;
  2689. }
  2690. function arrayFilter(array, predicate) {
  2691. var index = -1, length = array == null ? 0 : array.length, resIndex = 0, result = [];
  2692. while (++index < length) {
  2693. var value = array[index];
  2694. if (predicate(value, index, array)) {
  2695. result[resIndex++] = value;
  2696. }
  2697. }
  2698. return result;
  2699. }
  2700. function stubArray() {
  2701. return [];
  2702. }
  2703. var objectProto$d = Object.prototype;
  2704. var propertyIsEnumerable = objectProto$d.propertyIsEnumerable;
  2705. var nativeGetSymbols$1 = Object.getOwnPropertySymbols;
  2706. var getSymbols = !nativeGetSymbols$1 ? stubArray : function(object) {
  2707. if (object == null) {
  2708. return [];
  2709. }
  2710. object = Object(object);
  2711. return arrayFilter(nativeGetSymbols$1(object), function(symbol) {
  2712. return propertyIsEnumerable.call(object, symbol);
  2713. });
  2714. };
  2715. function copySymbols(source, object) {
  2716. return copyObject(source, getSymbols(source), object);
  2717. }
  2718. var nativeGetSymbols = Object.getOwnPropertySymbols;
  2719. var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
  2720. var result = [];
  2721. while (object) {
  2722. arrayPush(result, getSymbols(object));
  2723. object = getPrototype(object);
  2724. }
  2725. return result;
  2726. };
  2727. function copySymbolsIn(source, object) {
  2728. return copyObject(source, getSymbolsIn(source), object);
  2729. }
  2730. function baseGetAllKeys(object, keysFunc, symbolsFunc) {
  2731. var result = keysFunc(object);
  2732. return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
  2733. }
  2734. function getAllKeys(object) {
  2735. return baseGetAllKeys(object, keys, getSymbols);
  2736. }
  2737. function getAllKeysIn(object) {
  2738. return baseGetAllKeys(object, keysIn, getSymbolsIn);
  2739. }
  2740. var DataView = getNative(root, "DataView");
  2741. var Promise$1 = getNative(root, "Promise");
  2742. var Set$1 = getNative(root, "Set");
  2743. var mapTag$8 = "[object Map]";
  2744. var objectTag$2 = "[object Object]";
  2745. var promiseTag = "[object Promise]";
  2746. var setTag$8 = "[object Set]";
  2747. var weakMapTag$2 = "[object WeakMap]";
  2748. var dataViewTag$3 = "[object DataView]";
  2749. var dataViewCtorString = toSource(DataView);
  2750. var mapCtorString = toSource(Map$1);
  2751. var promiseCtorString = toSource(Promise$1);
  2752. var setCtorString = toSource(Set$1);
  2753. var weakMapCtorString = toSource(WeakMap);
  2754. var getTag = baseGetTag;
  2755. if (DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag$3 || Map$1 && getTag(new Map$1()) != mapTag$8 || Promise$1 && getTag(Promise$1.resolve()) != promiseTag || Set$1 && getTag(new Set$1()) != setTag$8 || WeakMap && getTag(new WeakMap()) != weakMapTag$2) {
  2756. getTag = function(value) {
  2757. var result = baseGetTag(value), Ctor = result == objectTag$2 ? value.constructor : void 0, ctorString = Ctor ? toSource(Ctor) : "";
  2758. if (ctorString) {
  2759. switch (ctorString) {
  2760. case dataViewCtorString:
  2761. return dataViewTag$3;
  2762. case mapCtorString:
  2763. return mapTag$8;
  2764. case promiseCtorString:
  2765. return promiseTag;
  2766. case setCtorString:
  2767. return setTag$8;
  2768. case weakMapCtorString:
  2769. return weakMapTag$2;
  2770. }
  2771. }
  2772. return result;
  2773. };
  2774. }
  2775. var getTag$1 = getTag;
  2776. var objectProto$c = Object.prototype;
  2777. var hasOwnProperty$b = objectProto$c.hasOwnProperty;
  2778. function initCloneArray(array) {
  2779. var length = array.length, result = new array.constructor(length);
  2780. if (length && typeof array[0] == "string" && hasOwnProperty$b.call(array, "index")) {
  2781. result.index = array.index;
  2782. result.input = array.input;
  2783. }
  2784. return result;
  2785. }
  2786. var Uint8Array = root.Uint8Array;
  2787. function cloneArrayBuffer(arrayBuffer) {
  2788. var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  2789. new Uint8Array(result).set(new Uint8Array(arrayBuffer));
  2790. return result;
  2791. }
  2792. function cloneDataView(dataView, isDeep) {
  2793. var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
  2794. return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
  2795. }
  2796. var reFlags$1 = /\w*$/;
  2797. function cloneRegExp(regexp) {
  2798. var result = new regexp.constructor(regexp.source, reFlags$1.exec(regexp));
  2799. result.lastIndex = regexp.lastIndex;
  2800. return result;
  2801. }
  2802. var symbolProto$1 = Symbol$1 ? Symbol$1.prototype : void 0;
  2803. var symbolValueOf$1 = symbolProto$1 ? symbolProto$1.valueOf : void 0;
  2804. function cloneSymbol(symbol) {
  2805. return symbolValueOf$1 ? Object(symbolValueOf$1.call(symbol)) : {};
  2806. }
  2807. function cloneTypedArray(typedArray, isDeep) {
  2808. var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
  2809. return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
  2810. }
  2811. var boolTag$3 = "[object Boolean]";
  2812. var dateTag$3 = "[object Date]";
  2813. var mapTag$7 = "[object Map]";
  2814. var numberTag$3 = "[object Number]";
  2815. var regexpTag$3 = "[object RegExp]";
  2816. var setTag$7 = "[object Set]";
  2817. var stringTag$3 = "[object String]";
  2818. var symbolTag$2 = "[object Symbol]";
  2819. var arrayBufferTag$3 = "[object ArrayBuffer]";
  2820. var dataViewTag$2 = "[object DataView]";
  2821. var float32Tag$1 = "[object Float32Array]";
  2822. var float64Tag$1 = "[object Float64Array]";
  2823. var int8Tag$1 = "[object Int8Array]";
  2824. var int16Tag$1 = "[object Int16Array]";
  2825. var int32Tag$1 = "[object Int32Array]";
  2826. var uint8Tag$1 = "[object Uint8Array]";
  2827. var uint8ClampedTag$1 = "[object Uint8ClampedArray]";
  2828. var uint16Tag$1 = "[object Uint16Array]";
  2829. var uint32Tag$1 = "[object Uint32Array]";
  2830. function initCloneByTag(object, tag, isDeep) {
  2831. var Ctor = object.constructor;
  2832. switch (tag) {
  2833. case arrayBufferTag$3:
  2834. return cloneArrayBuffer(object);
  2835. case boolTag$3:
  2836. case dateTag$3:
  2837. return new Ctor(+object);
  2838. case dataViewTag$2:
  2839. return cloneDataView(object, isDeep);
  2840. case float32Tag$1:
  2841. case float64Tag$1:
  2842. case int8Tag$1:
  2843. case int16Tag$1:
  2844. case int32Tag$1:
  2845. case uint8Tag$1:
  2846. case uint8ClampedTag$1:
  2847. case uint16Tag$1:
  2848. case uint32Tag$1:
  2849. return cloneTypedArray(object, isDeep);
  2850. case mapTag$7:
  2851. return new Ctor();
  2852. case numberTag$3:
  2853. case stringTag$3:
  2854. return new Ctor(object);
  2855. case regexpTag$3:
  2856. return cloneRegExp(object);
  2857. case setTag$7:
  2858. return new Ctor();
  2859. case symbolTag$2:
  2860. return cloneSymbol(object);
  2861. }
  2862. }
  2863. function initCloneObject(object) {
  2864. return typeof object.constructor == "function" && !isPrototype(object) ? baseCreate(getPrototype(object)) : {};
  2865. }
  2866. var mapTag$6 = "[object Map]";
  2867. function baseIsMap(value) {
  2868. return isObjectLike(value) && getTag$1(value) == mapTag$6;
  2869. }
  2870. var nodeIsMap = nodeUtil && nodeUtil.isMap;
  2871. var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
  2872. var setTag$6 = "[object Set]";
  2873. function baseIsSet(value) {
  2874. return isObjectLike(value) && getTag$1(value) == setTag$6;
  2875. }
  2876. var nodeIsSet = nodeUtil && nodeUtil.isSet;
  2877. var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
  2878. var CLONE_DEEP_FLAG$7 = 1;
  2879. var CLONE_FLAT_FLAG$1 = 2;
  2880. var CLONE_SYMBOLS_FLAG$5 = 4;
  2881. var argsTag$1 = "[object Arguments]";
  2882. var arrayTag$1 = "[object Array]";
  2883. var boolTag$2 = "[object Boolean]";
  2884. var dateTag$2 = "[object Date]";
  2885. var errorTag$1 = "[object Error]";
  2886. var funcTag = "[object Function]";
  2887. var genTag = "[object GeneratorFunction]";
  2888. var mapTag$5 = "[object Map]";
  2889. var numberTag$2 = "[object Number]";
  2890. var objectTag$1 = "[object Object]";
  2891. var regexpTag$2 = "[object RegExp]";
  2892. var setTag$5 = "[object Set]";
  2893. var stringTag$2 = "[object String]";
  2894. var symbolTag$1 = "[object Symbol]";
  2895. var weakMapTag$1 = "[object WeakMap]";
  2896. var arrayBufferTag$2 = "[object ArrayBuffer]";
  2897. var dataViewTag$1 = "[object DataView]";
  2898. var float32Tag = "[object Float32Array]";
  2899. var float64Tag = "[object Float64Array]";
  2900. var int8Tag = "[object Int8Array]";
  2901. var int16Tag = "[object Int16Array]";
  2902. var int32Tag = "[object Int32Array]";
  2903. var uint8Tag = "[object Uint8Array]";
  2904. var uint8ClampedTag = "[object Uint8ClampedArray]";
  2905. var uint16Tag = "[object Uint16Array]";
  2906. var uint32Tag = "[object Uint32Array]";
  2907. var cloneableTags = {};
  2908. cloneableTags[argsTag$1] = cloneableTags[arrayTag$1] = cloneableTags[arrayBufferTag$2] = cloneableTags[dataViewTag$1] = cloneableTags[boolTag$2] = cloneableTags[dateTag$2] = cloneableTags[float32Tag] = cloneableTags[float64Tag] = cloneableTags[int8Tag] = cloneableTags[int16Tag] = cloneableTags[int32Tag] = cloneableTags[mapTag$5] = cloneableTags[numberTag$2] = cloneableTags[objectTag$1] = cloneableTags[regexpTag$2] = cloneableTags[setTag$5] = cloneableTags[stringTag$2] = cloneableTags[symbolTag$1] = cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
  2909. cloneableTags[errorTag$1] = cloneableTags[funcTag] = cloneableTags[weakMapTag$1] = false;
  2910. function baseClone(value, bitmask, customizer, key, object, stack) {
  2911. var result, isDeep = bitmask & CLONE_DEEP_FLAG$7, isFlat = bitmask & CLONE_FLAT_FLAG$1, isFull = bitmask & CLONE_SYMBOLS_FLAG$5;
  2912. if (customizer) {
  2913. result = object ? customizer(value, key, object, stack) : customizer(value);
  2914. }
  2915. if (result !== void 0) {
  2916. return result;
  2917. }
  2918. if (!isObject(value)) {
  2919. return value;
  2920. }
  2921. var isArr = isArray(value);
  2922. if (isArr) {
  2923. result = initCloneArray(value);
  2924. if (!isDeep) {
  2925. return copyArray(value, result);
  2926. }
  2927. } else {
  2928. var tag = getTag$1(value), isFunc = tag == funcTag || tag == genTag;
  2929. if (isBuffer(value)) {
  2930. return cloneBuffer(value, isDeep);
  2931. }
  2932. if (tag == objectTag$1 || tag == argsTag$1 || isFunc && !object) {
  2933. result = isFlat || isFunc ? {} : initCloneObject(value);
  2934. if (!isDeep) {
  2935. return isFlat ? copySymbolsIn(value, baseAssignIn(result, value)) : copySymbols(value, baseAssign(result, value));
  2936. }
  2937. } else {
  2938. if (!cloneableTags[tag]) {
  2939. return object ? value : {};
  2940. }
  2941. result = initCloneByTag(value, tag, isDeep);
  2942. }
  2943. }
  2944. stack || (stack = new Stack());
  2945. var stacked = stack.get(value);
  2946. if (stacked) {
  2947. return stacked;
  2948. }
  2949. stack.set(value, result);
  2950. if (isSet(value)) {
  2951. value.forEach(function(subValue) {
  2952. result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
  2953. });
  2954. } else if (isMap(value)) {
  2955. value.forEach(function(subValue, key2) {
  2956. result.set(key2, baseClone(subValue, bitmask, customizer, key2, value, stack));
  2957. });
  2958. }
  2959. var keysFunc = isFull ? isFlat ? getAllKeysIn : getAllKeys : isFlat ? keysIn : keys;
  2960. var props = isArr ? void 0 : keysFunc(value);
  2961. arrayEach(props || value, function(subValue, key2) {
  2962. if (props) {
  2963. key2 = subValue;
  2964. subValue = value[key2];
  2965. }
  2966. assignValue(result, key2, baseClone(subValue, bitmask, customizer, key2, value, stack));
  2967. });
  2968. return result;
  2969. }
  2970. var CLONE_SYMBOLS_FLAG$4 = 4;
  2971. function clone(value) {
  2972. return baseClone(value, CLONE_SYMBOLS_FLAG$4);
  2973. }
  2974. var CLONE_DEEP_FLAG$6 = 1;
  2975. var CLONE_SYMBOLS_FLAG$3 = 4;
  2976. function cloneDeep(value) {
  2977. return baseClone(value, CLONE_DEEP_FLAG$6 | CLONE_SYMBOLS_FLAG$3);
  2978. }
  2979. var CLONE_DEEP_FLAG$5 = 1;
  2980. var CLONE_SYMBOLS_FLAG$2 = 4;
  2981. function cloneDeepWith(value, customizer) {
  2982. customizer = typeof customizer == "function" ? customizer : void 0;
  2983. return baseClone(value, CLONE_DEEP_FLAG$5 | CLONE_SYMBOLS_FLAG$2, customizer);
  2984. }
  2985. var CLONE_SYMBOLS_FLAG$1 = 4;
  2986. function cloneWith(value, customizer) {
  2987. customizer = typeof customizer == "function" ? customizer : void 0;
  2988. return baseClone(value, CLONE_SYMBOLS_FLAG$1, customizer);
  2989. }
  2990. function wrapperCommit() {
  2991. return new LodashWrapper(this.value(), this.__chain__);
  2992. }
  2993. function compact(array) {
  2994. var index = -1, length = array == null ? 0 : array.length, resIndex = 0, result = [];
  2995. while (++index < length) {
  2996. var value = array[index];
  2997. if (value) {
  2998. result[resIndex++] = value;
  2999. }
  3000. }
  3001. return result;
  3002. }
  3003. function concat() {
  3004. var length = arguments.length;
  3005. if (!length) {
  3006. return [];
  3007. }
  3008. var args = Array(length - 1), array = arguments[0], index = length;
  3009. while (index--) {
  3010. args[index - 1] = arguments[index];
  3011. }
  3012. return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1));
  3013. }
  3014. var HASH_UNDEFINED = "__lodash_hash_undefined__";
  3015. function setCacheAdd(value) {
  3016. this.__data__.set(value, HASH_UNDEFINED);
  3017. return this;
  3018. }
  3019. function setCacheHas(value) {
  3020. return this.__data__.has(value);
  3021. }
  3022. function SetCache(values) {
  3023. var index = -1, length = values == null ? 0 : values.length;
  3024. this.__data__ = new MapCache();
  3025. while (++index < length) {
  3026. this.add(values[index]);
  3027. }
  3028. }
  3029. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  3030. SetCache.prototype.has = setCacheHas;
  3031. function arraySome(array, predicate) {
  3032. var index = -1, length = array == null ? 0 : array.length;
  3033. while (++index < length) {
  3034. if (predicate(array[index], index, array)) {
  3035. return true;
  3036. }
  3037. }
  3038. return false;
  3039. }
  3040. function cacheHas(cache, key) {
  3041. return cache.has(key);
  3042. }
  3043. var COMPARE_PARTIAL_FLAG$5 = 1;
  3044. var COMPARE_UNORDERED_FLAG$3 = 2;
  3045. function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
  3046. var isPartial = bitmask & COMPARE_PARTIAL_FLAG$5, arrLength = array.length, othLength = other.length;
  3047. if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
  3048. return false;
  3049. }
  3050. var arrStacked = stack.get(array);
  3051. var othStacked = stack.get(other);
  3052. if (arrStacked && othStacked) {
  3053. return arrStacked == other && othStacked == array;
  3054. }
  3055. var index = -1, result = true, seen = bitmask & COMPARE_UNORDERED_FLAG$3 ? new SetCache() : void 0;
  3056. stack.set(array, other);
  3057. stack.set(other, array);
  3058. while (++index < arrLength) {
  3059. var arrValue = array[index], othValue = other[index];
  3060. if (customizer) {
  3061. var compared = isPartial ? customizer(othValue, arrValue, index, other, array, stack) : customizer(arrValue, othValue, index, array, other, stack);
  3062. }
  3063. if (compared !== void 0) {
  3064. if (compared) {
  3065. continue;
  3066. }
  3067. result = false;
  3068. break;
  3069. }
  3070. if (seen) {
  3071. if (!arraySome(other, function(othValue2, othIndex) {
  3072. if (!cacheHas(seen, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) {
  3073. return seen.push(othIndex);
  3074. }
  3075. })) {
  3076. result = false;
  3077. break;
  3078. }
  3079. } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
  3080. result = false;
  3081. break;
  3082. }
  3083. }
  3084. stack["delete"](array);
  3085. stack["delete"](other);
  3086. return result;
  3087. }
  3088. function mapToArray(map) {
  3089. var index = -1, result = Array(map.size);
  3090. map.forEach(function(value, key) {
  3091. result[++index] = [key, value];
  3092. });
  3093. return result;
  3094. }
  3095. function setToArray(set) {
  3096. var index = -1, result = Array(set.size);
  3097. set.forEach(function(value) {
  3098. result[++index] = value;
  3099. });
  3100. return result;
  3101. }
  3102. var COMPARE_PARTIAL_FLAG$4 = 1;
  3103. var COMPARE_UNORDERED_FLAG$2 = 2;
  3104. var boolTag$1 = "[object Boolean]";
  3105. var dateTag$1 = "[object Date]";
  3106. var errorTag = "[object Error]";
  3107. var mapTag$4 = "[object Map]";
  3108. var numberTag$1 = "[object Number]";
  3109. var regexpTag$1 = "[object RegExp]";
  3110. var setTag$4 = "[object Set]";
  3111. var stringTag$1 = "[object String]";
  3112. var symbolTag = "[object Symbol]";
  3113. var arrayBufferTag$1 = "[object ArrayBuffer]";
  3114. var dataViewTag = "[object DataView]";
  3115. var symbolProto = Symbol$1 ? Symbol$1.prototype : void 0;
  3116. var symbolValueOf = symbolProto ? symbolProto.valueOf : void 0;
  3117. function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
  3118. switch (tag) {
  3119. case dataViewTag:
  3120. if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) {
  3121. return false;
  3122. }
  3123. object = object.buffer;
  3124. other = other.buffer;
  3125. case arrayBufferTag$1:
  3126. if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
  3127. return false;
  3128. }
  3129. return true;
  3130. case boolTag$1:
  3131. case dateTag$1:
  3132. case numberTag$1:
  3133. return eq(+object, +other);
  3134. case errorTag:
  3135. return object.name == other.name && object.message == other.message;
  3136. case regexpTag$1:
  3137. case stringTag$1:
  3138. return object == other + "";
  3139. case mapTag$4:
  3140. var convert = mapToArray;
  3141. case setTag$4:
  3142. var isPartial = bitmask & COMPARE_PARTIAL_FLAG$4;
  3143. convert || (convert = setToArray);
  3144. if (object.size != other.size && !isPartial) {
  3145. return false;
  3146. }
  3147. var stacked = stack.get(object);
  3148. if (stacked) {
  3149. return stacked == other;
  3150. }
  3151. bitmask |= COMPARE_UNORDERED_FLAG$2;
  3152. stack.set(object, other);
  3153. var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
  3154. stack["delete"](object);
  3155. return result;
  3156. case symbolTag:
  3157. if (symbolValueOf) {
  3158. return symbolValueOf.call(object) == symbolValueOf.call(other);
  3159. }
  3160. }
  3161. return false;
  3162. }
  3163. var COMPARE_PARTIAL_FLAG$3 = 1;
  3164. var objectProto$b = Object.prototype;
  3165. var hasOwnProperty$a = objectProto$b.hasOwnProperty;
  3166. function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
  3167. var isPartial = bitmask & COMPARE_PARTIAL_FLAG$3, objProps = getAllKeys(object), objLength = objProps.length, othProps = getAllKeys(other), othLength = othProps.length;
  3168. if (objLength != othLength && !isPartial) {
  3169. return false;
  3170. }
  3171. var index = objLength;
  3172. while (index--) {
  3173. var key = objProps[index];
  3174. if (!(isPartial ? key in other : hasOwnProperty$a.call(other, key))) {
  3175. return false;
  3176. }
  3177. }
  3178. var objStacked = stack.get(object);
  3179. var othStacked = stack.get(other);
  3180. if (objStacked && othStacked) {
  3181. return objStacked == other && othStacked == object;
  3182. }
  3183. var result = true;
  3184. stack.set(object, other);
  3185. stack.set(other, object);
  3186. var skipCtor = isPartial;
  3187. while (++index < objLength) {
  3188. key = objProps[index];
  3189. var objValue = object[key], othValue = other[key];
  3190. if (customizer) {
  3191. var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack);
  3192. }
  3193. if (!(compared === void 0 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
  3194. result = false;
  3195. break;
  3196. }
  3197. skipCtor || (skipCtor = key == "constructor");
  3198. }
  3199. if (result && !skipCtor) {
  3200. var objCtor = object.constructor, othCtor = other.constructor;
  3201. if (objCtor != othCtor && ("constructor" in object && "constructor" in other) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) {
  3202. result = false;
  3203. }
  3204. }
  3205. stack["delete"](object);
  3206. stack["delete"](other);
  3207. return result;
  3208. }
  3209. var COMPARE_PARTIAL_FLAG$2 = 1;
  3210. var argsTag = "[object Arguments]";
  3211. var arrayTag = "[object Array]";
  3212. var objectTag = "[object Object]";
  3213. var objectProto$a = Object.prototype;
  3214. var hasOwnProperty$9 = objectProto$a.hasOwnProperty;
  3215. function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
  3216. var objIsArr = isArray(object), othIsArr = isArray(other), objTag = objIsArr ? arrayTag : getTag$1(object), othTag = othIsArr ? arrayTag : getTag$1(other);
  3217. objTag = objTag == argsTag ? objectTag : objTag;
  3218. othTag = othTag == argsTag ? objectTag : othTag;
  3219. var objIsObj = objTag == objectTag, othIsObj = othTag == objectTag, isSameTag = objTag == othTag;
  3220. if (isSameTag && isBuffer(object)) {
  3221. if (!isBuffer(other)) {
  3222. return false;
  3223. }
  3224. objIsArr = true;
  3225. objIsObj = false;
  3226. }
  3227. if (isSameTag && !objIsObj) {
  3228. stack || (stack = new Stack());
  3229. return objIsArr || isTypedArray(object) ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
  3230. }
  3231. if (!(bitmask & COMPARE_PARTIAL_FLAG$2)) {
  3232. var objIsWrapped = objIsObj && hasOwnProperty$9.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty$9.call(other, "__wrapped__");
  3233. if (objIsWrapped || othIsWrapped) {
  3234. var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other;
  3235. stack || (stack = new Stack());
  3236. return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
  3237. }
  3238. }
  3239. if (!isSameTag) {
  3240. return false;
  3241. }
  3242. stack || (stack = new Stack());
  3243. return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
  3244. }
  3245. function baseIsEqual(value, other, bitmask, customizer, stack) {
  3246. if (value === other) {
  3247. return true;
  3248. }
  3249. if (value == null || other == null || !isObjectLike(value) && !isObjectLike(other)) {
  3250. return value !== value && other !== other;
  3251. }
  3252. return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
  3253. }
  3254. var COMPARE_PARTIAL_FLAG$1 = 1;
  3255. var COMPARE_UNORDERED_FLAG$1 = 2;
  3256. function baseIsMatch(object, source, matchData, customizer) {
  3257. var index = matchData.length, length = index, noCustomizer = !customizer;
  3258. if (object == null) {
  3259. return !length;
  3260. }
  3261. object = Object(object);
  3262. while (index--) {
  3263. var data = matchData[index];
  3264. if (noCustomizer && data[2] ? data[1] !== object[data[0]] : !(data[0] in object)) {
  3265. return false;
  3266. }
  3267. }
  3268. while (++index < length) {
  3269. data = matchData[index];
  3270. var key = data[0], objValue = object[key], srcValue = data[1];
  3271. if (noCustomizer && data[2]) {
  3272. if (objValue === void 0 && !(key in object)) {
  3273. return false;
  3274. }
  3275. } else {
  3276. var stack = new Stack();
  3277. if (customizer) {
  3278. var result = customizer(objValue, srcValue, key, object, source, stack);
  3279. }
  3280. if (!(result === void 0 ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG$1 | COMPARE_UNORDERED_FLAG$1, customizer, stack) : result)) {
  3281. return false;
  3282. }
  3283. }
  3284. }
  3285. return true;
  3286. }
  3287. function isStrictComparable(value) {
  3288. return value === value && !isObject(value);
  3289. }
  3290. function getMatchData(object) {
  3291. var result = keys(object), length = result.length;
  3292. while (length--) {
  3293. var key = result[length], value = object[key];
  3294. result[length] = [key, value, isStrictComparable(value)];
  3295. }
  3296. return result;
  3297. }
  3298. function matchesStrictComparable(key, srcValue) {
  3299. return function(object) {
  3300. if (object == null) {
  3301. return false;
  3302. }
  3303. return object[key] === srcValue && (srcValue !== void 0 || key in Object(object));
  3304. };
  3305. }
  3306. function baseMatches(source) {
  3307. var matchData = getMatchData(source);
  3308. if (matchData.length == 1 && matchData[0][2]) {
  3309. return matchesStrictComparable(matchData[0][0], matchData[0][1]);
  3310. }
  3311. return function(object) {
  3312. return object === source || baseIsMatch(object, source, matchData);
  3313. };
  3314. }
  3315. function baseHasIn(object, key) {
  3316. return object != null && key in Object(object);
  3317. }
  3318. function hasPath(object, path, hasFunc) {
  3319. path = castPath(path, object);
  3320. var index = -1, length = path.length, result = false;
  3321. while (++index < length) {
  3322. var key = toKey(path[index]);
  3323. if (!(result = object != null && hasFunc(object, key))) {
  3324. break;
  3325. }
  3326. object = object[key];
  3327. }
  3328. if (result || ++index != length) {
  3329. return result;
  3330. }
  3331. length = object == null ? 0 : object.length;
  3332. return !!length && isLength(length) && isIndex(key, length) && (isArray(object) || isArguments(object));
  3333. }
  3334. function hasIn(object, path) {
  3335. return object != null && hasPath(object, path, baseHasIn);
  3336. }
  3337. var COMPARE_PARTIAL_FLAG = 1;
  3338. var COMPARE_UNORDERED_FLAG = 2;
  3339. function baseMatchesProperty(path, srcValue) {
  3340. if (isKey(path) && isStrictComparable(srcValue)) {
  3341. return matchesStrictComparable(toKey(path), srcValue);
  3342. }
  3343. return function(object) {
  3344. var objValue = get(object, path);
  3345. return objValue === void 0 && objValue === srcValue ? hasIn(object, path) : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
  3346. };
  3347. }
  3348. function baseProperty(key) {
  3349. return function(object) {
  3350. return object == null ? void 0 : object[key];
  3351. };
  3352. }
  3353. function basePropertyDeep(path) {
  3354. return function(object) {
  3355. return baseGet(object, path);
  3356. };
  3357. }
  3358. function property(path) {
  3359. return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
  3360. }
  3361. function baseIteratee(value) {
  3362. if (typeof value == "function") {
  3363. return value;
  3364. }
  3365. if (value == null) {
  3366. return identity;
  3367. }
  3368. if (typeof value == "object") {
  3369. return isArray(value) ? baseMatchesProperty(value[0], value[1]) : baseMatches(value);
  3370. }
  3371. return property(value);
  3372. }
  3373. var FUNC_ERROR_TEXT$7 = "Expected a function";
  3374. function cond(pairs) {
  3375. var length = pairs == null ? 0 : pairs.length, toIteratee = baseIteratee;
  3376. pairs = !length ? [] : arrayMap(pairs, function(pair) {
  3377. if (typeof pair[1] != "function") {
  3378. throw new TypeError(FUNC_ERROR_TEXT$7);
  3379. }
  3380. return [toIteratee(pair[0]), pair[1]];
  3381. });
  3382. return baseRest(function(args) {
  3383. var index = -1;
  3384. while (++index < length) {
  3385. var pair = pairs[index];
  3386. if (apply(pair[0], this, args)) {
  3387. return apply(pair[1], this, args);
  3388. }
  3389. }
  3390. });
  3391. }
  3392. function baseConformsTo(object, source, props) {
  3393. var length = props.length;
  3394. if (object == null) {
  3395. return !length;
  3396. }
  3397. object = Object(object);
  3398. while (length--) {
  3399. var key = props[length], predicate = source[key], value = object[key];
  3400. if (value === void 0 && !(key in object) || !predicate(value)) {
  3401. return false;
  3402. }
  3403. }
  3404. return true;
  3405. }
  3406. function baseConforms(source) {
  3407. var props = keys(source);
  3408. return function(object) {
  3409. return baseConformsTo(object, source, props);
  3410. };
  3411. }
  3412. var CLONE_DEEP_FLAG$4 = 1;
  3413. function conforms(source) {
  3414. return baseConforms(baseClone(source, CLONE_DEEP_FLAG$4));
  3415. }
  3416. function conformsTo(object, source) {
  3417. return source == null || baseConformsTo(object, source, keys(source));
  3418. }
  3419. function arrayAggregator(array, setter, iteratee, accumulator) {
  3420. var index = -1, length = array == null ? 0 : array.length;
  3421. while (++index < length) {
  3422. var value = array[index];
  3423. setter(accumulator, value, iteratee(value), array);
  3424. }
  3425. return accumulator;
  3426. }
  3427. function createBaseFor(fromRight) {
  3428. return function(object, iteratee, keysFunc) {
  3429. var index = -1, iterable = Object(object), props = keysFunc(object), length = props.length;
  3430. while (length--) {
  3431. var key = props[fromRight ? length : ++index];
  3432. if (iteratee(iterable[key], key, iterable) === false) {
  3433. break;
  3434. }
  3435. }
  3436. return object;
  3437. };
  3438. }
  3439. var baseFor = createBaseFor();
  3440. function baseForOwn(object, iteratee) {
  3441. return object && baseFor(object, iteratee, keys);
  3442. }
  3443. function createBaseEach(eachFunc, fromRight) {
  3444. return function(collection, iteratee) {
  3445. if (collection == null) {
  3446. return collection;
  3447. }
  3448. if (!isArrayLike(collection)) {
  3449. return eachFunc(collection, iteratee);
  3450. }
  3451. var length = collection.length, index = fromRight ? length : -1, iterable = Object(collection);
  3452. while (fromRight ? index-- : ++index < length) {
  3453. if (iteratee(iterable[index], index, iterable) === false) {
  3454. break;
  3455. }
  3456. }
  3457. return collection;
  3458. };
  3459. }
  3460. var baseEach = createBaseEach(baseForOwn);
  3461. function baseAggregator(collection, setter, iteratee, accumulator) {
  3462. baseEach(collection, function(value, key, collection2) {
  3463. setter(accumulator, value, iteratee(value), collection2);
  3464. });
  3465. return accumulator;
  3466. }
  3467. function createAggregator(setter, initializer) {
  3468. return function(collection, iteratee) {
  3469. var func = isArray(collection) ? arrayAggregator : baseAggregator, accumulator = initializer ? initializer() : {};
  3470. return func(collection, setter, baseIteratee(iteratee), accumulator);
  3471. };
  3472. }
  3473. var objectProto$9 = Object.prototype;
  3474. var hasOwnProperty$8 = objectProto$9.hasOwnProperty;
  3475. var countBy = createAggregator(function(result, value, key) {
  3476. if (hasOwnProperty$8.call(result, key)) {
  3477. ++result[key];
  3478. } else {
  3479. baseAssignValue(result, key, 1);
  3480. }
  3481. });
  3482. function create(prototype, properties) {
  3483. var result = baseCreate(prototype);
  3484. return properties == null ? result : baseAssign(result, properties);
  3485. }
  3486. var WRAP_CURRY_FLAG$1 = 8;
  3487. function curry(func, arity, guard) {
  3488. arity = guard ? void 0 : arity;
  3489. var result = createWrap(func, WRAP_CURRY_FLAG$1, void 0, void 0, void 0, void 0, void 0, arity);
  3490. result.placeholder = curry.placeholder;
  3491. return result;
  3492. }
  3493. curry.placeholder = {};
  3494. var WRAP_CURRY_RIGHT_FLAG = 16;
  3495. function curryRight(func, arity, guard) {
  3496. arity = guard ? void 0 : arity;
  3497. var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, void 0, void 0, void 0, void 0, void 0, arity);
  3498. result.placeholder = curryRight.placeholder;
  3499. return result;
  3500. }
  3501. curryRight.placeholder = {};
  3502. var now = function() {
  3503. return root.Date.now();
  3504. };
  3505. var FUNC_ERROR_TEXT$6 = "Expected a function";
  3506. var nativeMax$b = Math.max;
  3507. var nativeMin$b = Math.min;
  3508. function debounce(func, wait, options) {
  3509. var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
  3510. if (typeof func != "function") {
  3511. throw new TypeError(FUNC_ERROR_TEXT$6);
  3512. }
  3513. wait = toNumber(wait) || 0;
  3514. if (isObject(options)) {
  3515. leading = !!options.leading;
  3516. maxing = "maxWait" in options;
  3517. maxWait = maxing ? nativeMax$b(toNumber(options.maxWait) || 0, wait) : maxWait;
  3518. trailing = "trailing" in options ? !!options.trailing : trailing;
  3519. }
  3520. function invokeFunc(time) {
  3521. var args = lastArgs, thisArg = lastThis;
  3522. lastArgs = lastThis = void 0;
  3523. lastInvokeTime = time;
  3524. result = func.apply(thisArg, args);
  3525. return result;
  3526. }
  3527. function leadingEdge(time) {
  3528. lastInvokeTime = time;
  3529. timerId = setTimeout(timerExpired, wait);
  3530. return leading ? invokeFunc(time) : result;
  3531. }
  3532. function remainingWait(time) {
  3533. var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
  3534. return maxing ? nativeMin$b(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
  3535. }
  3536. function shouldInvoke(time) {
  3537. var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime;
  3538. return lastCallTime === void 0 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
  3539. }
  3540. function timerExpired() {
  3541. var time = now();
  3542. if (shouldInvoke(time)) {
  3543. return trailingEdge(time);
  3544. }
  3545. timerId = setTimeout(timerExpired, remainingWait(time));
  3546. }
  3547. function trailingEdge(time) {
  3548. timerId = void 0;
  3549. if (trailing && lastArgs) {
  3550. return invokeFunc(time);
  3551. }
  3552. lastArgs = lastThis = void 0;
  3553. return result;
  3554. }
  3555. function cancel() {
  3556. if (timerId !== void 0) {
  3557. clearTimeout(timerId);
  3558. }
  3559. lastInvokeTime = 0;
  3560. lastArgs = lastCallTime = lastThis = timerId = void 0;
  3561. }
  3562. function flush() {
  3563. return timerId === void 0 ? result : trailingEdge(now());
  3564. }
  3565. function debounced() {
  3566. var time = now(), isInvoking = shouldInvoke(time);
  3567. lastArgs = arguments;
  3568. lastThis = this;
  3569. lastCallTime = time;
  3570. if (isInvoking) {
  3571. if (timerId === void 0) {
  3572. return leadingEdge(lastCallTime);
  3573. }
  3574. if (maxing) {
  3575. clearTimeout(timerId);
  3576. timerId = setTimeout(timerExpired, wait);
  3577. return invokeFunc(lastCallTime);
  3578. }
  3579. }
  3580. if (timerId === void 0) {
  3581. timerId = setTimeout(timerExpired, wait);
  3582. }
  3583. return result;
  3584. }
  3585. debounced.cancel = cancel;
  3586. debounced.flush = flush;
  3587. return debounced;
  3588. }
  3589. function defaultTo(value, defaultValue) {
  3590. return value == null || value !== value ? defaultValue : value;
  3591. }
  3592. var objectProto$8 = Object.prototype;
  3593. var hasOwnProperty$7 = objectProto$8.hasOwnProperty;
  3594. var defaults = baseRest(function(object, sources) {
  3595. object = Object(object);
  3596. var index = -1;
  3597. var length = sources.length;
  3598. var guard = length > 2 ? sources[2] : void 0;
  3599. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  3600. length = 1;
  3601. }
  3602. while (++index < length) {
  3603. var source = sources[index];
  3604. var props = keysIn(source);
  3605. var propsIndex = -1;
  3606. var propsLength = props.length;
  3607. while (++propsIndex < propsLength) {
  3608. var key = props[propsIndex];
  3609. var value = object[key];
  3610. if (value === void 0 || eq(value, objectProto$8[key]) && !hasOwnProperty$7.call(object, key)) {
  3611. object[key] = source[key];
  3612. }
  3613. }
  3614. }
  3615. return object;
  3616. });
  3617. function assignMergeValue(object, key, value) {
  3618. if (value !== void 0 && !eq(object[key], value) || value === void 0 && !(key in object)) {
  3619. baseAssignValue(object, key, value);
  3620. }
  3621. }
  3622. function isArrayLikeObject(value) {
  3623. return isObjectLike(value) && isArrayLike(value);
  3624. }
  3625. function safeGet(object, key) {
  3626. if (key === "constructor" && typeof object[key] === "function") {
  3627. return;
  3628. }
  3629. if (key == "__proto__") {
  3630. return;
  3631. }
  3632. return object[key];
  3633. }
  3634. function toPlainObject(value) {
  3635. return copyObject(value, keysIn(value));
  3636. }
  3637. function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
  3638. var objValue = safeGet(object, key), srcValue = safeGet(source, key), stacked = stack.get(srcValue);
  3639. if (stacked) {
  3640. assignMergeValue(object, key, stacked);
  3641. return;
  3642. }
  3643. var newValue = customizer ? customizer(objValue, srcValue, key + "", object, source, stack) : void 0;
  3644. var isCommon = newValue === void 0;
  3645. if (isCommon) {
  3646. var isArr = isArray(srcValue), isBuff = !isArr && isBuffer(srcValue), isTyped = !isArr && !isBuff && isTypedArray(srcValue);
  3647. newValue = srcValue;
  3648. if (isArr || isBuff || isTyped) {
  3649. if (isArray(objValue)) {
  3650. newValue = objValue;
  3651. } else if (isArrayLikeObject(objValue)) {
  3652. newValue = copyArray(objValue);
  3653. } else if (isBuff) {
  3654. isCommon = false;
  3655. newValue = cloneBuffer(srcValue, true);
  3656. } else if (isTyped) {
  3657. isCommon = false;
  3658. newValue = cloneTypedArray(srcValue, true);
  3659. } else {
  3660. newValue = [];
  3661. }
  3662. } else if (isPlainObject(srcValue) || isArguments(srcValue)) {
  3663. newValue = objValue;
  3664. if (isArguments(objValue)) {
  3665. newValue = toPlainObject(objValue);
  3666. } else if (!isObject(objValue) || isFunction(objValue)) {
  3667. newValue = initCloneObject(srcValue);
  3668. }
  3669. } else {
  3670. isCommon = false;
  3671. }
  3672. }
  3673. if (isCommon) {
  3674. stack.set(srcValue, newValue);
  3675. mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
  3676. stack["delete"](srcValue);
  3677. }
  3678. assignMergeValue(object, key, newValue);
  3679. }
  3680. function baseMerge(object, source, srcIndex, customizer, stack) {
  3681. if (object === source) {
  3682. return;
  3683. }
  3684. baseFor(source, function(srcValue, key) {
  3685. stack || (stack = new Stack());
  3686. if (isObject(srcValue)) {
  3687. baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
  3688. } else {
  3689. var newValue = customizer ? customizer(safeGet(object, key), srcValue, key + "", object, source, stack) : void 0;
  3690. if (newValue === void 0) {
  3691. newValue = srcValue;
  3692. }
  3693. assignMergeValue(object, key, newValue);
  3694. }
  3695. }, keysIn);
  3696. }
  3697. function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
  3698. if (isObject(objValue) && isObject(srcValue)) {
  3699. stack.set(srcValue, objValue);
  3700. baseMerge(objValue, srcValue, void 0, customDefaultsMerge, stack);
  3701. stack["delete"](srcValue);
  3702. }
  3703. return objValue;
  3704. }
  3705. var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
  3706. baseMerge(object, source, srcIndex, customizer);
  3707. });
  3708. var defaultsDeep = baseRest(function(args) {
  3709. args.push(void 0, customDefaultsMerge);
  3710. return apply(mergeWith, void 0, args);
  3711. });
  3712. var FUNC_ERROR_TEXT$5 = "Expected a function";
  3713. function baseDelay(func, wait, args) {
  3714. if (typeof func != "function") {
  3715. throw new TypeError(FUNC_ERROR_TEXT$5);
  3716. }
  3717. return setTimeout(function() {
  3718. func.apply(void 0, args);
  3719. }, wait);
  3720. }
  3721. var defer = baseRest(function(func, args) {
  3722. return baseDelay(func, 1, args);
  3723. });
  3724. var delay = baseRest(function(func, wait, args) {
  3725. return baseDelay(func, toNumber(wait) || 0, args);
  3726. });
  3727. function arrayIncludesWith(array, value, comparator) {
  3728. var index = -1, length = array == null ? 0 : array.length;
  3729. while (++index < length) {
  3730. if (comparator(value, array[index])) {
  3731. return true;
  3732. }
  3733. }
  3734. return false;
  3735. }
  3736. var LARGE_ARRAY_SIZE$1 = 200;
  3737. function baseDifference(array, values, iteratee, comparator) {
  3738. var index = -1, includes = arrayIncludes, isCommon = true, length = array.length, result = [], valuesLength = values.length;
  3739. if (!length) {
  3740. return result;
  3741. }
  3742. if (iteratee) {
  3743. values = arrayMap(values, baseUnary(iteratee));
  3744. }
  3745. if (comparator) {
  3746. includes = arrayIncludesWith;
  3747. isCommon = false;
  3748. } else if (values.length >= LARGE_ARRAY_SIZE$1) {
  3749. includes = cacheHas;
  3750. isCommon = false;
  3751. values = new SetCache(values);
  3752. }
  3753. outer:
  3754. while (++index < length) {
  3755. var value = array[index], computed = iteratee == null ? value : iteratee(value);
  3756. value = comparator || value !== 0 ? value : 0;
  3757. if (isCommon && computed === computed) {
  3758. var valuesIndex = valuesLength;
  3759. while (valuesIndex--) {
  3760. if (values[valuesIndex] === computed) {
  3761. continue outer;
  3762. }
  3763. }
  3764. result.push(value);
  3765. } else if (!includes(values, computed, comparator)) {
  3766. result.push(value);
  3767. }
  3768. }
  3769. return result;
  3770. }
  3771. var difference = baseRest(function(array, values) {
  3772. return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true)) : [];
  3773. });
  3774. function last(array) {
  3775. var length = array == null ? 0 : array.length;
  3776. return length ? array[length - 1] : void 0;
  3777. }
  3778. var differenceBy = baseRest(function(array, values) {
  3779. var iteratee = last(values);
  3780. if (isArrayLikeObject(iteratee)) {
  3781. iteratee = void 0;
  3782. }
  3783. return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), baseIteratee(iteratee)) : [];
  3784. });
  3785. var differenceWith = baseRest(function(array, values) {
  3786. var comparator = last(values);
  3787. if (isArrayLikeObject(comparator)) {
  3788. comparator = void 0;
  3789. }
  3790. return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), void 0, comparator) : [];
  3791. });
  3792. var divide = createMathOperation(function(dividend, divisor) {
  3793. return dividend / divisor;
  3794. }, 1);
  3795. function drop(array, n, guard) {
  3796. var length = array == null ? 0 : array.length;
  3797. if (!length) {
  3798. return [];
  3799. }
  3800. n = guard || n === void 0 ? 1 : toInteger(n);
  3801. return baseSlice(array, n < 0 ? 0 : n, length);
  3802. }
  3803. function dropRight(array, n, guard) {
  3804. var length = array == null ? 0 : array.length;
  3805. if (!length) {
  3806. return [];
  3807. }
  3808. n = guard || n === void 0 ? 1 : toInteger(n);
  3809. n = length - n;
  3810. return baseSlice(array, 0, n < 0 ? 0 : n);
  3811. }
  3812. function baseWhile(array, predicate, isDrop, fromRight) {
  3813. var length = array.length, index = fromRight ? length : -1;
  3814. while ((fromRight ? index-- : ++index < length) && predicate(array[index], index, array)) {
  3815. }
  3816. return isDrop ? baseSlice(array, fromRight ? 0 : index, fromRight ? index + 1 : length) : baseSlice(array, fromRight ? index + 1 : 0, fromRight ? length : index);
  3817. }
  3818. function dropRightWhile(array, predicate) {
  3819. return array && array.length ? baseWhile(array, baseIteratee(predicate), true, true) : [];
  3820. }
  3821. function dropWhile(array, predicate) {
  3822. return array && array.length ? baseWhile(array, baseIteratee(predicate), true) : [];
  3823. }
  3824. function castFunction(value) {
  3825. return typeof value == "function" ? value : identity;
  3826. }
  3827. function forEach(collection, iteratee) {
  3828. var func = isArray(collection) ? arrayEach : baseEach;
  3829. return func(collection, castFunction(iteratee));
  3830. }
  3831. function arrayEachRight(array, iteratee) {
  3832. var length = array == null ? 0 : array.length;
  3833. while (length--) {
  3834. if (iteratee(array[length], length, array) === false) {
  3835. break;
  3836. }
  3837. }
  3838. return array;
  3839. }
  3840. var baseForRight = createBaseFor(true);
  3841. function baseForOwnRight(object, iteratee) {
  3842. return object && baseForRight(object, iteratee, keys);
  3843. }
  3844. var baseEachRight = createBaseEach(baseForOwnRight, true);
  3845. function forEachRight(collection, iteratee) {
  3846. var func = isArray(collection) ? arrayEachRight : baseEachRight;
  3847. return func(collection, castFunction(iteratee));
  3848. }
  3849. function endsWith(string, target, position) {
  3850. string = toString(string);
  3851. target = baseToString(target);
  3852. var length = string.length;
  3853. position = position === void 0 ? length : baseClamp(toInteger(position), 0, length);
  3854. var end = position;
  3855. position -= target.length;
  3856. return position >= 0 && string.slice(position, end) == target;
  3857. }
  3858. function baseToPairs(object, props) {
  3859. return arrayMap(props, function(key) {
  3860. return [key, object[key]];
  3861. });
  3862. }
  3863. function setToPairs(set) {
  3864. var index = -1, result = Array(set.size);
  3865. set.forEach(function(value) {
  3866. result[++index] = [value, value];
  3867. });
  3868. return result;
  3869. }
  3870. var mapTag$3 = "[object Map]";
  3871. var setTag$3 = "[object Set]";
  3872. function createToPairs(keysFunc) {
  3873. return function(object) {
  3874. var tag = getTag$1(object);
  3875. if (tag == mapTag$3) {
  3876. return mapToArray(object);
  3877. }
  3878. if (tag == setTag$3) {
  3879. return setToPairs(object);
  3880. }
  3881. return baseToPairs(object, keysFunc(object));
  3882. };
  3883. }
  3884. var toPairs = createToPairs(keys);
  3885. var toPairsIn = createToPairs(keysIn);
  3886. var htmlEscapes = {
  3887. "&": "&amp;",
  3888. "<": "&lt;",
  3889. ">": "&gt;",
  3890. '"': "&quot;",
  3891. "'": "&#39;"
  3892. };
  3893. var escapeHtmlChar = basePropertyOf(htmlEscapes);
  3894. var reUnescapedHtml = /[&<>"']/g;
  3895. var reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
  3896. function escape(string) {
  3897. string = toString(string);
  3898. return string && reHasUnescapedHtml.test(string) ? string.replace(reUnescapedHtml, escapeHtmlChar) : string;
  3899. }
  3900. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
  3901. var reHasRegExpChar = RegExp(reRegExpChar.source);
  3902. function escapeRegExp(string) {
  3903. string = toString(string);
  3904. return string && reHasRegExpChar.test(string) ? string.replace(reRegExpChar, "\\$&") : string;
  3905. }
  3906. function arrayEvery(array, predicate) {
  3907. var index = -1, length = array == null ? 0 : array.length;
  3908. while (++index < length) {
  3909. if (!predicate(array[index], index, array)) {
  3910. return false;
  3911. }
  3912. }
  3913. return true;
  3914. }
  3915. function baseEvery(collection, predicate) {
  3916. var result = true;
  3917. baseEach(collection, function(value, index, collection2) {
  3918. result = !!predicate(value, index, collection2);
  3919. return result;
  3920. });
  3921. return result;
  3922. }
  3923. function every(collection, predicate, guard) {
  3924. var func = isArray(collection) ? arrayEvery : baseEvery;
  3925. if (guard && isIterateeCall(collection, predicate, guard)) {
  3926. predicate = void 0;
  3927. }
  3928. return func(collection, baseIteratee(predicate));
  3929. }
  3930. var MAX_ARRAY_LENGTH$5 = 4294967295;
  3931. function toLength(value) {
  3932. return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH$5) : 0;
  3933. }
  3934. function baseFill(array, value, start, end) {
  3935. var length = array.length;
  3936. start = toInteger(start);
  3937. if (start < 0) {
  3938. start = -start > length ? 0 : length + start;
  3939. }
  3940. end = end === void 0 || end > length ? length : toInteger(end);
  3941. if (end < 0) {
  3942. end += length;
  3943. }
  3944. end = start > end ? 0 : toLength(end);
  3945. while (start < end) {
  3946. array[start++] = value;
  3947. }
  3948. return array;
  3949. }
  3950. function fill(array, value, start, end) {
  3951. var length = array == null ? 0 : array.length;
  3952. if (!length) {
  3953. return [];
  3954. }
  3955. if (start && typeof start != "number" && isIterateeCall(array, value, start)) {
  3956. start = 0;
  3957. end = length;
  3958. }
  3959. return baseFill(array, value, start, end);
  3960. }
  3961. function baseFilter(collection, predicate) {
  3962. var result = [];
  3963. baseEach(collection, function(value, index, collection2) {
  3964. if (predicate(value, index, collection2)) {
  3965. result.push(value);
  3966. }
  3967. });
  3968. return result;
  3969. }
  3970. function filter(collection, predicate) {
  3971. var func = isArray(collection) ? arrayFilter : baseFilter;
  3972. return func(collection, baseIteratee(predicate));
  3973. }
  3974. function createFind(findIndexFunc) {
  3975. return function(collection, predicate, fromIndex) {
  3976. var iterable = Object(collection);
  3977. if (!isArrayLike(collection)) {
  3978. var iteratee = baseIteratee(predicate);
  3979. collection = keys(collection);
  3980. predicate = function(key) {
  3981. return iteratee(iterable[key], key, iterable);
  3982. };
  3983. }
  3984. var index = findIndexFunc(collection, predicate, fromIndex);
  3985. return index > -1 ? iterable[iteratee ? collection[index] : index] : void 0;
  3986. };
  3987. }
  3988. var nativeMax$a = Math.max;
  3989. function findIndex(array, predicate, fromIndex) {
  3990. var length = array == null ? 0 : array.length;
  3991. if (!length) {
  3992. return -1;
  3993. }
  3994. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  3995. if (index < 0) {
  3996. index = nativeMax$a(length + index, 0);
  3997. }
  3998. return baseFindIndex(array, baseIteratee(predicate), index);
  3999. }
  4000. var find = createFind(findIndex);
  4001. function baseFindKey(collection, predicate, eachFunc) {
  4002. var result;
  4003. eachFunc(collection, function(value, key, collection2) {
  4004. if (predicate(value, key, collection2)) {
  4005. result = key;
  4006. return false;
  4007. }
  4008. });
  4009. return result;
  4010. }
  4011. function findKey(object, predicate) {
  4012. return baseFindKey(object, baseIteratee(predicate), baseForOwn);
  4013. }
  4014. var nativeMax$9 = Math.max;
  4015. var nativeMin$a = Math.min;
  4016. function findLastIndex(array, predicate, fromIndex) {
  4017. var length = array == null ? 0 : array.length;
  4018. if (!length) {
  4019. return -1;
  4020. }
  4021. var index = length - 1;
  4022. if (fromIndex !== void 0) {
  4023. index = toInteger(fromIndex);
  4024. index = fromIndex < 0 ? nativeMax$9(length + index, 0) : nativeMin$a(index, length - 1);
  4025. }
  4026. return baseFindIndex(array, baseIteratee(predicate), index, true);
  4027. }
  4028. var findLast = createFind(findLastIndex);
  4029. function findLastKey(object, predicate) {
  4030. return baseFindKey(object, baseIteratee(predicate), baseForOwnRight);
  4031. }
  4032. function head(array) {
  4033. return array && array.length ? array[0] : void 0;
  4034. }
  4035. function baseMap(collection, iteratee) {
  4036. var index = -1, result = isArrayLike(collection) ? Array(collection.length) : [];
  4037. baseEach(collection, function(value, key, collection2) {
  4038. result[++index] = iteratee(value, key, collection2);
  4039. });
  4040. return result;
  4041. }
  4042. function map(collection, iteratee) {
  4043. var func = isArray(collection) ? arrayMap : baseMap;
  4044. return func(collection, baseIteratee(iteratee));
  4045. }
  4046. function flatMap(collection, iteratee) {
  4047. return baseFlatten(map(collection, iteratee), 1);
  4048. }
  4049. var INFINITY$2 = 1 / 0;
  4050. function flatMapDeep(collection, iteratee) {
  4051. return baseFlatten(map(collection, iteratee), INFINITY$2);
  4052. }
  4053. function flatMapDepth(collection, iteratee, depth) {
  4054. depth = depth === void 0 ? 1 : toInteger(depth);
  4055. return baseFlatten(map(collection, iteratee), depth);
  4056. }
  4057. var INFINITY$1 = 1 / 0;
  4058. function flattenDeep(array) {
  4059. var length = array == null ? 0 : array.length;
  4060. return length ? baseFlatten(array, INFINITY$1) : [];
  4061. }
  4062. function flattenDepth(array, depth) {
  4063. var length = array == null ? 0 : array.length;
  4064. if (!length) {
  4065. return [];
  4066. }
  4067. depth = depth === void 0 ? 1 : toInteger(depth);
  4068. return baseFlatten(array, depth);
  4069. }
  4070. var WRAP_FLIP_FLAG = 512;
  4071. function flip$1(func) {
  4072. return createWrap(func, WRAP_FLIP_FLAG);
  4073. }
  4074. var floor$1 = createRound("floor");
  4075. var FUNC_ERROR_TEXT$4 = "Expected a function";
  4076. var WRAP_CURRY_FLAG = 8;
  4077. var WRAP_PARTIAL_FLAG$1 = 32;
  4078. var WRAP_ARY_FLAG = 128;
  4079. var WRAP_REARG_FLAG$1 = 256;
  4080. function createFlow(fromRight) {
  4081. return flatRest(function(funcs) {
  4082. var length = funcs.length, index = length, prereq = LodashWrapper.prototype.thru;
  4083. if (fromRight) {
  4084. funcs.reverse();
  4085. }
  4086. while (index--) {
  4087. var func = funcs[index];
  4088. if (typeof func != "function") {
  4089. throw new TypeError(FUNC_ERROR_TEXT$4);
  4090. }
  4091. if (prereq && !wrapper && getFuncName(func) == "wrapper") {
  4092. var wrapper = new LodashWrapper([], true);
  4093. }
  4094. }
  4095. index = wrapper ? index : length;
  4096. while (++index < length) {
  4097. func = funcs[index];
  4098. var funcName = getFuncName(func), data = funcName == "wrapper" ? getData(func) : void 0;
  4099. if (data && isLaziable(data[0]) && data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG$1 | WRAP_REARG_FLAG$1) && !data[4].length && data[9] == 1) {
  4100. wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
  4101. } else {
  4102. wrapper = func.length == 1 && isLaziable(func) ? wrapper[funcName]() : wrapper.thru(func);
  4103. }
  4104. }
  4105. return function() {
  4106. var args = arguments, value = args[0];
  4107. if (wrapper && args.length == 1 && isArray(value)) {
  4108. return wrapper.plant(value).value();
  4109. }
  4110. var index2 = 0, result = length ? funcs[index2].apply(this, args) : value;
  4111. while (++index2 < length) {
  4112. result = funcs[index2].call(this, result);
  4113. }
  4114. return result;
  4115. };
  4116. });
  4117. }
  4118. var flow = createFlow();
  4119. var flowRight = createFlow(true);
  4120. function forIn(object, iteratee) {
  4121. return object == null ? object : baseFor(object, castFunction(iteratee), keysIn);
  4122. }
  4123. function forInRight(object, iteratee) {
  4124. return object == null ? object : baseForRight(object, castFunction(iteratee), keysIn);
  4125. }
  4126. function forOwn(object, iteratee) {
  4127. return object && baseForOwn(object, castFunction(iteratee));
  4128. }
  4129. function forOwnRight(object, iteratee) {
  4130. return object && baseForOwnRight(object, castFunction(iteratee));
  4131. }
  4132. function fromPairs(pairs) {
  4133. var index = -1, length = pairs == null ? 0 : pairs.length, result = {};
  4134. while (++index < length) {
  4135. var pair = pairs[index];
  4136. result[pair[0]] = pair[1];
  4137. }
  4138. return result;
  4139. }
  4140. function baseFunctions(object, props) {
  4141. return arrayFilter(props, function(key) {
  4142. return isFunction(object[key]);
  4143. });
  4144. }
  4145. function functions(object) {
  4146. return object == null ? [] : baseFunctions(object, keys(object));
  4147. }
  4148. function functionsIn(object) {
  4149. return object == null ? [] : baseFunctions(object, keysIn(object));
  4150. }
  4151. var objectProto$7 = Object.prototype;
  4152. var hasOwnProperty$6 = objectProto$7.hasOwnProperty;
  4153. var groupBy = createAggregator(function(result, value, key) {
  4154. if (hasOwnProperty$6.call(result, key)) {
  4155. result[key].push(value);
  4156. } else {
  4157. baseAssignValue(result, key, [value]);
  4158. }
  4159. });
  4160. function baseGt(value, other) {
  4161. return value > other;
  4162. }
  4163. function createRelationalOperation(operator) {
  4164. return function(value, other) {
  4165. if (!(typeof value == "string" && typeof other == "string")) {
  4166. value = toNumber(value);
  4167. other = toNumber(other);
  4168. }
  4169. return operator(value, other);
  4170. };
  4171. }
  4172. var gt$1 = createRelationalOperation(baseGt);
  4173. var gte = createRelationalOperation(function(value, other) {
  4174. return value >= other;
  4175. });
  4176. var objectProto$6 = Object.prototype;
  4177. var hasOwnProperty$5 = objectProto$6.hasOwnProperty;
  4178. function baseHas(object, key) {
  4179. return object != null && hasOwnProperty$5.call(object, key);
  4180. }
  4181. function has(object, path) {
  4182. return object != null && hasPath(object, path, baseHas);
  4183. }
  4184. var nativeMax$8 = Math.max;
  4185. var nativeMin$9 = Math.min;
  4186. function baseInRange(number, start, end) {
  4187. return number >= nativeMin$9(start, end) && number < nativeMax$8(start, end);
  4188. }
  4189. function inRange(number, start, end) {
  4190. start = toFinite(start);
  4191. if (end === void 0) {
  4192. end = start;
  4193. start = 0;
  4194. } else {
  4195. end = toFinite(end);
  4196. }
  4197. number = toNumber(number);
  4198. return baseInRange(number, start, end);
  4199. }
  4200. var stringTag = "[object String]";
  4201. function isString(value) {
  4202. return typeof value == "string" || !isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag;
  4203. }
  4204. function baseValues(object, props) {
  4205. return arrayMap(props, function(key) {
  4206. return object[key];
  4207. });
  4208. }
  4209. function values(object) {
  4210. return object == null ? [] : baseValues(object, keys(object));
  4211. }
  4212. var nativeMax$7 = Math.max;
  4213. function includes(collection, value, fromIndex, guard) {
  4214. collection = isArrayLike(collection) ? collection : values(collection);
  4215. fromIndex = fromIndex && !guard ? toInteger(fromIndex) : 0;
  4216. var length = collection.length;
  4217. if (fromIndex < 0) {
  4218. fromIndex = nativeMax$7(length + fromIndex, 0);
  4219. }
  4220. return isString(collection) ? fromIndex <= length && collection.indexOf(value, fromIndex) > -1 : !!length && baseIndexOf(collection, value, fromIndex) > -1;
  4221. }
  4222. var nativeMax$6 = Math.max;
  4223. function indexOf(array, value, fromIndex) {
  4224. var length = array == null ? 0 : array.length;
  4225. if (!length) {
  4226. return -1;
  4227. }
  4228. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  4229. if (index < 0) {
  4230. index = nativeMax$6(length + index, 0);
  4231. }
  4232. return baseIndexOf(array, value, index);
  4233. }
  4234. function initial$1(array) {
  4235. var length = array == null ? 0 : array.length;
  4236. return length ? baseSlice(array, 0, -1) : [];
  4237. }
  4238. var nativeMin$8 = Math.min;
  4239. function baseIntersection(arrays, iteratee, comparator) {
  4240. var includes = comparator ? arrayIncludesWith : arrayIncludes, length = arrays[0].length, othLength = arrays.length, othIndex = othLength, caches = Array(othLength), maxLength = Infinity, result = [];
  4241. while (othIndex--) {
  4242. var array = arrays[othIndex];
  4243. if (othIndex && iteratee) {
  4244. array = arrayMap(array, baseUnary(iteratee));
  4245. }
  4246. maxLength = nativeMin$8(array.length, maxLength);
  4247. caches[othIndex] = !comparator && (iteratee || length >= 120 && array.length >= 120) ? new SetCache(othIndex && array) : void 0;
  4248. }
  4249. array = arrays[0];
  4250. var index = -1, seen = caches[0];
  4251. outer:
  4252. while (++index < length && result.length < maxLength) {
  4253. var value = array[index], computed = iteratee ? iteratee(value) : value;
  4254. value = comparator || value !== 0 ? value : 0;
  4255. if (!(seen ? cacheHas(seen, computed) : includes(result, computed, comparator))) {
  4256. othIndex = othLength;
  4257. while (--othIndex) {
  4258. var cache = caches[othIndex];
  4259. if (!(cache ? cacheHas(cache, computed) : includes(arrays[othIndex], computed, comparator))) {
  4260. continue outer;
  4261. }
  4262. }
  4263. if (seen) {
  4264. seen.push(computed);
  4265. }
  4266. result.push(value);
  4267. }
  4268. }
  4269. return result;
  4270. }
  4271. function castArrayLikeObject(value) {
  4272. return isArrayLikeObject(value) ? value : [];
  4273. }
  4274. var intersection = baseRest(function(arrays) {
  4275. var mapped = arrayMap(arrays, castArrayLikeObject);
  4276. return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped) : [];
  4277. });
  4278. var intersectionBy = baseRest(function(arrays) {
  4279. var iteratee = last(arrays), mapped = arrayMap(arrays, castArrayLikeObject);
  4280. if (iteratee === last(mapped)) {
  4281. iteratee = void 0;
  4282. } else {
  4283. mapped.pop();
  4284. }
  4285. return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, baseIteratee(iteratee)) : [];
  4286. });
  4287. var intersectionWith = baseRest(function(arrays) {
  4288. var comparator = last(arrays), mapped = arrayMap(arrays, castArrayLikeObject);
  4289. comparator = typeof comparator == "function" ? comparator : void 0;
  4290. if (comparator) {
  4291. mapped.pop();
  4292. }
  4293. return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, void 0, comparator) : [];
  4294. });
  4295. function baseInverter(object, setter, iteratee, accumulator) {
  4296. baseForOwn(object, function(value, key, object2) {
  4297. setter(accumulator, iteratee(value), key, object2);
  4298. });
  4299. return accumulator;
  4300. }
  4301. function createInverter(setter, toIteratee) {
  4302. return function(object, iteratee) {
  4303. return baseInverter(object, setter, toIteratee(iteratee), {});
  4304. };
  4305. }
  4306. var objectProto$5 = Object.prototype;
  4307. var nativeObjectToString$1 = objectProto$5.toString;
  4308. var invert = createInverter(function(result, value, key) {
  4309. if (value != null && typeof value.toString != "function") {
  4310. value = nativeObjectToString$1.call(value);
  4311. }
  4312. result[value] = key;
  4313. }, constant(identity));
  4314. var objectProto$4 = Object.prototype;
  4315. var hasOwnProperty$4 = objectProto$4.hasOwnProperty;
  4316. var nativeObjectToString = objectProto$4.toString;
  4317. var invertBy = createInverter(function(result, value, key) {
  4318. if (value != null && typeof value.toString != "function") {
  4319. value = nativeObjectToString.call(value);
  4320. }
  4321. if (hasOwnProperty$4.call(result, value)) {
  4322. result[value].push(key);
  4323. } else {
  4324. result[value] = [key];
  4325. }
  4326. }, baseIteratee);
  4327. function parent(object, path) {
  4328. return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
  4329. }
  4330. function baseInvoke(object, path, args) {
  4331. path = castPath(path, object);
  4332. object = parent(object, path);
  4333. var func = object == null ? object : object[toKey(last(path))];
  4334. return func == null ? void 0 : apply(func, object, args);
  4335. }
  4336. var invoke = baseRest(baseInvoke);
  4337. var invokeMap = baseRest(function(collection, path, args) {
  4338. var index = -1, isFunc = typeof path == "function", result = isArrayLike(collection) ? Array(collection.length) : [];
  4339. baseEach(collection, function(value) {
  4340. result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
  4341. });
  4342. return result;
  4343. });
  4344. var arrayBufferTag = "[object ArrayBuffer]";
  4345. function baseIsArrayBuffer(value) {
  4346. return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;
  4347. }
  4348. var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer;
  4349. var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
  4350. var boolTag = "[object Boolean]";
  4351. function isBoolean$1(value) {
  4352. return value === true || value === false || isObjectLike(value) && baseGetTag(value) == boolTag;
  4353. }
  4354. var dateTag = "[object Date]";
  4355. function baseIsDate(value) {
  4356. return isObjectLike(value) && baseGetTag(value) == dateTag;
  4357. }
  4358. var nodeIsDate = nodeUtil && nodeUtil.isDate;
  4359. var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
  4360. function isElement$2(value) {
  4361. return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
  4362. }
  4363. var mapTag$2 = "[object Map]";
  4364. var setTag$2 = "[object Set]";
  4365. var objectProto$3 = Object.prototype;
  4366. var hasOwnProperty$3 = objectProto$3.hasOwnProperty;
  4367. function isEmpty$1(value) {
  4368. if (value == null) {
  4369. return true;
  4370. }
  4371. if (isArrayLike(value) && (isArray(value) || typeof value == "string" || typeof value.splice == "function" || isBuffer(value) || isTypedArray(value) || isArguments(value))) {
  4372. return !value.length;
  4373. }
  4374. var tag = getTag$1(value);
  4375. if (tag == mapTag$2 || tag == setTag$2) {
  4376. return !value.size;
  4377. }
  4378. if (isPrototype(value)) {
  4379. return !baseKeys(value).length;
  4380. }
  4381. for (var key in value) {
  4382. if (hasOwnProperty$3.call(value, key)) {
  4383. return false;
  4384. }
  4385. }
  4386. return true;
  4387. }
  4388. function isEqual$1(value, other) {
  4389. return baseIsEqual(value, other);
  4390. }
  4391. function isEqualWith(value, other, customizer) {
  4392. customizer = typeof customizer == "function" ? customizer : void 0;
  4393. var result = customizer ? customizer(value, other) : void 0;
  4394. return result === void 0 ? baseIsEqual(value, other, void 0, customizer) : !!result;
  4395. }
  4396. var nativeIsFinite = root.isFinite;
  4397. function isFinite(value) {
  4398. return typeof value == "number" && nativeIsFinite(value);
  4399. }
  4400. function isInteger(value) {
  4401. return typeof value == "number" && value == toInteger(value);
  4402. }
  4403. function isMatch(object, source) {
  4404. return object === source || baseIsMatch(object, source, getMatchData(source));
  4405. }
  4406. function isMatchWith(object, source, customizer) {
  4407. customizer = typeof customizer == "function" ? customizer : void 0;
  4408. return baseIsMatch(object, source, getMatchData(source), customizer);
  4409. }
  4410. var numberTag = "[object Number]";
  4411. function isNumber$1(value) {
  4412. return typeof value == "number" || isObjectLike(value) && baseGetTag(value) == numberTag;
  4413. }
  4414. function isNaN$1(value) {
  4415. return isNumber$1(value) && value != +value;
  4416. }
  4417. var isMaskable = coreJsData ? isFunction : stubFalse;
  4418. var CORE_ERROR_TEXT = "Unsupported core-js use. Try https://npms.io/search?q=ponyfill.";
  4419. function isNative(value) {
  4420. if (isMaskable(value)) {
  4421. throw new Error(CORE_ERROR_TEXT);
  4422. }
  4423. return baseIsNative(value);
  4424. }
  4425. function isNil(value) {
  4426. return value == null;
  4427. }
  4428. function isNull(value) {
  4429. return value === null;
  4430. }
  4431. var regexpTag = "[object RegExp]";
  4432. function baseIsRegExp(value) {
  4433. return isObjectLike(value) && baseGetTag(value) == regexpTag;
  4434. }
  4435. var nodeIsRegExp = nodeUtil && nodeUtil.isRegExp;
  4436. var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
  4437. var MAX_SAFE_INTEGER$3 = 9007199254740991;
  4438. function isSafeInteger(value) {
  4439. return isInteger(value) && value >= -MAX_SAFE_INTEGER$3 && value <= MAX_SAFE_INTEGER$3;
  4440. }
  4441. function isUndefined$1(value) {
  4442. return value === void 0;
  4443. }
  4444. var weakMapTag = "[object WeakMap]";
  4445. function isWeakMap(value) {
  4446. return isObjectLike(value) && getTag$1(value) == weakMapTag;
  4447. }
  4448. var weakSetTag = "[object WeakSet]";
  4449. function isWeakSet(value) {
  4450. return isObjectLike(value) && baseGetTag(value) == weakSetTag;
  4451. }
  4452. var CLONE_DEEP_FLAG$3 = 1;
  4453. function iteratee(func) {
  4454. return baseIteratee(typeof func == "function" ? func : baseClone(func, CLONE_DEEP_FLAG$3));
  4455. }
  4456. var arrayProto$4 = Array.prototype;
  4457. var nativeJoin = arrayProto$4.join;
  4458. function join(array, separator) {
  4459. return array == null ? "" : nativeJoin.call(array, separator);
  4460. }
  4461. var kebabCase = createCompounder(function(result, word, index) {
  4462. return result + (index ? "-" : "") + word.toLowerCase();
  4463. });
  4464. var keyBy = createAggregator(function(result, value, key) {
  4465. baseAssignValue(result, key, value);
  4466. });
  4467. function strictLastIndexOf(array, value, fromIndex) {
  4468. var index = fromIndex + 1;
  4469. while (index--) {
  4470. if (array[index] === value) {
  4471. return index;
  4472. }
  4473. }
  4474. return index;
  4475. }
  4476. var nativeMax$5 = Math.max;
  4477. var nativeMin$7 = Math.min;
  4478. function lastIndexOf(array, value, fromIndex) {
  4479. var length = array == null ? 0 : array.length;
  4480. if (!length) {
  4481. return -1;
  4482. }
  4483. var index = length;
  4484. if (fromIndex !== void 0) {
  4485. index = toInteger(fromIndex);
  4486. index = index < 0 ? nativeMax$5(length + index, 0) : nativeMin$7(index, length - 1);
  4487. }
  4488. return value === value ? strictLastIndexOf(array, value, index) : baseFindIndex(array, baseIsNaN, index, true);
  4489. }
  4490. var lowerCase = createCompounder(function(result, word, index) {
  4491. return result + (index ? " " : "") + word.toLowerCase();
  4492. });
  4493. var lowerFirst = createCaseFirst("toLowerCase");
  4494. function baseLt(value, other) {
  4495. return value < other;
  4496. }
  4497. var lt$1 = createRelationalOperation(baseLt);
  4498. var lte = createRelationalOperation(function(value, other) {
  4499. return value <= other;
  4500. });
  4501. function mapKeys(object, iteratee) {
  4502. var result = {};
  4503. iteratee = baseIteratee(iteratee);
  4504. baseForOwn(object, function(value, key, object2) {
  4505. baseAssignValue(result, iteratee(value, key, object2), value);
  4506. });
  4507. return result;
  4508. }
  4509. function mapValues(object, iteratee) {
  4510. var result = {};
  4511. iteratee = baseIteratee(iteratee);
  4512. baseForOwn(object, function(value, key, object2) {
  4513. baseAssignValue(result, key, iteratee(value, key, object2));
  4514. });
  4515. return result;
  4516. }
  4517. var CLONE_DEEP_FLAG$2 = 1;
  4518. function matches(source) {
  4519. return baseMatches(baseClone(source, CLONE_DEEP_FLAG$2));
  4520. }
  4521. var CLONE_DEEP_FLAG$1 = 1;
  4522. function matchesProperty(path, srcValue) {
  4523. return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG$1));
  4524. }
  4525. function baseExtremum(array, iteratee, comparator) {
  4526. var index = -1, length = array.length;
  4527. while (++index < length) {
  4528. var value = array[index], current = iteratee(value);
  4529. if (current != null && (computed === void 0 ? current === current && !isSymbol(current) : comparator(current, computed))) {
  4530. var computed = current, result = value;
  4531. }
  4532. }
  4533. return result;
  4534. }
  4535. function max$3(array) {
  4536. return array && array.length ? baseExtremum(array, identity, baseGt) : void 0;
  4537. }
  4538. function maxBy(array, iteratee) {
  4539. return array && array.length ? baseExtremum(array, baseIteratee(iteratee), baseGt) : void 0;
  4540. }
  4541. function baseSum(array, iteratee) {
  4542. var result, index = -1, length = array.length;
  4543. while (++index < length) {
  4544. var current = iteratee(array[index]);
  4545. if (current !== void 0) {
  4546. result = result === void 0 ? current : result + current;
  4547. }
  4548. }
  4549. return result;
  4550. }
  4551. var NAN = 0 / 0;
  4552. function baseMean(array, iteratee) {
  4553. var length = array == null ? 0 : array.length;
  4554. return length ? baseSum(array, iteratee) / length : NAN;
  4555. }
  4556. function mean(array) {
  4557. return baseMean(array, identity);
  4558. }
  4559. function meanBy(array, iteratee) {
  4560. return baseMean(array, baseIteratee(iteratee));
  4561. }
  4562. var merge = createAssigner(function(object, source, srcIndex) {
  4563. baseMerge(object, source, srcIndex);
  4564. });
  4565. var method = baseRest(function(path, args) {
  4566. return function(object) {
  4567. return baseInvoke(object, path, args);
  4568. };
  4569. });
  4570. var methodOf = baseRest(function(object, args) {
  4571. return function(path) {
  4572. return baseInvoke(object, path, args);
  4573. };
  4574. });
  4575. function min$3(array) {
  4576. return array && array.length ? baseExtremum(array, identity, baseLt) : void 0;
  4577. }
  4578. function minBy(array, iteratee) {
  4579. return array && array.length ? baseExtremum(array, baseIteratee(iteratee), baseLt) : void 0;
  4580. }
  4581. function mixin$1(object, source, options) {
  4582. var props = keys(source), methodNames = baseFunctions(source, props);
  4583. var chain = !(isObject(options) && "chain" in options) || !!options.chain, isFunc = isFunction(object);
  4584. arrayEach(methodNames, function(methodName) {
  4585. var func = source[methodName];
  4586. object[methodName] = func;
  4587. if (isFunc) {
  4588. object.prototype[methodName] = function() {
  4589. var chainAll = this.__chain__;
  4590. if (chain || chainAll) {
  4591. var result = object(this.__wrapped__), actions = result.__actions__ = copyArray(this.__actions__);
  4592. actions.push({ "func": func, "args": arguments, "thisArg": object });
  4593. result.__chain__ = chainAll;
  4594. return result;
  4595. }
  4596. return func.apply(object, arrayPush([this.value()], arguments));
  4597. };
  4598. }
  4599. });
  4600. return object;
  4601. }
  4602. var multiply = createMathOperation(function(multiplier, multiplicand) {
  4603. return multiplier * multiplicand;
  4604. }, 1);
  4605. var FUNC_ERROR_TEXT$3 = "Expected a function";
  4606. function negate(predicate) {
  4607. if (typeof predicate != "function") {
  4608. throw new TypeError(FUNC_ERROR_TEXT$3);
  4609. }
  4610. return function() {
  4611. var args = arguments;
  4612. switch (args.length) {
  4613. case 0:
  4614. return !predicate.call(this);
  4615. case 1:
  4616. return !predicate.call(this, args[0]);
  4617. case 2:
  4618. return !predicate.call(this, args[0], args[1]);
  4619. case 3:
  4620. return !predicate.call(this, args[0], args[1], args[2]);
  4621. }
  4622. return !predicate.apply(this, args);
  4623. };
  4624. }
  4625. function iteratorToArray(iterator) {
  4626. var data, result = [];
  4627. while (!(data = iterator.next()).done) {
  4628. result.push(data.value);
  4629. }
  4630. return result;
  4631. }
  4632. var mapTag$1 = "[object Map]";
  4633. var setTag$1 = "[object Set]";
  4634. var symIterator$1 = Symbol$1 ? Symbol$1.iterator : void 0;
  4635. function toArray(value) {
  4636. if (!value) {
  4637. return [];
  4638. }
  4639. if (isArrayLike(value)) {
  4640. return isString(value) ? stringToArray(value) : copyArray(value);
  4641. }
  4642. if (symIterator$1 && value[symIterator$1]) {
  4643. return iteratorToArray(value[symIterator$1]());
  4644. }
  4645. var tag = getTag$1(value), func = tag == mapTag$1 ? mapToArray : tag == setTag$1 ? setToArray : values;
  4646. return func(value);
  4647. }
  4648. function wrapperNext() {
  4649. if (this.__values__ === void 0) {
  4650. this.__values__ = toArray(this.value());
  4651. }
  4652. var done = this.__index__ >= this.__values__.length, value = done ? void 0 : this.__values__[this.__index__++];
  4653. return { "done": done, "value": value };
  4654. }
  4655. function baseNth(array, n) {
  4656. var length = array.length;
  4657. if (!length) {
  4658. return;
  4659. }
  4660. n += n < 0 ? length : 0;
  4661. return isIndex(n, length) ? array[n] : void 0;
  4662. }
  4663. function nth(array, n) {
  4664. return array && array.length ? baseNth(array, toInteger(n)) : void 0;
  4665. }
  4666. function nthArg(n) {
  4667. n = toInteger(n);
  4668. return baseRest(function(args) {
  4669. return baseNth(args, n);
  4670. });
  4671. }
  4672. function baseUnset(object, path) {
  4673. path = castPath(path, object);
  4674. object = parent(object, path);
  4675. return object == null || delete object[toKey(last(path))];
  4676. }
  4677. function customOmitClone(value) {
  4678. return isPlainObject(value) ? void 0 : value;
  4679. }
  4680. var CLONE_DEEP_FLAG = 1;
  4681. var CLONE_FLAT_FLAG = 2;
  4682. var CLONE_SYMBOLS_FLAG = 4;
  4683. var omit = flatRest(function(object, paths) {
  4684. var result = {};
  4685. if (object == null) {
  4686. return result;
  4687. }
  4688. var isDeep = false;
  4689. paths = arrayMap(paths, function(path) {
  4690. path = castPath(path, object);
  4691. isDeep || (isDeep = path.length > 1);
  4692. return path;
  4693. });
  4694. copyObject(object, getAllKeysIn(object), result);
  4695. if (isDeep) {
  4696. result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
  4697. }
  4698. var length = paths.length;
  4699. while (length--) {
  4700. baseUnset(result, paths[length]);
  4701. }
  4702. return result;
  4703. });
  4704. function baseSet(object, path, value, customizer) {
  4705. if (!isObject(object)) {
  4706. return object;
  4707. }
  4708. path = castPath(path, object);
  4709. var index = -1, length = path.length, lastIndex = length - 1, nested = object;
  4710. while (nested != null && ++index < length) {
  4711. var key = toKey(path[index]), newValue = value;
  4712. if (key === "__proto__" || key === "constructor" || key === "prototype") {
  4713. return object;
  4714. }
  4715. if (index != lastIndex) {
  4716. var objValue = nested[key];
  4717. newValue = customizer ? customizer(objValue, key, nested) : void 0;
  4718. if (newValue === void 0) {
  4719. newValue = isObject(objValue) ? objValue : isIndex(path[index + 1]) ? [] : {};
  4720. }
  4721. }
  4722. assignValue(nested, key, newValue);
  4723. nested = nested[key];
  4724. }
  4725. return object;
  4726. }
  4727. function basePickBy(object, paths, predicate) {
  4728. var index = -1, length = paths.length, result = {};
  4729. while (++index < length) {
  4730. var path = paths[index], value = baseGet(object, path);
  4731. if (predicate(value, path)) {
  4732. baseSet(result, castPath(path, object), value);
  4733. }
  4734. }
  4735. return result;
  4736. }
  4737. function pickBy(object, predicate) {
  4738. if (object == null) {
  4739. return {};
  4740. }
  4741. var props = arrayMap(getAllKeysIn(object), function(prop) {
  4742. return [prop];
  4743. });
  4744. predicate = baseIteratee(predicate);
  4745. return basePickBy(object, props, function(value, path) {
  4746. return predicate(value, path[0]);
  4747. });
  4748. }
  4749. function omitBy(object, predicate) {
  4750. return pickBy(object, negate(baseIteratee(predicate)));
  4751. }
  4752. function once(func) {
  4753. return before(2, func);
  4754. }
  4755. function baseSortBy(array, comparer) {
  4756. var length = array.length;
  4757. array.sort(comparer);
  4758. while (length--) {
  4759. array[length] = array[length].value;
  4760. }
  4761. return array;
  4762. }
  4763. function compareAscending(value, other) {
  4764. if (value !== other) {
  4765. var valIsDefined = value !== void 0, valIsNull = value === null, valIsReflexive = value === value, valIsSymbol = isSymbol(value);
  4766. var othIsDefined = other !== void 0, othIsNull = other === null, othIsReflexive = other === other, othIsSymbol = isSymbol(other);
  4767. if (!othIsNull && !othIsSymbol && !valIsSymbol && value > other || valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol || valIsNull && othIsDefined && othIsReflexive || !valIsDefined && othIsReflexive || !valIsReflexive) {
  4768. return 1;
  4769. }
  4770. if (!valIsNull && !valIsSymbol && !othIsSymbol && value < other || othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol || othIsNull && valIsDefined && valIsReflexive || !othIsDefined && valIsReflexive || !othIsReflexive) {
  4771. return -1;
  4772. }
  4773. }
  4774. return 0;
  4775. }
  4776. function compareMultiple(object, other, orders) {
  4777. var index = -1, objCriteria = object.criteria, othCriteria = other.criteria, length = objCriteria.length, ordersLength = orders.length;
  4778. while (++index < length) {
  4779. var result = compareAscending(objCriteria[index], othCriteria[index]);
  4780. if (result) {
  4781. if (index >= ordersLength) {
  4782. return result;
  4783. }
  4784. var order = orders[index];
  4785. return result * (order == "desc" ? -1 : 1);
  4786. }
  4787. }
  4788. return object.index - other.index;
  4789. }
  4790. function baseOrderBy(collection, iteratees, orders) {
  4791. if (iteratees.length) {
  4792. iteratees = arrayMap(iteratees, function(iteratee) {
  4793. if (isArray(iteratee)) {
  4794. return function(value) {
  4795. return baseGet(value, iteratee.length === 1 ? iteratee[0] : iteratee);
  4796. };
  4797. }
  4798. return iteratee;
  4799. });
  4800. } else {
  4801. iteratees = [identity];
  4802. }
  4803. var index = -1;
  4804. iteratees = arrayMap(iteratees, baseUnary(baseIteratee));
  4805. var result = baseMap(collection, function(value, key, collection2) {
  4806. var criteria = arrayMap(iteratees, function(iteratee) {
  4807. return iteratee(value);
  4808. });
  4809. return { "criteria": criteria, "index": ++index, "value": value };
  4810. });
  4811. return baseSortBy(result, function(object, other) {
  4812. return compareMultiple(object, other, orders);
  4813. });
  4814. }
  4815. function orderBy$1(collection, iteratees, orders, guard) {
  4816. if (collection == null) {
  4817. return [];
  4818. }
  4819. if (!isArray(iteratees)) {
  4820. iteratees = iteratees == null ? [] : [iteratees];
  4821. }
  4822. orders = guard ? void 0 : orders;
  4823. if (!isArray(orders)) {
  4824. orders = orders == null ? [] : [orders];
  4825. }
  4826. return baseOrderBy(collection, iteratees, orders);
  4827. }
  4828. function createOver(arrayFunc) {
  4829. return flatRest(function(iteratees) {
  4830. iteratees = arrayMap(iteratees, baseUnary(baseIteratee));
  4831. return baseRest(function(args) {
  4832. var thisArg = this;
  4833. return arrayFunc(iteratees, function(iteratee) {
  4834. return apply(iteratee, thisArg, args);
  4835. });
  4836. });
  4837. });
  4838. }
  4839. var over = createOver(arrayMap);
  4840. var castRest = baseRest;
  4841. var nativeMin$6 = Math.min;
  4842. var overArgs = castRest(function(func, transforms) {
  4843. transforms = transforms.length == 1 && isArray(transforms[0]) ? arrayMap(transforms[0], baseUnary(baseIteratee)) : arrayMap(baseFlatten(transforms, 1), baseUnary(baseIteratee));
  4844. var funcsLength = transforms.length;
  4845. return baseRest(function(args) {
  4846. var index = -1, length = nativeMin$6(args.length, funcsLength);
  4847. while (++index < length) {
  4848. args[index] = transforms[index].call(this, args[index]);
  4849. }
  4850. return apply(func, this, args);
  4851. });
  4852. });
  4853. var overEvery = createOver(arrayEvery);
  4854. var overSome = createOver(arraySome);
  4855. var MAX_SAFE_INTEGER$2 = 9007199254740991;
  4856. var nativeFloor$3 = Math.floor;
  4857. function baseRepeat(string, n) {
  4858. var result = "";
  4859. if (!string || n < 1 || n > MAX_SAFE_INTEGER$2) {
  4860. return result;
  4861. }
  4862. do {
  4863. if (n % 2) {
  4864. result += string;
  4865. }
  4866. n = nativeFloor$3(n / 2);
  4867. if (n) {
  4868. string += string;
  4869. }
  4870. } while (n);
  4871. return result;
  4872. }
  4873. var asciiSize = baseProperty("length");
  4874. var rsAstralRange = "\\ud800-\\udfff";
  4875. var rsComboMarksRange = "\\u0300-\\u036f";
  4876. var reComboHalfMarksRange = "\\ufe20-\\ufe2f";
  4877. var rsComboSymbolsRange = "\\u20d0-\\u20ff";
  4878. var rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange;
  4879. var rsVarRange = "\\ufe0e\\ufe0f";
  4880. var rsAstral = "[" + rsAstralRange + "]";
  4881. var rsCombo = "[" + rsComboRange + "]";
  4882. var rsFitz = "\\ud83c[\\udffb-\\udfff]";
  4883. var rsModifier = "(?:" + rsCombo + "|" + rsFitz + ")";
  4884. var rsNonAstral = "[^" + rsAstralRange + "]";
  4885. var rsRegional = "(?:\\ud83c[\\udde6-\\uddff]){2}";
  4886. var rsSurrPair = "[\\ud800-\\udbff][\\udc00-\\udfff]";
  4887. var rsZWJ = "\\u200d";
  4888. var reOptMod = rsModifier + "?";
  4889. var rsOptVar = "[" + rsVarRange + "]?";
  4890. var rsOptJoin = "(?:" + rsZWJ + "(?:" + [rsNonAstral, rsRegional, rsSurrPair].join("|") + ")" + rsOptVar + reOptMod + ")*";
  4891. var rsSeq = rsOptVar + reOptMod + rsOptJoin;
  4892. var rsSymbol = "(?:" + [rsNonAstral + rsCombo + "?", rsCombo, rsRegional, rsSurrPair, rsAstral].join("|") + ")";
  4893. var reUnicode = RegExp(rsFitz + "(?=" + rsFitz + ")|" + rsSymbol + rsSeq, "g");
  4894. function unicodeSize(string) {
  4895. var result = reUnicode.lastIndex = 0;
  4896. while (reUnicode.test(string)) {
  4897. ++result;
  4898. }
  4899. return result;
  4900. }
  4901. function stringSize(string) {
  4902. return hasUnicode(string) ? unicodeSize(string) : asciiSize(string);
  4903. }
  4904. var nativeCeil$2 = Math.ceil;
  4905. function createPadding(length, chars) {
  4906. chars = chars === void 0 ? " " : baseToString(chars);
  4907. var charsLength = chars.length;
  4908. if (charsLength < 2) {
  4909. return charsLength ? baseRepeat(chars, length) : chars;
  4910. }
  4911. var result = baseRepeat(chars, nativeCeil$2(length / stringSize(chars)));
  4912. return hasUnicode(chars) ? castSlice(stringToArray(result), 0, length).join("") : result.slice(0, length);
  4913. }
  4914. var nativeCeil$1 = Math.ceil;
  4915. var nativeFloor$2 = Math.floor;
  4916. function pad(string, length, chars) {
  4917. string = toString(string);
  4918. length = toInteger(length);
  4919. var strLength = length ? stringSize(string) : 0;
  4920. if (!length || strLength >= length) {
  4921. return string;
  4922. }
  4923. var mid = (length - strLength) / 2;
  4924. return createPadding(nativeFloor$2(mid), chars) + string + createPadding(nativeCeil$1(mid), chars);
  4925. }
  4926. function padEnd(string, length, chars) {
  4927. string = toString(string);
  4928. length = toInteger(length);
  4929. var strLength = length ? stringSize(string) : 0;
  4930. return length && strLength < length ? string + createPadding(length - strLength, chars) : string;
  4931. }
  4932. function padStart(string, length, chars) {
  4933. string = toString(string);
  4934. length = toInteger(length);
  4935. var strLength = length ? stringSize(string) : 0;
  4936. return length && strLength < length ? createPadding(length - strLength, chars) + string : string;
  4937. }
  4938. var reTrimStart$1 = /^\s+/;
  4939. var nativeParseInt = root.parseInt;
  4940. function parseInt$1(string, radix, guard) {
  4941. if (guard || radix == null) {
  4942. radix = 0;
  4943. } else if (radix) {
  4944. radix = +radix;
  4945. }
  4946. return nativeParseInt(toString(string).replace(reTrimStart$1, ""), radix || 0);
  4947. }
  4948. var WRAP_PARTIAL_FLAG = 32;
  4949. var partial = baseRest(function(func, partials) {
  4950. var holders = replaceHolders(partials, getHolder(partial));
  4951. return createWrap(func, WRAP_PARTIAL_FLAG, void 0, partials, holders);
  4952. });
  4953. partial.placeholder = {};
  4954. var WRAP_PARTIAL_RIGHT_FLAG = 64;
  4955. var partialRight = baseRest(function(func, partials) {
  4956. var holders = replaceHolders(partials, getHolder(partialRight));
  4957. return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, void 0, partials, holders);
  4958. });
  4959. partialRight.placeholder = {};
  4960. var partition = createAggregator(function(result, value, key) {
  4961. result[key ? 0 : 1].push(value);
  4962. }, function() {
  4963. return [[], []];
  4964. });
  4965. function basePick(object, paths) {
  4966. return basePickBy(object, paths, function(value, path) {
  4967. return hasIn(object, path);
  4968. });
  4969. }
  4970. var pick = flatRest(function(object, paths) {
  4971. return object == null ? {} : basePick(object, paths);
  4972. });
  4973. function wrapperPlant(value) {
  4974. var result, parent = this;
  4975. while (parent instanceof baseLodash) {
  4976. var clone = wrapperClone(parent);
  4977. clone.__index__ = 0;
  4978. clone.__values__ = void 0;
  4979. if (result) {
  4980. previous.__wrapped__ = clone;
  4981. } else {
  4982. result = clone;
  4983. }
  4984. var previous = clone;
  4985. parent = parent.__wrapped__;
  4986. }
  4987. previous.__wrapped__ = value;
  4988. return result;
  4989. }
  4990. function propertyOf(object) {
  4991. return function(path) {
  4992. return object == null ? void 0 : baseGet(object, path);
  4993. };
  4994. }
  4995. function baseIndexOfWith(array, value, fromIndex, comparator) {
  4996. var index = fromIndex - 1, length = array.length;
  4997. while (++index < length) {
  4998. if (comparator(array[index], value)) {
  4999. return index;
  5000. }
  5001. }
  5002. return -1;
  5003. }
  5004. var arrayProto$3 = Array.prototype;
  5005. var splice$1 = arrayProto$3.splice;
  5006. function basePullAll(array, values, iteratee, comparator) {
  5007. var indexOf = comparator ? baseIndexOfWith : baseIndexOf, index = -1, length = values.length, seen = array;
  5008. if (array === values) {
  5009. values = copyArray(values);
  5010. }
  5011. if (iteratee) {
  5012. seen = arrayMap(array, baseUnary(iteratee));
  5013. }
  5014. while (++index < length) {
  5015. var fromIndex = 0, value = values[index], computed = iteratee ? iteratee(value) : value;
  5016. while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
  5017. if (seen !== array) {
  5018. splice$1.call(seen, fromIndex, 1);
  5019. }
  5020. splice$1.call(array, fromIndex, 1);
  5021. }
  5022. }
  5023. return array;
  5024. }
  5025. function pullAll(array, values) {
  5026. return array && array.length && values && values.length ? basePullAll(array, values) : array;
  5027. }
  5028. var pull = baseRest(pullAll);
  5029. function pullAllBy(array, values, iteratee) {
  5030. return array && array.length && values && values.length ? basePullAll(array, values, baseIteratee(iteratee)) : array;
  5031. }
  5032. function pullAllWith(array, values, comparator) {
  5033. return array && array.length && values && values.length ? basePullAll(array, values, void 0, comparator) : array;
  5034. }
  5035. var arrayProto$2 = Array.prototype;
  5036. var splice = arrayProto$2.splice;
  5037. function basePullAt(array, indexes) {
  5038. var length = array ? indexes.length : 0, lastIndex = length - 1;
  5039. while (length--) {
  5040. var index = indexes[length];
  5041. if (length == lastIndex || index !== previous) {
  5042. var previous = index;
  5043. if (isIndex(index)) {
  5044. splice.call(array, index, 1);
  5045. } else {
  5046. baseUnset(array, index);
  5047. }
  5048. }
  5049. }
  5050. return array;
  5051. }
  5052. var pullAt = flatRest(function(array, indexes) {
  5053. var length = array == null ? 0 : array.length, result = baseAt(array, indexes);
  5054. basePullAt(array, arrayMap(indexes, function(index) {
  5055. return isIndex(index, length) ? +index : index;
  5056. }).sort(compareAscending));
  5057. return result;
  5058. });
  5059. var nativeFloor$1 = Math.floor;
  5060. var nativeRandom$1 = Math.random;
  5061. function baseRandom(lower, upper) {
  5062. return lower + nativeFloor$1(nativeRandom$1() * (upper - lower + 1));
  5063. }
  5064. var freeParseFloat = parseFloat;
  5065. var nativeMin$5 = Math.min;
  5066. var nativeRandom = Math.random;
  5067. function random(lower, upper, floating) {
  5068. if (floating && typeof floating != "boolean" && isIterateeCall(lower, upper, floating)) {
  5069. upper = floating = void 0;
  5070. }
  5071. if (floating === void 0) {
  5072. if (typeof upper == "boolean") {
  5073. floating = upper;
  5074. upper = void 0;
  5075. } else if (typeof lower == "boolean") {
  5076. floating = lower;
  5077. lower = void 0;
  5078. }
  5079. }
  5080. if (lower === void 0 && upper === void 0) {
  5081. lower = 0;
  5082. upper = 1;
  5083. } else {
  5084. lower = toFinite(lower);
  5085. if (upper === void 0) {
  5086. upper = lower;
  5087. lower = 0;
  5088. } else {
  5089. upper = toFinite(upper);
  5090. }
  5091. }
  5092. if (lower > upper) {
  5093. var temp = lower;
  5094. lower = upper;
  5095. upper = temp;
  5096. }
  5097. if (floating || lower % 1 || upper % 1) {
  5098. var rand = nativeRandom();
  5099. return nativeMin$5(lower + rand * (upper - lower + freeParseFloat("1e-" + ((rand + "").length - 1))), upper);
  5100. }
  5101. return baseRandom(lower, upper);
  5102. }
  5103. var nativeCeil = Math.ceil;
  5104. var nativeMax$4 = Math.max;
  5105. function baseRange(start, end, step, fromRight) {
  5106. var index = -1, length = nativeMax$4(nativeCeil((end - start) / (step || 1)), 0), result = Array(length);
  5107. while (length--) {
  5108. result[fromRight ? length : ++index] = start;
  5109. start += step;
  5110. }
  5111. return result;
  5112. }
  5113. function createRange(fromRight) {
  5114. return function(start, end, step) {
  5115. if (step && typeof step != "number" && isIterateeCall(start, end, step)) {
  5116. end = step = void 0;
  5117. }
  5118. start = toFinite(start);
  5119. if (end === void 0) {
  5120. end = start;
  5121. start = 0;
  5122. } else {
  5123. end = toFinite(end);
  5124. }
  5125. step = step === void 0 ? start < end ? 1 : -1 : toFinite(step);
  5126. return baseRange(start, end, step, fromRight);
  5127. };
  5128. }
  5129. var range$1 = createRange();
  5130. var rangeRight = createRange(true);
  5131. var WRAP_REARG_FLAG = 256;
  5132. var rearg = flatRest(function(func, indexes) {
  5133. return createWrap(func, WRAP_REARG_FLAG, void 0, void 0, void 0, indexes);
  5134. });
  5135. function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
  5136. eachFunc(collection, function(value, index, collection2) {
  5137. accumulator = initAccum ? (initAccum = false, value) : iteratee(accumulator, value, index, collection2);
  5138. });
  5139. return accumulator;
  5140. }
  5141. function reduce(collection, iteratee, accumulator) {
  5142. var func = isArray(collection) ? arrayReduce : baseReduce, initAccum = arguments.length < 3;
  5143. return func(collection, baseIteratee(iteratee), accumulator, initAccum, baseEach);
  5144. }
  5145. function arrayReduceRight(array, iteratee, accumulator, initAccum) {
  5146. var length = array == null ? 0 : array.length;
  5147. if (initAccum && length) {
  5148. accumulator = array[--length];
  5149. }
  5150. while (length--) {
  5151. accumulator = iteratee(accumulator, array[length], length, array);
  5152. }
  5153. return accumulator;
  5154. }
  5155. function reduceRight(collection, iteratee, accumulator) {
  5156. var func = isArray(collection) ? arrayReduceRight : baseReduce, initAccum = arguments.length < 3;
  5157. return func(collection, baseIteratee(iteratee), accumulator, initAccum, baseEachRight);
  5158. }
  5159. function reject(collection, predicate) {
  5160. var func = isArray(collection) ? arrayFilter : baseFilter;
  5161. return func(collection, negate(baseIteratee(predicate)));
  5162. }
  5163. function remove(array, predicate) {
  5164. var result = [];
  5165. if (!(array && array.length)) {
  5166. return result;
  5167. }
  5168. var index = -1, indexes = [], length = array.length;
  5169. predicate = baseIteratee(predicate);
  5170. while (++index < length) {
  5171. var value = array[index];
  5172. if (predicate(value, index, array)) {
  5173. result.push(value);
  5174. indexes.push(index);
  5175. }
  5176. }
  5177. basePullAt(array, indexes);
  5178. return result;
  5179. }
  5180. function repeat(string, n, guard) {
  5181. if (guard ? isIterateeCall(string, n, guard) : n === void 0) {
  5182. n = 1;
  5183. } else {
  5184. n = toInteger(n);
  5185. }
  5186. return baseRepeat(toString(string), n);
  5187. }
  5188. function replace() {
  5189. var args = arguments, string = toString(args[0]);
  5190. return args.length < 3 ? string : string.replace(args[1], args[2]);
  5191. }
  5192. var FUNC_ERROR_TEXT$2 = "Expected a function";
  5193. function rest(func, start) {
  5194. if (typeof func != "function") {
  5195. throw new TypeError(FUNC_ERROR_TEXT$2);
  5196. }
  5197. start = start === void 0 ? start : toInteger(start);
  5198. return baseRest(func, start);
  5199. }
  5200. function result(object, path, defaultValue) {
  5201. path = castPath(path, object);
  5202. var index = -1, length = path.length;
  5203. if (!length) {
  5204. length = 1;
  5205. object = void 0;
  5206. }
  5207. while (++index < length) {
  5208. var value = object == null ? void 0 : object[toKey(path[index])];
  5209. if (value === void 0) {
  5210. index = length;
  5211. value = defaultValue;
  5212. }
  5213. object = isFunction(value) ? value.call(object) : value;
  5214. }
  5215. return object;
  5216. }
  5217. var arrayProto$1 = Array.prototype;
  5218. var nativeReverse = arrayProto$1.reverse;
  5219. function reverse(array) {
  5220. return array == null ? array : nativeReverse.call(array);
  5221. }
  5222. var round$1 = createRound("round");
  5223. function arraySample(array) {
  5224. var length = array.length;
  5225. return length ? array[baseRandom(0, length - 1)] : void 0;
  5226. }
  5227. function baseSample(collection) {
  5228. return arraySample(values(collection));
  5229. }
  5230. function sample(collection) {
  5231. var func = isArray(collection) ? arraySample : baseSample;
  5232. return func(collection);
  5233. }
  5234. function shuffleSelf(array, size) {
  5235. var index = -1, length = array.length, lastIndex = length - 1;
  5236. size = size === void 0 ? length : size;
  5237. while (++index < size) {
  5238. var rand = baseRandom(index, lastIndex), value = array[rand];
  5239. array[rand] = array[index];
  5240. array[index] = value;
  5241. }
  5242. array.length = size;
  5243. return array;
  5244. }
  5245. function arraySampleSize(array, n) {
  5246. return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
  5247. }
  5248. function baseSampleSize(collection, n) {
  5249. var array = values(collection);
  5250. return shuffleSelf(array, baseClamp(n, 0, array.length));
  5251. }
  5252. function sampleSize(collection, n, guard) {
  5253. if (guard ? isIterateeCall(collection, n, guard) : n === void 0) {
  5254. n = 1;
  5255. } else {
  5256. n = toInteger(n);
  5257. }
  5258. var func = isArray(collection) ? arraySampleSize : baseSampleSize;
  5259. return func(collection, n);
  5260. }
  5261. function set(object, path, value) {
  5262. return object == null ? object : baseSet(object, path, value);
  5263. }
  5264. function setWith(object, path, value, customizer) {
  5265. customizer = typeof customizer == "function" ? customizer : void 0;
  5266. return object == null ? object : baseSet(object, path, value, customizer);
  5267. }
  5268. function arrayShuffle(array) {
  5269. return shuffleSelf(copyArray(array));
  5270. }
  5271. function baseShuffle(collection) {
  5272. return shuffleSelf(values(collection));
  5273. }
  5274. function shuffle(collection) {
  5275. var func = isArray(collection) ? arrayShuffle : baseShuffle;
  5276. return func(collection);
  5277. }
  5278. var mapTag = "[object Map]";
  5279. var setTag = "[object Set]";
  5280. function size(collection) {
  5281. if (collection == null) {
  5282. return 0;
  5283. }
  5284. if (isArrayLike(collection)) {
  5285. return isString(collection) ? stringSize(collection) : collection.length;
  5286. }
  5287. var tag = getTag$1(collection);
  5288. if (tag == mapTag || tag == setTag) {
  5289. return collection.size;
  5290. }
  5291. return baseKeys(collection).length;
  5292. }
  5293. function slice(array, start, end) {
  5294. var length = array == null ? 0 : array.length;
  5295. if (!length) {
  5296. return [];
  5297. }
  5298. if (end && typeof end != "number" && isIterateeCall(array, start, end)) {
  5299. start = 0;
  5300. end = length;
  5301. } else {
  5302. start = start == null ? 0 : toInteger(start);
  5303. end = end === void 0 ? length : toInteger(end);
  5304. }
  5305. return baseSlice(array, start, end);
  5306. }
  5307. var snakeCase = createCompounder(function(result, word, index) {
  5308. return result + (index ? "_" : "") + word.toLowerCase();
  5309. });
  5310. function baseSome(collection, predicate) {
  5311. var result;
  5312. baseEach(collection, function(value, index, collection2) {
  5313. result = predicate(value, index, collection2);
  5314. return !result;
  5315. });
  5316. return !!result;
  5317. }
  5318. function some(collection, predicate, guard) {
  5319. var func = isArray(collection) ? arraySome : baseSome;
  5320. if (guard && isIterateeCall(collection, predicate, guard)) {
  5321. predicate = void 0;
  5322. }
  5323. return func(collection, baseIteratee(predicate));
  5324. }
  5325. var sortBy = baseRest(function(collection, iteratees) {
  5326. if (collection == null) {
  5327. return [];
  5328. }
  5329. var length = iteratees.length;
  5330. if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
  5331. iteratees = [];
  5332. } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
  5333. iteratees = [iteratees[0]];
  5334. }
  5335. return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
  5336. });
  5337. var MAX_ARRAY_LENGTH$4 = 4294967295;
  5338. var MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH$4 - 1;
  5339. var nativeFloor = Math.floor;
  5340. var nativeMin$4 = Math.min;
  5341. function baseSortedIndexBy(array, value, iteratee, retHighest) {
  5342. var low = 0, high = array == null ? 0 : array.length;
  5343. if (high === 0) {
  5344. return 0;
  5345. }
  5346. value = iteratee(value);
  5347. var valIsNaN = value !== value, valIsNull = value === null, valIsSymbol = isSymbol(value), valIsUndefined = value === void 0;
  5348. while (low < high) {
  5349. var mid = nativeFloor((low + high) / 2), computed = iteratee(array[mid]), othIsDefined = computed !== void 0, othIsNull = computed === null, othIsReflexive = computed === computed, othIsSymbol = isSymbol(computed);
  5350. if (valIsNaN) {
  5351. var setLow = retHighest || othIsReflexive;
  5352. } else if (valIsUndefined) {
  5353. setLow = othIsReflexive && (retHighest || othIsDefined);
  5354. } else if (valIsNull) {
  5355. setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
  5356. } else if (valIsSymbol) {
  5357. setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
  5358. } else if (othIsNull || othIsSymbol) {
  5359. setLow = false;
  5360. } else {
  5361. setLow = retHighest ? computed <= value : computed < value;
  5362. }
  5363. if (setLow) {
  5364. low = mid + 1;
  5365. } else {
  5366. high = mid;
  5367. }
  5368. }
  5369. return nativeMin$4(high, MAX_ARRAY_INDEX);
  5370. }
  5371. var MAX_ARRAY_LENGTH$3 = 4294967295;
  5372. var HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH$3 >>> 1;
  5373. function baseSortedIndex(array, value, retHighest) {
  5374. var low = 0, high = array == null ? low : array.length;
  5375. if (typeof value == "number" && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
  5376. while (low < high) {
  5377. var mid = low + high >>> 1, computed = array[mid];
  5378. if (computed !== null && !isSymbol(computed) && (retHighest ? computed <= value : computed < value)) {
  5379. low = mid + 1;
  5380. } else {
  5381. high = mid;
  5382. }
  5383. }
  5384. return high;
  5385. }
  5386. return baseSortedIndexBy(array, value, identity, retHighest);
  5387. }
  5388. function sortedIndex(array, value) {
  5389. return baseSortedIndex(array, value);
  5390. }
  5391. function sortedIndexBy(array, value, iteratee) {
  5392. return baseSortedIndexBy(array, value, baseIteratee(iteratee));
  5393. }
  5394. function sortedIndexOf(array, value) {
  5395. var length = array == null ? 0 : array.length;
  5396. if (length) {
  5397. var index = baseSortedIndex(array, value);
  5398. if (index < length && eq(array[index], value)) {
  5399. return index;
  5400. }
  5401. }
  5402. return -1;
  5403. }
  5404. function sortedLastIndex(array, value) {
  5405. return baseSortedIndex(array, value, true);
  5406. }
  5407. function sortedLastIndexBy(array, value, iteratee) {
  5408. return baseSortedIndexBy(array, value, baseIteratee(iteratee), true);
  5409. }
  5410. function sortedLastIndexOf(array, value) {
  5411. var length = array == null ? 0 : array.length;
  5412. if (length) {
  5413. var index = baseSortedIndex(array, value, true) - 1;
  5414. if (eq(array[index], value)) {
  5415. return index;
  5416. }
  5417. }
  5418. return -1;
  5419. }
  5420. function baseSortedUniq(array, iteratee) {
  5421. var index = -1, length = array.length, resIndex = 0, result = [];
  5422. while (++index < length) {
  5423. var value = array[index], computed = iteratee ? iteratee(value) : value;
  5424. if (!index || !eq(computed, seen)) {
  5425. var seen = computed;
  5426. result[resIndex++] = value === 0 ? 0 : value;
  5427. }
  5428. }
  5429. return result;
  5430. }
  5431. function sortedUniq(array) {
  5432. return array && array.length ? baseSortedUniq(array) : [];
  5433. }
  5434. function sortedUniqBy(array, iteratee) {
  5435. return array && array.length ? baseSortedUniq(array, baseIteratee(iteratee)) : [];
  5436. }
  5437. var MAX_ARRAY_LENGTH$2 = 4294967295;
  5438. function split(string, separator, limit) {
  5439. if (limit && typeof limit != "number" && isIterateeCall(string, separator, limit)) {
  5440. separator = limit = void 0;
  5441. }
  5442. limit = limit === void 0 ? MAX_ARRAY_LENGTH$2 : limit >>> 0;
  5443. if (!limit) {
  5444. return [];
  5445. }
  5446. string = toString(string);
  5447. if (string && (typeof separator == "string" || separator != null && !isRegExp(separator))) {
  5448. separator = baseToString(separator);
  5449. if (!separator && hasUnicode(string)) {
  5450. return castSlice(stringToArray(string), 0, limit);
  5451. }
  5452. }
  5453. return string.split(separator, limit);
  5454. }
  5455. var FUNC_ERROR_TEXT$1 = "Expected a function";
  5456. var nativeMax$3 = Math.max;
  5457. function spread(func, start) {
  5458. if (typeof func != "function") {
  5459. throw new TypeError(FUNC_ERROR_TEXT$1);
  5460. }
  5461. start = start == null ? 0 : nativeMax$3(toInteger(start), 0);
  5462. return baseRest(function(args) {
  5463. var array = args[start], otherArgs = castSlice(args, 0, start);
  5464. if (array) {
  5465. arrayPush(otherArgs, array);
  5466. }
  5467. return apply(func, this, otherArgs);
  5468. });
  5469. }
  5470. var startCase = createCompounder(function(result, word, index) {
  5471. return result + (index ? " " : "") + upperFirst(word);
  5472. });
  5473. function startsWith(string, target, position) {
  5474. string = toString(string);
  5475. position = position == null ? 0 : baseClamp(toInteger(position), 0, string.length);
  5476. target = baseToString(target);
  5477. return string.slice(position, position + target.length) == target;
  5478. }
  5479. function stubObject() {
  5480. return {};
  5481. }
  5482. function stubString() {
  5483. return "";
  5484. }
  5485. function stubTrue() {
  5486. return true;
  5487. }
  5488. var subtract = createMathOperation(function(minuend, subtrahend) {
  5489. return minuend - subtrahend;
  5490. }, 0);
  5491. function sum$1(array) {
  5492. return array && array.length ? baseSum(array, identity) : 0;
  5493. }
  5494. function sumBy(array, iteratee) {
  5495. return array && array.length ? baseSum(array, baseIteratee(iteratee)) : 0;
  5496. }
  5497. function tail(array) {
  5498. var length = array == null ? 0 : array.length;
  5499. return length ? baseSlice(array, 1, length) : [];
  5500. }
  5501. function take(array, n, guard) {
  5502. if (!(array && array.length)) {
  5503. return [];
  5504. }
  5505. n = guard || n === void 0 ? 1 : toInteger(n);
  5506. return baseSlice(array, 0, n < 0 ? 0 : n);
  5507. }
  5508. function takeRight(array, n, guard) {
  5509. var length = array == null ? 0 : array.length;
  5510. if (!length) {
  5511. return [];
  5512. }
  5513. n = guard || n === void 0 ? 1 : toInteger(n);
  5514. n = length - n;
  5515. return baseSlice(array, n < 0 ? 0 : n, length);
  5516. }
  5517. function takeRightWhile(array, predicate) {
  5518. return array && array.length ? baseWhile(array, baseIteratee(predicate), false, true) : [];
  5519. }
  5520. function takeWhile(array, predicate) {
  5521. return array && array.length ? baseWhile(array, baseIteratee(predicate)) : [];
  5522. }
  5523. function tap(value, interceptor) {
  5524. interceptor(value);
  5525. return value;
  5526. }
  5527. var objectProto$2 = Object.prototype;
  5528. var hasOwnProperty$2 = objectProto$2.hasOwnProperty;
  5529. function customDefaultsAssignIn(objValue, srcValue, key, object) {
  5530. if (objValue === void 0 || eq(objValue, objectProto$2[key]) && !hasOwnProperty$2.call(object, key)) {
  5531. return srcValue;
  5532. }
  5533. return objValue;
  5534. }
  5535. var stringEscapes = {
  5536. "\\": "\\",
  5537. "'": "'",
  5538. "\n": "n",
  5539. "\r": "r",
  5540. "\u2028": "u2028",
  5541. "\u2029": "u2029"
  5542. };
  5543. function escapeStringChar(chr) {
  5544. return "\\" + stringEscapes[chr];
  5545. }
  5546. var reInterpolate = /<%=([\s\S]+?)%>/g;
  5547. var reEscape = /<%-([\s\S]+?)%>/g;
  5548. var reEvaluate = /<%([\s\S]+?)%>/g;
  5549. var templateSettings = {
  5550. "escape": reEscape,
  5551. "evaluate": reEvaluate,
  5552. "interpolate": reInterpolate,
  5553. "variable": "",
  5554. "imports": {
  5555. "_": { "escape": escape }
  5556. }
  5557. };
  5558. var INVALID_TEMPL_VAR_ERROR_TEXT = "Invalid `variable` option passed into `_.template`";
  5559. var reEmptyStringLeading = /\b__p \+= '';/g;
  5560. var reEmptyStringMiddle = /\b(__p \+=) '' \+/g;
  5561. var reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
  5562. var reForbiddenIdentifierChars = /[()=,{}\[\]\/\s]/;
  5563. var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
  5564. var reNoMatch = /($^)/;
  5565. var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
  5566. var objectProto$1 = Object.prototype;
  5567. var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
  5568. function template(string, options, guard) {
  5569. var settings = templateSettings.imports._.templateSettings || templateSettings;
  5570. if (guard && isIterateeCall(string, options, guard)) {
  5571. options = void 0;
  5572. }
  5573. string = toString(string);
  5574. options = assignInWith({}, options, settings, customDefaultsAssignIn);
  5575. var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn), importsKeys = keys(imports), importsValues = baseValues(imports, importsKeys);
  5576. var isEscaping, isEvaluating, index = 0, interpolate = options.interpolate || reNoMatch, source = "__p += '";
  5577. var reDelimiters = RegExp((options.escape || reNoMatch).source + "|" + interpolate.source + "|" + (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + "|" + (options.evaluate || reNoMatch).source + "|$", "g");
  5578. var sourceURL = hasOwnProperty$1.call(options, "sourceURL") ? "//# sourceURL=" + (options.sourceURL + "").replace(/\s/g, " ") + "\n" : "";
  5579. string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
  5580. interpolateValue || (interpolateValue = esTemplateValue);
  5581. source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
  5582. if (escapeValue) {
  5583. isEscaping = true;
  5584. source += "' +\n__e(" + escapeValue + ") +\n'";
  5585. }
  5586. if (evaluateValue) {
  5587. isEvaluating = true;
  5588. source += "';\n" + evaluateValue + ";\n__p += '";
  5589. }
  5590. if (interpolateValue) {
  5591. source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
  5592. }
  5593. index = offset + match.length;
  5594. return match;
  5595. });
  5596. source += "';\n";
  5597. var variable = hasOwnProperty$1.call(options, "variable") && options.variable;
  5598. if (!variable) {
  5599. source = "with (obj) {\n" + source + "\n}\n";
  5600. } else if (reForbiddenIdentifierChars.test(variable)) {
  5601. throw new Error(INVALID_TEMPL_VAR_ERROR_TEXT);
  5602. }
  5603. source = (isEvaluating ? source.replace(reEmptyStringLeading, "") : source).replace(reEmptyStringMiddle, "$1").replace(reEmptyStringTrailing, "$1;");
  5604. source = "function(" + (variable || "obj") + ") {\n" + (variable ? "" : "obj || (obj = {});\n") + "var __t, __p = ''" + (isEscaping ? ", __e = _.escape" : "") + (isEvaluating ? ", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n" : ";\n") + source + "return __p\n}";
  5605. var result = attempt(function() {
  5606. return Function(importsKeys, sourceURL + "return " + source).apply(void 0, importsValues);
  5607. });
  5608. result.source = source;
  5609. if (isError(result)) {
  5610. throw result;
  5611. }
  5612. return result;
  5613. }
  5614. var FUNC_ERROR_TEXT = "Expected a function";
  5615. function throttle(func, wait, options) {
  5616. var leading = true, trailing = true;
  5617. if (typeof func != "function") {
  5618. throw new TypeError(FUNC_ERROR_TEXT);
  5619. }
  5620. if (isObject(options)) {
  5621. leading = "leading" in options ? !!options.leading : leading;
  5622. trailing = "trailing" in options ? !!options.trailing : trailing;
  5623. }
  5624. return debounce(func, wait, {
  5625. "leading": leading,
  5626. "maxWait": wait,
  5627. "trailing": trailing
  5628. });
  5629. }
  5630. function thru(value, interceptor) {
  5631. return interceptor(value);
  5632. }
  5633. var MAX_SAFE_INTEGER$1 = 9007199254740991;
  5634. var MAX_ARRAY_LENGTH$1 = 4294967295;
  5635. var nativeMin$3 = Math.min;
  5636. function times(n, iteratee) {
  5637. n = toInteger(n);
  5638. if (n < 1 || n > MAX_SAFE_INTEGER$1) {
  5639. return [];
  5640. }
  5641. var index = MAX_ARRAY_LENGTH$1, length = nativeMin$3(n, MAX_ARRAY_LENGTH$1);
  5642. iteratee = castFunction(iteratee);
  5643. n -= MAX_ARRAY_LENGTH$1;
  5644. var result = baseTimes(length, iteratee);
  5645. while (++index < n) {
  5646. iteratee(index);
  5647. }
  5648. return result;
  5649. }
  5650. function wrapperToIterator() {
  5651. return this;
  5652. }
  5653. function baseWrapperValue(value, actions) {
  5654. var result = value;
  5655. if (result instanceof LazyWrapper) {
  5656. result = result.value();
  5657. }
  5658. return arrayReduce(actions, function(result2, action) {
  5659. return action.func.apply(action.thisArg, arrayPush([result2], action.args));
  5660. }, result);
  5661. }
  5662. function wrapperValue() {
  5663. return baseWrapperValue(this.__wrapped__, this.__actions__);
  5664. }
  5665. function toLower(value) {
  5666. return toString(value).toLowerCase();
  5667. }
  5668. function toPath(value) {
  5669. if (isArray(value)) {
  5670. return arrayMap(value, toKey);
  5671. }
  5672. return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));
  5673. }
  5674. var MAX_SAFE_INTEGER = 9007199254740991;
  5675. function toSafeInteger(value) {
  5676. return value ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER) : value === 0 ? value : 0;
  5677. }
  5678. function toUpper(value) {
  5679. return toString(value).toUpperCase();
  5680. }
  5681. function transform(object, iteratee, accumulator) {
  5682. var isArr = isArray(object), isArrLike = isArr || isBuffer(object) || isTypedArray(object);
  5683. iteratee = baseIteratee(iteratee);
  5684. if (accumulator == null) {
  5685. var Ctor = object && object.constructor;
  5686. if (isArrLike) {
  5687. accumulator = isArr ? new Ctor() : [];
  5688. } else if (isObject(object)) {
  5689. accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
  5690. } else {
  5691. accumulator = {};
  5692. }
  5693. }
  5694. (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object2) {
  5695. return iteratee(accumulator, value, index, object2);
  5696. });
  5697. return accumulator;
  5698. }
  5699. function charsEndIndex(strSymbols, chrSymbols) {
  5700. var index = strSymbols.length;
  5701. while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {
  5702. }
  5703. return index;
  5704. }
  5705. function charsStartIndex(strSymbols, chrSymbols) {
  5706. var index = -1, length = strSymbols.length;
  5707. while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {
  5708. }
  5709. return index;
  5710. }
  5711. function trim(string, chars, guard) {
  5712. string = toString(string);
  5713. if (string && (guard || chars === void 0)) {
  5714. return baseTrim(string);
  5715. }
  5716. if (!string || !(chars = baseToString(chars))) {
  5717. return string;
  5718. }
  5719. var strSymbols = stringToArray(string), chrSymbols = stringToArray(chars), start = charsStartIndex(strSymbols, chrSymbols), end = charsEndIndex(strSymbols, chrSymbols) + 1;
  5720. return castSlice(strSymbols, start, end).join("");
  5721. }
  5722. function trimEnd(string, chars, guard) {
  5723. string = toString(string);
  5724. if (string && (guard || chars === void 0)) {
  5725. return string.slice(0, trimmedEndIndex(string) + 1);
  5726. }
  5727. if (!string || !(chars = baseToString(chars))) {
  5728. return string;
  5729. }
  5730. var strSymbols = stringToArray(string), end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
  5731. return castSlice(strSymbols, 0, end).join("");
  5732. }
  5733. var reTrimStart = /^\s+/;
  5734. function trimStart(string, chars, guard) {
  5735. string = toString(string);
  5736. if (string && (guard || chars === void 0)) {
  5737. return string.replace(reTrimStart, "");
  5738. }
  5739. if (!string || !(chars = baseToString(chars))) {
  5740. return string;
  5741. }
  5742. var strSymbols = stringToArray(string), start = charsStartIndex(strSymbols, stringToArray(chars));
  5743. return castSlice(strSymbols, start).join("");
  5744. }
  5745. var DEFAULT_TRUNC_LENGTH = 30;
  5746. var DEFAULT_TRUNC_OMISSION = "...";
  5747. var reFlags = /\w*$/;
  5748. function truncate(string, options) {
  5749. var length = DEFAULT_TRUNC_LENGTH, omission = DEFAULT_TRUNC_OMISSION;
  5750. if (isObject(options)) {
  5751. var separator = "separator" in options ? options.separator : separator;
  5752. length = "length" in options ? toInteger(options.length) : length;
  5753. omission = "omission" in options ? baseToString(options.omission) : omission;
  5754. }
  5755. string = toString(string);
  5756. var strLength = string.length;
  5757. if (hasUnicode(string)) {
  5758. var strSymbols = stringToArray(string);
  5759. strLength = strSymbols.length;
  5760. }
  5761. if (length >= strLength) {
  5762. return string;
  5763. }
  5764. var end = length - stringSize(omission);
  5765. if (end < 1) {
  5766. return omission;
  5767. }
  5768. var result = strSymbols ? castSlice(strSymbols, 0, end).join("") : string.slice(0, end);
  5769. if (separator === void 0) {
  5770. return result + omission;
  5771. }
  5772. if (strSymbols) {
  5773. end += result.length - end;
  5774. }
  5775. if (isRegExp(separator)) {
  5776. if (string.slice(end).search(separator)) {
  5777. var match, substring = result;
  5778. if (!separator.global) {
  5779. separator = RegExp(separator.source, toString(reFlags.exec(separator)) + "g");
  5780. }
  5781. separator.lastIndex = 0;
  5782. while (match = separator.exec(substring)) {
  5783. var newEnd = match.index;
  5784. }
  5785. result = result.slice(0, newEnd === void 0 ? end : newEnd);
  5786. }
  5787. } else if (string.indexOf(baseToString(separator), end) != end) {
  5788. var index = result.lastIndexOf(separator);
  5789. if (index > -1) {
  5790. result = result.slice(0, index);
  5791. }
  5792. }
  5793. return result + omission;
  5794. }
  5795. function unary(func) {
  5796. return ary(func, 1);
  5797. }
  5798. var htmlUnescapes = {
  5799. "&amp;": "&",
  5800. "&lt;": "<",
  5801. "&gt;": ">",
  5802. "&quot;": '"',
  5803. "&#39;": "'"
  5804. };
  5805. var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
  5806. var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g;
  5807. var reHasEscapedHtml = RegExp(reEscapedHtml.source);
  5808. function unescape(string) {
  5809. string = toString(string);
  5810. return string && reHasEscapedHtml.test(string) ? string.replace(reEscapedHtml, unescapeHtmlChar) : string;
  5811. }
  5812. var INFINITY = 1 / 0;
  5813. var createSet = !(Set$1 && 1 / setToArray(new Set$1([, -0]))[1] == INFINITY) ? noop : function(values) {
  5814. return new Set$1(values);
  5815. };
  5816. var LARGE_ARRAY_SIZE = 200;
  5817. function baseUniq(array, iteratee, comparator) {
  5818. var index = -1, includes = arrayIncludes, length = array.length, isCommon = true, result = [], seen = result;
  5819. if (comparator) {
  5820. isCommon = false;
  5821. includes = arrayIncludesWith;
  5822. } else if (length >= LARGE_ARRAY_SIZE) {
  5823. var set = iteratee ? null : createSet(array);
  5824. if (set) {
  5825. return setToArray(set);
  5826. }
  5827. isCommon = false;
  5828. includes = cacheHas;
  5829. seen = new SetCache();
  5830. } else {
  5831. seen = iteratee ? [] : result;
  5832. }
  5833. outer:
  5834. while (++index < length) {
  5835. var value = array[index], computed = iteratee ? iteratee(value) : value;
  5836. value = comparator || value !== 0 ? value : 0;
  5837. if (isCommon && computed === computed) {
  5838. var seenIndex = seen.length;
  5839. while (seenIndex--) {
  5840. if (seen[seenIndex] === computed) {
  5841. continue outer;
  5842. }
  5843. }
  5844. if (iteratee) {
  5845. seen.push(computed);
  5846. }
  5847. result.push(value);
  5848. } else if (!includes(seen, computed, comparator)) {
  5849. if (seen !== result) {
  5850. seen.push(computed);
  5851. }
  5852. result.push(value);
  5853. }
  5854. }
  5855. return result;
  5856. }
  5857. var union = baseRest(function(arrays) {
  5858. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
  5859. });
  5860. var unionBy = baseRest(function(arrays) {
  5861. var iteratee = last(arrays);
  5862. if (isArrayLikeObject(iteratee)) {
  5863. iteratee = void 0;
  5864. }
  5865. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), baseIteratee(iteratee));
  5866. });
  5867. var unionWith = baseRest(function(arrays) {
  5868. var comparator = last(arrays);
  5869. comparator = typeof comparator == "function" ? comparator : void 0;
  5870. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), void 0, comparator);
  5871. });
  5872. function uniq(array) {
  5873. return array && array.length ? baseUniq(array) : [];
  5874. }
  5875. function uniqBy(array, iteratee) {
  5876. return array && array.length ? baseUniq(array, baseIteratee(iteratee)) : [];
  5877. }
  5878. function uniqWith(array, comparator) {
  5879. comparator = typeof comparator == "function" ? comparator : void 0;
  5880. return array && array.length ? baseUniq(array, void 0, comparator) : [];
  5881. }
  5882. var idCounter = 0;
  5883. function uniqueId(prefix) {
  5884. var id = ++idCounter;
  5885. return toString(prefix) + id;
  5886. }
  5887. function unset(object, path) {
  5888. return object == null ? true : baseUnset(object, path);
  5889. }
  5890. var nativeMax$2 = Math.max;
  5891. function unzip(array) {
  5892. if (!(array && array.length)) {
  5893. return [];
  5894. }
  5895. var length = 0;
  5896. array = arrayFilter(array, function(group) {
  5897. if (isArrayLikeObject(group)) {
  5898. length = nativeMax$2(group.length, length);
  5899. return true;
  5900. }
  5901. });
  5902. return baseTimes(length, function(index) {
  5903. return arrayMap(array, baseProperty(index));
  5904. });
  5905. }
  5906. function unzipWith(array, iteratee) {
  5907. if (!(array && array.length)) {
  5908. return [];
  5909. }
  5910. var result = unzip(array);
  5911. if (iteratee == null) {
  5912. return result;
  5913. }
  5914. return arrayMap(result, function(group) {
  5915. return apply(iteratee, void 0, group);
  5916. });
  5917. }
  5918. function baseUpdate(object, path, updater, customizer) {
  5919. return baseSet(object, path, updater(baseGet(object, path)), customizer);
  5920. }
  5921. function update(object, path, updater) {
  5922. return object == null ? object : baseUpdate(object, path, castFunction(updater));
  5923. }
  5924. function updateWith(object, path, updater, customizer) {
  5925. customizer = typeof customizer == "function" ? customizer : void 0;
  5926. return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
  5927. }
  5928. var upperCase = createCompounder(function(result, word, index) {
  5929. return result + (index ? " " : "") + word.toUpperCase();
  5930. });
  5931. function valuesIn(object) {
  5932. return object == null ? [] : baseValues(object, keysIn(object));
  5933. }
  5934. var without = baseRest(function(array, values) {
  5935. return isArrayLikeObject(array) ? baseDifference(array, values) : [];
  5936. });
  5937. function wrap(value, wrapper) {
  5938. return partial(castFunction(wrapper), value);
  5939. }
  5940. var wrapperAt = flatRest(function(paths) {
  5941. var length = paths.length, start = length ? paths[0] : 0, value = this.__wrapped__, interceptor = function(object) {
  5942. return baseAt(object, paths);
  5943. };
  5944. if (length > 1 || this.__actions__.length || !(value instanceof LazyWrapper) || !isIndex(start)) {
  5945. return this.thru(interceptor);
  5946. }
  5947. value = value.slice(start, +start + (length ? 1 : 0));
  5948. value.__actions__.push({
  5949. "func": thru,
  5950. "args": [interceptor],
  5951. "thisArg": void 0
  5952. });
  5953. return new LodashWrapper(value, this.__chain__).thru(function(array) {
  5954. if (length && !array.length) {
  5955. array.push(void 0);
  5956. }
  5957. return array;
  5958. });
  5959. });
  5960. function wrapperChain() {
  5961. return chain(this);
  5962. }
  5963. function wrapperReverse() {
  5964. var value = this.__wrapped__;
  5965. if (value instanceof LazyWrapper) {
  5966. var wrapped = value;
  5967. if (this.__actions__.length) {
  5968. wrapped = new LazyWrapper(this);
  5969. }
  5970. wrapped = wrapped.reverse();
  5971. wrapped.__actions__.push({
  5972. "func": thru,
  5973. "args": [reverse],
  5974. "thisArg": void 0
  5975. });
  5976. return new LodashWrapper(wrapped, this.__chain__);
  5977. }
  5978. return this.thru(reverse);
  5979. }
  5980. function baseXor(arrays, iteratee, comparator) {
  5981. var length = arrays.length;
  5982. if (length < 2) {
  5983. return length ? baseUniq(arrays[0]) : [];
  5984. }
  5985. var index = -1, result = Array(length);
  5986. while (++index < length) {
  5987. var array = arrays[index], othIndex = -1;
  5988. while (++othIndex < length) {
  5989. if (othIndex != index) {
  5990. result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator);
  5991. }
  5992. }
  5993. }
  5994. return baseUniq(baseFlatten(result, 1), iteratee, comparator);
  5995. }
  5996. var xor = baseRest(function(arrays) {
  5997. return baseXor(arrayFilter(arrays, isArrayLikeObject));
  5998. });
  5999. var xorBy = baseRest(function(arrays) {
  6000. var iteratee = last(arrays);
  6001. if (isArrayLikeObject(iteratee)) {
  6002. iteratee = void 0;
  6003. }
  6004. return baseXor(arrayFilter(arrays, isArrayLikeObject), baseIteratee(iteratee));
  6005. });
  6006. var xorWith = baseRest(function(arrays) {
  6007. var comparator = last(arrays);
  6008. comparator = typeof comparator == "function" ? comparator : void 0;
  6009. return baseXor(arrayFilter(arrays, isArrayLikeObject), void 0, comparator);
  6010. });
  6011. var zip = baseRest(unzip);
  6012. function baseZipObject(props, values, assignFunc) {
  6013. var index = -1, length = props.length, valsLength = values.length, result = {};
  6014. while (++index < length) {
  6015. var value = index < valsLength ? values[index] : void 0;
  6016. assignFunc(result, props[index], value);
  6017. }
  6018. return result;
  6019. }
  6020. function zipObject(props, values) {
  6021. return baseZipObject(props || [], values || [], assignValue);
  6022. }
  6023. function zipObjectDeep(props, values) {
  6024. return baseZipObject(props || [], values || [], baseSet);
  6025. }
  6026. var zipWith = baseRest(function(arrays) {
  6027. var length = arrays.length, iteratee = length > 1 ? arrays[length - 1] : void 0;
  6028. iteratee = typeof iteratee == "function" ? (arrays.pop(), iteratee) : void 0;
  6029. return unzipWith(arrays, iteratee);
  6030. });
  6031. var array = {
  6032. chunk,
  6033. compact,
  6034. concat,
  6035. difference,
  6036. differenceBy,
  6037. differenceWith,
  6038. drop,
  6039. dropRight,
  6040. dropRightWhile,
  6041. dropWhile,
  6042. fill,
  6043. findIndex,
  6044. findLastIndex,
  6045. first: head,
  6046. flatten,
  6047. flattenDeep,
  6048. flattenDepth,
  6049. fromPairs,
  6050. head,
  6051. indexOf,
  6052. initial: initial$1,
  6053. intersection,
  6054. intersectionBy,
  6055. intersectionWith,
  6056. join,
  6057. last,
  6058. lastIndexOf,
  6059. nth,
  6060. pull,
  6061. pullAll,
  6062. pullAllBy,
  6063. pullAllWith,
  6064. pullAt,
  6065. remove,
  6066. reverse,
  6067. slice,
  6068. sortedIndex,
  6069. sortedIndexBy,
  6070. sortedIndexOf,
  6071. sortedLastIndex,
  6072. sortedLastIndexBy,
  6073. sortedLastIndexOf,
  6074. sortedUniq,
  6075. sortedUniqBy,
  6076. tail,
  6077. take,
  6078. takeRight,
  6079. takeRightWhile,
  6080. takeWhile,
  6081. union,
  6082. unionBy,
  6083. unionWith,
  6084. uniq,
  6085. uniqBy,
  6086. uniqWith,
  6087. unzip,
  6088. unzipWith,
  6089. without,
  6090. xor,
  6091. xorBy,
  6092. xorWith,
  6093. zip,
  6094. zipObject,
  6095. zipObjectDeep,
  6096. zipWith
  6097. };
  6098. var collection = {
  6099. countBy,
  6100. each: forEach,
  6101. eachRight: forEachRight,
  6102. every,
  6103. filter,
  6104. find,
  6105. findLast,
  6106. flatMap,
  6107. flatMapDeep,
  6108. flatMapDepth,
  6109. forEach,
  6110. forEachRight,
  6111. groupBy,
  6112. includes,
  6113. invokeMap,
  6114. keyBy,
  6115. map,
  6116. orderBy: orderBy$1,
  6117. partition,
  6118. reduce,
  6119. reduceRight,
  6120. reject,
  6121. sample,
  6122. sampleSize,
  6123. shuffle,
  6124. size,
  6125. some,
  6126. sortBy
  6127. };
  6128. var date = {
  6129. now
  6130. };
  6131. var func = {
  6132. after,
  6133. ary,
  6134. before,
  6135. bind,
  6136. bindKey,
  6137. curry,
  6138. curryRight,
  6139. debounce,
  6140. defer,
  6141. delay,
  6142. flip: flip$1,
  6143. memoize,
  6144. negate,
  6145. once,
  6146. overArgs,
  6147. partial,
  6148. partialRight,
  6149. rearg,
  6150. rest,
  6151. spread,
  6152. throttle,
  6153. unary,
  6154. wrap
  6155. };
  6156. var lang = {
  6157. castArray: castArray$1,
  6158. clone,
  6159. cloneDeep,
  6160. cloneDeepWith,
  6161. cloneWith,
  6162. conformsTo,
  6163. eq,
  6164. gt: gt$1,
  6165. gte,
  6166. isArguments,
  6167. isArray,
  6168. isArrayBuffer,
  6169. isArrayLike,
  6170. isArrayLikeObject,
  6171. isBoolean: isBoolean$1,
  6172. isBuffer,
  6173. isDate,
  6174. isElement: isElement$2,
  6175. isEmpty: isEmpty$1,
  6176. isEqual: isEqual$1,
  6177. isEqualWith,
  6178. isError,
  6179. isFinite,
  6180. isFunction,
  6181. isInteger,
  6182. isLength,
  6183. isMap,
  6184. isMatch,
  6185. isMatchWith,
  6186. isNaN: isNaN$1,
  6187. isNative,
  6188. isNil,
  6189. isNull,
  6190. isNumber: isNumber$1,
  6191. isObject,
  6192. isObjectLike,
  6193. isPlainObject,
  6194. isRegExp,
  6195. isSafeInteger,
  6196. isSet,
  6197. isString,
  6198. isSymbol,
  6199. isTypedArray,
  6200. isUndefined: isUndefined$1,
  6201. isWeakMap,
  6202. isWeakSet,
  6203. lt: lt$1,
  6204. lte,
  6205. toArray,
  6206. toFinite,
  6207. toInteger,
  6208. toLength,
  6209. toNumber,
  6210. toPlainObject,
  6211. toSafeInteger,
  6212. toString
  6213. };
  6214. var math = {
  6215. add,
  6216. ceil,
  6217. divide,
  6218. floor: floor$1,
  6219. max: max$3,
  6220. maxBy,
  6221. mean,
  6222. meanBy,
  6223. min: min$3,
  6224. minBy,
  6225. multiply,
  6226. round: round$1,
  6227. subtract,
  6228. sum: sum$1,
  6229. sumBy
  6230. };
  6231. var number = {
  6232. clamp,
  6233. inRange,
  6234. random
  6235. };
  6236. var object = {
  6237. assign,
  6238. assignIn,
  6239. assignInWith,
  6240. assignWith,
  6241. at: at$1,
  6242. create,
  6243. defaults,
  6244. defaultsDeep,
  6245. entries: toPairs,
  6246. entriesIn: toPairsIn,
  6247. extend: assignIn,
  6248. extendWith: assignInWith,
  6249. findKey,
  6250. findLastKey,
  6251. forIn,
  6252. forInRight,
  6253. forOwn,
  6254. forOwnRight,
  6255. functions,
  6256. functionsIn,
  6257. get,
  6258. has,
  6259. hasIn,
  6260. invert,
  6261. invertBy,
  6262. invoke,
  6263. keys,
  6264. keysIn,
  6265. mapKeys,
  6266. mapValues,
  6267. merge,
  6268. mergeWith,
  6269. omit,
  6270. omitBy,
  6271. pick,
  6272. pickBy,
  6273. result,
  6274. set,
  6275. setWith,
  6276. toPairs,
  6277. toPairsIn,
  6278. transform,
  6279. unset,
  6280. update,
  6281. updateWith,
  6282. values,
  6283. valuesIn
  6284. };
  6285. var seq = {
  6286. at: wrapperAt,
  6287. chain,
  6288. commit: wrapperCommit,
  6289. lodash,
  6290. next: wrapperNext,
  6291. plant: wrapperPlant,
  6292. reverse: wrapperReverse,
  6293. tap,
  6294. thru,
  6295. toIterator: wrapperToIterator,
  6296. toJSON: wrapperValue,
  6297. value: wrapperValue,
  6298. valueOf: wrapperValue,
  6299. wrapperChain
  6300. };
  6301. var string$1 = {
  6302. camelCase,
  6303. capitalize: capitalize$1,
  6304. deburr,
  6305. endsWith,
  6306. escape,
  6307. escapeRegExp,
  6308. kebabCase,
  6309. lowerCase,
  6310. lowerFirst,
  6311. pad,
  6312. padEnd,
  6313. padStart,
  6314. parseInt: parseInt$1,
  6315. repeat,
  6316. replace,
  6317. snakeCase,
  6318. split,
  6319. startCase,
  6320. startsWith,
  6321. template,
  6322. templateSettings,
  6323. toLower,
  6324. toUpper,
  6325. trim,
  6326. trimEnd,
  6327. trimStart,
  6328. truncate,
  6329. unescape,
  6330. upperCase,
  6331. upperFirst,
  6332. words
  6333. };
  6334. var util = {
  6335. attempt,
  6336. bindAll,
  6337. cond,
  6338. conforms,
  6339. constant,
  6340. defaultTo,
  6341. flow,
  6342. flowRight,
  6343. identity,
  6344. iteratee,
  6345. matches,
  6346. matchesProperty,
  6347. method,
  6348. methodOf,
  6349. mixin: mixin$1,
  6350. noop,
  6351. nthArg,
  6352. over,
  6353. overEvery,
  6354. overSome,
  6355. property,
  6356. propertyOf,
  6357. range: range$1,
  6358. rangeRight,
  6359. stubArray,
  6360. stubFalse,
  6361. stubObject,
  6362. stubString,
  6363. stubTrue,
  6364. times,
  6365. toPath,
  6366. uniqueId
  6367. };
  6368. function lazyClone() {
  6369. var result = new LazyWrapper(this.__wrapped__);
  6370. result.__actions__ = copyArray(this.__actions__);
  6371. result.__dir__ = this.__dir__;
  6372. result.__filtered__ = this.__filtered__;
  6373. result.__iteratees__ = copyArray(this.__iteratees__);
  6374. result.__takeCount__ = this.__takeCount__;
  6375. result.__views__ = copyArray(this.__views__);
  6376. return result;
  6377. }
  6378. function lazyReverse() {
  6379. if (this.__filtered__) {
  6380. var result = new LazyWrapper(this);
  6381. result.__dir__ = -1;
  6382. result.__filtered__ = true;
  6383. } else {
  6384. result = this.clone();
  6385. result.__dir__ *= -1;
  6386. }
  6387. return result;
  6388. }
  6389. var nativeMax$1 = Math.max;
  6390. var nativeMin$2 = Math.min;
  6391. function getView(start, end, transforms) {
  6392. var index = -1, length = transforms.length;
  6393. while (++index < length) {
  6394. var data = transforms[index], size = data.size;
  6395. switch (data.type) {
  6396. case "drop":
  6397. start += size;
  6398. break;
  6399. case "dropRight":
  6400. end -= size;
  6401. break;
  6402. case "take":
  6403. end = nativeMin$2(end, start + size);
  6404. break;
  6405. case "takeRight":
  6406. start = nativeMax$1(start, end - size);
  6407. break;
  6408. }
  6409. }
  6410. return { "start": start, "end": end };
  6411. }
  6412. var LAZY_FILTER_FLAG$1 = 1;
  6413. var LAZY_MAP_FLAG = 2;
  6414. var nativeMin$1 = Math.min;
  6415. function lazyValue() {
  6416. var array = this.__wrapped__.value(), dir = this.__dir__, isArr = isArray(array), isRight = dir < 0, arrLength = isArr ? array.length : 0, view = getView(0, arrLength, this.__views__), start = view.start, end = view.end, length = end - start, index = isRight ? end : start - 1, iteratees = this.__iteratees__, iterLength = iteratees.length, resIndex = 0, takeCount = nativeMin$1(length, this.__takeCount__);
  6417. if (!isArr || !isRight && arrLength == length && takeCount == length) {
  6418. return baseWrapperValue(array, this.__actions__);
  6419. }
  6420. var result = [];
  6421. outer:
  6422. while (length-- && resIndex < takeCount) {
  6423. index += dir;
  6424. var iterIndex = -1, value = array[index];
  6425. while (++iterIndex < iterLength) {
  6426. var data = iteratees[iterIndex], iteratee = data.iteratee, type = data.type, computed = iteratee(value);
  6427. if (type == LAZY_MAP_FLAG) {
  6428. value = computed;
  6429. } else if (!computed) {
  6430. if (type == LAZY_FILTER_FLAG$1) {
  6431. continue outer;
  6432. } else {
  6433. break outer;
  6434. }
  6435. }
  6436. }
  6437. result[resIndex++] = value;
  6438. }
  6439. return result;
  6440. }
  6441. var VERSION = "4.17.21";
  6442. var WRAP_BIND_KEY_FLAG = 2;
  6443. var LAZY_FILTER_FLAG = 1;
  6444. var LAZY_WHILE_FLAG = 3;
  6445. var MAX_ARRAY_LENGTH = 4294967295;
  6446. var arrayProto = Array.prototype;
  6447. var objectProto = Object.prototype;
  6448. var hasOwnProperty = objectProto.hasOwnProperty;
  6449. var symIterator = Symbol$1 ? Symbol$1.iterator : void 0;
  6450. var nativeMax = Math.max;
  6451. var nativeMin = Math.min;
  6452. var mixin = function(func2) {
  6453. return function(object2, source, options) {
  6454. if (options == null) {
  6455. var isObj = isObject(source), props = isObj && keys(source), methodNames = props && props.length && baseFunctions(source, props);
  6456. if (!(methodNames ? methodNames.length : isObj)) {
  6457. options = source;
  6458. source = object2;
  6459. object2 = this;
  6460. }
  6461. }
  6462. return func2(object2, source, options);
  6463. };
  6464. }(mixin$1);
  6465. lodash.after = func.after;
  6466. lodash.ary = func.ary;
  6467. lodash.assign = object.assign;
  6468. lodash.assignIn = object.assignIn;
  6469. lodash.assignInWith = object.assignInWith;
  6470. lodash.assignWith = object.assignWith;
  6471. lodash.at = object.at;
  6472. lodash.before = func.before;
  6473. lodash.bind = func.bind;
  6474. lodash.bindAll = util.bindAll;
  6475. lodash.bindKey = func.bindKey;
  6476. lodash.castArray = lang.castArray;
  6477. lodash.chain = seq.chain;
  6478. lodash.chunk = array.chunk;
  6479. lodash.compact = array.compact;
  6480. lodash.concat = array.concat;
  6481. lodash.cond = util.cond;
  6482. lodash.conforms = util.conforms;
  6483. lodash.constant = util.constant;
  6484. lodash.countBy = collection.countBy;
  6485. lodash.create = object.create;
  6486. lodash.curry = func.curry;
  6487. lodash.curryRight = func.curryRight;
  6488. lodash.debounce = func.debounce;
  6489. lodash.defaults = object.defaults;
  6490. lodash.defaultsDeep = object.defaultsDeep;
  6491. lodash.defer = func.defer;
  6492. lodash.delay = func.delay;
  6493. lodash.difference = array.difference;
  6494. lodash.differenceBy = array.differenceBy;
  6495. lodash.differenceWith = array.differenceWith;
  6496. lodash.drop = array.drop;
  6497. lodash.dropRight = array.dropRight;
  6498. lodash.dropRightWhile = array.dropRightWhile;
  6499. lodash.dropWhile = array.dropWhile;
  6500. lodash.fill = array.fill;
  6501. lodash.filter = collection.filter;
  6502. lodash.flatMap = collection.flatMap;
  6503. lodash.flatMapDeep = collection.flatMapDeep;
  6504. lodash.flatMapDepth = collection.flatMapDepth;
  6505. lodash.flatten = array.flatten;
  6506. lodash.flattenDeep = array.flattenDeep;
  6507. lodash.flattenDepth = array.flattenDepth;
  6508. lodash.flip = func.flip;
  6509. lodash.flow = util.flow;
  6510. lodash.flowRight = util.flowRight;
  6511. lodash.fromPairs = array.fromPairs;
  6512. lodash.functions = object.functions;
  6513. lodash.functionsIn = object.functionsIn;
  6514. lodash.groupBy = collection.groupBy;
  6515. lodash.initial = array.initial;
  6516. lodash.intersection = array.intersection;
  6517. lodash.intersectionBy = array.intersectionBy;
  6518. lodash.intersectionWith = array.intersectionWith;
  6519. lodash.invert = object.invert;
  6520. lodash.invertBy = object.invertBy;
  6521. lodash.invokeMap = collection.invokeMap;
  6522. lodash.iteratee = util.iteratee;
  6523. lodash.keyBy = collection.keyBy;
  6524. lodash.keys = keys;
  6525. lodash.keysIn = object.keysIn;
  6526. lodash.map = collection.map;
  6527. lodash.mapKeys = object.mapKeys;
  6528. lodash.mapValues = object.mapValues;
  6529. lodash.matches = util.matches;
  6530. lodash.matchesProperty = util.matchesProperty;
  6531. lodash.memoize = func.memoize;
  6532. lodash.merge = object.merge;
  6533. lodash.mergeWith = object.mergeWith;
  6534. lodash.method = util.method;
  6535. lodash.methodOf = util.methodOf;
  6536. lodash.mixin = mixin;
  6537. lodash.negate = negate;
  6538. lodash.nthArg = util.nthArg;
  6539. lodash.omit = object.omit;
  6540. lodash.omitBy = object.omitBy;
  6541. lodash.once = func.once;
  6542. lodash.orderBy = collection.orderBy;
  6543. lodash.over = util.over;
  6544. lodash.overArgs = func.overArgs;
  6545. lodash.overEvery = util.overEvery;
  6546. lodash.overSome = util.overSome;
  6547. lodash.partial = func.partial;
  6548. lodash.partialRight = func.partialRight;
  6549. lodash.partition = collection.partition;
  6550. lodash.pick = object.pick;
  6551. lodash.pickBy = object.pickBy;
  6552. lodash.property = util.property;
  6553. lodash.propertyOf = util.propertyOf;
  6554. lodash.pull = array.pull;
  6555. lodash.pullAll = array.pullAll;
  6556. lodash.pullAllBy = array.pullAllBy;
  6557. lodash.pullAllWith = array.pullAllWith;
  6558. lodash.pullAt = array.pullAt;
  6559. lodash.range = util.range;
  6560. lodash.rangeRight = util.rangeRight;
  6561. lodash.rearg = func.rearg;
  6562. lodash.reject = collection.reject;
  6563. lodash.remove = array.remove;
  6564. lodash.rest = func.rest;
  6565. lodash.reverse = array.reverse;
  6566. lodash.sampleSize = collection.sampleSize;
  6567. lodash.set = object.set;
  6568. lodash.setWith = object.setWith;
  6569. lodash.shuffle = collection.shuffle;
  6570. lodash.slice = array.slice;
  6571. lodash.sortBy = collection.sortBy;
  6572. lodash.sortedUniq = array.sortedUniq;
  6573. lodash.sortedUniqBy = array.sortedUniqBy;
  6574. lodash.split = string$1.split;
  6575. lodash.spread = func.spread;
  6576. lodash.tail = array.tail;
  6577. lodash.take = array.take;
  6578. lodash.takeRight = array.takeRight;
  6579. lodash.takeRightWhile = array.takeRightWhile;
  6580. lodash.takeWhile = array.takeWhile;
  6581. lodash.tap = seq.tap;
  6582. lodash.throttle = func.throttle;
  6583. lodash.thru = thru;
  6584. lodash.toArray = lang.toArray;
  6585. lodash.toPairs = object.toPairs;
  6586. lodash.toPairsIn = object.toPairsIn;
  6587. lodash.toPath = util.toPath;
  6588. lodash.toPlainObject = lang.toPlainObject;
  6589. lodash.transform = object.transform;
  6590. lodash.unary = func.unary;
  6591. lodash.union = array.union;
  6592. lodash.unionBy = array.unionBy;
  6593. lodash.unionWith = array.unionWith;
  6594. lodash.uniq = array.uniq;
  6595. lodash.uniqBy = array.uniqBy;
  6596. lodash.uniqWith = array.uniqWith;
  6597. lodash.unset = object.unset;
  6598. lodash.unzip = array.unzip;
  6599. lodash.unzipWith = array.unzipWith;
  6600. lodash.update = object.update;
  6601. lodash.updateWith = object.updateWith;
  6602. lodash.values = object.values;
  6603. lodash.valuesIn = object.valuesIn;
  6604. lodash.without = array.without;
  6605. lodash.words = string$1.words;
  6606. lodash.wrap = func.wrap;
  6607. lodash.xor = array.xor;
  6608. lodash.xorBy = array.xorBy;
  6609. lodash.xorWith = array.xorWith;
  6610. lodash.zip = array.zip;
  6611. lodash.zipObject = array.zipObject;
  6612. lodash.zipObjectDeep = array.zipObjectDeep;
  6613. lodash.zipWith = array.zipWith;
  6614. lodash.entries = object.toPairs;
  6615. lodash.entriesIn = object.toPairsIn;
  6616. lodash.extend = object.assignIn;
  6617. lodash.extendWith = object.assignInWith;
  6618. mixin(lodash, lodash);
  6619. lodash.add = math.add;
  6620. lodash.attempt = util.attempt;
  6621. lodash.camelCase = string$1.camelCase;
  6622. lodash.capitalize = string$1.capitalize;
  6623. lodash.ceil = math.ceil;
  6624. lodash.clamp = number.clamp;
  6625. lodash.clone = lang.clone;
  6626. lodash.cloneDeep = lang.cloneDeep;
  6627. lodash.cloneDeepWith = lang.cloneDeepWith;
  6628. lodash.cloneWith = lang.cloneWith;
  6629. lodash.conformsTo = lang.conformsTo;
  6630. lodash.deburr = string$1.deburr;
  6631. lodash.defaultTo = util.defaultTo;
  6632. lodash.divide = math.divide;
  6633. lodash.endsWith = string$1.endsWith;
  6634. lodash.eq = lang.eq;
  6635. lodash.escape = string$1.escape;
  6636. lodash.escapeRegExp = string$1.escapeRegExp;
  6637. lodash.every = collection.every;
  6638. lodash.find = collection.find;
  6639. lodash.findIndex = array.findIndex;
  6640. lodash.findKey = object.findKey;
  6641. lodash.findLast = collection.findLast;
  6642. lodash.findLastIndex = array.findLastIndex;
  6643. lodash.findLastKey = object.findLastKey;
  6644. lodash.floor = math.floor;
  6645. lodash.forEach = collection.forEach;
  6646. lodash.forEachRight = collection.forEachRight;
  6647. lodash.forIn = object.forIn;
  6648. lodash.forInRight = object.forInRight;
  6649. lodash.forOwn = object.forOwn;
  6650. lodash.forOwnRight = object.forOwnRight;
  6651. lodash.get = object.get;
  6652. lodash.gt = lang.gt;
  6653. lodash.gte = lang.gte;
  6654. lodash.has = object.has;
  6655. lodash.hasIn = object.hasIn;
  6656. lodash.head = array.head;
  6657. lodash.identity = identity;
  6658. lodash.includes = collection.includes;
  6659. lodash.indexOf = array.indexOf;
  6660. lodash.inRange = number.inRange;
  6661. lodash.invoke = object.invoke;
  6662. lodash.isArguments = lang.isArguments;
  6663. lodash.isArray = isArray;
  6664. lodash.isArrayBuffer = lang.isArrayBuffer;
  6665. lodash.isArrayLike = lang.isArrayLike;
  6666. lodash.isArrayLikeObject = lang.isArrayLikeObject;
  6667. lodash.isBoolean = lang.isBoolean;
  6668. lodash.isBuffer = lang.isBuffer;
  6669. lodash.isDate = lang.isDate;
  6670. lodash.isElement = lang.isElement;
  6671. lodash.isEmpty = lang.isEmpty;
  6672. lodash.isEqual = lang.isEqual;
  6673. lodash.isEqualWith = lang.isEqualWith;
  6674. lodash.isError = lang.isError;
  6675. lodash.isFinite = lang.isFinite;
  6676. lodash.isFunction = lang.isFunction;
  6677. lodash.isInteger = lang.isInteger;
  6678. lodash.isLength = lang.isLength;
  6679. lodash.isMap = lang.isMap;
  6680. lodash.isMatch = lang.isMatch;
  6681. lodash.isMatchWith = lang.isMatchWith;
  6682. lodash.isNaN = lang.isNaN;
  6683. lodash.isNative = lang.isNative;
  6684. lodash.isNil = lang.isNil;
  6685. lodash.isNull = lang.isNull;
  6686. lodash.isNumber = lang.isNumber;
  6687. lodash.isObject = isObject;
  6688. lodash.isObjectLike = lang.isObjectLike;
  6689. lodash.isPlainObject = lang.isPlainObject;
  6690. lodash.isRegExp = lang.isRegExp;
  6691. lodash.isSafeInteger = lang.isSafeInteger;
  6692. lodash.isSet = lang.isSet;
  6693. lodash.isString = lang.isString;
  6694. lodash.isSymbol = lang.isSymbol;
  6695. lodash.isTypedArray = lang.isTypedArray;
  6696. lodash.isUndefined = lang.isUndefined;
  6697. lodash.isWeakMap = lang.isWeakMap;
  6698. lodash.isWeakSet = lang.isWeakSet;
  6699. lodash.join = array.join;
  6700. lodash.kebabCase = string$1.kebabCase;
  6701. lodash.last = last;
  6702. lodash.lastIndexOf = array.lastIndexOf;
  6703. lodash.lowerCase = string$1.lowerCase;
  6704. lodash.lowerFirst = string$1.lowerFirst;
  6705. lodash.lt = lang.lt;
  6706. lodash.lte = lang.lte;
  6707. lodash.max = math.max;
  6708. lodash.maxBy = math.maxBy;
  6709. lodash.mean = math.mean;
  6710. lodash.meanBy = math.meanBy;
  6711. lodash.min = math.min;
  6712. lodash.minBy = math.minBy;
  6713. lodash.stubArray = util.stubArray;
  6714. lodash.stubFalse = util.stubFalse;
  6715. lodash.stubObject = util.stubObject;
  6716. lodash.stubString = util.stubString;
  6717. lodash.stubTrue = util.stubTrue;
  6718. lodash.multiply = math.multiply;
  6719. lodash.nth = array.nth;
  6720. lodash.noop = util.noop;
  6721. lodash.now = date.now;
  6722. lodash.pad = string$1.pad;
  6723. lodash.padEnd = string$1.padEnd;
  6724. lodash.padStart = string$1.padStart;
  6725. lodash.parseInt = string$1.parseInt;
  6726. lodash.random = number.random;
  6727. lodash.reduce = collection.reduce;
  6728. lodash.reduceRight = collection.reduceRight;
  6729. lodash.repeat = string$1.repeat;
  6730. lodash.replace = string$1.replace;
  6731. lodash.result = object.result;
  6732. lodash.round = math.round;
  6733. lodash.sample = collection.sample;
  6734. lodash.size = collection.size;
  6735. lodash.snakeCase = string$1.snakeCase;
  6736. lodash.some = collection.some;
  6737. lodash.sortedIndex = array.sortedIndex;
  6738. lodash.sortedIndexBy = array.sortedIndexBy;
  6739. lodash.sortedIndexOf = array.sortedIndexOf;
  6740. lodash.sortedLastIndex = array.sortedLastIndex;
  6741. lodash.sortedLastIndexBy = array.sortedLastIndexBy;
  6742. lodash.sortedLastIndexOf = array.sortedLastIndexOf;
  6743. lodash.startCase = string$1.startCase;
  6744. lodash.startsWith = string$1.startsWith;
  6745. lodash.subtract = math.subtract;
  6746. lodash.sum = math.sum;
  6747. lodash.sumBy = math.sumBy;
  6748. lodash.template = string$1.template;
  6749. lodash.times = util.times;
  6750. lodash.toFinite = lang.toFinite;
  6751. lodash.toInteger = toInteger;
  6752. lodash.toLength = lang.toLength;
  6753. lodash.toLower = string$1.toLower;
  6754. lodash.toNumber = lang.toNumber;
  6755. lodash.toSafeInteger = lang.toSafeInteger;
  6756. lodash.toString = lang.toString;
  6757. lodash.toUpper = string$1.toUpper;
  6758. lodash.trim = string$1.trim;
  6759. lodash.trimEnd = string$1.trimEnd;
  6760. lodash.trimStart = string$1.trimStart;
  6761. lodash.truncate = string$1.truncate;
  6762. lodash.unescape = string$1.unescape;
  6763. lodash.uniqueId = util.uniqueId;
  6764. lodash.upperCase = string$1.upperCase;
  6765. lodash.upperFirst = string$1.upperFirst;
  6766. lodash.each = collection.forEach;
  6767. lodash.eachRight = collection.forEachRight;
  6768. lodash.first = array.head;
  6769. mixin(lodash, function() {
  6770. var source = {};
  6771. baseForOwn(lodash, function(func2, methodName) {
  6772. if (!hasOwnProperty.call(lodash.prototype, methodName)) {
  6773. source[methodName] = func2;
  6774. }
  6775. });
  6776. return source;
  6777. }(), { "chain": false });
  6778. lodash.VERSION = VERSION;
  6779. (lodash.templateSettings = string$1.templateSettings).imports._ = lodash;
  6780. arrayEach(["bind", "bindKey", "curry", "curryRight", "partial", "partialRight"], function(methodName) {
  6781. lodash[methodName].placeholder = lodash;
  6782. });
  6783. arrayEach(["drop", "take"], function(methodName, index) {
  6784. LazyWrapper.prototype[methodName] = function(n) {
  6785. n = n === void 0 ? 1 : nativeMax(toInteger(n), 0);
  6786. var result = this.__filtered__ && !index ? new LazyWrapper(this) : this.clone();
  6787. if (result.__filtered__) {
  6788. result.__takeCount__ = nativeMin(n, result.__takeCount__);
  6789. } else {
  6790. result.__views__.push({
  6791. "size": nativeMin(n, MAX_ARRAY_LENGTH),
  6792. "type": methodName + (result.__dir__ < 0 ? "Right" : "")
  6793. });
  6794. }
  6795. return result;
  6796. };
  6797. LazyWrapper.prototype[methodName + "Right"] = function(n) {
  6798. return this.reverse()[methodName](n).reverse();
  6799. };
  6800. });
  6801. arrayEach(["filter", "map", "takeWhile"], function(methodName, index) {
  6802. var type = index + 1, isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG;
  6803. LazyWrapper.prototype[methodName] = function(iteratee) {
  6804. var result = this.clone();
  6805. result.__iteratees__.push({
  6806. "iteratee": baseIteratee(iteratee),
  6807. "type": type
  6808. });
  6809. result.__filtered__ = result.__filtered__ || isFilter;
  6810. return result;
  6811. };
  6812. });
  6813. arrayEach(["head", "last"], function(methodName, index) {
  6814. var takeName = "take" + (index ? "Right" : "");
  6815. LazyWrapper.prototype[methodName] = function() {
  6816. return this[takeName](1).value()[0];
  6817. };
  6818. });
  6819. arrayEach(["initial", "tail"], function(methodName, index) {
  6820. var dropName = "drop" + (index ? "" : "Right");
  6821. LazyWrapper.prototype[methodName] = function() {
  6822. return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
  6823. };
  6824. });
  6825. LazyWrapper.prototype.compact = function() {
  6826. return this.filter(identity);
  6827. };
  6828. LazyWrapper.prototype.find = function(predicate) {
  6829. return this.filter(predicate).head();
  6830. };
  6831. LazyWrapper.prototype.findLast = function(predicate) {
  6832. return this.reverse().find(predicate);
  6833. };
  6834. LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
  6835. if (typeof path == "function") {
  6836. return new LazyWrapper(this);
  6837. }
  6838. return this.map(function(value) {
  6839. return baseInvoke(value, path, args);
  6840. });
  6841. });
  6842. LazyWrapper.prototype.reject = function(predicate) {
  6843. return this.filter(negate(baseIteratee(predicate)));
  6844. };
  6845. LazyWrapper.prototype.slice = function(start, end) {
  6846. start = toInteger(start);
  6847. var result = this;
  6848. if (result.__filtered__ && (start > 0 || end < 0)) {
  6849. return new LazyWrapper(result);
  6850. }
  6851. if (start < 0) {
  6852. result = result.takeRight(-start);
  6853. } else if (start) {
  6854. result = result.drop(start);
  6855. }
  6856. if (end !== void 0) {
  6857. end = toInteger(end);
  6858. result = end < 0 ? result.dropRight(-end) : result.take(end - start);
  6859. }
  6860. return result;
  6861. };
  6862. LazyWrapper.prototype.takeRightWhile = function(predicate) {
  6863. return this.reverse().takeWhile(predicate).reverse();
  6864. };
  6865. LazyWrapper.prototype.toArray = function() {
  6866. return this.take(MAX_ARRAY_LENGTH);
  6867. };
  6868. baseForOwn(LazyWrapper.prototype, function(func2, methodName) {
  6869. var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName), isTaker = /^(?:head|last)$/.test(methodName), lodashFunc = lodash[isTaker ? "take" + (methodName == "last" ? "Right" : "") : methodName], retUnwrapped = isTaker || /^find/.test(methodName);
  6870. if (!lodashFunc) {
  6871. return;
  6872. }
  6873. lodash.prototype[methodName] = function() {
  6874. var value = this.__wrapped__, args = isTaker ? [1] : arguments, isLazy = value instanceof LazyWrapper, iteratee = args[0], useLazy = isLazy || isArray(value);
  6875. var interceptor = function(value2) {
  6876. var result2 = lodashFunc.apply(lodash, arrayPush([value2], args));
  6877. return isTaker && chainAll ? result2[0] : result2;
  6878. };
  6879. if (useLazy && checkIteratee && typeof iteratee == "function" && iteratee.length != 1) {
  6880. isLazy = useLazy = false;
  6881. }
  6882. var chainAll = this.__chain__, isHybrid = !!this.__actions__.length, isUnwrapped = retUnwrapped && !chainAll, onlyLazy = isLazy && !isHybrid;
  6883. if (!retUnwrapped && useLazy) {
  6884. value = onlyLazy ? value : new LazyWrapper(this);
  6885. var result = func2.apply(value, args);
  6886. result.__actions__.push({ "func": thru, "args": [interceptor], "thisArg": void 0 });
  6887. return new LodashWrapper(result, chainAll);
  6888. }
  6889. if (isUnwrapped && onlyLazy) {
  6890. return func2.apply(this, args);
  6891. }
  6892. result = this.thru(interceptor);
  6893. return isUnwrapped ? isTaker ? result.value()[0] : result.value() : result;
  6894. };
  6895. });
  6896. arrayEach(["pop", "push", "shift", "sort", "splice", "unshift"], function(methodName) {
  6897. var func2 = arrayProto[methodName], chainName = /^(?:push|sort|unshift)$/.test(methodName) ? "tap" : "thru", retUnwrapped = /^(?:pop|shift)$/.test(methodName);
  6898. lodash.prototype[methodName] = function() {
  6899. var args = arguments;
  6900. if (retUnwrapped && !this.__chain__) {
  6901. var value = this.value();
  6902. return func2.apply(isArray(value) ? value : [], args);
  6903. }
  6904. return this[chainName](function(value2) {
  6905. return func2.apply(isArray(value2) ? value2 : [], args);
  6906. });
  6907. };
  6908. });
  6909. baseForOwn(LazyWrapper.prototype, function(func2, methodName) {
  6910. var lodashFunc = lodash[methodName];
  6911. if (lodashFunc) {
  6912. var key = lodashFunc.name + "";
  6913. if (!hasOwnProperty.call(realNames, key)) {
  6914. realNames[key] = [];
  6915. }
  6916. realNames[key].push({ "name": methodName, "func": lodashFunc });
  6917. }
  6918. });
  6919. realNames[createHybrid(void 0, WRAP_BIND_KEY_FLAG).name] = [{
  6920. "name": "wrapper",
  6921. "func": void 0
  6922. }];
  6923. LazyWrapper.prototype.clone = lazyClone;
  6924. LazyWrapper.prototype.reverse = lazyReverse;
  6925. LazyWrapper.prototype.value = lazyValue;
  6926. lodash.prototype.at = seq.at;
  6927. lodash.prototype.chain = seq.wrapperChain;
  6928. lodash.prototype.commit = seq.commit;
  6929. lodash.prototype.next = seq.next;
  6930. lodash.prototype.plant = seq.plant;
  6931. lodash.prototype.reverse = seq.reverse;
  6932. lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = seq.value;
  6933. lodash.prototype.first = lodash.prototype.head;
  6934. if (symIterator) {
  6935. lodash.prototype[symIterator] = seq.toIterator;
  6936. }
  6937. /**
  6938. * @license
  6939. * Lodash (Custom Build) <https://lodash.com/>
  6940. * Build: `lodash modularize exports="es" -o ./`
  6941. * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
  6942. * Released under MIT license <https://lodash.com/license>
  6943. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  6944. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  6945. */
  6946. const isUndefined = (val) => val === void 0;
  6947. const isBoolean = (val) => typeof val === "boolean";
  6948. const isNumber = (val) => typeof val === "number";
  6949. const isEmpty = (val) => !val && val !== 0 || isArray$1(val) && val.length === 0 || isObject$1(val) && !Object.keys(val).length;
  6950. const isElement$1 = (e) => {
  6951. if (typeof Element === "undefined")
  6952. return false;
  6953. return e instanceof Element;
  6954. };
  6955. const isPropAbsent = (prop) => isNil(prop);
  6956. const isStringNumber = (val) => {
  6957. if (!isString$1(val)) {
  6958. return false;
  6959. }
  6960. return !Number.isNaN(Number(val));
  6961. };
  6962. const isWindow$1 = (val) => val === window;
  6963. const rAF = (fn) => isClient ? window.requestAnimationFrame(fn) : setTimeout(fn, 16);
  6964. const cAF = (handle) => isClient ? window.cancelAnimationFrame(handle) : clearTimeout(handle);
  6965. const escapeStringRegexp = (string = "") => string.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
  6966. const capitalize = (str) => capitalize$2(str);
  6967. const keysOf = (arr) => Object.keys(arr);
  6968. const entriesOf = (arr) => Object.entries(arr);
  6969. const getProp = (obj, path, defaultValue) => {
  6970. return {
  6971. get value() {
  6972. return get(obj, path, defaultValue);
  6973. },
  6974. set value(val) {
  6975. set(obj, path, val);
  6976. }
  6977. };
  6978. };
  6979. class ElementPlusError extends Error {
  6980. constructor(m) {
  6981. super(m);
  6982. this.name = "ElementPlusError";
  6983. }
  6984. }
  6985. function throwError(scope, m) {
  6986. throw new ElementPlusError(`[${scope}] ${m}`);
  6987. }
  6988. function debugWarn(scope, message) {
  6989. }
  6990. const classNameToArray = (cls = "") => cls.split(" ").filter((item) => !!item.trim());
  6991. const hasClass = (el, cls) => {
  6992. if (!el || !cls)
  6993. return false;
  6994. if (cls.includes(" "))
  6995. throw new Error("className should not contain space.");
  6996. return el.classList.contains(cls);
  6997. };
  6998. const addClass = (el, cls) => {
  6999. if (!el || !cls.trim())
  7000. return;
  7001. el.classList.add(...classNameToArray(cls));
  7002. };
  7003. const removeClass = (el, cls) => {
  7004. if (!el || !cls.trim())
  7005. return;
  7006. el.classList.remove(...classNameToArray(cls));
  7007. };
  7008. const getStyle = (element, styleName) => {
  7009. var _a;
  7010. if (!isClient || !element || !styleName)
  7011. return "";
  7012. let key = camelize(styleName);
  7013. if (key === "float")
  7014. key = "cssFloat";
  7015. try {
  7016. const style = element.style[key];
  7017. if (style)
  7018. return style;
  7019. const computed = (_a = document.defaultView) == null ? void 0 : _a.getComputedStyle(element, "");
  7020. return computed ? computed[key] : "";
  7021. } catch (e) {
  7022. return element.style[key];
  7023. }
  7024. };
  7025. const setStyle = (element, styleName, value) => {
  7026. if (!element || !styleName)
  7027. return;
  7028. if (isObject$1(styleName)) {
  7029. entriesOf(styleName).forEach(([prop, value2]) => setStyle(element, prop, value2));
  7030. } else {
  7031. const key = camelize(styleName);
  7032. element.style[key] = value;
  7033. }
  7034. };
  7035. function addUnit(value, defaultUnit = "px") {
  7036. if (!value)
  7037. return "";
  7038. if (isNumber(value) || isStringNumber(value)) {
  7039. return `${value}${defaultUnit}`;
  7040. } else if (isString$1(value)) {
  7041. return value;
  7042. }
  7043. }
  7044. const isScroll = (el, isVertical) => {
  7045. if (!isClient)
  7046. return false;
  7047. const key = {
  7048. undefined: "overflow",
  7049. true: "overflow-y",
  7050. false: "overflow-x"
  7051. }[String(isVertical)];
  7052. const overflow = getStyle(el, key);
  7053. return ["scroll", "auto", "overlay"].some((s) => overflow.includes(s));
  7054. };
  7055. const getScrollContainer = (el, isVertical) => {
  7056. if (!isClient)
  7057. return;
  7058. let parent = el;
  7059. while (parent) {
  7060. if ([window, document, document.documentElement].includes(parent))
  7061. return window;
  7062. if (isScroll(parent, isVertical))
  7063. return parent;
  7064. parent = parent.parentNode;
  7065. }
  7066. return parent;
  7067. };
  7068. let scrollBarWidth;
  7069. const getScrollBarWidth = (namespace) => {
  7070. var _a;
  7071. if (!isClient)
  7072. return 0;
  7073. if (scrollBarWidth !== void 0)
  7074. return scrollBarWidth;
  7075. const outer = document.createElement("div");
  7076. outer.className = `${namespace}-scrollbar__wrap`;
  7077. outer.style.visibility = "hidden";
  7078. outer.style.width = "100px";
  7079. outer.style.position = "absolute";
  7080. outer.style.top = "-9999px";
  7081. document.body.appendChild(outer);
  7082. const widthNoScroll = outer.offsetWidth;
  7083. outer.style.overflow = "scroll";
  7084. const inner = document.createElement("div");
  7085. inner.style.width = "100%";
  7086. outer.appendChild(inner);
  7087. const widthWithScroll = inner.offsetWidth;
  7088. (_a = outer.parentNode) == null ? void 0 : _a.removeChild(outer);
  7089. scrollBarWidth = widthNoScroll - widthWithScroll;
  7090. return scrollBarWidth;
  7091. };
  7092. function scrollIntoView(container, selected) {
  7093. if (!isClient)
  7094. return;
  7095. if (!selected) {
  7096. container.scrollTop = 0;
  7097. return;
  7098. }
  7099. const offsetParents = [];
  7100. let pointer = selected.offsetParent;
  7101. while (pointer !== null && container !== pointer && container.contains(pointer)) {
  7102. offsetParents.push(pointer);
  7103. pointer = pointer.offsetParent;
  7104. }
  7105. const top = selected.offsetTop + offsetParents.reduce((prev, curr) => prev + curr.offsetTop, 0);
  7106. const bottom = top + selected.offsetHeight;
  7107. const viewRectTop = container.scrollTop;
  7108. const viewRectBottom = viewRectTop + container.clientHeight;
  7109. if (top < viewRectTop) {
  7110. container.scrollTop = top;
  7111. } else if (bottom > viewRectBottom) {
  7112. container.scrollTop = bottom - container.clientHeight;
  7113. }
  7114. }
  7115. function animateScrollTo(container, from, to, duration, callback) {
  7116. const startTime = Date.now();
  7117. let handle;
  7118. const scroll = () => {
  7119. const timestamp = Date.now();
  7120. const time = timestamp - startTime;
  7121. const nextScrollTop = easeInOutCubic(time > duration ? duration : time, from, to, duration);
  7122. if (isWindow$1(container)) {
  7123. container.scrollTo(window.pageXOffset, nextScrollTop);
  7124. } else {
  7125. container.scrollTop = nextScrollTop;
  7126. }
  7127. if (time < duration) {
  7128. handle = rAF(scroll);
  7129. } else if (isFunction$1(callback)) {
  7130. callback();
  7131. }
  7132. };
  7133. scroll();
  7134. return () => {
  7135. handle && cAF(handle);
  7136. };
  7137. }
  7138. const getScrollElement = (target, container) => {
  7139. if (isWindow$1(container)) {
  7140. return target.ownerDocument.documentElement;
  7141. }
  7142. return container;
  7143. };
  7144. const getScrollTop = (container) => {
  7145. if (isWindow$1(container)) {
  7146. return window.scrollY;
  7147. }
  7148. return container.scrollTop;
  7149. };
  7150. const getElement = (target) => {
  7151. if (!isClient || target === "")
  7152. return null;
  7153. if (isString$1(target)) {
  7154. try {
  7155. return document.querySelector(target);
  7156. } catch (e) {
  7157. return null;
  7158. }
  7159. }
  7160. return target;
  7161. };
  7162. let target = !isClient ? void 0 : document.body;
  7163. function createGlobalNode(id) {
  7164. const el = document.createElement("div");
  7165. if (id !== void 0) {
  7166. el.setAttribute("id", id);
  7167. }
  7168. if (target) {
  7169. target.appendChild(el);
  7170. }
  7171. return el;
  7172. }
  7173. function removeGlobalNode(el) {
  7174. el.remove();
  7175. }
  7176. var arrow_down_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7177. name: "ArrowDown",
  7178. __name: "arrow-down",
  7179. setup(__props) {
  7180. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7181. xmlns: "http://www.w3.org/2000/svg",
  7182. viewBox: "0 0 1024 1024"
  7183. }, [
  7184. vue.createElementVNode("path", {
  7185. fill: "currentColor",
  7186. d: "M831.872 340.864 512 652.672 192.128 340.864a30.592 30.592 0 0 0-42.752 0 29.12 29.12 0 0 0 0 41.6L489.664 714.24a32 32 0 0 0 44.672 0l340.288-331.712a29.12 29.12 0 0 0 0-41.728 30.592 30.592 0 0 0-42.752 0z"
  7187. })
  7188. ]));
  7189. }
  7190. });
  7191. var arrow_down_default = arrow_down_vue_vue_type_script_setup_true_lang_default;
  7192. var arrow_left_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7193. name: "ArrowLeft",
  7194. __name: "arrow-left",
  7195. setup(__props) {
  7196. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7197. xmlns: "http://www.w3.org/2000/svg",
  7198. viewBox: "0 0 1024 1024"
  7199. }, [
  7200. vue.createElementVNode("path", {
  7201. fill: "currentColor",
  7202. d: "M609.408 149.376 277.76 489.6a32 32 0 0 0 0 44.672l331.648 340.352a29.12 29.12 0 0 0 41.728 0 30.592 30.592 0 0 0 0-42.752L339.264 511.936l311.872-319.872a30.592 30.592 0 0 0 0-42.688 29.12 29.12 0 0 0-41.728 0z"
  7203. })
  7204. ]));
  7205. }
  7206. });
  7207. var arrow_left_default = arrow_left_vue_vue_type_script_setup_true_lang_default;
  7208. var arrow_right_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7209. name: "ArrowRight",
  7210. __name: "arrow-right",
  7211. setup(__props) {
  7212. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7213. xmlns: "http://www.w3.org/2000/svg",
  7214. viewBox: "0 0 1024 1024"
  7215. }, [
  7216. vue.createElementVNode("path", {
  7217. fill: "currentColor",
  7218. d: "M340.864 149.312a30.592 30.592 0 0 0 0 42.752L652.736 512 340.864 831.872a30.592 30.592 0 0 0 0 42.752 29.12 29.12 0 0 0 41.728 0L714.24 534.336a32 32 0 0 0 0-44.672L382.592 149.376a29.12 29.12 0 0 0-41.728 0z"
  7219. })
  7220. ]));
  7221. }
  7222. });
  7223. var arrow_right_default = arrow_right_vue_vue_type_script_setup_true_lang_default;
  7224. var arrow_up_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7225. name: "ArrowUp",
  7226. __name: "arrow-up",
  7227. setup(__props) {
  7228. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7229. xmlns: "http://www.w3.org/2000/svg",
  7230. viewBox: "0 0 1024 1024"
  7231. }, [
  7232. vue.createElementVNode("path", {
  7233. fill: "currentColor",
  7234. d: "m488.832 344.32-339.84 356.672a32 32 0 0 0 0 44.16l.384.384a29.44 29.44 0 0 0 42.688 0l320-335.872 319.872 335.872a29.44 29.44 0 0 0 42.688 0l.384-.384a32 32 0 0 0 0-44.16L535.168 344.32a32 32 0 0 0-46.336 0"
  7235. })
  7236. ]));
  7237. }
  7238. });
  7239. var arrow_up_default = arrow_up_vue_vue_type_script_setup_true_lang_default;
  7240. var back_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7241. name: "Back",
  7242. __name: "back",
  7243. setup(__props) {
  7244. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7245. xmlns: "http://www.w3.org/2000/svg",
  7246. viewBox: "0 0 1024 1024"
  7247. }, [
  7248. vue.createElementVNode("path", {
  7249. fill: "currentColor",
  7250. d: "M224 480h640a32 32 0 1 1 0 64H224a32 32 0 0 1 0-64"
  7251. }),
  7252. vue.createElementVNode("path", {
  7253. fill: "currentColor",
  7254. d: "m237.248 512 265.408 265.344a32 32 0 0 1-45.312 45.312l-288-288a32 32 0 0 1 0-45.312l288-288a32 32 0 1 1 45.312 45.312z"
  7255. })
  7256. ]));
  7257. }
  7258. });
  7259. var back_default = back_vue_vue_type_script_setup_true_lang_default;
  7260. var calendar_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7261. name: "Calendar",
  7262. __name: "calendar",
  7263. setup(__props) {
  7264. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7265. xmlns: "http://www.w3.org/2000/svg",
  7266. viewBox: "0 0 1024 1024"
  7267. }, [
  7268. vue.createElementVNode("path", {
  7269. fill: "currentColor",
  7270. d: "M128 384v512h768V192H768v32a32 32 0 1 1-64 0v-32H320v32a32 32 0 0 1-64 0v-32H128v128h768v64zm192-256h384V96a32 32 0 1 1 64 0v32h160a32 32 0 0 1 32 32v768a32 32 0 0 1-32 32H96a32 32 0 0 1-32-32V160a32 32 0 0 1 32-32h160V96a32 32 0 0 1 64 0zm-32 384h64a32 32 0 0 1 0 64h-64a32 32 0 0 1 0-64m0 192h64a32 32 0 1 1 0 64h-64a32 32 0 1 1 0-64m192-192h64a32 32 0 0 1 0 64h-64a32 32 0 0 1 0-64m0 192h64a32 32 0 1 1 0 64h-64a32 32 0 1 1 0-64m192-192h64a32 32 0 1 1 0 64h-64a32 32 0 1 1 0-64m0 192h64a32 32 0 1 1 0 64h-64a32 32 0 1 1 0-64"
  7271. })
  7272. ]));
  7273. }
  7274. });
  7275. var calendar_default = calendar_vue_vue_type_script_setup_true_lang_default;
  7276. var caret_right_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7277. name: "CaretRight",
  7278. __name: "caret-right",
  7279. setup(__props) {
  7280. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7281. xmlns: "http://www.w3.org/2000/svg",
  7282. viewBox: "0 0 1024 1024"
  7283. }, [
  7284. vue.createElementVNode("path", {
  7285. fill: "currentColor",
  7286. d: "M384 192v640l384-320.064z"
  7287. })
  7288. ]));
  7289. }
  7290. });
  7291. var caret_right_default = caret_right_vue_vue_type_script_setup_true_lang_default;
  7292. var caret_top_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7293. name: "CaretTop",
  7294. __name: "caret-top",
  7295. setup(__props) {
  7296. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7297. xmlns: "http://www.w3.org/2000/svg",
  7298. viewBox: "0 0 1024 1024"
  7299. }, [
  7300. vue.createElementVNode("path", {
  7301. fill: "currentColor",
  7302. d: "M512 320 192 704h639.936z"
  7303. })
  7304. ]));
  7305. }
  7306. });
  7307. var caret_top_default = caret_top_vue_vue_type_script_setup_true_lang_default;
  7308. var check_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7309. name: "Check",
  7310. __name: "check",
  7311. setup(__props) {
  7312. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7313. xmlns: "http://www.w3.org/2000/svg",
  7314. viewBox: "0 0 1024 1024"
  7315. }, [
  7316. vue.createElementVNode("path", {
  7317. fill: "currentColor",
  7318. d: "M406.656 706.944 195.84 496.256a32 32 0 1 0-45.248 45.248l256 256 512-512a32 32 0 0 0-45.248-45.248L406.592 706.944z"
  7319. })
  7320. ]));
  7321. }
  7322. });
  7323. var check_default = check_vue_vue_type_script_setup_true_lang_default;
  7324. var circle_check_filled_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7325. name: "CircleCheckFilled",
  7326. __name: "circle-check-filled",
  7327. setup(__props) {
  7328. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7329. xmlns: "http://www.w3.org/2000/svg",
  7330. viewBox: "0 0 1024 1024"
  7331. }, [
  7332. vue.createElementVNode("path", {
  7333. fill: "currentColor",
  7334. d: "M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m-55.808 536.384-99.52-99.584a38.4 38.4 0 1 0-54.336 54.336l126.72 126.72a38.272 38.272 0 0 0 54.336 0l262.4-262.464a38.4 38.4 0 1 0-54.272-54.336z"
  7335. })
  7336. ]));
  7337. }
  7338. });
  7339. var circle_check_filled_default = circle_check_filled_vue_vue_type_script_setup_true_lang_default;
  7340. var circle_check_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7341. name: "CircleCheck",
  7342. __name: "circle-check",
  7343. setup(__props) {
  7344. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7345. xmlns: "http://www.w3.org/2000/svg",
  7346. viewBox: "0 0 1024 1024"
  7347. }, [
  7348. vue.createElementVNode("path", {
  7349. fill: "currentColor",
  7350. d: "M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768m0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896"
  7351. }),
  7352. vue.createElementVNode("path", {
  7353. fill: "currentColor",
  7354. d: "M745.344 361.344a32 32 0 0 1 45.312 45.312l-288 288a32 32 0 0 1-45.312 0l-160-160a32 32 0 1 1 45.312-45.312L480 626.752l265.344-265.408z"
  7355. })
  7356. ]));
  7357. }
  7358. });
  7359. var circle_check_default = circle_check_vue_vue_type_script_setup_true_lang_default;
  7360. var circle_close_filled_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7361. name: "CircleCloseFilled",
  7362. __name: "circle-close-filled",
  7363. setup(__props) {
  7364. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7365. xmlns: "http://www.w3.org/2000/svg",
  7366. viewBox: "0 0 1024 1024"
  7367. }, [
  7368. vue.createElementVNode("path", {
  7369. fill: "currentColor",
  7370. d: "M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m0 393.664L407.936 353.6a38.4 38.4 0 1 0-54.336 54.336L457.664 512 353.6 616.064a38.4 38.4 0 1 0 54.336 54.336L512 566.336 616.064 670.4a38.4 38.4 0 1 0 54.336-54.336L566.336 512 670.4 407.936a38.4 38.4 0 1 0-54.336-54.336z"
  7371. })
  7372. ]));
  7373. }
  7374. });
  7375. var circle_close_filled_default = circle_close_filled_vue_vue_type_script_setup_true_lang_default;
  7376. var circle_close_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7377. name: "CircleClose",
  7378. __name: "circle-close",
  7379. setup(__props) {
  7380. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7381. xmlns: "http://www.w3.org/2000/svg",
  7382. viewBox: "0 0 1024 1024"
  7383. }, [
  7384. vue.createElementVNode("path", {
  7385. fill: "currentColor",
  7386. d: "m466.752 512-90.496-90.496a32 32 0 0 1 45.248-45.248L512 466.752l90.496-90.496a32 32 0 1 1 45.248 45.248L557.248 512l90.496 90.496a32 32 0 1 1-45.248 45.248L512 557.248l-90.496 90.496a32 32 0 0 1-45.248-45.248z"
  7387. }),
  7388. vue.createElementVNode("path", {
  7389. fill: "currentColor",
  7390. d: "M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768m0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896"
  7391. })
  7392. ]));
  7393. }
  7394. });
  7395. var circle_close_default = circle_close_vue_vue_type_script_setup_true_lang_default;
  7396. var clock_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7397. name: "Clock",
  7398. __name: "clock",
  7399. setup(__props) {
  7400. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7401. xmlns: "http://www.w3.org/2000/svg",
  7402. viewBox: "0 0 1024 1024"
  7403. }, [
  7404. vue.createElementVNode("path", {
  7405. fill: "currentColor",
  7406. d: "M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768m0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896"
  7407. }),
  7408. vue.createElementVNode("path", {
  7409. fill: "currentColor",
  7410. d: "M480 256a32 32 0 0 1 32 32v256a32 32 0 0 1-64 0V288a32 32 0 0 1 32-32"
  7411. }),
  7412. vue.createElementVNode("path", {
  7413. fill: "currentColor",
  7414. d: "M480 512h256q32 0 32 32t-32 32H480q-32 0-32-32t32-32"
  7415. })
  7416. ]));
  7417. }
  7418. });
  7419. var clock_default = clock_vue_vue_type_script_setup_true_lang_default;
  7420. var close_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7421. name: "Close",
  7422. __name: "close",
  7423. setup(__props) {
  7424. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7425. xmlns: "http://www.w3.org/2000/svg",
  7426. viewBox: "0 0 1024 1024"
  7427. }, [
  7428. vue.createElementVNode("path", {
  7429. fill: "currentColor",
  7430. d: "M764.288 214.592 512 466.88 259.712 214.592a31.936 31.936 0 0 0-45.12 45.12L466.752 512 214.528 764.224a31.936 31.936 0 1 0 45.12 45.184L512 557.184l252.288 252.288a31.936 31.936 0 0 0 45.12-45.12L557.12 512.064l252.288-252.352a31.936 31.936 0 1 0-45.12-45.184z"
  7431. })
  7432. ]));
  7433. }
  7434. });
  7435. var close_default = close_vue_vue_type_script_setup_true_lang_default;
  7436. var d_arrow_left_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7437. name: "DArrowLeft",
  7438. __name: "d-arrow-left",
  7439. setup(__props) {
  7440. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7441. xmlns: "http://www.w3.org/2000/svg",
  7442. viewBox: "0 0 1024 1024"
  7443. }, [
  7444. vue.createElementVNode("path", {
  7445. fill: "currentColor",
  7446. d: "M529.408 149.376a29.12 29.12 0 0 1 41.728 0 30.592 30.592 0 0 1 0 42.688L259.264 511.936l311.872 319.936a30.592 30.592 0 0 1-.512 43.264 29.12 29.12 0 0 1-41.216-.512L197.76 534.272a32 32 0 0 1 0-44.672l331.648-340.224zm256 0a29.12 29.12 0 0 1 41.728 0 30.592 30.592 0 0 1 0 42.688L515.264 511.936l311.872 319.936a30.592 30.592 0 0 1-.512 43.264 29.12 29.12 0 0 1-41.216-.512L453.76 534.272a32 32 0 0 1 0-44.672l331.648-340.224z"
  7447. })
  7448. ]));
  7449. }
  7450. });
  7451. var d_arrow_left_default = d_arrow_left_vue_vue_type_script_setup_true_lang_default;
  7452. var d_arrow_right_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7453. name: "DArrowRight",
  7454. __name: "d-arrow-right",
  7455. setup(__props) {
  7456. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7457. xmlns: "http://www.w3.org/2000/svg",
  7458. viewBox: "0 0 1024 1024"
  7459. }, [
  7460. vue.createElementVNode("path", {
  7461. fill: "currentColor",
  7462. d: "M452.864 149.312a29.12 29.12 0 0 1 41.728.064L826.24 489.664a32 32 0 0 1 0 44.672L494.592 874.624a29.12 29.12 0 0 1-41.728 0 30.592 30.592 0 0 1 0-42.752L764.736 512 452.864 192a30.592 30.592 0 0 1 0-42.688m-256 0a29.12 29.12 0 0 1 41.728.064L570.24 489.664a32 32 0 0 1 0 44.672L238.592 874.624a29.12 29.12 0 0 1-41.728 0 30.592 30.592 0 0 1 0-42.752L508.736 512 196.864 192a30.592 30.592 0 0 1 0-42.688z"
  7463. })
  7464. ]));
  7465. }
  7466. });
  7467. var d_arrow_right_default = d_arrow_right_vue_vue_type_script_setup_true_lang_default;
  7468. var delete_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7469. name: "Delete",
  7470. __name: "delete",
  7471. setup(__props) {
  7472. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7473. xmlns: "http://www.w3.org/2000/svg",
  7474. viewBox: "0 0 1024 1024"
  7475. }, [
  7476. vue.createElementVNode("path", {
  7477. fill: "currentColor",
  7478. d: "M160 256H96a32 32 0 0 1 0-64h256V95.936a32 32 0 0 1 32-32h256a32 32 0 0 1 32 32V192h256a32 32 0 1 1 0 64h-64v672a32 32 0 0 1-32 32H192a32 32 0 0 1-32-32zm448-64v-64H416v64zM224 896h576V256H224zm192-128a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32m192 0a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32"
  7479. })
  7480. ]));
  7481. }
  7482. });
  7483. var delete_default = delete_vue_vue_type_script_setup_true_lang_default;
  7484. var document_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7485. name: "Document",
  7486. __name: "document",
  7487. setup(__props) {
  7488. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7489. xmlns: "http://www.w3.org/2000/svg",
  7490. viewBox: "0 0 1024 1024"
  7491. }, [
  7492. vue.createElementVNode("path", {
  7493. fill: "currentColor",
  7494. d: "M832 384H576V128H192v768h640zm-26.496-64L640 154.496V320zM160 64h480l256 256v608a32 32 0 0 1-32 32H160a32 32 0 0 1-32-32V96a32 32 0 0 1 32-32m160 448h384v64H320zm0-192h160v64H320zm0 384h384v64H320z"
  7495. })
  7496. ]));
  7497. }
  7498. });
  7499. var document_default = document_vue_vue_type_script_setup_true_lang_default;
  7500. var full_screen_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7501. name: "FullScreen",
  7502. __name: "full-screen",
  7503. setup(__props) {
  7504. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7505. xmlns: "http://www.w3.org/2000/svg",
  7506. viewBox: "0 0 1024 1024"
  7507. }, [
  7508. vue.createElementVNode("path", {
  7509. fill: "currentColor",
  7510. d: "m160 96.064 192 .192a32 32 0 0 1 0 64l-192-.192V352a32 32 0 0 1-64 0V96h64zm0 831.872V928H96V672a32 32 0 1 1 64 0v191.936l192-.192a32 32 0 1 1 0 64zM864 96.064V96h64v256a32 32 0 1 1-64 0V160.064l-192 .192a32 32 0 1 1 0-64l192-.192zm0 831.872-192-.192a32 32 0 0 1 0-64l192 .192V672a32 32 0 1 1 64 0v256h-64z"
  7511. })
  7512. ]));
  7513. }
  7514. });
  7515. var full_screen_default = full_screen_vue_vue_type_script_setup_true_lang_default;
  7516. var hide_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7517. name: "Hide",
  7518. __name: "hide",
  7519. setup(__props) {
  7520. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7521. xmlns: "http://www.w3.org/2000/svg",
  7522. viewBox: "0 0 1024 1024"
  7523. }, [
  7524. vue.createElementVNode("path", {
  7525. fill: "currentColor",
  7526. d: "M876.8 156.8c0-9.6-3.2-16-9.6-22.4-6.4-6.4-12.8-9.6-22.4-9.6-9.6 0-16 3.2-22.4 9.6L736 220.8c-64-32-137.6-51.2-224-60.8-160 16-288 73.6-377.6 176C44.8 438.4 0 496 0 512s48 73.6 134.4 176c22.4 25.6 44.8 48 73.6 67.2l-86.4 89.6c-6.4 6.4-9.6 12.8-9.6 22.4 0 9.6 3.2 16 9.6 22.4 6.4 6.4 12.8 9.6 22.4 9.6 9.6 0 16-3.2 22.4-9.6l704-710.4c3.2-6.4 6.4-12.8 6.4-22.4Zm-646.4 528c-76.8-70.4-128-128-153.6-172.8 28.8-48 80-105.6 153.6-172.8C304 272 400 230.4 512 224c64 3.2 124.8 19.2 176 44.8l-54.4 54.4C598.4 300.8 560 288 512 288c-64 0-115.2 22.4-160 64s-64 96-64 160c0 48 12.8 89.6 35.2 124.8L256 707.2c-9.6-6.4-19.2-16-25.6-22.4Zm140.8-96c-12.8-22.4-19.2-48-19.2-76.8 0-44.8 16-83.2 48-112 32-28.8 67.2-48 112-48 28.8 0 54.4 6.4 73.6 19.2zM889.599 336c-12.8-16-28.8-28.8-41.6-41.6l-48 48c73.6 67.2 124.8 124.8 150.4 169.6-28.8 48-80 105.6-153.6 172.8-73.6 67.2-172.8 108.8-284.8 115.2-51.2-3.2-99.2-12.8-140.8-28.8l-48 48c57.6 22.4 118.4 38.4 188.8 44.8 160-16 288-73.6 377.6-176C979.199 585.6 1024 528 1024 512s-48.001-73.6-134.401-176Z"
  7527. }),
  7528. vue.createElementVNode("path", {
  7529. fill: "currentColor",
  7530. d: "M511.998 672c-12.8 0-25.6-3.2-38.4-6.4l-51.2 51.2c28.8 12.8 57.6 19.2 89.6 19.2 64 0 115.2-22.4 160-64 41.6-41.6 64-96 64-160 0-32-6.4-64-19.2-89.6l-51.2 51.2c3.2 12.8 6.4 25.6 6.4 38.4 0 44.8-16 83.2-48 112-32 28.8-67.2 48-112 48Z"
  7531. })
  7532. ]));
  7533. }
  7534. });
  7535. var hide_default = hide_vue_vue_type_script_setup_true_lang_default;
  7536. var info_filled_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7537. name: "InfoFilled",
  7538. __name: "info-filled",
  7539. setup(__props) {
  7540. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7541. xmlns: "http://www.w3.org/2000/svg",
  7542. viewBox: "0 0 1024 1024"
  7543. }, [
  7544. vue.createElementVNode("path", {
  7545. fill: "currentColor",
  7546. d: "M512 64a448 448 0 1 1 0 896.064A448 448 0 0 1 512 64m67.2 275.072c33.28 0 60.288-23.104 60.288-57.344s-27.072-57.344-60.288-57.344c-33.28 0-60.16 23.104-60.16 57.344s26.88 57.344 60.16 57.344M590.912 699.2c0-6.848 2.368-24.64 1.024-34.752l-52.608 60.544c-10.88 11.456-24.512 19.392-30.912 17.28a12.992 12.992 0 0 1-8.256-14.72l87.68-276.992c7.168-35.136-12.544-67.2-54.336-71.296-44.096 0-108.992 44.736-148.48 101.504 0 6.784-1.28 23.68.064 33.792l52.544-60.608c10.88-11.328 23.552-19.328 29.952-17.152a12.8 12.8 0 0 1 7.808 16.128L388.48 728.576c-10.048 32.256 8.96 63.872 55.04 71.04 67.84 0 107.904-43.648 147.456-100.416z"
  7547. })
  7548. ]));
  7549. }
  7550. });
  7551. var info_filled_default = info_filled_vue_vue_type_script_setup_true_lang_default;
  7552. var loading_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7553. name: "Loading",
  7554. __name: "loading",
  7555. setup(__props) {
  7556. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7557. xmlns: "http://www.w3.org/2000/svg",
  7558. viewBox: "0 0 1024 1024"
  7559. }, [
  7560. vue.createElementVNode("path", {
  7561. fill: "currentColor",
  7562. d: "M512 64a32 32 0 0 1 32 32v192a32 32 0 0 1-64 0V96a32 32 0 0 1 32-32m0 640a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V736a32 32 0 0 1 32-32m448-192a32 32 0 0 1-32 32H736a32 32 0 1 1 0-64h192a32 32 0 0 1 32 32m-640 0a32 32 0 0 1-32 32H96a32 32 0 0 1 0-64h192a32 32 0 0 1 32 32M195.2 195.2a32 32 0 0 1 45.248 0L376.32 331.008a32 32 0 0 1-45.248 45.248L195.2 240.448a32 32 0 0 1 0-45.248zm452.544 452.544a32 32 0 0 1 45.248 0L828.8 783.552a32 32 0 0 1-45.248 45.248L647.744 692.992a32 32 0 0 1 0-45.248zM828.8 195.264a32 32 0 0 1 0 45.184L692.992 376.32a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0m-452.544 452.48a32 32 0 0 1 0 45.248L240.448 828.8a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0z"
  7563. })
  7564. ]));
  7565. }
  7566. });
  7567. var loading_default = loading_vue_vue_type_script_setup_true_lang_default;
  7568. var minus_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7569. name: "Minus",
  7570. __name: "minus",
  7571. setup(__props) {
  7572. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7573. xmlns: "http://www.w3.org/2000/svg",
  7574. viewBox: "0 0 1024 1024"
  7575. }, [
  7576. vue.createElementVNode("path", {
  7577. fill: "currentColor",
  7578. d: "M128 544h768a32 32 0 1 0 0-64H128a32 32 0 0 0 0 64"
  7579. })
  7580. ]));
  7581. }
  7582. });
  7583. var minus_default = minus_vue_vue_type_script_setup_true_lang_default;
  7584. var more_filled_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7585. name: "MoreFilled",
  7586. __name: "more-filled",
  7587. setup(__props) {
  7588. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7589. xmlns: "http://www.w3.org/2000/svg",
  7590. viewBox: "0 0 1024 1024"
  7591. }, [
  7592. vue.createElementVNode("path", {
  7593. fill: "currentColor",
  7594. d: "M176 416a112 112 0 1 1 0 224 112 112 0 0 1 0-224m336 0a112 112 0 1 1 0 224 112 112 0 0 1 0-224m336 0a112 112 0 1 1 0 224 112 112 0 0 1 0-224"
  7595. })
  7596. ]));
  7597. }
  7598. });
  7599. var more_filled_default = more_filled_vue_vue_type_script_setup_true_lang_default;
  7600. var more_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7601. name: "More",
  7602. __name: "more",
  7603. setup(__props) {
  7604. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7605. xmlns: "http://www.w3.org/2000/svg",
  7606. viewBox: "0 0 1024 1024"
  7607. }, [
  7608. vue.createElementVNode("path", {
  7609. fill: "currentColor",
  7610. d: "M176 416a112 112 0 1 0 0 224 112 112 0 0 0 0-224m0 64a48 48 0 1 1 0 96 48 48 0 0 1 0-96m336-64a112 112 0 1 1 0 224 112 112 0 0 1 0-224m0 64a48 48 0 1 0 0 96 48 48 0 0 0 0-96m336-64a112 112 0 1 1 0 224 112 112 0 0 1 0-224m0 64a48 48 0 1 0 0 96 48 48 0 0 0 0-96"
  7611. })
  7612. ]));
  7613. }
  7614. });
  7615. var more_default = more_vue_vue_type_script_setup_true_lang_default;
  7616. var picture_filled_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7617. name: "PictureFilled",
  7618. __name: "picture-filled",
  7619. setup(__props) {
  7620. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7621. xmlns: "http://www.w3.org/2000/svg",
  7622. viewBox: "0 0 1024 1024"
  7623. }, [
  7624. vue.createElementVNode("path", {
  7625. fill: "currentColor",
  7626. d: "M96 896a32 32 0 0 1-32-32V160a32 32 0 0 1 32-32h832a32 32 0 0 1 32 32v704a32 32 0 0 1-32 32zm315.52-228.48-68.928-68.928a32 32 0 0 0-45.248 0L128 768.064h778.688l-242.112-290.56a32 32 0 0 0-49.216 0L458.752 665.408a32 32 0 0 1-47.232 2.112M256 384a96 96 0 1 0 192.064-.064A96 96 0 0 0 256 384"
  7627. })
  7628. ]));
  7629. }
  7630. });
  7631. var picture_filled_default = picture_filled_vue_vue_type_script_setup_true_lang_default;
  7632. var plus_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7633. name: "Plus",
  7634. __name: "plus",
  7635. setup(__props) {
  7636. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7637. xmlns: "http://www.w3.org/2000/svg",
  7638. viewBox: "0 0 1024 1024"
  7639. }, [
  7640. vue.createElementVNode("path", {
  7641. fill: "currentColor",
  7642. d: "M480 480V128a32 32 0 0 1 64 0v352h352a32 32 0 1 1 0 64H544v352a32 32 0 1 1-64 0V544H128a32 32 0 0 1 0-64z"
  7643. })
  7644. ]));
  7645. }
  7646. });
  7647. var plus_default = plus_vue_vue_type_script_setup_true_lang_default;
  7648. var question_filled_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7649. name: "QuestionFilled",
  7650. __name: "question-filled",
  7651. setup(__props) {
  7652. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7653. xmlns: "http://www.w3.org/2000/svg",
  7654. viewBox: "0 0 1024 1024"
  7655. }, [
  7656. vue.createElementVNode("path", {
  7657. fill: "currentColor",
  7658. d: "M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m23.744 191.488c-52.096 0-92.928 14.784-123.2 44.352-30.976 29.568-45.76 70.4-45.76 122.496h80.256c0-29.568 5.632-52.8 17.6-68.992 13.376-19.712 35.2-28.864 66.176-28.864 23.936 0 42.944 6.336 56.32 19.712 12.672 13.376 19.712 31.68 19.712 54.912 0 17.6-6.336 34.496-19.008 49.984l-8.448 9.856c-45.76 40.832-73.216 70.4-82.368 89.408-9.856 19.008-14.08 42.24-14.08 68.992v9.856h80.96v-9.856c0-16.896 3.52-31.68 10.56-45.76 6.336-12.672 15.488-24.64 28.16-35.2 33.792-29.568 54.208-48.576 60.544-55.616 16.896-22.528 26.048-51.392 26.048-86.592 0-42.944-14.08-76.736-42.24-101.376-28.16-25.344-65.472-37.312-111.232-37.312zm-12.672 406.208a54.272 54.272 0 0 0-38.72 14.784 49.408 49.408 0 0 0-15.488 38.016c0 15.488 4.928 28.16 15.488 38.016A54.848 54.848 0 0 0 523.072 768c15.488 0 28.16-4.928 38.72-14.784a51.52 51.52 0 0 0 16.192-38.72 51.968 51.968 0 0 0-15.488-38.016 55.936 55.936 0 0 0-39.424-14.784z"
  7659. })
  7660. ]));
  7661. }
  7662. });
  7663. var question_filled_default = question_filled_vue_vue_type_script_setup_true_lang_default;
  7664. var refresh_left_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7665. name: "RefreshLeft",
  7666. __name: "refresh-left",
  7667. setup(__props) {
  7668. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7669. xmlns: "http://www.w3.org/2000/svg",
  7670. viewBox: "0 0 1024 1024"
  7671. }, [
  7672. vue.createElementVNode("path", {
  7673. fill: "currentColor",
  7674. d: "M289.088 296.704h92.992a32 32 0 0 1 0 64H232.96a32 32 0 0 1-32-32V179.712a32 32 0 0 1 64 0v50.56a384 384 0 0 1 643.84 282.88 384 384 0 0 1-383.936 384 384 384 0 0 1-384-384h64a320 320 0 1 0 640 0 320 320 0 0 0-555.712-216.448z"
  7675. })
  7676. ]));
  7677. }
  7678. });
  7679. var refresh_left_default = refresh_left_vue_vue_type_script_setup_true_lang_default;
  7680. var refresh_right_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7681. name: "RefreshRight",
  7682. __name: "refresh-right",
  7683. setup(__props) {
  7684. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7685. xmlns: "http://www.w3.org/2000/svg",
  7686. viewBox: "0 0 1024 1024"
  7687. }, [
  7688. vue.createElementVNode("path", {
  7689. fill: "currentColor",
  7690. d: "M784.512 230.272v-50.56a32 32 0 1 1 64 0v149.056a32 32 0 0 1-32 32H667.52a32 32 0 1 1 0-64h92.992A320 320 0 1 0 524.8 833.152a320 320 0 0 0 320-320h64a384 384 0 0 1-384 384 384 384 0 0 1-384-384 384 384 0 0 1 643.712-282.88z"
  7691. })
  7692. ]));
  7693. }
  7694. });
  7695. var refresh_right_default = refresh_right_vue_vue_type_script_setup_true_lang_default;
  7696. var scale_to_original_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7697. name: "ScaleToOriginal",
  7698. __name: "scale-to-original",
  7699. setup(__props) {
  7700. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7701. xmlns: "http://www.w3.org/2000/svg",
  7702. viewBox: "0 0 1024 1024"
  7703. }, [
  7704. vue.createElementVNode("path", {
  7705. fill: "currentColor",
  7706. d: "M813.176 180.706a60.235 60.235 0 0 1 60.236 60.235v481.883a60.235 60.235 0 0 1-60.236 60.235H210.824a60.235 60.235 0 0 1-60.236-60.235V240.94a60.235 60.235 0 0 1 60.236-60.235h602.352zm0-60.235H210.824A120.47 120.47 0 0 0 90.353 240.94v481.883a120.47 120.47 0 0 0 120.47 120.47h602.353a120.47 120.47 0 0 0 120.471-120.47V240.94a120.47 120.47 0 0 0-120.47-120.47zm-120.47 180.705a30.118 30.118 0 0 0-30.118 30.118v301.177a30.118 30.118 0 0 0 60.236 0V331.294a30.118 30.118 0 0 0-30.118-30.118zm-361.412 0a30.118 30.118 0 0 0-30.118 30.118v301.177a30.118 30.118 0 1 0 60.236 0V331.294a30.118 30.118 0 0 0-30.118-30.118M512 361.412a30.118 30.118 0 0 0-30.118 30.117v30.118a30.118 30.118 0 0 0 60.236 0V391.53A30.118 30.118 0 0 0 512 361.412M512 512a30.118 30.118 0 0 0-30.118 30.118v30.117a30.118 30.118 0 0 0 60.236 0v-30.117A30.118 30.118 0 0 0 512 512"
  7707. })
  7708. ]));
  7709. }
  7710. });
  7711. var scale_to_original_default = scale_to_original_vue_vue_type_script_setup_true_lang_default;
  7712. var search_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7713. name: "Search",
  7714. __name: "search",
  7715. setup(__props) {
  7716. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7717. xmlns: "http://www.w3.org/2000/svg",
  7718. viewBox: "0 0 1024 1024"
  7719. }, [
  7720. vue.createElementVNode("path", {
  7721. fill: "currentColor",
  7722. d: "m795.904 750.72 124.992 124.928a32 32 0 0 1-45.248 45.248L750.656 795.904a416 416 0 1 1 45.248-45.248zM480 832a352 352 0 1 0 0-704 352 352 0 0 0 0 704"
  7723. })
  7724. ]));
  7725. }
  7726. });
  7727. var search_default = search_vue_vue_type_script_setup_true_lang_default;
  7728. var sort_down_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7729. name: "SortDown",
  7730. __name: "sort-down",
  7731. setup(__props) {
  7732. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7733. xmlns: "http://www.w3.org/2000/svg",
  7734. viewBox: "0 0 1024 1024"
  7735. }, [
  7736. vue.createElementVNode("path", {
  7737. fill: "currentColor",
  7738. d: "M576 96v709.568L333.312 562.816A32 32 0 1 0 288 608l297.408 297.344A32 32 0 0 0 640 882.688V96a32 32 0 0 0-64 0"
  7739. })
  7740. ]));
  7741. }
  7742. });
  7743. var sort_down_default = sort_down_vue_vue_type_script_setup_true_lang_default;
  7744. var sort_up_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7745. name: "SortUp",
  7746. __name: "sort-up",
  7747. setup(__props) {
  7748. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7749. xmlns: "http://www.w3.org/2000/svg",
  7750. viewBox: "0 0 1024 1024"
  7751. }, [
  7752. vue.createElementVNode("path", {
  7753. fill: "currentColor",
  7754. d: "M384 141.248V928a32 32 0 1 0 64 0V218.56l242.688 242.688A32 32 0 1 0 736 416L438.592 118.656A32 32 0 0 0 384 141.248"
  7755. })
  7756. ]));
  7757. }
  7758. });
  7759. var sort_up_default = sort_up_vue_vue_type_script_setup_true_lang_default;
  7760. var star_filled_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7761. name: "StarFilled",
  7762. __name: "star-filled",
  7763. setup(__props) {
  7764. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7765. xmlns: "http://www.w3.org/2000/svg",
  7766. viewBox: "0 0 1024 1024"
  7767. }, [
  7768. vue.createElementVNode("path", {
  7769. fill: "currentColor",
  7770. d: "M283.84 867.84 512 747.776l228.16 119.936a6.4 6.4 0 0 0 9.28-6.72l-43.52-254.08 184.512-179.904a6.4 6.4 0 0 0-3.52-10.88l-255.104-37.12L517.76 147.904a6.4 6.4 0 0 0-11.52 0L392.192 379.072l-255.104 37.12a6.4 6.4 0 0 0-3.52 10.88L318.08 606.976l-43.584 254.08a6.4 6.4 0 0 0 9.28 6.72z"
  7771. })
  7772. ]));
  7773. }
  7774. });
  7775. var star_filled_default = star_filled_vue_vue_type_script_setup_true_lang_default;
  7776. var star_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7777. name: "Star",
  7778. __name: "star",
  7779. setup(__props) {
  7780. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7781. xmlns: "http://www.w3.org/2000/svg",
  7782. viewBox: "0 0 1024 1024"
  7783. }, [
  7784. vue.createElementVNode("path", {
  7785. fill: "currentColor",
  7786. d: "m512 747.84 228.16 119.936a6.4 6.4 0 0 0 9.28-6.72l-43.52-254.08 184.512-179.904a6.4 6.4 0 0 0-3.52-10.88l-255.104-37.12L517.76 147.904a6.4 6.4 0 0 0-11.52 0L392.192 379.072l-255.104 37.12a6.4 6.4 0 0 0-3.52 10.88L318.08 606.976l-43.584 254.08a6.4 6.4 0 0 0 9.28 6.72zM313.6 924.48a70.4 70.4 0 0 1-102.144-74.24l37.888-220.928L88.96 472.96A70.4 70.4 0 0 1 128 352.896l221.76-32.256 99.2-200.96a70.4 70.4 0 0 1 126.208 0l99.2 200.96 221.824 32.256a70.4 70.4 0 0 1 39.04 120.064L774.72 629.376l37.888 220.928a70.4 70.4 0 0 1-102.144 74.24L512 820.096l-198.4 104.32z"
  7787. })
  7788. ]));
  7789. }
  7790. });
  7791. var star_default = star_vue_vue_type_script_setup_true_lang_default;
  7792. var success_filled_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7793. name: "SuccessFilled",
  7794. __name: "success-filled",
  7795. setup(__props) {
  7796. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7797. xmlns: "http://www.w3.org/2000/svg",
  7798. viewBox: "0 0 1024 1024"
  7799. }, [
  7800. vue.createElementVNode("path", {
  7801. fill: "currentColor",
  7802. d: "M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m-55.808 536.384-99.52-99.584a38.4 38.4 0 1 0-54.336 54.336l126.72 126.72a38.272 38.272 0 0 0 54.336 0l262.4-262.464a38.4 38.4 0 1 0-54.272-54.336z"
  7803. })
  7804. ]));
  7805. }
  7806. });
  7807. var success_filled_default = success_filled_vue_vue_type_script_setup_true_lang_default;
  7808. var view_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7809. name: "View",
  7810. __name: "view",
  7811. setup(__props) {
  7812. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7813. xmlns: "http://www.w3.org/2000/svg",
  7814. viewBox: "0 0 1024 1024"
  7815. }, [
  7816. vue.createElementVNode("path", {
  7817. fill: "currentColor",
  7818. d: "M512 160c320 0 512 352 512 352S832 864 512 864 0 512 0 512s192-352 512-352m0 64c-225.28 0-384.128 208.064-436.8 288 52.608 79.872 211.456 288 436.8 288 225.28 0 384.128-208.064 436.8-288-52.608-79.872-211.456-288-436.8-288zm0 64a224 224 0 1 1 0 448 224 224 0 0 1 0-448m0 64a160.192 160.192 0 0 0-160 160c0 88.192 71.744 160 160 160s160-71.808 160-160-71.744-160-160-160"
  7819. })
  7820. ]));
  7821. }
  7822. });
  7823. var view_default = view_vue_vue_type_script_setup_true_lang_default;
  7824. var warning_filled_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7825. name: "WarningFilled",
  7826. __name: "warning-filled",
  7827. setup(__props) {
  7828. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7829. xmlns: "http://www.w3.org/2000/svg",
  7830. viewBox: "0 0 1024 1024"
  7831. }, [
  7832. vue.createElementVNode("path", {
  7833. fill: "currentColor",
  7834. d: "M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m0 192a58.432 58.432 0 0 0-58.24 63.744l23.36 256.384a35.072 35.072 0 0 0 69.76 0l23.296-256.384A58.432 58.432 0 0 0 512 256m0 512a51.2 51.2 0 1 0 0-102.4 51.2 51.2 0 0 0 0 102.4"
  7835. })
  7836. ]));
  7837. }
  7838. });
  7839. var warning_filled_default = warning_filled_vue_vue_type_script_setup_true_lang_default;
  7840. var zoom_in_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7841. name: "ZoomIn",
  7842. __name: "zoom-in",
  7843. setup(__props) {
  7844. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7845. xmlns: "http://www.w3.org/2000/svg",
  7846. viewBox: "0 0 1024 1024"
  7847. }, [
  7848. vue.createElementVNode("path", {
  7849. fill: "currentColor",
  7850. d: "m795.904 750.72 124.992 124.928a32 32 0 0 1-45.248 45.248L750.656 795.904a416 416 0 1 1 45.248-45.248zM480 832a352 352 0 1 0 0-704 352 352 0 0 0 0 704m-32-384v-96a32 32 0 0 1 64 0v96h96a32 32 0 0 1 0 64h-96v96a32 32 0 0 1-64 0v-96h-96a32 32 0 0 1 0-64z"
  7851. })
  7852. ]));
  7853. }
  7854. });
  7855. var zoom_in_default = zoom_in_vue_vue_type_script_setup_true_lang_default;
  7856. var zoom_out_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ vue.defineComponent({
  7857. name: "ZoomOut",
  7858. __name: "zoom-out",
  7859. setup(__props) {
  7860. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7861. xmlns: "http://www.w3.org/2000/svg",
  7862. viewBox: "0 0 1024 1024"
  7863. }, [
  7864. vue.createElementVNode("path", {
  7865. fill: "currentColor",
  7866. d: "m795.904 750.72 124.992 124.928a32 32 0 0 1-45.248 45.248L750.656 795.904a416 416 0 1 1 45.248-45.248zM480 832a352 352 0 1 0 0-704 352 352 0 0 0 0 704M352 448h256a32 32 0 0 1 0 64H352a32 32 0 0 1 0-64"
  7867. })
  7868. ]));
  7869. }
  7870. });
  7871. var zoom_out_default = zoom_out_vue_vue_type_script_setup_true_lang_default;
  7872. /*! Element Plus Icons Vue v2.3.1 */
  7873. const epPropKey = "__epPropKey";
  7874. const definePropType = (val) => val;
  7875. const isEpProp = (val) => isObject$1(val) && !!val[epPropKey];
  7876. const buildProp = (prop, key) => {
  7877. if (!isObject$1(prop) || isEpProp(prop))
  7878. return prop;
  7879. const { values, required, default: defaultValue, type, validator } = prop;
  7880. const _validator = values || validator ? (val) => {
  7881. let valid = false;
  7882. let allowedValues = [];
  7883. if (values) {
  7884. allowedValues = Array.from(values);
  7885. if (hasOwn(prop, "default")) {
  7886. allowedValues.push(defaultValue);
  7887. }
  7888. valid || (valid = allowedValues.includes(val));
  7889. }
  7890. if (validator)
  7891. valid || (valid = validator(val));
  7892. if (!valid && allowedValues.length > 0) {
  7893. const allowValuesText = [...new Set(allowedValues)].map((value) => JSON.stringify(value)).join(", ");
  7894. vue.warn(`Invalid prop: validation failed${key ? ` for prop "${key}"` : ""}. Expected one of [${allowValuesText}], got value ${JSON.stringify(val)}.`);
  7895. }
  7896. return valid;
  7897. } : void 0;
  7898. const epProp = {
  7899. type,
  7900. required: !!required,
  7901. validator: _validator,
  7902. [epPropKey]: true
  7903. };
  7904. if (hasOwn(prop, "default"))
  7905. epProp.default = defaultValue;
  7906. return epProp;
  7907. };
  7908. const buildProps = (props) => fromPairs(Object.entries(props).map(([key, option]) => [
  7909. key,
  7910. buildProp(option, key)
  7911. ]));
  7912. const iconPropType = definePropType([
  7913. String,
  7914. Object,
  7915. Function
  7916. ]);
  7917. const CloseComponents = {
  7918. Close: close_default
  7919. };
  7920. const TypeComponents = {
  7921. Close: close_default,
  7922. SuccessFilled: success_filled_default,
  7923. InfoFilled: info_filled_default,
  7924. WarningFilled: warning_filled_default,
  7925. CircleCloseFilled: circle_close_filled_default
  7926. };
  7927. const TypeComponentsMap = {
  7928. success: success_filled_default,
  7929. warning: warning_filled_default,
  7930. error: circle_close_filled_default,
  7931. info: info_filled_default
  7932. };
  7933. const ValidateComponentsMap = {
  7934. validating: loading_default,
  7935. success: circle_check_default,
  7936. error: circle_close_default
  7937. };
  7938. const withInstall = (main, extra) => {
  7939. main.install = (app) => {
  7940. for (const comp of [main, ...Object.values(extra != null ? extra : {})]) {
  7941. app.component(comp.name, comp);
  7942. }
  7943. };
  7944. if (extra) {
  7945. for (const [key, comp] of Object.entries(extra)) {
  7946. main[key] = comp;
  7947. }
  7948. }
  7949. return main;
  7950. };
  7951. const withInstallFunction = (fn, name) => {
  7952. fn.install = (app) => {
  7953. fn._context = app._context;
  7954. app.config.globalProperties[name] = fn;
  7955. };
  7956. return fn;
  7957. };
  7958. const withInstallDirective = (directive, name) => {
  7959. directive.install = (app) => {
  7960. app.directive(name, directive);
  7961. };
  7962. return directive;
  7963. };
  7964. const withNoopInstall = (component) => {
  7965. component.install = NOOP;
  7966. return component;
  7967. };
  7968. const composeRefs = (...refs) => {
  7969. return (el) => {
  7970. refs.forEach((ref) => {
  7971. if (isFunction$1(ref)) {
  7972. ref(el);
  7973. } else {
  7974. ref.value = el;
  7975. }
  7976. });
  7977. };
  7978. };
  7979. const EVENT_CODE = {
  7980. tab: "Tab",
  7981. enter: "Enter",
  7982. space: "Space",
  7983. left: "ArrowLeft",
  7984. up: "ArrowUp",
  7985. right: "ArrowRight",
  7986. down: "ArrowDown",
  7987. esc: "Escape",
  7988. delete: "Delete",
  7989. backspace: "Backspace",
  7990. numpadEnter: "NumpadEnter",
  7991. pageUp: "PageUp",
  7992. pageDown: "PageDown",
  7993. home: "Home",
  7994. end: "End"
  7995. };
  7996. const datePickTypes = [
  7997. "year",
  7998. "years",
  7999. "month",
  8000. "months",
  8001. "date",
  8002. "dates",
  8003. "week",
  8004. "datetime",
  8005. "datetimerange",
  8006. "daterange",
  8007. "monthrange",
  8008. "yearrange"
  8009. ];
  8010. const WEEK_DAYS = [
  8011. "sun",
  8012. "mon",
  8013. "tue",
  8014. "wed",
  8015. "thu",
  8016. "fri",
  8017. "sat"
  8018. ];
  8019. const UPDATE_MODEL_EVENT = "update:modelValue";
  8020. const CHANGE_EVENT = "change";
  8021. const INPUT_EVENT = "input";
  8022. const INSTALLED_KEY = Symbol("INSTALLED_KEY");
  8023. const componentSizes = ["", "default", "small", "large"];
  8024. const componentSizeMap = {
  8025. large: 40,
  8026. default: 32,
  8027. small: 24
  8028. };
  8029. const isValidComponentSize = (val) => ["", ...componentSizes].includes(val);
  8030. var PatchFlags = /* @__PURE__ */ ((PatchFlags2) => {
  8031. PatchFlags2[PatchFlags2["TEXT"] = 1] = "TEXT";
  8032. PatchFlags2[PatchFlags2["CLASS"] = 2] = "CLASS";
  8033. PatchFlags2[PatchFlags2["STYLE"] = 4] = "STYLE";
  8034. PatchFlags2[PatchFlags2["PROPS"] = 8] = "PROPS";
  8035. PatchFlags2[PatchFlags2["FULL_PROPS"] = 16] = "FULL_PROPS";
  8036. PatchFlags2[PatchFlags2["HYDRATE_EVENTS"] = 32] = "HYDRATE_EVENTS";
  8037. PatchFlags2[PatchFlags2["STABLE_FRAGMENT"] = 64] = "STABLE_FRAGMENT";
  8038. PatchFlags2[PatchFlags2["KEYED_FRAGMENT"] = 128] = "KEYED_FRAGMENT";
  8039. PatchFlags2[PatchFlags2["UNKEYED_FRAGMENT"] = 256] = "UNKEYED_FRAGMENT";
  8040. PatchFlags2[PatchFlags2["NEED_PATCH"] = 512] = "NEED_PATCH";
  8041. PatchFlags2[PatchFlags2["DYNAMIC_SLOTS"] = 1024] = "DYNAMIC_SLOTS";
  8042. PatchFlags2[PatchFlags2["HOISTED"] = -1] = "HOISTED";
  8043. PatchFlags2[PatchFlags2["BAIL"] = -2] = "BAIL";
  8044. return PatchFlags2;
  8045. })(PatchFlags || {});
  8046. function isFragment(node) {
  8047. return vue.isVNode(node) && node.type === vue.Fragment;
  8048. }
  8049. function isComment(node) {
  8050. return vue.isVNode(node) && node.type === vue.Comment;
  8051. }
  8052. function isValidElementNode(node) {
  8053. return vue.isVNode(node) && !isFragment(node) && !isComment(node);
  8054. }
  8055. const getNormalizedProps = (node) => {
  8056. if (!vue.isVNode(node)) {
  8057. return {};
  8058. }
  8059. const raw = node.props || {};
  8060. const type = (vue.isVNode(node.type) ? node.type.props : void 0) || {};
  8061. const props = {};
  8062. Object.keys(type).forEach((key) => {
  8063. if (hasOwn(type[key], "default")) {
  8064. props[key] = type[key].default;
  8065. }
  8066. });
  8067. Object.keys(raw).forEach((key) => {
  8068. props[camelize(key)] = raw[key];
  8069. });
  8070. return props;
  8071. };
  8072. const ensureOnlyChild = (children) => {
  8073. if (!isArray$1(children) || children.length > 1) {
  8074. throw new Error("expect to receive a single Vue element child");
  8075. }
  8076. return children[0];
  8077. };
  8078. const flattedChildren = (children) => {
  8079. const vNodes = isArray$1(children) ? children : [children];
  8080. const result = [];
  8081. vNodes.forEach((child) => {
  8082. var _a;
  8083. if (isArray$1(child)) {
  8084. result.push(...flattedChildren(child));
  8085. } else if (vue.isVNode(child) && ((_a = child.component) == null ? void 0 : _a.subTree)) {
  8086. result.push(child, ...flattedChildren(child.component.subTree));
  8087. } else if (vue.isVNode(child) && isArray$1(child.children)) {
  8088. result.push(...flattedChildren(child.children));
  8089. } else {
  8090. result.push(child);
  8091. }
  8092. });
  8093. return result;
  8094. };
  8095. const unique = (arr) => [...new Set(arr)];
  8096. const castArray = (arr) => {
  8097. if (!arr && arr !== 0)
  8098. return [];
  8099. return isArray$1(arr) ? arr : [arr];
  8100. };
  8101. const isKorean = (text) => /([\uAC00-\uD7AF\u3130-\u318F])+/gi.test(text);
  8102. const mutable = (val) => val;
  8103. function throttleByRaf(cb) {
  8104. let timer = 0;
  8105. const throttle = (...args) => {
  8106. if (timer) {
  8107. cAF(timer);
  8108. }
  8109. timer = rAF(() => {
  8110. cb(...args);
  8111. timer = 0;
  8112. });
  8113. };
  8114. throttle.cancel = () => {
  8115. cAF(timer);
  8116. timer = 0;
  8117. };
  8118. return throttle;
  8119. }
  8120. const DEFAULT_EXCLUDE_KEYS = ["class", "style"];
  8121. const LISTENER_PREFIX = /^on[A-Z]/;
  8122. const useAttrs = (params = {}) => {
  8123. const { excludeListeners = false, excludeKeys } = params;
  8124. const allExcludeKeys = vue.computed(() => {
  8125. return ((excludeKeys == null ? void 0 : excludeKeys.value) || []).concat(DEFAULT_EXCLUDE_KEYS);
  8126. });
  8127. const instance = vue.getCurrentInstance();
  8128. if (!instance) {
  8129. return vue.computed(() => ({}));
  8130. }
  8131. return vue.computed(() => {
  8132. var _a;
  8133. return fromPairs(Object.entries((_a = instance.proxy) == null ? void 0 : _a.$attrs).filter(([key]) => !allExcludeKeys.value.includes(key) && !(excludeListeners && LISTENER_PREFIX.test(key))));
  8134. });
  8135. };
  8136. function useCalcInputWidth() {
  8137. const calculatorRef = vue.shallowRef();
  8138. const calculatorWidth = vue.ref(0);
  8139. const MINIMUM_INPUT_WIDTH = 11;
  8140. const inputStyle = vue.computed(() => ({
  8141. minWidth: `${Math.max(calculatorWidth.value, MINIMUM_INPUT_WIDTH)}px`
  8142. }));
  8143. const resetCalculatorWidth = () => {
  8144. var _a, _b;
  8145. calculatorWidth.value = (_b = (_a = calculatorRef.value) == null ? void 0 : _a.getBoundingClientRect().width) != null ? _b : 0;
  8146. };
  8147. useResizeObserver(calculatorRef, resetCalculatorWidth);
  8148. return {
  8149. calculatorRef,
  8150. calculatorWidth,
  8151. inputStyle
  8152. };
  8153. }
  8154. const useDeprecated = ({ from, replacement, scope, version, ref, type = "API" }, condition) => {
  8155. vue.watch(() => vue.unref(condition), (val) => {
  8156. }, {
  8157. immediate: true
  8158. });
  8159. };
  8160. const useDraggable = (targetRef, dragRef, draggable, overflow) => {
  8161. let transform = {
  8162. offsetX: 0,
  8163. offsetY: 0
  8164. };
  8165. const onMousedown = (e) => {
  8166. const downX = e.clientX;
  8167. const downY = e.clientY;
  8168. const { offsetX, offsetY } = transform;
  8169. const targetRect = targetRef.value.getBoundingClientRect();
  8170. const targetLeft = targetRect.left;
  8171. const targetTop = targetRect.top;
  8172. const targetWidth = targetRect.width;
  8173. const targetHeight = targetRect.height;
  8174. const clientWidth = document.documentElement.clientWidth;
  8175. const clientHeight = document.documentElement.clientHeight;
  8176. const minLeft = -targetLeft + offsetX;
  8177. const minTop = -targetTop + offsetY;
  8178. const maxLeft = clientWidth - targetLeft - targetWidth + offsetX;
  8179. const maxTop = clientHeight - targetTop - targetHeight + offsetY;
  8180. const onMousemove = (e2) => {
  8181. let moveX = offsetX + e2.clientX - downX;
  8182. let moveY = offsetY + e2.clientY - downY;
  8183. if (!(overflow == null ? void 0 : overflow.value)) {
  8184. moveX = Math.min(Math.max(moveX, minLeft), maxLeft);
  8185. moveY = Math.min(Math.max(moveY, minTop), maxTop);
  8186. }
  8187. transform = {
  8188. offsetX: moveX,
  8189. offsetY: moveY
  8190. };
  8191. if (targetRef.value) {
  8192. targetRef.value.style.transform = `translate(${addUnit(moveX)}, ${addUnit(moveY)})`;
  8193. }
  8194. };
  8195. const onMouseup = () => {
  8196. document.removeEventListener("mousemove", onMousemove);
  8197. document.removeEventListener("mouseup", onMouseup);
  8198. };
  8199. document.addEventListener("mousemove", onMousemove);
  8200. document.addEventListener("mouseup", onMouseup);
  8201. };
  8202. const onDraggable = () => {
  8203. if (dragRef.value && targetRef.value) {
  8204. dragRef.value.addEventListener("mousedown", onMousedown);
  8205. }
  8206. };
  8207. const offDraggable = () => {
  8208. if (dragRef.value && targetRef.value) {
  8209. dragRef.value.removeEventListener("mousedown", onMousedown);
  8210. }
  8211. };
  8212. const resetPosition = () => {
  8213. transform = {
  8214. offsetX: 0,
  8215. offsetY: 0
  8216. };
  8217. if (targetRef.value) {
  8218. targetRef.value.style.transform = "none";
  8219. }
  8220. };
  8221. vue.onMounted(() => {
  8222. vue.watchEffect(() => {
  8223. if (draggable.value) {
  8224. onDraggable();
  8225. } else {
  8226. offDraggable();
  8227. }
  8228. });
  8229. });
  8230. vue.onBeforeUnmount(() => {
  8231. offDraggable();
  8232. });
  8233. return {
  8234. resetPosition
  8235. };
  8236. };
  8237. const useFocus = (el) => {
  8238. return {
  8239. focus: () => {
  8240. var _a, _b;
  8241. (_b = (_a = el.value) == null ? void 0 : _a.focus) == null ? void 0 : _b.call(_a);
  8242. }
  8243. };
  8244. };
  8245. var English = {
  8246. name: "en",
  8247. el: {
  8248. breadcrumb: {
  8249. label: "Breadcrumb"
  8250. },
  8251. colorpicker: {
  8252. confirm: "OK",
  8253. clear: "Clear",
  8254. defaultLabel: "color picker",
  8255. description: "current color is {color}. press enter to select a new color.",
  8256. alphaLabel: "pick alpha value"
  8257. },
  8258. datepicker: {
  8259. now: "Now",
  8260. today: "Today",
  8261. cancel: "Cancel",
  8262. clear: "Clear",
  8263. confirm: "OK",
  8264. dateTablePrompt: "Use the arrow keys and enter to select the day of the month",
  8265. monthTablePrompt: "Use the arrow keys and enter to select the month",
  8266. yearTablePrompt: "Use the arrow keys and enter to select the year",
  8267. selectedDate: "Selected date",
  8268. selectDate: "Select date",
  8269. selectTime: "Select time",
  8270. startDate: "Start Date",
  8271. startTime: "Start Time",
  8272. endDate: "End Date",
  8273. endTime: "End Time",
  8274. prevYear: "Previous Year",
  8275. nextYear: "Next Year",
  8276. prevMonth: "Previous Month",
  8277. nextMonth: "Next Month",
  8278. year: "",
  8279. month1: "January",
  8280. month2: "February",
  8281. month3: "March",
  8282. month4: "April",
  8283. month5: "May",
  8284. month6: "June",
  8285. month7: "July",
  8286. month8: "August",
  8287. month9: "September",
  8288. month10: "October",
  8289. month11: "November",
  8290. month12: "December",
  8291. week: "week",
  8292. weeks: {
  8293. sun: "Sun",
  8294. mon: "Mon",
  8295. tue: "Tue",
  8296. wed: "Wed",
  8297. thu: "Thu",
  8298. fri: "Fri",
  8299. sat: "Sat"
  8300. },
  8301. weeksFull: {
  8302. sun: "Sunday",
  8303. mon: "Monday",
  8304. tue: "Tuesday",
  8305. wed: "Wednesday",
  8306. thu: "Thursday",
  8307. fri: "Friday",
  8308. sat: "Saturday"
  8309. },
  8310. months: {
  8311. jan: "Jan",
  8312. feb: "Feb",
  8313. mar: "Mar",
  8314. apr: "Apr",
  8315. may: "May",
  8316. jun: "Jun",
  8317. jul: "Jul",
  8318. aug: "Aug",
  8319. sep: "Sep",
  8320. oct: "Oct",
  8321. nov: "Nov",
  8322. dec: "Dec"
  8323. }
  8324. },
  8325. inputNumber: {
  8326. decrease: "decrease number",
  8327. increase: "increase number"
  8328. },
  8329. select: {
  8330. loading: "Loading",
  8331. noMatch: "No matching data",
  8332. noData: "No data",
  8333. placeholder: "Select"
  8334. },
  8335. mention: {
  8336. loading: "Loading"
  8337. },
  8338. dropdown: {
  8339. toggleDropdown: "Toggle Dropdown"
  8340. },
  8341. cascader: {
  8342. noMatch: "No matching data",
  8343. loading: "Loading",
  8344. placeholder: "Select",
  8345. noData: "No data"
  8346. },
  8347. pagination: {
  8348. goto: "Go to",
  8349. pagesize: "/page",
  8350. total: "Total {total}",
  8351. pageClassifier: "",
  8352. page: "Page",
  8353. prev: "Go to previous page",
  8354. next: "Go to next page",
  8355. currentPage: "page {pager}",
  8356. prevPages: "Previous {pager} pages",
  8357. nextPages: "Next {pager} pages",
  8358. deprecationWarning: "Deprecated usages detected, please refer to the el-pagination documentation for more details"
  8359. },
  8360. dialog: {
  8361. close: "Close this dialog"
  8362. },
  8363. drawer: {
  8364. close: "Close this dialog"
  8365. },
  8366. messagebox: {
  8367. title: "Message",
  8368. confirm: "OK",
  8369. cancel: "Cancel",
  8370. error: "Illegal input",
  8371. close: "Close this dialog"
  8372. },
  8373. upload: {
  8374. deleteTip: "press delete to remove",
  8375. delete: "Delete",
  8376. preview: "Preview",
  8377. continue: "Continue"
  8378. },
  8379. slider: {
  8380. defaultLabel: "slider between {min} and {max}",
  8381. defaultRangeStartLabel: "pick start value",
  8382. defaultRangeEndLabel: "pick end value"
  8383. },
  8384. table: {
  8385. emptyText: "No Data",
  8386. confirmFilter: "Confirm",
  8387. resetFilter: "Reset",
  8388. clearFilter: "All",
  8389. sumText: "Sum"
  8390. },
  8391. tour: {
  8392. next: "Next",
  8393. previous: "Previous",
  8394. finish: "Finish"
  8395. },
  8396. tree: {
  8397. emptyText: "No Data"
  8398. },
  8399. transfer: {
  8400. noMatch: "No matching data",
  8401. noData: "No data",
  8402. titles: ["List 1", "List 2"],
  8403. filterPlaceholder: "Enter keyword",
  8404. noCheckedFormat: "{total} items",
  8405. hasCheckedFormat: "{checked}/{total} checked"
  8406. },
  8407. image: {
  8408. error: "FAILED"
  8409. },
  8410. pageHeader: {
  8411. title: "Back"
  8412. },
  8413. popconfirm: {
  8414. confirmButtonText: "Yes",
  8415. cancelButtonText: "No"
  8416. },
  8417. carousel: {
  8418. leftArrow: "Carousel arrow left",
  8419. rightArrow: "Carousel arrow right",
  8420. indicator: "Carousel switch to index {index}"
  8421. }
  8422. }
  8423. };
  8424. const buildTranslator = (locale) => (path, option) => translate(path, option, vue.unref(locale));
  8425. const translate = (path, option, locale) => get(locale, path, path).replace(/\{(\w+)\}/g, (_, key) => {
  8426. var _a;
  8427. return `${(_a = option == null ? void 0 : option[key]) != null ? _a : `{${key}}`}`;
  8428. });
  8429. const buildLocaleContext = (locale) => {
  8430. const lang = vue.computed(() => vue.unref(locale).name);
  8431. const localeRef = vue.isRef(locale) ? locale : vue.ref(locale);
  8432. return {
  8433. lang,
  8434. locale: localeRef,
  8435. t: buildTranslator(locale)
  8436. };
  8437. };
  8438. const localeContextKey = Symbol("localeContextKey");
  8439. const useLocale = (localeOverrides) => {
  8440. const locale = localeOverrides || vue.inject(localeContextKey, vue.ref());
  8441. return buildLocaleContext(vue.computed(() => locale.value || English));
  8442. };
  8443. const defaultNamespace = "el";
  8444. const statePrefix = "is-";
  8445. const _bem = (namespace, block, blockSuffix, element, modifier) => {
  8446. let cls = `${namespace}-${block}`;
  8447. if (blockSuffix) {
  8448. cls += `-${blockSuffix}`;
  8449. }
  8450. if (element) {
  8451. cls += `__${element}`;
  8452. }
  8453. if (modifier) {
  8454. cls += `--${modifier}`;
  8455. }
  8456. return cls;
  8457. };
  8458. const namespaceContextKey = Symbol("namespaceContextKey");
  8459. const useGetDerivedNamespace = (namespaceOverrides) => {
  8460. const derivedNamespace = namespaceOverrides || (vue.getCurrentInstance() ? vue.inject(namespaceContextKey, vue.ref(defaultNamespace)) : vue.ref(defaultNamespace));
  8461. const namespace = vue.computed(() => {
  8462. return vue.unref(derivedNamespace) || defaultNamespace;
  8463. });
  8464. return namespace;
  8465. };
  8466. const useNamespace = (block, namespaceOverrides) => {
  8467. const namespace = useGetDerivedNamespace(namespaceOverrides);
  8468. const b = (blockSuffix = "") => _bem(namespace.value, block, blockSuffix, "", "");
  8469. const e = (element) => element ? _bem(namespace.value, block, "", element, "") : "";
  8470. const m = (modifier) => modifier ? _bem(namespace.value, block, "", "", modifier) : "";
  8471. const be = (blockSuffix, element) => blockSuffix && element ? _bem(namespace.value, block, blockSuffix, element, "") : "";
  8472. const em = (element, modifier) => element && modifier ? _bem(namespace.value, block, "", element, modifier) : "";
  8473. const bm = (blockSuffix, modifier) => blockSuffix && modifier ? _bem(namespace.value, block, blockSuffix, "", modifier) : "";
  8474. const bem = (blockSuffix, element, modifier) => blockSuffix && element && modifier ? _bem(namespace.value, block, blockSuffix, element, modifier) : "";
  8475. const is = (name, ...args) => {
  8476. const state = args.length >= 1 ? args[0] : true;
  8477. return name && state ? `${statePrefix}${name}` : "";
  8478. };
  8479. const cssVar = (object) => {
  8480. const styles = {};
  8481. for (const key in object) {
  8482. if (object[key]) {
  8483. styles[`--${namespace.value}-${key}`] = object[key];
  8484. }
  8485. }
  8486. return styles;
  8487. };
  8488. const cssVarBlock = (object) => {
  8489. const styles = {};
  8490. for (const key in object) {
  8491. if (object[key]) {
  8492. styles[`--${namespace.value}-${block}-${key}`] = object[key];
  8493. }
  8494. }
  8495. return styles;
  8496. };
  8497. const cssVarName = (name) => `--${namespace.value}-${name}`;
  8498. const cssVarBlockName = (name) => `--${namespace.value}-${block}-${name}`;
  8499. return {
  8500. namespace,
  8501. b,
  8502. e,
  8503. m,
  8504. be,
  8505. em,
  8506. bm,
  8507. bem,
  8508. is,
  8509. cssVar,
  8510. cssVarName,
  8511. cssVarBlock,
  8512. cssVarBlockName
  8513. };
  8514. };
  8515. const useLockscreen = (trigger, options = {}) => {
  8516. if (!vue.isRef(trigger)) {
  8517. throwError("[useLockscreen]", "You need to pass a ref param to this function");
  8518. }
  8519. const ns = options.ns || useNamespace("popup");
  8520. const hiddenCls = vue.computed(() => ns.bm("parent", "hidden"));
  8521. if (!isClient || hasClass(document.body, hiddenCls.value)) {
  8522. return;
  8523. }
  8524. let scrollBarWidth = 0;
  8525. let withoutHiddenClass = false;
  8526. let bodyWidth = "0";
  8527. const cleanup = () => {
  8528. setTimeout(() => {
  8529. if (typeof document === "undefined")
  8530. return;
  8531. removeClass(document == null ? void 0 : document.body, hiddenCls.value);
  8532. if (withoutHiddenClass && document) {
  8533. document.body.style.width = bodyWidth;
  8534. }
  8535. }, 200);
  8536. };
  8537. vue.watch(trigger, (val) => {
  8538. if (!val) {
  8539. cleanup();
  8540. return;
  8541. }
  8542. withoutHiddenClass = !hasClass(document.body, hiddenCls.value);
  8543. if (withoutHiddenClass) {
  8544. bodyWidth = document.body.style.width;
  8545. }
  8546. scrollBarWidth = getScrollBarWidth(ns.namespace.value);
  8547. const bodyHasOverflow = document.documentElement.clientHeight < document.body.scrollHeight;
  8548. const bodyOverflowY = getStyle(document.body, "overflowY");
  8549. if (scrollBarWidth > 0 && (bodyHasOverflow || bodyOverflowY === "scroll") && withoutHiddenClass) {
  8550. document.body.style.width = `calc(100% - ${scrollBarWidth}px)`;
  8551. }
  8552. addClass(document.body, hiddenCls.value);
  8553. });
  8554. vue.onScopeDispose(() => cleanup());
  8555. };
  8556. const modalStack = [];
  8557. const closeModal = (e) => {
  8558. if (modalStack.length === 0)
  8559. return;
  8560. if (e.code === EVENT_CODE.esc) {
  8561. e.stopPropagation();
  8562. const topModal = modalStack[modalStack.length - 1];
  8563. topModal.handleClose();
  8564. }
  8565. };
  8566. const useModal = (instance, visibleRef) => {
  8567. vue.watch(visibleRef, (val) => {
  8568. if (val) {
  8569. modalStack.push(instance);
  8570. } else {
  8571. modalStack.splice(modalStack.indexOf(instance), 1);
  8572. }
  8573. });
  8574. };
  8575. if (isClient)
  8576. useEventListener(document, "keydown", closeModal);
  8577. const _prop = buildProp({
  8578. type: definePropType(Boolean),
  8579. default: null
  8580. });
  8581. const _event = buildProp({
  8582. type: definePropType(Function)
  8583. });
  8584. const createModelToggleComposable = (name) => {
  8585. const updateEventKey = `update:${name}`;
  8586. const updateEventKeyRaw = `onUpdate:${name}`;
  8587. const useModelToggleEmits2 = [updateEventKey];
  8588. const useModelToggleProps2 = {
  8589. [name]: _prop,
  8590. [updateEventKeyRaw]: _event
  8591. };
  8592. const useModelToggle2 = ({
  8593. indicator,
  8594. toggleReason,
  8595. shouldHideWhenRouteChanges,
  8596. shouldProceed,
  8597. onShow,
  8598. onHide
  8599. }) => {
  8600. const instance = vue.getCurrentInstance();
  8601. const { emit } = instance;
  8602. const props = instance.props;
  8603. const hasUpdateHandler = vue.computed(() => isFunction$1(props[updateEventKeyRaw]));
  8604. const isModelBindingAbsent = vue.computed(() => props[name] === null);
  8605. const doShow = (event) => {
  8606. if (indicator.value === true) {
  8607. return;
  8608. }
  8609. indicator.value = true;
  8610. if (toggleReason) {
  8611. toggleReason.value = event;
  8612. }
  8613. if (isFunction$1(onShow)) {
  8614. onShow(event);
  8615. }
  8616. };
  8617. const doHide = (event) => {
  8618. if (indicator.value === false) {
  8619. return;
  8620. }
  8621. indicator.value = false;
  8622. if (toggleReason) {
  8623. toggleReason.value = event;
  8624. }
  8625. if (isFunction$1(onHide)) {
  8626. onHide(event);
  8627. }
  8628. };
  8629. const show = (event) => {
  8630. if (props.disabled === true || isFunction$1(shouldProceed) && !shouldProceed())
  8631. return;
  8632. const shouldEmit = hasUpdateHandler.value && isClient;
  8633. if (shouldEmit) {
  8634. emit(updateEventKey, true);
  8635. }
  8636. if (isModelBindingAbsent.value || !shouldEmit) {
  8637. doShow(event);
  8638. }
  8639. };
  8640. const hide = (event) => {
  8641. if (props.disabled === true || !isClient)
  8642. return;
  8643. const shouldEmit = hasUpdateHandler.value && isClient;
  8644. if (shouldEmit) {
  8645. emit(updateEventKey, false);
  8646. }
  8647. if (isModelBindingAbsent.value || !shouldEmit) {
  8648. doHide(event);
  8649. }
  8650. };
  8651. const onChange = (val) => {
  8652. if (!isBoolean(val))
  8653. return;
  8654. if (props.disabled && val) {
  8655. if (hasUpdateHandler.value) {
  8656. emit(updateEventKey, false);
  8657. }
  8658. } else if (indicator.value !== val) {
  8659. if (val) {
  8660. doShow();
  8661. } else {
  8662. doHide();
  8663. }
  8664. }
  8665. };
  8666. const toggle = () => {
  8667. if (indicator.value) {
  8668. hide();
  8669. } else {
  8670. show();
  8671. }
  8672. };
  8673. vue.watch(() => props[name], onChange);
  8674. if (shouldHideWhenRouteChanges && instance.appContext.config.globalProperties.$route !== void 0) {
  8675. vue.watch(() => ({
  8676. ...instance.proxy.$route
  8677. }), () => {
  8678. if (shouldHideWhenRouteChanges.value && indicator.value) {
  8679. hide();
  8680. }
  8681. });
  8682. }
  8683. vue.onMounted(() => {
  8684. onChange(props[name]);
  8685. });
  8686. return {
  8687. hide,
  8688. show,
  8689. toggle,
  8690. hasUpdateHandler
  8691. };
  8692. };
  8693. return {
  8694. useModelToggle: useModelToggle2,
  8695. useModelToggleProps: useModelToggleProps2,
  8696. useModelToggleEmits: useModelToggleEmits2
  8697. };
  8698. };
  8699. const { useModelToggle, useModelToggleProps, useModelToggleEmits } = createModelToggleComposable("modelValue");
  8700. const usePreventGlobal = (indicator, evt, cb) => {
  8701. const prevent = (e) => {
  8702. if (cb(e))
  8703. e.stopImmediatePropagation();
  8704. };
  8705. let stop = void 0;
  8706. vue.watch(() => indicator.value, (val) => {
  8707. if (val) {
  8708. stop = useEventListener(document, evt, prevent, true);
  8709. } else {
  8710. stop == null ? void 0 : stop();
  8711. }
  8712. }, { immediate: true });
  8713. };
  8714. const useProp = (name) => {
  8715. const vm = vue.getCurrentInstance();
  8716. return vue.computed(() => {
  8717. var _a, _b;
  8718. return (_b = (_a = vm == null ? void 0 : vm.proxy) == null ? void 0 : _a.$props) == null ? void 0 : _b[name];
  8719. });
  8720. };
  8721. var E$1="top",R="bottom",W="right",P$1="left",me="auto",G=[E$1,R,W,P$1],U$1="start",J="end",Xe="clippingParents",je="viewport",K="popper",Ye="reference",De=G.reduce(function(t,e){return t.concat([e+"-"+U$1,e+"-"+J])},[]),Ee=[].concat(G,[me]).reduce(function(t,e){return t.concat([e,e+"-"+U$1,e+"-"+J])},[]),Ge="beforeRead",Je="read",Ke="afterRead",Qe="beforeMain",Ze="main",et="afterMain",tt="beforeWrite",nt="write",rt="afterWrite",ot=[Ge,Je,Ke,Qe,Ze,et,tt,nt,rt];function C(t){return t?(t.nodeName||"").toLowerCase():null}function H(t){if(t==null)return window;if(t.toString()!=="[object Window]"){var e=t.ownerDocument;return e&&e.defaultView||window}return t}function Q(t){var e=H(t).Element;return t instanceof e||t instanceof Element}function B(t){var e=H(t).HTMLElement;return t instanceof e||t instanceof HTMLElement}function Pe(t){if(typeof ShadowRoot=="undefined")return !1;var e=H(t).ShadowRoot;return t instanceof e||t instanceof ShadowRoot}function Mt(t){var e=t.state;Object.keys(e.elements).forEach(function(n){var r=e.styles[n]||{},o=e.attributes[n]||{},i=e.elements[n];!B(i)||!C(i)||(Object.assign(i.style,r),Object.keys(o).forEach(function(a){var s=o[a];s===!1?i.removeAttribute(a):i.setAttribute(a,s===!0?"":s);}));});}function Rt(t){var e=t.state,n={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,n.popper),e.styles=n,e.elements.arrow&&Object.assign(e.elements.arrow.style,n.arrow),function(){Object.keys(e.elements).forEach(function(r){var o=e.elements[r],i=e.attributes[r]||{},a=Object.keys(e.styles.hasOwnProperty(r)?e.styles[r]:n[r]),s=a.reduce(function(f,c){return f[c]="",f},{});!B(o)||!C(o)||(Object.assign(o.style,s),Object.keys(i).forEach(function(f){o.removeAttribute(f);}));});}}var Ae={name:"applyStyles",enabled:!0,phase:"write",fn:Mt,effect:Rt,requires:["computeStyles"]};function q(t){return t.split("-")[0]}var X$1=Math.max,ve=Math.min,Z=Math.round;function ee(t,e){e===void 0&&(e=!1);var n=t.getBoundingClientRect(),r=1,o=1;if(B(t)&&e){var i=t.offsetHeight,a=t.offsetWidth;a>0&&(r=Z(n.width)/a||1),i>0&&(o=Z(n.height)/i||1);}return {width:n.width/r,height:n.height/o,top:n.top/o,right:n.right/r,bottom:n.bottom/o,left:n.left/r,x:n.left/r,y:n.top/o}}function ke(t){var e=ee(t),n=t.offsetWidth,r=t.offsetHeight;return Math.abs(e.width-n)<=1&&(n=e.width),Math.abs(e.height-r)<=1&&(r=e.height),{x:t.offsetLeft,y:t.offsetTop,width:n,height:r}}function it(t,e){var n=e.getRootNode&&e.getRootNode();if(t.contains(e))return !0;if(n&&Pe(n)){var r=e;do{if(r&&t.isSameNode(r))return !0;r=r.parentNode||r.host;}while(r)}return !1}function N$1(t){return H(t).getComputedStyle(t)}function Wt(t){return ["table","td","th"].indexOf(C(t))>=0}function I$1(t){return ((Q(t)?t.ownerDocument:t.document)||window.document).documentElement}function ge(t){return C(t)==="html"?t:t.assignedSlot||t.parentNode||(Pe(t)?t.host:null)||I$1(t)}function at(t){return !B(t)||N$1(t).position==="fixed"?null:t.offsetParent}function Bt(t){var e=navigator.userAgent.toLowerCase().indexOf("firefox")!==-1,n=navigator.userAgent.indexOf("Trident")!==-1;if(n&&B(t)){var r=N$1(t);if(r.position==="fixed")return null}var o=ge(t);for(Pe(o)&&(o=o.host);B(o)&&["html","body"].indexOf(C(o))<0;){var i=N$1(o);if(i.transform!=="none"||i.perspective!=="none"||i.contain==="paint"||["transform","perspective"].indexOf(i.willChange)!==-1||e&&i.willChange==="filter"||e&&i.filter&&i.filter!=="none")return o;o=o.parentNode;}return null}function se(t){for(var e=H(t),n=at(t);n&&Wt(n)&&N$1(n).position==="static";)n=at(n);return n&&(C(n)==="html"||C(n)==="body"&&N$1(n).position==="static")?e:n||Bt(t)||e}function Le(t){return ["top","bottom"].indexOf(t)>=0?"x":"y"}function fe(t,e,n){return X$1(t,ve(e,n))}function St(t,e,n){var r=fe(t,e,n);return r>n?n:r}function st(){return {top:0,right:0,bottom:0,left:0}}function ft(t){return Object.assign({},st(),t)}function ct(t,e){return e.reduce(function(n,r){return n[r]=t,n},{})}var Tt=function(t,e){return t=typeof t=="function"?t(Object.assign({},e.rects,{placement:e.placement})):t,ft(typeof t!="number"?t:ct(t,G))};function Ht(t){var e,n=t.state,r=t.name,o=t.options,i=n.elements.arrow,a=n.modifiersData.popperOffsets,s=q(n.placement),f=Le(s),c=[P$1,W].indexOf(s)>=0,u=c?"height":"width";if(!(!i||!a)){var m=Tt(o.padding,n),v=ke(i),l=f==="y"?E$1:P$1,h=f==="y"?R:W,p=n.rects.reference[u]+n.rects.reference[f]-a[f]-n.rects.popper[u],g=a[f]-n.rects.reference[f],x=se(i),y=x?f==="y"?x.clientHeight||0:x.clientWidth||0:0,$=p/2-g/2,d=m[l],b=y-v[u]-m[h],w=y/2-v[u]/2+$,O=fe(d,w,b),j=f;n.modifiersData[r]=(e={},e[j]=O,e.centerOffset=O-w,e);}}function Ct(t){var e=t.state,n=t.options,r=n.element,o=r===void 0?"[data-popper-arrow]":r;o!=null&&(typeof o=="string"&&(o=e.elements.popper.querySelector(o),!o)||!it(e.elements.popper,o)||(e.elements.arrow=o));}var pt={name:"arrow",enabled:!0,phase:"main",fn:Ht,effect:Ct,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function te(t){return t.split("-")[1]}var qt={top:"auto",right:"auto",bottom:"auto",left:"auto"};function Vt(t){var e=t.x,n=t.y,r=window,o=r.devicePixelRatio||1;return {x:Z(e*o)/o||0,y:Z(n*o)/o||0}}function ut(t){var e,n=t.popper,r=t.popperRect,o=t.placement,i=t.variation,a=t.offsets,s=t.position,f=t.gpuAcceleration,c=t.adaptive,u=t.roundOffsets,m=t.isFixed,v=a.x,l=v===void 0?0:v,h=a.y,p=h===void 0?0:h,g=typeof u=="function"?u({x:l,y:p}):{x:l,y:p};l=g.x,p=g.y;var x=a.hasOwnProperty("x"),y=a.hasOwnProperty("y"),$=P$1,d=E$1,b=window;if(c){var w=se(n),O="clientHeight",j="clientWidth";if(w===H(n)&&(w=I$1(n),N$1(w).position!=="static"&&s==="absolute"&&(O="scrollHeight",j="scrollWidth")),w=w,o===E$1||(o===P$1||o===W)&&i===J){d=R;var A=m&&w===b&&b.visualViewport?b.visualViewport.height:w[O];p-=A-r.height,p*=f?1:-1;}if(o===P$1||(o===E$1||o===R)&&i===J){$=W;var k=m&&w===b&&b.visualViewport?b.visualViewport.width:w[j];l-=k-r.width,l*=f?1:-1;}}var D=Object.assign({position:s},c&&qt),S=u===!0?Vt({x:l,y:p}):{x:l,y:p};if(l=S.x,p=S.y,f){var L;return Object.assign({},D,(L={},L[d]=y?"0":"",L[$]=x?"0":"",L.transform=(b.devicePixelRatio||1)<=1?"translate("+l+"px, "+p+"px)":"translate3d("+l+"px, "+p+"px, 0)",L))}return Object.assign({},D,(e={},e[d]=y?p+"px":"",e[$]=x?l+"px":"",e.transform="",e))}function Nt(t){var e=t.state,n=t.options,r=n.gpuAcceleration,o=r===void 0?!0:r,i=n.adaptive,a=i===void 0?!0:i,s=n.roundOffsets,f=s===void 0?!0:s,c={placement:q(e.placement),variation:te(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:o,isFixed:e.options.strategy==="fixed"};e.modifiersData.popperOffsets!=null&&(e.styles.popper=Object.assign({},e.styles.popper,ut(Object.assign({},c,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:a,roundOffsets:f})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,ut(Object.assign({},c,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:f})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement});}var Me={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:Nt,data:{}},ye={passive:!0};function It(t){var e=t.state,n=t.instance,r=t.options,o=r.scroll,i=o===void 0?!0:o,a=r.resize,s=a===void 0?!0:a,f=H(e.elements.popper),c=[].concat(e.scrollParents.reference,e.scrollParents.popper);return i&&c.forEach(function(u){u.addEventListener("scroll",n.update,ye);}),s&&f.addEventListener("resize",n.update,ye),function(){i&&c.forEach(function(u){u.removeEventListener("scroll",n.update,ye);}),s&&f.removeEventListener("resize",n.update,ye);}}var Re={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:It,data:{}},_t={left:"right",right:"left",bottom:"top",top:"bottom"};function be(t){return t.replace(/left|right|bottom|top/g,function(e){return _t[e]})}var zt={start:"end",end:"start"};function lt(t){return t.replace(/start|end/g,function(e){return zt[e]})}function We(t){var e=H(t),n=e.pageXOffset,r=e.pageYOffset;return {scrollLeft:n,scrollTop:r}}function Be(t){return ee(I$1(t)).left+We(t).scrollLeft}function Ft(t){var e=H(t),n=I$1(t),r=e.visualViewport,o=n.clientWidth,i=n.clientHeight,a=0,s=0;return r&&(o=r.width,i=r.height,/^((?!chrome|android).)*safari/i.test(navigator.userAgent)||(a=r.offsetLeft,s=r.offsetTop)),{width:o,height:i,x:a+Be(t),y:s}}function Ut(t){var e,n=I$1(t),r=We(t),o=(e=t.ownerDocument)==null?void 0:e.body,i=X$1(n.scrollWidth,n.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),a=X$1(n.scrollHeight,n.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0),s=-r.scrollLeft+Be(t),f=-r.scrollTop;return N$1(o||n).direction==="rtl"&&(s+=X$1(n.clientWidth,o?o.clientWidth:0)-i),{width:i,height:a,x:s,y:f}}function Se(t){var e=N$1(t),n=e.overflow,r=e.overflowX,o=e.overflowY;return /auto|scroll|overlay|hidden/.test(n+o+r)}function dt(t){return ["html","body","#document"].indexOf(C(t))>=0?t.ownerDocument.body:B(t)&&Se(t)?t:dt(ge(t))}function ce(t,e){var n;e===void 0&&(e=[]);var r=dt(t),o=r===((n=t.ownerDocument)==null?void 0:n.body),i=H(r),a=o?[i].concat(i.visualViewport||[],Se(r)?r:[]):r,s=e.concat(a);return o?s:s.concat(ce(ge(a)))}function Te(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function Xt(t){var e=ee(t);return e.top=e.top+t.clientTop,e.left=e.left+t.clientLeft,e.bottom=e.top+t.clientHeight,e.right=e.left+t.clientWidth,e.width=t.clientWidth,e.height=t.clientHeight,e.x=e.left,e.y=e.top,e}function ht(t,e){return e===je?Te(Ft(t)):Q(e)?Xt(e):Te(Ut(I$1(t)))}function Yt(t){var e=ce(ge(t)),n=["absolute","fixed"].indexOf(N$1(t).position)>=0,r=n&&B(t)?se(t):t;return Q(r)?e.filter(function(o){return Q(o)&&it(o,r)&&C(o)!=="body"}):[]}function Gt(t,e,n){var r=e==="clippingParents"?Yt(t):[].concat(e),o=[].concat(r,[n]),i=o[0],a=o.reduce(function(s,f){var c=ht(t,f);return s.top=X$1(c.top,s.top),s.right=ve(c.right,s.right),s.bottom=ve(c.bottom,s.bottom),s.left=X$1(c.left,s.left),s},ht(t,i));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function mt(t){var e=t.reference,n=t.element,r=t.placement,o=r?q(r):null,i=r?te(r):null,a=e.x+e.width/2-n.width/2,s=e.y+e.height/2-n.height/2,f;switch(o){case E$1:f={x:a,y:e.y-n.height};break;case R:f={x:a,y:e.y+e.height};break;case W:f={x:e.x+e.width,y:s};break;case P$1:f={x:e.x-n.width,y:s};break;default:f={x:e.x,y:e.y};}var c=o?Le(o):null;if(c!=null){var u=c==="y"?"height":"width";switch(i){case U$1:f[c]=f[c]-(e[u]/2-n[u]/2);break;case J:f[c]=f[c]+(e[u]/2-n[u]/2);break}}return f}function ne(t,e){e===void 0&&(e={});var n=e,r=n.placement,o=r===void 0?t.placement:r,i=n.boundary,a=i===void 0?Xe:i,s=n.rootBoundary,f=s===void 0?je:s,c=n.elementContext,u=c===void 0?K:c,m=n.altBoundary,v=m===void 0?!1:m,l=n.padding,h=l===void 0?0:l,p=ft(typeof h!="number"?h:ct(h,G)),g=u===K?Ye:K,x=t.rects.popper,y=t.elements[v?g:u],$=Gt(Q(y)?y:y.contextElement||I$1(t.elements.popper),a,f),d=ee(t.elements.reference),b=mt({reference:d,element:x,strategy:"absolute",placement:o}),w=Te(Object.assign({},x,b)),O=u===K?w:d,j={top:$.top-O.top+p.top,bottom:O.bottom-$.bottom+p.bottom,left:$.left-O.left+p.left,right:O.right-$.right+p.right},A=t.modifiersData.offset;if(u===K&&A){var k=A[o];Object.keys(j).forEach(function(D){var S=[W,R].indexOf(D)>=0?1:-1,L=[E$1,R].indexOf(D)>=0?"y":"x";j[D]+=k[L]*S;});}return j}function Jt(t,e){e===void 0&&(e={});var n=e,r=n.placement,o=n.boundary,i=n.rootBoundary,a=n.padding,s=n.flipVariations,f=n.allowedAutoPlacements,c=f===void 0?Ee:f,u=te(r),m=u?s?De:De.filter(function(h){return te(h)===u}):G,v=m.filter(function(h){return c.indexOf(h)>=0});v.length===0&&(v=m);var l=v.reduce(function(h,p){return h[p]=ne(t,{placement:p,boundary:o,rootBoundary:i,padding:a})[q(p)],h},{});return Object.keys(l).sort(function(h,p){return l[h]-l[p]})}function Kt(t){if(q(t)===me)return [];var e=be(t);return [lt(t),e,lt(e)]}function Qt(t){var e=t.state,n=t.options,r=t.name;if(!e.modifiersData[r]._skip){for(var o=n.mainAxis,i=o===void 0?!0:o,a=n.altAxis,s=a===void 0?!0:a,f=n.fallbackPlacements,c=n.padding,u=n.boundary,m=n.rootBoundary,v=n.altBoundary,l=n.flipVariations,h=l===void 0?!0:l,p=n.allowedAutoPlacements,g=e.options.placement,x=q(g),y=x===g,$=f||(y||!h?[be(g)]:Kt(g)),d=[g].concat($).reduce(function(z,V){return z.concat(q(V)===me?Jt(e,{placement:V,boundary:u,rootBoundary:m,padding:c,flipVariations:h,allowedAutoPlacements:p}):V)},[]),b=e.rects.reference,w=e.rects.popper,O=new Map,j=!0,A=d[0],k=0;k<d.length;k++){var D=d[k],S=q(D),L=te(D)===U$1,re=[E$1,R].indexOf(S)>=0,oe=re?"width":"height",M=ne(e,{placement:D,boundary:u,rootBoundary:m,altBoundary:v,padding:c}),T=re?L?W:P$1:L?R:E$1;b[oe]>w[oe]&&(T=be(T));var pe=be(T),_=[];if(i&&_.push(M[S]<=0),s&&_.push(M[T]<=0,M[pe]<=0),_.every(function(z){return z})){A=D,j=!1;break}O.set(D,_);}if(j)for(var ue=h?3:1,xe=function(z){var V=d.find(function(de){var ae=O.get(de);if(ae)return ae.slice(0,z).every(function(Y){return Y})});if(V)return A=V,"break"},ie=ue;ie>0;ie--){var le=xe(ie);if(le==="break")break}e.placement!==A&&(e.modifiersData[r]._skip=!0,e.placement=A,e.reset=!0);}}var vt={name:"flip",enabled:!0,phase:"main",fn:Qt,requiresIfExists:["offset"],data:{_skip:!1}};function gt(t,e,n){return n===void 0&&(n={x:0,y:0}),{top:t.top-e.height-n.y,right:t.right-e.width+n.x,bottom:t.bottom-e.height+n.y,left:t.left-e.width-n.x}}function yt(t){return [E$1,W,R,P$1].some(function(e){return t[e]>=0})}function Zt(t){var e=t.state,n=t.name,r=e.rects.reference,o=e.rects.popper,i=e.modifiersData.preventOverflow,a=ne(e,{elementContext:"reference"}),s=ne(e,{altBoundary:!0}),f=gt(a,r),c=gt(s,o,i),u=yt(f),m=yt(c);e.modifiersData[n]={referenceClippingOffsets:f,popperEscapeOffsets:c,isReferenceHidden:u,hasPopperEscaped:m},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":u,"data-popper-escaped":m});}var bt={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:Zt};function en(t,e,n){var r=q(t),o=[P$1,E$1].indexOf(r)>=0?-1:1,i=typeof n=="function"?n(Object.assign({},e,{placement:t})):n,a=i[0],s=i[1];return a=a||0,s=(s||0)*o,[P$1,W].indexOf(r)>=0?{x:s,y:a}:{x:a,y:s}}function tn(t){var e=t.state,n=t.options,r=t.name,o=n.offset,i=o===void 0?[0,0]:o,a=Ee.reduce(function(u,m){return u[m]=en(m,e.rects,i),u},{}),s=a[e.placement],f=s.x,c=s.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=f,e.modifiersData.popperOffsets.y+=c),e.modifiersData[r]=a;}var wt={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:tn};function nn(t){var e=t.state,n=t.name;e.modifiersData[n]=mt({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement});}var He={name:"popperOffsets",enabled:!0,phase:"read",fn:nn,data:{}};function rn(t){return t==="x"?"y":"x"}function on(t){var e=t.state,n=t.options,r=t.name,o=n.mainAxis,i=o===void 0?!0:o,a=n.altAxis,s=a===void 0?!1:a,f=n.boundary,c=n.rootBoundary,u=n.altBoundary,m=n.padding,v=n.tether,l=v===void 0?!0:v,h=n.tetherOffset,p=h===void 0?0:h,g=ne(e,{boundary:f,rootBoundary:c,padding:m,altBoundary:u}),x=q(e.placement),y=te(e.placement),$=!y,d=Le(x),b=rn(d),w=e.modifiersData.popperOffsets,O=e.rects.reference,j=e.rects.popper,A=typeof p=="function"?p(Object.assign({},e.rects,{placement:e.placement})):p,k=typeof A=="number"?{mainAxis:A,altAxis:A}:Object.assign({mainAxis:0,altAxis:0},A),D=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,S={x:0,y:0};if(w){if(i){var L,re=d==="y"?E$1:P$1,oe=d==="y"?R:W,M=d==="y"?"height":"width",T=w[d],pe=T+g[re],_=T-g[oe],ue=l?-j[M]/2:0,xe=y===U$1?O[M]:j[M],ie=y===U$1?-j[M]:-O[M],le=e.elements.arrow,z=l&&le?ke(le):{width:0,height:0},V=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:st(),de=V[re],ae=V[oe],Y=fe(0,O[M],z[M]),jt=$?O[M]/2-ue-Y-de-k.mainAxis:xe-Y-de-k.mainAxis,Dt=$?-O[M]/2+ue+Y+ae+k.mainAxis:ie+Y+ae+k.mainAxis,Oe=e.elements.arrow&&se(e.elements.arrow),Et=Oe?d==="y"?Oe.clientTop||0:Oe.clientLeft||0:0,Ce=(L=D==null?void 0:D[d])!=null?L:0,Pt=T+jt-Ce-Et,At=T+Dt-Ce,qe=fe(l?ve(pe,Pt):pe,T,l?X$1(_,At):_);w[d]=qe,S[d]=qe-T;}if(s){var Ve,kt=d==="x"?E$1:P$1,Lt=d==="x"?R:W,F=w[b],he=b==="y"?"height":"width",Ne=F+g[kt],Ie=F-g[Lt],$e=[E$1,P$1].indexOf(x)!==-1,_e=(Ve=D==null?void 0:D[b])!=null?Ve:0,ze=$e?Ne:F-O[he]-j[he]-_e+k.altAxis,Fe=$e?F+O[he]+j[he]-_e-k.altAxis:Ie,Ue=l&&$e?St(ze,F,Fe):fe(l?ze:Ne,F,l?Fe:Ie);w[b]=Ue,S[b]=Ue-F;}e.modifiersData[r]=S;}}var xt={name:"preventOverflow",enabled:!0,phase:"main",fn:on,requiresIfExists:["offset"]};function an(t){return {scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}}function sn(t){return t===H(t)||!B(t)?We(t):an(t)}function fn(t){var e=t.getBoundingClientRect(),n=Z(e.width)/t.offsetWidth||1,r=Z(e.height)/t.offsetHeight||1;return n!==1||r!==1}function cn(t,e,n){n===void 0&&(n=!1);var r=B(e),o=B(e)&&fn(e),i=I$1(e),a=ee(t,o),s={scrollLeft:0,scrollTop:0},f={x:0,y:0};return (r||!r&&!n)&&((C(e)!=="body"||Se(i))&&(s=sn(e)),B(e)?(f=ee(e,!0),f.x+=e.clientLeft,f.y+=e.clientTop):i&&(f.x=Be(i))),{x:a.left+s.scrollLeft-f.x,y:a.top+s.scrollTop-f.y,width:a.width,height:a.height}}function pn(t){var e=new Map,n=new Set,r=[];t.forEach(function(i){e.set(i.name,i);});function o(i){n.add(i.name);var a=[].concat(i.requires||[],i.requiresIfExists||[]);a.forEach(function(s){if(!n.has(s)){var f=e.get(s);f&&o(f);}}),r.push(i);}return t.forEach(function(i){n.has(i.name)||o(i);}),r}function un(t){var e=pn(t);return ot.reduce(function(n,r){return n.concat(e.filter(function(o){return o.phase===r}))},[])}function ln(t){var e;return function(){return e||(e=new Promise(function(n){Promise.resolve().then(function(){e=void 0,n(t());});})),e}}function dn(t){var e=t.reduce(function(n,r){var o=n[r.name];return n[r.name]=o?Object.assign({},o,r,{options:Object.assign({},o.options,r.options),data:Object.assign({},o.data,r.data)}):r,n},{});return Object.keys(e).map(function(n){return e[n]})}var Ot={placement:"bottom",modifiers:[],strategy:"absolute"};function $t(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return !e.some(function(r){return !(r&&typeof r.getBoundingClientRect=="function")})}function we(t){t===void 0&&(t={});var e=t,n=e.defaultModifiers,r=n===void 0?[]:n,o=e.defaultOptions,i=o===void 0?Ot:o;return function(a,s,f){f===void 0&&(f=i);var c={placement:"bottom",orderedModifiers:[],options:Object.assign({},Ot,i),modifiersData:{},elements:{reference:a,popper:s},attributes:{},styles:{}},u=[],m=!1,v={state:c,setOptions:function(p){var g=typeof p=="function"?p(c.options):p;h(),c.options=Object.assign({},i,c.options,g),c.scrollParents={reference:Q(a)?ce(a):a.contextElement?ce(a.contextElement):[],popper:ce(s)};var x=un(dn([].concat(r,c.options.modifiers)));return c.orderedModifiers=x.filter(function(y){return y.enabled}),l(),v.update()},forceUpdate:function(){if(!m){var p=c.elements,g=p.reference,x=p.popper;if($t(g,x)){c.rects={reference:cn(g,se(x),c.options.strategy==="fixed"),popper:ke(x)},c.reset=!1,c.placement=c.options.placement,c.orderedModifiers.forEach(function(j){return c.modifiersData[j.name]=Object.assign({},j.data)});for(var y=0;y<c.orderedModifiers.length;y++){if(c.reset===!0){c.reset=!1,y=-1;continue}var $=c.orderedModifiers[y],d=$.fn,b=$.options,w=b===void 0?{}:b,O=$.name;typeof d=="function"&&(c=d({state:c,options:w,name:O,instance:v})||c);}}}},update:ln(function(){return new Promise(function(p){v.forceUpdate(),p(c);})}),destroy:function(){h(),m=!0;}};if(!$t(a,s))return v;v.setOptions(f).then(function(p){!m&&f.onFirstUpdate&&f.onFirstUpdate(p);});function l(){c.orderedModifiers.forEach(function(p){var g=p.name,x=p.options,y=x===void 0?{}:x,$=p.effect;if(typeof $=="function"){var d=$({state:c,name:g,instance:v,options:y}),b=function(){};u.push(d||b);}});}function h(){u.forEach(function(p){return p()}),u=[];}return v}}we();var mn=[Re,He,Me,Ae];we({defaultModifiers:mn});var gn=[Re,He,Me,Ae,wt,vt,xt,pt,bt],yn=we({defaultModifiers:gn});
  8722. const usePopper = (referenceElementRef, popperElementRef, opts = {}) => {
  8723. const stateUpdater = {
  8724. name: "updateState",
  8725. enabled: true,
  8726. phase: "write",
  8727. fn: ({ state }) => {
  8728. const derivedState = deriveState(state);
  8729. Object.assign(states.value, derivedState);
  8730. },
  8731. requires: ["computeStyles"]
  8732. };
  8733. const options = vue.computed(() => {
  8734. const { onFirstUpdate, placement, strategy, modifiers } = vue.unref(opts);
  8735. return {
  8736. onFirstUpdate,
  8737. placement: placement || "bottom",
  8738. strategy: strategy || "absolute",
  8739. modifiers: [
  8740. ...modifiers || [],
  8741. stateUpdater,
  8742. { name: "applyStyles", enabled: false }
  8743. ]
  8744. };
  8745. });
  8746. const instanceRef = vue.shallowRef();
  8747. const states = vue.ref({
  8748. styles: {
  8749. popper: {
  8750. position: vue.unref(options).strategy,
  8751. left: "0",
  8752. top: "0"
  8753. },
  8754. arrow: {
  8755. position: "absolute"
  8756. }
  8757. },
  8758. attributes: {}
  8759. });
  8760. const destroy = () => {
  8761. if (!instanceRef.value)
  8762. return;
  8763. instanceRef.value.destroy();
  8764. instanceRef.value = void 0;
  8765. };
  8766. vue.watch(options, (newOptions) => {
  8767. const instance = vue.unref(instanceRef);
  8768. if (instance) {
  8769. instance.setOptions(newOptions);
  8770. }
  8771. }, {
  8772. deep: true
  8773. });
  8774. vue.watch([referenceElementRef, popperElementRef], ([referenceElement, popperElement]) => {
  8775. destroy();
  8776. if (!referenceElement || !popperElement)
  8777. return;
  8778. instanceRef.value = yn(referenceElement, popperElement, vue.unref(options));
  8779. });
  8780. vue.onBeforeUnmount(() => {
  8781. destroy();
  8782. });
  8783. return {
  8784. state: vue.computed(() => {
  8785. var _a;
  8786. return { ...((_a = vue.unref(instanceRef)) == null ? void 0 : _a.state) || {} };
  8787. }),
  8788. styles: vue.computed(() => vue.unref(states).styles),
  8789. attributes: vue.computed(() => vue.unref(states).attributes),
  8790. update: () => {
  8791. var _a;
  8792. return (_a = vue.unref(instanceRef)) == null ? void 0 : _a.update();
  8793. },
  8794. forceUpdate: () => {
  8795. var _a;
  8796. return (_a = vue.unref(instanceRef)) == null ? void 0 : _a.forceUpdate();
  8797. },
  8798. instanceRef: vue.computed(() => vue.unref(instanceRef))
  8799. };
  8800. };
  8801. function deriveState(state) {
  8802. const elements = Object.keys(state.elements);
  8803. const styles = fromPairs(elements.map((element) => [element, state.styles[element] || {}]));
  8804. const attributes = fromPairs(elements.map((element) => [element, state.attributes[element]]));
  8805. return {
  8806. styles,
  8807. attributes
  8808. };
  8809. }
  8810. const useSameTarget = (handleClick) => {
  8811. if (!handleClick) {
  8812. return { onClick: NOOP, onMousedown: NOOP, onMouseup: NOOP };
  8813. }
  8814. let mousedownTarget = false;
  8815. let mouseupTarget = false;
  8816. const onClick = (e) => {
  8817. if (mousedownTarget && mouseupTarget) {
  8818. handleClick(e);
  8819. }
  8820. mousedownTarget = mouseupTarget = false;
  8821. };
  8822. const onMousedown = (e) => {
  8823. mousedownTarget = e.target === e.currentTarget;
  8824. };
  8825. const onMouseup = (e) => {
  8826. mouseupTarget = e.target === e.currentTarget;
  8827. };
  8828. return { onClick, onMousedown, onMouseup };
  8829. };
  8830. const useTeleport = (contentRenderer, appendToBody) => {
  8831. const isTeleportVisible = vue.ref(false);
  8832. if (!isClient) {
  8833. return {
  8834. isTeleportVisible,
  8835. showTeleport: NOOP,
  8836. hideTeleport: NOOP,
  8837. renderTeleport: NOOP
  8838. };
  8839. }
  8840. let $el = null;
  8841. const showTeleport = () => {
  8842. isTeleportVisible.value = true;
  8843. if ($el !== null)
  8844. return;
  8845. $el = createGlobalNode();
  8846. };
  8847. const hideTeleport = () => {
  8848. isTeleportVisible.value = false;
  8849. if ($el !== null) {
  8850. removeGlobalNode($el);
  8851. $el = null;
  8852. }
  8853. };
  8854. const renderTeleport = () => {
  8855. return appendToBody.value !== true ? contentRenderer() : isTeleportVisible.value ? [vue.h(vue.Teleport, { to: $el }, contentRenderer())] : void 0;
  8856. };
  8857. vue.onUnmounted(hideTeleport);
  8858. return {
  8859. isTeleportVisible,
  8860. showTeleport,
  8861. hideTeleport,
  8862. renderTeleport
  8863. };
  8864. };
  8865. const useThrottleRender = (loading, throttle = 0) => {
  8866. if (throttle === 0)
  8867. return loading;
  8868. const initVal = isObject$1(throttle) && Boolean(throttle.initVal);
  8869. const throttled = vue.ref(initVal);
  8870. let timeoutHandle = null;
  8871. const dispatchThrottling = (timer) => {
  8872. if (isUndefined(timer)) {
  8873. throttled.value = loading.value;
  8874. return;
  8875. }
  8876. if (timeoutHandle) {
  8877. clearTimeout(timeoutHandle);
  8878. }
  8879. timeoutHandle = setTimeout(() => {
  8880. throttled.value = loading.value;
  8881. }, timer);
  8882. };
  8883. const dispatcher = (type) => {
  8884. if (type === "leading") {
  8885. if (isNumber(throttle)) {
  8886. dispatchThrottling(throttle);
  8887. } else {
  8888. dispatchThrottling(throttle.leading);
  8889. }
  8890. } else {
  8891. if (isObject$1(throttle)) {
  8892. dispatchThrottling(throttle.trailing);
  8893. } else {
  8894. throttled.value = false;
  8895. }
  8896. }
  8897. };
  8898. vue.onMounted(() => dispatcher("leading"));
  8899. vue.watch(() => loading.value, (val) => {
  8900. dispatcher(val ? "leading" : "trailing");
  8901. });
  8902. return throttled;
  8903. };
  8904. function useTimeout() {
  8905. let timeoutHandle;
  8906. const registerTimeout = (fn, delay) => {
  8907. cancelTimeout();
  8908. timeoutHandle = window.setTimeout(fn, delay);
  8909. };
  8910. const cancelTimeout = () => window.clearTimeout(timeoutHandle);
  8911. tryOnScopeDispose(() => cancelTimeout());
  8912. return {
  8913. registerTimeout,
  8914. cancelTimeout
  8915. };
  8916. }
  8917. const AFTER_APPEAR = "after-appear";
  8918. const AFTER_ENTER = "after-enter";
  8919. const AFTER_LEAVE = "after-leave";
  8920. const APPEAR = "appear";
  8921. const APPEAR_CANCELLED = "appear-cancelled";
  8922. const BEFORE_ENTER = "before-enter";
  8923. const BEFORE_LEAVE = "before-leave";
  8924. const ENTER = "enter";
  8925. const ENTER_CANCELLED = "enter-cancelled";
  8926. const LEAVE = "leave";
  8927. const LEAVE_CANCELLED = "leave-cancelled";
  8928. const useTransitionFallthroughEmits = [
  8929. AFTER_APPEAR,
  8930. AFTER_ENTER,
  8931. AFTER_LEAVE,
  8932. APPEAR,
  8933. APPEAR_CANCELLED,
  8934. BEFORE_ENTER,
  8935. BEFORE_LEAVE,
  8936. ENTER,
  8937. ENTER_CANCELLED,
  8938. LEAVE,
  8939. LEAVE_CANCELLED
  8940. ];
  8941. const useTransitionFallthrough = () => {
  8942. const { emit } = vue.getCurrentInstance();
  8943. return {
  8944. onAfterAppear: () => {
  8945. emit(AFTER_APPEAR);
  8946. },
  8947. onAfterEnter: () => {
  8948. emit(AFTER_ENTER);
  8949. },
  8950. onAfterLeave: () => {
  8951. emit(AFTER_LEAVE);
  8952. },
  8953. onAppearCancelled: () => {
  8954. emit(APPEAR_CANCELLED);
  8955. },
  8956. onBeforeEnter: () => {
  8957. emit(BEFORE_ENTER);
  8958. },
  8959. onBeforeLeave: () => {
  8960. emit(BEFORE_LEAVE);
  8961. },
  8962. onEnter: () => {
  8963. emit(ENTER);
  8964. },
  8965. onEnterCancelled: () => {
  8966. emit(ENTER_CANCELLED);
  8967. },
  8968. onLeave: () => {
  8969. emit(LEAVE);
  8970. },
  8971. onLeaveCancelled: () => {
  8972. emit(LEAVE_CANCELLED);
  8973. }
  8974. };
  8975. };
  8976. const defaultIdInjection = {
  8977. prefix: Math.floor(Math.random() * 1e4),
  8978. current: 0
  8979. };
  8980. const ID_INJECTION_KEY = Symbol("elIdInjection");
  8981. const useIdInjection = () => {
  8982. return vue.getCurrentInstance() ? vue.inject(ID_INJECTION_KEY, defaultIdInjection) : defaultIdInjection;
  8983. };
  8984. const useId = (deterministicId) => {
  8985. const idInjection = useIdInjection();
  8986. const namespace = useGetDerivedNamespace();
  8987. const idRef = computedEager(() => vue.unref(deterministicId) || `${namespace.value}-id-${idInjection.prefix}-${idInjection.current++}`);
  8988. return idRef;
  8989. };
  8990. let registeredEscapeHandlers = [];
  8991. const cachedHandler = (event) => {
  8992. if (event.code === EVENT_CODE.esc) {
  8993. registeredEscapeHandlers.forEach((registeredHandler) => registeredHandler(event));
  8994. }
  8995. };
  8996. const useEscapeKeydown = (handler) => {
  8997. vue.onMounted(() => {
  8998. if (registeredEscapeHandlers.length === 0) {
  8999. document.addEventListener("keydown", cachedHandler);
  9000. }
  9001. if (isClient)
  9002. registeredEscapeHandlers.push(handler);
  9003. });
  9004. vue.onBeforeUnmount(() => {
  9005. registeredEscapeHandlers = registeredEscapeHandlers.filter((registeredHandler) => registeredHandler !== handler);
  9006. if (registeredEscapeHandlers.length === 0) {
  9007. if (isClient)
  9008. document.removeEventListener("keydown", cachedHandler);
  9009. }
  9010. });
  9011. };
  9012. const usePopperContainerId = () => {
  9013. const namespace = useGetDerivedNamespace();
  9014. const idInjection = useIdInjection();
  9015. const id = vue.computed(() => {
  9016. return `${namespace.value}-popper-container-${idInjection.prefix}`;
  9017. });
  9018. const selector = vue.computed(() => `#${id.value}`);
  9019. return {
  9020. id,
  9021. selector
  9022. };
  9023. };
  9024. const createContainer = (id) => {
  9025. const container = document.createElement("div");
  9026. container.id = id;
  9027. document.body.appendChild(container);
  9028. return container;
  9029. };
  9030. const usePopperContainer = () => {
  9031. const { id, selector } = usePopperContainerId();
  9032. vue.onBeforeMount(() => {
  9033. if (!isClient)
  9034. return;
  9035. if (!document.body.querySelector(selector.value)) {
  9036. createContainer(id.value);
  9037. }
  9038. });
  9039. return {
  9040. id,
  9041. selector
  9042. };
  9043. };
  9044. const useDelayedRender = ({
  9045. indicator,
  9046. intermediateIndicator,
  9047. shouldSetIntermediate = () => true,
  9048. beforeShow,
  9049. afterShow,
  9050. afterHide,
  9051. beforeHide
  9052. }) => {
  9053. vue.watch(() => vue.unref(indicator), (val) => {
  9054. if (val) {
  9055. beforeShow == null ? void 0 : beforeShow();
  9056. vue.nextTick(() => {
  9057. if (!vue.unref(indicator))
  9058. return;
  9059. if (shouldSetIntermediate("show")) {
  9060. intermediateIndicator.value = true;
  9061. }
  9062. });
  9063. } else {
  9064. beforeHide == null ? void 0 : beforeHide();
  9065. vue.nextTick(() => {
  9066. if (vue.unref(indicator))
  9067. return;
  9068. if (shouldSetIntermediate("hide")) {
  9069. intermediateIndicator.value = false;
  9070. }
  9071. });
  9072. }
  9073. });
  9074. vue.watch(() => intermediateIndicator.value, (val) => {
  9075. if (val) {
  9076. afterShow == null ? void 0 : afterShow();
  9077. } else {
  9078. afterHide == null ? void 0 : afterHide();
  9079. }
  9080. });
  9081. };
  9082. const useDelayedToggleProps = buildProps({
  9083. showAfter: {
  9084. type: Number,
  9085. default: 0
  9086. },
  9087. hideAfter: {
  9088. type: Number,
  9089. default: 200
  9090. },
  9091. autoClose: {
  9092. type: Number,
  9093. default: 0
  9094. }
  9095. });
  9096. const useDelayedToggle = ({
  9097. showAfter,
  9098. hideAfter,
  9099. autoClose,
  9100. open,
  9101. close
  9102. }) => {
  9103. const { registerTimeout } = useTimeout();
  9104. const {
  9105. registerTimeout: registerTimeoutForAutoClose,
  9106. cancelTimeout: cancelTimeoutForAutoClose
  9107. } = useTimeout();
  9108. const onOpen = (event) => {
  9109. registerTimeout(() => {
  9110. open(event);
  9111. const _autoClose = vue.unref(autoClose);
  9112. if (isNumber(_autoClose) && _autoClose > 0) {
  9113. registerTimeoutForAutoClose(() => {
  9114. close(event);
  9115. }, _autoClose);
  9116. }
  9117. }, vue.unref(showAfter));
  9118. };
  9119. const onClose = (event) => {
  9120. cancelTimeoutForAutoClose();
  9121. registerTimeout(() => {
  9122. close(event);
  9123. }, vue.unref(hideAfter));
  9124. };
  9125. return {
  9126. onOpen,
  9127. onClose
  9128. };
  9129. };
  9130. const FORWARD_REF_INJECTION_KEY = Symbol("elForwardRef");
  9131. const useForwardRef = (forwardRef) => {
  9132. const setForwardRef = (el) => {
  9133. forwardRef.value = el;
  9134. };
  9135. vue.provide(FORWARD_REF_INJECTION_KEY, {
  9136. setForwardRef
  9137. });
  9138. };
  9139. const useForwardRefDirective = (setForwardRef) => {
  9140. return {
  9141. mounted(el) {
  9142. setForwardRef(el);
  9143. },
  9144. updated(el) {
  9145. setForwardRef(el);
  9146. },
  9147. unmounted() {
  9148. setForwardRef(null);
  9149. }
  9150. };
  9151. };
  9152. const initial = {
  9153. current: 0
  9154. };
  9155. const zIndex = vue.ref(0);
  9156. const defaultInitialZIndex = 2e3;
  9157. const ZINDEX_INJECTION_KEY = Symbol("elZIndexContextKey");
  9158. const zIndexContextKey = Symbol("zIndexContextKey");
  9159. const useZIndex = (zIndexOverrides) => {
  9160. const increasingInjection = vue.getCurrentInstance() ? vue.inject(ZINDEX_INJECTION_KEY, initial) : initial;
  9161. const zIndexInjection = zIndexOverrides || (vue.getCurrentInstance() ? vue.inject(zIndexContextKey, void 0) : void 0);
  9162. const initialZIndex = vue.computed(() => {
  9163. const zIndexFromInjection = vue.unref(zIndexInjection);
  9164. return isNumber(zIndexFromInjection) ? zIndexFromInjection : defaultInitialZIndex;
  9165. });
  9166. const currentZIndex = vue.computed(() => initialZIndex.value + zIndex.value);
  9167. const nextZIndex = () => {
  9168. increasingInjection.current++;
  9169. zIndex.value = increasingInjection.current;
  9170. return currentZIndex.value;
  9171. };
  9172. if (!isClient && !vue.inject(ZINDEX_INJECTION_KEY)) ;
  9173. return {
  9174. initialZIndex,
  9175. currentZIndex,
  9176. nextZIndex
  9177. };
  9178. };
  9179. function getSide(placement) {
  9180. return placement.split('-')[0];
  9181. }
  9182. function getAlignment(placement) {
  9183. return placement.split('-')[1];
  9184. }
  9185. function getMainAxisFromPlacement(placement) {
  9186. return ['top', 'bottom'].includes(getSide(placement)) ? 'x' : 'y';
  9187. }
  9188. function getLengthFromAxis(axis) {
  9189. return axis === 'y' ? 'height' : 'width';
  9190. }
  9191. function computeCoordsFromPlacement(_ref, placement, rtl) {
  9192. let {
  9193. reference,
  9194. floating
  9195. } = _ref;
  9196. const commonX = reference.x + reference.width / 2 - floating.width / 2;
  9197. const commonY = reference.y + reference.height / 2 - floating.height / 2;
  9198. const mainAxis = getMainAxisFromPlacement(placement);
  9199. const length = getLengthFromAxis(mainAxis);
  9200. const commonAlign = reference[length] / 2 - floating[length] / 2;
  9201. const side = getSide(placement);
  9202. const isVertical = mainAxis === 'x';
  9203. let coords;
  9204. switch (side) {
  9205. case 'top':
  9206. coords = {
  9207. x: commonX,
  9208. y: reference.y - floating.height
  9209. };
  9210. break;
  9211. case 'bottom':
  9212. coords = {
  9213. x: commonX,
  9214. y: reference.y + reference.height
  9215. };
  9216. break;
  9217. case 'right':
  9218. coords = {
  9219. x: reference.x + reference.width,
  9220. y: commonY
  9221. };
  9222. break;
  9223. case 'left':
  9224. coords = {
  9225. x: reference.x - floating.width,
  9226. y: commonY
  9227. };
  9228. break;
  9229. default:
  9230. coords = {
  9231. x: reference.x,
  9232. y: reference.y
  9233. };
  9234. }
  9235. switch (getAlignment(placement)) {
  9236. case 'start':
  9237. coords[mainAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
  9238. break;
  9239. case 'end':
  9240. coords[mainAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
  9241. break;
  9242. }
  9243. return coords;
  9244. }
  9245. /**
  9246. * Computes the `x` and `y` coordinates that will place the floating element
  9247. * next to a reference element when it is given a certain positioning strategy.
  9248. *
  9249. * This export does not have any `platform` interface logic. You will need to
  9250. * write one for the platform you are using Floating UI with.
  9251. */
  9252. const computePosition$1 = async (reference, floating, config) => {
  9253. const {
  9254. placement = 'bottom',
  9255. strategy = 'absolute',
  9256. middleware = [],
  9257. platform
  9258. } = config;
  9259. const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
  9260. let rects = await platform.getElementRects({
  9261. reference,
  9262. floating,
  9263. strategy
  9264. });
  9265. let {
  9266. x,
  9267. y
  9268. } = computeCoordsFromPlacement(rects, placement, rtl);
  9269. let statefulPlacement = placement;
  9270. let middlewareData = {};
  9271. let resetCount = 0;
  9272. for (let i = 0; i < middleware.length; i++) {
  9273. const {
  9274. name,
  9275. fn
  9276. } = middleware[i];
  9277. const {
  9278. x: nextX,
  9279. y: nextY,
  9280. data,
  9281. reset
  9282. } = await fn({
  9283. x,
  9284. y,
  9285. initialPlacement: placement,
  9286. placement: statefulPlacement,
  9287. strategy,
  9288. middlewareData,
  9289. rects,
  9290. platform,
  9291. elements: {
  9292. reference,
  9293. floating
  9294. }
  9295. });
  9296. x = nextX != null ? nextX : x;
  9297. y = nextY != null ? nextY : y;
  9298. middlewareData = { ...middlewareData,
  9299. [name]: { ...middlewareData[name],
  9300. ...data
  9301. }
  9302. };
  9303. if (reset && resetCount <= 50) {
  9304. resetCount++;
  9305. if (typeof reset === 'object') {
  9306. if (reset.placement) {
  9307. statefulPlacement = reset.placement;
  9308. }
  9309. if (reset.rects) {
  9310. rects = reset.rects === true ? await platform.getElementRects({
  9311. reference,
  9312. floating,
  9313. strategy
  9314. }) : reset.rects;
  9315. }
  9316. ({
  9317. x,
  9318. y
  9319. } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
  9320. }
  9321. i = -1;
  9322. continue;
  9323. }
  9324. }
  9325. return {
  9326. x,
  9327. y,
  9328. placement: statefulPlacement,
  9329. strategy,
  9330. middlewareData
  9331. };
  9332. };
  9333. function expandPaddingObject(padding) {
  9334. return {
  9335. top: 0,
  9336. right: 0,
  9337. bottom: 0,
  9338. left: 0,
  9339. ...padding
  9340. };
  9341. }
  9342. function getSideObjectFromPadding(padding) {
  9343. return typeof padding !== 'number' ? expandPaddingObject(padding) : {
  9344. top: padding,
  9345. right: padding,
  9346. bottom: padding,
  9347. left: padding
  9348. };
  9349. }
  9350. function rectToClientRect(rect) {
  9351. return { ...rect,
  9352. top: rect.y,
  9353. left: rect.x,
  9354. right: rect.x + rect.width,
  9355. bottom: rect.y + rect.height
  9356. };
  9357. }
  9358. /**
  9359. * Resolves with an object of overflow side offsets that determine how much the
  9360. * element is overflowing a given clipping boundary.
  9361. * - positive = overflowing the boundary by that number of pixels
  9362. * - negative = how many pixels left before it will overflow
  9363. * - 0 = lies flush with the boundary
  9364. * @see https://floating-ui.com/docs/detectOverflow
  9365. */
  9366. async function detectOverflow(middlewareArguments, options) {
  9367. var _await$platform$isEle;
  9368. if (options === void 0) {
  9369. options = {};
  9370. }
  9371. const {
  9372. x,
  9373. y,
  9374. platform,
  9375. rects,
  9376. elements,
  9377. strategy
  9378. } = middlewareArguments;
  9379. const {
  9380. boundary = 'clippingAncestors',
  9381. rootBoundary = 'viewport',
  9382. elementContext = 'floating',
  9383. altBoundary = false,
  9384. padding = 0
  9385. } = options;
  9386. const paddingObject = getSideObjectFromPadding(padding);
  9387. const altContext = elementContext === 'floating' ? 'reference' : 'floating';
  9388. const element = elements[altBoundary ? altContext : elementContext];
  9389. const clippingClientRect = rectToClientRect(await platform.getClippingRect({
  9390. element: ((_await$platform$isEle = await (platform.isElement == null ? void 0 : platform.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || (await (platform.getDocumentElement == null ? void 0 : platform.getDocumentElement(elements.floating))),
  9391. boundary,
  9392. rootBoundary,
  9393. strategy
  9394. }));
  9395. const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
  9396. rect: elementContext === 'floating' ? { ...rects.floating,
  9397. x,
  9398. y
  9399. } : rects.reference,
  9400. offsetParent: await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating)),
  9401. strategy
  9402. }) : rects[elementContext]);
  9403. return {
  9404. top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
  9405. bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
  9406. left: clippingClientRect.left - elementClientRect.left + paddingObject.left,
  9407. right: elementClientRect.right - clippingClientRect.right + paddingObject.right
  9408. };
  9409. }
  9410. const min$2 = Math.min;
  9411. const max$2 = Math.max;
  9412. function within(min$1, value, max$1) {
  9413. return max$2(min$1, min$2(value, max$1));
  9414. }
  9415. /**
  9416. * Positions an inner element of the floating element such that it is centered
  9417. * to the reference element.
  9418. * @see https://floating-ui.com/docs/arrow
  9419. */
  9420. const arrow = options => ({
  9421. name: 'arrow',
  9422. options,
  9423. async fn(middlewareArguments) {
  9424. // Since `element` is required, we don't Partial<> the type
  9425. const {
  9426. element,
  9427. padding = 0
  9428. } = options != null ? options : {};
  9429. const {
  9430. x,
  9431. y,
  9432. placement,
  9433. rects,
  9434. platform
  9435. } = middlewareArguments;
  9436. if (element == null) {
  9437. return {};
  9438. }
  9439. const paddingObject = getSideObjectFromPadding(padding);
  9440. const coords = {
  9441. x,
  9442. y
  9443. };
  9444. const axis = getMainAxisFromPlacement(placement);
  9445. const alignment = getAlignment(placement);
  9446. const length = getLengthFromAxis(axis);
  9447. const arrowDimensions = await platform.getDimensions(element);
  9448. const minProp = axis === 'y' ? 'top' : 'left';
  9449. const maxProp = axis === 'y' ? 'bottom' : 'right';
  9450. const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
  9451. const startDiff = coords[axis] - rects.reference[axis];
  9452. const arrowOffsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(element));
  9453. let clientSize = arrowOffsetParent ? axis === 'y' ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
  9454. if (clientSize === 0) {
  9455. clientSize = rects.floating[length];
  9456. }
  9457. const centerToReference = endDiff / 2 - startDiff / 2; // Make sure the arrow doesn't overflow the floating element if the center
  9458. // point is outside the floating element's bounds
  9459. const min = paddingObject[minProp];
  9460. const max = clientSize - arrowDimensions[length] - paddingObject[maxProp];
  9461. const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
  9462. const offset = within(min, center, max); // Make sure that arrow points at the reference
  9463. const alignmentPadding = alignment === 'start' ? paddingObject[minProp] : paddingObject[maxProp];
  9464. const shouldAddOffset = alignmentPadding > 0 && center !== offset && rects.reference[length] <= rects.floating[length];
  9465. const alignmentOffset = shouldAddOffset ? center < min ? min - center : max - center : 0;
  9466. return {
  9467. [axis]: coords[axis] - alignmentOffset,
  9468. data: {
  9469. [axis]: offset,
  9470. centerOffset: center - offset
  9471. }
  9472. };
  9473. }
  9474. });
  9475. const hash$1 = {
  9476. left: 'right',
  9477. right: 'left',
  9478. bottom: 'top',
  9479. top: 'bottom'
  9480. };
  9481. function getOppositePlacement(placement) {
  9482. return placement.replace(/left|right|bottom|top/g, matched => hash$1[matched]);
  9483. }
  9484. function getAlignmentSides(placement, rects, rtl) {
  9485. if (rtl === void 0) {
  9486. rtl = false;
  9487. }
  9488. const alignment = getAlignment(placement);
  9489. const mainAxis = getMainAxisFromPlacement(placement);
  9490. const length = getLengthFromAxis(mainAxis);
  9491. let mainAlignmentSide = mainAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';
  9492. if (rects.reference[length] > rects.floating[length]) {
  9493. mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
  9494. }
  9495. return {
  9496. main: mainAlignmentSide,
  9497. cross: getOppositePlacement(mainAlignmentSide)
  9498. };
  9499. }
  9500. const hash = {
  9501. start: 'end',
  9502. end: 'start'
  9503. };
  9504. function getOppositeAlignmentPlacement(placement) {
  9505. return placement.replace(/start|end/g, matched => hash[matched]);
  9506. }
  9507. function getExpandedPlacements(placement) {
  9508. const oppositePlacement = getOppositePlacement(placement);
  9509. return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
  9510. }
  9511. /**
  9512. * Changes the placement of the floating element to one that will fit if the
  9513. * initially specified `placement` does not.
  9514. * @see https://floating-ui.com/docs/flip
  9515. */
  9516. const flip = function (options) {
  9517. if (options === void 0) {
  9518. options = {};
  9519. }
  9520. return {
  9521. name: 'flip',
  9522. options,
  9523. async fn(middlewareArguments) {
  9524. var _middlewareData$flip;
  9525. const {
  9526. placement,
  9527. middlewareData,
  9528. rects,
  9529. initialPlacement,
  9530. platform,
  9531. elements
  9532. } = middlewareArguments;
  9533. const {
  9534. mainAxis: checkMainAxis = true,
  9535. crossAxis: checkCrossAxis = true,
  9536. fallbackPlacements: specifiedFallbackPlacements,
  9537. fallbackStrategy = 'bestFit',
  9538. flipAlignment = true,
  9539. ...detectOverflowOptions
  9540. } = options;
  9541. const side = getSide(placement);
  9542. const isBasePlacement = side === initialPlacement;
  9543. const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
  9544. const placements = [initialPlacement, ...fallbackPlacements];
  9545. const overflow = await detectOverflow(middlewareArguments, detectOverflowOptions);
  9546. const overflows = [];
  9547. let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
  9548. if (checkMainAxis) {
  9549. overflows.push(overflow[side]);
  9550. }
  9551. if (checkCrossAxis) {
  9552. const {
  9553. main,
  9554. cross
  9555. } = getAlignmentSides(placement, rects, await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)));
  9556. overflows.push(overflow[main], overflow[cross]);
  9557. }
  9558. overflowsData = [...overflowsData, {
  9559. placement,
  9560. overflows
  9561. }]; // One or more sides is overflowing
  9562. if (!overflows.every(side => side <= 0)) {
  9563. var _middlewareData$flip$, _middlewareData$flip2;
  9564. const nextIndex = ((_middlewareData$flip$ = (_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) != null ? _middlewareData$flip$ : 0) + 1;
  9565. const nextPlacement = placements[nextIndex];
  9566. if (nextPlacement) {
  9567. // Try next placement and re-run the lifecycle
  9568. return {
  9569. data: {
  9570. index: nextIndex,
  9571. overflows: overflowsData
  9572. },
  9573. reset: {
  9574. placement: nextPlacement
  9575. }
  9576. };
  9577. }
  9578. let resetPlacement = 'bottom';
  9579. switch (fallbackStrategy) {
  9580. case 'bestFit':
  9581. {
  9582. var _overflowsData$map$so;
  9583. const placement = (_overflowsData$map$so = overflowsData.map(d => [d, d.overflows.filter(overflow => overflow > 0).reduce((acc, overflow) => acc + overflow, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$map$so[0].placement;
  9584. if (placement) {
  9585. resetPlacement = placement;
  9586. }
  9587. break;
  9588. }
  9589. case 'initialPlacement':
  9590. resetPlacement = initialPlacement;
  9591. break;
  9592. }
  9593. if (placement !== resetPlacement) {
  9594. return {
  9595. reset: {
  9596. placement: resetPlacement
  9597. }
  9598. };
  9599. }
  9600. }
  9601. return {};
  9602. }
  9603. };
  9604. };
  9605. async function convertValueToCoords(middlewareArguments, value) {
  9606. const {
  9607. placement,
  9608. platform,
  9609. elements
  9610. } = middlewareArguments;
  9611. const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
  9612. const side = getSide(placement);
  9613. const alignment = getAlignment(placement);
  9614. const isVertical = getMainAxisFromPlacement(placement) === 'x';
  9615. const mainAxisMulti = ['left', 'top'].includes(side) ? -1 : 1;
  9616. const crossAxisMulti = rtl && isVertical ? -1 : 1;
  9617. const rawValue = typeof value === 'function' ? value(middlewareArguments) : value; // eslint-disable-next-line prefer-const
  9618. let {
  9619. mainAxis,
  9620. crossAxis,
  9621. alignmentAxis
  9622. } = typeof rawValue === 'number' ? {
  9623. mainAxis: rawValue,
  9624. crossAxis: 0,
  9625. alignmentAxis: null
  9626. } : {
  9627. mainAxis: 0,
  9628. crossAxis: 0,
  9629. alignmentAxis: null,
  9630. ...rawValue
  9631. };
  9632. if (alignment && typeof alignmentAxis === 'number') {
  9633. crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis;
  9634. }
  9635. return isVertical ? {
  9636. x: crossAxis * crossAxisMulti,
  9637. y: mainAxis * mainAxisMulti
  9638. } : {
  9639. x: mainAxis * mainAxisMulti,
  9640. y: crossAxis * crossAxisMulti
  9641. };
  9642. }
  9643. /**
  9644. * Displaces the floating element from its reference element.
  9645. * @see https://floating-ui.com/docs/offset
  9646. */
  9647. const offset = function (value) {
  9648. if (value === void 0) {
  9649. value = 0;
  9650. }
  9651. return {
  9652. name: 'offset',
  9653. options: value,
  9654. async fn(middlewareArguments) {
  9655. const {
  9656. x,
  9657. y
  9658. } = middlewareArguments;
  9659. const diffCoords = await convertValueToCoords(middlewareArguments, value);
  9660. return {
  9661. x: x + diffCoords.x,
  9662. y: y + diffCoords.y,
  9663. data: diffCoords
  9664. };
  9665. }
  9666. };
  9667. };
  9668. function getCrossAxis(axis) {
  9669. return axis === 'x' ? 'y' : 'x';
  9670. }
  9671. /**
  9672. * Shifts the floating element in order to keep it in view when it will overflow
  9673. * a clipping boundary.
  9674. * @see https://floating-ui.com/docs/shift
  9675. */
  9676. const shift = function (options) {
  9677. if (options === void 0) {
  9678. options = {};
  9679. }
  9680. return {
  9681. name: 'shift',
  9682. options,
  9683. async fn(middlewareArguments) {
  9684. const {
  9685. x,
  9686. y,
  9687. placement
  9688. } = middlewareArguments;
  9689. const {
  9690. mainAxis: checkMainAxis = true,
  9691. crossAxis: checkCrossAxis = false,
  9692. limiter = {
  9693. fn: _ref => {
  9694. let {
  9695. x,
  9696. y
  9697. } = _ref;
  9698. return {
  9699. x,
  9700. y
  9701. };
  9702. }
  9703. },
  9704. ...detectOverflowOptions
  9705. } = options;
  9706. const coords = {
  9707. x,
  9708. y
  9709. };
  9710. const overflow = await detectOverflow(middlewareArguments, detectOverflowOptions);
  9711. const mainAxis = getMainAxisFromPlacement(getSide(placement));
  9712. const crossAxis = getCrossAxis(mainAxis);
  9713. let mainAxisCoord = coords[mainAxis];
  9714. let crossAxisCoord = coords[crossAxis];
  9715. if (checkMainAxis) {
  9716. const minSide = mainAxis === 'y' ? 'top' : 'left';
  9717. const maxSide = mainAxis === 'y' ? 'bottom' : 'right';
  9718. const min = mainAxisCoord + overflow[minSide];
  9719. const max = mainAxisCoord - overflow[maxSide];
  9720. mainAxisCoord = within(min, mainAxisCoord, max);
  9721. }
  9722. if (checkCrossAxis) {
  9723. const minSide = crossAxis === 'y' ? 'top' : 'left';
  9724. const maxSide = crossAxis === 'y' ? 'bottom' : 'right';
  9725. const min = crossAxisCoord + overflow[minSide];
  9726. const max = crossAxisCoord - overflow[maxSide];
  9727. crossAxisCoord = within(min, crossAxisCoord, max);
  9728. }
  9729. const limitedCoords = limiter.fn({ ...middlewareArguments,
  9730. [mainAxis]: mainAxisCoord,
  9731. [crossAxis]: crossAxisCoord
  9732. });
  9733. return { ...limitedCoords,
  9734. data: {
  9735. x: limitedCoords.x - x,
  9736. y: limitedCoords.y - y
  9737. }
  9738. };
  9739. }
  9740. };
  9741. };
  9742. function isWindow(value) {
  9743. return value && value.document && value.location && value.alert && value.setInterval;
  9744. }
  9745. function getWindow(node) {
  9746. if (node == null) {
  9747. return window;
  9748. }
  9749. if (!isWindow(node)) {
  9750. const ownerDocument = node.ownerDocument;
  9751. return ownerDocument ? ownerDocument.defaultView || window : window;
  9752. }
  9753. return node;
  9754. }
  9755. function getComputedStyle$1(element) {
  9756. return getWindow(element).getComputedStyle(element);
  9757. }
  9758. function getNodeName(node) {
  9759. return isWindow(node) ? '' : node ? (node.nodeName || '').toLowerCase() : '';
  9760. }
  9761. function getUAString() {
  9762. const uaData = navigator.userAgentData;
  9763. if (uaData != null && uaData.brands) {
  9764. return uaData.brands.map(item => item.brand + "/" + item.version).join(' ');
  9765. }
  9766. return navigator.userAgent;
  9767. }
  9768. function isHTMLElement(value) {
  9769. return value instanceof getWindow(value).HTMLElement;
  9770. }
  9771. function isElement(value) {
  9772. return value instanceof getWindow(value).Element;
  9773. }
  9774. function isNode(value) {
  9775. return value instanceof getWindow(value).Node;
  9776. }
  9777. function isShadowRoot(node) {
  9778. // Browsers without `ShadowRoot` support
  9779. if (typeof ShadowRoot === 'undefined') {
  9780. return false;
  9781. }
  9782. const OwnElement = getWindow(node).ShadowRoot;
  9783. return node instanceof OwnElement || node instanceof ShadowRoot;
  9784. }
  9785. function isOverflowElement(element) {
  9786. // Firefox wants us to check `-x` and `-y` variations as well
  9787. const {
  9788. overflow,
  9789. overflowX,
  9790. overflowY
  9791. } = getComputedStyle$1(element);
  9792. return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
  9793. }
  9794. function isTableElement(element) {
  9795. return ['table', 'td', 'th'].includes(getNodeName(element));
  9796. }
  9797. function isContainingBlock(element) {
  9798. // TODO: Try and use feature detection here instead
  9799. const isFirefox = /firefox/i.test(getUAString());
  9800. const css = getComputedStyle$1(element); // This is non-exhaustive but covers the most common CSS properties that
  9801. // create a containing block.
  9802. // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
  9803. return css.transform !== 'none' || css.perspective !== 'none' || // @ts-ignore (TS 4.1 compat)
  9804. css.contain === 'paint' || ['transform', 'perspective'].includes(css.willChange) || isFirefox && css.willChange === 'filter' || isFirefox && (css.filter ? css.filter !== 'none' : false);
  9805. }
  9806. function isLayoutViewport() {
  9807. // Not Safari
  9808. return !/^((?!chrome|android).)*safari/i.test(getUAString()); // Feature detection for this fails in various ways
  9809. // • Always-visible scrollbar or not
  9810. // • Width of <html>, etc.
  9811. // const vV = win.visualViewport;
  9812. // return vV ? Math.abs(win.innerWidth / vV.scale - vV.width) < 0.5 : true;
  9813. }
  9814. const min$1 = Math.min;
  9815. const max$1 = Math.max;
  9816. const round = Math.round;
  9817. function getBoundingClientRect(element, includeScale, isFixedStrategy) {
  9818. var _win$visualViewport$o, _win$visualViewport, _win$visualViewport$o2, _win$visualViewport2;
  9819. if (includeScale === void 0) {
  9820. includeScale = false;
  9821. }
  9822. if (isFixedStrategy === void 0) {
  9823. isFixedStrategy = false;
  9824. }
  9825. const clientRect = element.getBoundingClientRect();
  9826. let scaleX = 1;
  9827. let scaleY = 1;
  9828. if (includeScale && isHTMLElement(element)) {
  9829. scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;
  9830. scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;
  9831. }
  9832. const win = isElement(element) ? getWindow(element) : window;
  9833. const addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
  9834. const x = (clientRect.left + (addVisualOffsets ? (_win$visualViewport$o = (_win$visualViewport = win.visualViewport) == null ? void 0 : _win$visualViewport.offsetLeft) != null ? _win$visualViewport$o : 0 : 0)) / scaleX;
  9835. const y = (clientRect.top + (addVisualOffsets ? (_win$visualViewport$o2 = (_win$visualViewport2 = win.visualViewport) == null ? void 0 : _win$visualViewport2.offsetTop) != null ? _win$visualViewport$o2 : 0 : 0)) / scaleY;
  9836. const width = clientRect.width / scaleX;
  9837. const height = clientRect.height / scaleY;
  9838. return {
  9839. width,
  9840. height,
  9841. top: y,
  9842. right: x + width,
  9843. bottom: y + height,
  9844. left: x,
  9845. x,
  9846. y
  9847. };
  9848. }
  9849. function getDocumentElement(node) {
  9850. return ((isNode(node) ? node.ownerDocument : node.document) || window.document).documentElement;
  9851. }
  9852. function getNodeScroll(element) {
  9853. if (isElement(element)) {
  9854. return {
  9855. scrollLeft: element.scrollLeft,
  9856. scrollTop: element.scrollTop
  9857. };
  9858. }
  9859. return {
  9860. scrollLeft: element.pageXOffset,
  9861. scrollTop: element.pageYOffset
  9862. };
  9863. }
  9864. function getWindowScrollBarX(element) {
  9865. // If <html> has a CSS width greater than the viewport, then this will be
  9866. // incorrect for RTL.
  9867. return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft;
  9868. }
  9869. function isScaled(element) {
  9870. const rect = getBoundingClientRect(element);
  9871. return round(rect.width) !== element.offsetWidth || round(rect.height) !== element.offsetHeight;
  9872. }
  9873. function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
  9874. const isOffsetParentAnElement = isHTMLElement(offsetParent);
  9875. const documentElement = getDocumentElement(offsetParent);
  9876. const rect = getBoundingClientRect(element, // @ts-ignore - checked above (TS 4.1 compat)
  9877. isOffsetParentAnElement && isScaled(offsetParent), strategy === 'fixed');
  9878. let scroll = {
  9879. scrollLeft: 0,
  9880. scrollTop: 0
  9881. };
  9882. const offsets = {
  9883. x: 0,
  9884. y: 0
  9885. };
  9886. if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== 'fixed') {
  9887. if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
  9888. scroll = getNodeScroll(offsetParent);
  9889. }
  9890. if (isHTMLElement(offsetParent)) {
  9891. const offsetRect = getBoundingClientRect(offsetParent, true);
  9892. offsets.x = offsetRect.x + offsetParent.clientLeft;
  9893. offsets.y = offsetRect.y + offsetParent.clientTop;
  9894. } else if (documentElement) {
  9895. offsets.x = getWindowScrollBarX(documentElement);
  9896. }
  9897. }
  9898. return {
  9899. x: rect.left + scroll.scrollLeft - offsets.x,
  9900. y: rect.top + scroll.scrollTop - offsets.y,
  9901. width: rect.width,
  9902. height: rect.height
  9903. };
  9904. }
  9905. function getParentNode(node) {
  9906. if (getNodeName(node) === 'html') {
  9907. return node;
  9908. }
  9909. return (// this is a quicker (but less type safe) way to save quite some bytes from the bundle
  9910. // @ts-ignore
  9911. node.assignedSlot || // step into the shadow DOM of the parent of a slotted node
  9912. node.parentNode || ( // DOM Element detected
  9913. isShadowRoot(node) ? node.host : null) || // ShadowRoot detected
  9914. getDocumentElement(node) // fallback
  9915. );
  9916. }
  9917. function getTrueOffsetParent(element) {
  9918. if (!isHTMLElement(element) || getComputedStyle$1(element).position === 'fixed') {
  9919. return null;
  9920. }
  9921. return composedOffsetParent(element);
  9922. }
  9923. /**
  9924. * Polyfills the old offsetParent behavior from before the spec was changed:
  9925. * https://github.com/w3c/csswg-drafts/issues/159
  9926. */
  9927. function composedOffsetParent(element) {
  9928. let {
  9929. offsetParent
  9930. } = element;
  9931. let ancestor = element;
  9932. let foundInsideSlot = false;
  9933. while (ancestor && ancestor !== offsetParent) {
  9934. const {
  9935. assignedSlot
  9936. } = ancestor;
  9937. if (assignedSlot) {
  9938. let newOffsetParent = assignedSlot.offsetParent;
  9939. if (getComputedStyle$1(assignedSlot).display === 'contents') {
  9940. const hadStyleAttribute = assignedSlot.hasAttribute('style');
  9941. const oldDisplay = assignedSlot.style.display;
  9942. assignedSlot.style.display = getComputedStyle$1(ancestor).display;
  9943. newOffsetParent = assignedSlot.offsetParent;
  9944. assignedSlot.style.display = oldDisplay;
  9945. if (!hadStyleAttribute) {
  9946. assignedSlot.removeAttribute('style');
  9947. }
  9948. }
  9949. ancestor = assignedSlot;
  9950. if (offsetParent !== newOffsetParent) {
  9951. offsetParent = newOffsetParent;
  9952. foundInsideSlot = true;
  9953. }
  9954. } else if (isShadowRoot(ancestor) && ancestor.host && foundInsideSlot) {
  9955. break;
  9956. }
  9957. ancestor = isShadowRoot(ancestor) && ancestor.host || ancestor.parentNode;
  9958. }
  9959. return offsetParent;
  9960. }
  9961. function getContainingBlock(element) {
  9962. let currentNode = getParentNode(element);
  9963. if (isShadowRoot(currentNode)) {
  9964. currentNode = currentNode.host;
  9965. }
  9966. while (isHTMLElement(currentNode) && !['html', 'body'].includes(getNodeName(currentNode))) {
  9967. if (isContainingBlock(currentNode)) {
  9968. return currentNode;
  9969. } else {
  9970. const parent = currentNode.parentNode;
  9971. currentNode = isShadowRoot(parent) ? parent.host : parent;
  9972. }
  9973. }
  9974. return null;
  9975. } // Gets the closest ancestor positioned element. Handles some edge cases,
  9976. // such as table ancestors and cross browser bugs.
  9977. function getOffsetParent(element) {
  9978. const window = getWindow(element);
  9979. let offsetParent = getTrueOffsetParent(element);
  9980. while (offsetParent && isTableElement(offsetParent) && getComputedStyle$1(offsetParent).position === 'static') {
  9981. offsetParent = getTrueOffsetParent(offsetParent);
  9982. }
  9983. if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle$1(offsetParent).position === 'static' && !isContainingBlock(offsetParent))) {
  9984. return window;
  9985. }
  9986. return offsetParent || getContainingBlock(element) || window;
  9987. }
  9988. function getDimensions(element) {
  9989. if (isHTMLElement(element)) {
  9990. return {
  9991. width: element.offsetWidth,
  9992. height: element.offsetHeight
  9993. };
  9994. }
  9995. const rect = getBoundingClientRect(element);
  9996. return {
  9997. width: rect.width,
  9998. height: rect.height
  9999. };
  10000. }
  10001. function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
  10002. let {
  10003. rect,
  10004. offsetParent,
  10005. strategy
  10006. } = _ref;
  10007. const isOffsetParentAnElement = isHTMLElement(offsetParent);
  10008. const documentElement = getDocumentElement(offsetParent);
  10009. if (offsetParent === documentElement) {
  10010. return rect;
  10011. }
  10012. let scroll = {
  10013. scrollLeft: 0,
  10014. scrollTop: 0
  10015. };
  10016. const offsets = {
  10017. x: 0,
  10018. y: 0
  10019. };
  10020. if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== 'fixed') {
  10021. if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
  10022. scroll = getNodeScroll(offsetParent);
  10023. }
  10024. if (isHTMLElement(offsetParent)) {
  10025. const offsetRect = getBoundingClientRect(offsetParent, true);
  10026. offsets.x = offsetRect.x + offsetParent.clientLeft;
  10027. offsets.y = offsetRect.y + offsetParent.clientTop;
  10028. } // This doesn't appear to be need to be negated.
  10029. // else if (documentElement) {
  10030. // offsets.x = getWindowScrollBarX(documentElement);
  10031. // }
  10032. }
  10033. return { ...rect,
  10034. x: rect.x - scroll.scrollLeft + offsets.x,
  10035. y: rect.y - scroll.scrollTop + offsets.y
  10036. };
  10037. }
  10038. function getViewportRect(element, strategy) {
  10039. const win = getWindow(element);
  10040. const html = getDocumentElement(element);
  10041. const visualViewport = win.visualViewport;
  10042. let width = html.clientWidth;
  10043. let height = html.clientHeight;
  10044. let x = 0;
  10045. let y = 0;
  10046. if (visualViewport) {
  10047. width = visualViewport.width;
  10048. height = visualViewport.height;
  10049. const layoutViewport = isLayoutViewport();
  10050. if (layoutViewport || !layoutViewport && strategy === 'fixed') {
  10051. x = visualViewport.offsetLeft;
  10052. y = visualViewport.offsetTop;
  10053. }
  10054. }
  10055. return {
  10056. width,
  10057. height,
  10058. x,
  10059. y
  10060. };
  10061. }
  10062. // of the `<html>` and `<body>` rect bounds if horizontally scrollable
  10063. function getDocumentRect(element) {
  10064. var _element$ownerDocumen;
  10065. const html = getDocumentElement(element);
  10066. const scroll = getNodeScroll(element);
  10067. const body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
  10068. const width = max$1(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
  10069. const height = max$1(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
  10070. let x = -scroll.scrollLeft + getWindowScrollBarX(element);
  10071. const y = -scroll.scrollTop;
  10072. if (getComputedStyle$1(body || html).direction === 'rtl') {
  10073. x += max$1(html.clientWidth, body ? body.clientWidth : 0) - width;
  10074. }
  10075. return {
  10076. width,
  10077. height,
  10078. x,
  10079. y
  10080. };
  10081. }
  10082. function getNearestOverflowAncestor(node) {
  10083. const parentNode = getParentNode(node);
  10084. if (['html', 'body', '#document'].includes(getNodeName(parentNode))) {
  10085. // @ts-ignore assume body is always available
  10086. return node.ownerDocument.body;
  10087. }
  10088. if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
  10089. return parentNode;
  10090. }
  10091. return getNearestOverflowAncestor(parentNode);
  10092. }
  10093. function getOverflowAncestors(node, list) {
  10094. var _node$ownerDocument;
  10095. if (list === void 0) {
  10096. list = [];
  10097. }
  10098. const scrollableAncestor = getNearestOverflowAncestor(node);
  10099. const isBody = scrollableAncestor === ((_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.body);
  10100. const win = getWindow(scrollableAncestor);
  10101. const target = isBody ? [win].concat(win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : []) : scrollableAncestor;
  10102. const updatedList = list.concat(target);
  10103. return isBody ? updatedList : // @ts-ignore: isBody tells us target will be an HTMLElement here
  10104. updatedList.concat(getOverflowAncestors(target));
  10105. }
  10106. function contains(parent, child) {
  10107. const rootNode = child.getRootNode == null ? void 0 : child.getRootNode(); // First, attempt with faster native method
  10108. if (parent.contains(child)) {
  10109. return true;
  10110. } // then fallback to custom implementation with Shadow DOM support
  10111. else if (rootNode && isShadowRoot(rootNode)) {
  10112. let next = child;
  10113. do {
  10114. // use `===` replace node.isSameNode()
  10115. if (next && parent === next) {
  10116. return true;
  10117. } // @ts-ignore: need a better way to handle this...
  10118. next = next.parentNode || next.host;
  10119. } while (next);
  10120. }
  10121. return false;
  10122. }
  10123. function getInnerBoundingClientRect(element, strategy) {
  10124. const clientRect = getBoundingClientRect(element, false, strategy === 'fixed');
  10125. const top = clientRect.top + element.clientTop;
  10126. const left = clientRect.left + element.clientLeft;
  10127. return {
  10128. top,
  10129. left,
  10130. x: left,
  10131. y: top,
  10132. right: left + element.clientWidth,
  10133. bottom: top + element.clientHeight,
  10134. width: element.clientWidth,
  10135. height: element.clientHeight
  10136. };
  10137. }
  10138. function getClientRectFromClippingAncestor(element, clippingParent, strategy) {
  10139. if (clippingParent === 'viewport') {
  10140. return rectToClientRect(getViewportRect(element, strategy));
  10141. }
  10142. if (isElement(clippingParent)) {
  10143. return getInnerBoundingClientRect(clippingParent, strategy);
  10144. }
  10145. return rectToClientRect(getDocumentRect(getDocumentElement(element)));
  10146. } // A "clipping ancestor" is an overflowable container with the characteristic of
  10147. // clipping (or hiding) overflowing elements with a position different from
  10148. // `initial`
  10149. function getClippingAncestors(element) {
  10150. const clippingAncestors = getOverflowAncestors(element);
  10151. const canEscapeClipping = ['absolute', 'fixed'].includes(getComputedStyle$1(element).position);
  10152. const clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;
  10153. if (!isElement(clipperElement)) {
  10154. return [];
  10155. } // @ts-ignore isElement check ensures we return Array<Element>
  10156. return clippingAncestors.filter(clippingAncestors => isElement(clippingAncestors) && contains(clippingAncestors, clipperElement) && getNodeName(clippingAncestors) !== 'body');
  10157. } // Gets the maximum area that the element is visible in due to any number of
  10158. // clipping ancestors
  10159. function getClippingRect(_ref) {
  10160. let {
  10161. element,
  10162. boundary,
  10163. rootBoundary,
  10164. strategy
  10165. } = _ref;
  10166. const mainClippingAncestors = boundary === 'clippingAncestors' ? getClippingAncestors(element) : [].concat(boundary);
  10167. const clippingAncestors = [...mainClippingAncestors, rootBoundary];
  10168. const firstClippingAncestor = clippingAncestors[0];
  10169. const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
  10170. const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
  10171. accRect.top = max$1(rect.top, accRect.top);
  10172. accRect.right = min$1(rect.right, accRect.right);
  10173. accRect.bottom = min$1(rect.bottom, accRect.bottom);
  10174. accRect.left = max$1(rect.left, accRect.left);
  10175. return accRect;
  10176. }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
  10177. return {
  10178. width: clippingRect.right - clippingRect.left,
  10179. height: clippingRect.bottom - clippingRect.top,
  10180. x: clippingRect.left,
  10181. y: clippingRect.top
  10182. };
  10183. }
  10184. const platform = {
  10185. getClippingRect,
  10186. convertOffsetParentRelativeRectToViewportRelativeRect,
  10187. isElement,
  10188. getDimensions,
  10189. getOffsetParent,
  10190. getDocumentElement,
  10191. getElementRects: _ref => {
  10192. let {
  10193. reference,
  10194. floating,
  10195. strategy
  10196. } = _ref;
  10197. return {
  10198. reference: getRectRelativeToOffsetParent(reference, getOffsetParent(floating), strategy),
  10199. floating: { ...getDimensions(floating),
  10200. x: 0,
  10201. y: 0
  10202. }
  10203. };
  10204. },
  10205. getClientRects: element => Array.from(element.getClientRects()),
  10206. isRTL: element => getComputedStyle$1(element).direction === 'rtl'
  10207. };
  10208. /**
  10209. * Automatically updates the position of the floating element when necessary.
  10210. * @see https://floating-ui.com/docs/autoUpdate
  10211. */
  10212. function autoUpdate(reference, floating, update, options) {
  10213. if (options === void 0) {
  10214. options = {};
  10215. }
  10216. const {
  10217. ancestorScroll: _ancestorScroll = true,
  10218. ancestorResize: _ancestorResize = true,
  10219. elementResize = true,
  10220. animationFrame = false
  10221. } = options;
  10222. const ancestorScroll = _ancestorScroll && !animationFrame;
  10223. const ancestorResize = _ancestorResize && !animationFrame;
  10224. const ancestors = ancestorScroll || ancestorResize ? [...(isElement(reference) ? getOverflowAncestors(reference) : []), ...getOverflowAncestors(floating)] : [];
  10225. ancestors.forEach(ancestor => {
  10226. ancestorScroll && ancestor.addEventListener('scroll', update, {
  10227. passive: true
  10228. });
  10229. ancestorResize && ancestor.addEventListener('resize', update);
  10230. });
  10231. let observer = null;
  10232. if (elementResize) {
  10233. let initialUpdate = true;
  10234. observer = new ResizeObserver(() => {
  10235. if (!initialUpdate) {
  10236. update();
  10237. }
  10238. initialUpdate = false;
  10239. });
  10240. isElement(reference) && !animationFrame && observer.observe(reference);
  10241. observer.observe(floating);
  10242. }
  10243. let frameId;
  10244. let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
  10245. if (animationFrame) {
  10246. frameLoop();
  10247. }
  10248. function frameLoop() {
  10249. const nextRefRect = getBoundingClientRect(reference);
  10250. if (prevRefRect && (nextRefRect.x !== prevRefRect.x || nextRefRect.y !== prevRefRect.y || nextRefRect.width !== prevRefRect.width || nextRefRect.height !== prevRefRect.height)) {
  10251. update();
  10252. }
  10253. prevRefRect = nextRefRect;
  10254. frameId = requestAnimationFrame(frameLoop);
  10255. }
  10256. update();
  10257. return () => {
  10258. var _observer;
  10259. ancestors.forEach(ancestor => {
  10260. ancestorScroll && ancestor.removeEventListener('scroll', update);
  10261. ancestorResize && ancestor.removeEventListener('resize', update);
  10262. });
  10263. (_observer = observer) == null ? void 0 : _observer.disconnect();
  10264. observer = null;
  10265. if (animationFrame) {
  10266. cancelAnimationFrame(frameId);
  10267. }
  10268. };
  10269. }
  10270. /**
  10271. * Computes the `x` and `y` coordinates that will place the floating element
  10272. * next to a reference element when it is given a certain CSS positioning
  10273. * strategy.
  10274. */
  10275. const computePosition = (reference, floating, options) => computePosition$1(reference, floating, {
  10276. platform,
  10277. ...options
  10278. });
  10279. const useFloatingProps = buildProps({});
  10280. const unrefReference = (elRef) => {
  10281. if (!isClient)
  10282. return;
  10283. if (!elRef)
  10284. return elRef;
  10285. const unrefEl = unrefElement(elRef);
  10286. if (unrefEl)
  10287. return unrefEl;
  10288. return vue.isRef(elRef) ? unrefEl : elRef;
  10289. };
  10290. const getPositionDataWithUnit = (record, key) => {
  10291. const value = record == null ? void 0 : record[key];
  10292. return isNil(value) ? "" : `${value}px`;
  10293. };
  10294. const useFloating$1 = ({
  10295. middleware,
  10296. placement,
  10297. strategy
  10298. }) => {
  10299. const referenceRef = vue.ref();
  10300. const contentRef = vue.ref();
  10301. const x = vue.ref();
  10302. const y = vue.ref();
  10303. const middlewareData = vue.ref({});
  10304. const states = {
  10305. x,
  10306. y,
  10307. placement,
  10308. strategy,
  10309. middlewareData
  10310. };
  10311. const update = async () => {
  10312. if (!isClient)
  10313. return;
  10314. const referenceEl = unrefReference(referenceRef);
  10315. const contentEl = unrefElement(contentRef);
  10316. if (!referenceEl || !contentEl)
  10317. return;
  10318. const data = await computePosition(referenceEl, contentEl, {
  10319. placement: vue.unref(placement),
  10320. strategy: vue.unref(strategy),
  10321. middleware: vue.unref(middleware)
  10322. });
  10323. keysOf(states).forEach((key) => {
  10324. states[key].value = data[key];
  10325. });
  10326. };
  10327. vue.onMounted(() => {
  10328. vue.watchEffect(() => {
  10329. update();
  10330. });
  10331. });
  10332. return {
  10333. ...states,
  10334. update,
  10335. referenceRef,
  10336. contentRef
  10337. };
  10338. };
  10339. const arrowMiddleware = ({
  10340. arrowRef,
  10341. padding
  10342. }) => {
  10343. return {
  10344. name: "arrow",
  10345. options: {
  10346. element: arrowRef,
  10347. padding
  10348. },
  10349. fn(args) {
  10350. const arrowEl = vue.unref(arrowRef);
  10351. if (!arrowEl)
  10352. return {};
  10353. return arrow({
  10354. element: arrowEl,
  10355. padding
  10356. }).fn(args);
  10357. }
  10358. };
  10359. };
  10360. function useCursor(input) {
  10361. let selectionInfo;
  10362. function recordCursor() {
  10363. if (input.value == void 0)
  10364. return;
  10365. const { selectionStart, selectionEnd, value } = input.value;
  10366. if (selectionStart == null || selectionEnd == null)
  10367. return;
  10368. const beforeTxt = value.slice(0, Math.max(0, selectionStart));
  10369. const afterTxt = value.slice(Math.max(0, selectionEnd));
  10370. selectionInfo = {
  10371. selectionStart,
  10372. selectionEnd,
  10373. value,
  10374. beforeTxt,
  10375. afterTxt
  10376. };
  10377. }
  10378. function setCursor() {
  10379. if (input.value == void 0 || selectionInfo == void 0)
  10380. return;
  10381. const { value } = input.value;
  10382. const { beforeTxt, afterTxt, selectionStart } = selectionInfo;
  10383. if (beforeTxt == void 0 || afterTxt == void 0 || selectionStart == void 0)
  10384. return;
  10385. let startPos = value.length;
  10386. if (value.endsWith(afterTxt)) {
  10387. startPos = value.length - afterTxt.length;
  10388. } else if (value.startsWith(beforeTxt)) {
  10389. startPos = beforeTxt.length;
  10390. } else {
  10391. const beforeLastChar = beforeTxt[selectionStart - 1];
  10392. const newIndex = value.indexOf(beforeLastChar, selectionStart - 1);
  10393. if (newIndex !== -1) {
  10394. startPos = newIndex + 1;
  10395. }
  10396. }
  10397. input.value.setSelectionRange(startPos, startPos);
  10398. }
  10399. return [recordCursor, setCursor];
  10400. }
  10401. const getOrderedChildren = (vm, childComponentName, children) => {
  10402. const nodes = flattedChildren(vm.subTree).filter((n) => {
  10403. var _a;
  10404. return vue.isVNode(n) && ((_a = n.type) == null ? void 0 : _a.name) === childComponentName && !!n.component;
  10405. });
  10406. const uids = nodes.map((n) => n.component.uid);
  10407. return uids.map((uid) => children[uid]).filter((p) => !!p);
  10408. };
  10409. const useOrderedChildren = (vm, childComponentName) => {
  10410. const children = {};
  10411. const orderedChildren = vue.shallowRef([]);
  10412. const addChild = (child) => {
  10413. children[child.uid] = child;
  10414. orderedChildren.value = getOrderedChildren(vm, childComponentName, children);
  10415. };
  10416. const removeChild = (uid) => {
  10417. delete children[uid];
  10418. orderedChildren.value = orderedChildren.value.filter((children2) => children2.uid !== uid);
  10419. };
  10420. return {
  10421. children: orderedChildren,
  10422. addChild,
  10423. removeChild
  10424. };
  10425. };
  10426. const useSizeProp = buildProp({
  10427. type: String,
  10428. values: componentSizes,
  10429. required: false
  10430. });
  10431. const useSizeProps = {
  10432. size: useSizeProp
  10433. };
  10434. const SIZE_INJECTION_KEY = Symbol("size");
  10435. const useGlobalSize = () => {
  10436. const injectedSize = vue.inject(SIZE_INJECTION_KEY, {});
  10437. return vue.computed(() => {
  10438. return vue.unref(injectedSize.size) || "";
  10439. });
  10440. };
  10441. function useFocusController(target, {
  10442. beforeFocus,
  10443. afterFocus,
  10444. beforeBlur,
  10445. afterBlur
  10446. } = {}) {
  10447. const instance = vue.getCurrentInstance();
  10448. const { emit } = instance;
  10449. const wrapperRef = vue.shallowRef();
  10450. const isFocused = vue.ref(false);
  10451. const handleFocus = (event) => {
  10452. const cancelFocus = isFunction$1(beforeFocus) ? beforeFocus(event) : false;
  10453. if (cancelFocus || isFocused.value)
  10454. return;
  10455. isFocused.value = true;
  10456. emit("focus", event);
  10457. afterFocus == null ? void 0 : afterFocus();
  10458. };
  10459. const handleBlur = (event) => {
  10460. var _a;
  10461. const cancelBlur = isFunction$1(beforeBlur) ? beforeBlur(event) : false;
  10462. if (cancelBlur || event.relatedTarget && ((_a = wrapperRef.value) == null ? void 0 : _a.contains(event.relatedTarget)))
  10463. return;
  10464. isFocused.value = false;
  10465. emit("blur", event);
  10466. afterBlur == null ? void 0 : afterBlur();
  10467. };
  10468. const handleClick = () => {
  10469. var _a, _b;
  10470. if (((_a = wrapperRef.value) == null ? void 0 : _a.contains(document.activeElement)) && wrapperRef.value !== document.activeElement)
  10471. return;
  10472. (_b = target.value) == null ? void 0 : _b.focus();
  10473. };
  10474. vue.watch(wrapperRef, (el) => {
  10475. if (el) {
  10476. el.setAttribute("tabindex", "-1");
  10477. }
  10478. });
  10479. useEventListener(wrapperRef, "focus", handleFocus, true);
  10480. useEventListener(wrapperRef, "blur", handleBlur, true);
  10481. useEventListener(wrapperRef, "click", handleClick, true);
  10482. return {
  10483. isFocused,
  10484. wrapperRef,
  10485. handleFocus,
  10486. handleBlur
  10487. };
  10488. }
  10489. function useComposition({
  10490. afterComposition,
  10491. emit
  10492. }) {
  10493. const isComposing = vue.ref(false);
  10494. const handleCompositionStart = (event) => {
  10495. emit == null ? void 0 : emit("compositionstart", event);
  10496. isComposing.value = true;
  10497. };
  10498. const handleCompositionUpdate = (event) => {
  10499. var _a;
  10500. emit == null ? void 0 : emit("compositionupdate", event);
  10501. const text = (_a = event.target) == null ? void 0 : _a.value;
  10502. const lastCharacter = text[text.length - 1] || "";
  10503. isComposing.value = !isKorean(lastCharacter);
  10504. };
  10505. const handleCompositionEnd = (event) => {
  10506. emit == null ? void 0 : emit("compositionend", event);
  10507. if (isComposing.value) {
  10508. isComposing.value = false;
  10509. vue.nextTick(() => afterComposition(event));
  10510. }
  10511. };
  10512. const handleComposition = (event) => {
  10513. event.type === "compositionend" ? handleCompositionEnd(event) : handleCompositionUpdate(event);
  10514. };
  10515. return {
  10516. isComposing,
  10517. handleComposition,
  10518. handleCompositionStart,
  10519. handleCompositionUpdate,
  10520. handleCompositionEnd
  10521. };
  10522. }
  10523. const emptyValuesContextKey = Symbol("emptyValuesContextKey");
  10524. const SCOPE$3 = "use-empty-values";
  10525. const DEFAULT_EMPTY_VALUES = ["", void 0, null];
  10526. const DEFAULT_VALUE_ON_CLEAR = void 0;
  10527. const useEmptyValuesProps = buildProps({
  10528. emptyValues: Array,
  10529. valueOnClear: {
  10530. type: [String, Number, Boolean, Function],
  10531. default: void 0,
  10532. validator: (val) => isFunction$1(val) ? !val() : !val
  10533. }
  10534. });
  10535. const useEmptyValues = (props, defaultValue) => {
  10536. const config = vue.getCurrentInstance() ? vue.inject(emptyValuesContextKey, vue.ref({})) : vue.ref({});
  10537. const emptyValues = vue.computed(() => props.emptyValues || config.value.emptyValues || DEFAULT_EMPTY_VALUES);
  10538. const valueOnClear = vue.computed(() => {
  10539. if (isFunction$1(props.valueOnClear)) {
  10540. return props.valueOnClear();
  10541. } else if (props.valueOnClear !== void 0) {
  10542. return props.valueOnClear;
  10543. } else if (isFunction$1(config.value.valueOnClear)) {
  10544. return config.value.valueOnClear();
  10545. } else if (config.value.valueOnClear !== void 0) {
  10546. return config.value.valueOnClear;
  10547. }
  10548. return defaultValue !== void 0 ? defaultValue : DEFAULT_VALUE_ON_CLEAR;
  10549. });
  10550. const isEmptyValue = (value) => {
  10551. return emptyValues.value.includes(value);
  10552. };
  10553. if (!emptyValues.value.includes(valueOnClear.value)) ;
  10554. return {
  10555. emptyValues,
  10556. valueOnClear,
  10557. isEmptyValue
  10558. };
  10559. };
  10560. const ariaProps = buildProps({
  10561. ariaLabel: String,
  10562. ariaOrientation: {
  10563. type: String,
  10564. values: ["horizontal", "vertical", "undefined"]
  10565. },
  10566. ariaControls: String
  10567. });
  10568. const useAriaProps = (arias) => {
  10569. return pick(ariaProps, arias);
  10570. };
  10571. const configProviderContextKey = Symbol();
  10572. const globalConfig = vue.ref();
  10573. function useGlobalConfig(key, defaultValue = void 0) {
  10574. const config = vue.getCurrentInstance() ? vue.inject(configProviderContextKey, globalConfig) : globalConfig;
  10575. if (key) {
  10576. return vue.computed(() => {
  10577. var _a, _b;
  10578. return (_b = (_a = config.value) == null ? void 0 : _a[key]) != null ? _b : defaultValue;
  10579. });
  10580. } else {
  10581. return config;
  10582. }
  10583. }
  10584. function useGlobalComponentSettings(block, sizeFallback) {
  10585. const config = useGlobalConfig();
  10586. const ns = useNamespace(block, vue.computed(() => {
  10587. var _a;
  10588. return ((_a = config.value) == null ? void 0 : _a.namespace) || defaultNamespace;
  10589. }));
  10590. const locale = useLocale(vue.computed(() => {
  10591. var _a;
  10592. return (_a = config.value) == null ? void 0 : _a.locale;
  10593. }));
  10594. const zIndex = useZIndex(vue.computed(() => {
  10595. var _a;
  10596. return ((_a = config.value) == null ? void 0 : _a.zIndex) || defaultInitialZIndex;
  10597. }));
  10598. const size = vue.computed(() => {
  10599. var _a;
  10600. return vue.unref(sizeFallback) || ((_a = config.value) == null ? void 0 : _a.size) || "";
  10601. });
  10602. provideGlobalConfig(vue.computed(() => vue.unref(config) || {}));
  10603. return {
  10604. ns,
  10605. locale,
  10606. zIndex,
  10607. size
  10608. };
  10609. }
  10610. const provideGlobalConfig = (config, app, global = false) => {
  10611. var _a;
  10612. const inSetup = !!vue.getCurrentInstance();
  10613. const oldConfig = inSetup ? useGlobalConfig() : void 0;
  10614. const provideFn = (_a = app == null ? void 0 : app.provide) != null ? _a : inSetup ? vue.provide : void 0;
  10615. if (!provideFn) {
  10616. return;
  10617. }
  10618. const context = vue.computed(() => {
  10619. const cfg = vue.unref(config);
  10620. if (!(oldConfig == null ? void 0 : oldConfig.value))
  10621. return cfg;
  10622. return mergeConfig(oldConfig.value, cfg);
  10623. });
  10624. provideFn(configProviderContextKey, context);
  10625. provideFn(localeContextKey, vue.computed(() => context.value.locale));
  10626. provideFn(namespaceContextKey, vue.computed(() => context.value.namespace));
  10627. provideFn(zIndexContextKey, vue.computed(() => context.value.zIndex));
  10628. provideFn(SIZE_INJECTION_KEY, {
  10629. size: vue.computed(() => context.value.size || "")
  10630. });
  10631. provideFn(emptyValuesContextKey, vue.computed(() => ({
  10632. emptyValues: context.value.emptyValues,
  10633. valueOnClear: context.value.valueOnClear
  10634. })));
  10635. if (global || !globalConfig.value) {
  10636. globalConfig.value = context.value;
  10637. }
  10638. return context;
  10639. };
  10640. const mergeConfig = (a, b) => {
  10641. const keys = [.../* @__PURE__ */ new Set([...keysOf(a), ...keysOf(b)])];
  10642. const obj = {};
  10643. for (const key of keys) {
  10644. obj[key] = b[key] !== void 0 ? b[key] : a[key];
  10645. }
  10646. return obj;
  10647. };
  10648. const configProviderProps = buildProps({
  10649. a11y: {
  10650. type: Boolean,
  10651. default: true
  10652. },
  10653. locale: {
  10654. type: definePropType(Object)
  10655. },
  10656. size: useSizeProp,
  10657. button: {
  10658. type: definePropType(Object)
  10659. },
  10660. experimentalFeatures: {
  10661. type: definePropType(Object)
  10662. },
  10663. keyboardNavigation: {
  10664. type: Boolean,
  10665. default: true
  10666. },
  10667. message: {
  10668. type: definePropType(Object)
  10669. },
  10670. zIndex: Number,
  10671. namespace: {
  10672. type: String,
  10673. default: "el"
  10674. },
  10675. ...useEmptyValuesProps
  10676. });
  10677. const messageConfig = {};
  10678. const ConfigProvider = vue.defineComponent({
  10679. name: "ElConfigProvider",
  10680. props: configProviderProps,
  10681. setup(props, { slots }) {
  10682. vue.watch(() => props.message, (val) => {
  10683. Object.assign(messageConfig, val != null ? val : {});
  10684. }, { immediate: true, deep: true });
  10685. const config = provideGlobalConfig(props);
  10686. return () => vue.renderSlot(slots, "default", { config: config == null ? void 0 : config.value });
  10687. }
  10688. });
  10689. const ElConfigProvider = withInstall(ConfigProvider);
  10690. const version$1 = "2.9.1";
  10691. const makeInstaller = (components = []) => {
  10692. const install = (app, options) => {
  10693. if (app[INSTALLED_KEY])
  10694. return;
  10695. app[INSTALLED_KEY] = true;
  10696. components.forEach((c) => app.use(c));
  10697. if (options)
  10698. provideGlobalConfig(options, app, true);
  10699. };
  10700. return {
  10701. version: version$1,
  10702. install
  10703. };
  10704. };
  10705. const affixProps = buildProps({
  10706. zIndex: {
  10707. type: definePropType([Number, String]),
  10708. default: 100
  10709. },
  10710. target: {
  10711. type: String,
  10712. default: ""
  10713. },
  10714. offset: {
  10715. type: Number,
  10716. default: 0
  10717. },
  10718. position: {
  10719. type: String,
  10720. values: ["top", "bottom"],
  10721. default: "top"
  10722. }
  10723. });
  10724. const affixEmits = {
  10725. scroll: ({ scrollTop, fixed }) => isNumber(scrollTop) && isBoolean(fixed),
  10726. [CHANGE_EVENT]: (fixed) => isBoolean(fixed)
  10727. };
  10728. var _export_sfc = (sfc, props) => {
  10729. const target = sfc.__vccOpts || sfc;
  10730. for (const [key, val] of props) {
  10731. target[key] = val;
  10732. }
  10733. return target;
  10734. };
  10735. const COMPONENT_NAME$n = "ElAffix";
  10736. const __default__$1R = vue.defineComponent({
  10737. name: COMPONENT_NAME$n
  10738. });
  10739. const _sfc_main$2x = /* @__PURE__ */ vue.defineComponent({
  10740. ...__default__$1R,
  10741. props: affixProps,
  10742. emits: affixEmits,
  10743. setup(__props, { expose, emit }) {
  10744. const props = __props;
  10745. const ns = useNamespace("affix");
  10746. const target = vue.shallowRef();
  10747. const root = vue.shallowRef();
  10748. const scrollContainer = vue.shallowRef();
  10749. const { height: windowHeight } = useWindowSize();
  10750. const {
  10751. height: rootHeight,
  10752. width: rootWidth,
  10753. top: rootTop,
  10754. bottom: rootBottom,
  10755. update: updateRoot
  10756. } = useElementBounding(root, { windowScroll: false });
  10757. const targetRect = useElementBounding(target);
  10758. const fixed = vue.ref(false);
  10759. const scrollTop = vue.ref(0);
  10760. const transform = vue.ref(0);
  10761. const rootStyle = vue.computed(() => {
  10762. return {
  10763. height: fixed.value ? `${rootHeight.value}px` : "",
  10764. width: fixed.value ? `${rootWidth.value}px` : ""
  10765. };
  10766. });
  10767. const affixStyle = vue.computed(() => {
  10768. if (!fixed.value)
  10769. return {};
  10770. const offset = props.offset ? addUnit(props.offset) : 0;
  10771. return {
  10772. height: `${rootHeight.value}px`,
  10773. width: `${rootWidth.value}px`,
  10774. top: props.position === "top" ? offset : "",
  10775. bottom: props.position === "bottom" ? offset : "",
  10776. transform: transform.value ? `translateY(${transform.value}px)` : "",
  10777. zIndex: props.zIndex
  10778. };
  10779. });
  10780. const update = () => {
  10781. if (!scrollContainer.value)
  10782. return;
  10783. scrollTop.value = scrollContainer.value instanceof Window ? document.documentElement.scrollTop : scrollContainer.value.scrollTop || 0;
  10784. const { position, target: target2, offset } = props;
  10785. const rootHeightOffset = offset + rootHeight.value;
  10786. if (position === "top") {
  10787. if (target2) {
  10788. const difference = targetRect.bottom.value - rootHeightOffset;
  10789. fixed.value = offset > rootTop.value && targetRect.bottom.value > 0;
  10790. transform.value = difference < 0 ? difference : 0;
  10791. } else {
  10792. fixed.value = offset > rootTop.value;
  10793. }
  10794. } else if (target2) {
  10795. const difference = windowHeight.value - targetRect.top.value - rootHeightOffset;
  10796. fixed.value = windowHeight.value - offset < rootBottom.value && windowHeight.value > targetRect.top.value;
  10797. transform.value = difference < 0 ? -difference : 0;
  10798. } else {
  10799. fixed.value = windowHeight.value - offset < rootBottom.value;
  10800. }
  10801. };
  10802. const handleScroll = () => {
  10803. updateRoot();
  10804. emit("scroll", {
  10805. scrollTop: scrollTop.value,
  10806. fixed: fixed.value
  10807. });
  10808. };
  10809. vue.watch(fixed, (val) => emit("change", val));
  10810. vue.onMounted(() => {
  10811. var _a;
  10812. if (props.target) {
  10813. target.value = (_a = document.querySelector(props.target)) != null ? _a : void 0;
  10814. if (!target.value)
  10815. throwError(COMPONENT_NAME$n, `Target does not exist: ${props.target}`);
  10816. } else {
  10817. target.value = document.documentElement;
  10818. }
  10819. scrollContainer.value = getScrollContainer(root.value, true);
  10820. updateRoot();
  10821. });
  10822. useEventListener(scrollContainer, "scroll", handleScroll);
  10823. vue.watchEffect(update);
  10824. expose({
  10825. update,
  10826. updateRoot
  10827. });
  10828. return (_ctx, _cache) => {
  10829. return vue.openBlock(), vue.createElementBlock("div", {
  10830. ref_key: "root",
  10831. ref: root,
  10832. class: vue.normalizeClass(vue.unref(ns).b()),
  10833. style: vue.normalizeStyle(vue.unref(rootStyle))
  10834. }, [
  10835. vue.createElementVNode("div", {
  10836. class: vue.normalizeClass({ [vue.unref(ns).m("fixed")]: fixed.value }),
  10837. style: vue.normalizeStyle(vue.unref(affixStyle))
  10838. }, [
  10839. vue.renderSlot(_ctx.$slots, "default")
  10840. ], 6)
  10841. ], 6);
  10842. };
  10843. }
  10844. });
  10845. var Affix = /* @__PURE__ */ _export_sfc(_sfc_main$2x, [["__file", "affix.vue"]]);
  10846. const ElAffix = withInstall(Affix);
  10847. const iconProps = buildProps({
  10848. size: {
  10849. type: definePropType([Number, String])
  10850. },
  10851. color: {
  10852. type: String
  10853. }
  10854. });
  10855. const __default__$1Q = vue.defineComponent({
  10856. name: "ElIcon",
  10857. inheritAttrs: false
  10858. });
  10859. const _sfc_main$2w = /* @__PURE__ */ vue.defineComponent({
  10860. ...__default__$1Q,
  10861. props: iconProps,
  10862. setup(__props) {
  10863. const props = __props;
  10864. const ns = useNamespace("icon");
  10865. const style = vue.computed(() => {
  10866. const { size, color } = props;
  10867. if (!size && !color)
  10868. return {};
  10869. return {
  10870. fontSize: isUndefined(size) ? void 0 : addUnit(size),
  10871. "--color": color
  10872. };
  10873. });
  10874. return (_ctx, _cache) => {
  10875. return vue.openBlock(), vue.createElementBlock("i", vue.mergeProps({
  10876. class: vue.unref(ns).b(),
  10877. style: vue.unref(style)
  10878. }, _ctx.$attrs), [
  10879. vue.renderSlot(_ctx.$slots, "default")
  10880. ], 16);
  10881. };
  10882. }
  10883. });
  10884. var Icon = /* @__PURE__ */ _export_sfc(_sfc_main$2w, [["__file", "icon.vue"]]);
  10885. const ElIcon = withInstall(Icon);
  10886. const alertEffects = ["light", "dark"];
  10887. const alertProps = buildProps({
  10888. title: {
  10889. type: String,
  10890. default: ""
  10891. },
  10892. description: {
  10893. type: String,
  10894. default: ""
  10895. },
  10896. type: {
  10897. type: String,
  10898. values: keysOf(TypeComponentsMap),
  10899. default: "info"
  10900. },
  10901. closable: {
  10902. type: Boolean,
  10903. default: true
  10904. },
  10905. closeText: {
  10906. type: String,
  10907. default: ""
  10908. },
  10909. showIcon: Boolean,
  10910. center: Boolean,
  10911. effect: {
  10912. type: String,
  10913. values: alertEffects,
  10914. default: "light"
  10915. }
  10916. });
  10917. const alertEmits = {
  10918. close: (evt) => evt instanceof MouseEvent
  10919. };
  10920. const __default__$1P = vue.defineComponent({
  10921. name: "ElAlert"
  10922. });
  10923. const _sfc_main$2v = /* @__PURE__ */ vue.defineComponent({
  10924. ...__default__$1P,
  10925. props: alertProps,
  10926. emits: alertEmits,
  10927. setup(__props, { emit }) {
  10928. const props = __props;
  10929. const { Close } = TypeComponents;
  10930. const slots = vue.useSlots();
  10931. const ns = useNamespace("alert");
  10932. const visible = vue.ref(true);
  10933. const iconComponent = vue.computed(() => TypeComponentsMap[props.type]);
  10934. const hasDesc = vue.computed(() => !!(props.description || slots.default));
  10935. const close = (evt) => {
  10936. visible.value = false;
  10937. emit("close", evt);
  10938. };
  10939. return (_ctx, _cache) => {
  10940. return vue.openBlock(), vue.createBlock(vue.Transition, {
  10941. name: vue.unref(ns).b("fade"),
  10942. persisted: ""
  10943. }, {
  10944. default: vue.withCtx(() => [
  10945. vue.withDirectives(vue.createElementVNode("div", {
  10946. class: vue.normalizeClass([vue.unref(ns).b(), vue.unref(ns).m(_ctx.type), vue.unref(ns).is("center", _ctx.center), vue.unref(ns).is(_ctx.effect)]),
  10947. role: "alert"
  10948. }, [
  10949. _ctx.showIcon && vue.unref(iconComponent) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  10950. key: 0,
  10951. class: vue.normalizeClass([vue.unref(ns).e("icon"), { [vue.unref(ns).is("big")]: vue.unref(hasDesc) }])
  10952. }, {
  10953. default: vue.withCtx(() => [
  10954. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(iconComponent))))
  10955. ]),
  10956. _: 1
  10957. }, 8, ["class"])) : vue.createCommentVNode("v-if", true),
  10958. vue.createElementVNode("div", {
  10959. class: vue.normalizeClass(vue.unref(ns).e("content"))
  10960. }, [
  10961. _ctx.title || _ctx.$slots.title ? (vue.openBlock(), vue.createElementBlock("span", {
  10962. key: 0,
  10963. class: vue.normalizeClass([vue.unref(ns).e("title"), { "with-description": vue.unref(hasDesc) }])
  10964. }, [
  10965. vue.renderSlot(_ctx.$slots, "title", {}, () => [
  10966. vue.createTextVNode(vue.toDisplayString(_ctx.title), 1)
  10967. ])
  10968. ], 2)) : vue.createCommentVNode("v-if", true),
  10969. vue.unref(hasDesc) ? (vue.openBlock(), vue.createElementBlock("p", {
  10970. key: 1,
  10971. class: vue.normalizeClass(vue.unref(ns).e("description"))
  10972. }, [
  10973. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  10974. vue.createTextVNode(vue.toDisplayString(_ctx.description), 1)
  10975. ])
  10976. ], 2)) : vue.createCommentVNode("v-if", true),
  10977. _ctx.closable ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 2 }, [
  10978. _ctx.closeText ? (vue.openBlock(), vue.createElementBlock("div", {
  10979. key: 0,
  10980. class: vue.normalizeClass([vue.unref(ns).e("close-btn"), vue.unref(ns).is("customed")]),
  10981. onClick: close
  10982. }, vue.toDisplayString(_ctx.closeText), 3)) : (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  10983. key: 1,
  10984. class: vue.normalizeClass(vue.unref(ns).e("close-btn")),
  10985. onClick: close
  10986. }, {
  10987. default: vue.withCtx(() => [
  10988. vue.createVNode(vue.unref(Close))
  10989. ]),
  10990. _: 1
  10991. }, 8, ["class"]))
  10992. ], 64)) : vue.createCommentVNode("v-if", true)
  10993. ], 2)
  10994. ], 2), [
  10995. [vue.vShow, visible.value]
  10996. ])
  10997. ]),
  10998. _: 3
  10999. }, 8, ["name"]);
  11000. };
  11001. }
  11002. });
  11003. var Alert = /* @__PURE__ */ _export_sfc(_sfc_main$2v, [["__file", "alert.vue"]]);
  11004. const ElAlert = withInstall(Alert);
  11005. const formContextKey = Symbol("formContextKey");
  11006. const formItemContextKey = Symbol("formItemContextKey");
  11007. const useFormSize = (fallback, ignore = {}) => {
  11008. const emptyRef = vue.ref(void 0);
  11009. const size = ignore.prop ? emptyRef : useProp("size");
  11010. const globalConfig = ignore.global ? emptyRef : useGlobalSize();
  11011. const form = ignore.form ? { size: void 0 } : vue.inject(formContextKey, void 0);
  11012. const formItem = ignore.formItem ? { size: void 0 } : vue.inject(formItemContextKey, void 0);
  11013. return vue.computed(() => size.value || vue.unref(fallback) || (formItem == null ? void 0 : formItem.size) || (form == null ? void 0 : form.size) || globalConfig.value || "");
  11014. };
  11015. const useFormDisabled = (fallback) => {
  11016. const disabled = useProp("disabled");
  11017. const form = vue.inject(formContextKey, void 0);
  11018. return vue.computed(() => disabled.value || vue.unref(fallback) || (form == null ? void 0 : form.disabled) || false);
  11019. };
  11020. const useSize = useFormSize;
  11021. const useDisabled = useFormDisabled;
  11022. const useFormItem = () => {
  11023. const form = vue.inject(formContextKey, void 0);
  11024. const formItem = vue.inject(formItemContextKey, void 0);
  11025. return {
  11026. form,
  11027. formItem
  11028. };
  11029. };
  11030. const useFormItemInputId = (props, {
  11031. formItemContext,
  11032. disableIdGeneration,
  11033. disableIdManagement
  11034. }) => {
  11035. if (!disableIdGeneration) {
  11036. disableIdGeneration = vue.ref(false);
  11037. }
  11038. if (!disableIdManagement) {
  11039. disableIdManagement = vue.ref(false);
  11040. }
  11041. const inputId = vue.ref();
  11042. let idUnwatch = void 0;
  11043. const isLabeledByFormItem = vue.computed(() => {
  11044. var _a;
  11045. return !!(!(props.label || props.ariaLabel) && formItemContext && formItemContext.inputIds && ((_a = formItemContext.inputIds) == null ? void 0 : _a.length) <= 1);
  11046. });
  11047. vue.onMounted(() => {
  11048. idUnwatch = vue.watch([vue.toRef(props, "id"), disableIdGeneration], ([id, disableIdGeneration2]) => {
  11049. const newId = id != null ? id : !disableIdGeneration2 ? useId().value : void 0;
  11050. if (newId !== inputId.value) {
  11051. if (formItemContext == null ? void 0 : formItemContext.removeInputId) {
  11052. inputId.value && formItemContext.removeInputId(inputId.value);
  11053. if (!(disableIdManagement == null ? void 0 : disableIdManagement.value) && !disableIdGeneration2 && newId) {
  11054. formItemContext.addInputId(newId);
  11055. }
  11056. }
  11057. inputId.value = newId;
  11058. }
  11059. }, { immediate: true });
  11060. });
  11061. vue.onUnmounted(() => {
  11062. idUnwatch && idUnwatch();
  11063. if (formItemContext == null ? void 0 : formItemContext.removeInputId) {
  11064. inputId.value && formItemContext.removeInputId(inputId.value);
  11065. }
  11066. });
  11067. return {
  11068. isLabeledByFormItem,
  11069. inputId
  11070. };
  11071. };
  11072. const formMetaProps = buildProps({
  11073. size: {
  11074. type: String,
  11075. values: componentSizes
  11076. },
  11077. disabled: Boolean
  11078. });
  11079. const formProps = buildProps({
  11080. ...formMetaProps,
  11081. model: Object,
  11082. rules: {
  11083. type: definePropType(Object)
  11084. },
  11085. labelPosition: {
  11086. type: String,
  11087. values: ["left", "right", "top"],
  11088. default: "right"
  11089. },
  11090. requireAsteriskPosition: {
  11091. type: String,
  11092. values: ["left", "right"],
  11093. default: "left"
  11094. },
  11095. labelWidth: {
  11096. type: [String, Number],
  11097. default: ""
  11098. },
  11099. labelSuffix: {
  11100. type: String,
  11101. default: ""
  11102. },
  11103. inline: Boolean,
  11104. inlineMessage: Boolean,
  11105. statusIcon: Boolean,
  11106. showMessage: {
  11107. type: Boolean,
  11108. default: true
  11109. },
  11110. validateOnRuleChange: {
  11111. type: Boolean,
  11112. default: true
  11113. },
  11114. hideRequiredAsterisk: Boolean,
  11115. scrollToError: Boolean,
  11116. scrollIntoViewOptions: {
  11117. type: [Object, Boolean]
  11118. }
  11119. });
  11120. const formEmits = {
  11121. validate: (prop, isValid, message) => (isArray$1(prop) || isString$1(prop)) && isBoolean(isValid) && isString$1(message)
  11122. };
  11123. function useFormLabelWidth() {
  11124. const potentialLabelWidthArr = vue.ref([]);
  11125. const autoLabelWidth = vue.computed(() => {
  11126. if (!potentialLabelWidthArr.value.length)
  11127. return "0";
  11128. const max = Math.max(...potentialLabelWidthArr.value);
  11129. return max ? `${max}px` : "";
  11130. });
  11131. function getLabelWidthIndex(width) {
  11132. const index = potentialLabelWidthArr.value.indexOf(width);
  11133. if (index === -1 && autoLabelWidth.value === "0") ;
  11134. return index;
  11135. }
  11136. function registerLabelWidth(val, oldVal) {
  11137. if (val && oldVal) {
  11138. const index = getLabelWidthIndex(oldVal);
  11139. potentialLabelWidthArr.value.splice(index, 1, val);
  11140. } else if (val) {
  11141. potentialLabelWidthArr.value.push(val);
  11142. }
  11143. }
  11144. function deregisterLabelWidth(val) {
  11145. const index = getLabelWidthIndex(val);
  11146. if (index > -1) {
  11147. potentialLabelWidthArr.value.splice(index, 1);
  11148. }
  11149. }
  11150. return {
  11151. autoLabelWidth,
  11152. registerLabelWidth,
  11153. deregisterLabelWidth
  11154. };
  11155. }
  11156. const filterFields = (fields, props) => {
  11157. const normalized = castArray$1(props);
  11158. return normalized.length > 0 ? fields.filter((field) => field.prop && normalized.includes(field.prop)) : fields;
  11159. };
  11160. const COMPONENT_NAME$m = "ElForm";
  11161. const __default__$1O = vue.defineComponent({
  11162. name: COMPONENT_NAME$m
  11163. });
  11164. const _sfc_main$2u = /* @__PURE__ */ vue.defineComponent({
  11165. ...__default__$1O,
  11166. props: formProps,
  11167. emits: formEmits,
  11168. setup(__props, { expose, emit }) {
  11169. const props = __props;
  11170. const fields = [];
  11171. const formSize = useFormSize();
  11172. const ns = useNamespace("form");
  11173. const formClasses = vue.computed(() => {
  11174. const { labelPosition, inline } = props;
  11175. return [
  11176. ns.b(),
  11177. ns.m(formSize.value || "default"),
  11178. {
  11179. [ns.m(`label-${labelPosition}`)]: labelPosition,
  11180. [ns.m("inline")]: inline
  11181. }
  11182. ];
  11183. });
  11184. const getField = (prop) => {
  11185. return fields.find((field) => field.prop === prop);
  11186. };
  11187. const addField = (field) => {
  11188. fields.push(field);
  11189. };
  11190. const removeField = (field) => {
  11191. if (field.prop) {
  11192. fields.splice(fields.indexOf(field), 1);
  11193. }
  11194. };
  11195. const resetFields = (properties = []) => {
  11196. if (!props.model) {
  11197. return;
  11198. }
  11199. filterFields(fields, properties).forEach((field) => field.resetField());
  11200. };
  11201. const clearValidate = (props2 = []) => {
  11202. filterFields(fields, props2).forEach((field) => field.clearValidate());
  11203. };
  11204. const isValidatable = vue.computed(() => {
  11205. const hasModel = !!props.model;
  11206. return hasModel;
  11207. });
  11208. const obtainValidateFields = (props2) => {
  11209. if (fields.length === 0)
  11210. return [];
  11211. const filteredFields = filterFields(fields, props2);
  11212. if (!filteredFields.length) {
  11213. return [];
  11214. }
  11215. return filteredFields;
  11216. };
  11217. const validate = async (callback) => validateField(void 0, callback);
  11218. const doValidateField = async (props2 = []) => {
  11219. if (!isValidatable.value)
  11220. return false;
  11221. const fields2 = obtainValidateFields(props2);
  11222. if (fields2.length === 0)
  11223. return true;
  11224. let validationErrors = {};
  11225. for (const field of fields2) {
  11226. try {
  11227. await field.validate("");
  11228. } catch (fields3) {
  11229. validationErrors = {
  11230. ...validationErrors,
  11231. ...fields3
  11232. };
  11233. }
  11234. }
  11235. if (Object.keys(validationErrors).length === 0)
  11236. return true;
  11237. return Promise.reject(validationErrors);
  11238. };
  11239. const validateField = async (modelProps = [], callback) => {
  11240. const shouldThrow = !isFunction$1(callback);
  11241. try {
  11242. const result = await doValidateField(modelProps);
  11243. if (result === true) {
  11244. await (callback == null ? void 0 : callback(result));
  11245. }
  11246. return result;
  11247. } catch (e) {
  11248. if (e instanceof Error)
  11249. throw e;
  11250. const invalidFields = e;
  11251. if (props.scrollToError) {
  11252. scrollToField(Object.keys(invalidFields)[0]);
  11253. }
  11254. await (callback == null ? void 0 : callback(false, invalidFields));
  11255. return shouldThrow && Promise.reject(invalidFields);
  11256. }
  11257. };
  11258. const scrollToField = (prop) => {
  11259. var _a;
  11260. const field = filterFields(fields, prop)[0];
  11261. if (field) {
  11262. (_a = field.$el) == null ? void 0 : _a.scrollIntoView(props.scrollIntoViewOptions);
  11263. }
  11264. };
  11265. vue.watch(() => props.rules, () => {
  11266. if (props.validateOnRuleChange) {
  11267. validate().catch((err) => debugWarn());
  11268. }
  11269. }, { deep: true });
  11270. vue.provide(formContextKey, vue.reactive({
  11271. ...vue.toRefs(props),
  11272. emit,
  11273. resetFields,
  11274. clearValidate,
  11275. validateField,
  11276. getField,
  11277. addField,
  11278. removeField,
  11279. ...useFormLabelWidth()
  11280. }));
  11281. expose({
  11282. validate,
  11283. validateField,
  11284. resetFields,
  11285. clearValidate,
  11286. scrollToField,
  11287. fields
  11288. });
  11289. return (_ctx, _cache) => {
  11290. return vue.openBlock(), vue.createElementBlock("form", {
  11291. class: vue.normalizeClass(vue.unref(formClasses))
  11292. }, [
  11293. vue.renderSlot(_ctx.$slots, "default")
  11294. ], 2);
  11295. };
  11296. }
  11297. });
  11298. var Form = /* @__PURE__ */ _export_sfc(_sfc_main$2u, [["__file", "form.vue"]]);
  11299. function _extends() {
  11300. _extends = Object.assign ? Object.assign.bind() : function(target) {
  11301. for (var i = 1; i < arguments.length; i++) {
  11302. var source = arguments[i];
  11303. for (var key in source) {
  11304. if (Object.prototype.hasOwnProperty.call(source, key)) {
  11305. target[key] = source[key];
  11306. }
  11307. }
  11308. }
  11309. return target;
  11310. };
  11311. return _extends.apply(this, arguments);
  11312. }
  11313. function _inheritsLoose(subClass, superClass) {
  11314. subClass.prototype = Object.create(superClass.prototype);
  11315. subClass.prototype.constructor = subClass;
  11316. _setPrototypeOf(subClass, superClass);
  11317. }
  11318. function _getPrototypeOf(o) {
  11319. _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf2(o2) {
  11320. return o2.__proto__ || Object.getPrototypeOf(o2);
  11321. };
  11322. return _getPrototypeOf(o);
  11323. }
  11324. function _setPrototypeOf(o, p) {
  11325. _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf2(o2, p2) {
  11326. o2.__proto__ = p2;
  11327. return o2;
  11328. };
  11329. return _setPrototypeOf(o, p);
  11330. }
  11331. function _isNativeReflectConstruct() {
  11332. if (typeof Reflect === "undefined" || !Reflect.construct)
  11333. return false;
  11334. if (Reflect.construct.sham)
  11335. return false;
  11336. if (typeof Proxy === "function")
  11337. return true;
  11338. try {
  11339. Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
  11340. }));
  11341. return true;
  11342. } catch (e) {
  11343. return false;
  11344. }
  11345. }
  11346. function _construct(Parent, args, Class) {
  11347. if (_isNativeReflectConstruct()) {
  11348. _construct = Reflect.construct.bind();
  11349. } else {
  11350. _construct = function _construct2(Parent2, args2, Class2) {
  11351. var a = [null];
  11352. a.push.apply(a, args2);
  11353. var Constructor = Function.bind.apply(Parent2, a);
  11354. var instance = new Constructor();
  11355. if (Class2)
  11356. _setPrototypeOf(instance, Class2.prototype);
  11357. return instance;
  11358. };
  11359. }
  11360. return _construct.apply(null, arguments);
  11361. }
  11362. function _isNativeFunction(fn) {
  11363. return Function.toString.call(fn).indexOf("[native code]") !== -1;
  11364. }
  11365. function _wrapNativeSuper(Class) {
  11366. var _cache = typeof Map === "function" ? /* @__PURE__ */ new Map() : void 0;
  11367. _wrapNativeSuper = function _wrapNativeSuper2(Class2) {
  11368. if (Class2 === null || !_isNativeFunction(Class2))
  11369. return Class2;
  11370. if (typeof Class2 !== "function") {
  11371. throw new TypeError("Super expression must either be null or a function");
  11372. }
  11373. if (typeof _cache !== "undefined") {
  11374. if (_cache.has(Class2))
  11375. return _cache.get(Class2);
  11376. _cache.set(Class2, Wrapper);
  11377. }
  11378. function Wrapper() {
  11379. return _construct(Class2, arguments, _getPrototypeOf(this).constructor);
  11380. }
  11381. Wrapper.prototype = Object.create(Class2.prototype, {
  11382. constructor: {
  11383. value: Wrapper,
  11384. enumerable: false,
  11385. writable: true,
  11386. configurable: true
  11387. }
  11388. });
  11389. return _setPrototypeOf(Wrapper, Class2);
  11390. };
  11391. return _wrapNativeSuper(Class);
  11392. }
  11393. var formatRegExp = /%[sdj%]/g;
  11394. var warning = function warning2() {
  11395. };
  11396. if (typeof process !== "undefined" && process.env && false) {
  11397. warning = function warning3(type4, errors) {
  11398. if (typeof console !== "undefined" && console.warn && typeof ASYNC_VALIDATOR_NO_WARNING === "undefined") {
  11399. if (errors.every(function(e) {
  11400. return typeof e === "string";
  11401. })) {
  11402. console.warn(type4, errors);
  11403. }
  11404. }
  11405. };
  11406. }
  11407. function convertFieldsError(errors) {
  11408. if (!errors || !errors.length)
  11409. return null;
  11410. var fields = {};
  11411. errors.forEach(function(error) {
  11412. var field = error.field;
  11413. fields[field] = fields[field] || [];
  11414. fields[field].push(error);
  11415. });
  11416. return fields;
  11417. }
  11418. function format(template) {
  11419. for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  11420. args[_key - 1] = arguments[_key];
  11421. }
  11422. var i = 0;
  11423. var len = args.length;
  11424. if (typeof template === "function") {
  11425. return template.apply(null, args);
  11426. }
  11427. if (typeof template === "string") {
  11428. var str = template.replace(formatRegExp, function(x) {
  11429. if (x === "%%") {
  11430. return "%";
  11431. }
  11432. if (i >= len) {
  11433. return x;
  11434. }
  11435. switch (x) {
  11436. case "%s":
  11437. return String(args[i++]);
  11438. case "%d":
  11439. return Number(args[i++]);
  11440. case "%j":
  11441. try {
  11442. return JSON.stringify(args[i++]);
  11443. } catch (_) {
  11444. return "[Circular]";
  11445. }
  11446. break;
  11447. default:
  11448. return x;
  11449. }
  11450. });
  11451. return str;
  11452. }
  11453. return template;
  11454. }
  11455. function isNativeStringType(type4) {
  11456. return type4 === "string" || type4 === "url" || type4 === "hex" || type4 === "email" || type4 === "date" || type4 === "pattern";
  11457. }
  11458. function isEmptyValue(value, type4) {
  11459. if (value === void 0 || value === null) {
  11460. return true;
  11461. }
  11462. if (type4 === "array" && Array.isArray(value) && !value.length) {
  11463. return true;
  11464. }
  11465. if (isNativeStringType(type4) && typeof value === "string" && !value) {
  11466. return true;
  11467. }
  11468. return false;
  11469. }
  11470. function asyncParallelArray(arr, func, callback) {
  11471. var results = [];
  11472. var total = 0;
  11473. var arrLength = arr.length;
  11474. function count(errors) {
  11475. results.push.apply(results, errors || []);
  11476. total++;
  11477. if (total === arrLength) {
  11478. callback(results);
  11479. }
  11480. }
  11481. arr.forEach(function(a) {
  11482. func(a, count);
  11483. });
  11484. }
  11485. function asyncSerialArray(arr, func, callback) {
  11486. var index = 0;
  11487. var arrLength = arr.length;
  11488. function next(errors) {
  11489. if (errors && errors.length) {
  11490. callback(errors);
  11491. return;
  11492. }
  11493. var original = index;
  11494. index = index + 1;
  11495. if (original < arrLength) {
  11496. func(arr[original], next);
  11497. } else {
  11498. callback([]);
  11499. }
  11500. }
  11501. next([]);
  11502. }
  11503. function flattenObjArr(objArr) {
  11504. var ret = [];
  11505. Object.keys(objArr).forEach(function(k) {
  11506. ret.push.apply(ret, objArr[k] || []);
  11507. });
  11508. return ret;
  11509. }
  11510. var AsyncValidationError = /* @__PURE__ */ function(_Error) {
  11511. _inheritsLoose(AsyncValidationError2, _Error);
  11512. function AsyncValidationError2(errors, fields) {
  11513. var _this;
  11514. _this = _Error.call(this, "Async Validation Error") || this;
  11515. _this.errors = errors;
  11516. _this.fields = fields;
  11517. return _this;
  11518. }
  11519. return AsyncValidationError2;
  11520. }(/* @__PURE__ */ _wrapNativeSuper(Error));
  11521. function asyncMap(objArr, option, func, callback, source) {
  11522. if (option.first) {
  11523. var _pending = new Promise(function(resolve, reject) {
  11524. var next = function next2(errors) {
  11525. callback(errors);
  11526. return errors.length ? reject(new AsyncValidationError(errors, convertFieldsError(errors))) : resolve(source);
  11527. };
  11528. var flattenArr = flattenObjArr(objArr);
  11529. asyncSerialArray(flattenArr, func, next);
  11530. });
  11531. _pending["catch"](function(e) {
  11532. return e;
  11533. });
  11534. return _pending;
  11535. }
  11536. var firstFields = option.firstFields === true ? Object.keys(objArr) : option.firstFields || [];
  11537. var objArrKeys = Object.keys(objArr);
  11538. var objArrLength = objArrKeys.length;
  11539. var total = 0;
  11540. var results = [];
  11541. var pending = new Promise(function(resolve, reject) {
  11542. var next = function next2(errors) {
  11543. results.push.apply(results, errors);
  11544. total++;
  11545. if (total === objArrLength) {
  11546. callback(results);
  11547. return results.length ? reject(new AsyncValidationError(results, convertFieldsError(results))) : resolve(source);
  11548. }
  11549. };
  11550. if (!objArrKeys.length) {
  11551. callback(results);
  11552. resolve(source);
  11553. }
  11554. objArrKeys.forEach(function(key) {
  11555. var arr = objArr[key];
  11556. if (firstFields.indexOf(key) !== -1) {
  11557. asyncSerialArray(arr, func, next);
  11558. } else {
  11559. asyncParallelArray(arr, func, next);
  11560. }
  11561. });
  11562. });
  11563. pending["catch"](function(e) {
  11564. return e;
  11565. });
  11566. return pending;
  11567. }
  11568. function isErrorObj(obj) {
  11569. return !!(obj && obj.message !== void 0);
  11570. }
  11571. function getValue(value, path) {
  11572. var v = value;
  11573. for (var i = 0; i < path.length; i++) {
  11574. if (v == void 0) {
  11575. return v;
  11576. }
  11577. v = v[path[i]];
  11578. }
  11579. return v;
  11580. }
  11581. function complementError(rule, source) {
  11582. return function(oe) {
  11583. var fieldValue;
  11584. if (rule.fullFields) {
  11585. fieldValue = getValue(source, rule.fullFields);
  11586. } else {
  11587. fieldValue = source[oe.field || rule.fullField];
  11588. }
  11589. if (isErrorObj(oe)) {
  11590. oe.field = oe.field || rule.fullField;
  11591. oe.fieldValue = fieldValue;
  11592. return oe;
  11593. }
  11594. return {
  11595. message: typeof oe === "function" ? oe() : oe,
  11596. fieldValue,
  11597. field: oe.field || rule.fullField
  11598. };
  11599. };
  11600. }
  11601. function deepMerge(target, source) {
  11602. if (source) {
  11603. for (var s in source) {
  11604. if (source.hasOwnProperty(s)) {
  11605. var value = source[s];
  11606. if (typeof value === "object" && typeof target[s] === "object") {
  11607. target[s] = _extends({}, target[s], value);
  11608. } else {
  11609. target[s] = value;
  11610. }
  11611. }
  11612. }
  11613. }
  11614. return target;
  11615. }
  11616. var required$1 = function required(rule, value, source, errors, options, type4) {
  11617. if (rule.required && (!source.hasOwnProperty(rule.field) || isEmptyValue(value, type4 || rule.type))) {
  11618. errors.push(format(options.messages.required, rule.fullField));
  11619. }
  11620. };
  11621. var whitespace = function whitespace2(rule, value, source, errors, options) {
  11622. if (/^\s+$/.test(value) || value === "") {
  11623. errors.push(format(options.messages.whitespace, rule.fullField));
  11624. }
  11625. };
  11626. var urlReg;
  11627. var getUrlRegex = function() {
  11628. if (urlReg) {
  11629. return urlReg;
  11630. }
  11631. var word = "[a-fA-F\\d:]";
  11632. var b = function b2(options) {
  11633. return options && options.includeBoundaries ? "(?:(?<=\\s|^)(?=" + word + ")|(?<=" + word + ")(?=\\s|$))" : "";
  11634. };
  11635. var v4 = "(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}";
  11636. var v6seg = "[a-fA-F\\d]{1,4}";
  11637. var v6 = ("\n(?:\n(?:" + v6seg + ":){7}(?:" + v6seg + "|:)| // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8\n(?:" + v6seg + ":){6}(?:" + v4 + "|:" + v6seg + "|:)| // 1:2:3:4:5:6:: 1:2:3:4:5:6::8 1:2:3:4:5:6::8 1:2:3:4:5:6::1.2.3.4\n(?:" + v6seg + ":){5}(?::" + v4 + "|(?::" + v6seg + "){1,2}|:)| // 1:2:3:4:5:: 1:2:3:4:5::7:8 1:2:3:4:5::8 1:2:3:4:5::7:1.2.3.4\n(?:" + v6seg + ":){4}(?:(?::" + v6seg + "){0,1}:" + v4 + "|(?::" + v6seg + "){1,3}|:)| // 1:2:3:4:: 1:2:3:4::6:7:8 1:2:3:4::8 1:2:3:4::6:7:1.2.3.4\n(?:" + v6seg + ":){3}(?:(?::" + v6seg + "){0,2}:" + v4 + "|(?::" + v6seg + "){1,4}|:)| // 1:2:3:: 1:2:3::5:6:7:8 1:2:3::8 1:2:3::5:6:7:1.2.3.4\n(?:" + v6seg + ":){2}(?:(?::" + v6seg + "){0,3}:" + v4 + "|(?::" + v6seg + "){1,5}|:)| // 1:2:: 1:2::4:5:6:7:8 1:2::8 1:2::4:5:6:7:1.2.3.4\n(?:" + v6seg + ":){1}(?:(?::" + v6seg + "){0,4}:" + v4 + "|(?::" + v6seg + "){1,6}|:)| // 1:: 1::3:4:5:6:7:8 1::8 1::3:4:5:6:7:1.2.3.4\n(?::(?:(?::" + v6seg + "){0,5}:" + v4 + "|(?::" + v6seg + "){1,7}|:)) // ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::1.2.3.4\n)(?:%[0-9a-zA-Z]{1,})? // %eth0 %1\n").replace(/\s*\/\/.*$/gm, "").replace(/\n/g, "").trim();
  11638. var v46Exact = new RegExp("(?:^" + v4 + "$)|(?:^" + v6 + "$)");
  11639. var v4exact = new RegExp("^" + v4 + "$");
  11640. var v6exact = new RegExp("^" + v6 + "$");
  11641. var ip = function ip2(options) {
  11642. return options && options.exact ? v46Exact : new RegExp("(?:" + b(options) + v4 + b(options) + ")|(?:" + b(options) + v6 + b(options) + ")", "g");
  11643. };
  11644. ip.v4 = function(options) {
  11645. return options && options.exact ? v4exact : new RegExp("" + b(options) + v4 + b(options), "g");
  11646. };
  11647. ip.v6 = function(options) {
  11648. return options && options.exact ? v6exact : new RegExp("" + b(options) + v6 + b(options), "g");
  11649. };
  11650. var protocol = "(?:(?:[a-z]+:)?//)";
  11651. var auth = "(?:\\S+(?::\\S*)?@)?";
  11652. var ipv4 = ip.v4().source;
  11653. var ipv6 = ip.v6().source;
  11654. var host = "(?:(?:[a-z\\u00a1-\\uffff0-9][-_]*)*[a-z\\u00a1-\\uffff0-9]+)";
  11655. var domain = "(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*";
  11656. var tld = "(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))";
  11657. var port = "(?::\\d{2,5})?";
  11658. var path = '(?:[/?#][^\\s"]*)?';
  11659. var regex = "(?:" + protocol + "|www\\.)" + auth + "(?:localhost|" + ipv4 + "|" + ipv6 + "|" + host + domain + tld + ")" + port + path;
  11660. urlReg = new RegExp("(?:^" + regex + "$)", "i");
  11661. return urlReg;
  11662. };
  11663. var pattern$2 = {
  11664. email: /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+\.)+[a-zA-Z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{2,}))$/,
  11665. hex: /^#?([a-f0-9]{6}|[a-f0-9]{3})$/i
  11666. };
  11667. var types = {
  11668. integer: function integer(value) {
  11669. return types.number(value) && parseInt(value, 10) === value;
  11670. },
  11671. "float": function float(value) {
  11672. return types.number(value) && !types.integer(value);
  11673. },
  11674. array: function array(value) {
  11675. return Array.isArray(value);
  11676. },
  11677. regexp: function regexp(value) {
  11678. if (value instanceof RegExp) {
  11679. return true;
  11680. }
  11681. try {
  11682. return !!new RegExp(value);
  11683. } catch (e) {
  11684. return false;
  11685. }
  11686. },
  11687. date: function date(value) {
  11688. return typeof value.getTime === "function" && typeof value.getMonth === "function" && typeof value.getYear === "function" && !isNaN(value.getTime());
  11689. },
  11690. number: function number(value) {
  11691. if (isNaN(value)) {
  11692. return false;
  11693. }
  11694. return typeof value === "number";
  11695. },
  11696. object: function object(value) {
  11697. return typeof value === "object" && !types.array(value);
  11698. },
  11699. method: function method(value) {
  11700. return typeof value === "function";
  11701. },
  11702. email: function email(value) {
  11703. return typeof value === "string" && value.length <= 320 && !!value.match(pattern$2.email);
  11704. },
  11705. url: function url(value) {
  11706. return typeof value === "string" && value.length <= 2048 && !!value.match(getUrlRegex());
  11707. },
  11708. hex: function hex(value) {
  11709. return typeof value === "string" && !!value.match(pattern$2.hex);
  11710. }
  11711. };
  11712. var type$1 = function type(rule, value, source, errors, options) {
  11713. if (rule.required && value === void 0) {
  11714. required$1(rule, value, source, errors, options);
  11715. return;
  11716. }
  11717. var custom = ["integer", "float", "array", "regexp", "object", "method", "email", "number", "date", "url", "hex"];
  11718. var ruleType = rule.type;
  11719. if (custom.indexOf(ruleType) > -1) {
  11720. if (!types[ruleType](value)) {
  11721. errors.push(format(options.messages.types[ruleType], rule.fullField, rule.type));
  11722. }
  11723. } else if (ruleType && typeof value !== rule.type) {
  11724. errors.push(format(options.messages.types[ruleType], rule.fullField, rule.type));
  11725. }
  11726. };
  11727. var range = function range2(rule, value, source, errors, options) {
  11728. var len = typeof rule.len === "number";
  11729. var min = typeof rule.min === "number";
  11730. var max = typeof rule.max === "number";
  11731. var val = value;
  11732. var key = null;
  11733. var num = typeof value === "number";
  11734. var str = typeof value === "string";
  11735. var arr = Array.isArray(value);
  11736. if (num) {
  11737. key = "number";
  11738. } else if (str) {
  11739. key = "string";
  11740. } else if (arr) {
  11741. key = "array";
  11742. }
  11743. if (!key) {
  11744. return false;
  11745. }
  11746. if (arr) {
  11747. val = value.length;
  11748. }
  11749. if (str) {
  11750. val = value.length;
  11751. }
  11752. if (len) {
  11753. if (val !== rule.len) {
  11754. errors.push(format(options.messages[key].len, rule.fullField, rule.len));
  11755. }
  11756. } else if (min && !max && val < rule.min) {
  11757. errors.push(format(options.messages[key].min, rule.fullField, rule.min));
  11758. } else if (max && !min && val > rule.max) {
  11759. errors.push(format(options.messages[key].max, rule.fullField, rule.max));
  11760. } else if (min && max && (val < rule.min || val > rule.max)) {
  11761. errors.push(format(options.messages[key].range, rule.fullField, rule.min, rule.max));
  11762. }
  11763. };
  11764. var ENUM$1 = "enum";
  11765. var enumerable$1 = function enumerable(rule, value, source, errors, options) {
  11766. rule[ENUM$1] = Array.isArray(rule[ENUM$1]) ? rule[ENUM$1] : [];
  11767. if (rule[ENUM$1].indexOf(value) === -1) {
  11768. errors.push(format(options.messages[ENUM$1], rule.fullField, rule[ENUM$1].join(", ")));
  11769. }
  11770. };
  11771. var pattern$1 = function pattern(rule, value, source, errors, options) {
  11772. if (rule.pattern) {
  11773. if (rule.pattern instanceof RegExp) {
  11774. rule.pattern.lastIndex = 0;
  11775. if (!rule.pattern.test(value)) {
  11776. errors.push(format(options.messages.pattern.mismatch, rule.fullField, value, rule.pattern));
  11777. }
  11778. } else if (typeof rule.pattern === "string") {
  11779. var _pattern = new RegExp(rule.pattern);
  11780. if (!_pattern.test(value)) {
  11781. errors.push(format(options.messages.pattern.mismatch, rule.fullField, value, rule.pattern));
  11782. }
  11783. }
  11784. }
  11785. };
  11786. var rules = {
  11787. required: required$1,
  11788. whitespace,
  11789. type: type$1,
  11790. range,
  11791. "enum": enumerable$1,
  11792. pattern: pattern$1
  11793. };
  11794. var string = function string2(rule, value, callback, source, options) {
  11795. var errors = [];
  11796. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  11797. if (validate) {
  11798. if (isEmptyValue(value, "string") && !rule.required) {
  11799. return callback();
  11800. }
  11801. rules.required(rule, value, source, errors, options, "string");
  11802. if (!isEmptyValue(value, "string")) {
  11803. rules.type(rule, value, source, errors, options);
  11804. rules.range(rule, value, source, errors, options);
  11805. rules.pattern(rule, value, source, errors, options);
  11806. if (rule.whitespace === true) {
  11807. rules.whitespace(rule, value, source, errors, options);
  11808. }
  11809. }
  11810. }
  11811. callback(errors);
  11812. };
  11813. var method2 = function method3(rule, value, callback, source, options) {
  11814. var errors = [];
  11815. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  11816. if (validate) {
  11817. if (isEmptyValue(value) && !rule.required) {
  11818. return callback();
  11819. }
  11820. rules.required(rule, value, source, errors, options);
  11821. if (value !== void 0) {
  11822. rules.type(rule, value, source, errors, options);
  11823. }
  11824. }
  11825. callback(errors);
  11826. };
  11827. var number2 = function number3(rule, value, callback, source, options) {
  11828. var errors = [];
  11829. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  11830. if (validate) {
  11831. if (value === "") {
  11832. value = void 0;
  11833. }
  11834. if (isEmptyValue(value) && !rule.required) {
  11835. return callback();
  11836. }
  11837. rules.required(rule, value, source, errors, options);
  11838. if (value !== void 0) {
  11839. rules.type(rule, value, source, errors, options);
  11840. rules.range(rule, value, source, errors, options);
  11841. }
  11842. }
  11843. callback(errors);
  11844. };
  11845. var _boolean = function _boolean2(rule, value, callback, source, options) {
  11846. var errors = [];
  11847. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  11848. if (validate) {
  11849. if (isEmptyValue(value) && !rule.required) {
  11850. return callback();
  11851. }
  11852. rules.required(rule, value, source, errors, options);
  11853. if (value !== void 0) {
  11854. rules.type(rule, value, source, errors, options);
  11855. }
  11856. }
  11857. callback(errors);
  11858. };
  11859. var regexp2 = function regexp3(rule, value, callback, source, options) {
  11860. var errors = [];
  11861. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  11862. if (validate) {
  11863. if (isEmptyValue(value) && !rule.required) {
  11864. return callback();
  11865. }
  11866. rules.required(rule, value, source, errors, options);
  11867. if (!isEmptyValue(value)) {
  11868. rules.type(rule, value, source, errors, options);
  11869. }
  11870. }
  11871. callback(errors);
  11872. };
  11873. var integer2 = function integer3(rule, value, callback, source, options) {
  11874. var errors = [];
  11875. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  11876. if (validate) {
  11877. if (isEmptyValue(value) && !rule.required) {
  11878. return callback();
  11879. }
  11880. rules.required(rule, value, source, errors, options);
  11881. if (value !== void 0) {
  11882. rules.type(rule, value, source, errors, options);
  11883. rules.range(rule, value, source, errors, options);
  11884. }
  11885. }
  11886. callback(errors);
  11887. };
  11888. var floatFn = function floatFn2(rule, value, callback, source, options) {
  11889. var errors = [];
  11890. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  11891. if (validate) {
  11892. if (isEmptyValue(value) && !rule.required) {
  11893. return callback();
  11894. }
  11895. rules.required(rule, value, source, errors, options);
  11896. if (value !== void 0) {
  11897. rules.type(rule, value, source, errors, options);
  11898. rules.range(rule, value, source, errors, options);
  11899. }
  11900. }
  11901. callback(errors);
  11902. };
  11903. var array2 = function array3(rule, value, callback, source, options) {
  11904. var errors = [];
  11905. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  11906. if (validate) {
  11907. if ((value === void 0 || value === null) && !rule.required) {
  11908. return callback();
  11909. }
  11910. rules.required(rule, value, source, errors, options, "array");
  11911. if (value !== void 0 && value !== null) {
  11912. rules.type(rule, value, source, errors, options);
  11913. rules.range(rule, value, source, errors, options);
  11914. }
  11915. }
  11916. callback(errors);
  11917. };
  11918. var object2 = function object3(rule, value, callback, source, options) {
  11919. var errors = [];
  11920. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  11921. if (validate) {
  11922. if (isEmptyValue(value) && !rule.required) {
  11923. return callback();
  11924. }
  11925. rules.required(rule, value, source, errors, options);
  11926. if (value !== void 0) {
  11927. rules.type(rule, value, source, errors, options);
  11928. }
  11929. }
  11930. callback(errors);
  11931. };
  11932. var ENUM = "enum";
  11933. var enumerable2 = function enumerable3(rule, value, callback, source, options) {
  11934. var errors = [];
  11935. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  11936. if (validate) {
  11937. if (isEmptyValue(value) && !rule.required) {
  11938. return callback();
  11939. }
  11940. rules.required(rule, value, source, errors, options);
  11941. if (value !== void 0) {
  11942. rules[ENUM](rule, value, source, errors, options);
  11943. }
  11944. }
  11945. callback(errors);
  11946. };
  11947. var pattern2 = function pattern3(rule, value, callback, source, options) {
  11948. var errors = [];
  11949. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  11950. if (validate) {
  11951. if (isEmptyValue(value, "string") && !rule.required) {
  11952. return callback();
  11953. }
  11954. rules.required(rule, value, source, errors, options);
  11955. if (!isEmptyValue(value, "string")) {
  11956. rules.pattern(rule, value, source, errors, options);
  11957. }
  11958. }
  11959. callback(errors);
  11960. };
  11961. var date2 = function date3(rule, value, callback, source, options) {
  11962. var errors = [];
  11963. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  11964. if (validate) {
  11965. if (isEmptyValue(value, "date") && !rule.required) {
  11966. return callback();
  11967. }
  11968. rules.required(rule, value, source, errors, options);
  11969. if (!isEmptyValue(value, "date")) {
  11970. var dateObject;
  11971. if (value instanceof Date) {
  11972. dateObject = value;
  11973. } else {
  11974. dateObject = new Date(value);
  11975. }
  11976. rules.type(rule, dateObject, source, errors, options);
  11977. if (dateObject) {
  11978. rules.range(rule, dateObject.getTime(), source, errors, options);
  11979. }
  11980. }
  11981. }
  11982. callback(errors);
  11983. };
  11984. var required2 = function required3(rule, value, callback, source, options) {
  11985. var errors = [];
  11986. var type4 = Array.isArray(value) ? "array" : typeof value;
  11987. rules.required(rule, value, source, errors, options, type4);
  11988. callback(errors);
  11989. };
  11990. var type2 = function type3(rule, value, callback, source, options) {
  11991. var ruleType = rule.type;
  11992. var errors = [];
  11993. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  11994. if (validate) {
  11995. if (isEmptyValue(value, ruleType) && !rule.required) {
  11996. return callback();
  11997. }
  11998. rules.required(rule, value, source, errors, options, ruleType);
  11999. if (!isEmptyValue(value, ruleType)) {
  12000. rules.type(rule, value, source, errors, options);
  12001. }
  12002. }
  12003. callback(errors);
  12004. };
  12005. var any = function any2(rule, value, callback, source, options) {
  12006. var errors = [];
  12007. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  12008. if (validate) {
  12009. if (isEmptyValue(value) && !rule.required) {
  12010. return callback();
  12011. }
  12012. rules.required(rule, value, source, errors, options);
  12013. }
  12014. callback(errors);
  12015. };
  12016. var validators = {
  12017. string,
  12018. method: method2,
  12019. number: number2,
  12020. "boolean": _boolean,
  12021. regexp: regexp2,
  12022. integer: integer2,
  12023. "float": floatFn,
  12024. array: array2,
  12025. object: object2,
  12026. "enum": enumerable2,
  12027. pattern: pattern2,
  12028. date: date2,
  12029. url: type2,
  12030. hex: type2,
  12031. email: type2,
  12032. required: required2,
  12033. any
  12034. };
  12035. function newMessages() {
  12036. return {
  12037. "default": "Validation error on field %s",
  12038. required: "%s is required",
  12039. "enum": "%s must be one of %s",
  12040. whitespace: "%s cannot be empty",
  12041. date: {
  12042. format: "%s date %s is invalid for format %s",
  12043. parse: "%s date could not be parsed, %s is invalid ",
  12044. invalid: "%s date %s is invalid"
  12045. },
  12046. types: {
  12047. string: "%s is not a %s",
  12048. method: "%s is not a %s (function)",
  12049. array: "%s is not an %s",
  12050. object: "%s is not an %s",
  12051. number: "%s is not a %s",
  12052. date: "%s is not a %s",
  12053. "boolean": "%s is not a %s",
  12054. integer: "%s is not an %s",
  12055. "float": "%s is not a %s",
  12056. regexp: "%s is not a valid %s",
  12057. email: "%s is not a valid %s",
  12058. url: "%s is not a valid %s",
  12059. hex: "%s is not a valid %s"
  12060. },
  12061. string: {
  12062. len: "%s must be exactly %s characters",
  12063. min: "%s must be at least %s characters",
  12064. max: "%s cannot be longer than %s characters",
  12065. range: "%s must be between %s and %s characters"
  12066. },
  12067. number: {
  12068. len: "%s must equal %s",
  12069. min: "%s cannot be less than %s",
  12070. max: "%s cannot be greater than %s",
  12071. range: "%s must be between %s and %s"
  12072. },
  12073. array: {
  12074. len: "%s must be exactly %s in length",
  12075. min: "%s cannot be less than %s in length",
  12076. max: "%s cannot be greater than %s in length",
  12077. range: "%s must be between %s and %s in length"
  12078. },
  12079. pattern: {
  12080. mismatch: "%s value %s does not match pattern %s"
  12081. },
  12082. clone: function clone() {
  12083. var cloned = JSON.parse(JSON.stringify(this));
  12084. cloned.clone = this.clone;
  12085. return cloned;
  12086. }
  12087. };
  12088. }
  12089. var messages = newMessages();
  12090. var Schema = /* @__PURE__ */ function() {
  12091. function Schema2(descriptor) {
  12092. this.rules = null;
  12093. this._messages = messages;
  12094. this.define(descriptor);
  12095. }
  12096. var _proto = Schema2.prototype;
  12097. _proto.define = function define(rules2) {
  12098. var _this = this;
  12099. if (!rules2) {
  12100. throw new Error("Cannot configure a schema with no rules");
  12101. }
  12102. if (typeof rules2 !== "object" || Array.isArray(rules2)) {
  12103. throw new Error("Rules must be an object");
  12104. }
  12105. this.rules = {};
  12106. Object.keys(rules2).forEach(function(name) {
  12107. var item = rules2[name];
  12108. _this.rules[name] = Array.isArray(item) ? item : [item];
  12109. });
  12110. };
  12111. _proto.messages = function messages2(_messages) {
  12112. if (_messages) {
  12113. this._messages = deepMerge(newMessages(), _messages);
  12114. }
  12115. return this._messages;
  12116. };
  12117. _proto.validate = function validate(source_, o, oc) {
  12118. var _this2 = this;
  12119. if (o === void 0) {
  12120. o = {};
  12121. }
  12122. if (oc === void 0) {
  12123. oc = function oc2() {
  12124. };
  12125. }
  12126. var source = source_;
  12127. var options = o;
  12128. var callback = oc;
  12129. if (typeof options === "function") {
  12130. callback = options;
  12131. options = {};
  12132. }
  12133. if (!this.rules || Object.keys(this.rules).length === 0) {
  12134. if (callback) {
  12135. callback(null, source);
  12136. }
  12137. return Promise.resolve(source);
  12138. }
  12139. function complete(results) {
  12140. var errors = [];
  12141. var fields = {};
  12142. function add(e) {
  12143. if (Array.isArray(e)) {
  12144. var _errors;
  12145. errors = (_errors = errors).concat.apply(_errors, e);
  12146. } else {
  12147. errors.push(e);
  12148. }
  12149. }
  12150. for (var i = 0; i < results.length; i++) {
  12151. add(results[i]);
  12152. }
  12153. if (!errors.length) {
  12154. callback(null, source);
  12155. } else {
  12156. fields = convertFieldsError(errors);
  12157. callback(errors, fields);
  12158. }
  12159. }
  12160. if (options.messages) {
  12161. var messages$1 = this.messages();
  12162. if (messages$1 === messages) {
  12163. messages$1 = newMessages();
  12164. }
  12165. deepMerge(messages$1, options.messages);
  12166. options.messages = messages$1;
  12167. } else {
  12168. options.messages = this.messages();
  12169. }
  12170. var series = {};
  12171. var keys = options.keys || Object.keys(this.rules);
  12172. keys.forEach(function(z) {
  12173. var arr = _this2.rules[z];
  12174. var value = source[z];
  12175. arr.forEach(function(r) {
  12176. var rule = r;
  12177. if (typeof rule.transform === "function") {
  12178. if (source === source_) {
  12179. source = _extends({}, source);
  12180. }
  12181. value = source[z] = rule.transform(value);
  12182. }
  12183. if (typeof rule === "function") {
  12184. rule = {
  12185. validator: rule
  12186. };
  12187. } else {
  12188. rule = _extends({}, rule);
  12189. }
  12190. rule.validator = _this2.getValidationMethod(rule);
  12191. if (!rule.validator) {
  12192. return;
  12193. }
  12194. rule.field = z;
  12195. rule.fullField = rule.fullField || z;
  12196. rule.type = _this2.getType(rule);
  12197. series[z] = series[z] || [];
  12198. series[z].push({
  12199. rule,
  12200. value,
  12201. source,
  12202. field: z
  12203. });
  12204. });
  12205. });
  12206. var errorFields = {};
  12207. return asyncMap(series, options, function(data, doIt) {
  12208. var rule = data.rule;
  12209. var deep = (rule.type === "object" || rule.type === "array") && (typeof rule.fields === "object" || typeof rule.defaultField === "object");
  12210. deep = deep && (rule.required || !rule.required && data.value);
  12211. rule.field = data.field;
  12212. function addFullField(key, schema) {
  12213. return _extends({}, schema, {
  12214. fullField: rule.fullField + "." + key,
  12215. fullFields: rule.fullFields ? [].concat(rule.fullFields, [key]) : [key]
  12216. });
  12217. }
  12218. function cb(e) {
  12219. if (e === void 0) {
  12220. e = [];
  12221. }
  12222. var errorList = Array.isArray(e) ? e : [e];
  12223. if (!options.suppressWarning && errorList.length) {
  12224. Schema2.warning("async-validator:", errorList);
  12225. }
  12226. if (errorList.length && rule.message !== void 0) {
  12227. errorList = [].concat(rule.message);
  12228. }
  12229. var filledErrors = errorList.map(complementError(rule, source));
  12230. if (options.first && filledErrors.length) {
  12231. errorFields[rule.field] = 1;
  12232. return doIt(filledErrors);
  12233. }
  12234. if (!deep) {
  12235. doIt(filledErrors);
  12236. } else {
  12237. if (rule.required && !data.value) {
  12238. if (rule.message !== void 0) {
  12239. filledErrors = [].concat(rule.message).map(complementError(rule, source));
  12240. } else if (options.error) {
  12241. filledErrors = [options.error(rule, format(options.messages.required, rule.field))];
  12242. }
  12243. return doIt(filledErrors);
  12244. }
  12245. var fieldsSchema = {};
  12246. if (rule.defaultField) {
  12247. Object.keys(data.value).map(function(key) {
  12248. fieldsSchema[key] = rule.defaultField;
  12249. });
  12250. }
  12251. fieldsSchema = _extends({}, fieldsSchema, data.rule.fields);
  12252. var paredFieldsSchema = {};
  12253. Object.keys(fieldsSchema).forEach(function(field) {
  12254. var fieldSchema = fieldsSchema[field];
  12255. var fieldSchemaList = Array.isArray(fieldSchema) ? fieldSchema : [fieldSchema];
  12256. paredFieldsSchema[field] = fieldSchemaList.map(addFullField.bind(null, field));
  12257. });
  12258. var schema = new Schema2(paredFieldsSchema);
  12259. schema.messages(options.messages);
  12260. if (data.rule.options) {
  12261. data.rule.options.messages = options.messages;
  12262. data.rule.options.error = options.error;
  12263. }
  12264. schema.validate(data.value, data.rule.options || options, function(errs) {
  12265. var finalErrors = [];
  12266. if (filledErrors && filledErrors.length) {
  12267. finalErrors.push.apply(finalErrors, filledErrors);
  12268. }
  12269. if (errs && errs.length) {
  12270. finalErrors.push.apply(finalErrors, errs);
  12271. }
  12272. doIt(finalErrors.length ? finalErrors : null);
  12273. });
  12274. }
  12275. }
  12276. var res;
  12277. if (rule.asyncValidator) {
  12278. res = rule.asyncValidator(rule, data.value, cb, data.source, options);
  12279. } else if (rule.validator) {
  12280. try {
  12281. res = rule.validator(rule, data.value, cb, data.source, options);
  12282. } catch (error) {
  12283. console.error == null ? void 0 : console.error(error);
  12284. if (!options.suppressValidatorError) {
  12285. setTimeout(function() {
  12286. throw error;
  12287. }, 0);
  12288. }
  12289. cb(error.message);
  12290. }
  12291. if (res === true) {
  12292. cb();
  12293. } else if (res === false) {
  12294. cb(typeof rule.message === "function" ? rule.message(rule.fullField || rule.field) : rule.message || (rule.fullField || rule.field) + " fails");
  12295. } else if (res instanceof Array) {
  12296. cb(res);
  12297. } else if (res instanceof Error) {
  12298. cb(res.message);
  12299. }
  12300. }
  12301. if (res && res.then) {
  12302. res.then(function() {
  12303. return cb();
  12304. }, function(e) {
  12305. return cb(e);
  12306. });
  12307. }
  12308. }, function(results) {
  12309. complete(results);
  12310. }, source);
  12311. };
  12312. _proto.getType = function getType(rule) {
  12313. if (rule.type === void 0 && rule.pattern instanceof RegExp) {
  12314. rule.type = "pattern";
  12315. }
  12316. if (typeof rule.validator !== "function" && rule.type && !validators.hasOwnProperty(rule.type)) {
  12317. throw new Error(format("Unknown rule type %s", rule.type));
  12318. }
  12319. return rule.type || "string";
  12320. };
  12321. _proto.getValidationMethod = function getValidationMethod(rule) {
  12322. if (typeof rule.validator === "function") {
  12323. return rule.validator;
  12324. }
  12325. var keys = Object.keys(rule);
  12326. var messageIndex = keys.indexOf("message");
  12327. if (messageIndex !== -1) {
  12328. keys.splice(messageIndex, 1);
  12329. }
  12330. if (keys.length === 1 && keys[0] === "required") {
  12331. return validators.required;
  12332. }
  12333. return validators[this.getType(rule)] || void 0;
  12334. };
  12335. return Schema2;
  12336. }();
  12337. Schema.register = function register(type4, validator) {
  12338. if (typeof validator !== "function") {
  12339. throw new Error("Cannot register a validator by type, validator is not a function");
  12340. }
  12341. validators[type4] = validator;
  12342. };
  12343. Schema.warning = warning;
  12344. Schema.messages = messages;
  12345. Schema.validators = validators;
  12346. const formItemValidateStates = [
  12347. "",
  12348. "error",
  12349. "validating",
  12350. "success"
  12351. ];
  12352. const formItemProps = buildProps({
  12353. label: String,
  12354. labelWidth: {
  12355. type: [String, Number],
  12356. default: ""
  12357. },
  12358. labelPosition: {
  12359. type: String,
  12360. values: ["left", "right", "top", ""],
  12361. default: ""
  12362. },
  12363. prop: {
  12364. type: definePropType([String, Array])
  12365. },
  12366. required: {
  12367. type: Boolean,
  12368. default: void 0
  12369. },
  12370. rules: {
  12371. type: definePropType([Object, Array])
  12372. },
  12373. error: String,
  12374. validateStatus: {
  12375. type: String,
  12376. values: formItemValidateStates
  12377. },
  12378. for: String,
  12379. inlineMessage: {
  12380. type: [String, Boolean],
  12381. default: ""
  12382. },
  12383. showMessage: {
  12384. type: Boolean,
  12385. default: true
  12386. },
  12387. size: {
  12388. type: String,
  12389. values: componentSizes
  12390. }
  12391. });
  12392. const COMPONENT_NAME$l = "ElLabelWrap";
  12393. var FormLabelWrap = vue.defineComponent({
  12394. name: COMPONENT_NAME$l,
  12395. props: {
  12396. isAutoWidth: Boolean,
  12397. updateAll: Boolean
  12398. },
  12399. setup(props, {
  12400. slots
  12401. }) {
  12402. const formContext = vue.inject(formContextKey, void 0);
  12403. const formItemContext = vue.inject(formItemContextKey);
  12404. if (!formItemContext)
  12405. throwError(COMPONENT_NAME$l, "usage: <el-form-item><label-wrap /></el-form-item>");
  12406. const ns = useNamespace("form");
  12407. const el = vue.ref();
  12408. const computedWidth = vue.ref(0);
  12409. const getLabelWidth = () => {
  12410. var _a;
  12411. if ((_a = el.value) == null ? void 0 : _a.firstElementChild) {
  12412. const width = window.getComputedStyle(el.value.firstElementChild).width;
  12413. return Math.ceil(Number.parseFloat(width));
  12414. } else {
  12415. return 0;
  12416. }
  12417. };
  12418. const updateLabelWidth = (action = "update") => {
  12419. vue.nextTick(() => {
  12420. if (slots.default && props.isAutoWidth) {
  12421. if (action === "update") {
  12422. computedWidth.value = getLabelWidth();
  12423. } else if (action === "remove") {
  12424. formContext == null ? void 0 : formContext.deregisterLabelWidth(computedWidth.value);
  12425. }
  12426. }
  12427. });
  12428. };
  12429. const updateLabelWidthFn = () => updateLabelWidth("update");
  12430. vue.onMounted(() => {
  12431. updateLabelWidthFn();
  12432. });
  12433. vue.onBeforeUnmount(() => {
  12434. updateLabelWidth("remove");
  12435. });
  12436. vue.onUpdated(() => updateLabelWidthFn());
  12437. vue.watch(computedWidth, (val, oldVal) => {
  12438. if (props.updateAll) {
  12439. formContext == null ? void 0 : formContext.registerLabelWidth(val, oldVal);
  12440. }
  12441. });
  12442. useResizeObserver(vue.computed(() => {
  12443. var _a, _b;
  12444. return (_b = (_a = el.value) == null ? void 0 : _a.firstElementChild) != null ? _b : null;
  12445. }), updateLabelWidthFn);
  12446. return () => {
  12447. var _a, _b;
  12448. if (!slots)
  12449. return null;
  12450. const {
  12451. isAutoWidth
  12452. } = props;
  12453. if (isAutoWidth) {
  12454. const autoLabelWidth = formContext == null ? void 0 : formContext.autoLabelWidth;
  12455. const hasLabel = formItemContext == null ? void 0 : formItemContext.hasLabel;
  12456. const style = {};
  12457. if (hasLabel && autoLabelWidth && autoLabelWidth !== "auto") {
  12458. const marginWidth = Math.max(0, Number.parseInt(autoLabelWidth, 10) - computedWidth.value);
  12459. const labelPosition = formItemContext.labelPosition || formContext.labelPosition;
  12460. const marginPosition = labelPosition === "left" ? "marginRight" : "marginLeft";
  12461. if (marginWidth) {
  12462. style[marginPosition] = `${marginWidth}px`;
  12463. }
  12464. }
  12465. return vue.createVNode("div", {
  12466. "ref": el,
  12467. "class": [ns.be("item", "label-wrap")],
  12468. "style": style
  12469. }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
  12470. } else {
  12471. return vue.createVNode(vue.Fragment, {
  12472. "ref": el
  12473. }, [(_b = slots.default) == null ? void 0 : _b.call(slots)]);
  12474. }
  12475. };
  12476. }
  12477. });
  12478. const __default__$1N = vue.defineComponent({
  12479. name: "ElFormItem"
  12480. });
  12481. const _sfc_main$2t = /* @__PURE__ */ vue.defineComponent({
  12482. ...__default__$1N,
  12483. props: formItemProps,
  12484. setup(__props, { expose }) {
  12485. const props = __props;
  12486. const slots = vue.useSlots();
  12487. const formContext = vue.inject(formContextKey, void 0);
  12488. const parentFormItemContext = vue.inject(formItemContextKey, void 0);
  12489. const _size = useFormSize(void 0, { formItem: false });
  12490. const ns = useNamespace("form-item");
  12491. const labelId = useId().value;
  12492. const inputIds = vue.ref([]);
  12493. const validateState = vue.ref("");
  12494. const validateStateDebounced = refDebounced(validateState, 100);
  12495. const validateMessage = vue.ref("");
  12496. const formItemRef = vue.ref();
  12497. let initialValue = void 0;
  12498. let isResettingField = false;
  12499. const labelPosition = vue.computed(() => props.labelPosition || (formContext == null ? void 0 : formContext.labelPosition));
  12500. const labelStyle = vue.computed(() => {
  12501. if (labelPosition.value === "top") {
  12502. return {};
  12503. }
  12504. const labelWidth = addUnit(props.labelWidth || (formContext == null ? void 0 : formContext.labelWidth) || "");
  12505. if (labelWidth)
  12506. return { width: labelWidth };
  12507. return {};
  12508. });
  12509. const contentStyle = vue.computed(() => {
  12510. if (labelPosition.value === "top" || (formContext == null ? void 0 : formContext.inline)) {
  12511. return {};
  12512. }
  12513. if (!props.label && !props.labelWidth && isNested) {
  12514. return {};
  12515. }
  12516. const labelWidth = addUnit(props.labelWidth || (formContext == null ? void 0 : formContext.labelWidth) || "");
  12517. if (!props.label && !slots.label) {
  12518. return { marginLeft: labelWidth };
  12519. }
  12520. return {};
  12521. });
  12522. const formItemClasses = vue.computed(() => [
  12523. ns.b(),
  12524. ns.m(_size.value),
  12525. ns.is("error", validateState.value === "error"),
  12526. ns.is("validating", validateState.value === "validating"),
  12527. ns.is("success", validateState.value === "success"),
  12528. ns.is("required", isRequired.value || props.required),
  12529. ns.is("no-asterisk", formContext == null ? void 0 : formContext.hideRequiredAsterisk),
  12530. (formContext == null ? void 0 : formContext.requireAsteriskPosition) === "right" ? "asterisk-right" : "asterisk-left",
  12531. {
  12532. [ns.m("feedback")]: formContext == null ? void 0 : formContext.statusIcon,
  12533. [ns.m(`label-${labelPosition.value}`)]: labelPosition.value
  12534. }
  12535. ]);
  12536. const _inlineMessage = vue.computed(() => isBoolean(props.inlineMessage) ? props.inlineMessage : (formContext == null ? void 0 : formContext.inlineMessage) || false);
  12537. const validateClasses = vue.computed(() => [
  12538. ns.e("error"),
  12539. { [ns.em("error", "inline")]: _inlineMessage.value }
  12540. ]);
  12541. const propString = vue.computed(() => {
  12542. if (!props.prop)
  12543. return "";
  12544. return isString$1(props.prop) ? props.prop : props.prop.join(".");
  12545. });
  12546. const hasLabel = vue.computed(() => {
  12547. return !!(props.label || slots.label);
  12548. });
  12549. const labelFor = vue.computed(() => {
  12550. return props.for || (inputIds.value.length === 1 ? inputIds.value[0] : void 0);
  12551. });
  12552. const isGroup = vue.computed(() => {
  12553. return !labelFor.value && hasLabel.value;
  12554. });
  12555. const isNested = !!parentFormItemContext;
  12556. const fieldValue = vue.computed(() => {
  12557. const model = formContext == null ? void 0 : formContext.model;
  12558. if (!model || !props.prop) {
  12559. return;
  12560. }
  12561. return getProp(model, props.prop).value;
  12562. });
  12563. const normalizedRules = vue.computed(() => {
  12564. const { required } = props;
  12565. const rules = [];
  12566. if (props.rules) {
  12567. rules.push(...castArray$1(props.rules));
  12568. }
  12569. const formRules = formContext == null ? void 0 : formContext.rules;
  12570. if (formRules && props.prop) {
  12571. const _rules = getProp(formRules, props.prop).value;
  12572. if (_rules) {
  12573. rules.push(...castArray$1(_rules));
  12574. }
  12575. }
  12576. if (required !== void 0) {
  12577. const requiredRules = rules.map((rule, i) => [rule, i]).filter(([rule]) => Object.keys(rule).includes("required"));
  12578. if (requiredRules.length > 0) {
  12579. for (const [rule, i] of requiredRules) {
  12580. if (rule.required === required)
  12581. continue;
  12582. rules[i] = { ...rule, required };
  12583. }
  12584. } else {
  12585. rules.push({ required });
  12586. }
  12587. }
  12588. return rules;
  12589. });
  12590. const validateEnabled = vue.computed(() => normalizedRules.value.length > 0);
  12591. const getFilteredRule = (trigger) => {
  12592. const rules = normalizedRules.value;
  12593. return rules.filter((rule) => {
  12594. if (!rule.trigger || !trigger)
  12595. return true;
  12596. if (isArray$1(rule.trigger)) {
  12597. return rule.trigger.includes(trigger);
  12598. } else {
  12599. return rule.trigger === trigger;
  12600. }
  12601. }).map(({ trigger: trigger2, ...rule }) => rule);
  12602. };
  12603. const isRequired = vue.computed(() => normalizedRules.value.some((rule) => rule.required));
  12604. const shouldShowError = vue.computed(() => {
  12605. var _a;
  12606. return validateStateDebounced.value === "error" && props.showMessage && ((_a = formContext == null ? void 0 : formContext.showMessage) != null ? _a : true);
  12607. });
  12608. const currentLabel = vue.computed(() => `${props.label || ""}${(formContext == null ? void 0 : formContext.labelSuffix) || ""}`);
  12609. const setValidationState = (state) => {
  12610. validateState.value = state;
  12611. };
  12612. const onValidationFailed = (error) => {
  12613. var _a, _b;
  12614. const { errors, fields } = error;
  12615. if (!errors || !fields) {
  12616. console.error(error);
  12617. }
  12618. setValidationState("error");
  12619. validateMessage.value = errors ? (_b = (_a = errors == null ? void 0 : errors[0]) == null ? void 0 : _a.message) != null ? _b : `${props.prop} is required` : "";
  12620. formContext == null ? void 0 : formContext.emit("validate", props.prop, false, validateMessage.value);
  12621. };
  12622. const onValidationSucceeded = () => {
  12623. setValidationState("success");
  12624. formContext == null ? void 0 : formContext.emit("validate", props.prop, true, "");
  12625. };
  12626. const doValidate = async (rules) => {
  12627. const modelName = propString.value;
  12628. const validator = new Schema({
  12629. [modelName]: rules
  12630. });
  12631. return validator.validate({ [modelName]: fieldValue.value }, { firstFields: true }).then(() => {
  12632. onValidationSucceeded();
  12633. return true;
  12634. }).catch((err) => {
  12635. onValidationFailed(err);
  12636. return Promise.reject(err);
  12637. });
  12638. };
  12639. const validate = async (trigger, callback) => {
  12640. if (isResettingField || !props.prop) {
  12641. return false;
  12642. }
  12643. const hasCallback = isFunction$1(callback);
  12644. if (!validateEnabled.value) {
  12645. callback == null ? void 0 : callback(false);
  12646. return false;
  12647. }
  12648. const rules = getFilteredRule(trigger);
  12649. if (rules.length === 0) {
  12650. callback == null ? void 0 : callback(true);
  12651. return true;
  12652. }
  12653. setValidationState("validating");
  12654. return doValidate(rules).then(() => {
  12655. callback == null ? void 0 : callback(true);
  12656. return true;
  12657. }).catch((err) => {
  12658. const { fields } = err;
  12659. callback == null ? void 0 : callback(false, fields);
  12660. return hasCallback ? false : Promise.reject(fields);
  12661. });
  12662. };
  12663. const clearValidate = () => {
  12664. setValidationState("");
  12665. validateMessage.value = "";
  12666. isResettingField = false;
  12667. };
  12668. const resetField = async () => {
  12669. const model = formContext == null ? void 0 : formContext.model;
  12670. if (!model || !props.prop)
  12671. return;
  12672. const computedValue = getProp(model, props.prop);
  12673. isResettingField = true;
  12674. computedValue.value = clone(initialValue);
  12675. await vue.nextTick();
  12676. clearValidate();
  12677. isResettingField = false;
  12678. };
  12679. const addInputId = (id) => {
  12680. if (!inputIds.value.includes(id)) {
  12681. inputIds.value.push(id);
  12682. }
  12683. };
  12684. const removeInputId = (id) => {
  12685. inputIds.value = inputIds.value.filter((listId) => listId !== id);
  12686. };
  12687. vue.watch(() => props.error, (val) => {
  12688. validateMessage.value = val || "";
  12689. setValidationState(val ? "error" : "");
  12690. }, { immediate: true });
  12691. vue.watch(() => props.validateStatus, (val) => setValidationState(val || ""));
  12692. const context = vue.reactive({
  12693. ...vue.toRefs(props),
  12694. $el: formItemRef,
  12695. size: _size,
  12696. validateState,
  12697. labelId,
  12698. inputIds,
  12699. isGroup,
  12700. hasLabel,
  12701. fieldValue,
  12702. addInputId,
  12703. removeInputId,
  12704. resetField,
  12705. clearValidate,
  12706. validate
  12707. });
  12708. vue.provide(formItemContextKey, context);
  12709. vue.onMounted(() => {
  12710. if (props.prop) {
  12711. formContext == null ? void 0 : formContext.addField(context);
  12712. initialValue = clone(fieldValue.value);
  12713. }
  12714. });
  12715. vue.onBeforeUnmount(() => {
  12716. formContext == null ? void 0 : formContext.removeField(context);
  12717. });
  12718. expose({
  12719. size: _size,
  12720. validateMessage,
  12721. validateState,
  12722. validate,
  12723. clearValidate,
  12724. resetField
  12725. });
  12726. return (_ctx, _cache) => {
  12727. var _a;
  12728. return vue.openBlock(), vue.createElementBlock("div", {
  12729. ref_key: "formItemRef",
  12730. ref: formItemRef,
  12731. class: vue.normalizeClass(vue.unref(formItemClasses)),
  12732. role: vue.unref(isGroup) ? "group" : void 0,
  12733. "aria-labelledby": vue.unref(isGroup) ? vue.unref(labelId) : void 0
  12734. }, [
  12735. vue.createVNode(vue.unref(FormLabelWrap), {
  12736. "is-auto-width": vue.unref(labelStyle).width === "auto",
  12737. "update-all": ((_a = vue.unref(formContext)) == null ? void 0 : _a.labelWidth) === "auto"
  12738. }, {
  12739. default: vue.withCtx(() => [
  12740. vue.unref(hasLabel) ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(labelFor) ? "label" : "div"), {
  12741. key: 0,
  12742. id: vue.unref(labelId),
  12743. for: vue.unref(labelFor),
  12744. class: vue.normalizeClass(vue.unref(ns).e("label")),
  12745. style: vue.normalizeStyle(vue.unref(labelStyle))
  12746. }, {
  12747. default: vue.withCtx(() => [
  12748. vue.renderSlot(_ctx.$slots, "label", { label: vue.unref(currentLabel) }, () => [
  12749. vue.createTextVNode(vue.toDisplayString(vue.unref(currentLabel)), 1)
  12750. ])
  12751. ]),
  12752. _: 3
  12753. }, 8, ["id", "for", "class", "style"])) : vue.createCommentVNode("v-if", true)
  12754. ]),
  12755. _: 3
  12756. }, 8, ["is-auto-width", "update-all"]),
  12757. vue.createElementVNode("div", {
  12758. class: vue.normalizeClass(vue.unref(ns).e("content")),
  12759. style: vue.normalizeStyle(vue.unref(contentStyle))
  12760. }, [
  12761. vue.renderSlot(_ctx.$slots, "default"),
  12762. vue.createVNode(vue.TransitionGroup, {
  12763. name: `${vue.unref(ns).namespace.value}-zoom-in-top`
  12764. }, {
  12765. default: vue.withCtx(() => [
  12766. vue.unref(shouldShowError) ? vue.renderSlot(_ctx.$slots, "error", {
  12767. key: 0,
  12768. error: validateMessage.value
  12769. }, () => [
  12770. vue.createElementVNode("div", {
  12771. class: vue.normalizeClass(vue.unref(validateClasses))
  12772. }, vue.toDisplayString(validateMessage.value), 3)
  12773. ]) : vue.createCommentVNode("v-if", true)
  12774. ]),
  12775. _: 3
  12776. }, 8, ["name"])
  12777. ], 6)
  12778. ], 10, ["role", "aria-labelledby"]);
  12779. };
  12780. }
  12781. });
  12782. var FormItem = /* @__PURE__ */ _export_sfc(_sfc_main$2t, [["__file", "form-item.vue"]]);
  12783. const ElForm = withInstall(Form, {
  12784. FormItem
  12785. });
  12786. const ElFormItem = withNoopInstall(FormItem);
  12787. let hiddenTextarea = void 0;
  12788. const HIDDEN_STYLE = `
  12789. height:0 !important;
  12790. visibility:hidden !important;
  12791. ${isFirefox() ? "" : "overflow:hidden !important;"}
  12792. position:absolute !important;
  12793. z-index:-1000 !important;
  12794. top:0 !important;
  12795. right:0 !important;
  12796. `;
  12797. const CONTEXT_STYLE = [
  12798. "letter-spacing",
  12799. "line-height",
  12800. "padding-top",
  12801. "padding-bottom",
  12802. "font-family",
  12803. "font-weight",
  12804. "font-size",
  12805. "text-rendering",
  12806. "text-transform",
  12807. "width",
  12808. "text-indent",
  12809. "padding-left",
  12810. "padding-right",
  12811. "border-width",
  12812. "box-sizing"
  12813. ];
  12814. function calculateNodeStyling(targetElement) {
  12815. const style = window.getComputedStyle(targetElement);
  12816. const boxSizing = style.getPropertyValue("box-sizing");
  12817. const paddingSize = Number.parseFloat(style.getPropertyValue("padding-bottom")) + Number.parseFloat(style.getPropertyValue("padding-top"));
  12818. const borderSize = Number.parseFloat(style.getPropertyValue("border-bottom-width")) + Number.parseFloat(style.getPropertyValue("border-top-width"));
  12819. const contextStyle = CONTEXT_STYLE.map((name) => `${name}:${style.getPropertyValue(name)}`).join(";");
  12820. return { contextStyle, paddingSize, borderSize, boxSizing };
  12821. }
  12822. function calcTextareaHeight(targetElement, minRows = 1, maxRows) {
  12823. var _a;
  12824. if (!hiddenTextarea) {
  12825. hiddenTextarea = document.createElement("textarea");
  12826. document.body.appendChild(hiddenTextarea);
  12827. }
  12828. const { paddingSize, borderSize, boxSizing, contextStyle } = calculateNodeStyling(targetElement);
  12829. hiddenTextarea.setAttribute("style", `${contextStyle};${HIDDEN_STYLE}`);
  12830. hiddenTextarea.value = targetElement.value || targetElement.placeholder || "";
  12831. let height = hiddenTextarea.scrollHeight;
  12832. const result = {};
  12833. if (boxSizing === "border-box") {
  12834. height = height + borderSize;
  12835. } else if (boxSizing === "content-box") {
  12836. height = height - paddingSize;
  12837. }
  12838. hiddenTextarea.value = "";
  12839. const singleRowHeight = hiddenTextarea.scrollHeight - paddingSize;
  12840. if (isNumber(minRows)) {
  12841. let minHeight = singleRowHeight * minRows;
  12842. if (boxSizing === "border-box") {
  12843. minHeight = minHeight + paddingSize + borderSize;
  12844. }
  12845. height = Math.max(minHeight, height);
  12846. result.minHeight = `${minHeight}px`;
  12847. }
  12848. if (isNumber(maxRows)) {
  12849. let maxHeight = singleRowHeight * maxRows;
  12850. if (boxSizing === "border-box") {
  12851. maxHeight = maxHeight + paddingSize + borderSize;
  12852. }
  12853. height = Math.min(maxHeight, height);
  12854. }
  12855. result.height = `${height}px`;
  12856. (_a = hiddenTextarea.parentNode) == null ? void 0 : _a.removeChild(hiddenTextarea);
  12857. hiddenTextarea = void 0;
  12858. return result;
  12859. }
  12860. const inputProps = buildProps({
  12861. id: {
  12862. type: String,
  12863. default: void 0
  12864. },
  12865. size: useSizeProp,
  12866. disabled: Boolean,
  12867. modelValue: {
  12868. type: definePropType([
  12869. String,
  12870. Number,
  12871. Object
  12872. ]),
  12873. default: ""
  12874. },
  12875. maxlength: {
  12876. type: [String, Number]
  12877. },
  12878. minlength: {
  12879. type: [String, Number]
  12880. },
  12881. type: {
  12882. type: String,
  12883. default: "text"
  12884. },
  12885. resize: {
  12886. type: String,
  12887. values: ["none", "both", "horizontal", "vertical"]
  12888. },
  12889. autosize: {
  12890. type: definePropType([Boolean, Object]),
  12891. default: false
  12892. },
  12893. autocomplete: {
  12894. type: String,
  12895. default: "off"
  12896. },
  12897. formatter: {
  12898. type: Function
  12899. },
  12900. parser: {
  12901. type: Function
  12902. },
  12903. placeholder: {
  12904. type: String
  12905. },
  12906. form: {
  12907. type: String
  12908. },
  12909. readonly: Boolean,
  12910. clearable: Boolean,
  12911. showPassword: Boolean,
  12912. showWordLimit: Boolean,
  12913. suffixIcon: {
  12914. type: iconPropType
  12915. },
  12916. prefixIcon: {
  12917. type: iconPropType
  12918. },
  12919. containerRole: {
  12920. type: String,
  12921. default: void 0
  12922. },
  12923. tabindex: {
  12924. type: [String, Number],
  12925. default: 0
  12926. },
  12927. validateEvent: {
  12928. type: Boolean,
  12929. default: true
  12930. },
  12931. inputStyle: {
  12932. type: definePropType([Object, Array, String]),
  12933. default: () => mutable({})
  12934. },
  12935. autofocus: Boolean,
  12936. rows: {
  12937. type: Number,
  12938. default: 2
  12939. },
  12940. ...useAriaProps(["ariaLabel"])
  12941. });
  12942. const inputEmits = {
  12943. [UPDATE_MODEL_EVENT]: (value) => isString$1(value),
  12944. input: (value) => isString$1(value),
  12945. change: (value) => isString$1(value),
  12946. focus: (evt) => evt instanceof FocusEvent,
  12947. blur: (evt) => evt instanceof FocusEvent,
  12948. clear: () => true,
  12949. mouseleave: (evt) => evt instanceof MouseEvent,
  12950. mouseenter: (evt) => evt instanceof MouseEvent,
  12951. keydown: (evt) => evt instanceof Event,
  12952. compositionstart: (evt) => evt instanceof CompositionEvent,
  12953. compositionupdate: (evt) => evt instanceof CompositionEvent,
  12954. compositionend: (evt) => evt instanceof CompositionEvent
  12955. };
  12956. const __default__$1M = vue.defineComponent({
  12957. name: "ElInput",
  12958. inheritAttrs: false
  12959. });
  12960. const _sfc_main$2s = /* @__PURE__ */ vue.defineComponent({
  12961. ...__default__$1M,
  12962. props: inputProps,
  12963. emits: inputEmits,
  12964. setup(__props, { expose, emit }) {
  12965. const props = __props;
  12966. const rawAttrs = vue.useAttrs();
  12967. const attrs = useAttrs();
  12968. const slots = vue.useSlots();
  12969. const containerKls = vue.computed(() => [
  12970. props.type === "textarea" ? nsTextarea.b() : nsInput.b(),
  12971. nsInput.m(inputSize.value),
  12972. nsInput.is("disabled", inputDisabled.value),
  12973. nsInput.is("exceed", inputExceed.value),
  12974. {
  12975. [nsInput.b("group")]: slots.prepend || slots.append,
  12976. [nsInput.m("prefix")]: slots.prefix || props.prefixIcon,
  12977. [nsInput.m("suffix")]: slots.suffix || props.suffixIcon || props.clearable || props.showPassword,
  12978. [nsInput.bm("suffix", "password-clear")]: showClear.value && showPwdVisible.value,
  12979. [nsInput.b("hidden")]: props.type === "hidden"
  12980. },
  12981. rawAttrs.class
  12982. ]);
  12983. const wrapperKls = vue.computed(() => [
  12984. nsInput.e("wrapper"),
  12985. nsInput.is("focus", isFocused.value)
  12986. ]);
  12987. const { form: elForm, formItem: elFormItem } = useFormItem();
  12988. const { inputId } = useFormItemInputId(props, {
  12989. formItemContext: elFormItem
  12990. });
  12991. const inputSize = useFormSize();
  12992. const inputDisabled = useFormDisabled();
  12993. const nsInput = useNamespace("input");
  12994. const nsTextarea = useNamespace("textarea");
  12995. const input = vue.shallowRef();
  12996. const textarea = vue.shallowRef();
  12997. const hovering = vue.ref(false);
  12998. const passwordVisible = vue.ref(false);
  12999. const countStyle = vue.ref();
  13000. const textareaCalcStyle = vue.shallowRef(props.inputStyle);
  13001. const _ref = vue.computed(() => input.value || textarea.value);
  13002. const { wrapperRef, isFocused, handleFocus, handleBlur } = useFocusController(_ref, {
  13003. beforeFocus() {
  13004. return inputDisabled.value;
  13005. },
  13006. afterBlur() {
  13007. var _a;
  13008. if (props.validateEvent) {
  13009. (_a = elFormItem == null ? void 0 : elFormItem.validate) == null ? void 0 : _a.call(elFormItem, "blur").catch((err) => debugWarn());
  13010. }
  13011. }
  13012. });
  13013. const needStatusIcon = vue.computed(() => {
  13014. var _a;
  13015. return (_a = elForm == null ? void 0 : elForm.statusIcon) != null ? _a : false;
  13016. });
  13017. const validateState = vue.computed(() => (elFormItem == null ? void 0 : elFormItem.validateState) || "");
  13018. const validateIcon = vue.computed(() => validateState.value && ValidateComponentsMap[validateState.value]);
  13019. const passwordIcon = vue.computed(() => passwordVisible.value ? view_default : hide_default);
  13020. const containerStyle = vue.computed(() => [
  13021. rawAttrs.style
  13022. ]);
  13023. const textareaStyle = vue.computed(() => [
  13024. props.inputStyle,
  13025. textareaCalcStyle.value,
  13026. { resize: props.resize }
  13027. ]);
  13028. const nativeInputValue = vue.computed(() => isNil(props.modelValue) ? "" : String(props.modelValue));
  13029. const showClear = vue.computed(() => props.clearable && !inputDisabled.value && !props.readonly && !!nativeInputValue.value && (isFocused.value || hovering.value));
  13030. const showPwdVisible = vue.computed(() => props.showPassword && !inputDisabled.value && !!nativeInputValue.value && (!!nativeInputValue.value || isFocused.value));
  13031. const isWordLimitVisible = vue.computed(() => props.showWordLimit && !!props.maxlength && (props.type === "text" || props.type === "textarea") && !inputDisabled.value && !props.readonly && !props.showPassword);
  13032. const textLength = vue.computed(() => nativeInputValue.value.length);
  13033. const inputExceed = vue.computed(() => !!isWordLimitVisible.value && textLength.value > Number(props.maxlength));
  13034. const suffixVisible = vue.computed(() => !!slots.suffix || !!props.suffixIcon || showClear.value || props.showPassword || isWordLimitVisible.value || !!validateState.value && needStatusIcon.value);
  13035. const [recordCursor, setCursor] = useCursor(input);
  13036. useResizeObserver(textarea, (entries) => {
  13037. onceInitSizeTextarea();
  13038. if (!isWordLimitVisible.value || props.resize !== "both")
  13039. return;
  13040. const entry = entries[0];
  13041. const { width } = entry.contentRect;
  13042. countStyle.value = {
  13043. right: `calc(100% - ${width + 15 + 6}px)`
  13044. };
  13045. });
  13046. const resizeTextarea = () => {
  13047. const { type, autosize } = props;
  13048. if (!isClient || type !== "textarea" || !textarea.value)
  13049. return;
  13050. if (autosize) {
  13051. const minRows = isObject$1(autosize) ? autosize.minRows : void 0;
  13052. const maxRows = isObject$1(autosize) ? autosize.maxRows : void 0;
  13053. const textareaStyle2 = calcTextareaHeight(textarea.value, minRows, maxRows);
  13054. textareaCalcStyle.value = {
  13055. overflowY: "hidden",
  13056. ...textareaStyle2
  13057. };
  13058. vue.nextTick(() => {
  13059. textarea.value.offsetHeight;
  13060. textareaCalcStyle.value = textareaStyle2;
  13061. });
  13062. } else {
  13063. textareaCalcStyle.value = {
  13064. minHeight: calcTextareaHeight(textarea.value).minHeight
  13065. };
  13066. }
  13067. };
  13068. const createOnceInitResize = (resizeTextarea2) => {
  13069. let isInit = false;
  13070. return () => {
  13071. var _a;
  13072. if (isInit || !props.autosize)
  13073. return;
  13074. const isElHidden = ((_a = textarea.value) == null ? void 0 : _a.offsetParent) === null;
  13075. if (!isElHidden) {
  13076. resizeTextarea2();
  13077. isInit = true;
  13078. }
  13079. };
  13080. };
  13081. const onceInitSizeTextarea = createOnceInitResize(resizeTextarea);
  13082. const setNativeInputValue = () => {
  13083. const input2 = _ref.value;
  13084. const formatterValue = props.formatter ? props.formatter(nativeInputValue.value) : nativeInputValue.value;
  13085. if (!input2 || input2.value === formatterValue)
  13086. return;
  13087. input2.value = formatterValue;
  13088. };
  13089. const handleInput = async (event) => {
  13090. recordCursor();
  13091. let { value } = event.target;
  13092. if (props.formatter) {
  13093. value = props.parser ? props.parser(value) : value;
  13094. }
  13095. if (isComposing.value)
  13096. return;
  13097. if (value === nativeInputValue.value) {
  13098. setNativeInputValue();
  13099. return;
  13100. }
  13101. emit(UPDATE_MODEL_EVENT, value);
  13102. emit("input", value);
  13103. await vue.nextTick();
  13104. setNativeInputValue();
  13105. setCursor();
  13106. };
  13107. const handleChange = (event) => {
  13108. emit("change", event.target.value);
  13109. };
  13110. const {
  13111. isComposing,
  13112. handleCompositionStart,
  13113. handleCompositionUpdate,
  13114. handleCompositionEnd
  13115. } = useComposition({ emit, afterComposition: handleInput });
  13116. const handlePasswordVisible = () => {
  13117. recordCursor();
  13118. passwordVisible.value = !passwordVisible.value;
  13119. setTimeout(setCursor);
  13120. };
  13121. const focus = () => {
  13122. var _a;
  13123. return (_a = _ref.value) == null ? void 0 : _a.focus();
  13124. };
  13125. const blur = () => {
  13126. var _a;
  13127. return (_a = _ref.value) == null ? void 0 : _a.blur();
  13128. };
  13129. const handleMouseLeave = (evt) => {
  13130. hovering.value = false;
  13131. emit("mouseleave", evt);
  13132. };
  13133. const handleMouseEnter = (evt) => {
  13134. hovering.value = true;
  13135. emit("mouseenter", evt);
  13136. };
  13137. const handleKeydown = (evt) => {
  13138. emit("keydown", evt);
  13139. };
  13140. const select = () => {
  13141. var _a;
  13142. (_a = _ref.value) == null ? void 0 : _a.select();
  13143. };
  13144. const clear = () => {
  13145. emit(UPDATE_MODEL_EVENT, "");
  13146. emit("change", "");
  13147. emit("clear");
  13148. emit("input", "");
  13149. };
  13150. vue.watch(() => props.modelValue, () => {
  13151. var _a;
  13152. vue.nextTick(() => resizeTextarea());
  13153. if (props.validateEvent) {
  13154. (_a = elFormItem == null ? void 0 : elFormItem.validate) == null ? void 0 : _a.call(elFormItem, "change").catch((err) => debugWarn());
  13155. }
  13156. });
  13157. vue.watch(nativeInputValue, () => setNativeInputValue());
  13158. vue.watch(() => props.type, async () => {
  13159. await vue.nextTick();
  13160. setNativeInputValue();
  13161. resizeTextarea();
  13162. });
  13163. vue.onMounted(() => {
  13164. if (!props.formatter && props.parser) ;
  13165. setNativeInputValue();
  13166. vue.nextTick(resizeTextarea);
  13167. });
  13168. expose({
  13169. input,
  13170. textarea,
  13171. ref: _ref,
  13172. textareaStyle,
  13173. autosize: vue.toRef(props, "autosize"),
  13174. isComposing,
  13175. focus,
  13176. blur,
  13177. select,
  13178. clear,
  13179. resizeTextarea
  13180. });
  13181. return (_ctx, _cache) => {
  13182. return vue.openBlock(), vue.createElementBlock("div", {
  13183. class: vue.normalizeClass([
  13184. vue.unref(containerKls),
  13185. {
  13186. [vue.unref(nsInput).bm("group", "append")]: _ctx.$slots.append,
  13187. [vue.unref(nsInput).bm("group", "prepend")]: _ctx.$slots.prepend
  13188. }
  13189. ]),
  13190. style: vue.normalizeStyle(vue.unref(containerStyle)),
  13191. onMouseenter: handleMouseEnter,
  13192. onMouseleave: handleMouseLeave
  13193. }, [
  13194. vue.createCommentVNode(" input "),
  13195. _ctx.type !== "textarea" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  13196. vue.createCommentVNode(" prepend slot "),
  13197. _ctx.$slots.prepend ? (vue.openBlock(), vue.createElementBlock("div", {
  13198. key: 0,
  13199. class: vue.normalizeClass(vue.unref(nsInput).be("group", "prepend"))
  13200. }, [
  13201. vue.renderSlot(_ctx.$slots, "prepend")
  13202. ], 2)) : vue.createCommentVNode("v-if", true),
  13203. vue.createElementVNode("div", {
  13204. ref_key: "wrapperRef",
  13205. ref: wrapperRef,
  13206. class: vue.normalizeClass(vue.unref(wrapperKls))
  13207. }, [
  13208. vue.createCommentVNode(" prefix slot "),
  13209. _ctx.$slots.prefix || _ctx.prefixIcon ? (vue.openBlock(), vue.createElementBlock("span", {
  13210. key: 0,
  13211. class: vue.normalizeClass(vue.unref(nsInput).e("prefix"))
  13212. }, [
  13213. vue.createElementVNode("span", {
  13214. class: vue.normalizeClass(vue.unref(nsInput).e("prefix-inner"))
  13215. }, [
  13216. vue.renderSlot(_ctx.$slots, "prefix"),
  13217. _ctx.prefixIcon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  13218. key: 0,
  13219. class: vue.normalizeClass(vue.unref(nsInput).e("icon"))
  13220. }, {
  13221. default: vue.withCtx(() => [
  13222. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.prefixIcon)))
  13223. ]),
  13224. _: 1
  13225. }, 8, ["class"])) : vue.createCommentVNode("v-if", true)
  13226. ], 2)
  13227. ], 2)) : vue.createCommentVNode("v-if", true),
  13228. vue.createElementVNode("input", vue.mergeProps({
  13229. id: vue.unref(inputId),
  13230. ref_key: "input",
  13231. ref: input,
  13232. class: vue.unref(nsInput).e("inner")
  13233. }, vue.unref(attrs), {
  13234. minlength: _ctx.minlength,
  13235. maxlength: _ctx.maxlength,
  13236. type: _ctx.showPassword ? passwordVisible.value ? "text" : "password" : _ctx.type,
  13237. disabled: vue.unref(inputDisabled),
  13238. readonly: _ctx.readonly,
  13239. autocomplete: _ctx.autocomplete,
  13240. tabindex: _ctx.tabindex,
  13241. "aria-label": _ctx.ariaLabel,
  13242. placeholder: _ctx.placeholder,
  13243. style: _ctx.inputStyle,
  13244. form: _ctx.form,
  13245. autofocus: _ctx.autofocus,
  13246. role: _ctx.containerRole,
  13247. onCompositionstart: vue.unref(handleCompositionStart),
  13248. onCompositionupdate: vue.unref(handleCompositionUpdate),
  13249. onCompositionend: vue.unref(handleCompositionEnd),
  13250. onInput: handleInput,
  13251. onChange: handleChange,
  13252. onKeydown: handleKeydown
  13253. }), null, 16, ["id", "minlength", "maxlength", "type", "disabled", "readonly", "autocomplete", "tabindex", "aria-label", "placeholder", "form", "autofocus", "role", "onCompositionstart", "onCompositionupdate", "onCompositionend"]),
  13254. vue.createCommentVNode(" suffix slot "),
  13255. vue.unref(suffixVisible) ? (vue.openBlock(), vue.createElementBlock("span", {
  13256. key: 1,
  13257. class: vue.normalizeClass(vue.unref(nsInput).e("suffix"))
  13258. }, [
  13259. vue.createElementVNode("span", {
  13260. class: vue.normalizeClass(vue.unref(nsInput).e("suffix-inner"))
  13261. }, [
  13262. !vue.unref(showClear) || !vue.unref(showPwdVisible) || !vue.unref(isWordLimitVisible) ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  13263. vue.renderSlot(_ctx.$slots, "suffix"),
  13264. _ctx.suffixIcon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  13265. key: 0,
  13266. class: vue.normalizeClass(vue.unref(nsInput).e("icon"))
  13267. }, {
  13268. default: vue.withCtx(() => [
  13269. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.suffixIcon)))
  13270. ]),
  13271. _: 1
  13272. }, 8, ["class"])) : vue.createCommentVNode("v-if", true)
  13273. ], 64)) : vue.createCommentVNode("v-if", true),
  13274. vue.unref(showClear) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  13275. key: 1,
  13276. class: vue.normalizeClass([vue.unref(nsInput).e("icon"), vue.unref(nsInput).e("clear")]),
  13277. onMousedown: vue.withModifiers(vue.unref(NOOP), ["prevent"]),
  13278. onClick: clear
  13279. }, {
  13280. default: vue.withCtx(() => [
  13281. vue.createVNode(vue.unref(circle_close_default))
  13282. ]),
  13283. _: 1
  13284. }, 8, ["class", "onMousedown"])) : vue.createCommentVNode("v-if", true),
  13285. vue.unref(showPwdVisible) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  13286. key: 2,
  13287. class: vue.normalizeClass([vue.unref(nsInput).e("icon"), vue.unref(nsInput).e("password")]),
  13288. onClick: handlePasswordVisible
  13289. }, {
  13290. default: vue.withCtx(() => [
  13291. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(passwordIcon))))
  13292. ]),
  13293. _: 1
  13294. }, 8, ["class"])) : vue.createCommentVNode("v-if", true),
  13295. vue.unref(isWordLimitVisible) ? (vue.openBlock(), vue.createElementBlock("span", {
  13296. key: 3,
  13297. class: vue.normalizeClass(vue.unref(nsInput).e("count"))
  13298. }, [
  13299. vue.createElementVNode("span", {
  13300. class: vue.normalizeClass(vue.unref(nsInput).e("count-inner"))
  13301. }, vue.toDisplayString(vue.unref(textLength)) + " / " + vue.toDisplayString(_ctx.maxlength), 3)
  13302. ], 2)) : vue.createCommentVNode("v-if", true),
  13303. vue.unref(validateState) && vue.unref(validateIcon) && vue.unref(needStatusIcon) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  13304. key: 4,
  13305. class: vue.normalizeClass([
  13306. vue.unref(nsInput).e("icon"),
  13307. vue.unref(nsInput).e("validateIcon"),
  13308. vue.unref(nsInput).is("loading", vue.unref(validateState) === "validating")
  13309. ])
  13310. }, {
  13311. default: vue.withCtx(() => [
  13312. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(validateIcon))))
  13313. ]),
  13314. _: 1
  13315. }, 8, ["class"])) : vue.createCommentVNode("v-if", true)
  13316. ], 2)
  13317. ], 2)) : vue.createCommentVNode("v-if", true)
  13318. ], 2),
  13319. vue.createCommentVNode(" append slot "),
  13320. _ctx.$slots.append ? (vue.openBlock(), vue.createElementBlock("div", {
  13321. key: 1,
  13322. class: vue.normalizeClass(vue.unref(nsInput).be("group", "append"))
  13323. }, [
  13324. vue.renderSlot(_ctx.$slots, "append")
  13325. ], 2)) : vue.createCommentVNode("v-if", true)
  13326. ], 64)) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  13327. vue.createCommentVNode(" textarea "),
  13328. vue.createElementVNode("textarea", vue.mergeProps({
  13329. id: vue.unref(inputId),
  13330. ref_key: "textarea",
  13331. ref: textarea,
  13332. class: [vue.unref(nsTextarea).e("inner"), vue.unref(nsInput).is("focus", vue.unref(isFocused))]
  13333. }, vue.unref(attrs), {
  13334. minlength: _ctx.minlength,
  13335. maxlength: _ctx.maxlength,
  13336. tabindex: _ctx.tabindex,
  13337. disabled: vue.unref(inputDisabled),
  13338. readonly: _ctx.readonly,
  13339. autocomplete: _ctx.autocomplete,
  13340. style: vue.unref(textareaStyle),
  13341. "aria-label": _ctx.ariaLabel,
  13342. placeholder: _ctx.placeholder,
  13343. form: _ctx.form,
  13344. autofocus: _ctx.autofocus,
  13345. rows: _ctx.rows,
  13346. role: _ctx.containerRole,
  13347. onCompositionstart: vue.unref(handleCompositionStart),
  13348. onCompositionupdate: vue.unref(handleCompositionUpdate),
  13349. onCompositionend: vue.unref(handleCompositionEnd),
  13350. onInput: handleInput,
  13351. onFocus: vue.unref(handleFocus),
  13352. onBlur: vue.unref(handleBlur),
  13353. onChange: handleChange,
  13354. onKeydown: handleKeydown
  13355. }), null, 16, ["id", "minlength", "maxlength", "tabindex", "disabled", "readonly", "autocomplete", "aria-label", "placeholder", "form", "autofocus", "rows", "role", "onCompositionstart", "onCompositionupdate", "onCompositionend", "onFocus", "onBlur"]),
  13356. vue.unref(isWordLimitVisible) ? (vue.openBlock(), vue.createElementBlock("span", {
  13357. key: 0,
  13358. style: vue.normalizeStyle(countStyle.value),
  13359. class: vue.normalizeClass(vue.unref(nsInput).e("count"))
  13360. }, vue.toDisplayString(vue.unref(textLength)) + " / " + vue.toDisplayString(_ctx.maxlength), 7)) : vue.createCommentVNode("v-if", true)
  13361. ], 64))
  13362. ], 38);
  13363. };
  13364. }
  13365. });
  13366. var Input = /* @__PURE__ */ _export_sfc(_sfc_main$2s, [["__file", "input.vue"]]);
  13367. const ElInput = withInstall(Input);
  13368. const GAP = 4;
  13369. const BAR_MAP = {
  13370. vertical: {
  13371. offset: "offsetHeight",
  13372. scroll: "scrollTop",
  13373. scrollSize: "scrollHeight",
  13374. size: "height",
  13375. key: "vertical",
  13376. axis: "Y",
  13377. client: "clientY",
  13378. direction: "top"
  13379. },
  13380. horizontal: {
  13381. offset: "offsetWidth",
  13382. scroll: "scrollLeft",
  13383. scrollSize: "scrollWidth",
  13384. size: "width",
  13385. key: "horizontal",
  13386. axis: "X",
  13387. client: "clientX",
  13388. direction: "left"
  13389. }
  13390. };
  13391. const renderThumbStyle$1 = ({
  13392. move,
  13393. size,
  13394. bar
  13395. }) => ({
  13396. [bar.size]: size,
  13397. transform: `translate${bar.axis}(${move}%)`
  13398. });
  13399. const scrollbarContextKey = Symbol("scrollbarContextKey");
  13400. const thumbProps = buildProps({
  13401. vertical: Boolean,
  13402. size: String,
  13403. move: Number,
  13404. ratio: {
  13405. type: Number,
  13406. required: true
  13407. },
  13408. always: Boolean
  13409. });
  13410. const COMPONENT_NAME$k = "Thumb";
  13411. const _sfc_main$2r = /* @__PURE__ */ vue.defineComponent({
  13412. __name: "thumb",
  13413. props: thumbProps,
  13414. setup(__props) {
  13415. const props = __props;
  13416. const scrollbar = vue.inject(scrollbarContextKey);
  13417. const ns = useNamespace("scrollbar");
  13418. if (!scrollbar)
  13419. throwError(COMPONENT_NAME$k, "can not inject scrollbar context");
  13420. const instance = vue.ref();
  13421. const thumb = vue.ref();
  13422. const thumbState = vue.ref({});
  13423. const visible = vue.ref(false);
  13424. let cursorDown = false;
  13425. let cursorLeave = false;
  13426. let originalOnSelectStart = isClient ? document.onselectstart : null;
  13427. const bar = vue.computed(() => BAR_MAP[props.vertical ? "vertical" : "horizontal"]);
  13428. const thumbStyle = vue.computed(() => renderThumbStyle$1({
  13429. size: props.size,
  13430. move: props.move,
  13431. bar: bar.value
  13432. }));
  13433. const offsetRatio = vue.computed(() => instance.value[bar.value.offset] ** 2 / scrollbar.wrapElement[bar.value.scrollSize] / props.ratio / thumb.value[bar.value.offset]);
  13434. const clickThumbHandler = (e) => {
  13435. var _a;
  13436. e.stopPropagation();
  13437. if (e.ctrlKey || [1, 2].includes(e.button))
  13438. return;
  13439. (_a = window.getSelection()) == null ? void 0 : _a.removeAllRanges();
  13440. startDrag(e);
  13441. const el = e.currentTarget;
  13442. if (!el)
  13443. return;
  13444. thumbState.value[bar.value.axis] = el[bar.value.offset] - (e[bar.value.client] - el.getBoundingClientRect()[bar.value.direction]);
  13445. };
  13446. const clickTrackHandler = (e) => {
  13447. if (!thumb.value || !instance.value || !scrollbar.wrapElement)
  13448. return;
  13449. const offset = Math.abs(e.target.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]);
  13450. const thumbHalf = thumb.value[bar.value.offset] / 2;
  13451. const thumbPositionPercentage = (offset - thumbHalf) * 100 * offsetRatio.value / instance.value[bar.value.offset];
  13452. scrollbar.wrapElement[bar.value.scroll] = thumbPositionPercentage * scrollbar.wrapElement[bar.value.scrollSize] / 100;
  13453. };
  13454. const startDrag = (e) => {
  13455. e.stopImmediatePropagation();
  13456. cursorDown = true;
  13457. document.addEventListener("mousemove", mouseMoveDocumentHandler);
  13458. document.addEventListener("mouseup", mouseUpDocumentHandler);
  13459. originalOnSelectStart = document.onselectstart;
  13460. document.onselectstart = () => false;
  13461. };
  13462. const mouseMoveDocumentHandler = (e) => {
  13463. if (!instance.value || !thumb.value)
  13464. return;
  13465. if (cursorDown === false)
  13466. return;
  13467. const prevPage = thumbState.value[bar.value.axis];
  13468. if (!prevPage)
  13469. return;
  13470. const offset = (instance.value.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]) * -1;
  13471. const thumbClickPosition = thumb.value[bar.value.offset] - prevPage;
  13472. const thumbPositionPercentage = (offset - thumbClickPosition) * 100 * offsetRatio.value / instance.value[bar.value.offset];
  13473. scrollbar.wrapElement[bar.value.scroll] = thumbPositionPercentage * scrollbar.wrapElement[bar.value.scrollSize] / 100;
  13474. };
  13475. const mouseUpDocumentHandler = () => {
  13476. cursorDown = false;
  13477. thumbState.value[bar.value.axis] = 0;
  13478. document.removeEventListener("mousemove", mouseMoveDocumentHandler);
  13479. document.removeEventListener("mouseup", mouseUpDocumentHandler);
  13480. restoreOnselectstart();
  13481. if (cursorLeave)
  13482. visible.value = false;
  13483. };
  13484. const mouseMoveScrollbarHandler = () => {
  13485. cursorLeave = false;
  13486. visible.value = !!props.size;
  13487. };
  13488. const mouseLeaveScrollbarHandler = () => {
  13489. cursorLeave = true;
  13490. visible.value = cursorDown;
  13491. };
  13492. vue.onBeforeUnmount(() => {
  13493. restoreOnselectstart();
  13494. document.removeEventListener("mouseup", mouseUpDocumentHandler);
  13495. });
  13496. const restoreOnselectstart = () => {
  13497. if (document.onselectstart !== originalOnSelectStart)
  13498. document.onselectstart = originalOnSelectStart;
  13499. };
  13500. useEventListener(vue.toRef(scrollbar, "scrollbarElement"), "mousemove", mouseMoveScrollbarHandler);
  13501. useEventListener(vue.toRef(scrollbar, "scrollbarElement"), "mouseleave", mouseLeaveScrollbarHandler);
  13502. return (_ctx, _cache) => {
  13503. return vue.openBlock(), vue.createBlock(vue.Transition, {
  13504. name: vue.unref(ns).b("fade"),
  13505. persisted: ""
  13506. }, {
  13507. default: vue.withCtx(() => [
  13508. vue.withDirectives(vue.createElementVNode("div", {
  13509. ref_key: "instance",
  13510. ref: instance,
  13511. class: vue.normalizeClass([vue.unref(ns).e("bar"), vue.unref(ns).is(vue.unref(bar).key)]),
  13512. onMousedown: clickTrackHandler
  13513. }, [
  13514. vue.createElementVNode("div", {
  13515. ref_key: "thumb",
  13516. ref: thumb,
  13517. class: vue.normalizeClass(vue.unref(ns).e("thumb")),
  13518. style: vue.normalizeStyle(vue.unref(thumbStyle)),
  13519. onMousedown: clickThumbHandler
  13520. }, null, 38)
  13521. ], 34), [
  13522. [vue.vShow, _ctx.always || visible.value]
  13523. ])
  13524. ]),
  13525. _: 1
  13526. }, 8, ["name"]);
  13527. };
  13528. }
  13529. });
  13530. var Thumb = /* @__PURE__ */ _export_sfc(_sfc_main$2r, [["__file", "thumb.vue"]]);
  13531. const barProps = buildProps({
  13532. always: {
  13533. type: Boolean,
  13534. default: true
  13535. },
  13536. minSize: {
  13537. type: Number,
  13538. required: true
  13539. }
  13540. });
  13541. const _sfc_main$2q = /* @__PURE__ */ vue.defineComponent({
  13542. __name: "bar",
  13543. props: barProps,
  13544. setup(__props, { expose }) {
  13545. const props = __props;
  13546. const scrollbar = vue.inject(scrollbarContextKey);
  13547. const moveX = vue.ref(0);
  13548. const moveY = vue.ref(0);
  13549. const sizeWidth = vue.ref("");
  13550. const sizeHeight = vue.ref("");
  13551. const ratioY = vue.ref(1);
  13552. const ratioX = vue.ref(1);
  13553. const handleScroll = (wrap) => {
  13554. if (wrap) {
  13555. const offsetHeight = wrap.offsetHeight - GAP;
  13556. const offsetWidth = wrap.offsetWidth - GAP;
  13557. moveY.value = wrap.scrollTop * 100 / offsetHeight * ratioY.value;
  13558. moveX.value = wrap.scrollLeft * 100 / offsetWidth * ratioX.value;
  13559. }
  13560. };
  13561. const update = () => {
  13562. const wrap = scrollbar == null ? void 0 : scrollbar.wrapElement;
  13563. if (!wrap)
  13564. return;
  13565. const offsetHeight = wrap.offsetHeight - GAP;
  13566. const offsetWidth = wrap.offsetWidth - GAP;
  13567. const originalHeight = offsetHeight ** 2 / wrap.scrollHeight;
  13568. const originalWidth = offsetWidth ** 2 / wrap.scrollWidth;
  13569. const height = Math.max(originalHeight, props.minSize);
  13570. const width = Math.max(originalWidth, props.minSize);
  13571. ratioY.value = originalHeight / (offsetHeight - originalHeight) / (height / (offsetHeight - height));
  13572. ratioX.value = originalWidth / (offsetWidth - originalWidth) / (width / (offsetWidth - width));
  13573. sizeHeight.value = height + GAP < offsetHeight ? `${height}px` : "";
  13574. sizeWidth.value = width + GAP < offsetWidth ? `${width}px` : "";
  13575. };
  13576. expose({
  13577. handleScroll,
  13578. update
  13579. });
  13580. return (_ctx, _cache) => {
  13581. return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
  13582. vue.createVNode(Thumb, {
  13583. move: moveX.value,
  13584. ratio: ratioX.value,
  13585. size: sizeWidth.value,
  13586. always: _ctx.always
  13587. }, null, 8, ["move", "ratio", "size", "always"]),
  13588. vue.createVNode(Thumb, {
  13589. move: moveY.value,
  13590. ratio: ratioY.value,
  13591. size: sizeHeight.value,
  13592. vertical: "",
  13593. always: _ctx.always
  13594. }, null, 8, ["move", "ratio", "size", "always"])
  13595. ], 64);
  13596. };
  13597. }
  13598. });
  13599. var Bar = /* @__PURE__ */ _export_sfc(_sfc_main$2q, [["__file", "bar.vue"]]);
  13600. const scrollbarProps = buildProps({
  13601. height: {
  13602. type: [String, Number],
  13603. default: ""
  13604. },
  13605. maxHeight: {
  13606. type: [String, Number],
  13607. default: ""
  13608. },
  13609. native: {
  13610. type: Boolean,
  13611. default: false
  13612. },
  13613. wrapStyle: {
  13614. type: definePropType([String, Object, Array]),
  13615. default: ""
  13616. },
  13617. wrapClass: {
  13618. type: [String, Array],
  13619. default: ""
  13620. },
  13621. viewClass: {
  13622. type: [String, Array],
  13623. default: ""
  13624. },
  13625. viewStyle: {
  13626. type: [String, Array, Object],
  13627. default: ""
  13628. },
  13629. noresize: Boolean,
  13630. tag: {
  13631. type: String,
  13632. default: "div"
  13633. },
  13634. always: Boolean,
  13635. minSize: {
  13636. type: Number,
  13637. default: 20
  13638. },
  13639. tabindex: {
  13640. type: [String, Number],
  13641. default: void 0
  13642. },
  13643. id: String,
  13644. role: String,
  13645. ...useAriaProps(["ariaLabel", "ariaOrientation"])
  13646. });
  13647. const scrollbarEmits = {
  13648. scroll: ({
  13649. scrollTop,
  13650. scrollLeft
  13651. }) => [scrollTop, scrollLeft].every(isNumber)
  13652. };
  13653. const COMPONENT_NAME$j = "ElScrollbar";
  13654. const __default__$1L = vue.defineComponent({
  13655. name: COMPONENT_NAME$j
  13656. });
  13657. const _sfc_main$2p = /* @__PURE__ */ vue.defineComponent({
  13658. ...__default__$1L,
  13659. props: scrollbarProps,
  13660. emits: scrollbarEmits,
  13661. setup(__props, { expose, emit }) {
  13662. const props = __props;
  13663. const ns = useNamespace("scrollbar");
  13664. let stopResizeObserver = void 0;
  13665. let stopResizeListener = void 0;
  13666. let wrapScrollTop = 0;
  13667. let wrapScrollLeft = 0;
  13668. const scrollbarRef = vue.ref();
  13669. const wrapRef = vue.ref();
  13670. const resizeRef = vue.ref();
  13671. const barRef = vue.ref();
  13672. const wrapStyle = vue.computed(() => {
  13673. const style = {};
  13674. if (props.height)
  13675. style.height = addUnit(props.height);
  13676. if (props.maxHeight)
  13677. style.maxHeight = addUnit(props.maxHeight);
  13678. return [props.wrapStyle, style];
  13679. });
  13680. const wrapKls = vue.computed(() => {
  13681. return [
  13682. props.wrapClass,
  13683. ns.e("wrap"),
  13684. { [ns.em("wrap", "hidden-default")]: !props.native }
  13685. ];
  13686. });
  13687. const resizeKls = vue.computed(() => {
  13688. return [ns.e("view"), props.viewClass];
  13689. });
  13690. const handleScroll = () => {
  13691. var _a;
  13692. if (wrapRef.value) {
  13693. (_a = barRef.value) == null ? void 0 : _a.handleScroll(wrapRef.value);
  13694. wrapScrollTop = wrapRef.value.scrollTop;
  13695. wrapScrollLeft = wrapRef.value.scrollLeft;
  13696. emit("scroll", {
  13697. scrollTop: wrapRef.value.scrollTop,
  13698. scrollLeft: wrapRef.value.scrollLeft
  13699. });
  13700. }
  13701. };
  13702. function scrollTo(arg1, arg2) {
  13703. if (isObject$1(arg1)) {
  13704. wrapRef.value.scrollTo(arg1);
  13705. } else if (isNumber(arg1) && isNumber(arg2)) {
  13706. wrapRef.value.scrollTo(arg1, arg2);
  13707. }
  13708. }
  13709. const setScrollTop = (value) => {
  13710. if (!isNumber(value)) {
  13711. return;
  13712. }
  13713. wrapRef.value.scrollTop = value;
  13714. };
  13715. const setScrollLeft = (value) => {
  13716. if (!isNumber(value)) {
  13717. return;
  13718. }
  13719. wrapRef.value.scrollLeft = value;
  13720. };
  13721. const update = () => {
  13722. var _a;
  13723. (_a = barRef.value) == null ? void 0 : _a.update();
  13724. };
  13725. vue.watch(() => props.noresize, (noresize) => {
  13726. if (noresize) {
  13727. stopResizeObserver == null ? void 0 : stopResizeObserver();
  13728. stopResizeListener == null ? void 0 : stopResizeListener();
  13729. } else {
  13730. ({ stop: stopResizeObserver } = useResizeObserver(resizeRef, update));
  13731. stopResizeListener = useEventListener("resize", update);
  13732. }
  13733. }, { immediate: true });
  13734. vue.watch(() => [props.maxHeight, props.height], () => {
  13735. if (!props.native)
  13736. vue.nextTick(() => {
  13737. var _a;
  13738. update();
  13739. if (wrapRef.value) {
  13740. (_a = barRef.value) == null ? void 0 : _a.handleScroll(wrapRef.value);
  13741. }
  13742. });
  13743. });
  13744. vue.provide(scrollbarContextKey, vue.reactive({
  13745. scrollbarElement: scrollbarRef,
  13746. wrapElement: wrapRef
  13747. }));
  13748. vue.onActivated(() => {
  13749. if (wrapRef.value) {
  13750. wrapRef.value.scrollTop = wrapScrollTop;
  13751. wrapRef.value.scrollLeft = wrapScrollLeft;
  13752. }
  13753. });
  13754. vue.onMounted(() => {
  13755. if (!props.native)
  13756. vue.nextTick(() => {
  13757. update();
  13758. });
  13759. });
  13760. vue.onUpdated(() => update());
  13761. expose({
  13762. wrapRef,
  13763. update,
  13764. scrollTo,
  13765. setScrollTop,
  13766. setScrollLeft,
  13767. handleScroll
  13768. });
  13769. return (_ctx, _cache) => {
  13770. return vue.openBlock(), vue.createElementBlock("div", {
  13771. ref_key: "scrollbarRef",
  13772. ref: scrollbarRef,
  13773. class: vue.normalizeClass(vue.unref(ns).b())
  13774. }, [
  13775. vue.createElementVNode("div", {
  13776. ref_key: "wrapRef",
  13777. ref: wrapRef,
  13778. class: vue.normalizeClass(vue.unref(wrapKls)),
  13779. style: vue.normalizeStyle(vue.unref(wrapStyle)),
  13780. tabindex: _ctx.tabindex,
  13781. onScroll: handleScroll
  13782. }, [
  13783. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.tag), {
  13784. id: _ctx.id,
  13785. ref_key: "resizeRef",
  13786. ref: resizeRef,
  13787. class: vue.normalizeClass(vue.unref(resizeKls)),
  13788. style: vue.normalizeStyle(_ctx.viewStyle),
  13789. role: _ctx.role,
  13790. "aria-label": _ctx.ariaLabel,
  13791. "aria-orientation": _ctx.ariaOrientation
  13792. }, {
  13793. default: vue.withCtx(() => [
  13794. vue.renderSlot(_ctx.$slots, "default")
  13795. ]),
  13796. _: 3
  13797. }, 8, ["id", "class", "style", "role", "aria-label", "aria-orientation"]))
  13798. ], 46, ["tabindex"]),
  13799. !_ctx.native ? (vue.openBlock(), vue.createBlock(Bar, {
  13800. key: 0,
  13801. ref_key: "barRef",
  13802. ref: barRef,
  13803. always: _ctx.always,
  13804. "min-size": _ctx.minSize
  13805. }, null, 8, ["always", "min-size"])) : vue.createCommentVNode("v-if", true)
  13806. ], 2);
  13807. };
  13808. }
  13809. });
  13810. var Scrollbar$1 = /* @__PURE__ */ _export_sfc(_sfc_main$2p, [["__file", "scrollbar.vue"]]);
  13811. const ElScrollbar = withInstall(Scrollbar$1);
  13812. const POPPER_INJECTION_KEY = Symbol("popper");
  13813. const POPPER_CONTENT_INJECTION_KEY = Symbol("popperContent");
  13814. const Effect = {
  13815. LIGHT: "light",
  13816. DARK: "dark"
  13817. };
  13818. const roleTypes = [
  13819. "dialog",
  13820. "grid",
  13821. "group",
  13822. "listbox",
  13823. "menu",
  13824. "navigation",
  13825. "tooltip",
  13826. "tree"
  13827. ];
  13828. const popperProps = buildProps({
  13829. role: {
  13830. type: String,
  13831. values: roleTypes,
  13832. default: "tooltip"
  13833. }
  13834. });
  13835. const usePopperProps = popperProps;
  13836. const __default__$1K = vue.defineComponent({
  13837. name: "ElPopper",
  13838. inheritAttrs: false
  13839. });
  13840. const _sfc_main$2o = /* @__PURE__ */ vue.defineComponent({
  13841. ...__default__$1K,
  13842. props: popperProps,
  13843. setup(__props, { expose }) {
  13844. const props = __props;
  13845. const triggerRef = vue.ref();
  13846. const popperInstanceRef = vue.ref();
  13847. const contentRef = vue.ref();
  13848. const referenceRef = vue.ref();
  13849. const role = vue.computed(() => props.role);
  13850. const popperProvides = {
  13851. triggerRef,
  13852. popperInstanceRef,
  13853. contentRef,
  13854. referenceRef,
  13855. role
  13856. };
  13857. expose(popperProvides);
  13858. vue.provide(POPPER_INJECTION_KEY, popperProvides);
  13859. return (_ctx, _cache) => {
  13860. return vue.renderSlot(_ctx.$slots, "default");
  13861. };
  13862. }
  13863. });
  13864. var Popper = /* @__PURE__ */ _export_sfc(_sfc_main$2o, [["__file", "popper.vue"]]);
  13865. const popperArrowProps = buildProps({
  13866. arrowOffset: {
  13867. type: Number,
  13868. default: 5
  13869. }
  13870. });
  13871. const usePopperArrowProps = popperArrowProps;
  13872. const __default__$1J = vue.defineComponent({
  13873. name: "ElPopperArrow",
  13874. inheritAttrs: false
  13875. });
  13876. const _sfc_main$2n = /* @__PURE__ */ vue.defineComponent({
  13877. ...__default__$1J,
  13878. props: popperArrowProps,
  13879. setup(__props, { expose }) {
  13880. const props = __props;
  13881. const ns = useNamespace("popper");
  13882. const { arrowOffset, arrowRef, arrowStyle } = vue.inject(POPPER_CONTENT_INJECTION_KEY, void 0);
  13883. vue.watch(() => props.arrowOffset, (val) => {
  13884. arrowOffset.value = val;
  13885. });
  13886. vue.onBeforeUnmount(() => {
  13887. arrowRef.value = void 0;
  13888. });
  13889. expose({
  13890. arrowRef
  13891. });
  13892. return (_ctx, _cache) => {
  13893. return vue.openBlock(), vue.createElementBlock("span", {
  13894. ref_key: "arrowRef",
  13895. ref: arrowRef,
  13896. class: vue.normalizeClass(vue.unref(ns).e("arrow")),
  13897. style: vue.normalizeStyle(vue.unref(arrowStyle)),
  13898. "data-popper-arrow": ""
  13899. }, null, 6);
  13900. };
  13901. }
  13902. });
  13903. var ElPopperArrow = /* @__PURE__ */ _export_sfc(_sfc_main$2n, [["__file", "arrow.vue"]]);
  13904. const NAME = "ElOnlyChild";
  13905. const OnlyChild = vue.defineComponent({
  13906. name: NAME,
  13907. setup(_, {
  13908. slots,
  13909. attrs
  13910. }) {
  13911. var _a;
  13912. const forwardRefInjection = vue.inject(FORWARD_REF_INJECTION_KEY);
  13913. const forwardRefDirective = useForwardRefDirective((_a = forwardRefInjection == null ? void 0 : forwardRefInjection.setForwardRef) != null ? _a : NOOP);
  13914. return () => {
  13915. var _a2;
  13916. const defaultSlot = (_a2 = slots.default) == null ? void 0 : _a2.call(slots, attrs);
  13917. if (!defaultSlot)
  13918. return null;
  13919. if (defaultSlot.length > 1) {
  13920. return null;
  13921. }
  13922. const firstLegitNode = findFirstLegitChild(defaultSlot);
  13923. if (!firstLegitNode) {
  13924. return null;
  13925. }
  13926. return vue.withDirectives(vue.cloneVNode(firstLegitNode, attrs), [[forwardRefDirective]]);
  13927. };
  13928. }
  13929. });
  13930. function findFirstLegitChild(node) {
  13931. if (!node)
  13932. return null;
  13933. const children = node;
  13934. for (const child of children) {
  13935. if (isObject$1(child)) {
  13936. switch (child.type) {
  13937. case vue.Comment:
  13938. continue;
  13939. case vue.Text:
  13940. case "svg":
  13941. return wrapTextContent(child);
  13942. case vue.Fragment:
  13943. return findFirstLegitChild(child.children);
  13944. default:
  13945. return child;
  13946. }
  13947. }
  13948. return wrapTextContent(child);
  13949. }
  13950. return null;
  13951. }
  13952. function wrapTextContent(s) {
  13953. const ns = useNamespace("only-child");
  13954. return vue.createVNode("span", {
  13955. "class": ns.e("content")
  13956. }, [s]);
  13957. }
  13958. const popperTriggerProps = buildProps({
  13959. virtualRef: {
  13960. type: definePropType(Object)
  13961. },
  13962. virtualTriggering: Boolean,
  13963. onMouseenter: {
  13964. type: definePropType(Function)
  13965. },
  13966. onMouseleave: {
  13967. type: definePropType(Function)
  13968. },
  13969. onClick: {
  13970. type: definePropType(Function)
  13971. },
  13972. onKeydown: {
  13973. type: definePropType(Function)
  13974. },
  13975. onFocus: {
  13976. type: definePropType(Function)
  13977. },
  13978. onBlur: {
  13979. type: definePropType(Function)
  13980. },
  13981. onContextmenu: {
  13982. type: definePropType(Function)
  13983. },
  13984. id: String,
  13985. open: Boolean
  13986. });
  13987. const usePopperTriggerProps = popperTriggerProps;
  13988. const __default__$1I = vue.defineComponent({
  13989. name: "ElPopperTrigger",
  13990. inheritAttrs: false
  13991. });
  13992. const _sfc_main$2m = /* @__PURE__ */ vue.defineComponent({
  13993. ...__default__$1I,
  13994. props: popperTriggerProps,
  13995. setup(__props, { expose }) {
  13996. const props = __props;
  13997. const { role, triggerRef } = vue.inject(POPPER_INJECTION_KEY, void 0);
  13998. useForwardRef(triggerRef);
  13999. const ariaControls = vue.computed(() => {
  14000. return ariaHaspopup.value ? props.id : void 0;
  14001. });
  14002. const ariaDescribedby = vue.computed(() => {
  14003. if (role && role.value === "tooltip") {
  14004. return props.open && props.id ? props.id : void 0;
  14005. }
  14006. return void 0;
  14007. });
  14008. const ariaHaspopup = vue.computed(() => {
  14009. if (role && role.value !== "tooltip") {
  14010. return role.value;
  14011. }
  14012. return void 0;
  14013. });
  14014. const ariaExpanded = vue.computed(() => {
  14015. return ariaHaspopup.value ? `${props.open}` : void 0;
  14016. });
  14017. let virtualTriggerAriaStopWatch = void 0;
  14018. const TRIGGER_ELE_EVENTS = [
  14019. "onMouseenter",
  14020. "onMouseleave",
  14021. "onClick",
  14022. "onKeydown",
  14023. "onFocus",
  14024. "onBlur",
  14025. "onContextmenu"
  14026. ];
  14027. vue.onMounted(() => {
  14028. vue.watch(() => props.virtualRef, (virtualEl) => {
  14029. if (virtualEl) {
  14030. triggerRef.value = unrefElement(virtualEl);
  14031. }
  14032. }, {
  14033. immediate: true
  14034. });
  14035. vue.watch(triggerRef, (el, prevEl) => {
  14036. virtualTriggerAriaStopWatch == null ? void 0 : virtualTriggerAriaStopWatch();
  14037. virtualTriggerAriaStopWatch = void 0;
  14038. if (isElement$1(el)) {
  14039. TRIGGER_ELE_EVENTS.forEach((eventName) => {
  14040. var _a;
  14041. const handler = props[eventName];
  14042. if (handler) {
  14043. el.addEventListener(eventName.slice(2).toLowerCase(), handler);
  14044. (_a = prevEl == null ? void 0 : prevEl.removeEventListener) == null ? void 0 : _a.call(prevEl, eventName.slice(2).toLowerCase(), handler);
  14045. }
  14046. });
  14047. if (isFocusable(el)) {
  14048. virtualTriggerAriaStopWatch = vue.watch([ariaControls, ariaDescribedby, ariaHaspopup, ariaExpanded], (watches) => {
  14049. [
  14050. "aria-controls",
  14051. "aria-describedby",
  14052. "aria-haspopup",
  14053. "aria-expanded"
  14054. ].forEach((key, idx) => {
  14055. isNil(watches[idx]) ? el.removeAttribute(key) : el.setAttribute(key, watches[idx]);
  14056. });
  14057. }, { immediate: true });
  14058. }
  14059. }
  14060. if (isElement$1(prevEl) && isFocusable(prevEl)) {
  14061. [
  14062. "aria-controls",
  14063. "aria-describedby",
  14064. "aria-haspopup",
  14065. "aria-expanded"
  14066. ].forEach((key) => prevEl.removeAttribute(key));
  14067. }
  14068. }, {
  14069. immediate: true
  14070. });
  14071. });
  14072. vue.onBeforeUnmount(() => {
  14073. virtualTriggerAriaStopWatch == null ? void 0 : virtualTriggerAriaStopWatch();
  14074. virtualTriggerAriaStopWatch = void 0;
  14075. if (triggerRef.value && isElement$1(triggerRef.value)) {
  14076. const el = triggerRef.value;
  14077. TRIGGER_ELE_EVENTS.forEach((eventName) => {
  14078. const handler = props[eventName];
  14079. if (handler) {
  14080. el.removeEventListener(eventName.slice(2).toLowerCase(), handler);
  14081. }
  14082. });
  14083. triggerRef.value = void 0;
  14084. }
  14085. });
  14086. expose({
  14087. triggerRef
  14088. });
  14089. return (_ctx, _cache) => {
  14090. return !_ctx.virtualTriggering ? (vue.openBlock(), vue.createBlock(vue.unref(OnlyChild), vue.mergeProps({ key: 0 }, _ctx.$attrs, {
  14091. "aria-controls": vue.unref(ariaControls),
  14092. "aria-describedby": vue.unref(ariaDescribedby),
  14093. "aria-expanded": vue.unref(ariaExpanded),
  14094. "aria-haspopup": vue.unref(ariaHaspopup)
  14095. }), {
  14096. default: vue.withCtx(() => [
  14097. vue.renderSlot(_ctx.$slots, "default")
  14098. ]),
  14099. _: 3
  14100. }, 16, ["aria-controls", "aria-describedby", "aria-expanded", "aria-haspopup"])) : vue.createCommentVNode("v-if", true);
  14101. };
  14102. }
  14103. });
  14104. var ElPopperTrigger = /* @__PURE__ */ _export_sfc(_sfc_main$2m, [["__file", "trigger.vue"]]);
  14105. const FOCUS_AFTER_TRAPPED = "focus-trap.focus-after-trapped";
  14106. const FOCUS_AFTER_RELEASED = "focus-trap.focus-after-released";
  14107. const FOCUSOUT_PREVENTED = "focus-trap.focusout-prevented";
  14108. const FOCUS_AFTER_TRAPPED_OPTS = {
  14109. cancelable: true,
  14110. bubbles: false
  14111. };
  14112. const FOCUSOUT_PREVENTED_OPTS = {
  14113. cancelable: true,
  14114. bubbles: false
  14115. };
  14116. const ON_TRAP_FOCUS_EVT = "focusAfterTrapped";
  14117. const ON_RELEASE_FOCUS_EVT = "focusAfterReleased";
  14118. const FOCUS_TRAP_INJECTION_KEY = Symbol("elFocusTrap");
  14119. const focusReason = vue.ref();
  14120. const lastUserFocusTimestamp = vue.ref(0);
  14121. const lastAutomatedFocusTimestamp = vue.ref(0);
  14122. let focusReasonUserCount = 0;
  14123. const obtainAllFocusableElements = (element) => {
  14124. const nodes = [];
  14125. const walker = document.createTreeWalker(element, NodeFilter.SHOW_ELEMENT, {
  14126. acceptNode: (node) => {
  14127. const isHiddenInput = node.tagName === "INPUT" && node.type === "hidden";
  14128. if (node.disabled || node.hidden || isHiddenInput)
  14129. return NodeFilter.FILTER_SKIP;
  14130. return node.tabIndex >= 0 || node === document.activeElement ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
  14131. }
  14132. });
  14133. while (walker.nextNode())
  14134. nodes.push(walker.currentNode);
  14135. return nodes;
  14136. };
  14137. const getVisibleElement = (elements, container) => {
  14138. for (const element of elements) {
  14139. if (!isHidden(element, container))
  14140. return element;
  14141. }
  14142. };
  14143. const isHidden = (element, container) => {
  14144. if (getComputedStyle(element).visibility === "hidden")
  14145. return true;
  14146. while (element) {
  14147. if (container && element === container)
  14148. return false;
  14149. if (getComputedStyle(element).display === "none")
  14150. return true;
  14151. element = element.parentElement;
  14152. }
  14153. return false;
  14154. };
  14155. const getEdges = (container) => {
  14156. const focusable = obtainAllFocusableElements(container);
  14157. const first = getVisibleElement(focusable, container);
  14158. const last = getVisibleElement(focusable.reverse(), container);
  14159. return [first, last];
  14160. };
  14161. const isSelectable = (element) => {
  14162. return element instanceof HTMLInputElement && "select" in element;
  14163. };
  14164. const tryFocus = (element, shouldSelect) => {
  14165. if (element && element.focus) {
  14166. const prevFocusedElement = document.activeElement;
  14167. element.focus({ preventScroll: true });
  14168. lastAutomatedFocusTimestamp.value = window.performance.now();
  14169. if (element !== prevFocusedElement && isSelectable(element) && shouldSelect) {
  14170. element.select();
  14171. }
  14172. }
  14173. };
  14174. function removeFromStack(list, item) {
  14175. const copy = [...list];
  14176. const idx = list.indexOf(item);
  14177. if (idx !== -1) {
  14178. copy.splice(idx, 1);
  14179. }
  14180. return copy;
  14181. }
  14182. const createFocusableStack = () => {
  14183. let stack = [];
  14184. const push = (layer) => {
  14185. const currentLayer = stack[0];
  14186. if (currentLayer && layer !== currentLayer) {
  14187. currentLayer.pause();
  14188. }
  14189. stack = removeFromStack(stack, layer);
  14190. stack.unshift(layer);
  14191. };
  14192. const remove = (layer) => {
  14193. var _a, _b;
  14194. stack = removeFromStack(stack, layer);
  14195. (_b = (_a = stack[0]) == null ? void 0 : _a.resume) == null ? void 0 : _b.call(_a);
  14196. };
  14197. return {
  14198. push,
  14199. remove
  14200. };
  14201. };
  14202. const focusFirstDescendant = (elements, shouldSelect = false) => {
  14203. const prevFocusedElement = document.activeElement;
  14204. for (const element of elements) {
  14205. tryFocus(element, shouldSelect);
  14206. if (document.activeElement !== prevFocusedElement)
  14207. return;
  14208. }
  14209. };
  14210. const focusableStack = createFocusableStack();
  14211. const isFocusCausedByUserEvent = () => {
  14212. return lastUserFocusTimestamp.value > lastAutomatedFocusTimestamp.value;
  14213. };
  14214. const notifyFocusReasonPointer = () => {
  14215. focusReason.value = "pointer";
  14216. lastUserFocusTimestamp.value = window.performance.now();
  14217. };
  14218. const notifyFocusReasonKeydown = () => {
  14219. focusReason.value = "keyboard";
  14220. lastUserFocusTimestamp.value = window.performance.now();
  14221. };
  14222. const useFocusReason = () => {
  14223. vue.onMounted(() => {
  14224. if (focusReasonUserCount === 0) {
  14225. document.addEventListener("mousedown", notifyFocusReasonPointer);
  14226. document.addEventListener("touchstart", notifyFocusReasonPointer);
  14227. document.addEventListener("keydown", notifyFocusReasonKeydown);
  14228. }
  14229. focusReasonUserCount++;
  14230. });
  14231. vue.onBeforeUnmount(() => {
  14232. focusReasonUserCount--;
  14233. if (focusReasonUserCount <= 0) {
  14234. document.removeEventListener("mousedown", notifyFocusReasonPointer);
  14235. document.removeEventListener("touchstart", notifyFocusReasonPointer);
  14236. document.removeEventListener("keydown", notifyFocusReasonKeydown);
  14237. }
  14238. });
  14239. return {
  14240. focusReason,
  14241. lastUserFocusTimestamp,
  14242. lastAutomatedFocusTimestamp
  14243. };
  14244. };
  14245. const createFocusOutPreventedEvent = (detail) => {
  14246. return new CustomEvent(FOCUSOUT_PREVENTED, {
  14247. ...FOCUSOUT_PREVENTED_OPTS,
  14248. detail
  14249. });
  14250. };
  14251. const _sfc_main$2l = vue.defineComponent({
  14252. name: "ElFocusTrap",
  14253. inheritAttrs: false,
  14254. props: {
  14255. loop: Boolean,
  14256. trapped: Boolean,
  14257. focusTrapEl: Object,
  14258. focusStartEl: {
  14259. type: [Object, String],
  14260. default: "first"
  14261. }
  14262. },
  14263. emits: [
  14264. ON_TRAP_FOCUS_EVT,
  14265. ON_RELEASE_FOCUS_EVT,
  14266. "focusin",
  14267. "focusout",
  14268. "focusout-prevented",
  14269. "release-requested"
  14270. ],
  14271. setup(props, { emit }) {
  14272. const forwardRef = vue.ref();
  14273. let lastFocusBeforeTrapped;
  14274. let lastFocusAfterTrapped;
  14275. const { focusReason } = useFocusReason();
  14276. useEscapeKeydown((event) => {
  14277. if (props.trapped && !focusLayer.paused) {
  14278. emit("release-requested", event);
  14279. }
  14280. });
  14281. const focusLayer = {
  14282. paused: false,
  14283. pause() {
  14284. this.paused = true;
  14285. },
  14286. resume() {
  14287. this.paused = false;
  14288. }
  14289. };
  14290. const onKeydown = (e) => {
  14291. if (!props.loop && !props.trapped)
  14292. return;
  14293. if (focusLayer.paused)
  14294. return;
  14295. const { code, altKey, ctrlKey, metaKey, currentTarget, shiftKey } = e;
  14296. const { loop } = props;
  14297. const isTabbing = code === EVENT_CODE.tab && !altKey && !ctrlKey && !metaKey;
  14298. const currentFocusingEl = document.activeElement;
  14299. if (isTabbing && currentFocusingEl) {
  14300. const container = currentTarget;
  14301. const [first, last] = getEdges(container);
  14302. const isTabbable = first && last;
  14303. if (!isTabbable) {
  14304. if (currentFocusingEl === container) {
  14305. const focusoutPreventedEvent = createFocusOutPreventedEvent({
  14306. focusReason: focusReason.value
  14307. });
  14308. emit("focusout-prevented", focusoutPreventedEvent);
  14309. if (!focusoutPreventedEvent.defaultPrevented) {
  14310. e.preventDefault();
  14311. }
  14312. }
  14313. } else {
  14314. if (!shiftKey && currentFocusingEl === last) {
  14315. const focusoutPreventedEvent = createFocusOutPreventedEvent({
  14316. focusReason: focusReason.value
  14317. });
  14318. emit("focusout-prevented", focusoutPreventedEvent);
  14319. if (!focusoutPreventedEvent.defaultPrevented) {
  14320. e.preventDefault();
  14321. if (loop)
  14322. tryFocus(first, true);
  14323. }
  14324. } else if (shiftKey && [first, container].includes(currentFocusingEl)) {
  14325. const focusoutPreventedEvent = createFocusOutPreventedEvent({
  14326. focusReason: focusReason.value
  14327. });
  14328. emit("focusout-prevented", focusoutPreventedEvent);
  14329. if (!focusoutPreventedEvent.defaultPrevented) {
  14330. e.preventDefault();
  14331. if (loop)
  14332. tryFocus(last, true);
  14333. }
  14334. }
  14335. }
  14336. }
  14337. };
  14338. vue.provide(FOCUS_TRAP_INJECTION_KEY, {
  14339. focusTrapRef: forwardRef,
  14340. onKeydown
  14341. });
  14342. vue.watch(() => props.focusTrapEl, (focusTrapEl) => {
  14343. if (focusTrapEl) {
  14344. forwardRef.value = focusTrapEl;
  14345. }
  14346. }, { immediate: true });
  14347. vue.watch([forwardRef], ([forwardRef2], [oldForwardRef]) => {
  14348. if (forwardRef2) {
  14349. forwardRef2.addEventListener("keydown", onKeydown);
  14350. forwardRef2.addEventListener("focusin", onFocusIn);
  14351. forwardRef2.addEventListener("focusout", onFocusOut);
  14352. }
  14353. if (oldForwardRef) {
  14354. oldForwardRef.removeEventListener("keydown", onKeydown);
  14355. oldForwardRef.removeEventListener("focusin", onFocusIn);
  14356. oldForwardRef.removeEventListener("focusout", onFocusOut);
  14357. }
  14358. });
  14359. const trapOnFocus = (e) => {
  14360. emit(ON_TRAP_FOCUS_EVT, e);
  14361. };
  14362. const releaseOnFocus = (e) => emit(ON_RELEASE_FOCUS_EVT, e);
  14363. const onFocusIn = (e) => {
  14364. const trapContainer = vue.unref(forwardRef);
  14365. if (!trapContainer)
  14366. return;
  14367. const target = e.target;
  14368. const relatedTarget = e.relatedTarget;
  14369. const isFocusedInTrap = target && trapContainer.contains(target);
  14370. if (!props.trapped) {
  14371. const isPrevFocusedInTrap = relatedTarget && trapContainer.contains(relatedTarget);
  14372. if (!isPrevFocusedInTrap) {
  14373. lastFocusBeforeTrapped = relatedTarget;
  14374. }
  14375. }
  14376. if (isFocusedInTrap)
  14377. emit("focusin", e);
  14378. if (focusLayer.paused)
  14379. return;
  14380. if (props.trapped) {
  14381. if (isFocusedInTrap) {
  14382. lastFocusAfterTrapped = target;
  14383. } else {
  14384. tryFocus(lastFocusAfterTrapped, true);
  14385. }
  14386. }
  14387. };
  14388. const onFocusOut = (e) => {
  14389. const trapContainer = vue.unref(forwardRef);
  14390. if (focusLayer.paused || !trapContainer)
  14391. return;
  14392. if (props.trapped) {
  14393. const relatedTarget = e.relatedTarget;
  14394. if (!isNil(relatedTarget) && !trapContainer.contains(relatedTarget)) {
  14395. setTimeout(() => {
  14396. if (!focusLayer.paused && props.trapped) {
  14397. const focusoutPreventedEvent = createFocusOutPreventedEvent({
  14398. focusReason: focusReason.value
  14399. });
  14400. emit("focusout-prevented", focusoutPreventedEvent);
  14401. if (!focusoutPreventedEvent.defaultPrevented) {
  14402. tryFocus(lastFocusAfterTrapped, true);
  14403. }
  14404. }
  14405. }, 0);
  14406. }
  14407. } else {
  14408. const target = e.target;
  14409. const isFocusedInTrap = target && trapContainer.contains(target);
  14410. if (!isFocusedInTrap)
  14411. emit("focusout", e);
  14412. }
  14413. };
  14414. async function startTrap() {
  14415. await vue.nextTick();
  14416. const trapContainer = vue.unref(forwardRef);
  14417. if (trapContainer) {
  14418. focusableStack.push(focusLayer);
  14419. const prevFocusedElement = trapContainer.contains(document.activeElement) ? lastFocusBeforeTrapped : document.activeElement;
  14420. lastFocusBeforeTrapped = prevFocusedElement;
  14421. const isPrevFocusContained = trapContainer.contains(prevFocusedElement);
  14422. if (!isPrevFocusContained) {
  14423. const focusEvent = new Event(FOCUS_AFTER_TRAPPED, FOCUS_AFTER_TRAPPED_OPTS);
  14424. trapContainer.addEventListener(FOCUS_AFTER_TRAPPED, trapOnFocus);
  14425. trapContainer.dispatchEvent(focusEvent);
  14426. if (!focusEvent.defaultPrevented) {
  14427. vue.nextTick(() => {
  14428. let focusStartEl = props.focusStartEl;
  14429. if (!isString$1(focusStartEl)) {
  14430. tryFocus(focusStartEl);
  14431. if (document.activeElement !== focusStartEl) {
  14432. focusStartEl = "first";
  14433. }
  14434. }
  14435. if (focusStartEl === "first") {
  14436. focusFirstDescendant(obtainAllFocusableElements(trapContainer), true);
  14437. }
  14438. if (document.activeElement === prevFocusedElement || focusStartEl === "container") {
  14439. tryFocus(trapContainer);
  14440. }
  14441. });
  14442. }
  14443. }
  14444. }
  14445. }
  14446. function stopTrap() {
  14447. const trapContainer = vue.unref(forwardRef);
  14448. if (trapContainer) {
  14449. trapContainer.removeEventListener(FOCUS_AFTER_TRAPPED, trapOnFocus);
  14450. const releasedEvent = new CustomEvent(FOCUS_AFTER_RELEASED, {
  14451. ...FOCUS_AFTER_TRAPPED_OPTS,
  14452. detail: {
  14453. focusReason: focusReason.value
  14454. }
  14455. });
  14456. trapContainer.addEventListener(FOCUS_AFTER_RELEASED, releaseOnFocus);
  14457. trapContainer.dispatchEvent(releasedEvent);
  14458. if (!releasedEvent.defaultPrevented && (focusReason.value == "keyboard" || !isFocusCausedByUserEvent() || trapContainer.contains(document.activeElement))) {
  14459. tryFocus(lastFocusBeforeTrapped != null ? lastFocusBeforeTrapped : document.body);
  14460. }
  14461. trapContainer.removeEventListener(FOCUS_AFTER_RELEASED, releaseOnFocus);
  14462. focusableStack.remove(focusLayer);
  14463. }
  14464. }
  14465. vue.onMounted(() => {
  14466. if (props.trapped) {
  14467. startTrap();
  14468. }
  14469. vue.watch(() => props.trapped, (trapped) => {
  14470. if (trapped) {
  14471. startTrap();
  14472. } else {
  14473. stopTrap();
  14474. }
  14475. });
  14476. });
  14477. vue.onBeforeUnmount(() => {
  14478. if (props.trapped) {
  14479. stopTrap();
  14480. }
  14481. if (forwardRef.value) {
  14482. forwardRef.value.removeEventListener("keydown", onKeydown);
  14483. forwardRef.value.removeEventListener("focusin", onFocusIn);
  14484. forwardRef.value.removeEventListener("focusout", onFocusOut);
  14485. forwardRef.value = void 0;
  14486. }
  14487. });
  14488. return {
  14489. onKeydown
  14490. };
  14491. }
  14492. });
  14493. function _sfc_render$u(_ctx, _cache, $props, $setup, $data, $options) {
  14494. return vue.renderSlot(_ctx.$slots, "default", { handleKeydown: _ctx.onKeydown });
  14495. }
  14496. var ElFocusTrap = /* @__PURE__ */ _export_sfc(_sfc_main$2l, [["render", _sfc_render$u], ["__file", "focus-trap.vue"]]);
  14497. const POSITIONING_STRATEGIES = ["fixed", "absolute"];
  14498. const popperCoreConfigProps = buildProps({
  14499. boundariesPadding: {
  14500. type: Number,
  14501. default: 0
  14502. },
  14503. fallbackPlacements: {
  14504. type: definePropType(Array),
  14505. default: void 0
  14506. },
  14507. gpuAcceleration: {
  14508. type: Boolean,
  14509. default: true
  14510. },
  14511. offset: {
  14512. type: Number,
  14513. default: 12
  14514. },
  14515. placement: {
  14516. type: String,
  14517. values: Ee,
  14518. default: "bottom"
  14519. },
  14520. popperOptions: {
  14521. type: definePropType(Object),
  14522. default: () => ({})
  14523. },
  14524. strategy: {
  14525. type: String,
  14526. values: POSITIONING_STRATEGIES,
  14527. default: "absolute"
  14528. }
  14529. });
  14530. const popperContentProps = buildProps({
  14531. ...popperCoreConfigProps,
  14532. id: String,
  14533. style: {
  14534. type: definePropType([String, Array, Object])
  14535. },
  14536. className: {
  14537. type: definePropType([String, Array, Object])
  14538. },
  14539. effect: {
  14540. type: definePropType(String),
  14541. default: "dark"
  14542. },
  14543. visible: Boolean,
  14544. enterable: {
  14545. type: Boolean,
  14546. default: true
  14547. },
  14548. pure: Boolean,
  14549. focusOnShow: {
  14550. type: Boolean,
  14551. default: false
  14552. },
  14553. trapping: {
  14554. type: Boolean,
  14555. default: false
  14556. },
  14557. popperClass: {
  14558. type: definePropType([String, Array, Object])
  14559. },
  14560. popperStyle: {
  14561. type: definePropType([String, Array, Object])
  14562. },
  14563. referenceEl: {
  14564. type: definePropType(Object)
  14565. },
  14566. triggerTargetEl: {
  14567. type: definePropType(Object)
  14568. },
  14569. stopPopperMouseEvent: {
  14570. type: Boolean,
  14571. default: true
  14572. },
  14573. virtualTriggering: Boolean,
  14574. zIndex: Number,
  14575. ...useAriaProps(["ariaLabel"])
  14576. });
  14577. const popperContentEmits = {
  14578. mouseenter: (evt) => evt instanceof MouseEvent,
  14579. mouseleave: (evt) => evt instanceof MouseEvent,
  14580. focus: () => true,
  14581. blur: () => true,
  14582. close: () => true
  14583. };
  14584. const usePopperCoreConfigProps = popperCoreConfigProps;
  14585. const usePopperContentProps = popperContentProps;
  14586. const usePopperContentEmits = popperContentEmits;
  14587. const buildPopperOptions = (props, modifiers = []) => {
  14588. const { placement, strategy, popperOptions } = props;
  14589. const options = {
  14590. placement,
  14591. strategy,
  14592. ...popperOptions,
  14593. modifiers: [...genModifiers(props), ...modifiers]
  14594. };
  14595. deriveExtraModifiers(options, popperOptions == null ? void 0 : popperOptions.modifiers);
  14596. return options;
  14597. };
  14598. const unwrapMeasurableEl = ($el) => {
  14599. if (!isClient)
  14600. return;
  14601. return unrefElement($el);
  14602. };
  14603. function genModifiers(options) {
  14604. const { offset, gpuAcceleration, fallbackPlacements } = options;
  14605. return [
  14606. {
  14607. name: "offset",
  14608. options: {
  14609. offset: [0, offset != null ? offset : 12]
  14610. }
  14611. },
  14612. {
  14613. name: "preventOverflow",
  14614. options: {
  14615. padding: {
  14616. top: 2,
  14617. bottom: 2,
  14618. left: 5,
  14619. right: 5
  14620. }
  14621. }
  14622. },
  14623. {
  14624. name: "flip",
  14625. options: {
  14626. padding: 5,
  14627. fallbackPlacements
  14628. }
  14629. },
  14630. {
  14631. name: "computeStyles",
  14632. options: {
  14633. gpuAcceleration
  14634. }
  14635. }
  14636. ];
  14637. }
  14638. function deriveExtraModifiers(options, modifiers) {
  14639. if (modifiers) {
  14640. options.modifiers = [...options.modifiers, ...modifiers != null ? modifiers : []];
  14641. }
  14642. }
  14643. const DEFAULT_ARROW_OFFSET = 0;
  14644. const usePopperContent = (props) => {
  14645. const { popperInstanceRef, contentRef, triggerRef, role } = vue.inject(POPPER_INJECTION_KEY, void 0);
  14646. const arrowRef = vue.ref();
  14647. const arrowOffset = vue.ref();
  14648. const eventListenerModifier = vue.computed(() => {
  14649. return {
  14650. name: "eventListeners",
  14651. enabled: !!props.visible
  14652. };
  14653. });
  14654. const arrowModifier = vue.computed(() => {
  14655. var _a;
  14656. const arrowEl = vue.unref(arrowRef);
  14657. const offset = (_a = vue.unref(arrowOffset)) != null ? _a : DEFAULT_ARROW_OFFSET;
  14658. return {
  14659. name: "arrow",
  14660. enabled: !isUndefined$1(arrowEl),
  14661. options: {
  14662. element: arrowEl,
  14663. padding: offset
  14664. }
  14665. };
  14666. });
  14667. const options = vue.computed(() => {
  14668. return {
  14669. onFirstUpdate: () => {
  14670. update();
  14671. },
  14672. ...buildPopperOptions(props, [
  14673. vue.unref(arrowModifier),
  14674. vue.unref(eventListenerModifier)
  14675. ])
  14676. };
  14677. });
  14678. const computedReference = vue.computed(() => unwrapMeasurableEl(props.referenceEl) || vue.unref(triggerRef));
  14679. const { attributes, state, styles, update, forceUpdate, instanceRef } = usePopper(computedReference, contentRef, options);
  14680. vue.watch(instanceRef, (instance) => popperInstanceRef.value = instance);
  14681. vue.onMounted(() => {
  14682. vue.watch(() => {
  14683. var _a;
  14684. return (_a = vue.unref(computedReference)) == null ? void 0 : _a.getBoundingClientRect();
  14685. }, () => {
  14686. update();
  14687. });
  14688. });
  14689. return {
  14690. attributes,
  14691. arrowRef,
  14692. contentRef,
  14693. instanceRef,
  14694. state,
  14695. styles,
  14696. role,
  14697. forceUpdate,
  14698. update
  14699. };
  14700. };
  14701. const usePopperContentDOM = (props, {
  14702. attributes,
  14703. styles,
  14704. role
  14705. }) => {
  14706. const { nextZIndex } = useZIndex();
  14707. const ns = useNamespace("popper");
  14708. const contentAttrs = vue.computed(() => vue.unref(attributes).popper);
  14709. const contentZIndex = vue.ref(isNumber(props.zIndex) ? props.zIndex : nextZIndex());
  14710. const contentClass = vue.computed(() => [
  14711. ns.b(),
  14712. ns.is("pure", props.pure),
  14713. ns.is(props.effect),
  14714. props.popperClass
  14715. ]);
  14716. const contentStyle = vue.computed(() => {
  14717. return [
  14718. { zIndex: vue.unref(contentZIndex) },
  14719. vue.unref(styles).popper,
  14720. props.popperStyle || {}
  14721. ];
  14722. });
  14723. const ariaModal = vue.computed(() => role.value === "dialog" ? "false" : void 0);
  14724. const arrowStyle = vue.computed(() => vue.unref(styles).arrow || {});
  14725. const updateZIndex = () => {
  14726. contentZIndex.value = isNumber(props.zIndex) ? props.zIndex : nextZIndex();
  14727. };
  14728. return {
  14729. ariaModal,
  14730. arrowStyle,
  14731. contentAttrs,
  14732. contentClass,
  14733. contentStyle,
  14734. contentZIndex,
  14735. updateZIndex
  14736. };
  14737. };
  14738. const usePopperContentFocusTrap = (props, emit) => {
  14739. const trapped = vue.ref(false);
  14740. const focusStartRef = vue.ref();
  14741. const onFocusAfterTrapped = () => {
  14742. emit("focus");
  14743. };
  14744. const onFocusAfterReleased = (event) => {
  14745. var _a;
  14746. if (((_a = event.detail) == null ? void 0 : _a.focusReason) !== "pointer") {
  14747. focusStartRef.value = "first";
  14748. emit("blur");
  14749. }
  14750. };
  14751. const onFocusInTrap = (event) => {
  14752. if (props.visible && !trapped.value) {
  14753. if (event.target) {
  14754. focusStartRef.value = event.target;
  14755. }
  14756. trapped.value = true;
  14757. }
  14758. };
  14759. const onFocusoutPrevented = (event) => {
  14760. if (!props.trapping) {
  14761. if (event.detail.focusReason === "pointer") {
  14762. event.preventDefault();
  14763. }
  14764. trapped.value = false;
  14765. }
  14766. };
  14767. const onReleaseRequested = () => {
  14768. trapped.value = false;
  14769. emit("close");
  14770. };
  14771. return {
  14772. focusStartRef,
  14773. trapped,
  14774. onFocusAfterReleased,
  14775. onFocusAfterTrapped,
  14776. onFocusInTrap,
  14777. onFocusoutPrevented,
  14778. onReleaseRequested
  14779. };
  14780. };
  14781. const __default__$1H = vue.defineComponent({
  14782. name: "ElPopperContent"
  14783. });
  14784. const _sfc_main$2k = /* @__PURE__ */ vue.defineComponent({
  14785. ...__default__$1H,
  14786. props: popperContentProps,
  14787. emits: popperContentEmits,
  14788. setup(__props, { expose, emit }) {
  14789. const props = __props;
  14790. const {
  14791. focusStartRef,
  14792. trapped,
  14793. onFocusAfterReleased,
  14794. onFocusAfterTrapped,
  14795. onFocusInTrap,
  14796. onFocusoutPrevented,
  14797. onReleaseRequested
  14798. } = usePopperContentFocusTrap(props, emit);
  14799. const { attributes, arrowRef, contentRef, styles, instanceRef, role, update } = usePopperContent(props);
  14800. const {
  14801. ariaModal,
  14802. arrowStyle,
  14803. contentAttrs,
  14804. contentClass,
  14805. contentStyle,
  14806. updateZIndex
  14807. } = usePopperContentDOM(props, {
  14808. styles,
  14809. attributes,
  14810. role
  14811. });
  14812. const formItemContext = vue.inject(formItemContextKey, void 0);
  14813. const arrowOffset = vue.ref();
  14814. vue.provide(POPPER_CONTENT_INJECTION_KEY, {
  14815. arrowStyle,
  14816. arrowRef,
  14817. arrowOffset
  14818. });
  14819. if (formItemContext) {
  14820. vue.provide(formItemContextKey, {
  14821. ...formItemContext,
  14822. addInputId: NOOP,
  14823. removeInputId: NOOP
  14824. });
  14825. }
  14826. let triggerTargetAriaStopWatch = void 0;
  14827. const updatePopper = (shouldUpdateZIndex = true) => {
  14828. update();
  14829. shouldUpdateZIndex && updateZIndex();
  14830. };
  14831. const togglePopperAlive = () => {
  14832. updatePopper(false);
  14833. if (props.visible && props.focusOnShow) {
  14834. trapped.value = true;
  14835. } else if (props.visible === false) {
  14836. trapped.value = false;
  14837. }
  14838. };
  14839. vue.onMounted(() => {
  14840. vue.watch(() => props.triggerTargetEl, (triggerTargetEl, prevTriggerTargetEl) => {
  14841. triggerTargetAriaStopWatch == null ? void 0 : triggerTargetAriaStopWatch();
  14842. triggerTargetAriaStopWatch = void 0;
  14843. const el = vue.unref(triggerTargetEl || contentRef.value);
  14844. const prevEl = vue.unref(prevTriggerTargetEl || contentRef.value);
  14845. if (isElement$1(el)) {
  14846. triggerTargetAriaStopWatch = vue.watch([role, () => props.ariaLabel, ariaModal, () => props.id], (watches) => {
  14847. ["role", "aria-label", "aria-modal", "id"].forEach((key, idx) => {
  14848. isNil(watches[idx]) ? el.removeAttribute(key) : el.setAttribute(key, watches[idx]);
  14849. });
  14850. }, { immediate: true });
  14851. }
  14852. if (prevEl !== el && isElement$1(prevEl)) {
  14853. ["role", "aria-label", "aria-modal", "id"].forEach((key) => {
  14854. prevEl.removeAttribute(key);
  14855. });
  14856. }
  14857. }, { immediate: true });
  14858. vue.watch(() => props.visible, togglePopperAlive, { immediate: true });
  14859. });
  14860. vue.onBeforeUnmount(() => {
  14861. triggerTargetAriaStopWatch == null ? void 0 : triggerTargetAriaStopWatch();
  14862. triggerTargetAriaStopWatch = void 0;
  14863. });
  14864. expose({
  14865. popperContentRef: contentRef,
  14866. popperInstanceRef: instanceRef,
  14867. updatePopper,
  14868. contentStyle
  14869. });
  14870. return (_ctx, _cache) => {
  14871. return vue.openBlock(), vue.createElementBlock("div", vue.mergeProps({
  14872. ref_key: "contentRef",
  14873. ref: contentRef
  14874. }, vue.unref(contentAttrs), {
  14875. style: vue.unref(contentStyle),
  14876. class: vue.unref(contentClass),
  14877. tabindex: "-1",
  14878. onMouseenter: (e) => _ctx.$emit("mouseenter", e),
  14879. onMouseleave: (e) => _ctx.$emit("mouseleave", e)
  14880. }), [
  14881. vue.createVNode(vue.unref(ElFocusTrap), {
  14882. trapped: vue.unref(trapped),
  14883. "trap-on-focus-in": true,
  14884. "focus-trap-el": vue.unref(contentRef),
  14885. "focus-start-el": vue.unref(focusStartRef),
  14886. onFocusAfterTrapped: vue.unref(onFocusAfterTrapped),
  14887. onFocusAfterReleased: vue.unref(onFocusAfterReleased),
  14888. onFocusin: vue.unref(onFocusInTrap),
  14889. onFocusoutPrevented: vue.unref(onFocusoutPrevented),
  14890. onReleaseRequested: vue.unref(onReleaseRequested)
  14891. }, {
  14892. default: vue.withCtx(() => [
  14893. vue.renderSlot(_ctx.$slots, "default")
  14894. ]),
  14895. _: 3
  14896. }, 8, ["trapped", "focus-trap-el", "focus-start-el", "onFocusAfterTrapped", "onFocusAfterReleased", "onFocusin", "onFocusoutPrevented", "onReleaseRequested"])
  14897. ], 16, ["onMouseenter", "onMouseleave"]);
  14898. };
  14899. }
  14900. });
  14901. var ElPopperContent = /* @__PURE__ */ _export_sfc(_sfc_main$2k, [["__file", "content.vue"]]);
  14902. const ElPopper = withInstall(Popper);
  14903. const TOOLTIP_INJECTION_KEY = Symbol("elTooltip");
  14904. const useTooltipContentProps = buildProps({
  14905. ...useDelayedToggleProps,
  14906. ...popperContentProps,
  14907. appendTo: {
  14908. type: definePropType([String, Object])
  14909. },
  14910. content: {
  14911. type: String,
  14912. default: ""
  14913. },
  14914. rawContent: Boolean,
  14915. persistent: Boolean,
  14916. visible: {
  14917. type: definePropType(Boolean),
  14918. default: null
  14919. },
  14920. transition: String,
  14921. teleported: {
  14922. type: Boolean,
  14923. default: true
  14924. },
  14925. disabled: Boolean,
  14926. ...useAriaProps(["ariaLabel"])
  14927. });
  14928. const useTooltipTriggerProps = buildProps({
  14929. ...popperTriggerProps,
  14930. disabled: Boolean,
  14931. trigger: {
  14932. type: definePropType([String, Array]),
  14933. default: "hover"
  14934. },
  14935. triggerKeys: {
  14936. type: definePropType(Array),
  14937. default: () => [EVENT_CODE.enter, EVENT_CODE.numpadEnter, EVENT_CODE.space]
  14938. }
  14939. });
  14940. const {
  14941. useModelToggleProps: useTooltipModelToggleProps,
  14942. useModelToggleEmits: useTooltipModelToggleEmits,
  14943. useModelToggle: useTooltipModelToggle
  14944. } = createModelToggleComposable("visible");
  14945. const useTooltipProps = buildProps({
  14946. ...popperProps,
  14947. ...useTooltipModelToggleProps,
  14948. ...useTooltipContentProps,
  14949. ...useTooltipTriggerProps,
  14950. ...popperArrowProps,
  14951. showArrow: {
  14952. type: Boolean,
  14953. default: true
  14954. }
  14955. });
  14956. const tooltipEmits = [
  14957. ...useTooltipModelToggleEmits,
  14958. "before-show",
  14959. "before-hide",
  14960. "show",
  14961. "hide",
  14962. "open",
  14963. "close"
  14964. ];
  14965. const isTriggerType = (trigger, type) => {
  14966. if (isArray$1(trigger)) {
  14967. return trigger.includes(type);
  14968. }
  14969. return trigger === type;
  14970. };
  14971. const whenTrigger = (trigger, type, handler) => {
  14972. return (e) => {
  14973. isTriggerType(vue.unref(trigger), type) && handler(e);
  14974. };
  14975. };
  14976. const __default__$1G = vue.defineComponent({
  14977. name: "ElTooltipTrigger"
  14978. });
  14979. const _sfc_main$2j = /* @__PURE__ */ vue.defineComponent({
  14980. ...__default__$1G,
  14981. props: useTooltipTriggerProps,
  14982. setup(__props, { expose }) {
  14983. const props = __props;
  14984. const ns = useNamespace("tooltip");
  14985. const { controlled, id, open, onOpen, onClose, onToggle } = vue.inject(TOOLTIP_INJECTION_KEY, void 0);
  14986. const triggerRef = vue.ref(null);
  14987. const stopWhenControlledOrDisabled = () => {
  14988. if (vue.unref(controlled) || props.disabled) {
  14989. return true;
  14990. }
  14991. };
  14992. const trigger = vue.toRef(props, "trigger");
  14993. const onMouseenter = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "hover", onOpen));
  14994. const onMouseleave = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "hover", onClose));
  14995. const onClick = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "click", (e) => {
  14996. if (e.button === 0) {
  14997. onToggle(e);
  14998. }
  14999. }));
  15000. const onFocus = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "focus", onOpen));
  15001. const onBlur = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "focus", onClose));
  15002. const onContextMenu = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "contextmenu", (e) => {
  15003. e.preventDefault();
  15004. onToggle(e);
  15005. }));
  15006. const onKeydown = composeEventHandlers(stopWhenControlledOrDisabled, (e) => {
  15007. const { code } = e;
  15008. if (props.triggerKeys.includes(code)) {
  15009. e.preventDefault();
  15010. onToggle(e);
  15011. }
  15012. });
  15013. expose({
  15014. triggerRef
  15015. });
  15016. return (_ctx, _cache) => {
  15017. return vue.openBlock(), vue.createBlock(vue.unref(ElPopperTrigger), {
  15018. id: vue.unref(id),
  15019. "virtual-ref": _ctx.virtualRef,
  15020. open: vue.unref(open),
  15021. "virtual-triggering": _ctx.virtualTriggering,
  15022. class: vue.normalizeClass(vue.unref(ns).e("trigger")),
  15023. onBlur: vue.unref(onBlur),
  15024. onClick: vue.unref(onClick),
  15025. onContextmenu: vue.unref(onContextMenu),
  15026. onFocus: vue.unref(onFocus),
  15027. onMouseenter: vue.unref(onMouseenter),
  15028. onMouseleave: vue.unref(onMouseleave),
  15029. onKeydown: vue.unref(onKeydown)
  15030. }, {
  15031. default: vue.withCtx(() => [
  15032. vue.renderSlot(_ctx.$slots, "default")
  15033. ]),
  15034. _: 3
  15035. }, 8, ["id", "virtual-ref", "open", "virtual-triggering", "class", "onBlur", "onClick", "onContextmenu", "onFocus", "onMouseenter", "onMouseleave", "onKeydown"]);
  15036. };
  15037. }
  15038. });
  15039. var ElTooltipTrigger = /* @__PURE__ */ _export_sfc(_sfc_main$2j, [["__file", "trigger.vue"]]);
  15040. const teleportProps = buildProps({
  15041. to: {
  15042. type: definePropType([String, Object]),
  15043. required: true
  15044. },
  15045. disabled: Boolean
  15046. });
  15047. const _sfc_main$2i = /* @__PURE__ */ vue.defineComponent({
  15048. __name: "teleport",
  15049. props: teleportProps,
  15050. setup(__props) {
  15051. return (_ctx, _cache) => {
  15052. return _ctx.disabled ? vue.renderSlot(_ctx.$slots, "default", { key: 0 }) : (vue.openBlock(), vue.createBlock(vue.Teleport, {
  15053. key: 1,
  15054. to: _ctx.to
  15055. }, [
  15056. vue.renderSlot(_ctx.$slots, "default")
  15057. ], 8, ["to"]));
  15058. };
  15059. }
  15060. });
  15061. var Teleport = /* @__PURE__ */ _export_sfc(_sfc_main$2i, [["__file", "teleport.vue"]]);
  15062. const ElTeleport = withInstall(Teleport);
  15063. var ElTeleport$1 = ElTeleport;
  15064. const __default__$1F = vue.defineComponent({
  15065. name: "ElTooltipContent",
  15066. inheritAttrs: false
  15067. });
  15068. const _sfc_main$2h = /* @__PURE__ */ vue.defineComponent({
  15069. ...__default__$1F,
  15070. props: useTooltipContentProps,
  15071. setup(__props, { expose }) {
  15072. const props = __props;
  15073. const { selector } = usePopperContainerId();
  15074. const ns = useNamespace("tooltip");
  15075. const contentRef = vue.ref();
  15076. let stopHandle;
  15077. const {
  15078. controlled,
  15079. id,
  15080. open,
  15081. trigger,
  15082. onClose,
  15083. onOpen,
  15084. onShow,
  15085. onHide,
  15086. onBeforeShow,
  15087. onBeforeHide
  15088. } = vue.inject(TOOLTIP_INJECTION_KEY, void 0);
  15089. const transitionClass = vue.computed(() => {
  15090. return props.transition || `${ns.namespace.value}-fade-in-linear`;
  15091. });
  15092. const persistentRef = vue.computed(() => {
  15093. return props.persistent;
  15094. });
  15095. vue.onBeforeUnmount(() => {
  15096. stopHandle == null ? void 0 : stopHandle();
  15097. });
  15098. const shouldRender = vue.computed(() => {
  15099. return vue.unref(persistentRef) ? true : vue.unref(open);
  15100. });
  15101. const shouldShow = vue.computed(() => {
  15102. return props.disabled ? false : vue.unref(open);
  15103. });
  15104. const appendTo = vue.computed(() => {
  15105. return props.appendTo || selector.value;
  15106. });
  15107. const contentStyle = vue.computed(() => {
  15108. var _a;
  15109. return (_a = props.style) != null ? _a : {};
  15110. });
  15111. const ariaHidden = vue.ref(true);
  15112. const onTransitionLeave = () => {
  15113. onHide();
  15114. ariaHidden.value = true;
  15115. };
  15116. const stopWhenControlled = () => {
  15117. if (vue.unref(controlled))
  15118. return true;
  15119. };
  15120. const onContentEnter = composeEventHandlers(stopWhenControlled, () => {
  15121. if (props.enterable && vue.unref(trigger) === "hover") {
  15122. onOpen();
  15123. }
  15124. });
  15125. const onContentLeave = composeEventHandlers(stopWhenControlled, () => {
  15126. if (vue.unref(trigger) === "hover") {
  15127. onClose();
  15128. }
  15129. });
  15130. const onBeforeEnter = () => {
  15131. var _a, _b;
  15132. (_b = (_a = contentRef.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a);
  15133. onBeforeShow == null ? void 0 : onBeforeShow();
  15134. };
  15135. const onBeforeLeave = () => {
  15136. onBeforeHide == null ? void 0 : onBeforeHide();
  15137. };
  15138. const onAfterShow = () => {
  15139. onShow();
  15140. stopHandle = onClickOutside(vue.computed(() => {
  15141. var _a;
  15142. return (_a = contentRef.value) == null ? void 0 : _a.popperContentRef;
  15143. }), () => {
  15144. if (vue.unref(controlled))
  15145. return;
  15146. const $trigger = vue.unref(trigger);
  15147. if ($trigger !== "hover") {
  15148. onClose();
  15149. }
  15150. });
  15151. };
  15152. const onBlur = () => {
  15153. if (!props.virtualTriggering) {
  15154. onClose();
  15155. }
  15156. };
  15157. vue.watch(() => vue.unref(open), (val) => {
  15158. if (!val) {
  15159. stopHandle == null ? void 0 : stopHandle();
  15160. } else {
  15161. ariaHidden.value = false;
  15162. }
  15163. }, {
  15164. flush: "post"
  15165. });
  15166. vue.watch(() => props.content, () => {
  15167. var _a, _b;
  15168. (_b = (_a = contentRef.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a);
  15169. });
  15170. expose({
  15171. contentRef
  15172. });
  15173. return (_ctx, _cache) => {
  15174. return vue.openBlock(), vue.createBlock(vue.unref(ElTeleport$1), {
  15175. disabled: !_ctx.teleported,
  15176. to: vue.unref(appendTo)
  15177. }, {
  15178. default: vue.withCtx(() => [
  15179. vue.createVNode(vue.Transition, {
  15180. name: vue.unref(transitionClass),
  15181. onAfterLeave: onTransitionLeave,
  15182. onBeforeEnter,
  15183. onAfterEnter: onAfterShow,
  15184. onBeforeLeave
  15185. }, {
  15186. default: vue.withCtx(() => [
  15187. vue.unref(shouldRender) ? vue.withDirectives((vue.openBlock(), vue.createBlock(vue.unref(ElPopperContent), vue.mergeProps({
  15188. key: 0,
  15189. id: vue.unref(id),
  15190. ref_key: "contentRef",
  15191. ref: contentRef
  15192. }, _ctx.$attrs, {
  15193. "aria-label": _ctx.ariaLabel,
  15194. "aria-hidden": ariaHidden.value,
  15195. "boundaries-padding": _ctx.boundariesPadding,
  15196. "fallback-placements": _ctx.fallbackPlacements,
  15197. "gpu-acceleration": _ctx.gpuAcceleration,
  15198. offset: _ctx.offset,
  15199. placement: _ctx.placement,
  15200. "popper-options": _ctx.popperOptions,
  15201. strategy: _ctx.strategy,
  15202. effect: _ctx.effect,
  15203. enterable: _ctx.enterable,
  15204. pure: _ctx.pure,
  15205. "popper-class": _ctx.popperClass,
  15206. "popper-style": [_ctx.popperStyle, vue.unref(contentStyle)],
  15207. "reference-el": _ctx.referenceEl,
  15208. "trigger-target-el": _ctx.triggerTargetEl,
  15209. visible: vue.unref(shouldShow),
  15210. "z-index": _ctx.zIndex,
  15211. onMouseenter: vue.unref(onContentEnter),
  15212. onMouseleave: vue.unref(onContentLeave),
  15213. onBlur,
  15214. onClose: vue.unref(onClose)
  15215. }), {
  15216. default: vue.withCtx(() => [
  15217. vue.renderSlot(_ctx.$slots, "default")
  15218. ]),
  15219. _: 3
  15220. }, 16, ["id", "aria-label", "aria-hidden", "boundaries-padding", "fallback-placements", "gpu-acceleration", "offset", "placement", "popper-options", "strategy", "effect", "enterable", "pure", "popper-class", "popper-style", "reference-el", "trigger-target-el", "visible", "z-index", "onMouseenter", "onMouseleave", "onClose"])), [
  15221. [vue.vShow, vue.unref(shouldShow)]
  15222. ]) : vue.createCommentVNode("v-if", true)
  15223. ]),
  15224. _: 3
  15225. }, 8, ["name"])
  15226. ]),
  15227. _: 3
  15228. }, 8, ["disabled", "to"]);
  15229. };
  15230. }
  15231. });
  15232. var ElTooltipContent = /* @__PURE__ */ _export_sfc(_sfc_main$2h, [["__file", "content.vue"]]);
  15233. const __default__$1E = vue.defineComponent({
  15234. name: "ElTooltip"
  15235. });
  15236. const _sfc_main$2g = /* @__PURE__ */ vue.defineComponent({
  15237. ...__default__$1E,
  15238. props: useTooltipProps,
  15239. emits: tooltipEmits,
  15240. setup(__props, { expose, emit }) {
  15241. const props = __props;
  15242. usePopperContainer();
  15243. const id = useId();
  15244. const popperRef = vue.ref();
  15245. const contentRef = vue.ref();
  15246. const updatePopper = () => {
  15247. var _a;
  15248. const popperComponent = vue.unref(popperRef);
  15249. if (popperComponent) {
  15250. (_a = popperComponent.popperInstanceRef) == null ? void 0 : _a.update();
  15251. }
  15252. };
  15253. const open = vue.ref(false);
  15254. const toggleReason = vue.ref();
  15255. const { show, hide, hasUpdateHandler } = useTooltipModelToggle({
  15256. indicator: open,
  15257. toggleReason
  15258. });
  15259. const { onOpen, onClose } = useDelayedToggle({
  15260. showAfter: vue.toRef(props, "showAfter"),
  15261. hideAfter: vue.toRef(props, "hideAfter"),
  15262. autoClose: vue.toRef(props, "autoClose"),
  15263. open: show,
  15264. close: hide
  15265. });
  15266. const controlled = vue.computed(() => isBoolean(props.visible) && !hasUpdateHandler.value);
  15267. vue.provide(TOOLTIP_INJECTION_KEY, {
  15268. controlled,
  15269. id,
  15270. open: vue.readonly(open),
  15271. trigger: vue.toRef(props, "trigger"),
  15272. onOpen: (event) => {
  15273. onOpen(event);
  15274. },
  15275. onClose: (event) => {
  15276. onClose(event);
  15277. },
  15278. onToggle: (event) => {
  15279. if (vue.unref(open)) {
  15280. onClose(event);
  15281. } else {
  15282. onOpen(event);
  15283. }
  15284. },
  15285. onShow: () => {
  15286. emit("show", toggleReason.value);
  15287. },
  15288. onHide: () => {
  15289. emit("hide", toggleReason.value);
  15290. },
  15291. onBeforeShow: () => {
  15292. emit("before-show", toggleReason.value);
  15293. },
  15294. onBeforeHide: () => {
  15295. emit("before-hide", toggleReason.value);
  15296. },
  15297. updatePopper
  15298. });
  15299. vue.watch(() => props.disabled, (disabled) => {
  15300. if (disabled && open.value) {
  15301. open.value = false;
  15302. }
  15303. });
  15304. const isFocusInsideContent = (event) => {
  15305. var _a, _b;
  15306. const popperContent = (_b = (_a = contentRef.value) == null ? void 0 : _a.contentRef) == null ? void 0 : _b.popperContentRef;
  15307. const activeElement = (event == null ? void 0 : event.relatedTarget) || document.activeElement;
  15308. return popperContent && popperContent.contains(activeElement);
  15309. };
  15310. vue.onDeactivated(() => open.value && hide());
  15311. expose({
  15312. popperRef,
  15313. contentRef,
  15314. isFocusInsideContent,
  15315. updatePopper,
  15316. onOpen,
  15317. onClose,
  15318. hide
  15319. });
  15320. return (_ctx, _cache) => {
  15321. return vue.openBlock(), vue.createBlock(vue.unref(ElPopper), {
  15322. ref_key: "popperRef",
  15323. ref: popperRef,
  15324. role: _ctx.role
  15325. }, {
  15326. default: vue.withCtx(() => [
  15327. vue.createVNode(ElTooltipTrigger, {
  15328. disabled: _ctx.disabled,
  15329. trigger: _ctx.trigger,
  15330. "trigger-keys": _ctx.triggerKeys,
  15331. "virtual-ref": _ctx.virtualRef,
  15332. "virtual-triggering": _ctx.virtualTriggering
  15333. }, {
  15334. default: vue.withCtx(() => [
  15335. _ctx.$slots.default ? vue.renderSlot(_ctx.$slots, "default", { key: 0 }) : vue.createCommentVNode("v-if", true)
  15336. ]),
  15337. _: 3
  15338. }, 8, ["disabled", "trigger", "trigger-keys", "virtual-ref", "virtual-triggering"]),
  15339. vue.createVNode(ElTooltipContent, {
  15340. ref_key: "contentRef",
  15341. ref: contentRef,
  15342. "aria-label": _ctx.ariaLabel,
  15343. "boundaries-padding": _ctx.boundariesPadding,
  15344. content: _ctx.content,
  15345. disabled: _ctx.disabled,
  15346. effect: _ctx.effect,
  15347. enterable: _ctx.enterable,
  15348. "fallback-placements": _ctx.fallbackPlacements,
  15349. "hide-after": _ctx.hideAfter,
  15350. "gpu-acceleration": _ctx.gpuAcceleration,
  15351. offset: _ctx.offset,
  15352. persistent: _ctx.persistent,
  15353. "popper-class": _ctx.popperClass,
  15354. "popper-style": _ctx.popperStyle,
  15355. placement: _ctx.placement,
  15356. "popper-options": _ctx.popperOptions,
  15357. pure: _ctx.pure,
  15358. "raw-content": _ctx.rawContent,
  15359. "reference-el": _ctx.referenceEl,
  15360. "trigger-target-el": _ctx.triggerTargetEl,
  15361. "show-after": _ctx.showAfter,
  15362. strategy: _ctx.strategy,
  15363. teleported: _ctx.teleported,
  15364. transition: _ctx.transition,
  15365. "virtual-triggering": _ctx.virtualTriggering,
  15366. "z-index": _ctx.zIndex,
  15367. "append-to": _ctx.appendTo
  15368. }, {
  15369. default: vue.withCtx(() => [
  15370. vue.renderSlot(_ctx.$slots, "content", {}, () => [
  15371. _ctx.rawContent ? (vue.openBlock(), vue.createElementBlock("span", {
  15372. key: 0,
  15373. innerHTML: _ctx.content
  15374. }, null, 8, ["innerHTML"])) : (vue.openBlock(), vue.createElementBlock("span", { key: 1 }, vue.toDisplayString(_ctx.content), 1))
  15375. ]),
  15376. _ctx.showArrow ? (vue.openBlock(), vue.createBlock(vue.unref(ElPopperArrow), {
  15377. key: 0,
  15378. "arrow-offset": _ctx.arrowOffset
  15379. }, null, 8, ["arrow-offset"])) : vue.createCommentVNode("v-if", true)
  15380. ]),
  15381. _: 3
  15382. }, 8, ["aria-label", "boundaries-padding", "content", "disabled", "effect", "enterable", "fallback-placements", "hide-after", "gpu-acceleration", "offset", "persistent", "popper-class", "popper-style", "placement", "popper-options", "pure", "raw-content", "reference-el", "trigger-target-el", "show-after", "strategy", "teleported", "transition", "virtual-triggering", "z-index", "append-to"])
  15383. ]),
  15384. _: 3
  15385. }, 8, ["role"]);
  15386. };
  15387. }
  15388. });
  15389. var Tooltip = /* @__PURE__ */ _export_sfc(_sfc_main$2g, [["__file", "tooltip.vue"]]);
  15390. const ElTooltip = withInstall(Tooltip);
  15391. const autocompleteProps = buildProps({
  15392. valueKey: {
  15393. type: String,
  15394. default: "value"
  15395. },
  15396. modelValue: {
  15397. type: [String, Number],
  15398. default: ""
  15399. },
  15400. debounce: {
  15401. type: Number,
  15402. default: 300
  15403. },
  15404. placement: {
  15405. type: definePropType(String),
  15406. values: [
  15407. "top",
  15408. "top-start",
  15409. "top-end",
  15410. "bottom",
  15411. "bottom-start",
  15412. "bottom-end"
  15413. ],
  15414. default: "bottom-start"
  15415. },
  15416. fetchSuggestions: {
  15417. type: definePropType([Function, Array]),
  15418. default: NOOP
  15419. },
  15420. popperClass: {
  15421. type: String,
  15422. default: ""
  15423. },
  15424. triggerOnFocus: {
  15425. type: Boolean,
  15426. default: true
  15427. },
  15428. selectWhenUnmatched: {
  15429. type: Boolean,
  15430. default: false
  15431. },
  15432. hideLoading: {
  15433. type: Boolean,
  15434. default: false
  15435. },
  15436. teleported: useTooltipContentProps.teleported,
  15437. highlightFirstItem: {
  15438. type: Boolean,
  15439. default: false
  15440. },
  15441. fitInputWidth: {
  15442. type: Boolean,
  15443. default: false
  15444. },
  15445. clearable: {
  15446. type: Boolean,
  15447. default: false
  15448. },
  15449. disabled: {
  15450. type: Boolean,
  15451. default: false
  15452. },
  15453. name: String,
  15454. ...useAriaProps(["ariaLabel"])
  15455. });
  15456. const autocompleteEmits = {
  15457. [UPDATE_MODEL_EVENT]: (value) => isString$1(value),
  15458. [INPUT_EVENT]: (value) => isString$1(value),
  15459. [CHANGE_EVENT]: (value) => isString$1(value),
  15460. focus: (evt) => evt instanceof FocusEvent,
  15461. blur: (evt) => evt instanceof FocusEvent,
  15462. clear: () => true,
  15463. select: (item) => isObject$1(item)
  15464. };
  15465. const COMPONENT_NAME$i = "ElAutocomplete";
  15466. const __default__$1D = vue.defineComponent({
  15467. name: COMPONENT_NAME$i,
  15468. inheritAttrs: false
  15469. });
  15470. const _sfc_main$2f = /* @__PURE__ */ vue.defineComponent({
  15471. ...__default__$1D,
  15472. props: autocompleteProps,
  15473. emits: autocompleteEmits,
  15474. setup(__props, { expose, emit }) {
  15475. const props = __props;
  15476. const attrs = useAttrs();
  15477. const rawAttrs = vue.useAttrs();
  15478. const disabled = useFormDisabled();
  15479. const ns = useNamespace("autocomplete");
  15480. const inputRef = vue.ref();
  15481. const regionRef = vue.ref();
  15482. const popperRef = vue.ref();
  15483. const listboxRef = vue.ref();
  15484. let readonly = false;
  15485. let ignoreFocusEvent = false;
  15486. const suggestions = vue.ref([]);
  15487. const highlightedIndex = vue.ref(-1);
  15488. const dropdownWidth = vue.ref("");
  15489. const activated = vue.ref(false);
  15490. const suggestionDisabled = vue.ref(false);
  15491. const loading = vue.ref(false);
  15492. const listboxId = useId();
  15493. const styles = vue.computed(() => rawAttrs.style);
  15494. const suggestionVisible = vue.computed(() => {
  15495. const isValidData = suggestions.value.length > 0;
  15496. return (isValidData || loading.value) && activated.value;
  15497. });
  15498. const suggestionLoading = vue.computed(() => !props.hideLoading && loading.value);
  15499. const refInput = vue.computed(() => {
  15500. if (inputRef.value) {
  15501. return Array.from(inputRef.value.$el.querySelectorAll("input"));
  15502. }
  15503. return [];
  15504. });
  15505. const onSuggestionShow = () => {
  15506. if (suggestionVisible.value) {
  15507. dropdownWidth.value = `${inputRef.value.$el.offsetWidth}px`;
  15508. }
  15509. };
  15510. const onHide = () => {
  15511. highlightedIndex.value = -1;
  15512. };
  15513. const getData = async (queryString) => {
  15514. if (suggestionDisabled.value)
  15515. return;
  15516. const cb = (suggestionList) => {
  15517. loading.value = false;
  15518. if (suggestionDisabled.value)
  15519. return;
  15520. if (isArray$1(suggestionList)) {
  15521. suggestions.value = suggestionList;
  15522. highlightedIndex.value = props.highlightFirstItem ? 0 : -1;
  15523. } else {
  15524. throwError(COMPONENT_NAME$i, "autocomplete suggestions must be an array");
  15525. }
  15526. };
  15527. loading.value = true;
  15528. if (isArray$1(props.fetchSuggestions)) {
  15529. cb(props.fetchSuggestions);
  15530. } else {
  15531. const result = await props.fetchSuggestions(queryString, cb);
  15532. if (isArray$1(result))
  15533. cb(result);
  15534. }
  15535. };
  15536. const debouncedGetData = debounce(getData, props.debounce);
  15537. const handleInput = (value) => {
  15538. const valuePresented = !!value;
  15539. emit(INPUT_EVENT, value);
  15540. emit(UPDATE_MODEL_EVENT, value);
  15541. suggestionDisabled.value = false;
  15542. activated.value || (activated.value = valuePresented);
  15543. if (!props.triggerOnFocus && !value) {
  15544. suggestionDisabled.value = true;
  15545. suggestions.value = [];
  15546. return;
  15547. }
  15548. debouncedGetData(value);
  15549. };
  15550. const handleMouseDown = (event) => {
  15551. var _a;
  15552. if (disabled.value)
  15553. return;
  15554. if (((_a = event.target) == null ? void 0 : _a.tagName) !== "INPUT" || refInput.value.includes(document.activeElement)) {
  15555. activated.value = true;
  15556. }
  15557. };
  15558. const handleChange = (value) => {
  15559. emit(CHANGE_EVENT, value);
  15560. };
  15561. const handleFocus = (evt) => {
  15562. if (!ignoreFocusEvent) {
  15563. activated.value = true;
  15564. emit("focus", evt);
  15565. if (props.triggerOnFocus && !readonly) {
  15566. debouncedGetData(String(props.modelValue));
  15567. }
  15568. } else {
  15569. ignoreFocusEvent = false;
  15570. }
  15571. };
  15572. const handleBlur = (evt) => {
  15573. setTimeout(() => {
  15574. var _a;
  15575. if ((_a = popperRef.value) == null ? void 0 : _a.isFocusInsideContent()) {
  15576. ignoreFocusEvent = true;
  15577. return;
  15578. }
  15579. activated.value && close();
  15580. emit("blur", evt);
  15581. });
  15582. };
  15583. const handleClear = () => {
  15584. activated.value = false;
  15585. emit(UPDATE_MODEL_EVENT, "");
  15586. emit("clear");
  15587. };
  15588. const handleKeyEnter = async () => {
  15589. if (suggestionVisible.value && highlightedIndex.value >= 0 && highlightedIndex.value < suggestions.value.length) {
  15590. handleSelect(suggestions.value[highlightedIndex.value]);
  15591. } else if (props.selectWhenUnmatched) {
  15592. emit("select", { value: props.modelValue });
  15593. suggestions.value = [];
  15594. highlightedIndex.value = -1;
  15595. }
  15596. };
  15597. const handleKeyEscape = (evt) => {
  15598. if (suggestionVisible.value) {
  15599. evt.preventDefault();
  15600. evt.stopPropagation();
  15601. close();
  15602. }
  15603. };
  15604. const close = () => {
  15605. activated.value = false;
  15606. };
  15607. const focus = () => {
  15608. var _a;
  15609. (_a = inputRef.value) == null ? void 0 : _a.focus();
  15610. };
  15611. const blur = () => {
  15612. var _a;
  15613. (_a = inputRef.value) == null ? void 0 : _a.blur();
  15614. };
  15615. const handleSelect = async (item) => {
  15616. emit(INPUT_EVENT, item[props.valueKey]);
  15617. emit(UPDATE_MODEL_EVENT, item[props.valueKey]);
  15618. emit("select", item);
  15619. suggestions.value = [];
  15620. highlightedIndex.value = -1;
  15621. };
  15622. const highlight = (index) => {
  15623. if (!suggestionVisible.value || loading.value)
  15624. return;
  15625. if (index < 0) {
  15626. highlightedIndex.value = -1;
  15627. return;
  15628. }
  15629. if (index >= suggestions.value.length) {
  15630. index = suggestions.value.length - 1;
  15631. }
  15632. const suggestion = regionRef.value.querySelector(`.${ns.be("suggestion", "wrap")}`);
  15633. const suggestionList = suggestion.querySelectorAll(`.${ns.be("suggestion", "list")} li`);
  15634. const highlightItem = suggestionList[index];
  15635. const scrollTop = suggestion.scrollTop;
  15636. const { offsetTop, scrollHeight } = highlightItem;
  15637. if (offsetTop + scrollHeight > scrollTop + suggestion.clientHeight) {
  15638. suggestion.scrollTop += scrollHeight;
  15639. }
  15640. if (offsetTop < scrollTop) {
  15641. suggestion.scrollTop -= scrollHeight;
  15642. }
  15643. highlightedIndex.value = index;
  15644. inputRef.value.ref.setAttribute("aria-activedescendant", `${listboxId.value}-item-${highlightedIndex.value}`);
  15645. };
  15646. const stopHandle = onClickOutside(listboxRef, () => {
  15647. suggestionVisible.value && close();
  15648. });
  15649. vue.onBeforeUnmount(() => {
  15650. stopHandle == null ? void 0 : stopHandle();
  15651. });
  15652. vue.onMounted(() => {
  15653. inputRef.value.ref.setAttribute("role", "textbox");
  15654. inputRef.value.ref.setAttribute("aria-autocomplete", "list");
  15655. inputRef.value.ref.setAttribute("aria-controls", "id");
  15656. inputRef.value.ref.setAttribute("aria-activedescendant", `${listboxId.value}-item-${highlightedIndex.value}`);
  15657. readonly = inputRef.value.ref.hasAttribute("readonly");
  15658. });
  15659. expose({
  15660. highlightedIndex,
  15661. activated,
  15662. loading,
  15663. inputRef,
  15664. popperRef,
  15665. suggestions,
  15666. handleSelect,
  15667. handleKeyEnter,
  15668. focus,
  15669. blur,
  15670. close,
  15671. highlight,
  15672. getData
  15673. });
  15674. return (_ctx, _cache) => {
  15675. return vue.openBlock(), vue.createBlock(vue.unref(ElTooltip), {
  15676. ref_key: "popperRef",
  15677. ref: popperRef,
  15678. visible: vue.unref(suggestionVisible),
  15679. placement: _ctx.placement,
  15680. "fallback-placements": ["bottom-start", "top-start"],
  15681. "popper-class": [vue.unref(ns).e("popper"), _ctx.popperClass],
  15682. teleported: _ctx.teleported,
  15683. "gpu-acceleration": false,
  15684. pure: "",
  15685. "manual-mode": "",
  15686. effect: "light",
  15687. trigger: "click",
  15688. transition: `${vue.unref(ns).namespace.value}-zoom-in-top`,
  15689. persistent: "",
  15690. role: "listbox",
  15691. onBeforeShow: onSuggestionShow,
  15692. onHide
  15693. }, {
  15694. content: vue.withCtx(() => [
  15695. vue.createElementVNode("div", {
  15696. ref_key: "regionRef",
  15697. ref: regionRef,
  15698. class: vue.normalizeClass([vue.unref(ns).b("suggestion"), vue.unref(ns).is("loading", vue.unref(suggestionLoading))]),
  15699. style: vue.normalizeStyle({
  15700. [_ctx.fitInputWidth ? "width" : "minWidth"]: dropdownWidth.value,
  15701. outline: "none"
  15702. }),
  15703. role: "region"
  15704. }, [
  15705. vue.createVNode(vue.unref(ElScrollbar), {
  15706. id: vue.unref(listboxId),
  15707. tag: "ul",
  15708. "wrap-class": vue.unref(ns).be("suggestion", "wrap"),
  15709. "view-class": vue.unref(ns).be("suggestion", "list"),
  15710. role: "listbox"
  15711. }, {
  15712. default: vue.withCtx(() => [
  15713. vue.unref(suggestionLoading) ? (vue.openBlock(), vue.createElementBlock("li", { key: 0 }, [
  15714. vue.renderSlot(_ctx.$slots, "loading", {}, () => [
  15715. vue.createVNode(vue.unref(ElIcon), {
  15716. class: vue.normalizeClass(vue.unref(ns).is("loading"))
  15717. }, {
  15718. default: vue.withCtx(() => [
  15719. vue.createVNode(vue.unref(loading_default))
  15720. ]),
  15721. _: 1
  15722. }, 8, ["class"])
  15723. ])
  15724. ])) : (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 1 }, vue.renderList(suggestions.value, (item, index) => {
  15725. return vue.openBlock(), vue.createElementBlock("li", {
  15726. id: `${vue.unref(listboxId)}-item-${index}`,
  15727. key: index,
  15728. class: vue.normalizeClass({ highlighted: highlightedIndex.value === index }),
  15729. role: "option",
  15730. "aria-selected": highlightedIndex.value === index,
  15731. onClick: ($event) => handleSelect(item)
  15732. }, [
  15733. vue.renderSlot(_ctx.$slots, "default", { item }, () => [
  15734. vue.createTextVNode(vue.toDisplayString(item[_ctx.valueKey]), 1)
  15735. ])
  15736. ], 10, ["id", "aria-selected", "onClick"]);
  15737. }), 128))
  15738. ]),
  15739. _: 3
  15740. }, 8, ["id", "wrap-class", "view-class"])
  15741. ], 6)
  15742. ]),
  15743. default: vue.withCtx(() => [
  15744. vue.createElementVNode("div", {
  15745. ref_key: "listboxRef",
  15746. ref: listboxRef,
  15747. class: vue.normalizeClass([vue.unref(ns).b(), _ctx.$attrs.class]),
  15748. style: vue.normalizeStyle(vue.unref(styles)),
  15749. role: "combobox",
  15750. "aria-haspopup": "listbox",
  15751. "aria-expanded": vue.unref(suggestionVisible),
  15752. "aria-owns": vue.unref(listboxId)
  15753. }, [
  15754. vue.createVNode(vue.unref(ElInput), vue.mergeProps({
  15755. ref_key: "inputRef",
  15756. ref: inputRef
  15757. }, vue.unref(attrs), {
  15758. clearable: _ctx.clearable,
  15759. disabled: vue.unref(disabled),
  15760. name: _ctx.name,
  15761. "model-value": _ctx.modelValue,
  15762. "aria-label": _ctx.ariaLabel,
  15763. onInput: handleInput,
  15764. onChange: handleChange,
  15765. onFocus: handleFocus,
  15766. onBlur: handleBlur,
  15767. onClear: handleClear,
  15768. onKeydown: [
  15769. vue.withKeys(vue.withModifiers(($event) => highlight(highlightedIndex.value - 1), ["prevent"]), ["up"]),
  15770. vue.withKeys(vue.withModifiers(($event) => highlight(highlightedIndex.value + 1), ["prevent"]), ["down"]),
  15771. vue.withKeys(handleKeyEnter, ["enter"]),
  15772. vue.withKeys(close, ["tab"]),
  15773. vue.withKeys(handleKeyEscape, ["esc"])
  15774. ],
  15775. onMousedown: handleMouseDown
  15776. }), vue.createSlots({
  15777. _: 2
  15778. }, [
  15779. _ctx.$slots.prepend ? {
  15780. name: "prepend",
  15781. fn: vue.withCtx(() => [
  15782. vue.renderSlot(_ctx.$slots, "prepend")
  15783. ])
  15784. } : void 0,
  15785. _ctx.$slots.append ? {
  15786. name: "append",
  15787. fn: vue.withCtx(() => [
  15788. vue.renderSlot(_ctx.$slots, "append")
  15789. ])
  15790. } : void 0,
  15791. _ctx.$slots.prefix ? {
  15792. name: "prefix",
  15793. fn: vue.withCtx(() => [
  15794. vue.renderSlot(_ctx.$slots, "prefix")
  15795. ])
  15796. } : void 0,
  15797. _ctx.$slots.suffix ? {
  15798. name: "suffix",
  15799. fn: vue.withCtx(() => [
  15800. vue.renderSlot(_ctx.$slots, "suffix")
  15801. ])
  15802. } : void 0
  15803. ]), 1040, ["clearable", "disabled", "name", "model-value", "aria-label", "onKeydown"])
  15804. ], 14, ["aria-expanded", "aria-owns"])
  15805. ]),
  15806. _: 3
  15807. }, 8, ["visible", "placement", "popper-class", "teleported", "transition"]);
  15808. };
  15809. }
  15810. });
  15811. var Autocomplete = /* @__PURE__ */ _export_sfc(_sfc_main$2f, [["__file", "autocomplete.vue"]]);
  15812. const ElAutocomplete = withInstall(Autocomplete);
  15813. const avatarProps = buildProps({
  15814. size: {
  15815. type: [Number, String],
  15816. values: componentSizes,
  15817. default: "",
  15818. validator: (val) => isNumber(val)
  15819. },
  15820. shape: {
  15821. type: String,
  15822. values: ["circle", "square"],
  15823. default: "circle"
  15824. },
  15825. icon: {
  15826. type: iconPropType
  15827. },
  15828. src: {
  15829. type: String,
  15830. default: ""
  15831. },
  15832. alt: String,
  15833. srcSet: String,
  15834. fit: {
  15835. type: definePropType(String),
  15836. default: "cover"
  15837. }
  15838. });
  15839. const avatarEmits = {
  15840. error: (evt) => evt instanceof Event
  15841. };
  15842. const __default__$1C = vue.defineComponent({
  15843. name: "ElAvatar"
  15844. });
  15845. const _sfc_main$2e = /* @__PURE__ */ vue.defineComponent({
  15846. ...__default__$1C,
  15847. props: avatarProps,
  15848. emits: avatarEmits,
  15849. setup(__props, { emit }) {
  15850. const props = __props;
  15851. const ns = useNamespace("avatar");
  15852. const hasLoadError = vue.ref(false);
  15853. const avatarClass = vue.computed(() => {
  15854. const { size, icon, shape } = props;
  15855. const classList = [ns.b()];
  15856. if (isString$1(size))
  15857. classList.push(ns.m(size));
  15858. if (icon)
  15859. classList.push(ns.m("icon"));
  15860. if (shape)
  15861. classList.push(ns.m(shape));
  15862. return classList;
  15863. });
  15864. const sizeStyle = vue.computed(() => {
  15865. const { size } = props;
  15866. return isNumber(size) ? ns.cssVarBlock({
  15867. size: addUnit(size) || ""
  15868. }) : void 0;
  15869. });
  15870. const fitStyle = vue.computed(() => ({
  15871. objectFit: props.fit
  15872. }));
  15873. vue.watch(() => props.src, () => hasLoadError.value = false);
  15874. function handleError(e) {
  15875. hasLoadError.value = true;
  15876. emit("error", e);
  15877. }
  15878. return (_ctx, _cache) => {
  15879. return vue.openBlock(), vue.createElementBlock("span", {
  15880. class: vue.normalizeClass(vue.unref(avatarClass)),
  15881. style: vue.normalizeStyle(vue.unref(sizeStyle))
  15882. }, [
  15883. (_ctx.src || _ctx.srcSet) && !hasLoadError.value ? (vue.openBlock(), vue.createElementBlock("img", {
  15884. key: 0,
  15885. src: _ctx.src,
  15886. alt: _ctx.alt,
  15887. srcset: _ctx.srcSet,
  15888. style: vue.normalizeStyle(vue.unref(fitStyle)),
  15889. onError: handleError
  15890. }, null, 44, ["src", "alt", "srcset"])) : _ctx.icon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 1 }, {
  15891. default: vue.withCtx(() => [
  15892. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.icon)))
  15893. ]),
  15894. _: 1
  15895. })) : vue.renderSlot(_ctx.$slots, "default", { key: 2 })
  15896. ], 6);
  15897. };
  15898. }
  15899. });
  15900. var Avatar = /* @__PURE__ */ _export_sfc(_sfc_main$2e, [["__file", "avatar.vue"]]);
  15901. const ElAvatar = withInstall(Avatar);
  15902. const backtopProps = {
  15903. visibilityHeight: {
  15904. type: Number,
  15905. default: 200
  15906. },
  15907. target: {
  15908. type: String,
  15909. default: ""
  15910. },
  15911. right: {
  15912. type: Number,
  15913. default: 40
  15914. },
  15915. bottom: {
  15916. type: Number,
  15917. default: 40
  15918. }
  15919. };
  15920. const backtopEmits = {
  15921. click: (evt) => evt instanceof MouseEvent
  15922. };
  15923. const useBackTop = (props, emit, componentName) => {
  15924. const el = vue.shallowRef();
  15925. const container = vue.shallowRef();
  15926. const visible = vue.ref(false);
  15927. const handleScroll = () => {
  15928. if (el.value)
  15929. visible.value = el.value.scrollTop >= props.visibilityHeight;
  15930. };
  15931. const handleClick = (event) => {
  15932. var _a;
  15933. (_a = el.value) == null ? void 0 : _a.scrollTo({ top: 0, behavior: "smooth" });
  15934. emit("click", event);
  15935. };
  15936. const handleScrollThrottled = useThrottleFn(handleScroll, 300, true);
  15937. useEventListener(container, "scroll", handleScrollThrottled);
  15938. vue.onMounted(() => {
  15939. var _a;
  15940. container.value = document;
  15941. el.value = document.documentElement;
  15942. if (props.target) {
  15943. el.value = (_a = document.querySelector(props.target)) != null ? _a : void 0;
  15944. if (!el.value) {
  15945. throwError(componentName, `target does not exist: ${props.target}`);
  15946. }
  15947. container.value = el.value;
  15948. }
  15949. handleScroll();
  15950. });
  15951. return {
  15952. visible,
  15953. handleClick
  15954. };
  15955. };
  15956. const COMPONENT_NAME$h = "ElBacktop";
  15957. const __default__$1B = vue.defineComponent({
  15958. name: COMPONENT_NAME$h
  15959. });
  15960. const _sfc_main$2d = /* @__PURE__ */ vue.defineComponent({
  15961. ...__default__$1B,
  15962. props: backtopProps,
  15963. emits: backtopEmits,
  15964. setup(__props, { emit }) {
  15965. const props = __props;
  15966. const ns = useNamespace("backtop");
  15967. const { handleClick, visible } = useBackTop(props, emit, COMPONENT_NAME$h);
  15968. const backTopStyle = vue.computed(() => ({
  15969. right: `${props.right}px`,
  15970. bottom: `${props.bottom}px`
  15971. }));
  15972. return (_ctx, _cache) => {
  15973. return vue.openBlock(), vue.createBlock(vue.Transition, {
  15974. name: `${vue.unref(ns).namespace.value}-fade-in`
  15975. }, {
  15976. default: vue.withCtx(() => [
  15977. vue.unref(visible) ? (vue.openBlock(), vue.createElementBlock("div", {
  15978. key: 0,
  15979. style: vue.normalizeStyle(vue.unref(backTopStyle)),
  15980. class: vue.normalizeClass(vue.unref(ns).b()),
  15981. onClick: vue.withModifiers(vue.unref(handleClick), ["stop"])
  15982. }, [
  15983. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  15984. vue.createVNode(vue.unref(ElIcon), {
  15985. class: vue.normalizeClass(vue.unref(ns).e("icon"))
  15986. }, {
  15987. default: vue.withCtx(() => [
  15988. vue.createVNode(vue.unref(caret_top_default))
  15989. ]),
  15990. _: 1
  15991. }, 8, ["class"])
  15992. ])
  15993. ], 14, ["onClick"])) : vue.createCommentVNode("v-if", true)
  15994. ]),
  15995. _: 3
  15996. }, 8, ["name"]);
  15997. };
  15998. }
  15999. });
  16000. var Backtop = /* @__PURE__ */ _export_sfc(_sfc_main$2d, [["__file", "backtop.vue"]]);
  16001. const ElBacktop = withInstall(Backtop);
  16002. const badgeProps = buildProps({
  16003. value: {
  16004. type: [String, Number],
  16005. default: ""
  16006. },
  16007. max: {
  16008. type: Number,
  16009. default: 99
  16010. },
  16011. isDot: Boolean,
  16012. hidden: Boolean,
  16013. type: {
  16014. type: String,
  16015. values: ["primary", "success", "warning", "info", "danger"],
  16016. default: "danger"
  16017. },
  16018. showZero: {
  16019. type: Boolean,
  16020. default: true
  16021. },
  16022. color: String,
  16023. badgeStyle: {
  16024. type: definePropType([String, Object, Array])
  16025. },
  16026. offset: {
  16027. type: definePropType(Array),
  16028. default: [0, 0]
  16029. },
  16030. badgeClass: {
  16031. type: String
  16032. }
  16033. });
  16034. const __default__$1A = vue.defineComponent({
  16035. name: "ElBadge"
  16036. });
  16037. const _sfc_main$2c = /* @__PURE__ */ vue.defineComponent({
  16038. ...__default__$1A,
  16039. props: badgeProps,
  16040. setup(__props, { expose }) {
  16041. const props = __props;
  16042. const ns = useNamespace("badge");
  16043. const content = vue.computed(() => {
  16044. if (props.isDot)
  16045. return "";
  16046. if (isNumber(props.value) && isNumber(props.max)) {
  16047. return props.max < props.value ? `${props.max}+` : `${props.value}`;
  16048. }
  16049. return `${props.value}`;
  16050. });
  16051. const style = vue.computed(() => {
  16052. var _a, _b, _c, _d, _e;
  16053. return [
  16054. {
  16055. backgroundColor: props.color,
  16056. marginRight: addUnit(-((_b = (_a = props.offset) == null ? void 0 : _a[0]) != null ? _b : 0)),
  16057. marginTop: addUnit((_d = (_c = props.offset) == null ? void 0 : _c[1]) != null ? _d : 0)
  16058. },
  16059. (_e = props.badgeStyle) != null ? _e : {}
  16060. ];
  16061. });
  16062. expose({
  16063. content
  16064. });
  16065. return (_ctx, _cache) => {
  16066. return vue.openBlock(), vue.createElementBlock("div", {
  16067. class: vue.normalizeClass(vue.unref(ns).b())
  16068. }, [
  16069. vue.renderSlot(_ctx.$slots, "default"),
  16070. vue.createVNode(vue.Transition, {
  16071. name: `${vue.unref(ns).namespace.value}-zoom-in-center`,
  16072. persisted: ""
  16073. }, {
  16074. default: vue.withCtx(() => [
  16075. vue.withDirectives(vue.createElementVNode("sup", {
  16076. class: vue.normalizeClass([
  16077. vue.unref(ns).e("content"),
  16078. vue.unref(ns).em("content", _ctx.type),
  16079. vue.unref(ns).is("fixed", !!_ctx.$slots.default),
  16080. vue.unref(ns).is("dot", _ctx.isDot),
  16081. vue.unref(ns).is("hide-zero", !_ctx.showZero && props.value === 0),
  16082. _ctx.badgeClass
  16083. ]),
  16084. style: vue.normalizeStyle(vue.unref(style))
  16085. }, [
  16086. vue.renderSlot(_ctx.$slots, "content", { value: vue.unref(content) }, () => [
  16087. vue.createTextVNode(vue.toDisplayString(vue.unref(content)), 1)
  16088. ])
  16089. ], 6), [
  16090. [vue.vShow, !_ctx.hidden && (vue.unref(content) || _ctx.isDot || _ctx.$slots.content)]
  16091. ])
  16092. ]),
  16093. _: 3
  16094. }, 8, ["name"])
  16095. ], 2);
  16096. };
  16097. }
  16098. });
  16099. var Badge = /* @__PURE__ */ _export_sfc(_sfc_main$2c, [["__file", "badge.vue"]]);
  16100. const ElBadge = withInstall(Badge);
  16101. const breadcrumbKey = Symbol("breadcrumbKey");
  16102. const breadcrumbProps = buildProps({
  16103. separator: {
  16104. type: String,
  16105. default: "/"
  16106. },
  16107. separatorIcon: {
  16108. type: iconPropType
  16109. }
  16110. });
  16111. const __default__$1z = vue.defineComponent({
  16112. name: "ElBreadcrumb"
  16113. });
  16114. const _sfc_main$2b = /* @__PURE__ */ vue.defineComponent({
  16115. ...__default__$1z,
  16116. props: breadcrumbProps,
  16117. setup(__props) {
  16118. const props = __props;
  16119. const { t } = useLocale();
  16120. const ns = useNamespace("breadcrumb");
  16121. const breadcrumb = vue.ref();
  16122. vue.provide(breadcrumbKey, props);
  16123. vue.onMounted(() => {
  16124. const items = breadcrumb.value.querySelectorAll(`.${ns.e("item")}`);
  16125. if (items.length) {
  16126. items[items.length - 1].setAttribute("aria-current", "page");
  16127. }
  16128. });
  16129. return (_ctx, _cache) => {
  16130. return vue.openBlock(), vue.createElementBlock("div", {
  16131. ref_key: "breadcrumb",
  16132. ref: breadcrumb,
  16133. class: vue.normalizeClass(vue.unref(ns).b()),
  16134. "aria-label": vue.unref(t)("el.breadcrumb.label"),
  16135. role: "navigation"
  16136. }, [
  16137. vue.renderSlot(_ctx.$slots, "default")
  16138. ], 10, ["aria-label"]);
  16139. };
  16140. }
  16141. });
  16142. var Breadcrumb = /* @__PURE__ */ _export_sfc(_sfc_main$2b, [["__file", "breadcrumb.vue"]]);
  16143. const breadcrumbItemProps = buildProps({
  16144. to: {
  16145. type: definePropType([String, Object]),
  16146. default: ""
  16147. },
  16148. replace: Boolean
  16149. });
  16150. const __default__$1y = vue.defineComponent({
  16151. name: "ElBreadcrumbItem"
  16152. });
  16153. const _sfc_main$2a = /* @__PURE__ */ vue.defineComponent({
  16154. ...__default__$1y,
  16155. props: breadcrumbItemProps,
  16156. setup(__props) {
  16157. const props = __props;
  16158. const instance = vue.getCurrentInstance();
  16159. const breadcrumbContext = vue.inject(breadcrumbKey, void 0);
  16160. const ns = useNamespace("breadcrumb");
  16161. const router = instance.appContext.config.globalProperties.$router;
  16162. const link = vue.ref();
  16163. const onClick = () => {
  16164. if (!props.to || !router)
  16165. return;
  16166. props.replace ? router.replace(props.to) : router.push(props.to);
  16167. };
  16168. return (_ctx, _cache) => {
  16169. var _a, _b;
  16170. return vue.openBlock(), vue.createElementBlock("span", {
  16171. class: vue.normalizeClass(vue.unref(ns).e("item"))
  16172. }, [
  16173. vue.createElementVNode("span", {
  16174. ref_key: "link",
  16175. ref: link,
  16176. class: vue.normalizeClass([vue.unref(ns).e("inner"), vue.unref(ns).is("link", !!_ctx.to)]),
  16177. role: "link",
  16178. onClick
  16179. }, [
  16180. vue.renderSlot(_ctx.$slots, "default")
  16181. ], 2),
  16182. ((_a = vue.unref(breadcrumbContext)) == null ? void 0 : _a.separatorIcon) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  16183. key: 0,
  16184. class: vue.normalizeClass(vue.unref(ns).e("separator"))
  16185. }, {
  16186. default: vue.withCtx(() => [
  16187. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(breadcrumbContext).separatorIcon)))
  16188. ]),
  16189. _: 1
  16190. }, 8, ["class"])) : (vue.openBlock(), vue.createElementBlock("span", {
  16191. key: 1,
  16192. class: vue.normalizeClass(vue.unref(ns).e("separator")),
  16193. role: "presentation"
  16194. }, vue.toDisplayString((_b = vue.unref(breadcrumbContext)) == null ? void 0 : _b.separator), 3))
  16195. ], 2);
  16196. };
  16197. }
  16198. });
  16199. var BreadcrumbItem = /* @__PURE__ */ _export_sfc(_sfc_main$2a, [["__file", "breadcrumb-item.vue"]]);
  16200. const ElBreadcrumb = withInstall(Breadcrumb, {
  16201. BreadcrumbItem
  16202. });
  16203. const ElBreadcrumbItem = withNoopInstall(BreadcrumbItem);
  16204. const buttonGroupContextKey = Symbol("buttonGroupContextKey");
  16205. const useButton = (props, emit) => {
  16206. useDeprecated({
  16207. from: "type.text",
  16208. replacement: "link",
  16209. version: "3.0.0",
  16210. scope: "props",
  16211. ref: "https://element-plus.org/en-US/component/button.html#button-attributes"
  16212. }, vue.computed(() => props.type === "text"));
  16213. const buttonGroupContext = vue.inject(buttonGroupContextKey, void 0);
  16214. const globalConfig = useGlobalConfig("button");
  16215. const { form } = useFormItem();
  16216. const _size = useFormSize(vue.computed(() => buttonGroupContext == null ? void 0 : buttonGroupContext.size));
  16217. const _disabled = useFormDisabled();
  16218. const _ref = vue.ref();
  16219. const slots = vue.useSlots();
  16220. const _type = vue.computed(() => props.type || (buttonGroupContext == null ? void 0 : buttonGroupContext.type) || "");
  16221. const autoInsertSpace = vue.computed(() => {
  16222. var _a, _b, _c;
  16223. return (_c = (_b = props.autoInsertSpace) != null ? _b : (_a = globalConfig.value) == null ? void 0 : _a.autoInsertSpace) != null ? _c : false;
  16224. });
  16225. const _props = vue.computed(() => {
  16226. if (props.tag === "button") {
  16227. return {
  16228. ariaDisabled: _disabled.value || props.loading,
  16229. disabled: _disabled.value || props.loading,
  16230. autofocus: props.autofocus,
  16231. type: props.nativeType
  16232. };
  16233. }
  16234. return {};
  16235. });
  16236. const shouldAddSpace = vue.computed(() => {
  16237. var _a;
  16238. const defaultSlot = (_a = slots.default) == null ? void 0 : _a.call(slots);
  16239. if (autoInsertSpace.value && (defaultSlot == null ? void 0 : defaultSlot.length) === 1) {
  16240. const slot = defaultSlot[0];
  16241. if ((slot == null ? void 0 : slot.type) === vue.Text) {
  16242. const text = slot.children;
  16243. return /^\p{Unified_Ideograph}{2}$/u.test(text.trim());
  16244. }
  16245. }
  16246. return false;
  16247. });
  16248. const handleClick = (evt) => {
  16249. if (_disabled.value || props.loading) {
  16250. evt.stopPropagation();
  16251. return;
  16252. }
  16253. if (props.nativeType === "reset") {
  16254. form == null ? void 0 : form.resetFields();
  16255. }
  16256. emit("click", evt);
  16257. };
  16258. return {
  16259. _disabled,
  16260. _size,
  16261. _type,
  16262. _ref,
  16263. _props,
  16264. shouldAddSpace,
  16265. handleClick
  16266. };
  16267. };
  16268. const buttonTypes = [
  16269. "default",
  16270. "primary",
  16271. "success",
  16272. "warning",
  16273. "info",
  16274. "danger",
  16275. "text",
  16276. ""
  16277. ];
  16278. const buttonNativeTypes = ["button", "submit", "reset"];
  16279. const buttonProps = buildProps({
  16280. size: useSizeProp,
  16281. disabled: Boolean,
  16282. type: {
  16283. type: String,
  16284. values: buttonTypes,
  16285. default: ""
  16286. },
  16287. icon: {
  16288. type: iconPropType
  16289. },
  16290. nativeType: {
  16291. type: String,
  16292. values: buttonNativeTypes,
  16293. default: "button"
  16294. },
  16295. loading: Boolean,
  16296. loadingIcon: {
  16297. type: iconPropType,
  16298. default: () => loading_default
  16299. },
  16300. plain: Boolean,
  16301. text: Boolean,
  16302. link: Boolean,
  16303. bg: Boolean,
  16304. autofocus: Boolean,
  16305. round: Boolean,
  16306. circle: Boolean,
  16307. color: String,
  16308. dark: Boolean,
  16309. autoInsertSpace: {
  16310. type: Boolean,
  16311. default: void 0
  16312. },
  16313. tag: {
  16314. type: definePropType([String, Object]),
  16315. default: "button"
  16316. }
  16317. });
  16318. const buttonEmits = {
  16319. click: (evt) => evt instanceof MouseEvent
  16320. };
  16321. function bound01$1(n, max) {
  16322. if (isOnePointZero$1(n)) {
  16323. n = "100%";
  16324. }
  16325. var isPercent = isPercentage$1(n);
  16326. n = max === 360 ? n : Math.min(max, Math.max(0, parseFloat(n)));
  16327. if (isPercent) {
  16328. n = parseInt(String(n * max), 10) / 100;
  16329. }
  16330. if (Math.abs(n - max) < 1e-6) {
  16331. return 1;
  16332. }
  16333. if (max === 360) {
  16334. n = (n < 0 ? n % max + max : n % max) / parseFloat(String(max));
  16335. } else {
  16336. n = n % max / parseFloat(String(max));
  16337. }
  16338. return n;
  16339. }
  16340. function clamp01(val) {
  16341. return Math.min(1, Math.max(0, val));
  16342. }
  16343. function isOnePointZero$1(n) {
  16344. return typeof n === "string" && n.indexOf(".") !== -1 && parseFloat(n) === 1;
  16345. }
  16346. function isPercentage$1(n) {
  16347. return typeof n === "string" && n.indexOf("%") !== -1;
  16348. }
  16349. function boundAlpha(a) {
  16350. a = parseFloat(a);
  16351. if (isNaN(a) || a < 0 || a > 1) {
  16352. a = 1;
  16353. }
  16354. return a;
  16355. }
  16356. function convertToPercentage(n) {
  16357. if (n <= 1) {
  16358. return "".concat(Number(n) * 100, "%");
  16359. }
  16360. return n;
  16361. }
  16362. function pad2(c) {
  16363. return c.length === 1 ? "0" + c : String(c);
  16364. }
  16365. function rgbToRgb(r, g, b) {
  16366. return {
  16367. r: bound01$1(r, 255) * 255,
  16368. g: bound01$1(g, 255) * 255,
  16369. b: bound01$1(b, 255) * 255
  16370. };
  16371. }
  16372. function rgbToHsl(r, g, b) {
  16373. r = bound01$1(r, 255);
  16374. g = bound01$1(g, 255);
  16375. b = bound01$1(b, 255);
  16376. var max = Math.max(r, g, b);
  16377. var min = Math.min(r, g, b);
  16378. var h = 0;
  16379. var s = 0;
  16380. var l = (max + min) / 2;
  16381. if (max === min) {
  16382. s = 0;
  16383. h = 0;
  16384. } else {
  16385. var d = max - min;
  16386. s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
  16387. switch (max) {
  16388. case r:
  16389. h = (g - b) / d + (g < b ? 6 : 0);
  16390. break;
  16391. case g:
  16392. h = (b - r) / d + 2;
  16393. break;
  16394. case b:
  16395. h = (r - g) / d + 4;
  16396. break;
  16397. }
  16398. h /= 6;
  16399. }
  16400. return { h, s, l };
  16401. }
  16402. function hue2rgb(p, q, t) {
  16403. if (t < 0) {
  16404. t += 1;
  16405. }
  16406. if (t > 1) {
  16407. t -= 1;
  16408. }
  16409. if (t < 1 / 6) {
  16410. return p + (q - p) * (6 * t);
  16411. }
  16412. if (t < 1 / 2) {
  16413. return q;
  16414. }
  16415. if (t < 2 / 3) {
  16416. return p + (q - p) * (2 / 3 - t) * 6;
  16417. }
  16418. return p;
  16419. }
  16420. function hslToRgb(h, s, l) {
  16421. var r;
  16422. var g;
  16423. var b;
  16424. h = bound01$1(h, 360);
  16425. s = bound01$1(s, 100);
  16426. l = bound01$1(l, 100);
  16427. if (s === 0) {
  16428. g = l;
  16429. b = l;
  16430. r = l;
  16431. } else {
  16432. var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
  16433. var p = 2 * l - q;
  16434. r = hue2rgb(p, q, h + 1 / 3);
  16435. g = hue2rgb(p, q, h);
  16436. b = hue2rgb(p, q, h - 1 / 3);
  16437. }
  16438. return { r: r * 255, g: g * 255, b: b * 255 };
  16439. }
  16440. function rgbToHsv(r, g, b) {
  16441. r = bound01$1(r, 255);
  16442. g = bound01$1(g, 255);
  16443. b = bound01$1(b, 255);
  16444. var max = Math.max(r, g, b);
  16445. var min = Math.min(r, g, b);
  16446. var h = 0;
  16447. var v = max;
  16448. var d = max - min;
  16449. var s = max === 0 ? 0 : d / max;
  16450. if (max === min) {
  16451. h = 0;
  16452. } else {
  16453. switch (max) {
  16454. case r:
  16455. h = (g - b) / d + (g < b ? 6 : 0);
  16456. break;
  16457. case g:
  16458. h = (b - r) / d + 2;
  16459. break;
  16460. case b:
  16461. h = (r - g) / d + 4;
  16462. break;
  16463. }
  16464. h /= 6;
  16465. }
  16466. return { h, s, v };
  16467. }
  16468. function hsvToRgb(h, s, v) {
  16469. h = bound01$1(h, 360) * 6;
  16470. s = bound01$1(s, 100);
  16471. v = bound01$1(v, 100);
  16472. var i = Math.floor(h);
  16473. var f = h - i;
  16474. var p = v * (1 - s);
  16475. var q = v * (1 - f * s);
  16476. var t = v * (1 - (1 - f) * s);
  16477. var mod = i % 6;
  16478. var r = [v, q, p, p, t, v][mod];
  16479. var g = [t, v, v, q, p, p][mod];
  16480. var b = [p, p, t, v, v, q][mod];
  16481. return { r: r * 255, g: g * 255, b: b * 255 };
  16482. }
  16483. function rgbToHex(r, g, b, allow3Char) {
  16484. var hex = [
  16485. pad2(Math.round(r).toString(16)),
  16486. pad2(Math.round(g).toString(16)),
  16487. pad2(Math.round(b).toString(16))
  16488. ];
  16489. if (allow3Char && hex[0].startsWith(hex[0].charAt(1)) && hex[1].startsWith(hex[1].charAt(1)) && hex[2].startsWith(hex[2].charAt(1))) {
  16490. return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);
  16491. }
  16492. return hex.join("");
  16493. }
  16494. function rgbaToHex(r, g, b, a, allow4Char) {
  16495. var hex = [
  16496. pad2(Math.round(r).toString(16)),
  16497. pad2(Math.round(g).toString(16)),
  16498. pad2(Math.round(b).toString(16)),
  16499. pad2(convertDecimalToHex(a))
  16500. ];
  16501. if (allow4Char && hex[0].startsWith(hex[0].charAt(1)) && hex[1].startsWith(hex[1].charAt(1)) && hex[2].startsWith(hex[2].charAt(1)) && hex[3].startsWith(hex[3].charAt(1))) {
  16502. return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0);
  16503. }
  16504. return hex.join("");
  16505. }
  16506. function convertDecimalToHex(d) {
  16507. return Math.round(parseFloat(d) * 255).toString(16);
  16508. }
  16509. function convertHexToDecimal(h) {
  16510. return parseIntFromHex(h) / 255;
  16511. }
  16512. function parseIntFromHex(val) {
  16513. return parseInt(val, 16);
  16514. }
  16515. function numberInputToObject(color) {
  16516. return {
  16517. r: color >> 16,
  16518. g: (color & 65280) >> 8,
  16519. b: color & 255
  16520. };
  16521. }
  16522. var names = {
  16523. aliceblue: "#f0f8ff",
  16524. antiquewhite: "#faebd7",
  16525. aqua: "#00ffff",
  16526. aquamarine: "#7fffd4",
  16527. azure: "#f0ffff",
  16528. beige: "#f5f5dc",
  16529. bisque: "#ffe4c4",
  16530. black: "#000000",
  16531. blanchedalmond: "#ffebcd",
  16532. blue: "#0000ff",
  16533. blueviolet: "#8a2be2",
  16534. brown: "#a52a2a",
  16535. burlywood: "#deb887",
  16536. cadetblue: "#5f9ea0",
  16537. chartreuse: "#7fff00",
  16538. chocolate: "#d2691e",
  16539. coral: "#ff7f50",
  16540. cornflowerblue: "#6495ed",
  16541. cornsilk: "#fff8dc",
  16542. crimson: "#dc143c",
  16543. cyan: "#00ffff",
  16544. darkblue: "#00008b",
  16545. darkcyan: "#008b8b",
  16546. darkgoldenrod: "#b8860b",
  16547. darkgray: "#a9a9a9",
  16548. darkgreen: "#006400",
  16549. darkgrey: "#a9a9a9",
  16550. darkkhaki: "#bdb76b",
  16551. darkmagenta: "#8b008b",
  16552. darkolivegreen: "#556b2f",
  16553. darkorange: "#ff8c00",
  16554. darkorchid: "#9932cc",
  16555. darkred: "#8b0000",
  16556. darksalmon: "#e9967a",
  16557. darkseagreen: "#8fbc8f",
  16558. darkslateblue: "#483d8b",
  16559. darkslategray: "#2f4f4f",
  16560. darkslategrey: "#2f4f4f",
  16561. darkturquoise: "#00ced1",
  16562. darkviolet: "#9400d3",
  16563. deeppink: "#ff1493",
  16564. deepskyblue: "#00bfff",
  16565. dimgray: "#696969",
  16566. dimgrey: "#696969",
  16567. dodgerblue: "#1e90ff",
  16568. firebrick: "#b22222",
  16569. floralwhite: "#fffaf0",
  16570. forestgreen: "#228b22",
  16571. fuchsia: "#ff00ff",
  16572. gainsboro: "#dcdcdc",
  16573. ghostwhite: "#f8f8ff",
  16574. goldenrod: "#daa520",
  16575. gold: "#ffd700",
  16576. gray: "#808080",
  16577. green: "#008000",
  16578. greenyellow: "#adff2f",
  16579. grey: "#808080",
  16580. honeydew: "#f0fff0",
  16581. hotpink: "#ff69b4",
  16582. indianred: "#cd5c5c",
  16583. indigo: "#4b0082",
  16584. ivory: "#fffff0",
  16585. khaki: "#f0e68c",
  16586. lavenderblush: "#fff0f5",
  16587. lavender: "#e6e6fa",
  16588. lawngreen: "#7cfc00",
  16589. lemonchiffon: "#fffacd",
  16590. lightblue: "#add8e6",
  16591. lightcoral: "#f08080",
  16592. lightcyan: "#e0ffff",
  16593. lightgoldenrodyellow: "#fafad2",
  16594. lightgray: "#d3d3d3",
  16595. lightgreen: "#90ee90",
  16596. lightgrey: "#d3d3d3",
  16597. lightpink: "#ffb6c1",
  16598. lightsalmon: "#ffa07a",
  16599. lightseagreen: "#20b2aa",
  16600. lightskyblue: "#87cefa",
  16601. lightslategray: "#778899",
  16602. lightslategrey: "#778899",
  16603. lightsteelblue: "#b0c4de",
  16604. lightyellow: "#ffffe0",
  16605. lime: "#00ff00",
  16606. limegreen: "#32cd32",
  16607. linen: "#faf0e6",
  16608. magenta: "#ff00ff",
  16609. maroon: "#800000",
  16610. mediumaquamarine: "#66cdaa",
  16611. mediumblue: "#0000cd",
  16612. mediumorchid: "#ba55d3",
  16613. mediumpurple: "#9370db",
  16614. mediumseagreen: "#3cb371",
  16615. mediumslateblue: "#7b68ee",
  16616. mediumspringgreen: "#00fa9a",
  16617. mediumturquoise: "#48d1cc",
  16618. mediumvioletred: "#c71585",
  16619. midnightblue: "#191970",
  16620. mintcream: "#f5fffa",
  16621. mistyrose: "#ffe4e1",
  16622. moccasin: "#ffe4b5",
  16623. navajowhite: "#ffdead",
  16624. navy: "#000080",
  16625. oldlace: "#fdf5e6",
  16626. olive: "#808000",
  16627. olivedrab: "#6b8e23",
  16628. orange: "#ffa500",
  16629. orangered: "#ff4500",
  16630. orchid: "#da70d6",
  16631. palegoldenrod: "#eee8aa",
  16632. palegreen: "#98fb98",
  16633. paleturquoise: "#afeeee",
  16634. palevioletred: "#db7093",
  16635. papayawhip: "#ffefd5",
  16636. peachpuff: "#ffdab9",
  16637. peru: "#cd853f",
  16638. pink: "#ffc0cb",
  16639. plum: "#dda0dd",
  16640. powderblue: "#b0e0e6",
  16641. purple: "#800080",
  16642. rebeccapurple: "#663399",
  16643. red: "#ff0000",
  16644. rosybrown: "#bc8f8f",
  16645. royalblue: "#4169e1",
  16646. saddlebrown: "#8b4513",
  16647. salmon: "#fa8072",
  16648. sandybrown: "#f4a460",
  16649. seagreen: "#2e8b57",
  16650. seashell: "#fff5ee",
  16651. sienna: "#a0522d",
  16652. silver: "#c0c0c0",
  16653. skyblue: "#87ceeb",
  16654. slateblue: "#6a5acd",
  16655. slategray: "#708090",
  16656. slategrey: "#708090",
  16657. snow: "#fffafa",
  16658. springgreen: "#00ff7f",
  16659. steelblue: "#4682b4",
  16660. tan: "#d2b48c",
  16661. teal: "#008080",
  16662. thistle: "#d8bfd8",
  16663. tomato: "#ff6347",
  16664. turquoise: "#40e0d0",
  16665. violet: "#ee82ee",
  16666. wheat: "#f5deb3",
  16667. white: "#ffffff",
  16668. whitesmoke: "#f5f5f5",
  16669. yellow: "#ffff00",
  16670. yellowgreen: "#9acd32"
  16671. };
  16672. function inputToRGB(color) {
  16673. var rgb = { r: 0, g: 0, b: 0 };
  16674. var a = 1;
  16675. var s = null;
  16676. var v = null;
  16677. var l = null;
  16678. var ok = false;
  16679. var format = false;
  16680. if (typeof color === "string") {
  16681. color = stringInputToObject(color);
  16682. }
  16683. if (typeof color === "object") {
  16684. if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) {
  16685. rgb = rgbToRgb(color.r, color.g, color.b);
  16686. ok = true;
  16687. format = String(color.r).substr(-1) === "%" ? "prgb" : "rgb";
  16688. } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) {
  16689. s = convertToPercentage(color.s);
  16690. v = convertToPercentage(color.v);
  16691. rgb = hsvToRgb(color.h, s, v);
  16692. ok = true;
  16693. format = "hsv";
  16694. } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) {
  16695. s = convertToPercentage(color.s);
  16696. l = convertToPercentage(color.l);
  16697. rgb = hslToRgb(color.h, s, l);
  16698. ok = true;
  16699. format = "hsl";
  16700. }
  16701. if (Object.prototype.hasOwnProperty.call(color, "a")) {
  16702. a = color.a;
  16703. }
  16704. }
  16705. a = boundAlpha(a);
  16706. return {
  16707. ok,
  16708. format: color.format || format,
  16709. r: Math.min(255, Math.max(rgb.r, 0)),
  16710. g: Math.min(255, Math.max(rgb.g, 0)),
  16711. b: Math.min(255, Math.max(rgb.b, 0)),
  16712. a
  16713. };
  16714. }
  16715. var CSS_INTEGER = "[-\\+]?\\d+%?";
  16716. var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?";
  16717. var CSS_UNIT = "(?:".concat(CSS_NUMBER, ")|(?:").concat(CSS_INTEGER, ")");
  16718. var PERMISSIVE_MATCH3 = "[\\s|\\(]+(".concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")\\s*\\)?");
  16719. var PERMISSIVE_MATCH4 = "[\\s|\\(]+(".concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")\\s*\\)?");
  16720. var matchers = {
  16721. CSS_UNIT: new RegExp(CSS_UNIT),
  16722. rgb: new RegExp("rgb" + PERMISSIVE_MATCH3),
  16723. rgba: new RegExp("rgba" + PERMISSIVE_MATCH4),
  16724. hsl: new RegExp("hsl" + PERMISSIVE_MATCH3),
  16725. hsla: new RegExp("hsla" + PERMISSIVE_MATCH4),
  16726. hsv: new RegExp("hsv" + PERMISSIVE_MATCH3),
  16727. hsva: new RegExp("hsva" + PERMISSIVE_MATCH4),
  16728. hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
  16729. hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
  16730. hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
  16731. hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
  16732. };
  16733. function stringInputToObject(color) {
  16734. color = color.trim().toLowerCase();
  16735. if (color.length === 0) {
  16736. return false;
  16737. }
  16738. var named = false;
  16739. if (names[color]) {
  16740. color = names[color];
  16741. named = true;
  16742. } else if (color === "transparent") {
  16743. return { r: 0, g: 0, b: 0, a: 0, format: "name" };
  16744. }
  16745. var match = matchers.rgb.exec(color);
  16746. if (match) {
  16747. return { r: match[1], g: match[2], b: match[3] };
  16748. }
  16749. match = matchers.rgba.exec(color);
  16750. if (match) {
  16751. return { r: match[1], g: match[2], b: match[3], a: match[4] };
  16752. }
  16753. match = matchers.hsl.exec(color);
  16754. if (match) {
  16755. return { h: match[1], s: match[2], l: match[3] };
  16756. }
  16757. match = matchers.hsla.exec(color);
  16758. if (match) {
  16759. return { h: match[1], s: match[2], l: match[3], a: match[4] };
  16760. }
  16761. match = matchers.hsv.exec(color);
  16762. if (match) {
  16763. return { h: match[1], s: match[2], v: match[3] };
  16764. }
  16765. match = matchers.hsva.exec(color);
  16766. if (match) {
  16767. return { h: match[1], s: match[2], v: match[3], a: match[4] };
  16768. }
  16769. match = matchers.hex8.exec(color);
  16770. if (match) {
  16771. return {
  16772. r: parseIntFromHex(match[1]),
  16773. g: parseIntFromHex(match[2]),
  16774. b: parseIntFromHex(match[3]),
  16775. a: convertHexToDecimal(match[4]),
  16776. format: named ? "name" : "hex8"
  16777. };
  16778. }
  16779. match = matchers.hex6.exec(color);
  16780. if (match) {
  16781. return {
  16782. r: parseIntFromHex(match[1]),
  16783. g: parseIntFromHex(match[2]),
  16784. b: parseIntFromHex(match[3]),
  16785. format: named ? "name" : "hex"
  16786. };
  16787. }
  16788. match = matchers.hex4.exec(color);
  16789. if (match) {
  16790. return {
  16791. r: parseIntFromHex(match[1] + match[1]),
  16792. g: parseIntFromHex(match[2] + match[2]),
  16793. b: parseIntFromHex(match[3] + match[3]),
  16794. a: convertHexToDecimal(match[4] + match[4]),
  16795. format: named ? "name" : "hex8"
  16796. };
  16797. }
  16798. match = matchers.hex3.exec(color);
  16799. if (match) {
  16800. return {
  16801. r: parseIntFromHex(match[1] + match[1]),
  16802. g: parseIntFromHex(match[2] + match[2]),
  16803. b: parseIntFromHex(match[3] + match[3]),
  16804. format: named ? "name" : "hex"
  16805. };
  16806. }
  16807. return false;
  16808. }
  16809. function isValidCSSUnit(color) {
  16810. return Boolean(matchers.CSS_UNIT.exec(String(color)));
  16811. }
  16812. var TinyColor = function() {
  16813. function TinyColor2(color, opts) {
  16814. if (color === void 0) {
  16815. color = "";
  16816. }
  16817. if (opts === void 0) {
  16818. opts = {};
  16819. }
  16820. var _a;
  16821. if (color instanceof TinyColor2) {
  16822. return color;
  16823. }
  16824. if (typeof color === "number") {
  16825. color = numberInputToObject(color);
  16826. }
  16827. this.originalInput = color;
  16828. var rgb = inputToRGB(color);
  16829. this.originalInput = color;
  16830. this.r = rgb.r;
  16831. this.g = rgb.g;
  16832. this.b = rgb.b;
  16833. this.a = rgb.a;
  16834. this.roundA = Math.round(100 * this.a) / 100;
  16835. this.format = (_a = opts.format) !== null && _a !== void 0 ? _a : rgb.format;
  16836. this.gradientType = opts.gradientType;
  16837. if (this.r < 1) {
  16838. this.r = Math.round(this.r);
  16839. }
  16840. if (this.g < 1) {
  16841. this.g = Math.round(this.g);
  16842. }
  16843. if (this.b < 1) {
  16844. this.b = Math.round(this.b);
  16845. }
  16846. this.isValid = rgb.ok;
  16847. }
  16848. TinyColor2.prototype.isDark = function() {
  16849. return this.getBrightness() < 128;
  16850. };
  16851. TinyColor2.prototype.isLight = function() {
  16852. return !this.isDark();
  16853. };
  16854. TinyColor2.prototype.getBrightness = function() {
  16855. var rgb = this.toRgb();
  16856. return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1e3;
  16857. };
  16858. TinyColor2.prototype.getLuminance = function() {
  16859. var rgb = this.toRgb();
  16860. var R;
  16861. var G;
  16862. var B;
  16863. var RsRGB = rgb.r / 255;
  16864. var GsRGB = rgb.g / 255;
  16865. var BsRGB = rgb.b / 255;
  16866. if (RsRGB <= 0.03928) {
  16867. R = RsRGB / 12.92;
  16868. } else {
  16869. R = Math.pow((RsRGB + 0.055) / 1.055, 2.4);
  16870. }
  16871. if (GsRGB <= 0.03928) {
  16872. G = GsRGB / 12.92;
  16873. } else {
  16874. G = Math.pow((GsRGB + 0.055) / 1.055, 2.4);
  16875. }
  16876. if (BsRGB <= 0.03928) {
  16877. B = BsRGB / 12.92;
  16878. } else {
  16879. B = Math.pow((BsRGB + 0.055) / 1.055, 2.4);
  16880. }
  16881. return 0.2126 * R + 0.7152 * G + 0.0722 * B;
  16882. };
  16883. TinyColor2.prototype.getAlpha = function() {
  16884. return this.a;
  16885. };
  16886. TinyColor2.prototype.setAlpha = function(alpha) {
  16887. this.a = boundAlpha(alpha);
  16888. this.roundA = Math.round(100 * this.a) / 100;
  16889. return this;
  16890. };
  16891. TinyColor2.prototype.toHsv = function() {
  16892. var hsv = rgbToHsv(this.r, this.g, this.b);
  16893. return { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: this.a };
  16894. };
  16895. TinyColor2.prototype.toHsvString = function() {
  16896. var hsv = rgbToHsv(this.r, this.g, this.b);
  16897. var h = Math.round(hsv.h * 360);
  16898. var s = Math.round(hsv.s * 100);
  16899. var v = Math.round(hsv.v * 100);
  16900. return this.a === 1 ? "hsv(".concat(h, ", ").concat(s, "%, ").concat(v, "%)") : "hsva(".concat(h, ", ").concat(s, "%, ").concat(v, "%, ").concat(this.roundA, ")");
  16901. };
  16902. TinyColor2.prototype.toHsl = function() {
  16903. var hsl = rgbToHsl(this.r, this.g, this.b);
  16904. return { h: hsl.h * 360, s: hsl.s, l: hsl.l, a: this.a };
  16905. };
  16906. TinyColor2.prototype.toHslString = function() {
  16907. var hsl = rgbToHsl(this.r, this.g, this.b);
  16908. var h = Math.round(hsl.h * 360);
  16909. var s = Math.round(hsl.s * 100);
  16910. var l = Math.round(hsl.l * 100);
  16911. return this.a === 1 ? "hsl(".concat(h, ", ").concat(s, "%, ").concat(l, "%)") : "hsla(".concat(h, ", ").concat(s, "%, ").concat(l, "%, ").concat(this.roundA, ")");
  16912. };
  16913. TinyColor2.prototype.toHex = function(allow3Char) {
  16914. if (allow3Char === void 0) {
  16915. allow3Char = false;
  16916. }
  16917. return rgbToHex(this.r, this.g, this.b, allow3Char);
  16918. };
  16919. TinyColor2.prototype.toHexString = function(allow3Char) {
  16920. if (allow3Char === void 0) {
  16921. allow3Char = false;
  16922. }
  16923. return "#" + this.toHex(allow3Char);
  16924. };
  16925. TinyColor2.prototype.toHex8 = function(allow4Char) {
  16926. if (allow4Char === void 0) {
  16927. allow4Char = false;
  16928. }
  16929. return rgbaToHex(this.r, this.g, this.b, this.a, allow4Char);
  16930. };
  16931. TinyColor2.prototype.toHex8String = function(allow4Char) {
  16932. if (allow4Char === void 0) {
  16933. allow4Char = false;
  16934. }
  16935. return "#" + this.toHex8(allow4Char);
  16936. };
  16937. TinyColor2.prototype.toRgb = function() {
  16938. return {
  16939. r: Math.round(this.r),
  16940. g: Math.round(this.g),
  16941. b: Math.round(this.b),
  16942. a: this.a
  16943. };
  16944. };
  16945. TinyColor2.prototype.toRgbString = function() {
  16946. var r = Math.round(this.r);
  16947. var g = Math.round(this.g);
  16948. var b = Math.round(this.b);
  16949. return this.a === 1 ? "rgb(".concat(r, ", ").concat(g, ", ").concat(b, ")") : "rgba(".concat(r, ", ").concat(g, ", ").concat(b, ", ").concat(this.roundA, ")");
  16950. };
  16951. TinyColor2.prototype.toPercentageRgb = function() {
  16952. var fmt = function(x) {
  16953. return "".concat(Math.round(bound01$1(x, 255) * 100), "%");
  16954. };
  16955. return {
  16956. r: fmt(this.r),
  16957. g: fmt(this.g),
  16958. b: fmt(this.b),
  16959. a: this.a
  16960. };
  16961. };
  16962. TinyColor2.prototype.toPercentageRgbString = function() {
  16963. var rnd = function(x) {
  16964. return Math.round(bound01$1(x, 255) * 100);
  16965. };
  16966. return this.a === 1 ? "rgb(".concat(rnd(this.r), "%, ").concat(rnd(this.g), "%, ").concat(rnd(this.b), "%)") : "rgba(".concat(rnd(this.r), "%, ").concat(rnd(this.g), "%, ").concat(rnd(this.b), "%, ").concat(this.roundA, ")");
  16967. };
  16968. TinyColor2.prototype.toName = function() {
  16969. if (this.a === 0) {
  16970. return "transparent";
  16971. }
  16972. if (this.a < 1) {
  16973. return false;
  16974. }
  16975. var hex = "#" + rgbToHex(this.r, this.g, this.b, false);
  16976. for (var _i = 0, _a = Object.entries(names); _i < _a.length; _i++) {
  16977. var _b = _a[_i], key = _b[0], value = _b[1];
  16978. if (hex === value) {
  16979. return key;
  16980. }
  16981. }
  16982. return false;
  16983. };
  16984. TinyColor2.prototype.toString = function(format) {
  16985. var formatSet = Boolean(format);
  16986. format = format !== null && format !== void 0 ? format : this.format;
  16987. var formattedString = false;
  16988. var hasAlpha = this.a < 1 && this.a >= 0;
  16989. var needsAlphaFormat = !formatSet && hasAlpha && (format.startsWith("hex") || format === "name");
  16990. if (needsAlphaFormat) {
  16991. if (format === "name" && this.a === 0) {
  16992. return this.toName();
  16993. }
  16994. return this.toRgbString();
  16995. }
  16996. if (format === "rgb") {
  16997. formattedString = this.toRgbString();
  16998. }
  16999. if (format === "prgb") {
  17000. formattedString = this.toPercentageRgbString();
  17001. }
  17002. if (format === "hex" || format === "hex6") {
  17003. formattedString = this.toHexString();
  17004. }
  17005. if (format === "hex3") {
  17006. formattedString = this.toHexString(true);
  17007. }
  17008. if (format === "hex4") {
  17009. formattedString = this.toHex8String(true);
  17010. }
  17011. if (format === "hex8") {
  17012. formattedString = this.toHex8String();
  17013. }
  17014. if (format === "name") {
  17015. formattedString = this.toName();
  17016. }
  17017. if (format === "hsl") {
  17018. formattedString = this.toHslString();
  17019. }
  17020. if (format === "hsv") {
  17021. formattedString = this.toHsvString();
  17022. }
  17023. return formattedString || this.toHexString();
  17024. };
  17025. TinyColor2.prototype.toNumber = function() {
  17026. return (Math.round(this.r) << 16) + (Math.round(this.g) << 8) + Math.round(this.b);
  17027. };
  17028. TinyColor2.prototype.clone = function() {
  17029. return new TinyColor2(this.toString());
  17030. };
  17031. TinyColor2.prototype.lighten = function(amount) {
  17032. if (amount === void 0) {
  17033. amount = 10;
  17034. }
  17035. var hsl = this.toHsl();
  17036. hsl.l += amount / 100;
  17037. hsl.l = clamp01(hsl.l);
  17038. return new TinyColor2(hsl);
  17039. };
  17040. TinyColor2.prototype.brighten = function(amount) {
  17041. if (amount === void 0) {
  17042. amount = 10;
  17043. }
  17044. var rgb = this.toRgb();
  17045. rgb.r = Math.max(0, Math.min(255, rgb.r - Math.round(255 * -(amount / 100))));
  17046. rgb.g = Math.max(0, Math.min(255, rgb.g - Math.round(255 * -(amount / 100))));
  17047. rgb.b = Math.max(0, Math.min(255, rgb.b - Math.round(255 * -(amount / 100))));
  17048. return new TinyColor2(rgb);
  17049. };
  17050. TinyColor2.prototype.darken = function(amount) {
  17051. if (amount === void 0) {
  17052. amount = 10;
  17053. }
  17054. var hsl = this.toHsl();
  17055. hsl.l -= amount / 100;
  17056. hsl.l = clamp01(hsl.l);
  17057. return new TinyColor2(hsl);
  17058. };
  17059. TinyColor2.prototype.tint = function(amount) {
  17060. if (amount === void 0) {
  17061. amount = 10;
  17062. }
  17063. return this.mix("white", amount);
  17064. };
  17065. TinyColor2.prototype.shade = function(amount) {
  17066. if (amount === void 0) {
  17067. amount = 10;
  17068. }
  17069. return this.mix("black", amount);
  17070. };
  17071. TinyColor2.prototype.desaturate = function(amount) {
  17072. if (amount === void 0) {
  17073. amount = 10;
  17074. }
  17075. var hsl = this.toHsl();
  17076. hsl.s -= amount / 100;
  17077. hsl.s = clamp01(hsl.s);
  17078. return new TinyColor2(hsl);
  17079. };
  17080. TinyColor2.prototype.saturate = function(amount) {
  17081. if (amount === void 0) {
  17082. amount = 10;
  17083. }
  17084. var hsl = this.toHsl();
  17085. hsl.s += amount / 100;
  17086. hsl.s = clamp01(hsl.s);
  17087. return new TinyColor2(hsl);
  17088. };
  17089. TinyColor2.prototype.greyscale = function() {
  17090. return this.desaturate(100);
  17091. };
  17092. TinyColor2.prototype.spin = function(amount) {
  17093. var hsl = this.toHsl();
  17094. var hue = (hsl.h + amount) % 360;
  17095. hsl.h = hue < 0 ? 360 + hue : hue;
  17096. return new TinyColor2(hsl);
  17097. };
  17098. TinyColor2.prototype.mix = function(color, amount) {
  17099. if (amount === void 0) {
  17100. amount = 50;
  17101. }
  17102. var rgb1 = this.toRgb();
  17103. var rgb2 = new TinyColor2(color).toRgb();
  17104. var p = amount / 100;
  17105. var rgba = {
  17106. r: (rgb2.r - rgb1.r) * p + rgb1.r,
  17107. g: (rgb2.g - rgb1.g) * p + rgb1.g,
  17108. b: (rgb2.b - rgb1.b) * p + rgb1.b,
  17109. a: (rgb2.a - rgb1.a) * p + rgb1.a
  17110. };
  17111. return new TinyColor2(rgba);
  17112. };
  17113. TinyColor2.prototype.analogous = function(results, slices) {
  17114. if (results === void 0) {
  17115. results = 6;
  17116. }
  17117. if (slices === void 0) {
  17118. slices = 30;
  17119. }
  17120. var hsl = this.toHsl();
  17121. var part = 360 / slices;
  17122. var ret = [this];
  17123. for (hsl.h = (hsl.h - (part * results >> 1) + 720) % 360; --results; ) {
  17124. hsl.h = (hsl.h + part) % 360;
  17125. ret.push(new TinyColor2(hsl));
  17126. }
  17127. return ret;
  17128. };
  17129. TinyColor2.prototype.complement = function() {
  17130. var hsl = this.toHsl();
  17131. hsl.h = (hsl.h + 180) % 360;
  17132. return new TinyColor2(hsl);
  17133. };
  17134. TinyColor2.prototype.monochromatic = function(results) {
  17135. if (results === void 0) {
  17136. results = 6;
  17137. }
  17138. var hsv = this.toHsv();
  17139. var h = hsv.h;
  17140. var s = hsv.s;
  17141. var v = hsv.v;
  17142. var res = [];
  17143. var modification = 1 / results;
  17144. while (results--) {
  17145. res.push(new TinyColor2({ h, s, v }));
  17146. v = (v + modification) % 1;
  17147. }
  17148. return res;
  17149. };
  17150. TinyColor2.prototype.splitcomplement = function() {
  17151. var hsl = this.toHsl();
  17152. var h = hsl.h;
  17153. return [
  17154. this,
  17155. new TinyColor2({ h: (h + 72) % 360, s: hsl.s, l: hsl.l }),
  17156. new TinyColor2({ h: (h + 216) % 360, s: hsl.s, l: hsl.l })
  17157. ];
  17158. };
  17159. TinyColor2.prototype.onBackground = function(background) {
  17160. var fg = this.toRgb();
  17161. var bg = new TinyColor2(background).toRgb();
  17162. return new TinyColor2({
  17163. r: bg.r + (fg.r - bg.r) * fg.a,
  17164. g: bg.g + (fg.g - bg.g) * fg.a,
  17165. b: bg.b + (fg.b - bg.b) * fg.a
  17166. });
  17167. };
  17168. TinyColor2.prototype.triad = function() {
  17169. return this.polyad(3);
  17170. };
  17171. TinyColor2.prototype.tetrad = function() {
  17172. return this.polyad(4);
  17173. };
  17174. TinyColor2.prototype.polyad = function(n) {
  17175. var hsl = this.toHsl();
  17176. var h = hsl.h;
  17177. var result = [this];
  17178. var increment = 360 / n;
  17179. for (var i = 1; i < n; i++) {
  17180. result.push(new TinyColor2({ h: (h + i * increment) % 360, s: hsl.s, l: hsl.l }));
  17181. }
  17182. return result;
  17183. };
  17184. TinyColor2.prototype.equals = function(color) {
  17185. return this.toRgbString() === new TinyColor2(color).toRgbString();
  17186. };
  17187. return TinyColor2;
  17188. }();
  17189. function darken(color, amount = 20) {
  17190. return color.mix("#141414", amount).toString();
  17191. }
  17192. function useButtonCustomStyle(props) {
  17193. const _disabled = useFormDisabled();
  17194. const ns = useNamespace("button");
  17195. return vue.computed(() => {
  17196. let styles = {};
  17197. let buttonColor = props.color;
  17198. if (buttonColor) {
  17199. const match = buttonColor.match(/var\((.*?)\)/);
  17200. if (match) {
  17201. buttonColor = window.getComputedStyle(window.document.documentElement).getPropertyValue(match[1]);
  17202. }
  17203. const color = new TinyColor(buttonColor);
  17204. const activeBgColor = props.dark ? color.tint(20).toString() : darken(color, 20);
  17205. if (props.plain) {
  17206. styles = ns.cssVarBlock({
  17207. "bg-color": props.dark ? darken(color, 90) : color.tint(90).toString(),
  17208. "text-color": buttonColor,
  17209. "border-color": props.dark ? darken(color, 50) : color.tint(50).toString(),
  17210. "hover-text-color": `var(${ns.cssVarName("color-white")})`,
  17211. "hover-bg-color": buttonColor,
  17212. "hover-border-color": buttonColor,
  17213. "active-bg-color": activeBgColor,
  17214. "active-text-color": `var(${ns.cssVarName("color-white")})`,
  17215. "active-border-color": activeBgColor
  17216. });
  17217. if (_disabled.value) {
  17218. styles[ns.cssVarBlockName("disabled-bg-color")] = props.dark ? darken(color, 90) : color.tint(90).toString();
  17219. styles[ns.cssVarBlockName("disabled-text-color")] = props.dark ? darken(color, 50) : color.tint(50).toString();
  17220. styles[ns.cssVarBlockName("disabled-border-color")] = props.dark ? darken(color, 80) : color.tint(80).toString();
  17221. }
  17222. } else {
  17223. const hoverBgColor = props.dark ? darken(color, 30) : color.tint(30).toString();
  17224. const textColor = color.isDark() ? `var(${ns.cssVarName("color-white")})` : `var(${ns.cssVarName("color-black")})`;
  17225. styles = ns.cssVarBlock({
  17226. "bg-color": buttonColor,
  17227. "text-color": textColor,
  17228. "border-color": buttonColor,
  17229. "hover-bg-color": hoverBgColor,
  17230. "hover-text-color": textColor,
  17231. "hover-border-color": hoverBgColor,
  17232. "active-bg-color": activeBgColor,
  17233. "active-border-color": activeBgColor
  17234. });
  17235. if (_disabled.value) {
  17236. const disabledButtonColor = props.dark ? darken(color, 50) : color.tint(50).toString();
  17237. styles[ns.cssVarBlockName("disabled-bg-color")] = disabledButtonColor;
  17238. styles[ns.cssVarBlockName("disabled-text-color")] = props.dark ? "rgba(255, 255, 255, 0.5)" : `var(${ns.cssVarName("color-white")})`;
  17239. styles[ns.cssVarBlockName("disabled-border-color")] = disabledButtonColor;
  17240. }
  17241. }
  17242. }
  17243. return styles;
  17244. });
  17245. }
  17246. const __default__$1x = vue.defineComponent({
  17247. name: "ElButton"
  17248. });
  17249. const _sfc_main$29 = /* @__PURE__ */ vue.defineComponent({
  17250. ...__default__$1x,
  17251. props: buttonProps,
  17252. emits: buttonEmits,
  17253. setup(__props, { expose, emit }) {
  17254. const props = __props;
  17255. const buttonStyle = useButtonCustomStyle(props);
  17256. const ns = useNamespace("button");
  17257. const { _ref, _size, _type, _disabled, _props, shouldAddSpace, handleClick } = useButton(props, emit);
  17258. const buttonKls = vue.computed(() => [
  17259. ns.b(),
  17260. ns.m(_type.value),
  17261. ns.m(_size.value),
  17262. ns.is("disabled", _disabled.value),
  17263. ns.is("loading", props.loading),
  17264. ns.is("plain", props.plain),
  17265. ns.is("round", props.round),
  17266. ns.is("circle", props.circle),
  17267. ns.is("text", props.text),
  17268. ns.is("link", props.link),
  17269. ns.is("has-bg", props.bg)
  17270. ]);
  17271. expose({
  17272. ref: _ref,
  17273. size: _size,
  17274. type: _type,
  17275. disabled: _disabled,
  17276. shouldAddSpace
  17277. });
  17278. return (_ctx, _cache) => {
  17279. return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.tag), vue.mergeProps({
  17280. ref_key: "_ref",
  17281. ref: _ref
  17282. }, vue.unref(_props), {
  17283. class: vue.unref(buttonKls),
  17284. style: vue.unref(buttonStyle),
  17285. onClick: vue.unref(handleClick)
  17286. }), {
  17287. default: vue.withCtx(() => [
  17288. _ctx.loading ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  17289. _ctx.$slots.loading ? vue.renderSlot(_ctx.$slots, "loading", { key: 0 }) : (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  17290. key: 1,
  17291. class: vue.normalizeClass(vue.unref(ns).is("loading"))
  17292. }, {
  17293. default: vue.withCtx(() => [
  17294. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.loadingIcon)))
  17295. ]),
  17296. _: 1
  17297. }, 8, ["class"]))
  17298. ], 64)) : _ctx.icon || _ctx.$slots.icon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 1 }, {
  17299. default: vue.withCtx(() => [
  17300. _ctx.icon ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.icon), { key: 0 })) : vue.renderSlot(_ctx.$slots, "icon", { key: 1 })
  17301. ]),
  17302. _: 3
  17303. })) : vue.createCommentVNode("v-if", true),
  17304. _ctx.$slots.default ? (vue.openBlock(), vue.createElementBlock("span", {
  17305. key: 2,
  17306. class: vue.normalizeClass({ [vue.unref(ns).em("text", "expand")]: vue.unref(shouldAddSpace) })
  17307. }, [
  17308. vue.renderSlot(_ctx.$slots, "default")
  17309. ], 2)) : vue.createCommentVNode("v-if", true)
  17310. ]),
  17311. _: 3
  17312. }, 16, ["class", "style", "onClick"]);
  17313. };
  17314. }
  17315. });
  17316. var Button = /* @__PURE__ */ _export_sfc(_sfc_main$29, [["__file", "button.vue"]]);
  17317. const buttonGroupProps = {
  17318. size: buttonProps.size,
  17319. type: buttonProps.type
  17320. };
  17321. const __default__$1w = vue.defineComponent({
  17322. name: "ElButtonGroup"
  17323. });
  17324. const _sfc_main$28 = /* @__PURE__ */ vue.defineComponent({
  17325. ...__default__$1w,
  17326. props: buttonGroupProps,
  17327. setup(__props) {
  17328. const props = __props;
  17329. vue.provide(buttonGroupContextKey, vue.reactive({
  17330. size: vue.toRef(props, "size"),
  17331. type: vue.toRef(props, "type")
  17332. }));
  17333. const ns = useNamespace("button");
  17334. return (_ctx, _cache) => {
  17335. return vue.openBlock(), vue.createElementBlock("div", {
  17336. class: vue.normalizeClass(vue.unref(ns).b("group"))
  17337. }, [
  17338. vue.renderSlot(_ctx.$slots, "default")
  17339. ], 2);
  17340. };
  17341. }
  17342. });
  17343. var ButtonGroup = /* @__PURE__ */ _export_sfc(_sfc_main$28, [["__file", "button-group.vue"]]);
  17344. const ElButton = withInstall(Button, {
  17345. ButtonGroup
  17346. });
  17347. const ElButtonGroup$1 = withNoopInstall(ButtonGroup);
  17348. var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
  17349. var dayjs_min = {exports: {}};
  17350. (function(module, exports) {
  17351. !function(t, e) {
  17352. module.exports = e() ;
  17353. }(commonjsGlobal, function() {
  17354. var t = 1e3, e = 6e4, n = 36e5, r = "millisecond", i = "second", s = "minute", u = "hour", a = "day", o = "week", c = "month", f = "quarter", h = "year", d = "date", l = "Invalid Date", $ = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, y = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, M = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(t2) {
  17355. var e2 = ["th", "st", "nd", "rd"], n2 = t2 % 100;
  17356. return "[" + t2 + (e2[(n2 - 20) % 10] || e2[n2] || e2[0]) + "]";
  17357. } }, m = function(t2, e2, n2) {
  17358. var r2 = String(t2);
  17359. return !r2 || r2.length >= e2 ? t2 : "" + Array(e2 + 1 - r2.length).join(n2) + t2;
  17360. }, v = { s: m, z: function(t2) {
  17361. var e2 = -t2.utcOffset(), n2 = Math.abs(e2), r2 = Math.floor(n2 / 60), i2 = n2 % 60;
  17362. return (e2 <= 0 ? "+" : "-") + m(r2, 2, "0") + ":" + m(i2, 2, "0");
  17363. }, m: function t2(e2, n2) {
  17364. if (e2.date() < n2.date())
  17365. return -t2(n2, e2);
  17366. var r2 = 12 * (n2.year() - e2.year()) + (n2.month() - e2.month()), i2 = e2.clone().add(r2, c), s2 = n2 - i2 < 0, u2 = e2.clone().add(r2 + (s2 ? -1 : 1), c);
  17367. return +(-(r2 + (n2 - i2) / (s2 ? i2 - u2 : u2 - i2)) || 0);
  17368. }, a: function(t2) {
  17369. return t2 < 0 ? Math.ceil(t2) || 0 : Math.floor(t2);
  17370. }, p: function(t2) {
  17371. return { M: c, y: h, w: o, d: a, D: d, h: u, m: s, s: i, ms: r, Q: f }[t2] || String(t2 || "").toLowerCase().replace(/s$/, "");
  17372. }, u: function(t2) {
  17373. return t2 === void 0;
  17374. } }, g = "en", D = {};
  17375. D[g] = M;
  17376. var p = "$isDayjsObject", S = function(t2) {
  17377. return t2 instanceof _ || !(!t2 || !t2[p]);
  17378. }, w = function t2(e2, n2, r2) {
  17379. var i2;
  17380. if (!e2)
  17381. return g;
  17382. if (typeof e2 == "string") {
  17383. var s2 = e2.toLowerCase();
  17384. D[s2] && (i2 = s2), n2 && (D[s2] = n2, i2 = s2);
  17385. var u2 = e2.split("-");
  17386. if (!i2 && u2.length > 1)
  17387. return t2(u2[0]);
  17388. } else {
  17389. var a2 = e2.name;
  17390. D[a2] = e2, i2 = a2;
  17391. }
  17392. return !r2 && i2 && (g = i2), i2 || !r2 && g;
  17393. }, O = function(t2, e2) {
  17394. if (S(t2))
  17395. return t2.clone();
  17396. var n2 = typeof e2 == "object" ? e2 : {};
  17397. return n2.date = t2, n2.args = arguments, new _(n2);
  17398. }, b = v;
  17399. b.l = w, b.i = S, b.w = function(t2, e2) {
  17400. return O(t2, { locale: e2.$L, utc: e2.$u, x: e2.$x, $offset: e2.$offset });
  17401. };
  17402. var _ = function() {
  17403. function M2(t2) {
  17404. this.$L = w(t2.locale, null, true), this.parse(t2), this.$x = this.$x || t2.x || {}, this[p] = true;
  17405. }
  17406. var m2 = M2.prototype;
  17407. return m2.parse = function(t2) {
  17408. this.$d = function(t3) {
  17409. var e2 = t3.date, n2 = t3.utc;
  17410. if (e2 === null)
  17411. return new Date(NaN);
  17412. if (b.u(e2))
  17413. return new Date();
  17414. if (e2 instanceof Date)
  17415. return new Date(e2);
  17416. if (typeof e2 == "string" && !/Z$/i.test(e2)) {
  17417. var r2 = e2.match($);
  17418. if (r2) {
  17419. var i2 = r2[2] - 1 || 0, s2 = (r2[7] || "0").substring(0, 3);
  17420. return n2 ? new Date(Date.UTC(r2[1], i2, r2[3] || 1, r2[4] || 0, r2[5] || 0, r2[6] || 0, s2)) : new Date(r2[1], i2, r2[3] || 1, r2[4] || 0, r2[5] || 0, r2[6] || 0, s2);
  17421. }
  17422. }
  17423. return new Date(e2);
  17424. }(t2), this.init();
  17425. }, m2.init = function() {
  17426. var t2 = this.$d;
  17427. this.$y = t2.getFullYear(), this.$M = t2.getMonth(), this.$D = t2.getDate(), this.$W = t2.getDay(), this.$H = t2.getHours(), this.$m = t2.getMinutes(), this.$s = t2.getSeconds(), this.$ms = t2.getMilliseconds();
  17428. }, m2.$utils = function() {
  17429. return b;
  17430. }, m2.isValid = function() {
  17431. return !(this.$d.toString() === l);
  17432. }, m2.isSame = function(t2, e2) {
  17433. var n2 = O(t2);
  17434. return this.startOf(e2) <= n2 && n2 <= this.endOf(e2);
  17435. }, m2.isAfter = function(t2, e2) {
  17436. return O(t2) < this.startOf(e2);
  17437. }, m2.isBefore = function(t2, e2) {
  17438. return this.endOf(e2) < O(t2);
  17439. }, m2.$g = function(t2, e2, n2) {
  17440. return b.u(t2) ? this[e2] : this.set(n2, t2);
  17441. }, m2.unix = function() {
  17442. return Math.floor(this.valueOf() / 1e3);
  17443. }, m2.valueOf = function() {
  17444. return this.$d.getTime();
  17445. }, m2.startOf = function(t2, e2) {
  17446. var n2 = this, r2 = !!b.u(e2) || e2, f2 = b.p(t2), l2 = function(t3, e3) {
  17447. var i2 = b.w(n2.$u ? Date.UTC(n2.$y, e3, t3) : new Date(n2.$y, e3, t3), n2);
  17448. return r2 ? i2 : i2.endOf(a);
  17449. }, $2 = function(t3, e3) {
  17450. return b.w(n2.toDate()[t3].apply(n2.toDate("s"), (r2 ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(e3)), n2);
  17451. }, y2 = this.$W, M3 = this.$M, m3 = this.$D, v2 = "set" + (this.$u ? "UTC" : "");
  17452. switch (f2) {
  17453. case h:
  17454. return r2 ? l2(1, 0) : l2(31, 11);
  17455. case c:
  17456. return r2 ? l2(1, M3) : l2(0, M3 + 1);
  17457. case o:
  17458. var g2 = this.$locale().weekStart || 0, D2 = (y2 < g2 ? y2 + 7 : y2) - g2;
  17459. return l2(r2 ? m3 - D2 : m3 + (6 - D2), M3);
  17460. case a:
  17461. case d:
  17462. return $2(v2 + "Hours", 0);
  17463. case u:
  17464. return $2(v2 + "Minutes", 1);
  17465. case s:
  17466. return $2(v2 + "Seconds", 2);
  17467. case i:
  17468. return $2(v2 + "Milliseconds", 3);
  17469. default:
  17470. return this.clone();
  17471. }
  17472. }, m2.endOf = function(t2) {
  17473. return this.startOf(t2, false);
  17474. }, m2.$set = function(t2, e2) {
  17475. var n2, o2 = b.p(t2), f2 = "set" + (this.$u ? "UTC" : ""), l2 = (n2 = {}, n2[a] = f2 + "Date", n2[d] = f2 + "Date", n2[c] = f2 + "Month", n2[h] = f2 + "FullYear", n2[u] = f2 + "Hours", n2[s] = f2 + "Minutes", n2[i] = f2 + "Seconds", n2[r] = f2 + "Milliseconds", n2)[o2], $2 = o2 === a ? this.$D + (e2 - this.$W) : e2;
  17476. if (o2 === c || o2 === h) {
  17477. var y2 = this.clone().set(d, 1);
  17478. y2.$d[l2]($2), y2.init(), this.$d = y2.set(d, Math.min(this.$D, y2.daysInMonth())).$d;
  17479. } else
  17480. l2 && this.$d[l2]($2);
  17481. return this.init(), this;
  17482. }, m2.set = function(t2, e2) {
  17483. return this.clone().$set(t2, e2);
  17484. }, m2.get = function(t2) {
  17485. return this[b.p(t2)]();
  17486. }, m2.add = function(r2, f2) {
  17487. var d2, l2 = this;
  17488. r2 = Number(r2);
  17489. var $2 = b.p(f2), y2 = function(t2) {
  17490. var e2 = O(l2);
  17491. return b.w(e2.date(e2.date() + Math.round(t2 * r2)), l2);
  17492. };
  17493. if ($2 === c)
  17494. return this.set(c, this.$M + r2);
  17495. if ($2 === h)
  17496. return this.set(h, this.$y + r2);
  17497. if ($2 === a)
  17498. return y2(1);
  17499. if ($2 === o)
  17500. return y2(7);
  17501. var M3 = (d2 = {}, d2[s] = e, d2[u] = n, d2[i] = t, d2)[$2] || 1, m3 = this.$d.getTime() + r2 * M3;
  17502. return b.w(m3, this);
  17503. }, m2.subtract = function(t2, e2) {
  17504. return this.add(-1 * t2, e2);
  17505. }, m2.format = function(t2) {
  17506. var e2 = this, n2 = this.$locale();
  17507. if (!this.isValid())
  17508. return n2.invalidDate || l;
  17509. var r2 = t2 || "YYYY-MM-DDTHH:mm:ssZ", i2 = b.z(this), s2 = this.$H, u2 = this.$m, a2 = this.$M, o2 = n2.weekdays, c2 = n2.months, f2 = n2.meridiem, h2 = function(t3, n3, i3, s3) {
  17510. return t3 && (t3[n3] || t3(e2, r2)) || i3[n3].slice(0, s3);
  17511. }, d2 = function(t3) {
  17512. return b.s(s2 % 12 || 12, t3, "0");
  17513. }, $2 = f2 || function(t3, e3, n3) {
  17514. var r3 = t3 < 12 ? "AM" : "PM";
  17515. return n3 ? r3.toLowerCase() : r3;
  17516. };
  17517. return r2.replace(y, function(t3, r3) {
  17518. return r3 || function(t4) {
  17519. switch (t4) {
  17520. case "YY":
  17521. return String(e2.$y).slice(-2);
  17522. case "YYYY":
  17523. return b.s(e2.$y, 4, "0");
  17524. case "M":
  17525. return a2 + 1;
  17526. case "MM":
  17527. return b.s(a2 + 1, 2, "0");
  17528. case "MMM":
  17529. return h2(n2.monthsShort, a2, c2, 3);
  17530. case "MMMM":
  17531. return h2(c2, a2);
  17532. case "D":
  17533. return e2.$D;
  17534. case "DD":
  17535. return b.s(e2.$D, 2, "0");
  17536. case "d":
  17537. return String(e2.$W);
  17538. case "dd":
  17539. return h2(n2.weekdaysMin, e2.$W, o2, 2);
  17540. case "ddd":
  17541. return h2(n2.weekdaysShort, e2.$W, o2, 3);
  17542. case "dddd":
  17543. return o2[e2.$W];
  17544. case "H":
  17545. return String(s2);
  17546. case "HH":
  17547. return b.s(s2, 2, "0");
  17548. case "h":
  17549. return d2(1);
  17550. case "hh":
  17551. return d2(2);
  17552. case "a":
  17553. return $2(s2, u2, true);
  17554. case "A":
  17555. return $2(s2, u2, false);
  17556. case "m":
  17557. return String(u2);
  17558. case "mm":
  17559. return b.s(u2, 2, "0");
  17560. case "s":
  17561. return String(e2.$s);
  17562. case "ss":
  17563. return b.s(e2.$s, 2, "0");
  17564. case "SSS":
  17565. return b.s(e2.$ms, 3, "0");
  17566. case "Z":
  17567. return i2;
  17568. }
  17569. return null;
  17570. }(t3) || i2.replace(":", "");
  17571. });
  17572. }, m2.utcOffset = function() {
  17573. return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
  17574. }, m2.diff = function(r2, d2, l2) {
  17575. var $2, y2 = this, M3 = b.p(d2), m3 = O(r2), v2 = (m3.utcOffset() - this.utcOffset()) * e, g2 = this - m3, D2 = function() {
  17576. return b.m(y2, m3);
  17577. };
  17578. switch (M3) {
  17579. case h:
  17580. $2 = D2() / 12;
  17581. break;
  17582. case c:
  17583. $2 = D2();
  17584. break;
  17585. case f:
  17586. $2 = D2() / 3;
  17587. break;
  17588. case o:
  17589. $2 = (g2 - v2) / 6048e5;
  17590. break;
  17591. case a:
  17592. $2 = (g2 - v2) / 864e5;
  17593. break;
  17594. case u:
  17595. $2 = g2 / n;
  17596. break;
  17597. case s:
  17598. $2 = g2 / e;
  17599. break;
  17600. case i:
  17601. $2 = g2 / t;
  17602. break;
  17603. default:
  17604. $2 = g2;
  17605. }
  17606. return l2 ? $2 : b.a($2);
  17607. }, m2.daysInMonth = function() {
  17608. return this.endOf(c).$D;
  17609. }, m2.$locale = function() {
  17610. return D[this.$L];
  17611. }, m2.locale = function(t2, e2) {
  17612. if (!t2)
  17613. return this.$L;
  17614. var n2 = this.clone(), r2 = w(t2, e2, true);
  17615. return r2 && (n2.$L = r2), n2;
  17616. }, m2.clone = function() {
  17617. return b.w(this.$d, this);
  17618. }, m2.toDate = function() {
  17619. return new Date(this.valueOf());
  17620. }, m2.toJSON = function() {
  17621. return this.isValid() ? this.toISOString() : null;
  17622. }, m2.toISOString = function() {
  17623. return this.$d.toISOString();
  17624. }, m2.toString = function() {
  17625. return this.$d.toUTCString();
  17626. }, M2;
  17627. }(), k = _.prototype;
  17628. return O.prototype = k, [["$ms", r], ["$s", i], ["$m", s], ["$H", u], ["$W", a], ["$M", c], ["$y", h], ["$D", d]].forEach(function(t2) {
  17629. k[t2[1]] = function(e2) {
  17630. return this.$g(e2, t2[0], t2[1]);
  17631. };
  17632. }), O.extend = function(t2, e2) {
  17633. return t2.$i || (t2(e2, _, O), t2.$i = true), O;
  17634. }, O.locale = w, O.isDayjs = S, O.unix = function(t2) {
  17635. return O(1e3 * t2);
  17636. }, O.en = D[g], O.Ls = D, O.p = {}, O;
  17637. });
  17638. })(dayjs_min);
  17639. var dayjs = dayjs_min.exports;
  17640. var customParseFormat$1 = {exports: {}};
  17641. (function(module, exports) {
  17642. !function(e, t) {
  17643. module.exports = t() ;
  17644. }(commonjsGlobal, function() {
  17645. var e = { LTS: "h:mm:ss A", LT: "h:mm A", L: "MM/DD/YYYY", LL: "MMMM D, YYYY", LLL: "MMMM D, YYYY h:mm A", LLLL: "dddd, MMMM D, YYYY h:mm A" }, t = /(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g, n = /\d/, r = /\d\d/, i = /\d\d?/, o = /\d*[^-_:/,()\s\d]+/, s = {}, a = function(e2) {
  17646. return (e2 = +e2) + (e2 > 68 ? 1900 : 2e3);
  17647. };
  17648. var f = function(e2) {
  17649. return function(t2) {
  17650. this[e2] = +t2;
  17651. };
  17652. }, h = [/[+-]\d\d:?(\d\d)?|Z/, function(e2) {
  17653. (this.zone || (this.zone = {})).offset = function(e3) {
  17654. if (!e3)
  17655. return 0;
  17656. if (e3 === "Z")
  17657. return 0;
  17658. var t2 = e3.match(/([+-]|\d\d)/g), n2 = 60 * t2[1] + (+t2[2] || 0);
  17659. return n2 === 0 ? 0 : t2[0] === "+" ? -n2 : n2;
  17660. }(e2);
  17661. }], u = function(e2) {
  17662. var t2 = s[e2];
  17663. return t2 && (t2.indexOf ? t2 : t2.s.concat(t2.f));
  17664. }, d = function(e2, t2) {
  17665. var n2, r2 = s.meridiem;
  17666. if (r2) {
  17667. for (var i2 = 1; i2 <= 24; i2 += 1)
  17668. if (e2.indexOf(r2(i2, 0, t2)) > -1) {
  17669. n2 = i2 > 12;
  17670. break;
  17671. }
  17672. } else
  17673. n2 = e2 === (t2 ? "pm" : "PM");
  17674. return n2;
  17675. }, c = { A: [o, function(e2) {
  17676. this.afternoon = d(e2, false);
  17677. }], a: [o, function(e2) {
  17678. this.afternoon = d(e2, true);
  17679. }], Q: [n, function(e2) {
  17680. this.month = 3 * (e2 - 1) + 1;
  17681. }], S: [n, function(e2) {
  17682. this.milliseconds = 100 * +e2;
  17683. }], SS: [r, function(e2) {
  17684. this.milliseconds = 10 * +e2;
  17685. }], SSS: [/\d{3}/, function(e2) {
  17686. this.milliseconds = +e2;
  17687. }], s: [i, f("seconds")], ss: [i, f("seconds")], m: [i, f("minutes")], mm: [i, f("minutes")], H: [i, f("hours")], h: [i, f("hours")], HH: [i, f("hours")], hh: [i, f("hours")], D: [i, f("day")], DD: [r, f("day")], Do: [o, function(e2) {
  17688. var t2 = s.ordinal, n2 = e2.match(/\d+/);
  17689. if (this.day = n2[0], t2)
  17690. for (var r2 = 1; r2 <= 31; r2 += 1)
  17691. t2(r2).replace(/\[|\]/g, "") === e2 && (this.day = r2);
  17692. }], w: [i, f("week")], ww: [r, f("week")], M: [i, f("month")], MM: [r, f("month")], MMM: [o, function(e2) {
  17693. var t2 = u("months"), n2 = (u("monthsShort") || t2.map(function(e3) {
  17694. return e3.slice(0, 3);
  17695. })).indexOf(e2) + 1;
  17696. if (n2 < 1)
  17697. throw new Error();
  17698. this.month = n2 % 12 || n2;
  17699. }], MMMM: [o, function(e2) {
  17700. var t2 = u("months").indexOf(e2) + 1;
  17701. if (t2 < 1)
  17702. throw new Error();
  17703. this.month = t2 % 12 || t2;
  17704. }], Y: [/[+-]?\d+/, f("year")], YY: [r, function(e2) {
  17705. this.year = a(e2);
  17706. }], YYYY: [/\d{4}/, f("year")], Z: h, ZZ: h };
  17707. function l(n2) {
  17708. var r2, i2;
  17709. r2 = n2, i2 = s && s.formats;
  17710. for (var o2 = (n2 = r2.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g, function(t2, n3, r3) {
  17711. var o3 = r3 && r3.toUpperCase();
  17712. return n3 || i2[r3] || e[r3] || i2[o3].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, function(e2, t3, n4) {
  17713. return t3 || n4.slice(1);
  17714. });
  17715. })).match(t), a2 = o2.length, f2 = 0; f2 < a2; f2 += 1) {
  17716. var h2 = o2[f2], u2 = c[h2], d2 = u2 && u2[0], l2 = u2 && u2[1];
  17717. o2[f2] = l2 ? { regex: d2, parser: l2 } : h2.replace(/^\[|\]$/g, "");
  17718. }
  17719. return function(e2) {
  17720. for (var t2 = {}, n3 = 0, r3 = 0; n3 < a2; n3 += 1) {
  17721. var i3 = o2[n3];
  17722. if (typeof i3 == "string")
  17723. r3 += i3.length;
  17724. else {
  17725. var s2 = i3.regex, f3 = i3.parser, h3 = e2.slice(r3), u3 = s2.exec(h3)[0];
  17726. f3.call(t2, u3), e2 = e2.replace(u3, "");
  17727. }
  17728. }
  17729. return function(e3) {
  17730. var t3 = e3.afternoon;
  17731. if (t3 !== void 0) {
  17732. var n4 = e3.hours;
  17733. t3 ? n4 < 12 && (e3.hours += 12) : n4 === 12 && (e3.hours = 0), delete e3.afternoon;
  17734. }
  17735. }(t2), t2;
  17736. };
  17737. }
  17738. return function(e2, t2, n2) {
  17739. n2.p.customParseFormat = true, e2 && e2.parseTwoDigitYear && (a = e2.parseTwoDigitYear);
  17740. var r2 = t2.prototype, i2 = r2.parse;
  17741. r2.parse = function(e3) {
  17742. var t3 = e3.date, r3 = e3.utc, o2 = e3.args;
  17743. this.$u = r3;
  17744. var a2 = o2[1];
  17745. if (typeof a2 == "string") {
  17746. var f2 = o2[2] === true, h2 = o2[3] === true, u2 = f2 || h2, d2 = o2[2];
  17747. h2 && (d2 = o2[2]), s = this.$locale(), !f2 && d2 && (s = n2.Ls[d2]), this.$d = function(e4, t4, n3, r4) {
  17748. try {
  17749. if (["x", "X"].indexOf(t4) > -1)
  17750. return new Date((t4 === "X" ? 1e3 : 1) * e4);
  17751. var i3 = l(t4)(e4), o3 = i3.year, s2 = i3.month, a3 = i3.day, f3 = i3.hours, h3 = i3.minutes, u3 = i3.seconds, d3 = i3.milliseconds, c3 = i3.zone, m2 = i3.week, M2 = new Date(), Y = a3 || (o3 || s2 ? 1 : M2.getDate()), p = o3 || M2.getFullYear(), v = 0;
  17752. o3 && !s2 || (v = s2 > 0 ? s2 - 1 : M2.getMonth());
  17753. var D, w = f3 || 0, g = h3 || 0, y = u3 || 0, L = d3 || 0;
  17754. return c3 ? new Date(Date.UTC(p, v, Y, w, g, y, L + 60 * c3.offset * 1e3)) : n3 ? new Date(Date.UTC(p, v, Y, w, g, y, L)) : (D = new Date(p, v, Y, w, g, y, L), m2 && (D = r4(D).week(m2).toDate()), D);
  17755. } catch (e5) {
  17756. return new Date("");
  17757. }
  17758. }(t3, a2, r3, n2), this.init(), d2 && d2 !== true && (this.$L = this.locale(d2).$L), u2 && t3 != this.format(a2) && (this.$d = new Date("")), s = {};
  17759. } else if (a2 instanceof Array)
  17760. for (var c2 = a2.length, m = 1; m <= c2; m += 1) {
  17761. o2[1] = a2[m - 1];
  17762. var M = n2.apply(this, o2);
  17763. if (M.isValid()) {
  17764. this.$d = M.$d, this.$L = M.$L, this.init();
  17765. break;
  17766. }
  17767. m === c2 && (this.$d = new Date(""));
  17768. }
  17769. else
  17770. i2.call(this, e3);
  17771. };
  17772. };
  17773. });
  17774. })(customParseFormat$1);
  17775. var customParseFormat = customParseFormat$1.exports;
  17776. const timeUnits$1 = ["hours", "minutes", "seconds"];
  17777. const DEFAULT_FORMATS_TIME = "HH:mm:ss";
  17778. const DEFAULT_FORMATS_DATE = "YYYY-MM-DD";
  17779. const DEFAULT_FORMATS_DATEPICKER = {
  17780. date: DEFAULT_FORMATS_DATE,
  17781. dates: DEFAULT_FORMATS_DATE,
  17782. week: "gggg[w]ww",
  17783. year: "YYYY",
  17784. years: "YYYY",
  17785. month: "YYYY-MM",
  17786. months: "YYYY-MM",
  17787. datetime: `${DEFAULT_FORMATS_DATE} ${DEFAULT_FORMATS_TIME}`,
  17788. monthrange: "YYYY-MM",
  17789. yearrange: "YYYY",
  17790. daterange: DEFAULT_FORMATS_DATE,
  17791. datetimerange: `${DEFAULT_FORMATS_DATE} ${DEFAULT_FORMATS_TIME}`
  17792. };
  17793. const buildTimeList = (value, bound) => {
  17794. return [
  17795. value > 0 ? value - 1 : void 0,
  17796. value,
  17797. value < bound ? value + 1 : void 0
  17798. ];
  17799. };
  17800. const rangeArr = (n) => Array.from(Array.from({ length: n }).keys());
  17801. const extractDateFormat = (format) => {
  17802. return format.replace(/\W?m{1,2}|\W?ZZ/g, "").replace(/\W?h{1,2}|\W?s{1,3}|\W?a/gi, "").trim();
  17803. };
  17804. const extractTimeFormat = (format) => {
  17805. return format.replace(/\W?D{1,2}|\W?Do|\W?d{1,4}|\W?M{1,4}|\W?Y{2,4}/g, "").trim();
  17806. };
  17807. const dateEquals = function(a, b) {
  17808. const aIsDate = isDate$1(a);
  17809. const bIsDate = isDate$1(b);
  17810. if (aIsDate && bIsDate) {
  17811. return a.getTime() === b.getTime();
  17812. }
  17813. if (!aIsDate && !bIsDate) {
  17814. return a === b;
  17815. }
  17816. return false;
  17817. };
  17818. const valueEquals = function(a, b) {
  17819. const aIsArray = isArray$1(a);
  17820. const bIsArray = isArray$1(b);
  17821. if (aIsArray && bIsArray) {
  17822. if (a.length !== b.length) {
  17823. return false;
  17824. }
  17825. return a.every((item, index) => dateEquals(item, b[index]));
  17826. }
  17827. if (!aIsArray && !bIsArray) {
  17828. return dateEquals(a, b);
  17829. }
  17830. return false;
  17831. };
  17832. const parseDate = function(date, format, lang) {
  17833. const day = isEmpty(format) || format === "x" ? dayjs(date).locale(lang) : dayjs(date, format).locale(lang);
  17834. return day.isValid() ? day : void 0;
  17835. };
  17836. const formatter = function(date, format, lang) {
  17837. if (isEmpty(format))
  17838. return date;
  17839. if (format === "x")
  17840. return +date;
  17841. return dayjs(date).locale(lang).format(format);
  17842. };
  17843. const makeList = (total, method) => {
  17844. var _a;
  17845. const arr = [];
  17846. const disabledArr = method == null ? void 0 : method();
  17847. for (let i = 0; i < total; i++) {
  17848. arr.push((_a = disabledArr == null ? void 0 : disabledArr.includes(i)) != null ? _a : false);
  17849. }
  17850. return arr;
  17851. };
  17852. const dayOrDaysToDate = (dayOrDays) => {
  17853. return isArray$1(dayOrDays) ? dayOrDays.map((d) => d.toDate()) : dayOrDays.toDate();
  17854. };
  17855. const disabledTimeListsProps = buildProps({
  17856. disabledHours: {
  17857. type: definePropType(Function)
  17858. },
  17859. disabledMinutes: {
  17860. type: definePropType(Function)
  17861. },
  17862. disabledSeconds: {
  17863. type: definePropType(Function)
  17864. }
  17865. });
  17866. const timePanelSharedProps = buildProps({
  17867. visible: Boolean,
  17868. actualVisible: {
  17869. type: Boolean,
  17870. default: void 0
  17871. },
  17872. format: {
  17873. type: String,
  17874. default: ""
  17875. }
  17876. });
  17877. const timePickerDefaultProps = buildProps({
  17878. id: {
  17879. type: definePropType([Array, String])
  17880. },
  17881. name: {
  17882. type: definePropType([Array, String])
  17883. },
  17884. popperClass: {
  17885. type: String,
  17886. default: ""
  17887. },
  17888. format: String,
  17889. valueFormat: String,
  17890. dateFormat: String,
  17891. timeFormat: String,
  17892. type: {
  17893. type: String,
  17894. default: ""
  17895. },
  17896. clearable: {
  17897. type: Boolean,
  17898. default: true
  17899. },
  17900. clearIcon: {
  17901. type: definePropType([String, Object]),
  17902. default: circle_close_default
  17903. },
  17904. editable: {
  17905. type: Boolean,
  17906. default: true
  17907. },
  17908. prefixIcon: {
  17909. type: definePropType([String, Object]),
  17910. default: ""
  17911. },
  17912. size: useSizeProp,
  17913. readonly: Boolean,
  17914. disabled: Boolean,
  17915. placeholder: {
  17916. type: String,
  17917. default: ""
  17918. },
  17919. popperOptions: {
  17920. type: definePropType(Object),
  17921. default: () => ({})
  17922. },
  17923. modelValue: {
  17924. type: definePropType([Date, Array, String, Number]),
  17925. default: ""
  17926. },
  17927. rangeSeparator: {
  17928. type: String,
  17929. default: "-"
  17930. },
  17931. startPlaceholder: String,
  17932. endPlaceholder: String,
  17933. defaultValue: {
  17934. type: definePropType([Date, Array])
  17935. },
  17936. defaultTime: {
  17937. type: definePropType([Date, Array])
  17938. },
  17939. isRange: Boolean,
  17940. ...disabledTimeListsProps,
  17941. disabledDate: {
  17942. type: Function
  17943. },
  17944. cellClassName: {
  17945. type: Function
  17946. },
  17947. shortcuts: {
  17948. type: Array,
  17949. default: () => []
  17950. },
  17951. arrowControl: Boolean,
  17952. tabindex: {
  17953. type: definePropType([String, Number]),
  17954. default: 0
  17955. },
  17956. validateEvent: {
  17957. type: Boolean,
  17958. default: true
  17959. },
  17960. unlinkPanels: Boolean,
  17961. placement: {
  17962. type: definePropType(String),
  17963. values: Ee,
  17964. default: "bottom"
  17965. },
  17966. fallbackPlacements: {
  17967. type: definePropType(Array),
  17968. default: ["bottom", "top", "right", "left"]
  17969. },
  17970. ...useEmptyValuesProps,
  17971. ...useAriaProps(["ariaLabel"]),
  17972. showNow: {
  17973. type: Boolean,
  17974. default: true
  17975. }
  17976. });
  17977. const timePickerRngeTriggerProps = buildProps({
  17978. id: {
  17979. type: definePropType(Array)
  17980. },
  17981. name: {
  17982. type: definePropType(Array)
  17983. },
  17984. modelValue: {
  17985. type: definePropType([Array, String])
  17986. },
  17987. startPlaceholder: String,
  17988. endPlaceholder: String
  17989. });
  17990. const __default__$1v = vue.defineComponent({
  17991. name: "PickerRangeTrigger",
  17992. inheritAttrs: false
  17993. });
  17994. const _sfc_main$27 = /* @__PURE__ */ vue.defineComponent({
  17995. ...__default__$1v,
  17996. props: timePickerRngeTriggerProps,
  17997. emits: [
  17998. "mouseenter",
  17999. "mouseleave",
  18000. "click",
  18001. "touchstart",
  18002. "focus",
  18003. "blur",
  18004. "startInput",
  18005. "endInput",
  18006. "startChange",
  18007. "endChange"
  18008. ],
  18009. setup(__props, { expose, emit }) {
  18010. const attrs = useAttrs();
  18011. const nsDate = useNamespace("date");
  18012. const nsRange = useNamespace("range");
  18013. const inputRef = vue.ref();
  18014. const endInputRef = vue.ref();
  18015. const { wrapperRef, isFocused } = useFocusController(inputRef);
  18016. const handleClick = (evt) => {
  18017. emit("click", evt);
  18018. };
  18019. const handleMouseEnter = (evt) => {
  18020. emit("mouseenter", evt);
  18021. };
  18022. const handleMouseLeave = (evt) => {
  18023. emit("mouseleave", evt);
  18024. };
  18025. const handleTouchStart = (evt) => {
  18026. emit("mouseenter", evt);
  18027. };
  18028. const handleStartInput = (evt) => {
  18029. emit("startInput", evt);
  18030. };
  18031. const handleEndInput = (evt) => {
  18032. emit("endInput", evt);
  18033. };
  18034. const handleStartChange = (evt) => {
  18035. emit("startChange", evt);
  18036. };
  18037. const handleEndChange = (evt) => {
  18038. emit("endChange", evt);
  18039. };
  18040. const focus = () => {
  18041. var _a;
  18042. (_a = inputRef.value) == null ? void 0 : _a.focus();
  18043. };
  18044. const blur = () => {
  18045. var _a, _b;
  18046. (_a = inputRef.value) == null ? void 0 : _a.blur();
  18047. (_b = endInputRef.value) == null ? void 0 : _b.blur();
  18048. };
  18049. expose({
  18050. focus,
  18051. blur
  18052. });
  18053. return (_ctx, _cache) => {
  18054. return vue.openBlock(), vue.createElementBlock("div", {
  18055. ref_key: "wrapperRef",
  18056. ref: wrapperRef,
  18057. class: vue.normalizeClass([vue.unref(nsDate).is("active", vue.unref(isFocused)), _ctx.$attrs.class]),
  18058. style: vue.normalizeStyle(_ctx.$attrs.style),
  18059. onClick: handleClick,
  18060. onMouseenter: handleMouseEnter,
  18061. onMouseleave: handleMouseLeave,
  18062. onTouchstartPassive: handleTouchStart
  18063. }, [
  18064. vue.renderSlot(_ctx.$slots, "prefix"),
  18065. vue.createElementVNode("input", vue.mergeProps(vue.unref(attrs), {
  18066. id: _ctx.id && _ctx.id[0],
  18067. ref_key: "inputRef",
  18068. ref: inputRef,
  18069. name: _ctx.name && _ctx.name[0],
  18070. placeholder: _ctx.startPlaceholder,
  18071. value: _ctx.modelValue && _ctx.modelValue[0],
  18072. class: vue.unref(nsRange).b("input"),
  18073. onInput: handleStartInput,
  18074. onChange: handleStartChange
  18075. }), null, 16, ["id", "name", "placeholder", "value"]),
  18076. vue.renderSlot(_ctx.$slots, "range-separator"),
  18077. vue.createElementVNode("input", vue.mergeProps(vue.unref(attrs), {
  18078. id: _ctx.id && _ctx.id[1],
  18079. ref_key: "endInputRef",
  18080. ref: endInputRef,
  18081. name: _ctx.name && _ctx.name[1],
  18082. placeholder: _ctx.endPlaceholder,
  18083. value: _ctx.modelValue && _ctx.modelValue[1],
  18084. class: vue.unref(nsRange).b("input"),
  18085. onInput: handleEndInput,
  18086. onChange: handleEndChange
  18087. }), null, 16, ["id", "name", "placeholder", "value"]),
  18088. vue.renderSlot(_ctx.$slots, "suffix")
  18089. ], 38);
  18090. };
  18091. }
  18092. });
  18093. var PickerRangeTrigger = /* @__PURE__ */ _export_sfc(_sfc_main$27, [["__file", "picker-range-trigger.vue"]]);
  18094. const __default__$1u = vue.defineComponent({
  18095. name: "Picker"
  18096. });
  18097. const _sfc_main$26 = /* @__PURE__ */ vue.defineComponent({
  18098. ...__default__$1u,
  18099. props: timePickerDefaultProps,
  18100. emits: [
  18101. "update:modelValue",
  18102. "change",
  18103. "focus",
  18104. "blur",
  18105. "clear",
  18106. "calendar-change",
  18107. "panel-change",
  18108. "visible-change",
  18109. "keydown"
  18110. ],
  18111. setup(__props, { expose, emit }) {
  18112. const props = __props;
  18113. const attrs = vue.useAttrs();
  18114. const { lang } = useLocale();
  18115. const nsDate = useNamespace("date");
  18116. const nsInput = useNamespace("input");
  18117. const nsRange = useNamespace("range");
  18118. const { form, formItem } = useFormItem();
  18119. const elPopperOptions = vue.inject("ElPopperOptions", {});
  18120. const { valueOnClear } = useEmptyValues(props, null);
  18121. const refPopper = vue.ref();
  18122. const inputRef = vue.ref();
  18123. const pickerVisible = vue.ref(false);
  18124. const pickerActualVisible = vue.ref(false);
  18125. const valueOnOpen = vue.ref(null);
  18126. let hasJustTabExitedInput = false;
  18127. const { isFocused, handleFocus, handleBlur } = useFocusController(inputRef, {
  18128. beforeFocus() {
  18129. return props.readonly || pickerDisabled.value;
  18130. },
  18131. afterFocus() {
  18132. pickerVisible.value = true;
  18133. },
  18134. beforeBlur(event) {
  18135. var _a;
  18136. return !hasJustTabExitedInput && ((_a = refPopper.value) == null ? void 0 : _a.isFocusInsideContent(event));
  18137. },
  18138. afterBlur() {
  18139. handleChange();
  18140. pickerVisible.value = false;
  18141. hasJustTabExitedInput = false;
  18142. props.validateEvent && (formItem == null ? void 0 : formItem.validate("blur").catch((err) => debugWarn()));
  18143. }
  18144. });
  18145. const rangeInputKls = vue.computed(() => [
  18146. nsDate.b("editor"),
  18147. nsDate.bm("editor", props.type),
  18148. nsInput.e("wrapper"),
  18149. nsDate.is("disabled", pickerDisabled.value),
  18150. nsDate.is("active", pickerVisible.value),
  18151. nsRange.b("editor"),
  18152. pickerSize ? nsRange.bm("editor", pickerSize.value) : "",
  18153. attrs.class
  18154. ]);
  18155. const clearIconKls = vue.computed(() => [
  18156. nsInput.e("icon"),
  18157. nsRange.e("close-icon"),
  18158. !showClose.value ? nsRange.e("close-icon--hidden") : ""
  18159. ]);
  18160. vue.watch(pickerVisible, (val) => {
  18161. if (!val) {
  18162. userInput.value = null;
  18163. vue.nextTick(() => {
  18164. emitChange(props.modelValue);
  18165. });
  18166. } else {
  18167. vue.nextTick(() => {
  18168. if (val) {
  18169. valueOnOpen.value = props.modelValue;
  18170. }
  18171. });
  18172. }
  18173. });
  18174. const emitChange = (val, isClear) => {
  18175. if (isClear || !valueEquals(val, valueOnOpen.value)) {
  18176. emit("change", val);
  18177. props.validateEvent && (formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn()));
  18178. }
  18179. };
  18180. const emitInput = (input) => {
  18181. if (!valueEquals(props.modelValue, input)) {
  18182. let formatted;
  18183. if (isArray$1(input)) {
  18184. formatted = input.map((item) => formatter(item, props.valueFormat, lang.value));
  18185. } else if (input) {
  18186. formatted = formatter(input, props.valueFormat, lang.value);
  18187. }
  18188. emit("update:modelValue", input ? formatted : input, lang.value);
  18189. }
  18190. };
  18191. const emitKeydown = (e) => {
  18192. emit("keydown", e);
  18193. };
  18194. const refInput = vue.computed(() => {
  18195. if (inputRef.value) {
  18196. return Array.from(inputRef.value.$el.querySelectorAll("input"));
  18197. }
  18198. return [];
  18199. });
  18200. const setSelectionRange = (start, end, pos) => {
  18201. const _inputs = refInput.value;
  18202. if (!_inputs.length)
  18203. return;
  18204. if (!pos || pos === "min") {
  18205. _inputs[0].setSelectionRange(start, end);
  18206. _inputs[0].focus();
  18207. } else if (pos === "max") {
  18208. _inputs[1].setSelectionRange(start, end);
  18209. _inputs[1].focus();
  18210. }
  18211. };
  18212. const onPick = (date = "", visible = false) => {
  18213. pickerVisible.value = visible;
  18214. let result;
  18215. if (isArray$1(date)) {
  18216. result = date.map((_) => _.toDate());
  18217. } else {
  18218. result = date ? date.toDate() : date;
  18219. }
  18220. userInput.value = null;
  18221. emitInput(result);
  18222. };
  18223. const onBeforeShow = () => {
  18224. pickerActualVisible.value = true;
  18225. };
  18226. const onShow = () => {
  18227. emit("visible-change", true);
  18228. };
  18229. const onHide = () => {
  18230. pickerActualVisible.value = false;
  18231. pickerVisible.value = false;
  18232. emit("visible-change", false);
  18233. };
  18234. const handleOpen = () => {
  18235. pickerVisible.value = true;
  18236. };
  18237. const handleClose = () => {
  18238. pickerVisible.value = false;
  18239. };
  18240. const pickerDisabled = vue.computed(() => {
  18241. return props.disabled || (form == null ? void 0 : form.disabled);
  18242. });
  18243. const parsedValue = vue.computed(() => {
  18244. let dayOrDays;
  18245. if (valueIsEmpty.value) {
  18246. if (pickerOptions.value.getDefaultValue) {
  18247. dayOrDays = pickerOptions.value.getDefaultValue();
  18248. }
  18249. } else {
  18250. if (isArray$1(props.modelValue)) {
  18251. dayOrDays = props.modelValue.map((d) => parseDate(d, props.valueFormat, lang.value));
  18252. } else {
  18253. dayOrDays = parseDate(props.modelValue, props.valueFormat, lang.value);
  18254. }
  18255. }
  18256. if (pickerOptions.value.getRangeAvailableTime) {
  18257. const availableResult = pickerOptions.value.getRangeAvailableTime(dayOrDays);
  18258. if (!isEqual$1(availableResult, dayOrDays)) {
  18259. dayOrDays = availableResult;
  18260. if (!valueIsEmpty.value) {
  18261. emitInput(dayOrDaysToDate(dayOrDays));
  18262. }
  18263. }
  18264. }
  18265. if (isArray$1(dayOrDays) && dayOrDays.some((day) => !day)) {
  18266. dayOrDays = [];
  18267. }
  18268. return dayOrDays;
  18269. });
  18270. const displayValue = vue.computed(() => {
  18271. if (!pickerOptions.value.panelReady)
  18272. return "";
  18273. const formattedValue = formatDayjsToString(parsedValue.value);
  18274. if (isArray$1(userInput.value)) {
  18275. return [
  18276. userInput.value[0] || formattedValue && formattedValue[0] || "",
  18277. userInput.value[1] || formattedValue && formattedValue[1] || ""
  18278. ];
  18279. } else if (userInput.value !== null) {
  18280. return userInput.value;
  18281. }
  18282. if (!isTimePicker.value && valueIsEmpty.value)
  18283. return "";
  18284. if (!pickerVisible.value && valueIsEmpty.value)
  18285. return "";
  18286. if (formattedValue) {
  18287. return isDatesPicker.value || isMonthsPicker.value || isYearsPicker.value ? formattedValue.join(", ") : formattedValue;
  18288. }
  18289. return "";
  18290. });
  18291. const isTimeLikePicker = vue.computed(() => props.type.includes("time"));
  18292. const isTimePicker = vue.computed(() => props.type.startsWith("time"));
  18293. const isDatesPicker = vue.computed(() => props.type === "dates");
  18294. const isMonthsPicker = vue.computed(() => props.type === "months");
  18295. const isYearsPicker = vue.computed(() => props.type === "years");
  18296. const triggerIcon = vue.computed(() => props.prefixIcon || (isTimeLikePicker.value ? clock_default : calendar_default));
  18297. const showClose = vue.ref(false);
  18298. const onClearIconClick = (event) => {
  18299. if (props.readonly || pickerDisabled.value)
  18300. return;
  18301. if (showClose.value) {
  18302. event.stopPropagation();
  18303. if (pickerOptions.value.handleClear) {
  18304. pickerOptions.value.handleClear();
  18305. } else {
  18306. emitInput(valueOnClear.value);
  18307. }
  18308. emitChange(valueOnClear.value, true);
  18309. showClose.value = false;
  18310. onHide();
  18311. }
  18312. emit("clear");
  18313. };
  18314. const valueIsEmpty = vue.computed(() => {
  18315. const { modelValue } = props;
  18316. return !modelValue || isArray$1(modelValue) && !modelValue.filter(Boolean).length;
  18317. });
  18318. const onMouseDownInput = async (event) => {
  18319. var _a;
  18320. if (props.readonly || pickerDisabled.value)
  18321. return;
  18322. if (((_a = event.target) == null ? void 0 : _a.tagName) !== "INPUT" || isFocused.value) {
  18323. pickerVisible.value = true;
  18324. }
  18325. };
  18326. const onMouseEnter = () => {
  18327. if (props.readonly || pickerDisabled.value)
  18328. return;
  18329. if (!valueIsEmpty.value && props.clearable) {
  18330. showClose.value = true;
  18331. }
  18332. };
  18333. const onMouseLeave = () => {
  18334. showClose.value = false;
  18335. };
  18336. const onTouchStartInput = (event) => {
  18337. var _a;
  18338. if (props.readonly || pickerDisabled.value)
  18339. return;
  18340. if (((_a = event.touches[0].target) == null ? void 0 : _a.tagName) !== "INPUT" || isFocused.value) {
  18341. pickerVisible.value = true;
  18342. }
  18343. };
  18344. const isRangeInput = vue.computed(() => {
  18345. return props.type.includes("range");
  18346. });
  18347. const pickerSize = useFormSize();
  18348. const popperEl = vue.computed(() => {
  18349. var _a, _b;
  18350. return (_b = (_a = vue.unref(refPopper)) == null ? void 0 : _a.popperRef) == null ? void 0 : _b.contentRef;
  18351. });
  18352. const stophandle = onClickOutside(inputRef, (e) => {
  18353. const unrefedPopperEl = vue.unref(popperEl);
  18354. const inputEl = unrefElement(inputRef);
  18355. if (unrefedPopperEl && (e.target === unrefedPopperEl || e.composedPath().includes(unrefedPopperEl)) || e.target === inputEl || inputEl && e.composedPath().includes(inputEl))
  18356. return;
  18357. pickerVisible.value = false;
  18358. });
  18359. vue.onBeforeUnmount(() => {
  18360. stophandle == null ? void 0 : stophandle();
  18361. });
  18362. const userInput = vue.ref(null);
  18363. const handleChange = () => {
  18364. if (userInput.value) {
  18365. const value = parseUserInputToDayjs(displayValue.value);
  18366. if (value) {
  18367. if (isValidValue(value)) {
  18368. emitInput(dayOrDaysToDate(value));
  18369. userInput.value = null;
  18370. }
  18371. }
  18372. }
  18373. if (userInput.value === "") {
  18374. emitInput(valueOnClear.value);
  18375. emitChange(valueOnClear.value);
  18376. userInput.value = null;
  18377. }
  18378. };
  18379. const parseUserInputToDayjs = (value) => {
  18380. if (!value)
  18381. return null;
  18382. return pickerOptions.value.parseUserInput(value);
  18383. };
  18384. const formatDayjsToString = (value) => {
  18385. if (!value)
  18386. return null;
  18387. return pickerOptions.value.formatToString(value);
  18388. };
  18389. const isValidValue = (value) => {
  18390. return pickerOptions.value.isValidValue(value);
  18391. };
  18392. const handleKeydownInput = async (event) => {
  18393. if (props.readonly || pickerDisabled.value)
  18394. return;
  18395. const { code } = event;
  18396. emitKeydown(event);
  18397. if (code === EVENT_CODE.esc) {
  18398. if (pickerVisible.value === true) {
  18399. pickerVisible.value = false;
  18400. event.preventDefault();
  18401. event.stopPropagation();
  18402. }
  18403. return;
  18404. }
  18405. if (code === EVENT_CODE.down) {
  18406. if (pickerOptions.value.handleFocusPicker) {
  18407. event.preventDefault();
  18408. event.stopPropagation();
  18409. }
  18410. if (pickerVisible.value === false) {
  18411. pickerVisible.value = true;
  18412. await vue.nextTick();
  18413. }
  18414. if (pickerOptions.value.handleFocusPicker) {
  18415. pickerOptions.value.handleFocusPicker();
  18416. return;
  18417. }
  18418. }
  18419. if (code === EVENT_CODE.tab) {
  18420. hasJustTabExitedInput = true;
  18421. return;
  18422. }
  18423. if (code === EVENT_CODE.enter || code === EVENT_CODE.numpadEnter) {
  18424. if (userInput.value === null || userInput.value === "" || isValidValue(parseUserInputToDayjs(displayValue.value))) {
  18425. handleChange();
  18426. pickerVisible.value = false;
  18427. }
  18428. event.stopPropagation();
  18429. return;
  18430. }
  18431. if (userInput.value) {
  18432. event.stopPropagation();
  18433. return;
  18434. }
  18435. if (pickerOptions.value.handleKeydownInput) {
  18436. pickerOptions.value.handleKeydownInput(event);
  18437. }
  18438. };
  18439. const onUserInput = (e) => {
  18440. userInput.value = e;
  18441. if (!pickerVisible.value) {
  18442. pickerVisible.value = true;
  18443. }
  18444. };
  18445. const handleStartInput = (event) => {
  18446. const target = event.target;
  18447. if (userInput.value) {
  18448. userInput.value = [target.value, userInput.value[1]];
  18449. } else {
  18450. userInput.value = [target.value, null];
  18451. }
  18452. };
  18453. const handleEndInput = (event) => {
  18454. const target = event.target;
  18455. if (userInput.value) {
  18456. userInput.value = [userInput.value[0], target.value];
  18457. } else {
  18458. userInput.value = [null, target.value];
  18459. }
  18460. };
  18461. const handleStartChange = () => {
  18462. var _a;
  18463. const values = userInput.value;
  18464. const value = parseUserInputToDayjs(values && values[0]);
  18465. const parsedVal = vue.unref(parsedValue);
  18466. if (value && value.isValid()) {
  18467. userInput.value = [
  18468. formatDayjsToString(value),
  18469. ((_a = displayValue.value) == null ? void 0 : _a[1]) || null
  18470. ];
  18471. const newValue = [value, parsedVal && (parsedVal[1] || null)];
  18472. if (isValidValue(newValue)) {
  18473. emitInput(dayOrDaysToDate(newValue));
  18474. userInput.value = null;
  18475. }
  18476. }
  18477. };
  18478. const handleEndChange = () => {
  18479. var _a;
  18480. const values = vue.unref(userInput);
  18481. const value = parseUserInputToDayjs(values && values[1]);
  18482. const parsedVal = vue.unref(parsedValue);
  18483. if (value && value.isValid()) {
  18484. userInput.value = [
  18485. ((_a = vue.unref(displayValue)) == null ? void 0 : _a[0]) || null,
  18486. formatDayjsToString(value)
  18487. ];
  18488. const newValue = [parsedVal && parsedVal[0], value];
  18489. if (isValidValue(newValue)) {
  18490. emitInput(dayOrDaysToDate(newValue));
  18491. userInput.value = null;
  18492. }
  18493. }
  18494. };
  18495. const pickerOptions = vue.ref({});
  18496. const onSetPickerOption = (e) => {
  18497. pickerOptions.value[e[0]] = e[1];
  18498. pickerOptions.value.panelReady = true;
  18499. };
  18500. const onCalendarChange = (e) => {
  18501. emit("calendar-change", e);
  18502. };
  18503. const onPanelChange = (value, mode, view) => {
  18504. emit("panel-change", value, mode, view);
  18505. };
  18506. const focus = () => {
  18507. var _a;
  18508. (_a = inputRef.value) == null ? void 0 : _a.focus();
  18509. };
  18510. const blur = () => {
  18511. var _a;
  18512. (_a = inputRef.value) == null ? void 0 : _a.blur();
  18513. };
  18514. vue.provide("EP_PICKER_BASE", {
  18515. props
  18516. });
  18517. expose({
  18518. focus,
  18519. blur,
  18520. handleOpen,
  18521. handleClose,
  18522. onPick
  18523. });
  18524. return (_ctx, _cache) => {
  18525. return vue.openBlock(), vue.createBlock(vue.unref(ElTooltip), vue.mergeProps({
  18526. ref_key: "refPopper",
  18527. ref: refPopper,
  18528. visible: pickerVisible.value,
  18529. effect: "light",
  18530. pure: "",
  18531. trigger: "click"
  18532. }, _ctx.$attrs, {
  18533. role: "dialog",
  18534. teleported: "",
  18535. transition: `${vue.unref(nsDate).namespace.value}-zoom-in-top`,
  18536. "popper-class": [`${vue.unref(nsDate).namespace.value}-picker__popper`, _ctx.popperClass],
  18537. "popper-options": vue.unref(elPopperOptions),
  18538. "fallback-placements": _ctx.fallbackPlacements,
  18539. "gpu-acceleration": false,
  18540. placement: _ctx.placement,
  18541. "stop-popper-mouse-event": false,
  18542. "hide-after": 0,
  18543. persistent: "",
  18544. onBeforeShow,
  18545. onShow,
  18546. onHide
  18547. }), {
  18548. default: vue.withCtx(() => [
  18549. !vue.unref(isRangeInput) ? (vue.openBlock(), vue.createBlock(vue.unref(ElInput), {
  18550. key: 0,
  18551. id: _ctx.id,
  18552. ref_key: "inputRef",
  18553. ref: inputRef,
  18554. "container-role": "combobox",
  18555. "model-value": vue.unref(displayValue),
  18556. name: _ctx.name,
  18557. size: vue.unref(pickerSize),
  18558. disabled: vue.unref(pickerDisabled),
  18559. placeholder: _ctx.placeholder,
  18560. class: vue.normalizeClass([vue.unref(nsDate).b("editor"), vue.unref(nsDate).bm("editor", _ctx.type), _ctx.$attrs.class]),
  18561. style: vue.normalizeStyle(_ctx.$attrs.style),
  18562. readonly: !_ctx.editable || _ctx.readonly || vue.unref(isDatesPicker) || vue.unref(isMonthsPicker) || vue.unref(isYearsPicker) || _ctx.type === "week",
  18563. "aria-label": _ctx.ariaLabel,
  18564. tabindex: _ctx.tabindex,
  18565. "validate-event": false,
  18566. onInput: onUserInput,
  18567. onFocus: vue.unref(handleFocus),
  18568. onBlur: vue.unref(handleBlur),
  18569. onKeydown: handleKeydownInput,
  18570. onChange: handleChange,
  18571. onMousedown: onMouseDownInput,
  18572. onMouseenter: onMouseEnter,
  18573. onMouseleave: onMouseLeave,
  18574. onTouchstartPassive: onTouchStartInput,
  18575. onClick: vue.withModifiers(() => {
  18576. }, ["stop"])
  18577. }, {
  18578. prefix: vue.withCtx(() => [
  18579. vue.unref(triggerIcon) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  18580. key: 0,
  18581. class: vue.normalizeClass(vue.unref(nsInput).e("icon")),
  18582. onMousedown: vue.withModifiers(onMouseDownInput, ["prevent"]),
  18583. onTouchstartPassive: onTouchStartInput
  18584. }, {
  18585. default: vue.withCtx(() => [
  18586. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(triggerIcon))))
  18587. ]),
  18588. _: 1
  18589. }, 8, ["class", "onMousedown"])) : vue.createCommentVNode("v-if", true)
  18590. ]),
  18591. suffix: vue.withCtx(() => [
  18592. showClose.value && _ctx.clearIcon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  18593. key: 0,
  18594. class: vue.normalizeClass(`${vue.unref(nsInput).e("icon")} clear-icon`),
  18595. onMousedown: vue.withModifiers(vue.unref(NOOP), ["prevent"]),
  18596. onClick: onClearIconClick
  18597. }, {
  18598. default: vue.withCtx(() => [
  18599. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.clearIcon)))
  18600. ]),
  18601. _: 1
  18602. }, 8, ["class", "onMousedown"])) : vue.createCommentVNode("v-if", true)
  18603. ]),
  18604. _: 1
  18605. }, 8, ["id", "model-value", "name", "size", "disabled", "placeholder", "class", "style", "readonly", "aria-label", "tabindex", "onFocus", "onBlur", "onClick"])) : (vue.openBlock(), vue.createBlock(PickerRangeTrigger, {
  18606. key: 1,
  18607. id: _ctx.id,
  18608. ref_key: "inputRef",
  18609. ref: inputRef,
  18610. "model-value": vue.unref(displayValue),
  18611. name: _ctx.name,
  18612. disabled: vue.unref(pickerDisabled),
  18613. readonly: !_ctx.editable || _ctx.readonly,
  18614. "start-placeholder": _ctx.startPlaceholder,
  18615. "end-placeholder": _ctx.endPlaceholder,
  18616. class: vue.normalizeClass(vue.unref(rangeInputKls)),
  18617. style: vue.normalizeStyle(_ctx.$attrs.style),
  18618. "aria-label": _ctx.ariaLabel,
  18619. tabindex: _ctx.tabindex,
  18620. autocomplete: "off",
  18621. role: "combobox",
  18622. onClick: onMouseDownInput,
  18623. onFocus: vue.unref(handleFocus),
  18624. onBlur: vue.unref(handleBlur),
  18625. onStartInput: handleStartInput,
  18626. onStartChange: handleStartChange,
  18627. onEndInput: handleEndInput,
  18628. onEndChange: handleEndChange,
  18629. onMousedown: onMouseDownInput,
  18630. onMouseenter: onMouseEnter,
  18631. onMouseleave: onMouseLeave,
  18632. onTouchstartPassive: onTouchStartInput,
  18633. onKeydown: handleKeydownInput
  18634. }, {
  18635. prefix: vue.withCtx(() => [
  18636. vue.unref(triggerIcon) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  18637. key: 0,
  18638. class: vue.normalizeClass([vue.unref(nsInput).e("icon"), vue.unref(nsRange).e("icon")])
  18639. }, {
  18640. default: vue.withCtx(() => [
  18641. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(triggerIcon))))
  18642. ]),
  18643. _: 1
  18644. }, 8, ["class"])) : vue.createCommentVNode("v-if", true)
  18645. ]),
  18646. "range-separator": vue.withCtx(() => [
  18647. vue.renderSlot(_ctx.$slots, "range-separator", {}, () => [
  18648. vue.createElementVNode("span", {
  18649. class: vue.normalizeClass(vue.unref(nsRange).b("separator"))
  18650. }, vue.toDisplayString(_ctx.rangeSeparator), 3)
  18651. ])
  18652. ]),
  18653. suffix: vue.withCtx(() => [
  18654. _ctx.clearIcon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  18655. key: 0,
  18656. class: vue.normalizeClass(vue.unref(clearIconKls)),
  18657. onMousedown: vue.withModifiers(vue.unref(NOOP), ["prevent"]),
  18658. onClick: onClearIconClick
  18659. }, {
  18660. default: vue.withCtx(() => [
  18661. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.clearIcon)))
  18662. ]),
  18663. _: 1
  18664. }, 8, ["class", "onMousedown"])) : vue.createCommentVNode("v-if", true)
  18665. ]),
  18666. _: 3
  18667. }, 8, ["id", "model-value", "name", "disabled", "readonly", "start-placeholder", "end-placeholder", "class", "style", "aria-label", "tabindex", "onFocus", "onBlur"]))
  18668. ]),
  18669. content: vue.withCtx(() => [
  18670. vue.renderSlot(_ctx.$slots, "default", {
  18671. visible: pickerVisible.value,
  18672. actualVisible: pickerActualVisible.value,
  18673. parsedValue: vue.unref(parsedValue),
  18674. format: _ctx.format,
  18675. dateFormat: _ctx.dateFormat,
  18676. timeFormat: _ctx.timeFormat,
  18677. unlinkPanels: _ctx.unlinkPanels,
  18678. type: _ctx.type,
  18679. defaultValue: _ctx.defaultValue,
  18680. showNow: _ctx.showNow,
  18681. onPick,
  18682. onSelectRange: setSelectionRange,
  18683. onSetPickerOption,
  18684. onCalendarChange,
  18685. onPanelChange,
  18686. onMousedown: vue.withModifiers(() => {
  18687. }, ["stop"])
  18688. })
  18689. ]),
  18690. _: 3
  18691. }, 16, ["visible", "transition", "popper-class", "popper-options", "fallback-placements", "placement"]);
  18692. };
  18693. }
  18694. });
  18695. var CommonPicker = /* @__PURE__ */ _export_sfc(_sfc_main$26, [["__file", "picker.vue"]]);
  18696. const panelTimePickerProps = buildProps({
  18697. ...timePanelSharedProps,
  18698. datetimeRole: String,
  18699. parsedValue: {
  18700. type: definePropType(Object)
  18701. }
  18702. });
  18703. const useTimePanel = ({
  18704. getAvailableHours,
  18705. getAvailableMinutes,
  18706. getAvailableSeconds
  18707. }) => {
  18708. const getAvailableTime = (date, role, first, compareDate) => {
  18709. const availableTimeGetters = {
  18710. hour: getAvailableHours,
  18711. minute: getAvailableMinutes,
  18712. second: getAvailableSeconds
  18713. };
  18714. let result = date;
  18715. ["hour", "minute", "second"].forEach((type) => {
  18716. if (availableTimeGetters[type]) {
  18717. let availableTimeSlots;
  18718. const method = availableTimeGetters[type];
  18719. switch (type) {
  18720. case "minute": {
  18721. availableTimeSlots = method(result.hour(), role, compareDate);
  18722. break;
  18723. }
  18724. case "second": {
  18725. availableTimeSlots = method(result.hour(), result.minute(), role, compareDate);
  18726. break;
  18727. }
  18728. default: {
  18729. availableTimeSlots = method(role, compareDate);
  18730. break;
  18731. }
  18732. }
  18733. if ((availableTimeSlots == null ? void 0 : availableTimeSlots.length) && !availableTimeSlots.includes(result[type]())) {
  18734. const pos = first ? 0 : availableTimeSlots.length - 1;
  18735. result = result[type](availableTimeSlots[pos]);
  18736. }
  18737. }
  18738. });
  18739. return result;
  18740. };
  18741. const timePickerOptions = {};
  18742. const onSetOption = ([key, val]) => {
  18743. timePickerOptions[key] = val;
  18744. };
  18745. return {
  18746. timePickerOptions,
  18747. getAvailableTime,
  18748. onSetOption
  18749. };
  18750. };
  18751. const makeAvailableArr = (disabledList) => {
  18752. const trueOrNumber = (isDisabled, index) => isDisabled || index;
  18753. const getNumber = (predicate) => predicate !== true;
  18754. return disabledList.map(trueOrNumber).filter(getNumber);
  18755. };
  18756. const getTimeLists = (disabledHours, disabledMinutes, disabledSeconds) => {
  18757. const getHoursList = (role, compare) => {
  18758. return makeList(24, disabledHours && (() => disabledHours == null ? void 0 : disabledHours(role, compare)));
  18759. };
  18760. const getMinutesList = (hour, role, compare) => {
  18761. return makeList(60, disabledMinutes && (() => disabledMinutes == null ? void 0 : disabledMinutes(hour, role, compare)));
  18762. };
  18763. const getSecondsList = (hour, minute, role, compare) => {
  18764. return makeList(60, disabledSeconds && (() => disabledSeconds == null ? void 0 : disabledSeconds(hour, minute, role, compare)));
  18765. };
  18766. return {
  18767. getHoursList,
  18768. getMinutesList,
  18769. getSecondsList
  18770. };
  18771. };
  18772. const buildAvailableTimeSlotGetter = (disabledHours, disabledMinutes, disabledSeconds) => {
  18773. const { getHoursList, getMinutesList, getSecondsList } = getTimeLists(disabledHours, disabledMinutes, disabledSeconds);
  18774. const getAvailableHours = (role, compare) => {
  18775. return makeAvailableArr(getHoursList(role, compare));
  18776. };
  18777. const getAvailableMinutes = (hour, role, compare) => {
  18778. return makeAvailableArr(getMinutesList(hour, role, compare));
  18779. };
  18780. const getAvailableSeconds = (hour, minute, role, compare) => {
  18781. return makeAvailableArr(getSecondsList(hour, minute, role, compare));
  18782. };
  18783. return {
  18784. getAvailableHours,
  18785. getAvailableMinutes,
  18786. getAvailableSeconds
  18787. };
  18788. };
  18789. const useOldValue = (props) => {
  18790. const oldValue = vue.ref(props.parsedValue);
  18791. vue.watch(() => props.visible, (val) => {
  18792. if (!val) {
  18793. oldValue.value = props.parsedValue;
  18794. }
  18795. });
  18796. return oldValue;
  18797. };
  18798. const nodeList = /* @__PURE__ */ new Map();
  18799. if (isClient) {
  18800. let startClick;
  18801. document.addEventListener("mousedown", (e) => startClick = e);
  18802. document.addEventListener("mouseup", (e) => {
  18803. if (startClick) {
  18804. for (const handlers of nodeList.values()) {
  18805. for (const { documentHandler } of handlers) {
  18806. documentHandler(e, startClick);
  18807. }
  18808. }
  18809. startClick = void 0;
  18810. }
  18811. });
  18812. }
  18813. function createDocumentHandler(el, binding) {
  18814. let excludes = [];
  18815. if (isArray$1(binding.arg)) {
  18816. excludes = binding.arg;
  18817. } else if (isElement$1(binding.arg)) {
  18818. excludes.push(binding.arg);
  18819. }
  18820. return function(mouseup, mousedown) {
  18821. const popperRef = binding.instance.popperRef;
  18822. const mouseUpTarget = mouseup.target;
  18823. const mouseDownTarget = mousedown == null ? void 0 : mousedown.target;
  18824. const isBound = !binding || !binding.instance;
  18825. const isTargetExists = !mouseUpTarget || !mouseDownTarget;
  18826. const isContainedByEl = el.contains(mouseUpTarget) || el.contains(mouseDownTarget);
  18827. const isSelf = el === mouseUpTarget;
  18828. const isTargetExcluded = excludes.length && excludes.some((item) => item == null ? void 0 : item.contains(mouseUpTarget)) || excludes.length && excludes.includes(mouseDownTarget);
  18829. const isContainedByPopper = popperRef && (popperRef.contains(mouseUpTarget) || popperRef.contains(mouseDownTarget));
  18830. if (isBound || isTargetExists || isContainedByEl || isSelf || isTargetExcluded || isContainedByPopper) {
  18831. return;
  18832. }
  18833. binding.value(mouseup, mousedown);
  18834. };
  18835. }
  18836. const ClickOutside = {
  18837. beforeMount(el, binding) {
  18838. if (!nodeList.has(el)) {
  18839. nodeList.set(el, []);
  18840. }
  18841. nodeList.get(el).push({
  18842. documentHandler: createDocumentHandler(el, binding),
  18843. bindingFn: binding.value
  18844. });
  18845. },
  18846. updated(el, binding) {
  18847. if (!nodeList.has(el)) {
  18848. nodeList.set(el, []);
  18849. }
  18850. const handlers = nodeList.get(el);
  18851. const oldHandlerIndex = handlers.findIndex((item) => item.bindingFn === binding.oldValue);
  18852. const newHandler = {
  18853. documentHandler: createDocumentHandler(el, binding),
  18854. bindingFn: binding.value
  18855. };
  18856. if (oldHandlerIndex >= 0) {
  18857. handlers.splice(oldHandlerIndex, 1, newHandler);
  18858. } else {
  18859. handlers.push(newHandler);
  18860. }
  18861. },
  18862. unmounted(el) {
  18863. nodeList.delete(el);
  18864. }
  18865. };
  18866. const REPEAT_INTERVAL = 100;
  18867. const REPEAT_DELAY = 600;
  18868. const vRepeatClick = {
  18869. beforeMount(el, binding) {
  18870. const value = binding.value;
  18871. const { interval = REPEAT_INTERVAL, delay = REPEAT_DELAY } = isFunction$1(value) ? {} : value;
  18872. let intervalId;
  18873. let delayId;
  18874. const handler = () => isFunction$1(value) ? value() : value.handler();
  18875. const clear = () => {
  18876. if (delayId) {
  18877. clearTimeout(delayId);
  18878. delayId = void 0;
  18879. }
  18880. if (intervalId) {
  18881. clearInterval(intervalId);
  18882. intervalId = void 0;
  18883. }
  18884. };
  18885. el.addEventListener("mousedown", (evt) => {
  18886. if (evt.button !== 0)
  18887. return;
  18888. clear();
  18889. handler();
  18890. document.addEventListener("mouseup", () => clear(), {
  18891. once: true
  18892. });
  18893. delayId = setTimeout(() => {
  18894. intervalId = setInterval(() => {
  18895. handler();
  18896. }, interval);
  18897. }, delay);
  18898. });
  18899. }
  18900. };
  18901. const FOCUSABLE_CHILDREN = "_trap-focus-children";
  18902. const FOCUS_STACK = [];
  18903. const FOCUS_HANDLER = (e) => {
  18904. if (FOCUS_STACK.length === 0)
  18905. return;
  18906. const focusableElement = FOCUS_STACK[FOCUS_STACK.length - 1][FOCUSABLE_CHILDREN];
  18907. if (focusableElement.length > 0 && e.code === EVENT_CODE.tab) {
  18908. if (focusableElement.length === 1) {
  18909. e.preventDefault();
  18910. if (document.activeElement !== focusableElement[0]) {
  18911. focusableElement[0].focus();
  18912. }
  18913. return;
  18914. }
  18915. const goingBackward = e.shiftKey;
  18916. const isFirst = e.target === focusableElement[0];
  18917. const isLast = e.target === focusableElement[focusableElement.length - 1];
  18918. if (isFirst && goingBackward) {
  18919. e.preventDefault();
  18920. focusableElement[focusableElement.length - 1].focus();
  18921. }
  18922. if (isLast && !goingBackward) {
  18923. e.preventDefault();
  18924. focusableElement[0].focus();
  18925. }
  18926. }
  18927. };
  18928. const TrapFocus = {
  18929. beforeMount(el) {
  18930. el[FOCUSABLE_CHILDREN] = obtainAllFocusableElements$1(el);
  18931. FOCUS_STACK.push(el);
  18932. if (FOCUS_STACK.length <= 1) {
  18933. document.addEventListener("keydown", FOCUS_HANDLER);
  18934. }
  18935. },
  18936. updated(el) {
  18937. vue.nextTick(() => {
  18938. el[FOCUSABLE_CHILDREN] = obtainAllFocusableElements$1(el);
  18939. });
  18940. },
  18941. unmounted() {
  18942. FOCUS_STACK.shift();
  18943. if (FOCUS_STACK.length === 0) {
  18944. document.removeEventListener("keydown", FOCUS_HANDLER);
  18945. }
  18946. }
  18947. };
  18948. var v=!1,o,f,s,u,d,N,l,p,m,w,D,x,E,M,F;function a(){if(!v){v=!0;var e=navigator.userAgent,n=/(?:MSIE.(\d+\.\d+))|(?:(?:Firefox|GranParadiso|Iceweasel).(\d+\.\d+))|(?:Opera(?:.+Version.|.)(\d+\.\d+))|(?:AppleWebKit.(\d+(?:\.\d+)?))|(?:Trident\/\d+\.\d+.*rv:(\d+\.\d+))/.exec(e),i=/(Mac OS X)|(Windows)|(Linux)/.exec(e);if(x=/\b(iPhone|iP[ao]d)/.exec(e),E=/\b(iP[ao]d)/.exec(e),w=/Android/i.exec(e),M=/FBAN\/\w+;/i.exec(e),F=/Mobile/i.exec(e),D=!!/Win64/.exec(e),n){o=n[1]?parseFloat(n[1]):n[5]?parseFloat(n[5]):NaN,o&&document&&document.documentMode&&(o=document.documentMode);var r=/(?:Trident\/(\d+.\d+))/.exec(e);N=r?parseFloat(r[1])+4:o,f=n[2]?parseFloat(n[2]):NaN,s=n[3]?parseFloat(n[3]):NaN,u=n[4]?parseFloat(n[4]):NaN,u?(n=/(?:Chrome\/(\d+\.\d+))/.exec(e),d=n&&n[1]?parseFloat(n[1]):NaN):d=NaN;}else o=f=s=d=u=NaN;if(i){if(i[1]){var t=/(?:Mac OS X (\d+(?:[._]\d+)?))/.exec(e);l=t?parseFloat(t[1].replace("_",".")):!0;}else l=!1;p=!!i[2],m=!!i[3];}else l=p=m=!1;}}var _={ie:function(){return a()||o},ieCompatibilityMode:function(){return a()||N>o},ie64:function(){return _.ie()&&D},firefox:function(){return a()||f},opera:function(){return a()||s},webkit:function(){return a()||u},safari:function(){return _.webkit()},chrome:function(){return a()||d},windows:function(){return a()||p},osx:function(){return a()||l},linux:function(){return a()||m},iphone:function(){return a()||x},mobile:function(){return a()||x||E||w||F},nativeApp:function(){return a()||M},android:function(){return a()||w},ipad:function(){return a()||E}},A=_;var c=!!(typeof window<"u"&&window.document&&window.document.createElement),U={canUseDOM:c,canUseWorkers:typeof Worker<"u",canUseEventListeners:c&&!!(window.addEventListener||window.attachEvent),canUseViewport:c&&!!window.screen,isInWorker:!c},h=U;var X;h.canUseDOM&&(X=document.implementation&&document.implementation.hasFeature&&document.implementation.hasFeature("","")!==!0);function S(e,n){if(!h.canUseDOM||n&&!("addEventListener"in document))return !1;var i="on"+e,r=i in document;if(!r){var t=document.createElement("div");t.setAttribute(i,"return;"),r=typeof t[i]=="function";}return !r&&X&&e==="wheel"&&(r=document.implementation.hasFeature("Events.wheel","3.0")),r}var b=S;var O=10,I=40,P=800;function T(e){var n=0,i=0,r=0,t=0;return "detail"in e&&(i=e.detail),"wheelDelta"in e&&(i=-e.wheelDelta/120),"wheelDeltaY"in e&&(i=-e.wheelDeltaY/120),"wheelDeltaX"in e&&(n=-e.wheelDeltaX/120),"axis"in e&&e.axis===e.HORIZONTAL_AXIS&&(n=i,i=0),r=n*O,t=i*O,"deltaY"in e&&(t=e.deltaY),"deltaX"in e&&(r=e.deltaX),(r||t)&&e.deltaMode&&(e.deltaMode==1?(r*=I,t*=I):(r*=P,t*=P)),r&&!n&&(n=r<1?-1:1),t&&!i&&(i=t<1?-1:1),{spinX:n,spinY:i,pixelX:r,pixelY:t}}T.getEventType=function(){return A.firefox()?"DOMMouseScroll":b("wheel")?"wheel":"mousewheel"};var Y=T;/**
  18949. * Checks if an event is supported in the current execution environment.
  18950. *
  18951. * NOTE: This will not work correctly for non-generic events such as `change`,
  18952. * `reset`, `load`, `error`, and `select`.
  18953. *
  18954. * Borrows from Modernizr.
  18955. *
  18956. * @param {string} eventNameSuffix Event name, e.g. "click".
  18957. * @param {?boolean} capture Check if the capture phase is supported.
  18958. * @return {boolean} True if the event is supported.
  18959. * @internal
  18960. * @license Modernizr 3.0.0pre (Custom Build) | MIT
  18961. */
  18962. const mousewheel = function(element, callback) {
  18963. if (element && element.addEventListener) {
  18964. const fn = function(event) {
  18965. const normalized = Y(event);
  18966. callback && Reflect.apply(callback, this, [event, normalized]);
  18967. };
  18968. element.addEventListener("wheel", fn, { passive: true });
  18969. }
  18970. };
  18971. const Mousewheel = {
  18972. beforeMount(el, binding) {
  18973. mousewheel(el, binding.value);
  18974. }
  18975. };
  18976. const basicTimeSpinnerProps = buildProps({
  18977. role: {
  18978. type: String,
  18979. required: true
  18980. },
  18981. spinnerDate: {
  18982. type: definePropType(Object),
  18983. required: true
  18984. },
  18985. showSeconds: {
  18986. type: Boolean,
  18987. default: true
  18988. },
  18989. arrowControl: Boolean,
  18990. amPmMode: {
  18991. type: definePropType(String),
  18992. default: ""
  18993. },
  18994. ...disabledTimeListsProps
  18995. });
  18996. const _sfc_main$25 = /* @__PURE__ */ vue.defineComponent({
  18997. __name: "basic-time-spinner",
  18998. props: basicTimeSpinnerProps,
  18999. emits: ["change", "select-range", "set-option"],
  19000. setup(__props, { emit }) {
  19001. const props = __props;
  19002. const pickerBase = vue.inject("EP_PICKER_BASE");
  19003. const { isRange } = pickerBase.props;
  19004. const ns = useNamespace("time");
  19005. const { getHoursList, getMinutesList, getSecondsList } = getTimeLists(props.disabledHours, props.disabledMinutes, props.disabledSeconds);
  19006. let isScrolling = false;
  19007. const currentScrollbar = vue.ref();
  19008. const listHoursRef = vue.ref();
  19009. const listMinutesRef = vue.ref();
  19010. const listSecondsRef = vue.ref();
  19011. const listRefsMap = {
  19012. hours: listHoursRef,
  19013. minutes: listMinutesRef,
  19014. seconds: listSecondsRef
  19015. };
  19016. const spinnerItems = vue.computed(() => {
  19017. return props.showSeconds ? timeUnits$1 : timeUnits$1.slice(0, 2);
  19018. });
  19019. const timePartials = vue.computed(() => {
  19020. const { spinnerDate } = props;
  19021. const hours = spinnerDate.hour();
  19022. const minutes = spinnerDate.minute();
  19023. const seconds = spinnerDate.second();
  19024. return { hours, minutes, seconds };
  19025. });
  19026. const timeList = vue.computed(() => {
  19027. const { hours, minutes } = vue.unref(timePartials);
  19028. const { role, spinnerDate } = props;
  19029. const compare = !isRange ? spinnerDate : void 0;
  19030. return {
  19031. hours: getHoursList(role, compare),
  19032. minutes: getMinutesList(hours, role, compare),
  19033. seconds: getSecondsList(hours, minutes, role, compare)
  19034. };
  19035. });
  19036. const arrowControlTimeList = vue.computed(() => {
  19037. const { hours, minutes, seconds } = vue.unref(timePartials);
  19038. return {
  19039. hours: buildTimeList(hours, 23),
  19040. minutes: buildTimeList(minutes, 59),
  19041. seconds: buildTimeList(seconds, 59)
  19042. };
  19043. });
  19044. const debouncedResetScroll = debounce((type) => {
  19045. isScrolling = false;
  19046. adjustCurrentSpinner(type);
  19047. }, 200);
  19048. const getAmPmFlag = (hour) => {
  19049. const shouldShowAmPm = !!props.amPmMode;
  19050. if (!shouldShowAmPm)
  19051. return "";
  19052. const isCapital = props.amPmMode === "A";
  19053. let content = hour < 12 ? " am" : " pm";
  19054. if (isCapital)
  19055. content = content.toUpperCase();
  19056. return content;
  19057. };
  19058. const emitSelectRange = (type) => {
  19059. let range;
  19060. switch (type) {
  19061. case "hours":
  19062. range = [0, 2];
  19063. break;
  19064. case "minutes":
  19065. range = [3, 5];
  19066. break;
  19067. case "seconds":
  19068. range = [6, 8];
  19069. break;
  19070. }
  19071. const [left, right] = range;
  19072. emit("select-range", left, right);
  19073. currentScrollbar.value = type;
  19074. };
  19075. const adjustCurrentSpinner = (type) => {
  19076. adjustSpinner(type, vue.unref(timePartials)[type]);
  19077. };
  19078. const adjustSpinners = () => {
  19079. adjustCurrentSpinner("hours");
  19080. adjustCurrentSpinner("minutes");
  19081. adjustCurrentSpinner("seconds");
  19082. };
  19083. const getScrollbarElement = (el) => el.querySelector(`.${ns.namespace.value}-scrollbar__wrap`);
  19084. const adjustSpinner = (type, value) => {
  19085. if (props.arrowControl)
  19086. return;
  19087. const scrollbar = vue.unref(listRefsMap[type]);
  19088. if (scrollbar && scrollbar.$el) {
  19089. getScrollbarElement(scrollbar.$el).scrollTop = Math.max(0, value * typeItemHeight(type));
  19090. }
  19091. };
  19092. const typeItemHeight = (type) => {
  19093. const scrollbar = vue.unref(listRefsMap[type]);
  19094. const listItem = scrollbar == null ? void 0 : scrollbar.$el.querySelector("li");
  19095. if (listItem) {
  19096. return Number.parseFloat(getStyle(listItem, "height")) || 0;
  19097. }
  19098. return 0;
  19099. };
  19100. const onIncrement = () => {
  19101. scrollDown(1);
  19102. };
  19103. const onDecrement = () => {
  19104. scrollDown(-1);
  19105. };
  19106. const scrollDown = (step) => {
  19107. if (!currentScrollbar.value) {
  19108. emitSelectRange("hours");
  19109. }
  19110. const label = currentScrollbar.value;
  19111. const now = vue.unref(timePartials)[label];
  19112. const total = currentScrollbar.value === "hours" ? 24 : 60;
  19113. const next = findNextUnDisabled(label, now, step, total);
  19114. modifyDateField(label, next);
  19115. adjustSpinner(label, next);
  19116. vue.nextTick(() => emitSelectRange(label));
  19117. };
  19118. const findNextUnDisabled = (type, now, step, total) => {
  19119. let next = (now + step + total) % total;
  19120. const list = vue.unref(timeList)[type];
  19121. while (list[next] && next !== now) {
  19122. next = (next + step + total) % total;
  19123. }
  19124. return next;
  19125. };
  19126. const modifyDateField = (type, value) => {
  19127. const list = vue.unref(timeList)[type];
  19128. const isDisabled = list[value];
  19129. if (isDisabled)
  19130. return;
  19131. const { hours, minutes, seconds } = vue.unref(timePartials);
  19132. let changeTo;
  19133. switch (type) {
  19134. case "hours":
  19135. changeTo = props.spinnerDate.hour(value).minute(minutes).second(seconds);
  19136. break;
  19137. case "minutes":
  19138. changeTo = props.spinnerDate.hour(hours).minute(value).second(seconds);
  19139. break;
  19140. case "seconds":
  19141. changeTo = props.spinnerDate.hour(hours).minute(minutes).second(value);
  19142. break;
  19143. }
  19144. emit("change", changeTo);
  19145. };
  19146. const handleClick = (type, { value, disabled }) => {
  19147. if (!disabled) {
  19148. modifyDateField(type, value);
  19149. emitSelectRange(type);
  19150. adjustSpinner(type, value);
  19151. }
  19152. };
  19153. const handleScroll = (type) => {
  19154. const scrollbar = vue.unref(listRefsMap[type]);
  19155. if (!scrollbar)
  19156. return;
  19157. isScrolling = true;
  19158. debouncedResetScroll(type);
  19159. const value = Math.min(Math.round((getScrollbarElement(scrollbar.$el).scrollTop - (scrollBarHeight(type) * 0.5 - 10) / typeItemHeight(type) + 3) / typeItemHeight(type)), type === "hours" ? 23 : 59);
  19160. modifyDateField(type, value);
  19161. };
  19162. const scrollBarHeight = (type) => {
  19163. return vue.unref(listRefsMap[type]).$el.offsetHeight;
  19164. };
  19165. const bindScrollEvent = () => {
  19166. const bindFunction = (type) => {
  19167. const scrollbar = vue.unref(listRefsMap[type]);
  19168. if (scrollbar && scrollbar.$el) {
  19169. getScrollbarElement(scrollbar.$el).onscroll = () => {
  19170. handleScroll(type);
  19171. };
  19172. }
  19173. };
  19174. bindFunction("hours");
  19175. bindFunction("minutes");
  19176. bindFunction("seconds");
  19177. };
  19178. vue.onMounted(() => {
  19179. vue.nextTick(() => {
  19180. !props.arrowControl && bindScrollEvent();
  19181. adjustSpinners();
  19182. if (props.role === "start")
  19183. emitSelectRange("hours");
  19184. });
  19185. });
  19186. const setRef = (scrollbar, type) => {
  19187. listRefsMap[type].value = scrollbar != null ? scrollbar : void 0;
  19188. };
  19189. emit("set-option", [`${props.role}_scrollDown`, scrollDown]);
  19190. emit("set-option", [`${props.role}_emitSelectRange`, emitSelectRange]);
  19191. vue.watch(() => props.spinnerDate, () => {
  19192. if (isScrolling)
  19193. return;
  19194. adjustSpinners();
  19195. });
  19196. return (_ctx, _cache) => {
  19197. return vue.openBlock(), vue.createElementBlock("div", {
  19198. class: vue.normalizeClass([vue.unref(ns).b("spinner"), { "has-seconds": _ctx.showSeconds }])
  19199. }, [
  19200. !_ctx.arrowControl ? (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 0 }, vue.renderList(vue.unref(spinnerItems), (item) => {
  19201. return vue.openBlock(), vue.createBlock(vue.unref(ElScrollbar), {
  19202. key: item,
  19203. ref_for: true,
  19204. ref: (scrollbar) => setRef(scrollbar, item),
  19205. class: vue.normalizeClass(vue.unref(ns).be("spinner", "wrapper")),
  19206. "wrap-style": "max-height: inherit;",
  19207. "view-class": vue.unref(ns).be("spinner", "list"),
  19208. noresize: "",
  19209. tag: "ul",
  19210. onMouseenter: ($event) => emitSelectRange(item),
  19211. onMousemove: ($event) => adjustCurrentSpinner(item)
  19212. }, {
  19213. default: vue.withCtx(() => [
  19214. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(timeList)[item], (disabled, key) => {
  19215. return vue.openBlock(), vue.createElementBlock("li", {
  19216. key,
  19217. class: vue.normalizeClass([
  19218. vue.unref(ns).be("spinner", "item"),
  19219. vue.unref(ns).is("active", key === vue.unref(timePartials)[item]),
  19220. vue.unref(ns).is("disabled", disabled)
  19221. ]),
  19222. onClick: ($event) => handleClick(item, { value: key, disabled })
  19223. }, [
  19224. item === "hours" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  19225. vue.createTextVNode(vue.toDisplayString(("0" + (_ctx.amPmMode ? key % 12 || 12 : key)).slice(-2)) + vue.toDisplayString(getAmPmFlag(key)), 1)
  19226. ], 64)) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  19227. vue.createTextVNode(vue.toDisplayString(("0" + key).slice(-2)), 1)
  19228. ], 64))
  19229. ], 10, ["onClick"]);
  19230. }), 128))
  19231. ]),
  19232. _: 2
  19233. }, 1032, ["class", "view-class", "onMouseenter", "onMousemove"]);
  19234. }), 128)) : vue.createCommentVNode("v-if", true),
  19235. _ctx.arrowControl ? (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 1 }, vue.renderList(vue.unref(spinnerItems), (item) => {
  19236. return vue.openBlock(), vue.createElementBlock("div", {
  19237. key: item,
  19238. class: vue.normalizeClass([vue.unref(ns).be("spinner", "wrapper"), vue.unref(ns).is("arrow")]),
  19239. onMouseenter: ($event) => emitSelectRange(item)
  19240. }, [
  19241. vue.withDirectives((vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  19242. class: vue.normalizeClass(["arrow-up", vue.unref(ns).be("spinner", "arrow")])
  19243. }, {
  19244. default: vue.withCtx(() => [
  19245. vue.createVNode(vue.unref(arrow_up_default))
  19246. ]),
  19247. _: 1
  19248. }, 8, ["class"])), [
  19249. [vue.unref(vRepeatClick), onDecrement]
  19250. ]),
  19251. vue.withDirectives((vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  19252. class: vue.normalizeClass(["arrow-down", vue.unref(ns).be("spinner", "arrow")])
  19253. }, {
  19254. default: vue.withCtx(() => [
  19255. vue.createVNode(vue.unref(arrow_down_default))
  19256. ]),
  19257. _: 1
  19258. }, 8, ["class"])), [
  19259. [vue.unref(vRepeatClick), onIncrement]
  19260. ]),
  19261. vue.createElementVNode("ul", {
  19262. class: vue.normalizeClass(vue.unref(ns).be("spinner", "list"))
  19263. }, [
  19264. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(arrowControlTimeList)[item], (time, key) => {
  19265. return vue.openBlock(), vue.createElementBlock("li", {
  19266. key,
  19267. class: vue.normalizeClass([
  19268. vue.unref(ns).be("spinner", "item"),
  19269. vue.unref(ns).is("active", time === vue.unref(timePartials)[item]),
  19270. vue.unref(ns).is("disabled", vue.unref(timeList)[item][time])
  19271. ])
  19272. }, [
  19273. vue.unref(isNumber)(time) ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  19274. item === "hours" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  19275. vue.createTextVNode(vue.toDisplayString(("0" + (_ctx.amPmMode ? time % 12 || 12 : time)).slice(-2)) + vue.toDisplayString(getAmPmFlag(time)), 1)
  19276. ], 64)) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  19277. vue.createTextVNode(vue.toDisplayString(("0" + time).slice(-2)), 1)
  19278. ], 64))
  19279. ], 64)) : vue.createCommentVNode("v-if", true)
  19280. ], 2);
  19281. }), 128))
  19282. ], 2)
  19283. ], 42, ["onMouseenter"]);
  19284. }), 128)) : vue.createCommentVNode("v-if", true)
  19285. ], 2);
  19286. };
  19287. }
  19288. });
  19289. var TimeSpinner = /* @__PURE__ */ _export_sfc(_sfc_main$25, [["__file", "basic-time-spinner.vue"]]);
  19290. const _sfc_main$24 = /* @__PURE__ */ vue.defineComponent({
  19291. __name: "panel-time-pick",
  19292. props: panelTimePickerProps,
  19293. emits: ["pick", "select-range", "set-picker-option"],
  19294. setup(__props, { emit }) {
  19295. const props = __props;
  19296. const pickerBase = vue.inject("EP_PICKER_BASE");
  19297. const {
  19298. arrowControl,
  19299. disabledHours,
  19300. disabledMinutes,
  19301. disabledSeconds,
  19302. defaultValue
  19303. } = pickerBase.props;
  19304. const { getAvailableHours, getAvailableMinutes, getAvailableSeconds } = buildAvailableTimeSlotGetter(disabledHours, disabledMinutes, disabledSeconds);
  19305. const ns = useNamespace("time");
  19306. const { t, lang } = useLocale();
  19307. const selectionRange = vue.ref([0, 2]);
  19308. const oldValue = useOldValue(props);
  19309. const transitionName = vue.computed(() => {
  19310. return isUndefined(props.actualVisible) ? `${ns.namespace.value}-zoom-in-top` : "";
  19311. });
  19312. const showSeconds = vue.computed(() => {
  19313. return props.format.includes("ss");
  19314. });
  19315. const amPmMode = vue.computed(() => {
  19316. if (props.format.includes("A"))
  19317. return "A";
  19318. if (props.format.includes("a"))
  19319. return "a";
  19320. return "";
  19321. });
  19322. const isValidValue = (_date) => {
  19323. const parsedDate = dayjs(_date).locale(lang.value);
  19324. const result = getRangeAvailableTime(parsedDate);
  19325. return parsedDate.isSame(result);
  19326. };
  19327. const handleCancel = () => {
  19328. emit("pick", oldValue.value, false);
  19329. };
  19330. const handleConfirm = (visible = false, first = false) => {
  19331. if (first)
  19332. return;
  19333. emit("pick", props.parsedValue, visible);
  19334. };
  19335. const handleChange = (_date) => {
  19336. if (!props.visible) {
  19337. return;
  19338. }
  19339. const result = getRangeAvailableTime(_date).millisecond(0);
  19340. emit("pick", result, true);
  19341. };
  19342. const setSelectionRange = (start, end) => {
  19343. emit("select-range", start, end);
  19344. selectionRange.value = [start, end];
  19345. };
  19346. const changeSelectionRange = (step) => {
  19347. const list = [0, 3].concat(showSeconds.value ? [6] : []);
  19348. const mapping = ["hours", "minutes"].concat(showSeconds.value ? ["seconds"] : []);
  19349. const index = list.indexOf(selectionRange.value[0]);
  19350. const next = (index + step + list.length) % list.length;
  19351. timePickerOptions["start_emitSelectRange"](mapping[next]);
  19352. };
  19353. const handleKeydown = (event) => {
  19354. const code = event.code;
  19355. const { left, right, up, down } = EVENT_CODE;
  19356. if ([left, right].includes(code)) {
  19357. const step = code === left ? -1 : 1;
  19358. changeSelectionRange(step);
  19359. event.preventDefault();
  19360. return;
  19361. }
  19362. if ([up, down].includes(code)) {
  19363. const step = code === up ? -1 : 1;
  19364. timePickerOptions["start_scrollDown"](step);
  19365. event.preventDefault();
  19366. return;
  19367. }
  19368. };
  19369. const { timePickerOptions, onSetOption, getAvailableTime } = useTimePanel({
  19370. getAvailableHours,
  19371. getAvailableMinutes,
  19372. getAvailableSeconds
  19373. });
  19374. const getRangeAvailableTime = (date) => {
  19375. return getAvailableTime(date, props.datetimeRole || "", true);
  19376. };
  19377. const parseUserInput = (value) => {
  19378. if (!value)
  19379. return null;
  19380. return dayjs(value, props.format).locale(lang.value);
  19381. };
  19382. const formatToString = (value) => {
  19383. if (!value)
  19384. return null;
  19385. return value.format(props.format);
  19386. };
  19387. const getDefaultValue = () => {
  19388. return dayjs(defaultValue).locale(lang.value);
  19389. };
  19390. emit("set-picker-option", ["isValidValue", isValidValue]);
  19391. emit("set-picker-option", ["formatToString", formatToString]);
  19392. emit("set-picker-option", ["parseUserInput", parseUserInput]);
  19393. emit("set-picker-option", ["handleKeydownInput", handleKeydown]);
  19394. emit("set-picker-option", ["getRangeAvailableTime", getRangeAvailableTime]);
  19395. emit("set-picker-option", ["getDefaultValue", getDefaultValue]);
  19396. return (_ctx, _cache) => {
  19397. return vue.openBlock(), vue.createBlock(vue.Transition, { name: vue.unref(transitionName) }, {
  19398. default: vue.withCtx(() => [
  19399. _ctx.actualVisible || _ctx.visible ? (vue.openBlock(), vue.createElementBlock("div", {
  19400. key: 0,
  19401. class: vue.normalizeClass(vue.unref(ns).b("panel"))
  19402. }, [
  19403. vue.createElementVNode("div", {
  19404. class: vue.normalizeClass([vue.unref(ns).be("panel", "content"), { "has-seconds": vue.unref(showSeconds) }])
  19405. }, [
  19406. vue.createVNode(TimeSpinner, {
  19407. ref: "spinner",
  19408. role: _ctx.datetimeRole || "start",
  19409. "arrow-control": vue.unref(arrowControl),
  19410. "show-seconds": vue.unref(showSeconds),
  19411. "am-pm-mode": vue.unref(amPmMode),
  19412. "spinner-date": _ctx.parsedValue,
  19413. "disabled-hours": vue.unref(disabledHours),
  19414. "disabled-minutes": vue.unref(disabledMinutes),
  19415. "disabled-seconds": vue.unref(disabledSeconds),
  19416. onChange: handleChange,
  19417. onSetOption: vue.unref(onSetOption),
  19418. onSelectRange: setSelectionRange
  19419. }, null, 8, ["role", "arrow-control", "show-seconds", "am-pm-mode", "spinner-date", "disabled-hours", "disabled-minutes", "disabled-seconds", "onSetOption"])
  19420. ], 2),
  19421. vue.createElementVNode("div", {
  19422. class: vue.normalizeClass(vue.unref(ns).be("panel", "footer"))
  19423. }, [
  19424. vue.createElementVNode("button", {
  19425. type: "button",
  19426. class: vue.normalizeClass([vue.unref(ns).be("panel", "btn"), "cancel"]),
  19427. onClick: handleCancel
  19428. }, vue.toDisplayString(vue.unref(t)("el.datepicker.cancel")), 3),
  19429. vue.createElementVNode("button", {
  19430. type: "button",
  19431. class: vue.normalizeClass([vue.unref(ns).be("panel", "btn"), "confirm"]),
  19432. onClick: ($event) => handleConfirm()
  19433. }, vue.toDisplayString(vue.unref(t)("el.datepicker.confirm")), 11, ["onClick"])
  19434. ], 2)
  19435. ], 2)) : vue.createCommentVNode("v-if", true)
  19436. ]),
  19437. _: 1
  19438. }, 8, ["name"]);
  19439. };
  19440. }
  19441. });
  19442. var TimePickPanel = /* @__PURE__ */ _export_sfc(_sfc_main$24, [["__file", "panel-time-pick.vue"]]);
  19443. const panelTimeRangeProps = buildProps({
  19444. ...timePanelSharedProps,
  19445. parsedValue: {
  19446. type: definePropType(Array)
  19447. }
  19448. });
  19449. const _sfc_main$23 = /* @__PURE__ */ vue.defineComponent({
  19450. __name: "panel-time-range",
  19451. props: panelTimeRangeProps,
  19452. emits: ["pick", "select-range", "set-picker-option"],
  19453. setup(__props, { emit }) {
  19454. const props = __props;
  19455. const makeSelectRange = (start, end) => {
  19456. const result = [];
  19457. for (let i = start; i <= end; i++) {
  19458. result.push(i);
  19459. }
  19460. return result;
  19461. };
  19462. const { t, lang } = useLocale();
  19463. const nsTime = useNamespace("time");
  19464. const nsPicker = useNamespace("picker");
  19465. const pickerBase = vue.inject("EP_PICKER_BASE");
  19466. const {
  19467. arrowControl,
  19468. disabledHours,
  19469. disabledMinutes,
  19470. disabledSeconds,
  19471. defaultValue
  19472. } = pickerBase.props;
  19473. const startContainerKls = vue.computed(() => [
  19474. nsTime.be("range-picker", "body"),
  19475. nsTime.be("panel", "content"),
  19476. nsTime.is("arrow", arrowControl),
  19477. showSeconds.value ? "has-seconds" : ""
  19478. ]);
  19479. const endContainerKls = vue.computed(() => [
  19480. nsTime.be("range-picker", "body"),
  19481. nsTime.be("panel", "content"),
  19482. nsTime.is("arrow", arrowControl),
  19483. showSeconds.value ? "has-seconds" : ""
  19484. ]);
  19485. const startTime = vue.computed(() => props.parsedValue[0]);
  19486. const endTime = vue.computed(() => props.parsedValue[1]);
  19487. const oldValue = useOldValue(props);
  19488. const handleCancel = () => {
  19489. emit("pick", oldValue.value, false);
  19490. };
  19491. const showSeconds = vue.computed(() => {
  19492. return props.format.includes("ss");
  19493. });
  19494. const amPmMode = vue.computed(() => {
  19495. if (props.format.includes("A"))
  19496. return "A";
  19497. if (props.format.includes("a"))
  19498. return "a";
  19499. return "";
  19500. });
  19501. const handleConfirm = (visible = false) => {
  19502. emit("pick", [startTime.value, endTime.value], visible);
  19503. };
  19504. const handleMinChange = (date) => {
  19505. handleChange(date.millisecond(0), endTime.value);
  19506. };
  19507. const handleMaxChange = (date) => {
  19508. handleChange(startTime.value, date.millisecond(0));
  19509. };
  19510. const isValidValue = (_date) => {
  19511. const parsedDate = _date.map((_) => dayjs(_).locale(lang.value));
  19512. const result = getRangeAvailableTime(parsedDate);
  19513. return parsedDate[0].isSame(result[0]) && parsedDate[1].isSame(result[1]);
  19514. };
  19515. const handleChange = (start, end) => {
  19516. if (!props.visible) {
  19517. return;
  19518. }
  19519. emit("pick", [start, end], true);
  19520. };
  19521. const btnConfirmDisabled = vue.computed(() => {
  19522. return startTime.value > endTime.value;
  19523. });
  19524. const selectionRange = vue.ref([0, 2]);
  19525. const setMinSelectionRange = (start, end) => {
  19526. emit("select-range", start, end, "min");
  19527. selectionRange.value = [start, end];
  19528. };
  19529. const offset = vue.computed(() => showSeconds.value ? 11 : 8);
  19530. const setMaxSelectionRange = (start, end) => {
  19531. emit("select-range", start, end, "max");
  19532. const _offset = vue.unref(offset);
  19533. selectionRange.value = [start + _offset, end + _offset];
  19534. };
  19535. const changeSelectionRange = (step) => {
  19536. const list = showSeconds.value ? [0, 3, 6, 11, 14, 17] : [0, 3, 8, 11];
  19537. const mapping = ["hours", "minutes"].concat(showSeconds.value ? ["seconds"] : []);
  19538. const index = list.indexOf(selectionRange.value[0]);
  19539. const next = (index + step + list.length) % list.length;
  19540. const half = list.length / 2;
  19541. if (next < half) {
  19542. timePickerOptions["start_emitSelectRange"](mapping[next]);
  19543. } else {
  19544. timePickerOptions["end_emitSelectRange"](mapping[next - half]);
  19545. }
  19546. };
  19547. const handleKeydown = (event) => {
  19548. const code = event.code;
  19549. const { left, right, up, down } = EVENT_CODE;
  19550. if ([left, right].includes(code)) {
  19551. const step = code === left ? -1 : 1;
  19552. changeSelectionRange(step);
  19553. event.preventDefault();
  19554. return;
  19555. }
  19556. if ([up, down].includes(code)) {
  19557. const step = code === up ? -1 : 1;
  19558. const role = selectionRange.value[0] < offset.value ? "start" : "end";
  19559. timePickerOptions[`${role}_scrollDown`](step);
  19560. event.preventDefault();
  19561. return;
  19562. }
  19563. };
  19564. const disabledHours_ = (role, compare) => {
  19565. const defaultDisable = disabledHours ? disabledHours(role) : [];
  19566. const isStart = role === "start";
  19567. const compareDate = compare || (isStart ? endTime.value : startTime.value);
  19568. const compareHour = compareDate.hour();
  19569. const nextDisable = isStart ? makeSelectRange(compareHour + 1, 23) : makeSelectRange(0, compareHour - 1);
  19570. return union(defaultDisable, nextDisable);
  19571. };
  19572. const disabledMinutes_ = (hour, role, compare) => {
  19573. const defaultDisable = disabledMinutes ? disabledMinutes(hour, role) : [];
  19574. const isStart = role === "start";
  19575. const compareDate = compare || (isStart ? endTime.value : startTime.value);
  19576. const compareHour = compareDate.hour();
  19577. if (hour !== compareHour) {
  19578. return defaultDisable;
  19579. }
  19580. const compareMinute = compareDate.minute();
  19581. const nextDisable = isStart ? makeSelectRange(compareMinute + 1, 59) : makeSelectRange(0, compareMinute - 1);
  19582. return union(defaultDisable, nextDisable);
  19583. };
  19584. const disabledSeconds_ = (hour, minute, role, compare) => {
  19585. const defaultDisable = disabledSeconds ? disabledSeconds(hour, minute, role) : [];
  19586. const isStart = role === "start";
  19587. const compareDate = compare || (isStart ? endTime.value : startTime.value);
  19588. const compareHour = compareDate.hour();
  19589. const compareMinute = compareDate.minute();
  19590. if (hour !== compareHour || minute !== compareMinute) {
  19591. return defaultDisable;
  19592. }
  19593. const compareSecond = compareDate.second();
  19594. const nextDisable = isStart ? makeSelectRange(compareSecond + 1, 59) : makeSelectRange(0, compareSecond - 1);
  19595. return union(defaultDisable, nextDisable);
  19596. };
  19597. const getRangeAvailableTime = ([start, end]) => {
  19598. return [
  19599. getAvailableTime(start, "start", true, end),
  19600. getAvailableTime(end, "end", false, start)
  19601. ];
  19602. };
  19603. const { getAvailableHours, getAvailableMinutes, getAvailableSeconds } = buildAvailableTimeSlotGetter(disabledHours_, disabledMinutes_, disabledSeconds_);
  19604. const {
  19605. timePickerOptions,
  19606. getAvailableTime,
  19607. onSetOption
  19608. } = useTimePanel({
  19609. getAvailableHours,
  19610. getAvailableMinutes,
  19611. getAvailableSeconds
  19612. });
  19613. const parseUserInput = (days) => {
  19614. if (!days)
  19615. return null;
  19616. if (isArray$1(days)) {
  19617. return days.map((d) => dayjs(d, props.format).locale(lang.value));
  19618. }
  19619. return dayjs(days, props.format).locale(lang.value);
  19620. };
  19621. const formatToString = (days) => {
  19622. if (!days)
  19623. return null;
  19624. if (isArray$1(days)) {
  19625. return days.map((d) => d.format(props.format));
  19626. }
  19627. return days.format(props.format);
  19628. };
  19629. const getDefaultValue = () => {
  19630. if (isArray$1(defaultValue)) {
  19631. return defaultValue.map((d) => dayjs(d).locale(lang.value));
  19632. }
  19633. const defaultDay = dayjs(defaultValue).locale(lang.value);
  19634. return [defaultDay, defaultDay.add(60, "m")];
  19635. };
  19636. emit("set-picker-option", ["formatToString", formatToString]);
  19637. emit("set-picker-option", ["parseUserInput", parseUserInput]);
  19638. emit("set-picker-option", ["isValidValue", isValidValue]);
  19639. emit("set-picker-option", ["handleKeydownInput", handleKeydown]);
  19640. emit("set-picker-option", ["getDefaultValue", getDefaultValue]);
  19641. emit("set-picker-option", ["getRangeAvailableTime", getRangeAvailableTime]);
  19642. return (_ctx, _cache) => {
  19643. return _ctx.actualVisible ? (vue.openBlock(), vue.createElementBlock("div", {
  19644. key: 0,
  19645. class: vue.normalizeClass([vue.unref(nsTime).b("range-picker"), vue.unref(nsPicker).b("panel")])
  19646. }, [
  19647. vue.createElementVNode("div", {
  19648. class: vue.normalizeClass(vue.unref(nsTime).be("range-picker", "content"))
  19649. }, [
  19650. vue.createElementVNode("div", {
  19651. class: vue.normalizeClass(vue.unref(nsTime).be("range-picker", "cell"))
  19652. }, [
  19653. vue.createElementVNode("div", {
  19654. class: vue.normalizeClass(vue.unref(nsTime).be("range-picker", "header"))
  19655. }, vue.toDisplayString(vue.unref(t)("el.datepicker.startTime")), 3),
  19656. vue.createElementVNode("div", {
  19657. class: vue.normalizeClass(vue.unref(startContainerKls))
  19658. }, [
  19659. vue.createVNode(TimeSpinner, {
  19660. ref: "minSpinner",
  19661. role: "start",
  19662. "show-seconds": vue.unref(showSeconds),
  19663. "am-pm-mode": vue.unref(amPmMode),
  19664. "arrow-control": vue.unref(arrowControl),
  19665. "spinner-date": vue.unref(startTime),
  19666. "disabled-hours": disabledHours_,
  19667. "disabled-minutes": disabledMinutes_,
  19668. "disabled-seconds": disabledSeconds_,
  19669. onChange: handleMinChange,
  19670. onSetOption: vue.unref(onSetOption),
  19671. onSelectRange: setMinSelectionRange
  19672. }, null, 8, ["show-seconds", "am-pm-mode", "arrow-control", "spinner-date", "onSetOption"])
  19673. ], 2)
  19674. ], 2),
  19675. vue.createElementVNode("div", {
  19676. class: vue.normalizeClass(vue.unref(nsTime).be("range-picker", "cell"))
  19677. }, [
  19678. vue.createElementVNode("div", {
  19679. class: vue.normalizeClass(vue.unref(nsTime).be("range-picker", "header"))
  19680. }, vue.toDisplayString(vue.unref(t)("el.datepicker.endTime")), 3),
  19681. vue.createElementVNode("div", {
  19682. class: vue.normalizeClass(vue.unref(endContainerKls))
  19683. }, [
  19684. vue.createVNode(TimeSpinner, {
  19685. ref: "maxSpinner",
  19686. role: "end",
  19687. "show-seconds": vue.unref(showSeconds),
  19688. "am-pm-mode": vue.unref(amPmMode),
  19689. "arrow-control": vue.unref(arrowControl),
  19690. "spinner-date": vue.unref(endTime),
  19691. "disabled-hours": disabledHours_,
  19692. "disabled-minutes": disabledMinutes_,
  19693. "disabled-seconds": disabledSeconds_,
  19694. onChange: handleMaxChange,
  19695. onSetOption: vue.unref(onSetOption),
  19696. onSelectRange: setMaxSelectionRange
  19697. }, null, 8, ["show-seconds", "am-pm-mode", "arrow-control", "spinner-date", "onSetOption"])
  19698. ], 2)
  19699. ], 2)
  19700. ], 2),
  19701. vue.createElementVNode("div", {
  19702. class: vue.normalizeClass(vue.unref(nsTime).be("panel", "footer"))
  19703. }, [
  19704. vue.createElementVNode("button", {
  19705. type: "button",
  19706. class: vue.normalizeClass([vue.unref(nsTime).be("panel", "btn"), "cancel"]),
  19707. onClick: ($event) => handleCancel()
  19708. }, vue.toDisplayString(vue.unref(t)("el.datepicker.cancel")), 11, ["onClick"]),
  19709. vue.createElementVNode("button", {
  19710. type: "button",
  19711. class: vue.normalizeClass([vue.unref(nsTime).be("panel", "btn"), "confirm"]),
  19712. disabled: vue.unref(btnConfirmDisabled),
  19713. onClick: ($event) => handleConfirm()
  19714. }, vue.toDisplayString(vue.unref(t)("el.datepicker.confirm")), 11, ["disabled", "onClick"])
  19715. ], 2)
  19716. ], 2)) : vue.createCommentVNode("v-if", true);
  19717. };
  19718. }
  19719. });
  19720. var TimeRangePanel = /* @__PURE__ */ _export_sfc(_sfc_main$23, [["__file", "panel-time-range.vue"]]);
  19721. dayjs.extend(customParseFormat);
  19722. var TimePicker = vue.defineComponent({
  19723. name: "ElTimePicker",
  19724. install: null,
  19725. props: {
  19726. ...timePickerDefaultProps,
  19727. isRange: {
  19728. type: Boolean,
  19729. default: false
  19730. }
  19731. },
  19732. emits: ["update:modelValue"],
  19733. setup(props, ctx) {
  19734. const commonPicker = vue.ref();
  19735. const [type, Panel] = props.isRange ? ["timerange", TimeRangePanel] : ["time", TimePickPanel];
  19736. const modelUpdater = (value) => ctx.emit("update:modelValue", value);
  19737. vue.provide("ElPopperOptions", props.popperOptions);
  19738. ctx.expose({
  19739. focus: () => {
  19740. var _a;
  19741. (_a = commonPicker.value) == null ? void 0 : _a.focus();
  19742. },
  19743. blur: () => {
  19744. var _a;
  19745. (_a = commonPicker.value) == null ? void 0 : _a.blur();
  19746. },
  19747. handleOpen: () => {
  19748. var _a;
  19749. (_a = commonPicker.value) == null ? void 0 : _a.handleOpen();
  19750. },
  19751. handleClose: () => {
  19752. var _a;
  19753. (_a = commonPicker.value) == null ? void 0 : _a.handleClose();
  19754. }
  19755. });
  19756. return () => {
  19757. var _a;
  19758. const format = (_a = props.format) != null ? _a : DEFAULT_FORMATS_TIME;
  19759. return vue.createVNode(CommonPicker, vue.mergeProps(props, {
  19760. "ref": commonPicker,
  19761. "type": type,
  19762. "format": format,
  19763. "onUpdate:modelValue": modelUpdater
  19764. }), {
  19765. default: (props2) => vue.createVNode(Panel, props2, null)
  19766. });
  19767. };
  19768. }
  19769. });
  19770. const ElTimePicker = withInstall(TimePicker);
  19771. const getPrevMonthLastDays = (date, count) => {
  19772. const lastDay = date.subtract(1, "month").endOf("month").date();
  19773. return rangeArr(count).map((_, index) => lastDay - (count - index - 1));
  19774. };
  19775. const getMonthDays = (date) => {
  19776. const days = date.daysInMonth();
  19777. return rangeArr(days).map((_, index) => index + 1);
  19778. };
  19779. const toNestedArr = (days) => rangeArr(days.length / 7).map((index) => {
  19780. const start = index * 7;
  19781. return days.slice(start, start + 7);
  19782. });
  19783. const dateTableProps = buildProps({
  19784. selectedDay: {
  19785. type: definePropType(Object)
  19786. },
  19787. range: {
  19788. type: definePropType(Array)
  19789. },
  19790. date: {
  19791. type: definePropType(Object),
  19792. required: true
  19793. },
  19794. hideHeader: {
  19795. type: Boolean
  19796. }
  19797. });
  19798. const dateTableEmits = {
  19799. pick: (value) => isObject$1(value)
  19800. };
  19801. var localeData$1 = {exports: {}};
  19802. (function(module, exports) {
  19803. !function(n, e) {
  19804. module.exports = e() ;
  19805. }(commonjsGlobal, function() {
  19806. return function(n, e, t) {
  19807. var r = e.prototype, o = function(n2) {
  19808. return n2 && (n2.indexOf ? n2 : n2.s);
  19809. }, u = function(n2, e2, t2, r2, u2) {
  19810. var i2 = n2.name ? n2 : n2.$locale(), a2 = o(i2[e2]), s2 = o(i2[t2]), f = a2 || s2.map(function(n3) {
  19811. return n3.slice(0, r2);
  19812. });
  19813. if (!u2)
  19814. return f;
  19815. var d = i2.weekStart;
  19816. return f.map(function(n3, e3) {
  19817. return f[(e3 + (d || 0)) % 7];
  19818. });
  19819. }, i = function() {
  19820. return t.Ls[t.locale()];
  19821. }, a = function(n2, e2) {
  19822. return n2.formats[e2] || function(n3) {
  19823. return n3.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, function(n4, e3, t2) {
  19824. return e3 || t2.slice(1);
  19825. });
  19826. }(n2.formats[e2.toUpperCase()]);
  19827. }, s = function() {
  19828. var n2 = this;
  19829. return { months: function(e2) {
  19830. return e2 ? e2.format("MMMM") : u(n2, "months");
  19831. }, monthsShort: function(e2) {
  19832. return e2 ? e2.format("MMM") : u(n2, "monthsShort", "months", 3);
  19833. }, firstDayOfWeek: function() {
  19834. return n2.$locale().weekStart || 0;
  19835. }, weekdays: function(e2) {
  19836. return e2 ? e2.format("dddd") : u(n2, "weekdays");
  19837. }, weekdaysMin: function(e2) {
  19838. return e2 ? e2.format("dd") : u(n2, "weekdaysMin", "weekdays", 2);
  19839. }, weekdaysShort: function(e2) {
  19840. return e2 ? e2.format("ddd") : u(n2, "weekdaysShort", "weekdays", 3);
  19841. }, longDateFormat: function(e2) {
  19842. return a(n2.$locale(), e2);
  19843. }, meridiem: this.$locale().meridiem, ordinal: this.$locale().ordinal };
  19844. };
  19845. r.localeData = function() {
  19846. return s.bind(this)();
  19847. }, t.localeData = function() {
  19848. var n2 = i();
  19849. return { firstDayOfWeek: function() {
  19850. return n2.weekStart || 0;
  19851. }, weekdays: function() {
  19852. return t.weekdays();
  19853. }, weekdaysShort: function() {
  19854. return t.weekdaysShort();
  19855. }, weekdaysMin: function() {
  19856. return t.weekdaysMin();
  19857. }, months: function() {
  19858. return t.months();
  19859. }, monthsShort: function() {
  19860. return t.monthsShort();
  19861. }, longDateFormat: function(e2) {
  19862. return a(n2, e2);
  19863. }, meridiem: n2.meridiem, ordinal: n2.ordinal };
  19864. }, t.months = function() {
  19865. return u(i(), "months");
  19866. }, t.monthsShort = function() {
  19867. return u(i(), "monthsShort", "months", 3);
  19868. }, t.weekdays = function(n2) {
  19869. return u(i(), "weekdays", null, null, n2);
  19870. }, t.weekdaysShort = function(n2) {
  19871. return u(i(), "weekdaysShort", "weekdays", 3, n2);
  19872. }, t.weekdaysMin = function(n2) {
  19873. return u(i(), "weekdaysMin", "weekdays", 2, n2);
  19874. };
  19875. };
  19876. });
  19877. })(localeData$1);
  19878. var localeData = localeData$1.exports;
  19879. const useDateTable = (props, emit) => {
  19880. dayjs.extend(localeData);
  19881. const firstDayOfWeek = dayjs.localeData().firstDayOfWeek();
  19882. const { t, lang } = useLocale();
  19883. const now = dayjs().locale(lang.value);
  19884. const isInRange = vue.computed(() => !!props.range && !!props.range.length);
  19885. const rows = vue.computed(() => {
  19886. let days = [];
  19887. if (isInRange.value) {
  19888. const [start, end] = props.range;
  19889. const currentMonthRange = rangeArr(end.date() - start.date() + 1).map((index) => ({
  19890. text: start.date() + index,
  19891. type: "current"
  19892. }));
  19893. let remaining = currentMonthRange.length % 7;
  19894. remaining = remaining === 0 ? 0 : 7 - remaining;
  19895. const nextMonthRange = rangeArr(remaining).map((_, index) => ({
  19896. text: index + 1,
  19897. type: "next"
  19898. }));
  19899. days = currentMonthRange.concat(nextMonthRange);
  19900. } else {
  19901. const firstDay = props.date.startOf("month").day();
  19902. const prevMonthDays = getPrevMonthLastDays(props.date, (firstDay - firstDayOfWeek + 7) % 7).map((day) => ({
  19903. text: day,
  19904. type: "prev"
  19905. }));
  19906. const currentMonthDays = getMonthDays(props.date).map((day) => ({
  19907. text: day,
  19908. type: "current"
  19909. }));
  19910. days = [...prevMonthDays, ...currentMonthDays];
  19911. const remaining = 7 - (days.length % 7 || 7);
  19912. const nextMonthDays = rangeArr(remaining).map((_, index) => ({
  19913. text: index + 1,
  19914. type: "next"
  19915. }));
  19916. days = days.concat(nextMonthDays);
  19917. }
  19918. return toNestedArr(days);
  19919. });
  19920. const weekDays = vue.computed(() => {
  19921. const start = firstDayOfWeek;
  19922. if (start === 0) {
  19923. return WEEK_DAYS.map((_) => t(`el.datepicker.weeks.${_}`));
  19924. } else {
  19925. return WEEK_DAYS.slice(start).concat(WEEK_DAYS.slice(0, start)).map((_) => t(`el.datepicker.weeks.${_}`));
  19926. }
  19927. });
  19928. const getFormattedDate = (day, type) => {
  19929. switch (type) {
  19930. case "prev":
  19931. return props.date.startOf("month").subtract(1, "month").date(day);
  19932. case "next":
  19933. return props.date.startOf("month").add(1, "month").date(day);
  19934. case "current":
  19935. return props.date.date(day);
  19936. }
  19937. };
  19938. const handlePickDay = ({ text, type }) => {
  19939. const date = getFormattedDate(text, type);
  19940. emit("pick", date);
  19941. };
  19942. const getSlotData = ({ text, type }) => {
  19943. const day = getFormattedDate(text, type);
  19944. return {
  19945. isSelected: day.isSame(props.selectedDay),
  19946. type: `${type}-month`,
  19947. day: day.format("YYYY-MM-DD"),
  19948. date: day.toDate()
  19949. };
  19950. };
  19951. return {
  19952. now,
  19953. isInRange,
  19954. rows,
  19955. weekDays,
  19956. getFormattedDate,
  19957. handlePickDay,
  19958. getSlotData
  19959. };
  19960. };
  19961. const __default__$1t = vue.defineComponent({
  19962. name: "DateTable"
  19963. });
  19964. const _sfc_main$22 = /* @__PURE__ */ vue.defineComponent({
  19965. ...__default__$1t,
  19966. props: dateTableProps,
  19967. emits: dateTableEmits,
  19968. setup(__props, { expose, emit }) {
  19969. const props = __props;
  19970. const {
  19971. isInRange,
  19972. now,
  19973. rows,
  19974. weekDays,
  19975. getFormattedDate,
  19976. handlePickDay,
  19977. getSlotData
  19978. } = useDateTable(props, emit);
  19979. const nsTable = useNamespace("calendar-table");
  19980. const nsDay = useNamespace("calendar-day");
  19981. const getCellClass = ({ text, type }) => {
  19982. const classes = [type];
  19983. if (type === "current") {
  19984. const date = getFormattedDate(text, type);
  19985. if (date.isSame(props.selectedDay, "day")) {
  19986. classes.push(nsDay.is("selected"));
  19987. }
  19988. if (date.isSame(now, "day")) {
  19989. classes.push(nsDay.is("today"));
  19990. }
  19991. }
  19992. return classes;
  19993. };
  19994. expose({
  19995. getFormattedDate
  19996. });
  19997. return (_ctx, _cache) => {
  19998. return vue.openBlock(), vue.createElementBlock("table", {
  19999. class: vue.normalizeClass([vue.unref(nsTable).b(), vue.unref(nsTable).is("range", vue.unref(isInRange))]),
  20000. cellspacing: "0",
  20001. cellpadding: "0"
  20002. }, [
  20003. !_ctx.hideHeader ? (vue.openBlock(), vue.createElementBlock("thead", { key: 0 }, [
  20004. vue.createElementVNode("tr", null, [
  20005. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(weekDays), (day) => {
  20006. return vue.openBlock(), vue.createElementBlock("th", {
  20007. key: day,
  20008. scope: "col"
  20009. }, vue.toDisplayString(day), 1);
  20010. }), 128))
  20011. ])
  20012. ])) : vue.createCommentVNode("v-if", true),
  20013. vue.createElementVNode("tbody", null, [
  20014. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(rows), (row, index) => {
  20015. return vue.openBlock(), vue.createElementBlock("tr", {
  20016. key: index,
  20017. class: vue.normalizeClass({
  20018. [vue.unref(nsTable).e("row")]: true,
  20019. [vue.unref(nsTable).em("row", "hide-border")]: index === 0 && _ctx.hideHeader
  20020. })
  20021. }, [
  20022. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(row, (cell, key) => {
  20023. return vue.openBlock(), vue.createElementBlock("td", {
  20024. key,
  20025. class: vue.normalizeClass(getCellClass(cell)),
  20026. onClick: ($event) => vue.unref(handlePickDay)(cell)
  20027. }, [
  20028. vue.createElementVNode("div", {
  20029. class: vue.normalizeClass(vue.unref(nsDay).b())
  20030. }, [
  20031. vue.renderSlot(_ctx.$slots, "date-cell", {
  20032. data: vue.unref(getSlotData)(cell)
  20033. }, () => [
  20034. vue.createElementVNode("span", null, vue.toDisplayString(cell.text), 1)
  20035. ])
  20036. ], 2)
  20037. ], 10, ["onClick"]);
  20038. }), 128))
  20039. ], 2);
  20040. }), 128))
  20041. ])
  20042. ], 2);
  20043. };
  20044. }
  20045. });
  20046. var DateTable$1 = /* @__PURE__ */ _export_sfc(_sfc_main$22, [["__file", "date-table.vue"]]);
  20047. const adjacentMonth = (start, end) => {
  20048. const firstMonthLastDay = start.endOf("month");
  20049. const lastMonthFirstDay = end.startOf("month");
  20050. const isSameWeek = firstMonthLastDay.isSame(lastMonthFirstDay, "week");
  20051. const lastMonthStartDay = isSameWeek ? lastMonthFirstDay.add(1, "week") : lastMonthFirstDay;
  20052. return [
  20053. [start, firstMonthLastDay],
  20054. [lastMonthStartDay.startOf("week"), end]
  20055. ];
  20056. };
  20057. const threeConsecutiveMonth = (start, end) => {
  20058. const firstMonthLastDay = start.endOf("month");
  20059. const secondMonthFirstDay = start.add(1, "month").startOf("month");
  20060. const secondMonthStartDay = firstMonthLastDay.isSame(secondMonthFirstDay, "week") ? secondMonthFirstDay.add(1, "week") : secondMonthFirstDay;
  20061. const secondMonthLastDay = secondMonthStartDay.endOf("month");
  20062. const lastMonthFirstDay = end.startOf("month");
  20063. const lastMonthStartDay = secondMonthLastDay.isSame(lastMonthFirstDay, "week") ? lastMonthFirstDay.add(1, "week") : lastMonthFirstDay;
  20064. return [
  20065. [start, firstMonthLastDay],
  20066. [secondMonthStartDay.startOf("week"), secondMonthLastDay],
  20067. [lastMonthStartDay.startOf("week"), end]
  20068. ];
  20069. };
  20070. const useCalendar = (props, emit, componentName) => {
  20071. const { lang } = useLocale();
  20072. const selectedDay = vue.ref();
  20073. const now = dayjs().locale(lang.value);
  20074. const realSelectedDay = vue.computed({
  20075. get() {
  20076. if (!props.modelValue)
  20077. return selectedDay.value;
  20078. return date.value;
  20079. },
  20080. set(val) {
  20081. if (!val)
  20082. return;
  20083. selectedDay.value = val;
  20084. const result = val.toDate();
  20085. emit(INPUT_EVENT, result);
  20086. emit(UPDATE_MODEL_EVENT, result);
  20087. }
  20088. });
  20089. const validatedRange = vue.computed(() => {
  20090. if (!props.range || !isArray$1(props.range) || props.range.length !== 2 || props.range.some((item) => !isDate$1(item)))
  20091. return [];
  20092. const rangeArrDayjs = props.range.map((_) => dayjs(_).locale(lang.value));
  20093. const [startDayjs, endDayjs] = rangeArrDayjs;
  20094. if (startDayjs.isAfter(endDayjs)) {
  20095. return [];
  20096. }
  20097. if (startDayjs.isSame(endDayjs, "month")) {
  20098. return calculateValidatedDateRange(startDayjs, endDayjs);
  20099. } else {
  20100. if (startDayjs.add(1, "month").month() !== endDayjs.month()) {
  20101. return [];
  20102. }
  20103. return calculateValidatedDateRange(startDayjs, endDayjs);
  20104. }
  20105. });
  20106. const date = vue.computed(() => {
  20107. if (!props.modelValue) {
  20108. return realSelectedDay.value || (validatedRange.value.length ? validatedRange.value[0][0] : now);
  20109. } else {
  20110. return dayjs(props.modelValue).locale(lang.value);
  20111. }
  20112. });
  20113. const prevMonthDayjs = vue.computed(() => date.value.subtract(1, "month").date(1));
  20114. const nextMonthDayjs = vue.computed(() => date.value.add(1, "month").date(1));
  20115. const prevYearDayjs = vue.computed(() => date.value.subtract(1, "year").date(1));
  20116. const nextYearDayjs = vue.computed(() => date.value.add(1, "year").date(1));
  20117. const calculateValidatedDateRange = (startDayjs, endDayjs) => {
  20118. const firstDay = startDayjs.startOf("week");
  20119. const lastDay = endDayjs.endOf("week");
  20120. const firstMonth = firstDay.get("month");
  20121. const lastMonth = lastDay.get("month");
  20122. if (firstMonth === lastMonth) {
  20123. return [[firstDay, lastDay]];
  20124. } else if ((firstMonth + 1) % 12 === lastMonth) {
  20125. return adjacentMonth(firstDay, lastDay);
  20126. } else if (firstMonth + 2 === lastMonth || (firstMonth + 1) % 11 === lastMonth) {
  20127. return threeConsecutiveMonth(firstDay, lastDay);
  20128. } else {
  20129. return [];
  20130. }
  20131. };
  20132. const pickDay = (day) => {
  20133. realSelectedDay.value = day;
  20134. };
  20135. const selectDate = (type) => {
  20136. const dateMap = {
  20137. "prev-month": prevMonthDayjs.value,
  20138. "next-month": nextMonthDayjs.value,
  20139. "prev-year": prevYearDayjs.value,
  20140. "next-year": nextYearDayjs.value,
  20141. today: now
  20142. };
  20143. const day = dateMap[type];
  20144. if (!day.isSame(date.value, "day")) {
  20145. pickDay(day);
  20146. }
  20147. };
  20148. return {
  20149. calculateValidatedDateRange,
  20150. date,
  20151. realSelectedDay,
  20152. pickDay,
  20153. selectDate,
  20154. validatedRange
  20155. };
  20156. };
  20157. const isValidRange$1 = (range) => isArray$1(range) && range.length === 2 && range.every((item) => isDate$1(item));
  20158. const calendarProps = buildProps({
  20159. modelValue: {
  20160. type: Date
  20161. },
  20162. range: {
  20163. type: definePropType(Array),
  20164. validator: isValidRange$1
  20165. }
  20166. });
  20167. const calendarEmits = {
  20168. [UPDATE_MODEL_EVENT]: (value) => isDate$1(value),
  20169. [INPUT_EVENT]: (value) => isDate$1(value)
  20170. };
  20171. const COMPONENT_NAME$g = "ElCalendar";
  20172. const __default__$1s = vue.defineComponent({
  20173. name: COMPONENT_NAME$g
  20174. });
  20175. const _sfc_main$21 = /* @__PURE__ */ vue.defineComponent({
  20176. ...__default__$1s,
  20177. props: calendarProps,
  20178. emits: calendarEmits,
  20179. setup(__props, { expose, emit }) {
  20180. const props = __props;
  20181. const ns = useNamespace("calendar");
  20182. const {
  20183. calculateValidatedDateRange,
  20184. date,
  20185. pickDay,
  20186. realSelectedDay,
  20187. selectDate,
  20188. validatedRange
  20189. } = useCalendar(props, emit);
  20190. const { t } = useLocale();
  20191. const i18nDate = vue.computed(() => {
  20192. const pickedMonth = `el.datepicker.month${date.value.format("M")}`;
  20193. return `${date.value.year()} ${t("el.datepicker.year")} ${t(pickedMonth)}`;
  20194. });
  20195. expose({
  20196. selectedDay: realSelectedDay,
  20197. pickDay,
  20198. selectDate,
  20199. calculateValidatedDateRange
  20200. });
  20201. return (_ctx, _cache) => {
  20202. return vue.openBlock(), vue.createElementBlock("div", {
  20203. class: vue.normalizeClass(vue.unref(ns).b())
  20204. }, [
  20205. vue.createElementVNode("div", {
  20206. class: vue.normalizeClass(vue.unref(ns).e("header"))
  20207. }, [
  20208. vue.renderSlot(_ctx.$slots, "header", { date: vue.unref(i18nDate) }, () => [
  20209. vue.createElementVNode("div", {
  20210. class: vue.normalizeClass(vue.unref(ns).e("title"))
  20211. }, vue.toDisplayString(vue.unref(i18nDate)), 3),
  20212. vue.unref(validatedRange).length === 0 ? (vue.openBlock(), vue.createElementBlock("div", {
  20213. key: 0,
  20214. class: vue.normalizeClass(vue.unref(ns).e("button-group"))
  20215. }, [
  20216. vue.createVNode(vue.unref(ElButtonGroup$1), null, {
  20217. default: vue.withCtx(() => [
  20218. vue.createVNode(vue.unref(ElButton), {
  20219. size: "small",
  20220. onClick: ($event) => vue.unref(selectDate)("prev-month")
  20221. }, {
  20222. default: vue.withCtx(() => [
  20223. vue.createTextVNode(vue.toDisplayString(vue.unref(t)("el.datepicker.prevMonth")), 1)
  20224. ]),
  20225. _: 1
  20226. }, 8, ["onClick"]),
  20227. vue.createVNode(vue.unref(ElButton), {
  20228. size: "small",
  20229. onClick: ($event) => vue.unref(selectDate)("today")
  20230. }, {
  20231. default: vue.withCtx(() => [
  20232. vue.createTextVNode(vue.toDisplayString(vue.unref(t)("el.datepicker.today")), 1)
  20233. ]),
  20234. _: 1
  20235. }, 8, ["onClick"]),
  20236. vue.createVNode(vue.unref(ElButton), {
  20237. size: "small",
  20238. onClick: ($event) => vue.unref(selectDate)("next-month")
  20239. }, {
  20240. default: vue.withCtx(() => [
  20241. vue.createTextVNode(vue.toDisplayString(vue.unref(t)("el.datepicker.nextMonth")), 1)
  20242. ]),
  20243. _: 1
  20244. }, 8, ["onClick"])
  20245. ]),
  20246. _: 1
  20247. })
  20248. ], 2)) : vue.createCommentVNode("v-if", true)
  20249. ])
  20250. ], 2),
  20251. vue.unref(validatedRange).length === 0 ? (vue.openBlock(), vue.createElementBlock("div", {
  20252. key: 0,
  20253. class: vue.normalizeClass(vue.unref(ns).e("body"))
  20254. }, [
  20255. vue.createVNode(DateTable$1, {
  20256. date: vue.unref(date),
  20257. "selected-day": vue.unref(realSelectedDay),
  20258. onPick: vue.unref(pickDay)
  20259. }, vue.createSlots({
  20260. _: 2
  20261. }, [
  20262. _ctx.$slots["date-cell"] ? {
  20263. name: "date-cell",
  20264. fn: vue.withCtx((data) => [
  20265. vue.renderSlot(_ctx.$slots, "date-cell", vue.normalizeProps(vue.guardReactiveProps(data)))
  20266. ])
  20267. } : void 0
  20268. ]), 1032, ["date", "selected-day", "onPick"])
  20269. ], 2)) : (vue.openBlock(), vue.createElementBlock("div", {
  20270. key: 1,
  20271. class: vue.normalizeClass(vue.unref(ns).e("body"))
  20272. }, [
  20273. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(validatedRange), (range_, index) => {
  20274. return vue.openBlock(), vue.createBlock(DateTable$1, {
  20275. key: index,
  20276. date: range_[0],
  20277. "selected-day": vue.unref(realSelectedDay),
  20278. range: range_,
  20279. "hide-header": index !== 0,
  20280. onPick: vue.unref(pickDay)
  20281. }, vue.createSlots({
  20282. _: 2
  20283. }, [
  20284. _ctx.$slots["date-cell"] ? {
  20285. name: "date-cell",
  20286. fn: vue.withCtx((data) => [
  20287. vue.renderSlot(_ctx.$slots, "date-cell", vue.normalizeProps(vue.guardReactiveProps(data)))
  20288. ])
  20289. } : void 0
  20290. ]), 1032, ["date", "selected-day", "range", "hide-header", "onPick"]);
  20291. }), 128))
  20292. ], 2))
  20293. ], 2);
  20294. };
  20295. }
  20296. });
  20297. var Calendar = /* @__PURE__ */ _export_sfc(_sfc_main$21, [["__file", "calendar.vue"]]);
  20298. const ElCalendar = withInstall(Calendar);
  20299. const cardProps = buildProps({
  20300. header: {
  20301. type: String,
  20302. default: ""
  20303. },
  20304. footer: {
  20305. type: String,
  20306. default: ""
  20307. },
  20308. bodyStyle: {
  20309. type: definePropType([String, Object, Array]),
  20310. default: ""
  20311. },
  20312. bodyClass: String,
  20313. shadow: {
  20314. type: String,
  20315. values: ["always", "hover", "never"],
  20316. default: "always"
  20317. }
  20318. });
  20319. const __default__$1r = vue.defineComponent({
  20320. name: "ElCard"
  20321. });
  20322. const _sfc_main$20 = /* @__PURE__ */ vue.defineComponent({
  20323. ...__default__$1r,
  20324. props: cardProps,
  20325. setup(__props) {
  20326. const ns = useNamespace("card");
  20327. return (_ctx, _cache) => {
  20328. return vue.openBlock(), vue.createElementBlock("div", {
  20329. class: vue.normalizeClass([vue.unref(ns).b(), vue.unref(ns).is(`${_ctx.shadow}-shadow`)])
  20330. }, [
  20331. _ctx.$slots.header || _ctx.header ? (vue.openBlock(), vue.createElementBlock("div", {
  20332. key: 0,
  20333. class: vue.normalizeClass(vue.unref(ns).e("header"))
  20334. }, [
  20335. vue.renderSlot(_ctx.$slots, "header", {}, () => [
  20336. vue.createTextVNode(vue.toDisplayString(_ctx.header), 1)
  20337. ])
  20338. ], 2)) : vue.createCommentVNode("v-if", true),
  20339. vue.createElementVNode("div", {
  20340. class: vue.normalizeClass([vue.unref(ns).e("body"), _ctx.bodyClass]),
  20341. style: vue.normalizeStyle(_ctx.bodyStyle)
  20342. }, [
  20343. vue.renderSlot(_ctx.$slots, "default")
  20344. ], 6),
  20345. _ctx.$slots.footer || _ctx.footer ? (vue.openBlock(), vue.createElementBlock("div", {
  20346. key: 1,
  20347. class: vue.normalizeClass(vue.unref(ns).e("footer"))
  20348. }, [
  20349. vue.renderSlot(_ctx.$slots, "footer", {}, () => [
  20350. vue.createTextVNode(vue.toDisplayString(_ctx.footer), 1)
  20351. ])
  20352. ], 2)) : vue.createCommentVNode("v-if", true)
  20353. ], 2);
  20354. };
  20355. }
  20356. });
  20357. var Card = /* @__PURE__ */ _export_sfc(_sfc_main$20, [["__file", "card.vue"]]);
  20358. const ElCard = withInstall(Card);
  20359. const carouselProps = buildProps({
  20360. initialIndex: {
  20361. type: Number,
  20362. default: 0
  20363. },
  20364. height: {
  20365. type: String,
  20366. default: ""
  20367. },
  20368. trigger: {
  20369. type: String,
  20370. values: ["hover", "click"],
  20371. default: "hover"
  20372. },
  20373. autoplay: {
  20374. type: Boolean,
  20375. default: true
  20376. },
  20377. interval: {
  20378. type: Number,
  20379. default: 3e3
  20380. },
  20381. indicatorPosition: {
  20382. type: String,
  20383. values: ["", "none", "outside"],
  20384. default: ""
  20385. },
  20386. arrow: {
  20387. type: String,
  20388. values: ["always", "hover", "never"],
  20389. default: "hover"
  20390. },
  20391. type: {
  20392. type: String,
  20393. values: ["", "card"],
  20394. default: ""
  20395. },
  20396. cardScale: {
  20397. type: Number,
  20398. default: 0.83
  20399. },
  20400. loop: {
  20401. type: Boolean,
  20402. default: true
  20403. },
  20404. direction: {
  20405. type: String,
  20406. values: ["horizontal", "vertical"],
  20407. default: "horizontal"
  20408. },
  20409. pauseOnHover: {
  20410. type: Boolean,
  20411. default: true
  20412. },
  20413. motionBlur: Boolean
  20414. });
  20415. const carouselEmits = {
  20416. change: (current, prev) => [current, prev].every(isNumber)
  20417. };
  20418. const carouselContextKey = Symbol("carouselContextKey");
  20419. const CAROUSEL_ITEM_NAME = "ElCarouselItem";
  20420. const THROTTLE_TIME = 300;
  20421. const useCarousel = (props, emit, componentName) => {
  20422. const {
  20423. children: items,
  20424. addChild: addItem,
  20425. removeChild: removeItem
  20426. } = useOrderedChildren(vue.getCurrentInstance(), CAROUSEL_ITEM_NAME);
  20427. const slots = vue.useSlots();
  20428. const activeIndex = vue.ref(-1);
  20429. const timer = vue.ref(null);
  20430. const hover = vue.ref(false);
  20431. const root = vue.ref();
  20432. const containerHeight = vue.ref(0);
  20433. const isItemsTwoLength = vue.ref(true);
  20434. const isFirstCall = vue.ref(true);
  20435. const isTransitioning = vue.ref(false);
  20436. const arrowDisplay = vue.computed(() => props.arrow !== "never" && !vue.unref(isVertical));
  20437. const hasLabel = vue.computed(() => {
  20438. return items.value.some((item) => item.props.label.toString().length > 0);
  20439. });
  20440. const isCardType = vue.computed(() => props.type === "card");
  20441. const isVertical = vue.computed(() => props.direction === "vertical");
  20442. const containerStyle = vue.computed(() => {
  20443. if (props.height !== "auto") {
  20444. return {
  20445. height: props.height
  20446. };
  20447. }
  20448. return {
  20449. height: `${containerHeight.value}px`,
  20450. overflow: "hidden"
  20451. };
  20452. });
  20453. const throttledArrowClick = throttle((index) => {
  20454. setActiveItem(index);
  20455. }, THROTTLE_TIME, { trailing: true });
  20456. const throttledIndicatorHover = throttle((index) => {
  20457. handleIndicatorHover(index);
  20458. }, THROTTLE_TIME);
  20459. const isTwoLengthShow = (index) => {
  20460. if (!isItemsTwoLength.value)
  20461. return true;
  20462. return activeIndex.value <= 1 ? index <= 1 : index > 1;
  20463. };
  20464. function pauseTimer() {
  20465. if (timer.value) {
  20466. clearInterval(timer.value);
  20467. timer.value = null;
  20468. }
  20469. }
  20470. function startTimer() {
  20471. if (props.interval <= 0 || !props.autoplay || timer.value)
  20472. return;
  20473. timer.value = setInterval(() => playSlides(), props.interval);
  20474. }
  20475. const playSlides = () => {
  20476. if (!isFirstCall.value) {
  20477. isTransitioning.value = true;
  20478. }
  20479. isFirstCall.value = false;
  20480. if (activeIndex.value < items.value.length - 1) {
  20481. activeIndex.value = activeIndex.value + 1;
  20482. } else if (props.loop) {
  20483. activeIndex.value = 0;
  20484. } else {
  20485. isTransitioning.value = false;
  20486. }
  20487. };
  20488. function setActiveItem(index) {
  20489. if (!isFirstCall.value) {
  20490. isTransitioning.value = true;
  20491. }
  20492. isFirstCall.value = false;
  20493. if (isString$1(index)) {
  20494. const filteredItems = items.value.filter((item) => item.props.name === index);
  20495. if (filteredItems.length > 0) {
  20496. index = items.value.indexOf(filteredItems[0]);
  20497. }
  20498. }
  20499. index = Number(index);
  20500. if (Number.isNaN(index) || index !== Math.floor(index)) {
  20501. return;
  20502. }
  20503. const itemCount = items.value.length;
  20504. const oldIndex = activeIndex.value;
  20505. if (index < 0) {
  20506. activeIndex.value = props.loop ? itemCount - 1 : 0;
  20507. } else if (index >= itemCount) {
  20508. activeIndex.value = props.loop ? 0 : itemCount - 1;
  20509. } else {
  20510. activeIndex.value = index;
  20511. }
  20512. if (oldIndex === activeIndex.value) {
  20513. resetItemPosition(oldIndex);
  20514. }
  20515. resetTimer();
  20516. }
  20517. function resetItemPosition(oldIndex) {
  20518. items.value.forEach((item, index) => {
  20519. item.translateItem(index, activeIndex.value, oldIndex);
  20520. });
  20521. }
  20522. function itemInStage(item, index) {
  20523. var _a, _b, _c, _d;
  20524. const _items = vue.unref(items);
  20525. const itemCount = _items.length;
  20526. if (itemCount === 0 || !item.states.inStage)
  20527. return false;
  20528. const nextItemIndex = index + 1;
  20529. const prevItemIndex = index - 1;
  20530. const lastItemIndex = itemCount - 1;
  20531. const isLastItemActive = _items[lastItemIndex].states.active;
  20532. const isFirstItemActive = _items[0].states.active;
  20533. const isNextItemActive = (_b = (_a = _items[nextItemIndex]) == null ? void 0 : _a.states) == null ? void 0 : _b.active;
  20534. const isPrevItemActive = (_d = (_c = _items[prevItemIndex]) == null ? void 0 : _c.states) == null ? void 0 : _d.active;
  20535. if (index === lastItemIndex && isFirstItemActive || isNextItemActive) {
  20536. return "left";
  20537. } else if (index === 0 && isLastItemActive || isPrevItemActive) {
  20538. return "right";
  20539. }
  20540. return false;
  20541. }
  20542. function handleMouseEnter() {
  20543. hover.value = true;
  20544. if (props.pauseOnHover) {
  20545. pauseTimer();
  20546. }
  20547. }
  20548. function handleMouseLeave() {
  20549. hover.value = false;
  20550. startTimer();
  20551. }
  20552. function handleTransitionEnd() {
  20553. isTransitioning.value = false;
  20554. }
  20555. function handleButtonEnter(arrow) {
  20556. if (vue.unref(isVertical))
  20557. return;
  20558. items.value.forEach((item, index) => {
  20559. if (arrow === itemInStage(item, index)) {
  20560. item.states.hover = true;
  20561. }
  20562. });
  20563. }
  20564. function handleButtonLeave() {
  20565. if (vue.unref(isVertical))
  20566. return;
  20567. items.value.forEach((item) => {
  20568. item.states.hover = false;
  20569. });
  20570. }
  20571. function handleIndicatorClick(index) {
  20572. if (index !== activeIndex.value) {
  20573. if (!isFirstCall.value) {
  20574. isTransitioning.value = true;
  20575. }
  20576. }
  20577. activeIndex.value = index;
  20578. }
  20579. function handleIndicatorHover(index) {
  20580. if (props.trigger === "hover" && index !== activeIndex.value) {
  20581. activeIndex.value = index;
  20582. if (!isFirstCall.value) {
  20583. isTransitioning.value = true;
  20584. }
  20585. }
  20586. }
  20587. function prev() {
  20588. setActiveItem(activeIndex.value - 1);
  20589. }
  20590. function next() {
  20591. setActiveItem(activeIndex.value + 1);
  20592. }
  20593. function resetTimer() {
  20594. pauseTimer();
  20595. if (!props.pauseOnHover)
  20596. startTimer();
  20597. }
  20598. function setContainerHeight(height) {
  20599. if (props.height !== "auto")
  20600. return;
  20601. containerHeight.value = height;
  20602. }
  20603. function PlaceholderItem() {
  20604. var _a;
  20605. const defaultSlots = (_a = slots.default) == null ? void 0 : _a.call(slots);
  20606. if (!defaultSlots)
  20607. return null;
  20608. const flatSlots = flattedChildren(defaultSlots);
  20609. const normalizeSlots = flatSlots.filter((slot) => {
  20610. return vue.isVNode(slot) && slot.type.name === CAROUSEL_ITEM_NAME;
  20611. });
  20612. if ((normalizeSlots == null ? void 0 : normalizeSlots.length) === 2 && props.loop && !isCardType.value) {
  20613. isItemsTwoLength.value = true;
  20614. return normalizeSlots;
  20615. }
  20616. isItemsTwoLength.value = false;
  20617. return null;
  20618. }
  20619. vue.watch(() => activeIndex.value, (current, prev2) => {
  20620. resetItemPosition(prev2);
  20621. if (isItemsTwoLength.value) {
  20622. current = current % 2;
  20623. prev2 = prev2 % 2;
  20624. }
  20625. if (prev2 > -1) {
  20626. emit("change", current, prev2);
  20627. }
  20628. });
  20629. vue.watch(() => props.autoplay, (autoplay) => {
  20630. autoplay ? startTimer() : pauseTimer();
  20631. });
  20632. vue.watch(() => props.loop, () => {
  20633. setActiveItem(activeIndex.value);
  20634. });
  20635. vue.watch(() => props.interval, () => {
  20636. resetTimer();
  20637. });
  20638. const resizeObserver = vue.shallowRef();
  20639. vue.onMounted(() => {
  20640. vue.watch(() => items.value, () => {
  20641. if (items.value.length > 0)
  20642. setActiveItem(props.initialIndex);
  20643. }, {
  20644. immediate: true
  20645. });
  20646. resizeObserver.value = useResizeObserver(root.value, () => {
  20647. resetItemPosition();
  20648. });
  20649. startTimer();
  20650. });
  20651. vue.onBeforeUnmount(() => {
  20652. pauseTimer();
  20653. if (root.value && resizeObserver.value)
  20654. resizeObserver.value.stop();
  20655. });
  20656. vue.provide(carouselContextKey, {
  20657. root,
  20658. isCardType,
  20659. isVertical,
  20660. items,
  20661. loop: props.loop,
  20662. cardScale: props.cardScale,
  20663. addItem,
  20664. removeItem,
  20665. setActiveItem,
  20666. setContainerHeight
  20667. });
  20668. return {
  20669. root,
  20670. activeIndex,
  20671. arrowDisplay,
  20672. hasLabel,
  20673. hover,
  20674. isCardType,
  20675. isTransitioning,
  20676. items,
  20677. isVertical,
  20678. containerStyle,
  20679. isItemsTwoLength,
  20680. handleButtonEnter,
  20681. handleTransitionEnd,
  20682. handleButtonLeave,
  20683. handleIndicatorClick,
  20684. handleMouseEnter,
  20685. handleMouseLeave,
  20686. setActiveItem,
  20687. prev,
  20688. next,
  20689. PlaceholderItem,
  20690. isTwoLengthShow,
  20691. throttledArrowClick,
  20692. throttledIndicatorHover
  20693. };
  20694. };
  20695. const COMPONENT_NAME$f = "ElCarousel";
  20696. const __default__$1q = vue.defineComponent({
  20697. name: COMPONENT_NAME$f
  20698. });
  20699. const _sfc_main$1$ = /* @__PURE__ */ vue.defineComponent({
  20700. ...__default__$1q,
  20701. props: carouselProps,
  20702. emits: carouselEmits,
  20703. setup(__props, { expose, emit }) {
  20704. const props = __props;
  20705. const {
  20706. root,
  20707. activeIndex,
  20708. arrowDisplay,
  20709. hasLabel,
  20710. hover,
  20711. isCardType,
  20712. items,
  20713. isVertical,
  20714. containerStyle,
  20715. handleButtonEnter,
  20716. handleButtonLeave,
  20717. isTransitioning,
  20718. handleIndicatorClick,
  20719. handleMouseEnter,
  20720. handleMouseLeave,
  20721. handleTransitionEnd,
  20722. setActiveItem,
  20723. prev,
  20724. next,
  20725. PlaceholderItem,
  20726. isTwoLengthShow,
  20727. throttledArrowClick,
  20728. throttledIndicatorHover
  20729. } = useCarousel(props, emit);
  20730. const ns = useNamespace("carousel");
  20731. const { t } = useLocale();
  20732. const carouselClasses = vue.computed(() => {
  20733. const classes = [ns.b(), ns.m(props.direction)];
  20734. if (vue.unref(isCardType)) {
  20735. classes.push(ns.m("card"));
  20736. }
  20737. return classes;
  20738. });
  20739. const carouselContainer = vue.computed(() => {
  20740. const classes = [ns.e("container")];
  20741. if (props.motionBlur && vue.unref(isTransitioning) && items.value.length > 1) {
  20742. classes.push(vue.unref(isVertical) ? `${ns.namespace.value}-transitioning-vertical` : `${ns.namespace.value}-transitioning`);
  20743. }
  20744. return classes;
  20745. });
  20746. const indicatorsClasses = vue.computed(() => {
  20747. const classes = [ns.e("indicators"), ns.em("indicators", props.direction)];
  20748. if (vue.unref(hasLabel)) {
  20749. classes.push(ns.em("indicators", "labels"));
  20750. }
  20751. if (props.indicatorPosition === "outside") {
  20752. classes.push(ns.em("indicators", "outside"));
  20753. }
  20754. if (vue.unref(isVertical)) {
  20755. classes.push(ns.em("indicators", "right"));
  20756. }
  20757. return classes;
  20758. });
  20759. expose({
  20760. activeIndex,
  20761. setActiveItem,
  20762. prev,
  20763. next
  20764. });
  20765. return (_ctx, _cache) => {
  20766. return vue.openBlock(), vue.createElementBlock("div", {
  20767. ref_key: "root",
  20768. ref: root,
  20769. class: vue.normalizeClass(vue.unref(carouselClasses)),
  20770. onMouseenter: vue.withModifiers(vue.unref(handleMouseEnter), ["stop"]),
  20771. onMouseleave: vue.withModifiers(vue.unref(handleMouseLeave), ["stop"])
  20772. }, [
  20773. vue.unref(arrowDisplay) ? (vue.openBlock(), vue.createBlock(vue.Transition, {
  20774. key: 0,
  20775. name: "carousel-arrow-left",
  20776. persisted: ""
  20777. }, {
  20778. default: vue.withCtx(() => [
  20779. vue.withDirectives(vue.createElementVNode("button", {
  20780. type: "button",
  20781. class: vue.normalizeClass([vue.unref(ns).e("arrow"), vue.unref(ns).em("arrow", "left")]),
  20782. "aria-label": vue.unref(t)("el.carousel.leftArrow"),
  20783. onMouseenter: ($event) => vue.unref(handleButtonEnter)("left"),
  20784. onMouseleave: vue.unref(handleButtonLeave),
  20785. onClick: vue.withModifiers(($event) => vue.unref(throttledArrowClick)(vue.unref(activeIndex) - 1), ["stop"])
  20786. }, [
  20787. vue.createVNode(vue.unref(ElIcon), null, {
  20788. default: vue.withCtx(() => [
  20789. vue.createVNode(vue.unref(arrow_left_default))
  20790. ]),
  20791. _: 1
  20792. })
  20793. ], 42, ["aria-label", "onMouseenter", "onMouseleave", "onClick"]), [
  20794. [
  20795. vue.vShow,
  20796. (_ctx.arrow === "always" || vue.unref(hover)) && (props.loop || vue.unref(activeIndex) > 0)
  20797. ]
  20798. ])
  20799. ]),
  20800. _: 1
  20801. })) : vue.createCommentVNode("v-if", true),
  20802. vue.unref(arrowDisplay) ? (vue.openBlock(), vue.createBlock(vue.Transition, {
  20803. key: 1,
  20804. name: "carousel-arrow-right",
  20805. persisted: ""
  20806. }, {
  20807. default: vue.withCtx(() => [
  20808. vue.withDirectives(vue.createElementVNode("button", {
  20809. type: "button",
  20810. class: vue.normalizeClass([vue.unref(ns).e("arrow"), vue.unref(ns).em("arrow", "right")]),
  20811. "aria-label": vue.unref(t)("el.carousel.rightArrow"),
  20812. onMouseenter: ($event) => vue.unref(handleButtonEnter)("right"),
  20813. onMouseleave: vue.unref(handleButtonLeave),
  20814. onClick: vue.withModifiers(($event) => vue.unref(throttledArrowClick)(vue.unref(activeIndex) + 1), ["stop"])
  20815. }, [
  20816. vue.createVNode(vue.unref(ElIcon), null, {
  20817. default: vue.withCtx(() => [
  20818. vue.createVNode(vue.unref(arrow_right_default))
  20819. ]),
  20820. _: 1
  20821. })
  20822. ], 42, ["aria-label", "onMouseenter", "onMouseleave", "onClick"]), [
  20823. [
  20824. vue.vShow,
  20825. (_ctx.arrow === "always" || vue.unref(hover)) && (props.loop || vue.unref(activeIndex) < vue.unref(items).length - 1)
  20826. ]
  20827. ])
  20828. ]),
  20829. _: 1
  20830. })) : vue.createCommentVNode("v-if", true),
  20831. vue.createElementVNode("div", {
  20832. class: vue.normalizeClass(vue.unref(carouselContainer)),
  20833. style: vue.normalizeStyle(vue.unref(containerStyle)),
  20834. onTransitionend: vue.unref(handleTransitionEnd)
  20835. }, [
  20836. vue.createVNode(vue.unref(PlaceholderItem)),
  20837. vue.renderSlot(_ctx.$slots, "default")
  20838. ], 46, ["onTransitionend"]),
  20839. _ctx.indicatorPosition !== "none" ? (vue.openBlock(), vue.createElementBlock("ul", {
  20840. key: 2,
  20841. class: vue.normalizeClass(vue.unref(indicatorsClasses))
  20842. }, [
  20843. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(items), (item, index) => {
  20844. return vue.withDirectives((vue.openBlock(), vue.createElementBlock("li", {
  20845. key: index,
  20846. class: vue.normalizeClass([
  20847. vue.unref(ns).e("indicator"),
  20848. vue.unref(ns).em("indicator", _ctx.direction),
  20849. vue.unref(ns).is("active", index === vue.unref(activeIndex))
  20850. ]),
  20851. onMouseenter: ($event) => vue.unref(throttledIndicatorHover)(index),
  20852. onClick: vue.withModifiers(($event) => vue.unref(handleIndicatorClick)(index), ["stop"])
  20853. }, [
  20854. vue.createElementVNode("button", {
  20855. class: vue.normalizeClass(vue.unref(ns).e("button")),
  20856. "aria-label": vue.unref(t)("el.carousel.indicator", { index: index + 1 })
  20857. }, [
  20858. vue.unref(hasLabel) ? (vue.openBlock(), vue.createElementBlock("span", { key: 0 }, vue.toDisplayString(item.props.label), 1)) : vue.createCommentVNode("v-if", true)
  20859. ], 10, ["aria-label"])
  20860. ], 42, ["onMouseenter", "onClick"])), [
  20861. [vue.vShow, vue.unref(isTwoLengthShow)(index)]
  20862. ]);
  20863. }), 128))
  20864. ], 2)) : vue.createCommentVNode("v-if", true),
  20865. props.motionBlur ? (vue.openBlock(), vue.createElementBlock("svg", {
  20866. key: 3,
  20867. xmlns: "http://www.w3.org/2000/svg",
  20868. version: "1.1",
  20869. style: { "display": "none" }
  20870. }, [
  20871. vue.createElementVNode("defs", null, [
  20872. vue.createElementVNode("filter", { id: "elCarouselHorizontal" }, [
  20873. vue.createElementVNode("feGaussianBlur", {
  20874. in: "SourceGraphic",
  20875. stdDeviation: "12,0"
  20876. })
  20877. ]),
  20878. vue.createElementVNode("filter", { id: "elCarouselVertical" }, [
  20879. vue.createElementVNode("feGaussianBlur", {
  20880. in: "SourceGraphic",
  20881. stdDeviation: "0,10"
  20882. })
  20883. ])
  20884. ])
  20885. ])) : vue.createCommentVNode("v-if", true)
  20886. ], 42, ["onMouseenter", "onMouseleave"]);
  20887. };
  20888. }
  20889. });
  20890. var Carousel = /* @__PURE__ */ _export_sfc(_sfc_main$1$, [["__file", "carousel.vue"]]);
  20891. const carouselItemProps = buildProps({
  20892. name: { type: String, default: "" },
  20893. label: {
  20894. type: [String, Number],
  20895. default: ""
  20896. }
  20897. });
  20898. const useCarouselItem = (props) => {
  20899. const carouselContext = vue.inject(carouselContextKey);
  20900. const instance = vue.getCurrentInstance();
  20901. const carouselItemRef = vue.ref();
  20902. const hover = vue.ref(false);
  20903. const translate = vue.ref(0);
  20904. const scale = vue.ref(1);
  20905. const active = vue.ref(false);
  20906. const ready = vue.ref(false);
  20907. const inStage = vue.ref(false);
  20908. const animating = vue.ref(false);
  20909. const { isCardType, isVertical, cardScale } = carouselContext;
  20910. function processIndex(index, activeIndex, length) {
  20911. const lastItemIndex = length - 1;
  20912. const prevItemIndex = activeIndex - 1;
  20913. const nextItemIndex = activeIndex + 1;
  20914. const halfItemIndex = length / 2;
  20915. if (activeIndex === 0 && index === lastItemIndex) {
  20916. return -1;
  20917. } else if (activeIndex === lastItemIndex && index === 0) {
  20918. return length;
  20919. } else if (index < prevItemIndex && activeIndex - index >= halfItemIndex) {
  20920. return length + 1;
  20921. } else if (index > nextItemIndex && index - activeIndex >= halfItemIndex) {
  20922. return -2;
  20923. }
  20924. return index;
  20925. }
  20926. function calcCardTranslate(index, activeIndex) {
  20927. var _a, _b;
  20928. const parentWidth = vue.unref(isVertical) ? ((_a = carouselContext.root.value) == null ? void 0 : _a.offsetHeight) || 0 : ((_b = carouselContext.root.value) == null ? void 0 : _b.offsetWidth) || 0;
  20929. if (inStage.value) {
  20930. return parentWidth * ((2 - cardScale) * (index - activeIndex) + 1) / 4;
  20931. } else if (index < activeIndex) {
  20932. return -(1 + cardScale) * parentWidth / 4;
  20933. } else {
  20934. return (3 + cardScale) * parentWidth / 4;
  20935. }
  20936. }
  20937. function calcTranslate(index, activeIndex, isVertical2) {
  20938. const rootEl = carouselContext.root.value;
  20939. if (!rootEl)
  20940. return 0;
  20941. const distance = (isVertical2 ? rootEl.offsetHeight : rootEl.offsetWidth) || 0;
  20942. return distance * (index - activeIndex);
  20943. }
  20944. const translateItem = (index, activeIndex, oldIndex) => {
  20945. var _a;
  20946. const _isCardType = vue.unref(isCardType);
  20947. const carouselItemLength = (_a = carouselContext.items.value.length) != null ? _a : Number.NaN;
  20948. const isActive = index === activeIndex;
  20949. if (!_isCardType && !isUndefined(oldIndex)) {
  20950. animating.value = isActive || index === oldIndex;
  20951. }
  20952. if (!isActive && carouselItemLength > 2 && carouselContext.loop) {
  20953. index = processIndex(index, activeIndex, carouselItemLength);
  20954. }
  20955. const _isVertical = vue.unref(isVertical);
  20956. active.value = isActive;
  20957. if (_isCardType) {
  20958. inStage.value = Math.round(Math.abs(index - activeIndex)) <= 1;
  20959. translate.value = calcCardTranslate(index, activeIndex);
  20960. scale.value = vue.unref(active) ? 1 : cardScale;
  20961. } else {
  20962. translate.value = calcTranslate(index, activeIndex, _isVertical);
  20963. }
  20964. ready.value = true;
  20965. if (isActive && carouselItemRef.value) {
  20966. carouselContext.setContainerHeight(carouselItemRef.value.offsetHeight);
  20967. }
  20968. };
  20969. function handleItemClick() {
  20970. if (carouselContext && vue.unref(isCardType)) {
  20971. const index = carouselContext.items.value.findIndex(({ uid }) => uid === instance.uid);
  20972. carouselContext.setActiveItem(index);
  20973. }
  20974. }
  20975. vue.onMounted(() => {
  20976. carouselContext.addItem({
  20977. props,
  20978. states: vue.reactive({
  20979. hover,
  20980. translate,
  20981. scale,
  20982. active,
  20983. ready,
  20984. inStage,
  20985. animating
  20986. }),
  20987. uid: instance.uid,
  20988. translateItem
  20989. });
  20990. });
  20991. vue.onUnmounted(() => {
  20992. carouselContext.removeItem(instance.uid);
  20993. });
  20994. return {
  20995. carouselItemRef,
  20996. active,
  20997. animating,
  20998. hover,
  20999. inStage,
  21000. isVertical,
  21001. translate,
  21002. isCardType,
  21003. scale,
  21004. ready,
  21005. handleItemClick
  21006. };
  21007. };
  21008. const __default__$1p = vue.defineComponent({
  21009. name: CAROUSEL_ITEM_NAME
  21010. });
  21011. const _sfc_main$1_ = /* @__PURE__ */ vue.defineComponent({
  21012. ...__default__$1p,
  21013. props: carouselItemProps,
  21014. setup(__props) {
  21015. const props = __props;
  21016. const ns = useNamespace("carousel");
  21017. const {
  21018. carouselItemRef,
  21019. active,
  21020. animating,
  21021. hover,
  21022. inStage,
  21023. isVertical,
  21024. translate,
  21025. isCardType,
  21026. scale,
  21027. ready,
  21028. handleItemClick
  21029. } = useCarouselItem(props);
  21030. const itemKls = vue.computed(() => [
  21031. ns.e("item"),
  21032. ns.is("active", active.value),
  21033. ns.is("in-stage", inStage.value),
  21034. ns.is("hover", hover.value),
  21035. ns.is("animating", animating.value),
  21036. {
  21037. [ns.em("item", "card")]: isCardType.value,
  21038. [ns.em("item", "card-vertical")]: isCardType.value && isVertical.value
  21039. }
  21040. ]);
  21041. const itemStyle = vue.computed(() => {
  21042. const translateType = `translate${vue.unref(isVertical) ? "Y" : "X"}`;
  21043. const _translate = `${translateType}(${vue.unref(translate)}px)`;
  21044. const _scale = `scale(${vue.unref(scale)})`;
  21045. const transform = [_translate, _scale].join(" ");
  21046. return {
  21047. transform
  21048. };
  21049. });
  21050. return (_ctx, _cache) => {
  21051. return vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  21052. ref_key: "carouselItemRef",
  21053. ref: carouselItemRef,
  21054. class: vue.normalizeClass(vue.unref(itemKls)),
  21055. style: vue.normalizeStyle(vue.unref(itemStyle)),
  21056. onClick: vue.unref(handleItemClick)
  21057. }, [
  21058. vue.unref(isCardType) ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  21059. key: 0,
  21060. class: vue.normalizeClass(vue.unref(ns).e("mask"))
  21061. }, null, 2)), [
  21062. [vue.vShow, !vue.unref(active)]
  21063. ]) : vue.createCommentVNode("v-if", true),
  21064. vue.renderSlot(_ctx.$slots, "default")
  21065. ], 14, ["onClick"])), [
  21066. [vue.vShow, vue.unref(ready)]
  21067. ]);
  21068. };
  21069. }
  21070. });
  21071. var CarouselItem = /* @__PURE__ */ _export_sfc(_sfc_main$1_, [["__file", "carousel-item.vue"]]);
  21072. const ElCarousel = withInstall(Carousel, {
  21073. CarouselItem
  21074. });
  21075. const ElCarouselItem = withNoopInstall(CarouselItem);
  21076. const checkboxProps = {
  21077. modelValue: {
  21078. type: [Number, String, Boolean],
  21079. default: void 0
  21080. },
  21081. label: {
  21082. type: [String, Boolean, Number, Object],
  21083. default: void 0
  21084. },
  21085. value: {
  21086. type: [String, Boolean, Number, Object],
  21087. default: void 0
  21088. },
  21089. indeterminate: Boolean,
  21090. disabled: Boolean,
  21091. checked: Boolean,
  21092. name: {
  21093. type: String,
  21094. default: void 0
  21095. },
  21096. trueValue: {
  21097. type: [String, Number],
  21098. default: void 0
  21099. },
  21100. falseValue: {
  21101. type: [String, Number],
  21102. default: void 0
  21103. },
  21104. trueLabel: {
  21105. type: [String, Number],
  21106. default: void 0
  21107. },
  21108. falseLabel: {
  21109. type: [String, Number],
  21110. default: void 0
  21111. },
  21112. id: {
  21113. type: String,
  21114. default: void 0
  21115. },
  21116. border: Boolean,
  21117. size: useSizeProp,
  21118. tabindex: [String, Number],
  21119. validateEvent: {
  21120. type: Boolean,
  21121. default: true
  21122. },
  21123. ...useAriaProps(["ariaControls"])
  21124. };
  21125. const checkboxEmits = {
  21126. [UPDATE_MODEL_EVENT]: (val) => isString$1(val) || isNumber(val) || isBoolean(val),
  21127. change: (val) => isString$1(val) || isNumber(val) || isBoolean(val)
  21128. };
  21129. const checkboxGroupContextKey = Symbol("checkboxGroupContextKey");
  21130. const useCheckboxDisabled = ({
  21131. model,
  21132. isChecked
  21133. }) => {
  21134. const checkboxGroup = vue.inject(checkboxGroupContextKey, void 0);
  21135. const isLimitDisabled = vue.computed(() => {
  21136. var _a, _b;
  21137. const max = (_a = checkboxGroup == null ? void 0 : checkboxGroup.max) == null ? void 0 : _a.value;
  21138. const min = (_b = checkboxGroup == null ? void 0 : checkboxGroup.min) == null ? void 0 : _b.value;
  21139. return !isUndefined(max) && model.value.length >= max && !isChecked.value || !isUndefined(min) && model.value.length <= min && isChecked.value;
  21140. });
  21141. const isDisabled = useFormDisabled(vue.computed(() => (checkboxGroup == null ? void 0 : checkboxGroup.disabled.value) || isLimitDisabled.value));
  21142. return {
  21143. isDisabled,
  21144. isLimitDisabled
  21145. };
  21146. };
  21147. const useCheckboxEvent = (props, {
  21148. model,
  21149. isLimitExceeded,
  21150. hasOwnLabel,
  21151. isDisabled,
  21152. isLabeledByFormItem
  21153. }) => {
  21154. const checkboxGroup = vue.inject(checkboxGroupContextKey, void 0);
  21155. const { formItem } = useFormItem();
  21156. const { emit } = vue.getCurrentInstance();
  21157. function getLabeledValue(value) {
  21158. var _a, _b, _c, _d;
  21159. return [true, props.trueValue, props.trueLabel].includes(value) ? (_b = (_a = props.trueValue) != null ? _a : props.trueLabel) != null ? _b : true : (_d = (_c = props.falseValue) != null ? _c : props.falseLabel) != null ? _d : false;
  21160. }
  21161. function emitChangeEvent(checked, e) {
  21162. emit("change", getLabeledValue(checked), e);
  21163. }
  21164. function handleChange(e) {
  21165. if (isLimitExceeded.value)
  21166. return;
  21167. const target = e.target;
  21168. emit("change", getLabeledValue(target.checked), e);
  21169. }
  21170. async function onClickRoot(e) {
  21171. if (isLimitExceeded.value)
  21172. return;
  21173. if (!hasOwnLabel.value && !isDisabled.value && isLabeledByFormItem.value) {
  21174. const eventTargets = e.composedPath();
  21175. const hasLabel = eventTargets.some((item) => item.tagName === "LABEL");
  21176. if (!hasLabel) {
  21177. model.value = getLabeledValue([false, props.falseValue, props.falseLabel].includes(model.value));
  21178. await vue.nextTick();
  21179. emitChangeEvent(model.value, e);
  21180. }
  21181. }
  21182. }
  21183. const validateEvent = vue.computed(() => (checkboxGroup == null ? void 0 : checkboxGroup.validateEvent) || props.validateEvent);
  21184. vue.watch(() => props.modelValue, () => {
  21185. if (validateEvent.value) {
  21186. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
  21187. }
  21188. });
  21189. return {
  21190. handleChange,
  21191. onClickRoot
  21192. };
  21193. };
  21194. const useCheckboxModel = (props) => {
  21195. const selfModel = vue.ref(false);
  21196. const { emit } = vue.getCurrentInstance();
  21197. const checkboxGroup = vue.inject(checkboxGroupContextKey, void 0);
  21198. const isGroup = vue.computed(() => isUndefined(checkboxGroup) === false);
  21199. const isLimitExceeded = vue.ref(false);
  21200. const model = vue.computed({
  21201. get() {
  21202. var _a, _b;
  21203. return isGroup.value ? (_a = checkboxGroup == null ? void 0 : checkboxGroup.modelValue) == null ? void 0 : _a.value : (_b = props.modelValue) != null ? _b : selfModel.value;
  21204. },
  21205. set(val) {
  21206. var _a, _b;
  21207. if (isGroup.value && isArray$1(val)) {
  21208. isLimitExceeded.value = ((_a = checkboxGroup == null ? void 0 : checkboxGroup.max) == null ? void 0 : _a.value) !== void 0 && val.length > (checkboxGroup == null ? void 0 : checkboxGroup.max.value) && val.length > model.value.length;
  21209. isLimitExceeded.value === false && ((_b = checkboxGroup == null ? void 0 : checkboxGroup.changeEvent) == null ? void 0 : _b.call(checkboxGroup, val));
  21210. } else {
  21211. emit(UPDATE_MODEL_EVENT, val);
  21212. selfModel.value = val;
  21213. }
  21214. }
  21215. });
  21216. return {
  21217. model,
  21218. isGroup,
  21219. isLimitExceeded
  21220. };
  21221. };
  21222. const useCheckboxStatus = (props, slots, { model }) => {
  21223. const checkboxGroup = vue.inject(checkboxGroupContextKey, void 0);
  21224. const isFocused = vue.ref(false);
  21225. const actualValue = vue.computed(() => {
  21226. if (!isPropAbsent(props.value)) {
  21227. return props.value;
  21228. }
  21229. return props.label;
  21230. });
  21231. const isChecked = vue.computed(() => {
  21232. const value = model.value;
  21233. if (isBoolean(value)) {
  21234. return value;
  21235. } else if (isArray$1(value)) {
  21236. if (isObject$1(actualValue.value)) {
  21237. return value.map(vue.toRaw).some((o) => isEqual$1(o, actualValue.value));
  21238. } else {
  21239. return value.map(vue.toRaw).includes(actualValue.value);
  21240. }
  21241. } else if (value !== null && value !== void 0) {
  21242. return value === props.trueValue || value === props.trueLabel;
  21243. } else {
  21244. return !!value;
  21245. }
  21246. });
  21247. const checkboxButtonSize = useFormSize(vue.computed(() => {
  21248. var _a;
  21249. return (_a = checkboxGroup == null ? void 0 : checkboxGroup.size) == null ? void 0 : _a.value;
  21250. }), {
  21251. prop: true
  21252. });
  21253. const checkboxSize = useFormSize(vue.computed(() => {
  21254. var _a;
  21255. return (_a = checkboxGroup == null ? void 0 : checkboxGroup.size) == null ? void 0 : _a.value;
  21256. }));
  21257. const hasOwnLabel = vue.computed(() => {
  21258. return !!slots.default || !isPropAbsent(actualValue.value);
  21259. });
  21260. return {
  21261. checkboxButtonSize,
  21262. isChecked,
  21263. isFocused,
  21264. checkboxSize,
  21265. hasOwnLabel,
  21266. actualValue
  21267. };
  21268. };
  21269. const useCheckbox = (props, slots) => {
  21270. const { formItem: elFormItem } = useFormItem();
  21271. const { model, isGroup, isLimitExceeded } = useCheckboxModel(props);
  21272. const {
  21273. isFocused,
  21274. isChecked,
  21275. checkboxButtonSize,
  21276. checkboxSize,
  21277. hasOwnLabel,
  21278. actualValue
  21279. } = useCheckboxStatus(props, slots, { model });
  21280. const { isDisabled } = useCheckboxDisabled({ model, isChecked });
  21281. const { inputId, isLabeledByFormItem } = useFormItemInputId(props, {
  21282. formItemContext: elFormItem,
  21283. disableIdGeneration: hasOwnLabel,
  21284. disableIdManagement: isGroup
  21285. });
  21286. const { handleChange, onClickRoot } = useCheckboxEvent(props, {
  21287. model,
  21288. isLimitExceeded,
  21289. hasOwnLabel,
  21290. isDisabled,
  21291. isLabeledByFormItem
  21292. });
  21293. const setStoreValue = () => {
  21294. function addToStore() {
  21295. var _a, _b;
  21296. if (isArray$1(model.value) && !model.value.includes(actualValue.value)) {
  21297. model.value.push(actualValue.value);
  21298. } else {
  21299. model.value = (_b = (_a = props.trueValue) != null ? _a : props.trueLabel) != null ? _b : true;
  21300. }
  21301. }
  21302. props.checked && addToStore();
  21303. };
  21304. setStoreValue();
  21305. useDeprecated({
  21306. from: "label act as value",
  21307. replacement: "value",
  21308. version: "3.0.0",
  21309. scope: "el-checkbox",
  21310. ref: "https://element-plus.org/en-US/component/checkbox.html"
  21311. }, vue.computed(() => isGroup.value && isPropAbsent(props.value)));
  21312. useDeprecated({
  21313. from: "true-label",
  21314. replacement: "true-value",
  21315. version: "3.0.0",
  21316. scope: "el-checkbox",
  21317. ref: "https://element-plus.org/en-US/component/checkbox.html"
  21318. }, vue.computed(() => !!props.trueLabel));
  21319. useDeprecated({
  21320. from: "false-label",
  21321. replacement: "false-value",
  21322. version: "3.0.0",
  21323. scope: "el-checkbox",
  21324. ref: "https://element-plus.org/en-US/component/checkbox.html"
  21325. }, vue.computed(() => !!props.falseLabel));
  21326. return {
  21327. inputId,
  21328. isLabeledByFormItem,
  21329. isChecked,
  21330. isDisabled,
  21331. isFocused,
  21332. checkboxButtonSize,
  21333. checkboxSize,
  21334. hasOwnLabel,
  21335. model,
  21336. actualValue,
  21337. handleChange,
  21338. onClickRoot
  21339. };
  21340. };
  21341. const __default__$1o = vue.defineComponent({
  21342. name: "ElCheckbox"
  21343. });
  21344. const _sfc_main$1Z = /* @__PURE__ */ vue.defineComponent({
  21345. ...__default__$1o,
  21346. props: checkboxProps,
  21347. emits: checkboxEmits,
  21348. setup(__props) {
  21349. const props = __props;
  21350. const slots = vue.useSlots();
  21351. const {
  21352. inputId,
  21353. isLabeledByFormItem,
  21354. isChecked,
  21355. isDisabled,
  21356. isFocused,
  21357. checkboxSize,
  21358. hasOwnLabel,
  21359. model,
  21360. actualValue,
  21361. handleChange,
  21362. onClickRoot
  21363. } = useCheckbox(props, slots);
  21364. const ns = useNamespace("checkbox");
  21365. const compKls = vue.computed(() => {
  21366. return [
  21367. ns.b(),
  21368. ns.m(checkboxSize.value),
  21369. ns.is("disabled", isDisabled.value),
  21370. ns.is("bordered", props.border),
  21371. ns.is("checked", isChecked.value)
  21372. ];
  21373. });
  21374. const spanKls = vue.computed(() => {
  21375. return [
  21376. ns.e("input"),
  21377. ns.is("disabled", isDisabled.value),
  21378. ns.is("checked", isChecked.value),
  21379. ns.is("indeterminate", props.indeterminate),
  21380. ns.is("focus", isFocused.value)
  21381. ];
  21382. });
  21383. return (_ctx, _cache) => {
  21384. return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(!vue.unref(hasOwnLabel) && vue.unref(isLabeledByFormItem) ? "span" : "label"), {
  21385. class: vue.normalizeClass(vue.unref(compKls)),
  21386. "aria-controls": _ctx.indeterminate ? _ctx.ariaControls : null,
  21387. onClick: vue.unref(onClickRoot)
  21388. }, {
  21389. default: vue.withCtx(() => {
  21390. var _a, _b, _c, _d;
  21391. return [
  21392. vue.createElementVNode("span", {
  21393. class: vue.normalizeClass(vue.unref(spanKls))
  21394. }, [
  21395. _ctx.trueValue || _ctx.falseValue || _ctx.trueLabel || _ctx.falseLabel ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("input", {
  21396. key: 0,
  21397. id: vue.unref(inputId),
  21398. "onUpdate:modelValue": ($event) => vue.isRef(model) ? model.value = $event : null,
  21399. class: vue.normalizeClass(vue.unref(ns).e("original")),
  21400. type: "checkbox",
  21401. indeterminate: _ctx.indeterminate,
  21402. name: _ctx.name,
  21403. tabindex: _ctx.tabindex,
  21404. disabled: vue.unref(isDisabled),
  21405. "true-value": (_b = (_a = _ctx.trueValue) != null ? _a : _ctx.trueLabel) != null ? _b : true,
  21406. "false-value": (_d = (_c = _ctx.falseValue) != null ? _c : _ctx.falseLabel) != null ? _d : false,
  21407. onChange: vue.unref(handleChange),
  21408. onFocus: ($event) => isFocused.value = true,
  21409. onBlur: ($event) => isFocused.value = false,
  21410. onClick: vue.withModifiers(() => {
  21411. }, ["stop"])
  21412. }, null, 42, ["id", "onUpdate:modelValue", "indeterminate", "name", "tabindex", "disabled", "true-value", "false-value", "onChange", "onFocus", "onBlur", "onClick"])), [
  21413. [vue.vModelCheckbox, vue.unref(model)]
  21414. ]) : vue.withDirectives((vue.openBlock(), vue.createElementBlock("input", {
  21415. key: 1,
  21416. id: vue.unref(inputId),
  21417. "onUpdate:modelValue": ($event) => vue.isRef(model) ? model.value = $event : null,
  21418. class: vue.normalizeClass(vue.unref(ns).e("original")),
  21419. type: "checkbox",
  21420. indeterminate: _ctx.indeterminate,
  21421. disabled: vue.unref(isDisabled),
  21422. value: vue.unref(actualValue),
  21423. name: _ctx.name,
  21424. tabindex: _ctx.tabindex,
  21425. onChange: vue.unref(handleChange),
  21426. onFocus: ($event) => isFocused.value = true,
  21427. onBlur: ($event) => isFocused.value = false,
  21428. onClick: vue.withModifiers(() => {
  21429. }, ["stop"])
  21430. }, null, 42, ["id", "onUpdate:modelValue", "indeterminate", "disabled", "value", "name", "tabindex", "onChange", "onFocus", "onBlur", "onClick"])), [
  21431. [vue.vModelCheckbox, vue.unref(model)]
  21432. ]),
  21433. vue.createElementVNode("span", {
  21434. class: vue.normalizeClass(vue.unref(ns).e("inner"))
  21435. }, null, 2)
  21436. ], 2),
  21437. vue.unref(hasOwnLabel) ? (vue.openBlock(), vue.createElementBlock("span", {
  21438. key: 0,
  21439. class: vue.normalizeClass(vue.unref(ns).e("label"))
  21440. }, [
  21441. vue.renderSlot(_ctx.$slots, "default"),
  21442. !_ctx.$slots.default ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  21443. vue.createTextVNode(vue.toDisplayString(_ctx.label), 1)
  21444. ], 64)) : vue.createCommentVNode("v-if", true)
  21445. ], 2)) : vue.createCommentVNode("v-if", true)
  21446. ];
  21447. }),
  21448. _: 3
  21449. }, 8, ["class", "aria-controls", "onClick"]);
  21450. };
  21451. }
  21452. });
  21453. var Checkbox = /* @__PURE__ */ _export_sfc(_sfc_main$1Z, [["__file", "checkbox.vue"]]);
  21454. const __default__$1n = vue.defineComponent({
  21455. name: "ElCheckboxButton"
  21456. });
  21457. const _sfc_main$1Y = /* @__PURE__ */ vue.defineComponent({
  21458. ...__default__$1n,
  21459. props: checkboxProps,
  21460. emits: checkboxEmits,
  21461. setup(__props) {
  21462. const props = __props;
  21463. const slots = vue.useSlots();
  21464. const {
  21465. isFocused,
  21466. isChecked,
  21467. isDisabled,
  21468. checkboxButtonSize,
  21469. model,
  21470. actualValue,
  21471. handleChange
  21472. } = useCheckbox(props, slots);
  21473. const checkboxGroup = vue.inject(checkboxGroupContextKey, void 0);
  21474. const ns = useNamespace("checkbox");
  21475. const activeStyle = vue.computed(() => {
  21476. var _a, _b, _c, _d;
  21477. const fillValue = (_b = (_a = checkboxGroup == null ? void 0 : checkboxGroup.fill) == null ? void 0 : _a.value) != null ? _b : "";
  21478. return {
  21479. backgroundColor: fillValue,
  21480. borderColor: fillValue,
  21481. color: (_d = (_c = checkboxGroup == null ? void 0 : checkboxGroup.textColor) == null ? void 0 : _c.value) != null ? _d : "",
  21482. boxShadow: fillValue ? `-1px 0 0 0 ${fillValue}` : void 0
  21483. };
  21484. });
  21485. const labelKls = vue.computed(() => {
  21486. return [
  21487. ns.b("button"),
  21488. ns.bm("button", checkboxButtonSize.value),
  21489. ns.is("disabled", isDisabled.value),
  21490. ns.is("checked", isChecked.value),
  21491. ns.is("focus", isFocused.value)
  21492. ];
  21493. });
  21494. return (_ctx, _cache) => {
  21495. var _a, _b, _c, _d;
  21496. return vue.openBlock(), vue.createElementBlock("label", {
  21497. class: vue.normalizeClass(vue.unref(labelKls))
  21498. }, [
  21499. _ctx.trueValue || _ctx.falseValue || _ctx.trueLabel || _ctx.falseLabel ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("input", {
  21500. key: 0,
  21501. "onUpdate:modelValue": ($event) => vue.isRef(model) ? model.value = $event : null,
  21502. class: vue.normalizeClass(vue.unref(ns).be("button", "original")),
  21503. type: "checkbox",
  21504. name: _ctx.name,
  21505. tabindex: _ctx.tabindex,
  21506. disabled: vue.unref(isDisabled),
  21507. "true-value": (_b = (_a = _ctx.trueValue) != null ? _a : _ctx.trueLabel) != null ? _b : true,
  21508. "false-value": (_d = (_c = _ctx.falseValue) != null ? _c : _ctx.falseLabel) != null ? _d : false,
  21509. onChange: vue.unref(handleChange),
  21510. onFocus: ($event) => isFocused.value = true,
  21511. onBlur: ($event) => isFocused.value = false,
  21512. onClick: vue.withModifiers(() => {
  21513. }, ["stop"])
  21514. }, null, 42, ["onUpdate:modelValue", "name", "tabindex", "disabled", "true-value", "false-value", "onChange", "onFocus", "onBlur", "onClick"])), [
  21515. [vue.vModelCheckbox, vue.unref(model)]
  21516. ]) : vue.withDirectives((vue.openBlock(), vue.createElementBlock("input", {
  21517. key: 1,
  21518. "onUpdate:modelValue": ($event) => vue.isRef(model) ? model.value = $event : null,
  21519. class: vue.normalizeClass(vue.unref(ns).be("button", "original")),
  21520. type: "checkbox",
  21521. name: _ctx.name,
  21522. tabindex: _ctx.tabindex,
  21523. disabled: vue.unref(isDisabled),
  21524. value: vue.unref(actualValue),
  21525. onChange: vue.unref(handleChange),
  21526. onFocus: ($event) => isFocused.value = true,
  21527. onBlur: ($event) => isFocused.value = false,
  21528. onClick: vue.withModifiers(() => {
  21529. }, ["stop"])
  21530. }, null, 42, ["onUpdate:modelValue", "name", "tabindex", "disabled", "value", "onChange", "onFocus", "onBlur", "onClick"])), [
  21531. [vue.vModelCheckbox, vue.unref(model)]
  21532. ]),
  21533. _ctx.$slots.default || _ctx.label ? (vue.openBlock(), vue.createElementBlock("span", {
  21534. key: 2,
  21535. class: vue.normalizeClass(vue.unref(ns).be("button", "inner")),
  21536. style: vue.normalizeStyle(vue.unref(isChecked) ? vue.unref(activeStyle) : void 0)
  21537. }, [
  21538. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  21539. vue.createTextVNode(vue.toDisplayString(_ctx.label), 1)
  21540. ])
  21541. ], 6)) : vue.createCommentVNode("v-if", true)
  21542. ], 2);
  21543. };
  21544. }
  21545. });
  21546. var CheckboxButton = /* @__PURE__ */ _export_sfc(_sfc_main$1Y, [["__file", "checkbox-button.vue"]]);
  21547. const checkboxGroupProps = buildProps({
  21548. modelValue: {
  21549. type: definePropType(Array),
  21550. default: () => []
  21551. },
  21552. disabled: Boolean,
  21553. min: Number,
  21554. max: Number,
  21555. size: useSizeProp,
  21556. fill: String,
  21557. textColor: String,
  21558. tag: {
  21559. type: String,
  21560. default: "div"
  21561. },
  21562. validateEvent: {
  21563. type: Boolean,
  21564. default: true
  21565. },
  21566. ...useAriaProps(["ariaLabel"])
  21567. });
  21568. const checkboxGroupEmits = {
  21569. [UPDATE_MODEL_EVENT]: (val) => isArray$1(val),
  21570. change: (val) => isArray$1(val)
  21571. };
  21572. const __default__$1m = vue.defineComponent({
  21573. name: "ElCheckboxGroup"
  21574. });
  21575. const _sfc_main$1X = /* @__PURE__ */ vue.defineComponent({
  21576. ...__default__$1m,
  21577. props: checkboxGroupProps,
  21578. emits: checkboxGroupEmits,
  21579. setup(__props, { emit }) {
  21580. const props = __props;
  21581. const ns = useNamespace("checkbox");
  21582. const { formItem } = useFormItem();
  21583. const { inputId: groupId, isLabeledByFormItem } = useFormItemInputId(props, {
  21584. formItemContext: formItem
  21585. });
  21586. const changeEvent = async (value) => {
  21587. emit(UPDATE_MODEL_EVENT, value);
  21588. await vue.nextTick();
  21589. emit("change", value);
  21590. };
  21591. const modelValue = vue.computed({
  21592. get() {
  21593. return props.modelValue;
  21594. },
  21595. set(val) {
  21596. changeEvent(val);
  21597. }
  21598. });
  21599. vue.provide(checkboxGroupContextKey, {
  21600. ...pick(vue.toRefs(props), [
  21601. "size",
  21602. "min",
  21603. "max",
  21604. "disabled",
  21605. "validateEvent",
  21606. "fill",
  21607. "textColor"
  21608. ]),
  21609. modelValue,
  21610. changeEvent
  21611. });
  21612. vue.watch(() => props.modelValue, () => {
  21613. if (props.validateEvent) {
  21614. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
  21615. }
  21616. });
  21617. return (_ctx, _cache) => {
  21618. var _a;
  21619. return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.tag), {
  21620. id: vue.unref(groupId),
  21621. class: vue.normalizeClass(vue.unref(ns).b("group")),
  21622. role: "group",
  21623. "aria-label": !vue.unref(isLabeledByFormItem) ? _ctx.ariaLabel || "checkbox-group" : void 0,
  21624. "aria-labelledby": vue.unref(isLabeledByFormItem) ? (_a = vue.unref(formItem)) == null ? void 0 : _a.labelId : void 0
  21625. }, {
  21626. default: vue.withCtx(() => [
  21627. vue.renderSlot(_ctx.$slots, "default")
  21628. ]),
  21629. _: 3
  21630. }, 8, ["id", "class", "aria-label", "aria-labelledby"]);
  21631. };
  21632. }
  21633. });
  21634. var CheckboxGroup = /* @__PURE__ */ _export_sfc(_sfc_main$1X, [["__file", "checkbox-group.vue"]]);
  21635. const ElCheckbox = withInstall(Checkbox, {
  21636. CheckboxButton,
  21637. CheckboxGroup
  21638. });
  21639. const ElCheckboxButton = withNoopInstall(CheckboxButton);
  21640. const ElCheckboxGroup$1 = withNoopInstall(CheckboxGroup);
  21641. const radioPropsBase = buildProps({
  21642. modelValue: {
  21643. type: [String, Number, Boolean],
  21644. default: void 0
  21645. },
  21646. size: useSizeProp,
  21647. disabled: Boolean,
  21648. label: {
  21649. type: [String, Number, Boolean],
  21650. default: void 0
  21651. },
  21652. value: {
  21653. type: [String, Number, Boolean],
  21654. default: void 0
  21655. },
  21656. name: {
  21657. type: String,
  21658. default: void 0
  21659. }
  21660. });
  21661. const radioProps = buildProps({
  21662. ...radioPropsBase,
  21663. border: Boolean
  21664. });
  21665. const radioEmits = {
  21666. [UPDATE_MODEL_EVENT]: (val) => isString$1(val) || isNumber(val) || isBoolean(val),
  21667. [CHANGE_EVENT]: (val) => isString$1(val) || isNumber(val) || isBoolean(val)
  21668. };
  21669. const radioGroupKey = Symbol("radioGroupKey");
  21670. const useRadio = (props, emit) => {
  21671. const radioRef = vue.ref();
  21672. const radioGroup = vue.inject(radioGroupKey, void 0);
  21673. const isGroup = vue.computed(() => !!radioGroup);
  21674. const actualValue = vue.computed(() => {
  21675. if (!isPropAbsent(props.value)) {
  21676. return props.value;
  21677. }
  21678. return props.label;
  21679. });
  21680. const modelValue = vue.computed({
  21681. get() {
  21682. return isGroup.value ? radioGroup.modelValue : props.modelValue;
  21683. },
  21684. set(val) {
  21685. if (isGroup.value) {
  21686. radioGroup.changeEvent(val);
  21687. } else {
  21688. emit && emit(UPDATE_MODEL_EVENT, val);
  21689. }
  21690. radioRef.value.checked = props.modelValue === actualValue.value;
  21691. }
  21692. });
  21693. const size = useFormSize(vue.computed(() => radioGroup == null ? void 0 : radioGroup.size));
  21694. const disabled = useFormDisabled(vue.computed(() => radioGroup == null ? void 0 : radioGroup.disabled));
  21695. const focus = vue.ref(false);
  21696. const tabIndex = vue.computed(() => {
  21697. return disabled.value || isGroup.value && modelValue.value !== actualValue.value ? -1 : 0;
  21698. });
  21699. useDeprecated({
  21700. from: "label act as value",
  21701. replacement: "value",
  21702. version: "3.0.0",
  21703. scope: "el-radio",
  21704. ref: "https://element-plus.org/en-US/component/radio.html"
  21705. }, vue.computed(() => isGroup.value && isPropAbsent(props.value)));
  21706. return {
  21707. radioRef,
  21708. isGroup,
  21709. radioGroup,
  21710. focus,
  21711. size,
  21712. disabled,
  21713. tabIndex,
  21714. modelValue,
  21715. actualValue
  21716. };
  21717. };
  21718. const __default__$1l = vue.defineComponent({
  21719. name: "ElRadio"
  21720. });
  21721. const _sfc_main$1W = /* @__PURE__ */ vue.defineComponent({
  21722. ...__default__$1l,
  21723. props: radioProps,
  21724. emits: radioEmits,
  21725. setup(__props, { emit }) {
  21726. const props = __props;
  21727. const ns = useNamespace("radio");
  21728. const { radioRef, radioGroup, focus, size, disabled, modelValue, actualValue } = useRadio(props, emit);
  21729. function handleChange() {
  21730. vue.nextTick(() => emit("change", modelValue.value));
  21731. }
  21732. return (_ctx, _cache) => {
  21733. var _a;
  21734. return vue.openBlock(), vue.createElementBlock("label", {
  21735. class: vue.normalizeClass([
  21736. vue.unref(ns).b(),
  21737. vue.unref(ns).is("disabled", vue.unref(disabled)),
  21738. vue.unref(ns).is("focus", vue.unref(focus)),
  21739. vue.unref(ns).is("bordered", _ctx.border),
  21740. vue.unref(ns).is("checked", vue.unref(modelValue) === vue.unref(actualValue)),
  21741. vue.unref(ns).m(vue.unref(size))
  21742. ])
  21743. }, [
  21744. vue.createElementVNode("span", {
  21745. class: vue.normalizeClass([
  21746. vue.unref(ns).e("input"),
  21747. vue.unref(ns).is("disabled", vue.unref(disabled)),
  21748. vue.unref(ns).is("checked", vue.unref(modelValue) === vue.unref(actualValue))
  21749. ])
  21750. }, [
  21751. vue.withDirectives(vue.createElementVNode("input", {
  21752. ref_key: "radioRef",
  21753. ref: radioRef,
  21754. "onUpdate:modelValue": ($event) => vue.isRef(modelValue) ? modelValue.value = $event : null,
  21755. class: vue.normalizeClass(vue.unref(ns).e("original")),
  21756. value: vue.unref(actualValue),
  21757. name: _ctx.name || ((_a = vue.unref(radioGroup)) == null ? void 0 : _a.name),
  21758. disabled: vue.unref(disabled),
  21759. checked: vue.unref(modelValue) === vue.unref(actualValue),
  21760. type: "radio",
  21761. onFocus: ($event) => focus.value = true,
  21762. onBlur: ($event) => focus.value = false,
  21763. onChange: handleChange,
  21764. onClick: vue.withModifiers(() => {
  21765. }, ["stop"])
  21766. }, null, 42, ["onUpdate:modelValue", "value", "name", "disabled", "checked", "onFocus", "onBlur", "onClick"]), [
  21767. [vue.vModelRadio, vue.unref(modelValue)]
  21768. ]),
  21769. vue.createElementVNode("span", {
  21770. class: vue.normalizeClass(vue.unref(ns).e("inner"))
  21771. }, null, 2)
  21772. ], 2),
  21773. vue.createElementVNode("span", {
  21774. class: vue.normalizeClass(vue.unref(ns).e("label")),
  21775. onKeydown: vue.withModifiers(() => {
  21776. }, ["stop"])
  21777. }, [
  21778. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  21779. vue.createTextVNode(vue.toDisplayString(_ctx.label), 1)
  21780. ])
  21781. ], 42, ["onKeydown"])
  21782. ], 2);
  21783. };
  21784. }
  21785. });
  21786. var Radio = /* @__PURE__ */ _export_sfc(_sfc_main$1W, [["__file", "radio.vue"]]);
  21787. const radioButtonProps = buildProps({
  21788. ...radioPropsBase
  21789. });
  21790. const __default__$1k = vue.defineComponent({
  21791. name: "ElRadioButton"
  21792. });
  21793. const _sfc_main$1V = /* @__PURE__ */ vue.defineComponent({
  21794. ...__default__$1k,
  21795. props: radioButtonProps,
  21796. setup(__props) {
  21797. const props = __props;
  21798. const ns = useNamespace("radio");
  21799. const { radioRef, focus, size, disabled, modelValue, radioGroup, actualValue } = useRadio(props);
  21800. const activeStyle = vue.computed(() => {
  21801. return {
  21802. backgroundColor: (radioGroup == null ? void 0 : radioGroup.fill) || "",
  21803. borderColor: (radioGroup == null ? void 0 : radioGroup.fill) || "",
  21804. boxShadow: (radioGroup == null ? void 0 : radioGroup.fill) ? `-1px 0 0 0 ${radioGroup.fill}` : "",
  21805. color: (radioGroup == null ? void 0 : radioGroup.textColor) || ""
  21806. };
  21807. });
  21808. return (_ctx, _cache) => {
  21809. var _a;
  21810. return vue.openBlock(), vue.createElementBlock("label", {
  21811. class: vue.normalizeClass([
  21812. vue.unref(ns).b("button"),
  21813. vue.unref(ns).is("active", vue.unref(modelValue) === vue.unref(actualValue)),
  21814. vue.unref(ns).is("disabled", vue.unref(disabled)),
  21815. vue.unref(ns).is("focus", vue.unref(focus)),
  21816. vue.unref(ns).bm("button", vue.unref(size))
  21817. ])
  21818. }, [
  21819. vue.withDirectives(vue.createElementVNode("input", {
  21820. ref_key: "radioRef",
  21821. ref: radioRef,
  21822. "onUpdate:modelValue": ($event) => vue.isRef(modelValue) ? modelValue.value = $event : null,
  21823. class: vue.normalizeClass(vue.unref(ns).be("button", "original-radio")),
  21824. value: vue.unref(actualValue),
  21825. type: "radio",
  21826. name: _ctx.name || ((_a = vue.unref(radioGroup)) == null ? void 0 : _a.name),
  21827. disabled: vue.unref(disabled),
  21828. onFocus: ($event) => focus.value = true,
  21829. onBlur: ($event) => focus.value = false,
  21830. onClick: vue.withModifiers(() => {
  21831. }, ["stop"])
  21832. }, null, 42, ["onUpdate:modelValue", "value", "name", "disabled", "onFocus", "onBlur", "onClick"]), [
  21833. [vue.vModelRadio, vue.unref(modelValue)]
  21834. ]),
  21835. vue.createElementVNode("span", {
  21836. class: vue.normalizeClass(vue.unref(ns).be("button", "inner")),
  21837. style: vue.normalizeStyle(vue.unref(modelValue) === vue.unref(actualValue) ? vue.unref(activeStyle) : {}),
  21838. onKeydown: vue.withModifiers(() => {
  21839. }, ["stop"])
  21840. }, [
  21841. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  21842. vue.createTextVNode(vue.toDisplayString(_ctx.label), 1)
  21843. ])
  21844. ], 46, ["onKeydown"])
  21845. ], 2);
  21846. };
  21847. }
  21848. });
  21849. var RadioButton = /* @__PURE__ */ _export_sfc(_sfc_main$1V, [["__file", "radio-button.vue"]]);
  21850. const radioGroupProps = buildProps({
  21851. id: {
  21852. type: String,
  21853. default: void 0
  21854. },
  21855. size: useSizeProp,
  21856. disabled: Boolean,
  21857. modelValue: {
  21858. type: [String, Number, Boolean],
  21859. default: void 0
  21860. },
  21861. fill: {
  21862. type: String,
  21863. default: ""
  21864. },
  21865. textColor: {
  21866. type: String,
  21867. default: ""
  21868. },
  21869. name: {
  21870. type: String,
  21871. default: void 0
  21872. },
  21873. validateEvent: {
  21874. type: Boolean,
  21875. default: true
  21876. },
  21877. ...useAriaProps(["ariaLabel"])
  21878. });
  21879. const radioGroupEmits = radioEmits;
  21880. const __default__$1j = vue.defineComponent({
  21881. name: "ElRadioGroup"
  21882. });
  21883. const _sfc_main$1U = /* @__PURE__ */ vue.defineComponent({
  21884. ...__default__$1j,
  21885. props: radioGroupProps,
  21886. emits: radioGroupEmits,
  21887. setup(__props, { emit }) {
  21888. const props = __props;
  21889. const ns = useNamespace("radio");
  21890. const radioId = useId();
  21891. const radioGroupRef = vue.ref();
  21892. const { formItem } = useFormItem();
  21893. const { inputId: groupId, isLabeledByFormItem } = useFormItemInputId(props, {
  21894. formItemContext: formItem
  21895. });
  21896. const changeEvent = (value) => {
  21897. emit(UPDATE_MODEL_EVENT, value);
  21898. vue.nextTick(() => emit("change", value));
  21899. };
  21900. vue.onMounted(() => {
  21901. const radios = radioGroupRef.value.querySelectorAll("[type=radio]");
  21902. const firstLabel = radios[0];
  21903. if (!Array.from(radios).some((radio) => radio.checked) && firstLabel) {
  21904. firstLabel.tabIndex = 0;
  21905. }
  21906. });
  21907. const name = vue.computed(() => {
  21908. return props.name || radioId.value;
  21909. });
  21910. vue.provide(radioGroupKey, vue.reactive({
  21911. ...vue.toRefs(props),
  21912. changeEvent,
  21913. name
  21914. }));
  21915. vue.watch(() => props.modelValue, () => {
  21916. if (props.validateEvent) {
  21917. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
  21918. }
  21919. });
  21920. return (_ctx, _cache) => {
  21921. return vue.openBlock(), vue.createElementBlock("div", {
  21922. id: vue.unref(groupId),
  21923. ref_key: "radioGroupRef",
  21924. ref: radioGroupRef,
  21925. class: vue.normalizeClass(vue.unref(ns).b("group")),
  21926. role: "radiogroup",
  21927. "aria-label": !vue.unref(isLabeledByFormItem) ? _ctx.ariaLabel || "radio-group" : void 0,
  21928. "aria-labelledby": vue.unref(isLabeledByFormItem) ? vue.unref(formItem).labelId : void 0
  21929. }, [
  21930. vue.renderSlot(_ctx.$slots, "default")
  21931. ], 10, ["id", "aria-label", "aria-labelledby"]);
  21932. };
  21933. }
  21934. });
  21935. var RadioGroup = /* @__PURE__ */ _export_sfc(_sfc_main$1U, [["__file", "radio-group.vue"]]);
  21936. const ElRadio = withInstall(Radio, {
  21937. RadioButton,
  21938. RadioGroup
  21939. });
  21940. const ElRadioGroup = withNoopInstall(RadioGroup);
  21941. const ElRadioButton = withNoopInstall(RadioButton);
  21942. var NodeContent$1 = vue.defineComponent({
  21943. name: "NodeContent",
  21944. setup() {
  21945. const ns = useNamespace("cascader-node");
  21946. return {
  21947. ns
  21948. };
  21949. },
  21950. render() {
  21951. const { ns } = this;
  21952. const { node, panel } = this.$parent;
  21953. const { data, label } = node;
  21954. const { renderLabelFn } = panel;
  21955. return vue.h("span", { class: ns.e("label") }, renderLabelFn ? renderLabelFn({ node, data }) : label);
  21956. }
  21957. });
  21958. const CASCADER_PANEL_INJECTION_KEY = Symbol();
  21959. const _sfc_main$1T = vue.defineComponent({
  21960. name: "ElCascaderNode",
  21961. components: {
  21962. ElCheckbox,
  21963. ElRadio,
  21964. NodeContent: NodeContent$1,
  21965. ElIcon,
  21966. Check: check_default,
  21967. Loading: loading_default,
  21968. ArrowRight: arrow_right_default
  21969. },
  21970. props: {
  21971. node: {
  21972. type: Object,
  21973. required: true
  21974. },
  21975. menuId: String
  21976. },
  21977. emits: ["expand"],
  21978. setup(props, { emit }) {
  21979. const panel = vue.inject(CASCADER_PANEL_INJECTION_KEY);
  21980. const ns = useNamespace("cascader-node");
  21981. const isHoverMenu = vue.computed(() => panel.isHoverMenu);
  21982. const multiple = vue.computed(() => panel.config.multiple);
  21983. const checkStrictly = vue.computed(() => panel.config.checkStrictly);
  21984. const checkedNodeId = vue.computed(() => {
  21985. var _a;
  21986. return (_a = panel.checkedNodes[0]) == null ? void 0 : _a.uid;
  21987. });
  21988. const isDisabled = vue.computed(() => props.node.isDisabled);
  21989. const isLeaf = vue.computed(() => props.node.isLeaf);
  21990. const expandable = vue.computed(() => checkStrictly.value && !isLeaf.value || !isDisabled.value);
  21991. const inExpandingPath = vue.computed(() => isInPath(panel.expandingNode));
  21992. const inCheckedPath = vue.computed(() => checkStrictly.value && panel.checkedNodes.some(isInPath));
  21993. const isInPath = (node) => {
  21994. var _a;
  21995. const { level, uid } = props.node;
  21996. return ((_a = node == null ? void 0 : node.pathNodes[level - 1]) == null ? void 0 : _a.uid) === uid;
  21997. };
  21998. const doExpand = () => {
  21999. if (inExpandingPath.value)
  22000. return;
  22001. panel.expandNode(props.node);
  22002. };
  22003. const doCheck = (checked) => {
  22004. const { node } = props;
  22005. if (checked === node.checked)
  22006. return;
  22007. panel.handleCheckChange(node, checked);
  22008. };
  22009. const doLoad = () => {
  22010. panel.lazyLoad(props.node, () => {
  22011. if (!isLeaf.value)
  22012. doExpand();
  22013. });
  22014. };
  22015. const handleHoverExpand = (e) => {
  22016. if (!isHoverMenu.value)
  22017. return;
  22018. handleExpand();
  22019. !isLeaf.value && emit("expand", e);
  22020. };
  22021. const handleExpand = () => {
  22022. const { node } = props;
  22023. if (!expandable.value || node.loading)
  22024. return;
  22025. node.loaded ? doExpand() : doLoad();
  22026. };
  22027. const handleClick = () => {
  22028. if (isHoverMenu.value && !isLeaf.value)
  22029. return;
  22030. if (isLeaf.value && !isDisabled.value && !checkStrictly.value && !multiple.value) {
  22031. handleCheck(true);
  22032. } else {
  22033. handleExpand();
  22034. }
  22035. };
  22036. const handleSelectCheck = (checked) => {
  22037. if (checkStrictly.value) {
  22038. doCheck(checked);
  22039. if (props.node.loaded) {
  22040. doExpand();
  22041. }
  22042. } else {
  22043. handleCheck(checked);
  22044. }
  22045. };
  22046. const handleCheck = (checked) => {
  22047. if (!props.node.loaded) {
  22048. doLoad();
  22049. } else {
  22050. doCheck(checked);
  22051. !checkStrictly.value && doExpand();
  22052. }
  22053. };
  22054. return {
  22055. panel,
  22056. isHoverMenu,
  22057. multiple,
  22058. checkStrictly,
  22059. checkedNodeId,
  22060. isDisabled,
  22061. isLeaf,
  22062. expandable,
  22063. inExpandingPath,
  22064. inCheckedPath,
  22065. ns,
  22066. handleHoverExpand,
  22067. handleExpand,
  22068. handleClick,
  22069. handleCheck,
  22070. handleSelectCheck
  22071. };
  22072. }
  22073. });
  22074. function _sfc_render$t(_ctx, _cache, $props, $setup, $data, $options) {
  22075. const _component_el_checkbox = vue.resolveComponent("el-checkbox");
  22076. const _component_el_radio = vue.resolveComponent("el-radio");
  22077. const _component_check = vue.resolveComponent("check");
  22078. const _component_el_icon = vue.resolveComponent("el-icon");
  22079. const _component_node_content = vue.resolveComponent("node-content");
  22080. const _component_loading = vue.resolveComponent("loading");
  22081. const _component_arrow_right = vue.resolveComponent("arrow-right");
  22082. return vue.openBlock(), vue.createElementBlock("li", {
  22083. id: `${_ctx.menuId}-${_ctx.node.uid}`,
  22084. role: "menuitem",
  22085. "aria-haspopup": !_ctx.isLeaf,
  22086. "aria-owns": _ctx.isLeaf ? null : _ctx.menuId,
  22087. "aria-expanded": _ctx.inExpandingPath,
  22088. tabindex: _ctx.expandable ? -1 : void 0,
  22089. class: vue.normalizeClass([
  22090. _ctx.ns.b(),
  22091. _ctx.ns.is("selectable", _ctx.checkStrictly),
  22092. _ctx.ns.is("active", _ctx.node.checked),
  22093. _ctx.ns.is("disabled", !_ctx.expandable),
  22094. _ctx.inExpandingPath && "in-active-path",
  22095. _ctx.inCheckedPath && "in-checked-path"
  22096. ]),
  22097. onMouseenter: _ctx.handleHoverExpand,
  22098. onFocus: _ctx.handleHoverExpand,
  22099. onClick: _ctx.handleClick
  22100. }, [
  22101. vue.createCommentVNode(" prefix "),
  22102. _ctx.multiple ? (vue.openBlock(), vue.createBlock(_component_el_checkbox, {
  22103. key: 0,
  22104. "model-value": _ctx.node.checked,
  22105. indeterminate: _ctx.node.indeterminate,
  22106. disabled: _ctx.isDisabled,
  22107. onClick: vue.withModifiers(() => {
  22108. }, ["stop"]),
  22109. "onUpdate:modelValue": _ctx.handleSelectCheck
  22110. }, null, 8, ["model-value", "indeterminate", "disabled", "onClick", "onUpdate:modelValue"])) : _ctx.checkStrictly ? (vue.openBlock(), vue.createBlock(_component_el_radio, {
  22111. key: 1,
  22112. "model-value": _ctx.checkedNodeId,
  22113. label: _ctx.node.uid,
  22114. disabled: _ctx.isDisabled,
  22115. "onUpdate:modelValue": _ctx.handleSelectCheck,
  22116. onClick: vue.withModifiers(() => {
  22117. }, ["stop"])
  22118. }, {
  22119. default: vue.withCtx(() => [
  22120. vue.createCommentVNode("\n Add an empty element to avoid render label,\n do not use empty fragment here for https://github.com/vuejs/vue-next/pull/2485\n "),
  22121. vue.createElementVNode("span")
  22122. ]),
  22123. _: 1
  22124. }, 8, ["model-value", "label", "disabled", "onUpdate:modelValue", "onClick"])) : _ctx.isLeaf && _ctx.node.checked ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
  22125. key: 2,
  22126. class: vue.normalizeClass(_ctx.ns.e("prefix"))
  22127. }, {
  22128. default: vue.withCtx(() => [
  22129. vue.createVNode(_component_check)
  22130. ]),
  22131. _: 1
  22132. }, 8, ["class"])) : vue.createCommentVNode("v-if", true),
  22133. vue.createCommentVNode(" content "),
  22134. vue.createVNode(_component_node_content),
  22135. vue.createCommentVNode(" postfix "),
  22136. !_ctx.isLeaf ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 3 }, [
  22137. _ctx.node.loading ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
  22138. key: 0,
  22139. class: vue.normalizeClass([_ctx.ns.is("loading"), _ctx.ns.e("postfix")])
  22140. }, {
  22141. default: vue.withCtx(() => [
  22142. vue.createVNode(_component_loading)
  22143. ]),
  22144. _: 1
  22145. }, 8, ["class"])) : (vue.openBlock(), vue.createBlock(_component_el_icon, {
  22146. key: 1,
  22147. class: vue.normalizeClass(["arrow-right", _ctx.ns.e("postfix")])
  22148. }, {
  22149. default: vue.withCtx(() => [
  22150. vue.createVNode(_component_arrow_right)
  22151. ]),
  22152. _: 1
  22153. }, 8, ["class"]))
  22154. ], 64)) : vue.createCommentVNode("v-if", true)
  22155. ], 42, ["id", "aria-haspopup", "aria-owns", "aria-expanded", "tabindex", "onMouseenter", "onFocus", "onClick"]);
  22156. }
  22157. var ElCascaderNode = /* @__PURE__ */ _export_sfc(_sfc_main$1T, [["render", _sfc_render$t], ["__file", "node.vue"]]);
  22158. const _sfc_main$1S = vue.defineComponent({
  22159. name: "ElCascaderMenu",
  22160. components: {
  22161. Loading: loading_default,
  22162. ElIcon,
  22163. ElScrollbar,
  22164. ElCascaderNode
  22165. },
  22166. props: {
  22167. nodes: {
  22168. type: Array,
  22169. required: true
  22170. },
  22171. index: {
  22172. type: Number,
  22173. required: true
  22174. }
  22175. },
  22176. setup(props) {
  22177. const instance = vue.getCurrentInstance();
  22178. const ns = useNamespace("cascader-menu");
  22179. const { t } = useLocale();
  22180. const id = useId();
  22181. let activeNode = null;
  22182. let hoverTimer = null;
  22183. const panel = vue.inject(CASCADER_PANEL_INJECTION_KEY);
  22184. const hoverZone = vue.ref(null);
  22185. const isEmpty = vue.computed(() => !props.nodes.length);
  22186. const isLoading = vue.computed(() => !panel.initialLoaded);
  22187. const menuId = vue.computed(() => `${id.value}-${props.index}`);
  22188. const handleExpand = (e) => {
  22189. activeNode = e.target;
  22190. };
  22191. const handleMouseMove = (e) => {
  22192. if (!panel.isHoverMenu || !activeNode || !hoverZone.value)
  22193. return;
  22194. if (activeNode.contains(e.target)) {
  22195. clearHoverTimer();
  22196. const el = instance.vnode.el;
  22197. const { left } = el.getBoundingClientRect();
  22198. const { offsetWidth, offsetHeight } = el;
  22199. const startX = e.clientX - left;
  22200. const top = activeNode.offsetTop;
  22201. const bottom = top + activeNode.offsetHeight;
  22202. hoverZone.value.innerHTML = `
  22203. <path style="pointer-events: auto;" fill="transparent" d="M${startX} ${top} L${offsetWidth} 0 V${top} Z" />
  22204. <path style="pointer-events: auto;" fill="transparent" d="M${startX} ${bottom} L${offsetWidth} ${offsetHeight} V${bottom} Z" />
  22205. `;
  22206. } else if (!hoverTimer) {
  22207. hoverTimer = window.setTimeout(clearHoverZone, panel.config.hoverThreshold);
  22208. }
  22209. };
  22210. const clearHoverTimer = () => {
  22211. if (!hoverTimer)
  22212. return;
  22213. clearTimeout(hoverTimer);
  22214. hoverTimer = null;
  22215. };
  22216. const clearHoverZone = () => {
  22217. if (!hoverZone.value)
  22218. return;
  22219. hoverZone.value.innerHTML = "";
  22220. clearHoverTimer();
  22221. };
  22222. return {
  22223. ns,
  22224. panel,
  22225. hoverZone,
  22226. isEmpty,
  22227. isLoading,
  22228. menuId,
  22229. t,
  22230. handleExpand,
  22231. handleMouseMove,
  22232. clearHoverZone
  22233. };
  22234. }
  22235. });
  22236. function _sfc_render$s(_ctx, _cache, $props, $setup, $data, $options) {
  22237. const _component_el_cascader_node = vue.resolveComponent("el-cascader-node");
  22238. const _component_loading = vue.resolveComponent("loading");
  22239. const _component_el_icon = vue.resolveComponent("el-icon");
  22240. const _component_el_scrollbar = vue.resolveComponent("el-scrollbar");
  22241. return vue.openBlock(), vue.createBlock(_component_el_scrollbar, {
  22242. key: _ctx.menuId,
  22243. tag: "ul",
  22244. role: "menu",
  22245. class: vue.normalizeClass(_ctx.ns.b()),
  22246. "wrap-class": _ctx.ns.e("wrap"),
  22247. "view-class": [_ctx.ns.e("list"), _ctx.ns.is("empty", _ctx.isEmpty)],
  22248. onMousemove: _ctx.handleMouseMove,
  22249. onMouseleave: _ctx.clearHoverZone
  22250. }, {
  22251. default: vue.withCtx(() => {
  22252. var _a;
  22253. return [
  22254. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.nodes, (node) => {
  22255. return vue.openBlock(), vue.createBlock(_component_el_cascader_node, {
  22256. key: node.uid,
  22257. node,
  22258. "menu-id": _ctx.menuId,
  22259. onExpand: _ctx.handleExpand
  22260. }, null, 8, ["node", "menu-id", "onExpand"]);
  22261. }), 128)),
  22262. _ctx.isLoading ? (vue.openBlock(), vue.createElementBlock("div", {
  22263. key: 0,
  22264. class: vue.normalizeClass(_ctx.ns.e("empty-text"))
  22265. }, [
  22266. vue.createVNode(_component_el_icon, {
  22267. size: "14",
  22268. class: vue.normalizeClass(_ctx.ns.is("loading"))
  22269. }, {
  22270. default: vue.withCtx(() => [
  22271. vue.createVNode(_component_loading)
  22272. ]),
  22273. _: 1
  22274. }, 8, ["class"]),
  22275. vue.createTextVNode(" " + vue.toDisplayString(_ctx.t("el.cascader.loading")), 1)
  22276. ], 2)) : _ctx.isEmpty ? (vue.openBlock(), vue.createElementBlock("div", {
  22277. key: 1,
  22278. class: vue.normalizeClass(_ctx.ns.e("empty-text"))
  22279. }, [
  22280. vue.renderSlot(_ctx.$slots, "empty", {}, () => [
  22281. vue.createTextVNode(vue.toDisplayString(_ctx.t("el.cascader.noData")), 1)
  22282. ])
  22283. ], 2)) : ((_a = _ctx.panel) == null ? void 0 : _a.isHoverMenu) ? (vue.openBlock(), vue.createElementBlock("svg", {
  22284. key: 2,
  22285. ref: "hoverZone",
  22286. class: vue.normalizeClass(_ctx.ns.e("hover-zone"))
  22287. }, null, 2)) : vue.createCommentVNode("v-if", true)
  22288. ];
  22289. }),
  22290. _: 3
  22291. }, 8, ["class", "wrap-class", "view-class", "onMousemove", "onMouseleave"]);
  22292. }
  22293. var ElCascaderMenu = /* @__PURE__ */ _export_sfc(_sfc_main$1S, [["render", _sfc_render$s], ["__file", "menu.vue"]]);
  22294. let uid = 0;
  22295. const calculatePathNodes = (node) => {
  22296. const nodes = [node];
  22297. let { parent } = node;
  22298. while (parent) {
  22299. nodes.unshift(parent);
  22300. parent = parent.parent;
  22301. }
  22302. return nodes;
  22303. };
  22304. class Node$2 {
  22305. constructor(data, config, parent, root = false) {
  22306. this.data = data;
  22307. this.config = config;
  22308. this.parent = parent;
  22309. this.root = root;
  22310. this.uid = uid++;
  22311. this.checked = false;
  22312. this.indeterminate = false;
  22313. this.loading = false;
  22314. const { value: valueKey, label: labelKey, children: childrenKey } = config;
  22315. const childrenData = data[childrenKey];
  22316. const pathNodes = calculatePathNodes(this);
  22317. this.level = root ? 0 : parent ? parent.level + 1 : 1;
  22318. this.value = data[valueKey];
  22319. this.label = data[labelKey];
  22320. this.pathNodes = pathNodes;
  22321. this.pathValues = pathNodes.map((node) => node.value);
  22322. this.pathLabels = pathNodes.map((node) => node.label);
  22323. this.childrenData = childrenData;
  22324. this.children = (childrenData || []).map((child) => new Node$2(child, config, this));
  22325. this.loaded = !config.lazy || this.isLeaf || !isEmpty(childrenData);
  22326. }
  22327. get isDisabled() {
  22328. const { data, parent, config } = this;
  22329. const { disabled, checkStrictly } = config;
  22330. const isDisabled = isFunction$1(disabled) ? disabled(data, this) : !!data[disabled];
  22331. return isDisabled || !checkStrictly && (parent == null ? void 0 : parent.isDisabled);
  22332. }
  22333. get isLeaf() {
  22334. const { data, config, childrenData, loaded } = this;
  22335. const { lazy, leaf } = config;
  22336. const isLeaf = isFunction$1(leaf) ? leaf(data, this) : data[leaf];
  22337. return isUndefined(isLeaf) ? lazy && !loaded ? false : !(isArray$1(childrenData) && childrenData.length) : !!isLeaf;
  22338. }
  22339. get valueByOption() {
  22340. return this.config.emitPath ? this.pathValues : this.value;
  22341. }
  22342. appendChild(childData) {
  22343. const { childrenData, children } = this;
  22344. const node = new Node$2(childData, this.config, this);
  22345. if (isArray$1(childrenData)) {
  22346. childrenData.push(childData);
  22347. } else {
  22348. this.childrenData = [childData];
  22349. }
  22350. children.push(node);
  22351. return node;
  22352. }
  22353. calcText(allLevels, separator) {
  22354. const text = allLevels ? this.pathLabels.join(separator) : this.label;
  22355. this.text = text;
  22356. return text;
  22357. }
  22358. broadcast(event, ...args) {
  22359. const handlerName = `onParent${capitalize(event)}`;
  22360. this.children.forEach((child) => {
  22361. if (child) {
  22362. child.broadcast(event, ...args);
  22363. child[handlerName] && child[handlerName](...args);
  22364. }
  22365. });
  22366. }
  22367. emit(event, ...args) {
  22368. const { parent } = this;
  22369. const handlerName = `onChild${capitalize(event)}`;
  22370. if (parent) {
  22371. parent[handlerName] && parent[handlerName](...args);
  22372. parent.emit(event, ...args);
  22373. }
  22374. }
  22375. onParentCheck(checked) {
  22376. if (!this.isDisabled) {
  22377. this.setCheckState(checked);
  22378. }
  22379. }
  22380. onChildCheck() {
  22381. const { children } = this;
  22382. const validChildren = children.filter((child) => !child.isDisabled);
  22383. const checked = validChildren.length ? validChildren.every((child) => child.checked) : false;
  22384. this.setCheckState(checked);
  22385. }
  22386. setCheckState(checked) {
  22387. const totalNum = this.children.length;
  22388. const checkedNum = this.children.reduce((c, p) => {
  22389. const num = p.checked ? 1 : p.indeterminate ? 0.5 : 0;
  22390. return c + num;
  22391. }, 0);
  22392. this.checked = this.loaded && this.children.filter((child) => !child.isDisabled).every((child) => child.loaded && child.checked) && checked;
  22393. this.indeterminate = this.loaded && checkedNum !== totalNum && checkedNum > 0;
  22394. }
  22395. doCheck(checked) {
  22396. if (this.checked === checked)
  22397. return;
  22398. const { checkStrictly, multiple } = this.config;
  22399. if (checkStrictly || !multiple) {
  22400. this.checked = checked;
  22401. } else {
  22402. this.broadcast("check", checked);
  22403. this.setCheckState(checked);
  22404. this.emit("check");
  22405. }
  22406. }
  22407. }
  22408. var Node$3 = Node$2;
  22409. const flatNodes = (nodes, leafOnly) => {
  22410. return nodes.reduce((res, node) => {
  22411. if (node.isLeaf) {
  22412. res.push(node);
  22413. } else {
  22414. !leafOnly && res.push(node);
  22415. res = res.concat(flatNodes(node.children, leafOnly));
  22416. }
  22417. return res;
  22418. }, []);
  22419. };
  22420. class Store {
  22421. constructor(data, config) {
  22422. this.config = config;
  22423. const nodes = (data || []).map((nodeData) => new Node$3(nodeData, this.config));
  22424. this.nodes = nodes;
  22425. this.allNodes = flatNodes(nodes, false);
  22426. this.leafNodes = flatNodes(nodes, true);
  22427. }
  22428. getNodes() {
  22429. return this.nodes;
  22430. }
  22431. getFlattedNodes(leafOnly) {
  22432. return leafOnly ? this.leafNodes : this.allNodes;
  22433. }
  22434. appendNode(nodeData, parentNode) {
  22435. const node = parentNode ? parentNode.appendChild(nodeData) : new Node$3(nodeData, this.config);
  22436. if (!parentNode)
  22437. this.nodes.push(node);
  22438. this.allNodes.push(node);
  22439. node.isLeaf && this.leafNodes.push(node);
  22440. }
  22441. appendNodes(nodeDataList, parentNode) {
  22442. nodeDataList.forEach((nodeData) => this.appendNode(nodeData, parentNode));
  22443. }
  22444. getNodeByValue(value, leafOnly = false) {
  22445. if (!value && value !== 0)
  22446. return null;
  22447. const node = this.getFlattedNodes(leafOnly).find((node2) => isEqual$1(node2.value, value) || isEqual$1(node2.pathValues, value));
  22448. return node || null;
  22449. }
  22450. getSameNode(node) {
  22451. if (!node)
  22452. return null;
  22453. const node_ = this.getFlattedNodes(false).find(({ value, level }) => isEqual$1(node.value, value) && node.level === level);
  22454. return node_ || null;
  22455. }
  22456. }
  22457. const CommonProps = buildProps({
  22458. modelValue: {
  22459. type: definePropType([Number, String, Array])
  22460. },
  22461. options: {
  22462. type: definePropType(Array),
  22463. default: () => []
  22464. },
  22465. props: {
  22466. type: definePropType(Object),
  22467. default: () => ({})
  22468. }
  22469. });
  22470. const DefaultProps = {
  22471. expandTrigger: "click",
  22472. multiple: false,
  22473. checkStrictly: false,
  22474. emitPath: true,
  22475. lazy: false,
  22476. lazyLoad: NOOP,
  22477. value: "value",
  22478. label: "label",
  22479. children: "children",
  22480. leaf: "leaf",
  22481. disabled: "disabled",
  22482. hoverThreshold: 500
  22483. };
  22484. const useCascaderConfig = (props) => {
  22485. return vue.computed(() => ({
  22486. ...DefaultProps,
  22487. ...props.props
  22488. }));
  22489. };
  22490. const getMenuIndex = (el) => {
  22491. if (!el)
  22492. return 0;
  22493. const pieces = el.id.split("-");
  22494. return Number(pieces[pieces.length - 2]);
  22495. };
  22496. const checkNode = (el) => {
  22497. if (!el)
  22498. return;
  22499. const input = el.querySelector("input");
  22500. if (input) {
  22501. input.click();
  22502. } else if (isLeaf(el)) {
  22503. el.click();
  22504. }
  22505. };
  22506. const sortByOriginalOrder = (oldNodes, newNodes) => {
  22507. const newNodesCopy = newNodes.slice(0);
  22508. const newIds = newNodesCopy.map((node) => node.uid);
  22509. const res = oldNodes.reduce((acc, item) => {
  22510. const index = newIds.indexOf(item.uid);
  22511. if (index > -1) {
  22512. acc.push(item);
  22513. newNodesCopy.splice(index, 1);
  22514. newIds.splice(index, 1);
  22515. }
  22516. return acc;
  22517. }, []);
  22518. res.push(...newNodesCopy);
  22519. return res;
  22520. };
  22521. const _sfc_main$1R = vue.defineComponent({
  22522. name: "ElCascaderPanel",
  22523. components: {
  22524. ElCascaderMenu
  22525. },
  22526. props: {
  22527. ...CommonProps,
  22528. border: {
  22529. type: Boolean,
  22530. default: true
  22531. },
  22532. renderLabel: Function
  22533. },
  22534. emits: [UPDATE_MODEL_EVENT, CHANGE_EVENT, "close", "expand-change"],
  22535. setup(props, { emit, slots }) {
  22536. let manualChecked = false;
  22537. const ns = useNamespace("cascader");
  22538. const config = useCascaderConfig(props);
  22539. let store = null;
  22540. const initialLoaded = vue.ref(true);
  22541. const menuList = vue.ref([]);
  22542. const checkedValue = vue.ref(null);
  22543. const menus = vue.ref([]);
  22544. const expandingNode = vue.ref(null);
  22545. const checkedNodes = vue.ref([]);
  22546. const isHoverMenu = vue.computed(() => config.value.expandTrigger === "hover");
  22547. const renderLabelFn = vue.computed(() => props.renderLabel || slots.default);
  22548. const initStore = () => {
  22549. const { options } = props;
  22550. const cfg = config.value;
  22551. manualChecked = false;
  22552. store = new Store(options, cfg);
  22553. menus.value = [store.getNodes()];
  22554. if (cfg.lazy && isEmpty(props.options)) {
  22555. initialLoaded.value = false;
  22556. lazyLoad(void 0, (list) => {
  22557. if (list) {
  22558. store = new Store(list, cfg);
  22559. menus.value = [store.getNodes()];
  22560. }
  22561. initialLoaded.value = true;
  22562. syncCheckedValue(false, true);
  22563. });
  22564. } else {
  22565. syncCheckedValue(false, true);
  22566. }
  22567. };
  22568. const lazyLoad = (node, cb) => {
  22569. const cfg = config.value;
  22570. node = node || new Node$3({}, cfg, void 0, true);
  22571. node.loading = true;
  22572. const resolve = (dataList) => {
  22573. const _node = node;
  22574. const parent = _node.root ? null : _node;
  22575. dataList && (store == null ? void 0 : store.appendNodes(dataList, parent));
  22576. _node.loading = false;
  22577. _node.loaded = true;
  22578. _node.childrenData = _node.childrenData || [];
  22579. cb && cb(dataList);
  22580. };
  22581. cfg.lazyLoad(node, resolve);
  22582. };
  22583. const expandNode = (node, silent) => {
  22584. var _a;
  22585. const { level } = node;
  22586. const newMenus = menus.value.slice(0, level);
  22587. let newExpandingNode;
  22588. if (node.isLeaf) {
  22589. newExpandingNode = node.pathNodes[level - 2];
  22590. } else {
  22591. newExpandingNode = node;
  22592. newMenus.push(node.children);
  22593. }
  22594. if (((_a = expandingNode.value) == null ? void 0 : _a.uid) !== (newExpandingNode == null ? void 0 : newExpandingNode.uid)) {
  22595. expandingNode.value = node;
  22596. menus.value = newMenus;
  22597. !silent && emit("expand-change", (node == null ? void 0 : node.pathValues) || []);
  22598. }
  22599. };
  22600. const handleCheckChange = (node, checked, emitClose = true) => {
  22601. const { checkStrictly, multiple } = config.value;
  22602. const oldNode = checkedNodes.value[0];
  22603. manualChecked = true;
  22604. !multiple && (oldNode == null ? void 0 : oldNode.doCheck(false));
  22605. node.doCheck(checked);
  22606. calculateCheckedValue();
  22607. emitClose && !multiple && !checkStrictly && emit("close");
  22608. !emitClose && !multiple && !checkStrictly && expandParentNode(node);
  22609. };
  22610. const expandParentNode = (node) => {
  22611. if (!node)
  22612. return;
  22613. node = node.parent;
  22614. expandParentNode(node);
  22615. node && expandNode(node);
  22616. };
  22617. const getFlattedNodes = (leafOnly) => {
  22618. return store == null ? void 0 : store.getFlattedNodes(leafOnly);
  22619. };
  22620. const getCheckedNodes = (leafOnly) => {
  22621. var _a;
  22622. return (_a = getFlattedNodes(leafOnly)) == null ? void 0 : _a.filter((node) => node.checked !== false);
  22623. };
  22624. const clearCheckedNodes = () => {
  22625. checkedNodes.value.forEach((node) => node.doCheck(false));
  22626. calculateCheckedValue();
  22627. menus.value = menus.value.slice(0, 1);
  22628. expandingNode.value = null;
  22629. emit("expand-change", []);
  22630. };
  22631. const calculateCheckedValue = () => {
  22632. var _a;
  22633. const { checkStrictly, multiple } = config.value;
  22634. const oldNodes = checkedNodes.value;
  22635. const newNodes = getCheckedNodes(!checkStrictly);
  22636. const nodes = sortByOriginalOrder(oldNodes, newNodes);
  22637. const values = nodes.map((node) => node.valueByOption);
  22638. checkedNodes.value = nodes;
  22639. checkedValue.value = multiple ? values : (_a = values[0]) != null ? _a : null;
  22640. };
  22641. const syncCheckedValue = (loaded = false, forced = false) => {
  22642. const { modelValue } = props;
  22643. const { lazy, multiple, checkStrictly } = config.value;
  22644. const leafOnly = !checkStrictly;
  22645. if (!initialLoaded.value || manualChecked || !forced && isEqual$1(modelValue, checkedValue.value))
  22646. return;
  22647. if (lazy && !loaded) {
  22648. const values = unique(flattenDeep(castArray(modelValue)));
  22649. const nodes = values.map((val) => store == null ? void 0 : store.getNodeByValue(val)).filter((node) => !!node && !node.loaded && !node.loading);
  22650. if (nodes.length) {
  22651. nodes.forEach((node) => {
  22652. lazyLoad(node, () => syncCheckedValue(false, forced));
  22653. });
  22654. } else {
  22655. syncCheckedValue(true, forced);
  22656. }
  22657. } else {
  22658. const values = multiple ? castArray(modelValue) : [modelValue];
  22659. const nodes = unique(values.map((val) => store == null ? void 0 : store.getNodeByValue(val, leafOnly)));
  22660. syncMenuState(nodes, forced);
  22661. checkedValue.value = cloneDeep(modelValue);
  22662. }
  22663. };
  22664. const syncMenuState = (newCheckedNodes, reserveExpandingState = true) => {
  22665. const { checkStrictly } = config.value;
  22666. const oldNodes = checkedNodes.value;
  22667. const newNodes = newCheckedNodes.filter((node) => !!node && (checkStrictly || node.isLeaf));
  22668. const oldExpandingNode = store == null ? void 0 : store.getSameNode(expandingNode.value);
  22669. const newExpandingNode = reserveExpandingState && oldExpandingNode || newNodes[0];
  22670. if (newExpandingNode) {
  22671. newExpandingNode.pathNodes.forEach((node) => expandNode(node, true));
  22672. } else {
  22673. expandingNode.value = null;
  22674. }
  22675. oldNodes.forEach((node) => node.doCheck(false));
  22676. vue.reactive(newNodes).forEach((node) => node.doCheck(true));
  22677. checkedNodes.value = newNodes;
  22678. vue.nextTick(scrollToExpandingNode);
  22679. };
  22680. const scrollToExpandingNode = () => {
  22681. if (!isClient)
  22682. return;
  22683. menuList.value.forEach((menu) => {
  22684. const menuElement = menu == null ? void 0 : menu.$el;
  22685. if (menuElement) {
  22686. const container = menuElement.querySelector(`.${ns.namespace.value}-scrollbar__wrap`);
  22687. const activeNode = menuElement.querySelector(`.${ns.b("node")}.${ns.is("active")}`) || menuElement.querySelector(`.${ns.b("node")}.in-active-path`);
  22688. scrollIntoView(container, activeNode);
  22689. }
  22690. });
  22691. };
  22692. const handleKeyDown = (e) => {
  22693. const target = e.target;
  22694. const { code } = e;
  22695. switch (code) {
  22696. case EVENT_CODE.up:
  22697. case EVENT_CODE.down: {
  22698. e.preventDefault();
  22699. const distance = code === EVENT_CODE.up ? -1 : 1;
  22700. focusNode(getSibling(target, distance, `.${ns.b("node")}[tabindex="-1"]`));
  22701. break;
  22702. }
  22703. case EVENT_CODE.left: {
  22704. e.preventDefault();
  22705. const preMenu = menuList.value[getMenuIndex(target) - 1];
  22706. const expandedNode = preMenu == null ? void 0 : preMenu.$el.querySelector(`.${ns.b("node")}[aria-expanded="true"]`);
  22707. focusNode(expandedNode);
  22708. break;
  22709. }
  22710. case EVENT_CODE.right: {
  22711. e.preventDefault();
  22712. const nextMenu = menuList.value[getMenuIndex(target) + 1];
  22713. const firstNode = nextMenu == null ? void 0 : nextMenu.$el.querySelector(`.${ns.b("node")}[tabindex="-1"]`);
  22714. focusNode(firstNode);
  22715. break;
  22716. }
  22717. case EVENT_CODE.enter:
  22718. case EVENT_CODE.numpadEnter:
  22719. checkNode(target);
  22720. break;
  22721. }
  22722. };
  22723. vue.provide(CASCADER_PANEL_INJECTION_KEY, vue.reactive({
  22724. config,
  22725. expandingNode,
  22726. checkedNodes,
  22727. isHoverMenu,
  22728. initialLoaded,
  22729. renderLabelFn,
  22730. lazyLoad,
  22731. expandNode,
  22732. handleCheckChange
  22733. }));
  22734. vue.watch([config, () => props.options], initStore, {
  22735. deep: true,
  22736. immediate: true
  22737. });
  22738. vue.watch(() => props.modelValue, () => {
  22739. manualChecked = false;
  22740. syncCheckedValue();
  22741. }, {
  22742. deep: true
  22743. });
  22744. vue.watch(() => checkedValue.value, (val) => {
  22745. if (!isEqual$1(val, props.modelValue)) {
  22746. emit(UPDATE_MODEL_EVENT, val);
  22747. emit(CHANGE_EVENT, val);
  22748. }
  22749. });
  22750. vue.onBeforeUpdate(() => menuList.value = []);
  22751. vue.onMounted(() => !isEmpty(props.modelValue) && syncCheckedValue());
  22752. return {
  22753. ns,
  22754. menuList,
  22755. menus,
  22756. checkedNodes,
  22757. handleKeyDown,
  22758. handleCheckChange,
  22759. getFlattedNodes,
  22760. getCheckedNodes,
  22761. clearCheckedNodes,
  22762. calculateCheckedValue,
  22763. scrollToExpandingNode
  22764. };
  22765. }
  22766. });
  22767. function _sfc_render$r(_ctx, _cache, $props, $setup, $data, $options) {
  22768. const _component_el_cascader_menu = vue.resolveComponent("el-cascader-menu");
  22769. return vue.openBlock(), vue.createElementBlock("div", {
  22770. class: vue.normalizeClass([_ctx.ns.b("panel"), _ctx.ns.is("bordered", _ctx.border)]),
  22771. onKeydown: _ctx.handleKeyDown
  22772. }, [
  22773. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.menus, (menu, index) => {
  22774. return vue.openBlock(), vue.createBlock(_component_el_cascader_menu, {
  22775. key: index,
  22776. ref_for: true,
  22777. ref: (item) => _ctx.menuList[index] = item,
  22778. index,
  22779. nodes: [...menu]
  22780. }, {
  22781. empty: vue.withCtx(() => [
  22782. vue.renderSlot(_ctx.$slots, "empty")
  22783. ]),
  22784. _: 2
  22785. }, 1032, ["index", "nodes"]);
  22786. }), 128))
  22787. ], 42, ["onKeydown"]);
  22788. }
  22789. var CascaderPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1R, [["render", _sfc_render$r], ["__file", "index.vue"]]);
  22790. const ElCascaderPanel = withInstall(CascaderPanel);
  22791. const tagProps = buildProps({
  22792. type: {
  22793. type: String,
  22794. values: ["primary", "success", "info", "warning", "danger"],
  22795. default: "primary"
  22796. },
  22797. closable: Boolean,
  22798. disableTransitions: Boolean,
  22799. hit: Boolean,
  22800. color: String,
  22801. size: {
  22802. type: String,
  22803. values: componentSizes
  22804. },
  22805. effect: {
  22806. type: String,
  22807. values: ["dark", "light", "plain"],
  22808. default: "light"
  22809. },
  22810. round: Boolean
  22811. });
  22812. const tagEmits = {
  22813. close: (evt) => evt instanceof MouseEvent,
  22814. click: (evt) => evt instanceof MouseEvent
  22815. };
  22816. const __default__$1i = vue.defineComponent({
  22817. name: "ElTag"
  22818. });
  22819. const _sfc_main$1Q = /* @__PURE__ */ vue.defineComponent({
  22820. ...__default__$1i,
  22821. props: tagProps,
  22822. emits: tagEmits,
  22823. setup(__props, { emit }) {
  22824. const props = __props;
  22825. const tagSize = useFormSize();
  22826. const ns = useNamespace("tag");
  22827. const containerKls = vue.computed(() => {
  22828. const { type, hit, effect, closable, round } = props;
  22829. return [
  22830. ns.b(),
  22831. ns.is("closable", closable),
  22832. ns.m(type || "primary"),
  22833. ns.m(tagSize.value),
  22834. ns.m(effect),
  22835. ns.is("hit", hit),
  22836. ns.is("round", round)
  22837. ];
  22838. });
  22839. const handleClose = (event) => {
  22840. emit("close", event);
  22841. };
  22842. const handleClick = (event) => {
  22843. emit("click", event);
  22844. };
  22845. const handleVNodeMounted = (vnode) => {
  22846. var _a, _b, _c;
  22847. if ((_c = (_b = (_a = vnode == null ? void 0 : vnode.component) == null ? void 0 : _a.subTree) == null ? void 0 : _b.component) == null ? void 0 : _c.bum) {
  22848. vnode.component.subTree.component.bum = null;
  22849. }
  22850. };
  22851. return (_ctx, _cache) => {
  22852. return _ctx.disableTransitions ? (vue.openBlock(), vue.createElementBlock("span", {
  22853. key: 0,
  22854. class: vue.normalizeClass(vue.unref(containerKls)),
  22855. style: vue.normalizeStyle({ backgroundColor: _ctx.color }),
  22856. onClick: handleClick
  22857. }, [
  22858. vue.createElementVNode("span", {
  22859. class: vue.normalizeClass(vue.unref(ns).e("content"))
  22860. }, [
  22861. vue.renderSlot(_ctx.$slots, "default")
  22862. ], 2),
  22863. _ctx.closable ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  22864. key: 0,
  22865. class: vue.normalizeClass(vue.unref(ns).e("close")),
  22866. onClick: vue.withModifiers(handleClose, ["stop"])
  22867. }, {
  22868. default: vue.withCtx(() => [
  22869. vue.createVNode(vue.unref(close_default))
  22870. ]),
  22871. _: 1
  22872. }, 8, ["class", "onClick"])) : vue.createCommentVNode("v-if", true)
  22873. ], 6)) : (vue.openBlock(), vue.createBlock(vue.Transition, {
  22874. key: 1,
  22875. name: `${vue.unref(ns).namespace.value}-zoom-in-center`,
  22876. appear: "",
  22877. onVnodeMounted: handleVNodeMounted
  22878. }, {
  22879. default: vue.withCtx(() => [
  22880. vue.createElementVNode("span", {
  22881. class: vue.normalizeClass(vue.unref(containerKls)),
  22882. style: vue.normalizeStyle({ backgroundColor: _ctx.color }),
  22883. onClick: handleClick
  22884. }, [
  22885. vue.createElementVNode("span", {
  22886. class: vue.normalizeClass(vue.unref(ns).e("content"))
  22887. }, [
  22888. vue.renderSlot(_ctx.$slots, "default")
  22889. ], 2),
  22890. _ctx.closable ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  22891. key: 0,
  22892. class: vue.normalizeClass(vue.unref(ns).e("close")),
  22893. onClick: vue.withModifiers(handleClose, ["stop"])
  22894. }, {
  22895. default: vue.withCtx(() => [
  22896. vue.createVNode(vue.unref(close_default))
  22897. ]),
  22898. _: 1
  22899. }, 8, ["class", "onClick"])) : vue.createCommentVNode("v-if", true)
  22900. ], 6)
  22901. ]),
  22902. _: 3
  22903. }, 8, ["name"]));
  22904. };
  22905. }
  22906. });
  22907. var Tag = /* @__PURE__ */ _export_sfc(_sfc_main$1Q, [["__file", "tag.vue"]]);
  22908. const ElTag = withInstall(Tag);
  22909. const cascaderProps = buildProps({
  22910. ...CommonProps,
  22911. size: useSizeProp,
  22912. placeholder: String,
  22913. disabled: Boolean,
  22914. clearable: Boolean,
  22915. filterable: Boolean,
  22916. filterMethod: {
  22917. type: definePropType(Function),
  22918. default: (node, keyword) => node.text.includes(keyword)
  22919. },
  22920. separator: {
  22921. type: String,
  22922. default: " / "
  22923. },
  22924. showAllLevels: {
  22925. type: Boolean,
  22926. default: true
  22927. },
  22928. collapseTags: Boolean,
  22929. maxCollapseTags: {
  22930. type: Number,
  22931. default: 1
  22932. },
  22933. collapseTagsTooltip: {
  22934. type: Boolean,
  22935. default: false
  22936. },
  22937. debounce: {
  22938. type: Number,
  22939. default: 300
  22940. },
  22941. beforeFilter: {
  22942. type: definePropType(Function),
  22943. default: () => true
  22944. },
  22945. placement: {
  22946. type: definePropType(String),
  22947. values: Ee,
  22948. default: "bottom-start"
  22949. },
  22950. fallbackPlacements: {
  22951. type: definePropType(Array),
  22952. default: ["bottom-start", "bottom", "top-start", "top", "right", "left"]
  22953. },
  22954. popperClass: {
  22955. type: String,
  22956. default: ""
  22957. },
  22958. teleported: useTooltipContentProps.teleported,
  22959. tagType: { ...tagProps.type, default: "info" },
  22960. tagEffect: { ...tagProps.effect, default: "light" },
  22961. validateEvent: {
  22962. type: Boolean,
  22963. default: true
  22964. },
  22965. persistent: {
  22966. type: Boolean,
  22967. default: true
  22968. },
  22969. ...useEmptyValuesProps
  22970. });
  22971. const cascaderEmits = {
  22972. [UPDATE_MODEL_EVENT]: (_) => true,
  22973. [CHANGE_EVENT]: (_) => true,
  22974. focus: (evt) => evt instanceof FocusEvent,
  22975. blur: (evt) => evt instanceof FocusEvent,
  22976. clear: () => true,
  22977. visibleChange: (val) => isBoolean(val),
  22978. expandChange: (val) => !!val,
  22979. removeTag: (val) => !!val
  22980. };
  22981. const COMPONENT_NAME$e = "ElCascader";
  22982. const __default__$1h = vue.defineComponent({
  22983. name: COMPONENT_NAME$e
  22984. });
  22985. const _sfc_main$1P = /* @__PURE__ */ vue.defineComponent({
  22986. ...__default__$1h,
  22987. props: cascaderProps,
  22988. emits: cascaderEmits,
  22989. setup(__props, { expose, emit }) {
  22990. const props = __props;
  22991. const popperOptions = {
  22992. modifiers: [
  22993. {
  22994. name: "arrowPosition",
  22995. enabled: true,
  22996. phase: "main",
  22997. fn: ({ state }) => {
  22998. const { modifiersData, placement } = state;
  22999. if (["right", "left", "bottom", "top"].includes(placement))
  23000. return;
  23001. modifiersData.arrow.x = 35;
  23002. },
  23003. requires: ["arrow"]
  23004. }
  23005. ]
  23006. };
  23007. const attrs = vue.useAttrs();
  23008. let inputInitialHeight = 0;
  23009. let pressDeleteCount = 0;
  23010. const nsCascader = useNamespace("cascader");
  23011. const nsInput = useNamespace("input");
  23012. const { t } = useLocale();
  23013. const { form, formItem } = useFormItem();
  23014. const { valueOnClear } = useEmptyValues(props);
  23015. const { isComposing, handleComposition } = useComposition({
  23016. afterComposition(event) {
  23017. var _a;
  23018. const text = (_a = event.target) == null ? void 0 : _a.value;
  23019. handleInput(text);
  23020. }
  23021. });
  23022. const tooltipRef = vue.ref(null);
  23023. const input = vue.ref(null);
  23024. const tagWrapper = vue.ref(null);
  23025. const cascaderPanelRef = vue.ref(null);
  23026. const suggestionPanel = vue.ref(null);
  23027. const popperVisible = vue.ref(false);
  23028. const inputHover = vue.ref(false);
  23029. const filtering = vue.ref(false);
  23030. const filterFocus = vue.ref(false);
  23031. const inputValue = vue.ref("");
  23032. const searchInputValue = vue.ref("");
  23033. const presentTags = vue.ref([]);
  23034. const allPresentTags = vue.ref([]);
  23035. const suggestions = vue.ref([]);
  23036. const cascaderStyle = vue.computed(() => {
  23037. return attrs.style;
  23038. });
  23039. const isDisabled = vue.computed(() => props.disabled || (form == null ? void 0 : form.disabled));
  23040. const inputPlaceholder = vue.computed(() => props.placeholder || t("el.cascader.placeholder"));
  23041. const currentPlaceholder = vue.computed(() => searchInputValue.value || presentTags.value.length > 0 || isComposing.value ? "" : inputPlaceholder.value);
  23042. const realSize = useFormSize();
  23043. const tagSize = vue.computed(() => realSize.value === "small" ? "small" : "default");
  23044. const multiple = vue.computed(() => !!props.props.multiple);
  23045. const readonly = vue.computed(() => !props.filterable || multiple.value);
  23046. const searchKeyword = vue.computed(() => multiple.value ? searchInputValue.value : inputValue.value);
  23047. const checkedNodes = vue.computed(() => {
  23048. var _a;
  23049. return ((_a = cascaderPanelRef.value) == null ? void 0 : _a.checkedNodes) || [];
  23050. });
  23051. const clearBtnVisible = vue.computed(() => {
  23052. if (!props.clearable || isDisabled.value || filtering.value || !inputHover.value)
  23053. return false;
  23054. return !!checkedNodes.value.length;
  23055. });
  23056. const presentText = vue.computed(() => {
  23057. const { showAllLevels, separator } = props;
  23058. const nodes = checkedNodes.value;
  23059. return nodes.length ? multiple.value ? "" : nodes[0].calcText(showAllLevels, separator) : "";
  23060. });
  23061. const validateState = vue.computed(() => (formItem == null ? void 0 : formItem.validateState) || "");
  23062. const checkedValue = vue.computed({
  23063. get() {
  23064. return cloneDeep(props.modelValue);
  23065. },
  23066. set(val) {
  23067. const value = val != null ? val : valueOnClear.value;
  23068. emit(UPDATE_MODEL_EVENT, value);
  23069. emit(CHANGE_EVENT, value);
  23070. if (props.validateEvent) {
  23071. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
  23072. }
  23073. }
  23074. });
  23075. const cascaderKls = vue.computed(() => {
  23076. return [
  23077. nsCascader.b(),
  23078. nsCascader.m(realSize.value),
  23079. nsCascader.is("disabled", isDisabled.value),
  23080. attrs.class
  23081. ];
  23082. });
  23083. const cascaderIconKls = vue.computed(() => {
  23084. return [
  23085. nsInput.e("icon"),
  23086. "icon-arrow-down",
  23087. nsCascader.is("reverse", popperVisible.value)
  23088. ];
  23089. });
  23090. const inputClass = vue.computed(() => {
  23091. return nsCascader.is("focus", popperVisible.value || filterFocus.value);
  23092. });
  23093. const contentRef = vue.computed(() => {
  23094. var _a, _b;
  23095. return (_b = (_a = tooltipRef.value) == null ? void 0 : _a.popperRef) == null ? void 0 : _b.contentRef;
  23096. });
  23097. const togglePopperVisible = (visible) => {
  23098. var _a, _b, _c;
  23099. if (isDisabled.value)
  23100. return;
  23101. visible = visible != null ? visible : !popperVisible.value;
  23102. if (visible !== popperVisible.value) {
  23103. popperVisible.value = visible;
  23104. (_b = (_a = input.value) == null ? void 0 : _a.input) == null ? void 0 : _b.setAttribute("aria-expanded", `${visible}`);
  23105. if (visible) {
  23106. updatePopperPosition();
  23107. vue.nextTick((_c = cascaderPanelRef.value) == null ? void 0 : _c.scrollToExpandingNode);
  23108. } else if (props.filterable) {
  23109. syncPresentTextValue();
  23110. }
  23111. emit("visibleChange", visible);
  23112. }
  23113. };
  23114. const updatePopperPosition = () => {
  23115. vue.nextTick(() => {
  23116. var _a;
  23117. (_a = tooltipRef.value) == null ? void 0 : _a.updatePopper();
  23118. });
  23119. };
  23120. const hideSuggestionPanel = () => {
  23121. filtering.value = false;
  23122. };
  23123. const genTag = (node) => {
  23124. const { showAllLevels, separator } = props;
  23125. return {
  23126. node,
  23127. key: node.uid,
  23128. text: node.calcText(showAllLevels, separator),
  23129. hitState: false,
  23130. closable: !isDisabled.value && !node.isDisabled,
  23131. isCollapseTag: false
  23132. };
  23133. };
  23134. const deleteTag = (tag) => {
  23135. var _a;
  23136. const node = tag.node;
  23137. node.doCheck(false);
  23138. (_a = cascaderPanelRef.value) == null ? void 0 : _a.calculateCheckedValue();
  23139. emit("removeTag", node.valueByOption);
  23140. };
  23141. const calculatePresentTags = () => {
  23142. if (!multiple.value)
  23143. return;
  23144. const nodes = checkedNodes.value;
  23145. const tags = [];
  23146. const allTags = [];
  23147. nodes.forEach((node) => allTags.push(genTag(node)));
  23148. allPresentTags.value = allTags;
  23149. if (nodes.length) {
  23150. nodes.slice(0, props.maxCollapseTags).forEach((node) => tags.push(genTag(node)));
  23151. const rest = nodes.slice(props.maxCollapseTags);
  23152. const restCount = rest.length;
  23153. if (restCount) {
  23154. if (props.collapseTags) {
  23155. tags.push({
  23156. key: -1,
  23157. text: `+ ${restCount}`,
  23158. closable: false,
  23159. isCollapseTag: true
  23160. });
  23161. } else {
  23162. rest.forEach((node) => tags.push(genTag(node)));
  23163. }
  23164. }
  23165. }
  23166. presentTags.value = tags;
  23167. };
  23168. const calculateSuggestions = () => {
  23169. var _a, _b;
  23170. const { filterMethod, showAllLevels, separator } = props;
  23171. const res = (_b = (_a = cascaderPanelRef.value) == null ? void 0 : _a.getFlattedNodes(!props.props.checkStrictly)) == null ? void 0 : _b.filter((node) => {
  23172. if (node.isDisabled)
  23173. return false;
  23174. node.calcText(showAllLevels, separator);
  23175. return filterMethod(node, searchKeyword.value);
  23176. });
  23177. if (multiple.value) {
  23178. presentTags.value.forEach((tag) => {
  23179. tag.hitState = false;
  23180. });
  23181. allPresentTags.value.forEach((tag) => {
  23182. tag.hitState = false;
  23183. });
  23184. }
  23185. filtering.value = true;
  23186. suggestions.value = res;
  23187. updatePopperPosition();
  23188. };
  23189. const focusFirstNode = () => {
  23190. var _a;
  23191. let firstNode;
  23192. if (filtering.value && suggestionPanel.value) {
  23193. firstNode = suggestionPanel.value.$el.querySelector(`.${nsCascader.e("suggestion-item")}`);
  23194. } else {
  23195. firstNode = (_a = cascaderPanelRef.value) == null ? void 0 : _a.$el.querySelector(`.${nsCascader.b("node")}[tabindex="-1"]`);
  23196. }
  23197. if (firstNode) {
  23198. firstNode.focus();
  23199. !filtering.value && firstNode.click();
  23200. }
  23201. };
  23202. const updateStyle = () => {
  23203. var _a, _b;
  23204. const inputInner = (_a = input.value) == null ? void 0 : _a.input;
  23205. const tagWrapperEl = tagWrapper.value;
  23206. const suggestionPanelEl = (_b = suggestionPanel.value) == null ? void 0 : _b.$el;
  23207. if (!isClient || !inputInner)
  23208. return;
  23209. if (suggestionPanelEl) {
  23210. const suggestionList = suggestionPanelEl.querySelector(`.${nsCascader.e("suggestion-list")}`);
  23211. suggestionList.style.minWidth = `${inputInner.offsetWidth}px`;
  23212. }
  23213. if (tagWrapperEl) {
  23214. const { offsetHeight } = tagWrapperEl;
  23215. const height = presentTags.value.length > 0 ? `${Math.max(offsetHeight, inputInitialHeight) - 2}px` : `${inputInitialHeight}px`;
  23216. inputInner.style.height = height;
  23217. updatePopperPosition();
  23218. }
  23219. };
  23220. const getCheckedNodes = (leafOnly) => {
  23221. var _a;
  23222. return (_a = cascaderPanelRef.value) == null ? void 0 : _a.getCheckedNodes(leafOnly);
  23223. };
  23224. const handleExpandChange = (value) => {
  23225. updatePopperPosition();
  23226. emit("expandChange", value);
  23227. };
  23228. const handleKeyDown = (e) => {
  23229. if (isComposing.value)
  23230. return;
  23231. switch (e.code) {
  23232. case EVENT_CODE.enter:
  23233. case EVENT_CODE.numpadEnter:
  23234. togglePopperVisible();
  23235. break;
  23236. case EVENT_CODE.down:
  23237. togglePopperVisible(true);
  23238. vue.nextTick(focusFirstNode);
  23239. e.preventDefault();
  23240. break;
  23241. case EVENT_CODE.esc:
  23242. if (popperVisible.value === true) {
  23243. e.preventDefault();
  23244. e.stopPropagation();
  23245. togglePopperVisible(false);
  23246. }
  23247. break;
  23248. case EVENT_CODE.tab:
  23249. togglePopperVisible(false);
  23250. break;
  23251. }
  23252. };
  23253. const handleClear = () => {
  23254. var _a;
  23255. (_a = cascaderPanelRef.value) == null ? void 0 : _a.clearCheckedNodes();
  23256. if (!popperVisible.value && props.filterable) {
  23257. syncPresentTextValue();
  23258. }
  23259. togglePopperVisible(false);
  23260. emit("clear");
  23261. };
  23262. const syncPresentTextValue = () => {
  23263. const { value } = presentText;
  23264. inputValue.value = value;
  23265. searchInputValue.value = value;
  23266. };
  23267. const handleSuggestionClick = (node) => {
  23268. var _a, _b;
  23269. const { checked } = node;
  23270. if (multiple.value) {
  23271. (_a = cascaderPanelRef.value) == null ? void 0 : _a.handleCheckChange(node, !checked, false);
  23272. } else {
  23273. !checked && ((_b = cascaderPanelRef.value) == null ? void 0 : _b.handleCheckChange(node, true, false));
  23274. togglePopperVisible(false);
  23275. }
  23276. };
  23277. const handleSuggestionKeyDown = (e) => {
  23278. const target = e.target;
  23279. const { code } = e;
  23280. switch (code) {
  23281. case EVENT_CODE.up:
  23282. case EVENT_CODE.down: {
  23283. const distance = code === EVENT_CODE.up ? -1 : 1;
  23284. focusNode(getSibling(target, distance, `.${nsCascader.e("suggestion-item")}[tabindex="-1"]`));
  23285. break;
  23286. }
  23287. case EVENT_CODE.enter:
  23288. case EVENT_CODE.numpadEnter:
  23289. target.click();
  23290. break;
  23291. }
  23292. };
  23293. const handleDelete = () => {
  23294. const tags = presentTags.value;
  23295. const lastTag = tags[tags.length - 1];
  23296. pressDeleteCount = searchInputValue.value ? 0 : pressDeleteCount + 1;
  23297. if (!lastTag || !pressDeleteCount || props.collapseTags && tags.length > 1)
  23298. return;
  23299. if (lastTag.hitState) {
  23300. deleteTag(lastTag);
  23301. } else {
  23302. lastTag.hitState = true;
  23303. }
  23304. };
  23305. const handleFocus = (e) => {
  23306. const el = e.target;
  23307. const name = nsCascader.e("search-input");
  23308. if (el.className === name) {
  23309. filterFocus.value = true;
  23310. }
  23311. emit("focus", e);
  23312. };
  23313. const handleBlur = (e) => {
  23314. filterFocus.value = false;
  23315. emit("blur", e);
  23316. };
  23317. const handleFilter = debounce(() => {
  23318. const { value } = searchKeyword;
  23319. if (!value)
  23320. return;
  23321. const passed = props.beforeFilter(value);
  23322. if (isPromise(passed)) {
  23323. passed.then(calculateSuggestions).catch(() => {
  23324. });
  23325. } else if (passed !== false) {
  23326. calculateSuggestions();
  23327. } else {
  23328. hideSuggestionPanel();
  23329. }
  23330. }, props.debounce);
  23331. const handleInput = (val, e) => {
  23332. !popperVisible.value && togglePopperVisible(true);
  23333. if (e == null ? void 0 : e.isComposing)
  23334. return;
  23335. val ? handleFilter() : hideSuggestionPanel();
  23336. };
  23337. const getInputInnerHeight = (inputInner) => Number.parseFloat(useCssVar(nsInput.cssVarName("input-height"), inputInner).value) - 2;
  23338. vue.watch(filtering, updatePopperPosition);
  23339. vue.watch([checkedNodes, isDisabled, () => props.collapseTags], calculatePresentTags);
  23340. vue.watch(presentTags, () => {
  23341. vue.nextTick(() => updateStyle());
  23342. });
  23343. vue.watch(realSize, async () => {
  23344. await vue.nextTick();
  23345. const inputInner = input.value.input;
  23346. inputInitialHeight = getInputInnerHeight(inputInner) || inputInitialHeight;
  23347. updateStyle();
  23348. });
  23349. vue.watch(presentText, syncPresentTextValue, { immediate: true });
  23350. vue.onMounted(() => {
  23351. const inputInner = input.value.input;
  23352. const inputInnerHeight = getInputInnerHeight(inputInner);
  23353. inputInitialHeight = inputInner.offsetHeight || inputInnerHeight;
  23354. useResizeObserver(inputInner, updateStyle);
  23355. });
  23356. expose({
  23357. getCheckedNodes,
  23358. cascaderPanelRef,
  23359. togglePopperVisible,
  23360. contentRef,
  23361. presentText
  23362. });
  23363. return (_ctx, _cache) => {
  23364. return vue.openBlock(), vue.createBlock(vue.unref(ElTooltip), {
  23365. ref_key: "tooltipRef",
  23366. ref: tooltipRef,
  23367. visible: popperVisible.value,
  23368. teleported: _ctx.teleported,
  23369. "popper-class": [vue.unref(nsCascader).e("dropdown"), _ctx.popperClass],
  23370. "popper-options": popperOptions,
  23371. "fallback-placements": _ctx.fallbackPlacements,
  23372. "stop-popper-mouse-event": false,
  23373. "gpu-acceleration": false,
  23374. placement: _ctx.placement,
  23375. transition: `${vue.unref(nsCascader).namespace.value}-zoom-in-top`,
  23376. effect: "light",
  23377. pure: "",
  23378. persistent: _ctx.persistent,
  23379. onHide: hideSuggestionPanel
  23380. }, {
  23381. default: vue.withCtx(() => [
  23382. vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  23383. class: vue.normalizeClass(vue.unref(cascaderKls)),
  23384. style: vue.normalizeStyle(vue.unref(cascaderStyle)),
  23385. onClick: () => togglePopperVisible(vue.unref(readonly) ? void 0 : true),
  23386. onKeydown: handleKeyDown,
  23387. onMouseenter: ($event) => inputHover.value = true,
  23388. onMouseleave: ($event) => inputHover.value = false
  23389. }, [
  23390. vue.createVNode(vue.unref(ElInput), {
  23391. ref_key: "input",
  23392. ref: input,
  23393. modelValue: inputValue.value,
  23394. "onUpdate:modelValue": ($event) => inputValue.value = $event,
  23395. placeholder: vue.unref(currentPlaceholder),
  23396. readonly: vue.unref(readonly),
  23397. disabled: vue.unref(isDisabled),
  23398. "validate-event": false,
  23399. size: vue.unref(realSize),
  23400. class: vue.normalizeClass(vue.unref(inputClass)),
  23401. tabindex: vue.unref(multiple) && _ctx.filterable && !vue.unref(isDisabled) ? -1 : void 0,
  23402. onCompositionstart: vue.unref(handleComposition),
  23403. onCompositionupdate: vue.unref(handleComposition),
  23404. onCompositionend: vue.unref(handleComposition),
  23405. onFocus: handleFocus,
  23406. onBlur: handleBlur,
  23407. onInput: handleInput
  23408. }, {
  23409. suffix: vue.withCtx(() => [
  23410. vue.unref(clearBtnVisible) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  23411. key: "clear",
  23412. class: vue.normalizeClass([vue.unref(nsInput).e("icon"), "icon-circle-close"]),
  23413. onClick: vue.withModifiers(handleClear, ["stop"])
  23414. }, {
  23415. default: vue.withCtx(() => [
  23416. vue.createVNode(vue.unref(circle_close_default))
  23417. ]),
  23418. _: 1
  23419. }, 8, ["class", "onClick"])) : (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  23420. key: "arrow-down",
  23421. class: vue.normalizeClass(vue.unref(cascaderIconKls)),
  23422. onClick: vue.withModifiers(($event) => togglePopperVisible(), ["stop"])
  23423. }, {
  23424. default: vue.withCtx(() => [
  23425. vue.createVNode(vue.unref(arrow_down_default))
  23426. ]),
  23427. _: 1
  23428. }, 8, ["class", "onClick"]))
  23429. ]),
  23430. _: 1
  23431. }, 8, ["modelValue", "onUpdate:modelValue", "placeholder", "readonly", "disabled", "size", "class", "tabindex", "onCompositionstart", "onCompositionupdate", "onCompositionend"]),
  23432. vue.unref(multiple) ? (vue.openBlock(), vue.createElementBlock("div", {
  23433. key: 0,
  23434. ref_key: "tagWrapper",
  23435. ref: tagWrapper,
  23436. class: vue.normalizeClass([
  23437. vue.unref(nsCascader).e("tags"),
  23438. vue.unref(nsCascader).is("validate", Boolean(vue.unref(validateState)))
  23439. ])
  23440. }, [
  23441. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(presentTags.value, (tag) => {
  23442. return vue.openBlock(), vue.createBlock(vue.unref(ElTag), {
  23443. key: tag.key,
  23444. type: _ctx.tagType,
  23445. size: vue.unref(tagSize),
  23446. effect: _ctx.tagEffect,
  23447. hit: tag.hitState,
  23448. closable: tag.closable,
  23449. "disable-transitions": "",
  23450. onClose: ($event) => deleteTag(tag)
  23451. }, {
  23452. default: vue.withCtx(() => [
  23453. tag.isCollapseTag === false ? (vue.openBlock(), vue.createElementBlock("span", { key: 0 }, vue.toDisplayString(tag.text), 1)) : (vue.openBlock(), vue.createBlock(vue.unref(ElTooltip), {
  23454. key: 1,
  23455. disabled: popperVisible.value || !_ctx.collapseTagsTooltip,
  23456. "fallback-placements": ["bottom", "top", "right", "left"],
  23457. placement: "bottom",
  23458. effect: "light"
  23459. }, {
  23460. default: vue.withCtx(() => [
  23461. vue.createElementVNode("span", null, vue.toDisplayString(tag.text), 1)
  23462. ]),
  23463. content: vue.withCtx(() => [
  23464. vue.createElementVNode("div", {
  23465. class: vue.normalizeClass(vue.unref(nsCascader).e("collapse-tags"))
  23466. }, [
  23467. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(allPresentTags.value.slice(_ctx.maxCollapseTags), (tag2, idx) => {
  23468. return vue.openBlock(), vue.createElementBlock("div", {
  23469. key: idx,
  23470. class: vue.normalizeClass(vue.unref(nsCascader).e("collapse-tag"))
  23471. }, [
  23472. (vue.openBlock(), vue.createBlock(vue.unref(ElTag), {
  23473. key: tag2.key,
  23474. class: "in-tooltip",
  23475. type: _ctx.tagType,
  23476. size: vue.unref(tagSize),
  23477. effect: _ctx.tagEffect,
  23478. hit: tag2.hitState,
  23479. closable: tag2.closable,
  23480. "disable-transitions": "",
  23481. onClose: ($event) => deleteTag(tag2)
  23482. }, {
  23483. default: vue.withCtx(() => [
  23484. vue.createElementVNode("span", null, vue.toDisplayString(tag2.text), 1)
  23485. ]),
  23486. _: 2
  23487. }, 1032, ["type", "size", "effect", "hit", "closable", "onClose"]))
  23488. ], 2);
  23489. }), 128))
  23490. ], 2)
  23491. ]),
  23492. _: 2
  23493. }, 1032, ["disabled"]))
  23494. ]),
  23495. _: 2
  23496. }, 1032, ["type", "size", "effect", "hit", "closable", "onClose"]);
  23497. }), 128)),
  23498. _ctx.filterable && !vue.unref(isDisabled) ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("input", {
  23499. key: 0,
  23500. "onUpdate:modelValue": ($event) => searchInputValue.value = $event,
  23501. type: "text",
  23502. class: vue.normalizeClass(vue.unref(nsCascader).e("search-input")),
  23503. placeholder: vue.unref(presentText) ? "" : vue.unref(inputPlaceholder),
  23504. onInput: (e) => handleInput(searchInputValue.value, e),
  23505. onClick: vue.withModifiers(($event) => togglePopperVisible(true), ["stop"]),
  23506. onKeydown: vue.withKeys(handleDelete, ["delete"]),
  23507. onCompositionstart: vue.unref(handleComposition),
  23508. onCompositionupdate: vue.unref(handleComposition),
  23509. onCompositionend: vue.unref(handleComposition),
  23510. onFocus: handleFocus,
  23511. onBlur: handleBlur
  23512. }, null, 42, ["onUpdate:modelValue", "placeholder", "onInput", "onClick", "onKeydown", "onCompositionstart", "onCompositionupdate", "onCompositionend"])), [
  23513. [vue.vModelText, searchInputValue.value]
  23514. ]) : vue.createCommentVNode("v-if", true)
  23515. ], 2)) : vue.createCommentVNode("v-if", true)
  23516. ], 46, ["onClick", "onMouseenter", "onMouseleave"])), [
  23517. [vue.unref(ClickOutside), () => togglePopperVisible(false), vue.unref(contentRef)]
  23518. ])
  23519. ]),
  23520. content: vue.withCtx(() => [
  23521. vue.withDirectives(vue.createVNode(vue.unref(ElCascaderPanel), {
  23522. ref_key: "cascaderPanelRef",
  23523. ref: cascaderPanelRef,
  23524. modelValue: vue.unref(checkedValue),
  23525. "onUpdate:modelValue": ($event) => vue.isRef(checkedValue) ? checkedValue.value = $event : null,
  23526. options: _ctx.options,
  23527. props: props.props,
  23528. border: false,
  23529. "render-label": _ctx.$slots.default,
  23530. onExpandChange: handleExpandChange,
  23531. onClose: ($event) => _ctx.$nextTick(() => togglePopperVisible(false))
  23532. }, {
  23533. empty: vue.withCtx(() => [
  23534. vue.renderSlot(_ctx.$slots, "empty")
  23535. ]),
  23536. _: 3
  23537. }, 8, ["modelValue", "onUpdate:modelValue", "options", "props", "render-label", "onClose"]), [
  23538. [vue.vShow, !filtering.value]
  23539. ]),
  23540. _ctx.filterable ? vue.withDirectives((vue.openBlock(), vue.createBlock(vue.unref(ElScrollbar), {
  23541. key: 0,
  23542. ref_key: "suggestionPanel",
  23543. ref: suggestionPanel,
  23544. tag: "ul",
  23545. class: vue.normalizeClass(vue.unref(nsCascader).e("suggestion-panel")),
  23546. "view-class": vue.unref(nsCascader).e("suggestion-list"),
  23547. onKeydown: handleSuggestionKeyDown
  23548. }, {
  23549. default: vue.withCtx(() => [
  23550. suggestions.value.length ? (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 0 }, vue.renderList(suggestions.value, (item) => {
  23551. return vue.openBlock(), vue.createElementBlock("li", {
  23552. key: item.uid,
  23553. class: vue.normalizeClass([
  23554. vue.unref(nsCascader).e("suggestion-item"),
  23555. vue.unref(nsCascader).is("checked", item.checked)
  23556. ]),
  23557. tabindex: -1,
  23558. onClick: ($event) => handleSuggestionClick(item)
  23559. }, [
  23560. vue.createElementVNode("span", null, vue.toDisplayString(item.text), 1),
  23561. item.checked ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 0 }, {
  23562. default: vue.withCtx(() => [
  23563. vue.createVNode(vue.unref(check_default))
  23564. ]),
  23565. _: 1
  23566. })) : vue.createCommentVNode("v-if", true)
  23567. ], 10, ["onClick"]);
  23568. }), 128)) : vue.renderSlot(_ctx.$slots, "empty", { key: 1 }, () => [
  23569. vue.createElementVNode("li", {
  23570. class: vue.normalizeClass(vue.unref(nsCascader).e("empty-text"))
  23571. }, vue.toDisplayString(vue.unref(t)("el.cascader.noMatch")), 3)
  23572. ])
  23573. ]),
  23574. _: 3
  23575. }, 8, ["class", "view-class"])), [
  23576. [vue.vShow, filtering.value]
  23577. ]) : vue.createCommentVNode("v-if", true)
  23578. ]),
  23579. _: 3
  23580. }, 8, ["visible", "teleported", "popper-class", "fallback-placements", "placement", "transition", "persistent"]);
  23581. };
  23582. }
  23583. });
  23584. var Cascader = /* @__PURE__ */ _export_sfc(_sfc_main$1P, [["__file", "cascader.vue"]]);
  23585. const ElCascader = withInstall(Cascader);
  23586. const checkTagProps = buildProps({
  23587. checked: Boolean,
  23588. disabled: Boolean,
  23589. type: {
  23590. type: String,
  23591. values: ["primary", "success", "info", "warning", "danger"],
  23592. default: "primary"
  23593. }
  23594. });
  23595. const checkTagEmits = {
  23596. "update:checked": (value) => isBoolean(value),
  23597. [CHANGE_EVENT]: (value) => isBoolean(value)
  23598. };
  23599. const __default__$1g = vue.defineComponent({
  23600. name: "ElCheckTag"
  23601. });
  23602. const _sfc_main$1O = /* @__PURE__ */ vue.defineComponent({
  23603. ...__default__$1g,
  23604. props: checkTagProps,
  23605. emits: checkTagEmits,
  23606. setup(__props, { emit }) {
  23607. const props = __props;
  23608. const ns = useNamespace("check-tag");
  23609. const isDisabled = vue.computed(() => props.disabled);
  23610. const containerKls = vue.computed(() => [
  23611. ns.b(),
  23612. ns.is("checked", props.checked),
  23613. ns.is("disabled", isDisabled.value),
  23614. ns.m(props.type || "primary")
  23615. ]);
  23616. const handleChange = () => {
  23617. if (isDisabled.value)
  23618. return;
  23619. const checked = !props.checked;
  23620. emit(CHANGE_EVENT, checked);
  23621. emit("update:checked", checked);
  23622. };
  23623. return (_ctx, _cache) => {
  23624. return vue.openBlock(), vue.createElementBlock("span", {
  23625. class: vue.normalizeClass(vue.unref(containerKls)),
  23626. onClick: handleChange
  23627. }, [
  23628. vue.renderSlot(_ctx.$slots, "default")
  23629. ], 2);
  23630. };
  23631. }
  23632. });
  23633. var CheckTag = /* @__PURE__ */ _export_sfc(_sfc_main$1O, [["__file", "check-tag.vue"]]);
  23634. const ElCheckTag = withInstall(CheckTag);
  23635. const rowContextKey = Symbol("rowContextKey");
  23636. const RowJustify = [
  23637. "start",
  23638. "center",
  23639. "end",
  23640. "space-around",
  23641. "space-between",
  23642. "space-evenly"
  23643. ];
  23644. const RowAlign = ["top", "middle", "bottom"];
  23645. const rowProps = buildProps({
  23646. tag: {
  23647. type: String,
  23648. default: "div"
  23649. },
  23650. gutter: {
  23651. type: Number,
  23652. default: 0
  23653. },
  23654. justify: {
  23655. type: String,
  23656. values: RowJustify,
  23657. default: "start"
  23658. },
  23659. align: {
  23660. type: String,
  23661. values: RowAlign
  23662. }
  23663. });
  23664. const __default__$1f = vue.defineComponent({
  23665. name: "ElRow"
  23666. });
  23667. const _sfc_main$1N = /* @__PURE__ */ vue.defineComponent({
  23668. ...__default__$1f,
  23669. props: rowProps,
  23670. setup(__props) {
  23671. const props = __props;
  23672. const ns = useNamespace("row");
  23673. const gutter = vue.computed(() => props.gutter);
  23674. vue.provide(rowContextKey, {
  23675. gutter
  23676. });
  23677. const style = vue.computed(() => {
  23678. const styles = {};
  23679. if (!props.gutter) {
  23680. return styles;
  23681. }
  23682. styles.marginRight = styles.marginLeft = `-${props.gutter / 2}px`;
  23683. return styles;
  23684. });
  23685. const rowKls = vue.computed(() => [
  23686. ns.b(),
  23687. ns.is(`justify-${props.justify}`, props.justify !== "start"),
  23688. ns.is(`align-${props.align}`, !!props.align)
  23689. ]);
  23690. return (_ctx, _cache) => {
  23691. return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.tag), {
  23692. class: vue.normalizeClass(vue.unref(rowKls)),
  23693. style: vue.normalizeStyle(vue.unref(style))
  23694. }, {
  23695. default: vue.withCtx(() => [
  23696. vue.renderSlot(_ctx.$slots, "default")
  23697. ]),
  23698. _: 3
  23699. }, 8, ["class", "style"]);
  23700. };
  23701. }
  23702. });
  23703. var Row$1 = /* @__PURE__ */ _export_sfc(_sfc_main$1N, [["__file", "row.vue"]]);
  23704. const ElRow = withInstall(Row$1);
  23705. const colProps = buildProps({
  23706. tag: {
  23707. type: String,
  23708. default: "div"
  23709. },
  23710. span: {
  23711. type: Number,
  23712. default: 24
  23713. },
  23714. offset: {
  23715. type: Number,
  23716. default: 0
  23717. },
  23718. pull: {
  23719. type: Number,
  23720. default: 0
  23721. },
  23722. push: {
  23723. type: Number,
  23724. default: 0
  23725. },
  23726. xs: {
  23727. type: definePropType([Number, Object]),
  23728. default: () => mutable({})
  23729. },
  23730. sm: {
  23731. type: definePropType([Number, Object]),
  23732. default: () => mutable({})
  23733. },
  23734. md: {
  23735. type: definePropType([Number, Object]),
  23736. default: () => mutable({})
  23737. },
  23738. lg: {
  23739. type: definePropType([Number, Object]),
  23740. default: () => mutable({})
  23741. },
  23742. xl: {
  23743. type: definePropType([Number, Object]),
  23744. default: () => mutable({})
  23745. }
  23746. });
  23747. const __default__$1e = vue.defineComponent({
  23748. name: "ElCol"
  23749. });
  23750. const _sfc_main$1M = /* @__PURE__ */ vue.defineComponent({
  23751. ...__default__$1e,
  23752. props: colProps,
  23753. setup(__props) {
  23754. const props = __props;
  23755. const { gutter } = vue.inject(rowContextKey, { gutter: vue.computed(() => 0) });
  23756. const ns = useNamespace("col");
  23757. const style = vue.computed(() => {
  23758. const styles = {};
  23759. if (gutter.value) {
  23760. styles.paddingLeft = styles.paddingRight = `${gutter.value / 2}px`;
  23761. }
  23762. return styles;
  23763. });
  23764. const colKls = vue.computed(() => {
  23765. const classes = [];
  23766. const pos = ["span", "offset", "pull", "push"];
  23767. pos.forEach((prop) => {
  23768. const size = props[prop];
  23769. if (isNumber(size)) {
  23770. if (prop === "span")
  23771. classes.push(ns.b(`${props[prop]}`));
  23772. else if (size > 0)
  23773. classes.push(ns.b(`${prop}-${props[prop]}`));
  23774. }
  23775. });
  23776. const sizes = ["xs", "sm", "md", "lg", "xl"];
  23777. sizes.forEach((size) => {
  23778. if (isNumber(props[size])) {
  23779. classes.push(ns.b(`${size}-${props[size]}`));
  23780. } else if (isObject$1(props[size])) {
  23781. Object.entries(props[size]).forEach(([prop, sizeProp]) => {
  23782. classes.push(prop !== "span" ? ns.b(`${size}-${prop}-${sizeProp}`) : ns.b(`${size}-${sizeProp}`));
  23783. });
  23784. }
  23785. });
  23786. if (gutter.value) {
  23787. classes.push(ns.is("guttered"));
  23788. }
  23789. return [ns.b(), classes];
  23790. });
  23791. return (_ctx, _cache) => {
  23792. return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.tag), {
  23793. class: vue.normalizeClass(vue.unref(colKls)),
  23794. style: vue.normalizeStyle(vue.unref(style))
  23795. }, {
  23796. default: vue.withCtx(() => [
  23797. vue.renderSlot(_ctx.$slots, "default")
  23798. ]),
  23799. _: 3
  23800. }, 8, ["class", "style"]);
  23801. };
  23802. }
  23803. });
  23804. var Col = /* @__PURE__ */ _export_sfc(_sfc_main$1M, [["__file", "col.vue"]]);
  23805. const ElCol = withInstall(Col);
  23806. const emitChangeFn = (value) => isNumber(value) || isString$1(value) || isArray$1(value);
  23807. const collapseProps = buildProps({
  23808. accordion: Boolean,
  23809. modelValue: {
  23810. type: definePropType([Array, String, Number]),
  23811. default: () => mutable([])
  23812. }
  23813. });
  23814. const collapseEmits = {
  23815. [UPDATE_MODEL_EVENT]: emitChangeFn,
  23816. [CHANGE_EVENT]: emitChangeFn
  23817. };
  23818. const collapseContextKey = Symbol("collapseContextKey");
  23819. const useCollapse = (props, emit) => {
  23820. const activeNames = vue.ref(castArray$1(props.modelValue));
  23821. const setActiveNames = (_activeNames) => {
  23822. activeNames.value = _activeNames;
  23823. const value = props.accordion ? activeNames.value[0] : activeNames.value;
  23824. emit(UPDATE_MODEL_EVENT, value);
  23825. emit(CHANGE_EVENT, value);
  23826. };
  23827. const handleItemClick = (name) => {
  23828. if (props.accordion) {
  23829. setActiveNames([activeNames.value[0] === name ? "" : name]);
  23830. } else {
  23831. const _activeNames = [...activeNames.value];
  23832. const index = _activeNames.indexOf(name);
  23833. if (index > -1) {
  23834. _activeNames.splice(index, 1);
  23835. } else {
  23836. _activeNames.push(name);
  23837. }
  23838. setActiveNames(_activeNames);
  23839. }
  23840. };
  23841. vue.watch(() => props.modelValue, () => activeNames.value = castArray$1(props.modelValue), { deep: true });
  23842. vue.provide(collapseContextKey, {
  23843. activeNames,
  23844. handleItemClick
  23845. });
  23846. return {
  23847. activeNames,
  23848. setActiveNames
  23849. };
  23850. };
  23851. const useCollapseDOM = () => {
  23852. const ns = useNamespace("collapse");
  23853. const rootKls = vue.computed(() => ns.b());
  23854. return {
  23855. rootKls
  23856. };
  23857. };
  23858. const __default__$1d = vue.defineComponent({
  23859. name: "ElCollapse"
  23860. });
  23861. const _sfc_main$1L = /* @__PURE__ */ vue.defineComponent({
  23862. ...__default__$1d,
  23863. props: collapseProps,
  23864. emits: collapseEmits,
  23865. setup(__props, { expose, emit }) {
  23866. const props = __props;
  23867. const { activeNames, setActiveNames } = useCollapse(props, emit);
  23868. const { rootKls } = useCollapseDOM();
  23869. expose({
  23870. activeNames,
  23871. setActiveNames
  23872. });
  23873. return (_ctx, _cache) => {
  23874. return vue.openBlock(), vue.createElementBlock("div", {
  23875. class: vue.normalizeClass(vue.unref(rootKls))
  23876. }, [
  23877. vue.renderSlot(_ctx.$slots, "default")
  23878. ], 2);
  23879. };
  23880. }
  23881. });
  23882. var Collapse = /* @__PURE__ */ _export_sfc(_sfc_main$1L, [["__file", "collapse.vue"]]);
  23883. const __default__$1c = vue.defineComponent({
  23884. name: "ElCollapseTransition"
  23885. });
  23886. const _sfc_main$1K = /* @__PURE__ */ vue.defineComponent({
  23887. ...__default__$1c,
  23888. setup(__props) {
  23889. const ns = useNamespace("collapse-transition");
  23890. const reset = (el) => {
  23891. el.style.maxHeight = "";
  23892. el.style.overflow = el.dataset.oldOverflow;
  23893. el.style.paddingTop = el.dataset.oldPaddingTop;
  23894. el.style.paddingBottom = el.dataset.oldPaddingBottom;
  23895. };
  23896. const on = {
  23897. beforeEnter(el) {
  23898. if (!el.dataset)
  23899. el.dataset = {};
  23900. el.dataset.oldPaddingTop = el.style.paddingTop;
  23901. el.dataset.oldPaddingBottom = el.style.paddingBottom;
  23902. if (el.style.height)
  23903. el.dataset.elExistsHeight = el.style.height;
  23904. el.style.maxHeight = 0;
  23905. el.style.paddingTop = 0;
  23906. el.style.paddingBottom = 0;
  23907. },
  23908. enter(el) {
  23909. requestAnimationFrame(() => {
  23910. el.dataset.oldOverflow = el.style.overflow;
  23911. if (el.dataset.elExistsHeight) {
  23912. el.style.maxHeight = el.dataset.elExistsHeight;
  23913. } else if (el.scrollHeight !== 0) {
  23914. el.style.maxHeight = `${el.scrollHeight}px`;
  23915. } else {
  23916. el.style.maxHeight = 0;
  23917. }
  23918. el.style.paddingTop = el.dataset.oldPaddingTop;
  23919. el.style.paddingBottom = el.dataset.oldPaddingBottom;
  23920. el.style.overflow = "hidden";
  23921. });
  23922. },
  23923. afterEnter(el) {
  23924. el.style.maxHeight = "";
  23925. el.style.overflow = el.dataset.oldOverflow;
  23926. },
  23927. enterCancelled(el) {
  23928. reset(el);
  23929. },
  23930. beforeLeave(el) {
  23931. if (!el.dataset)
  23932. el.dataset = {};
  23933. el.dataset.oldPaddingTop = el.style.paddingTop;
  23934. el.dataset.oldPaddingBottom = el.style.paddingBottom;
  23935. el.dataset.oldOverflow = el.style.overflow;
  23936. el.style.maxHeight = `${el.scrollHeight}px`;
  23937. el.style.overflow = "hidden";
  23938. },
  23939. leave(el) {
  23940. if (el.scrollHeight !== 0) {
  23941. el.style.maxHeight = 0;
  23942. el.style.paddingTop = 0;
  23943. el.style.paddingBottom = 0;
  23944. }
  23945. },
  23946. afterLeave(el) {
  23947. reset(el);
  23948. },
  23949. leaveCancelled(el) {
  23950. reset(el);
  23951. }
  23952. };
  23953. return (_ctx, _cache) => {
  23954. return vue.openBlock(), vue.createBlock(vue.Transition, vue.mergeProps({
  23955. name: vue.unref(ns).b()
  23956. }, vue.toHandlers(on)), {
  23957. default: vue.withCtx(() => [
  23958. vue.renderSlot(_ctx.$slots, "default")
  23959. ]),
  23960. _: 3
  23961. }, 16, ["name"]);
  23962. };
  23963. }
  23964. });
  23965. var CollapseTransition = /* @__PURE__ */ _export_sfc(_sfc_main$1K, [["__file", "collapse-transition.vue"]]);
  23966. const ElCollapseTransition = withInstall(CollapseTransition);
  23967. const collapseItemProps = buildProps({
  23968. title: {
  23969. type: String,
  23970. default: ""
  23971. },
  23972. name: {
  23973. type: definePropType([String, Number]),
  23974. default: void 0
  23975. },
  23976. icon: {
  23977. type: iconPropType,
  23978. default: arrow_right_default
  23979. },
  23980. disabled: Boolean
  23981. });
  23982. const useCollapseItem = (props) => {
  23983. const collapse = vue.inject(collapseContextKey);
  23984. const { namespace } = useNamespace("collapse");
  23985. const focusing = vue.ref(false);
  23986. const isClick = vue.ref(false);
  23987. const idInjection = useIdInjection();
  23988. const id = vue.computed(() => idInjection.current++);
  23989. const name = vue.computed(() => {
  23990. var _a;
  23991. return (_a = props.name) != null ? _a : `${namespace.value}-id-${idInjection.prefix}-${vue.unref(id)}`;
  23992. });
  23993. const isActive = vue.computed(() => collapse == null ? void 0 : collapse.activeNames.value.includes(vue.unref(name)));
  23994. const handleFocus = () => {
  23995. setTimeout(() => {
  23996. if (!isClick.value) {
  23997. focusing.value = true;
  23998. } else {
  23999. isClick.value = false;
  24000. }
  24001. }, 50);
  24002. };
  24003. const handleHeaderClick = () => {
  24004. if (props.disabled)
  24005. return;
  24006. collapse == null ? void 0 : collapse.handleItemClick(vue.unref(name));
  24007. focusing.value = false;
  24008. isClick.value = true;
  24009. };
  24010. const handleEnterClick = () => {
  24011. collapse == null ? void 0 : collapse.handleItemClick(vue.unref(name));
  24012. };
  24013. return {
  24014. focusing,
  24015. id,
  24016. isActive,
  24017. handleFocus,
  24018. handleHeaderClick,
  24019. handleEnterClick
  24020. };
  24021. };
  24022. const useCollapseItemDOM = (props, { focusing, isActive, id }) => {
  24023. const ns = useNamespace("collapse");
  24024. const rootKls = vue.computed(() => [
  24025. ns.b("item"),
  24026. ns.is("active", vue.unref(isActive)),
  24027. ns.is("disabled", props.disabled)
  24028. ]);
  24029. const headKls = vue.computed(() => [
  24030. ns.be("item", "header"),
  24031. ns.is("active", vue.unref(isActive)),
  24032. { focusing: vue.unref(focusing) && !props.disabled }
  24033. ]);
  24034. const arrowKls = vue.computed(() => [
  24035. ns.be("item", "arrow"),
  24036. ns.is("active", vue.unref(isActive))
  24037. ]);
  24038. const itemWrapperKls = vue.computed(() => ns.be("item", "wrap"));
  24039. const itemContentKls = vue.computed(() => ns.be("item", "content"));
  24040. const scopedContentId = vue.computed(() => ns.b(`content-${vue.unref(id)}`));
  24041. const scopedHeadId = vue.computed(() => ns.b(`head-${vue.unref(id)}`));
  24042. return {
  24043. arrowKls,
  24044. headKls,
  24045. rootKls,
  24046. itemWrapperKls,
  24047. itemContentKls,
  24048. scopedContentId,
  24049. scopedHeadId
  24050. };
  24051. };
  24052. const __default__$1b = vue.defineComponent({
  24053. name: "ElCollapseItem"
  24054. });
  24055. const _sfc_main$1J = /* @__PURE__ */ vue.defineComponent({
  24056. ...__default__$1b,
  24057. props: collapseItemProps,
  24058. setup(__props, { expose }) {
  24059. const props = __props;
  24060. const {
  24061. focusing,
  24062. id,
  24063. isActive,
  24064. handleFocus,
  24065. handleHeaderClick,
  24066. handleEnterClick
  24067. } = useCollapseItem(props);
  24068. const {
  24069. arrowKls,
  24070. headKls,
  24071. rootKls,
  24072. itemWrapperKls,
  24073. itemContentKls,
  24074. scopedContentId,
  24075. scopedHeadId
  24076. } = useCollapseItemDOM(props, { focusing, isActive, id });
  24077. expose({
  24078. isActive
  24079. });
  24080. return (_ctx, _cache) => {
  24081. return vue.openBlock(), vue.createElementBlock("div", {
  24082. class: vue.normalizeClass(vue.unref(rootKls))
  24083. }, [
  24084. vue.createElementVNode("button", {
  24085. id: vue.unref(scopedHeadId),
  24086. class: vue.normalizeClass(vue.unref(headKls)),
  24087. "aria-expanded": vue.unref(isActive),
  24088. "aria-controls": vue.unref(scopedContentId),
  24089. "aria-describedby": vue.unref(scopedContentId),
  24090. tabindex: _ctx.disabled ? -1 : 0,
  24091. type: "button",
  24092. onClick: vue.unref(handleHeaderClick),
  24093. onKeydown: vue.withKeys(vue.withModifiers(vue.unref(handleEnterClick), ["stop", "prevent"]), ["space", "enter"]),
  24094. onFocus: vue.unref(handleFocus),
  24095. onBlur: ($event) => focusing.value = false
  24096. }, [
  24097. vue.renderSlot(_ctx.$slots, "title", {}, () => [
  24098. vue.createTextVNode(vue.toDisplayString(_ctx.title), 1)
  24099. ]),
  24100. vue.renderSlot(_ctx.$slots, "icon", { isActive: vue.unref(isActive) }, () => [
  24101. vue.createVNode(vue.unref(ElIcon), {
  24102. class: vue.normalizeClass(vue.unref(arrowKls))
  24103. }, {
  24104. default: vue.withCtx(() => [
  24105. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.icon)))
  24106. ]),
  24107. _: 1
  24108. }, 8, ["class"])
  24109. ])
  24110. ], 42, ["id", "aria-expanded", "aria-controls", "aria-describedby", "tabindex", "onClick", "onKeydown", "onFocus", "onBlur"]),
  24111. vue.createVNode(vue.unref(ElCollapseTransition), null, {
  24112. default: vue.withCtx(() => [
  24113. vue.withDirectives(vue.createElementVNode("div", {
  24114. id: vue.unref(scopedContentId),
  24115. role: "region",
  24116. class: vue.normalizeClass(vue.unref(itemWrapperKls)),
  24117. "aria-hidden": !vue.unref(isActive),
  24118. "aria-labelledby": vue.unref(scopedHeadId)
  24119. }, [
  24120. vue.createElementVNode("div", {
  24121. class: vue.normalizeClass(vue.unref(itemContentKls))
  24122. }, [
  24123. vue.renderSlot(_ctx.$slots, "default")
  24124. ], 2)
  24125. ], 10, ["id", "aria-hidden", "aria-labelledby"]), [
  24126. [vue.vShow, vue.unref(isActive)]
  24127. ])
  24128. ]),
  24129. _: 3
  24130. })
  24131. ], 2);
  24132. };
  24133. }
  24134. });
  24135. var CollapseItem = /* @__PURE__ */ _export_sfc(_sfc_main$1J, [["__file", "collapse-item.vue"]]);
  24136. const ElCollapse = withInstall(Collapse, {
  24137. CollapseItem
  24138. });
  24139. const ElCollapseItem = withNoopInstall(CollapseItem);
  24140. const alphaSliderProps = buildProps({
  24141. color: {
  24142. type: definePropType(Object),
  24143. required: true
  24144. },
  24145. vertical: {
  24146. type: Boolean,
  24147. default: false
  24148. }
  24149. });
  24150. let isDragging = false;
  24151. function draggable(element, options) {
  24152. if (!isClient)
  24153. return;
  24154. const moveFn = function(event) {
  24155. var _a;
  24156. (_a = options.drag) == null ? void 0 : _a.call(options, event);
  24157. };
  24158. const upFn = function(event) {
  24159. var _a;
  24160. document.removeEventListener("mousemove", moveFn);
  24161. document.removeEventListener("mouseup", upFn);
  24162. document.removeEventListener("touchmove", moveFn);
  24163. document.removeEventListener("touchend", upFn);
  24164. document.onselectstart = null;
  24165. document.ondragstart = null;
  24166. isDragging = false;
  24167. (_a = options.end) == null ? void 0 : _a.call(options, event);
  24168. };
  24169. const downFn = function(event) {
  24170. var _a;
  24171. if (isDragging)
  24172. return;
  24173. event.preventDefault();
  24174. document.onselectstart = () => false;
  24175. document.ondragstart = () => false;
  24176. document.addEventListener("mousemove", moveFn);
  24177. document.addEventListener("mouseup", upFn);
  24178. document.addEventListener("touchmove", moveFn);
  24179. document.addEventListener("touchend", upFn);
  24180. isDragging = true;
  24181. (_a = options.start) == null ? void 0 : _a.call(options, event);
  24182. };
  24183. element.addEventListener("mousedown", downFn);
  24184. element.addEventListener("touchstart", downFn, { passive: false });
  24185. }
  24186. const useAlphaSlider = (props) => {
  24187. const instance = vue.getCurrentInstance();
  24188. const { t } = useLocale();
  24189. const thumb = vue.shallowRef();
  24190. const bar = vue.shallowRef();
  24191. const alpha = vue.computed(() => props.color.get("alpha"));
  24192. const alphaLabel = vue.computed(() => t("el.colorpicker.alphaLabel"));
  24193. function handleClick(event) {
  24194. var _a;
  24195. const target = event.target;
  24196. if (target !== thumb.value) {
  24197. handleDrag(event);
  24198. }
  24199. (_a = thumb.value) == null ? void 0 : _a.focus();
  24200. }
  24201. function handleDrag(event) {
  24202. if (!bar.value || !thumb.value)
  24203. return;
  24204. const el = instance.vnode.el;
  24205. const rect = el.getBoundingClientRect();
  24206. const { clientX, clientY } = getClientXY(event);
  24207. if (!props.vertical) {
  24208. let left = clientX - rect.left;
  24209. left = Math.max(thumb.value.offsetWidth / 2, left);
  24210. left = Math.min(left, rect.width - thumb.value.offsetWidth / 2);
  24211. props.color.set("alpha", Math.round((left - thumb.value.offsetWidth / 2) / (rect.width - thumb.value.offsetWidth) * 100));
  24212. } else {
  24213. let top = clientY - rect.top;
  24214. top = Math.max(thumb.value.offsetHeight / 2, top);
  24215. top = Math.min(top, rect.height - thumb.value.offsetHeight / 2);
  24216. props.color.set("alpha", Math.round((top - thumb.value.offsetHeight / 2) / (rect.height - thumb.value.offsetHeight) * 100));
  24217. }
  24218. }
  24219. function handleKeydown(event) {
  24220. const { code, shiftKey } = event;
  24221. const step = shiftKey ? 10 : 1;
  24222. switch (code) {
  24223. case EVENT_CODE.left:
  24224. case EVENT_CODE.down:
  24225. event.preventDefault();
  24226. event.stopPropagation();
  24227. incrementPosition(-step);
  24228. break;
  24229. case EVENT_CODE.right:
  24230. case EVENT_CODE.up:
  24231. event.preventDefault();
  24232. event.stopPropagation();
  24233. incrementPosition(step);
  24234. break;
  24235. }
  24236. }
  24237. function incrementPosition(step) {
  24238. let next = alpha.value + step;
  24239. next = next < 0 ? 0 : next > 100 ? 100 : next;
  24240. props.color.set("alpha", next);
  24241. }
  24242. return {
  24243. thumb,
  24244. bar,
  24245. alpha,
  24246. alphaLabel,
  24247. handleDrag,
  24248. handleClick,
  24249. handleKeydown
  24250. };
  24251. };
  24252. const useAlphaSliderDOM = (props, {
  24253. bar,
  24254. thumb,
  24255. handleDrag
  24256. }) => {
  24257. const instance = vue.getCurrentInstance();
  24258. const ns = useNamespace("color-alpha-slider");
  24259. const thumbLeft = vue.ref(0);
  24260. const thumbTop = vue.ref(0);
  24261. const background = vue.ref();
  24262. function getThumbLeft() {
  24263. if (!thumb.value)
  24264. return 0;
  24265. if (props.vertical)
  24266. return 0;
  24267. const el = instance.vnode.el;
  24268. const alpha = props.color.get("alpha");
  24269. if (!el)
  24270. return 0;
  24271. return Math.round(alpha * (el.offsetWidth - thumb.value.offsetWidth / 2) / 100);
  24272. }
  24273. function getThumbTop() {
  24274. if (!thumb.value)
  24275. return 0;
  24276. const el = instance.vnode.el;
  24277. if (!props.vertical)
  24278. return 0;
  24279. const alpha = props.color.get("alpha");
  24280. if (!el)
  24281. return 0;
  24282. return Math.round(alpha * (el.offsetHeight - thumb.value.offsetHeight / 2) / 100);
  24283. }
  24284. function getBackground() {
  24285. if (props.color && props.color.value) {
  24286. const { r, g, b } = props.color.toRgb();
  24287. return `linear-gradient(to right, rgba(${r}, ${g}, ${b}, 0) 0%, rgba(${r}, ${g}, ${b}, 1) 100%)`;
  24288. }
  24289. return "";
  24290. }
  24291. function update() {
  24292. thumbLeft.value = getThumbLeft();
  24293. thumbTop.value = getThumbTop();
  24294. background.value = getBackground();
  24295. }
  24296. vue.onMounted(() => {
  24297. if (!bar.value || !thumb.value)
  24298. return;
  24299. const dragConfig = {
  24300. drag: (event) => {
  24301. handleDrag(event);
  24302. },
  24303. end: (event) => {
  24304. handleDrag(event);
  24305. }
  24306. };
  24307. draggable(bar.value, dragConfig);
  24308. draggable(thumb.value, dragConfig);
  24309. update();
  24310. });
  24311. vue.watch(() => props.color.get("alpha"), () => update());
  24312. vue.watch(() => props.color.value, () => update());
  24313. const rootKls = vue.computed(() => [ns.b(), ns.is("vertical", props.vertical)]);
  24314. const barKls = vue.computed(() => ns.e("bar"));
  24315. const thumbKls = vue.computed(() => ns.e("thumb"));
  24316. const barStyle = vue.computed(() => ({ background: background.value }));
  24317. const thumbStyle = vue.computed(() => ({
  24318. left: addUnit(thumbLeft.value),
  24319. top: addUnit(thumbTop.value)
  24320. }));
  24321. return { rootKls, barKls, barStyle, thumbKls, thumbStyle, update };
  24322. };
  24323. const COMPONENT_NAME$d = "ElColorAlphaSlider";
  24324. const __default__$1a = vue.defineComponent({
  24325. name: COMPONENT_NAME$d
  24326. });
  24327. const _sfc_main$1I = /* @__PURE__ */ vue.defineComponent({
  24328. ...__default__$1a,
  24329. props: alphaSliderProps,
  24330. setup(__props, { expose }) {
  24331. const props = __props;
  24332. const {
  24333. alpha,
  24334. alphaLabel,
  24335. bar,
  24336. thumb,
  24337. handleDrag,
  24338. handleClick,
  24339. handleKeydown
  24340. } = useAlphaSlider(props);
  24341. const { rootKls, barKls, barStyle, thumbKls, thumbStyle, update } = useAlphaSliderDOM(props, {
  24342. bar,
  24343. thumb,
  24344. handleDrag
  24345. });
  24346. expose({
  24347. update,
  24348. bar,
  24349. thumb
  24350. });
  24351. return (_ctx, _cache) => {
  24352. return vue.openBlock(), vue.createElementBlock("div", {
  24353. class: vue.normalizeClass(vue.unref(rootKls))
  24354. }, [
  24355. vue.createElementVNode("div", {
  24356. ref_key: "bar",
  24357. ref: bar,
  24358. class: vue.normalizeClass(vue.unref(barKls)),
  24359. style: vue.normalizeStyle(vue.unref(barStyle)),
  24360. onClick: vue.unref(handleClick)
  24361. }, null, 14, ["onClick"]),
  24362. vue.createElementVNode("div", {
  24363. ref_key: "thumb",
  24364. ref: thumb,
  24365. class: vue.normalizeClass(vue.unref(thumbKls)),
  24366. style: vue.normalizeStyle(vue.unref(thumbStyle)),
  24367. "aria-label": vue.unref(alphaLabel),
  24368. "aria-valuenow": vue.unref(alpha),
  24369. "aria-orientation": _ctx.vertical ? "vertical" : "horizontal",
  24370. "aria-valuemin": "0",
  24371. "aria-valuemax": "100",
  24372. role: "slider",
  24373. tabindex: "0",
  24374. onKeydown: vue.unref(handleKeydown)
  24375. }, null, 46, ["aria-label", "aria-valuenow", "aria-orientation", "onKeydown"])
  24376. ], 2);
  24377. };
  24378. }
  24379. });
  24380. var AlphaSlider = /* @__PURE__ */ _export_sfc(_sfc_main$1I, [["__file", "alpha-slider.vue"]]);
  24381. const _sfc_main$1H = vue.defineComponent({
  24382. name: "ElColorHueSlider",
  24383. props: {
  24384. color: {
  24385. type: Object,
  24386. required: true
  24387. },
  24388. vertical: Boolean
  24389. },
  24390. setup(props) {
  24391. const ns = useNamespace("color-hue-slider");
  24392. const instance = vue.getCurrentInstance();
  24393. const thumb = vue.ref();
  24394. const bar = vue.ref();
  24395. const thumbLeft = vue.ref(0);
  24396. const thumbTop = vue.ref(0);
  24397. const hueValue = vue.computed(() => {
  24398. return props.color.get("hue");
  24399. });
  24400. vue.watch(() => hueValue.value, () => {
  24401. update();
  24402. });
  24403. function handleClick(event) {
  24404. const target = event.target;
  24405. if (target !== thumb.value) {
  24406. handleDrag(event);
  24407. }
  24408. }
  24409. function handleDrag(event) {
  24410. if (!bar.value || !thumb.value)
  24411. return;
  24412. const el = instance.vnode.el;
  24413. const rect = el.getBoundingClientRect();
  24414. const { clientX, clientY } = getClientXY(event);
  24415. let hue;
  24416. if (!props.vertical) {
  24417. let left = clientX - rect.left;
  24418. left = Math.min(left, rect.width - thumb.value.offsetWidth / 2);
  24419. left = Math.max(thumb.value.offsetWidth / 2, left);
  24420. hue = Math.round((left - thumb.value.offsetWidth / 2) / (rect.width - thumb.value.offsetWidth) * 360);
  24421. } else {
  24422. let top = clientY - rect.top;
  24423. top = Math.min(top, rect.height - thumb.value.offsetHeight / 2);
  24424. top = Math.max(thumb.value.offsetHeight / 2, top);
  24425. hue = Math.round((top - thumb.value.offsetHeight / 2) / (rect.height - thumb.value.offsetHeight) * 360);
  24426. }
  24427. props.color.set("hue", hue);
  24428. }
  24429. function getThumbLeft() {
  24430. if (!thumb.value)
  24431. return 0;
  24432. const el = instance.vnode.el;
  24433. if (props.vertical)
  24434. return 0;
  24435. const hue = props.color.get("hue");
  24436. if (!el)
  24437. return 0;
  24438. return Math.round(hue * (el.offsetWidth - thumb.value.offsetWidth / 2) / 360);
  24439. }
  24440. function getThumbTop() {
  24441. if (!thumb.value)
  24442. return 0;
  24443. const el = instance.vnode.el;
  24444. if (!props.vertical)
  24445. return 0;
  24446. const hue = props.color.get("hue");
  24447. if (!el)
  24448. return 0;
  24449. return Math.round(hue * (el.offsetHeight - thumb.value.offsetHeight / 2) / 360);
  24450. }
  24451. function update() {
  24452. thumbLeft.value = getThumbLeft();
  24453. thumbTop.value = getThumbTop();
  24454. }
  24455. vue.onMounted(() => {
  24456. if (!bar.value || !thumb.value)
  24457. return;
  24458. const dragConfig = {
  24459. drag: (event) => {
  24460. handleDrag(event);
  24461. },
  24462. end: (event) => {
  24463. handleDrag(event);
  24464. }
  24465. };
  24466. draggable(bar.value, dragConfig);
  24467. draggable(thumb.value, dragConfig);
  24468. update();
  24469. });
  24470. return {
  24471. bar,
  24472. thumb,
  24473. thumbLeft,
  24474. thumbTop,
  24475. hueValue,
  24476. handleClick,
  24477. update,
  24478. ns
  24479. };
  24480. }
  24481. });
  24482. function _sfc_render$q(_ctx, _cache, $props, $setup, $data, $options) {
  24483. return vue.openBlock(), vue.createElementBlock("div", {
  24484. class: vue.normalizeClass([_ctx.ns.b(), _ctx.ns.is("vertical", _ctx.vertical)])
  24485. }, [
  24486. vue.createElementVNode("div", {
  24487. ref: "bar",
  24488. class: vue.normalizeClass(_ctx.ns.e("bar")),
  24489. onClick: _ctx.handleClick
  24490. }, null, 10, ["onClick"]),
  24491. vue.createElementVNode("div", {
  24492. ref: "thumb",
  24493. class: vue.normalizeClass(_ctx.ns.e("thumb")),
  24494. style: vue.normalizeStyle({
  24495. left: _ctx.thumbLeft + "px",
  24496. top: _ctx.thumbTop + "px"
  24497. })
  24498. }, null, 6)
  24499. ], 2);
  24500. }
  24501. var HueSlider = /* @__PURE__ */ _export_sfc(_sfc_main$1H, [["render", _sfc_render$q], ["__file", "hue-slider.vue"]]);
  24502. const colorPickerProps = buildProps({
  24503. modelValue: String,
  24504. id: String,
  24505. showAlpha: Boolean,
  24506. colorFormat: String,
  24507. disabled: Boolean,
  24508. size: useSizeProp,
  24509. popperClass: {
  24510. type: String,
  24511. default: ""
  24512. },
  24513. tabindex: {
  24514. type: [String, Number],
  24515. default: 0
  24516. },
  24517. teleported: useTooltipContentProps.teleported,
  24518. predefine: {
  24519. type: definePropType(Array)
  24520. },
  24521. validateEvent: {
  24522. type: Boolean,
  24523. default: true
  24524. },
  24525. ...useAriaProps(["ariaLabel"])
  24526. });
  24527. const colorPickerEmits = {
  24528. [UPDATE_MODEL_EVENT]: (val) => isString$1(val) || isNil(val),
  24529. [CHANGE_EVENT]: (val) => isString$1(val) || isNil(val),
  24530. activeChange: (val) => isString$1(val) || isNil(val),
  24531. focus: (evt) => evt instanceof FocusEvent,
  24532. blur: (evt) => evt instanceof FocusEvent
  24533. };
  24534. const colorPickerContextKey = Symbol("colorPickerContextKey");
  24535. const hsv2hsl = function(hue, sat, val) {
  24536. return [
  24537. hue,
  24538. sat * val / ((hue = (2 - sat) * val) < 1 ? hue : 2 - hue) || 0,
  24539. hue / 2
  24540. ];
  24541. };
  24542. const isOnePointZero = function(n) {
  24543. return isString$1(n) && n.includes(".") && Number.parseFloat(n) === 1;
  24544. };
  24545. const isPercentage = function(n) {
  24546. return isString$1(n) && n.includes("%");
  24547. };
  24548. const bound01 = function(value, max) {
  24549. if (isOnePointZero(value))
  24550. value = "100%";
  24551. const processPercent = isPercentage(value);
  24552. value = Math.min(max, Math.max(0, Number.parseFloat(`${value}`)));
  24553. if (processPercent) {
  24554. value = Number.parseInt(`${value * max}`, 10) / 100;
  24555. }
  24556. if (Math.abs(value - max) < 1e-6) {
  24557. return 1;
  24558. }
  24559. return value % max / Number.parseFloat(max);
  24560. };
  24561. const INT_HEX_MAP = {
  24562. 10: "A",
  24563. 11: "B",
  24564. 12: "C",
  24565. 13: "D",
  24566. 14: "E",
  24567. 15: "F"
  24568. };
  24569. const hexOne = (value) => {
  24570. value = Math.min(Math.round(value), 255);
  24571. const high = Math.floor(value / 16);
  24572. const low = value % 16;
  24573. return `${INT_HEX_MAP[high] || high}${INT_HEX_MAP[low] || low}`;
  24574. };
  24575. const toHex = function({ r, g, b }) {
  24576. if (Number.isNaN(+r) || Number.isNaN(+g) || Number.isNaN(+b))
  24577. return "";
  24578. return `#${hexOne(r)}${hexOne(g)}${hexOne(b)}`;
  24579. };
  24580. const HEX_INT_MAP = {
  24581. A: 10,
  24582. B: 11,
  24583. C: 12,
  24584. D: 13,
  24585. E: 14,
  24586. F: 15
  24587. };
  24588. const parseHexChannel = function(hex) {
  24589. if (hex.length === 2) {
  24590. return (HEX_INT_MAP[hex[0].toUpperCase()] || +hex[0]) * 16 + (HEX_INT_MAP[hex[1].toUpperCase()] || +hex[1]);
  24591. }
  24592. return HEX_INT_MAP[hex[1].toUpperCase()] || +hex[1];
  24593. };
  24594. const hsl2hsv = function(hue, sat, light) {
  24595. sat = sat / 100;
  24596. light = light / 100;
  24597. let smin = sat;
  24598. const lmin = Math.max(light, 0.01);
  24599. light *= 2;
  24600. sat *= light <= 1 ? light : 2 - light;
  24601. smin *= lmin <= 1 ? lmin : 2 - lmin;
  24602. const v = (light + sat) / 2;
  24603. const sv = light === 0 ? 2 * smin / (lmin + smin) : 2 * sat / (light + sat);
  24604. return {
  24605. h: hue,
  24606. s: sv * 100,
  24607. v: v * 100
  24608. };
  24609. };
  24610. const rgb2hsv = (r, g, b) => {
  24611. r = bound01(r, 255);
  24612. g = bound01(g, 255);
  24613. b = bound01(b, 255);
  24614. const max = Math.max(r, g, b);
  24615. const min = Math.min(r, g, b);
  24616. let h;
  24617. const v = max;
  24618. const d = max - min;
  24619. const s = max === 0 ? 0 : d / max;
  24620. if (max === min) {
  24621. h = 0;
  24622. } else {
  24623. switch (max) {
  24624. case r: {
  24625. h = (g - b) / d + (g < b ? 6 : 0);
  24626. break;
  24627. }
  24628. case g: {
  24629. h = (b - r) / d + 2;
  24630. break;
  24631. }
  24632. case b: {
  24633. h = (r - g) / d + 4;
  24634. break;
  24635. }
  24636. }
  24637. h /= 6;
  24638. }
  24639. return { h: h * 360, s: s * 100, v: v * 100 };
  24640. };
  24641. const hsv2rgb = function(h, s, v) {
  24642. h = bound01(h, 360) * 6;
  24643. s = bound01(s, 100);
  24644. v = bound01(v, 100);
  24645. const i = Math.floor(h);
  24646. const f = h - i;
  24647. const p = v * (1 - s);
  24648. const q = v * (1 - f * s);
  24649. const t = v * (1 - (1 - f) * s);
  24650. const mod = i % 6;
  24651. const r = [v, q, p, p, t, v][mod];
  24652. const g = [t, v, v, q, p, p][mod];
  24653. const b = [p, p, t, v, v, q][mod];
  24654. return {
  24655. r: Math.round(r * 255),
  24656. g: Math.round(g * 255),
  24657. b: Math.round(b * 255)
  24658. };
  24659. };
  24660. class Color {
  24661. constructor(options = {}) {
  24662. this._hue = 0;
  24663. this._saturation = 100;
  24664. this._value = 100;
  24665. this._alpha = 100;
  24666. this.enableAlpha = false;
  24667. this.format = "hex";
  24668. this.value = "";
  24669. for (const option in options) {
  24670. if (hasOwn(options, option)) {
  24671. this[option] = options[option];
  24672. }
  24673. }
  24674. if (options.value) {
  24675. this.fromString(options.value);
  24676. } else {
  24677. this.doOnChange();
  24678. }
  24679. }
  24680. set(prop, value) {
  24681. if (arguments.length === 1 && typeof prop === "object") {
  24682. for (const p in prop) {
  24683. if (hasOwn(prop, p)) {
  24684. this.set(p, prop[p]);
  24685. }
  24686. }
  24687. return;
  24688. }
  24689. this[`_${prop}`] = value;
  24690. this.doOnChange();
  24691. }
  24692. get(prop) {
  24693. if (prop === "alpha") {
  24694. return Math.floor(this[`_${prop}`]);
  24695. }
  24696. return this[`_${prop}`];
  24697. }
  24698. toRgb() {
  24699. return hsv2rgb(this._hue, this._saturation, this._value);
  24700. }
  24701. fromString(value) {
  24702. if (!value) {
  24703. this._hue = 0;
  24704. this._saturation = 100;
  24705. this._value = 100;
  24706. this.doOnChange();
  24707. return;
  24708. }
  24709. const fromHSV = (h, s, v) => {
  24710. this._hue = Math.max(0, Math.min(360, h));
  24711. this._saturation = Math.max(0, Math.min(100, s));
  24712. this._value = Math.max(0, Math.min(100, v));
  24713. this.doOnChange();
  24714. };
  24715. if (value.includes("hsl")) {
  24716. const parts = value.replace(/hsla|hsl|\(|\)/gm, "").split(/\s|,/g).filter((val) => val !== "").map((val, index) => index > 2 ? Number.parseFloat(val) : Number.parseInt(val, 10));
  24717. if (parts.length === 4) {
  24718. this._alpha = Number.parseFloat(parts[3]) * 100;
  24719. } else if (parts.length === 3) {
  24720. this._alpha = 100;
  24721. }
  24722. if (parts.length >= 3) {
  24723. const { h, s, v } = hsl2hsv(parts[0], parts[1], parts[2]);
  24724. fromHSV(h, s, v);
  24725. }
  24726. } else if (value.includes("hsv")) {
  24727. const parts = value.replace(/hsva|hsv|\(|\)/gm, "").split(/\s|,/g).filter((val) => val !== "").map((val, index) => index > 2 ? Number.parseFloat(val) : Number.parseInt(val, 10));
  24728. if (parts.length === 4) {
  24729. this._alpha = Number.parseFloat(parts[3]) * 100;
  24730. } else if (parts.length === 3) {
  24731. this._alpha = 100;
  24732. }
  24733. if (parts.length >= 3) {
  24734. fromHSV(parts[0], parts[1], parts[2]);
  24735. }
  24736. } else if (value.includes("rgb")) {
  24737. const parts = value.replace(/rgba|rgb|\(|\)/gm, "").split(/\s|,/g).filter((val) => val !== "").map((val, index) => index > 2 ? Number.parseFloat(val) : Number.parseInt(val, 10));
  24738. if (parts.length === 4) {
  24739. this._alpha = Number.parseFloat(parts[3]) * 100;
  24740. } else if (parts.length === 3) {
  24741. this._alpha = 100;
  24742. }
  24743. if (parts.length >= 3) {
  24744. const { h, s, v } = rgb2hsv(parts[0], parts[1], parts[2]);
  24745. fromHSV(h, s, v);
  24746. }
  24747. } else if (value.includes("#")) {
  24748. const hex = value.replace("#", "").trim();
  24749. if (!/^[0-9a-fA-F]{3}$|^[0-9a-fA-F]{6}$|^[0-9a-fA-F]{8}$/.test(hex))
  24750. return;
  24751. let r, g, b;
  24752. if (hex.length === 3) {
  24753. r = parseHexChannel(hex[0] + hex[0]);
  24754. g = parseHexChannel(hex[1] + hex[1]);
  24755. b = parseHexChannel(hex[2] + hex[2]);
  24756. } else if (hex.length === 6 || hex.length === 8) {
  24757. r = parseHexChannel(hex.slice(0, 2));
  24758. g = parseHexChannel(hex.slice(2, 4));
  24759. b = parseHexChannel(hex.slice(4, 6));
  24760. }
  24761. if (hex.length === 8) {
  24762. this._alpha = parseHexChannel(hex.slice(6)) / 255 * 100;
  24763. } else if (hex.length === 3 || hex.length === 6) {
  24764. this._alpha = 100;
  24765. }
  24766. const { h, s, v } = rgb2hsv(r, g, b);
  24767. fromHSV(h, s, v);
  24768. }
  24769. }
  24770. compare(color) {
  24771. return Math.abs(color._hue - this._hue) < 2 && Math.abs(color._saturation - this._saturation) < 1 && Math.abs(color._value - this._value) < 1 && Math.abs(color._alpha - this._alpha) < 1;
  24772. }
  24773. doOnChange() {
  24774. const { _hue, _saturation, _value, _alpha, format } = this;
  24775. if (this.enableAlpha) {
  24776. switch (format) {
  24777. case "hsl": {
  24778. const hsl = hsv2hsl(_hue, _saturation / 100, _value / 100);
  24779. this.value = `hsla(${_hue}, ${Math.round(hsl[1] * 100)}%, ${Math.round(hsl[2] * 100)}%, ${this.get("alpha") / 100})`;
  24780. break;
  24781. }
  24782. case "hsv": {
  24783. this.value = `hsva(${_hue}, ${Math.round(_saturation)}%, ${Math.round(_value)}%, ${this.get("alpha") / 100})`;
  24784. break;
  24785. }
  24786. case "hex": {
  24787. this.value = `${toHex(hsv2rgb(_hue, _saturation, _value))}${hexOne(_alpha * 255 / 100)}`;
  24788. break;
  24789. }
  24790. default: {
  24791. const { r, g, b } = hsv2rgb(_hue, _saturation, _value);
  24792. this.value = `rgba(${r}, ${g}, ${b}, ${this.get("alpha") / 100})`;
  24793. }
  24794. }
  24795. } else {
  24796. switch (format) {
  24797. case "hsl": {
  24798. const hsl = hsv2hsl(_hue, _saturation / 100, _value / 100);
  24799. this.value = `hsl(${_hue}, ${Math.round(hsl[1] * 100)}%, ${Math.round(hsl[2] * 100)}%)`;
  24800. break;
  24801. }
  24802. case "hsv": {
  24803. this.value = `hsv(${_hue}, ${Math.round(_saturation)}%, ${Math.round(_value)}%)`;
  24804. break;
  24805. }
  24806. case "rgb": {
  24807. const { r, g, b } = hsv2rgb(_hue, _saturation, _value);
  24808. this.value = `rgb(${r}, ${g}, ${b})`;
  24809. break;
  24810. }
  24811. default: {
  24812. this.value = toHex(hsv2rgb(_hue, _saturation, _value));
  24813. }
  24814. }
  24815. }
  24816. }
  24817. }
  24818. const _sfc_main$1G = vue.defineComponent({
  24819. props: {
  24820. colors: {
  24821. type: Array,
  24822. required: true
  24823. },
  24824. color: {
  24825. type: Object,
  24826. required: true
  24827. },
  24828. enableAlpha: {
  24829. type: Boolean,
  24830. required: true
  24831. }
  24832. },
  24833. setup(props) {
  24834. const ns = useNamespace("color-predefine");
  24835. const { currentColor } = vue.inject(colorPickerContextKey);
  24836. const rgbaColors = vue.ref(parseColors(props.colors, props.color));
  24837. vue.watch(() => currentColor.value, (val) => {
  24838. const color = new Color();
  24839. color.fromString(val);
  24840. rgbaColors.value.forEach((item) => {
  24841. item.selected = color.compare(item);
  24842. });
  24843. });
  24844. vue.watchEffect(() => {
  24845. rgbaColors.value = parseColors(props.colors, props.color);
  24846. });
  24847. function handleSelect(index) {
  24848. props.color.fromString(props.colors[index]);
  24849. }
  24850. function parseColors(colors, color) {
  24851. return colors.map((value) => {
  24852. const c = new Color();
  24853. c.enableAlpha = props.enableAlpha;
  24854. c.format = "rgba";
  24855. c.fromString(value);
  24856. c.selected = c.value === color.value;
  24857. return c;
  24858. });
  24859. }
  24860. return {
  24861. rgbaColors,
  24862. handleSelect,
  24863. ns
  24864. };
  24865. }
  24866. });
  24867. function _sfc_render$p(_ctx, _cache, $props, $setup, $data, $options) {
  24868. return vue.openBlock(), vue.createElementBlock("div", {
  24869. class: vue.normalizeClass(_ctx.ns.b())
  24870. }, [
  24871. vue.createElementVNode("div", {
  24872. class: vue.normalizeClass(_ctx.ns.e("colors"))
  24873. }, [
  24874. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.rgbaColors, (item, index) => {
  24875. return vue.openBlock(), vue.createElementBlock("div", {
  24876. key: _ctx.colors[index],
  24877. class: vue.normalizeClass([
  24878. _ctx.ns.e("color-selector"),
  24879. _ctx.ns.is("alpha", item._alpha < 100),
  24880. { selected: item.selected }
  24881. ]),
  24882. onClick: ($event) => _ctx.handleSelect(index)
  24883. }, [
  24884. vue.createElementVNode("div", {
  24885. style: vue.normalizeStyle({ backgroundColor: item.value })
  24886. }, null, 4)
  24887. ], 10, ["onClick"]);
  24888. }), 128))
  24889. ], 2)
  24890. ], 2);
  24891. }
  24892. var Predefine = /* @__PURE__ */ _export_sfc(_sfc_main$1G, [["render", _sfc_render$p], ["__file", "predefine.vue"]]);
  24893. const _sfc_main$1F = vue.defineComponent({
  24894. name: "ElSlPanel",
  24895. props: {
  24896. color: {
  24897. type: Object,
  24898. required: true
  24899. }
  24900. },
  24901. setup(props) {
  24902. const ns = useNamespace("color-svpanel");
  24903. const instance = vue.getCurrentInstance();
  24904. const cursorTop = vue.ref(0);
  24905. const cursorLeft = vue.ref(0);
  24906. const background = vue.ref("hsl(0, 100%, 50%)");
  24907. const colorValue = vue.computed(() => {
  24908. const hue = props.color.get("hue");
  24909. const value = props.color.get("value");
  24910. return { hue, value };
  24911. });
  24912. function update() {
  24913. const saturation = props.color.get("saturation");
  24914. const value = props.color.get("value");
  24915. const el = instance.vnode.el;
  24916. const { clientWidth: width, clientHeight: height } = el;
  24917. cursorLeft.value = saturation * width / 100;
  24918. cursorTop.value = (100 - value) * height / 100;
  24919. background.value = `hsl(${props.color.get("hue")}, 100%, 50%)`;
  24920. }
  24921. function handleDrag(event) {
  24922. const el = instance.vnode.el;
  24923. const rect = el.getBoundingClientRect();
  24924. const { clientX, clientY } = getClientXY(event);
  24925. let left = clientX - rect.left;
  24926. let top = clientY - rect.top;
  24927. left = Math.max(0, left);
  24928. left = Math.min(left, rect.width);
  24929. top = Math.max(0, top);
  24930. top = Math.min(top, rect.height);
  24931. cursorLeft.value = left;
  24932. cursorTop.value = top;
  24933. props.color.set({
  24934. saturation: left / rect.width * 100,
  24935. value: 100 - top / rect.height * 100
  24936. });
  24937. }
  24938. vue.watch(() => colorValue.value, () => {
  24939. update();
  24940. });
  24941. vue.onMounted(() => {
  24942. draggable(instance.vnode.el, {
  24943. drag: (event) => {
  24944. handleDrag(event);
  24945. },
  24946. end: (event) => {
  24947. handleDrag(event);
  24948. }
  24949. });
  24950. update();
  24951. });
  24952. return {
  24953. cursorTop,
  24954. cursorLeft,
  24955. background,
  24956. colorValue,
  24957. handleDrag,
  24958. update,
  24959. ns
  24960. };
  24961. }
  24962. });
  24963. function _sfc_render$o(_ctx, _cache, $props, $setup, $data, $options) {
  24964. return vue.openBlock(), vue.createElementBlock("div", {
  24965. class: vue.normalizeClass(_ctx.ns.b()),
  24966. style: vue.normalizeStyle({
  24967. backgroundColor: _ctx.background
  24968. })
  24969. }, [
  24970. vue.createElementVNode("div", {
  24971. class: vue.normalizeClass(_ctx.ns.e("white"))
  24972. }, null, 2),
  24973. vue.createElementVNode("div", {
  24974. class: vue.normalizeClass(_ctx.ns.e("black"))
  24975. }, null, 2),
  24976. vue.createElementVNode("div", {
  24977. class: vue.normalizeClass(_ctx.ns.e("cursor")),
  24978. style: vue.normalizeStyle({
  24979. top: _ctx.cursorTop + "px",
  24980. left: _ctx.cursorLeft + "px"
  24981. })
  24982. }, [
  24983. vue.createElementVNode("div")
  24984. ], 6)
  24985. ], 6);
  24986. }
  24987. var SvPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1F, [["render", _sfc_render$o], ["__file", "sv-panel.vue"]]);
  24988. const __default__$19 = vue.defineComponent({
  24989. name: "ElColorPicker"
  24990. });
  24991. const _sfc_main$1E = /* @__PURE__ */ vue.defineComponent({
  24992. ...__default__$19,
  24993. props: colorPickerProps,
  24994. emits: colorPickerEmits,
  24995. setup(__props, { expose, emit }) {
  24996. const props = __props;
  24997. const { t } = useLocale();
  24998. const ns = useNamespace("color");
  24999. const { formItem } = useFormItem();
  25000. const colorSize = useFormSize();
  25001. const colorDisabled = useFormDisabled();
  25002. const { inputId: buttonId, isLabeledByFormItem } = useFormItemInputId(props, {
  25003. formItemContext: formItem
  25004. });
  25005. const hue = vue.ref();
  25006. const sv = vue.ref();
  25007. const alpha = vue.ref();
  25008. const popper = vue.ref();
  25009. const triggerRef = vue.ref();
  25010. const inputRef = vue.ref();
  25011. const { isFocused, handleFocus, handleBlur } = useFocusController(triggerRef, {
  25012. beforeFocus() {
  25013. return colorDisabled.value;
  25014. },
  25015. beforeBlur(event) {
  25016. var _a;
  25017. return (_a = popper.value) == null ? void 0 : _a.isFocusInsideContent(event);
  25018. },
  25019. afterBlur() {
  25020. setShowPicker(false);
  25021. resetColor();
  25022. }
  25023. });
  25024. let shouldActiveChange = true;
  25025. const color = vue.reactive(new Color({
  25026. enableAlpha: props.showAlpha,
  25027. format: props.colorFormat || "",
  25028. value: props.modelValue
  25029. }));
  25030. const showPicker = vue.ref(false);
  25031. const showPanelColor = vue.ref(false);
  25032. const customInput = vue.ref("");
  25033. const displayedColor = vue.computed(() => {
  25034. if (!props.modelValue && !showPanelColor.value) {
  25035. return "transparent";
  25036. }
  25037. return displayedRgb(color, props.showAlpha);
  25038. });
  25039. const currentColor = vue.computed(() => {
  25040. return !props.modelValue && !showPanelColor.value ? "" : color.value;
  25041. });
  25042. const buttonAriaLabel = vue.computed(() => {
  25043. return !isLabeledByFormItem.value ? props.ariaLabel || t("el.colorpicker.defaultLabel") : void 0;
  25044. });
  25045. const buttonAriaLabelledby = vue.computed(() => {
  25046. return isLabeledByFormItem.value ? formItem == null ? void 0 : formItem.labelId : void 0;
  25047. });
  25048. const btnKls = vue.computed(() => {
  25049. return [
  25050. ns.b("picker"),
  25051. ns.is("disabled", colorDisabled.value),
  25052. ns.bm("picker", colorSize.value),
  25053. ns.is("focused", isFocused.value)
  25054. ];
  25055. });
  25056. function displayedRgb(color2, showAlpha) {
  25057. if (!(color2 instanceof Color)) {
  25058. throw new TypeError("color should be instance of _color Class");
  25059. }
  25060. const { r, g, b } = color2.toRgb();
  25061. return showAlpha ? `rgba(${r}, ${g}, ${b}, ${color2.get("alpha") / 100})` : `rgb(${r}, ${g}, ${b})`;
  25062. }
  25063. function setShowPicker(value) {
  25064. showPicker.value = value;
  25065. }
  25066. const debounceSetShowPicker = debounce(setShowPicker, 100, { leading: true });
  25067. function show() {
  25068. if (colorDisabled.value)
  25069. return;
  25070. setShowPicker(true);
  25071. }
  25072. function hide() {
  25073. debounceSetShowPicker(false);
  25074. resetColor();
  25075. }
  25076. function resetColor() {
  25077. vue.nextTick(() => {
  25078. if (props.modelValue) {
  25079. color.fromString(props.modelValue);
  25080. } else {
  25081. color.value = "";
  25082. vue.nextTick(() => {
  25083. showPanelColor.value = false;
  25084. });
  25085. }
  25086. });
  25087. }
  25088. function handleTrigger() {
  25089. if (colorDisabled.value)
  25090. return;
  25091. debounceSetShowPicker(!showPicker.value);
  25092. }
  25093. function handleConfirm() {
  25094. color.fromString(customInput.value);
  25095. }
  25096. function confirmValue() {
  25097. const value = color.value;
  25098. emit(UPDATE_MODEL_EVENT, value);
  25099. emit("change", value);
  25100. if (props.validateEvent) {
  25101. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
  25102. }
  25103. debounceSetShowPicker(false);
  25104. vue.nextTick(() => {
  25105. const newColor = new Color({
  25106. enableAlpha: props.showAlpha,
  25107. format: props.colorFormat || "",
  25108. value: props.modelValue
  25109. });
  25110. if (!color.compare(newColor)) {
  25111. resetColor();
  25112. }
  25113. });
  25114. }
  25115. function clear() {
  25116. debounceSetShowPicker(false);
  25117. emit(UPDATE_MODEL_EVENT, null);
  25118. emit("change", null);
  25119. if (props.modelValue !== null && props.validateEvent) {
  25120. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
  25121. }
  25122. resetColor();
  25123. }
  25124. function handleClickOutside() {
  25125. if (!showPicker.value)
  25126. return;
  25127. hide();
  25128. isFocused.value && focus();
  25129. }
  25130. function handleEsc(event) {
  25131. event.preventDefault();
  25132. event.stopPropagation();
  25133. setShowPicker(false);
  25134. resetColor();
  25135. }
  25136. function handleKeyDown(event) {
  25137. switch (event.code) {
  25138. case EVENT_CODE.enter:
  25139. case EVENT_CODE.numpadEnter:
  25140. case EVENT_CODE.space:
  25141. event.preventDefault();
  25142. event.stopPropagation();
  25143. show();
  25144. inputRef.value.focus();
  25145. break;
  25146. case EVENT_CODE.esc:
  25147. handleEsc(event);
  25148. break;
  25149. }
  25150. }
  25151. function focus() {
  25152. triggerRef.value.focus();
  25153. }
  25154. function blur() {
  25155. triggerRef.value.blur();
  25156. }
  25157. vue.onMounted(() => {
  25158. if (props.modelValue) {
  25159. customInput.value = currentColor.value;
  25160. }
  25161. });
  25162. vue.watch(() => props.modelValue, (newVal) => {
  25163. if (!newVal) {
  25164. showPanelColor.value = false;
  25165. } else if (newVal && newVal !== color.value) {
  25166. shouldActiveChange = false;
  25167. color.fromString(newVal);
  25168. }
  25169. });
  25170. vue.watch(() => [props.colorFormat, props.showAlpha], () => {
  25171. color.enableAlpha = props.showAlpha;
  25172. color.format = props.colorFormat || color.format;
  25173. color.doOnChange();
  25174. emit(UPDATE_MODEL_EVENT, color.value);
  25175. });
  25176. vue.watch(() => currentColor.value, (val) => {
  25177. customInput.value = val;
  25178. shouldActiveChange && emit("activeChange", val);
  25179. shouldActiveChange = true;
  25180. });
  25181. vue.watch(() => color.value, () => {
  25182. if (!props.modelValue && !showPanelColor.value) {
  25183. showPanelColor.value = true;
  25184. }
  25185. });
  25186. vue.watch(() => showPicker.value, () => {
  25187. vue.nextTick(() => {
  25188. var _a, _b, _c;
  25189. (_a = hue.value) == null ? void 0 : _a.update();
  25190. (_b = sv.value) == null ? void 0 : _b.update();
  25191. (_c = alpha.value) == null ? void 0 : _c.update();
  25192. });
  25193. });
  25194. vue.provide(colorPickerContextKey, {
  25195. currentColor
  25196. });
  25197. expose({
  25198. color,
  25199. show,
  25200. hide,
  25201. focus,
  25202. blur
  25203. });
  25204. return (_ctx, _cache) => {
  25205. return vue.openBlock(), vue.createBlock(vue.unref(ElTooltip), {
  25206. ref_key: "popper",
  25207. ref: popper,
  25208. visible: showPicker.value,
  25209. "show-arrow": false,
  25210. "fallback-placements": ["bottom", "top", "right", "left"],
  25211. offset: 0,
  25212. "gpu-acceleration": false,
  25213. "popper-class": [vue.unref(ns).be("picker", "panel"), vue.unref(ns).b("dropdown"), _ctx.popperClass],
  25214. "stop-popper-mouse-event": false,
  25215. effect: "light",
  25216. trigger: "click",
  25217. teleported: _ctx.teleported,
  25218. transition: `${vue.unref(ns).namespace.value}-zoom-in-top`,
  25219. persistent: "",
  25220. onHide: ($event) => setShowPicker(false)
  25221. }, {
  25222. content: vue.withCtx(() => [
  25223. vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  25224. onKeydown: vue.withKeys(handleEsc, ["esc"])
  25225. }, [
  25226. vue.createElementVNode("div", {
  25227. class: vue.normalizeClass(vue.unref(ns).be("dropdown", "main-wrapper"))
  25228. }, [
  25229. vue.createVNode(HueSlider, {
  25230. ref_key: "hue",
  25231. ref: hue,
  25232. class: "hue-slider",
  25233. color: vue.unref(color),
  25234. vertical: ""
  25235. }, null, 8, ["color"]),
  25236. vue.createVNode(SvPanel, {
  25237. ref_key: "sv",
  25238. ref: sv,
  25239. color: vue.unref(color)
  25240. }, null, 8, ["color"])
  25241. ], 2),
  25242. _ctx.showAlpha ? (vue.openBlock(), vue.createBlock(AlphaSlider, {
  25243. key: 0,
  25244. ref_key: "alpha",
  25245. ref: alpha,
  25246. color: vue.unref(color)
  25247. }, null, 8, ["color"])) : vue.createCommentVNode("v-if", true),
  25248. _ctx.predefine ? (vue.openBlock(), vue.createBlock(Predefine, {
  25249. key: 1,
  25250. ref: "predefine",
  25251. "enable-alpha": _ctx.showAlpha,
  25252. color: vue.unref(color),
  25253. colors: _ctx.predefine
  25254. }, null, 8, ["enable-alpha", "color", "colors"])) : vue.createCommentVNode("v-if", true),
  25255. vue.createElementVNode("div", {
  25256. class: vue.normalizeClass(vue.unref(ns).be("dropdown", "btns"))
  25257. }, [
  25258. vue.createElementVNode("span", {
  25259. class: vue.normalizeClass(vue.unref(ns).be("dropdown", "value"))
  25260. }, [
  25261. vue.createVNode(vue.unref(ElInput), {
  25262. ref_key: "inputRef",
  25263. ref: inputRef,
  25264. modelValue: customInput.value,
  25265. "onUpdate:modelValue": ($event) => customInput.value = $event,
  25266. "validate-event": false,
  25267. size: "small",
  25268. onKeyup: vue.withKeys(handleConfirm, ["enter"]),
  25269. onBlur: handleConfirm
  25270. }, null, 8, ["modelValue", "onUpdate:modelValue", "onKeyup"])
  25271. ], 2),
  25272. vue.createVNode(vue.unref(ElButton), {
  25273. class: vue.normalizeClass(vue.unref(ns).be("dropdown", "link-btn")),
  25274. text: "",
  25275. size: "small",
  25276. onClick: clear
  25277. }, {
  25278. default: vue.withCtx(() => [
  25279. vue.createTextVNode(vue.toDisplayString(vue.unref(t)("el.colorpicker.clear")), 1)
  25280. ]),
  25281. _: 1
  25282. }, 8, ["class"]),
  25283. vue.createVNode(vue.unref(ElButton), {
  25284. plain: "",
  25285. size: "small",
  25286. class: vue.normalizeClass(vue.unref(ns).be("dropdown", "btn")),
  25287. onClick: confirmValue
  25288. }, {
  25289. default: vue.withCtx(() => [
  25290. vue.createTextVNode(vue.toDisplayString(vue.unref(t)("el.colorpicker.confirm")), 1)
  25291. ]),
  25292. _: 1
  25293. }, 8, ["class"])
  25294. ], 2)
  25295. ], 40, ["onKeydown"])), [
  25296. [vue.unref(ClickOutside), handleClickOutside]
  25297. ])
  25298. ]),
  25299. default: vue.withCtx(() => [
  25300. vue.createElementVNode("div", vue.mergeProps({
  25301. id: vue.unref(buttonId),
  25302. ref_key: "triggerRef",
  25303. ref: triggerRef
  25304. }, _ctx.$attrs, {
  25305. class: vue.unref(btnKls),
  25306. role: "button",
  25307. "aria-label": vue.unref(buttonAriaLabel),
  25308. "aria-labelledby": vue.unref(buttonAriaLabelledby),
  25309. "aria-description": vue.unref(t)("el.colorpicker.description", { color: _ctx.modelValue || "" }),
  25310. "aria-disabled": vue.unref(colorDisabled),
  25311. tabindex: vue.unref(colorDisabled) ? -1 : _ctx.tabindex,
  25312. onKeydown: handleKeyDown,
  25313. onFocus: vue.unref(handleFocus),
  25314. onBlur: vue.unref(handleBlur)
  25315. }), [
  25316. vue.unref(colorDisabled) ? (vue.openBlock(), vue.createElementBlock("div", {
  25317. key: 0,
  25318. class: vue.normalizeClass(vue.unref(ns).be("picker", "mask"))
  25319. }, null, 2)) : vue.createCommentVNode("v-if", true),
  25320. vue.createElementVNode("div", {
  25321. class: vue.normalizeClass(vue.unref(ns).be("picker", "trigger")),
  25322. onClick: handleTrigger
  25323. }, [
  25324. vue.createElementVNode("span", {
  25325. class: vue.normalizeClass([vue.unref(ns).be("picker", "color"), vue.unref(ns).is("alpha", _ctx.showAlpha)])
  25326. }, [
  25327. vue.createElementVNode("span", {
  25328. class: vue.normalizeClass(vue.unref(ns).be("picker", "color-inner")),
  25329. style: vue.normalizeStyle({
  25330. backgroundColor: vue.unref(displayedColor)
  25331. })
  25332. }, [
  25333. vue.withDirectives(vue.createVNode(vue.unref(ElIcon), {
  25334. class: vue.normalizeClass([vue.unref(ns).be("picker", "icon"), vue.unref(ns).is("icon-arrow-down")])
  25335. }, {
  25336. default: vue.withCtx(() => [
  25337. vue.createVNode(vue.unref(arrow_down_default))
  25338. ]),
  25339. _: 1
  25340. }, 8, ["class"]), [
  25341. [vue.vShow, _ctx.modelValue || showPanelColor.value]
  25342. ]),
  25343. vue.withDirectives(vue.createVNode(vue.unref(ElIcon), {
  25344. class: vue.normalizeClass([vue.unref(ns).be("picker", "empty"), vue.unref(ns).is("icon-close")])
  25345. }, {
  25346. default: vue.withCtx(() => [
  25347. vue.createVNode(vue.unref(close_default))
  25348. ]),
  25349. _: 1
  25350. }, 8, ["class"]), [
  25351. [vue.vShow, !_ctx.modelValue && !showPanelColor.value]
  25352. ])
  25353. ], 6)
  25354. ], 2)
  25355. ], 2)
  25356. ], 16, ["id", "aria-label", "aria-labelledby", "aria-description", "aria-disabled", "tabindex", "onFocus", "onBlur"])
  25357. ]),
  25358. _: 1
  25359. }, 8, ["visible", "popper-class", "teleported", "transition", "onHide"]);
  25360. };
  25361. }
  25362. });
  25363. var ColorPicker = /* @__PURE__ */ _export_sfc(_sfc_main$1E, [["__file", "color-picker.vue"]]);
  25364. const ElColorPicker = withInstall(ColorPicker);
  25365. const __default__$18 = vue.defineComponent({
  25366. name: "ElContainer"
  25367. });
  25368. const _sfc_main$1D = /* @__PURE__ */ vue.defineComponent({
  25369. ...__default__$18,
  25370. props: {
  25371. direction: {
  25372. type: String
  25373. }
  25374. },
  25375. setup(__props) {
  25376. const props = __props;
  25377. const slots = vue.useSlots();
  25378. const ns = useNamespace("container");
  25379. const isVertical = vue.computed(() => {
  25380. if (props.direction === "vertical") {
  25381. return true;
  25382. } else if (props.direction === "horizontal") {
  25383. return false;
  25384. }
  25385. if (slots && slots.default) {
  25386. const vNodes = slots.default();
  25387. return vNodes.some((vNode) => {
  25388. const tag = vNode.type.name;
  25389. return tag === "ElHeader" || tag === "ElFooter";
  25390. });
  25391. } else {
  25392. return false;
  25393. }
  25394. });
  25395. return (_ctx, _cache) => {
  25396. return vue.openBlock(), vue.createElementBlock("section", {
  25397. class: vue.normalizeClass([vue.unref(ns).b(), vue.unref(ns).is("vertical", vue.unref(isVertical))])
  25398. }, [
  25399. vue.renderSlot(_ctx.$slots, "default")
  25400. ], 2);
  25401. };
  25402. }
  25403. });
  25404. var Container = /* @__PURE__ */ _export_sfc(_sfc_main$1D, [["__file", "container.vue"]]);
  25405. const __default__$17 = vue.defineComponent({
  25406. name: "ElAside"
  25407. });
  25408. const _sfc_main$1C = /* @__PURE__ */ vue.defineComponent({
  25409. ...__default__$17,
  25410. props: {
  25411. width: {
  25412. type: String,
  25413. default: null
  25414. }
  25415. },
  25416. setup(__props) {
  25417. const props = __props;
  25418. const ns = useNamespace("aside");
  25419. const style = vue.computed(() => props.width ? ns.cssVarBlock({ width: props.width }) : {});
  25420. return (_ctx, _cache) => {
  25421. return vue.openBlock(), vue.createElementBlock("aside", {
  25422. class: vue.normalizeClass(vue.unref(ns).b()),
  25423. style: vue.normalizeStyle(vue.unref(style))
  25424. }, [
  25425. vue.renderSlot(_ctx.$slots, "default")
  25426. ], 6);
  25427. };
  25428. }
  25429. });
  25430. var Aside = /* @__PURE__ */ _export_sfc(_sfc_main$1C, [["__file", "aside.vue"]]);
  25431. const __default__$16 = vue.defineComponent({
  25432. name: "ElFooter"
  25433. });
  25434. const _sfc_main$1B = /* @__PURE__ */ vue.defineComponent({
  25435. ...__default__$16,
  25436. props: {
  25437. height: {
  25438. type: String,
  25439. default: null
  25440. }
  25441. },
  25442. setup(__props) {
  25443. const props = __props;
  25444. const ns = useNamespace("footer");
  25445. const style = vue.computed(() => props.height ? ns.cssVarBlock({ height: props.height }) : {});
  25446. return (_ctx, _cache) => {
  25447. return vue.openBlock(), vue.createElementBlock("footer", {
  25448. class: vue.normalizeClass(vue.unref(ns).b()),
  25449. style: vue.normalizeStyle(vue.unref(style))
  25450. }, [
  25451. vue.renderSlot(_ctx.$slots, "default")
  25452. ], 6);
  25453. };
  25454. }
  25455. });
  25456. var Footer$2 = /* @__PURE__ */ _export_sfc(_sfc_main$1B, [["__file", "footer.vue"]]);
  25457. const __default__$15 = vue.defineComponent({
  25458. name: "ElHeader"
  25459. });
  25460. const _sfc_main$1A = /* @__PURE__ */ vue.defineComponent({
  25461. ...__default__$15,
  25462. props: {
  25463. height: {
  25464. type: String,
  25465. default: null
  25466. }
  25467. },
  25468. setup(__props) {
  25469. const props = __props;
  25470. const ns = useNamespace("header");
  25471. const style = vue.computed(() => {
  25472. return props.height ? ns.cssVarBlock({
  25473. height: props.height
  25474. }) : {};
  25475. });
  25476. return (_ctx, _cache) => {
  25477. return vue.openBlock(), vue.createElementBlock("header", {
  25478. class: vue.normalizeClass(vue.unref(ns).b()),
  25479. style: vue.normalizeStyle(vue.unref(style))
  25480. }, [
  25481. vue.renderSlot(_ctx.$slots, "default")
  25482. ], 6);
  25483. };
  25484. }
  25485. });
  25486. var Header$1 = /* @__PURE__ */ _export_sfc(_sfc_main$1A, [["__file", "header.vue"]]);
  25487. const __default__$14 = vue.defineComponent({
  25488. name: "ElMain"
  25489. });
  25490. const _sfc_main$1z = /* @__PURE__ */ vue.defineComponent({
  25491. ...__default__$14,
  25492. setup(__props) {
  25493. const ns = useNamespace("main");
  25494. return (_ctx, _cache) => {
  25495. return vue.openBlock(), vue.createElementBlock("main", {
  25496. class: vue.normalizeClass(vue.unref(ns).b())
  25497. }, [
  25498. vue.renderSlot(_ctx.$slots, "default")
  25499. ], 2);
  25500. };
  25501. }
  25502. });
  25503. var Main = /* @__PURE__ */ _export_sfc(_sfc_main$1z, [["__file", "main.vue"]]);
  25504. const ElContainer = withInstall(Container, {
  25505. Aside,
  25506. Footer: Footer$2,
  25507. Header: Header$1,
  25508. Main
  25509. });
  25510. const ElAside = withNoopInstall(Aside);
  25511. const ElFooter = withNoopInstall(Footer$2);
  25512. const ElHeader = withNoopInstall(Header$1);
  25513. const ElMain = withNoopInstall(Main);
  25514. var advancedFormat$1 = {exports: {}};
  25515. (function(module, exports) {
  25516. !function(e, t) {
  25517. module.exports = t() ;
  25518. }(commonjsGlobal, function() {
  25519. return function(e, t) {
  25520. var r = t.prototype, n = r.format;
  25521. r.format = function(e2) {
  25522. var t2 = this, r2 = this.$locale();
  25523. if (!this.isValid())
  25524. return n.bind(this)(e2);
  25525. var s = this.$utils(), a = (e2 || "YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g, function(e3) {
  25526. switch (e3) {
  25527. case "Q":
  25528. return Math.ceil((t2.$M + 1) / 3);
  25529. case "Do":
  25530. return r2.ordinal(t2.$D);
  25531. case "gggg":
  25532. return t2.weekYear();
  25533. case "GGGG":
  25534. return t2.isoWeekYear();
  25535. case "wo":
  25536. return r2.ordinal(t2.week(), "W");
  25537. case "w":
  25538. case "ww":
  25539. return s.s(t2.week(), e3 === "w" ? 1 : 2, "0");
  25540. case "W":
  25541. case "WW":
  25542. return s.s(t2.isoWeek(), e3 === "W" ? 1 : 2, "0");
  25543. case "k":
  25544. case "kk":
  25545. return s.s(String(t2.$H === 0 ? 24 : t2.$H), e3 === "k" ? 1 : 2, "0");
  25546. case "X":
  25547. return Math.floor(t2.$d.getTime() / 1e3);
  25548. case "x":
  25549. return t2.$d.getTime();
  25550. case "z":
  25551. return "[" + t2.offsetName() + "]";
  25552. case "zzz":
  25553. return "[" + t2.offsetName("long") + "]";
  25554. default:
  25555. return e3;
  25556. }
  25557. });
  25558. return n.bind(this)(a);
  25559. };
  25560. };
  25561. });
  25562. })(advancedFormat$1);
  25563. var advancedFormat = advancedFormat$1.exports;
  25564. var weekOfYear$1 = {exports: {}};
  25565. (function(module, exports) {
  25566. !function(e, t) {
  25567. module.exports = t() ;
  25568. }(commonjsGlobal, function() {
  25569. var e = "week", t = "year";
  25570. return function(i, n, r) {
  25571. var f = n.prototype;
  25572. f.week = function(i2) {
  25573. if (i2 === void 0 && (i2 = null), i2 !== null)
  25574. return this.add(7 * (i2 - this.week()), "day");
  25575. var n2 = this.$locale().yearStart || 1;
  25576. if (this.month() === 11 && this.date() > 25) {
  25577. var f2 = r(this).startOf(t).add(1, t).date(n2), s = r(this).endOf(e);
  25578. if (f2.isBefore(s))
  25579. return 1;
  25580. }
  25581. var a = r(this).startOf(t).date(n2).startOf(e).subtract(1, "millisecond"), o = this.diff(a, e, true);
  25582. return o < 0 ? r(this).startOf("week").week() : Math.ceil(o);
  25583. }, f.weeks = function(e2) {
  25584. return e2 === void 0 && (e2 = null), this.week(e2);
  25585. };
  25586. };
  25587. });
  25588. })(weekOfYear$1);
  25589. var weekOfYear = weekOfYear$1.exports;
  25590. var weekYear$1 = {exports: {}};
  25591. (function(module, exports) {
  25592. !function(e, t) {
  25593. module.exports = t() ;
  25594. }(commonjsGlobal, function() {
  25595. return function(e, t) {
  25596. t.prototype.weekYear = function() {
  25597. var e2 = this.month(), t2 = this.week(), n = this.year();
  25598. return t2 === 1 && e2 === 11 ? n + 1 : e2 === 0 && t2 >= 52 ? n - 1 : n;
  25599. };
  25600. };
  25601. });
  25602. })(weekYear$1);
  25603. var weekYear = weekYear$1.exports;
  25604. var dayOfYear$1 = {exports: {}};
  25605. (function(module, exports) {
  25606. !function(e, t) {
  25607. module.exports = t() ;
  25608. }(commonjsGlobal, function() {
  25609. return function(e, t, n) {
  25610. t.prototype.dayOfYear = function(e2) {
  25611. var t2 = Math.round((n(this).startOf("day") - n(this).startOf("year")) / 864e5) + 1;
  25612. return e2 == null ? t2 : this.add(e2 - t2, "day");
  25613. };
  25614. };
  25615. });
  25616. })(dayOfYear$1);
  25617. var dayOfYear = dayOfYear$1.exports;
  25618. var isSameOrAfter$1 = {exports: {}};
  25619. (function(module, exports) {
  25620. !function(e, t) {
  25621. module.exports = t() ;
  25622. }(commonjsGlobal, function() {
  25623. return function(e, t) {
  25624. t.prototype.isSameOrAfter = function(e2, t2) {
  25625. return this.isSame(e2, t2) || this.isAfter(e2, t2);
  25626. };
  25627. };
  25628. });
  25629. })(isSameOrAfter$1);
  25630. var isSameOrAfter = isSameOrAfter$1.exports;
  25631. var isSameOrBefore$1 = {exports: {}};
  25632. (function(module, exports) {
  25633. !function(e, i) {
  25634. module.exports = i() ;
  25635. }(commonjsGlobal, function() {
  25636. return function(e, i) {
  25637. i.prototype.isSameOrBefore = function(e2, i2) {
  25638. return this.isSame(e2, i2) || this.isBefore(e2, i2);
  25639. };
  25640. };
  25641. });
  25642. })(isSameOrBefore$1);
  25643. var isSameOrBefore = isSameOrBefore$1.exports;
  25644. const ROOT_PICKER_INJECTION_KEY = Symbol();
  25645. const datePickerProps = buildProps({
  25646. ...timePickerDefaultProps,
  25647. type: {
  25648. type: definePropType(String),
  25649. default: "date"
  25650. }
  25651. });
  25652. const selectionModes = [
  25653. "date",
  25654. "dates",
  25655. "year",
  25656. "years",
  25657. "month",
  25658. "months",
  25659. "week",
  25660. "range"
  25661. ];
  25662. const datePickerSharedProps = buildProps({
  25663. disabledDate: {
  25664. type: definePropType(Function)
  25665. },
  25666. date: {
  25667. type: definePropType(Object),
  25668. required: true
  25669. },
  25670. minDate: {
  25671. type: definePropType(Object)
  25672. },
  25673. maxDate: {
  25674. type: definePropType(Object)
  25675. },
  25676. parsedValue: {
  25677. type: definePropType([Object, Array])
  25678. },
  25679. rangeState: {
  25680. type: definePropType(Object),
  25681. default: () => ({
  25682. endDate: null,
  25683. selecting: false
  25684. })
  25685. }
  25686. });
  25687. const panelSharedProps = buildProps({
  25688. type: {
  25689. type: definePropType(String),
  25690. required: true,
  25691. values: datePickTypes
  25692. },
  25693. dateFormat: String,
  25694. timeFormat: String,
  25695. showNow: {
  25696. type: Boolean,
  25697. default: true
  25698. }
  25699. });
  25700. const panelRangeSharedProps = buildProps({
  25701. unlinkPanels: Boolean,
  25702. parsedValue: {
  25703. type: definePropType(Array)
  25704. }
  25705. });
  25706. const selectionModeWithDefault = (mode) => {
  25707. return {
  25708. type: String,
  25709. values: selectionModes,
  25710. default: mode
  25711. };
  25712. };
  25713. const panelDatePickProps = buildProps({
  25714. ...panelSharedProps,
  25715. parsedValue: {
  25716. type: definePropType([Object, Array])
  25717. },
  25718. visible: {
  25719. type: Boolean
  25720. },
  25721. format: {
  25722. type: String,
  25723. default: ""
  25724. }
  25725. });
  25726. const isValidRange = (range) => {
  25727. if (!isArray$1(range))
  25728. return false;
  25729. const [left, right] = range;
  25730. return dayjs.isDayjs(left) && dayjs.isDayjs(right) && left.isSameOrBefore(right);
  25731. };
  25732. const getDefaultValue = (defaultValue, { lang, unit, unlinkPanels }) => {
  25733. let start;
  25734. if (isArray$1(defaultValue)) {
  25735. let [left, right] = defaultValue.map((d) => dayjs(d).locale(lang));
  25736. if (!unlinkPanels) {
  25737. right = left.add(1, unit);
  25738. }
  25739. return [left, right];
  25740. } else if (defaultValue) {
  25741. start = dayjs(defaultValue);
  25742. } else {
  25743. start = dayjs();
  25744. }
  25745. start = start.locale(lang);
  25746. return [start, start.add(1, unit)];
  25747. };
  25748. const buildPickerTable = (dimension, rows, {
  25749. columnIndexOffset,
  25750. startDate,
  25751. nextEndDate,
  25752. now,
  25753. unit,
  25754. relativeDateGetter,
  25755. setCellMetadata,
  25756. setRowMetadata
  25757. }) => {
  25758. for (let rowIndex = 0; rowIndex < dimension.row; rowIndex++) {
  25759. const row = rows[rowIndex];
  25760. for (let columnIndex = 0; columnIndex < dimension.column; columnIndex++) {
  25761. let cell = row[columnIndex + columnIndexOffset];
  25762. if (!cell) {
  25763. cell = {
  25764. row: rowIndex,
  25765. column: columnIndex,
  25766. type: "normal",
  25767. inRange: false,
  25768. start: false,
  25769. end: false
  25770. };
  25771. }
  25772. const index = rowIndex * dimension.column + columnIndex;
  25773. const nextStartDate = relativeDateGetter(index);
  25774. cell.dayjs = nextStartDate;
  25775. cell.date = nextStartDate.toDate();
  25776. cell.timestamp = nextStartDate.valueOf();
  25777. cell.type = "normal";
  25778. cell.inRange = !!(startDate && nextStartDate.isSameOrAfter(startDate, unit) && nextEndDate && nextStartDate.isSameOrBefore(nextEndDate, unit)) || !!(startDate && nextStartDate.isSameOrBefore(startDate, unit) && nextEndDate && nextStartDate.isSameOrAfter(nextEndDate, unit));
  25779. if (startDate == null ? void 0 : startDate.isSameOrAfter(nextEndDate)) {
  25780. cell.start = !!nextEndDate && nextStartDate.isSame(nextEndDate, unit);
  25781. cell.end = startDate && nextStartDate.isSame(startDate, unit);
  25782. } else {
  25783. cell.start = !!startDate && nextStartDate.isSame(startDate, unit);
  25784. cell.end = !!nextEndDate && nextStartDate.isSame(nextEndDate, unit);
  25785. }
  25786. const isToday = nextStartDate.isSame(now, unit);
  25787. if (isToday) {
  25788. cell.type = "today";
  25789. }
  25790. setCellMetadata == null ? void 0 : setCellMetadata(cell, { rowIndex, columnIndex });
  25791. row[columnIndex + columnIndexOffset] = cell;
  25792. }
  25793. setRowMetadata == null ? void 0 : setRowMetadata(row);
  25794. }
  25795. };
  25796. const datesInMonth = (year, month, lang) => {
  25797. const firstDay = dayjs().locale(lang).startOf("month").month(month).year(year);
  25798. const numOfDays = firstDay.daysInMonth();
  25799. return rangeArr(numOfDays).map((n) => firstDay.add(n, "day").toDate());
  25800. };
  25801. const getValidDateOfMonth = (year, month, lang, disabledDate) => {
  25802. const _value = dayjs().year(year).month(month).startOf("month");
  25803. const _date = datesInMonth(year, month, lang).find((date) => {
  25804. return !(disabledDate == null ? void 0 : disabledDate(date));
  25805. });
  25806. if (_date) {
  25807. return dayjs(_date).locale(lang);
  25808. }
  25809. return _value.locale(lang);
  25810. };
  25811. const getValidDateOfYear = (value, lang, disabledDate) => {
  25812. const year = value.year();
  25813. if (!(disabledDate == null ? void 0 : disabledDate(value.toDate()))) {
  25814. return value.locale(lang);
  25815. }
  25816. const month = value.month();
  25817. if (!datesInMonth(year, month, lang).every(disabledDate)) {
  25818. return getValidDateOfMonth(year, month, lang, disabledDate);
  25819. }
  25820. for (let i = 0; i < 12; i++) {
  25821. if (!datesInMonth(year, i, lang).every(disabledDate)) {
  25822. return getValidDateOfMonth(year, i, lang, disabledDate);
  25823. }
  25824. }
  25825. return value;
  25826. };
  25827. const basicDateTableProps = buildProps({
  25828. ...datePickerSharedProps,
  25829. cellClassName: {
  25830. type: definePropType(Function)
  25831. },
  25832. showWeekNumber: Boolean,
  25833. selectionMode: selectionModeWithDefault("date")
  25834. });
  25835. const basicDateTableEmits = ["changerange", "pick", "select"];
  25836. const isNormalDay = (type = "") => {
  25837. return ["normal", "today"].includes(type);
  25838. };
  25839. const useBasicDateTable = (props, emit) => {
  25840. const { lang } = useLocale();
  25841. const tbodyRef = vue.ref();
  25842. const currentCellRef = vue.ref();
  25843. const lastRow = vue.ref();
  25844. const lastColumn = vue.ref();
  25845. const tableRows = vue.ref([[], [], [], [], [], []]);
  25846. let focusWithClick = false;
  25847. const firstDayOfWeek = props.date.$locale().weekStart || 7;
  25848. const WEEKS_CONSTANT = props.date.locale("en").localeData().weekdaysShort().map((_) => _.toLowerCase());
  25849. const offsetDay = vue.computed(() => {
  25850. return firstDayOfWeek > 3 ? 7 - firstDayOfWeek : -firstDayOfWeek;
  25851. });
  25852. const startDate = vue.computed(() => {
  25853. const startDayOfMonth = props.date.startOf("month");
  25854. return startDayOfMonth.subtract(startDayOfMonth.day() || 7, "day");
  25855. });
  25856. const WEEKS = vue.computed(() => {
  25857. return WEEKS_CONSTANT.concat(WEEKS_CONSTANT).slice(firstDayOfWeek, firstDayOfWeek + 7);
  25858. });
  25859. const hasCurrent = vue.computed(() => {
  25860. return flatten(vue.unref(rows)).some((row) => {
  25861. return row.isCurrent;
  25862. });
  25863. });
  25864. const days = vue.computed(() => {
  25865. const startOfMonth = props.date.startOf("month");
  25866. const startOfMonthDay = startOfMonth.day() || 7;
  25867. const dateCountOfMonth = startOfMonth.daysInMonth();
  25868. const dateCountOfLastMonth = startOfMonth.subtract(1, "month").daysInMonth();
  25869. return {
  25870. startOfMonthDay,
  25871. dateCountOfMonth,
  25872. dateCountOfLastMonth
  25873. };
  25874. });
  25875. const selectedDate = vue.computed(() => {
  25876. return props.selectionMode === "dates" ? castArray(props.parsedValue) : [];
  25877. });
  25878. const setDateText = (cell, { count, rowIndex, columnIndex }) => {
  25879. const { startOfMonthDay, dateCountOfMonth, dateCountOfLastMonth } = vue.unref(days);
  25880. const offset = vue.unref(offsetDay);
  25881. if (rowIndex >= 0 && rowIndex <= 1) {
  25882. const numberOfDaysFromPreviousMonth = startOfMonthDay + offset < 0 ? 7 + startOfMonthDay + offset : startOfMonthDay + offset;
  25883. if (columnIndex + rowIndex * 7 >= numberOfDaysFromPreviousMonth) {
  25884. cell.text = count;
  25885. return true;
  25886. } else {
  25887. cell.text = dateCountOfLastMonth - (numberOfDaysFromPreviousMonth - columnIndex % 7) + 1 + rowIndex * 7;
  25888. cell.type = "prev-month";
  25889. }
  25890. } else {
  25891. if (count <= dateCountOfMonth) {
  25892. cell.text = count;
  25893. } else {
  25894. cell.text = count - dateCountOfMonth;
  25895. cell.type = "next-month";
  25896. }
  25897. return true;
  25898. }
  25899. return false;
  25900. };
  25901. const setCellMetadata = (cell, { columnIndex, rowIndex }, count) => {
  25902. const { disabledDate, cellClassName } = props;
  25903. const _selectedDate = vue.unref(selectedDate);
  25904. const shouldIncrement = setDateText(cell, { count, rowIndex, columnIndex });
  25905. const cellDate = cell.dayjs.toDate();
  25906. cell.selected = _selectedDate.find((d) => d.isSame(cell.dayjs, "day"));
  25907. cell.isSelected = !!cell.selected;
  25908. cell.isCurrent = isCurrent(cell);
  25909. cell.disabled = disabledDate == null ? void 0 : disabledDate(cellDate);
  25910. cell.customClass = cellClassName == null ? void 0 : cellClassName(cellDate);
  25911. return shouldIncrement;
  25912. };
  25913. const setRowMetadata = (row) => {
  25914. if (props.selectionMode === "week") {
  25915. const [start, end] = props.showWeekNumber ? [1, 7] : [0, 6];
  25916. const isActive = isWeekActive(row[start + 1]);
  25917. row[start].inRange = isActive;
  25918. row[start].start = isActive;
  25919. row[end].inRange = isActive;
  25920. row[end].end = isActive;
  25921. }
  25922. };
  25923. const rows = vue.computed(() => {
  25924. const { minDate, maxDate, rangeState, showWeekNumber } = props;
  25925. const offset = vue.unref(offsetDay);
  25926. const rows_ = vue.unref(tableRows);
  25927. const dateUnit = "day";
  25928. let count = 1;
  25929. if (showWeekNumber) {
  25930. for (let rowIndex = 0; rowIndex < 6; rowIndex++) {
  25931. if (!rows_[rowIndex][0]) {
  25932. rows_[rowIndex][0] = {
  25933. type: "week",
  25934. text: vue.unref(startDate).add(rowIndex * 7 + 1, dateUnit).week()
  25935. };
  25936. }
  25937. }
  25938. }
  25939. buildPickerTable({ row: 6, column: 7 }, rows_, {
  25940. startDate: minDate,
  25941. columnIndexOffset: showWeekNumber ? 1 : 0,
  25942. nextEndDate: rangeState.endDate || maxDate || rangeState.selecting && minDate || null,
  25943. now: dayjs().locale(vue.unref(lang)).startOf(dateUnit),
  25944. unit: dateUnit,
  25945. relativeDateGetter: (idx) => vue.unref(startDate).add(idx - offset, dateUnit),
  25946. setCellMetadata: (...args) => {
  25947. if (setCellMetadata(...args, count)) {
  25948. count += 1;
  25949. }
  25950. },
  25951. setRowMetadata
  25952. });
  25953. return rows_;
  25954. });
  25955. vue.watch(() => props.date, async () => {
  25956. var _a;
  25957. if ((_a = vue.unref(tbodyRef)) == null ? void 0 : _a.contains(document.activeElement)) {
  25958. await vue.nextTick();
  25959. await focus();
  25960. }
  25961. });
  25962. const focus = async () => {
  25963. var _a;
  25964. return (_a = vue.unref(currentCellRef)) == null ? void 0 : _a.focus();
  25965. };
  25966. const isCurrent = (cell) => {
  25967. return props.selectionMode === "date" && isNormalDay(cell.type) && cellMatchesDate(cell, props.parsedValue);
  25968. };
  25969. const cellMatchesDate = (cell, date) => {
  25970. if (!date)
  25971. return false;
  25972. return dayjs(date).locale(vue.unref(lang)).isSame(props.date.date(Number(cell.text)), "day");
  25973. };
  25974. const getDateOfCell = (row, column) => {
  25975. const offsetFromStart = row * 7 + (column - (props.showWeekNumber ? 1 : 0)) - vue.unref(offsetDay);
  25976. return vue.unref(startDate).add(offsetFromStart, "day");
  25977. };
  25978. const handleMouseMove = (event) => {
  25979. var _a;
  25980. if (!props.rangeState.selecting)
  25981. return;
  25982. let target = event.target;
  25983. if (target.tagName === "SPAN") {
  25984. target = (_a = target.parentNode) == null ? void 0 : _a.parentNode;
  25985. }
  25986. if (target.tagName === "DIV") {
  25987. target = target.parentNode;
  25988. }
  25989. if (target.tagName !== "TD")
  25990. return;
  25991. const row = target.parentNode.rowIndex - 1;
  25992. const column = target.cellIndex;
  25993. if (vue.unref(rows)[row][column].disabled)
  25994. return;
  25995. if (row !== vue.unref(lastRow) || column !== vue.unref(lastColumn)) {
  25996. lastRow.value = row;
  25997. lastColumn.value = column;
  25998. emit("changerange", {
  25999. selecting: true,
  26000. endDate: getDateOfCell(row, column)
  26001. });
  26002. }
  26003. };
  26004. const isSelectedCell = (cell) => {
  26005. return !vue.unref(hasCurrent) && (cell == null ? void 0 : cell.text) === 1 && cell.type === "normal" || cell.isCurrent;
  26006. };
  26007. const handleFocus = (event) => {
  26008. if (focusWithClick || vue.unref(hasCurrent) || props.selectionMode !== "date")
  26009. return;
  26010. handlePickDate(event, true);
  26011. };
  26012. const handleMouseDown = (event) => {
  26013. const target = event.target.closest("td");
  26014. if (!target)
  26015. return;
  26016. focusWithClick = true;
  26017. };
  26018. const handleMouseUp = (event) => {
  26019. const target = event.target.closest("td");
  26020. if (!target)
  26021. return;
  26022. focusWithClick = false;
  26023. };
  26024. const handleRangePick = (newDate) => {
  26025. if (!props.rangeState.selecting || !props.minDate) {
  26026. emit("pick", { minDate: newDate, maxDate: null });
  26027. emit("select", true);
  26028. } else {
  26029. if (newDate >= props.minDate) {
  26030. emit("pick", { minDate: props.minDate, maxDate: newDate });
  26031. } else {
  26032. emit("pick", { minDate: newDate, maxDate: props.minDate });
  26033. }
  26034. emit("select", false);
  26035. }
  26036. };
  26037. const handleWeekPick = (newDate) => {
  26038. const weekNumber = newDate.week();
  26039. const value = `${newDate.year()}w${weekNumber}`;
  26040. emit("pick", {
  26041. year: newDate.year(),
  26042. week: weekNumber,
  26043. value,
  26044. date: newDate.startOf("week")
  26045. });
  26046. };
  26047. const handleDatesPick = (newDate, selected) => {
  26048. const newValue = selected ? castArray(props.parsedValue).filter((d) => (d == null ? void 0 : d.valueOf()) !== newDate.valueOf()) : castArray(props.parsedValue).concat([newDate]);
  26049. emit("pick", newValue);
  26050. };
  26051. const handlePickDate = (event, isKeyboardMovement = false) => {
  26052. const target = event.target.closest("td");
  26053. if (!target)
  26054. return;
  26055. const row = target.parentNode.rowIndex - 1;
  26056. const column = target.cellIndex;
  26057. const cell = vue.unref(rows)[row][column];
  26058. if (cell.disabled || cell.type === "week")
  26059. return;
  26060. const newDate = getDateOfCell(row, column);
  26061. switch (props.selectionMode) {
  26062. case "range": {
  26063. handleRangePick(newDate);
  26064. break;
  26065. }
  26066. case "date": {
  26067. emit("pick", newDate, isKeyboardMovement);
  26068. break;
  26069. }
  26070. case "week": {
  26071. handleWeekPick(newDate);
  26072. break;
  26073. }
  26074. case "dates": {
  26075. handleDatesPick(newDate, !!cell.selected);
  26076. break;
  26077. }
  26078. }
  26079. };
  26080. const isWeekActive = (cell) => {
  26081. if (props.selectionMode !== "week")
  26082. return false;
  26083. let newDate = props.date.startOf("day");
  26084. if (cell.type === "prev-month") {
  26085. newDate = newDate.subtract(1, "month");
  26086. }
  26087. if (cell.type === "next-month") {
  26088. newDate = newDate.add(1, "month");
  26089. }
  26090. newDate = newDate.date(Number.parseInt(cell.text, 10));
  26091. if (props.parsedValue && !isArray$1(props.parsedValue)) {
  26092. const dayOffset = (props.parsedValue.day() - firstDayOfWeek + 7) % 7 - 1;
  26093. const weekDate = props.parsedValue.subtract(dayOffset, "day");
  26094. return weekDate.isSame(newDate, "day");
  26095. }
  26096. return false;
  26097. };
  26098. return {
  26099. WEEKS,
  26100. rows,
  26101. tbodyRef,
  26102. currentCellRef,
  26103. focus,
  26104. isCurrent,
  26105. isWeekActive,
  26106. isSelectedCell,
  26107. handlePickDate,
  26108. handleMouseUp,
  26109. handleMouseDown,
  26110. handleMouseMove,
  26111. handleFocus
  26112. };
  26113. };
  26114. const useBasicDateTableDOM = (props, {
  26115. isCurrent,
  26116. isWeekActive
  26117. }) => {
  26118. const ns = useNamespace("date-table");
  26119. const { t } = useLocale();
  26120. const tableKls = vue.computed(() => [
  26121. ns.b(),
  26122. { "is-week-mode": props.selectionMode === "week" }
  26123. ]);
  26124. const tableLabel = vue.computed(() => t("el.datepicker.dateTablePrompt"));
  26125. const weekLabel = vue.computed(() => t("el.datepicker.week"));
  26126. const getCellClasses = (cell) => {
  26127. const classes = [];
  26128. if (isNormalDay(cell.type) && !cell.disabled) {
  26129. classes.push("available");
  26130. if (cell.type === "today") {
  26131. classes.push("today");
  26132. }
  26133. } else {
  26134. classes.push(cell.type);
  26135. }
  26136. if (isCurrent(cell)) {
  26137. classes.push("current");
  26138. }
  26139. if (cell.inRange && (isNormalDay(cell.type) || props.selectionMode === "week")) {
  26140. classes.push("in-range");
  26141. if (cell.start) {
  26142. classes.push("start-date");
  26143. }
  26144. if (cell.end) {
  26145. classes.push("end-date");
  26146. }
  26147. }
  26148. if (cell.disabled) {
  26149. classes.push("disabled");
  26150. }
  26151. if (cell.selected) {
  26152. classes.push("selected");
  26153. }
  26154. if (cell.customClass) {
  26155. classes.push(cell.customClass);
  26156. }
  26157. return classes.join(" ");
  26158. };
  26159. const getRowKls = (cell) => [
  26160. ns.e("row"),
  26161. { current: isWeekActive(cell) }
  26162. ];
  26163. return {
  26164. tableKls,
  26165. tableLabel,
  26166. weekLabel,
  26167. getCellClasses,
  26168. getRowKls,
  26169. t
  26170. };
  26171. };
  26172. const basicCellProps = buildProps({
  26173. cell: {
  26174. type: definePropType(Object)
  26175. }
  26176. });
  26177. var ElDatePickerCell = vue.defineComponent({
  26178. name: "ElDatePickerCell",
  26179. props: basicCellProps,
  26180. setup(props) {
  26181. const ns = useNamespace("date-table-cell");
  26182. const {
  26183. slots
  26184. } = vue.inject(ROOT_PICKER_INJECTION_KEY);
  26185. return () => {
  26186. const {
  26187. cell
  26188. } = props;
  26189. return vue.renderSlot(slots, "default", {
  26190. ...cell
  26191. }, () => {
  26192. var _a;
  26193. return [vue.createVNode("div", {
  26194. "class": ns.b()
  26195. }, [vue.createVNode("span", {
  26196. "class": ns.e("text")
  26197. }, [(_a = cell == null ? void 0 : cell.renderText) != null ? _a : cell == null ? void 0 : cell.text])])];
  26198. });
  26199. };
  26200. }
  26201. });
  26202. const _sfc_main$1y = /* @__PURE__ */ vue.defineComponent({
  26203. __name: "basic-date-table",
  26204. props: basicDateTableProps,
  26205. emits: basicDateTableEmits,
  26206. setup(__props, { expose, emit }) {
  26207. const props = __props;
  26208. const {
  26209. WEEKS,
  26210. rows,
  26211. tbodyRef,
  26212. currentCellRef,
  26213. focus,
  26214. isCurrent,
  26215. isWeekActive,
  26216. isSelectedCell,
  26217. handlePickDate,
  26218. handleMouseUp,
  26219. handleMouseDown,
  26220. handleMouseMove,
  26221. handleFocus
  26222. } = useBasicDateTable(props, emit);
  26223. const { tableLabel, tableKls, weekLabel, getCellClasses, getRowKls, t } = useBasicDateTableDOM(props, {
  26224. isCurrent,
  26225. isWeekActive
  26226. });
  26227. expose({
  26228. focus
  26229. });
  26230. return (_ctx, _cache) => {
  26231. return vue.openBlock(), vue.createElementBlock("table", {
  26232. "aria-label": vue.unref(tableLabel),
  26233. class: vue.normalizeClass(vue.unref(tableKls)),
  26234. cellspacing: "0",
  26235. cellpadding: "0",
  26236. role: "grid",
  26237. onClick: vue.unref(handlePickDate),
  26238. onMousemove: vue.unref(handleMouseMove),
  26239. onMousedown: vue.withModifiers(vue.unref(handleMouseDown), ["prevent"]),
  26240. onMouseup: vue.unref(handleMouseUp)
  26241. }, [
  26242. vue.createElementVNode("tbody", {
  26243. ref_key: "tbodyRef",
  26244. ref: tbodyRef
  26245. }, [
  26246. vue.createElementVNode("tr", null, [
  26247. _ctx.showWeekNumber ? (vue.openBlock(), vue.createElementBlock("th", {
  26248. key: 0,
  26249. scope: "col"
  26250. }, vue.toDisplayString(vue.unref(weekLabel)), 1)) : vue.createCommentVNode("v-if", true),
  26251. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(WEEKS), (week, key) => {
  26252. return vue.openBlock(), vue.createElementBlock("th", {
  26253. key,
  26254. "aria-label": vue.unref(t)("el.datepicker.weeksFull." + week),
  26255. scope: "col"
  26256. }, vue.toDisplayString(vue.unref(t)("el.datepicker.weeks." + week)), 9, ["aria-label"]);
  26257. }), 128))
  26258. ]),
  26259. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(rows), (row, rowKey) => {
  26260. return vue.openBlock(), vue.createElementBlock("tr", {
  26261. key: rowKey,
  26262. class: vue.normalizeClass(vue.unref(getRowKls)(row[1]))
  26263. }, [
  26264. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(row, (cell, columnKey) => {
  26265. return vue.openBlock(), vue.createElementBlock("td", {
  26266. key: `${rowKey}.${columnKey}`,
  26267. ref_for: true,
  26268. ref: (el) => vue.unref(isSelectedCell)(cell) && (currentCellRef.value = el),
  26269. class: vue.normalizeClass(vue.unref(getCellClasses)(cell)),
  26270. "aria-current": cell.isCurrent ? "date" : void 0,
  26271. "aria-selected": cell.isCurrent,
  26272. tabindex: vue.unref(isSelectedCell)(cell) ? 0 : -1,
  26273. onFocus: vue.unref(handleFocus)
  26274. }, [
  26275. vue.createVNode(vue.unref(ElDatePickerCell), { cell }, null, 8, ["cell"])
  26276. ], 42, ["aria-current", "aria-selected", "tabindex", "onFocus"]);
  26277. }), 128))
  26278. ], 2);
  26279. }), 128))
  26280. ], 512)
  26281. ], 42, ["aria-label", "onClick", "onMousemove", "onMousedown", "onMouseup"]);
  26282. };
  26283. }
  26284. });
  26285. var DateTable = /* @__PURE__ */ _export_sfc(_sfc_main$1y, [["__file", "basic-date-table.vue"]]);
  26286. const basicMonthTableProps = buildProps({
  26287. ...datePickerSharedProps,
  26288. selectionMode: selectionModeWithDefault("month")
  26289. });
  26290. const _sfc_main$1x = /* @__PURE__ */ vue.defineComponent({
  26291. __name: "basic-month-table",
  26292. props: basicMonthTableProps,
  26293. emits: ["changerange", "pick", "select"],
  26294. setup(__props, { expose, emit }) {
  26295. const props = __props;
  26296. const ns = useNamespace("month-table");
  26297. const { t, lang } = useLocale();
  26298. const tbodyRef = vue.ref();
  26299. const currentCellRef = vue.ref();
  26300. const months = vue.ref(props.date.locale("en").localeData().monthsShort().map((_) => _.toLowerCase()));
  26301. const tableRows = vue.ref([
  26302. [],
  26303. [],
  26304. []
  26305. ]);
  26306. const lastRow = vue.ref();
  26307. const lastColumn = vue.ref();
  26308. const rows = vue.computed(() => {
  26309. var _a, _b;
  26310. const rows2 = tableRows.value;
  26311. const now = dayjs().locale(lang.value).startOf("month");
  26312. for (let i = 0; i < 3; i++) {
  26313. const row = rows2[i];
  26314. for (let j = 0; j < 4; j++) {
  26315. const cell = row[j] || (row[j] = {
  26316. row: i,
  26317. column: j,
  26318. type: "normal",
  26319. inRange: false,
  26320. start: false,
  26321. end: false,
  26322. text: -1,
  26323. disabled: false
  26324. });
  26325. cell.type = "normal";
  26326. const index = i * 4 + j;
  26327. const calTime = props.date.startOf("year").month(index);
  26328. const calEndDate = props.rangeState.endDate || props.maxDate || props.rangeState.selecting && props.minDate || null;
  26329. cell.inRange = !!(props.minDate && calTime.isSameOrAfter(props.minDate, "month") && calEndDate && calTime.isSameOrBefore(calEndDate, "month")) || !!(props.minDate && calTime.isSameOrBefore(props.minDate, "month") && calEndDate && calTime.isSameOrAfter(calEndDate, "month"));
  26330. if ((_a = props.minDate) == null ? void 0 : _a.isSameOrAfter(calEndDate)) {
  26331. cell.start = !!(calEndDate && calTime.isSame(calEndDate, "month"));
  26332. cell.end = props.minDate && calTime.isSame(props.minDate, "month");
  26333. } else {
  26334. cell.start = !!(props.minDate && calTime.isSame(props.minDate, "month"));
  26335. cell.end = !!(calEndDate && calTime.isSame(calEndDate, "month"));
  26336. }
  26337. const isToday = now.isSame(calTime);
  26338. if (isToday) {
  26339. cell.type = "today";
  26340. }
  26341. cell.text = index;
  26342. cell.disabled = ((_b = props.disabledDate) == null ? void 0 : _b.call(props, calTime.toDate())) || false;
  26343. }
  26344. }
  26345. return rows2;
  26346. });
  26347. const focus = () => {
  26348. var _a;
  26349. (_a = currentCellRef.value) == null ? void 0 : _a.focus();
  26350. };
  26351. const getCellStyle = (cell) => {
  26352. const style = {};
  26353. const year = props.date.year();
  26354. const today = /* @__PURE__ */ new Date();
  26355. const month = cell.text;
  26356. style.disabled = props.disabledDate ? datesInMonth(year, month, lang.value).every(props.disabledDate) : false;
  26357. style.current = castArray(props.parsedValue).findIndex((date) => dayjs.isDayjs(date) && date.year() === year && date.month() === month) >= 0;
  26358. style.today = today.getFullYear() === year && today.getMonth() === month;
  26359. if (cell.inRange) {
  26360. style["in-range"] = true;
  26361. if (cell.start) {
  26362. style["start-date"] = true;
  26363. }
  26364. if (cell.end) {
  26365. style["end-date"] = true;
  26366. }
  26367. }
  26368. return style;
  26369. };
  26370. const isSelectedCell = (cell) => {
  26371. const year = props.date.year();
  26372. const month = cell.text;
  26373. return castArray(props.date).findIndex((date) => date.year() === year && date.month() === month) >= 0;
  26374. };
  26375. const handleMouseMove = (event) => {
  26376. var _a;
  26377. if (!props.rangeState.selecting)
  26378. return;
  26379. let target = event.target;
  26380. if (target.tagName === "SPAN") {
  26381. target = (_a = target.parentNode) == null ? void 0 : _a.parentNode;
  26382. }
  26383. if (target.tagName === "DIV") {
  26384. target = target.parentNode;
  26385. }
  26386. if (target.tagName !== "TD")
  26387. return;
  26388. const row = target.parentNode.rowIndex;
  26389. const column = target.cellIndex;
  26390. if (rows.value[row][column].disabled)
  26391. return;
  26392. if (row !== lastRow.value || column !== lastColumn.value) {
  26393. lastRow.value = row;
  26394. lastColumn.value = column;
  26395. emit("changerange", {
  26396. selecting: true,
  26397. endDate: props.date.startOf("year").month(row * 4 + column)
  26398. });
  26399. }
  26400. };
  26401. const handleMonthTableClick = (event) => {
  26402. var _a;
  26403. const target = (_a = event.target) == null ? void 0 : _a.closest("td");
  26404. if ((target == null ? void 0 : target.tagName) !== "TD")
  26405. return;
  26406. if (hasClass(target, "disabled"))
  26407. return;
  26408. const column = target.cellIndex;
  26409. const row = target.parentNode.rowIndex;
  26410. const month = row * 4 + column;
  26411. const newDate = props.date.startOf("year").month(month);
  26412. if (props.selectionMode === "months") {
  26413. if (event.type === "keydown") {
  26414. emit("pick", castArray(props.parsedValue), false);
  26415. return;
  26416. }
  26417. const newMonth = getValidDateOfMonth(props.date.year(), month, lang.value, props.disabledDate);
  26418. const newValue = hasClass(target, "current") ? castArray(props.parsedValue).filter((d) => (d == null ? void 0 : d.month()) !== newMonth.month()) : castArray(props.parsedValue).concat([dayjs(newMonth)]);
  26419. emit("pick", newValue);
  26420. } else if (props.selectionMode === "range") {
  26421. if (!props.rangeState.selecting) {
  26422. emit("pick", { minDate: newDate, maxDate: null });
  26423. emit("select", true);
  26424. } else {
  26425. if (props.minDate && newDate >= props.minDate) {
  26426. emit("pick", { minDate: props.minDate, maxDate: newDate });
  26427. } else {
  26428. emit("pick", { minDate: newDate, maxDate: props.minDate });
  26429. }
  26430. emit("select", false);
  26431. }
  26432. } else {
  26433. emit("pick", month);
  26434. }
  26435. };
  26436. vue.watch(() => props.date, async () => {
  26437. var _a, _b;
  26438. if ((_a = tbodyRef.value) == null ? void 0 : _a.contains(document.activeElement)) {
  26439. await vue.nextTick();
  26440. (_b = currentCellRef.value) == null ? void 0 : _b.focus();
  26441. }
  26442. });
  26443. expose({
  26444. focus
  26445. });
  26446. return (_ctx, _cache) => {
  26447. return vue.openBlock(), vue.createElementBlock("table", {
  26448. role: "grid",
  26449. "aria-label": vue.unref(t)("el.datepicker.monthTablePrompt"),
  26450. class: vue.normalizeClass(vue.unref(ns).b()),
  26451. onClick: handleMonthTableClick,
  26452. onMousemove: handleMouseMove
  26453. }, [
  26454. vue.createElementVNode("tbody", {
  26455. ref_key: "tbodyRef",
  26456. ref: tbodyRef
  26457. }, [
  26458. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(rows), (row, key) => {
  26459. return vue.openBlock(), vue.createElementBlock("tr", { key }, [
  26460. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(row, (cell, key_) => {
  26461. return vue.openBlock(), vue.createElementBlock("td", {
  26462. key: key_,
  26463. ref_for: true,
  26464. ref: (el) => isSelectedCell(cell) && (currentCellRef.value = el),
  26465. class: vue.normalizeClass(getCellStyle(cell)),
  26466. "aria-selected": `${isSelectedCell(cell)}`,
  26467. "aria-label": vue.unref(t)(`el.datepicker.month${+cell.text + 1}`),
  26468. tabindex: isSelectedCell(cell) ? 0 : -1,
  26469. onKeydown: [
  26470. vue.withKeys(vue.withModifiers(handleMonthTableClick, ["prevent", "stop"]), ["space"]),
  26471. vue.withKeys(vue.withModifiers(handleMonthTableClick, ["prevent", "stop"]), ["enter"])
  26472. ]
  26473. }, [
  26474. vue.createVNode(vue.unref(ElDatePickerCell), {
  26475. cell: {
  26476. ...cell,
  26477. renderText: vue.unref(t)("el.datepicker.months." + months.value[cell.text])
  26478. }
  26479. }, null, 8, ["cell"])
  26480. ], 42, ["aria-selected", "aria-label", "tabindex", "onKeydown"]);
  26481. }), 128))
  26482. ]);
  26483. }), 128))
  26484. ], 512)
  26485. ], 42, ["aria-label"]);
  26486. };
  26487. }
  26488. });
  26489. var MonthTable = /* @__PURE__ */ _export_sfc(_sfc_main$1x, [["__file", "basic-month-table.vue"]]);
  26490. const basicYearTableProps = buildProps({
  26491. ...datePickerSharedProps,
  26492. selectionMode: selectionModeWithDefault("year")
  26493. });
  26494. const _sfc_main$1w = /* @__PURE__ */ vue.defineComponent({
  26495. __name: "basic-year-table",
  26496. props: basicYearTableProps,
  26497. emits: ["changerange", "pick", "select"],
  26498. setup(__props, { expose, emit }) {
  26499. const props = __props;
  26500. const datesInYear = (year, lang2) => {
  26501. const firstDay = dayjs(String(year)).locale(lang2).startOf("year");
  26502. const lastDay = firstDay.endOf("year");
  26503. const numOfDays = lastDay.dayOfYear();
  26504. return rangeArr(numOfDays).map((n) => firstDay.add(n, "day").toDate());
  26505. };
  26506. const ns = useNamespace("year-table");
  26507. const { t, lang } = useLocale();
  26508. const tbodyRef = vue.ref();
  26509. const currentCellRef = vue.ref();
  26510. const startYear = vue.computed(() => {
  26511. return Math.floor(props.date.year() / 10) * 10;
  26512. });
  26513. const tableRows = vue.ref([[], [], []]);
  26514. const lastRow = vue.ref();
  26515. const lastColumn = vue.ref();
  26516. const rows = vue.computed(() => {
  26517. var _a;
  26518. const rows2 = tableRows.value;
  26519. const now = dayjs().locale(lang.value).startOf("year");
  26520. for (let i = 0; i < 3; i++) {
  26521. const row = rows2[i];
  26522. for (let j = 0; j < 4; j++) {
  26523. if (i * 4 + j >= 10) {
  26524. break;
  26525. }
  26526. let cell = row[j];
  26527. if (!cell) {
  26528. cell = {
  26529. row: i,
  26530. column: j,
  26531. type: "normal",
  26532. inRange: false,
  26533. start: false,
  26534. end: false,
  26535. text: -1,
  26536. disabled: false
  26537. };
  26538. }
  26539. cell.type = "normal";
  26540. const index = i * 4 + j + startYear.value;
  26541. const calTime = dayjs().year(index);
  26542. const calEndDate = props.rangeState.endDate || props.maxDate || props.rangeState.selecting && props.minDate || null;
  26543. cell.inRange = !!(props.minDate && calTime.isSameOrAfter(props.minDate, "year") && calEndDate && calTime.isSameOrBefore(calEndDate, "year")) || !!(props.minDate && calTime.isSameOrBefore(props.minDate, "year") && calEndDate && calTime.isSameOrAfter(calEndDate, "year"));
  26544. if ((_a = props.minDate) == null ? void 0 : _a.isSameOrAfter(calEndDate)) {
  26545. cell.start = !!(calEndDate && calTime.isSame(calEndDate, "year"));
  26546. cell.end = !!(props.minDate && calTime.isSame(props.minDate, "year"));
  26547. } else {
  26548. cell.start = !!(props.minDate && calTime.isSame(props.minDate, "year"));
  26549. cell.end = !!(calEndDate && calTime.isSame(calEndDate, "year"));
  26550. }
  26551. const isToday = now.isSame(calTime);
  26552. if (isToday) {
  26553. cell.type = "today";
  26554. }
  26555. cell.text = index;
  26556. const cellDate = calTime.toDate();
  26557. cell.disabled = props.disabledDate && props.disabledDate(cellDate) || false;
  26558. row[j] = cell;
  26559. }
  26560. }
  26561. return rows2;
  26562. });
  26563. const focus = () => {
  26564. var _a;
  26565. (_a = currentCellRef.value) == null ? void 0 : _a.focus();
  26566. };
  26567. const getCellKls = (cell) => {
  26568. const kls = {};
  26569. const today = dayjs().locale(lang.value);
  26570. const year = cell.text;
  26571. kls.disabled = props.disabledDate ? datesInYear(year, lang.value).every(props.disabledDate) : false;
  26572. kls.today = today.year() === year;
  26573. kls.current = castArray(props.parsedValue).findIndex((d) => d.year() === year) >= 0;
  26574. if (cell.inRange) {
  26575. kls["in-range"] = true;
  26576. if (cell.start) {
  26577. kls["start-date"] = true;
  26578. }
  26579. if (cell.end) {
  26580. kls["end-date"] = true;
  26581. }
  26582. }
  26583. return kls;
  26584. };
  26585. const isSelectedCell = (cell) => {
  26586. const year = cell.text;
  26587. return castArray(props.date).findIndex((date) => date.year() === year) >= 0;
  26588. };
  26589. const handleYearTableClick = (event) => {
  26590. var _a;
  26591. const target = (_a = event.target) == null ? void 0 : _a.closest("td");
  26592. if (!target || !target.textContent || hasClass(target, "disabled"))
  26593. return;
  26594. const column = target.cellIndex;
  26595. const row = target.parentNode.rowIndex;
  26596. const selectedYear = row * 4 + column + startYear.value;
  26597. const newDate = dayjs().year(selectedYear);
  26598. if (props.selectionMode === "range") {
  26599. if (!props.rangeState.selecting) {
  26600. emit("pick", { minDate: newDate, maxDate: null });
  26601. emit("select", true);
  26602. } else {
  26603. if (props.minDate && newDate >= props.minDate) {
  26604. emit("pick", { minDate: props.minDate, maxDate: newDate });
  26605. } else {
  26606. emit("pick", { minDate: newDate, maxDate: props.minDate });
  26607. }
  26608. emit("select", false);
  26609. }
  26610. } else if (props.selectionMode === "years") {
  26611. if (event.type === "keydown") {
  26612. emit("pick", castArray(props.parsedValue), false);
  26613. return;
  26614. }
  26615. const vaildYear = getValidDateOfYear(newDate.startOf("year"), lang.value, props.disabledDate);
  26616. const newValue = hasClass(target, "current") ? castArray(props.parsedValue).filter((d) => (d == null ? void 0 : d.year()) !== selectedYear) : castArray(props.parsedValue).concat([vaildYear]);
  26617. emit("pick", newValue);
  26618. } else {
  26619. emit("pick", selectedYear);
  26620. }
  26621. };
  26622. const handleMouseMove = (event) => {
  26623. var _a;
  26624. if (!props.rangeState.selecting)
  26625. return;
  26626. const target = (_a = event.target) == null ? void 0 : _a.closest("td");
  26627. if (!target)
  26628. return;
  26629. const row = target.parentNode.rowIndex;
  26630. const column = target.cellIndex;
  26631. if (rows.value[row][column].disabled)
  26632. return;
  26633. if (row !== lastRow.value || column !== lastColumn.value) {
  26634. lastRow.value = row;
  26635. lastColumn.value = column;
  26636. emit("changerange", {
  26637. selecting: true,
  26638. endDate: dayjs().year(startYear.value).add(row * 4 + column, "year")
  26639. });
  26640. }
  26641. };
  26642. vue.watch(() => props.date, async () => {
  26643. var _a, _b;
  26644. if ((_a = tbodyRef.value) == null ? void 0 : _a.contains(document.activeElement)) {
  26645. await vue.nextTick();
  26646. (_b = currentCellRef.value) == null ? void 0 : _b.focus();
  26647. }
  26648. });
  26649. expose({
  26650. focus
  26651. });
  26652. return (_ctx, _cache) => {
  26653. return vue.openBlock(), vue.createElementBlock("table", {
  26654. role: "grid",
  26655. "aria-label": vue.unref(t)("el.datepicker.yearTablePrompt"),
  26656. class: vue.normalizeClass(vue.unref(ns).b()),
  26657. onClick: handleYearTableClick,
  26658. onMousemove: handleMouseMove
  26659. }, [
  26660. vue.createElementVNode("tbody", {
  26661. ref_key: "tbodyRef",
  26662. ref: tbodyRef
  26663. }, [
  26664. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(rows), (row, rowKey) => {
  26665. return vue.openBlock(), vue.createElementBlock("tr", { key: rowKey }, [
  26666. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(row, (cell, cellKey) => {
  26667. return vue.openBlock(), vue.createElementBlock("td", {
  26668. key: `${rowKey}_${cellKey}`,
  26669. ref_for: true,
  26670. ref: (el) => isSelectedCell(cell) && (currentCellRef.value = el),
  26671. class: vue.normalizeClass(["available", getCellKls(cell)]),
  26672. "aria-selected": isSelectedCell(cell),
  26673. "aria-label": String(cell.text),
  26674. tabindex: isSelectedCell(cell) ? 0 : -1,
  26675. onKeydown: [
  26676. vue.withKeys(vue.withModifiers(handleYearTableClick, ["prevent", "stop"]), ["space"]),
  26677. vue.withKeys(vue.withModifiers(handleYearTableClick, ["prevent", "stop"]), ["enter"])
  26678. ]
  26679. }, [
  26680. vue.createVNode(vue.unref(ElDatePickerCell), { cell }, null, 8, ["cell"])
  26681. ], 42, ["aria-selected", "aria-label", "tabindex", "onKeydown"]);
  26682. }), 128))
  26683. ]);
  26684. }), 128))
  26685. ], 512)
  26686. ], 42, ["aria-label"]);
  26687. };
  26688. }
  26689. });
  26690. var YearTable = /* @__PURE__ */ _export_sfc(_sfc_main$1w, [["__file", "basic-year-table.vue"]]);
  26691. const _sfc_main$1v = /* @__PURE__ */ vue.defineComponent({
  26692. __name: "panel-date-pick",
  26693. props: panelDatePickProps,
  26694. emits: ["pick", "set-picker-option", "panel-change"],
  26695. setup(__props, { emit: contextEmit }) {
  26696. const props = __props;
  26697. const timeWithinRange = (_, __, ___) => true;
  26698. const ppNs = useNamespace("picker-panel");
  26699. const dpNs = useNamespace("date-picker");
  26700. const attrs = vue.useAttrs();
  26701. const slots = vue.useSlots();
  26702. const { t, lang } = useLocale();
  26703. const pickerBase = vue.inject("EP_PICKER_BASE");
  26704. const popper = vue.inject(TOOLTIP_INJECTION_KEY);
  26705. const { shortcuts, disabledDate, cellClassName, defaultTime } = pickerBase.props;
  26706. const defaultValue = vue.toRef(pickerBase.props, "defaultValue");
  26707. const currentViewRef = vue.ref();
  26708. const innerDate = vue.ref(dayjs().locale(lang.value));
  26709. const isChangeToNow = vue.ref(false);
  26710. let isShortcut = false;
  26711. const defaultTimeD = vue.computed(() => {
  26712. return dayjs(defaultTime).locale(lang.value);
  26713. });
  26714. const month = vue.computed(() => {
  26715. return innerDate.value.month();
  26716. });
  26717. const year = vue.computed(() => {
  26718. return innerDate.value.year();
  26719. });
  26720. const selectableRange = vue.ref([]);
  26721. const userInputDate = vue.ref(null);
  26722. const userInputTime = vue.ref(null);
  26723. const checkDateWithinRange = (date) => {
  26724. return selectableRange.value.length > 0 ? timeWithinRange(date, selectableRange.value, props.format || "HH:mm:ss") : true;
  26725. };
  26726. const formatEmit = (emitDayjs) => {
  26727. if (defaultTime && !visibleTime.value && !isChangeToNow.value && !isShortcut) {
  26728. return defaultTimeD.value.year(emitDayjs.year()).month(emitDayjs.month()).date(emitDayjs.date());
  26729. }
  26730. if (showTime.value)
  26731. return emitDayjs.millisecond(0);
  26732. return emitDayjs.startOf("day");
  26733. };
  26734. const emit = (value, ...args) => {
  26735. if (!value) {
  26736. contextEmit("pick", value, ...args);
  26737. } else if (isArray$1(value)) {
  26738. const dates = value.map(formatEmit);
  26739. contextEmit("pick", dates, ...args);
  26740. } else {
  26741. contextEmit("pick", formatEmit(value), ...args);
  26742. }
  26743. userInputDate.value = null;
  26744. userInputTime.value = null;
  26745. isChangeToNow.value = false;
  26746. isShortcut = false;
  26747. };
  26748. const handleDatePick = async (value, keepOpen) => {
  26749. if (selectionMode.value === "date") {
  26750. value = value;
  26751. let newDate = props.parsedValue ? props.parsedValue.year(value.year()).month(value.month()).date(value.date()) : value;
  26752. if (!checkDateWithinRange(newDate)) {
  26753. newDate = selectableRange.value[0][0].year(value.year()).month(value.month()).date(value.date());
  26754. }
  26755. innerDate.value = newDate;
  26756. emit(newDate, showTime.value || keepOpen);
  26757. if (props.type === "datetime") {
  26758. await vue.nextTick();
  26759. handleFocusPicker();
  26760. }
  26761. } else if (selectionMode.value === "week") {
  26762. emit(value.date);
  26763. } else if (selectionMode.value === "dates") {
  26764. emit(value, true);
  26765. }
  26766. };
  26767. const moveByMonth = (forward) => {
  26768. const action = forward ? "add" : "subtract";
  26769. innerDate.value = innerDate.value[action](1, "month");
  26770. handlePanelChange("month");
  26771. };
  26772. const moveByYear = (forward) => {
  26773. const currentDate = innerDate.value;
  26774. const action = forward ? "add" : "subtract";
  26775. innerDate.value = currentView.value === "year" ? currentDate[action](10, "year") : currentDate[action](1, "year");
  26776. handlePanelChange("year");
  26777. };
  26778. const currentView = vue.ref("date");
  26779. const yearLabel = vue.computed(() => {
  26780. const yearTranslation = t("el.datepicker.year");
  26781. if (currentView.value === "year") {
  26782. const startYear = Math.floor(year.value / 10) * 10;
  26783. if (yearTranslation) {
  26784. return `${startYear} ${yearTranslation} - ${startYear + 9} ${yearTranslation}`;
  26785. }
  26786. return `${startYear} - ${startYear + 9}`;
  26787. }
  26788. return `${year.value} ${yearTranslation}`;
  26789. });
  26790. const handleShortcutClick = (shortcut) => {
  26791. const shortcutValue = isFunction$1(shortcut.value) ? shortcut.value() : shortcut.value;
  26792. if (shortcutValue) {
  26793. isShortcut = true;
  26794. emit(dayjs(shortcutValue).locale(lang.value));
  26795. return;
  26796. }
  26797. if (shortcut.onClick) {
  26798. shortcut.onClick({
  26799. attrs,
  26800. slots,
  26801. emit: contextEmit
  26802. });
  26803. }
  26804. };
  26805. const selectionMode = vue.computed(() => {
  26806. const { type } = props;
  26807. if (["week", "month", "months", "year", "years", "dates"].includes(type))
  26808. return type;
  26809. return "date";
  26810. });
  26811. const isMultipleType = vue.computed(() => {
  26812. return selectionMode.value === "dates" || selectionMode.value === "months" || selectionMode.value === "years";
  26813. });
  26814. const keyboardMode = vue.computed(() => {
  26815. return selectionMode.value === "date" ? currentView.value : selectionMode.value;
  26816. });
  26817. const hasShortcuts = vue.computed(() => !!shortcuts.length);
  26818. const handleMonthPick = async (month2, keepOpen) => {
  26819. if (selectionMode.value === "month") {
  26820. innerDate.value = getValidDateOfMonth(innerDate.value.year(), month2, lang.value, disabledDate);
  26821. emit(innerDate.value, false);
  26822. } else if (selectionMode.value === "months") {
  26823. emit(month2, keepOpen != null ? keepOpen : true);
  26824. } else {
  26825. innerDate.value = getValidDateOfMonth(innerDate.value.year(), month2, lang.value, disabledDate);
  26826. currentView.value = "date";
  26827. if (["month", "year", "date", "week"].includes(selectionMode.value)) {
  26828. emit(innerDate.value, true);
  26829. await vue.nextTick();
  26830. handleFocusPicker();
  26831. }
  26832. }
  26833. handlePanelChange("month");
  26834. };
  26835. const handleYearPick = async (year2, keepOpen) => {
  26836. if (selectionMode.value === "year") {
  26837. const data = innerDate.value.startOf("year").year(year2);
  26838. innerDate.value = getValidDateOfYear(data, lang.value, disabledDate);
  26839. emit(innerDate.value, false);
  26840. } else if (selectionMode.value === "years") {
  26841. emit(year2, keepOpen != null ? keepOpen : true);
  26842. } else {
  26843. const data = innerDate.value.year(year2);
  26844. innerDate.value = getValidDateOfYear(data, lang.value, disabledDate);
  26845. currentView.value = "month";
  26846. if (["month", "year", "date", "week"].includes(selectionMode.value)) {
  26847. emit(innerDate.value, true);
  26848. await vue.nextTick();
  26849. handleFocusPicker();
  26850. }
  26851. }
  26852. handlePanelChange("year");
  26853. };
  26854. const showPicker = async (view) => {
  26855. currentView.value = view;
  26856. await vue.nextTick();
  26857. handleFocusPicker();
  26858. };
  26859. const showTime = vue.computed(() => props.type === "datetime" || props.type === "datetimerange");
  26860. const footerVisible = vue.computed(() => {
  26861. const showDateFooter = showTime.value || selectionMode.value === "dates";
  26862. const showYearFooter = selectionMode.value === "years";
  26863. const showMonthFooter = selectionMode.value === "months";
  26864. const isDateView = currentView.value === "date";
  26865. const isYearView = currentView.value === "year";
  26866. const isMonthView = currentView.value === "month";
  26867. return showDateFooter && isDateView || showYearFooter && isYearView || showMonthFooter && isMonthView;
  26868. });
  26869. const disabledConfirm = vue.computed(() => {
  26870. if (!disabledDate)
  26871. return false;
  26872. if (!props.parsedValue)
  26873. return true;
  26874. if (isArray$1(props.parsedValue)) {
  26875. return disabledDate(props.parsedValue[0].toDate());
  26876. }
  26877. return disabledDate(props.parsedValue.toDate());
  26878. });
  26879. const onConfirm = () => {
  26880. if (isMultipleType.value) {
  26881. emit(props.parsedValue);
  26882. } else {
  26883. let result = props.parsedValue;
  26884. if (!result) {
  26885. const defaultTimeD2 = dayjs(defaultTime).locale(lang.value);
  26886. const defaultValueD = getDefaultValue();
  26887. result = defaultTimeD2.year(defaultValueD.year()).month(defaultValueD.month()).date(defaultValueD.date());
  26888. }
  26889. innerDate.value = result;
  26890. emit(result);
  26891. }
  26892. };
  26893. const disabledNow = vue.computed(() => {
  26894. if (!disabledDate)
  26895. return false;
  26896. return disabledDate(dayjs().locale(lang.value).toDate());
  26897. });
  26898. const changeToNow = () => {
  26899. const now = dayjs().locale(lang.value);
  26900. const nowDate = now.toDate();
  26901. isChangeToNow.value = true;
  26902. if ((!disabledDate || !disabledDate(nowDate)) && checkDateWithinRange(nowDate)) {
  26903. innerDate.value = dayjs().locale(lang.value);
  26904. emit(innerDate.value);
  26905. }
  26906. };
  26907. const timeFormat = vue.computed(() => {
  26908. return props.timeFormat || extractTimeFormat(props.format);
  26909. });
  26910. const dateFormat = vue.computed(() => {
  26911. return props.dateFormat || extractDateFormat(props.format);
  26912. });
  26913. const visibleTime = vue.computed(() => {
  26914. if (userInputTime.value)
  26915. return userInputTime.value;
  26916. if (!props.parsedValue && !defaultValue.value)
  26917. return;
  26918. return (props.parsedValue || innerDate.value).format(timeFormat.value);
  26919. });
  26920. const visibleDate = vue.computed(() => {
  26921. if (userInputDate.value)
  26922. return userInputDate.value;
  26923. if (!props.parsedValue && !defaultValue.value)
  26924. return;
  26925. return (props.parsedValue || innerDate.value).format(dateFormat.value);
  26926. });
  26927. const timePickerVisible = vue.ref(false);
  26928. const onTimePickerInputFocus = () => {
  26929. timePickerVisible.value = true;
  26930. };
  26931. const handleTimePickClose = () => {
  26932. timePickerVisible.value = false;
  26933. };
  26934. const getUnits = (date) => {
  26935. return {
  26936. hour: date.hour(),
  26937. minute: date.minute(),
  26938. second: date.second(),
  26939. year: date.year(),
  26940. month: date.month(),
  26941. date: date.date()
  26942. };
  26943. };
  26944. const handleTimePick = (value, visible, first) => {
  26945. const { hour, minute, second } = getUnits(value);
  26946. const newDate = props.parsedValue ? props.parsedValue.hour(hour).minute(minute).second(second) : value;
  26947. innerDate.value = newDate;
  26948. emit(innerDate.value, true);
  26949. if (!first) {
  26950. timePickerVisible.value = visible;
  26951. }
  26952. };
  26953. const handleVisibleTimeChange = (value) => {
  26954. const newDate = dayjs(value, timeFormat.value).locale(lang.value);
  26955. if (newDate.isValid() && checkDateWithinRange(newDate)) {
  26956. const { year: year2, month: month2, date } = getUnits(innerDate.value);
  26957. innerDate.value = newDate.year(year2).month(month2).date(date);
  26958. userInputTime.value = null;
  26959. timePickerVisible.value = false;
  26960. emit(innerDate.value, true);
  26961. }
  26962. };
  26963. const handleVisibleDateChange = (value) => {
  26964. const newDate = dayjs(value, dateFormat.value).locale(lang.value);
  26965. if (newDate.isValid()) {
  26966. if (disabledDate && disabledDate(newDate.toDate())) {
  26967. return;
  26968. }
  26969. const { hour, minute, second } = getUnits(innerDate.value);
  26970. innerDate.value = newDate.hour(hour).minute(minute).second(second);
  26971. userInputDate.value = null;
  26972. emit(innerDate.value, true);
  26973. }
  26974. };
  26975. const isValidValue = (date) => {
  26976. return dayjs.isDayjs(date) && date.isValid() && (disabledDate ? !disabledDate(date.toDate()) : true);
  26977. };
  26978. const formatToString = (value) => {
  26979. return isArray$1(value) ? value.map((_) => _.format(props.format)) : value.format(props.format);
  26980. };
  26981. const parseUserInput = (value) => {
  26982. return dayjs(value, props.format).locale(lang.value);
  26983. };
  26984. const getDefaultValue = () => {
  26985. const parseDate = dayjs(defaultValue.value).locale(lang.value);
  26986. if (!defaultValue.value) {
  26987. const defaultTimeDValue = defaultTimeD.value;
  26988. return dayjs().hour(defaultTimeDValue.hour()).minute(defaultTimeDValue.minute()).second(defaultTimeDValue.second()).locale(lang.value);
  26989. }
  26990. return parseDate;
  26991. };
  26992. const handleFocusPicker = async () => {
  26993. var _a;
  26994. if (["week", "month", "year", "date"].includes(selectionMode.value)) {
  26995. (_a = currentViewRef.value) == null ? void 0 : _a.focus();
  26996. if (selectionMode.value === "week") {
  26997. handleKeyControl(EVENT_CODE.down);
  26998. }
  26999. }
  27000. };
  27001. const handleKeydownTable = (event) => {
  27002. const { code } = event;
  27003. const validCode = [
  27004. EVENT_CODE.up,
  27005. EVENT_CODE.down,
  27006. EVENT_CODE.left,
  27007. EVENT_CODE.right,
  27008. EVENT_CODE.home,
  27009. EVENT_CODE.end,
  27010. EVENT_CODE.pageUp,
  27011. EVENT_CODE.pageDown
  27012. ];
  27013. if (validCode.includes(code)) {
  27014. handleKeyControl(code);
  27015. event.stopPropagation();
  27016. event.preventDefault();
  27017. }
  27018. if ([EVENT_CODE.enter, EVENT_CODE.space, EVENT_CODE.numpadEnter].includes(code) && userInputDate.value === null && userInputTime.value === null) {
  27019. event.preventDefault();
  27020. emit(innerDate.value, false);
  27021. }
  27022. };
  27023. const handleKeyControl = (code) => {
  27024. var _a;
  27025. const { up, down, left, right, home, end, pageUp, pageDown } = EVENT_CODE;
  27026. const mapping = {
  27027. year: {
  27028. [up]: -4,
  27029. [down]: 4,
  27030. [left]: -1,
  27031. [right]: 1,
  27032. offset: (date, step) => date.setFullYear(date.getFullYear() + step)
  27033. },
  27034. month: {
  27035. [up]: -4,
  27036. [down]: 4,
  27037. [left]: -1,
  27038. [right]: 1,
  27039. offset: (date, step) => date.setMonth(date.getMonth() + step)
  27040. },
  27041. week: {
  27042. [up]: -1,
  27043. [down]: 1,
  27044. [left]: -1,
  27045. [right]: 1,
  27046. offset: (date, step) => date.setDate(date.getDate() + step * 7)
  27047. },
  27048. date: {
  27049. [up]: -7,
  27050. [down]: 7,
  27051. [left]: -1,
  27052. [right]: 1,
  27053. [home]: (date) => -date.getDay(),
  27054. [end]: (date) => -date.getDay() + 6,
  27055. [pageUp]: (date) => -new Date(date.getFullYear(), date.getMonth(), 0).getDate(),
  27056. [pageDown]: (date) => new Date(date.getFullYear(), date.getMonth() + 1, 0).getDate(),
  27057. offset: (date, step) => date.setDate(date.getDate() + step)
  27058. }
  27059. };
  27060. const newDate = innerDate.value.toDate();
  27061. while (Math.abs(innerDate.value.diff(newDate, "year", true)) < 1) {
  27062. const map = mapping[keyboardMode.value];
  27063. if (!map)
  27064. return;
  27065. map.offset(newDate, isFunction$1(map[code]) ? map[code](newDate) : (_a = map[code]) != null ? _a : 0);
  27066. if (disabledDate && disabledDate(newDate)) {
  27067. break;
  27068. }
  27069. const result = dayjs(newDate).locale(lang.value);
  27070. innerDate.value = result;
  27071. contextEmit("pick", result, true);
  27072. break;
  27073. }
  27074. };
  27075. const handlePanelChange = (mode) => {
  27076. contextEmit("panel-change", innerDate.value.toDate(), mode, currentView.value);
  27077. };
  27078. vue.watch(() => selectionMode.value, (val) => {
  27079. if (["month", "year"].includes(val)) {
  27080. currentView.value = val;
  27081. return;
  27082. } else if (val === "years") {
  27083. currentView.value = "year";
  27084. return;
  27085. } else if (val === "months") {
  27086. currentView.value = "month";
  27087. return;
  27088. }
  27089. currentView.value = "date";
  27090. }, { immediate: true });
  27091. vue.watch(() => currentView.value, () => {
  27092. popper == null ? void 0 : popper.updatePopper();
  27093. });
  27094. vue.watch(() => defaultValue.value, (val) => {
  27095. if (val) {
  27096. innerDate.value = getDefaultValue();
  27097. }
  27098. }, { immediate: true });
  27099. vue.watch(() => props.parsedValue, (val) => {
  27100. if (val) {
  27101. if (isMultipleType.value)
  27102. return;
  27103. if (isArray$1(val))
  27104. return;
  27105. innerDate.value = val;
  27106. } else {
  27107. innerDate.value = getDefaultValue();
  27108. }
  27109. }, { immediate: true });
  27110. contextEmit("set-picker-option", ["isValidValue", isValidValue]);
  27111. contextEmit("set-picker-option", ["formatToString", formatToString]);
  27112. contextEmit("set-picker-option", ["parseUserInput", parseUserInput]);
  27113. contextEmit("set-picker-option", ["handleFocusPicker", handleFocusPicker]);
  27114. return (_ctx, _cache) => {
  27115. return vue.openBlock(), vue.createElementBlock("div", {
  27116. class: vue.normalizeClass([
  27117. vue.unref(ppNs).b(),
  27118. vue.unref(dpNs).b(),
  27119. {
  27120. "has-sidebar": _ctx.$slots.sidebar || vue.unref(hasShortcuts),
  27121. "has-time": vue.unref(showTime)
  27122. }
  27123. ])
  27124. }, [
  27125. vue.createElementVNode("div", {
  27126. class: vue.normalizeClass(vue.unref(ppNs).e("body-wrapper"))
  27127. }, [
  27128. vue.renderSlot(_ctx.$slots, "sidebar", {
  27129. class: vue.normalizeClass(vue.unref(ppNs).e("sidebar"))
  27130. }),
  27131. vue.unref(hasShortcuts) ? (vue.openBlock(), vue.createElementBlock("div", {
  27132. key: 0,
  27133. class: vue.normalizeClass(vue.unref(ppNs).e("sidebar"))
  27134. }, [
  27135. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(shortcuts), (shortcut, key) => {
  27136. return vue.openBlock(), vue.createElementBlock("button", {
  27137. key,
  27138. type: "button",
  27139. class: vue.normalizeClass(vue.unref(ppNs).e("shortcut")),
  27140. onClick: ($event) => handleShortcutClick(shortcut)
  27141. }, vue.toDisplayString(shortcut.text), 11, ["onClick"]);
  27142. }), 128))
  27143. ], 2)) : vue.createCommentVNode("v-if", true),
  27144. vue.createElementVNode("div", {
  27145. class: vue.normalizeClass(vue.unref(ppNs).e("body"))
  27146. }, [
  27147. vue.unref(showTime) ? (vue.openBlock(), vue.createElementBlock("div", {
  27148. key: 0,
  27149. class: vue.normalizeClass(vue.unref(dpNs).e("time-header"))
  27150. }, [
  27151. vue.createElementVNode("span", {
  27152. class: vue.normalizeClass(vue.unref(dpNs).e("editor-wrap"))
  27153. }, [
  27154. vue.createVNode(vue.unref(ElInput), {
  27155. placeholder: vue.unref(t)("el.datepicker.selectDate"),
  27156. "model-value": vue.unref(visibleDate),
  27157. size: "small",
  27158. "validate-event": false,
  27159. onInput: (val) => userInputDate.value = val,
  27160. onChange: handleVisibleDateChange
  27161. }, null, 8, ["placeholder", "model-value", "onInput"])
  27162. ], 2),
  27163. vue.withDirectives((vue.openBlock(), vue.createElementBlock("span", {
  27164. class: vue.normalizeClass(vue.unref(dpNs).e("editor-wrap"))
  27165. }, [
  27166. vue.createVNode(vue.unref(ElInput), {
  27167. placeholder: vue.unref(t)("el.datepicker.selectTime"),
  27168. "model-value": vue.unref(visibleTime),
  27169. size: "small",
  27170. "validate-event": false,
  27171. onFocus: onTimePickerInputFocus,
  27172. onInput: (val) => userInputTime.value = val,
  27173. onChange: handleVisibleTimeChange
  27174. }, null, 8, ["placeholder", "model-value", "onInput"]),
  27175. vue.createVNode(vue.unref(TimePickPanel), {
  27176. visible: timePickerVisible.value,
  27177. format: vue.unref(timeFormat),
  27178. "parsed-value": innerDate.value,
  27179. onPick: handleTimePick
  27180. }, null, 8, ["visible", "format", "parsed-value"])
  27181. ], 2)), [
  27182. [vue.unref(ClickOutside), handleTimePickClose]
  27183. ])
  27184. ], 2)) : vue.createCommentVNode("v-if", true),
  27185. vue.withDirectives(vue.createElementVNode("div", {
  27186. class: vue.normalizeClass([
  27187. vue.unref(dpNs).e("header"),
  27188. (currentView.value === "year" || currentView.value === "month") && vue.unref(dpNs).e("header--bordered")
  27189. ])
  27190. }, [
  27191. vue.createElementVNode("span", {
  27192. class: vue.normalizeClass(vue.unref(dpNs).e("prev-btn"))
  27193. }, [
  27194. vue.createElementVNode("button", {
  27195. type: "button",
  27196. "aria-label": vue.unref(t)(`el.datepicker.prevYear`),
  27197. class: vue.normalizeClass(["d-arrow-left", vue.unref(ppNs).e("icon-btn")]),
  27198. onClick: ($event) => moveByYear(false)
  27199. }, [
  27200. vue.renderSlot(_ctx.$slots, "prev-year", {}, () => [
  27201. vue.createVNode(vue.unref(ElIcon), null, {
  27202. default: vue.withCtx(() => [
  27203. vue.createVNode(vue.unref(d_arrow_left_default))
  27204. ]),
  27205. _: 1
  27206. })
  27207. ])
  27208. ], 10, ["aria-label", "onClick"]),
  27209. vue.withDirectives(vue.createElementVNode("button", {
  27210. type: "button",
  27211. "aria-label": vue.unref(t)(`el.datepicker.prevMonth`),
  27212. class: vue.normalizeClass([vue.unref(ppNs).e("icon-btn"), "arrow-left"]),
  27213. onClick: ($event) => moveByMonth(false)
  27214. }, [
  27215. vue.renderSlot(_ctx.$slots, "prev-month", {}, () => [
  27216. vue.createVNode(vue.unref(ElIcon), null, {
  27217. default: vue.withCtx(() => [
  27218. vue.createVNode(vue.unref(arrow_left_default))
  27219. ]),
  27220. _: 1
  27221. })
  27222. ])
  27223. ], 10, ["aria-label", "onClick"]), [
  27224. [vue.vShow, currentView.value === "date"]
  27225. ])
  27226. ], 2),
  27227. vue.createElementVNode("span", {
  27228. role: "button",
  27229. class: vue.normalizeClass(vue.unref(dpNs).e("header-label")),
  27230. "aria-live": "polite",
  27231. tabindex: "0",
  27232. onKeydown: vue.withKeys(($event) => showPicker("year"), ["enter"]),
  27233. onClick: ($event) => showPicker("year")
  27234. }, vue.toDisplayString(vue.unref(yearLabel)), 43, ["onKeydown", "onClick"]),
  27235. vue.withDirectives(vue.createElementVNode("span", {
  27236. role: "button",
  27237. "aria-live": "polite",
  27238. tabindex: "0",
  27239. class: vue.normalizeClass([
  27240. vue.unref(dpNs).e("header-label"),
  27241. { active: currentView.value === "month" }
  27242. ]),
  27243. onKeydown: vue.withKeys(($event) => showPicker("month"), ["enter"]),
  27244. onClick: ($event) => showPicker("month")
  27245. }, vue.toDisplayString(vue.unref(t)(`el.datepicker.month${vue.unref(month) + 1}`)), 43, ["onKeydown", "onClick"]), [
  27246. [vue.vShow, currentView.value === "date"]
  27247. ]),
  27248. vue.createElementVNode("span", {
  27249. class: vue.normalizeClass(vue.unref(dpNs).e("next-btn"))
  27250. }, [
  27251. vue.withDirectives(vue.createElementVNode("button", {
  27252. type: "button",
  27253. "aria-label": vue.unref(t)(`el.datepicker.nextMonth`),
  27254. class: vue.normalizeClass([vue.unref(ppNs).e("icon-btn"), "arrow-right"]),
  27255. onClick: ($event) => moveByMonth(true)
  27256. }, [
  27257. vue.renderSlot(_ctx.$slots, "next-month", {}, () => [
  27258. vue.createVNode(vue.unref(ElIcon), null, {
  27259. default: vue.withCtx(() => [
  27260. vue.createVNode(vue.unref(arrow_right_default))
  27261. ]),
  27262. _: 1
  27263. })
  27264. ])
  27265. ], 10, ["aria-label", "onClick"]), [
  27266. [vue.vShow, currentView.value === "date"]
  27267. ]),
  27268. vue.createElementVNode("button", {
  27269. type: "button",
  27270. "aria-label": vue.unref(t)(`el.datepicker.nextYear`),
  27271. class: vue.normalizeClass([vue.unref(ppNs).e("icon-btn"), "d-arrow-right"]),
  27272. onClick: ($event) => moveByYear(true)
  27273. }, [
  27274. vue.renderSlot(_ctx.$slots, "next-year", {}, () => [
  27275. vue.createVNode(vue.unref(ElIcon), null, {
  27276. default: vue.withCtx(() => [
  27277. vue.createVNode(vue.unref(d_arrow_right_default))
  27278. ]),
  27279. _: 1
  27280. })
  27281. ])
  27282. ], 10, ["aria-label", "onClick"])
  27283. ], 2)
  27284. ], 2), [
  27285. [vue.vShow, currentView.value !== "time"]
  27286. ]),
  27287. vue.createElementVNode("div", {
  27288. class: vue.normalizeClass(vue.unref(ppNs).e("content")),
  27289. onKeydown: handleKeydownTable
  27290. }, [
  27291. currentView.value === "date" ? (vue.openBlock(), vue.createBlock(DateTable, {
  27292. key: 0,
  27293. ref_key: "currentViewRef",
  27294. ref: currentViewRef,
  27295. "selection-mode": vue.unref(selectionMode),
  27296. date: innerDate.value,
  27297. "parsed-value": _ctx.parsedValue,
  27298. "disabled-date": vue.unref(disabledDate),
  27299. "cell-class-name": vue.unref(cellClassName),
  27300. onPick: handleDatePick
  27301. }, null, 8, ["selection-mode", "date", "parsed-value", "disabled-date", "cell-class-name"])) : vue.createCommentVNode("v-if", true),
  27302. currentView.value === "year" ? (vue.openBlock(), vue.createBlock(YearTable, {
  27303. key: 1,
  27304. ref_key: "currentViewRef",
  27305. ref: currentViewRef,
  27306. "selection-mode": vue.unref(selectionMode),
  27307. date: innerDate.value,
  27308. "disabled-date": vue.unref(disabledDate),
  27309. "parsed-value": _ctx.parsedValue,
  27310. onPick: handleYearPick
  27311. }, null, 8, ["selection-mode", "date", "disabled-date", "parsed-value"])) : vue.createCommentVNode("v-if", true),
  27312. currentView.value === "month" ? (vue.openBlock(), vue.createBlock(MonthTable, {
  27313. key: 2,
  27314. ref_key: "currentViewRef",
  27315. ref: currentViewRef,
  27316. "selection-mode": vue.unref(selectionMode),
  27317. date: innerDate.value,
  27318. "parsed-value": _ctx.parsedValue,
  27319. "disabled-date": vue.unref(disabledDate),
  27320. onPick: handleMonthPick
  27321. }, null, 8, ["selection-mode", "date", "parsed-value", "disabled-date"])) : vue.createCommentVNode("v-if", true)
  27322. ], 34)
  27323. ], 2)
  27324. ], 2),
  27325. vue.withDirectives(vue.createElementVNode("div", {
  27326. class: vue.normalizeClass(vue.unref(ppNs).e("footer"))
  27327. }, [
  27328. vue.withDirectives(vue.createVNode(vue.unref(ElButton), {
  27329. text: "",
  27330. size: "small",
  27331. class: vue.normalizeClass(vue.unref(ppNs).e("link-btn")),
  27332. disabled: vue.unref(disabledNow),
  27333. onClick: changeToNow
  27334. }, {
  27335. default: vue.withCtx(() => [
  27336. vue.createTextVNode(vue.toDisplayString(vue.unref(t)("el.datepicker.now")), 1)
  27337. ]),
  27338. _: 1
  27339. }, 8, ["class", "disabled"]), [
  27340. [vue.vShow, !vue.unref(isMultipleType) && _ctx.showNow]
  27341. ]),
  27342. vue.createVNode(vue.unref(ElButton), {
  27343. plain: "",
  27344. size: "small",
  27345. class: vue.normalizeClass(vue.unref(ppNs).e("link-btn")),
  27346. disabled: vue.unref(disabledConfirm),
  27347. onClick: onConfirm
  27348. }, {
  27349. default: vue.withCtx(() => [
  27350. vue.createTextVNode(vue.toDisplayString(vue.unref(t)("el.datepicker.confirm")), 1)
  27351. ]),
  27352. _: 1
  27353. }, 8, ["class", "disabled"])
  27354. ], 2), [
  27355. [vue.vShow, vue.unref(footerVisible)]
  27356. ])
  27357. ], 2);
  27358. };
  27359. }
  27360. });
  27361. var DatePickPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1v, [["__file", "panel-date-pick.vue"]]);
  27362. const panelDateRangeProps = buildProps({
  27363. ...panelSharedProps,
  27364. ...panelRangeSharedProps,
  27365. visible: Boolean
  27366. });
  27367. const useShortcut = (lang) => {
  27368. const { emit } = vue.getCurrentInstance();
  27369. const attrs = vue.useAttrs();
  27370. const slots = vue.useSlots();
  27371. const handleShortcutClick = (shortcut) => {
  27372. const shortcutValues = isFunction$1(shortcut.value) ? shortcut.value() : shortcut.value;
  27373. if (shortcutValues) {
  27374. emit("pick", [
  27375. dayjs(shortcutValues[0]).locale(lang.value),
  27376. dayjs(shortcutValues[1]).locale(lang.value)
  27377. ]);
  27378. return;
  27379. }
  27380. if (shortcut.onClick) {
  27381. shortcut.onClick({
  27382. attrs,
  27383. slots,
  27384. emit
  27385. });
  27386. }
  27387. };
  27388. return handleShortcutClick;
  27389. };
  27390. const useRangePicker = (props, {
  27391. defaultValue,
  27392. leftDate,
  27393. rightDate,
  27394. unit,
  27395. onParsedValueChanged
  27396. }) => {
  27397. const { emit } = vue.getCurrentInstance();
  27398. const { pickerNs } = vue.inject(ROOT_PICKER_INJECTION_KEY);
  27399. const drpNs = useNamespace("date-range-picker");
  27400. const { t, lang } = useLocale();
  27401. const handleShortcutClick = useShortcut(lang);
  27402. const minDate = vue.ref();
  27403. const maxDate = vue.ref();
  27404. const rangeState = vue.ref({
  27405. endDate: null,
  27406. selecting: false
  27407. });
  27408. const handleChangeRange = (val) => {
  27409. rangeState.value = val;
  27410. };
  27411. const handleRangeConfirm = (visible = false) => {
  27412. const _minDate = vue.unref(minDate);
  27413. const _maxDate = vue.unref(maxDate);
  27414. if (isValidRange([_minDate, _maxDate])) {
  27415. emit("pick", [_minDate, _maxDate], visible);
  27416. }
  27417. };
  27418. const onSelect = (selecting) => {
  27419. rangeState.value.selecting = selecting;
  27420. if (!selecting) {
  27421. rangeState.value.endDate = null;
  27422. }
  27423. };
  27424. const onReset = (parsedValue) => {
  27425. if (isArray$1(parsedValue) && parsedValue.length === 2) {
  27426. const [start, end] = parsedValue;
  27427. minDate.value = start;
  27428. leftDate.value = start;
  27429. maxDate.value = end;
  27430. onParsedValueChanged(vue.unref(minDate), vue.unref(maxDate));
  27431. } else {
  27432. restoreDefault();
  27433. }
  27434. };
  27435. const restoreDefault = () => {
  27436. const [start, end] = getDefaultValue(vue.unref(defaultValue), {
  27437. lang: vue.unref(lang),
  27438. unit,
  27439. unlinkPanels: props.unlinkPanels
  27440. });
  27441. minDate.value = void 0;
  27442. maxDate.value = void 0;
  27443. leftDate.value = start;
  27444. rightDate.value = end;
  27445. };
  27446. vue.watch(defaultValue, (val) => {
  27447. if (val) {
  27448. restoreDefault();
  27449. }
  27450. }, { immediate: true });
  27451. vue.watch(() => props.parsedValue, onReset, { immediate: true });
  27452. return {
  27453. minDate,
  27454. maxDate,
  27455. rangeState,
  27456. lang,
  27457. ppNs: pickerNs,
  27458. drpNs,
  27459. handleChangeRange,
  27460. handleRangeConfirm,
  27461. handleShortcutClick,
  27462. onSelect,
  27463. onReset,
  27464. t
  27465. };
  27466. };
  27467. const unit$2 = "month";
  27468. const _sfc_main$1u = /* @__PURE__ */ vue.defineComponent({
  27469. __name: "panel-date-range",
  27470. props: panelDateRangeProps,
  27471. emits: [
  27472. "pick",
  27473. "set-picker-option",
  27474. "calendar-change",
  27475. "panel-change"
  27476. ],
  27477. setup(__props, { emit }) {
  27478. const props = __props;
  27479. const pickerBase = vue.inject("EP_PICKER_BASE");
  27480. const { disabledDate, cellClassName, defaultTime, clearable } = pickerBase.props;
  27481. const format = vue.toRef(pickerBase.props, "format");
  27482. const shortcuts = vue.toRef(pickerBase.props, "shortcuts");
  27483. const defaultValue = vue.toRef(pickerBase.props, "defaultValue");
  27484. const { lang } = useLocale();
  27485. const leftDate = vue.ref(dayjs().locale(lang.value));
  27486. const rightDate = vue.ref(dayjs().locale(lang.value).add(1, unit$2));
  27487. const {
  27488. minDate,
  27489. maxDate,
  27490. rangeState,
  27491. ppNs,
  27492. drpNs,
  27493. handleChangeRange,
  27494. handleRangeConfirm,
  27495. handleShortcutClick,
  27496. onSelect,
  27497. onReset,
  27498. t
  27499. } = useRangePicker(props, {
  27500. defaultValue,
  27501. leftDate,
  27502. rightDate,
  27503. unit: unit$2,
  27504. onParsedValueChanged
  27505. });
  27506. vue.watch(() => props.visible, (visible) => {
  27507. if (!visible && rangeState.value.selecting) {
  27508. onReset(props.parsedValue);
  27509. onSelect(false);
  27510. }
  27511. });
  27512. const dateUserInput = vue.ref({
  27513. min: null,
  27514. max: null
  27515. });
  27516. const timeUserInput = vue.ref({
  27517. min: null,
  27518. max: null
  27519. });
  27520. const leftLabel = vue.computed(() => {
  27521. return `${leftDate.value.year()} ${t("el.datepicker.year")} ${t(`el.datepicker.month${leftDate.value.month() + 1}`)}`;
  27522. });
  27523. const rightLabel = vue.computed(() => {
  27524. return `${rightDate.value.year()} ${t("el.datepicker.year")} ${t(`el.datepicker.month${rightDate.value.month() + 1}`)}`;
  27525. });
  27526. const leftYear = vue.computed(() => {
  27527. return leftDate.value.year();
  27528. });
  27529. const leftMonth = vue.computed(() => {
  27530. return leftDate.value.month();
  27531. });
  27532. const rightYear = vue.computed(() => {
  27533. return rightDate.value.year();
  27534. });
  27535. const rightMonth = vue.computed(() => {
  27536. return rightDate.value.month();
  27537. });
  27538. const hasShortcuts = vue.computed(() => !!shortcuts.value.length);
  27539. const minVisibleDate = vue.computed(() => {
  27540. if (dateUserInput.value.min !== null)
  27541. return dateUserInput.value.min;
  27542. if (minDate.value)
  27543. return minDate.value.format(dateFormat.value);
  27544. return "";
  27545. });
  27546. const maxVisibleDate = vue.computed(() => {
  27547. if (dateUserInput.value.max !== null)
  27548. return dateUserInput.value.max;
  27549. if (maxDate.value || minDate.value)
  27550. return (maxDate.value || minDate.value).format(dateFormat.value);
  27551. return "";
  27552. });
  27553. const minVisibleTime = vue.computed(() => {
  27554. if (timeUserInput.value.min !== null)
  27555. return timeUserInput.value.min;
  27556. if (minDate.value)
  27557. return minDate.value.format(timeFormat.value);
  27558. return "";
  27559. });
  27560. const maxVisibleTime = vue.computed(() => {
  27561. if (timeUserInput.value.max !== null)
  27562. return timeUserInput.value.max;
  27563. if (maxDate.value || minDate.value)
  27564. return (maxDate.value || minDate.value).format(timeFormat.value);
  27565. return "";
  27566. });
  27567. const timeFormat = vue.computed(() => {
  27568. return props.timeFormat || extractTimeFormat(format.value);
  27569. });
  27570. const dateFormat = vue.computed(() => {
  27571. return props.dateFormat || extractDateFormat(format.value);
  27572. });
  27573. const isValidValue = (date) => {
  27574. return isValidRange(date) && (disabledDate ? !disabledDate(date[0].toDate()) && !disabledDate(date[1].toDate()) : true);
  27575. };
  27576. const leftPrevYear = () => {
  27577. leftDate.value = leftDate.value.subtract(1, "year");
  27578. if (!props.unlinkPanels) {
  27579. rightDate.value = leftDate.value.add(1, "month");
  27580. }
  27581. handlePanelChange("year");
  27582. };
  27583. const leftPrevMonth = () => {
  27584. leftDate.value = leftDate.value.subtract(1, "month");
  27585. if (!props.unlinkPanels) {
  27586. rightDate.value = leftDate.value.add(1, "month");
  27587. }
  27588. handlePanelChange("month");
  27589. };
  27590. const rightNextYear = () => {
  27591. if (!props.unlinkPanels) {
  27592. leftDate.value = leftDate.value.add(1, "year");
  27593. rightDate.value = leftDate.value.add(1, "month");
  27594. } else {
  27595. rightDate.value = rightDate.value.add(1, "year");
  27596. }
  27597. handlePanelChange("year");
  27598. };
  27599. const rightNextMonth = () => {
  27600. if (!props.unlinkPanels) {
  27601. leftDate.value = leftDate.value.add(1, "month");
  27602. rightDate.value = leftDate.value.add(1, "month");
  27603. } else {
  27604. rightDate.value = rightDate.value.add(1, "month");
  27605. }
  27606. handlePanelChange("month");
  27607. };
  27608. const leftNextYear = () => {
  27609. leftDate.value = leftDate.value.add(1, "year");
  27610. handlePanelChange("year");
  27611. };
  27612. const leftNextMonth = () => {
  27613. leftDate.value = leftDate.value.add(1, "month");
  27614. handlePanelChange("month");
  27615. };
  27616. const rightPrevYear = () => {
  27617. rightDate.value = rightDate.value.subtract(1, "year");
  27618. handlePanelChange("year");
  27619. };
  27620. const rightPrevMonth = () => {
  27621. rightDate.value = rightDate.value.subtract(1, "month");
  27622. handlePanelChange("month");
  27623. };
  27624. const handlePanelChange = (mode) => {
  27625. emit("panel-change", [leftDate.value.toDate(), rightDate.value.toDate()], mode);
  27626. };
  27627. const enableMonthArrow = vue.computed(() => {
  27628. const nextMonth = (leftMonth.value + 1) % 12;
  27629. const yearOffset = leftMonth.value + 1 >= 12 ? 1 : 0;
  27630. return props.unlinkPanels && new Date(leftYear.value + yearOffset, nextMonth) < new Date(rightYear.value, rightMonth.value);
  27631. });
  27632. const enableYearArrow = vue.computed(() => {
  27633. return props.unlinkPanels && rightYear.value * 12 + rightMonth.value - (leftYear.value * 12 + leftMonth.value + 1) >= 12;
  27634. });
  27635. const btnDisabled = vue.computed(() => {
  27636. return !(minDate.value && maxDate.value && !rangeState.value.selecting && isValidRange([minDate.value, maxDate.value]));
  27637. });
  27638. const showTime = vue.computed(() => props.type === "datetime" || props.type === "datetimerange");
  27639. const formatEmit = (emitDayjs, index) => {
  27640. if (!emitDayjs)
  27641. return;
  27642. if (defaultTime) {
  27643. const defaultTimeD = dayjs(defaultTime[index] || defaultTime).locale(lang.value);
  27644. return defaultTimeD.year(emitDayjs.year()).month(emitDayjs.month()).date(emitDayjs.date());
  27645. }
  27646. return emitDayjs;
  27647. };
  27648. const handleRangePick = (val, close = true) => {
  27649. const min_ = val.minDate;
  27650. const max_ = val.maxDate;
  27651. const minDate_ = formatEmit(min_, 0);
  27652. const maxDate_ = formatEmit(max_, 1);
  27653. if (maxDate.value === maxDate_ && minDate.value === minDate_) {
  27654. return;
  27655. }
  27656. emit("calendar-change", [min_.toDate(), max_ && max_.toDate()]);
  27657. maxDate.value = maxDate_;
  27658. minDate.value = minDate_;
  27659. if (!close || showTime.value)
  27660. return;
  27661. handleRangeConfirm();
  27662. };
  27663. const minTimePickerVisible = vue.ref(false);
  27664. const maxTimePickerVisible = vue.ref(false);
  27665. const handleMinTimeClose = () => {
  27666. minTimePickerVisible.value = false;
  27667. };
  27668. const handleMaxTimeClose = () => {
  27669. maxTimePickerVisible.value = false;
  27670. };
  27671. const handleDateInput = (value, type) => {
  27672. dateUserInput.value[type] = value;
  27673. const parsedValueD = dayjs(value, dateFormat.value).locale(lang.value);
  27674. if (parsedValueD.isValid()) {
  27675. if (disabledDate && disabledDate(parsedValueD.toDate())) {
  27676. return;
  27677. }
  27678. if (type === "min") {
  27679. leftDate.value = parsedValueD;
  27680. minDate.value = (minDate.value || leftDate.value).year(parsedValueD.year()).month(parsedValueD.month()).date(parsedValueD.date());
  27681. if (!props.unlinkPanels && (!maxDate.value || maxDate.value.isBefore(minDate.value))) {
  27682. rightDate.value = parsedValueD.add(1, "month");
  27683. maxDate.value = minDate.value.add(1, "month");
  27684. }
  27685. } else {
  27686. rightDate.value = parsedValueD;
  27687. maxDate.value = (maxDate.value || rightDate.value).year(parsedValueD.year()).month(parsedValueD.month()).date(parsedValueD.date());
  27688. if (!props.unlinkPanels && (!minDate.value || minDate.value.isAfter(maxDate.value))) {
  27689. leftDate.value = parsedValueD.subtract(1, "month");
  27690. minDate.value = maxDate.value.subtract(1, "month");
  27691. }
  27692. }
  27693. }
  27694. };
  27695. const handleDateChange = (_, type) => {
  27696. dateUserInput.value[type] = null;
  27697. };
  27698. const handleTimeInput = (value, type) => {
  27699. timeUserInput.value[type] = value;
  27700. const parsedValueD = dayjs(value, timeFormat.value).locale(lang.value);
  27701. if (parsedValueD.isValid()) {
  27702. if (type === "min") {
  27703. minTimePickerVisible.value = true;
  27704. minDate.value = (minDate.value || leftDate.value).hour(parsedValueD.hour()).minute(parsedValueD.minute()).second(parsedValueD.second());
  27705. } else {
  27706. maxTimePickerVisible.value = true;
  27707. maxDate.value = (maxDate.value || rightDate.value).hour(parsedValueD.hour()).minute(parsedValueD.minute()).second(parsedValueD.second());
  27708. rightDate.value = maxDate.value;
  27709. }
  27710. }
  27711. };
  27712. const handleTimeChange = (value, type) => {
  27713. timeUserInput.value[type] = null;
  27714. if (type === "min") {
  27715. leftDate.value = minDate.value;
  27716. minTimePickerVisible.value = false;
  27717. if (!maxDate.value || maxDate.value.isBefore(minDate.value)) {
  27718. maxDate.value = minDate.value;
  27719. }
  27720. } else {
  27721. rightDate.value = maxDate.value;
  27722. maxTimePickerVisible.value = false;
  27723. if (maxDate.value && maxDate.value.isBefore(minDate.value)) {
  27724. minDate.value = maxDate.value;
  27725. }
  27726. }
  27727. };
  27728. const handleMinTimePick = (value, visible, first) => {
  27729. if (timeUserInput.value.min)
  27730. return;
  27731. if (value) {
  27732. leftDate.value = value;
  27733. minDate.value = (minDate.value || leftDate.value).hour(value.hour()).minute(value.minute()).second(value.second());
  27734. }
  27735. if (!first) {
  27736. minTimePickerVisible.value = visible;
  27737. }
  27738. if (!maxDate.value || maxDate.value.isBefore(minDate.value)) {
  27739. maxDate.value = minDate.value;
  27740. rightDate.value = value;
  27741. }
  27742. };
  27743. const handleMaxTimePick = (value, visible, first) => {
  27744. if (timeUserInput.value.max)
  27745. return;
  27746. if (value) {
  27747. rightDate.value = value;
  27748. maxDate.value = (maxDate.value || rightDate.value).hour(value.hour()).minute(value.minute()).second(value.second());
  27749. }
  27750. if (!first) {
  27751. maxTimePickerVisible.value = visible;
  27752. }
  27753. if (maxDate.value && maxDate.value.isBefore(minDate.value)) {
  27754. minDate.value = maxDate.value;
  27755. }
  27756. };
  27757. const handleClear = () => {
  27758. leftDate.value = getDefaultValue(vue.unref(defaultValue), {
  27759. lang: vue.unref(lang),
  27760. unit: "month",
  27761. unlinkPanels: props.unlinkPanels
  27762. })[0];
  27763. rightDate.value = leftDate.value.add(1, "month");
  27764. maxDate.value = void 0;
  27765. minDate.value = void 0;
  27766. emit("pick", null);
  27767. };
  27768. const formatToString = (value) => {
  27769. return isArray$1(value) ? value.map((_) => _.format(format.value)) : value.format(format.value);
  27770. };
  27771. const parseUserInput = (value) => {
  27772. return isArray$1(value) ? value.map((_) => dayjs(_, format.value).locale(lang.value)) : dayjs(value, format.value).locale(lang.value);
  27773. };
  27774. function onParsedValueChanged(minDate2, maxDate2) {
  27775. if (props.unlinkPanels && maxDate2) {
  27776. const minDateYear = (minDate2 == null ? void 0 : minDate2.year()) || 0;
  27777. const minDateMonth = (minDate2 == null ? void 0 : minDate2.month()) || 0;
  27778. const maxDateYear = maxDate2.year();
  27779. const maxDateMonth = maxDate2.month();
  27780. rightDate.value = minDateYear === maxDateYear && minDateMonth === maxDateMonth ? maxDate2.add(1, unit$2) : maxDate2;
  27781. } else {
  27782. rightDate.value = leftDate.value.add(1, unit$2);
  27783. if (maxDate2) {
  27784. rightDate.value = rightDate.value.hour(maxDate2.hour()).minute(maxDate2.minute()).second(maxDate2.second());
  27785. }
  27786. }
  27787. }
  27788. emit("set-picker-option", ["isValidValue", isValidValue]);
  27789. emit("set-picker-option", ["parseUserInput", parseUserInput]);
  27790. emit("set-picker-option", ["formatToString", formatToString]);
  27791. emit("set-picker-option", ["handleClear", handleClear]);
  27792. return (_ctx, _cache) => {
  27793. return vue.openBlock(), vue.createElementBlock("div", {
  27794. class: vue.normalizeClass([
  27795. vue.unref(ppNs).b(),
  27796. vue.unref(drpNs).b(),
  27797. {
  27798. "has-sidebar": _ctx.$slots.sidebar || vue.unref(hasShortcuts),
  27799. "has-time": vue.unref(showTime)
  27800. }
  27801. ])
  27802. }, [
  27803. vue.createElementVNode("div", {
  27804. class: vue.normalizeClass(vue.unref(ppNs).e("body-wrapper"))
  27805. }, [
  27806. vue.renderSlot(_ctx.$slots, "sidebar", {
  27807. class: vue.normalizeClass(vue.unref(ppNs).e("sidebar"))
  27808. }),
  27809. vue.unref(hasShortcuts) ? (vue.openBlock(), vue.createElementBlock("div", {
  27810. key: 0,
  27811. class: vue.normalizeClass(vue.unref(ppNs).e("sidebar"))
  27812. }, [
  27813. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(shortcuts), (shortcut, key) => {
  27814. return vue.openBlock(), vue.createElementBlock("button", {
  27815. key,
  27816. type: "button",
  27817. class: vue.normalizeClass(vue.unref(ppNs).e("shortcut")),
  27818. onClick: ($event) => vue.unref(handleShortcutClick)(shortcut)
  27819. }, vue.toDisplayString(shortcut.text), 11, ["onClick"]);
  27820. }), 128))
  27821. ], 2)) : vue.createCommentVNode("v-if", true),
  27822. vue.createElementVNode("div", {
  27823. class: vue.normalizeClass(vue.unref(ppNs).e("body"))
  27824. }, [
  27825. vue.unref(showTime) ? (vue.openBlock(), vue.createElementBlock("div", {
  27826. key: 0,
  27827. class: vue.normalizeClass(vue.unref(drpNs).e("time-header"))
  27828. }, [
  27829. vue.createElementVNode("span", {
  27830. class: vue.normalizeClass(vue.unref(drpNs).e("editors-wrap"))
  27831. }, [
  27832. vue.createElementVNode("span", {
  27833. class: vue.normalizeClass(vue.unref(drpNs).e("time-picker-wrap"))
  27834. }, [
  27835. vue.createVNode(vue.unref(ElInput), {
  27836. size: "small",
  27837. disabled: vue.unref(rangeState).selecting,
  27838. placeholder: vue.unref(t)("el.datepicker.startDate"),
  27839. class: vue.normalizeClass(vue.unref(drpNs).e("editor")),
  27840. "model-value": vue.unref(minVisibleDate),
  27841. "validate-event": false,
  27842. onInput: (val) => handleDateInput(val, "min"),
  27843. onChange: (val) => handleDateChange(val, "min")
  27844. }, null, 8, ["disabled", "placeholder", "class", "model-value", "onInput", "onChange"])
  27845. ], 2),
  27846. vue.withDirectives((vue.openBlock(), vue.createElementBlock("span", {
  27847. class: vue.normalizeClass(vue.unref(drpNs).e("time-picker-wrap"))
  27848. }, [
  27849. vue.createVNode(vue.unref(ElInput), {
  27850. size: "small",
  27851. class: vue.normalizeClass(vue.unref(drpNs).e("editor")),
  27852. disabled: vue.unref(rangeState).selecting,
  27853. placeholder: vue.unref(t)("el.datepicker.startTime"),
  27854. "model-value": vue.unref(minVisibleTime),
  27855. "validate-event": false,
  27856. onFocus: ($event) => minTimePickerVisible.value = true,
  27857. onInput: (val) => handleTimeInput(val, "min"),
  27858. onChange: (val) => handleTimeChange(val, "min")
  27859. }, null, 8, ["class", "disabled", "placeholder", "model-value", "onFocus", "onInput", "onChange"]),
  27860. vue.createVNode(vue.unref(TimePickPanel), {
  27861. visible: minTimePickerVisible.value,
  27862. format: vue.unref(timeFormat),
  27863. "datetime-role": "start",
  27864. "parsed-value": leftDate.value,
  27865. onPick: handleMinTimePick
  27866. }, null, 8, ["visible", "format", "parsed-value"])
  27867. ], 2)), [
  27868. [vue.unref(ClickOutside), handleMinTimeClose]
  27869. ])
  27870. ], 2),
  27871. vue.createElementVNode("span", null, [
  27872. vue.createVNode(vue.unref(ElIcon), null, {
  27873. default: vue.withCtx(() => [
  27874. vue.createVNode(vue.unref(arrow_right_default))
  27875. ]),
  27876. _: 1
  27877. })
  27878. ]),
  27879. vue.createElementVNode("span", {
  27880. class: vue.normalizeClass([vue.unref(drpNs).e("editors-wrap"), "is-right"])
  27881. }, [
  27882. vue.createElementVNode("span", {
  27883. class: vue.normalizeClass(vue.unref(drpNs).e("time-picker-wrap"))
  27884. }, [
  27885. vue.createVNode(vue.unref(ElInput), {
  27886. size: "small",
  27887. class: vue.normalizeClass(vue.unref(drpNs).e("editor")),
  27888. disabled: vue.unref(rangeState).selecting,
  27889. placeholder: vue.unref(t)("el.datepicker.endDate"),
  27890. "model-value": vue.unref(maxVisibleDate),
  27891. readonly: !vue.unref(minDate),
  27892. "validate-event": false,
  27893. onInput: (val) => handleDateInput(val, "max"),
  27894. onChange: (val) => handleDateChange(val, "max")
  27895. }, null, 8, ["class", "disabled", "placeholder", "model-value", "readonly", "onInput", "onChange"])
  27896. ], 2),
  27897. vue.withDirectives((vue.openBlock(), vue.createElementBlock("span", {
  27898. class: vue.normalizeClass(vue.unref(drpNs).e("time-picker-wrap"))
  27899. }, [
  27900. vue.createVNode(vue.unref(ElInput), {
  27901. size: "small",
  27902. class: vue.normalizeClass(vue.unref(drpNs).e("editor")),
  27903. disabled: vue.unref(rangeState).selecting,
  27904. placeholder: vue.unref(t)("el.datepicker.endTime"),
  27905. "model-value": vue.unref(maxVisibleTime),
  27906. readonly: !vue.unref(minDate),
  27907. "validate-event": false,
  27908. onFocus: ($event) => vue.unref(minDate) && (maxTimePickerVisible.value = true),
  27909. onInput: (val) => handleTimeInput(val, "max"),
  27910. onChange: (val) => handleTimeChange(val, "max")
  27911. }, null, 8, ["class", "disabled", "placeholder", "model-value", "readonly", "onFocus", "onInput", "onChange"]),
  27912. vue.createVNode(vue.unref(TimePickPanel), {
  27913. "datetime-role": "end",
  27914. visible: maxTimePickerVisible.value,
  27915. format: vue.unref(timeFormat),
  27916. "parsed-value": rightDate.value,
  27917. onPick: handleMaxTimePick
  27918. }, null, 8, ["visible", "format", "parsed-value"])
  27919. ], 2)), [
  27920. [vue.unref(ClickOutside), handleMaxTimeClose]
  27921. ])
  27922. ], 2)
  27923. ], 2)) : vue.createCommentVNode("v-if", true),
  27924. vue.createElementVNode("div", {
  27925. class: vue.normalizeClass([[vue.unref(ppNs).e("content"), vue.unref(drpNs).e("content")], "is-left"])
  27926. }, [
  27927. vue.createElementVNode("div", {
  27928. class: vue.normalizeClass(vue.unref(drpNs).e("header"))
  27929. }, [
  27930. vue.createElementVNode("button", {
  27931. type: "button",
  27932. class: vue.normalizeClass([vue.unref(ppNs).e("icon-btn"), "d-arrow-left"]),
  27933. "aria-label": vue.unref(t)(`el.datepicker.prevYear`),
  27934. onClick: leftPrevYear
  27935. }, [
  27936. vue.renderSlot(_ctx.$slots, "prev-year", {}, () => [
  27937. vue.createVNode(vue.unref(ElIcon), null, {
  27938. default: vue.withCtx(() => [
  27939. vue.createVNode(vue.unref(d_arrow_left_default))
  27940. ]),
  27941. _: 1
  27942. })
  27943. ])
  27944. ], 10, ["aria-label"]),
  27945. vue.createElementVNode("button", {
  27946. type: "button",
  27947. class: vue.normalizeClass([vue.unref(ppNs).e("icon-btn"), "arrow-left"]),
  27948. "aria-label": vue.unref(t)(`el.datepicker.prevMonth`),
  27949. onClick: leftPrevMonth
  27950. }, [
  27951. vue.renderSlot(_ctx.$slots, "prev-month", {}, () => [
  27952. vue.createVNode(vue.unref(ElIcon), null, {
  27953. default: vue.withCtx(() => [
  27954. vue.createVNode(vue.unref(arrow_left_default))
  27955. ]),
  27956. _: 1
  27957. })
  27958. ])
  27959. ], 10, ["aria-label"]),
  27960. _ctx.unlinkPanels ? (vue.openBlock(), vue.createElementBlock("button", {
  27961. key: 0,
  27962. type: "button",
  27963. disabled: !vue.unref(enableYearArrow),
  27964. class: vue.normalizeClass([[vue.unref(ppNs).e("icon-btn"), { "is-disabled": !vue.unref(enableYearArrow) }], "d-arrow-right"]),
  27965. "aria-label": vue.unref(t)(`el.datepicker.nextYear`),
  27966. onClick: leftNextYear
  27967. }, [
  27968. vue.renderSlot(_ctx.$slots, "next-year", {}, () => [
  27969. vue.createVNode(vue.unref(ElIcon), null, {
  27970. default: vue.withCtx(() => [
  27971. vue.createVNode(vue.unref(d_arrow_right_default))
  27972. ]),
  27973. _: 1
  27974. })
  27975. ])
  27976. ], 10, ["disabled", "aria-label"])) : vue.createCommentVNode("v-if", true),
  27977. _ctx.unlinkPanels ? (vue.openBlock(), vue.createElementBlock("button", {
  27978. key: 1,
  27979. type: "button",
  27980. disabled: !vue.unref(enableMonthArrow),
  27981. class: vue.normalizeClass([[
  27982. vue.unref(ppNs).e("icon-btn"),
  27983. { "is-disabled": !vue.unref(enableMonthArrow) }
  27984. ], "arrow-right"]),
  27985. "aria-label": vue.unref(t)(`el.datepicker.nextMonth`),
  27986. onClick: leftNextMonth
  27987. }, [
  27988. vue.renderSlot(_ctx.$slots, "next-month", {}, () => [
  27989. vue.createVNode(vue.unref(ElIcon), null, {
  27990. default: vue.withCtx(() => [
  27991. vue.createVNode(vue.unref(arrow_right_default))
  27992. ]),
  27993. _: 1
  27994. })
  27995. ])
  27996. ], 10, ["disabled", "aria-label"])) : vue.createCommentVNode("v-if", true),
  27997. vue.createElementVNode("div", null, vue.toDisplayString(vue.unref(leftLabel)), 1)
  27998. ], 2),
  27999. vue.createVNode(DateTable, {
  28000. "selection-mode": "range",
  28001. date: leftDate.value,
  28002. "min-date": vue.unref(minDate),
  28003. "max-date": vue.unref(maxDate),
  28004. "range-state": vue.unref(rangeState),
  28005. "disabled-date": vue.unref(disabledDate),
  28006. "cell-class-name": vue.unref(cellClassName),
  28007. onChangerange: vue.unref(handleChangeRange),
  28008. onPick: handleRangePick,
  28009. onSelect: vue.unref(onSelect)
  28010. }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "cell-class-name", "onChangerange", "onSelect"])
  28011. ], 2),
  28012. vue.createElementVNode("div", {
  28013. class: vue.normalizeClass([[vue.unref(ppNs).e("content"), vue.unref(drpNs).e("content")], "is-right"])
  28014. }, [
  28015. vue.createElementVNode("div", {
  28016. class: vue.normalizeClass(vue.unref(drpNs).e("header"))
  28017. }, [
  28018. _ctx.unlinkPanels ? (vue.openBlock(), vue.createElementBlock("button", {
  28019. key: 0,
  28020. type: "button",
  28021. disabled: !vue.unref(enableYearArrow),
  28022. class: vue.normalizeClass([[vue.unref(ppNs).e("icon-btn"), { "is-disabled": !vue.unref(enableYearArrow) }], "d-arrow-left"]),
  28023. "aria-label": vue.unref(t)(`el.datepicker.prevYear`),
  28024. onClick: rightPrevYear
  28025. }, [
  28026. vue.renderSlot(_ctx.$slots, "prev-year", {}, () => [
  28027. vue.createVNode(vue.unref(ElIcon), null, {
  28028. default: vue.withCtx(() => [
  28029. vue.createVNode(vue.unref(d_arrow_left_default))
  28030. ]),
  28031. _: 1
  28032. })
  28033. ])
  28034. ], 10, ["disabled", "aria-label"])) : vue.createCommentVNode("v-if", true),
  28035. _ctx.unlinkPanels ? (vue.openBlock(), vue.createElementBlock("button", {
  28036. key: 1,
  28037. type: "button",
  28038. disabled: !vue.unref(enableMonthArrow),
  28039. class: vue.normalizeClass([[
  28040. vue.unref(ppNs).e("icon-btn"),
  28041. { "is-disabled": !vue.unref(enableMonthArrow) }
  28042. ], "arrow-left"]),
  28043. "aria-label": vue.unref(t)(`el.datepicker.prevMonth`),
  28044. onClick: rightPrevMonth
  28045. }, [
  28046. vue.renderSlot(_ctx.$slots, "prev-month", {}, () => [
  28047. vue.createVNode(vue.unref(ElIcon), null, {
  28048. default: vue.withCtx(() => [
  28049. vue.createVNode(vue.unref(arrow_left_default))
  28050. ]),
  28051. _: 1
  28052. })
  28053. ])
  28054. ], 10, ["disabled", "aria-label"])) : vue.createCommentVNode("v-if", true),
  28055. vue.createElementVNode("button", {
  28056. type: "button",
  28057. "aria-label": vue.unref(t)(`el.datepicker.nextYear`),
  28058. class: vue.normalizeClass([vue.unref(ppNs).e("icon-btn"), "d-arrow-right"]),
  28059. onClick: rightNextYear
  28060. }, [
  28061. vue.renderSlot(_ctx.$slots, "next-year", {}, () => [
  28062. vue.createVNode(vue.unref(ElIcon), null, {
  28063. default: vue.withCtx(() => [
  28064. vue.createVNode(vue.unref(d_arrow_right_default))
  28065. ]),
  28066. _: 1
  28067. })
  28068. ])
  28069. ], 10, ["aria-label"]),
  28070. vue.createElementVNode("button", {
  28071. type: "button",
  28072. class: vue.normalizeClass([vue.unref(ppNs).e("icon-btn"), "arrow-right"]),
  28073. "aria-label": vue.unref(t)(`el.datepicker.nextMonth`),
  28074. onClick: rightNextMonth
  28075. }, [
  28076. vue.renderSlot(_ctx.$slots, "next-month", {}, () => [
  28077. vue.createVNode(vue.unref(ElIcon), null, {
  28078. default: vue.withCtx(() => [
  28079. vue.createVNode(vue.unref(arrow_right_default))
  28080. ]),
  28081. _: 1
  28082. })
  28083. ])
  28084. ], 10, ["aria-label"]),
  28085. vue.createElementVNode("div", null, vue.toDisplayString(vue.unref(rightLabel)), 1)
  28086. ], 2),
  28087. vue.createVNode(DateTable, {
  28088. "selection-mode": "range",
  28089. date: rightDate.value,
  28090. "min-date": vue.unref(minDate),
  28091. "max-date": vue.unref(maxDate),
  28092. "range-state": vue.unref(rangeState),
  28093. "disabled-date": vue.unref(disabledDate),
  28094. "cell-class-name": vue.unref(cellClassName),
  28095. onChangerange: vue.unref(handleChangeRange),
  28096. onPick: handleRangePick,
  28097. onSelect: vue.unref(onSelect)
  28098. }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "cell-class-name", "onChangerange", "onSelect"])
  28099. ], 2)
  28100. ], 2)
  28101. ], 2),
  28102. vue.unref(showTime) ? (vue.openBlock(), vue.createElementBlock("div", {
  28103. key: 0,
  28104. class: vue.normalizeClass(vue.unref(ppNs).e("footer"))
  28105. }, [
  28106. vue.unref(clearable) ? (vue.openBlock(), vue.createBlock(vue.unref(ElButton), {
  28107. key: 0,
  28108. text: "",
  28109. size: "small",
  28110. class: vue.normalizeClass(vue.unref(ppNs).e("link-btn")),
  28111. onClick: handleClear
  28112. }, {
  28113. default: vue.withCtx(() => [
  28114. vue.createTextVNode(vue.toDisplayString(vue.unref(t)("el.datepicker.clear")), 1)
  28115. ]),
  28116. _: 1
  28117. }, 8, ["class"])) : vue.createCommentVNode("v-if", true),
  28118. vue.createVNode(vue.unref(ElButton), {
  28119. plain: "",
  28120. size: "small",
  28121. class: vue.normalizeClass(vue.unref(ppNs).e("link-btn")),
  28122. disabled: vue.unref(btnDisabled),
  28123. onClick: ($event) => vue.unref(handleRangeConfirm)(false)
  28124. }, {
  28125. default: vue.withCtx(() => [
  28126. vue.createTextVNode(vue.toDisplayString(vue.unref(t)("el.datepicker.confirm")), 1)
  28127. ]),
  28128. _: 1
  28129. }, 8, ["class", "disabled", "onClick"])
  28130. ], 2)) : vue.createCommentVNode("v-if", true)
  28131. ], 2);
  28132. };
  28133. }
  28134. });
  28135. var DateRangePickPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1u, [["__file", "panel-date-range.vue"]]);
  28136. const panelMonthRangeProps = buildProps({
  28137. ...panelRangeSharedProps
  28138. });
  28139. const panelMonthRangeEmits = [
  28140. "pick",
  28141. "set-picker-option",
  28142. "calendar-change"
  28143. ];
  28144. const useMonthRangeHeader = ({
  28145. unlinkPanels,
  28146. leftDate,
  28147. rightDate
  28148. }) => {
  28149. const { t } = useLocale();
  28150. const leftPrevYear = () => {
  28151. leftDate.value = leftDate.value.subtract(1, "year");
  28152. if (!unlinkPanels.value) {
  28153. rightDate.value = rightDate.value.subtract(1, "year");
  28154. }
  28155. };
  28156. const rightNextYear = () => {
  28157. if (!unlinkPanels.value) {
  28158. leftDate.value = leftDate.value.add(1, "year");
  28159. }
  28160. rightDate.value = rightDate.value.add(1, "year");
  28161. };
  28162. const leftNextYear = () => {
  28163. leftDate.value = leftDate.value.add(1, "year");
  28164. };
  28165. const rightPrevYear = () => {
  28166. rightDate.value = rightDate.value.subtract(1, "year");
  28167. };
  28168. const leftLabel = vue.computed(() => {
  28169. return `${leftDate.value.year()} ${t("el.datepicker.year")}`;
  28170. });
  28171. const rightLabel = vue.computed(() => {
  28172. return `${rightDate.value.year()} ${t("el.datepicker.year")}`;
  28173. });
  28174. const leftYear = vue.computed(() => {
  28175. return leftDate.value.year();
  28176. });
  28177. const rightYear = vue.computed(() => {
  28178. return rightDate.value.year() === leftDate.value.year() ? leftDate.value.year() + 1 : rightDate.value.year();
  28179. });
  28180. return {
  28181. leftPrevYear,
  28182. rightNextYear,
  28183. leftNextYear,
  28184. rightPrevYear,
  28185. leftLabel,
  28186. rightLabel,
  28187. leftYear,
  28188. rightYear
  28189. };
  28190. };
  28191. const unit$1 = "year";
  28192. const __default__$13 = vue.defineComponent({
  28193. name: "DatePickerMonthRange"
  28194. });
  28195. const _sfc_main$1t = /* @__PURE__ */ vue.defineComponent({
  28196. ...__default__$13,
  28197. props: panelMonthRangeProps,
  28198. emits: panelMonthRangeEmits,
  28199. setup(__props, { emit }) {
  28200. const props = __props;
  28201. const { lang } = useLocale();
  28202. const pickerBase = vue.inject("EP_PICKER_BASE");
  28203. const { shortcuts, disabledDate } = pickerBase.props;
  28204. const format = vue.toRef(pickerBase.props, "format");
  28205. const defaultValue = vue.toRef(pickerBase.props, "defaultValue");
  28206. const leftDate = vue.ref(dayjs().locale(lang.value));
  28207. const rightDate = vue.ref(dayjs().locale(lang.value).add(1, unit$1));
  28208. const {
  28209. minDate,
  28210. maxDate,
  28211. rangeState,
  28212. ppNs,
  28213. drpNs,
  28214. handleChangeRange,
  28215. handleRangeConfirm,
  28216. handleShortcutClick,
  28217. onSelect
  28218. } = useRangePicker(props, {
  28219. defaultValue,
  28220. leftDate,
  28221. rightDate,
  28222. unit: unit$1,
  28223. onParsedValueChanged
  28224. });
  28225. const hasShortcuts = vue.computed(() => !!shortcuts.length);
  28226. const {
  28227. leftPrevYear,
  28228. rightNextYear,
  28229. leftNextYear,
  28230. rightPrevYear,
  28231. leftLabel,
  28232. rightLabel,
  28233. leftYear,
  28234. rightYear
  28235. } = useMonthRangeHeader({
  28236. unlinkPanels: vue.toRef(props, "unlinkPanels"),
  28237. leftDate,
  28238. rightDate
  28239. });
  28240. const enableYearArrow = vue.computed(() => {
  28241. return props.unlinkPanels && rightYear.value > leftYear.value + 1;
  28242. });
  28243. const handleRangePick = (val, close = true) => {
  28244. const minDate_ = val.minDate;
  28245. const maxDate_ = val.maxDate;
  28246. if (maxDate.value === maxDate_ && minDate.value === minDate_) {
  28247. return;
  28248. }
  28249. emit("calendar-change", [minDate_.toDate(), maxDate_ && maxDate_.toDate()]);
  28250. maxDate.value = maxDate_;
  28251. minDate.value = minDate_;
  28252. if (!close)
  28253. return;
  28254. handleRangeConfirm();
  28255. };
  28256. const handleClear = () => {
  28257. leftDate.value = getDefaultValue(vue.unref(defaultValue), {
  28258. lang: vue.unref(lang),
  28259. unit: "year",
  28260. unlinkPanels: props.unlinkPanels
  28261. })[0];
  28262. rightDate.value = leftDate.value.add(1, "year");
  28263. emit("pick", null);
  28264. };
  28265. const formatToString = (value) => {
  28266. return isArray$1(value) ? value.map((_) => _.format(format.value)) : value.format(format.value);
  28267. };
  28268. const parseUserInput = (value) => {
  28269. return isArray$1(value) ? value.map((_) => dayjs(_, format.value).locale(lang.value)) : dayjs(value, format.value).locale(lang.value);
  28270. };
  28271. function onParsedValueChanged(minDate2, maxDate2) {
  28272. if (props.unlinkPanels && maxDate2) {
  28273. const minDateYear = (minDate2 == null ? void 0 : minDate2.year()) || 0;
  28274. const maxDateYear = maxDate2.year();
  28275. rightDate.value = minDateYear === maxDateYear ? maxDate2.add(1, unit$1) : maxDate2;
  28276. } else {
  28277. rightDate.value = leftDate.value.add(1, unit$1);
  28278. }
  28279. }
  28280. emit("set-picker-option", ["isValidValue", isValidRange]);
  28281. emit("set-picker-option", ["formatToString", formatToString]);
  28282. emit("set-picker-option", ["parseUserInput", parseUserInput]);
  28283. emit("set-picker-option", ["handleClear", handleClear]);
  28284. return (_ctx, _cache) => {
  28285. return vue.openBlock(), vue.createElementBlock("div", {
  28286. class: vue.normalizeClass([
  28287. vue.unref(ppNs).b(),
  28288. vue.unref(drpNs).b(),
  28289. {
  28290. "has-sidebar": Boolean(_ctx.$slots.sidebar) || vue.unref(hasShortcuts)
  28291. }
  28292. ])
  28293. }, [
  28294. vue.createElementVNode("div", {
  28295. class: vue.normalizeClass(vue.unref(ppNs).e("body-wrapper"))
  28296. }, [
  28297. vue.renderSlot(_ctx.$slots, "sidebar", {
  28298. class: vue.normalizeClass(vue.unref(ppNs).e("sidebar"))
  28299. }),
  28300. vue.unref(hasShortcuts) ? (vue.openBlock(), vue.createElementBlock("div", {
  28301. key: 0,
  28302. class: vue.normalizeClass(vue.unref(ppNs).e("sidebar"))
  28303. }, [
  28304. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(shortcuts), (shortcut, key) => {
  28305. return vue.openBlock(), vue.createElementBlock("button", {
  28306. key,
  28307. type: "button",
  28308. class: vue.normalizeClass(vue.unref(ppNs).e("shortcut")),
  28309. onClick: ($event) => vue.unref(handleShortcutClick)(shortcut)
  28310. }, vue.toDisplayString(shortcut.text), 11, ["onClick"]);
  28311. }), 128))
  28312. ], 2)) : vue.createCommentVNode("v-if", true),
  28313. vue.createElementVNode("div", {
  28314. class: vue.normalizeClass(vue.unref(ppNs).e("body"))
  28315. }, [
  28316. vue.createElementVNode("div", {
  28317. class: vue.normalizeClass([[vue.unref(ppNs).e("content"), vue.unref(drpNs).e("content")], "is-left"])
  28318. }, [
  28319. vue.createElementVNode("div", {
  28320. class: vue.normalizeClass(vue.unref(drpNs).e("header"))
  28321. }, [
  28322. vue.createElementVNode("button", {
  28323. type: "button",
  28324. class: vue.normalizeClass([vue.unref(ppNs).e("icon-btn"), "d-arrow-left"]),
  28325. onClick: vue.unref(leftPrevYear)
  28326. }, [
  28327. vue.renderSlot(_ctx.$slots, "prev-year", {}, () => [
  28328. vue.createVNode(vue.unref(ElIcon), null, {
  28329. default: vue.withCtx(() => [
  28330. vue.createVNode(vue.unref(d_arrow_left_default))
  28331. ]),
  28332. _: 1
  28333. })
  28334. ])
  28335. ], 10, ["onClick"]),
  28336. _ctx.unlinkPanels ? (vue.openBlock(), vue.createElementBlock("button", {
  28337. key: 0,
  28338. type: "button",
  28339. disabled: !vue.unref(enableYearArrow),
  28340. class: vue.normalizeClass([[
  28341. vue.unref(ppNs).e("icon-btn"),
  28342. { [vue.unref(ppNs).is("disabled")]: !vue.unref(enableYearArrow) }
  28343. ], "d-arrow-right"]),
  28344. onClick: vue.unref(leftNextYear)
  28345. }, [
  28346. vue.renderSlot(_ctx.$slots, "next-year", {}, () => [
  28347. vue.createVNode(vue.unref(ElIcon), null, {
  28348. default: vue.withCtx(() => [
  28349. vue.createVNode(vue.unref(d_arrow_right_default))
  28350. ]),
  28351. _: 1
  28352. })
  28353. ])
  28354. ], 10, ["disabled", "onClick"])) : vue.createCommentVNode("v-if", true),
  28355. vue.createElementVNode("div", null, vue.toDisplayString(vue.unref(leftLabel)), 1)
  28356. ], 2),
  28357. vue.createVNode(MonthTable, {
  28358. "selection-mode": "range",
  28359. date: leftDate.value,
  28360. "min-date": vue.unref(minDate),
  28361. "max-date": vue.unref(maxDate),
  28362. "range-state": vue.unref(rangeState),
  28363. "disabled-date": vue.unref(disabledDate),
  28364. onChangerange: vue.unref(handleChangeRange),
  28365. onPick: handleRangePick,
  28366. onSelect: vue.unref(onSelect)
  28367. }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "onChangerange", "onSelect"])
  28368. ], 2),
  28369. vue.createElementVNode("div", {
  28370. class: vue.normalizeClass([[vue.unref(ppNs).e("content"), vue.unref(drpNs).e("content")], "is-right"])
  28371. }, [
  28372. vue.createElementVNode("div", {
  28373. class: vue.normalizeClass(vue.unref(drpNs).e("header"))
  28374. }, [
  28375. _ctx.unlinkPanels ? (vue.openBlock(), vue.createElementBlock("button", {
  28376. key: 0,
  28377. type: "button",
  28378. disabled: !vue.unref(enableYearArrow),
  28379. class: vue.normalizeClass([[vue.unref(ppNs).e("icon-btn"), { "is-disabled": !vue.unref(enableYearArrow) }], "d-arrow-left"]),
  28380. onClick: vue.unref(rightPrevYear)
  28381. }, [
  28382. vue.renderSlot(_ctx.$slots, "prev-year", {}, () => [
  28383. vue.createVNode(vue.unref(ElIcon), null, {
  28384. default: vue.withCtx(() => [
  28385. vue.createVNode(vue.unref(d_arrow_left_default))
  28386. ]),
  28387. _: 1
  28388. })
  28389. ])
  28390. ], 10, ["disabled", "onClick"])) : vue.createCommentVNode("v-if", true),
  28391. vue.createElementVNode("button", {
  28392. type: "button",
  28393. class: vue.normalizeClass([vue.unref(ppNs).e("icon-btn"), "d-arrow-right"]),
  28394. onClick: vue.unref(rightNextYear)
  28395. }, [
  28396. vue.renderSlot(_ctx.$slots, "next-year", {}, () => [
  28397. vue.createVNode(vue.unref(ElIcon), null, {
  28398. default: vue.withCtx(() => [
  28399. vue.createVNode(vue.unref(d_arrow_right_default))
  28400. ]),
  28401. _: 1
  28402. })
  28403. ])
  28404. ], 10, ["onClick"]),
  28405. vue.createElementVNode("div", null, vue.toDisplayString(vue.unref(rightLabel)), 1)
  28406. ], 2),
  28407. vue.createVNode(MonthTable, {
  28408. "selection-mode": "range",
  28409. date: rightDate.value,
  28410. "min-date": vue.unref(minDate),
  28411. "max-date": vue.unref(maxDate),
  28412. "range-state": vue.unref(rangeState),
  28413. "disabled-date": vue.unref(disabledDate),
  28414. onChangerange: vue.unref(handleChangeRange),
  28415. onPick: handleRangePick,
  28416. onSelect: vue.unref(onSelect)
  28417. }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "onChangerange", "onSelect"])
  28418. ], 2)
  28419. ], 2)
  28420. ], 2)
  28421. ], 2);
  28422. };
  28423. }
  28424. });
  28425. var MonthRangePickPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1t, [["__file", "panel-month-range.vue"]]);
  28426. const panelYearRangeProps = buildProps({
  28427. ...panelRangeSharedProps
  28428. });
  28429. const panelYearRangeEmits = [
  28430. "pick",
  28431. "set-picker-option",
  28432. "calendar-change"
  28433. ];
  28434. const useYearRangeHeader = ({
  28435. unlinkPanels,
  28436. leftDate,
  28437. rightDate
  28438. }) => {
  28439. const leftPrevYear = () => {
  28440. leftDate.value = leftDate.value.subtract(10, "year");
  28441. if (!unlinkPanels.value) {
  28442. rightDate.value = rightDate.value.subtract(10, "year");
  28443. }
  28444. };
  28445. const rightNextYear = () => {
  28446. if (!unlinkPanels.value) {
  28447. leftDate.value = leftDate.value.add(10, "year");
  28448. }
  28449. rightDate.value = rightDate.value.add(10, "year");
  28450. };
  28451. const leftNextYear = () => {
  28452. leftDate.value = leftDate.value.add(10, "year");
  28453. };
  28454. const rightPrevYear = () => {
  28455. rightDate.value = rightDate.value.subtract(10, "year");
  28456. };
  28457. const leftLabel = vue.computed(() => {
  28458. const leftStartDate = Math.floor(leftDate.value.year() / 10) * 10;
  28459. return `${leftStartDate}-${leftStartDate + 9}`;
  28460. });
  28461. const rightLabel = vue.computed(() => {
  28462. const rightStartDate = Math.floor(rightDate.value.year() / 10) * 10;
  28463. return `${rightStartDate}-${rightStartDate + 9}`;
  28464. });
  28465. const leftYear = vue.computed(() => {
  28466. const leftEndDate = Math.floor(leftDate.value.year() / 10) * 10 + 9;
  28467. return leftEndDate;
  28468. });
  28469. const rightYear = vue.computed(() => {
  28470. const rightStartDate = Math.floor(rightDate.value.year() / 10) * 10;
  28471. return rightStartDate;
  28472. });
  28473. return {
  28474. leftPrevYear,
  28475. rightNextYear,
  28476. leftNextYear,
  28477. rightPrevYear,
  28478. leftLabel,
  28479. rightLabel,
  28480. leftYear,
  28481. rightYear
  28482. };
  28483. };
  28484. const unit = "year";
  28485. const __default__$12 = vue.defineComponent({
  28486. name: "DatePickerYearRange"
  28487. });
  28488. const _sfc_main$1s = /* @__PURE__ */ vue.defineComponent({
  28489. ...__default__$12,
  28490. props: panelYearRangeProps,
  28491. emits: panelYearRangeEmits,
  28492. setup(__props, { emit }) {
  28493. const props = __props;
  28494. const { lang } = useLocale();
  28495. const leftDate = vue.ref(dayjs().locale(lang.value));
  28496. const rightDate = vue.ref(leftDate.value.add(10, "year"));
  28497. const { pickerNs: ppNs } = vue.inject(ROOT_PICKER_INJECTION_KEY);
  28498. const drpNs = useNamespace("date-range-picker");
  28499. const hasShortcuts = vue.computed(() => !!shortcuts.length);
  28500. const panelKls = vue.computed(() => [
  28501. ppNs.b(),
  28502. drpNs.b(),
  28503. {
  28504. "has-sidebar": Boolean(vue.useSlots().sidebar) || hasShortcuts.value
  28505. }
  28506. ]);
  28507. const leftPanelKls = vue.computed(() => {
  28508. return {
  28509. content: [ppNs.e("content"), drpNs.e("content"), "is-left"],
  28510. arrowLeftBtn: [ppNs.e("icon-btn"), "d-arrow-left"],
  28511. arrowRightBtn: [
  28512. ppNs.e("icon-btn"),
  28513. { [ppNs.is("disabled")]: !enableYearArrow.value },
  28514. "d-arrow-right"
  28515. ]
  28516. };
  28517. });
  28518. const rightPanelKls = vue.computed(() => {
  28519. return {
  28520. content: [ppNs.e("content"), drpNs.e("content"), "is-right"],
  28521. arrowLeftBtn: [
  28522. ppNs.e("icon-btn"),
  28523. { "is-disabled": !enableYearArrow.value },
  28524. "d-arrow-left"
  28525. ],
  28526. arrowRightBtn: [ppNs.e("icon-btn"), "d-arrow-right"]
  28527. };
  28528. });
  28529. const handleShortcutClick = useShortcut(lang);
  28530. const {
  28531. leftPrevYear,
  28532. rightNextYear,
  28533. leftNextYear,
  28534. rightPrevYear,
  28535. leftLabel,
  28536. rightLabel,
  28537. leftYear,
  28538. rightYear
  28539. } = useYearRangeHeader({
  28540. unlinkPanels: vue.toRef(props, "unlinkPanels"),
  28541. leftDate,
  28542. rightDate
  28543. });
  28544. const enableYearArrow = vue.computed(() => {
  28545. return props.unlinkPanels && rightYear.value > leftYear.value + 1;
  28546. });
  28547. const minDate = vue.ref();
  28548. const maxDate = vue.ref();
  28549. const rangeState = vue.ref({
  28550. endDate: null,
  28551. selecting: false
  28552. });
  28553. const handleChangeRange = (val) => {
  28554. rangeState.value = val;
  28555. };
  28556. const handleRangePick = (val, close = true) => {
  28557. const minDate_ = val.minDate;
  28558. const maxDate_ = val.maxDate;
  28559. if (maxDate.value === maxDate_ && minDate.value === minDate_) {
  28560. return;
  28561. }
  28562. emit("calendar-change", [minDate_.toDate(), maxDate_ && maxDate_.toDate()]);
  28563. maxDate.value = maxDate_;
  28564. minDate.value = minDate_;
  28565. if (!close)
  28566. return;
  28567. handleConfirm();
  28568. };
  28569. const handleConfirm = (visible = false) => {
  28570. if (isValidRange([minDate.value, maxDate.value])) {
  28571. emit("pick", [minDate.value, maxDate.value], visible);
  28572. }
  28573. };
  28574. const onSelect = (selecting) => {
  28575. rangeState.value.selecting = selecting;
  28576. if (!selecting) {
  28577. rangeState.value.endDate = null;
  28578. }
  28579. };
  28580. const pickerBase = vue.inject("EP_PICKER_BASE");
  28581. const { shortcuts, disabledDate } = pickerBase.props;
  28582. const format = vue.toRef(pickerBase.props, "format");
  28583. const defaultValue = vue.toRef(pickerBase.props, "defaultValue");
  28584. const getDefaultValue = () => {
  28585. let start;
  28586. if (isArray$1(defaultValue.value)) {
  28587. const left = dayjs(defaultValue.value[0]);
  28588. let right = dayjs(defaultValue.value[1]);
  28589. if (!props.unlinkPanels) {
  28590. right = left.add(10, unit);
  28591. }
  28592. return [left, right];
  28593. } else if (defaultValue.value) {
  28594. start = dayjs(defaultValue.value);
  28595. } else {
  28596. start = dayjs();
  28597. }
  28598. start = start.locale(lang.value);
  28599. return [start, start.add(10, unit)];
  28600. };
  28601. vue.watch(() => defaultValue.value, (val) => {
  28602. if (val) {
  28603. const defaultArr = getDefaultValue();
  28604. leftDate.value = defaultArr[0];
  28605. rightDate.value = defaultArr[1];
  28606. }
  28607. }, { immediate: true });
  28608. vue.watch(() => props.parsedValue, (newVal) => {
  28609. if (newVal && newVal.length === 2) {
  28610. minDate.value = newVal[0];
  28611. maxDate.value = newVal[1];
  28612. leftDate.value = minDate.value;
  28613. if (props.unlinkPanels && maxDate.value) {
  28614. const minDateYear = minDate.value.year();
  28615. const maxDateYear = maxDate.value.year();
  28616. rightDate.value = minDateYear === maxDateYear ? maxDate.value.add(10, "year") : maxDate.value;
  28617. } else {
  28618. rightDate.value = leftDate.value.add(10, "year");
  28619. }
  28620. } else {
  28621. const defaultArr = getDefaultValue();
  28622. minDate.value = void 0;
  28623. maxDate.value = void 0;
  28624. leftDate.value = defaultArr[0];
  28625. rightDate.value = defaultArr[1];
  28626. }
  28627. }, { immediate: true });
  28628. const parseUserInput = (value) => {
  28629. return isArray$1(value) ? value.map((_) => dayjs(_, format.value).locale(lang.value)) : dayjs(value, format.value).locale(lang.value);
  28630. };
  28631. const formatToString = (value) => {
  28632. return isArray$1(value) ? value.map((day) => day.format(format.value)) : value.format(format.value);
  28633. };
  28634. const isValidValue = (date) => {
  28635. return isValidRange(date) && (disabledDate ? !disabledDate(date[0].toDate()) && !disabledDate(date[1].toDate()) : true);
  28636. };
  28637. const handleClear = () => {
  28638. const defaultArr = getDefaultValue();
  28639. leftDate.value = defaultArr[0];
  28640. rightDate.value = defaultArr[1];
  28641. maxDate.value = void 0;
  28642. minDate.value = void 0;
  28643. emit("pick", null);
  28644. };
  28645. emit("set-picker-option", ["isValidValue", isValidValue]);
  28646. emit("set-picker-option", ["parseUserInput", parseUserInput]);
  28647. emit("set-picker-option", ["formatToString", formatToString]);
  28648. emit("set-picker-option", ["handleClear", handleClear]);
  28649. return (_ctx, _cache) => {
  28650. return vue.openBlock(), vue.createElementBlock("div", {
  28651. class: vue.normalizeClass(vue.unref(panelKls))
  28652. }, [
  28653. vue.createElementVNode("div", {
  28654. class: vue.normalizeClass(vue.unref(ppNs).e("body-wrapper"))
  28655. }, [
  28656. vue.renderSlot(_ctx.$slots, "sidebar", {
  28657. class: vue.normalizeClass(vue.unref(ppNs).e("sidebar"))
  28658. }),
  28659. vue.unref(hasShortcuts) ? (vue.openBlock(), vue.createElementBlock("div", {
  28660. key: 0,
  28661. class: vue.normalizeClass(vue.unref(ppNs).e("sidebar"))
  28662. }, [
  28663. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(shortcuts), (shortcut, key) => {
  28664. return vue.openBlock(), vue.createElementBlock("button", {
  28665. key,
  28666. type: "button",
  28667. class: vue.normalizeClass(vue.unref(ppNs).e("shortcut")),
  28668. onClick: ($event) => vue.unref(handleShortcutClick)(shortcut)
  28669. }, vue.toDisplayString(shortcut.text), 11, ["onClick"]);
  28670. }), 128))
  28671. ], 2)) : vue.createCommentVNode("v-if", true),
  28672. vue.createElementVNode("div", {
  28673. class: vue.normalizeClass(vue.unref(ppNs).e("body"))
  28674. }, [
  28675. vue.createElementVNode("div", {
  28676. class: vue.normalizeClass(vue.unref(leftPanelKls).content)
  28677. }, [
  28678. vue.createElementVNode("div", {
  28679. class: vue.normalizeClass(vue.unref(drpNs).e("header"))
  28680. }, [
  28681. vue.createElementVNode("button", {
  28682. type: "button",
  28683. class: vue.normalizeClass(vue.unref(leftPanelKls).arrowLeftBtn),
  28684. onClick: vue.unref(leftPrevYear)
  28685. }, [
  28686. vue.renderSlot(_ctx.$slots, "prev-year", {}, () => [
  28687. vue.createVNode(vue.unref(ElIcon), null, {
  28688. default: vue.withCtx(() => [
  28689. vue.createVNode(vue.unref(d_arrow_left_default))
  28690. ]),
  28691. _: 1
  28692. })
  28693. ])
  28694. ], 10, ["onClick"]),
  28695. _ctx.unlinkPanels ? (vue.openBlock(), vue.createElementBlock("button", {
  28696. key: 0,
  28697. type: "button",
  28698. disabled: !vue.unref(enableYearArrow),
  28699. class: vue.normalizeClass(vue.unref(leftPanelKls).arrowRightBtn),
  28700. onClick: vue.unref(leftNextYear)
  28701. }, [
  28702. vue.renderSlot(_ctx.$slots, "next-year", {}, () => [
  28703. vue.createVNode(vue.unref(ElIcon), null, {
  28704. default: vue.withCtx(() => [
  28705. vue.createVNode(vue.unref(d_arrow_right_default))
  28706. ]),
  28707. _: 1
  28708. })
  28709. ])
  28710. ], 10, ["disabled", "onClick"])) : vue.createCommentVNode("v-if", true),
  28711. vue.createElementVNode("div", null, vue.toDisplayString(vue.unref(leftLabel)), 1)
  28712. ], 2),
  28713. vue.createVNode(YearTable, {
  28714. "selection-mode": "range",
  28715. date: leftDate.value,
  28716. "min-date": minDate.value,
  28717. "max-date": maxDate.value,
  28718. "range-state": rangeState.value,
  28719. "disabled-date": vue.unref(disabledDate),
  28720. onChangerange: handleChangeRange,
  28721. onPick: handleRangePick,
  28722. onSelect
  28723. }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date"])
  28724. ], 2),
  28725. vue.createElementVNode("div", {
  28726. class: vue.normalizeClass(vue.unref(rightPanelKls).content)
  28727. }, [
  28728. vue.createElementVNode("div", {
  28729. class: vue.normalizeClass(vue.unref(drpNs).e("header"))
  28730. }, [
  28731. _ctx.unlinkPanels ? (vue.openBlock(), vue.createElementBlock("button", {
  28732. key: 0,
  28733. type: "button",
  28734. disabled: !vue.unref(enableYearArrow),
  28735. class: vue.normalizeClass(vue.unref(rightPanelKls).arrowLeftBtn),
  28736. onClick: vue.unref(rightPrevYear)
  28737. }, [
  28738. vue.renderSlot(_ctx.$slots, "prev-year", {}, () => [
  28739. vue.createVNode(vue.unref(ElIcon), null, {
  28740. default: vue.withCtx(() => [
  28741. vue.createVNode(vue.unref(d_arrow_left_default))
  28742. ]),
  28743. _: 1
  28744. })
  28745. ])
  28746. ], 10, ["disabled", "onClick"])) : vue.createCommentVNode("v-if", true),
  28747. vue.createElementVNode("button", {
  28748. type: "button",
  28749. class: vue.normalizeClass(vue.unref(rightPanelKls).arrowRightBtn),
  28750. onClick: vue.unref(rightNextYear)
  28751. }, [
  28752. vue.renderSlot(_ctx.$slots, "next-year", {}, () => [
  28753. vue.createVNode(vue.unref(ElIcon), null, {
  28754. default: vue.withCtx(() => [
  28755. vue.createVNode(vue.unref(d_arrow_right_default))
  28756. ]),
  28757. _: 1
  28758. })
  28759. ])
  28760. ], 10, ["onClick"]),
  28761. vue.createElementVNode("div", null, vue.toDisplayString(vue.unref(rightLabel)), 1)
  28762. ], 2),
  28763. vue.createVNode(YearTable, {
  28764. "selection-mode": "range",
  28765. date: rightDate.value,
  28766. "min-date": minDate.value,
  28767. "max-date": maxDate.value,
  28768. "range-state": rangeState.value,
  28769. "disabled-date": vue.unref(disabledDate),
  28770. onChangerange: handleChangeRange,
  28771. onPick: handleRangePick,
  28772. onSelect
  28773. }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date"])
  28774. ], 2)
  28775. ], 2)
  28776. ], 2)
  28777. ], 2);
  28778. };
  28779. }
  28780. });
  28781. var YearRangePickPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1s, [["__file", "panel-year-range.vue"]]);
  28782. const getPanel = function(type) {
  28783. switch (type) {
  28784. case "daterange":
  28785. case "datetimerange": {
  28786. return DateRangePickPanel;
  28787. }
  28788. case "monthrange": {
  28789. return MonthRangePickPanel;
  28790. }
  28791. case "yearrange": {
  28792. return YearRangePickPanel;
  28793. }
  28794. default: {
  28795. return DatePickPanel;
  28796. }
  28797. }
  28798. };
  28799. dayjs.extend(localeData);
  28800. dayjs.extend(advancedFormat);
  28801. dayjs.extend(customParseFormat);
  28802. dayjs.extend(weekOfYear);
  28803. dayjs.extend(weekYear);
  28804. dayjs.extend(dayOfYear);
  28805. dayjs.extend(isSameOrAfter);
  28806. dayjs.extend(isSameOrBefore);
  28807. var DatePicker = vue.defineComponent({
  28808. name: "ElDatePicker",
  28809. install: null,
  28810. props: datePickerProps,
  28811. emits: ["update:modelValue"],
  28812. setup(props, {
  28813. expose,
  28814. emit,
  28815. slots
  28816. }) {
  28817. const ns = useNamespace("picker-panel");
  28818. vue.provide("ElPopperOptions", vue.reactive(vue.toRef(props, "popperOptions")));
  28819. vue.provide(ROOT_PICKER_INJECTION_KEY, {
  28820. slots,
  28821. pickerNs: ns
  28822. });
  28823. const commonPicker = vue.ref();
  28824. const refProps = {
  28825. focus: () => {
  28826. var _a;
  28827. (_a = commonPicker.value) == null ? void 0 : _a.focus();
  28828. },
  28829. blur: () => {
  28830. var _a;
  28831. (_a = commonPicker.value) == null ? void 0 : _a.blur();
  28832. },
  28833. handleOpen: () => {
  28834. var _a;
  28835. (_a = commonPicker.value) == null ? void 0 : _a.handleOpen();
  28836. },
  28837. handleClose: () => {
  28838. var _a;
  28839. (_a = commonPicker.value) == null ? void 0 : _a.handleClose();
  28840. }
  28841. };
  28842. expose(refProps);
  28843. const onModelValueUpdated = (val) => {
  28844. emit("update:modelValue", val);
  28845. };
  28846. return () => {
  28847. var _a;
  28848. const format = (_a = props.format) != null ? _a : DEFAULT_FORMATS_DATEPICKER[props.type] || DEFAULT_FORMATS_DATE;
  28849. const Component = getPanel(props.type);
  28850. return vue.createVNode(CommonPicker, vue.mergeProps(props, {
  28851. "format": format,
  28852. "type": props.type,
  28853. "ref": commonPicker,
  28854. "onUpdate:modelValue": onModelValueUpdated
  28855. }), {
  28856. default: (scopedProps) => vue.createVNode(Component, scopedProps, {
  28857. "prev-month": slots["prev-month"],
  28858. "next-month": slots["next-month"],
  28859. "prev-year": slots["prev-year"],
  28860. "next-year": slots["next-year"]
  28861. }),
  28862. "range-separator": slots["range-separator"]
  28863. });
  28864. };
  28865. }
  28866. });
  28867. const ElDatePicker = withInstall(DatePicker);
  28868. const descriptionsKey = Symbol("elDescriptions");
  28869. var ElDescriptionsCell = vue.defineComponent({
  28870. name: "ElDescriptionsCell",
  28871. props: {
  28872. cell: {
  28873. type: Object
  28874. },
  28875. tag: {
  28876. type: String,
  28877. default: "td"
  28878. },
  28879. type: {
  28880. type: String
  28881. }
  28882. },
  28883. setup() {
  28884. const descriptions = vue.inject(descriptionsKey, {});
  28885. return {
  28886. descriptions
  28887. };
  28888. },
  28889. render() {
  28890. var _a;
  28891. const item = getNormalizedProps(this.cell);
  28892. const directives = (((_a = this.cell) == null ? void 0 : _a.dirs) || []).map((dire) => {
  28893. const { dir, arg, modifiers, value } = dire;
  28894. return [dir, value, arg, modifiers];
  28895. });
  28896. const { border, direction } = this.descriptions;
  28897. const isVertical = direction === "vertical";
  28898. const renderLabel = () => {
  28899. var _a2, _b, _c;
  28900. return ((_c = (_b = (_a2 = this.cell) == null ? void 0 : _a2.children) == null ? void 0 : _b.label) == null ? void 0 : _c.call(_b)) || item.label;
  28901. };
  28902. const renderContent = () => {
  28903. var _a2, _b, _c;
  28904. return (_c = (_b = (_a2 = this.cell) == null ? void 0 : _a2.children) == null ? void 0 : _b.default) == null ? void 0 : _c.call(_b);
  28905. };
  28906. const span = item.span;
  28907. const rowspan = item.rowspan;
  28908. const align = item.align ? `is-${item.align}` : "";
  28909. const labelAlign = item.labelAlign ? `is-${item.labelAlign}` : align;
  28910. const className = item.className;
  28911. const labelClassName = item.labelClassName;
  28912. const width = this.type === "label" ? item.labelWidth || this.descriptions.labelWidth || item.width : item.width;
  28913. const style = {
  28914. width: addUnit(width),
  28915. minWidth: addUnit(item.minWidth)
  28916. };
  28917. const ns = useNamespace("descriptions");
  28918. switch (this.type) {
  28919. case "label":
  28920. return vue.withDirectives(vue.h(this.tag, {
  28921. style,
  28922. class: [
  28923. ns.e("cell"),
  28924. ns.e("label"),
  28925. ns.is("bordered-label", border),
  28926. ns.is("vertical-label", isVertical),
  28927. labelAlign,
  28928. labelClassName
  28929. ],
  28930. colSpan: isVertical ? span : 1,
  28931. rowspan: isVertical ? 1 : rowspan
  28932. }, renderLabel()), directives);
  28933. case "content":
  28934. return vue.withDirectives(vue.h(this.tag, {
  28935. style,
  28936. class: [
  28937. ns.e("cell"),
  28938. ns.e("content"),
  28939. ns.is("bordered-content", border),
  28940. ns.is("vertical-content", isVertical),
  28941. align,
  28942. className
  28943. ],
  28944. colSpan: isVertical ? span : span * 2 - 1,
  28945. rowspan: isVertical ? rowspan * 2 - 1 : rowspan
  28946. }, renderContent()), directives);
  28947. default: {
  28948. const label = renderLabel();
  28949. return vue.withDirectives(vue.h("td", {
  28950. style,
  28951. class: [ns.e("cell"), align],
  28952. colSpan: span,
  28953. rowspan
  28954. }, [
  28955. !isNil(label) ? vue.h("span", {
  28956. class: [ns.e("label"), labelClassName]
  28957. }, label) : void 0,
  28958. vue.h("span", {
  28959. class: [ns.e("content"), className]
  28960. }, renderContent())
  28961. ]), directives);
  28962. }
  28963. }
  28964. }
  28965. });
  28966. const descriptionsRowProps = buildProps({
  28967. row: {
  28968. type: definePropType(Array),
  28969. default: () => []
  28970. }
  28971. });
  28972. const __default__$11 = vue.defineComponent({
  28973. name: "ElDescriptionsRow"
  28974. });
  28975. const _sfc_main$1r = /* @__PURE__ */ vue.defineComponent({
  28976. ...__default__$11,
  28977. props: descriptionsRowProps,
  28978. setup(__props) {
  28979. const descriptions = vue.inject(descriptionsKey, {});
  28980. return (_ctx, _cache) => {
  28981. return vue.unref(descriptions).direction === "vertical" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  28982. vue.createElementVNode("tr", null, [
  28983. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.row, (cell, _index) => {
  28984. return vue.openBlock(), vue.createBlock(vue.unref(ElDescriptionsCell), {
  28985. key: `tr1-${_index}`,
  28986. cell,
  28987. tag: "th",
  28988. type: "label"
  28989. }, null, 8, ["cell"]);
  28990. }), 128))
  28991. ]),
  28992. vue.createElementVNode("tr", null, [
  28993. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.row, (cell, _index) => {
  28994. return vue.openBlock(), vue.createBlock(vue.unref(ElDescriptionsCell), {
  28995. key: `tr2-${_index}`,
  28996. cell,
  28997. tag: "td",
  28998. type: "content"
  28999. }, null, 8, ["cell"]);
  29000. }), 128))
  29001. ])
  29002. ], 64)) : (vue.openBlock(), vue.createElementBlock("tr", { key: 1 }, [
  29003. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.row, (cell, _index) => {
  29004. return vue.openBlock(), vue.createElementBlock(vue.Fragment, {
  29005. key: `tr3-${_index}`
  29006. }, [
  29007. vue.unref(descriptions).border ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  29008. vue.createVNode(vue.unref(ElDescriptionsCell), {
  29009. cell,
  29010. tag: "td",
  29011. type: "label"
  29012. }, null, 8, ["cell"]),
  29013. vue.createVNode(vue.unref(ElDescriptionsCell), {
  29014. cell,
  29015. tag: "td",
  29016. type: "content"
  29017. }, null, 8, ["cell"])
  29018. ], 64)) : (vue.openBlock(), vue.createBlock(vue.unref(ElDescriptionsCell), {
  29019. key: 1,
  29020. cell,
  29021. tag: "td",
  29022. type: "both"
  29023. }, null, 8, ["cell"]))
  29024. ], 64);
  29025. }), 128))
  29026. ]));
  29027. };
  29028. }
  29029. });
  29030. var ElDescriptionsRow = /* @__PURE__ */ _export_sfc(_sfc_main$1r, [["__file", "descriptions-row.vue"]]);
  29031. const descriptionProps = buildProps({
  29032. border: Boolean,
  29033. column: {
  29034. type: Number,
  29035. default: 3
  29036. },
  29037. direction: {
  29038. type: String,
  29039. values: ["horizontal", "vertical"],
  29040. default: "horizontal"
  29041. },
  29042. size: useSizeProp,
  29043. title: {
  29044. type: String,
  29045. default: ""
  29046. },
  29047. extra: {
  29048. type: String,
  29049. default: ""
  29050. },
  29051. labelWidth: {
  29052. type: [String, Number],
  29053. default: ""
  29054. }
  29055. });
  29056. const __default__$10 = vue.defineComponent({
  29057. name: "ElDescriptions"
  29058. });
  29059. const _sfc_main$1q = /* @__PURE__ */ vue.defineComponent({
  29060. ...__default__$10,
  29061. props: descriptionProps,
  29062. setup(__props) {
  29063. const props = __props;
  29064. const ns = useNamespace("descriptions");
  29065. const descriptionsSize = useFormSize();
  29066. const slots = vue.useSlots();
  29067. vue.provide(descriptionsKey, props);
  29068. const descriptionKls = vue.computed(() => [ns.b(), ns.m(descriptionsSize.value)]);
  29069. const filledNode = (node, span, count, isLast = false) => {
  29070. if (!node.props) {
  29071. node.props = {};
  29072. }
  29073. if (span > count) {
  29074. node.props.span = count;
  29075. }
  29076. if (isLast) {
  29077. node.props.span = span;
  29078. }
  29079. return node;
  29080. };
  29081. const getRows = () => {
  29082. if (!slots.default)
  29083. return [];
  29084. const children = flattedChildren(slots.default()).filter((node) => {
  29085. var _a;
  29086. return ((_a = node == null ? void 0 : node.type) == null ? void 0 : _a.name) === "ElDescriptionsItem";
  29087. });
  29088. const rows = [];
  29089. let temp = [];
  29090. let count = props.column;
  29091. let totalSpan = 0;
  29092. const rowspanTemp = [];
  29093. children.forEach((node, index) => {
  29094. var _a, _b, _c;
  29095. const span = ((_a = node.props) == null ? void 0 : _a.span) || 1;
  29096. const rowspan = ((_b = node.props) == null ? void 0 : _b.rowspan) || 1;
  29097. const rowNo = rows.length;
  29098. rowspanTemp[rowNo] || (rowspanTemp[rowNo] = 0);
  29099. if (rowspan > 1) {
  29100. for (let i = 1; i < rowspan; i++) {
  29101. rowspanTemp[_c = rowNo + i] || (rowspanTemp[_c] = 0);
  29102. rowspanTemp[rowNo + i]++;
  29103. totalSpan++;
  29104. }
  29105. }
  29106. if (rowspanTemp[rowNo] > 0) {
  29107. count -= rowspanTemp[rowNo];
  29108. rowspanTemp[rowNo] = 0;
  29109. }
  29110. if (index < children.length - 1) {
  29111. totalSpan += span > count ? count : span;
  29112. }
  29113. if (index === children.length - 1) {
  29114. const lastSpan = props.column - totalSpan % props.column;
  29115. temp.push(filledNode(node, lastSpan, count, true));
  29116. rows.push(temp);
  29117. return;
  29118. }
  29119. if (span < count) {
  29120. count -= span;
  29121. temp.push(node);
  29122. } else {
  29123. temp.push(filledNode(node, span, count));
  29124. rows.push(temp);
  29125. count = props.column;
  29126. temp = [];
  29127. }
  29128. });
  29129. return rows;
  29130. };
  29131. return (_ctx, _cache) => {
  29132. return vue.openBlock(), vue.createElementBlock("div", {
  29133. class: vue.normalizeClass(vue.unref(descriptionKls))
  29134. }, [
  29135. _ctx.title || _ctx.extra || _ctx.$slots.title || _ctx.$slots.extra ? (vue.openBlock(), vue.createElementBlock("div", {
  29136. key: 0,
  29137. class: vue.normalizeClass(vue.unref(ns).e("header"))
  29138. }, [
  29139. vue.createElementVNode("div", {
  29140. class: vue.normalizeClass(vue.unref(ns).e("title"))
  29141. }, [
  29142. vue.renderSlot(_ctx.$slots, "title", {}, () => [
  29143. vue.createTextVNode(vue.toDisplayString(_ctx.title), 1)
  29144. ])
  29145. ], 2),
  29146. vue.createElementVNode("div", {
  29147. class: vue.normalizeClass(vue.unref(ns).e("extra"))
  29148. }, [
  29149. vue.renderSlot(_ctx.$slots, "extra", {}, () => [
  29150. vue.createTextVNode(vue.toDisplayString(_ctx.extra), 1)
  29151. ])
  29152. ], 2)
  29153. ], 2)) : vue.createCommentVNode("v-if", true),
  29154. vue.createElementVNode("div", {
  29155. class: vue.normalizeClass(vue.unref(ns).e("body"))
  29156. }, [
  29157. vue.createElementVNode("table", {
  29158. class: vue.normalizeClass([vue.unref(ns).e("table"), vue.unref(ns).is("bordered", _ctx.border)])
  29159. }, [
  29160. vue.createElementVNode("tbody", null, [
  29161. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(getRows(), (row, _index) => {
  29162. return vue.openBlock(), vue.createBlock(ElDescriptionsRow, {
  29163. key: _index,
  29164. row
  29165. }, null, 8, ["row"]);
  29166. }), 128))
  29167. ])
  29168. ], 2)
  29169. ], 2)
  29170. ], 2);
  29171. };
  29172. }
  29173. });
  29174. var Descriptions = /* @__PURE__ */ _export_sfc(_sfc_main$1q, [["__file", "description.vue"]]);
  29175. const descriptionItemProps = buildProps({
  29176. label: {
  29177. type: String,
  29178. default: ""
  29179. },
  29180. span: {
  29181. type: Number,
  29182. default: 1
  29183. },
  29184. rowspan: {
  29185. type: Number,
  29186. default: 1
  29187. },
  29188. width: {
  29189. type: [String, Number],
  29190. default: ""
  29191. },
  29192. minWidth: {
  29193. type: [String, Number],
  29194. default: ""
  29195. },
  29196. labelWidth: {
  29197. type: [String, Number],
  29198. default: ""
  29199. },
  29200. align: {
  29201. type: String,
  29202. default: "left"
  29203. },
  29204. labelAlign: {
  29205. type: String,
  29206. default: ""
  29207. },
  29208. className: {
  29209. type: String,
  29210. default: ""
  29211. },
  29212. labelClassName: {
  29213. type: String,
  29214. default: ""
  29215. }
  29216. });
  29217. const DescriptionItem = vue.defineComponent({
  29218. name: "ElDescriptionsItem",
  29219. props: descriptionItemProps
  29220. });
  29221. const ElDescriptions = withInstall(Descriptions, {
  29222. DescriptionsItem: DescriptionItem
  29223. });
  29224. const ElDescriptionsItem = withNoopInstall(DescriptionItem);
  29225. const overlayProps = buildProps({
  29226. mask: {
  29227. type: Boolean,
  29228. default: true
  29229. },
  29230. customMaskEvent: Boolean,
  29231. overlayClass: {
  29232. type: definePropType([
  29233. String,
  29234. Array,
  29235. Object
  29236. ])
  29237. },
  29238. zIndex: {
  29239. type: definePropType([String, Number])
  29240. }
  29241. });
  29242. const overlayEmits = {
  29243. click: (evt) => evt instanceof MouseEvent
  29244. };
  29245. const BLOCK = "overlay";
  29246. var Overlay$1 = vue.defineComponent({
  29247. name: "ElOverlay",
  29248. props: overlayProps,
  29249. emits: overlayEmits,
  29250. setup(props, { slots, emit }) {
  29251. const ns = useNamespace(BLOCK);
  29252. const onMaskClick = (e) => {
  29253. emit("click", e);
  29254. };
  29255. const { onClick, onMousedown, onMouseup } = useSameTarget(props.customMaskEvent ? void 0 : onMaskClick);
  29256. return () => {
  29257. return props.mask ? vue.createVNode("div", {
  29258. class: [ns.b(), props.overlayClass],
  29259. style: {
  29260. zIndex: props.zIndex
  29261. },
  29262. onClick,
  29263. onMousedown,
  29264. onMouseup
  29265. }, [vue.renderSlot(slots, "default")], PatchFlags.STYLE | PatchFlags.CLASS | PatchFlags.PROPS, ["onClick", "onMouseup", "onMousedown"]) : vue.h("div", {
  29266. class: props.overlayClass,
  29267. style: {
  29268. zIndex: props.zIndex,
  29269. position: "fixed",
  29270. top: "0px",
  29271. right: "0px",
  29272. bottom: "0px",
  29273. left: "0px"
  29274. }
  29275. }, [vue.renderSlot(slots, "default")]);
  29276. };
  29277. }
  29278. });
  29279. const ElOverlay = Overlay$1;
  29280. const dialogInjectionKey = Symbol("dialogInjectionKey");
  29281. const dialogContentProps = buildProps({
  29282. center: Boolean,
  29283. alignCenter: Boolean,
  29284. closeIcon: {
  29285. type: iconPropType
  29286. },
  29287. draggable: Boolean,
  29288. overflow: Boolean,
  29289. fullscreen: Boolean,
  29290. showClose: {
  29291. type: Boolean,
  29292. default: true
  29293. },
  29294. title: {
  29295. type: String,
  29296. default: ""
  29297. },
  29298. ariaLevel: {
  29299. type: String,
  29300. default: "2"
  29301. }
  29302. });
  29303. const dialogContentEmits = {
  29304. close: () => true
  29305. };
  29306. const __default__$$ = vue.defineComponent({ name: "ElDialogContent" });
  29307. const _sfc_main$1p = /* @__PURE__ */ vue.defineComponent({
  29308. ...__default__$$,
  29309. props: dialogContentProps,
  29310. emits: dialogContentEmits,
  29311. setup(__props, { expose }) {
  29312. const props = __props;
  29313. const { t } = useLocale();
  29314. const { Close } = CloseComponents;
  29315. const { dialogRef, headerRef, bodyId, ns, style } = vue.inject(dialogInjectionKey);
  29316. const { focusTrapRef } = vue.inject(FOCUS_TRAP_INJECTION_KEY);
  29317. const dialogKls = vue.computed(() => [
  29318. ns.b(),
  29319. ns.is("fullscreen", props.fullscreen),
  29320. ns.is("draggable", props.draggable),
  29321. ns.is("align-center", props.alignCenter),
  29322. { [ns.m("center")]: props.center }
  29323. ]);
  29324. const composedDialogRef = composeRefs(focusTrapRef, dialogRef);
  29325. const draggable = vue.computed(() => props.draggable);
  29326. const overflow = vue.computed(() => props.overflow);
  29327. const { resetPosition } = useDraggable(dialogRef, headerRef, draggable, overflow);
  29328. expose({
  29329. resetPosition
  29330. });
  29331. return (_ctx, _cache) => {
  29332. return vue.openBlock(), vue.createElementBlock("div", {
  29333. ref: vue.unref(composedDialogRef),
  29334. class: vue.normalizeClass(vue.unref(dialogKls)),
  29335. style: vue.normalizeStyle(vue.unref(style)),
  29336. tabindex: "-1"
  29337. }, [
  29338. vue.createElementVNode("header", {
  29339. ref_key: "headerRef",
  29340. ref: headerRef,
  29341. class: vue.normalizeClass([vue.unref(ns).e("header"), { "show-close": _ctx.showClose }])
  29342. }, [
  29343. vue.renderSlot(_ctx.$slots, "header", {}, () => [
  29344. vue.createElementVNode("span", {
  29345. role: "heading",
  29346. "aria-level": _ctx.ariaLevel,
  29347. class: vue.normalizeClass(vue.unref(ns).e("title"))
  29348. }, vue.toDisplayString(_ctx.title), 11, ["aria-level"])
  29349. ]),
  29350. _ctx.showClose ? (vue.openBlock(), vue.createElementBlock("button", {
  29351. key: 0,
  29352. "aria-label": vue.unref(t)("el.dialog.close"),
  29353. class: vue.normalizeClass(vue.unref(ns).e("headerbtn")),
  29354. type: "button",
  29355. onClick: ($event) => _ctx.$emit("close")
  29356. }, [
  29357. vue.createVNode(vue.unref(ElIcon), {
  29358. class: vue.normalizeClass(vue.unref(ns).e("close"))
  29359. }, {
  29360. default: vue.withCtx(() => [
  29361. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.closeIcon || vue.unref(Close))))
  29362. ]),
  29363. _: 1
  29364. }, 8, ["class"])
  29365. ], 10, ["aria-label", "onClick"])) : vue.createCommentVNode("v-if", true)
  29366. ], 2),
  29367. vue.createElementVNode("div", {
  29368. id: vue.unref(bodyId),
  29369. class: vue.normalizeClass(vue.unref(ns).e("body"))
  29370. }, [
  29371. vue.renderSlot(_ctx.$slots, "default")
  29372. ], 10, ["id"]),
  29373. _ctx.$slots.footer ? (vue.openBlock(), vue.createElementBlock("footer", {
  29374. key: 0,
  29375. class: vue.normalizeClass(vue.unref(ns).e("footer"))
  29376. }, [
  29377. vue.renderSlot(_ctx.$slots, "footer")
  29378. ], 2)) : vue.createCommentVNode("v-if", true)
  29379. ], 6);
  29380. };
  29381. }
  29382. });
  29383. var ElDialogContent = /* @__PURE__ */ _export_sfc(_sfc_main$1p, [["__file", "dialog-content.vue"]]);
  29384. const dialogProps = buildProps({
  29385. ...dialogContentProps,
  29386. appendToBody: Boolean,
  29387. appendTo: {
  29388. type: definePropType([String, Object]),
  29389. default: "body"
  29390. },
  29391. beforeClose: {
  29392. type: definePropType(Function)
  29393. },
  29394. destroyOnClose: Boolean,
  29395. closeOnClickModal: {
  29396. type: Boolean,
  29397. default: true
  29398. },
  29399. closeOnPressEscape: {
  29400. type: Boolean,
  29401. default: true
  29402. },
  29403. lockScroll: {
  29404. type: Boolean,
  29405. default: true
  29406. },
  29407. modal: {
  29408. type: Boolean,
  29409. default: true
  29410. },
  29411. openDelay: {
  29412. type: Number,
  29413. default: 0
  29414. },
  29415. closeDelay: {
  29416. type: Number,
  29417. default: 0
  29418. },
  29419. top: {
  29420. type: String
  29421. },
  29422. modelValue: Boolean,
  29423. modalClass: String,
  29424. width: {
  29425. type: [String, Number]
  29426. },
  29427. zIndex: {
  29428. type: Number
  29429. },
  29430. trapFocus: Boolean,
  29431. headerAriaLevel: {
  29432. type: String,
  29433. default: "2"
  29434. }
  29435. });
  29436. const dialogEmits = {
  29437. open: () => true,
  29438. opened: () => true,
  29439. close: () => true,
  29440. closed: () => true,
  29441. [UPDATE_MODEL_EVENT]: (value) => isBoolean(value),
  29442. openAutoFocus: () => true,
  29443. closeAutoFocus: () => true
  29444. };
  29445. const useDialog = (props, targetRef) => {
  29446. var _a;
  29447. const instance = vue.getCurrentInstance();
  29448. const emit = instance.emit;
  29449. const { nextZIndex } = useZIndex();
  29450. let lastPosition = "";
  29451. const titleId = useId();
  29452. const bodyId = useId();
  29453. const visible = vue.ref(false);
  29454. const closed = vue.ref(false);
  29455. const rendered = vue.ref(false);
  29456. const zIndex = vue.ref((_a = props.zIndex) != null ? _a : nextZIndex());
  29457. let openTimer = void 0;
  29458. let closeTimer = void 0;
  29459. const namespace = useGlobalConfig("namespace", defaultNamespace);
  29460. const style = vue.computed(() => {
  29461. const style2 = {};
  29462. const varPrefix = `--${namespace.value}-dialog`;
  29463. if (!props.fullscreen) {
  29464. if (props.top) {
  29465. style2[`${varPrefix}-margin-top`] = props.top;
  29466. }
  29467. if (props.width) {
  29468. style2[`${varPrefix}-width`] = addUnit(props.width);
  29469. }
  29470. }
  29471. return style2;
  29472. });
  29473. const overlayDialogStyle = vue.computed(() => {
  29474. if (props.alignCenter) {
  29475. return { display: "flex" };
  29476. }
  29477. return {};
  29478. });
  29479. function afterEnter() {
  29480. emit("opened");
  29481. }
  29482. function afterLeave() {
  29483. emit("closed");
  29484. emit(UPDATE_MODEL_EVENT, false);
  29485. if (props.destroyOnClose) {
  29486. rendered.value = false;
  29487. }
  29488. }
  29489. function beforeLeave() {
  29490. emit("close");
  29491. }
  29492. function open() {
  29493. closeTimer == null ? void 0 : closeTimer();
  29494. openTimer == null ? void 0 : openTimer();
  29495. if (props.openDelay && props.openDelay > 0) {
  29496. ({ stop: openTimer } = useTimeoutFn(() => doOpen(), props.openDelay));
  29497. } else {
  29498. doOpen();
  29499. }
  29500. }
  29501. function close() {
  29502. openTimer == null ? void 0 : openTimer();
  29503. closeTimer == null ? void 0 : closeTimer();
  29504. if (props.closeDelay && props.closeDelay > 0) {
  29505. ({ stop: closeTimer } = useTimeoutFn(() => doClose(), props.closeDelay));
  29506. } else {
  29507. doClose();
  29508. }
  29509. }
  29510. function handleClose() {
  29511. function hide(shouldCancel) {
  29512. if (shouldCancel)
  29513. return;
  29514. closed.value = true;
  29515. visible.value = false;
  29516. }
  29517. if (props.beforeClose) {
  29518. props.beforeClose(hide);
  29519. } else {
  29520. close();
  29521. }
  29522. }
  29523. function onModalClick() {
  29524. if (props.closeOnClickModal) {
  29525. handleClose();
  29526. }
  29527. }
  29528. function doOpen() {
  29529. if (!isClient)
  29530. return;
  29531. visible.value = true;
  29532. }
  29533. function doClose() {
  29534. visible.value = false;
  29535. }
  29536. function onOpenAutoFocus() {
  29537. emit("openAutoFocus");
  29538. }
  29539. function onCloseAutoFocus() {
  29540. emit("closeAutoFocus");
  29541. }
  29542. function onFocusoutPrevented(event) {
  29543. var _a2;
  29544. if (((_a2 = event.detail) == null ? void 0 : _a2.focusReason) === "pointer") {
  29545. event.preventDefault();
  29546. }
  29547. }
  29548. if (props.lockScroll) {
  29549. useLockscreen(visible);
  29550. }
  29551. function onCloseRequested() {
  29552. if (props.closeOnPressEscape) {
  29553. handleClose();
  29554. }
  29555. }
  29556. vue.watch(() => props.modelValue, (val) => {
  29557. if (val) {
  29558. closed.value = false;
  29559. open();
  29560. rendered.value = true;
  29561. zIndex.value = isUndefined$1(props.zIndex) ? nextZIndex() : zIndex.value++;
  29562. vue.nextTick(() => {
  29563. emit("open");
  29564. if (targetRef.value) {
  29565. targetRef.value.scrollTop = 0;
  29566. }
  29567. });
  29568. } else {
  29569. if (visible.value) {
  29570. close();
  29571. }
  29572. }
  29573. });
  29574. vue.watch(() => props.fullscreen, (val) => {
  29575. if (!targetRef.value)
  29576. return;
  29577. if (val) {
  29578. lastPosition = targetRef.value.style.transform;
  29579. targetRef.value.style.transform = "";
  29580. } else {
  29581. targetRef.value.style.transform = lastPosition;
  29582. }
  29583. });
  29584. vue.onMounted(() => {
  29585. if (props.modelValue) {
  29586. visible.value = true;
  29587. rendered.value = true;
  29588. open();
  29589. }
  29590. });
  29591. return {
  29592. afterEnter,
  29593. afterLeave,
  29594. beforeLeave,
  29595. handleClose,
  29596. onModalClick,
  29597. close,
  29598. doClose,
  29599. onOpenAutoFocus,
  29600. onCloseAutoFocus,
  29601. onCloseRequested,
  29602. onFocusoutPrevented,
  29603. titleId,
  29604. bodyId,
  29605. closed,
  29606. style,
  29607. overlayDialogStyle,
  29608. rendered,
  29609. visible,
  29610. zIndex
  29611. };
  29612. };
  29613. const __default__$_ = vue.defineComponent({
  29614. name: "ElDialog",
  29615. inheritAttrs: false
  29616. });
  29617. const _sfc_main$1o = /* @__PURE__ */ vue.defineComponent({
  29618. ...__default__$_,
  29619. props: dialogProps,
  29620. emits: dialogEmits,
  29621. setup(__props, { expose }) {
  29622. const props = __props;
  29623. const slots = vue.useSlots();
  29624. useDeprecated({
  29625. scope: "el-dialog",
  29626. from: "the title slot",
  29627. replacement: "the header slot",
  29628. version: "3.0.0",
  29629. ref: "https://element-plus.org/en-US/component/dialog.html#slots"
  29630. }, vue.computed(() => !!slots.title));
  29631. const ns = useNamespace("dialog");
  29632. const dialogRef = vue.ref();
  29633. const headerRef = vue.ref();
  29634. const dialogContentRef = vue.ref();
  29635. const {
  29636. visible,
  29637. titleId,
  29638. bodyId,
  29639. style,
  29640. overlayDialogStyle,
  29641. rendered,
  29642. zIndex,
  29643. afterEnter,
  29644. afterLeave,
  29645. beforeLeave,
  29646. handleClose,
  29647. onModalClick,
  29648. onOpenAutoFocus,
  29649. onCloseAutoFocus,
  29650. onCloseRequested,
  29651. onFocusoutPrevented
  29652. } = useDialog(props, dialogRef);
  29653. vue.provide(dialogInjectionKey, {
  29654. dialogRef,
  29655. headerRef,
  29656. bodyId,
  29657. ns,
  29658. rendered,
  29659. style
  29660. });
  29661. const overlayEvent = useSameTarget(onModalClick);
  29662. const draggable = vue.computed(() => props.draggable && !props.fullscreen);
  29663. const resetPosition = () => {
  29664. var _a;
  29665. (_a = dialogContentRef.value) == null ? void 0 : _a.resetPosition();
  29666. };
  29667. expose({
  29668. visible,
  29669. dialogContentRef,
  29670. resetPosition
  29671. });
  29672. return (_ctx, _cache) => {
  29673. return vue.openBlock(), vue.createBlock(vue.unref(ElTeleport$1), {
  29674. to: _ctx.appendTo,
  29675. disabled: _ctx.appendTo !== "body" ? false : !_ctx.appendToBody
  29676. }, {
  29677. default: vue.withCtx(() => [
  29678. vue.createVNode(vue.Transition, {
  29679. name: "dialog-fade",
  29680. onAfterEnter: vue.unref(afterEnter),
  29681. onAfterLeave: vue.unref(afterLeave),
  29682. onBeforeLeave: vue.unref(beforeLeave),
  29683. persisted: ""
  29684. }, {
  29685. default: vue.withCtx(() => [
  29686. vue.withDirectives(vue.createVNode(vue.unref(ElOverlay), {
  29687. "custom-mask-event": "",
  29688. mask: _ctx.modal,
  29689. "overlay-class": _ctx.modalClass,
  29690. "z-index": vue.unref(zIndex)
  29691. }, {
  29692. default: vue.withCtx(() => [
  29693. vue.createElementVNode("div", {
  29694. role: "dialog",
  29695. "aria-modal": "true",
  29696. "aria-label": _ctx.title || void 0,
  29697. "aria-labelledby": !_ctx.title ? vue.unref(titleId) : void 0,
  29698. "aria-describedby": vue.unref(bodyId),
  29699. class: vue.normalizeClass(`${vue.unref(ns).namespace.value}-overlay-dialog`),
  29700. style: vue.normalizeStyle(vue.unref(overlayDialogStyle)),
  29701. onClick: vue.unref(overlayEvent).onClick,
  29702. onMousedown: vue.unref(overlayEvent).onMousedown,
  29703. onMouseup: vue.unref(overlayEvent).onMouseup
  29704. }, [
  29705. vue.createVNode(vue.unref(ElFocusTrap), {
  29706. loop: "",
  29707. trapped: vue.unref(visible),
  29708. "focus-start-el": "container",
  29709. onFocusAfterTrapped: vue.unref(onOpenAutoFocus),
  29710. onFocusAfterReleased: vue.unref(onCloseAutoFocus),
  29711. onFocusoutPrevented: vue.unref(onFocusoutPrevented),
  29712. onReleaseRequested: vue.unref(onCloseRequested)
  29713. }, {
  29714. default: vue.withCtx(() => [
  29715. vue.unref(rendered) ? (vue.openBlock(), vue.createBlock(ElDialogContent, vue.mergeProps({
  29716. key: 0,
  29717. ref_key: "dialogContentRef",
  29718. ref: dialogContentRef
  29719. }, _ctx.$attrs, {
  29720. center: _ctx.center,
  29721. "align-center": _ctx.alignCenter,
  29722. "close-icon": _ctx.closeIcon,
  29723. draggable: vue.unref(draggable),
  29724. overflow: _ctx.overflow,
  29725. fullscreen: _ctx.fullscreen,
  29726. "show-close": _ctx.showClose,
  29727. title: _ctx.title,
  29728. "aria-level": _ctx.headerAriaLevel,
  29729. onClose: vue.unref(handleClose)
  29730. }), vue.createSlots({
  29731. header: vue.withCtx(() => [
  29732. !_ctx.$slots.title ? vue.renderSlot(_ctx.$slots, "header", {
  29733. key: 0,
  29734. close: vue.unref(handleClose),
  29735. titleId: vue.unref(titleId),
  29736. titleClass: vue.unref(ns).e("title")
  29737. }) : vue.renderSlot(_ctx.$slots, "title", { key: 1 })
  29738. ]),
  29739. default: vue.withCtx(() => [
  29740. vue.renderSlot(_ctx.$slots, "default")
  29741. ]),
  29742. _: 2
  29743. }, [
  29744. _ctx.$slots.footer ? {
  29745. name: "footer",
  29746. fn: vue.withCtx(() => [
  29747. vue.renderSlot(_ctx.$slots, "footer")
  29748. ])
  29749. } : void 0
  29750. ]), 1040, ["center", "align-center", "close-icon", "draggable", "overflow", "fullscreen", "show-close", "title", "aria-level", "onClose"])) : vue.createCommentVNode("v-if", true)
  29751. ]),
  29752. _: 3
  29753. }, 8, ["trapped", "onFocusAfterTrapped", "onFocusAfterReleased", "onFocusoutPrevented", "onReleaseRequested"])
  29754. ], 46, ["aria-label", "aria-labelledby", "aria-describedby", "onClick", "onMousedown", "onMouseup"])
  29755. ]),
  29756. _: 3
  29757. }, 8, ["mask", "overlay-class", "z-index"]), [
  29758. [vue.vShow, vue.unref(visible)]
  29759. ])
  29760. ]),
  29761. _: 3
  29762. }, 8, ["onAfterEnter", "onAfterLeave", "onBeforeLeave"])
  29763. ]),
  29764. _: 3
  29765. }, 8, ["to", "disabled"]);
  29766. };
  29767. }
  29768. });
  29769. var Dialog = /* @__PURE__ */ _export_sfc(_sfc_main$1o, [["__file", "dialog.vue"]]);
  29770. const ElDialog = withInstall(Dialog);
  29771. const dividerProps = buildProps({
  29772. direction: {
  29773. type: String,
  29774. values: ["horizontal", "vertical"],
  29775. default: "horizontal"
  29776. },
  29777. contentPosition: {
  29778. type: String,
  29779. values: ["left", "center", "right"],
  29780. default: "center"
  29781. },
  29782. borderStyle: {
  29783. type: definePropType(String),
  29784. default: "solid"
  29785. }
  29786. });
  29787. const __default__$Z = vue.defineComponent({
  29788. name: "ElDivider"
  29789. });
  29790. const _sfc_main$1n = /* @__PURE__ */ vue.defineComponent({
  29791. ...__default__$Z,
  29792. props: dividerProps,
  29793. setup(__props) {
  29794. const props = __props;
  29795. const ns = useNamespace("divider");
  29796. const dividerStyle = vue.computed(() => {
  29797. return ns.cssVar({
  29798. "border-style": props.borderStyle
  29799. });
  29800. });
  29801. return (_ctx, _cache) => {
  29802. return vue.openBlock(), vue.createElementBlock("div", {
  29803. class: vue.normalizeClass([vue.unref(ns).b(), vue.unref(ns).m(_ctx.direction)]),
  29804. style: vue.normalizeStyle(vue.unref(dividerStyle)),
  29805. role: "separator"
  29806. }, [
  29807. _ctx.$slots.default && _ctx.direction !== "vertical" ? (vue.openBlock(), vue.createElementBlock("div", {
  29808. key: 0,
  29809. class: vue.normalizeClass([vue.unref(ns).e("text"), vue.unref(ns).is(_ctx.contentPosition)])
  29810. }, [
  29811. vue.renderSlot(_ctx.$slots, "default")
  29812. ], 2)) : vue.createCommentVNode("v-if", true)
  29813. ], 6);
  29814. };
  29815. }
  29816. });
  29817. var Divider = /* @__PURE__ */ _export_sfc(_sfc_main$1n, [["__file", "divider.vue"]]);
  29818. const ElDivider = withInstall(Divider);
  29819. const drawerProps = buildProps({
  29820. ...dialogProps,
  29821. direction: {
  29822. type: String,
  29823. default: "rtl",
  29824. values: ["ltr", "rtl", "ttb", "btt"]
  29825. },
  29826. size: {
  29827. type: [String, Number],
  29828. default: "30%"
  29829. },
  29830. withHeader: {
  29831. type: Boolean,
  29832. default: true
  29833. },
  29834. modalFade: {
  29835. type: Boolean,
  29836. default: true
  29837. },
  29838. headerAriaLevel: {
  29839. type: String,
  29840. default: "2"
  29841. }
  29842. });
  29843. const drawerEmits = dialogEmits;
  29844. const __default__$Y = vue.defineComponent({
  29845. name: "ElDrawer",
  29846. inheritAttrs: false
  29847. });
  29848. const _sfc_main$1m = /* @__PURE__ */ vue.defineComponent({
  29849. ...__default__$Y,
  29850. props: drawerProps,
  29851. emits: drawerEmits,
  29852. setup(__props, { expose }) {
  29853. const props = __props;
  29854. const slots = vue.useSlots();
  29855. useDeprecated({
  29856. scope: "el-drawer",
  29857. from: "the title slot",
  29858. replacement: "the header slot",
  29859. version: "3.0.0",
  29860. ref: "https://element-plus.org/en-US/component/drawer.html#slots"
  29861. }, vue.computed(() => !!slots.title));
  29862. const drawerRef = vue.ref();
  29863. const focusStartRef = vue.ref();
  29864. const ns = useNamespace("drawer");
  29865. const { t } = useLocale();
  29866. const {
  29867. afterEnter,
  29868. afterLeave,
  29869. beforeLeave,
  29870. visible,
  29871. rendered,
  29872. titleId,
  29873. bodyId,
  29874. zIndex,
  29875. onModalClick,
  29876. onOpenAutoFocus,
  29877. onCloseAutoFocus,
  29878. onFocusoutPrevented,
  29879. onCloseRequested,
  29880. handleClose
  29881. } = useDialog(props, drawerRef);
  29882. const isHorizontal = vue.computed(() => props.direction === "rtl" || props.direction === "ltr");
  29883. const drawerSize = vue.computed(() => addUnit(props.size));
  29884. expose({
  29885. handleClose,
  29886. afterEnter,
  29887. afterLeave
  29888. });
  29889. return (_ctx, _cache) => {
  29890. return vue.openBlock(), vue.createBlock(vue.unref(ElTeleport$1), {
  29891. to: _ctx.appendTo,
  29892. disabled: _ctx.appendTo !== "body" ? false : !_ctx.appendToBody
  29893. }, {
  29894. default: vue.withCtx(() => [
  29895. vue.createVNode(vue.Transition, {
  29896. name: vue.unref(ns).b("fade"),
  29897. onAfterEnter: vue.unref(afterEnter),
  29898. onAfterLeave: vue.unref(afterLeave),
  29899. onBeforeLeave: vue.unref(beforeLeave),
  29900. persisted: ""
  29901. }, {
  29902. default: vue.withCtx(() => [
  29903. vue.withDirectives(vue.createVNode(vue.unref(ElOverlay), {
  29904. mask: _ctx.modal,
  29905. "overlay-class": _ctx.modalClass,
  29906. "z-index": vue.unref(zIndex),
  29907. onClick: vue.unref(onModalClick)
  29908. }, {
  29909. default: vue.withCtx(() => [
  29910. vue.createVNode(vue.unref(ElFocusTrap), {
  29911. loop: "",
  29912. trapped: vue.unref(visible),
  29913. "focus-trap-el": drawerRef.value,
  29914. "focus-start-el": focusStartRef.value,
  29915. onFocusAfterTrapped: vue.unref(onOpenAutoFocus),
  29916. onFocusAfterReleased: vue.unref(onCloseAutoFocus),
  29917. onFocusoutPrevented: vue.unref(onFocusoutPrevented),
  29918. onReleaseRequested: vue.unref(onCloseRequested)
  29919. }, {
  29920. default: vue.withCtx(() => [
  29921. vue.createElementVNode("div", vue.mergeProps({
  29922. ref_key: "drawerRef",
  29923. ref: drawerRef,
  29924. "aria-modal": "true",
  29925. "aria-label": _ctx.title || void 0,
  29926. "aria-labelledby": !_ctx.title ? vue.unref(titleId) : void 0,
  29927. "aria-describedby": vue.unref(bodyId)
  29928. }, _ctx.$attrs, {
  29929. class: [vue.unref(ns).b(), _ctx.direction, vue.unref(visible) && "open"],
  29930. style: vue.unref(isHorizontal) ? "width: " + vue.unref(drawerSize) : "height: " + vue.unref(drawerSize),
  29931. role: "dialog",
  29932. onClick: vue.withModifiers(() => {
  29933. }, ["stop"])
  29934. }), [
  29935. vue.createElementVNode("span", {
  29936. ref_key: "focusStartRef",
  29937. ref: focusStartRef,
  29938. class: vue.normalizeClass(vue.unref(ns).e("sr-focus")),
  29939. tabindex: "-1"
  29940. }, null, 2),
  29941. _ctx.withHeader ? (vue.openBlock(), vue.createElementBlock("header", {
  29942. key: 0,
  29943. class: vue.normalizeClass(vue.unref(ns).e("header"))
  29944. }, [
  29945. !_ctx.$slots.title ? vue.renderSlot(_ctx.$slots, "header", {
  29946. key: 0,
  29947. close: vue.unref(handleClose),
  29948. titleId: vue.unref(titleId),
  29949. titleClass: vue.unref(ns).e("title")
  29950. }, () => [
  29951. !_ctx.$slots.title ? (vue.openBlock(), vue.createElementBlock("span", {
  29952. key: 0,
  29953. id: vue.unref(titleId),
  29954. role: "heading",
  29955. "aria-level": _ctx.headerAriaLevel,
  29956. class: vue.normalizeClass(vue.unref(ns).e("title"))
  29957. }, vue.toDisplayString(_ctx.title), 11, ["id", "aria-level"])) : vue.createCommentVNode("v-if", true)
  29958. ]) : vue.renderSlot(_ctx.$slots, "title", { key: 1 }, () => [
  29959. vue.createCommentVNode(" DEPRECATED SLOT ")
  29960. ]),
  29961. _ctx.showClose ? (vue.openBlock(), vue.createElementBlock("button", {
  29962. key: 2,
  29963. "aria-label": vue.unref(t)("el.drawer.close"),
  29964. class: vue.normalizeClass(vue.unref(ns).e("close-btn")),
  29965. type: "button",
  29966. onClick: vue.unref(handleClose)
  29967. }, [
  29968. vue.createVNode(vue.unref(ElIcon), {
  29969. class: vue.normalizeClass(vue.unref(ns).e("close"))
  29970. }, {
  29971. default: vue.withCtx(() => [
  29972. vue.createVNode(vue.unref(close_default))
  29973. ]),
  29974. _: 1
  29975. }, 8, ["class"])
  29976. ], 10, ["aria-label", "onClick"])) : vue.createCommentVNode("v-if", true)
  29977. ], 2)) : vue.createCommentVNode("v-if", true),
  29978. vue.unref(rendered) ? (vue.openBlock(), vue.createElementBlock("div", {
  29979. key: 1,
  29980. id: vue.unref(bodyId),
  29981. class: vue.normalizeClass(vue.unref(ns).e("body"))
  29982. }, [
  29983. vue.renderSlot(_ctx.$slots, "default")
  29984. ], 10, ["id"])) : vue.createCommentVNode("v-if", true),
  29985. _ctx.$slots.footer ? (vue.openBlock(), vue.createElementBlock("div", {
  29986. key: 2,
  29987. class: vue.normalizeClass(vue.unref(ns).e("footer"))
  29988. }, [
  29989. vue.renderSlot(_ctx.$slots, "footer")
  29990. ], 2)) : vue.createCommentVNode("v-if", true)
  29991. ], 16, ["aria-label", "aria-labelledby", "aria-describedby", "onClick"])
  29992. ]),
  29993. _: 3
  29994. }, 8, ["trapped", "focus-trap-el", "focus-start-el", "onFocusAfterTrapped", "onFocusAfterReleased", "onFocusoutPrevented", "onReleaseRequested"])
  29995. ]),
  29996. _: 3
  29997. }, 8, ["mask", "overlay-class", "z-index", "onClick"]), [
  29998. [vue.vShow, vue.unref(visible)]
  29999. ])
  30000. ]),
  30001. _: 3
  30002. }, 8, ["name", "onAfterEnter", "onAfterLeave", "onBeforeLeave"])
  30003. ]),
  30004. _: 3
  30005. }, 8, ["to", "disabled"]);
  30006. };
  30007. }
  30008. });
  30009. var Drawer = /* @__PURE__ */ _export_sfc(_sfc_main$1m, [["__file", "drawer.vue"]]);
  30010. const ElDrawer = withInstall(Drawer);
  30011. const _sfc_main$1l = /* @__PURE__ */ vue.defineComponent({
  30012. inheritAttrs: false
  30013. });
  30014. function _sfc_render$n(_ctx, _cache, $props, $setup, $data, $options) {
  30015. return vue.renderSlot(_ctx.$slots, "default");
  30016. }
  30017. var Collection = /* @__PURE__ */ _export_sfc(_sfc_main$1l, [["render", _sfc_render$n], ["__file", "collection.vue"]]);
  30018. const _sfc_main$1k = /* @__PURE__ */ vue.defineComponent({
  30019. name: "ElCollectionItem",
  30020. inheritAttrs: false
  30021. });
  30022. function _sfc_render$m(_ctx, _cache, $props, $setup, $data, $options) {
  30023. return vue.renderSlot(_ctx.$slots, "default");
  30024. }
  30025. var CollectionItem = /* @__PURE__ */ _export_sfc(_sfc_main$1k, [["render", _sfc_render$m], ["__file", "collection-item.vue"]]);
  30026. const COLLECTION_ITEM_SIGN = `data-el-collection-item`;
  30027. const createCollectionWithScope = (name) => {
  30028. const COLLECTION_NAME = `El${name}Collection`;
  30029. const COLLECTION_ITEM_NAME = `${COLLECTION_NAME}Item`;
  30030. const COLLECTION_INJECTION_KEY = Symbol(COLLECTION_NAME);
  30031. const COLLECTION_ITEM_INJECTION_KEY = Symbol(COLLECTION_ITEM_NAME);
  30032. const ElCollection = {
  30033. ...Collection,
  30034. name: COLLECTION_NAME,
  30035. setup() {
  30036. const collectionRef = vue.ref(null);
  30037. const itemMap = /* @__PURE__ */ new Map();
  30038. const getItems = () => {
  30039. const collectionEl = vue.unref(collectionRef);
  30040. if (!collectionEl)
  30041. return [];
  30042. const orderedNodes = Array.from(collectionEl.querySelectorAll(`[${COLLECTION_ITEM_SIGN}]`));
  30043. const items = [...itemMap.values()];
  30044. return items.sort((a, b) => orderedNodes.indexOf(a.ref) - orderedNodes.indexOf(b.ref));
  30045. };
  30046. vue.provide(COLLECTION_INJECTION_KEY, {
  30047. itemMap,
  30048. getItems,
  30049. collectionRef
  30050. });
  30051. }
  30052. };
  30053. const ElCollectionItem = {
  30054. ...CollectionItem,
  30055. name: COLLECTION_ITEM_NAME,
  30056. setup(_, { attrs }) {
  30057. const collectionItemRef = vue.ref(null);
  30058. const collectionInjection = vue.inject(COLLECTION_INJECTION_KEY, void 0);
  30059. vue.provide(COLLECTION_ITEM_INJECTION_KEY, {
  30060. collectionItemRef
  30061. });
  30062. vue.onMounted(() => {
  30063. const collectionItemEl = vue.unref(collectionItemRef);
  30064. if (collectionItemEl) {
  30065. collectionInjection.itemMap.set(collectionItemEl, {
  30066. ref: collectionItemEl,
  30067. ...attrs
  30068. });
  30069. }
  30070. });
  30071. vue.onBeforeUnmount(() => {
  30072. const collectionItemEl = vue.unref(collectionItemRef);
  30073. collectionInjection.itemMap.delete(collectionItemEl);
  30074. });
  30075. }
  30076. };
  30077. return {
  30078. COLLECTION_INJECTION_KEY,
  30079. COLLECTION_ITEM_INJECTION_KEY,
  30080. ElCollection,
  30081. ElCollectionItem
  30082. };
  30083. };
  30084. const rovingFocusGroupProps = buildProps({
  30085. style: { type: definePropType([String, Array, Object]) },
  30086. currentTabId: {
  30087. type: definePropType(String)
  30088. },
  30089. defaultCurrentTabId: String,
  30090. loop: Boolean,
  30091. dir: {
  30092. type: String,
  30093. values: ["ltr", "rtl"],
  30094. default: "ltr"
  30095. },
  30096. orientation: {
  30097. type: definePropType(String)
  30098. },
  30099. onBlur: Function,
  30100. onFocus: Function,
  30101. onMousedown: Function
  30102. });
  30103. const {
  30104. ElCollection: ElCollection$1,
  30105. ElCollectionItem: ElCollectionItem$1,
  30106. COLLECTION_INJECTION_KEY: COLLECTION_INJECTION_KEY$1,
  30107. COLLECTION_ITEM_INJECTION_KEY: COLLECTION_ITEM_INJECTION_KEY$1
  30108. } = createCollectionWithScope("RovingFocusGroup");
  30109. const ROVING_FOCUS_GROUP_INJECTION_KEY = Symbol("elRovingFocusGroup");
  30110. const ROVING_FOCUS_GROUP_ITEM_INJECTION_KEY = Symbol("elRovingFocusGroupItem");
  30111. const MAP_KEY_TO_FOCUS_INTENT = {
  30112. ArrowLeft: "prev",
  30113. ArrowUp: "prev",
  30114. ArrowRight: "next",
  30115. ArrowDown: "next",
  30116. PageUp: "first",
  30117. Home: "first",
  30118. PageDown: "last",
  30119. End: "last"
  30120. };
  30121. const getDirectionAwareKey = (key, dir) => {
  30122. if (dir !== "rtl")
  30123. return key;
  30124. switch (key) {
  30125. case EVENT_CODE.right:
  30126. return EVENT_CODE.left;
  30127. case EVENT_CODE.left:
  30128. return EVENT_CODE.right;
  30129. default:
  30130. return key;
  30131. }
  30132. };
  30133. const getFocusIntent = (event, orientation, dir) => {
  30134. const key = getDirectionAwareKey(event.code, dir);
  30135. if (orientation === "vertical" && [EVENT_CODE.left, EVENT_CODE.right].includes(key))
  30136. return void 0;
  30137. if (orientation === "horizontal" && [EVENT_CODE.up, EVENT_CODE.down].includes(key))
  30138. return void 0;
  30139. return MAP_KEY_TO_FOCUS_INTENT[key];
  30140. };
  30141. const reorderArray = (array, atIdx) => {
  30142. return array.map((_, idx) => array[(idx + atIdx) % array.length]);
  30143. };
  30144. const focusFirst = (elements) => {
  30145. const { activeElement: prevActive } = document;
  30146. for (const element of elements) {
  30147. if (element === prevActive)
  30148. return;
  30149. element.focus();
  30150. if (prevActive !== document.activeElement)
  30151. return;
  30152. }
  30153. };
  30154. const CURRENT_TAB_ID_CHANGE_EVT = "currentTabIdChange";
  30155. const ENTRY_FOCUS_EVT = "rovingFocusGroup.entryFocus";
  30156. const EVT_OPTS = { bubbles: false, cancelable: true };
  30157. const _sfc_main$1j = vue.defineComponent({
  30158. name: "ElRovingFocusGroupImpl",
  30159. inheritAttrs: false,
  30160. props: rovingFocusGroupProps,
  30161. emits: [CURRENT_TAB_ID_CHANGE_EVT, "entryFocus"],
  30162. setup(props, { emit }) {
  30163. var _a;
  30164. const currentTabbedId = vue.ref((_a = props.currentTabId || props.defaultCurrentTabId) != null ? _a : null);
  30165. const isBackingOut = vue.ref(false);
  30166. const isClickFocus = vue.ref(false);
  30167. const rovingFocusGroupRef = vue.ref(null);
  30168. const { getItems } = vue.inject(COLLECTION_INJECTION_KEY$1, void 0);
  30169. const rovingFocusGroupRootStyle = vue.computed(() => {
  30170. return [
  30171. {
  30172. outline: "none"
  30173. },
  30174. props.style
  30175. ];
  30176. });
  30177. const onItemFocus = (tabbedId) => {
  30178. emit(CURRENT_TAB_ID_CHANGE_EVT, tabbedId);
  30179. };
  30180. const onItemShiftTab = () => {
  30181. isBackingOut.value = true;
  30182. };
  30183. const onMousedown = composeEventHandlers((e) => {
  30184. var _a2;
  30185. (_a2 = props.onMousedown) == null ? void 0 : _a2.call(props, e);
  30186. }, () => {
  30187. isClickFocus.value = true;
  30188. });
  30189. const onFocus = composeEventHandlers((e) => {
  30190. var _a2;
  30191. (_a2 = props.onFocus) == null ? void 0 : _a2.call(props, e);
  30192. }, (e) => {
  30193. const isKeyboardFocus = !vue.unref(isClickFocus);
  30194. const { target, currentTarget } = e;
  30195. if (target === currentTarget && isKeyboardFocus && !vue.unref(isBackingOut)) {
  30196. const entryFocusEvt = new Event(ENTRY_FOCUS_EVT, EVT_OPTS);
  30197. currentTarget == null ? void 0 : currentTarget.dispatchEvent(entryFocusEvt);
  30198. if (!entryFocusEvt.defaultPrevented) {
  30199. const items = getItems().filter((item) => item.focusable);
  30200. const activeItem = items.find((item) => item.active);
  30201. const currentItem = items.find((item) => item.id === vue.unref(currentTabbedId));
  30202. const candidates = [activeItem, currentItem, ...items].filter(Boolean);
  30203. const candidateNodes = candidates.map((item) => item.ref);
  30204. focusFirst(candidateNodes);
  30205. }
  30206. }
  30207. isClickFocus.value = false;
  30208. });
  30209. const onBlur = composeEventHandlers((e) => {
  30210. var _a2;
  30211. (_a2 = props.onBlur) == null ? void 0 : _a2.call(props, e);
  30212. }, () => {
  30213. isBackingOut.value = false;
  30214. });
  30215. const handleEntryFocus = (...args) => {
  30216. emit("entryFocus", ...args);
  30217. };
  30218. vue.provide(ROVING_FOCUS_GROUP_INJECTION_KEY, {
  30219. currentTabbedId: vue.readonly(currentTabbedId),
  30220. loop: vue.toRef(props, "loop"),
  30221. tabIndex: vue.computed(() => {
  30222. return vue.unref(isBackingOut) ? -1 : 0;
  30223. }),
  30224. rovingFocusGroupRef,
  30225. rovingFocusGroupRootStyle,
  30226. orientation: vue.toRef(props, "orientation"),
  30227. dir: vue.toRef(props, "dir"),
  30228. onItemFocus,
  30229. onItemShiftTab,
  30230. onBlur,
  30231. onFocus,
  30232. onMousedown
  30233. });
  30234. vue.watch(() => props.currentTabId, (val) => {
  30235. currentTabbedId.value = val != null ? val : null;
  30236. });
  30237. useEventListener(rovingFocusGroupRef, ENTRY_FOCUS_EVT, handleEntryFocus);
  30238. }
  30239. });
  30240. function _sfc_render$l(_ctx, _cache, $props, $setup, $data, $options) {
  30241. return vue.renderSlot(_ctx.$slots, "default");
  30242. }
  30243. var ElRovingFocusGroupImpl = /* @__PURE__ */ _export_sfc(_sfc_main$1j, [["render", _sfc_render$l], ["__file", "roving-focus-group-impl.vue"]]);
  30244. const _sfc_main$1i = vue.defineComponent({
  30245. name: "ElRovingFocusGroup",
  30246. components: {
  30247. ElFocusGroupCollection: ElCollection$1,
  30248. ElRovingFocusGroupImpl
  30249. }
  30250. });
  30251. function _sfc_render$k(_ctx, _cache, $props, $setup, $data, $options) {
  30252. const _component_el_roving_focus_group_impl = vue.resolveComponent("el-roving-focus-group-impl");
  30253. const _component_el_focus_group_collection = vue.resolveComponent("el-focus-group-collection");
  30254. return vue.openBlock(), vue.createBlock(_component_el_focus_group_collection, null, {
  30255. default: vue.withCtx(() => [
  30256. vue.createVNode(_component_el_roving_focus_group_impl, vue.normalizeProps(vue.guardReactiveProps(_ctx.$attrs)), {
  30257. default: vue.withCtx(() => [
  30258. vue.renderSlot(_ctx.$slots, "default")
  30259. ]),
  30260. _: 3
  30261. }, 16)
  30262. ]),
  30263. _: 3
  30264. });
  30265. }
  30266. var ElRovingFocusGroup = /* @__PURE__ */ _export_sfc(_sfc_main$1i, [["render", _sfc_render$k], ["__file", "roving-focus-group.vue"]]);
  30267. const _sfc_main$1h = vue.defineComponent({
  30268. components: {
  30269. ElRovingFocusCollectionItem: ElCollectionItem$1
  30270. },
  30271. props: {
  30272. focusable: {
  30273. type: Boolean,
  30274. default: true
  30275. },
  30276. active: {
  30277. type: Boolean,
  30278. default: false
  30279. }
  30280. },
  30281. emits: ["mousedown", "focus", "keydown"],
  30282. setup(props, { emit }) {
  30283. const { currentTabbedId, loop, onItemFocus, onItemShiftTab } = vue.inject(ROVING_FOCUS_GROUP_INJECTION_KEY, void 0);
  30284. const { getItems } = vue.inject(COLLECTION_INJECTION_KEY$1, void 0);
  30285. const id = useId();
  30286. const rovingFocusGroupItemRef = vue.ref(null);
  30287. const handleMousedown = composeEventHandlers((e) => {
  30288. emit("mousedown", e);
  30289. }, (e) => {
  30290. if (!props.focusable) {
  30291. e.preventDefault();
  30292. } else {
  30293. onItemFocus(vue.unref(id));
  30294. }
  30295. });
  30296. const handleFocus = composeEventHandlers((e) => {
  30297. emit("focus", e);
  30298. }, () => {
  30299. onItemFocus(vue.unref(id));
  30300. });
  30301. const handleKeydown = composeEventHandlers((e) => {
  30302. emit("keydown", e);
  30303. }, (e) => {
  30304. const { code, shiftKey, target, currentTarget } = e;
  30305. if (code === EVENT_CODE.tab && shiftKey) {
  30306. onItemShiftTab();
  30307. return;
  30308. }
  30309. if (target !== currentTarget)
  30310. return;
  30311. const focusIntent = getFocusIntent(e);
  30312. if (focusIntent) {
  30313. e.preventDefault();
  30314. const items = getItems().filter((item) => item.focusable);
  30315. let elements = items.map((item) => item.ref);
  30316. switch (focusIntent) {
  30317. case "last": {
  30318. elements.reverse();
  30319. break;
  30320. }
  30321. case "prev":
  30322. case "next": {
  30323. if (focusIntent === "prev") {
  30324. elements.reverse();
  30325. }
  30326. const currentIdx = elements.indexOf(currentTarget);
  30327. elements = loop.value ? reorderArray(elements, currentIdx + 1) : elements.slice(currentIdx + 1);
  30328. break;
  30329. }
  30330. }
  30331. vue.nextTick(() => {
  30332. focusFirst(elements);
  30333. });
  30334. }
  30335. });
  30336. const isCurrentTab = vue.computed(() => currentTabbedId.value === vue.unref(id));
  30337. vue.provide(ROVING_FOCUS_GROUP_ITEM_INJECTION_KEY, {
  30338. rovingFocusGroupItemRef,
  30339. tabIndex: vue.computed(() => vue.unref(isCurrentTab) ? 0 : -1),
  30340. handleMousedown,
  30341. handleFocus,
  30342. handleKeydown
  30343. });
  30344. return {
  30345. id,
  30346. handleKeydown,
  30347. handleFocus,
  30348. handleMousedown
  30349. };
  30350. }
  30351. });
  30352. function _sfc_render$j(_ctx, _cache, $props, $setup, $data, $options) {
  30353. const _component_el_roving_focus_collection_item = vue.resolveComponent("el-roving-focus-collection-item");
  30354. return vue.openBlock(), vue.createBlock(_component_el_roving_focus_collection_item, {
  30355. id: _ctx.id,
  30356. focusable: _ctx.focusable,
  30357. active: _ctx.active
  30358. }, {
  30359. default: vue.withCtx(() => [
  30360. vue.renderSlot(_ctx.$slots, "default")
  30361. ]),
  30362. _: 3
  30363. }, 8, ["id", "focusable", "active"]);
  30364. }
  30365. var ElRovingFocusItem = /* @__PURE__ */ _export_sfc(_sfc_main$1h, [["render", _sfc_render$j], ["__file", "roving-focus-item.vue"]]);
  30366. const dropdownProps = buildProps({
  30367. trigger: useTooltipTriggerProps.trigger,
  30368. triggerKeys: {
  30369. type: definePropType(Array),
  30370. default: () => [
  30371. EVENT_CODE.enter,
  30372. EVENT_CODE.numpadEnter,
  30373. EVENT_CODE.space,
  30374. EVENT_CODE.down
  30375. ]
  30376. },
  30377. effect: {
  30378. ...useTooltipContentProps.effect,
  30379. default: "light"
  30380. },
  30381. type: {
  30382. type: definePropType(String)
  30383. },
  30384. placement: {
  30385. type: definePropType(String),
  30386. default: "bottom"
  30387. },
  30388. popperOptions: {
  30389. type: definePropType(Object),
  30390. default: () => ({})
  30391. },
  30392. id: String,
  30393. size: {
  30394. type: String,
  30395. default: ""
  30396. },
  30397. splitButton: Boolean,
  30398. hideOnClick: {
  30399. type: Boolean,
  30400. default: true
  30401. },
  30402. loop: {
  30403. type: Boolean,
  30404. default: true
  30405. },
  30406. showTimeout: {
  30407. type: Number,
  30408. default: 150
  30409. },
  30410. hideTimeout: {
  30411. type: Number,
  30412. default: 150
  30413. },
  30414. tabindex: {
  30415. type: definePropType([Number, String]),
  30416. default: 0
  30417. },
  30418. maxHeight: {
  30419. type: definePropType([Number, String]),
  30420. default: ""
  30421. },
  30422. popperClass: {
  30423. type: String,
  30424. default: ""
  30425. },
  30426. disabled: Boolean,
  30427. role: {
  30428. type: String,
  30429. default: "menu"
  30430. },
  30431. buttonProps: {
  30432. type: definePropType(Object)
  30433. },
  30434. teleported: useTooltipContentProps.teleported
  30435. });
  30436. const dropdownItemProps = buildProps({
  30437. command: {
  30438. type: [Object, String, Number],
  30439. default: () => ({})
  30440. },
  30441. disabled: Boolean,
  30442. divided: Boolean,
  30443. textValue: String,
  30444. icon: {
  30445. type: iconPropType
  30446. }
  30447. });
  30448. const dropdownMenuProps = buildProps({
  30449. onKeydown: { type: definePropType(Function) }
  30450. });
  30451. const FIRST_KEYS = [
  30452. EVENT_CODE.down,
  30453. EVENT_CODE.pageDown,
  30454. EVENT_CODE.home
  30455. ];
  30456. const LAST_KEYS = [EVENT_CODE.up, EVENT_CODE.pageUp, EVENT_CODE.end];
  30457. const FIRST_LAST_KEYS = [...FIRST_KEYS, ...LAST_KEYS];
  30458. const {
  30459. ElCollection,
  30460. ElCollectionItem,
  30461. COLLECTION_INJECTION_KEY,
  30462. COLLECTION_ITEM_INJECTION_KEY
  30463. } = createCollectionWithScope("Dropdown");
  30464. const DROPDOWN_INJECTION_KEY = Symbol("elDropdown");
  30465. const { ButtonGroup: ElButtonGroup } = ElButton;
  30466. const _sfc_main$1g = vue.defineComponent({
  30467. name: "ElDropdown",
  30468. components: {
  30469. ElButton,
  30470. ElButtonGroup,
  30471. ElScrollbar,
  30472. ElDropdownCollection: ElCollection,
  30473. ElTooltip,
  30474. ElRovingFocusGroup,
  30475. ElOnlyChild: OnlyChild,
  30476. ElIcon,
  30477. ArrowDown: arrow_down_default
  30478. },
  30479. props: dropdownProps,
  30480. emits: ["visible-change", "click", "command"],
  30481. setup(props, { emit }) {
  30482. const _instance = vue.getCurrentInstance();
  30483. const ns = useNamespace("dropdown");
  30484. const { t } = useLocale();
  30485. const triggeringElementRef = vue.ref();
  30486. const referenceElementRef = vue.ref();
  30487. const popperRef = vue.ref(null);
  30488. const contentRef = vue.ref(null);
  30489. const scrollbar = vue.ref(null);
  30490. const currentTabId = vue.ref(null);
  30491. const isUsingKeyboard = vue.ref(false);
  30492. const wrapStyle = vue.computed(() => ({
  30493. maxHeight: addUnit(props.maxHeight)
  30494. }));
  30495. const dropdownTriggerKls = vue.computed(() => [ns.m(dropdownSize.value)]);
  30496. const trigger = vue.computed(() => castArray$1(props.trigger));
  30497. const defaultTriggerId = useId().value;
  30498. const triggerId = vue.computed(() => props.id || defaultTriggerId);
  30499. vue.watch([triggeringElementRef, trigger], ([triggeringElement, trigger2], [prevTriggeringElement]) => {
  30500. var _a, _b, _c;
  30501. if ((_a = prevTriggeringElement == null ? void 0 : prevTriggeringElement.$el) == null ? void 0 : _a.removeEventListener) {
  30502. prevTriggeringElement.$el.removeEventListener("pointerenter", onAutofocusTriggerEnter);
  30503. }
  30504. if ((_b = triggeringElement == null ? void 0 : triggeringElement.$el) == null ? void 0 : _b.removeEventListener) {
  30505. triggeringElement.$el.removeEventListener("pointerenter", onAutofocusTriggerEnter);
  30506. }
  30507. if (((_c = triggeringElement == null ? void 0 : triggeringElement.$el) == null ? void 0 : _c.addEventListener) && trigger2.includes("hover")) {
  30508. triggeringElement.$el.addEventListener("pointerenter", onAutofocusTriggerEnter);
  30509. }
  30510. }, { immediate: true });
  30511. vue.onBeforeUnmount(() => {
  30512. var _a, _b;
  30513. if ((_b = (_a = triggeringElementRef.value) == null ? void 0 : _a.$el) == null ? void 0 : _b.removeEventListener) {
  30514. triggeringElementRef.value.$el.removeEventListener("pointerenter", onAutofocusTriggerEnter);
  30515. }
  30516. });
  30517. function handleClick() {
  30518. handleClose();
  30519. }
  30520. function handleClose() {
  30521. var _a;
  30522. (_a = popperRef.value) == null ? void 0 : _a.onClose();
  30523. }
  30524. function handleOpen() {
  30525. var _a;
  30526. (_a = popperRef.value) == null ? void 0 : _a.onOpen();
  30527. }
  30528. const dropdownSize = useFormSize();
  30529. function commandHandler(...args) {
  30530. emit("command", ...args);
  30531. }
  30532. function onAutofocusTriggerEnter() {
  30533. var _a, _b;
  30534. (_b = (_a = triggeringElementRef.value) == null ? void 0 : _a.$el) == null ? void 0 : _b.focus();
  30535. }
  30536. function onItemEnter() {
  30537. }
  30538. function onItemLeave() {
  30539. const contentEl = vue.unref(contentRef);
  30540. trigger.value.includes("hover") && (contentEl == null ? void 0 : contentEl.focus());
  30541. currentTabId.value = null;
  30542. }
  30543. function handleCurrentTabIdChange(id) {
  30544. currentTabId.value = id;
  30545. }
  30546. function handleEntryFocus(e) {
  30547. if (!isUsingKeyboard.value) {
  30548. e.preventDefault();
  30549. e.stopImmediatePropagation();
  30550. }
  30551. }
  30552. function handleBeforeShowTooltip() {
  30553. emit("visible-change", true);
  30554. }
  30555. function handleShowTooltip(event) {
  30556. if ((event == null ? void 0 : event.type) === "keydown") {
  30557. contentRef.value.focus();
  30558. }
  30559. }
  30560. function handleBeforeHideTooltip() {
  30561. emit("visible-change", false);
  30562. }
  30563. vue.provide(DROPDOWN_INJECTION_KEY, {
  30564. contentRef,
  30565. role: vue.computed(() => props.role),
  30566. triggerId,
  30567. isUsingKeyboard,
  30568. onItemEnter,
  30569. onItemLeave
  30570. });
  30571. vue.provide("elDropdown", {
  30572. instance: _instance,
  30573. dropdownSize,
  30574. handleClick,
  30575. commandHandler,
  30576. trigger: vue.toRef(props, "trigger"),
  30577. hideOnClick: vue.toRef(props, "hideOnClick")
  30578. });
  30579. const onFocusAfterTrapped = (e) => {
  30580. var _a, _b;
  30581. e.preventDefault();
  30582. (_b = (_a = contentRef.value) == null ? void 0 : _a.focus) == null ? void 0 : _b.call(_a, {
  30583. preventScroll: true
  30584. });
  30585. };
  30586. const handlerMainButtonClick = (event) => {
  30587. emit("click", event);
  30588. };
  30589. return {
  30590. t,
  30591. ns,
  30592. scrollbar,
  30593. wrapStyle,
  30594. dropdownTriggerKls,
  30595. dropdownSize,
  30596. triggerId,
  30597. currentTabId,
  30598. handleCurrentTabIdChange,
  30599. handlerMainButtonClick,
  30600. handleEntryFocus,
  30601. handleClose,
  30602. handleOpen,
  30603. handleBeforeShowTooltip,
  30604. handleShowTooltip,
  30605. handleBeforeHideTooltip,
  30606. onFocusAfterTrapped,
  30607. popperRef,
  30608. contentRef,
  30609. triggeringElementRef,
  30610. referenceElementRef
  30611. };
  30612. }
  30613. });
  30614. function _sfc_render$i(_ctx, _cache, $props, $setup, $data, $options) {
  30615. var _a;
  30616. const _component_el_dropdown_collection = vue.resolveComponent("el-dropdown-collection");
  30617. const _component_el_roving_focus_group = vue.resolveComponent("el-roving-focus-group");
  30618. const _component_el_scrollbar = vue.resolveComponent("el-scrollbar");
  30619. const _component_el_only_child = vue.resolveComponent("el-only-child");
  30620. const _component_el_tooltip = vue.resolveComponent("el-tooltip");
  30621. const _component_el_button = vue.resolveComponent("el-button");
  30622. const _component_arrow_down = vue.resolveComponent("arrow-down");
  30623. const _component_el_icon = vue.resolveComponent("el-icon");
  30624. const _component_el_button_group = vue.resolveComponent("el-button-group");
  30625. return vue.openBlock(), vue.createElementBlock("div", {
  30626. class: vue.normalizeClass([_ctx.ns.b(), _ctx.ns.is("disabled", _ctx.disabled)])
  30627. }, [
  30628. vue.createVNode(_component_el_tooltip, {
  30629. ref: "popperRef",
  30630. role: _ctx.role,
  30631. effect: _ctx.effect,
  30632. "fallback-placements": ["bottom", "top"],
  30633. "popper-options": _ctx.popperOptions,
  30634. "gpu-acceleration": false,
  30635. "hide-after": _ctx.trigger === "hover" ? _ctx.hideTimeout : 0,
  30636. "manual-mode": true,
  30637. placement: _ctx.placement,
  30638. "popper-class": [_ctx.ns.e("popper"), _ctx.popperClass],
  30639. "reference-element": (_a = _ctx.referenceElementRef) == null ? void 0 : _a.$el,
  30640. trigger: _ctx.trigger,
  30641. "trigger-keys": _ctx.triggerKeys,
  30642. "trigger-target-el": _ctx.contentRef,
  30643. "show-after": _ctx.trigger === "hover" ? _ctx.showTimeout : 0,
  30644. "stop-popper-mouse-event": false,
  30645. "virtual-ref": _ctx.triggeringElementRef,
  30646. "virtual-triggering": _ctx.splitButton,
  30647. disabled: _ctx.disabled,
  30648. transition: `${_ctx.ns.namespace.value}-zoom-in-top`,
  30649. teleported: _ctx.teleported,
  30650. pure: "",
  30651. persistent: "",
  30652. onBeforeShow: _ctx.handleBeforeShowTooltip,
  30653. onShow: _ctx.handleShowTooltip,
  30654. onBeforeHide: _ctx.handleBeforeHideTooltip
  30655. }, vue.createSlots({
  30656. content: vue.withCtx(() => [
  30657. vue.createVNode(_component_el_scrollbar, {
  30658. ref: "scrollbar",
  30659. "wrap-style": _ctx.wrapStyle,
  30660. tag: "div",
  30661. "view-class": _ctx.ns.e("list")
  30662. }, {
  30663. default: vue.withCtx(() => [
  30664. vue.createVNode(_component_el_roving_focus_group, {
  30665. loop: _ctx.loop,
  30666. "current-tab-id": _ctx.currentTabId,
  30667. orientation: "horizontal",
  30668. onCurrentTabIdChange: _ctx.handleCurrentTabIdChange,
  30669. onEntryFocus: _ctx.handleEntryFocus
  30670. }, {
  30671. default: vue.withCtx(() => [
  30672. vue.createVNode(_component_el_dropdown_collection, null, {
  30673. default: vue.withCtx(() => [
  30674. vue.renderSlot(_ctx.$slots, "dropdown")
  30675. ]),
  30676. _: 3
  30677. })
  30678. ]),
  30679. _: 3
  30680. }, 8, ["loop", "current-tab-id", "onCurrentTabIdChange", "onEntryFocus"])
  30681. ]),
  30682. _: 3
  30683. }, 8, ["wrap-style", "view-class"])
  30684. ]),
  30685. _: 2
  30686. }, [
  30687. !_ctx.splitButton ? {
  30688. name: "default",
  30689. fn: vue.withCtx(() => [
  30690. vue.createVNode(_component_el_only_child, {
  30691. id: _ctx.triggerId,
  30692. ref: "triggeringElementRef",
  30693. role: "button",
  30694. tabindex: _ctx.tabindex
  30695. }, {
  30696. default: vue.withCtx(() => [
  30697. vue.renderSlot(_ctx.$slots, "default")
  30698. ]),
  30699. _: 3
  30700. }, 8, ["id", "tabindex"])
  30701. ])
  30702. } : void 0
  30703. ]), 1032, ["role", "effect", "popper-options", "hide-after", "placement", "popper-class", "reference-element", "trigger", "trigger-keys", "trigger-target-el", "show-after", "virtual-ref", "virtual-triggering", "disabled", "transition", "teleported", "onBeforeShow", "onShow", "onBeforeHide"]),
  30704. _ctx.splitButton ? (vue.openBlock(), vue.createBlock(_component_el_button_group, { key: 0 }, {
  30705. default: vue.withCtx(() => [
  30706. vue.createVNode(_component_el_button, vue.mergeProps({ ref: "referenceElementRef" }, _ctx.buttonProps, {
  30707. size: _ctx.dropdownSize,
  30708. type: _ctx.type,
  30709. disabled: _ctx.disabled,
  30710. tabindex: _ctx.tabindex,
  30711. onClick: _ctx.handlerMainButtonClick
  30712. }), {
  30713. default: vue.withCtx(() => [
  30714. vue.renderSlot(_ctx.$slots, "default")
  30715. ]),
  30716. _: 3
  30717. }, 16, ["size", "type", "disabled", "tabindex", "onClick"]),
  30718. vue.createVNode(_component_el_button, vue.mergeProps({
  30719. id: _ctx.triggerId,
  30720. ref: "triggeringElementRef"
  30721. }, _ctx.buttonProps, {
  30722. role: "button",
  30723. size: _ctx.dropdownSize,
  30724. type: _ctx.type,
  30725. class: _ctx.ns.e("caret-button"),
  30726. disabled: _ctx.disabled,
  30727. tabindex: _ctx.tabindex,
  30728. "aria-label": _ctx.t("el.dropdown.toggleDropdown")
  30729. }), {
  30730. default: vue.withCtx(() => [
  30731. vue.createVNode(_component_el_icon, {
  30732. class: vue.normalizeClass(_ctx.ns.e("icon"))
  30733. }, {
  30734. default: vue.withCtx(() => [
  30735. vue.createVNode(_component_arrow_down)
  30736. ]),
  30737. _: 1
  30738. }, 8, ["class"])
  30739. ]),
  30740. _: 1
  30741. }, 16, ["id", "size", "type", "class", "disabled", "tabindex", "aria-label"])
  30742. ]),
  30743. _: 3
  30744. })) : vue.createCommentVNode("v-if", true)
  30745. ], 2);
  30746. }
  30747. var Dropdown = /* @__PURE__ */ _export_sfc(_sfc_main$1g, [["render", _sfc_render$i], ["__file", "dropdown.vue"]]);
  30748. const _sfc_main$1f = vue.defineComponent({
  30749. name: "DropdownItemImpl",
  30750. components: {
  30751. ElIcon
  30752. },
  30753. props: dropdownItemProps,
  30754. emits: ["pointermove", "pointerleave", "click", "clickimpl"],
  30755. setup(_, { emit }) {
  30756. const ns = useNamespace("dropdown");
  30757. const { role: menuRole } = vue.inject(DROPDOWN_INJECTION_KEY, void 0);
  30758. const { collectionItemRef: dropdownCollectionItemRef } = vue.inject(COLLECTION_ITEM_INJECTION_KEY, void 0);
  30759. const { collectionItemRef: rovingFocusCollectionItemRef } = vue.inject(COLLECTION_ITEM_INJECTION_KEY$1, void 0);
  30760. const {
  30761. rovingFocusGroupItemRef,
  30762. tabIndex,
  30763. handleFocus,
  30764. handleKeydown: handleItemKeydown,
  30765. handleMousedown
  30766. } = vue.inject(ROVING_FOCUS_GROUP_ITEM_INJECTION_KEY, void 0);
  30767. const itemRef = composeRefs(dropdownCollectionItemRef, rovingFocusCollectionItemRef, rovingFocusGroupItemRef);
  30768. const role = vue.computed(() => {
  30769. if (menuRole.value === "menu") {
  30770. return "menuitem";
  30771. } else if (menuRole.value === "navigation") {
  30772. return "link";
  30773. }
  30774. return "button";
  30775. });
  30776. const handleKeydown = composeEventHandlers((e) => {
  30777. if ([EVENT_CODE.enter, EVENT_CODE.numpadEnter, EVENT_CODE.space].includes(e.code)) {
  30778. e.preventDefault();
  30779. e.stopImmediatePropagation();
  30780. emit("clickimpl", e);
  30781. return true;
  30782. }
  30783. }, handleItemKeydown);
  30784. return {
  30785. ns,
  30786. itemRef,
  30787. dataset: {
  30788. [COLLECTION_ITEM_SIGN]: ""
  30789. },
  30790. role,
  30791. tabIndex,
  30792. handleFocus,
  30793. handleKeydown,
  30794. handleMousedown
  30795. };
  30796. }
  30797. });
  30798. function _sfc_render$h(_ctx, _cache, $props, $setup, $data, $options) {
  30799. const _component_el_icon = vue.resolveComponent("el-icon");
  30800. return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
  30801. _ctx.divided ? (vue.openBlock(), vue.createElementBlock("li", {
  30802. key: 0,
  30803. role: "separator",
  30804. class: vue.normalizeClass(_ctx.ns.bem("menu", "item", "divided"))
  30805. }, null, 2)) : vue.createCommentVNode("v-if", true),
  30806. vue.createElementVNode("li", vue.mergeProps({ ref: _ctx.itemRef }, { ..._ctx.dataset, ..._ctx.$attrs }, {
  30807. "aria-disabled": _ctx.disabled,
  30808. class: [_ctx.ns.be("menu", "item"), _ctx.ns.is("disabled", _ctx.disabled)],
  30809. tabindex: _ctx.tabIndex,
  30810. role: _ctx.role,
  30811. onClick: (e) => _ctx.$emit("clickimpl", e),
  30812. onFocus: _ctx.handleFocus,
  30813. onKeydown: vue.withModifiers(_ctx.handleKeydown, ["self"]),
  30814. onMousedown: _ctx.handleMousedown,
  30815. onPointermove: (e) => _ctx.$emit("pointermove", e),
  30816. onPointerleave: (e) => _ctx.$emit("pointerleave", e)
  30817. }), [
  30818. _ctx.icon ? (vue.openBlock(), vue.createBlock(_component_el_icon, { key: 0 }, {
  30819. default: vue.withCtx(() => [
  30820. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.icon)))
  30821. ]),
  30822. _: 1
  30823. })) : vue.createCommentVNode("v-if", true),
  30824. vue.renderSlot(_ctx.$slots, "default")
  30825. ], 16, ["aria-disabled", "tabindex", "role", "onClick", "onFocus", "onKeydown", "onMousedown", "onPointermove", "onPointerleave"])
  30826. ], 64);
  30827. }
  30828. var ElDropdownItemImpl = /* @__PURE__ */ _export_sfc(_sfc_main$1f, [["render", _sfc_render$h], ["__file", "dropdown-item-impl.vue"]]);
  30829. const useDropdown = () => {
  30830. const elDropdown = vue.inject("elDropdown", {});
  30831. const _elDropdownSize = vue.computed(() => elDropdown == null ? void 0 : elDropdown.dropdownSize);
  30832. return {
  30833. elDropdown,
  30834. _elDropdownSize
  30835. };
  30836. };
  30837. const _sfc_main$1e = vue.defineComponent({
  30838. name: "ElDropdownItem",
  30839. components: {
  30840. ElDropdownCollectionItem: ElCollectionItem,
  30841. ElRovingFocusItem,
  30842. ElDropdownItemImpl
  30843. },
  30844. inheritAttrs: false,
  30845. props: dropdownItemProps,
  30846. emits: ["pointermove", "pointerleave", "click"],
  30847. setup(props, { emit, attrs }) {
  30848. const { elDropdown } = useDropdown();
  30849. const _instance = vue.getCurrentInstance();
  30850. const itemRef = vue.ref(null);
  30851. const textContent = vue.computed(() => {
  30852. var _a, _b;
  30853. return (_b = (_a = vue.unref(itemRef)) == null ? void 0 : _a.textContent) != null ? _b : "";
  30854. });
  30855. const { onItemEnter, onItemLeave } = vue.inject(DROPDOWN_INJECTION_KEY, void 0);
  30856. const handlePointerMove = composeEventHandlers((e) => {
  30857. emit("pointermove", e);
  30858. return e.defaultPrevented;
  30859. }, whenMouse((e) => {
  30860. if (props.disabled) {
  30861. onItemLeave(e);
  30862. return;
  30863. }
  30864. const target = e.currentTarget;
  30865. if (target === document.activeElement || target.contains(document.activeElement)) {
  30866. return;
  30867. }
  30868. onItemEnter(e);
  30869. if (!e.defaultPrevented) {
  30870. target == null ? void 0 : target.focus();
  30871. }
  30872. }));
  30873. const handlePointerLeave = composeEventHandlers((e) => {
  30874. emit("pointerleave", e);
  30875. return e.defaultPrevented;
  30876. }, whenMouse(onItemLeave));
  30877. const handleClick = composeEventHandlers((e) => {
  30878. if (props.disabled) {
  30879. return;
  30880. }
  30881. emit("click", e);
  30882. return e.type !== "keydown" && e.defaultPrevented;
  30883. }, (e) => {
  30884. var _a, _b, _c;
  30885. if (props.disabled) {
  30886. e.stopImmediatePropagation();
  30887. return;
  30888. }
  30889. if ((_a = elDropdown == null ? void 0 : elDropdown.hideOnClick) == null ? void 0 : _a.value) {
  30890. (_b = elDropdown.handleClick) == null ? void 0 : _b.call(elDropdown);
  30891. }
  30892. (_c = elDropdown.commandHandler) == null ? void 0 : _c.call(elDropdown, props.command, _instance, e);
  30893. });
  30894. const propsAndAttrs = vue.computed(() => ({ ...props, ...attrs }));
  30895. return {
  30896. handleClick,
  30897. handlePointerMove,
  30898. handlePointerLeave,
  30899. textContent,
  30900. propsAndAttrs
  30901. };
  30902. }
  30903. });
  30904. function _sfc_render$g(_ctx, _cache, $props, $setup, $data, $options) {
  30905. var _a;
  30906. const _component_el_dropdown_item_impl = vue.resolveComponent("el-dropdown-item-impl");
  30907. const _component_el_roving_focus_item = vue.resolveComponent("el-roving-focus-item");
  30908. const _component_el_dropdown_collection_item = vue.resolveComponent("el-dropdown-collection-item");
  30909. return vue.openBlock(), vue.createBlock(_component_el_dropdown_collection_item, {
  30910. disabled: _ctx.disabled,
  30911. "text-value": (_a = _ctx.textValue) != null ? _a : _ctx.textContent
  30912. }, {
  30913. default: vue.withCtx(() => [
  30914. vue.createVNode(_component_el_roving_focus_item, {
  30915. focusable: !_ctx.disabled
  30916. }, {
  30917. default: vue.withCtx(() => [
  30918. vue.createVNode(_component_el_dropdown_item_impl, vue.mergeProps(_ctx.propsAndAttrs, {
  30919. onPointerleave: _ctx.handlePointerLeave,
  30920. onPointermove: _ctx.handlePointerMove,
  30921. onClickimpl: _ctx.handleClick
  30922. }), {
  30923. default: vue.withCtx(() => [
  30924. vue.renderSlot(_ctx.$slots, "default")
  30925. ]),
  30926. _: 3
  30927. }, 16, ["onPointerleave", "onPointermove", "onClickimpl"])
  30928. ]),
  30929. _: 3
  30930. }, 8, ["focusable"])
  30931. ]),
  30932. _: 3
  30933. }, 8, ["disabled", "text-value"]);
  30934. }
  30935. var DropdownItem = /* @__PURE__ */ _export_sfc(_sfc_main$1e, [["render", _sfc_render$g], ["__file", "dropdown-item.vue"]]);
  30936. const _sfc_main$1d = vue.defineComponent({
  30937. name: "ElDropdownMenu",
  30938. props: dropdownMenuProps,
  30939. setup(props) {
  30940. const ns = useNamespace("dropdown");
  30941. const { _elDropdownSize } = useDropdown();
  30942. const size = _elDropdownSize.value;
  30943. const { focusTrapRef, onKeydown } = vue.inject(FOCUS_TRAP_INJECTION_KEY, void 0);
  30944. const { contentRef, role, triggerId } = vue.inject(DROPDOWN_INJECTION_KEY, void 0);
  30945. const { collectionRef: dropdownCollectionRef, getItems } = vue.inject(COLLECTION_INJECTION_KEY, void 0);
  30946. const {
  30947. rovingFocusGroupRef,
  30948. rovingFocusGroupRootStyle,
  30949. tabIndex,
  30950. onBlur,
  30951. onFocus,
  30952. onMousedown
  30953. } = vue.inject(ROVING_FOCUS_GROUP_INJECTION_KEY, void 0);
  30954. const { collectionRef: rovingFocusGroupCollectionRef } = vue.inject(COLLECTION_INJECTION_KEY$1, void 0);
  30955. const dropdownKls = vue.computed(() => {
  30956. return [ns.b("menu"), ns.bm("menu", size == null ? void 0 : size.value)];
  30957. });
  30958. const dropdownListWrapperRef = composeRefs(contentRef, dropdownCollectionRef, focusTrapRef, rovingFocusGroupRef, rovingFocusGroupCollectionRef);
  30959. const composedKeydown = composeEventHandlers((e) => {
  30960. var _a;
  30961. (_a = props.onKeydown) == null ? void 0 : _a.call(props, e);
  30962. }, (e) => {
  30963. const { currentTarget, code, target } = e;
  30964. currentTarget.contains(target);
  30965. if (EVENT_CODE.tab === code) {
  30966. e.stopImmediatePropagation();
  30967. }
  30968. e.preventDefault();
  30969. if (target !== vue.unref(contentRef) || !FIRST_LAST_KEYS.includes(code))
  30970. return;
  30971. const items = getItems().filter((item) => !item.disabled);
  30972. const targets = items.map((item) => item.ref);
  30973. if (LAST_KEYS.includes(code)) {
  30974. targets.reverse();
  30975. }
  30976. focusFirst(targets);
  30977. });
  30978. const handleKeydown = (e) => {
  30979. composedKeydown(e);
  30980. onKeydown(e);
  30981. };
  30982. return {
  30983. size,
  30984. rovingFocusGroupRootStyle,
  30985. tabIndex,
  30986. dropdownKls,
  30987. role,
  30988. triggerId,
  30989. dropdownListWrapperRef,
  30990. handleKeydown,
  30991. onBlur,
  30992. onFocus,
  30993. onMousedown
  30994. };
  30995. }
  30996. });
  30997. function _sfc_render$f(_ctx, _cache, $props, $setup, $data, $options) {
  30998. return vue.openBlock(), vue.createElementBlock("ul", {
  30999. ref: _ctx.dropdownListWrapperRef,
  31000. class: vue.normalizeClass(_ctx.dropdownKls),
  31001. style: vue.normalizeStyle(_ctx.rovingFocusGroupRootStyle),
  31002. tabindex: -1,
  31003. role: _ctx.role,
  31004. "aria-labelledby": _ctx.triggerId,
  31005. onBlur: _ctx.onBlur,
  31006. onFocus: _ctx.onFocus,
  31007. onKeydown: vue.withModifiers(_ctx.handleKeydown, ["self"]),
  31008. onMousedown: vue.withModifiers(_ctx.onMousedown, ["self"])
  31009. }, [
  31010. vue.renderSlot(_ctx.$slots, "default")
  31011. ], 46, ["role", "aria-labelledby", "onBlur", "onFocus", "onKeydown", "onMousedown"]);
  31012. }
  31013. var DropdownMenu = /* @__PURE__ */ _export_sfc(_sfc_main$1d, [["render", _sfc_render$f], ["__file", "dropdown-menu.vue"]]);
  31014. const ElDropdown = withInstall(Dropdown, {
  31015. DropdownItem,
  31016. DropdownMenu
  31017. });
  31018. const ElDropdownItem = withNoopInstall(DropdownItem);
  31019. const ElDropdownMenu = withNoopInstall(DropdownMenu);
  31020. const __default__$X = vue.defineComponent({
  31021. name: "ImgEmpty"
  31022. });
  31023. const _sfc_main$1c = /* @__PURE__ */ vue.defineComponent({
  31024. ...__default__$X,
  31025. setup(__props) {
  31026. const ns = useNamespace("empty");
  31027. const id = useId();
  31028. return (_ctx, _cache) => {
  31029. return vue.openBlock(), vue.createElementBlock("svg", {
  31030. viewBox: "0 0 79 86",
  31031. version: "1.1",
  31032. xmlns: "http://www.w3.org/2000/svg",
  31033. "xmlns:xlink": "http://www.w3.org/1999/xlink"
  31034. }, [
  31035. vue.createElementVNode("defs", null, [
  31036. vue.createElementVNode("linearGradient", {
  31037. id: `linearGradient-1-${vue.unref(id)}`,
  31038. x1: "38.8503086%",
  31039. y1: "0%",
  31040. x2: "61.1496914%",
  31041. y2: "100%"
  31042. }, [
  31043. vue.createElementVNode("stop", {
  31044. "stop-color": `var(${vue.unref(ns).cssVarBlockName("fill-color-1")})`,
  31045. offset: "0%"
  31046. }, null, 8, ["stop-color"]),
  31047. vue.createElementVNode("stop", {
  31048. "stop-color": `var(${vue.unref(ns).cssVarBlockName("fill-color-4")})`,
  31049. offset: "100%"
  31050. }, null, 8, ["stop-color"])
  31051. ], 8, ["id"]),
  31052. vue.createElementVNode("linearGradient", {
  31053. id: `linearGradient-2-${vue.unref(id)}`,
  31054. x1: "0%",
  31055. y1: "9.5%",
  31056. x2: "100%",
  31057. y2: "90.5%"
  31058. }, [
  31059. vue.createElementVNode("stop", {
  31060. "stop-color": `var(${vue.unref(ns).cssVarBlockName("fill-color-1")})`,
  31061. offset: "0%"
  31062. }, null, 8, ["stop-color"]),
  31063. vue.createElementVNode("stop", {
  31064. "stop-color": `var(${vue.unref(ns).cssVarBlockName("fill-color-6")})`,
  31065. offset: "100%"
  31066. }, null, 8, ["stop-color"])
  31067. ], 8, ["id"]),
  31068. vue.createElementVNode("rect", {
  31069. id: `path-3-${vue.unref(id)}`,
  31070. x: "0",
  31071. y: "0",
  31072. width: "17",
  31073. height: "36"
  31074. }, null, 8, ["id"])
  31075. ]),
  31076. vue.createElementVNode("g", {
  31077. id: "Illustrations",
  31078. stroke: "none",
  31079. "stroke-width": "1",
  31080. fill: "none",
  31081. "fill-rule": "evenodd"
  31082. }, [
  31083. vue.createElementVNode("g", {
  31084. id: "B-type",
  31085. transform: "translate(-1268.000000, -535.000000)"
  31086. }, [
  31087. vue.createElementVNode("g", {
  31088. id: "Group-2",
  31089. transform: "translate(1268.000000, 535.000000)"
  31090. }, [
  31091. vue.createElementVNode("path", {
  31092. id: "Oval-Copy-2",
  31093. d: "M39.5,86 C61.3152476,86 79,83.9106622 79,81.3333333 C79,78.7560045 57.3152476,78 35.5,78 C13.6847524,78 0,78.7560045 0,81.3333333 C0,83.9106622 17.6847524,86 39.5,86 Z",
  31094. fill: `var(${vue.unref(ns).cssVarBlockName("fill-color-3")})`
  31095. }, null, 8, ["fill"]),
  31096. vue.createElementVNode("polygon", {
  31097. id: "Rectangle-Copy-14",
  31098. fill: `var(${vue.unref(ns).cssVarBlockName("fill-color-7")})`,
  31099. transform: "translate(27.500000, 51.500000) scale(1, -1) translate(-27.500000, -51.500000) ",
  31100. points: "13 58 53 58 42 45 2 45"
  31101. }, null, 8, ["fill"]),
  31102. vue.createElementVNode("g", {
  31103. id: "Group-Copy",
  31104. transform: "translate(34.500000, 31.500000) scale(-1, 1) rotate(-25.000000) translate(-34.500000, -31.500000) translate(7.000000, 10.000000)"
  31105. }, [
  31106. vue.createElementVNode("polygon", {
  31107. id: "Rectangle-Copy-10",
  31108. fill: `var(${vue.unref(ns).cssVarBlockName("fill-color-7")})`,
  31109. transform: "translate(11.500000, 5.000000) scale(1, -1) translate(-11.500000, -5.000000) ",
  31110. points: "2.84078316e-14 3 18 3 23 7 5 7"
  31111. }, null, 8, ["fill"]),
  31112. vue.createElementVNode("polygon", {
  31113. id: "Rectangle-Copy-11",
  31114. fill: `var(${vue.unref(ns).cssVarBlockName("fill-color-5")})`,
  31115. points: "-3.69149156e-15 7 38 7 38 43 -3.69149156e-15 43"
  31116. }, null, 8, ["fill"]),
  31117. vue.createElementVNode("rect", {
  31118. id: "Rectangle-Copy-12",
  31119. fill: `url(#linearGradient-1-${vue.unref(id)})`,
  31120. transform: "translate(46.500000, 25.000000) scale(-1, 1) translate(-46.500000, -25.000000) ",
  31121. x: "38",
  31122. y: "7",
  31123. width: "17",
  31124. height: "36"
  31125. }, null, 8, ["fill"]),
  31126. vue.createElementVNode("polygon", {
  31127. id: "Rectangle-Copy-13",
  31128. fill: `var(${vue.unref(ns).cssVarBlockName("fill-color-2")})`,
  31129. transform: "translate(39.500000, 3.500000) scale(-1, 1) translate(-39.500000, -3.500000) ",
  31130. points: "24 7 41 7 55 -3.63806207e-12 38 -3.63806207e-12"
  31131. }, null, 8, ["fill"])
  31132. ]),
  31133. vue.createElementVNode("rect", {
  31134. id: "Rectangle-Copy-15",
  31135. fill: `url(#linearGradient-2-${vue.unref(id)})`,
  31136. x: "13",
  31137. y: "45",
  31138. width: "40",
  31139. height: "36"
  31140. }, null, 8, ["fill"]),
  31141. vue.createElementVNode("g", {
  31142. id: "Rectangle-Copy-17",
  31143. transform: "translate(53.000000, 45.000000)"
  31144. }, [
  31145. vue.createElementVNode("use", {
  31146. id: "Mask",
  31147. fill: `var(${vue.unref(ns).cssVarBlockName("fill-color-8")})`,
  31148. transform: "translate(8.500000, 18.000000) scale(-1, 1) translate(-8.500000, -18.000000) ",
  31149. "xlink:href": `#path-3-${vue.unref(id)}`
  31150. }, null, 8, ["fill", "xlink:href"]),
  31151. vue.createElementVNode("polygon", {
  31152. id: "Rectangle-Copy",
  31153. fill: `var(${vue.unref(ns).cssVarBlockName("fill-color-9")})`,
  31154. mask: `url(#mask-4-${vue.unref(id)})`,
  31155. transform: "translate(12.000000, 9.000000) scale(-1, 1) translate(-12.000000, -9.000000) ",
  31156. points: "7 0 24 0 20 18 7 16.5"
  31157. }, null, 8, ["fill", "mask"])
  31158. ]),
  31159. vue.createElementVNode("polygon", {
  31160. id: "Rectangle-Copy-18",
  31161. fill: `var(${vue.unref(ns).cssVarBlockName("fill-color-2")})`,
  31162. transform: "translate(66.000000, 51.500000) scale(-1, 1) translate(-66.000000, -51.500000) ",
  31163. points: "62 45 79 45 70 58 53 58"
  31164. }, null, 8, ["fill"])
  31165. ])
  31166. ])
  31167. ])
  31168. ]);
  31169. };
  31170. }
  31171. });
  31172. var ImgEmpty = /* @__PURE__ */ _export_sfc(_sfc_main$1c, [["__file", "img-empty.vue"]]);
  31173. const emptyProps = buildProps({
  31174. image: {
  31175. type: String,
  31176. default: ""
  31177. },
  31178. imageSize: Number,
  31179. description: {
  31180. type: String,
  31181. default: ""
  31182. }
  31183. });
  31184. const __default__$W = vue.defineComponent({
  31185. name: "ElEmpty"
  31186. });
  31187. const _sfc_main$1b = /* @__PURE__ */ vue.defineComponent({
  31188. ...__default__$W,
  31189. props: emptyProps,
  31190. setup(__props) {
  31191. const props = __props;
  31192. const { t } = useLocale();
  31193. const ns = useNamespace("empty");
  31194. const emptyDescription = vue.computed(() => props.description || t("el.table.emptyText"));
  31195. const imageStyle = vue.computed(() => ({
  31196. width: addUnit(props.imageSize)
  31197. }));
  31198. return (_ctx, _cache) => {
  31199. return vue.openBlock(), vue.createElementBlock("div", {
  31200. class: vue.normalizeClass(vue.unref(ns).b())
  31201. }, [
  31202. vue.createElementVNode("div", {
  31203. class: vue.normalizeClass(vue.unref(ns).e("image")),
  31204. style: vue.normalizeStyle(vue.unref(imageStyle))
  31205. }, [
  31206. _ctx.image ? (vue.openBlock(), vue.createElementBlock("img", {
  31207. key: 0,
  31208. src: _ctx.image,
  31209. ondragstart: "return false"
  31210. }, null, 8, ["src"])) : vue.renderSlot(_ctx.$slots, "image", { key: 1 }, () => [
  31211. vue.createVNode(ImgEmpty)
  31212. ])
  31213. ], 6),
  31214. vue.createElementVNode("div", {
  31215. class: vue.normalizeClass(vue.unref(ns).e("description"))
  31216. }, [
  31217. _ctx.$slots.description ? vue.renderSlot(_ctx.$slots, "description", { key: 0 }) : (vue.openBlock(), vue.createElementBlock("p", { key: 1 }, vue.toDisplayString(vue.unref(emptyDescription)), 1))
  31218. ], 2),
  31219. _ctx.$slots.default ? (vue.openBlock(), vue.createElementBlock("div", {
  31220. key: 0,
  31221. class: vue.normalizeClass(vue.unref(ns).e("bottom"))
  31222. }, [
  31223. vue.renderSlot(_ctx.$slots, "default")
  31224. ], 2)) : vue.createCommentVNode("v-if", true)
  31225. ], 2);
  31226. };
  31227. }
  31228. });
  31229. var Empty = /* @__PURE__ */ _export_sfc(_sfc_main$1b, [["__file", "empty.vue"]]);
  31230. const ElEmpty = withInstall(Empty);
  31231. const imageViewerProps = buildProps({
  31232. urlList: {
  31233. type: definePropType(Array),
  31234. default: () => mutable([])
  31235. },
  31236. zIndex: {
  31237. type: Number
  31238. },
  31239. initialIndex: {
  31240. type: Number,
  31241. default: 0
  31242. },
  31243. infinite: {
  31244. type: Boolean,
  31245. default: true
  31246. },
  31247. hideOnClickModal: Boolean,
  31248. teleported: Boolean,
  31249. closeOnPressEscape: {
  31250. type: Boolean,
  31251. default: true
  31252. },
  31253. zoomRate: {
  31254. type: Number,
  31255. default: 1.2
  31256. },
  31257. minScale: {
  31258. type: Number,
  31259. default: 0.2
  31260. },
  31261. maxScale: {
  31262. type: Number,
  31263. default: 7
  31264. },
  31265. crossorigin: {
  31266. type: definePropType(String)
  31267. }
  31268. });
  31269. const imageViewerEmits = {
  31270. close: () => true,
  31271. switch: (index) => isNumber(index),
  31272. rotate: (deg) => isNumber(deg)
  31273. };
  31274. const __default__$V = vue.defineComponent({
  31275. name: "ElImageViewer"
  31276. });
  31277. const _sfc_main$1a = /* @__PURE__ */ vue.defineComponent({
  31278. ...__default__$V,
  31279. props: imageViewerProps,
  31280. emits: imageViewerEmits,
  31281. setup(__props, { expose, emit }) {
  31282. var _a;
  31283. const props = __props;
  31284. const modes = {
  31285. CONTAIN: {
  31286. name: "contain",
  31287. icon: vue.markRaw(full_screen_default)
  31288. },
  31289. ORIGINAL: {
  31290. name: "original",
  31291. icon: vue.markRaw(scale_to_original_default)
  31292. }
  31293. };
  31294. const { t } = useLocale();
  31295. const ns = useNamespace("image-viewer");
  31296. const { nextZIndex } = useZIndex();
  31297. const wrapper = vue.ref();
  31298. const imgRefs = vue.ref([]);
  31299. const scopeEventListener = vue.effectScope();
  31300. const loading = vue.ref(true);
  31301. const activeIndex = vue.ref(props.initialIndex);
  31302. const mode = vue.shallowRef(modes.CONTAIN);
  31303. const transform = vue.ref({
  31304. scale: 1,
  31305. deg: 0,
  31306. offsetX: 0,
  31307. offsetY: 0,
  31308. enableTransition: false
  31309. });
  31310. const zIndex = vue.ref((_a = props.zIndex) != null ? _a : nextZIndex());
  31311. const isSingle = vue.computed(() => {
  31312. const { urlList } = props;
  31313. return urlList.length <= 1;
  31314. });
  31315. const isFirst = vue.computed(() => {
  31316. return activeIndex.value === 0;
  31317. });
  31318. const isLast = vue.computed(() => {
  31319. return activeIndex.value === props.urlList.length - 1;
  31320. });
  31321. const currentImg = vue.computed(() => {
  31322. return props.urlList[activeIndex.value];
  31323. });
  31324. const arrowPrevKls = vue.computed(() => [
  31325. ns.e("btn"),
  31326. ns.e("prev"),
  31327. ns.is("disabled", !props.infinite && isFirst.value)
  31328. ]);
  31329. const arrowNextKls = vue.computed(() => [
  31330. ns.e("btn"),
  31331. ns.e("next"),
  31332. ns.is("disabled", !props.infinite && isLast.value)
  31333. ]);
  31334. const imgStyle = vue.computed(() => {
  31335. const { scale, deg, offsetX, offsetY, enableTransition } = transform.value;
  31336. let translateX = offsetX / scale;
  31337. let translateY = offsetY / scale;
  31338. const radian = deg * Math.PI / 180;
  31339. const cosRadian = Math.cos(radian);
  31340. const sinRadian = Math.sin(radian);
  31341. translateX = translateX * cosRadian + translateY * sinRadian;
  31342. translateY = translateY * cosRadian - offsetX / scale * sinRadian;
  31343. const style = {
  31344. transform: `scale(${scale}) rotate(${deg}deg) translate(${translateX}px, ${translateY}px)`,
  31345. transition: enableTransition ? "transform .3s" : ""
  31346. };
  31347. if (mode.value.name === modes.CONTAIN.name) {
  31348. style.maxWidth = style.maxHeight = "100%";
  31349. }
  31350. return style;
  31351. });
  31352. function hide() {
  31353. unregisterEventListener();
  31354. emit("close");
  31355. }
  31356. function registerEventListener() {
  31357. const keydownHandler = throttle((e) => {
  31358. switch (e.code) {
  31359. case EVENT_CODE.esc:
  31360. props.closeOnPressEscape && hide();
  31361. break;
  31362. case EVENT_CODE.space:
  31363. toggleMode();
  31364. break;
  31365. case EVENT_CODE.left:
  31366. prev();
  31367. break;
  31368. case EVENT_CODE.up:
  31369. handleActions("zoomIn");
  31370. break;
  31371. case EVENT_CODE.right:
  31372. next();
  31373. break;
  31374. case EVENT_CODE.down:
  31375. handleActions("zoomOut");
  31376. break;
  31377. }
  31378. });
  31379. const mousewheelHandler = throttle((e) => {
  31380. const delta = e.deltaY || e.deltaX;
  31381. handleActions(delta < 0 ? "zoomIn" : "zoomOut", {
  31382. zoomRate: props.zoomRate,
  31383. enableTransition: false
  31384. });
  31385. });
  31386. scopeEventListener.run(() => {
  31387. useEventListener(document, "keydown", keydownHandler);
  31388. useEventListener(document, "wheel", mousewheelHandler);
  31389. });
  31390. }
  31391. function unregisterEventListener() {
  31392. scopeEventListener.stop();
  31393. }
  31394. function handleImgLoad() {
  31395. loading.value = false;
  31396. }
  31397. function handleImgError(e) {
  31398. loading.value = false;
  31399. e.target.alt = t("el.image.error");
  31400. }
  31401. function handleMouseDown(e) {
  31402. if (loading.value || e.button !== 0 || !wrapper.value)
  31403. return;
  31404. transform.value.enableTransition = false;
  31405. const { offsetX, offsetY } = transform.value;
  31406. const startX = e.pageX;
  31407. const startY = e.pageY;
  31408. const dragHandler = throttle((ev) => {
  31409. transform.value = {
  31410. ...transform.value,
  31411. offsetX: offsetX + ev.pageX - startX,
  31412. offsetY: offsetY + ev.pageY - startY
  31413. };
  31414. });
  31415. const removeMousemove = useEventListener(document, "mousemove", dragHandler);
  31416. useEventListener(document, "mouseup", () => {
  31417. removeMousemove();
  31418. });
  31419. e.preventDefault();
  31420. }
  31421. function reset() {
  31422. transform.value = {
  31423. scale: 1,
  31424. deg: 0,
  31425. offsetX: 0,
  31426. offsetY: 0,
  31427. enableTransition: false
  31428. };
  31429. }
  31430. function toggleMode() {
  31431. if (loading.value)
  31432. return;
  31433. const modeNames = keysOf(modes);
  31434. const modeValues = Object.values(modes);
  31435. const currentMode = mode.value.name;
  31436. const index = modeValues.findIndex((i) => i.name === currentMode);
  31437. const nextIndex = (index + 1) % modeNames.length;
  31438. mode.value = modes[modeNames[nextIndex]];
  31439. reset();
  31440. }
  31441. function setActiveItem(index) {
  31442. const len = props.urlList.length;
  31443. activeIndex.value = (index + len) % len;
  31444. }
  31445. function prev() {
  31446. if (isFirst.value && !props.infinite)
  31447. return;
  31448. setActiveItem(activeIndex.value - 1);
  31449. }
  31450. function next() {
  31451. if (isLast.value && !props.infinite)
  31452. return;
  31453. setActiveItem(activeIndex.value + 1);
  31454. }
  31455. function handleActions(action, options = {}) {
  31456. if (loading.value)
  31457. return;
  31458. const { minScale, maxScale } = props;
  31459. const { zoomRate, rotateDeg, enableTransition } = {
  31460. zoomRate: props.zoomRate,
  31461. rotateDeg: 90,
  31462. enableTransition: true,
  31463. ...options
  31464. };
  31465. switch (action) {
  31466. case "zoomOut":
  31467. if (transform.value.scale > minScale) {
  31468. transform.value.scale = Number.parseFloat((transform.value.scale / zoomRate).toFixed(3));
  31469. }
  31470. break;
  31471. case "zoomIn":
  31472. if (transform.value.scale < maxScale) {
  31473. transform.value.scale = Number.parseFloat((transform.value.scale * zoomRate).toFixed(3));
  31474. }
  31475. break;
  31476. case "clockwise":
  31477. transform.value.deg += rotateDeg;
  31478. emit("rotate", transform.value.deg);
  31479. break;
  31480. case "anticlockwise":
  31481. transform.value.deg -= rotateDeg;
  31482. emit("rotate", transform.value.deg);
  31483. break;
  31484. }
  31485. transform.value.enableTransition = enableTransition;
  31486. }
  31487. function onFocusoutPrevented(event) {
  31488. var _a2;
  31489. if (((_a2 = event.detail) == null ? void 0 : _a2.focusReason) === "pointer") {
  31490. event.preventDefault();
  31491. }
  31492. }
  31493. function onCloseRequested() {
  31494. if (props.closeOnPressEscape) {
  31495. hide();
  31496. }
  31497. }
  31498. vue.watch(currentImg, () => {
  31499. vue.nextTick(() => {
  31500. const $img = imgRefs.value[0];
  31501. if (!($img == null ? void 0 : $img.complete)) {
  31502. loading.value = true;
  31503. }
  31504. });
  31505. });
  31506. vue.watch(activeIndex, (val) => {
  31507. reset();
  31508. emit("switch", val);
  31509. });
  31510. vue.onMounted(() => {
  31511. registerEventListener();
  31512. });
  31513. expose({
  31514. setActiveItem
  31515. });
  31516. return (_ctx, _cache) => {
  31517. return vue.openBlock(), vue.createBlock(vue.unref(ElTeleport$1), {
  31518. to: "body",
  31519. disabled: !_ctx.teleported
  31520. }, {
  31521. default: vue.withCtx(() => [
  31522. vue.createVNode(vue.Transition, {
  31523. name: "viewer-fade",
  31524. appear: ""
  31525. }, {
  31526. default: vue.withCtx(() => [
  31527. vue.createElementVNode("div", {
  31528. ref_key: "wrapper",
  31529. ref: wrapper,
  31530. tabindex: -1,
  31531. class: vue.normalizeClass(vue.unref(ns).e("wrapper")),
  31532. style: vue.normalizeStyle({ zIndex: zIndex.value })
  31533. }, [
  31534. vue.createVNode(vue.unref(ElFocusTrap), {
  31535. loop: "",
  31536. trapped: "",
  31537. "focus-trap-el": wrapper.value,
  31538. "focus-start-el": "container",
  31539. onFocusoutPrevented,
  31540. onReleaseRequested: onCloseRequested
  31541. }, {
  31542. default: vue.withCtx(() => [
  31543. vue.createElementVNode("div", {
  31544. class: vue.normalizeClass(vue.unref(ns).e("mask")),
  31545. onClick: vue.withModifiers(($event) => _ctx.hideOnClickModal && hide(), ["self"])
  31546. }, null, 10, ["onClick"]),
  31547. vue.createCommentVNode(" CLOSE "),
  31548. vue.createElementVNode("span", {
  31549. class: vue.normalizeClass([vue.unref(ns).e("btn"), vue.unref(ns).e("close")]),
  31550. onClick: hide
  31551. }, [
  31552. vue.createVNode(vue.unref(ElIcon), null, {
  31553. default: vue.withCtx(() => [
  31554. vue.createVNode(vue.unref(close_default))
  31555. ]),
  31556. _: 1
  31557. })
  31558. ], 2),
  31559. vue.createCommentVNode(" ARROW "),
  31560. !vue.unref(isSingle) ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  31561. vue.createElementVNode("span", {
  31562. class: vue.normalizeClass(vue.unref(arrowPrevKls)),
  31563. onClick: prev
  31564. }, [
  31565. vue.createVNode(vue.unref(ElIcon), null, {
  31566. default: vue.withCtx(() => [
  31567. vue.createVNode(vue.unref(arrow_left_default))
  31568. ]),
  31569. _: 1
  31570. })
  31571. ], 2),
  31572. vue.createElementVNode("span", {
  31573. class: vue.normalizeClass(vue.unref(arrowNextKls)),
  31574. onClick: next
  31575. }, [
  31576. vue.createVNode(vue.unref(ElIcon), null, {
  31577. default: vue.withCtx(() => [
  31578. vue.createVNode(vue.unref(arrow_right_default))
  31579. ]),
  31580. _: 1
  31581. })
  31582. ], 2)
  31583. ], 64)) : vue.createCommentVNode("v-if", true),
  31584. vue.createCommentVNode(" ACTIONS "),
  31585. vue.createElementVNode("div", {
  31586. class: vue.normalizeClass([vue.unref(ns).e("btn"), vue.unref(ns).e("actions")])
  31587. }, [
  31588. vue.createElementVNode("div", {
  31589. class: vue.normalizeClass(vue.unref(ns).e("actions__inner"))
  31590. }, [
  31591. vue.createVNode(vue.unref(ElIcon), {
  31592. onClick: ($event) => handleActions("zoomOut")
  31593. }, {
  31594. default: vue.withCtx(() => [
  31595. vue.createVNode(vue.unref(zoom_out_default))
  31596. ]),
  31597. _: 1
  31598. }, 8, ["onClick"]),
  31599. vue.createVNode(vue.unref(ElIcon), {
  31600. onClick: ($event) => handleActions("zoomIn")
  31601. }, {
  31602. default: vue.withCtx(() => [
  31603. vue.createVNode(vue.unref(zoom_in_default))
  31604. ]),
  31605. _: 1
  31606. }, 8, ["onClick"]),
  31607. vue.createElementVNode("i", {
  31608. class: vue.normalizeClass(vue.unref(ns).e("actions__divider"))
  31609. }, null, 2),
  31610. vue.createVNode(vue.unref(ElIcon), { onClick: toggleMode }, {
  31611. default: vue.withCtx(() => [
  31612. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(mode).icon)))
  31613. ]),
  31614. _: 1
  31615. }),
  31616. vue.createElementVNode("i", {
  31617. class: vue.normalizeClass(vue.unref(ns).e("actions__divider"))
  31618. }, null, 2),
  31619. vue.createVNode(vue.unref(ElIcon), {
  31620. onClick: ($event) => handleActions("anticlockwise")
  31621. }, {
  31622. default: vue.withCtx(() => [
  31623. vue.createVNode(vue.unref(refresh_left_default))
  31624. ]),
  31625. _: 1
  31626. }, 8, ["onClick"]),
  31627. vue.createVNode(vue.unref(ElIcon), {
  31628. onClick: ($event) => handleActions("clockwise")
  31629. }, {
  31630. default: vue.withCtx(() => [
  31631. vue.createVNode(vue.unref(refresh_right_default))
  31632. ]),
  31633. _: 1
  31634. }, 8, ["onClick"])
  31635. ], 2)
  31636. ], 2),
  31637. vue.createCommentVNode(" CANVAS "),
  31638. vue.createElementVNode("div", {
  31639. class: vue.normalizeClass(vue.unref(ns).e("canvas"))
  31640. }, [
  31641. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.urlList, (url, i) => {
  31642. return vue.withDirectives((vue.openBlock(), vue.createElementBlock("img", {
  31643. ref_for: true,
  31644. ref: (el) => imgRefs.value[i] = el,
  31645. key: url,
  31646. src: url,
  31647. style: vue.normalizeStyle(vue.unref(imgStyle)),
  31648. class: vue.normalizeClass(vue.unref(ns).e("img")),
  31649. crossorigin: _ctx.crossorigin,
  31650. onLoad: handleImgLoad,
  31651. onError: handleImgError,
  31652. onMousedown: handleMouseDown
  31653. }, null, 46, ["src", "crossorigin"])), [
  31654. [vue.vShow, i === activeIndex.value]
  31655. ]);
  31656. }), 128))
  31657. ], 2),
  31658. vue.renderSlot(_ctx.$slots, "default")
  31659. ]),
  31660. _: 3
  31661. }, 8, ["focus-trap-el"])
  31662. ], 6)
  31663. ]),
  31664. _: 3
  31665. })
  31666. ]),
  31667. _: 3
  31668. }, 8, ["disabled"]);
  31669. };
  31670. }
  31671. });
  31672. var ImageViewer = /* @__PURE__ */ _export_sfc(_sfc_main$1a, [["__file", "image-viewer.vue"]]);
  31673. const ElImageViewer = withInstall(ImageViewer);
  31674. const imageProps = buildProps({
  31675. hideOnClickModal: Boolean,
  31676. src: {
  31677. type: String,
  31678. default: ""
  31679. },
  31680. fit: {
  31681. type: String,
  31682. values: ["", "contain", "cover", "fill", "none", "scale-down"],
  31683. default: ""
  31684. },
  31685. loading: {
  31686. type: String,
  31687. values: ["eager", "lazy"]
  31688. },
  31689. lazy: Boolean,
  31690. scrollContainer: {
  31691. type: definePropType([String, Object])
  31692. },
  31693. previewSrcList: {
  31694. type: definePropType(Array),
  31695. default: () => mutable([])
  31696. },
  31697. previewTeleported: Boolean,
  31698. zIndex: {
  31699. type: Number
  31700. },
  31701. initialIndex: {
  31702. type: Number,
  31703. default: 0
  31704. },
  31705. infinite: {
  31706. type: Boolean,
  31707. default: true
  31708. },
  31709. closeOnPressEscape: {
  31710. type: Boolean,
  31711. default: true
  31712. },
  31713. zoomRate: {
  31714. type: Number,
  31715. default: 1.2
  31716. },
  31717. minScale: {
  31718. type: Number,
  31719. default: 0.2
  31720. },
  31721. maxScale: {
  31722. type: Number,
  31723. default: 7
  31724. },
  31725. crossorigin: {
  31726. type: definePropType(String)
  31727. }
  31728. });
  31729. const imageEmits = {
  31730. load: (evt) => evt instanceof Event,
  31731. error: (evt) => evt instanceof Event,
  31732. switch: (val) => isNumber(val),
  31733. close: () => true,
  31734. show: () => true
  31735. };
  31736. const __default__$U = vue.defineComponent({
  31737. name: "ElImage",
  31738. inheritAttrs: false
  31739. });
  31740. const _sfc_main$19 = /* @__PURE__ */ vue.defineComponent({
  31741. ...__default__$U,
  31742. props: imageProps,
  31743. emits: imageEmits,
  31744. setup(__props, { emit }) {
  31745. const props = __props;
  31746. let prevOverflow = "";
  31747. const { t } = useLocale();
  31748. const ns = useNamespace("image");
  31749. const rawAttrs = vue.useAttrs();
  31750. const containerAttrs = vue.computed(() => {
  31751. return fromPairs(Object.entries(rawAttrs).filter(([key]) => /^(data-|on[A-Z])/i.test(key) || ["id", "style"].includes(key)));
  31752. });
  31753. const imgAttrs = useAttrs({
  31754. excludeListeners: true,
  31755. excludeKeys: vue.computed(() => {
  31756. return Object.keys(containerAttrs.value);
  31757. })
  31758. });
  31759. const imageSrc = vue.ref();
  31760. const hasLoadError = vue.ref(false);
  31761. const isLoading = vue.ref(true);
  31762. const showViewer = vue.ref(false);
  31763. const container = vue.ref();
  31764. const _scrollContainer = vue.ref();
  31765. const supportLoading = isClient && "loading" in HTMLImageElement.prototype;
  31766. let stopScrollListener;
  31767. let stopWheelListener;
  31768. const imageKls = vue.computed(() => [
  31769. ns.e("inner"),
  31770. preview.value && ns.e("preview"),
  31771. isLoading.value && ns.is("loading")
  31772. ]);
  31773. const imageStyle = vue.computed(() => {
  31774. const { fit } = props;
  31775. if (isClient && fit) {
  31776. return { objectFit: fit };
  31777. }
  31778. return {};
  31779. });
  31780. const preview = vue.computed(() => {
  31781. const { previewSrcList } = props;
  31782. return isArray$1(previewSrcList) && previewSrcList.length > 0;
  31783. });
  31784. const imageIndex = vue.computed(() => {
  31785. const { previewSrcList, initialIndex } = props;
  31786. let previewIndex = initialIndex;
  31787. if (initialIndex > previewSrcList.length - 1) {
  31788. previewIndex = 0;
  31789. }
  31790. return previewIndex;
  31791. });
  31792. const isManual = vue.computed(() => {
  31793. if (props.loading === "eager")
  31794. return false;
  31795. return !supportLoading && props.loading === "lazy" || props.lazy;
  31796. });
  31797. const loadImage = () => {
  31798. if (!isClient)
  31799. return;
  31800. isLoading.value = true;
  31801. hasLoadError.value = false;
  31802. imageSrc.value = props.src;
  31803. };
  31804. function handleLoad(event) {
  31805. isLoading.value = false;
  31806. hasLoadError.value = false;
  31807. emit("load", event);
  31808. }
  31809. function handleError(event) {
  31810. isLoading.value = false;
  31811. hasLoadError.value = true;
  31812. emit("error", event);
  31813. }
  31814. function handleLazyLoad() {
  31815. if (isInContainer(container.value, _scrollContainer.value)) {
  31816. loadImage();
  31817. removeLazyLoadListener();
  31818. }
  31819. }
  31820. const lazyLoadHandler = useThrottleFn(handleLazyLoad, 200, true);
  31821. async function addLazyLoadListener() {
  31822. var _a;
  31823. if (!isClient)
  31824. return;
  31825. await vue.nextTick();
  31826. const { scrollContainer } = props;
  31827. if (isElement$1(scrollContainer)) {
  31828. _scrollContainer.value = scrollContainer;
  31829. } else if (isString$1(scrollContainer) && scrollContainer !== "") {
  31830. _scrollContainer.value = (_a = document.querySelector(scrollContainer)) != null ? _a : void 0;
  31831. } else if (container.value) {
  31832. _scrollContainer.value = getScrollContainer(container.value);
  31833. }
  31834. if (_scrollContainer.value) {
  31835. stopScrollListener = useEventListener(_scrollContainer, "scroll", lazyLoadHandler);
  31836. setTimeout(() => handleLazyLoad(), 100);
  31837. }
  31838. }
  31839. function removeLazyLoadListener() {
  31840. if (!isClient || !_scrollContainer.value || !lazyLoadHandler)
  31841. return;
  31842. stopScrollListener == null ? void 0 : stopScrollListener();
  31843. _scrollContainer.value = void 0;
  31844. }
  31845. function wheelHandler(e) {
  31846. if (!e.ctrlKey)
  31847. return;
  31848. if (e.deltaY < 0) {
  31849. e.preventDefault();
  31850. return false;
  31851. } else if (e.deltaY > 0) {
  31852. e.preventDefault();
  31853. return false;
  31854. }
  31855. }
  31856. function clickHandler() {
  31857. if (!preview.value)
  31858. return;
  31859. stopWheelListener = useEventListener("wheel", wheelHandler, {
  31860. passive: false
  31861. });
  31862. prevOverflow = document.body.style.overflow;
  31863. document.body.style.overflow = "hidden";
  31864. showViewer.value = true;
  31865. emit("show");
  31866. }
  31867. function closeViewer() {
  31868. stopWheelListener == null ? void 0 : stopWheelListener();
  31869. document.body.style.overflow = prevOverflow;
  31870. showViewer.value = false;
  31871. emit("close");
  31872. }
  31873. function switchViewer(val) {
  31874. emit("switch", val);
  31875. }
  31876. vue.watch(() => props.src, () => {
  31877. if (isManual.value) {
  31878. isLoading.value = true;
  31879. hasLoadError.value = false;
  31880. removeLazyLoadListener();
  31881. addLazyLoadListener();
  31882. } else {
  31883. loadImage();
  31884. }
  31885. });
  31886. vue.onMounted(() => {
  31887. if (isManual.value) {
  31888. addLazyLoadListener();
  31889. } else {
  31890. loadImage();
  31891. }
  31892. });
  31893. return (_ctx, _cache) => {
  31894. return vue.openBlock(), vue.createElementBlock("div", vue.mergeProps({
  31895. ref_key: "container",
  31896. ref: container
  31897. }, vue.unref(containerAttrs), {
  31898. class: [vue.unref(ns).b(), _ctx.$attrs.class]
  31899. }), [
  31900. hasLoadError.value ? vue.renderSlot(_ctx.$slots, "error", { key: 0 }, () => [
  31901. vue.createElementVNode("div", {
  31902. class: vue.normalizeClass(vue.unref(ns).e("error"))
  31903. }, vue.toDisplayString(vue.unref(t)("el.image.error")), 3)
  31904. ]) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  31905. imageSrc.value !== void 0 ? (vue.openBlock(), vue.createElementBlock("img", vue.mergeProps({ key: 0 }, vue.unref(imgAttrs), {
  31906. src: imageSrc.value,
  31907. loading: _ctx.loading,
  31908. style: vue.unref(imageStyle),
  31909. class: vue.unref(imageKls),
  31910. crossorigin: _ctx.crossorigin,
  31911. onClick: clickHandler,
  31912. onLoad: handleLoad,
  31913. onError: handleError
  31914. }), null, 16, ["src", "loading", "crossorigin"])) : vue.createCommentVNode("v-if", true),
  31915. isLoading.value ? (vue.openBlock(), vue.createElementBlock("div", {
  31916. key: 1,
  31917. class: vue.normalizeClass(vue.unref(ns).e("wrapper"))
  31918. }, [
  31919. vue.renderSlot(_ctx.$slots, "placeholder", {}, () => [
  31920. vue.createElementVNode("div", {
  31921. class: vue.normalizeClass(vue.unref(ns).e("placeholder"))
  31922. }, null, 2)
  31923. ])
  31924. ], 2)) : vue.createCommentVNode("v-if", true)
  31925. ], 64)),
  31926. vue.unref(preview) ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 2 }, [
  31927. showViewer.value ? (vue.openBlock(), vue.createBlock(vue.unref(ElImageViewer), {
  31928. key: 0,
  31929. "z-index": _ctx.zIndex,
  31930. "initial-index": vue.unref(imageIndex),
  31931. infinite: _ctx.infinite,
  31932. "zoom-rate": _ctx.zoomRate,
  31933. "min-scale": _ctx.minScale,
  31934. "max-scale": _ctx.maxScale,
  31935. "url-list": _ctx.previewSrcList,
  31936. crossorigin: _ctx.crossorigin,
  31937. "hide-on-click-modal": _ctx.hideOnClickModal,
  31938. teleported: _ctx.previewTeleported,
  31939. "close-on-press-escape": _ctx.closeOnPressEscape,
  31940. onClose: closeViewer,
  31941. onSwitch: switchViewer
  31942. }, {
  31943. default: vue.withCtx(() => [
  31944. _ctx.$slots.viewer ? (vue.openBlock(), vue.createElementBlock("div", { key: 0 }, [
  31945. vue.renderSlot(_ctx.$slots, "viewer")
  31946. ])) : vue.createCommentVNode("v-if", true)
  31947. ]),
  31948. _: 3
  31949. }, 8, ["z-index", "initial-index", "infinite", "zoom-rate", "min-scale", "max-scale", "url-list", "crossorigin", "hide-on-click-modal", "teleported", "close-on-press-escape"])) : vue.createCommentVNode("v-if", true)
  31950. ], 64)) : vue.createCommentVNode("v-if", true)
  31951. ], 16);
  31952. };
  31953. }
  31954. });
  31955. var Image$1 = /* @__PURE__ */ _export_sfc(_sfc_main$19, [["__file", "image.vue"]]);
  31956. const ElImage = withInstall(Image$1);
  31957. const inputNumberProps = buildProps({
  31958. id: {
  31959. type: String,
  31960. default: void 0
  31961. },
  31962. step: {
  31963. type: Number,
  31964. default: 1
  31965. },
  31966. stepStrictly: Boolean,
  31967. max: {
  31968. type: Number,
  31969. default: Number.POSITIVE_INFINITY
  31970. },
  31971. min: {
  31972. type: Number,
  31973. default: Number.NEGATIVE_INFINITY
  31974. },
  31975. modelValue: Number,
  31976. readonly: Boolean,
  31977. disabled: Boolean,
  31978. size: useSizeProp,
  31979. controls: {
  31980. type: Boolean,
  31981. default: true
  31982. },
  31983. controlsPosition: {
  31984. type: String,
  31985. default: "",
  31986. values: ["", "right"]
  31987. },
  31988. valueOnClear: {
  31989. type: [String, Number, null],
  31990. validator: (val) => val === null || isNumber(val) || ["min", "max"].includes(val),
  31991. default: null
  31992. },
  31993. name: String,
  31994. placeholder: String,
  31995. precision: {
  31996. type: Number,
  31997. validator: (val) => val >= 0 && val === Number.parseInt(`${val}`, 10)
  31998. },
  31999. validateEvent: {
  32000. type: Boolean,
  32001. default: true
  32002. },
  32003. ...useAriaProps(["ariaLabel"])
  32004. });
  32005. const inputNumberEmits = {
  32006. [CHANGE_EVENT]: (cur, prev) => prev !== cur,
  32007. blur: (e) => e instanceof FocusEvent,
  32008. focus: (e) => e instanceof FocusEvent,
  32009. [INPUT_EVENT]: (val) => isNumber(val) || isNil(val),
  32010. [UPDATE_MODEL_EVENT]: (val) => isNumber(val) || isNil(val)
  32011. };
  32012. const __default__$T = vue.defineComponent({
  32013. name: "ElInputNumber"
  32014. });
  32015. const _sfc_main$18 = /* @__PURE__ */ vue.defineComponent({
  32016. ...__default__$T,
  32017. props: inputNumberProps,
  32018. emits: inputNumberEmits,
  32019. setup(__props, { expose, emit }) {
  32020. const props = __props;
  32021. const { t } = useLocale();
  32022. const ns = useNamespace("input-number");
  32023. const input = vue.ref();
  32024. const data = vue.reactive({
  32025. currentValue: props.modelValue,
  32026. userInput: null
  32027. });
  32028. const { formItem } = useFormItem();
  32029. const minDisabled = vue.computed(() => isNumber(props.modelValue) && props.modelValue <= props.min);
  32030. const maxDisabled = vue.computed(() => isNumber(props.modelValue) && props.modelValue >= props.max);
  32031. const numPrecision = vue.computed(() => {
  32032. const stepPrecision = getPrecision(props.step);
  32033. if (!isUndefined(props.precision)) {
  32034. if (stepPrecision > props.precision) ;
  32035. return props.precision;
  32036. } else {
  32037. return Math.max(getPrecision(props.modelValue), stepPrecision);
  32038. }
  32039. });
  32040. const controlsAtRight = vue.computed(() => {
  32041. return props.controls && props.controlsPosition === "right";
  32042. });
  32043. const inputNumberSize = useFormSize();
  32044. const inputNumberDisabled = useFormDisabled();
  32045. const displayValue = vue.computed(() => {
  32046. if (data.userInput !== null) {
  32047. return data.userInput;
  32048. }
  32049. let currentValue = data.currentValue;
  32050. if (isNil(currentValue))
  32051. return "";
  32052. if (isNumber(currentValue)) {
  32053. if (Number.isNaN(currentValue))
  32054. return "";
  32055. if (!isUndefined(props.precision)) {
  32056. currentValue = currentValue.toFixed(props.precision);
  32057. }
  32058. }
  32059. return currentValue;
  32060. });
  32061. const toPrecision = (num, pre) => {
  32062. if (isUndefined(pre))
  32063. pre = numPrecision.value;
  32064. if (pre === 0)
  32065. return Math.round(num);
  32066. let snum = String(num);
  32067. const pointPos = snum.indexOf(".");
  32068. if (pointPos === -1)
  32069. return num;
  32070. const nums = snum.replace(".", "").split("");
  32071. const datum = nums[pointPos + pre];
  32072. if (!datum)
  32073. return num;
  32074. const length = snum.length;
  32075. if (snum.charAt(length - 1) === "5") {
  32076. snum = `${snum.slice(0, Math.max(0, length - 1))}6`;
  32077. }
  32078. return Number.parseFloat(Number(snum).toFixed(pre));
  32079. };
  32080. const getPrecision = (value) => {
  32081. if (isNil(value))
  32082. return 0;
  32083. const valueString = value.toString();
  32084. const dotPosition = valueString.indexOf(".");
  32085. let precision = 0;
  32086. if (dotPosition !== -1) {
  32087. precision = valueString.length - dotPosition - 1;
  32088. }
  32089. return precision;
  32090. };
  32091. const ensurePrecision = (val, coefficient = 1) => {
  32092. if (!isNumber(val))
  32093. return data.currentValue;
  32094. return toPrecision(val + props.step * coefficient);
  32095. };
  32096. const increase = () => {
  32097. if (props.readonly || inputNumberDisabled.value || maxDisabled.value)
  32098. return;
  32099. const value = Number(displayValue.value) || 0;
  32100. const newVal = ensurePrecision(value);
  32101. setCurrentValue(newVal);
  32102. emit(INPUT_EVENT, data.currentValue);
  32103. setCurrentValueToModelValue();
  32104. };
  32105. const decrease = () => {
  32106. if (props.readonly || inputNumberDisabled.value || minDisabled.value)
  32107. return;
  32108. const value = Number(displayValue.value) || 0;
  32109. const newVal = ensurePrecision(value, -1);
  32110. setCurrentValue(newVal);
  32111. emit(INPUT_EVENT, data.currentValue);
  32112. setCurrentValueToModelValue();
  32113. };
  32114. const verifyValue = (value, update) => {
  32115. const { max, min, step, precision, stepStrictly, valueOnClear } = props;
  32116. if (max < min) {
  32117. throwError("InputNumber", "min should not be greater than max.");
  32118. }
  32119. let newVal = Number(value);
  32120. if (isNil(value) || Number.isNaN(newVal)) {
  32121. return null;
  32122. }
  32123. if (value === "") {
  32124. if (valueOnClear === null) {
  32125. return null;
  32126. }
  32127. newVal = isString$1(valueOnClear) ? { min, max }[valueOnClear] : valueOnClear;
  32128. }
  32129. if (stepStrictly) {
  32130. newVal = toPrecision(Math.round(newVal / step) * step, precision);
  32131. if (newVal !== value) {
  32132. update && emit(UPDATE_MODEL_EVENT, newVal);
  32133. }
  32134. }
  32135. if (!isUndefined(precision)) {
  32136. newVal = toPrecision(newVal, precision);
  32137. }
  32138. if (newVal > max || newVal < min) {
  32139. newVal = newVal > max ? max : min;
  32140. update && emit(UPDATE_MODEL_EVENT, newVal);
  32141. }
  32142. return newVal;
  32143. };
  32144. const setCurrentValue = (value, emitChange = true) => {
  32145. var _a;
  32146. const oldVal = data.currentValue;
  32147. const newVal = verifyValue(value);
  32148. if (!emitChange) {
  32149. emit(UPDATE_MODEL_EVENT, newVal);
  32150. return;
  32151. }
  32152. if (oldVal === newVal && value)
  32153. return;
  32154. data.userInput = null;
  32155. emit(UPDATE_MODEL_EVENT, newVal);
  32156. if (oldVal !== newVal) {
  32157. emit(CHANGE_EVENT, newVal, oldVal);
  32158. }
  32159. if (props.validateEvent) {
  32160. (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "change").catch((err) => debugWarn());
  32161. }
  32162. data.currentValue = newVal;
  32163. };
  32164. const handleInput = (value) => {
  32165. data.userInput = value;
  32166. const newVal = value === "" ? null : Number(value);
  32167. emit(INPUT_EVENT, newVal);
  32168. setCurrentValue(newVal, false);
  32169. };
  32170. const handleInputChange = (value) => {
  32171. const newVal = value !== "" ? Number(value) : "";
  32172. if (isNumber(newVal) && !Number.isNaN(newVal) || value === "") {
  32173. setCurrentValue(newVal);
  32174. }
  32175. setCurrentValueToModelValue();
  32176. data.userInput = null;
  32177. };
  32178. const focus = () => {
  32179. var _a, _b;
  32180. (_b = (_a = input.value) == null ? void 0 : _a.focus) == null ? void 0 : _b.call(_a);
  32181. };
  32182. const blur = () => {
  32183. var _a, _b;
  32184. (_b = (_a = input.value) == null ? void 0 : _a.blur) == null ? void 0 : _b.call(_a);
  32185. };
  32186. const handleFocus = (event) => {
  32187. emit("focus", event);
  32188. };
  32189. const handleBlur = (event) => {
  32190. var _a, _b;
  32191. data.userInput = null;
  32192. if (isFirefox() && data.currentValue === null && ((_a = input.value) == null ? void 0 : _a.input)) {
  32193. input.value.input.value = "";
  32194. }
  32195. emit("blur", event);
  32196. if (props.validateEvent) {
  32197. (_b = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _b.call(formItem, "blur").catch((err) => debugWarn());
  32198. }
  32199. };
  32200. const setCurrentValueToModelValue = () => {
  32201. if (data.currentValue !== props.modelValue) {
  32202. data.currentValue = props.modelValue;
  32203. }
  32204. };
  32205. const handleWheel = (e) => {
  32206. if (document.activeElement === e.target)
  32207. e.preventDefault();
  32208. };
  32209. vue.watch(() => props.modelValue, (value, oldValue) => {
  32210. const newValue = verifyValue(value, true);
  32211. if (data.userInput === null && newValue !== oldValue) {
  32212. data.currentValue = newValue;
  32213. }
  32214. }, { immediate: true });
  32215. vue.onMounted(() => {
  32216. var _a;
  32217. const { min, max, modelValue } = props;
  32218. const innerInput = (_a = input.value) == null ? void 0 : _a.input;
  32219. innerInput.setAttribute("role", "spinbutton");
  32220. if (Number.isFinite(max)) {
  32221. innerInput.setAttribute("aria-valuemax", String(max));
  32222. } else {
  32223. innerInput.removeAttribute("aria-valuemax");
  32224. }
  32225. if (Number.isFinite(min)) {
  32226. innerInput.setAttribute("aria-valuemin", String(min));
  32227. } else {
  32228. innerInput.removeAttribute("aria-valuemin");
  32229. }
  32230. innerInput.setAttribute("aria-valuenow", data.currentValue || data.currentValue === 0 ? String(data.currentValue) : "");
  32231. innerInput.setAttribute("aria-disabled", String(inputNumberDisabled.value));
  32232. if (!isNumber(modelValue) && modelValue != null) {
  32233. let val = Number(modelValue);
  32234. if (Number.isNaN(val)) {
  32235. val = null;
  32236. }
  32237. emit(UPDATE_MODEL_EVENT, val);
  32238. }
  32239. innerInput.addEventListener("wheel", handleWheel, { passive: false });
  32240. });
  32241. vue.onUpdated(() => {
  32242. var _a, _b;
  32243. const innerInput = (_a = input.value) == null ? void 0 : _a.input;
  32244. innerInput == null ? void 0 : innerInput.setAttribute("aria-valuenow", `${(_b = data.currentValue) != null ? _b : ""}`);
  32245. });
  32246. expose({
  32247. focus,
  32248. blur
  32249. });
  32250. return (_ctx, _cache) => {
  32251. return vue.openBlock(), vue.createElementBlock("div", {
  32252. class: vue.normalizeClass([
  32253. vue.unref(ns).b(),
  32254. vue.unref(ns).m(vue.unref(inputNumberSize)),
  32255. vue.unref(ns).is("disabled", vue.unref(inputNumberDisabled)),
  32256. vue.unref(ns).is("without-controls", !_ctx.controls),
  32257. vue.unref(ns).is("controls-right", vue.unref(controlsAtRight))
  32258. ]),
  32259. onDragstart: vue.withModifiers(() => {
  32260. }, ["prevent"])
  32261. }, [
  32262. _ctx.controls ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("span", {
  32263. key: 0,
  32264. role: "button",
  32265. "aria-label": vue.unref(t)("el.inputNumber.decrease"),
  32266. class: vue.normalizeClass([vue.unref(ns).e("decrease"), vue.unref(ns).is("disabled", vue.unref(minDisabled))]),
  32267. onKeydown: vue.withKeys(decrease, ["enter"])
  32268. }, [
  32269. vue.renderSlot(_ctx.$slots, "decrease-icon", {}, () => [
  32270. vue.createVNode(vue.unref(ElIcon), null, {
  32271. default: vue.withCtx(() => [
  32272. vue.unref(controlsAtRight) ? (vue.openBlock(), vue.createBlock(vue.unref(arrow_down_default), { key: 0 })) : (vue.openBlock(), vue.createBlock(vue.unref(minus_default), { key: 1 }))
  32273. ]),
  32274. _: 1
  32275. })
  32276. ])
  32277. ], 42, ["aria-label", "onKeydown"])), [
  32278. [vue.unref(vRepeatClick), decrease]
  32279. ]) : vue.createCommentVNode("v-if", true),
  32280. _ctx.controls ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("span", {
  32281. key: 1,
  32282. role: "button",
  32283. "aria-label": vue.unref(t)("el.inputNumber.increase"),
  32284. class: vue.normalizeClass([vue.unref(ns).e("increase"), vue.unref(ns).is("disabled", vue.unref(maxDisabled))]),
  32285. onKeydown: vue.withKeys(increase, ["enter"])
  32286. }, [
  32287. vue.renderSlot(_ctx.$slots, "increase-icon", {}, () => [
  32288. vue.createVNode(vue.unref(ElIcon), null, {
  32289. default: vue.withCtx(() => [
  32290. vue.unref(controlsAtRight) ? (vue.openBlock(), vue.createBlock(vue.unref(arrow_up_default), { key: 0 })) : (vue.openBlock(), vue.createBlock(vue.unref(plus_default), { key: 1 }))
  32291. ]),
  32292. _: 1
  32293. })
  32294. ])
  32295. ], 42, ["aria-label", "onKeydown"])), [
  32296. [vue.unref(vRepeatClick), increase]
  32297. ]) : vue.createCommentVNode("v-if", true),
  32298. vue.createVNode(vue.unref(ElInput), {
  32299. id: _ctx.id,
  32300. ref_key: "input",
  32301. ref: input,
  32302. type: "number",
  32303. step: _ctx.step,
  32304. "model-value": vue.unref(displayValue),
  32305. placeholder: _ctx.placeholder,
  32306. readonly: _ctx.readonly,
  32307. disabled: vue.unref(inputNumberDisabled),
  32308. size: vue.unref(inputNumberSize),
  32309. max: _ctx.max,
  32310. min: _ctx.min,
  32311. name: _ctx.name,
  32312. "aria-label": _ctx.ariaLabel,
  32313. "validate-event": false,
  32314. onKeydown: [
  32315. vue.withKeys(vue.withModifiers(increase, ["prevent"]), ["up"]),
  32316. vue.withKeys(vue.withModifiers(decrease, ["prevent"]), ["down"])
  32317. ],
  32318. onBlur: handleBlur,
  32319. onFocus: handleFocus,
  32320. onInput: handleInput,
  32321. onChange: handleInputChange
  32322. }, vue.createSlots({
  32323. _: 2
  32324. }, [
  32325. _ctx.$slots.prefix ? {
  32326. name: "prefix",
  32327. fn: vue.withCtx(() => [
  32328. vue.renderSlot(_ctx.$slots, "prefix")
  32329. ])
  32330. } : void 0,
  32331. _ctx.$slots.suffix ? {
  32332. name: "suffix",
  32333. fn: vue.withCtx(() => [
  32334. vue.renderSlot(_ctx.$slots, "suffix")
  32335. ])
  32336. } : void 0
  32337. ]), 1032, ["id", "step", "model-value", "placeholder", "readonly", "disabled", "size", "max", "min", "name", "aria-label", "onKeydown"])
  32338. ], 42, ["onDragstart"]);
  32339. };
  32340. }
  32341. });
  32342. var InputNumber = /* @__PURE__ */ _export_sfc(_sfc_main$18, [["__file", "input-number.vue"]]);
  32343. const ElInputNumber = withInstall(InputNumber);
  32344. const inputTagProps = buildProps({
  32345. modelValue: {
  32346. type: definePropType(Array)
  32347. },
  32348. max: Number,
  32349. tagType: { ...tagProps.type, default: "info" },
  32350. tagEffect: tagProps.effect,
  32351. trigger: {
  32352. type: definePropType(String),
  32353. default: EVENT_CODE.enter
  32354. },
  32355. draggable: {
  32356. type: Boolean,
  32357. default: false
  32358. },
  32359. size: useSizeProp,
  32360. clearable: Boolean,
  32361. disabled: {
  32362. type: Boolean,
  32363. default: void 0
  32364. },
  32365. validateEvent: {
  32366. type: Boolean,
  32367. default: true
  32368. },
  32369. readonly: Boolean,
  32370. autofocus: Boolean,
  32371. id: {
  32372. type: String,
  32373. default: void 0
  32374. },
  32375. tabindex: {
  32376. type: [String, Number],
  32377. default: 0
  32378. },
  32379. maxlength: {
  32380. type: [String, Number]
  32381. },
  32382. minlength: {
  32383. type: [String, Number]
  32384. },
  32385. placeholder: String,
  32386. autocomplete: {
  32387. type: String,
  32388. default: "off"
  32389. },
  32390. ariaLabel: String
  32391. });
  32392. const inputTagEmits = {
  32393. [UPDATE_MODEL_EVENT]: (value) => isArray$1(value) || isUndefined(value),
  32394. [CHANGE_EVENT]: (value) => isArray$1(value) || isUndefined(value),
  32395. [INPUT_EVENT]: (value) => isString$1(value),
  32396. "add-tag": (value) => isString$1(value),
  32397. "remove-tag": (value) => isString$1(value),
  32398. focus: (evt) => evt instanceof FocusEvent,
  32399. blur: (evt) => evt instanceof FocusEvent,
  32400. clear: () => true
  32401. };
  32402. function useDragTag({
  32403. wrapperRef,
  32404. handleDragged,
  32405. afterDragged
  32406. }) {
  32407. const ns = useNamespace("input-tag");
  32408. const dropIndicatorRef = vue.shallowRef();
  32409. const showDropIndicator = vue.ref(false);
  32410. let draggingIndex;
  32411. let draggingTag;
  32412. let dropIndex;
  32413. let dropType;
  32414. function getTagClassName(index) {
  32415. return `.${ns.e("inner")} .${ns.namespace.value}-tag:nth-child(${index + 1})`;
  32416. }
  32417. function handleDragStart(event, index) {
  32418. draggingIndex = index;
  32419. draggingTag = wrapperRef.value.querySelector(getTagClassName(index));
  32420. if (draggingTag) {
  32421. draggingTag.style.opacity = "0.5";
  32422. }
  32423. event.dataTransfer.effectAllowed = "move";
  32424. }
  32425. function handleDragOver(event, index) {
  32426. dropIndex = index;
  32427. event.preventDefault();
  32428. event.dataTransfer.dropEffect = "move";
  32429. if (isUndefined(draggingIndex) || draggingIndex === index) {
  32430. showDropIndicator.value = false;
  32431. return;
  32432. }
  32433. const dropPosition = wrapperRef.value.querySelector(getTagClassName(index)).getBoundingClientRect();
  32434. const dropPrev = !(draggingIndex + 1 === index);
  32435. const dropNext = !(draggingIndex - 1 === index);
  32436. const distance = event.clientX - dropPosition.left;
  32437. const prevPercent = dropPrev ? dropNext ? 0.5 : 1 : -1;
  32438. const nextPercent = dropNext ? dropPrev ? 0.5 : 0 : 1;
  32439. if (distance <= dropPosition.width * prevPercent) {
  32440. dropType = "before";
  32441. } else if (distance > dropPosition.width * nextPercent) {
  32442. dropType = "after";
  32443. } else {
  32444. dropType = void 0;
  32445. }
  32446. const innerEl = wrapperRef.value.querySelector(`.${ns.e("inner")}`);
  32447. const innerPosition = innerEl.getBoundingClientRect();
  32448. const gap = Number.parseFloat(getStyle(innerEl, "gap")) / 2;
  32449. const indicatorTop = dropPosition.top - innerPosition.top;
  32450. let indicatorLeft = -9999;
  32451. if (dropType === "before") {
  32452. indicatorLeft = Math.max(dropPosition.left - innerPosition.left - gap, Math.floor(-gap / 2));
  32453. } else if (dropType === "after") {
  32454. const left = dropPosition.right - innerPosition.left;
  32455. indicatorLeft = left + (innerPosition.width === left ? Math.floor(gap / 2) : gap);
  32456. }
  32457. setStyle(dropIndicatorRef.value, {
  32458. top: `${indicatorTop}px`,
  32459. left: `${indicatorLeft}px`
  32460. });
  32461. showDropIndicator.value = !!dropType;
  32462. }
  32463. function handleDragEnd(event) {
  32464. event.preventDefault();
  32465. if (draggingTag) {
  32466. draggingTag.style.opacity = "";
  32467. }
  32468. if (dropType && !isUndefined(draggingIndex) && !isUndefined(dropIndex) && draggingIndex !== dropIndex) {
  32469. handleDragged(draggingIndex, dropIndex, dropType);
  32470. }
  32471. showDropIndicator.value = false;
  32472. draggingIndex = void 0;
  32473. draggingTag = null;
  32474. dropIndex = void 0;
  32475. dropType = void 0;
  32476. afterDragged == null ? void 0 : afterDragged();
  32477. }
  32478. return {
  32479. dropIndicatorRef,
  32480. showDropIndicator,
  32481. handleDragStart,
  32482. handleDragOver,
  32483. handleDragEnd
  32484. };
  32485. }
  32486. function useHovering() {
  32487. const hovering = vue.ref(false);
  32488. const handleMouseEnter = () => {
  32489. hovering.value = true;
  32490. };
  32491. const handleMouseLeave = () => {
  32492. hovering.value = false;
  32493. };
  32494. return {
  32495. hovering,
  32496. handleMouseEnter,
  32497. handleMouseLeave
  32498. };
  32499. }
  32500. function useInputTag({ props, emit, formItem }) {
  32501. const disabled = useFormDisabled();
  32502. const size = useFormSize();
  32503. const inputRef = vue.shallowRef();
  32504. const inputValue = vue.ref();
  32505. const tagSize = vue.computed(() => {
  32506. return ["small"].includes(size.value) ? "small" : "default";
  32507. });
  32508. const placeholder = vue.computed(() => {
  32509. var _a;
  32510. return ((_a = props.modelValue) == null ? void 0 : _a.length) ? void 0 : props.placeholder;
  32511. });
  32512. const closable = vue.computed(() => !(props.readonly || disabled.value));
  32513. const inputLimit = vue.computed(() => {
  32514. var _a, _b;
  32515. return isUndefined(props.max) ? false : ((_b = (_a = props.modelValue) == null ? void 0 : _a.length) != null ? _b : 0) >= props.max;
  32516. });
  32517. const handleInput = (event) => {
  32518. if (inputLimit.value) {
  32519. inputValue.value = void 0;
  32520. return;
  32521. }
  32522. if (isComposing.value)
  32523. return;
  32524. emit(INPUT_EVENT, event.target.value);
  32525. };
  32526. const handleKeydown = (event) => {
  32527. var _a;
  32528. if (isComposing.value)
  32529. return;
  32530. switch (event.code) {
  32531. case props.trigger:
  32532. event.preventDefault();
  32533. event.stopPropagation();
  32534. handleAddTag();
  32535. break;
  32536. case EVENT_CODE.numpadEnter:
  32537. if (props.trigger === EVENT_CODE.enter) {
  32538. event.preventDefault();
  32539. event.stopPropagation();
  32540. handleAddTag();
  32541. }
  32542. break;
  32543. case EVENT_CODE.backspace:
  32544. if (!inputValue.value && ((_a = props.modelValue) == null ? void 0 : _a.length)) {
  32545. event.preventDefault();
  32546. event.stopPropagation();
  32547. handleRemoveTag(props.modelValue.length - 1);
  32548. }
  32549. break;
  32550. }
  32551. };
  32552. const handleAddTag = () => {
  32553. var _a, _b;
  32554. const value = (_a = inputValue.value) == null ? void 0 : _a.trim();
  32555. if (!value || inputLimit.value)
  32556. return;
  32557. const list = [...(_b = props.modelValue) != null ? _b : [], value];
  32558. emit(UPDATE_MODEL_EVENT, list);
  32559. emit(CHANGE_EVENT, list);
  32560. emit("add-tag", value);
  32561. inputValue.value = void 0;
  32562. };
  32563. const handleRemoveTag = (index) => {
  32564. var _a;
  32565. const value = ((_a = props.modelValue) != null ? _a : []).slice();
  32566. const [item] = value.splice(index, 1);
  32567. emit(UPDATE_MODEL_EVENT, value);
  32568. emit(CHANGE_EVENT, value);
  32569. emit("remove-tag", item);
  32570. };
  32571. const handleClear = () => {
  32572. inputValue.value = void 0;
  32573. emit(UPDATE_MODEL_EVENT, void 0);
  32574. emit(CHANGE_EVENT, void 0);
  32575. emit("clear");
  32576. };
  32577. const handleDragged = (draggingIndex, dropIndex, type) => {
  32578. var _a;
  32579. const value = ((_a = props.modelValue) != null ? _a : []).slice();
  32580. const [draggedItem] = value.splice(draggingIndex, 1);
  32581. const step = dropIndex > draggingIndex && type === "before" ? -1 : dropIndex < draggingIndex && type === "after" ? 1 : 0;
  32582. value.splice(dropIndex + step, 0, draggedItem);
  32583. emit(UPDATE_MODEL_EVENT, value);
  32584. emit(CHANGE_EVENT, value);
  32585. };
  32586. const focus = () => {
  32587. var _a;
  32588. (_a = inputRef.value) == null ? void 0 : _a.focus();
  32589. };
  32590. const blur = () => {
  32591. var _a;
  32592. (_a = inputRef.value) == null ? void 0 : _a.blur();
  32593. };
  32594. const { wrapperRef, isFocused } = useFocusController(inputRef, {
  32595. beforeFocus() {
  32596. return disabled.value;
  32597. },
  32598. afterBlur() {
  32599. var _a;
  32600. handleAddTag();
  32601. if (props.validateEvent) {
  32602. (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "blur").catch((err) => debugWarn());
  32603. }
  32604. }
  32605. });
  32606. const {
  32607. isComposing,
  32608. handleCompositionStart,
  32609. handleCompositionUpdate,
  32610. handleCompositionEnd
  32611. } = useComposition({ afterComposition: handleInput });
  32612. vue.watch(() => props.modelValue, () => {
  32613. var _a;
  32614. if (props.validateEvent) {
  32615. (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, CHANGE_EVENT).catch((err) => debugWarn());
  32616. }
  32617. });
  32618. return {
  32619. inputRef,
  32620. wrapperRef,
  32621. isFocused,
  32622. isComposing,
  32623. inputValue,
  32624. size,
  32625. tagSize,
  32626. placeholder,
  32627. closable,
  32628. disabled,
  32629. inputLimit,
  32630. handleDragged,
  32631. handleInput,
  32632. handleKeydown,
  32633. handleAddTag,
  32634. handleRemoveTag,
  32635. handleClear,
  32636. handleCompositionStart,
  32637. handleCompositionUpdate,
  32638. handleCompositionEnd,
  32639. focus,
  32640. blur
  32641. };
  32642. }
  32643. function useInputTagDom({
  32644. props,
  32645. isFocused,
  32646. hovering,
  32647. disabled,
  32648. inputValue,
  32649. size,
  32650. validateState,
  32651. validateIcon,
  32652. needStatusIcon
  32653. }) {
  32654. const attrs = vue.useAttrs();
  32655. const slots = vue.useSlots();
  32656. const ns = useNamespace("input-tag");
  32657. const nsInput = useNamespace("input");
  32658. const containerKls = vue.computed(() => [
  32659. ns.b(),
  32660. ns.is("focused", isFocused.value),
  32661. ns.is("hovering", hovering.value),
  32662. ns.is("disabled", disabled.value),
  32663. ns.m(size.value),
  32664. ns.e("wrapper"),
  32665. attrs.class
  32666. ]);
  32667. const containerStyle = vue.computed(() => [attrs.style]);
  32668. const innerKls = vue.computed(() => {
  32669. var _a, _b;
  32670. return [
  32671. ns.e("inner"),
  32672. ns.is("draggable", props.draggable),
  32673. ns.is("left-space", !((_a = props.modelValue) == null ? void 0 : _a.length) && !slots.prefix),
  32674. ns.is("right-space", !((_b = props.modelValue) == null ? void 0 : _b.length) && !showSuffix.value)
  32675. ];
  32676. });
  32677. const showClear = vue.computed(() => {
  32678. var _a;
  32679. return props.clearable && !disabled.value && !props.readonly && (((_a = props.modelValue) == null ? void 0 : _a.length) || inputValue.value) && (isFocused.value || hovering.value);
  32680. });
  32681. const showSuffix = vue.computed(() => {
  32682. return slots.suffix || showClear.value || validateState.value && validateIcon.value && needStatusIcon.value;
  32683. });
  32684. return {
  32685. ns,
  32686. nsInput,
  32687. containerKls,
  32688. containerStyle,
  32689. innerKls,
  32690. showClear,
  32691. showSuffix
  32692. };
  32693. }
  32694. const __default__$S = vue.defineComponent({
  32695. name: "ElInputTag",
  32696. inheritAttrs: false
  32697. });
  32698. const _sfc_main$17 = /* @__PURE__ */ vue.defineComponent({
  32699. ...__default__$S,
  32700. props: inputTagProps,
  32701. emits: inputTagEmits,
  32702. setup(__props, { expose, emit }) {
  32703. const props = __props;
  32704. const attrs = useAttrs();
  32705. const slots = vue.useSlots();
  32706. const { form, formItem } = useFormItem();
  32707. const { inputId } = useFormItemInputId(props, { formItemContext: formItem });
  32708. const needStatusIcon = vue.computed(() => {
  32709. var _a;
  32710. return (_a = form == null ? void 0 : form.statusIcon) != null ? _a : false;
  32711. });
  32712. const validateState = vue.computed(() => (formItem == null ? void 0 : formItem.validateState) || "");
  32713. const validateIcon = vue.computed(() => {
  32714. return validateState.value && ValidateComponentsMap[validateState.value];
  32715. });
  32716. const {
  32717. inputRef,
  32718. wrapperRef,
  32719. isFocused,
  32720. inputValue,
  32721. size,
  32722. tagSize,
  32723. placeholder,
  32724. closable,
  32725. disabled,
  32726. handleDragged,
  32727. handleInput,
  32728. handleKeydown,
  32729. handleRemoveTag,
  32730. handleClear,
  32731. handleCompositionStart,
  32732. handleCompositionUpdate,
  32733. handleCompositionEnd,
  32734. focus,
  32735. blur
  32736. } = useInputTag({ props, emit, formItem });
  32737. const { hovering, handleMouseEnter, handleMouseLeave } = useHovering();
  32738. const { calculatorRef, inputStyle } = useCalcInputWidth();
  32739. const {
  32740. dropIndicatorRef,
  32741. showDropIndicator,
  32742. handleDragStart,
  32743. handleDragOver,
  32744. handleDragEnd
  32745. } = useDragTag({ wrapperRef, handleDragged, afterDragged: focus });
  32746. const {
  32747. ns,
  32748. nsInput,
  32749. containerKls,
  32750. containerStyle,
  32751. innerKls,
  32752. showClear,
  32753. showSuffix
  32754. } = useInputTagDom({
  32755. props,
  32756. hovering,
  32757. isFocused,
  32758. inputValue,
  32759. disabled,
  32760. size,
  32761. validateState,
  32762. validateIcon,
  32763. needStatusIcon
  32764. });
  32765. expose({
  32766. focus,
  32767. blur
  32768. });
  32769. return (_ctx, _cache) => {
  32770. return vue.openBlock(), vue.createElementBlock("div", {
  32771. ref_key: "wrapperRef",
  32772. ref: wrapperRef,
  32773. class: vue.normalizeClass(vue.unref(containerKls)),
  32774. style: vue.normalizeStyle(vue.unref(containerStyle)),
  32775. onMouseenter: vue.unref(handleMouseEnter),
  32776. onMouseleave: vue.unref(handleMouseLeave)
  32777. }, [
  32778. vue.unref(slots).prefix ? (vue.openBlock(), vue.createElementBlock("div", {
  32779. key: 0,
  32780. class: vue.normalizeClass(vue.unref(ns).e("prefix"))
  32781. }, [
  32782. vue.renderSlot(_ctx.$slots, "prefix")
  32783. ], 2)) : vue.createCommentVNode("v-if", true),
  32784. vue.createElementVNode("div", {
  32785. class: vue.normalizeClass(vue.unref(innerKls))
  32786. }, [
  32787. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.modelValue, (item, index) => {
  32788. return vue.openBlock(), vue.createBlock(vue.unref(ElTag), {
  32789. key: index,
  32790. size: vue.unref(tagSize),
  32791. closable: vue.unref(closable),
  32792. type: _ctx.tagType,
  32793. effect: _ctx.tagEffect,
  32794. draggable: vue.unref(closable) && _ctx.draggable,
  32795. "disable-transitions": "",
  32796. onClose: ($event) => vue.unref(handleRemoveTag)(index),
  32797. onDragstart: (event) => vue.unref(handleDragStart)(event, index),
  32798. onDragover: (event) => vue.unref(handleDragOver)(event, index),
  32799. onDragend: vue.unref(handleDragEnd),
  32800. onDrop: vue.withModifiers(() => {
  32801. }, ["stop"])
  32802. }, {
  32803. default: vue.withCtx(() => [
  32804. vue.renderSlot(_ctx.$slots, "tag", {
  32805. value: item,
  32806. index
  32807. }, () => [
  32808. vue.createTextVNode(vue.toDisplayString(item), 1)
  32809. ])
  32810. ]),
  32811. _: 2
  32812. }, 1032, ["size", "closable", "type", "effect", "draggable", "onClose", "onDragstart", "onDragover", "onDragend", "onDrop"]);
  32813. }), 128)),
  32814. vue.createElementVNode("div", {
  32815. class: vue.normalizeClass(vue.unref(ns).e("input-wrapper"))
  32816. }, [
  32817. vue.withDirectives(vue.createElementVNode("input", vue.mergeProps({
  32818. id: vue.unref(inputId),
  32819. ref_key: "inputRef",
  32820. ref: inputRef,
  32821. "onUpdate:modelValue": ($event) => vue.isRef(inputValue) ? inputValue.value = $event : null
  32822. }, vue.unref(attrs), {
  32823. type: "text",
  32824. minlength: _ctx.minlength,
  32825. maxlength: _ctx.maxlength,
  32826. disabled: vue.unref(disabled),
  32827. readonly: _ctx.readonly,
  32828. autocomplete: _ctx.autocomplete,
  32829. tabindex: _ctx.tabindex,
  32830. placeholder: vue.unref(placeholder),
  32831. autofocus: _ctx.autofocus,
  32832. ariaLabel: _ctx.ariaLabel,
  32833. class: vue.unref(ns).e("input"),
  32834. style: vue.unref(inputStyle),
  32835. onCompositionstart: vue.unref(handleCompositionStart),
  32836. onCompositionupdate: vue.unref(handleCompositionUpdate),
  32837. onCompositionend: vue.unref(handleCompositionEnd),
  32838. onInput: vue.unref(handleInput),
  32839. onKeydown: vue.unref(handleKeydown)
  32840. }), null, 16, ["id", "onUpdate:modelValue", "minlength", "maxlength", "disabled", "readonly", "autocomplete", "tabindex", "placeholder", "autofocus", "ariaLabel", "onCompositionstart", "onCompositionupdate", "onCompositionend", "onInput", "onKeydown"]), [
  32841. [vue.vModelText, vue.unref(inputValue)]
  32842. ]),
  32843. vue.createElementVNode("span", {
  32844. ref_key: "calculatorRef",
  32845. ref: calculatorRef,
  32846. "aria-hidden": "true",
  32847. class: vue.normalizeClass(vue.unref(ns).e("input-calculator")),
  32848. textContent: vue.toDisplayString(vue.unref(inputValue))
  32849. }, null, 10, ["textContent"])
  32850. ], 2),
  32851. vue.withDirectives(vue.createElementVNode("div", {
  32852. ref_key: "dropIndicatorRef",
  32853. ref: dropIndicatorRef,
  32854. class: vue.normalizeClass(vue.unref(ns).e("drop-indicator"))
  32855. }, null, 2), [
  32856. [vue.vShow, vue.unref(showDropIndicator)]
  32857. ])
  32858. ], 2),
  32859. vue.unref(showSuffix) ? (vue.openBlock(), vue.createElementBlock("div", {
  32860. key: 1,
  32861. class: vue.normalizeClass(vue.unref(ns).e("suffix"))
  32862. }, [
  32863. vue.renderSlot(_ctx.$slots, "suffix"),
  32864. vue.unref(showClear) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  32865. key: 0,
  32866. class: vue.normalizeClass([vue.unref(ns).e("icon"), vue.unref(ns).e("clear")]),
  32867. onMousedown: vue.withModifiers(vue.unref(NOOP), ["prevent"]),
  32868. onClick: vue.unref(handleClear)
  32869. }, {
  32870. default: vue.withCtx(() => [
  32871. vue.createVNode(vue.unref(circle_close_default))
  32872. ]),
  32873. _: 1
  32874. }, 8, ["class", "onMousedown", "onClick"])) : vue.createCommentVNode("v-if", true),
  32875. vue.unref(validateState) && vue.unref(validateIcon) && vue.unref(needStatusIcon) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  32876. key: 1,
  32877. class: vue.normalizeClass([
  32878. vue.unref(nsInput).e("icon"),
  32879. vue.unref(nsInput).e("validateIcon"),
  32880. vue.unref(nsInput).is("loading", vue.unref(validateState) === "validating")
  32881. ])
  32882. }, {
  32883. default: vue.withCtx(() => [
  32884. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(validateIcon))))
  32885. ]),
  32886. _: 1
  32887. }, 8, ["class"])) : vue.createCommentVNode("v-if", true)
  32888. ], 2)) : vue.createCommentVNode("v-if", true)
  32889. ], 46, ["onMouseenter", "onMouseleave"]);
  32890. };
  32891. }
  32892. });
  32893. var InputTag = /* @__PURE__ */ _export_sfc(_sfc_main$17, [["__file", "input-tag.vue"]]);
  32894. const ElInputTag = withInstall(InputTag);
  32895. const linkProps = buildProps({
  32896. type: {
  32897. type: String,
  32898. values: ["primary", "success", "warning", "info", "danger", "default"],
  32899. default: "default"
  32900. },
  32901. underline: {
  32902. type: Boolean,
  32903. default: true
  32904. },
  32905. disabled: Boolean,
  32906. href: { type: String, default: "" },
  32907. target: {
  32908. type: String,
  32909. default: "_self"
  32910. },
  32911. icon: {
  32912. type: iconPropType
  32913. }
  32914. });
  32915. const linkEmits = {
  32916. click: (evt) => evt instanceof MouseEvent
  32917. };
  32918. const __default__$R = vue.defineComponent({
  32919. name: "ElLink"
  32920. });
  32921. const _sfc_main$16 = /* @__PURE__ */ vue.defineComponent({
  32922. ...__default__$R,
  32923. props: linkProps,
  32924. emits: linkEmits,
  32925. setup(__props, { emit }) {
  32926. const props = __props;
  32927. const ns = useNamespace("link");
  32928. const linkKls = vue.computed(() => [
  32929. ns.b(),
  32930. ns.m(props.type),
  32931. ns.is("disabled", props.disabled),
  32932. ns.is("underline", props.underline && !props.disabled)
  32933. ]);
  32934. function handleClick(event) {
  32935. if (!props.disabled)
  32936. emit("click", event);
  32937. }
  32938. return (_ctx, _cache) => {
  32939. return vue.openBlock(), vue.createElementBlock("a", {
  32940. class: vue.normalizeClass(vue.unref(linkKls)),
  32941. href: _ctx.disabled || !_ctx.href ? void 0 : _ctx.href,
  32942. target: _ctx.disabled || !_ctx.href ? void 0 : _ctx.target,
  32943. onClick: handleClick
  32944. }, [
  32945. _ctx.icon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 0 }, {
  32946. default: vue.withCtx(() => [
  32947. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.icon)))
  32948. ]),
  32949. _: 1
  32950. })) : vue.createCommentVNode("v-if", true),
  32951. _ctx.$slots.default ? (vue.openBlock(), vue.createElementBlock("span", {
  32952. key: 1,
  32953. class: vue.normalizeClass(vue.unref(ns).e("inner"))
  32954. }, [
  32955. vue.renderSlot(_ctx.$slots, "default")
  32956. ], 2)) : vue.createCommentVNode("v-if", true),
  32957. _ctx.$slots.icon ? vue.renderSlot(_ctx.$slots, "icon", { key: 2 }) : vue.createCommentVNode("v-if", true)
  32958. ], 10, ["href", "target"]);
  32959. };
  32960. }
  32961. });
  32962. var Link = /* @__PURE__ */ _export_sfc(_sfc_main$16, [["__file", "link.vue"]]);
  32963. const ElLink = withInstall(Link);
  32964. class SubMenu$1 {
  32965. constructor(parent, domNode) {
  32966. this.parent = parent;
  32967. this.domNode = domNode;
  32968. this.subIndex = 0;
  32969. this.subIndex = 0;
  32970. this.init();
  32971. }
  32972. init() {
  32973. this.subMenuItems = this.domNode.querySelectorAll("li");
  32974. this.addListeners();
  32975. }
  32976. gotoSubIndex(idx) {
  32977. if (idx === this.subMenuItems.length) {
  32978. idx = 0;
  32979. } else if (idx < 0) {
  32980. idx = this.subMenuItems.length - 1;
  32981. }
  32982. this.subMenuItems[idx].focus();
  32983. this.subIndex = idx;
  32984. }
  32985. addListeners() {
  32986. const parentNode = this.parent.domNode;
  32987. Array.prototype.forEach.call(this.subMenuItems, (el) => {
  32988. el.addEventListener("keydown", (event) => {
  32989. let prevDef = false;
  32990. switch (event.code) {
  32991. case EVENT_CODE.down: {
  32992. this.gotoSubIndex(this.subIndex + 1);
  32993. prevDef = true;
  32994. break;
  32995. }
  32996. case EVENT_CODE.up: {
  32997. this.gotoSubIndex(this.subIndex - 1);
  32998. prevDef = true;
  32999. break;
  33000. }
  33001. case EVENT_CODE.tab: {
  33002. triggerEvent(parentNode, "mouseleave");
  33003. break;
  33004. }
  33005. case EVENT_CODE.enter:
  33006. case EVENT_CODE.numpadEnter:
  33007. case EVENT_CODE.space: {
  33008. prevDef = true;
  33009. event.currentTarget.click();
  33010. break;
  33011. }
  33012. }
  33013. if (prevDef) {
  33014. event.preventDefault();
  33015. event.stopPropagation();
  33016. }
  33017. return false;
  33018. });
  33019. });
  33020. }
  33021. }
  33022. var SubMenu$2 = SubMenu$1;
  33023. class MenuItem$1 {
  33024. constructor(domNode, namespace) {
  33025. this.domNode = domNode;
  33026. this.submenu = null;
  33027. this.submenu = null;
  33028. this.init(namespace);
  33029. }
  33030. init(namespace) {
  33031. this.domNode.setAttribute("tabindex", "0");
  33032. const menuChild = this.domNode.querySelector(`.${namespace}-menu`);
  33033. if (menuChild) {
  33034. this.submenu = new SubMenu$2(this, menuChild);
  33035. }
  33036. this.addListeners();
  33037. }
  33038. addListeners() {
  33039. this.domNode.addEventListener("keydown", (event) => {
  33040. let prevDef = false;
  33041. switch (event.code) {
  33042. case EVENT_CODE.down: {
  33043. triggerEvent(event.currentTarget, "mouseenter");
  33044. this.submenu && this.submenu.gotoSubIndex(0);
  33045. prevDef = true;
  33046. break;
  33047. }
  33048. case EVENT_CODE.up: {
  33049. triggerEvent(event.currentTarget, "mouseenter");
  33050. this.submenu && this.submenu.gotoSubIndex(this.submenu.subMenuItems.length - 1);
  33051. prevDef = true;
  33052. break;
  33053. }
  33054. case EVENT_CODE.tab: {
  33055. triggerEvent(event.currentTarget, "mouseleave");
  33056. break;
  33057. }
  33058. case EVENT_CODE.enter:
  33059. case EVENT_CODE.numpadEnter:
  33060. case EVENT_CODE.space: {
  33061. prevDef = true;
  33062. event.currentTarget.click();
  33063. break;
  33064. }
  33065. }
  33066. if (prevDef) {
  33067. event.preventDefault();
  33068. }
  33069. });
  33070. }
  33071. }
  33072. var MenuItem$2 = MenuItem$1;
  33073. class Menu$1 {
  33074. constructor(domNode, namespace) {
  33075. this.domNode = domNode;
  33076. this.init(namespace);
  33077. }
  33078. init(namespace) {
  33079. const menuChildren = this.domNode.childNodes;
  33080. Array.from(menuChildren).forEach((child) => {
  33081. if (child.nodeType === 1) {
  33082. new MenuItem$2(child, namespace);
  33083. }
  33084. });
  33085. }
  33086. }
  33087. var Menubar = Menu$1;
  33088. const _sfc_main$15 = vue.defineComponent({
  33089. name: "ElMenuCollapseTransition",
  33090. setup() {
  33091. const ns = useNamespace("menu");
  33092. const listeners = {
  33093. onBeforeEnter: (el) => el.style.opacity = "0.2",
  33094. onEnter(el, done) {
  33095. addClass(el, `${ns.namespace.value}-opacity-transition`);
  33096. el.style.opacity = "1";
  33097. done();
  33098. },
  33099. onAfterEnter(el) {
  33100. removeClass(el, `${ns.namespace.value}-opacity-transition`);
  33101. el.style.opacity = "";
  33102. },
  33103. onBeforeLeave(el) {
  33104. if (!el.dataset) {
  33105. el.dataset = {};
  33106. }
  33107. if (hasClass(el, ns.m("collapse"))) {
  33108. removeClass(el, ns.m("collapse"));
  33109. el.dataset.oldOverflow = el.style.overflow;
  33110. el.dataset.scrollWidth = el.clientWidth.toString();
  33111. addClass(el, ns.m("collapse"));
  33112. } else {
  33113. addClass(el, ns.m("collapse"));
  33114. el.dataset.oldOverflow = el.style.overflow;
  33115. el.dataset.scrollWidth = el.clientWidth.toString();
  33116. removeClass(el, ns.m("collapse"));
  33117. }
  33118. el.style.width = `${el.scrollWidth}px`;
  33119. el.style.overflow = "hidden";
  33120. },
  33121. onLeave(el) {
  33122. addClass(el, "horizontal-collapse-transition");
  33123. el.style.width = `${el.dataset.scrollWidth}px`;
  33124. }
  33125. };
  33126. return {
  33127. listeners
  33128. };
  33129. }
  33130. });
  33131. function _sfc_render$e(_ctx, _cache, $props, $setup, $data, $options) {
  33132. return vue.openBlock(), vue.createBlock(vue.Transition, vue.mergeProps({ mode: "out-in" }, _ctx.listeners), {
  33133. default: vue.withCtx(() => [
  33134. vue.renderSlot(_ctx.$slots, "default")
  33135. ]),
  33136. _: 3
  33137. }, 16);
  33138. }
  33139. var ElMenuCollapseTransition = /* @__PURE__ */ _export_sfc(_sfc_main$15, [["render", _sfc_render$e], ["__file", "menu-collapse-transition.vue"]]);
  33140. function useMenu(instance, currentIndex) {
  33141. const indexPath = vue.computed(() => {
  33142. let parent = instance.parent;
  33143. const path = [currentIndex.value];
  33144. while (parent.type.name !== "ElMenu") {
  33145. if (parent.props.index) {
  33146. path.unshift(parent.props.index);
  33147. }
  33148. parent = parent.parent;
  33149. }
  33150. return path;
  33151. });
  33152. const parentMenu = vue.computed(() => {
  33153. let parent = instance.parent;
  33154. while (parent && !["ElMenu", "ElSubMenu"].includes(parent.type.name)) {
  33155. parent = parent.parent;
  33156. }
  33157. return parent;
  33158. });
  33159. return {
  33160. parentMenu,
  33161. indexPath
  33162. };
  33163. }
  33164. function useMenuColor(props) {
  33165. const menuBarColor = vue.computed(() => {
  33166. const color = props.backgroundColor;
  33167. if (!color) {
  33168. return "";
  33169. } else {
  33170. return new TinyColor(color).shade(20).toString();
  33171. }
  33172. });
  33173. return menuBarColor;
  33174. }
  33175. const useMenuCssVar = (props, level) => {
  33176. const ns = useNamespace("menu");
  33177. return vue.computed(() => {
  33178. return ns.cssVarBlock({
  33179. "text-color": props.textColor || "",
  33180. "hover-text-color": props.textColor || "",
  33181. "bg-color": props.backgroundColor || "",
  33182. "hover-bg-color": useMenuColor(props).value || "",
  33183. "active-color": props.activeTextColor || "",
  33184. level: `${level}`
  33185. });
  33186. });
  33187. };
  33188. const subMenuProps = buildProps({
  33189. index: {
  33190. type: String,
  33191. required: true
  33192. },
  33193. showTimeout: Number,
  33194. hideTimeout: Number,
  33195. popperClass: String,
  33196. disabled: Boolean,
  33197. teleported: {
  33198. type: Boolean,
  33199. default: void 0
  33200. },
  33201. popperOffset: Number,
  33202. expandCloseIcon: {
  33203. type: iconPropType
  33204. },
  33205. expandOpenIcon: {
  33206. type: iconPropType
  33207. },
  33208. collapseCloseIcon: {
  33209. type: iconPropType
  33210. },
  33211. collapseOpenIcon: {
  33212. type: iconPropType
  33213. }
  33214. });
  33215. const COMPONENT_NAME$c = "ElSubMenu";
  33216. var SubMenu = vue.defineComponent({
  33217. name: COMPONENT_NAME$c,
  33218. props: subMenuProps,
  33219. setup(props, { slots, expose }) {
  33220. const instance = vue.getCurrentInstance();
  33221. const { indexPath, parentMenu } = useMenu(instance, vue.computed(() => props.index));
  33222. const nsMenu = useNamespace("menu");
  33223. const nsSubMenu = useNamespace("sub-menu");
  33224. const rootMenu = vue.inject("rootMenu");
  33225. if (!rootMenu)
  33226. throwError(COMPONENT_NAME$c, "can not inject root menu");
  33227. const subMenu = vue.inject(`subMenu:${parentMenu.value.uid}`);
  33228. if (!subMenu)
  33229. throwError(COMPONENT_NAME$c, "can not inject sub menu");
  33230. const items = vue.ref({});
  33231. const subMenus = vue.ref({});
  33232. let timeout;
  33233. const mouseInChild = vue.ref(false);
  33234. const verticalTitleRef = vue.ref();
  33235. const vPopper = vue.ref(null);
  33236. const currentPlacement = vue.computed(() => mode.value === "horizontal" && isFirstLevel.value ? "bottom-start" : "right-start");
  33237. const subMenuTitleIcon = vue.computed(() => {
  33238. return mode.value === "horizontal" && isFirstLevel.value || mode.value === "vertical" && !rootMenu.props.collapse ? props.expandCloseIcon && props.expandOpenIcon ? opened.value ? props.expandOpenIcon : props.expandCloseIcon : arrow_down_default : props.collapseCloseIcon && props.collapseOpenIcon ? opened.value ? props.collapseOpenIcon : props.collapseCloseIcon : arrow_right_default;
  33239. });
  33240. const isFirstLevel = vue.computed(() => {
  33241. return subMenu.level === 0;
  33242. });
  33243. const appendToBody = vue.computed(() => {
  33244. const value = props.teleported;
  33245. return value === void 0 ? isFirstLevel.value : value;
  33246. });
  33247. const menuTransitionName = vue.computed(() => rootMenu.props.collapse ? `${nsMenu.namespace.value}-zoom-in-left` : `${nsMenu.namespace.value}-zoom-in-top`);
  33248. const fallbackPlacements = vue.computed(() => mode.value === "horizontal" && isFirstLevel.value ? [
  33249. "bottom-start",
  33250. "bottom-end",
  33251. "top-start",
  33252. "top-end",
  33253. "right-start",
  33254. "left-start"
  33255. ] : [
  33256. "right-start",
  33257. "right",
  33258. "right-end",
  33259. "left-start",
  33260. "bottom-start",
  33261. "bottom-end",
  33262. "top-start",
  33263. "top-end"
  33264. ]);
  33265. const opened = vue.computed(() => rootMenu.openedMenus.includes(props.index));
  33266. const active = vue.computed(() => {
  33267. let isActive = false;
  33268. Object.values(items.value).forEach((item2) => {
  33269. if (item2.active) {
  33270. isActive = true;
  33271. }
  33272. });
  33273. Object.values(subMenus.value).forEach((subItem) => {
  33274. if (subItem.active) {
  33275. isActive = true;
  33276. }
  33277. });
  33278. return isActive;
  33279. });
  33280. const mode = vue.computed(() => rootMenu.props.mode);
  33281. const item = vue.reactive({
  33282. index: props.index,
  33283. indexPath,
  33284. active
  33285. });
  33286. const ulStyle = useMenuCssVar(rootMenu.props, subMenu.level + 1);
  33287. const subMenuPopperOffset = vue.computed(() => {
  33288. var _a;
  33289. return (_a = props.popperOffset) != null ? _a : rootMenu.props.popperOffset;
  33290. });
  33291. const subMenuPopperClass = vue.computed(() => {
  33292. var _a;
  33293. return (_a = props.popperClass) != null ? _a : rootMenu.props.popperClass;
  33294. });
  33295. const subMenuShowTimeout = vue.computed(() => {
  33296. var _a;
  33297. return (_a = props.showTimeout) != null ? _a : rootMenu.props.showTimeout;
  33298. });
  33299. const subMenuHideTimeout = vue.computed(() => {
  33300. var _a;
  33301. return (_a = props.hideTimeout) != null ? _a : rootMenu.props.hideTimeout;
  33302. });
  33303. const doDestroy = () => {
  33304. var _a, _b, _c;
  33305. return (_c = (_b = (_a = vPopper.value) == null ? void 0 : _a.popperRef) == null ? void 0 : _b.popperInstanceRef) == null ? void 0 : _c.destroy();
  33306. };
  33307. const handleCollapseToggle = (value) => {
  33308. if (!value) {
  33309. doDestroy();
  33310. }
  33311. };
  33312. const handleClick = () => {
  33313. if (rootMenu.props.menuTrigger === "hover" && rootMenu.props.mode === "horizontal" || rootMenu.props.collapse && rootMenu.props.mode === "vertical" || props.disabled)
  33314. return;
  33315. rootMenu.handleSubMenuClick({
  33316. index: props.index,
  33317. indexPath: indexPath.value,
  33318. active: active.value
  33319. });
  33320. };
  33321. const handleMouseenter = (event, showTimeout = subMenuShowTimeout.value) => {
  33322. var _a;
  33323. if (event.type === "focus") {
  33324. return;
  33325. }
  33326. if (rootMenu.props.menuTrigger === "click" && rootMenu.props.mode === "horizontal" || !rootMenu.props.collapse && rootMenu.props.mode === "vertical" || props.disabled) {
  33327. subMenu.mouseInChild.value = true;
  33328. return;
  33329. }
  33330. subMenu.mouseInChild.value = true;
  33331. timeout == null ? void 0 : timeout();
  33332. ({ stop: timeout } = useTimeoutFn(() => {
  33333. rootMenu.openMenu(props.index, indexPath.value);
  33334. }, showTimeout));
  33335. if (appendToBody.value) {
  33336. (_a = parentMenu.value.vnode.el) == null ? void 0 : _a.dispatchEvent(new MouseEvent("mouseenter"));
  33337. }
  33338. };
  33339. const handleMouseleave = (deepDispatch = false) => {
  33340. var _a;
  33341. if (rootMenu.props.menuTrigger === "click" && rootMenu.props.mode === "horizontal" || !rootMenu.props.collapse && rootMenu.props.mode === "vertical") {
  33342. subMenu.mouseInChild.value = false;
  33343. return;
  33344. }
  33345. timeout == null ? void 0 : timeout();
  33346. subMenu.mouseInChild.value = false;
  33347. ({ stop: timeout } = useTimeoutFn(() => !mouseInChild.value && rootMenu.closeMenu(props.index, indexPath.value), subMenuHideTimeout.value));
  33348. if (appendToBody.value && deepDispatch) {
  33349. (_a = subMenu.handleMouseleave) == null ? void 0 : _a.call(subMenu, true);
  33350. }
  33351. };
  33352. vue.watch(() => rootMenu.props.collapse, (value) => handleCollapseToggle(Boolean(value)));
  33353. {
  33354. const addSubMenu = (item2) => {
  33355. subMenus.value[item2.index] = item2;
  33356. };
  33357. const removeSubMenu = (item2) => {
  33358. delete subMenus.value[item2.index];
  33359. };
  33360. vue.provide(`subMenu:${instance.uid}`, {
  33361. addSubMenu,
  33362. removeSubMenu,
  33363. handleMouseleave,
  33364. mouseInChild,
  33365. level: subMenu.level + 1
  33366. });
  33367. }
  33368. expose({
  33369. opened
  33370. });
  33371. vue.onMounted(() => {
  33372. rootMenu.addSubMenu(item);
  33373. subMenu.addSubMenu(item);
  33374. });
  33375. vue.onBeforeUnmount(() => {
  33376. subMenu.removeSubMenu(item);
  33377. rootMenu.removeSubMenu(item);
  33378. });
  33379. return () => {
  33380. var _a;
  33381. const titleTag = [
  33382. (_a = slots.title) == null ? void 0 : _a.call(slots),
  33383. vue.h(ElIcon, {
  33384. class: nsSubMenu.e("icon-arrow"),
  33385. style: {
  33386. transform: opened.value ? props.expandCloseIcon && props.expandOpenIcon || props.collapseCloseIcon && props.collapseOpenIcon && rootMenu.props.collapse ? "none" : "rotateZ(180deg)" : "none"
  33387. }
  33388. }, {
  33389. default: () => isString$1(subMenuTitleIcon.value) ? vue.h(instance.appContext.components[subMenuTitleIcon.value]) : vue.h(subMenuTitleIcon.value)
  33390. })
  33391. ];
  33392. const child = rootMenu.isMenuPopup ? vue.h(ElTooltip, {
  33393. ref: vPopper,
  33394. visible: opened.value,
  33395. effect: "light",
  33396. pure: true,
  33397. offset: subMenuPopperOffset.value,
  33398. showArrow: false,
  33399. persistent: true,
  33400. popperClass: subMenuPopperClass.value,
  33401. placement: currentPlacement.value,
  33402. teleported: appendToBody.value,
  33403. fallbackPlacements: fallbackPlacements.value,
  33404. transition: menuTransitionName.value,
  33405. gpuAcceleration: false
  33406. }, {
  33407. content: () => {
  33408. var _a2;
  33409. return vue.h("div", {
  33410. class: [
  33411. nsMenu.m(mode.value),
  33412. nsMenu.m("popup-container"),
  33413. subMenuPopperClass.value
  33414. ],
  33415. onMouseenter: (evt) => handleMouseenter(evt, 100),
  33416. onMouseleave: () => handleMouseleave(true),
  33417. onFocus: (evt) => handleMouseenter(evt, 100)
  33418. }, [
  33419. vue.h("ul", {
  33420. class: [
  33421. nsMenu.b(),
  33422. nsMenu.m("popup"),
  33423. nsMenu.m(`popup-${currentPlacement.value}`)
  33424. ],
  33425. style: ulStyle.value
  33426. }, [(_a2 = slots.default) == null ? void 0 : _a2.call(slots)])
  33427. ]);
  33428. },
  33429. default: () => vue.h("div", {
  33430. class: nsSubMenu.e("title"),
  33431. onClick: handleClick
  33432. }, titleTag)
  33433. }) : vue.h(vue.Fragment, {}, [
  33434. vue.h("div", {
  33435. class: nsSubMenu.e("title"),
  33436. ref: verticalTitleRef,
  33437. onClick: handleClick
  33438. }, titleTag),
  33439. vue.h(ElCollapseTransition, {}, {
  33440. default: () => {
  33441. var _a2;
  33442. return vue.withDirectives(vue.h("ul", {
  33443. role: "menu",
  33444. class: [nsMenu.b(), nsMenu.m("inline")],
  33445. style: ulStyle.value
  33446. }, [(_a2 = slots.default) == null ? void 0 : _a2.call(slots)]), [[vue.vShow, opened.value]]);
  33447. }
  33448. })
  33449. ]);
  33450. return vue.h("li", {
  33451. class: [
  33452. nsSubMenu.b(),
  33453. nsSubMenu.is("active", active.value),
  33454. nsSubMenu.is("opened", opened.value),
  33455. nsSubMenu.is("disabled", props.disabled)
  33456. ],
  33457. role: "menuitem",
  33458. ariaHaspopup: true,
  33459. ariaExpanded: opened.value,
  33460. onMouseenter: handleMouseenter,
  33461. onMouseleave: () => handleMouseleave(),
  33462. onFocus: handleMouseenter
  33463. }, [child]);
  33464. };
  33465. }
  33466. });
  33467. const menuProps = buildProps({
  33468. mode: {
  33469. type: String,
  33470. values: ["horizontal", "vertical"],
  33471. default: "vertical"
  33472. },
  33473. defaultActive: {
  33474. type: String,
  33475. default: ""
  33476. },
  33477. defaultOpeneds: {
  33478. type: definePropType(Array),
  33479. default: () => mutable([])
  33480. },
  33481. uniqueOpened: Boolean,
  33482. router: Boolean,
  33483. menuTrigger: {
  33484. type: String,
  33485. values: ["hover", "click"],
  33486. default: "hover"
  33487. },
  33488. collapse: Boolean,
  33489. backgroundColor: String,
  33490. textColor: String,
  33491. activeTextColor: String,
  33492. closeOnClickOutside: Boolean,
  33493. collapseTransition: {
  33494. type: Boolean,
  33495. default: true
  33496. },
  33497. ellipsis: {
  33498. type: Boolean,
  33499. default: true
  33500. },
  33501. popperOffset: {
  33502. type: Number,
  33503. default: 6
  33504. },
  33505. ellipsisIcon: {
  33506. type: iconPropType,
  33507. default: () => more_default
  33508. },
  33509. popperEffect: {
  33510. type: definePropType(String),
  33511. default: "dark"
  33512. },
  33513. popperClass: String,
  33514. showTimeout: {
  33515. type: Number,
  33516. default: 300
  33517. },
  33518. hideTimeout: {
  33519. type: Number,
  33520. default: 300
  33521. }
  33522. });
  33523. const checkIndexPath = (indexPath) => isArray$1(indexPath) && indexPath.every((path) => isString$1(path));
  33524. const menuEmits = {
  33525. close: (index, indexPath) => isString$1(index) && checkIndexPath(indexPath),
  33526. open: (index, indexPath) => isString$1(index) && checkIndexPath(indexPath),
  33527. select: (index, indexPath, item, routerResult) => isString$1(index) && checkIndexPath(indexPath) && isObject$1(item) && (routerResult === void 0 || routerResult instanceof Promise)
  33528. };
  33529. var Menu = vue.defineComponent({
  33530. name: "ElMenu",
  33531. props: menuProps,
  33532. emits: menuEmits,
  33533. setup(props, { emit, slots, expose }) {
  33534. const instance = vue.getCurrentInstance();
  33535. const router = instance.appContext.config.globalProperties.$router;
  33536. const menu = vue.ref();
  33537. const nsMenu = useNamespace("menu");
  33538. const nsSubMenu = useNamespace("sub-menu");
  33539. const sliceIndex = vue.ref(-1);
  33540. const openedMenus = vue.ref(props.defaultOpeneds && !props.collapse ? props.defaultOpeneds.slice(0) : []);
  33541. const activeIndex = vue.ref(props.defaultActive);
  33542. const items = vue.ref({});
  33543. const subMenus = vue.ref({});
  33544. const isMenuPopup = vue.computed(() => {
  33545. return props.mode === "horizontal" || props.mode === "vertical" && props.collapse;
  33546. });
  33547. const initMenu = () => {
  33548. const activeItem = activeIndex.value && items.value[activeIndex.value];
  33549. if (!activeItem || props.mode === "horizontal" || props.collapse)
  33550. return;
  33551. const indexPath = activeItem.indexPath;
  33552. indexPath.forEach((index) => {
  33553. const subMenu = subMenus.value[index];
  33554. subMenu && openMenu(index, subMenu.indexPath);
  33555. });
  33556. };
  33557. const openMenu = (index, indexPath) => {
  33558. if (openedMenus.value.includes(index))
  33559. return;
  33560. if (props.uniqueOpened) {
  33561. openedMenus.value = openedMenus.value.filter((index2) => indexPath.includes(index2));
  33562. }
  33563. openedMenus.value.push(index);
  33564. emit("open", index, indexPath);
  33565. };
  33566. const close = (index) => {
  33567. const i = openedMenus.value.indexOf(index);
  33568. if (i !== -1) {
  33569. openedMenus.value.splice(i, 1);
  33570. }
  33571. };
  33572. const closeMenu = (index, indexPath) => {
  33573. close(index);
  33574. emit("close", index, indexPath);
  33575. };
  33576. const handleSubMenuClick = ({
  33577. index,
  33578. indexPath
  33579. }) => {
  33580. const isOpened = openedMenus.value.includes(index);
  33581. if (isOpened) {
  33582. closeMenu(index, indexPath);
  33583. } else {
  33584. openMenu(index, indexPath);
  33585. }
  33586. };
  33587. const handleMenuItemClick = (menuItem) => {
  33588. if (props.mode === "horizontal" || props.collapse) {
  33589. openedMenus.value = [];
  33590. }
  33591. const { index, indexPath } = menuItem;
  33592. if (isNil(index) || isNil(indexPath))
  33593. return;
  33594. if (props.router && router) {
  33595. const route = menuItem.route || index;
  33596. const routerResult = router.push(route).then((res) => {
  33597. if (!res)
  33598. activeIndex.value = index;
  33599. return res;
  33600. });
  33601. emit("select", index, indexPath, { index, indexPath, route }, routerResult);
  33602. } else {
  33603. activeIndex.value = index;
  33604. emit("select", index, indexPath, { index, indexPath });
  33605. }
  33606. };
  33607. const updateActiveIndex = (val) => {
  33608. const itemsInData = items.value;
  33609. const item = itemsInData[val] || activeIndex.value && itemsInData[activeIndex.value] || itemsInData[props.defaultActive];
  33610. if (item) {
  33611. activeIndex.value = item.index;
  33612. } else {
  33613. activeIndex.value = val;
  33614. }
  33615. };
  33616. const calcMenuItemWidth = (menuItem) => {
  33617. const computedStyle = getComputedStyle(menuItem);
  33618. const marginLeft = Number.parseInt(computedStyle.marginLeft, 10);
  33619. const marginRight = Number.parseInt(computedStyle.marginRight, 10);
  33620. return menuItem.offsetWidth + marginLeft + marginRight || 0;
  33621. };
  33622. const calcSliceIndex = () => {
  33623. var _a, _b;
  33624. if (!menu.value)
  33625. return -1;
  33626. const items2 = Array.from((_b = (_a = menu.value) == null ? void 0 : _a.childNodes) != null ? _b : []).filter((item) => item.nodeName !== "#comment" && (item.nodeName !== "#text" || item.nodeValue));
  33627. const moreItemWidth = 64;
  33628. const computedMenuStyle = getComputedStyle(menu.value);
  33629. const paddingLeft = Number.parseInt(computedMenuStyle.paddingLeft, 10);
  33630. const paddingRight = Number.parseInt(computedMenuStyle.paddingRight, 10);
  33631. const menuWidth = menu.value.clientWidth - paddingLeft - paddingRight;
  33632. let calcWidth = 0;
  33633. let sliceIndex2 = 0;
  33634. items2.forEach((item, index) => {
  33635. calcWidth += calcMenuItemWidth(item);
  33636. if (calcWidth <= menuWidth - moreItemWidth) {
  33637. sliceIndex2 = index + 1;
  33638. }
  33639. });
  33640. return sliceIndex2 === items2.length ? -1 : sliceIndex2;
  33641. };
  33642. const getIndexPath = (index) => subMenus.value[index].indexPath;
  33643. const debounce = (fn, wait = 33.34) => {
  33644. let timmer;
  33645. return () => {
  33646. timmer && clearTimeout(timmer);
  33647. timmer = setTimeout(() => {
  33648. fn();
  33649. }, wait);
  33650. };
  33651. };
  33652. let isFirstTimeRender = true;
  33653. const handleResize = () => {
  33654. if (sliceIndex.value === calcSliceIndex())
  33655. return;
  33656. const callback = () => {
  33657. sliceIndex.value = -1;
  33658. vue.nextTick(() => {
  33659. sliceIndex.value = calcSliceIndex();
  33660. });
  33661. };
  33662. isFirstTimeRender ? callback() : debounce(callback)();
  33663. isFirstTimeRender = false;
  33664. };
  33665. vue.watch(() => props.defaultActive, (currentActive) => {
  33666. if (!items.value[currentActive]) {
  33667. activeIndex.value = "";
  33668. }
  33669. updateActiveIndex(currentActive);
  33670. });
  33671. vue.watch(() => props.collapse, (value) => {
  33672. if (value)
  33673. openedMenus.value = [];
  33674. });
  33675. vue.watch(items.value, initMenu);
  33676. let resizeStopper;
  33677. vue.watchEffect(() => {
  33678. if (props.mode === "horizontal" && props.ellipsis)
  33679. resizeStopper = useResizeObserver(menu, handleResize).stop;
  33680. else
  33681. resizeStopper == null ? void 0 : resizeStopper();
  33682. });
  33683. const mouseInChild = vue.ref(false);
  33684. {
  33685. const addSubMenu = (item) => {
  33686. subMenus.value[item.index] = item;
  33687. };
  33688. const removeSubMenu = (item) => {
  33689. delete subMenus.value[item.index];
  33690. };
  33691. const addMenuItem = (item) => {
  33692. items.value[item.index] = item;
  33693. };
  33694. const removeMenuItem = (item) => {
  33695. delete items.value[item.index];
  33696. };
  33697. vue.provide("rootMenu", vue.reactive({
  33698. props,
  33699. openedMenus,
  33700. items,
  33701. subMenus,
  33702. activeIndex,
  33703. isMenuPopup,
  33704. addMenuItem,
  33705. removeMenuItem,
  33706. addSubMenu,
  33707. removeSubMenu,
  33708. openMenu,
  33709. closeMenu,
  33710. handleMenuItemClick,
  33711. handleSubMenuClick
  33712. }));
  33713. vue.provide(`subMenu:${instance.uid}`, {
  33714. addSubMenu,
  33715. removeSubMenu,
  33716. mouseInChild,
  33717. level: 0
  33718. });
  33719. }
  33720. vue.onMounted(() => {
  33721. if (props.mode === "horizontal") {
  33722. new Menubar(instance.vnode.el, nsMenu.namespace.value);
  33723. }
  33724. });
  33725. {
  33726. const open = (index) => {
  33727. const { indexPath } = subMenus.value[index];
  33728. indexPath.forEach((i) => openMenu(i, indexPath));
  33729. };
  33730. expose({
  33731. open,
  33732. close,
  33733. handleResize
  33734. });
  33735. }
  33736. const ulStyle = useMenuCssVar(props, 0);
  33737. return () => {
  33738. var _a, _b;
  33739. let slot = (_b = (_a = slots.default) == null ? void 0 : _a.call(slots)) != null ? _b : [];
  33740. const vShowMore = [];
  33741. if (props.mode === "horizontal" && menu.value) {
  33742. const originalSlot = flattedChildren(slot);
  33743. const slotDefault = sliceIndex.value === -1 ? originalSlot : originalSlot.slice(0, sliceIndex.value);
  33744. const slotMore = sliceIndex.value === -1 ? [] : originalSlot.slice(sliceIndex.value);
  33745. if ((slotMore == null ? void 0 : slotMore.length) && props.ellipsis) {
  33746. slot = slotDefault;
  33747. vShowMore.push(vue.h(SubMenu, {
  33748. index: "sub-menu-more",
  33749. class: nsSubMenu.e("hide-arrow"),
  33750. popperOffset: props.popperOffset
  33751. }, {
  33752. title: () => vue.h(ElIcon, {
  33753. class: nsSubMenu.e("icon-more")
  33754. }, {
  33755. default: () => vue.h(props.ellipsisIcon)
  33756. }),
  33757. default: () => slotMore
  33758. }));
  33759. }
  33760. }
  33761. const directives = props.closeOnClickOutside ? [
  33762. [
  33763. ClickOutside,
  33764. () => {
  33765. if (!openedMenus.value.length)
  33766. return;
  33767. if (!mouseInChild.value) {
  33768. openedMenus.value.forEach((openedMenu) => emit("close", openedMenu, getIndexPath(openedMenu)));
  33769. openedMenus.value = [];
  33770. }
  33771. }
  33772. ]
  33773. ] : [];
  33774. const vMenu = vue.withDirectives(vue.h("ul", {
  33775. key: String(props.collapse),
  33776. role: "menubar",
  33777. ref: menu,
  33778. style: ulStyle.value,
  33779. class: {
  33780. [nsMenu.b()]: true,
  33781. [nsMenu.m(props.mode)]: true,
  33782. [nsMenu.m("collapse")]: props.collapse
  33783. }
  33784. }, [...slot, ...vShowMore]), directives);
  33785. if (props.collapseTransition && props.mode === "vertical") {
  33786. return vue.h(ElMenuCollapseTransition, () => vMenu);
  33787. }
  33788. return vMenu;
  33789. };
  33790. }
  33791. });
  33792. const menuItemProps = buildProps({
  33793. index: {
  33794. type: definePropType([String, null]),
  33795. default: null
  33796. },
  33797. route: {
  33798. type: definePropType([String, Object])
  33799. },
  33800. disabled: Boolean
  33801. });
  33802. const menuItemEmits = {
  33803. click: (item) => isString$1(item.index) && isArray$1(item.indexPath)
  33804. };
  33805. const COMPONENT_NAME$b = "ElMenuItem";
  33806. const _sfc_main$14 = vue.defineComponent({
  33807. name: COMPONENT_NAME$b,
  33808. components: {
  33809. ElTooltip
  33810. },
  33811. props: menuItemProps,
  33812. emits: menuItemEmits,
  33813. setup(props, { emit }) {
  33814. const instance = vue.getCurrentInstance();
  33815. const rootMenu = vue.inject("rootMenu");
  33816. const nsMenu = useNamespace("menu");
  33817. const nsMenuItem = useNamespace("menu-item");
  33818. if (!rootMenu)
  33819. throwError(COMPONENT_NAME$b, "can not inject root menu");
  33820. const { parentMenu, indexPath } = useMenu(instance, vue.toRef(props, "index"));
  33821. const subMenu = vue.inject(`subMenu:${parentMenu.value.uid}`);
  33822. if (!subMenu)
  33823. throwError(COMPONENT_NAME$b, "can not inject sub menu");
  33824. const active = vue.computed(() => props.index === rootMenu.activeIndex);
  33825. const item = vue.reactive({
  33826. index: props.index,
  33827. indexPath,
  33828. active
  33829. });
  33830. const handleClick = () => {
  33831. if (!props.disabled) {
  33832. rootMenu.handleMenuItemClick({
  33833. index: props.index,
  33834. indexPath: indexPath.value,
  33835. route: props.route
  33836. });
  33837. emit("click", item);
  33838. }
  33839. };
  33840. vue.onMounted(() => {
  33841. subMenu.addSubMenu(item);
  33842. rootMenu.addMenuItem(item);
  33843. });
  33844. vue.onBeforeUnmount(() => {
  33845. subMenu.removeSubMenu(item);
  33846. rootMenu.removeMenuItem(item);
  33847. });
  33848. return {
  33849. parentMenu,
  33850. rootMenu,
  33851. active,
  33852. nsMenu,
  33853. nsMenuItem,
  33854. handleClick
  33855. };
  33856. }
  33857. });
  33858. function _sfc_render$d(_ctx, _cache, $props, $setup, $data, $options) {
  33859. const _component_el_tooltip = vue.resolveComponent("el-tooltip");
  33860. return vue.openBlock(), vue.createElementBlock("li", {
  33861. class: vue.normalizeClass([
  33862. _ctx.nsMenuItem.b(),
  33863. _ctx.nsMenuItem.is("active", _ctx.active),
  33864. _ctx.nsMenuItem.is("disabled", _ctx.disabled)
  33865. ]),
  33866. role: "menuitem",
  33867. tabindex: "-1",
  33868. onClick: _ctx.handleClick
  33869. }, [
  33870. _ctx.parentMenu.type.name === "ElMenu" && _ctx.rootMenu.props.collapse && _ctx.$slots.title ? (vue.openBlock(), vue.createBlock(_component_el_tooltip, {
  33871. key: 0,
  33872. effect: _ctx.rootMenu.props.popperEffect,
  33873. placement: "right",
  33874. "fallback-placements": ["left"],
  33875. persistent: ""
  33876. }, {
  33877. content: vue.withCtx(() => [
  33878. vue.renderSlot(_ctx.$slots, "title")
  33879. ]),
  33880. default: vue.withCtx(() => [
  33881. vue.createElementVNode("div", {
  33882. class: vue.normalizeClass(_ctx.nsMenu.be("tooltip", "trigger"))
  33883. }, [
  33884. vue.renderSlot(_ctx.$slots, "default")
  33885. ], 2)
  33886. ]),
  33887. _: 3
  33888. }, 8, ["effect"])) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  33889. vue.renderSlot(_ctx.$slots, "default"),
  33890. vue.renderSlot(_ctx.$slots, "title")
  33891. ], 64))
  33892. ], 10, ["onClick"]);
  33893. }
  33894. var MenuItem = /* @__PURE__ */ _export_sfc(_sfc_main$14, [["render", _sfc_render$d], ["__file", "menu-item.vue"]]);
  33895. const menuItemGroupProps = {
  33896. title: String
  33897. };
  33898. const COMPONENT_NAME$a = "ElMenuItemGroup";
  33899. const _sfc_main$13 = vue.defineComponent({
  33900. name: COMPONENT_NAME$a,
  33901. props: menuItemGroupProps,
  33902. setup() {
  33903. const ns = useNamespace("menu-item-group");
  33904. return {
  33905. ns
  33906. };
  33907. }
  33908. });
  33909. function _sfc_render$c(_ctx, _cache, $props, $setup, $data, $options) {
  33910. return vue.openBlock(), vue.createElementBlock("li", {
  33911. class: vue.normalizeClass(_ctx.ns.b())
  33912. }, [
  33913. vue.createElementVNode("div", {
  33914. class: vue.normalizeClass(_ctx.ns.e("title"))
  33915. }, [
  33916. !_ctx.$slots.title ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  33917. vue.createTextVNode(vue.toDisplayString(_ctx.title), 1)
  33918. ], 64)) : vue.renderSlot(_ctx.$slots, "title", { key: 1 })
  33919. ], 2),
  33920. vue.createElementVNode("ul", null, [
  33921. vue.renderSlot(_ctx.$slots, "default")
  33922. ])
  33923. ], 2);
  33924. }
  33925. var MenuItemGroup = /* @__PURE__ */ _export_sfc(_sfc_main$13, [["render", _sfc_render$c], ["__file", "menu-item-group.vue"]]);
  33926. const ElMenu = withInstall(Menu, {
  33927. MenuItem,
  33928. MenuItemGroup,
  33929. SubMenu
  33930. });
  33931. const ElMenuItem = withNoopInstall(MenuItem);
  33932. const ElMenuItemGroup = withNoopInstall(MenuItemGroup);
  33933. const ElSubMenu = withNoopInstall(SubMenu);
  33934. const pageHeaderProps = buildProps({
  33935. icon: {
  33936. type: iconPropType,
  33937. default: () => back_default
  33938. },
  33939. title: String,
  33940. content: {
  33941. type: String,
  33942. default: ""
  33943. }
  33944. });
  33945. const pageHeaderEmits = {
  33946. back: () => true
  33947. };
  33948. const __default__$Q = vue.defineComponent({
  33949. name: "ElPageHeader"
  33950. });
  33951. const _sfc_main$12 = /* @__PURE__ */ vue.defineComponent({
  33952. ...__default__$Q,
  33953. props: pageHeaderProps,
  33954. emits: pageHeaderEmits,
  33955. setup(__props, { emit }) {
  33956. const slots = vue.useSlots();
  33957. const { t } = useLocale();
  33958. const ns = useNamespace("page-header");
  33959. const kls = vue.computed(() => {
  33960. return [
  33961. ns.b(),
  33962. {
  33963. [ns.m("has-breadcrumb")]: !!slots.breadcrumb,
  33964. [ns.m("has-extra")]: !!slots.extra,
  33965. [ns.is("contentful")]: !!slots.default
  33966. }
  33967. ];
  33968. });
  33969. function handleClick() {
  33970. emit("back");
  33971. }
  33972. return (_ctx, _cache) => {
  33973. return vue.openBlock(), vue.createElementBlock("div", {
  33974. class: vue.normalizeClass(vue.unref(kls))
  33975. }, [
  33976. _ctx.$slots.breadcrumb ? (vue.openBlock(), vue.createElementBlock("div", {
  33977. key: 0,
  33978. class: vue.normalizeClass(vue.unref(ns).e("breadcrumb"))
  33979. }, [
  33980. vue.renderSlot(_ctx.$slots, "breadcrumb")
  33981. ], 2)) : vue.createCommentVNode("v-if", true),
  33982. vue.createElementVNode("div", {
  33983. class: vue.normalizeClass(vue.unref(ns).e("header"))
  33984. }, [
  33985. vue.createElementVNode("div", {
  33986. class: vue.normalizeClass(vue.unref(ns).e("left"))
  33987. }, [
  33988. vue.createElementVNode("div", {
  33989. class: vue.normalizeClass(vue.unref(ns).e("back")),
  33990. role: "button",
  33991. tabindex: "0",
  33992. onClick: handleClick
  33993. }, [
  33994. _ctx.icon || _ctx.$slots.icon ? (vue.openBlock(), vue.createElementBlock("div", {
  33995. key: 0,
  33996. "aria-label": _ctx.title || vue.unref(t)("el.pageHeader.title"),
  33997. class: vue.normalizeClass(vue.unref(ns).e("icon"))
  33998. }, [
  33999. vue.renderSlot(_ctx.$slots, "icon", {}, () => [
  34000. _ctx.icon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 0 }, {
  34001. default: vue.withCtx(() => [
  34002. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.icon)))
  34003. ]),
  34004. _: 1
  34005. })) : vue.createCommentVNode("v-if", true)
  34006. ])
  34007. ], 10, ["aria-label"])) : vue.createCommentVNode("v-if", true),
  34008. vue.createElementVNode("div", {
  34009. class: vue.normalizeClass(vue.unref(ns).e("title"))
  34010. }, [
  34011. vue.renderSlot(_ctx.$slots, "title", {}, () => [
  34012. vue.createTextVNode(vue.toDisplayString(_ctx.title || vue.unref(t)("el.pageHeader.title")), 1)
  34013. ])
  34014. ], 2)
  34015. ], 2),
  34016. vue.createVNode(vue.unref(ElDivider), { direction: "vertical" }),
  34017. vue.createElementVNode("div", {
  34018. class: vue.normalizeClass(vue.unref(ns).e("content"))
  34019. }, [
  34020. vue.renderSlot(_ctx.$slots, "content", {}, () => [
  34021. vue.createTextVNode(vue.toDisplayString(_ctx.content), 1)
  34022. ])
  34023. ], 2)
  34024. ], 2),
  34025. _ctx.$slots.extra ? (vue.openBlock(), vue.createElementBlock("div", {
  34026. key: 0,
  34027. class: vue.normalizeClass(vue.unref(ns).e("extra"))
  34028. }, [
  34029. vue.renderSlot(_ctx.$slots, "extra")
  34030. ], 2)) : vue.createCommentVNode("v-if", true)
  34031. ], 2),
  34032. _ctx.$slots.default ? (vue.openBlock(), vue.createElementBlock("div", {
  34033. key: 1,
  34034. class: vue.normalizeClass(vue.unref(ns).e("main"))
  34035. }, [
  34036. vue.renderSlot(_ctx.$slots, "default")
  34037. ], 2)) : vue.createCommentVNode("v-if", true)
  34038. ], 2);
  34039. };
  34040. }
  34041. });
  34042. var PageHeader = /* @__PURE__ */ _export_sfc(_sfc_main$12, [["__file", "page-header.vue"]]);
  34043. const ElPageHeader = withInstall(PageHeader);
  34044. const elPaginationKey = Symbol("elPaginationKey");
  34045. const paginationPrevProps = buildProps({
  34046. disabled: Boolean,
  34047. currentPage: {
  34048. type: Number,
  34049. default: 1
  34050. },
  34051. prevText: {
  34052. type: String
  34053. },
  34054. prevIcon: {
  34055. type: iconPropType
  34056. }
  34057. });
  34058. const paginationPrevEmits = {
  34059. click: (evt) => evt instanceof MouseEvent
  34060. };
  34061. const __default__$P = vue.defineComponent({
  34062. name: "ElPaginationPrev"
  34063. });
  34064. const _sfc_main$11 = /* @__PURE__ */ vue.defineComponent({
  34065. ...__default__$P,
  34066. props: paginationPrevProps,
  34067. emits: paginationPrevEmits,
  34068. setup(__props) {
  34069. const props = __props;
  34070. const { t } = useLocale();
  34071. const internalDisabled = vue.computed(() => props.disabled || props.currentPage <= 1);
  34072. return (_ctx, _cache) => {
  34073. return vue.openBlock(), vue.createElementBlock("button", {
  34074. type: "button",
  34075. class: "btn-prev",
  34076. disabled: vue.unref(internalDisabled),
  34077. "aria-label": _ctx.prevText || vue.unref(t)("el.pagination.prev"),
  34078. "aria-disabled": vue.unref(internalDisabled),
  34079. onClick: ($event) => _ctx.$emit("click", $event)
  34080. }, [
  34081. _ctx.prevText ? (vue.openBlock(), vue.createElementBlock("span", { key: 0 }, vue.toDisplayString(_ctx.prevText), 1)) : (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 1 }, {
  34082. default: vue.withCtx(() => [
  34083. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.prevIcon)))
  34084. ]),
  34085. _: 1
  34086. }))
  34087. ], 8, ["disabled", "aria-label", "aria-disabled", "onClick"]);
  34088. };
  34089. }
  34090. });
  34091. var Prev = /* @__PURE__ */ _export_sfc(_sfc_main$11, [["__file", "prev.vue"]]);
  34092. const paginationNextProps = buildProps({
  34093. disabled: Boolean,
  34094. currentPage: {
  34095. type: Number,
  34096. default: 1
  34097. },
  34098. pageCount: {
  34099. type: Number,
  34100. default: 50
  34101. },
  34102. nextText: {
  34103. type: String
  34104. },
  34105. nextIcon: {
  34106. type: iconPropType
  34107. }
  34108. });
  34109. const __default__$O = vue.defineComponent({
  34110. name: "ElPaginationNext"
  34111. });
  34112. const _sfc_main$10 = /* @__PURE__ */ vue.defineComponent({
  34113. ...__default__$O,
  34114. props: paginationNextProps,
  34115. emits: ["click"],
  34116. setup(__props) {
  34117. const props = __props;
  34118. const { t } = useLocale();
  34119. const internalDisabled = vue.computed(() => props.disabled || props.currentPage === props.pageCount || props.pageCount === 0);
  34120. return (_ctx, _cache) => {
  34121. return vue.openBlock(), vue.createElementBlock("button", {
  34122. type: "button",
  34123. class: "btn-next",
  34124. disabled: vue.unref(internalDisabled),
  34125. "aria-label": _ctx.nextText || vue.unref(t)("el.pagination.next"),
  34126. "aria-disabled": vue.unref(internalDisabled),
  34127. onClick: ($event) => _ctx.$emit("click", $event)
  34128. }, [
  34129. _ctx.nextText ? (vue.openBlock(), vue.createElementBlock("span", { key: 0 }, vue.toDisplayString(_ctx.nextText), 1)) : (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 1 }, {
  34130. default: vue.withCtx(() => [
  34131. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.nextIcon)))
  34132. ]),
  34133. _: 1
  34134. }))
  34135. ], 8, ["disabled", "aria-label", "aria-disabled", "onClick"]);
  34136. };
  34137. }
  34138. });
  34139. var Next = /* @__PURE__ */ _export_sfc(_sfc_main$10, [["__file", "next.vue"]]);
  34140. const selectGroupKey = Symbol("ElSelectGroup");
  34141. const selectKey = Symbol("ElSelect");
  34142. function useOption$1(props, states) {
  34143. const select = vue.inject(selectKey);
  34144. const selectGroup = vue.inject(selectGroupKey, { disabled: false });
  34145. const itemSelected = vue.computed(() => {
  34146. return contains(castArray$1(select.props.modelValue), props.value);
  34147. });
  34148. const limitReached = vue.computed(() => {
  34149. var _a;
  34150. if (select.props.multiple) {
  34151. const modelValue = castArray$1((_a = select.props.modelValue) != null ? _a : []);
  34152. return !itemSelected.value && modelValue.length >= select.props.multipleLimit && select.props.multipleLimit > 0;
  34153. } else {
  34154. return false;
  34155. }
  34156. });
  34157. const currentLabel = vue.computed(() => {
  34158. return props.label || (isObject$1(props.value) ? "" : props.value);
  34159. });
  34160. const currentValue = vue.computed(() => {
  34161. return props.value || props.label || "";
  34162. });
  34163. const isDisabled = vue.computed(() => {
  34164. return props.disabled || states.groupDisabled || limitReached.value;
  34165. });
  34166. const instance = vue.getCurrentInstance();
  34167. const contains = (arr = [], target) => {
  34168. if (!isObject$1(props.value)) {
  34169. return arr && arr.includes(target);
  34170. } else {
  34171. const valueKey = select.props.valueKey;
  34172. return arr && arr.some((item) => {
  34173. return vue.toRaw(get(item, valueKey)) === get(target, valueKey);
  34174. });
  34175. }
  34176. };
  34177. const hoverItem = () => {
  34178. if (!props.disabled && !selectGroup.disabled) {
  34179. select.states.hoveringIndex = select.optionsArray.indexOf(instance.proxy);
  34180. }
  34181. };
  34182. const updateOption = (query) => {
  34183. const regexp = new RegExp(escapeStringRegexp(query), "i");
  34184. states.visible = regexp.test(currentLabel.value) || props.created;
  34185. };
  34186. vue.watch(() => currentLabel.value, () => {
  34187. if (!props.created && !select.props.remote)
  34188. select.setSelected();
  34189. });
  34190. vue.watch(() => props.value, (val, oldVal) => {
  34191. const { remote, valueKey } = select.props;
  34192. if (val !== oldVal) {
  34193. select.onOptionDestroy(oldVal, instance.proxy);
  34194. select.onOptionCreate(instance.proxy);
  34195. }
  34196. if (!props.created && !remote) {
  34197. if (valueKey && isObject$1(val) && isObject$1(oldVal) && val[valueKey] === oldVal[valueKey]) {
  34198. return;
  34199. }
  34200. select.setSelected();
  34201. }
  34202. });
  34203. vue.watch(() => selectGroup.disabled, () => {
  34204. states.groupDisabled = selectGroup.disabled;
  34205. }, { immediate: true });
  34206. return {
  34207. select,
  34208. currentLabel,
  34209. currentValue,
  34210. itemSelected,
  34211. isDisabled,
  34212. hoverItem,
  34213. updateOption
  34214. };
  34215. }
  34216. const _sfc_main$$ = vue.defineComponent({
  34217. name: "ElOption",
  34218. componentName: "ElOption",
  34219. props: {
  34220. value: {
  34221. required: true,
  34222. type: [String, Number, Boolean, Object]
  34223. },
  34224. label: [String, Number],
  34225. created: Boolean,
  34226. disabled: Boolean
  34227. },
  34228. setup(props) {
  34229. const ns = useNamespace("select");
  34230. const id = useId();
  34231. const containerKls = vue.computed(() => [
  34232. ns.be("dropdown", "item"),
  34233. ns.is("disabled", vue.unref(isDisabled)),
  34234. ns.is("selected", vue.unref(itemSelected)),
  34235. ns.is("hovering", vue.unref(hover))
  34236. ]);
  34237. const states = vue.reactive({
  34238. index: -1,
  34239. groupDisabled: false,
  34240. visible: true,
  34241. hover: false
  34242. });
  34243. const {
  34244. currentLabel,
  34245. itemSelected,
  34246. isDisabled,
  34247. select,
  34248. hoverItem,
  34249. updateOption
  34250. } = useOption$1(props, states);
  34251. const { visible, hover } = vue.toRefs(states);
  34252. const vm = vue.getCurrentInstance().proxy;
  34253. select.onOptionCreate(vm);
  34254. vue.onBeforeUnmount(() => {
  34255. const key = vm.value;
  34256. const { selected: selectedOptions } = select.states;
  34257. const doesSelected = selectedOptions.some((item) => {
  34258. return item.value === vm.value;
  34259. });
  34260. vue.nextTick(() => {
  34261. if (select.states.cachedOptions.get(key) === vm && !doesSelected) {
  34262. select.states.cachedOptions.delete(key);
  34263. }
  34264. });
  34265. select.onOptionDestroy(key, vm);
  34266. });
  34267. function selectOptionClick() {
  34268. if (!isDisabled.value) {
  34269. select.handleOptionSelect(vm);
  34270. }
  34271. }
  34272. return {
  34273. ns,
  34274. id,
  34275. containerKls,
  34276. currentLabel,
  34277. itemSelected,
  34278. isDisabled,
  34279. select,
  34280. hoverItem,
  34281. updateOption,
  34282. visible,
  34283. hover,
  34284. selectOptionClick,
  34285. states
  34286. };
  34287. }
  34288. });
  34289. function _sfc_render$b(_ctx, _cache, $props, $setup, $data, $options) {
  34290. return vue.withDirectives((vue.openBlock(), vue.createElementBlock("li", {
  34291. id: _ctx.id,
  34292. class: vue.normalizeClass(_ctx.containerKls),
  34293. role: "option",
  34294. "aria-disabled": _ctx.isDisabled || void 0,
  34295. "aria-selected": _ctx.itemSelected,
  34296. onMousemove: _ctx.hoverItem,
  34297. onClick: vue.withModifiers(_ctx.selectOptionClick, ["stop"])
  34298. }, [
  34299. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  34300. vue.createElementVNode("span", null, vue.toDisplayString(_ctx.currentLabel), 1)
  34301. ])
  34302. ], 42, ["id", "aria-disabled", "aria-selected", "onMousemove", "onClick"])), [
  34303. [vue.vShow, _ctx.visible]
  34304. ]);
  34305. }
  34306. var Option = /* @__PURE__ */ _export_sfc(_sfc_main$$, [["render", _sfc_render$b], ["__file", "option.vue"]]);
  34307. const _sfc_main$_ = vue.defineComponent({
  34308. name: "ElSelectDropdown",
  34309. componentName: "ElSelectDropdown",
  34310. setup() {
  34311. const select = vue.inject(selectKey);
  34312. const ns = useNamespace("select");
  34313. const popperClass = vue.computed(() => select.props.popperClass);
  34314. const isMultiple = vue.computed(() => select.props.multiple);
  34315. const isFitInputWidth = vue.computed(() => select.props.fitInputWidth);
  34316. const minWidth = vue.ref("");
  34317. function updateMinWidth() {
  34318. var _a;
  34319. minWidth.value = `${(_a = select.selectRef) == null ? void 0 : _a.offsetWidth}px`;
  34320. }
  34321. vue.onMounted(() => {
  34322. updateMinWidth();
  34323. useResizeObserver(select.selectRef, updateMinWidth);
  34324. });
  34325. return {
  34326. ns,
  34327. minWidth,
  34328. popperClass,
  34329. isMultiple,
  34330. isFitInputWidth
  34331. };
  34332. }
  34333. });
  34334. function _sfc_render$a(_ctx, _cache, $props, $setup, $data, $options) {
  34335. return vue.openBlock(), vue.createElementBlock("div", {
  34336. class: vue.normalizeClass([_ctx.ns.b("dropdown"), _ctx.ns.is("multiple", _ctx.isMultiple), _ctx.popperClass]),
  34337. style: vue.normalizeStyle({ [_ctx.isFitInputWidth ? "width" : "minWidth"]: _ctx.minWidth })
  34338. }, [
  34339. _ctx.$slots.header ? (vue.openBlock(), vue.createElementBlock("div", {
  34340. key: 0,
  34341. class: vue.normalizeClass(_ctx.ns.be("dropdown", "header"))
  34342. }, [
  34343. vue.renderSlot(_ctx.$slots, "header")
  34344. ], 2)) : vue.createCommentVNode("v-if", true),
  34345. vue.renderSlot(_ctx.$slots, "default"),
  34346. _ctx.$slots.footer ? (vue.openBlock(), vue.createElementBlock("div", {
  34347. key: 1,
  34348. class: vue.normalizeClass(_ctx.ns.be("dropdown", "footer"))
  34349. }, [
  34350. vue.renderSlot(_ctx.$slots, "footer")
  34351. ], 2)) : vue.createCommentVNode("v-if", true)
  34352. ], 6);
  34353. }
  34354. var ElSelectMenu$1 = /* @__PURE__ */ _export_sfc(_sfc_main$_, [["render", _sfc_render$a], ["__file", "select-dropdown.vue"]]);
  34355. const MINIMUM_INPUT_WIDTH$1 = 11;
  34356. const useSelect$3 = (props, emit) => {
  34357. const { t } = useLocale();
  34358. const contentId = useId();
  34359. const nsSelect = useNamespace("select");
  34360. const nsInput = useNamespace("input");
  34361. const states = vue.reactive({
  34362. inputValue: "",
  34363. options: /* @__PURE__ */ new Map(),
  34364. cachedOptions: /* @__PURE__ */ new Map(),
  34365. optionValues: [],
  34366. selected: [],
  34367. selectionWidth: 0,
  34368. calculatorWidth: 0,
  34369. collapseItemWidth: 0,
  34370. selectedLabel: "",
  34371. hoveringIndex: -1,
  34372. previousQuery: null,
  34373. inputHovering: false,
  34374. menuVisibleOnFocus: false,
  34375. isBeforeHide: false
  34376. });
  34377. const selectRef = vue.ref(null);
  34378. const selectionRef = vue.ref(null);
  34379. const tooltipRef = vue.ref(null);
  34380. const tagTooltipRef = vue.ref(null);
  34381. const inputRef = vue.ref(null);
  34382. const calculatorRef = vue.ref(null);
  34383. const prefixRef = vue.ref(null);
  34384. const suffixRef = vue.ref(null);
  34385. const menuRef = vue.ref(null);
  34386. const tagMenuRef = vue.ref(null);
  34387. const collapseItemRef = vue.ref(null);
  34388. const scrollbarRef = vue.ref(null);
  34389. const {
  34390. isComposing,
  34391. handleCompositionStart,
  34392. handleCompositionUpdate,
  34393. handleCompositionEnd
  34394. } = useComposition({
  34395. afterComposition: (e) => onInput(e)
  34396. });
  34397. const { wrapperRef, isFocused, handleBlur } = useFocusController(inputRef, {
  34398. beforeFocus() {
  34399. return selectDisabled.value;
  34400. },
  34401. afterFocus() {
  34402. if (props.automaticDropdown && !expanded.value) {
  34403. expanded.value = true;
  34404. states.menuVisibleOnFocus = true;
  34405. }
  34406. },
  34407. beforeBlur(event) {
  34408. var _a, _b;
  34409. return ((_a = tooltipRef.value) == null ? void 0 : _a.isFocusInsideContent(event)) || ((_b = tagTooltipRef.value) == null ? void 0 : _b.isFocusInsideContent(event));
  34410. },
  34411. afterBlur() {
  34412. expanded.value = false;
  34413. states.menuVisibleOnFocus = false;
  34414. }
  34415. });
  34416. const expanded = vue.ref(false);
  34417. const hoverOption = vue.ref();
  34418. const { form, formItem } = useFormItem();
  34419. const { inputId } = useFormItemInputId(props, {
  34420. formItemContext: formItem
  34421. });
  34422. const { valueOnClear, isEmptyValue } = useEmptyValues(props);
  34423. const selectDisabled = vue.computed(() => props.disabled || (form == null ? void 0 : form.disabled));
  34424. const hasModelValue = vue.computed(() => {
  34425. return isArray$1(props.modelValue) ? props.modelValue.length > 0 : !isEmptyValue(props.modelValue);
  34426. });
  34427. const needStatusIcon = vue.computed(() => {
  34428. var _a;
  34429. return (_a = form == null ? void 0 : form.statusIcon) != null ? _a : false;
  34430. });
  34431. const showClose = vue.computed(() => {
  34432. return props.clearable && !selectDisabled.value && states.inputHovering && hasModelValue.value;
  34433. });
  34434. const iconComponent = vue.computed(() => props.remote && props.filterable && !props.remoteShowSuffix ? "" : props.suffixIcon);
  34435. const iconReverse = vue.computed(() => nsSelect.is("reverse", iconComponent.value && expanded.value));
  34436. const validateState = vue.computed(() => (formItem == null ? void 0 : formItem.validateState) || "");
  34437. const validateIcon = vue.computed(() => ValidateComponentsMap[validateState.value]);
  34438. const debounce$1 = vue.computed(() => props.remote ? 300 : 0);
  34439. const emptyText = vue.computed(() => {
  34440. if (props.loading) {
  34441. return props.loadingText || t("el.select.loading");
  34442. } else {
  34443. if (props.remote && !states.inputValue && states.options.size === 0)
  34444. return false;
  34445. if (props.filterable && states.inputValue && states.options.size > 0 && filteredOptionsCount.value === 0) {
  34446. return props.noMatchText || t("el.select.noMatch");
  34447. }
  34448. if (states.options.size === 0) {
  34449. return props.noDataText || t("el.select.noData");
  34450. }
  34451. }
  34452. return null;
  34453. });
  34454. const filteredOptionsCount = vue.computed(() => optionsArray.value.filter((option) => option.visible).length);
  34455. const optionsArray = vue.computed(() => {
  34456. const list = Array.from(states.options.values());
  34457. const newList = [];
  34458. states.optionValues.forEach((item) => {
  34459. const index = list.findIndex((i) => i.value === item);
  34460. if (index > -1) {
  34461. newList.push(list[index]);
  34462. }
  34463. });
  34464. return newList.length >= list.length ? newList : list;
  34465. });
  34466. const cachedOptionsArray = vue.computed(() => Array.from(states.cachedOptions.values()));
  34467. const showNewOption = vue.computed(() => {
  34468. const hasExistingOption = optionsArray.value.filter((option) => {
  34469. return !option.created;
  34470. }).some((option) => {
  34471. return option.currentLabel === states.inputValue;
  34472. });
  34473. return props.filterable && props.allowCreate && states.inputValue !== "" && !hasExistingOption;
  34474. });
  34475. const updateOptions = () => {
  34476. if (props.filterable && isFunction$1(props.filterMethod))
  34477. return;
  34478. if (props.filterable && props.remote && isFunction$1(props.remoteMethod))
  34479. return;
  34480. optionsArray.value.forEach((option) => {
  34481. var _a;
  34482. (_a = option.updateOption) == null ? void 0 : _a.call(option, states.inputValue);
  34483. });
  34484. };
  34485. const selectSize = useFormSize();
  34486. const collapseTagSize = vue.computed(() => ["small"].includes(selectSize.value) ? "small" : "default");
  34487. const dropdownMenuVisible = vue.computed({
  34488. get() {
  34489. return expanded.value && emptyText.value !== false;
  34490. },
  34491. set(val) {
  34492. expanded.value = val;
  34493. }
  34494. });
  34495. const shouldShowPlaceholder = vue.computed(() => {
  34496. if (props.multiple && !isUndefined(props.modelValue)) {
  34497. return castArray$1(props.modelValue).length === 0 && !states.inputValue;
  34498. }
  34499. const value = isArray$1(props.modelValue) ? props.modelValue[0] : props.modelValue;
  34500. return props.filterable || isUndefined(value) ? !states.inputValue : true;
  34501. });
  34502. const currentPlaceholder = vue.computed(() => {
  34503. var _a;
  34504. const _placeholder = (_a = props.placeholder) != null ? _a : t("el.select.placeholder");
  34505. return props.multiple || !hasModelValue.value ? _placeholder : states.selectedLabel;
  34506. });
  34507. const mouseEnterEventName = vue.computed(() => isIOS ? null : "mouseenter");
  34508. vue.watch(() => props.modelValue, (val, oldVal) => {
  34509. if (props.multiple) {
  34510. if (props.filterable && !props.reserveKeyword) {
  34511. states.inputValue = "";
  34512. handleQueryChange("");
  34513. }
  34514. }
  34515. setSelected();
  34516. if (!isEqual$1(val, oldVal) && props.validateEvent) {
  34517. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
  34518. }
  34519. }, {
  34520. flush: "post",
  34521. deep: true
  34522. });
  34523. vue.watch(() => expanded.value, (val) => {
  34524. if (val) {
  34525. handleQueryChange(states.inputValue);
  34526. } else {
  34527. states.inputValue = "";
  34528. states.previousQuery = null;
  34529. states.isBeforeHide = true;
  34530. }
  34531. emit("visible-change", val);
  34532. });
  34533. vue.watch(() => states.options.entries(), () => {
  34534. if (!isClient)
  34535. return;
  34536. setSelected();
  34537. if (props.defaultFirstOption && (props.filterable || props.remote) && filteredOptionsCount.value) {
  34538. checkDefaultFirstOption();
  34539. }
  34540. }, {
  34541. flush: "post"
  34542. });
  34543. vue.watch(() => states.hoveringIndex, (val) => {
  34544. if (isNumber(val) && val > -1) {
  34545. hoverOption.value = optionsArray.value[val] || {};
  34546. } else {
  34547. hoverOption.value = {};
  34548. }
  34549. optionsArray.value.forEach((option) => {
  34550. option.hover = hoverOption.value === option;
  34551. });
  34552. });
  34553. vue.watchEffect(() => {
  34554. if (states.isBeforeHide)
  34555. return;
  34556. updateOptions();
  34557. });
  34558. const handleQueryChange = (val) => {
  34559. if (states.previousQuery === val || isComposing.value) {
  34560. return;
  34561. }
  34562. states.previousQuery = val;
  34563. if (props.filterable && isFunction$1(props.filterMethod)) {
  34564. props.filterMethod(val);
  34565. } else if (props.filterable && props.remote && isFunction$1(props.remoteMethod)) {
  34566. props.remoteMethod(val);
  34567. }
  34568. if (props.defaultFirstOption && (props.filterable || props.remote) && filteredOptionsCount.value) {
  34569. vue.nextTick(checkDefaultFirstOption);
  34570. } else {
  34571. vue.nextTick(updateHoveringIndex);
  34572. }
  34573. };
  34574. const checkDefaultFirstOption = () => {
  34575. const optionsInDropdown = optionsArray.value.filter((n) => n.visible && !n.disabled && !n.states.groupDisabled);
  34576. const userCreatedOption = optionsInDropdown.find((n) => n.created);
  34577. const firstOriginOption = optionsInDropdown[0];
  34578. const valueList = optionsArray.value.map((item) => item.value);
  34579. states.hoveringIndex = getValueIndex(valueList, userCreatedOption || firstOriginOption);
  34580. };
  34581. const setSelected = () => {
  34582. if (!props.multiple) {
  34583. const value = isArray$1(props.modelValue) ? props.modelValue[0] : props.modelValue;
  34584. const option = getOption(value);
  34585. states.selectedLabel = option.currentLabel;
  34586. states.selected = [option];
  34587. return;
  34588. } else {
  34589. states.selectedLabel = "";
  34590. }
  34591. const result = [];
  34592. if (!isUndefined(props.modelValue)) {
  34593. castArray$1(props.modelValue).forEach((value) => {
  34594. result.push(getOption(value));
  34595. });
  34596. }
  34597. states.selected = result;
  34598. };
  34599. const getOption = (value) => {
  34600. let option;
  34601. const isObjectValue = isPlainObject$1(value);
  34602. for (let i = states.cachedOptions.size - 1; i >= 0; i--) {
  34603. const cachedOption = cachedOptionsArray.value[i];
  34604. const isEqualValue = isObjectValue ? get(cachedOption.value, props.valueKey) === get(value, props.valueKey) : cachedOption.value === value;
  34605. if (isEqualValue) {
  34606. option = {
  34607. value,
  34608. currentLabel: cachedOption.currentLabel,
  34609. get isDisabled() {
  34610. return cachedOption.isDisabled;
  34611. }
  34612. };
  34613. break;
  34614. }
  34615. }
  34616. if (option)
  34617. return option;
  34618. const label = isObjectValue ? value.label : value != null ? value : "";
  34619. const newOption = {
  34620. value,
  34621. currentLabel: label
  34622. };
  34623. return newOption;
  34624. };
  34625. const updateHoveringIndex = () => {
  34626. states.hoveringIndex = optionsArray.value.findIndex((item) => states.selected.some((selected) => getValueKey(selected) === getValueKey(item)));
  34627. };
  34628. const resetSelectionWidth = () => {
  34629. states.selectionWidth = selectionRef.value.getBoundingClientRect().width;
  34630. };
  34631. const resetCalculatorWidth = () => {
  34632. states.calculatorWidth = calculatorRef.value.getBoundingClientRect().width;
  34633. };
  34634. const resetCollapseItemWidth = () => {
  34635. states.collapseItemWidth = collapseItemRef.value.getBoundingClientRect().width;
  34636. };
  34637. const updateTooltip = () => {
  34638. var _a, _b;
  34639. (_b = (_a = tooltipRef.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a);
  34640. };
  34641. const updateTagTooltip = () => {
  34642. var _a, _b;
  34643. (_b = (_a = tagTooltipRef.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a);
  34644. };
  34645. const onInputChange = () => {
  34646. if (states.inputValue.length > 0 && !expanded.value) {
  34647. expanded.value = true;
  34648. }
  34649. handleQueryChange(states.inputValue);
  34650. };
  34651. const onInput = (event) => {
  34652. states.inputValue = event.target.value;
  34653. if (props.remote) {
  34654. debouncedOnInputChange();
  34655. } else {
  34656. return onInputChange();
  34657. }
  34658. };
  34659. const debouncedOnInputChange = debounce(() => {
  34660. onInputChange();
  34661. }, debounce$1.value);
  34662. const emitChange = (val) => {
  34663. if (!isEqual$1(props.modelValue, val)) {
  34664. emit(CHANGE_EVENT, val);
  34665. }
  34666. };
  34667. const getLastNotDisabledIndex = (value) => findLastIndex(value, (it) => {
  34668. const option = states.cachedOptions.get(it);
  34669. return option && !option.disabled && !option.states.groupDisabled;
  34670. });
  34671. const deletePrevTag = (e) => {
  34672. if (!props.multiple)
  34673. return;
  34674. if (e.code === EVENT_CODE.delete)
  34675. return;
  34676. if (e.target.value.length <= 0) {
  34677. const value = castArray$1(props.modelValue).slice();
  34678. const lastNotDisabledIndex = getLastNotDisabledIndex(value);
  34679. if (lastNotDisabledIndex < 0)
  34680. return;
  34681. const removeTagValue = value[lastNotDisabledIndex];
  34682. value.splice(lastNotDisabledIndex, 1);
  34683. emit(UPDATE_MODEL_EVENT, value);
  34684. emitChange(value);
  34685. emit("remove-tag", removeTagValue);
  34686. }
  34687. };
  34688. const deleteTag = (event, tag) => {
  34689. const index = states.selected.indexOf(tag);
  34690. if (index > -1 && !selectDisabled.value) {
  34691. const value = castArray$1(props.modelValue).slice();
  34692. value.splice(index, 1);
  34693. emit(UPDATE_MODEL_EVENT, value);
  34694. emitChange(value);
  34695. emit("remove-tag", tag.value);
  34696. }
  34697. event.stopPropagation();
  34698. focus();
  34699. };
  34700. const deleteSelected = (event) => {
  34701. event.stopPropagation();
  34702. const value = props.multiple ? [] : valueOnClear.value;
  34703. if (props.multiple) {
  34704. for (const item of states.selected) {
  34705. if (item.isDisabled)
  34706. value.push(item.value);
  34707. }
  34708. }
  34709. emit(UPDATE_MODEL_EVENT, value);
  34710. emitChange(value);
  34711. states.hoveringIndex = -1;
  34712. expanded.value = false;
  34713. emit("clear");
  34714. focus();
  34715. };
  34716. const handleOptionSelect = (option) => {
  34717. var _a;
  34718. if (props.multiple) {
  34719. const value = castArray$1((_a = props.modelValue) != null ? _a : []).slice();
  34720. const optionIndex = getValueIndex(value, option);
  34721. if (optionIndex > -1) {
  34722. value.splice(optionIndex, 1);
  34723. } else if (props.multipleLimit <= 0 || value.length < props.multipleLimit) {
  34724. value.push(option.value);
  34725. }
  34726. emit(UPDATE_MODEL_EVENT, value);
  34727. emitChange(value);
  34728. if (option.created) {
  34729. handleQueryChange("");
  34730. }
  34731. if (props.filterable && !props.reserveKeyword) {
  34732. states.inputValue = "";
  34733. }
  34734. } else {
  34735. emit(UPDATE_MODEL_EVENT, option.value);
  34736. emitChange(option.value);
  34737. expanded.value = false;
  34738. }
  34739. focus();
  34740. if (expanded.value)
  34741. return;
  34742. vue.nextTick(() => {
  34743. scrollToOption(option);
  34744. });
  34745. };
  34746. const getValueIndex = (arr = [], option) => {
  34747. if (isUndefined(option))
  34748. return -1;
  34749. if (!isObject$1(option.value))
  34750. return arr.indexOf(option.value);
  34751. return arr.findIndex((item) => {
  34752. return isEqual$1(get(item, props.valueKey), getValueKey(option));
  34753. });
  34754. };
  34755. const scrollToOption = (option) => {
  34756. var _a, _b, _c, _d, _e;
  34757. const targetOption = isArray$1(option) ? option[0] : option;
  34758. let target = null;
  34759. if (targetOption == null ? void 0 : targetOption.value) {
  34760. const options = optionsArray.value.filter((item) => item.value === targetOption.value);
  34761. if (options.length > 0) {
  34762. target = options[0].$el;
  34763. }
  34764. }
  34765. if (tooltipRef.value && target) {
  34766. const menu = (_d = (_c = (_b = (_a = tooltipRef.value) == null ? void 0 : _a.popperRef) == null ? void 0 : _b.contentRef) == null ? void 0 : _c.querySelector) == null ? void 0 : _d.call(_c, `.${nsSelect.be("dropdown", "wrap")}`);
  34767. if (menu) {
  34768. scrollIntoView(menu, target);
  34769. }
  34770. }
  34771. (_e = scrollbarRef.value) == null ? void 0 : _e.handleScroll();
  34772. };
  34773. const onOptionCreate = (vm) => {
  34774. states.options.set(vm.value, vm);
  34775. states.cachedOptions.set(vm.value, vm);
  34776. };
  34777. const onOptionDestroy = (key, vm) => {
  34778. if (states.options.get(key) === vm) {
  34779. states.options.delete(key);
  34780. }
  34781. };
  34782. const popperRef = vue.computed(() => {
  34783. var _a, _b;
  34784. return (_b = (_a = tooltipRef.value) == null ? void 0 : _a.popperRef) == null ? void 0 : _b.contentRef;
  34785. });
  34786. const handleMenuEnter = () => {
  34787. states.isBeforeHide = false;
  34788. vue.nextTick(() => scrollToOption(states.selected));
  34789. };
  34790. const focus = () => {
  34791. var _a;
  34792. (_a = inputRef.value) == null ? void 0 : _a.focus();
  34793. };
  34794. const blur = () => {
  34795. var _a;
  34796. if (expanded.value) {
  34797. expanded.value = false;
  34798. vue.nextTick(() => {
  34799. var _a2;
  34800. return (_a2 = inputRef.value) == null ? void 0 : _a2.blur();
  34801. });
  34802. return;
  34803. }
  34804. (_a = inputRef.value) == null ? void 0 : _a.blur();
  34805. };
  34806. const handleClearClick = (event) => {
  34807. deleteSelected(event);
  34808. };
  34809. const handleClickOutside = (event) => {
  34810. expanded.value = false;
  34811. if (isFocused.value) {
  34812. const _event = new FocusEvent("focus", event);
  34813. vue.nextTick(() => handleBlur(_event));
  34814. }
  34815. };
  34816. const handleEsc = () => {
  34817. if (states.inputValue.length > 0) {
  34818. states.inputValue = "";
  34819. } else {
  34820. expanded.value = false;
  34821. }
  34822. };
  34823. const toggleMenu = () => {
  34824. if (selectDisabled.value)
  34825. return;
  34826. if (isIOS)
  34827. states.inputHovering = true;
  34828. if (states.menuVisibleOnFocus) {
  34829. states.menuVisibleOnFocus = false;
  34830. } else {
  34831. expanded.value = !expanded.value;
  34832. }
  34833. };
  34834. const selectOption = () => {
  34835. if (!expanded.value) {
  34836. toggleMenu();
  34837. } else {
  34838. const option = optionsArray.value[states.hoveringIndex];
  34839. if (option && !option.isDisabled) {
  34840. handleOptionSelect(option);
  34841. }
  34842. }
  34843. };
  34844. const getValueKey = (item) => {
  34845. return isObject$1(item.value) ? get(item.value, props.valueKey) : item.value;
  34846. };
  34847. const optionsAllDisabled = vue.computed(() => optionsArray.value.filter((option) => option.visible).every((option) => option.isDisabled));
  34848. const showTagList = vue.computed(() => {
  34849. if (!props.multiple) {
  34850. return [];
  34851. }
  34852. return props.collapseTags ? states.selected.slice(0, props.maxCollapseTags) : states.selected;
  34853. });
  34854. const collapseTagList = vue.computed(() => {
  34855. if (!props.multiple) {
  34856. return [];
  34857. }
  34858. return props.collapseTags ? states.selected.slice(props.maxCollapseTags) : [];
  34859. });
  34860. const navigateOptions = (direction) => {
  34861. if (!expanded.value) {
  34862. expanded.value = true;
  34863. return;
  34864. }
  34865. if (states.options.size === 0 || filteredOptionsCount.value === 0 || isComposing.value)
  34866. return;
  34867. if (!optionsAllDisabled.value) {
  34868. if (direction === "next") {
  34869. states.hoveringIndex++;
  34870. if (states.hoveringIndex === states.options.size) {
  34871. states.hoveringIndex = 0;
  34872. }
  34873. } else if (direction === "prev") {
  34874. states.hoveringIndex--;
  34875. if (states.hoveringIndex < 0) {
  34876. states.hoveringIndex = states.options.size - 1;
  34877. }
  34878. }
  34879. const option = optionsArray.value[states.hoveringIndex];
  34880. if (option.isDisabled || !option.visible) {
  34881. navigateOptions(direction);
  34882. }
  34883. vue.nextTick(() => scrollToOption(hoverOption.value));
  34884. }
  34885. };
  34886. const getGapWidth = () => {
  34887. if (!selectionRef.value)
  34888. return 0;
  34889. const style = window.getComputedStyle(selectionRef.value);
  34890. return Number.parseFloat(style.gap || "6px");
  34891. };
  34892. const tagStyle = vue.computed(() => {
  34893. const gapWidth = getGapWidth();
  34894. const maxWidth = collapseItemRef.value && props.maxCollapseTags === 1 ? states.selectionWidth - states.collapseItemWidth - gapWidth : states.selectionWidth;
  34895. return { maxWidth: `${maxWidth}px` };
  34896. });
  34897. const collapseTagStyle = vue.computed(() => {
  34898. return { maxWidth: `${states.selectionWidth}px` };
  34899. });
  34900. const inputStyle = vue.computed(() => ({
  34901. width: `${Math.max(states.calculatorWidth, MINIMUM_INPUT_WIDTH$1)}px`
  34902. }));
  34903. useResizeObserver(selectionRef, resetSelectionWidth);
  34904. useResizeObserver(calculatorRef, resetCalculatorWidth);
  34905. useResizeObserver(menuRef, updateTooltip);
  34906. useResizeObserver(wrapperRef, updateTooltip);
  34907. useResizeObserver(tagMenuRef, updateTagTooltip);
  34908. useResizeObserver(collapseItemRef, resetCollapseItemWidth);
  34909. vue.onMounted(() => {
  34910. setSelected();
  34911. });
  34912. return {
  34913. inputId,
  34914. contentId,
  34915. nsSelect,
  34916. nsInput,
  34917. states,
  34918. isFocused,
  34919. expanded,
  34920. optionsArray,
  34921. hoverOption,
  34922. selectSize,
  34923. filteredOptionsCount,
  34924. resetCalculatorWidth,
  34925. updateTooltip,
  34926. updateTagTooltip,
  34927. debouncedOnInputChange,
  34928. onInput,
  34929. deletePrevTag,
  34930. deleteTag,
  34931. deleteSelected,
  34932. handleOptionSelect,
  34933. scrollToOption,
  34934. hasModelValue,
  34935. shouldShowPlaceholder,
  34936. currentPlaceholder,
  34937. mouseEnterEventName,
  34938. needStatusIcon,
  34939. showClose,
  34940. iconComponent,
  34941. iconReverse,
  34942. validateState,
  34943. validateIcon,
  34944. showNewOption,
  34945. updateOptions,
  34946. collapseTagSize,
  34947. setSelected,
  34948. selectDisabled,
  34949. emptyText,
  34950. handleCompositionStart,
  34951. handleCompositionUpdate,
  34952. handleCompositionEnd,
  34953. onOptionCreate,
  34954. onOptionDestroy,
  34955. handleMenuEnter,
  34956. focus,
  34957. blur,
  34958. handleClearClick,
  34959. handleClickOutside,
  34960. handleEsc,
  34961. toggleMenu,
  34962. selectOption,
  34963. getValueKey,
  34964. navigateOptions,
  34965. dropdownMenuVisible,
  34966. showTagList,
  34967. collapseTagList,
  34968. tagStyle,
  34969. collapseTagStyle,
  34970. inputStyle,
  34971. popperRef,
  34972. inputRef,
  34973. tooltipRef,
  34974. tagTooltipRef,
  34975. calculatorRef,
  34976. prefixRef,
  34977. suffixRef,
  34978. selectRef,
  34979. wrapperRef,
  34980. selectionRef,
  34981. scrollbarRef,
  34982. menuRef,
  34983. tagMenuRef,
  34984. collapseItemRef
  34985. };
  34986. };
  34987. var ElOptions = vue.defineComponent({
  34988. name: "ElOptions",
  34989. setup(_, { slots }) {
  34990. const select = vue.inject(selectKey);
  34991. let cachedValueList = [];
  34992. return () => {
  34993. var _a, _b;
  34994. const children = (_a = slots.default) == null ? void 0 : _a.call(slots);
  34995. const valueList = [];
  34996. function filterOptions(children2) {
  34997. if (!isArray$1(children2))
  34998. return;
  34999. children2.forEach((item) => {
  35000. var _a2, _b2, _c, _d;
  35001. const name = (_a2 = (item == null ? void 0 : item.type) || {}) == null ? void 0 : _a2.name;
  35002. if (name === "ElOptionGroup") {
  35003. filterOptions(!isString$1(item.children) && !isArray$1(item.children) && isFunction$1((_b2 = item.children) == null ? void 0 : _b2.default) ? (_c = item.children) == null ? void 0 : _c.default() : item.children);
  35004. } else if (name === "ElOption") {
  35005. valueList.push((_d = item.props) == null ? void 0 : _d.value);
  35006. } else if (isArray$1(item.children)) {
  35007. filterOptions(item.children);
  35008. }
  35009. });
  35010. }
  35011. if (children.length) {
  35012. filterOptions((_b = children[0]) == null ? void 0 : _b.children);
  35013. }
  35014. if (!isEqual$1(valueList, cachedValueList)) {
  35015. cachedValueList = valueList;
  35016. if (select) {
  35017. select.states.optionValues = valueList;
  35018. }
  35019. }
  35020. return children;
  35021. };
  35022. }
  35023. });
  35024. const SelectProps$1 = buildProps({
  35025. name: String,
  35026. id: String,
  35027. modelValue: {
  35028. type: [Array, String, Number, Boolean, Object],
  35029. default: void 0
  35030. },
  35031. autocomplete: {
  35032. type: String,
  35033. default: "off"
  35034. },
  35035. automaticDropdown: Boolean,
  35036. size: useSizeProp,
  35037. effect: {
  35038. type: definePropType(String),
  35039. default: "light"
  35040. },
  35041. disabled: Boolean,
  35042. clearable: Boolean,
  35043. filterable: Boolean,
  35044. allowCreate: Boolean,
  35045. loading: Boolean,
  35046. popperClass: {
  35047. type: String,
  35048. default: ""
  35049. },
  35050. popperOptions: {
  35051. type: definePropType(Object),
  35052. default: () => ({})
  35053. },
  35054. remote: Boolean,
  35055. loadingText: String,
  35056. noMatchText: String,
  35057. noDataText: String,
  35058. remoteMethod: Function,
  35059. filterMethod: Function,
  35060. multiple: Boolean,
  35061. multipleLimit: {
  35062. type: Number,
  35063. default: 0
  35064. },
  35065. placeholder: {
  35066. type: String
  35067. },
  35068. defaultFirstOption: Boolean,
  35069. reserveKeyword: {
  35070. type: Boolean,
  35071. default: true
  35072. },
  35073. valueKey: {
  35074. type: String,
  35075. default: "value"
  35076. },
  35077. collapseTags: Boolean,
  35078. collapseTagsTooltip: Boolean,
  35079. maxCollapseTags: {
  35080. type: Number,
  35081. default: 1
  35082. },
  35083. teleported: useTooltipContentProps.teleported,
  35084. persistent: {
  35085. type: Boolean,
  35086. default: true
  35087. },
  35088. clearIcon: {
  35089. type: iconPropType,
  35090. default: circle_close_default
  35091. },
  35092. fitInputWidth: Boolean,
  35093. suffixIcon: {
  35094. type: iconPropType,
  35095. default: arrow_down_default
  35096. },
  35097. tagType: { ...tagProps.type, default: "info" },
  35098. tagEffect: { ...tagProps.effect, default: "light" },
  35099. validateEvent: {
  35100. type: Boolean,
  35101. default: true
  35102. },
  35103. remoteShowSuffix: Boolean,
  35104. showArrow: {
  35105. type: Boolean,
  35106. default: true
  35107. },
  35108. offset: {
  35109. type: Number,
  35110. default: 12
  35111. },
  35112. placement: {
  35113. type: definePropType(String),
  35114. values: Ee,
  35115. default: "bottom-start"
  35116. },
  35117. fallbackPlacements: {
  35118. type: definePropType(Array),
  35119. default: ["bottom-start", "top-start", "right", "left"]
  35120. },
  35121. tabindex: {
  35122. type: [String, Number],
  35123. default: 0
  35124. },
  35125. appendTo: String,
  35126. ...useEmptyValuesProps,
  35127. ...useAriaProps(["ariaLabel"])
  35128. });
  35129. const COMPONENT_NAME$9 = "ElSelect";
  35130. const _sfc_main$Z = vue.defineComponent({
  35131. name: COMPONENT_NAME$9,
  35132. componentName: COMPONENT_NAME$9,
  35133. components: {
  35134. ElSelectMenu: ElSelectMenu$1,
  35135. ElOption: Option,
  35136. ElOptions,
  35137. ElTag,
  35138. ElScrollbar,
  35139. ElTooltip,
  35140. ElIcon
  35141. },
  35142. directives: { ClickOutside },
  35143. props: SelectProps$1,
  35144. emits: [
  35145. UPDATE_MODEL_EVENT,
  35146. CHANGE_EVENT,
  35147. "remove-tag",
  35148. "clear",
  35149. "visible-change",
  35150. "focus",
  35151. "blur"
  35152. ],
  35153. setup(props, { emit }) {
  35154. const modelValue = vue.computed(() => {
  35155. const { modelValue: rawModelValue, multiple } = props;
  35156. const fallback = multiple ? [] : void 0;
  35157. if (isArray$1(rawModelValue)) {
  35158. return multiple ? rawModelValue : fallback;
  35159. }
  35160. return multiple ? fallback : rawModelValue;
  35161. });
  35162. const _props = vue.reactive({
  35163. ...vue.toRefs(props),
  35164. modelValue
  35165. });
  35166. const API = useSelect$3(_props, emit);
  35167. vue.provide(selectKey, vue.reactive({
  35168. props: _props,
  35169. states: API.states,
  35170. optionsArray: API.optionsArray,
  35171. handleOptionSelect: API.handleOptionSelect,
  35172. onOptionCreate: API.onOptionCreate,
  35173. onOptionDestroy: API.onOptionDestroy,
  35174. selectRef: API.selectRef,
  35175. setSelected: API.setSelected
  35176. }));
  35177. const selectedLabel = vue.computed(() => {
  35178. if (!props.multiple) {
  35179. return API.states.selectedLabel;
  35180. }
  35181. return API.states.selected.map((i) => i.currentLabel);
  35182. });
  35183. return {
  35184. ...API,
  35185. modelValue,
  35186. selectedLabel
  35187. };
  35188. }
  35189. });
  35190. function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
  35191. const _component_el_tag = vue.resolveComponent("el-tag");
  35192. const _component_el_tooltip = vue.resolveComponent("el-tooltip");
  35193. const _component_el_icon = vue.resolveComponent("el-icon");
  35194. const _component_el_option = vue.resolveComponent("el-option");
  35195. const _component_el_options = vue.resolveComponent("el-options");
  35196. const _component_el_scrollbar = vue.resolveComponent("el-scrollbar");
  35197. const _component_el_select_menu = vue.resolveComponent("el-select-menu");
  35198. const _directive_click_outside = vue.resolveDirective("click-outside");
  35199. return vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  35200. ref: "selectRef",
  35201. class: vue.normalizeClass([_ctx.nsSelect.b(), _ctx.nsSelect.m(_ctx.selectSize)]),
  35202. [vue.toHandlerKey(_ctx.mouseEnterEventName)]: ($event) => _ctx.states.inputHovering = true,
  35203. onMouseleave: ($event) => _ctx.states.inputHovering = false
  35204. }, [
  35205. vue.createVNode(_component_el_tooltip, {
  35206. ref: "tooltipRef",
  35207. visible: _ctx.dropdownMenuVisible,
  35208. placement: _ctx.placement,
  35209. teleported: _ctx.teleported,
  35210. "popper-class": [_ctx.nsSelect.e("popper"), _ctx.popperClass],
  35211. "popper-options": _ctx.popperOptions,
  35212. "fallback-placements": _ctx.fallbackPlacements,
  35213. effect: _ctx.effect,
  35214. pure: "",
  35215. trigger: "click",
  35216. transition: `${_ctx.nsSelect.namespace.value}-zoom-in-top`,
  35217. "stop-popper-mouse-event": false,
  35218. "gpu-acceleration": false,
  35219. persistent: _ctx.persistent,
  35220. "append-to": _ctx.appendTo,
  35221. "show-arrow": _ctx.showArrow,
  35222. offset: _ctx.offset,
  35223. onBeforeShow: _ctx.handleMenuEnter,
  35224. onHide: ($event) => _ctx.states.isBeforeHide = false
  35225. }, {
  35226. default: vue.withCtx(() => {
  35227. var _a;
  35228. return [
  35229. vue.createElementVNode("div", {
  35230. ref: "wrapperRef",
  35231. class: vue.normalizeClass([
  35232. _ctx.nsSelect.e("wrapper"),
  35233. _ctx.nsSelect.is("focused", _ctx.isFocused),
  35234. _ctx.nsSelect.is("hovering", _ctx.states.inputHovering),
  35235. _ctx.nsSelect.is("filterable", _ctx.filterable),
  35236. _ctx.nsSelect.is("disabled", _ctx.selectDisabled)
  35237. ]),
  35238. onClick: vue.withModifiers(_ctx.toggleMenu, ["prevent"])
  35239. }, [
  35240. _ctx.$slots.prefix ? (vue.openBlock(), vue.createElementBlock("div", {
  35241. key: 0,
  35242. ref: "prefixRef",
  35243. class: vue.normalizeClass(_ctx.nsSelect.e("prefix"))
  35244. }, [
  35245. vue.renderSlot(_ctx.$slots, "prefix")
  35246. ], 2)) : vue.createCommentVNode("v-if", true),
  35247. vue.createElementVNode("div", {
  35248. ref: "selectionRef",
  35249. class: vue.normalizeClass([
  35250. _ctx.nsSelect.e("selection"),
  35251. _ctx.nsSelect.is("near", _ctx.multiple && !_ctx.$slots.prefix && !!_ctx.states.selected.length)
  35252. ])
  35253. }, [
  35254. _ctx.multiple ? vue.renderSlot(_ctx.$slots, "tag", { key: 0 }, () => [
  35255. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.showTagList, (item) => {
  35256. return vue.openBlock(), vue.createElementBlock("div", {
  35257. key: _ctx.getValueKey(item),
  35258. class: vue.normalizeClass(_ctx.nsSelect.e("selected-item"))
  35259. }, [
  35260. vue.createVNode(_component_el_tag, {
  35261. closable: !_ctx.selectDisabled && !item.isDisabled,
  35262. size: _ctx.collapseTagSize,
  35263. type: _ctx.tagType,
  35264. effect: _ctx.tagEffect,
  35265. "disable-transitions": "",
  35266. style: vue.normalizeStyle(_ctx.tagStyle),
  35267. onClose: ($event) => _ctx.deleteTag($event, item)
  35268. }, {
  35269. default: vue.withCtx(() => [
  35270. vue.createElementVNode("span", {
  35271. class: vue.normalizeClass(_ctx.nsSelect.e("tags-text"))
  35272. }, [
  35273. vue.renderSlot(_ctx.$slots, "label", {
  35274. label: item.currentLabel,
  35275. value: item.value
  35276. }, () => [
  35277. vue.createTextVNode(vue.toDisplayString(item.currentLabel), 1)
  35278. ])
  35279. ], 2)
  35280. ]),
  35281. _: 2
  35282. }, 1032, ["closable", "size", "type", "effect", "style", "onClose"])
  35283. ], 2);
  35284. }), 128)),
  35285. _ctx.collapseTags && _ctx.states.selected.length > _ctx.maxCollapseTags ? (vue.openBlock(), vue.createBlock(_component_el_tooltip, {
  35286. key: 0,
  35287. ref: "tagTooltipRef",
  35288. disabled: _ctx.dropdownMenuVisible || !_ctx.collapseTagsTooltip,
  35289. "fallback-placements": ["bottom", "top", "right", "left"],
  35290. effect: _ctx.effect,
  35291. placement: "bottom",
  35292. teleported: _ctx.teleported
  35293. }, {
  35294. default: vue.withCtx(() => [
  35295. vue.createElementVNode("div", {
  35296. ref: "collapseItemRef",
  35297. class: vue.normalizeClass(_ctx.nsSelect.e("selected-item"))
  35298. }, [
  35299. vue.createVNode(_component_el_tag, {
  35300. closable: false,
  35301. size: _ctx.collapseTagSize,
  35302. type: _ctx.tagType,
  35303. effect: _ctx.tagEffect,
  35304. "disable-transitions": "",
  35305. style: vue.normalizeStyle(_ctx.collapseTagStyle)
  35306. }, {
  35307. default: vue.withCtx(() => [
  35308. vue.createElementVNode("span", {
  35309. class: vue.normalizeClass(_ctx.nsSelect.e("tags-text"))
  35310. }, " + " + vue.toDisplayString(_ctx.states.selected.length - _ctx.maxCollapseTags), 3)
  35311. ]),
  35312. _: 1
  35313. }, 8, ["size", "type", "effect", "style"])
  35314. ], 2)
  35315. ]),
  35316. content: vue.withCtx(() => [
  35317. vue.createElementVNode("div", {
  35318. ref: "tagMenuRef",
  35319. class: vue.normalizeClass(_ctx.nsSelect.e("selection"))
  35320. }, [
  35321. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.collapseTagList, (item) => {
  35322. return vue.openBlock(), vue.createElementBlock("div", {
  35323. key: _ctx.getValueKey(item),
  35324. class: vue.normalizeClass(_ctx.nsSelect.e("selected-item"))
  35325. }, [
  35326. vue.createVNode(_component_el_tag, {
  35327. class: "in-tooltip",
  35328. closable: !_ctx.selectDisabled && !item.isDisabled,
  35329. size: _ctx.collapseTagSize,
  35330. type: _ctx.tagType,
  35331. effect: _ctx.tagEffect,
  35332. "disable-transitions": "",
  35333. onClose: ($event) => _ctx.deleteTag($event, item)
  35334. }, {
  35335. default: vue.withCtx(() => [
  35336. vue.createElementVNode("span", {
  35337. class: vue.normalizeClass(_ctx.nsSelect.e("tags-text"))
  35338. }, [
  35339. vue.renderSlot(_ctx.$slots, "label", {
  35340. label: item.currentLabel,
  35341. value: item.value
  35342. }, () => [
  35343. vue.createTextVNode(vue.toDisplayString(item.currentLabel), 1)
  35344. ])
  35345. ], 2)
  35346. ]),
  35347. _: 2
  35348. }, 1032, ["closable", "size", "type", "effect", "onClose"])
  35349. ], 2);
  35350. }), 128))
  35351. ], 2)
  35352. ]),
  35353. _: 3
  35354. }, 8, ["disabled", "effect", "teleported"])) : vue.createCommentVNode("v-if", true)
  35355. ]) : vue.createCommentVNode("v-if", true),
  35356. vue.createElementVNode("div", {
  35357. class: vue.normalizeClass([
  35358. _ctx.nsSelect.e("selected-item"),
  35359. _ctx.nsSelect.e("input-wrapper"),
  35360. _ctx.nsSelect.is("hidden", !_ctx.filterable)
  35361. ])
  35362. }, [
  35363. vue.withDirectives(vue.createElementVNode("input", {
  35364. id: _ctx.inputId,
  35365. ref: "inputRef",
  35366. "onUpdate:modelValue": ($event) => _ctx.states.inputValue = $event,
  35367. type: "text",
  35368. name: _ctx.name,
  35369. class: vue.normalizeClass([_ctx.nsSelect.e("input"), _ctx.nsSelect.is(_ctx.selectSize)]),
  35370. disabled: _ctx.selectDisabled,
  35371. autocomplete: _ctx.autocomplete,
  35372. style: vue.normalizeStyle(_ctx.inputStyle),
  35373. tabindex: _ctx.tabindex,
  35374. role: "combobox",
  35375. readonly: !_ctx.filterable,
  35376. spellcheck: "false",
  35377. "aria-activedescendant": ((_a = _ctx.hoverOption) == null ? void 0 : _a.id) || "",
  35378. "aria-controls": _ctx.contentId,
  35379. "aria-expanded": _ctx.dropdownMenuVisible,
  35380. "aria-label": _ctx.ariaLabel,
  35381. "aria-autocomplete": "none",
  35382. "aria-haspopup": "listbox",
  35383. onKeydown: [
  35384. vue.withKeys(vue.withModifiers(($event) => _ctx.navigateOptions("next"), ["stop", "prevent"]), ["down"]),
  35385. vue.withKeys(vue.withModifiers(($event) => _ctx.navigateOptions("prev"), ["stop", "prevent"]), ["up"]),
  35386. vue.withKeys(vue.withModifiers(_ctx.handleEsc, ["stop", "prevent"]), ["esc"]),
  35387. vue.withKeys(vue.withModifiers(_ctx.selectOption, ["stop", "prevent"]), ["enter"]),
  35388. vue.withKeys(vue.withModifiers(_ctx.deletePrevTag, ["stop"]), ["delete"])
  35389. ],
  35390. onCompositionstart: _ctx.handleCompositionStart,
  35391. onCompositionupdate: _ctx.handleCompositionUpdate,
  35392. onCompositionend: _ctx.handleCompositionEnd,
  35393. onInput: _ctx.onInput,
  35394. onClick: vue.withModifiers(_ctx.toggleMenu, ["stop"])
  35395. }, null, 46, ["id", "onUpdate:modelValue", "name", "disabled", "autocomplete", "tabindex", "readonly", "aria-activedescendant", "aria-controls", "aria-expanded", "aria-label", "onKeydown", "onCompositionstart", "onCompositionupdate", "onCompositionend", "onInput", "onClick"]), [
  35396. [vue.vModelText, _ctx.states.inputValue]
  35397. ]),
  35398. _ctx.filterable ? (vue.openBlock(), vue.createElementBlock("span", {
  35399. key: 0,
  35400. ref: "calculatorRef",
  35401. "aria-hidden": "true",
  35402. class: vue.normalizeClass(_ctx.nsSelect.e("input-calculator")),
  35403. textContent: vue.toDisplayString(_ctx.states.inputValue)
  35404. }, null, 10, ["textContent"])) : vue.createCommentVNode("v-if", true)
  35405. ], 2),
  35406. _ctx.shouldShowPlaceholder ? (vue.openBlock(), vue.createElementBlock("div", {
  35407. key: 1,
  35408. class: vue.normalizeClass([
  35409. _ctx.nsSelect.e("selected-item"),
  35410. _ctx.nsSelect.e("placeholder"),
  35411. _ctx.nsSelect.is("transparent", !_ctx.hasModelValue || _ctx.expanded && !_ctx.states.inputValue)
  35412. ])
  35413. }, [
  35414. _ctx.hasModelValue ? vue.renderSlot(_ctx.$slots, "label", {
  35415. key: 0,
  35416. label: _ctx.currentPlaceholder,
  35417. value: _ctx.modelValue
  35418. }, () => [
  35419. vue.createElementVNode("span", null, vue.toDisplayString(_ctx.currentPlaceholder), 1)
  35420. ]) : (vue.openBlock(), vue.createElementBlock("span", { key: 1 }, vue.toDisplayString(_ctx.currentPlaceholder), 1))
  35421. ], 2)) : vue.createCommentVNode("v-if", true)
  35422. ], 2),
  35423. vue.createElementVNode("div", {
  35424. ref: "suffixRef",
  35425. class: vue.normalizeClass(_ctx.nsSelect.e("suffix"))
  35426. }, [
  35427. _ctx.iconComponent && !_ctx.showClose ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
  35428. key: 0,
  35429. class: vue.normalizeClass([_ctx.nsSelect.e("caret"), _ctx.nsSelect.e("icon"), _ctx.iconReverse])
  35430. }, {
  35431. default: vue.withCtx(() => [
  35432. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.iconComponent)))
  35433. ]),
  35434. _: 1
  35435. }, 8, ["class"])) : vue.createCommentVNode("v-if", true),
  35436. _ctx.showClose && _ctx.clearIcon ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
  35437. key: 1,
  35438. class: vue.normalizeClass([
  35439. _ctx.nsSelect.e("caret"),
  35440. _ctx.nsSelect.e("icon"),
  35441. _ctx.nsSelect.e("clear")
  35442. ]),
  35443. onClick: _ctx.handleClearClick
  35444. }, {
  35445. default: vue.withCtx(() => [
  35446. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.clearIcon)))
  35447. ]),
  35448. _: 1
  35449. }, 8, ["class", "onClick"])) : vue.createCommentVNode("v-if", true),
  35450. _ctx.validateState && _ctx.validateIcon && _ctx.needStatusIcon ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
  35451. key: 2,
  35452. class: vue.normalizeClass([_ctx.nsInput.e("icon"), _ctx.nsInput.e("validateIcon")])
  35453. }, {
  35454. default: vue.withCtx(() => [
  35455. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.validateIcon)))
  35456. ]),
  35457. _: 1
  35458. }, 8, ["class"])) : vue.createCommentVNode("v-if", true)
  35459. ], 2)
  35460. ], 10, ["onClick"])
  35461. ];
  35462. }),
  35463. content: vue.withCtx(() => [
  35464. vue.createVNode(_component_el_select_menu, { ref: "menuRef" }, {
  35465. default: vue.withCtx(() => [
  35466. _ctx.$slots.header ? (vue.openBlock(), vue.createElementBlock("div", {
  35467. key: 0,
  35468. class: vue.normalizeClass(_ctx.nsSelect.be("dropdown", "header")),
  35469. onClick: vue.withModifiers(() => {
  35470. }, ["stop"])
  35471. }, [
  35472. vue.renderSlot(_ctx.$slots, "header")
  35473. ], 10, ["onClick"])) : vue.createCommentVNode("v-if", true),
  35474. vue.withDirectives(vue.createVNode(_component_el_scrollbar, {
  35475. id: _ctx.contentId,
  35476. ref: "scrollbarRef",
  35477. tag: "ul",
  35478. "wrap-class": _ctx.nsSelect.be("dropdown", "wrap"),
  35479. "view-class": _ctx.nsSelect.be("dropdown", "list"),
  35480. class: vue.normalizeClass([_ctx.nsSelect.is("empty", _ctx.filteredOptionsCount === 0)]),
  35481. role: "listbox",
  35482. "aria-label": _ctx.ariaLabel,
  35483. "aria-orientation": "vertical"
  35484. }, {
  35485. default: vue.withCtx(() => [
  35486. _ctx.showNewOption ? (vue.openBlock(), vue.createBlock(_component_el_option, {
  35487. key: 0,
  35488. value: _ctx.states.inputValue,
  35489. created: true
  35490. }, null, 8, ["value"])) : vue.createCommentVNode("v-if", true),
  35491. vue.createVNode(_component_el_options, null, {
  35492. default: vue.withCtx(() => [
  35493. vue.renderSlot(_ctx.$slots, "default")
  35494. ]),
  35495. _: 3
  35496. })
  35497. ]),
  35498. _: 3
  35499. }, 8, ["id", "wrap-class", "view-class", "class", "aria-label"]), [
  35500. [vue.vShow, _ctx.states.options.size > 0 && !_ctx.loading]
  35501. ]),
  35502. _ctx.$slots.loading && _ctx.loading ? (vue.openBlock(), vue.createElementBlock("div", {
  35503. key: 1,
  35504. class: vue.normalizeClass(_ctx.nsSelect.be("dropdown", "loading"))
  35505. }, [
  35506. vue.renderSlot(_ctx.$slots, "loading")
  35507. ], 2)) : _ctx.loading || _ctx.filteredOptionsCount === 0 ? (vue.openBlock(), vue.createElementBlock("div", {
  35508. key: 2,
  35509. class: vue.normalizeClass(_ctx.nsSelect.be("dropdown", "empty"))
  35510. }, [
  35511. vue.renderSlot(_ctx.$slots, "empty", {}, () => [
  35512. vue.createElementVNode("span", null, vue.toDisplayString(_ctx.emptyText), 1)
  35513. ])
  35514. ], 2)) : vue.createCommentVNode("v-if", true),
  35515. _ctx.$slots.footer ? (vue.openBlock(), vue.createElementBlock("div", {
  35516. key: 3,
  35517. class: vue.normalizeClass(_ctx.nsSelect.be("dropdown", "footer")),
  35518. onClick: vue.withModifiers(() => {
  35519. }, ["stop"])
  35520. }, [
  35521. vue.renderSlot(_ctx.$slots, "footer")
  35522. ], 10, ["onClick"])) : vue.createCommentVNode("v-if", true)
  35523. ]),
  35524. _: 3
  35525. }, 512)
  35526. ]),
  35527. _: 3
  35528. }, 8, ["visible", "placement", "teleported", "popper-class", "popper-options", "fallback-placements", "effect", "transition", "persistent", "append-to", "show-arrow", "offset", "onBeforeShow", "onHide"])
  35529. ], 16, ["onMouseleave"])), [
  35530. [_directive_click_outside, _ctx.handleClickOutside, _ctx.popperRef]
  35531. ]);
  35532. }
  35533. var Select$1 = /* @__PURE__ */ _export_sfc(_sfc_main$Z, [["render", _sfc_render$9], ["__file", "select.vue"]]);
  35534. const _sfc_main$Y = vue.defineComponent({
  35535. name: "ElOptionGroup",
  35536. componentName: "ElOptionGroup",
  35537. props: {
  35538. label: String,
  35539. disabled: Boolean
  35540. },
  35541. setup(props) {
  35542. const ns = useNamespace("select");
  35543. const groupRef = vue.ref(null);
  35544. const instance = vue.getCurrentInstance();
  35545. const children = vue.ref([]);
  35546. vue.provide(selectGroupKey, vue.reactive({
  35547. ...vue.toRefs(props)
  35548. }));
  35549. const visible = vue.computed(() => children.value.some((option) => option.visible === true));
  35550. const isOption = (node) => {
  35551. var _a, _b;
  35552. return ((_a = node.type) == null ? void 0 : _a.name) === "ElOption" && !!((_b = node.component) == null ? void 0 : _b.proxy);
  35553. };
  35554. const flattedChildren = (node) => {
  35555. const Nodes = castArray$1(node);
  35556. const children2 = [];
  35557. Nodes.forEach((child) => {
  35558. var _a, _b;
  35559. if (isOption(child)) {
  35560. children2.push(child.component.proxy);
  35561. } else if ((_a = child.children) == null ? void 0 : _a.length) {
  35562. children2.push(...flattedChildren(child.children));
  35563. } else if ((_b = child.component) == null ? void 0 : _b.subTree) {
  35564. children2.push(...flattedChildren(child.component.subTree));
  35565. }
  35566. });
  35567. return children2;
  35568. };
  35569. const updateChildren = () => {
  35570. children.value = flattedChildren(instance.subTree);
  35571. };
  35572. vue.onMounted(() => {
  35573. updateChildren();
  35574. });
  35575. useMutationObserver(groupRef, updateChildren, {
  35576. attributes: true,
  35577. subtree: true,
  35578. childList: true
  35579. });
  35580. return {
  35581. groupRef,
  35582. visible,
  35583. ns
  35584. };
  35585. }
  35586. });
  35587. function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) {
  35588. return vue.withDirectives((vue.openBlock(), vue.createElementBlock("ul", {
  35589. ref: "groupRef",
  35590. class: vue.normalizeClass(_ctx.ns.be("group", "wrap"))
  35591. }, [
  35592. vue.createElementVNode("li", {
  35593. class: vue.normalizeClass(_ctx.ns.be("group", "title"))
  35594. }, vue.toDisplayString(_ctx.label), 3),
  35595. vue.createElementVNode("li", null, [
  35596. vue.createElementVNode("ul", {
  35597. class: vue.normalizeClass(_ctx.ns.b("group"))
  35598. }, [
  35599. vue.renderSlot(_ctx.$slots, "default")
  35600. ], 2)
  35601. ])
  35602. ], 2)), [
  35603. [vue.vShow, _ctx.visible]
  35604. ]);
  35605. }
  35606. var OptionGroup = /* @__PURE__ */ _export_sfc(_sfc_main$Y, [["render", _sfc_render$8], ["__file", "option-group.vue"]]);
  35607. const ElSelect = withInstall(Select$1, {
  35608. Option,
  35609. OptionGroup
  35610. });
  35611. const ElOption = withNoopInstall(Option);
  35612. const ElOptionGroup = withNoopInstall(OptionGroup);
  35613. const usePagination = () => vue.inject(elPaginationKey, {});
  35614. const paginationSizesProps = buildProps({
  35615. pageSize: {
  35616. type: Number,
  35617. required: true
  35618. },
  35619. pageSizes: {
  35620. type: definePropType(Array),
  35621. default: () => mutable([10, 20, 30, 40, 50, 100])
  35622. },
  35623. popperClass: {
  35624. type: String
  35625. },
  35626. disabled: Boolean,
  35627. teleported: Boolean,
  35628. size: {
  35629. type: String,
  35630. values: componentSizes
  35631. },
  35632. appendSizeTo: String
  35633. });
  35634. const __default__$N = vue.defineComponent({
  35635. name: "ElPaginationSizes"
  35636. });
  35637. const _sfc_main$X = /* @__PURE__ */ vue.defineComponent({
  35638. ...__default__$N,
  35639. props: paginationSizesProps,
  35640. emits: ["page-size-change"],
  35641. setup(__props, { emit }) {
  35642. const props = __props;
  35643. const { t } = useLocale();
  35644. const ns = useNamespace("pagination");
  35645. const pagination = usePagination();
  35646. const innerPageSize = vue.ref(props.pageSize);
  35647. vue.watch(() => props.pageSizes, (newVal, oldVal) => {
  35648. if (isEqual$1(newVal, oldVal))
  35649. return;
  35650. if (isArray$1(newVal)) {
  35651. const pageSize = newVal.includes(props.pageSize) ? props.pageSize : props.pageSizes[0];
  35652. emit("page-size-change", pageSize);
  35653. }
  35654. });
  35655. vue.watch(() => props.pageSize, (newVal) => {
  35656. innerPageSize.value = newVal;
  35657. });
  35658. const innerPageSizes = vue.computed(() => props.pageSizes);
  35659. function handleChange(val) {
  35660. var _a;
  35661. if (val !== innerPageSize.value) {
  35662. innerPageSize.value = val;
  35663. (_a = pagination.handleSizeChange) == null ? void 0 : _a.call(pagination, Number(val));
  35664. }
  35665. }
  35666. return (_ctx, _cache) => {
  35667. return vue.openBlock(), vue.createElementBlock("span", {
  35668. class: vue.normalizeClass(vue.unref(ns).e("sizes"))
  35669. }, [
  35670. vue.createVNode(vue.unref(ElSelect), {
  35671. "model-value": innerPageSize.value,
  35672. disabled: _ctx.disabled,
  35673. "popper-class": _ctx.popperClass,
  35674. size: _ctx.size,
  35675. teleported: _ctx.teleported,
  35676. "validate-event": false,
  35677. "append-to": _ctx.appendSizeTo,
  35678. onChange: handleChange
  35679. }, {
  35680. default: vue.withCtx(() => [
  35681. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(innerPageSizes), (item) => {
  35682. return vue.openBlock(), vue.createBlock(vue.unref(ElOption), {
  35683. key: item,
  35684. value: item,
  35685. label: item + vue.unref(t)("el.pagination.pagesize")
  35686. }, null, 8, ["value", "label"]);
  35687. }), 128))
  35688. ]),
  35689. _: 1
  35690. }, 8, ["model-value", "disabled", "popper-class", "size", "teleported", "append-to"])
  35691. ], 2);
  35692. };
  35693. }
  35694. });
  35695. var Sizes = /* @__PURE__ */ _export_sfc(_sfc_main$X, [["__file", "sizes.vue"]]);
  35696. const paginationJumperProps = buildProps({
  35697. size: {
  35698. type: String,
  35699. values: componentSizes
  35700. }
  35701. });
  35702. const __default__$M = vue.defineComponent({
  35703. name: "ElPaginationJumper"
  35704. });
  35705. const _sfc_main$W = /* @__PURE__ */ vue.defineComponent({
  35706. ...__default__$M,
  35707. props: paginationJumperProps,
  35708. setup(__props) {
  35709. const { t } = useLocale();
  35710. const ns = useNamespace("pagination");
  35711. const { pageCount, disabled, currentPage, changeEvent } = usePagination();
  35712. const userInput = vue.ref();
  35713. const innerValue = vue.computed(() => {
  35714. var _a;
  35715. return (_a = userInput.value) != null ? _a : currentPage == null ? void 0 : currentPage.value;
  35716. });
  35717. function handleInput(val) {
  35718. userInput.value = val ? +val : "";
  35719. }
  35720. function handleChange(val) {
  35721. val = Math.trunc(+val);
  35722. changeEvent == null ? void 0 : changeEvent(val);
  35723. userInput.value = void 0;
  35724. }
  35725. return (_ctx, _cache) => {
  35726. return vue.openBlock(), vue.createElementBlock("span", {
  35727. class: vue.normalizeClass(vue.unref(ns).e("jump")),
  35728. disabled: vue.unref(disabled)
  35729. }, [
  35730. vue.createElementVNode("span", {
  35731. class: vue.normalizeClass([vue.unref(ns).e("goto")])
  35732. }, vue.toDisplayString(vue.unref(t)("el.pagination.goto")), 3),
  35733. vue.createVNode(vue.unref(ElInput), {
  35734. size: _ctx.size,
  35735. class: vue.normalizeClass([vue.unref(ns).e("editor"), vue.unref(ns).is("in-pagination")]),
  35736. min: 1,
  35737. max: vue.unref(pageCount),
  35738. disabled: vue.unref(disabled),
  35739. "model-value": vue.unref(innerValue),
  35740. "validate-event": false,
  35741. "aria-label": vue.unref(t)("el.pagination.page"),
  35742. type: "number",
  35743. "onUpdate:modelValue": handleInput,
  35744. onChange: handleChange
  35745. }, null, 8, ["size", "class", "max", "disabled", "model-value", "aria-label"]),
  35746. vue.createElementVNode("span", {
  35747. class: vue.normalizeClass([vue.unref(ns).e("classifier")])
  35748. }, vue.toDisplayString(vue.unref(t)("el.pagination.pageClassifier")), 3)
  35749. ], 10, ["disabled"]);
  35750. };
  35751. }
  35752. });
  35753. var Jumper = /* @__PURE__ */ _export_sfc(_sfc_main$W, [["__file", "jumper.vue"]]);
  35754. const paginationTotalProps = buildProps({
  35755. total: {
  35756. type: Number,
  35757. default: 1e3
  35758. }
  35759. });
  35760. const __default__$L = vue.defineComponent({
  35761. name: "ElPaginationTotal"
  35762. });
  35763. const _sfc_main$V = /* @__PURE__ */ vue.defineComponent({
  35764. ...__default__$L,
  35765. props: paginationTotalProps,
  35766. setup(__props) {
  35767. const { t } = useLocale();
  35768. const ns = useNamespace("pagination");
  35769. const { disabled } = usePagination();
  35770. return (_ctx, _cache) => {
  35771. return vue.openBlock(), vue.createElementBlock("span", {
  35772. class: vue.normalizeClass(vue.unref(ns).e("total")),
  35773. disabled: vue.unref(disabled)
  35774. }, vue.toDisplayString(vue.unref(t)("el.pagination.total", {
  35775. total: _ctx.total
  35776. })), 11, ["disabled"]);
  35777. };
  35778. }
  35779. });
  35780. var Total = /* @__PURE__ */ _export_sfc(_sfc_main$V, [["__file", "total.vue"]]);
  35781. const paginationPagerProps = buildProps({
  35782. currentPage: {
  35783. type: Number,
  35784. default: 1
  35785. },
  35786. pageCount: {
  35787. type: Number,
  35788. required: true
  35789. },
  35790. pagerCount: {
  35791. type: Number,
  35792. default: 7
  35793. },
  35794. disabled: Boolean
  35795. });
  35796. const __default__$K = vue.defineComponent({
  35797. name: "ElPaginationPager"
  35798. });
  35799. const _sfc_main$U = /* @__PURE__ */ vue.defineComponent({
  35800. ...__default__$K,
  35801. props: paginationPagerProps,
  35802. emits: ["change"],
  35803. setup(__props, { emit }) {
  35804. const props = __props;
  35805. const nsPager = useNamespace("pager");
  35806. const nsIcon = useNamespace("icon");
  35807. const { t } = useLocale();
  35808. const showPrevMore = vue.ref(false);
  35809. const showNextMore = vue.ref(false);
  35810. const quickPrevHover = vue.ref(false);
  35811. const quickNextHover = vue.ref(false);
  35812. const quickPrevFocus = vue.ref(false);
  35813. const quickNextFocus = vue.ref(false);
  35814. const pagers = vue.computed(() => {
  35815. const pagerCount = props.pagerCount;
  35816. const halfPagerCount = (pagerCount - 1) / 2;
  35817. const currentPage = Number(props.currentPage);
  35818. const pageCount = Number(props.pageCount);
  35819. let showPrevMore2 = false;
  35820. let showNextMore2 = false;
  35821. if (pageCount > pagerCount) {
  35822. if (currentPage > pagerCount - halfPagerCount) {
  35823. showPrevMore2 = true;
  35824. }
  35825. if (currentPage < pageCount - halfPagerCount) {
  35826. showNextMore2 = true;
  35827. }
  35828. }
  35829. const array = [];
  35830. if (showPrevMore2 && !showNextMore2) {
  35831. const startPage = pageCount - (pagerCount - 2);
  35832. for (let i = startPage; i < pageCount; i++) {
  35833. array.push(i);
  35834. }
  35835. } else if (!showPrevMore2 && showNextMore2) {
  35836. for (let i = 2; i < pagerCount; i++) {
  35837. array.push(i);
  35838. }
  35839. } else if (showPrevMore2 && showNextMore2) {
  35840. const offset = Math.floor(pagerCount / 2) - 1;
  35841. for (let i = currentPage - offset; i <= currentPage + offset; i++) {
  35842. array.push(i);
  35843. }
  35844. } else {
  35845. for (let i = 2; i < pageCount; i++) {
  35846. array.push(i);
  35847. }
  35848. }
  35849. return array;
  35850. });
  35851. const prevMoreKls = vue.computed(() => [
  35852. "more",
  35853. "btn-quickprev",
  35854. nsIcon.b(),
  35855. nsPager.is("disabled", props.disabled)
  35856. ]);
  35857. const nextMoreKls = vue.computed(() => [
  35858. "more",
  35859. "btn-quicknext",
  35860. nsIcon.b(),
  35861. nsPager.is("disabled", props.disabled)
  35862. ]);
  35863. const tabindex = vue.computed(() => props.disabled ? -1 : 0);
  35864. vue.watchEffect(() => {
  35865. const halfPagerCount = (props.pagerCount - 1) / 2;
  35866. showPrevMore.value = false;
  35867. showNextMore.value = false;
  35868. if (props.pageCount > props.pagerCount) {
  35869. if (props.currentPage > props.pagerCount - halfPagerCount) {
  35870. showPrevMore.value = true;
  35871. }
  35872. if (props.currentPage < props.pageCount - halfPagerCount) {
  35873. showNextMore.value = true;
  35874. }
  35875. }
  35876. });
  35877. function onMouseEnter(forward = false) {
  35878. if (props.disabled)
  35879. return;
  35880. if (forward) {
  35881. quickPrevHover.value = true;
  35882. } else {
  35883. quickNextHover.value = true;
  35884. }
  35885. }
  35886. function onFocus(forward = false) {
  35887. if (forward) {
  35888. quickPrevFocus.value = true;
  35889. } else {
  35890. quickNextFocus.value = true;
  35891. }
  35892. }
  35893. function onEnter(e) {
  35894. const target = e.target;
  35895. if (target.tagName.toLowerCase() === "li" && Array.from(target.classList).includes("number")) {
  35896. const newPage = Number(target.textContent);
  35897. if (newPage !== props.currentPage) {
  35898. emit("change", newPage);
  35899. }
  35900. } else if (target.tagName.toLowerCase() === "li" && Array.from(target.classList).includes("more")) {
  35901. onPagerClick(e);
  35902. }
  35903. }
  35904. function onPagerClick(event) {
  35905. const target = event.target;
  35906. if (target.tagName.toLowerCase() === "ul" || props.disabled) {
  35907. return;
  35908. }
  35909. let newPage = Number(target.textContent);
  35910. const pageCount = props.pageCount;
  35911. const currentPage = props.currentPage;
  35912. const pagerCountOffset = props.pagerCount - 2;
  35913. if (target.className.includes("more")) {
  35914. if (target.className.includes("quickprev")) {
  35915. newPage = currentPage - pagerCountOffset;
  35916. } else if (target.className.includes("quicknext")) {
  35917. newPage = currentPage + pagerCountOffset;
  35918. }
  35919. }
  35920. if (!Number.isNaN(+newPage)) {
  35921. if (newPage < 1) {
  35922. newPage = 1;
  35923. }
  35924. if (newPage > pageCount) {
  35925. newPage = pageCount;
  35926. }
  35927. }
  35928. if (newPage !== currentPage) {
  35929. emit("change", newPage);
  35930. }
  35931. }
  35932. return (_ctx, _cache) => {
  35933. return vue.openBlock(), vue.createElementBlock("ul", {
  35934. class: vue.normalizeClass(vue.unref(nsPager).b()),
  35935. onClick: onPagerClick,
  35936. onKeyup: vue.withKeys(onEnter, ["enter"])
  35937. }, [
  35938. _ctx.pageCount > 0 ? (vue.openBlock(), vue.createElementBlock("li", {
  35939. key: 0,
  35940. class: vue.normalizeClass([[
  35941. vue.unref(nsPager).is("active", _ctx.currentPage === 1),
  35942. vue.unref(nsPager).is("disabled", _ctx.disabled)
  35943. ], "number"]),
  35944. "aria-current": _ctx.currentPage === 1,
  35945. "aria-label": vue.unref(t)("el.pagination.currentPage", { pager: 1 }),
  35946. tabindex: vue.unref(tabindex)
  35947. }, " 1 ", 10, ["aria-current", "aria-label", "tabindex"])) : vue.createCommentVNode("v-if", true),
  35948. showPrevMore.value ? (vue.openBlock(), vue.createElementBlock("li", {
  35949. key: 1,
  35950. class: vue.normalizeClass(vue.unref(prevMoreKls)),
  35951. tabindex: vue.unref(tabindex),
  35952. "aria-label": vue.unref(t)("el.pagination.prevPages", { pager: _ctx.pagerCount - 2 }),
  35953. onMouseenter: ($event) => onMouseEnter(true),
  35954. onMouseleave: ($event) => quickPrevHover.value = false,
  35955. onFocus: ($event) => onFocus(true),
  35956. onBlur: ($event) => quickPrevFocus.value = false
  35957. }, [
  35958. (quickPrevHover.value || quickPrevFocus.value) && !_ctx.disabled ? (vue.openBlock(), vue.createBlock(vue.unref(d_arrow_left_default), { key: 0 })) : (vue.openBlock(), vue.createBlock(vue.unref(more_filled_default), { key: 1 }))
  35959. ], 42, ["tabindex", "aria-label", "onMouseenter", "onMouseleave", "onFocus", "onBlur"])) : vue.createCommentVNode("v-if", true),
  35960. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(pagers), (pager) => {
  35961. return vue.openBlock(), vue.createElementBlock("li", {
  35962. key: pager,
  35963. class: vue.normalizeClass([[
  35964. vue.unref(nsPager).is("active", _ctx.currentPage === pager),
  35965. vue.unref(nsPager).is("disabled", _ctx.disabled)
  35966. ], "number"]),
  35967. "aria-current": _ctx.currentPage === pager,
  35968. "aria-label": vue.unref(t)("el.pagination.currentPage", { pager }),
  35969. tabindex: vue.unref(tabindex)
  35970. }, vue.toDisplayString(pager), 11, ["aria-current", "aria-label", "tabindex"]);
  35971. }), 128)),
  35972. showNextMore.value ? (vue.openBlock(), vue.createElementBlock("li", {
  35973. key: 2,
  35974. class: vue.normalizeClass(vue.unref(nextMoreKls)),
  35975. tabindex: vue.unref(tabindex),
  35976. "aria-label": vue.unref(t)("el.pagination.nextPages", { pager: _ctx.pagerCount - 2 }),
  35977. onMouseenter: ($event) => onMouseEnter(),
  35978. onMouseleave: ($event) => quickNextHover.value = false,
  35979. onFocus: ($event) => onFocus(),
  35980. onBlur: ($event) => quickNextFocus.value = false
  35981. }, [
  35982. (quickNextHover.value || quickNextFocus.value) && !_ctx.disabled ? (vue.openBlock(), vue.createBlock(vue.unref(d_arrow_right_default), { key: 0 })) : (vue.openBlock(), vue.createBlock(vue.unref(more_filled_default), { key: 1 }))
  35983. ], 42, ["tabindex", "aria-label", "onMouseenter", "onMouseleave", "onFocus", "onBlur"])) : vue.createCommentVNode("v-if", true),
  35984. _ctx.pageCount > 1 ? (vue.openBlock(), vue.createElementBlock("li", {
  35985. key: 3,
  35986. class: vue.normalizeClass([[
  35987. vue.unref(nsPager).is("active", _ctx.currentPage === _ctx.pageCount),
  35988. vue.unref(nsPager).is("disabled", _ctx.disabled)
  35989. ], "number"]),
  35990. "aria-current": _ctx.currentPage === _ctx.pageCount,
  35991. "aria-label": vue.unref(t)("el.pagination.currentPage", { pager: _ctx.pageCount }),
  35992. tabindex: vue.unref(tabindex)
  35993. }, vue.toDisplayString(_ctx.pageCount), 11, ["aria-current", "aria-label", "tabindex"])) : vue.createCommentVNode("v-if", true)
  35994. ], 42, ["onKeyup"]);
  35995. };
  35996. }
  35997. });
  35998. var Pager = /* @__PURE__ */ _export_sfc(_sfc_main$U, [["__file", "pager.vue"]]);
  35999. const isAbsent = (v) => typeof v !== "number";
  36000. const paginationProps = buildProps({
  36001. pageSize: Number,
  36002. defaultPageSize: Number,
  36003. total: Number,
  36004. pageCount: Number,
  36005. pagerCount: {
  36006. type: Number,
  36007. validator: (value) => {
  36008. return isNumber(value) && Math.trunc(value) === value && value > 4 && value < 22 && value % 2 === 1;
  36009. },
  36010. default: 7
  36011. },
  36012. currentPage: Number,
  36013. defaultCurrentPage: Number,
  36014. layout: {
  36015. type: String,
  36016. default: ["prev", "pager", "next", "jumper", "->", "total"].join(", ")
  36017. },
  36018. pageSizes: {
  36019. type: definePropType(Array),
  36020. default: () => mutable([10, 20, 30, 40, 50, 100])
  36021. },
  36022. popperClass: {
  36023. type: String,
  36024. default: ""
  36025. },
  36026. prevText: {
  36027. type: String,
  36028. default: ""
  36029. },
  36030. prevIcon: {
  36031. type: iconPropType,
  36032. default: () => arrow_left_default
  36033. },
  36034. nextText: {
  36035. type: String,
  36036. default: ""
  36037. },
  36038. nextIcon: {
  36039. type: iconPropType,
  36040. default: () => arrow_right_default
  36041. },
  36042. teleported: {
  36043. type: Boolean,
  36044. default: true
  36045. },
  36046. small: Boolean,
  36047. size: useSizeProp,
  36048. background: Boolean,
  36049. disabled: Boolean,
  36050. hideOnSinglePage: Boolean,
  36051. appendSizeTo: String
  36052. });
  36053. const paginationEmits = {
  36054. "update:current-page": (val) => isNumber(val),
  36055. "update:page-size": (val) => isNumber(val),
  36056. "size-change": (val) => isNumber(val),
  36057. change: (currentPage, pageSize) => isNumber(currentPage) && isNumber(pageSize),
  36058. "current-change": (val) => isNumber(val),
  36059. "prev-click": (val) => isNumber(val),
  36060. "next-click": (val) => isNumber(val)
  36061. };
  36062. const componentName = "ElPagination";
  36063. var Pagination = vue.defineComponent({
  36064. name: componentName,
  36065. props: paginationProps,
  36066. emits: paginationEmits,
  36067. setup(props, { emit, slots }) {
  36068. const { t } = useLocale();
  36069. const ns = useNamespace("pagination");
  36070. const vnodeProps = vue.getCurrentInstance().vnode.props || {};
  36071. const _globalSize = useGlobalSize();
  36072. const _size = vue.computed(() => {
  36073. var _a;
  36074. return props.small ? "small" : (_a = props.size) != null ? _a : _globalSize.value;
  36075. });
  36076. useDeprecated({
  36077. from: "small",
  36078. replacement: "size",
  36079. version: "3.0.0",
  36080. scope: "el-pagination",
  36081. ref: "https://element-plus.org/zh-CN/component/pagination.html"
  36082. }, vue.computed(() => !!props.small));
  36083. const hasCurrentPageListener = "onUpdate:currentPage" in vnodeProps || "onUpdate:current-page" in vnodeProps || "onCurrentChange" in vnodeProps;
  36084. const hasPageSizeListener = "onUpdate:pageSize" in vnodeProps || "onUpdate:page-size" in vnodeProps || "onSizeChange" in vnodeProps;
  36085. const assertValidUsage = vue.computed(() => {
  36086. if (isAbsent(props.total) && isAbsent(props.pageCount))
  36087. return false;
  36088. if (!isAbsent(props.currentPage) && !hasCurrentPageListener)
  36089. return false;
  36090. if (props.layout.includes("sizes")) {
  36091. if (!isAbsent(props.pageCount)) {
  36092. if (!hasPageSizeListener)
  36093. return false;
  36094. } else if (!isAbsent(props.total)) {
  36095. if (!isAbsent(props.pageSize)) {
  36096. if (!hasPageSizeListener) {
  36097. return false;
  36098. }
  36099. }
  36100. }
  36101. }
  36102. return true;
  36103. });
  36104. const innerPageSize = vue.ref(isAbsent(props.defaultPageSize) ? 10 : props.defaultPageSize);
  36105. const innerCurrentPage = vue.ref(isAbsent(props.defaultCurrentPage) ? 1 : props.defaultCurrentPage);
  36106. const pageSizeBridge = vue.computed({
  36107. get() {
  36108. return isAbsent(props.pageSize) ? innerPageSize.value : props.pageSize;
  36109. },
  36110. set(v) {
  36111. if (isAbsent(props.pageSize)) {
  36112. innerPageSize.value = v;
  36113. }
  36114. if (hasPageSizeListener) {
  36115. emit("update:page-size", v);
  36116. emit("size-change", v);
  36117. }
  36118. }
  36119. });
  36120. const pageCountBridge = vue.computed(() => {
  36121. let pageCount = 0;
  36122. if (!isAbsent(props.pageCount)) {
  36123. pageCount = props.pageCount;
  36124. } else if (!isAbsent(props.total)) {
  36125. pageCount = Math.max(1, Math.ceil(props.total / pageSizeBridge.value));
  36126. }
  36127. return pageCount;
  36128. });
  36129. const currentPageBridge = vue.computed({
  36130. get() {
  36131. return isAbsent(props.currentPage) ? innerCurrentPage.value : props.currentPage;
  36132. },
  36133. set(v) {
  36134. let newCurrentPage = v;
  36135. if (v < 1) {
  36136. newCurrentPage = 1;
  36137. } else if (v > pageCountBridge.value) {
  36138. newCurrentPage = pageCountBridge.value;
  36139. }
  36140. if (isAbsent(props.currentPage)) {
  36141. innerCurrentPage.value = newCurrentPage;
  36142. }
  36143. if (hasCurrentPageListener) {
  36144. emit("update:current-page", newCurrentPage);
  36145. emit("current-change", newCurrentPage);
  36146. }
  36147. }
  36148. });
  36149. vue.watch(pageCountBridge, (val) => {
  36150. if (currentPageBridge.value > val)
  36151. currentPageBridge.value = val;
  36152. });
  36153. vue.watch([currentPageBridge, pageSizeBridge], (value) => {
  36154. emit("change", ...value);
  36155. }, { flush: "post" });
  36156. function handleCurrentChange(val) {
  36157. currentPageBridge.value = val;
  36158. }
  36159. function handleSizeChange(val) {
  36160. pageSizeBridge.value = val;
  36161. const newPageCount = pageCountBridge.value;
  36162. if (currentPageBridge.value > newPageCount) {
  36163. currentPageBridge.value = newPageCount;
  36164. }
  36165. }
  36166. function prev() {
  36167. if (props.disabled)
  36168. return;
  36169. currentPageBridge.value -= 1;
  36170. emit("prev-click", currentPageBridge.value);
  36171. }
  36172. function next() {
  36173. if (props.disabled)
  36174. return;
  36175. currentPageBridge.value += 1;
  36176. emit("next-click", currentPageBridge.value);
  36177. }
  36178. function addClass(element, cls) {
  36179. if (element) {
  36180. if (!element.props) {
  36181. element.props = {};
  36182. }
  36183. element.props.class = [element.props.class, cls].join(" ");
  36184. }
  36185. }
  36186. vue.provide(elPaginationKey, {
  36187. pageCount: pageCountBridge,
  36188. disabled: vue.computed(() => props.disabled),
  36189. currentPage: currentPageBridge,
  36190. changeEvent: handleCurrentChange,
  36191. handleSizeChange
  36192. });
  36193. return () => {
  36194. var _a, _b;
  36195. if (!assertValidUsage.value) {
  36196. debugWarn(componentName, t("el.pagination.deprecationWarning"));
  36197. return null;
  36198. }
  36199. if (!props.layout)
  36200. return null;
  36201. if (props.hideOnSinglePage && pageCountBridge.value <= 1)
  36202. return null;
  36203. const rootChildren = [];
  36204. const rightWrapperChildren = [];
  36205. const rightWrapperRoot = vue.h("div", { class: ns.e("rightwrapper") }, rightWrapperChildren);
  36206. const TEMPLATE_MAP = {
  36207. prev: vue.h(Prev, {
  36208. disabled: props.disabled,
  36209. currentPage: currentPageBridge.value,
  36210. prevText: props.prevText,
  36211. prevIcon: props.prevIcon,
  36212. onClick: prev
  36213. }),
  36214. jumper: vue.h(Jumper, {
  36215. size: _size.value
  36216. }),
  36217. pager: vue.h(Pager, {
  36218. currentPage: currentPageBridge.value,
  36219. pageCount: pageCountBridge.value,
  36220. pagerCount: props.pagerCount,
  36221. onChange: handleCurrentChange,
  36222. disabled: props.disabled
  36223. }),
  36224. next: vue.h(Next, {
  36225. disabled: props.disabled,
  36226. currentPage: currentPageBridge.value,
  36227. pageCount: pageCountBridge.value,
  36228. nextText: props.nextText,
  36229. nextIcon: props.nextIcon,
  36230. onClick: next
  36231. }),
  36232. sizes: vue.h(Sizes, {
  36233. pageSize: pageSizeBridge.value,
  36234. pageSizes: props.pageSizes,
  36235. popperClass: props.popperClass,
  36236. disabled: props.disabled,
  36237. teleported: props.teleported,
  36238. size: _size.value,
  36239. appendSizeTo: props.appendSizeTo
  36240. }),
  36241. slot: (_b = (_a = slots == null ? void 0 : slots.default) == null ? void 0 : _a.call(slots)) != null ? _b : null,
  36242. total: vue.h(Total, { total: isAbsent(props.total) ? 0 : props.total })
  36243. };
  36244. const components = props.layout.split(",").map((item) => item.trim());
  36245. let haveRightWrapper = false;
  36246. components.forEach((c) => {
  36247. if (c === "->") {
  36248. haveRightWrapper = true;
  36249. return;
  36250. }
  36251. if (!haveRightWrapper) {
  36252. rootChildren.push(TEMPLATE_MAP[c]);
  36253. } else {
  36254. rightWrapperChildren.push(TEMPLATE_MAP[c]);
  36255. }
  36256. });
  36257. addClass(rootChildren[0], ns.is("first"));
  36258. addClass(rootChildren[rootChildren.length - 1], ns.is("last"));
  36259. if (haveRightWrapper && rightWrapperChildren.length > 0) {
  36260. addClass(rightWrapperChildren[0], ns.is("first"));
  36261. addClass(rightWrapperChildren[rightWrapperChildren.length - 1], ns.is("last"));
  36262. rootChildren.push(rightWrapperRoot);
  36263. }
  36264. return vue.h("div", {
  36265. class: [
  36266. ns.b(),
  36267. ns.is("background", props.background),
  36268. ns.m(_size.value)
  36269. ]
  36270. }, rootChildren);
  36271. };
  36272. }
  36273. });
  36274. const ElPagination = withInstall(Pagination);
  36275. const popconfirmProps = buildProps({
  36276. title: String,
  36277. confirmButtonText: String,
  36278. cancelButtonText: String,
  36279. confirmButtonType: {
  36280. type: String,
  36281. values: buttonTypes,
  36282. default: "primary"
  36283. },
  36284. cancelButtonType: {
  36285. type: String,
  36286. values: buttonTypes,
  36287. default: "text"
  36288. },
  36289. icon: {
  36290. type: iconPropType,
  36291. default: () => question_filled_default
  36292. },
  36293. iconColor: {
  36294. type: String,
  36295. default: "#f90"
  36296. },
  36297. hideIcon: {
  36298. type: Boolean,
  36299. default: false
  36300. },
  36301. hideAfter: {
  36302. type: Number,
  36303. default: 200
  36304. },
  36305. teleported: useTooltipContentProps.teleported,
  36306. persistent: useTooltipContentProps.persistent,
  36307. width: {
  36308. type: [String, Number],
  36309. default: 150
  36310. }
  36311. });
  36312. const popconfirmEmits = {
  36313. confirm: (e) => e instanceof MouseEvent,
  36314. cancel: (e) => e instanceof MouseEvent
  36315. };
  36316. const __default__$J = vue.defineComponent({
  36317. name: "ElPopconfirm"
  36318. });
  36319. const _sfc_main$T = /* @__PURE__ */ vue.defineComponent({
  36320. ...__default__$J,
  36321. props: popconfirmProps,
  36322. emits: popconfirmEmits,
  36323. setup(__props, { emit }) {
  36324. const props = __props;
  36325. const { t } = useLocale();
  36326. const ns = useNamespace("popconfirm");
  36327. const tooltipRef = vue.ref();
  36328. const hidePopper = () => {
  36329. var _a, _b;
  36330. (_b = (_a = tooltipRef.value) == null ? void 0 : _a.onClose) == null ? void 0 : _b.call(_a);
  36331. };
  36332. const style = vue.computed(() => {
  36333. return {
  36334. width: addUnit(props.width)
  36335. };
  36336. });
  36337. const confirm = (e) => {
  36338. emit("confirm", e);
  36339. hidePopper();
  36340. };
  36341. const cancel = (e) => {
  36342. emit("cancel", e);
  36343. hidePopper();
  36344. };
  36345. const finalConfirmButtonText = vue.computed(() => props.confirmButtonText || t("el.popconfirm.confirmButtonText"));
  36346. const finalCancelButtonText = vue.computed(() => props.cancelButtonText || t("el.popconfirm.cancelButtonText"));
  36347. return (_ctx, _cache) => {
  36348. return vue.openBlock(), vue.createBlock(vue.unref(ElTooltip), vue.mergeProps({
  36349. ref_key: "tooltipRef",
  36350. ref: tooltipRef,
  36351. trigger: "click",
  36352. effect: "light"
  36353. }, _ctx.$attrs, {
  36354. "popper-class": `${vue.unref(ns).namespace.value}-popover`,
  36355. "popper-style": vue.unref(style),
  36356. teleported: _ctx.teleported,
  36357. "fallback-placements": ["bottom", "top", "right", "left"],
  36358. "hide-after": _ctx.hideAfter,
  36359. persistent: _ctx.persistent
  36360. }), {
  36361. content: vue.withCtx(() => [
  36362. vue.createElementVNode("div", {
  36363. class: vue.normalizeClass(vue.unref(ns).b())
  36364. }, [
  36365. vue.createElementVNode("div", {
  36366. class: vue.normalizeClass(vue.unref(ns).e("main"))
  36367. }, [
  36368. !_ctx.hideIcon && _ctx.icon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  36369. key: 0,
  36370. class: vue.normalizeClass(vue.unref(ns).e("icon")),
  36371. style: vue.normalizeStyle({ color: _ctx.iconColor })
  36372. }, {
  36373. default: vue.withCtx(() => [
  36374. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.icon)))
  36375. ]),
  36376. _: 1
  36377. }, 8, ["class", "style"])) : vue.createCommentVNode("v-if", true),
  36378. vue.createTextVNode(" " + vue.toDisplayString(_ctx.title), 1)
  36379. ], 2),
  36380. vue.createElementVNode("div", {
  36381. class: vue.normalizeClass(vue.unref(ns).e("action"))
  36382. }, [
  36383. vue.renderSlot(_ctx.$slots, "actions", {
  36384. confirm,
  36385. cancel
  36386. }, () => [
  36387. vue.createVNode(vue.unref(ElButton), {
  36388. size: "small",
  36389. type: _ctx.cancelButtonType === "text" ? "" : _ctx.cancelButtonType,
  36390. text: _ctx.cancelButtonType === "text",
  36391. onClick: cancel
  36392. }, {
  36393. default: vue.withCtx(() => [
  36394. vue.createTextVNode(vue.toDisplayString(vue.unref(finalCancelButtonText)), 1)
  36395. ]),
  36396. _: 1
  36397. }, 8, ["type", "text"]),
  36398. vue.createVNode(vue.unref(ElButton), {
  36399. size: "small",
  36400. type: _ctx.confirmButtonType === "text" ? "" : _ctx.confirmButtonType,
  36401. text: _ctx.confirmButtonType === "text",
  36402. onClick: confirm
  36403. }, {
  36404. default: vue.withCtx(() => [
  36405. vue.createTextVNode(vue.toDisplayString(vue.unref(finalConfirmButtonText)), 1)
  36406. ]),
  36407. _: 1
  36408. }, 8, ["type", "text"])
  36409. ])
  36410. ], 2)
  36411. ], 2)
  36412. ]),
  36413. default: vue.withCtx(() => [
  36414. _ctx.$slots.reference ? vue.renderSlot(_ctx.$slots, "reference", { key: 0 }) : vue.createCommentVNode("v-if", true)
  36415. ]),
  36416. _: 3
  36417. }, 16, ["popper-class", "popper-style", "teleported", "hide-after", "persistent"]);
  36418. };
  36419. }
  36420. });
  36421. var Popconfirm = /* @__PURE__ */ _export_sfc(_sfc_main$T, [["__file", "popconfirm.vue"]]);
  36422. const ElPopconfirm = withInstall(Popconfirm);
  36423. const popoverProps = buildProps({
  36424. trigger: useTooltipTriggerProps.trigger,
  36425. placement: dropdownProps.placement,
  36426. disabled: useTooltipTriggerProps.disabled,
  36427. visible: useTooltipContentProps.visible,
  36428. transition: useTooltipContentProps.transition,
  36429. popperOptions: dropdownProps.popperOptions,
  36430. tabindex: dropdownProps.tabindex,
  36431. content: useTooltipContentProps.content,
  36432. popperStyle: useTooltipContentProps.popperStyle,
  36433. popperClass: useTooltipContentProps.popperClass,
  36434. enterable: {
  36435. ...useTooltipContentProps.enterable,
  36436. default: true
  36437. },
  36438. effect: {
  36439. ...useTooltipContentProps.effect,
  36440. default: "light"
  36441. },
  36442. teleported: useTooltipContentProps.teleported,
  36443. title: String,
  36444. width: {
  36445. type: [String, Number],
  36446. default: 150
  36447. },
  36448. offset: {
  36449. type: Number,
  36450. default: void 0
  36451. },
  36452. showAfter: {
  36453. type: Number,
  36454. default: 0
  36455. },
  36456. hideAfter: {
  36457. type: Number,
  36458. default: 200
  36459. },
  36460. autoClose: {
  36461. type: Number,
  36462. default: 0
  36463. },
  36464. showArrow: {
  36465. type: Boolean,
  36466. default: true
  36467. },
  36468. persistent: {
  36469. type: Boolean,
  36470. default: true
  36471. },
  36472. "onUpdate:visible": {
  36473. type: Function
  36474. }
  36475. });
  36476. const popoverEmits = {
  36477. "update:visible": (value) => isBoolean(value),
  36478. "before-enter": () => true,
  36479. "before-leave": () => true,
  36480. "after-enter": () => true,
  36481. "after-leave": () => true
  36482. };
  36483. const updateEventKeyRaw = `onUpdate:visible`;
  36484. const __default__$I = vue.defineComponent({
  36485. name: "ElPopover"
  36486. });
  36487. const _sfc_main$S = /* @__PURE__ */ vue.defineComponent({
  36488. ...__default__$I,
  36489. props: popoverProps,
  36490. emits: popoverEmits,
  36491. setup(__props, { expose, emit }) {
  36492. const props = __props;
  36493. const onUpdateVisible = vue.computed(() => {
  36494. return props[updateEventKeyRaw];
  36495. });
  36496. const ns = useNamespace("popover");
  36497. const tooltipRef = vue.ref();
  36498. const popperRef = vue.computed(() => {
  36499. var _a;
  36500. return (_a = vue.unref(tooltipRef)) == null ? void 0 : _a.popperRef;
  36501. });
  36502. const style = vue.computed(() => {
  36503. return [
  36504. {
  36505. width: addUnit(props.width)
  36506. },
  36507. props.popperStyle
  36508. ];
  36509. });
  36510. const kls = vue.computed(() => {
  36511. return [ns.b(), props.popperClass, { [ns.m("plain")]: !!props.content }];
  36512. });
  36513. const gpuAcceleration = vue.computed(() => {
  36514. return props.transition === `${ns.namespace.value}-fade-in-linear`;
  36515. });
  36516. const hide = () => {
  36517. var _a;
  36518. (_a = tooltipRef.value) == null ? void 0 : _a.hide();
  36519. };
  36520. const beforeEnter = () => {
  36521. emit("before-enter");
  36522. };
  36523. const beforeLeave = () => {
  36524. emit("before-leave");
  36525. };
  36526. const afterEnter = () => {
  36527. emit("after-enter");
  36528. };
  36529. const afterLeave = () => {
  36530. emit("update:visible", false);
  36531. emit("after-leave");
  36532. };
  36533. expose({
  36534. popperRef,
  36535. hide
  36536. });
  36537. return (_ctx, _cache) => {
  36538. return vue.openBlock(), vue.createBlock(vue.unref(ElTooltip), vue.mergeProps({
  36539. ref_key: "tooltipRef",
  36540. ref: tooltipRef
  36541. }, _ctx.$attrs, {
  36542. trigger: _ctx.trigger,
  36543. placement: _ctx.placement,
  36544. disabled: _ctx.disabled,
  36545. visible: _ctx.visible,
  36546. transition: _ctx.transition,
  36547. "popper-options": _ctx.popperOptions,
  36548. tabindex: _ctx.tabindex,
  36549. content: _ctx.content,
  36550. offset: _ctx.offset,
  36551. "show-after": _ctx.showAfter,
  36552. "hide-after": _ctx.hideAfter,
  36553. "auto-close": _ctx.autoClose,
  36554. "show-arrow": _ctx.showArrow,
  36555. "aria-label": _ctx.title,
  36556. effect: _ctx.effect,
  36557. enterable: _ctx.enterable,
  36558. "popper-class": vue.unref(kls),
  36559. "popper-style": vue.unref(style),
  36560. teleported: _ctx.teleported,
  36561. persistent: _ctx.persistent,
  36562. "gpu-acceleration": vue.unref(gpuAcceleration),
  36563. "onUpdate:visible": vue.unref(onUpdateVisible),
  36564. onBeforeShow: beforeEnter,
  36565. onBeforeHide: beforeLeave,
  36566. onShow: afterEnter,
  36567. onHide: afterLeave
  36568. }), {
  36569. content: vue.withCtx(() => [
  36570. _ctx.title ? (vue.openBlock(), vue.createElementBlock("div", {
  36571. key: 0,
  36572. class: vue.normalizeClass(vue.unref(ns).e("title")),
  36573. role: "title"
  36574. }, vue.toDisplayString(_ctx.title), 3)) : vue.createCommentVNode("v-if", true),
  36575. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  36576. vue.createTextVNode(vue.toDisplayString(_ctx.content), 1)
  36577. ])
  36578. ]),
  36579. default: vue.withCtx(() => [
  36580. _ctx.$slots.reference ? vue.renderSlot(_ctx.$slots, "reference", { key: 0 }) : vue.createCommentVNode("v-if", true)
  36581. ]),
  36582. _: 3
  36583. }, 16, ["trigger", "placement", "disabled", "visible", "transition", "popper-options", "tabindex", "content", "offset", "show-after", "hide-after", "auto-close", "show-arrow", "aria-label", "effect", "enterable", "popper-class", "popper-style", "teleported", "persistent", "gpu-acceleration", "onUpdate:visible"]);
  36584. };
  36585. }
  36586. });
  36587. var Popover = /* @__PURE__ */ _export_sfc(_sfc_main$S, [["__file", "popover.vue"]]);
  36588. const attachEvents = (el, binding) => {
  36589. const popperComponent = binding.arg || binding.value;
  36590. const popover = popperComponent == null ? void 0 : popperComponent.popperRef;
  36591. if (popover) {
  36592. popover.triggerRef = el;
  36593. }
  36594. };
  36595. var PopoverDirective = {
  36596. mounted(el, binding) {
  36597. attachEvents(el, binding);
  36598. },
  36599. updated(el, binding) {
  36600. attachEvents(el, binding);
  36601. }
  36602. };
  36603. const VPopover = "popover";
  36604. const ElPopoverDirective = withInstallDirective(PopoverDirective, VPopover);
  36605. const ElPopover = withInstall(Popover, {
  36606. directive: ElPopoverDirective
  36607. });
  36608. const progressProps = buildProps({
  36609. type: {
  36610. type: String,
  36611. default: "line",
  36612. values: ["line", "circle", "dashboard"]
  36613. },
  36614. percentage: {
  36615. type: Number,
  36616. default: 0,
  36617. validator: (val) => val >= 0 && val <= 100
  36618. },
  36619. status: {
  36620. type: String,
  36621. default: "",
  36622. values: ["", "success", "exception", "warning"]
  36623. },
  36624. indeterminate: Boolean,
  36625. duration: {
  36626. type: Number,
  36627. default: 3
  36628. },
  36629. strokeWidth: {
  36630. type: Number,
  36631. default: 6
  36632. },
  36633. strokeLinecap: {
  36634. type: definePropType(String),
  36635. default: "round"
  36636. },
  36637. textInside: Boolean,
  36638. width: {
  36639. type: Number,
  36640. default: 126
  36641. },
  36642. showText: {
  36643. type: Boolean,
  36644. default: true
  36645. },
  36646. color: {
  36647. type: definePropType([
  36648. String,
  36649. Array,
  36650. Function
  36651. ]),
  36652. default: ""
  36653. },
  36654. striped: Boolean,
  36655. stripedFlow: Boolean,
  36656. format: {
  36657. type: definePropType(Function),
  36658. default: (percentage) => `${percentage}%`
  36659. }
  36660. });
  36661. const __default__$H = vue.defineComponent({
  36662. name: "ElProgress"
  36663. });
  36664. const _sfc_main$R = /* @__PURE__ */ vue.defineComponent({
  36665. ...__default__$H,
  36666. props: progressProps,
  36667. setup(__props) {
  36668. const props = __props;
  36669. const STATUS_COLOR_MAP = {
  36670. success: "#13ce66",
  36671. exception: "#ff4949",
  36672. warning: "#e6a23c",
  36673. default: "#20a0ff"
  36674. };
  36675. const ns = useNamespace("progress");
  36676. const barStyle = vue.computed(() => {
  36677. const barStyle2 = {
  36678. width: `${props.percentage}%`,
  36679. animationDuration: `${props.duration}s`
  36680. };
  36681. const color = getCurrentColor(props.percentage);
  36682. if (color.includes("gradient")) {
  36683. barStyle2.background = color;
  36684. } else {
  36685. barStyle2.backgroundColor = color;
  36686. }
  36687. return barStyle2;
  36688. });
  36689. const relativeStrokeWidth = vue.computed(() => (props.strokeWidth / props.width * 100).toFixed(1));
  36690. const radius = vue.computed(() => {
  36691. if (["circle", "dashboard"].includes(props.type)) {
  36692. return Number.parseInt(`${50 - Number.parseFloat(relativeStrokeWidth.value) / 2}`, 10);
  36693. }
  36694. return 0;
  36695. });
  36696. const trackPath = vue.computed(() => {
  36697. const r = radius.value;
  36698. const isDashboard = props.type === "dashboard";
  36699. return `
  36700. M 50 50
  36701. m 0 ${isDashboard ? "" : "-"}${r}
  36702. a ${r} ${r} 0 1 1 0 ${isDashboard ? "-" : ""}${r * 2}
  36703. a ${r} ${r} 0 1 1 0 ${isDashboard ? "" : "-"}${r * 2}
  36704. `;
  36705. });
  36706. const perimeter = vue.computed(() => 2 * Math.PI * radius.value);
  36707. const rate = vue.computed(() => props.type === "dashboard" ? 0.75 : 1);
  36708. const strokeDashoffset = vue.computed(() => {
  36709. const offset = -1 * perimeter.value * (1 - rate.value) / 2;
  36710. return `${offset}px`;
  36711. });
  36712. const trailPathStyle = vue.computed(() => ({
  36713. strokeDasharray: `${perimeter.value * rate.value}px, ${perimeter.value}px`,
  36714. strokeDashoffset: strokeDashoffset.value
  36715. }));
  36716. const circlePathStyle = vue.computed(() => ({
  36717. strokeDasharray: `${perimeter.value * rate.value * (props.percentage / 100)}px, ${perimeter.value}px`,
  36718. strokeDashoffset: strokeDashoffset.value,
  36719. transition: "stroke-dasharray 0.6s ease 0s, stroke 0.6s ease, opacity ease 0.6s"
  36720. }));
  36721. const stroke = vue.computed(() => {
  36722. let ret;
  36723. if (props.color) {
  36724. ret = getCurrentColor(props.percentage);
  36725. } else {
  36726. ret = STATUS_COLOR_MAP[props.status] || STATUS_COLOR_MAP.default;
  36727. }
  36728. return ret;
  36729. });
  36730. const statusIcon = vue.computed(() => {
  36731. if (props.status === "warning") {
  36732. return warning_filled_default;
  36733. }
  36734. if (props.type === "line") {
  36735. return props.status === "success" ? circle_check_default : circle_close_default;
  36736. } else {
  36737. return props.status === "success" ? check_default : close_default;
  36738. }
  36739. });
  36740. const progressTextSize = vue.computed(() => {
  36741. return props.type === "line" ? 12 + props.strokeWidth * 0.4 : props.width * 0.111111 + 2;
  36742. });
  36743. const content = vue.computed(() => props.format(props.percentage));
  36744. function getColors(color) {
  36745. const span = 100 / color.length;
  36746. const seriesColors = color.map((seriesColor, index) => {
  36747. if (isString$1(seriesColor)) {
  36748. return {
  36749. color: seriesColor,
  36750. percentage: (index + 1) * span
  36751. };
  36752. }
  36753. return seriesColor;
  36754. });
  36755. return seriesColors.sort((a, b) => a.percentage - b.percentage);
  36756. }
  36757. const getCurrentColor = (percentage) => {
  36758. var _a;
  36759. const { color } = props;
  36760. if (isFunction$1(color)) {
  36761. return color(percentage);
  36762. } else if (isString$1(color)) {
  36763. return color;
  36764. } else {
  36765. const colors = getColors(color);
  36766. for (const color2 of colors) {
  36767. if (color2.percentage > percentage)
  36768. return color2.color;
  36769. }
  36770. return (_a = colors[colors.length - 1]) == null ? void 0 : _a.color;
  36771. }
  36772. };
  36773. return (_ctx, _cache) => {
  36774. return vue.openBlock(), vue.createElementBlock("div", {
  36775. class: vue.normalizeClass([
  36776. vue.unref(ns).b(),
  36777. vue.unref(ns).m(_ctx.type),
  36778. vue.unref(ns).is(_ctx.status),
  36779. {
  36780. [vue.unref(ns).m("without-text")]: !_ctx.showText,
  36781. [vue.unref(ns).m("text-inside")]: _ctx.textInside
  36782. }
  36783. ]),
  36784. role: "progressbar",
  36785. "aria-valuenow": _ctx.percentage,
  36786. "aria-valuemin": "0",
  36787. "aria-valuemax": "100"
  36788. }, [
  36789. _ctx.type === "line" ? (vue.openBlock(), vue.createElementBlock("div", {
  36790. key: 0,
  36791. class: vue.normalizeClass(vue.unref(ns).b("bar"))
  36792. }, [
  36793. vue.createElementVNode("div", {
  36794. class: vue.normalizeClass(vue.unref(ns).be("bar", "outer")),
  36795. style: vue.normalizeStyle({ height: `${_ctx.strokeWidth}px` })
  36796. }, [
  36797. vue.createElementVNode("div", {
  36798. class: vue.normalizeClass([
  36799. vue.unref(ns).be("bar", "inner"),
  36800. { [vue.unref(ns).bem("bar", "inner", "indeterminate")]: _ctx.indeterminate },
  36801. { [vue.unref(ns).bem("bar", "inner", "striped")]: _ctx.striped },
  36802. { [vue.unref(ns).bem("bar", "inner", "striped-flow")]: _ctx.stripedFlow }
  36803. ]),
  36804. style: vue.normalizeStyle(vue.unref(barStyle))
  36805. }, [
  36806. (_ctx.showText || _ctx.$slots.default) && _ctx.textInside ? (vue.openBlock(), vue.createElementBlock("div", {
  36807. key: 0,
  36808. class: vue.normalizeClass(vue.unref(ns).be("bar", "innerText"))
  36809. }, [
  36810. vue.renderSlot(_ctx.$slots, "default", { percentage: _ctx.percentage }, () => [
  36811. vue.createElementVNode("span", null, vue.toDisplayString(vue.unref(content)), 1)
  36812. ])
  36813. ], 2)) : vue.createCommentVNode("v-if", true)
  36814. ], 6)
  36815. ], 6)
  36816. ], 2)) : (vue.openBlock(), vue.createElementBlock("div", {
  36817. key: 1,
  36818. class: vue.normalizeClass(vue.unref(ns).b("circle")),
  36819. style: vue.normalizeStyle({ height: `${_ctx.width}px`, width: `${_ctx.width}px` })
  36820. }, [
  36821. (vue.openBlock(), vue.createElementBlock("svg", { viewBox: "0 0 100 100" }, [
  36822. vue.createElementVNode("path", {
  36823. class: vue.normalizeClass(vue.unref(ns).be("circle", "track")),
  36824. d: vue.unref(trackPath),
  36825. stroke: `var(${vue.unref(ns).cssVarName("fill-color-light")}, #e5e9f2)`,
  36826. "stroke-linecap": _ctx.strokeLinecap,
  36827. "stroke-width": vue.unref(relativeStrokeWidth),
  36828. fill: "none",
  36829. style: vue.normalizeStyle(vue.unref(trailPathStyle))
  36830. }, null, 14, ["d", "stroke", "stroke-linecap", "stroke-width"]),
  36831. vue.createElementVNode("path", {
  36832. class: vue.normalizeClass(vue.unref(ns).be("circle", "path")),
  36833. d: vue.unref(trackPath),
  36834. stroke: vue.unref(stroke),
  36835. fill: "none",
  36836. opacity: _ctx.percentage ? 1 : 0,
  36837. "stroke-linecap": _ctx.strokeLinecap,
  36838. "stroke-width": vue.unref(relativeStrokeWidth),
  36839. style: vue.normalizeStyle(vue.unref(circlePathStyle))
  36840. }, null, 14, ["d", "stroke", "opacity", "stroke-linecap", "stroke-width"])
  36841. ]))
  36842. ], 6)),
  36843. (_ctx.showText || _ctx.$slots.default) && !_ctx.textInside ? (vue.openBlock(), vue.createElementBlock("div", {
  36844. key: 2,
  36845. class: vue.normalizeClass(vue.unref(ns).e("text")),
  36846. style: vue.normalizeStyle({ fontSize: `${vue.unref(progressTextSize)}px` })
  36847. }, [
  36848. vue.renderSlot(_ctx.$slots, "default", { percentage: _ctx.percentage }, () => [
  36849. !_ctx.status ? (vue.openBlock(), vue.createElementBlock("span", { key: 0 }, vue.toDisplayString(vue.unref(content)), 1)) : (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 1 }, {
  36850. default: vue.withCtx(() => [
  36851. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(statusIcon))))
  36852. ]),
  36853. _: 1
  36854. }))
  36855. ])
  36856. ], 6)) : vue.createCommentVNode("v-if", true)
  36857. ], 10, ["aria-valuenow"]);
  36858. };
  36859. }
  36860. });
  36861. var Progress = /* @__PURE__ */ _export_sfc(_sfc_main$R, [["__file", "progress.vue"]]);
  36862. const ElProgress = withInstall(Progress);
  36863. const rateProps = buildProps({
  36864. modelValue: {
  36865. type: Number,
  36866. default: 0
  36867. },
  36868. id: {
  36869. type: String,
  36870. default: void 0
  36871. },
  36872. lowThreshold: {
  36873. type: Number,
  36874. default: 2
  36875. },
  36876. highThreshold: {
  36877. type: Number,
  36878. default: 4
  36879. },
  36880. max: {
  36881. type: Number,
  36882. default: 5
  36883. },
  36884. colors: {
  36885. type: definePropType([Array, Object]),
  36886. default: () => mutable(["", "", ""])
  36887. },
  36888. voidColor: {
  36889. type: String,
  36890. default: ""
  36891. },
  36892. disabledVoidColor: {
  36893. type: String,
  36894. default: ""
  36895. },
  36896. icons: {
  36897. type: definePropType([Array, Object]),
  36898. default: () => [star_filled_default, star_filled_default, star_filled_default]
  36899. },
  36900. voidIcon: {
  36901. type: iconPropType,
  36902. default: () => star_default
  36903. },
  36904. disabledVoidIcon: {
  36905. type: iconPropType,
  36906. default: () => star_filled_default
  36907. },
  36908. disabled: Boolean,
  36909. allowHalf: Boolean,
  36910. showText: Boolean,
  36911. showScore: Boolean,
  36912. textColor: {
  36913. type: String,
  36914. default: ""
  36915. },
  36916. texts: {
  36917. type: definePropType(Array),
  36918. default: () => mutable([
  36919. "Extremely bad",
  36920. "Disappointed",
  36921. "Fair",
  36922. "Satisfied",
  36923. "Surprise"
  36924. ])
  36925. },
  36926. scoreTemplate: {
  36927. type: String,
  36928. default: "{value}"
  36929. },
  36930. size: useSizeProp,
  36931. clearable: Boolean,
  36932. ...useAriaProps(["ariaLabel"])
  36933. });
  36934. const rateEmits = {
  36935. [CHANGE_EVENT]: (value) => isNumber(value),
  36936. [UPDATE_MODEL_EVENT]: (value) => isNumber(value)
  36937. };
  36938. const __default__$G = vue.defineComponent({
  36939. name: "ElRate"
  36940. });
  36941. const _sfc_main$Q = /* @__PURE__ */ vue.defineComponent({
  36942. ...__default__$G,
  36943. props: rateProps,
  36944. emits: rateEmits,
  36945. setup(__props, { expose, emit }) {
  36946. const props = __props;
  36947. function getValueFromMap(value, map) {
  36948. const isExcludedObject = (val) => isObject$1(val);
  36949. const matchedKeys = Object.keys(map).map((key) => +key).filter((key) => {
  36950. const val = map[key];
  36951. const excluded = isExcludedObject(val) ? val.excluded : false;
  36952. return excluded ? value < key : value <= key;
  36953. }).sort((a, b) => a - b);
  36954. const matchedValue = map[matchedKeys[0]];
  36955. return isExcludedObject(matchedValue) && matchedValue.value || matchedValue;
  36956. }
  36957. const formContext = vue.inject(formContextKey, void 0);
  36958. const formItemContext = vue.inject(formItemContextKey, void 0);
  36959. const rateSize = useFormSize();
  36960. const ns = useNamespace("rate");
  36961. const { inputId, isLabeledByFormItem } = useFormItemInputId(props, {
  36962. formItemContext
  36963. });
  36964. const currentValue = vue.ref(props.modelValue);
  36965. const hoverIndex = vue.ref(-1);
  36966. const pointerAtLeftHalf = vue.ref(true);
  36967. const rateClasses = vue.computed(() => [ns.b(), ns.m(rateSize.value)]);
  36968. const rateDisabled = vue.computed(() => props.disabled || (formContext == null ? void 0 : formContext.disabled));
  36969. const rateStyles = vue.computed(() => {
  36970. return ns.cssVarBlock({
  36971. "void-color": props.voidColor,
  36972. "disabled-void-color": props.disabledVoidColor,
  36973. "fill-color": activeColor.value
  36974. });
  36975. });
  36976. const text = vue.computed(() => {
  36977. let result = "";
  36978. if (props.showScore) {
  36979. result = props.scoreTemplate.replace(/\{\s*value\s*\}/, rateDisabled.value ? `${props.modelValue}` : `${currentValue.value}`);
  36980. } else if (props.showText) {
  36981. result = props.texts[Math.ceil(currentValue.value) - 1];
  36982. }
  36983. return result;
  36984. });
  36985. const valueDecimal = vue.computed(() => props.modelValue * 100 - Math.floor(props.modelValue) * 100);
  36986. const colorMap = vue.computed(() => isArray$1(props.colors) ? {
  36987. [props.lowThreshold]: props.colors[0],
  36988. [props.highThreshold]: { value: props.colors[1], excluded: true },
  36989. [props.max]: props.colors[2]
  36990. } : props.colors);
  36991. const activeColor = vue.computed(() => {
  36992. const color = getValueFromMap(currentValue.value, colorMap.value);
  36993. return isObject$1(color) ? "" : color;
  36994. });
  36995. const decimalStyle = vue.computed(() => {
  36996. let width = "";
  36997. if (rateDisabled.value) {
  36998. width = `${valueDecimal.value}%`;
  36999. } else if (props.allowHalf) {
  37000. width = "50%";
  37001. }
  37002. return {
  37003. color: activeColor.value,
  37004. width
  37005. };
  37006. });
  37007. const componentMap = vue.computed(() => {
  37008. let icons = isArray$1(props.icons) ? [...props.icons] : { ...props.icons };
  37009. icons = vue.markRaw(icons);
  37010. return isArray$1(icons) ? {
  37011. [props.lowThreshold]: icons[0],
  37012. [props.highThreshold]: {
  37013. value: icons[1],
  37014. excluded: true
  37015. },
  37016. [props.max]: icons[2]
  37017. } : icons;
  37018. });
  37019. const decimalIconComponent = vue.computed(() => getValueFromMap(props.modelValue, componentMap.value));
  37020. const voidComponent = vue.computed(() => rateDisabled.value ? isString$1(props.disabledVoidIcon) ? props.disabledVoidIcon : vue.markRaw(props.disabledVoidIcon) : isString$1(props.voidIcon) ? props.voidIcon : vue.markRaw(props.voidIcon));
  37021. const activeComponent = vue.computed(() => getValueFromMap(currentValue.value, componentMap.value));
  37022. function showDecimalIcon(item) {
  37023. const showWhenDisabled = rateDisabled.value && valueDecimal.value > 0 && item - 1 < props.modelValue && item > props.modelValue;
  37024. const showWhenAllowHalf = props.allowHalf && pointerAtLeftHalf.value && item - 0.5 <= currentValue.value && item > currentValue.value;
  37025. return showWhenDisabled || showWhenAllowHalf;
  37026. }
  37027. function emitValue(value) {
  37028. if (props.clearable && value === props.modelValue) {
  37029. value = 0;
  37030. }
  37031. emit(UPDATE_MODEL_EVENT, value);
  37032. if (props.modelValue !== value) {
  37033. emit("change", value);
  37034. }
  37035. }
  37036. function selectValue(value) {
  37037. if (rateDisabled.value) {
  37038. return;
  37039. }
  37040. if (props.allowHalf && pointerAtLeftHalf.value) {
  37041. emitValue(currentValue.value);
  37042. } else {
  37043. emitValue(value);
  37044. }
  37045. }
  37046. function handleKey(e) {
  37047. if (rateDisabled.value) {
  37048. return;
  37049. }
  37050. let _currentValue = currentValue.value;
  37051. const code = e.code;
  37052. if (code === EVENT_CODE.up || code === EVENT_CODE.right) {
  37053. if (props.allowHalf) {
  37054. _currentValue += 0.5;
  37055. } else {
  37056. _currentValue += 1;
  37057. }
  37058. e.stopPropagation();
  37059. e.preventDefault();
  37060. } else if (code === EVENT_CODE.left || code === EVENT_CODE.down) {
  37061. if (props.allowHalf) {
  37062. _currentValue -= 0.5;
  37063. } else {
  37064. _currentValue -= 1;
  37065. }
  37066. e.stopPropagation();
  37067. e.preventDefault();
  37068. }
  37069. _currentValue = _currentValue < 0 ? 0 : _currentValue;
  37070. _currentValue = _currentValue > props.max ? props.max : _currentValue;
  37071. emit(UPDATE_MODEL_EVENT, _currentValue);
  37072. emit("change", _currentValue);
  37073. return _currentValue;
  37074. }
  37075. function setCurrentValue(value, event) {
  37076. if (rateDisabled.value) {
  37077. return;
  37078. }
  37079. if (props.allowHalf && event) {
  37080. let target = event.target;
  37081. if (hasClass(target, ns.e("item"))) {
  37082. target = target.querySelector(`.${ns.e("icon")}`);
  37083. }
  37084. if (target.clientWidth === 0 || hasClass(target, ns.e("decimal"))) {
  37085. target = target.parentNode;
  37086. }
  37087. pointerAtLeftHalf.value = event.offsetX * 2 <= target.clientWidth;
  37088. currentValue.value = pointerAtLeftHalf.value ? value - 0.5 : value;
  37089. } else {
  37090. currentValue.value = value;
  37091. }
  37092. hoverIndex.value = value;
  37093. }
  37094. function resetCurrentValue() {
  37095. if (rateDisabled.value) {
  37096. return;
  37097. }
  37098. if (props.allowHalf) {
  37099. pointerAtLeftHalf.value = props.modelValue !== Math.floor(props.modelValue);
  37100. }
  37101. currentValue.value = props.modelValue;
  37102. hoverIndex.value = -1;
  37103. }
  37104. vue.watch(() => props.modelValue, (val) => {
  37105. currentValue.value = val;
  37106. pointerAtLeftHalf.value = props.modelValue !== Math.floor(props.modelValue);
  37107. });
  37108. if (!props.modelValue) {
  37109. emit(UPDATE_MODEL_EVENT, 0);
  37110. }
  37111. expose({
  37112. setCurrentValue,
  37113. resetCurrentValue
  37114. });
  37115. return (_ctx, _cache) => {
  37116. var _a;
  37117. return vue.openBlock(), vue.createElementBlock("div", {
  37118. id: vue.unref(inputId),
  37119. class: vue.normalizeClass([vue.unref(rateClasses), vue.unref(ns).is("disabled", vue.unref(rateDisabled))]),
  37120. role: "slider",
  37121. "aria-label": !vue.unref(isLabeledByFormItem) ? _ctx.ariaLabel || "rating" : void 0,
  37122. "aria-labelledby": vue.unref(isLabeledByFormItem) ? (_a = vue.unref(formItemContext)) == null ? void 0 : _a.labelId : void 0,
  37123. "aria-valuenow": currentValue.value,
  37124. "aria-valuetext": vue.unref(text) || void 0,
  37125. "aria-valuemin": "0",
  37126. "aria-valuemax": _ctx.max,
  37127. tabindex: "0",
  37128. style: vue.normalizeStyle(vue.unref(rateStyles)),
  37129. onKeydown: handleKey
  37130. }, [
  37131. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.max, (item, key) => {
  37132. return vue.openBlock(), vue.createElementBlock("span", {
  37133. key,
  37134. class: vue.normalizeClass(vue.unref(ns).e("item")),
  37135. onMousemove: ($event) => setCurrentValue(item, $event),
  37136. onMouseleave: resetCurrentValue,
  37137. onClick: ($event) => selectValue(item)
  37138. }, [
  37139. vue.createVNode(vue.unref(ElIcon), {
  37140. class: vue.normalizeClass([
  37141. vue.unref(ns).e("icon"),
  37142. { hover: hoverIndex.value === item },
  37143. vue.unref(ns).is("active", item <= currentValue.value)
  37144. ])
  37145. }, {
  37146. default: vue.withCtx(() => [
  37147. !showDecimalIcon(item) ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  37148. vue.withDirectives((vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(activeComponent)), null, null, 512)), [
  37149. [vue.vShow, item <= currentValue.value]
  37150. ]),
  37151. vue.withDirectives((vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(voidComponent)), null, null, 512)), [
  37152. [vue.vShow, !(item <= currentValue.value)]
  37153. ])
  37154. ], 64)) : vue.createCommentVNode("v-if", true),
  37155. showDecimalIcon(item) ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  37156. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(voidComponent)), {
  37157. class: vue.normalizeClass([vue.unref(ns).em("decimal", "box")])
  37158. }, null, 8, ["class"])),
  37159. vue.createVNode(vue.unref(ElIcon), {
  37160. style: vue.normalizeStyle(vue.unref(decimalStyle)),
  37161. class: vue.normalizeClass([vue.unref(ns).e("icon"), vue.unref(ns).e("decimal")])
  37162. }, {
  37163. default: vue.withCtx(() => [
  37164. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(decimalIconComponent))))
  37165. ]),
  37166. _: 1
  37167. }, 8, ["style", "class"])
  37168. ], 64)) : vue.createCommentVNode("v-if", true)
  37169. ]),
  37170. _: 2
  37171. }, 1032, ["class"])
  37172. ], 42, ["onMousemove", "onClick"]);
  37173. }), 128)),
  37174. _ctx.showText || _ctx.showScore ? (vue.openBlock(), vue.createElementBlock("span", {
  37175. key: 0,
  37176. class: vue.normalizeClass(vue.unref(ns).e("text")),
  37177. style: vue.normalizeStyle({ color: _ctx.textColor })
  37178. }, vue.toDisplayString(vue.unref(text)), 7)) : vue.createCommentVNode("v-if", true)
  37179. ], 46, ["id", "aria-label", "aria-labelledby", "aria-valuenow", "aria-valuetext", "aria-valuemax"]);
  37180. };
  37181. }
  37182. });
  37183. var Rate = /* @__PURE__ */ _export_sfc(_sfc_main$Q, [["__file", "rate.vue"]]);
  37184. const ElRate = withInstall(Rate);
  37185. const IconMap = {
  37186. success: "icon-success",
  37187. warning: "icon-warning",
  37188. error: "icon-error",
  37189. info: "icon-info"
  37190. };
  37191. const IconComponentMap = {
  37192. [IconMap.success]: circle_check_filled_default,
  37193. [IconMap.warning]: warning_filled_default,
  37194. [IconMap.error]: circle_close_filled_default,
  37195. [IconMap.info]: info_filled_default
  37196. };
  37197. const resultProps = buildProps({
  37198. title: {
  37199. type: String,
  37200. default: ""
  37201. },
  37202. subTitle: {
  37203. type: String,
  37204. default: ""
  37205. },
  37206. icon: {
  37207. type: String,
  37208. values: ["success", "warning", "info", "error"],
  37209. default: "info"
  37210. }
  37211. });
  37212. const __default__$F = vue.defineComponent({
  37213. name: "ElResult"
  37214. });
  37215. const _sfc_main$P = /* @__PURE__ */ vue.defineComponent({
  37216. ...__default__$F,
  37217. props: resultProps,
  37218. setup(__props) {
  37219. const props = __props;
  37220. const ns = useNamespace("result");
  37221. const resultIcon = vue.computed(() => {
  37222. const icon = props.icon;
  37223. const iconClass = icon && IconMap[icon] ? IconMap[icon] : "icon-info";
  37224. const iconComponent = IconComponentMap[iconClass] || IconComponentMap["icon-info"];
  37225. return {
  37226. class: iconClass,
  37227. component: iconComponent
  37228. };
  37229. });
  37230. return (_ctx, _cache) => {
  37231. return vue.openBlock(), vue.createElementBlock("div", {
  37232. class: vue.normalizeClass(vue.unref(ns).b())
  37233. }, [
  37234. vue.createElementVNode("div", {
  37235. class: vue.normalizeClass(vue.unref(ns).e("icon"))
  37236. }, [
  37237. vue.renderSlot(_ctx.$slots, "icon", {}, () => [
  37238. vue.unref(resultIcon).component ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(resultIcon).component), {
  37239. key: 0,
  37240. class: vue.normalizeClass(vue.unref(resultIcon).class)
  37241. }, null, 8, ["class"])) : vue.createCommentVNode("v-if", true)
  37242. ])
  37243. ], 2),
  37244. _ctx.title || _ctx.$slots.title ? (vue.openBlock(), vue.createElementBlock("div", {
  37245. key: 0,
  37246. class: vue.normalizeClass(vue.unref(ns).e("title"))
  37247. }, [
  37248. vue.renderSlot(_ctx.$slots, "title", {}, () => [
  37249. vue.createElementVNode("p", null, vue.toDisplayString(_ctx.title), 1)
  37250. ])
  37251. ], 2)) : vue.createCommentVNode("v-if", true),
  37252. _ctx.subTitle || _ctx.$slots["sub-title"] ? (vue.openBlock(), vue.createElementBlock("div", {
  37253. key: 1,
  37254. class: vue.normalizeClass(vue.unref(ns).e("subtitle"))
  37255. }, [
  37256. vue.renderSlot(_ctx.$slots, "sub-title", {}, () => [
  37257. vue.createElementVNode("p", null, vue.toDisplayString(_ctx.subTitle), 1)
  37258. ])
  37259. ], 2)) : vue.createCommentVNode("v-if", true),
  37260. _ctx.$slots.extra ? (vue.openBlock(), vue.createElementBlock("div", {
  37261. key: 2,
  37262. class: vue.normalizeClass(vue.unref(ns).e("extra"))
  37263. }, [
  37264. vue.renderSlot(_ctx.$slots, "extra")
  37265. ], 2)) : vue.createCommentVNode("v-if", true)
  37266. ], 2);
  37267. };
  37268. }
  37269. });
  37270. var Result = /* @__PURE__ */ _export_sfc(_sfc_main$P, [["__file", "result.vue"]]);
  37271. const ElResult = withInstall(Result);
  37272. var safeIsNaN = Number.isNaN || function ponyfill(value) {
  37273. return typeof value === "number" && value !== value;
  37274. };
  37275. function isEqual(first, second) {
  37276. if (first === second) {
  37277. return true;
  37278. }
  37279. if (safeIsNaN(first) && safeIsNaN(second)) {
  37280. return true;
  37281. }
  37282. return false;
  37283. }
  37284. function areInputsEqual(newInputs, lastInputs) {
  37285. if (newInputs.length !== lastInputs.length) {
  37286. return false;
  37287. }
  37288. for (var i = 0; i < newInputs.length; i++) {
  37289. if (!isEqual(newInputs[i], lastInputs[i])) {
  37290. return false;
  37291. }
  37292. }
  37293. return true;
  37294. }
  37295. function memoizeOne(resultFn, isEqual2) {
  37296. if (isEqual2 === void 0) {
  37297. isEqual2 = areInputsEqual;
  37298. }
  37299. var cache = null;
  37300. function memoized() {
  37301. var newArgs = [];
  37302. for (var _i = 0; _i < arguments.length; _i++) {
  37303. newArgs[_i] = arguments[_i];
  37304. }
  37305. if (cache && cache.lastThis === this && isEqual2(newArgs, cache.lastArgs)) {
  37306. return cache.lastResult;
  37307. }
  37308. var lastResult = resultFn.apply(this, newArgs);
  37309. cache = {
  37310. lastResult,
  37311. lastArgs: newArgs,
  37312. lastThis: this
  37313. };
  37314. return lastResult;
  37315. }
  37316. memoized.clear = function clear() {
  37317. cache = null;
  37318. };
  37319. return memoized;
  37320. }
  37321. const useCache = () => {
  37322. const vm = vue.getCurrentInstance();
  37323. const props = vm.proxy.$props;
  37324. return vue.computed(() => {
  37325. const _getItemStyleCache = (_, __, ___) => ({});
  37326. return props.perfMode ? memoize(_getItemStyleCache) : memoizeOne(_getItemStyleCache);
  37327. });
  37328. };
  37329. const DEFAULT_DYNAMIC_LIST_ITEM_SIZE = 50;
  37330. const ITEM_RENDER_EVT = "itemRendered";
  37331. const SCROLL_EVT = "scroll";
  37332. const FORWARD = "forward";
  37333. const BACKWARD = "backward";
  37334. const AUTO_ALIGNMENT = "auto";
  37335. const SMART_ALIGNMENT = "smart";
  37336. const START_ALIGNMENT = "start";
  37337. const CENTERED_ALIGNMENT = "center";
  37338. const END_ALIGNMENT = "end";
  37339. const HORIZONTAL = "horizontal";
  37340. const VERTICAL = "vertical";
  37341. const LTR = "ltr";
  37342. const RTL = "rtl";
  37343. const RTL_OFFSET_NAG = "negative";
  37344. const RTL_OFFSET_POS_ASC = "positive-ascending";
  37345. const RTL_OFFSET_POS_DESC = "positive-descending";
  37346. const ScrollbarDirKey = {
  37347. [HORIZONTAL]: "left",
  37348. [VERTICAL]: "top"
  37349. };
  37350. const SCROLLBAR_MIN_SIZE = 20;
  37351. const LayoutKeys = {
  37352. [HORIZONTAL]: "deltaX",
  37353. [VERTICAL]: "deltaY"
  37354. };
  37355. const useWheel = ({ atEndEdge, atStartEdge, layout }, onWheelDelta) => {
  37356. let frameHandle;
  37357. let offset = 0;
  37358. const hasReachedEdge = (offset2) => {
  37359. const edgeReached = offset2 < 0 && atStartEdge.value || offset2 > 0 && atEndEdge.value;
  37360. return edgeReached;
  37361. };
  37362. const onWheel = (e) => {
  37363. cAF(frameHandle);
  37364. const newOffset = e[LayoutKeys[layout.value]];
  37365. if (hasReachedEdge(offset) && hasReachedEdge(offset + newOffset))
  37366. return;
  37367. offset += newOffset;
  37368. if (!isFirefox()) {
  37369. e.preventDefault();
  37370. }
  37371. frameHandle = rAF(() => {
  37372. onWheelDelta(offset);
  37373. offset = 0;
  37374. });
  37375. };
  37376. return {
  37377. hasReachedEdge,
  37378. onWheel
  37379. };
  37380. };
  37381. var useWheel$1 = useWheel;
  37382. const itemSize$1 = buildProp({
  37383. type: definePropType([Number, Function]),
  37384. required: true
  37385. });
  37386. const estimatedItemSize = buildProp({
  37387. type: Number
  37388. });
  37389. const cache = buildProp({
  37390. type: Number,
  37391. default: 2
  37392. });
  37393. const direction = buildProp({
  37394. type: String,
  37395. values: ["ltr", "rtl"],
  37396. default: "ltr"
  37397. });
  37398. const initScrollOffset = buildProp({
  37399. type: Number,
  37400. default: 0
  37401. });
  37402. const total = buildProp({
  37403. type: Number,
  37404. required: true
  37405. });
  37406. const layout = buildProp({
  37407. type: String,
  37408. values: ["horizontal", "vertical"],
  37409. default: VERTICAL
  37410. });
  37411. const virtualizedProps = buildProps({
  37412. className: {
  37413. type: String,
  37414. default: ""
  37415. },
  37416. containerElement: {
  37417. type: definePropType([String, Object]),
  37418. default: "div"
  37419. },
  37420. data: {
  37421. type: definePropType(Array),
  37422. default: () => mutable([])
  37423. },
  37424. direction,
  37425. height: {
  37426. type: [String, Number],
  37427. required: true
  37428. },
  37429. innerElement: {
  37430. type: [String, Object],
  37431. default: "div"
  37432. },
  37433. style: {
  37434. type: definePropType([Object, String, Array])
  37435. },
  37436. useIsScrolling: {
  37437. type: Boolean,
  37438. default: false
  37439. },
  37440. width: {
  37441. type: [Number, String],
  37442. required: false
  37443. },
  37444. perfMode: {
  37445. type: Boolean,
  37446. default: true
  37447. },
  37448. scrollbarAlwaysOn: {
  37449. type: Boolean,
  37450. default: false
  37451. }
  37452. });
  37453. const virtualizedListProps = buildProps({
  37454. cache,
  37455. estimatedItemSize,
  37456. layout,
  37457. initScrollOffset,
  37458. total,
  37459. itemSize: itemSize$1,
  37460. ...virtualizedProps
  37461. });
  37462. const scrollbarSize = {
  37463. type: Number,
  37464. default: 6
  37465. };
  37466. const startGap = { type: Number, default: 0 };
  37467. const endGap = { type: Number, default: 2 };
  37468. const virtualizedGridProps = buildProps({
  37469. columnCache: cache,
  37470. columnWidth: itemSize$1,
  37471. estimatedColumnWidth: estimatedItemSize,
  37472. estimatedRowHeight: estimatedItemSize,
  37473. initScrollLeft: initScrollOffset,
  37474. initScrollTop: initScrollOffset,
  37475. itemKey: {
  37476. type: definePropType(Function),
  37477. default: ({
  37478. columnIndex,
  37479. rowIndex
  37480. }) => `${rowIndex}:${columnIndex}`
  37481. },
  37482. rowCache: cache,
  37483. rowHeight: itemSize$1,
  37484. totalColumn: total,
  37485. totalRow: total,
  37486. hScrollbarSize: scrollbarSize,
  37487. vScrollbarSize: scrollbarSize,
  37488. scrollbarStartGap: startGap,
  37489. scrollbarEndGap: endGap,
  37490. role: String,
  37491. ...virtualizedProps
  37492. });
  37493. const virtualizedScrollbarProps = buildProps({
  37494. alwaysOn: Boolean,
  37495. class: String,
  37496. layout,
  37497. total,
  37498. ratio: {
  37499. type: Number,
  37500. required: true
  37501. },
  37502. clientSize: {
  37503. type: Number,
  37504. required: true
  37505. },
  37506. scrollFrom: {
  37507. type: Number,
  37508. required: true
  37509. },
  37510. scrollbarSize,
  37511. startGap,
  37512. endGap,
  37513. visible: Boolean
  37514. });
  37515. const getScrollDir = (prev, cur) => prev < cur ? FORWARD : BACKWARD;
  37516. const isHorizontal = (dir) => dir === LTR || dir === RTL || dir === HORIZONTAL;
  37517. const isRTL = (dir) => dir === RTL;
  37518. let cachedRTLResult = null;
  37519. function getRTLOffsetType(recalculate = false) {
  37520. if (cachedRTLResult === null || recalculate) {
  37521. const outerDiv = document.createElement("div");
  37522. const outerStyle = outerDiv.style;
  37523. outerStyle.width = "50px";
  37524. outerStyle.height = "50px";
  37525. outerStyle.overflow = "scroll";
  37526. outerStyle.direction = "rtl";
  37527. const innerDiv = document.createElement("div");
  37528. const innerStyle = innerDiv.style;
  37529. innerStyle.width = "100px";
  37530. innerStyle.height = "100px";
  37531. outerDiv.appendChild(innerDiv);
  37532. document.body.appendChild(outerDiv);
  37533. if (outerDiv.scrollLeft > 0) {
  37534. cachedRTLResult = RTL_OFFSET_POS_DESC;
  37535. } else {
  37536. outerDiv.scrollLeft = 1;
  37537. if (outerDiv.scrollLeft === 0) {
  37538. cachedRTLResult = RTL_OFFSET_NAG;
  37539. } else {
  37540. cachedRTLResult = RTL_OFFSET_POS_ASC;
  37541. }
  37542. }
  37543. document.body.removeChild(outerDiv);
  37544. return cachedRTLResult;
  37545. }
  37546. return cachedRTLResult;
  37547. }
  37548. function renderThumbStyle({ move, size, bar }, layout) {
  37549. const style = {};
  37550. const translate = `translate${bar.axis}(${move}px)`;
  37551. style[bar.size] = size;
  37552. style.transform = translate;
  37553. style.msTransform = translate;
  37554. style.webkitTransform = translate;
  37555. if (layout === "horizontal") {
  37556. style.height = "100%";
  37557. } else {
  37558. style.width = "100%";
  37559. }
  37560. return style;
  37561. }
  37562. const ScrollBar = vue.defineComponent({
  37563. name: "ElVirtualScrollBar",
  37564. props: virtualizedScrollbarProps,
  37565. emits: ["scroll", "start-move", "stop-move"],
  37566. setup(props, { emit }) {
  37567. const GAP = vue.computed(() => props.startGap + props.endGap);
  37568. const nsVirtualScrollbar = useNamespace("virtual-scrollbar");
  37569. const nsScrollbar = useNamespace("scrollbar");
  37570. const trackRef = vue.ref();
  37571. const thumbRef = vue.ref();
  37572. let frameHandle = null;
  37573. let onselectstartStore = null;
  37574. const state = vue.reactive({
  37575. isDragging: false,
  37576. traveled: 0
  37577. });
  37578. const bar = vue.computed(() => BAR_MAP[props.layout]);
  37579. const trackSize = vue.computed(() => props.clientSize - vue.unref(GAP));
  37580. const trackStyle = vue.computed(() => ({
  37581. position: "absolute",
  37582. width: `${HORIZONTAL === props.layout ? trackSize.value : props.scrollbarSize}px`,
  37583. height: `${HORIZONTAL === props.layout ? props.scrollbarSize : trackSize.value}px`,
  37584. [ScrollbarDirKey[props.layout]]: "2px",
  37585. right: "2px",
  37586. bottom: "2px",
  37587. borderRadius: "4px"
  37588. }));
  37589. const thumbSize = vue.computed(() => {
  37590. const ratio = props.ratio;
  37591. const clientSize = props.clientSize;
  37592. if (ratio >= 100) {
  37593. return Number.POSITIVE_INFINITY;
  37594. }
  37595. if (ratio >= 50) {
  37596. return ratio * clientSize / 100;
  37597. }
  37598. const SCROLLBAR_MAX_SIZE = clientSize / 3;
  37599. return Math.floor(Math.min(Math.max(ratio * clientSize, SCROLLBAR_MIN_SIZE), SCROLLBAR_MAX_SIZE));
  37600. });
  37601. const thumbStyle = vue.computed(() => {
  37602. if (!Number.isFinite(thumbSize.value)) {
  37603. return {
  37604. display: "none"
  37605. };
  37606. }
  37607. const thumb = `${thumbSize.value}px`;
  37608. const style = renderThumbStyle({
  37609. bar: bar.value,
  37610. size: thumb,
  37611. move: state.traveled
  37612. }, props.layout);
  37613. return style;
  37614. });
  37615. const totalSteps = vue.computed(() => Math.floor(props.clientSize - thumbSize.value - vue.unref(GAP)));
  37616. const attachEvents = () => {
  37617. window.addEventListener("mousemove", onMouseMove);
  37618. window.addEventListener("mouseup", onMouseUp);
  37619. const thumbEl = vue.unref(thumbRef);
  37620. if (!thumbEl)
  37621. return;
  37622. onselectstartStore = document.onselectstart;
  37623. document.onselectstart = () => false;
  37624. thumbEl.addEventListener("touchmove", onMouseMove, { passive: true });
  37625. thumbEl.addEventListener("touchend", onMouseUp);
  37626. };
  37627. const detachEvents = () => {
  37628. window.removeEventListener("mousemove", onMouseMove);
  37629. window.removeEventListener("mouseup", onMouseUp);
  37630. document.onselectstart = onselectstartStore;
  37631. onselectstartStore = null;
  37632. const thumbEl = vue.unref(thumbRef);
  37633. if (!thumbEl)
  37634. return;
  37635. thumbEl.removeEventListener("touchmove", onMouseMove);
  37636. thumbEl.removeEventListener("touchend", onMouseUp);
  37637. };
  37638. const onThumbMouseDown = (e) => {
  37639. e.stopImmediatePropagation();
  37640. if (e.ctrlKey || [1, 2].includes(e.button)) {
  37641. return;
  37642. }
  37643. state.isDragging = true;
  37644. state[bar.value.axis] = e.currentTarget[bar.value.offset] - (e[bar.value.client] - e.currentTarget.getBoundingClientRect()[bar.value.direction]);
  37645. emit("start-move");
  37646. attachEvents();
  37647. };
  37648. const onMouseUp = () => {
  37649. state.isDragging = false;
  37650. state[bar.value.axis] = 0;
  37651. emit("stop-move");
  37652. detachEvents();
  37653. };
  37654. const onMouseMove = (e) => {
  37655. const { isDragging } = state;
  37656. if (!isDragging)
  37657. return;
  37658. if (!thumbRef.value || !trackRef.value)
  37659. return;
  37660. const prevPage = state[bar.value.axis];
  37661. if (!prevPage)
  37662. return;
  37663. cAF(frameHandle);
  37664. const offset = (trackRef.value.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]) * -1;
  37665. const thumbClickPosition = thumbRef.value[bar.value.offset] - prevPage;
  37666. const distance = offset - thumbClickPosition;
  37667. frameHandle = rAF(() => {
  37668. state.traveled = Math.max(props.startGap, Math.min(distance, totalSteps.value));
  37669. emit("scroll", distance, totalSteps.value);
  37670. });
  37671. };
  37672. const clickTrackHandler = (e) => {
  37673. const offset = Math.abs(e.target.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]);
  37674. const thumbHalf = thumbRef.value[bar.value.offset] / 2;
  37675. const distance = offset - thumbHalf;
  37676. state.traveled = Math.max(0, Math.min(distance, totalSteps.value));
  37677. emit("scroll", distance, totalSteps.value);
  37678. };
  37679. vue.watch(() => props.scrollFrom, (v) => {
  37680. if (state.isDragging)
  37681. return;
  37682. state.traveled = Math.ceil(v * totalSteps.value);
  37683. });
  37684. vue.onBeforeUnmount(() => {
  37685. detachEvents();
  37686. });
  37687. return () => {
  37688. return vue.h("div", {
  37689. role: "presentation",
  37690. ref: trackRef,
  37691. class: [
  37692. nsVirtualScrollbar.b(),
  37693. props.class,
  37694. (props.alwaysOn || state.isDragging) && "always-on"
  37695. ],
  37696. style: trackStyle.value,
  37697. onMousedown: vue.withModifiers(clickTrackHandler, ["stop", "prevent"]),
  37698. onTouchstartPrevent: onThumbMouseDown
  37699. }, vue.h("div", {
  37700. ref: thumbRef,
  37701. class: nsScrollbar.e("thumb"),
  37702. style: thumbStyle.value,
  37703. onMousedown: onThumbMouseDown
  37704. }, []));
  37705. };
  37706. }
  37707. });
  37708. var Scrollbar = ScrollBar;
  37709. const createList = ({
  37710. name,
  37711. getOffset,
  37712. getItemSize,
  37713. getItemOffset,
  37714. getEstimatedTotalSize,
  37715. getStartIndexForOffset,
  37716. getStopIndexForStartIndex,
  37717. initCache,
  37718. clearCache,
  37719. validateProps
  37720. }) => {
  37721. return vue.defineComponent({
  37722. name: name != null ? name : "ElVirtualList",
  37723. props: virtualizedListProps,
  37724. emits: [ITEM_RENDER_EVT, SCROLL_EVT],
  37725. setup(props, { emit, expose }) {
  37726. validateProps(props);
  37727. const instance = vue.getCurrentInstance();
  37728. const ns = useNamespace("vl");
  37729. const dynamicSizeCache = vue.ref(initCache(props, instance));
  37730. const getItemStyleCache = useCache();
  37731. const windowRef = vue.ref();
  37732. const innerRef = vue.ref();
  37733. const scrollbarRef = vue.ref();
  37734. const states = vue.ref({
  37735. isScrolling: false,
  37736. scrollDir: "forward",
  37737. scrollOffset: isNumber(props.initScrollOffset) ? props.initScrollOffset : 0,
  37738. updateRequested: false,
  37739. isScrollbarDragging: false,
  37740. scrollbarAlwaysOn: props.scrollbarAlwaysOn
  37741. });
  37742. const itemsToRender = vue.computed(() => {
  37743. const { total, cache } = props;
  37744. const { isScrolling, scrollDir, scrollOffset } = vue.unref(states);
  37745. if (total === 0) {
  37746. return [0, 0, 0, 0];
  37747. }
  37748. const startIndex = getStartIndexForOffset(props, scrollOffset, vue.unref(dynamicSizeCache));
  37749. const stopIndex = getStopIndexForStartIndex(props, startIndex, scrollOffset, vue.unref(dynamicSizeCache));
  37750. const cacheBackward = !isScrolling || scrollDir === BACKWARD ? Math.max(1, cache) : 1;
  37751. const cacheForward = !isScrolling || scrollDir === FORWARD ? Math.max(1, cache) : 1;
  37752. return [
  37753. Math.max(0, startIndex - cacheBackward),
  37754. Math.max(0, Math.min(total - 1, stopIndex + cacheForward)),
  37755. startIndex,
  37756. stopIndex
  37757. ];
  37758. });
  37759. const estimatedTotalSize = vue.computed(() => getEstimatedTotalSize(props, vue.unref(dynamicSizeCache)));
  37760. const _isHorizontal = vue.computed(() => isHorizontal(props.layout));
  37761. const windowStyle = vue.computed(() => [
  37762. {
  37763. position: "relative",
  37764. [`overflow-${_isHorizontal.value ? "x" : "y"}`]: "scroll",
  37765. WebkitOverflowScrolling: "touch",
  37766. willChange: "transform"
  37767. },
  37768. {
  37769. direction: props.direction,
  37770. height: isNumber(props.height) ? `${props.height}px` : props.height,
  37771. width: isNumber(props.width) ? `${props.width}px` : props.width
  37772. },
  37773. props.style
  37774. ]);
  37775. const innerStyle = vue.computed(() => {
  37776. const size = vue.unref(estimatedTotalSize);
  37777. const horizontal = vue.unref(_isHorizontal);
  37778. return {
  37779. height: horizontal ? "100%" : `${size}px`,
  37780. pointerEvents: vue.unref(states).isScrolling ? "none" : void 0,
  37781. width: horizontal ? `${size}px` : "100%"
  37782. };
  37783. });
  37784. const clientSize = vue.computed(() => _isHorizontal.value ? props.width : props.height);
  37785. const { onWheel } = useWheel$1({
  37786. atStartEdge: vue.computed(() => states.value.scrollOffset <= 0),
  37787. atEndEdge: vue.computed(() => states.value.scrollOffset >= estimatedTotalSize.value),
  37788. layout: vue.computed(() => props.layout)
  37789. }, (offset) => {
  37790. var _a, _b;
  37791. (_b = (_a = scrollbarRef.value).onMouseUp) == null ? void 0 : _b.call(_a);
  37792. scrollTo(Math.min(states.value.scrollOffset + offset, estimatedTotalSize.value - clientSize.value));
  37793. });
  37794. useEventListener(windowRef, "wheel", onWheel, {
  37795. passive: false
  37796. });
  37797. const emitEvents = () => {
  37798. const { total } = props;
  37799. if (total > 0) {
  37800. const [cacheStart, cacheEnd, visibleStart, visibleEnd] = vue.unref(itemsToRender);
  37801. emit(ITEM_RENDER_EVT, cacheStart, cacheEnd, visibleStart, visibleEnd);
  37802. }
  37803. const { scrollDir, scrollOffset, updateRequested } = vue.unref(states);
  37804. emit(SCROLL_EVT, scrollDir, scrollOffset, updateRequested);
  37805. };
  37806. const scrollVertically = (e) => {
  37807. const { clientHeight, scrollHeight, scrollTop } = e.currentTarget;
  37808. const _states = vue.unref(states);
  37809. if (_states.scrollOffset === scrollTop) {
  37810. return;
  37811. }
  37812. const scrollOffset = Math.max(0, Math.min(scrollTop, scrollHeight - clientHeight));
  37813. states.value = {
  37814. ..._states,
  37815. isScrolling: true,
  37816. scrollDir: getScrollDir(_states.scrollOffset, scrollOffset),
  37817. scrollOffset,
  37818. updateRequested: false
  37819. };
  37820. vue.nextTick(resetIsScrolling);
  37821. };
  37822. const scrollHorizontally = (e) => {
  37823. const { clientWidth, scrollLeft, scrollWidth } = e.currentTarget;
  37824. const _states = vue.unref(states);
  37825. if (_states.scrollOffset === scrollLeft) {
  37826. return;
  37827. }
  37828. const { direction } = props;
  37829. let scrollOffset = scrollLeft;
  37830. if (direction === RTL) {
  37831. switch (getRTLOffsetType()) {
  37832. case RTL_OFFSET_NAG: {
  37833. scrollOffset = -scrollLeft;
  37834. break;
  37835. }
  37836. case RTL_OFFSET_POS_DESC: {
  37837. scrollOffset = scrollWidth - clientWidth - scrollLeft;
  37838. break;
  37839. }
  37840. }
  37841. }
  37842. scrollOffset = Math.max(0, Math.min(scrollOffset, scrollWidth - clientWidth));
  37843. states.value = {
  37844. ..._states,
  37845. isScrolling: true,
  37846. scrollDir: getScrollDir(_states.scrollOffset, scrollOffset),
  37847. scrollOffset,
  37848. updateRequested: false
  37849. };
  37850. vue.nextTick(resetIsScrolling);
  37851. };
  37852. const onScroll = (e) => {
  37853. vue.unref(_isHorizontal) ? scrollHorizontally(e) : scrollVertically(e);
  37854. emitEvents();
  37855. };
  37856. const onScrollbarScroll = (distanceToGo, totalSteps) => {
  37857. const offset = (estimatedTotalSize.value - clientSize.value) / totalSteps * distanceToGo;
  37858. scrollTo(Math.min(estimatedTotalSize.value - clientSize.value, offset));
  37859. };
  37860. const scrollTo = (offset) => {
  37861. offset = Math.max(offset, 0);
  37862. if (offset === vue.unref(states).scrollOffset) {
  37863. return;
  37864. }
  37865. states.value = {
  37866. ...vue.unref(states),
  37867. scrollOffset: offset,
  37868. scrollDir: getScrollDir(vue.unref(states).scrollOffset, offset),
  37869. updateRequested: true
  37870. };
  37871. vue.nextTick(resetIsScrolling);
  37872. };
  37873. const scrollToItem = (idx, alignment = AUTO_ALIGNMENT) => {
  37874. const { scrollOffset } = vue.unref(states);
  37875. idx = Math.max(0, Math.min(idx, props.total - 1));
  37876. scrollTo(getOffset(props, idx, alignment, scrollOffset, vue.unref(dynamicSizeCache)));
  37877. };
  37878. const getItemStyle = (idx) => {
  37879. const { direction, itemSize, layout } = props;
  37880. const itemStyleCache = getItemStyleCache.value(clearCache && itemSize, clearCache && layout, clearCache && direction);
  37881. let style;
  37882. if (hasOwn(itemStyleCache, String(idx))) {
  37883. style = itemStyleCache[idx];
  37884. } else {
  37885. const offset = getItemOffset(props, idx, vue.unref(dynamicSizeCache));
  37886. const size = getItemSize(props, idx, vue.unref(dynamicSizeCache));
  37887. const horizontal = vue.unref(_isHorizontal);
  37888. const isRtl = direction === RTL;
  37889. const offsetHorizontal = horizontal ? offset : 0;
  37890. itemStyleCache[idx] = style = {
  37891. position: "absolute",
  37892. left: isRtl ? void 0 : `${offsetHorizontal}px`,
  37893. right: isRtl ? `${offsetHorizontal}px` : void 0,
  37894. top: !horizontal ? `${offset}px` : 0,
  37895. height: !horizontal ? `${size}px` : "100%",
  37896. width: horizontal ? `${size}px` : "100%"
  37897. };
  37898. }
  37899. return style;
  37900. };
  37901. const resetIsScrolling = () => {
  37902. states.value.isScrolling = false;
  37903. vue.nextTick(() => {
  37904. getItemStyleCache.value(-1, null, null);
  37905. });
  37906. };
  37907. const resetScrollTop = () => {
  37908. const window = windowRef.value;
  37909. if (window) {
  37910. window.scrollTop = 0;
  37911. }
  37912. };
  37913. vue.onMounted(() => {
  37914. if (!isClient)
  37915. return;
  37916. const { initScrollOffset } = props;
  37917. const windowElement = vue.unref(windowRef);
  37918. if (isNumber(initScrollOffset) && windowElement) {
  37919. if (vue.unref(_isHorizontal)) {
  37920. windowElement.scrollLeft = initScrollOffset;
  37921. } else {
  37922. windowElement.scrollTop = initScrollOffset;
  37923. }
  37924. }
  37925. emitEvents();
  37926. });
  37927. vue.onUpdated(() => {
  37928. const { direction, layout } = props;
  37929. const { scrollOffset, updateRequested } = vue.unref(states);
  37930. const windowElement = vue.unref(windowRef);
  37931. if (updateRequested && windowElement) {
  37932. if (layout === HORIZONTAL) {
  37933. if (direction === RTL) {
  37934. switch (getRTLOffsetType()) {
  37935. case RTL_OFFSET_NAG: {
  37936. windowElement.scrollLeft = -scrollOffset;
  37937. break;
  37938. }
  37939. case RTL_OFFSET_POS_ASC: {
  37940. windowElement.scrollLeft = scrollOffset;
  37941. break;
  37942. }
  37943. default: {
  37944. const { clientWidth, scrollWidth } = windowElement;
  37945. windowElement.scrollLeft = scrollWidth - clientWidth - scrollOffset;
  37946. break;
  37947. }
  37948. }
  37949. } else {
  37950. windowElement.scrollLeft = scrollOffset;
  37951. }
  37952. } else {
  37953. windowElement.scrollTop = scrollOffset;
  37954. }
  37955. }
  37956. });
  37957. vue.onActivated(() => {
  37958. vue.unref(windowRef).scrollTop = vue.unref(states).scrollOffset;
  37959. });
  37960. const api = {
  37961. ns,
  37962. clientSize,
  37963. estimatedTotalSize,
  37964. windowStyle,
  37965. windowRef,
  37966. innerRef,
  37967. innerStyle,
  37968. itemsToRender,
  37969. scrollbarRef,
  37970. states,
  37971. getItemStyle,
  37972. onScroll,
  37973. onScrollbarScroll,
  37974. onWheel,
  37975. scrollTo,
  37976. scrollToItem,
  37977. resetScrollTop
  37978. };
  37979. expose({
  37980. windowRef,
  37981. innerRef,
  37982. getItemStyleCache,
  37983. scrollTo,
  37984. scrollToItem,
  37985. resetScrollTop,
  37986. states
  37987. });
  37988. return api;
  37989. },
  37990. render(ctx) {
  37991. var _a;
  37992. const {
  37993. $slots,
  37994. className,
  37995. clientSize,
  37996. containerElement,
  37997. data,
  37998. getItemStyle,
  37999. innerElement,
  38000. itemsToRender,
  38001. innerStyle,
  38002. layout,
  38003. total,
  38004. onScroll,
  38005. onScrollbarScroll,
  38006. states,
  38007. useIsScrolling,
  38008. windowStyle,
  38009. ns
  38010. } = ctx;
  38011. const [start, end] = itemsToRender;
  38012. const Container = vue.resolveDynamicComponent(containerElement);
  38013. const Inner = vue.resolveDynamicComponent(innerElement);
  38014. const children = [];
  38015. if (total > 0) {
  38016. for (let i = start; i <= end; i++) {
  38017. children.push(vue.h(vue.Fragment, { key: i }, (_a = $slots.default) == null ? void 0 : _a.call($slots, {
  38018. data,
  38019. index: i,
  38020. isScrolling: useIsScrolling ? states.isScrolling : void 0,
  38021. style: getItemStyle(i)
  38022. })));
  38023. }
  38024. }
  38025. const InnerNode = [
  38026. vue.h(Inner, {
  38027. style: innerStyle,
  38028. ref: "innerRef"
  38029. }, !isString$1(Inner) ? {
  38030. default: () => children
  38031. } : children)
  38032. ];
  38033. const scrollbar = vue.h(Scrollbar, {
  38034. ref: "scrollbarRef",
  38035. clientSize,
  38036. layout,
  38037. onScroll: onScrollbarScroll,
  38038. ratio: clientSize * 100 / this.estimatedTotalSize,
  38039. scrollFrom: states.scrollOffset / (this.estimatedTotalSize - clientSize),
  38040. total
  38041. });
  38042. const listContainer = vue.h(Container, {
  38043. class: [ns.e("window"), className],
  38044. style: windowStyle,
  38045. onScroll,
  38046. ref: "windowRef",
  38047. key: 0
  38048. }, !isString$1(Container) ? { default: () => [InnerNode] } : [InnerNode]);
  38049. return vue.h("div", {
  38050. key: 0,
  38051. class: [ns.e("wrapper"), states.scrollbarAlwaysOn ? "always-on" : ""]
  38052. }, [listContainer, scrollbar]);
  38053. }
  38054. });
  38055. };
  38056. var createList$1 = createList;
  38057. const FixedSizeList = createList$1({
  38058. name: "ElFixedSizeList",
  38059. getItemOffset: ({ itemSize }, index) => index * itemSize,
  38060. getItemSize: ({ itemSize }) => itemSize,
  38061. getEstimatedTotalSize: ({ total, itemSize }) => itemSize * total,
  38062. getOffset: ({ height, total, itemSize, layout, width }, index, alignment, scrollOffset) => {
  38063. const size = isHorizontal(layout) ? width : height;
  38064. const lastItemOffset = Math.max(0, total * itemSize - size);
  38065. const maxOffset = Math.min(lastItemOffset, index * itemSize);
  38066. const minOffset = Math.max(0, (index + 1) * itemSize - size);
  38067. if (alignment === SMART_ALIGNMENT) {
  38068. if (scrollOffset >= minOffset - size && scrollOffset <= maxOffset + size) {
  38069. alignment = AUTO_ALIGNMENT;
  38070. } else {
  38071. alignment = CENTERED_ALIGNMENT;
  38072. }
  38073. }
  38074. switch (alignment) {
  38075. case START_ALIGNMENT: {
  38076. return maxOffset;
  38077. }
  38078. case END_ALIGNMENT: {
  38079. return minOffset;
  38080. }
  38081. case CENTERED_ALIGNMENT: {
  38082. const middleOffset = Math.round(minOffset + (maxOffset - minOffset) / 2);
  38083. if (middleOffset < Math.ceil(size / 2)) {
  38084. return 0;
  38085. } else if (middleOffset > lastItemOffset + Math.floor(size / 2)) {
  38086. return lastItemOffset;
  38087. } else {
  38088. return middleOffset;
  38089. }
  38090. }
  38091. case AUTO_ALIGNMENT:
  38092. default: {
  38093. if (scrollOffset >= minOffset && scrollOffset <= maxOffset) {
  38094. return scrollOffset;
  38095. } else if (scrollOffset < minOffset) {
  38096. return minOffset;
  38097. } else {
  38098. return maxOffset;
  38099. }
  38100. }
  38101. }
  38102. },
  38103. getStartIndexForOffset: ({ total, itemSize }, offset) => Math.max(0, Math.min(total - 1, Math.floor(offset / itemSize))),
  38104. getStopIndexForStartIndex: ({ height, total, itemSize, layout, width }, startIndex, scrollOffset) => {
  38105. const offset = startIndex * itemSize;
  38106. const size = isHorizontal(layout) ? width : height;
  38107. const numVisibleItems = Math.ceil((size + scrollOffset - offset) / itemSize);
  38108. return Math.max(0, Math.min(total - 1, startIndex + numVisibleItems - 1));
  38109. },
  38110. initCache() {
  38111. return void 0;
  38112. },
  38113. clearCache: true,
  38114. validateProps() {
  38115. }
  38116. });
  38117. var FixedSizeList$1 = FixedSizeList;
  38118. const getItemFromCache$1 = (props, index, listCache) => {
  38119. const { itemSize } = props;
  38120. const { items, lastVisitedIndex } = listCache;
  38121. if (index > lastVisitedIndex) {
  38122. let offset = 0;
  38123. if (lastVisitedIndex >= 0) {
  38124. const item = items[lastVisitedIndex];
  38125. offset = item.offset + item.size;
  38126. }
  38127. for (let i = lastVisitedIndex + 1; i <= index; i++) {
  38128. const size = itemSize(i);
  38129. items[i] = {
  38130. offset,
  38131. size
  38132. };
  38133. offset += size;
  38134. }
  38135. listCache.lastVisitedIndex = index;
  38136. }
  38137. return items[index];
  38138. };
  38139. const findItem$1 = (props, listCache, offset) => {
  38140. const { items, lastVisitedIndex } = listCache;
  38141. const lastVisitedOffset = lastVisitedIndex > 0 ? items[lastVisitedIndex].offset : 0;
  38142. if (lastVisitedOffset >= offset) {
  38143. return bs$1(props, listCache, 0, lastVisitedIndex, offset);
  38144. }
  38145. return es$1(props, listCache, Math.max(0, lastVisitedIndex), offset);
  38146. };
  38147. const bs$1 = (props, listCache, low, high, offset) => {
  38148. while (low <= high) {
  38149. const mid = low + Math.floor((high - low) / 2);
  38150. const currentOffset = getItemFromCache$1(props, mid, listCache).offset;
  38151. if (currentOffset === offset) {
  38152. return mid;
  38153. } else if (currentOffset < offset) {
  38154. low = mid + 1;
  38155. } else if (currentOffset > offset) {
  38156. high = mid - 1;
  38157. }
  38158. }
  38159. return Math.max(0, low - 1);
  38160. };
  38161. const es$1 = (props, listCache, index, offset) => {
  38162. const { total } = props;
  38163. let exponent = 1;
  38164. while (index < total && getItemFromCache$1(props, index, listCache).offset < offset) {
  38165. index += exponent;
  38166. exponent *= 2;
  38167. }
  38168. return bs$1(props, listCache, Math.floor(index / 2), Math.min(index, total - 1), offset);
  38169. };
  38170. const getEstimatedTotalSize = ({ total }, { items, estimatedItemSize, lastVisitedIndex }) => {
  38171. let totalSizeOfMeasuredItems = 0;
  38172. if (lastVisitedIndex >= total) {
  38173. lastVisitedIndex = total - 1;
  38174. }
  38175. if (lastVisitedIndex >= 0) {
  38176. const item = items[lastVisitedIndex];
  38177. totalSizeOfMeasuredItems = item.offset + item.size;
  38178. }
  38179. const numUnmeasuredItems = total - lastVisitedIndex - 1;
  38180. const totalSizeOfUnmeasuredItems = numUnmeasuredItems * estimatedItemSize;
  38181. return totalSizeOfMeasuredItems + totalSizeOfUnmeasuredItems;
  38182. };
  38183. const DynamicSizeList = createList$1({
  38184. name: "ElDynamicSizeList",
  38185. getItemOffset: (props, index, listCache) => getItemFromCache$1(props, index, listCache).offset,
  38186. getItemSize: (_, index, { items }) => items[index].size,
  38187. getEstimatedTotalSize,
  38188. getOffset: (props, index, alignment, scrollOffset, listCache) => {
  38189. const { height, layout, width } = props;
  38190. const size = isHorizontal(layout) ? width : height;
  38191. const item = getItemFromCache$1(props, index, listCache);
  38192. const estimatedTotalSize = getEstimatedTotalSize(props, listCache);
  38193. const maxOffset = Math.max(0, Math.min(estimatedTotalSize - size, item.offset));
  38194. const minOffset = Math.max(0, item.offset - size + item.size);
  38195. if (alignment === SMART_ALIGNMENT) {
  38196. if (scrollOffset >= minOffset - size && scrollOffset <= maxOffset + size) {
  38197. alignment = AUTO_ALIGNMENT;
  38198. } else {
  38199. alignment = CENTERED_ALIGNMENT;
  38200. }
  38201. }
  38202. switch (alignment) {
  38203. case START_ALIGNMENT: {
  38204. return maxOffset;
  38205. }
  38206. case END_ALIGNMENT: {
  38207. return minOffset;
  38208. }
  38209. case CENTERED_ALIGNMENT: {
  38210. return Math.round(minOffset + (maxOffset - minOffset) / 2);
  38211. }
  38212. case AUTO_ALIGNMENT:
  38213. default: {
  38214. if (scrollOffset >= minOffset && scrollOffset <= maxOffset) {
  38215. return scrollOffset;
  38216. } else if (scrollOffset < minOffset) {
  38217. return minOffset;
  38218. } else {
  38219. return maxOffset;
  38220. }
  38221. }
  38222. }
  38223. },
  38224. getStartIndexForOffset: (props, offset, listCache) => findItem$1(props, listCache, offset),
  38225. getStopIndexForStartIndex: (props, startIndex, scrollOffset, listCache) => {
  38226. const { height, total, layout, width } = props;
  38227. const size = isHorizontal(layout) ? width : height;
  38228. const item = getItemFromCache$1(props, startIndex, listCache);
  38229. const maxOffset = scrollOffset + size;
  38230. let offset = item.offset + item.size;
  38231. let stopIndex = startIndex;
  38232. while (stopIndex < total - 1 && offset < maxOffset) {
  38233. stopIndex++;
  38234. offset += getItemFromCache$1(props, stopIndex, listCache).size;
  38235. }
  38236. return stopIndex;
  38237. },
  38238. initCache({ estimatedItemSize = DEFAULT_DYNAMIC_LIST_ITEM_SIZE }, instance) {
  38239. const cache = {
  38240. items: {},
  38241. estimatedItemSize,
  38242. lastVisitedIndex: -1
  38243. };
  38244. cache.clearCacheAfterIndex = (index, forceUpdate = true) => {
  38245. var _a, _b;
  38246. cache.lastVisitedIndex = Math.min(cache.lastVisitedIndex, index - 1);
  38247. (_a = instance.exposed) == null ? void 0 : _a.getItemStyleCache(-1);
  38248. if (forceUpdate) {
  38249. (_b = instance.proxy) == null ? void 0 : _b.$forceUpdate();
  38250. }
  38251. };
  38252. return cache;
  38253. },
  38254. clearCache: false,
  38255. validateProps: ({ itemSize }) => {
  38256. }
  38257. });
  38258. var DynamicSizeList$1 = DynamicSizeList;
  38259. const useGridWheel = ({ atXEndEdge, atXStartEdge, atYEndEdge, atYStartEdge }, onWheelDelta) => {
  38260. let frameHandle = null;
  38261. let xOffset = 0;
  38262. let yOffset = 0;
  38263. const hasReachedEdge = (x, y) => {
  38264. const xEdgeReached = x <= 0 && atXStartEdge.value || x >= 0 && atXEndEdge.value;
  38265. const yEdgeReached = y <= 0 && atYStartEdge.value || y >= 0 && atYEndEdge.value;
  38266. return xEdgeReached && yEdgeReached;
  38267. };
  38268. const onWheel = (e) => {
  38269. cAF(frameHandle);
  38270. let x = e.deltaX;
  38271. let y = e.deltaY;
  38272. if (Math.abs(x) > Math.abs(y)) {
  38273. y = 0;
  38274. } else {
  38275. x = 0;
  38276. }
  38277. if (e.shiftKey && y !== 0) {
  38278. x = y;
  38279. y = 0;
  38280. }
  38281. if (hasReachedEdge(xOffset, yOffset) && hasReachedEdge(xOffset + x, yOffset + y))
  38282. return;
  38283. xOffset += x;
  38284. yOffset += y;
  38285. e.preventDefault();
  38286. frameHandle = rAF(() => {
  38287. onWheelDelta(xOffset, yOffset);
  38288. xOffset = 0;
  38289. yOffset = 0;
  38290. });
  38291. };
  38292. return {
  38293. hasReachedEdge,
  38294. onWheel
  38295. };
  38296. };
  38297. const createGrid = ({
  38298. name,
  38299. clearCache,
  38300. getColumnPosition,
  38301. getColumnStartIndexForOffset,
  38302. getColumnStopIndexForStartIndex,
  38303. getEstimatedTotalHeight,
  38304. getEstimatedTotalWidth,
  38305. getColumnOffset,
  38306. getRowOffset,
  38307. getRowPosition,
  38308. getRowStartIndexForOffset,
  38309. getRowStopIndexForStartIndex,
  38310. initCache,
  38311. injectToInstance,
  38312. validateProps
  38313. }) => {
  38314. return vue.defineComponent({
  38315. name: name != null ? name : "ElVirtualList",
  38316. props: virtualizedGridProps,
  38317. emits: [ITEM_RENDER_EVT, SCROLL_EVT],
  38318. setup(props, { emit, expose, slots }) {
  38319. const ns = useNamespace("vl");
  38320. validateProps(props);
  38321. const instance = vue.getCurrentInstance();
  38322. const cache = vue.ref(initCache(props, instance));
  38323. injectToInstance == null ? void 0 : injectToInstance(instance, cache);
  38324. const windowRef = vue.ref();
  38325. const hScrollbar = vue.ref();
  38326. const vScrollbar = vue.ref();
  38327. const innerRef = vue.ref(null);
  38328. const states = vue.ref({
  38329. isScrolling: false,
  38330. scrollLeft: isNumber(props.initScrollLeft) ? props.initScrollLeft : 0,
  38331. scrollTop: isNumber(props.initScrollTop) ? props.initScrollTop : 0,
  38332. updateRequested: false,
  38333. xAxisScrollDir: FORWARD,
  38334. yAxisScrollDir: FORWARD
  38335. });
  38336. const getItemStyleCache = useCache();
  38337. const parsedHeight = vue.computed(() => Number.parseInt(`${props.height}`, 10));
  38338. const parsedWidth = vue.computed(() => Number.parseInt(`${props.width}`, 10));
  38339. const columnsToRender = vue.computed(() => {
  38340. const { totalColumn, totalRow, columnCache } = props;
  38341. const { isScrolling, xAxisScrollDir, scrollLeft } = vue.unref(states);
  38342. if (totalColumn === 0 || totalRow === 0) {
  38343. return [0, 0, 0, 0];
  38344. }
  38345. const startIndex = getColumnStartIndexForOffset(props, scrollLeft, vue.unref(cache));
  38346. const stopIndex = getColumnStopIndexForStartIndex(props, startIndex, scrollLeft, vue.unref(cache));
  38347. const cacheBackward = !isScrolling || xAxisScrollDir === BACKWARD ? Math.max(1, columnCache) : 1;
  38348. const cacheForward = !isScrolling || xAxisScrollDir === FORWARD ? Math.max(1, columnCache) : 1;
  38349. return [
  38350. Math.max(0, startIndex - cacheBackward),
  38351. Math.max(0, Math.min(totalColumn - 1, stopIndex + cacheForward)),
  38352. startIndex,
  38353. stopIndex
  38354. ];
  38355. });
  38356. const rowsToRender = vue.computed(() => {
  38357. const { totalColumn, totalRow, rowCache } = props;
  38358. const { isScrolling, yAxisScrollDir, scrollTop } = vue.unref(states);
  38359. if (totalColumn === 0 || totalRow === 0) {
  38360. return [0, 0, 0, 0];
  38361. }
  38362. const startIndex = getRowStartIndexForOffset(props, scrollTop, vue.unref(cache));
  38363. const stopIndex = getRowStopIndexForStartIndex(props, startIndex, scrollTop, vue.unref(cache));
  38364. const cacheBackward = !isScrolling || yAxisScrollDir === BACKWARD ? Math.max(1, rowCache) : 1;
  38365. const cacheForward = !isScrolling || yAxisScrollDir === FORWARD ? Math.max(1, rowCache) : 1;
  38366. return [
  38367. Math.max(0, startIndex - cacheBackward),
  38368. Math.max(0, Math.min(totalRow - 1, stopIndex + cacheForward)),
  38369. startIndex,
  38370. stopIndex
  38371. ];
  38372. });
  38373. const estimatedTotalHeight = vue.computed(() => getEstimatedTotalHeight(props, vue.unref(cache)));
  38374. const estimatedTotalWidth = vue.computed(() => getEstimatedTotalWidth(props, vue.unref(cache)));
  38375. const windowStyle = vue.computed(() => {
  38376. var _a;
  38377. return [
  38378. {
  38379. position: "relative",
  38380. overflow: "hidden",
  38381. WebkitOverflowScrolling: "touch",
  38382. willChange: "transform"
  38383. },
  38384. {
  38385. direction: props.direction,
  38386. height: isNumber(props.height) ? `${props.height}px` : props.height,
  38387. width: isNumber(props.width) ? `${props.width}px` : props.width
  38388. },
  38389. (_a = props.style) != null ? _a : {}
  38390. ];
  38391. });
  38392. const innerStyle = vue.computed(() => {
  38393. const width = `${vue.unref(estimatedTotalWidth)}px`;
  38394. const height = `${vue.unref(estimatedTotalHeight)}px`;
  38395. return {
  38396. height,
  38397. pointerEvents: vue.unref(states).isScrolling ? "none" : void 0,
  38398. width
  38399. };
  38400. });
  38401. const emitEvents = () => {
  38402. const { totalColumn, totalRow } = props;
  38403. if (totalColumn > 0 && totalRow > 0) {
  38404. const [
  38405. columnCacheStart,
  38406. columnCacheEnd,
  38407. columnVisibleStart,
  38408. columnVisibleEnd
  38409. ] = vue.unref(columnsToRender);
  38410. const [rowCacheStart, rowCacheEnd, rowVisibleStart, rowVisibleEnd] = vue.unref(rowsToRender);
  38411. emit(ITEM_RENDER_EVT, {
  38412. columnCacheStart,
  38413. columnCacheEnd,
  38414. rowCacheStart,
  38415. rowCacheEnd,
  38416. columnVisibleStart,
  38417. columnVisibleEnd,
  38418. rowVisibleStart,
  38419. rowVisibleEnd
  38420. });
  38421. }
  38422. const {
  38423. scrollLeft,
  38424. scrollTop,
  38425. updateRequested,
  38426. xAxisScrollDir,
  38427. yAxisScrollDir
  38428. } = vue.unref(states);
  38429. emit(SCROLL_EVT, {
  38430. xAxisScrollDir,
  38431. scrollLeft,
  38432. yAxisScrollDir,
  38433. scrollTop,
  38434. updateRequested
  38435. });
  38436. };
  38437. const onScroll = (e) => {
  38438. const {
  38439. clientHeight,
  38440. clientWidth,
  38441. scrollHeight,
  38442. scrollLeft,
  38443. scrollTop,
  38444. scrollWidth
  38445. } = e.currentTarget;
  38446. const _states = vue.unref(states);
  38447. if (_states.scrollTop === scrollTop && _states.scrollLeft === scrollLeft) {
  38448. return;
  38449. }
  38450. let _scrollLeft = scrollLeft;
  38451. if (isRTL(props.direction)) {
  38452. switch (getRTLOffsetType()) {
  38453. case RTL_OFFSET_NAG:
  38454. _scrollLeft = -scrollLeft;
  38455. break;
  38456. case RTL_OFFSET_POS_DESC:
  38457. _scrollLeft = scrollWidth - clientWidth - scrollLeft;
  38458. break;
  38459. }
  38460. }
  38461. states.value = {
  38462. ..._states,
  38463. isScrolling: true,
  38464. scrollLeft: _scrollLeft,
  38465. scrollTop: Math.max(0, Math.min(scrollTop, scrollHeight - clientHeight)),
  38466. updateRequested: true,
  38467. xAxisScrollDir: getScrollDir(_states.scrollLeft, _scrollLeft),
  38468. yAxisScrollDir: getScrollDir(_states.scrollTop, scrollTop)
  38469. };
  38470. vue.nextTick(() => resetIsScrolling());
  38471. onUpdated();
  38472. emitEvents();
  38473. };
  38474. const onVerticalScroll = (distance, totalSteps) => {
  38475. const height = vue.unref(parsedHeight);
  38476. const offset = (estimatedTotalHeight.value - height) / totalSteps * distance;
  38477. scrollTo({
  38478. scrollTop: Math.min(estimatedTotalHeight.value - height, offset)
  38479. });
  38480. };
  38481. const onHorizontalScroll = (distance, totalSteps) => {
  38482. const width = vue.unref(parsedWidth);
  38483. const offset = (estimatedTotalWidth.value - width) / totalSteps * distance;
  38484. scrollTo({
  38485. scrollLeft: Math.min(estimatedTotalWidth.value - width, offset)
  38486. });
  38487. };
  38488. const { onWheel } = useGridWheel({
  38489. atXStartEdge: vue.computed(() => states.value.scrollLeft <= 0),
  38490. atXEndEdge: vue.computed(() => states.value.scrollLeft >= estimatedTotalWidth.value - vue.unref(parsedWidth)),
  38491. atYStartEdge: vue.computed(() => states.value.scrollTop <= 0),
  38492. atYEndEdge: vue.computed(() => states.value.scrollTop >= estimatedTotalHeight.value - vue.unref(parsedHeight))
  38493. }, (x, y) => {
  38494. var _a, _b, _c, _d;
  38495. (_b = (_a = hScrollbar.value) == null ? void 0 : _a.onMouseUp) == null ? void 0 : _b.call(_a);
  38496. (_d = (_c = vScrollbar.value) == null ? void 0 : _c.onMouseUp) == null ? void 0 : _d.call(_c);
  38497. const width = vue.unref(parsedWidth);
  38498. const height = vue.unref(parsedHeight);
  38499. scrollTo({
  38500. scrollLeft: Math.min(states.value.scrollLeft + x, estimatedTotalWidth.value - width),
  38501. scrollTop: Math.min(states.value.scrollTop + y, estimatedTotalHeight.value - height)
  38502. });
  38503. });
  38504. useEventListener(windowRef, "wheel", onWheel, {
  38505. passive: false
  38506. });
  38507. const scrollTo = ({
  38508. scrollLeft = states.value.scrollLeft,
  38509. scrollTop = states.value.scrollTop
  38510. }) => {
  38511. scrollLeft = Math.max(scrollLeft, 0);
  38512. scrollTop = Math.max(scrollTop, 0);
  38513. const _states = vue.unref(states);
  38514. if (scrollTop === _states.scrollTop && scrollLeft === _states.scrollLeft) {
  38515. return;
  38516. }
  38517. states.value = {
  38518. ..._states,
  38519. xAxisScrollDir: getScrollDir(_states.scrollLeft, scrollLeft),
  38520. yAxisScrollDir: getScrollDir(_states.scrollTop, scrollTop),
  38521. scrollLeft,
  38522. scrollTop,
  38523. updateRequested: true
  38524. };
  38525. vue.nextTick(() => resetIsScrolling());
  38526. onUpdated();
  38527. emitEvents();
  38528. };
  38529. const scrollToItem = (rowIndex = 0, columnIdx = 0, alignment = AUTO_ALIGNMENT) => {
  38530. const _states = vue.unref(states);
  38531. columnIdx = Math.max(0, Math.min(columnIdx, props.totalColumn - 1));
  38532. rowIndex = Math.max(0, Math.min(rowIndex, props.totalRow - 1));
  38533. const scrollBarWidth = getScrollBarWidth(ns.namespace.value);
  38534. const _cache = vue.unref(cache);
  38535. const estimatedHeight = getEstimatedTotalHeight(props, _cache);
  38536. const estimatedWidth = getEstimatedTotalWidth(props, _cache);
  38537. scrollTo({
  38538. scrollLeft: getColumnOffset(props, columnIdx, alignment, _states.scrollLeft, _cache, estimatedWidth > props.width ? scrollBarWidth : 0),
  38539. scrollTop: getRowOffset(props, rowIndex, alignment, _states.scrollTop, _cache, estimatedHeight > props.height ? scrollBarWidth : 0)
  38540. });
  38541. };
  38542. const getItemStyle = (rowIndex, columnIndex) => {
  38543. const { columnWidth, direction, rowHeight } = props;
  38544. const itemStyleCache = getItemStyleCache.value(clearCache && columnWidth, clearCache && rowHeight, clearCache && direction);
  38545. const key = `${rowIndex},${columnIndex}`;
  38546. if (hasOwn(itemStyleCache, key)) {
  38547. return itemStyleCache[key];
  38548. } else {
  38549. const [, left] = getColumnPosition(props, columnIndex, vue.unref(cache));
  38550. const _cache = vue.unref(cache);
  38551. const rtl = isRTL(direction);
  38552. const [height, top] = getRowPosition(props, rowIndex, _cache);
  38553. const [width] = getColumnPosition(props, columnIndex, _cache);
  38554. itemStyleCache[key] = {
  38555. position: "absolute",
  38556. left: rtl ? void 0 : `${left}px`,
  38557. right: rtl ? `${left}px` : void 0,
  38558. top: `${top}px`,
  38559. height: `${height}px`,
  38560. width: `${width}px`
  38561. };
  38562. return itemStyleCache[key];
  38563. }
  38564. };
  38565. const resetIsScrolling = () => {
  38566. states.value.isScrolling = false;
  38567. vue.nextTick(() => {
  38568. getItemStyleCache.value(-1, null, null);
  38569. });
  38570. };
  38571. vue.onMounted(() => {
  38572. if (!isClient)
  38573. return;
  38574. const { initScrollLeft, initScrollTop } = props;
  38575. const windowElement = vue.unref(windowRef);
  38576. if (windowElement) {
  38577. if (isNumber(initScrollLeft)) {
  38578. windowElement.scrollLeft = initScrollLeft;
  38579. }
  38580. if (isNumber(initScrollTop)) {
  38581. windowElement.scrollTop = initScrollTop;
  38582. }
  38583. }
  38584. emitEvents();
  38585. });
  38586. const onUpdated = () => {
  38587. const { direction } = props;
  38588. const { scrollLeft, scrollTop, updateRequested } = vue.unref(states);
  38589. const windowElement = vue.unref(windowRef);
  38590. if (updateRequested && windowElement) {
  38591. if (direction === RTL) {
  38592. switch (getRTLOffsetType()) {
  38593. case RTL_OFFSET_NAG: {
  38594. windowElement.scrollLeft = -scrollLeft;
  38595. break;
  38596. }
  38597. case RTL_OFFSET_POS_ASC: {
  38598. windowElement.scrollLeft = scrollLeft;
  38599. break;
  38600. }
  38601. default: {
  38602. const { clientWidth, scrollWidth } = windowElement;
  38603. windowElement.scrollLeft = scrollWidth - clientWidth - scrollLeft;
  38604. break;
  38605. }
  38606. }
  38607. } else {
  38608. windowElement.scrollLeft = Math.max(0, scrollLeft);
  38609. }
  38610. windowElement.scrollTop = Math.max(0, scrollTop);
  38611. }
  38612. };
  38613. const { resetAfterColumnIndex, resetAfterRowIndex, resetAfter } = instance.proxy;
  38614. expose({
  38615. windowRef,
  38616. innerRef,
  38617. getItemStyleCache,
  38618. scrollTo,
  38619. scrollToItem,
  38620. states,
  38621. resetAfterColumnIndex,
  38622. resetAfterRowIndex,
  38623. resetAfter
  38624. });
  38625. const renderScrollbars = () => {
  38626. const {
  38627. scrollbarAlwaysOn,
  38628. scrollbarStartGap,
  38629. scrollbarEndGap,
  38630. totalColumn,
  38631. totalRow
  38632. } = props;
  38633. const width = vue.unref(parsedWidth);
  38634. const height = vue.unref(parsedHeight);
  38635. const estimatedWidth = vue.unref(estimatedTotalWidth);
  38636. const estimatedHeight = vue.unref(estimatedTotalHeight);
  38637. const { scrollLeft, scrollTop } = vue.unref(states);
  38638. const horizontalScrollbar = vue.h(Scrollbar, {
  38639. ref: hScrollbar,
  38640. alwaysOn: scrollbarAlwaysOn,
  38641. startGap: scrollbarStartGap,
  38642. endGap: scrollbarEndGap,
  38643. class: ns.e("horizontal"),
  38644. clientSize: width,
  38645. layout: "horizontal",
  38646. onScroll: onHorizontalScroll,
  38647. ratio: width * 100 / estimatedWidth,
  38648. scrollFrom: scrollLeft / (estimatedWidth - width),
  38649. total: totalRow,
  38650. visible: true
  38651. });
  38652. const verticalScrollbar = vue.h(Scrollbar, {
  38653. ref: vScrollbar,
  38654. alwaysOn: scrollbarAlwaysOn,
  38655. startGap: scrollbarStartGap,
  38656. endGap: scrollbarEndGap,
  38657. class: ns.e("vertical"),
  38658. clientSize: height,
  38659. layout: "vertical",
  38660. onScroll: onVerticalScroll,
  38661. ratio: height * 100 / estimatedHeight,
  38662. scrollFrom: scrollTop / (estimatedHeight - height),
  38663. total: totalColumn,
  38664. visible: true
  38665. });
  38666. return {
  38667. horizontalScrollbar,
  38668. verticalScrollbar
  38669. };
  38670. };
  38671. const renderItems = () => {
  38672. var _a;
  38673. const [columnStart, columnEnd] = vue.unref(columnsToRender);
  38674. const [rowStart, rowEnd] = vue.unref(rowsToRender);
  38675. const { data, totalColumn, totalRow, useIsScrolling, itemKey } = props;
  38676. const children = [];
  38677. if (totalRow > 0 && totalColumn > 0) {
  38678. for (let row = rowStart; row <= rowEnd; row++) {
  38679. for (let column = columnStart; column <= columnEnd; column++) {
  38680. const key = itemKey({ columnIndex: column, data, rowIndex: row });
  38681. children.push(vue.h(vue.Fragment, { key }, (_a = slots.default) == null ? void 0 : _a.call(slots, {
  38682. columnIndex: column,
  38683. data,
  38684. isScrolling: useIsScrolling ? vue.unref(states).isScrolling : void 0,
  38685. style: getItemStyle(row, column),
  38686. rowIndex: row
  38687. })));
  38688. }
  38689. }
  38690. }
  38691. return children;
  38692. };
  38693. const renderInner = () => {
  38694. const Inner = vue.resolveDynamicComponent(props.innerElement);
  38695. const children = renderItems();
  38696. return [
  38697. vue.h(Inner, {
  38698. style: vue.unref(innerStyle),
  38699. ref: innerRef
  38700. }, !isString$1(Inner) ? {
  38701. default: () => children
  38702. } : children)
  38703. ];
  38704. };
  38705. const renderWindow = () => {
  38706. const Container = vue.resolveDynamicComponent(props.containerElement);
  38707. const { horizontalScrollbar, verticalScrollbar } = renderScrollbars();
  38708. const Inner = renderInner();
  38709. return vue.h("div", {
  38710. key: 0,
  38711. class: ns.e("wrapper"),
  38712. role: props.role
  38713. }, [
  38714. vue.h(Container, {
  38715. class: props.className,
  38716. style: vue.unref(windowStyle),
  38717. onScroll,
  38718. ref: windowRef
  38719. }, !isString$1(Container) ? { default: () => Inner } : Inner),
  38720. horizontalScrollbar,
  38721. verticalScrollbar
  38722. ]);
  38723. };
  38724. return renderWindow;
  38725. }
  38726. });
  38727. };
  38728. var createGrid$1 = createGrid;
  38729. const FixedSizeGrid = createGrid$1({
  38730. name: "ElFixedSizeGrid",
  38731. getColumnPosition: ({ columnWidth }, index) => [
  38732. columnWidth,
  38733. index * columnWidth
  38734. ],
  38735. getRowPosition: ({ rowHeight }, index) => [
  38736. rowHeight,
  38737. index * rowHeight
  38738. ],
  38739. getEstimatedTotalHeight: ({ totalRow, rowHeight }) => rowHeight * totalRow,
  38740. getEstimatedTotalWidth: ({ totalColumn, columnWidth }) => columnWidth * totalColumn,
  38741. getColumnOffset: ({ totalColumn, columnWidth, width }, columnIndex, alignment, scrollLeft, _, scrollBarWidth) => {
  38742. width = Number(width);
  38743. const lastColumnOffset = Math.max(0, totalColumn * columnWidth - width);
  38744. const maxOffset = Math.min(lastColumnOffset, columnIndex * columnWidth);
  38745. const minOffset = Math.max(0, columnIndex * columnWidth - width + scrollBarWidth + columnWidth);
  38746. if (alignment === "smart") {
  38747. if (scrollLeft >= minOffset - width && scrollLeft <= maxOffset + width) {
  38748. alignment = AUTO_ALIGNMENT;
  38749. } else {
  38750. alignment = CENTERED_ALIGNMENT;
  38751. }
  38752. }
  38753. switch (alignment) {
  38754. case START_ALIGNMENT:
  38755. return maxOffset;
  38756. case END_ALIGNMENT:
  38757. return minOffset;
  38758. case CENTERED_ALIGNMENT: {
  38759. const middleOffset = Math.round(minOffset + (maxOffset - minOffset) / 2);
  38760. if (middleOffset < Math.ceil(width / 2)) {
  38761. return 0;
  38762. } else if (middleOffset > lastColumnOffset + Math.floor(width / 2)) {
  38763. return lastColumnOffset;
  38764. } else {
  38765. return middleOffset;
  38766. }
  38767. }
  38768. case AUTO_ALIGNMENT:
  38769. default:
  38770. if (scrollLeft >= minOffset && scrollLeft <= maxOffset) {
  38771. return scrollLeft;
  38772. } else if (minOffset > maxOffset) {
  38773. return minOffset;
  38774. } else if (scrollLeft < minOffset) {
  38775. return minOffset;
  38776. } else {
  38777. return maxOffset;
  38778. }
  38779. }
  38780. },
  38781. getRowOffset: ({ rowHeight, height, totalRow }, rowIndex, align, scrollTop, _, scrollBarWidth) => {
  38782. height = Number(height);
  38783. const lastRowOffset = Math.max(0, totalRow * rowHeight - height);
  38784. const maxOffset = Math.min(lastRowOffset, rowIndex * rowHeight);
  38785. const minOffset = Math.max(0, rowIndex * rowHeight - height + scrollBarWidth + rowHeight);
  38786. if (align === SMART_ALIGNMENT) {
  38787. if (scrollTop >= minOffset - height && scrollTop <= maxOffset + height) {
  38788. align = AUTO_ALIGNMENT;
  38789. } else {
  38790. align = CENTERED_ALIGNMENT;
  38791. }
  38792. }
  38793. switch (align) {
  38794. case START_ALIGNMENT:
  38795. return maxOffset;
  38796. case END_ALIGNMENT:
  38797. return minOffset;
  38798. case CENTERED_ALIGNMENT: {
  38799. const middleOffset = Math.round(minOffset + (maxOffset - minOffset) / 2);
  38800. if (middleOffset < Math.ceil(height / 2)) {
  38801. return 0;
  38802. } else if (middleOffset > lastRowOffset + Math.floor(height / 2)) {
  38803. return lastRowOffset;
  38804. } else {
  38805. return middleOffset;
  38806. }
  38807. }
  38808. case AUTO_ALIGNMENT:
  38809. default:
  38810. if (scrollTop >= minOffset && scrollTop <= maxOffset) {
  38811. return scrollTop;
  38812. } else if (minOffset > maxOffset) {
  38813. return minOffset;
  38814. } else if (scrollTop < minOffset) {
  38815. return minOffset;
  38816. } else {
  38817. return maxOffset;
  38818. }
  38819. }
  38820. },
  38821. getColumnStartIndexForOffset: ({ columnWidth, totalColumn }, scrollLeft) => Math.max(0, Math.min(totalColumn - 1, Math.floor(scrollLeft / columnWidth))),
  38822. getColumnStopIndexForStartIndex: ({ columnWidth, totalColumn, width }, startIndex, scrollLeft) => {
  38823. const left = startIndex * columnWidth;
  38824. const visibleColumnsCount = Math.ceil((width + scrollLeft - left) / columnWidth);
  38825. return Math.max(0, Math.min(totalColumn - 1, startIndex + visibleColumnsCount - 1));
  38826. },
  38827. getRowStartIndexForOffset: ({ rowHeight, totalRow }, scrollTop) => Math.max(0, Math.min(totalRow - 1, Math.floor(scrollTop / rowHeight))),
  38828. getRowStopIndexForStartIndex: ({ rowHeight, totalRow, height }, startIndex, scrollTop) => {
  38829. const top = startIndex * rowHeight;
  38830. const numVisibleRows = Math.ceil((height + scrollTop - top) / rowHeight);
  38831. return Math.max(0, Math.min(totalRow - 1, startIndex + numVisibleRows - 1));
  38832. },
  38833. initCache: () => void 0,
  38834. clearCache: true,
  38835. validateProps: ({ columnWidth, rowHeight }) => {
  38836. }
  38837. });
  38838. var FixedSizeGrid$1 = FixedSizeGrid;
  38839. const { max, min, floor } = Math;
  38840. const ACCESS_SIZER_KEY_MAP = {
  38841. column: "columnWidth",
  38842. row: "rowHeight"
  38843. };
  38844. const ACCESS_LAST_VISITED_KEY_MAP = {
  38845. column: "lastVisitedColumnIndex",
  38846. row: "lastVisitedRowIndex"
  38847. };
  38848. const getItemFromCache = (props, index, gridCache, type) => {
  38849. const [cachedItems, sizer, lastVisited] = [
  38850. gridCache[type],
  38851. props[ACCESS_SIZER_KEY_MAP[type]],
  38852. gridCache[ACCESS_LAST_VISITED_KEY_MAP[type]]
  38853. ];
  38854. if (index > lastVisited) {
  38855. let offset = 0;
  38856. if (lastVisited >= 0) {
  38857. const item = cachedItems[lastVisited];
  38858. offset = item.offset + item.size;
  38859. }
  38860. for (let i = lastVisited + 1; i <= index; i++) {
  38861. const size = sizer(i);
  38862. cachedItems[i] = {
  38863. offset,
  38864. size
  38865. };
  38866. offset += size;
  38867. }
  38868. gridCache[ACCESS_LAST_VISITED_KEY_MAP[type]] = index;
  38869. }
  38870. return cachedItems[index];
  38871. };
  38872. const bs = (props, gridCache, low, high, offset, type) => {
  38873. while (low <= high) {
  38874. const mid = low + floor((high - low) / 2);
  38875. const currentOffset = getItemFromCache(props, mid, gridCache, type).offset;
  38876. if (currentOffset === offset) {
  38877. return mid;
  38878. } else if (currentOffset < offset) {
  38879. low = mid + 1;
  38880. } else {
  38881. high = mid - 1;
  38882. }
  38883. }
  38884. return max(0, low - 1);
  38885. };
  38886. const es = (props, gridCache, idx, offset, type) => {
  38887. const total = type === "column" ? props.totalColumn : props.totalRow;
  38888. let exponent = 1;
  38889. while (idx < total && getItemFromCache(props, idx, gridCache, type).offset < offset) {
  38890. idx += exponent;
  38891. exponent *= 2;
  38892. }
  38893. return bs(props, gridCache, floor(idx / 2), min(idx, total - 1), offset, type);
  38894. };
  38895. const findItem = (props, gridCache, offset, type) => {
  38896. const [cache, lastVisitedIndex] = [
  38897. gridCache[type],
  38898. gridCache[ACCESS_LAST_VISITED_KEY_MAP[type]]
  38899. ];
  38900. const lastVisitedItemOffset = lastVisitedIndex > 0 ? cache[lastVisitedIndex].offset : 0;
  38901. if (lastVisitedItemOffset >= offset) {
  38902. return bs(props, gridCache, 0, lastVisitedIndex, offset, type);
  38903. }
  38904. return es(props, gridCache, max(0, lastVisitedIndex), offset, type);
  38905. };
  38906. const getEstimatedTotalHeight = ({ totalRow }, { estimatedRowHeight, lastVisitedRowIndex, row }) => {
  38907. let sizeOfVisitedRows = 0;
  38908. if (lastVisitedRowIndex >= totalRow) {
  38909. lastVisitedRowIndex = totalRow - 1;
  38910. }
  38911. if (lastVisitedRowIndex >= 0) {
  38912. const item = row[lastVisitedRowIndex];
  38913. sizeOfVisitedRows = item.offset + item.size;
  38914. }
  38915. const unvisitedItems = totalRow - lastVisitedRowIndex - 1;
  38916. const sizeOfUnvisitedItems = unvisitedItems * estimatedRowHeight;
  38917. return sizeOfVisitedRows + sizeOfUnvisitedItems;
  38918. };
  38919. const getEstimatedTotalWidth = ({ totalColumn }, { column, estimatedColumnWidth, lastVisitedColumnIndex }) => {
  38920. let sizeOfVisitedColumns = 0;
  38921. if (lastVisitedColumnIndex > totalColumn) {
  38922. lastVisitedColumnIndex = totalColumn - 1;
  38923. }
  38924. if (lastVisitedColumnIndex >= 0) {
  38925. const item = column[lastVisitedColumnIndex];
  38926. sizeOfVisitedColumns = item.offset + item.size;
  38927. }
  38928. const unvisitedItems = totalColumn - lastVisitedColumnIndex - 1;
  38929. const sizeOfUnvisitedItems = unvisitedItems * estimatedColumnWidth;
  38930. return sizeOfVisitedColumns + sizeOfUnvisitedItems;
  38931. };
  38932. const ACCESS_ESTIMATED_SIZE_KEY_MAP = {
  38933. column: getEstimatedTotalWidth,
  38934. row: getEstimatedTotalHeight
  38935. };
  38936. const getOffset$1 = (props, index, alignment, scrollOffset, cache, type, scrollBarWidth) => {
  38937. const [size, estimatedSizeAssociates] = [
  38938. type === "row" ? props.height : props.width,
  38939. ACCESS_ESTIMATED_SIZE_KEY_MAP[type]
  38940. ];
  38941. const item = getItemFromCache(props, index, cache, type);
  38942. const estimatedSize = estimatedSizeAssociates(props, cache);
  38943. const maxOffset = max(0, min(estimatedSize - size, item.offset));
  38944. const minOffset = max(0, item.offset - size + scrollBarWidth + item.size);
  38945. if (alignment === SMART_ALIGNMENT) {
  38946. if (scrollOffset >= minOffset - size && scrollOffset <= maxOffset + size) {
  38947. alignment = AUTO_ALIGNMENT;
  38948. } else {
  38949. alignment = CENTERED_ALIGNMENT;
  38950. }
  38951. }
  38952. switch (alignment) {
  38953. case START_ALIGNMENT: {
  38954. return maxOffset;
  38955. }
  38956. case END_ALIGNMENT: {
  38957. return minOffset;
  38958. }
  38959. case CENTERED_ALIGNMENT: {
  38960. return Math.round(minOffset + (maxOffset - minOffset) / 2);
  38961. }
  38962. case AUTO_ALIGNMENT:
  38963. default: {
  38964. if (scrollOffset >= minOffset && scrollOffset <= maxOffset) {
  38965. return scrollOffset;
  38966. } else if (minOffset > maxOffset) {
  38967. return minOffset;
  38968. } else if (scrollOffset < minOffset) {
  38969. return minOffset;
  38970. } else {
  38971. return maxOffset;
  38972. }
  38973. }
  38974. }
  38975. };
  38976. const DynamicSizeGrid = createGrid$1({
  38977. name: "ElDynamicSizeGrid",
  38978. getColumnPosition: (props, idx, cache) => {
  38979. const item = getItemFromCache(props, idx, cache, "column");
  38980. return [item.size, item.offset];
  38981. },
  38982. getRowPosition: (props, idx, cache) => {
  38983. const item = getItemFromCache(props, idx, cache, "row");
  38984. return [item.size, item.offset];
  38985. },
  38986. getColumnOffset: (props, columnIndex, alignment, scrollLeft, cache, scrollBarWidth) => getOffset$1(props, columnIndex, alignment, scrollLeft, cache, "column", scrollBarWidth),
  38987. getRowOffset: (props, rowIndex, alignment, scrollTop, cache, scrollBarWidth) => getOffset$1(props, rowIndex, alignment, scrollTop, cache, "row", scrollBarWidth),
  38988. getColumnStartIndexForOffset: (props, scrollLeft, cache) => findItem(props, cache, scrollLeft, "column"),
  38989. getColumnStopIndexForStartIndex: (props, startIndex, scrollLeft, cache) => {
  38990. const item = getItemFromCache(props, startIndex, cache, "column");
  38991. const maxOffset = scrollLeft + props.width;
  38992. let offset = item.offset + item.size;
  38993. let stopIndex = startIndex;
  38994. while (stopIndex < props.totalColumn - 1 && offset < maxOffset) {
  38995. stopIndex++;
  38996. offset += getItemFromCache(props, startIndex, cache, "column").size;
  38997. }
  38998. return stopIndex;
  38999. },
  39000. getEstimatedTotalHeight,
  39001. getEstimatedTotalWidth,
  39002. getRowStartIndexForOffset: (props, scrollTop, cache) => findItem(props, cache, scrollTop, "row"),
  39003. getRowStopIndexForStartIndex: (props, startIndex, scrollTop, cache) => {
  39004. const { totalRow, height } = props;
  39005. const item = getItemFromCache(props, startIndex, cache, "row");
  39006. const maxOffset = scrollTop + height;
  39007. let offset = item.size + item.offset;
  39008. let stopIndex = startIndex;
  39009. while (stopIndex < totalRow - 1 && offset < maxOffset) {
  39010. stopIndex++;
  39011. offset += getItemFromCache(props, stopIndex, cache, "row").size;
  39012. }
  39013. return stopIndex;
  39014. },
  39015. injectToInstance: (instance, cache) => {
  39016. const resetAfter = ({ columnIndex, rowIndex }, forceUpdate) => {
  39017. var _a, _b;
  39018. forceUpdate = isUndefined(forceUpdate) ? true : forceUpdate;
  39019. if (isNumber(columnIndex)) {
  39020. cache.value.lastVisitedColumnIndex = Math.min(cache.value.lastVisitedColumnIndex, columnIndex - 1);
  39021. }
  39022. if (isNumber(rowIndex)) {
  39023. cache.value.lastVisitedRowIndex = Math.min(cache.value.lastVisitedRowIndex, rowIndex - 1);
  39024. }
  39025. (_a = instance.exposed) == null ? void 0 : _a.getItemStyleCache.value(-1, null, null);
  39026. if (forceUpdate)
  39027. (_b = instance.proxy) == null ? void 0 : _b.$forceUpdate();
  39028. };
  39029. const resetAfterColumnIndex = (columnIndex, forceUpdate) => {
  39030. resetAfter({
  39031. columnIndex
  39032. }, forceUpdate);
  39033. };
  39034. const resetAfterRowIndex = (rowIndex, forceUpdate) => {
  39035. resetAfter({
  39036. rowIndex
  39037. }, forceUpdate);
  39038. };
  39039. Object.assign(instance.proxy, {
  39040. resetAfterColumnIndex,
  39041. resetAfterRowIndex,
  39042. resetAfter
  39043. });
  39044. },
  39045. initCache: ({
  39046. estimatedColumnWidth = DEFAULT_DYNAMIC_LIST_ITEM_SIZE,
  39047. estimatedRowHeight = DEFAULT_DYNAMIC_LIST_ITEM_SIZE
  39048. }) => {
  39049. const cache = {
  39050. column: {},
  39051. estimatedColumnWidth,
  39052. estimatedRowHeight,
  39053. lastVisitedColumnIndex: -1,
  39054. lastVisitedRowIndex: -1,
  39055. row: {}
  39056. };
  39057. return cache;
  39058. },
  39059. clearCache: false,
  39060. validateProps: ({ columnWidth, rowHeight }) => {
  39061. }
  39062. });
  39063. var DynamicSizeGrid$1 = DynamicSizeGrid;
  39064. const _sfc_main$O = vue.defineComponent({
  39065. props: {
  39066. item: {
  39067. type: Object,
  39068. required: true
  39069. },
  39070. style: {
  39071. type: Object
  39072. },
  39073. height: Number
  39074. },
  39075. setup() {
  39076. const ns = useNamespace("select");
  39077. return {
  39078. ns
  39079. };
  39080. }
  39081. });
  39082. function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
  39083. return vue.openBlock(), vue.createElementBlock("div", {
  39084. class: vue.normalizeClass(_ctx.ns.be("group", "title")),
  39085. style: vue.normalizeStyle({ ..._ctx.style, lineHeight: `${_ctx.height}px` })
  39086. }, vue.toDisplayString(_ctx.item.label), 7);
  39087. }
  39088. var GroupItem = /* @__PURE__ */ _export_sfc(_sfc_main$O, [["render", _sfc_render$7], ["__file", "group-item.vue"]]);
  39089. function useOption(props, { emit }) {
  39090. return {
  39091. hoverItem: () => {
  39092. if (!props.disabled) {
  39093. emit("hover", props.index);
  39094. }
  39095. },
  39096. selectOptionClick: () => {
  39097. if (!props.disabled) {
  39098. emit("select", props.item, props.index);
  39099. }
  39100. }
  39101. };
  39102. }
  39103. const defaultProps$4 = {
  39104. label: "label",
  39105. value: "value",
  39106. disabled: "disabled",
  39107. options: "options"
  39108. };
  39109. function useProps(props) {
  39110. const aliasProps = vue.computed(() => ({ ...defaultProps$4, ...props.props }));
  39111. const getLabel = (option) => get(option, aliasProps.value.label);
  39112. const getValue = (option) => get(option, aliasProps.value.value);
  39113. const getDisabled = (option) => get(option, aliasProps.value.disabled);
  39114. const getOptions = (option) => get(option, aliasProps.value.options);
  39115. return {
  39116. aliasProps,
  39117. getLabel,
  39118. getValue,
  39119. getDisabled,
  39120. getOptions
  39121. };
  39122. }
  39123. const SelectProps = buildProps({
  39124. allowCreate: Boolean,
  39125. autocomplete: {
  39126. type: definePropType(String),
  39127. default: "none"
  39128. },
  39129. automaticDropdown: Boolean,
  39130. clearable: Boolean,
  39131. clearIcon: {
  39132. type: iconPropType,
  39133. default: circle_close_default
  39134. },
  39135. effect: {
  39136. type: definePropType(String),
  39137. default: "light"
  39138. },
  39139. collapseTags: Boolean,
  39140. collapseTagsTooltip: Boolean,
  39141. maxCollapseTags: {
  39142. type: Number,
  39143. default: 1
  39144. },
  39145. defaultFirstOption: Boolean,
  39146. disabled: Boolean,
  39147. estimatedOptionHeight: {
  39148. type: Number,
  39149. default: void 0
  39150. },
  39151. filterable: Boolean,
  39152. filterMethod: Function,
  39153. height: {
  39154. type: Number,
  39155. default: 274
  39156. },
  39157. itemHeight: {
  39158. type: Number,
  39159. default: 34
  39160. },
  39161. id: String,
  39162. loading: Boolean,
  39163. loadingText: String,
  39164. modelValue: {
  39165. type: definePropType([Array, String, Number, Boolean, Object])
  39166. },
  39167. multiple: Boolean,
  39168. multipleLimit: {
  39169. type: Number,
  39170. default: 0
  39171. },
  39172. name: String,
  39173. noDataText: String,
  39174. noMatchText: String,
  39175. remoteMethod: Function,
  39176. reserveKeyword: {
  39177. type: Boolean,
  39178. default: true
  39179. },
  39180. options: {
  39181. type: definePropType(Array),
  39182. required: true
  39183. },
  39184. placeholder: {
  39185. type: String
  39186. },
  39187. teleported: useTooltipContentProps.teleported,
  39188. persistent: {
  39189. type: Boolean,
  39190. default: true
  39191. },
  39192. popperClass: {
  39193. type: String,
  39194. default: ""
  39195. },
  39196. popperOptions: {
  39197. type: definePropType(Object),
  39198. default: () => ({})
  39199. },
  39200. remote: Boolean,
  39201. size: useSizeProp,
  39202. props: {
  39203. type: definePropType(Object),
  39204. default: () => defaultProps$4
  39205. },
  39206. valueKey: {
  39207. type: String,
  39208. default: "value"
  39209. },
  39210. scrollbarAlwaysOn: Boolean,
  39211. validateEvent: {
  39212. type: Boolean,
  39213. default: true
  39214. },
  39215. offset: {
  39216. type: Number,
  39217. default: 12
  39218. },
  39219. showArrow: {
  39220. type: Boolean,
  39221. default: true
  39222. },
  39223. placement: {
  39224. type: definePropType(String),
  39225. values: Ee,
  39226. default: "bottom-start"
  39227. },
  39228. fallbackPlacements: {
  39229. type: definePropType(Array),
  39230. default: ["bottom-start", "top-start", "right", "left"]
  39231. },
  39232. tagType: { ...tagProps.type, default: "info" },
  39233. tagEffect: { ...tagProps.effect, default: "light" },
  39234. tabindex: {
  39235. type: [String, Number],
  39236. default: 0
  39237. },
  39238. appendTo: String,
  39239. ...useEmptyValuesProps,
  39240. ...useAriaProps(["ariaLabel"])
  39241. });
  39242. const OptionProps = buildProps({
  39243. data: Array,
  39244. disabled: Boolean,
  39245. hovering: Boolean,
  39246. item: {
  39247. type: definePropType(Object),
  39248. required: true
  39249. },
  39250. index: Number,
  39251. style: Object,
  39252. selected: Boolean,
  39253. created: Boolean
  39254. });
  39255. const selectEmits = {
  39256. [UPDATE_MODEL_EVENT]: (val) => true,
  39257. [CHANGE_EVENT]: (val) => true,
  39258. "remove-tag": (val) => true,
  39259. "visible-change": (visible) => true,
  39260. focus: (evt) => evt instanceof FocusEvent,
  39261. blur: (evt) => evt instanceof FocusEvent,
  39262. clear: () => true
  39263. };
  39264. const optionEmits = {
  39265. hover: (index) => isNumber(index),
  39266. select: (val, index) => true
  39267. };
  39268. const selectV2InjectionKey = Symbol("ElSelectV2Injection");
  39269. const _sfc_main$N = vue.defineComponent({
  39270. props: OptionProps,
  39271. emits: optionEmits,
  39272. setup(props, { emit }) {
  39273. const select = vue.inject(selectV2InjectionKey);
  39274. const ns = useNamespace("select");
  39275. const { hoverItem, selectOptionClick } = useOption(props, { emit });
  39276. const { getLabel } = useProps(select.props);
  39277. return {
  39278. ns,
  39279. hoverItem,
  39280. selectOptionClick,
  39281. getLabel
  39282. };
  39283. }
  39284. });
  39285. function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
  39286. return vue.openBlock(), vue.createElementBlock("li", {
  39287. "aria-selected": _ctx.selected,
  39288. style: vue.normalizeStyle(_ctx.style),
  39289. class: vue.normalizeClass([
  39290. _ctx.ns.be("dropdown", "item"),
  39291. _ctx.ns.is("selected", _ctx.selected),
  39292. _ctx.ns.is("disabled", _ctx.disabled),
  39293. _ctx.ns.is("created", _ctx.created),
  39294. _ctx.ns.is("hovering", _ctx.hovering)
  39295. ]),
  39296. onMousemove: _ctx.hoverItem,
  39297. onClick: vue.withModifiers(_ctx.selectOptionClick, ["stop"])
  39298. }, [
  39299. vue.renderSlot(_ctx.$slots, "default", {
  39300. item: _ctx.item,
  39301. index: _ctx.index,
  39302. disabled: _ctx.disabled
  39303. }, () => [
  39304. vue.createElementVNode("span", null, vue.toDisplayString(_ctx.getLabel(_ctx.item)), 1)
  39305. ])
  39306. ], 46, ["aria-selected", "onMousemove", "onClick"]);
  39307. }
  39308. var OptionItem = /* @__PURE__ */ _export_sfc(_sfc_main$N, [["render", _sfc_render$6], ["__file", "option-item.vue"]]);
  39309. const props = {
  39310. loading: Boolean,
  39311. data: {
  39312. type: Array,
  39313. required: true
  39314. },
  39315. hoveringIndex: Number,
  39316. width: Number
  39317. };
  39318. var ElSelectMenu = vue.defineComponent({
  39319. name: "ElSelectDropdown",
  39320. props,
  39321. setup(props2, {
  39322. slots,
  39323. expose
  39324. }) {
  39325. const select = vue.inject(selectV2InjectionKey);
  39326. const ns = useNamespace("select");
  39327. const {
  39328. getLabel,
  39329. getValue,
  39330. getDisabled
  39331. } = useProps(select.props);
  39332. const cachedHeights = vue.ref([]);
  39333. const listRef = vue.ref();
  39334. const size = vue.computed(() => props2.data.length);
  39335. vue.watch(() => size.value, () => {
  39336. var _a, _b;
  39337. (_b = (_a = select.tooltipRef.value).updatePopper) == null ? void 0 : _b.call(_a);
  39338. });
  39339. const isSized = vue.computed(() => isUndefined(select.props.estimatedOptionHeight));
  39340. const listProps = vue.computed(() => {
  39341. if (isSized.value) {
  39342. return {
  39343. itemSize: select.props.itemHeight
  39344. };
  39345. }
  39346. return {
  39347. estimatedSize: select.props.estimatedOptionHeight,
  39348. itemSize: (idx) => cachedHeights.value[idx]
  39349. };
  39350. });
  39351. const contains = (arr = [], target) => {
  39352. const {
  39353. props: {
  39354. valueKey
  39355. }
  39356. } = select;
  39357. if (!isObject$1(target)) {
  39358. return arr.includes(target);
  39359. }
  39360. return arr && arr.some((item) => {
  39361. return vue.toRaw(get(item, valueKey)) === get(target, valueKey);
  39362. });
  39363. };
  39364. const isEqual = (selected, target) => {
  39365. if (!isObject$1(target)) {
  39366. return selected === target;
  39367. } else {
  39368. const {
  39369. valueKey
  39370. } = select.props;
  39371. return get(selected, valueKey) === get(target, valueKey);
  39372. }
  39373. };
  39374. const isItemSelected = (modelValue, target) => {
  39375. if (select.props.multiple) {
  39376. return contains(modelValue, getValue(target));
  39377. }
  39378. return isEqual(modelValue, getValue(target));
  39379. };
  39380. const isItemDisabled = (modelValue, selected) => {
  39381. const {
  39382. disabled,
  39383. multiple,
  39384. multipleLimit
  39385. } = select.props;
  39386. return disabled || !selected && (multiple ? multipleLimit > 0 && modelValue.length >= multipleLimit : false);
  39387. };
  39388. const isItemHovering = (target) => props2.hoveringIndex === target;
  39389. const scrollToItem = (index) => {
  39390. const list = listRef.value;
  39391. if (list) {
  39392. list.scrollToItem(index);
  39393. }
  39394. };
  39395. const resetScrollTop = () => {
  39396. const list = listRef.value;
  39397. if (list) {
  39398. list.resetScrollTop();
  39399. }
  39400. };
  39401. const exposed = {
  39402. listRef,
  39403. isSized,
  39404. isItemDisabled,
  39405. isItemHovering,
  39406. isItemSelected,
  39407. scrollToItem,
  39408. resetScrollTop
  39409. };
  39410. expose(exposed);
  39411. const Item = (itemProps) => {
  39412. const {
  39413. index,
  39414. data,
  39415. style
  39416. } = itemProps;
  39417. const sized = vue.unref(isSized);
  39418. const {
  39419. itemSize,
  39420. estimatedSize
  39421. } = vue.unref(listProps);
  39422. const {
  39423. modelValue
  39424. } = select.props;
  39425. const {
  39426. onSelect,
  39427. onHover
  39428. } = select;
  39429. const item = data[index];
  39430. if (item.type === "Group") {
  39431. return vue.createVNode(GroupItem, {
  39432. "item": item,
  39433. "style": style,
  39434. "height": sized ? itemSize : estimatedSize
  39435. }, null);
  39436. }
  39437. const isSelected = isItemSelected(modelValue, item);
  39438. const isDisabled = isItemDisabled(modelValue, isSelected);
  39439. const isHovering = isItemHovering(index);
  39440. return vue.createVNode(OptionItem, vue.mergeProps(itemProps, {
  39441. "selected": isSelected,
  39442. "disabled": getDisabled(item) || isDisabled,
  39443. "created": !!item.created,
  39444. "hovering": isHovering,
  39445. "item": item,
  39446. "onSelect": onSelect,
  39447. "onHover": onHover
  39448. }), {
  39449. default: (props3) => {
  39450. var _a;
  39451. return ((_a = slots.default) == null ? void 0 : _a.call(slots, props3)) || vue.createVNode("span", null, [getLabel(item)]);
  39452. }
  39453. });
  39454. };
  39455. const {
  39456. onKeyboardNavigate,
  39457. onKeyboardSelect
  39458. } = select;
  39459. const onForward = () => {
  39460. onKeyboardNavigate("forward");
  39461. };
  39462. const onBackward = () => {
  39463. onKeyboardNavigate("backward");
  39464. };
  39465. const onKeydown = (e) => {
  39466. const {
  39467. code
  39468. } = e;
  39469. const {
  39470. tab,
  39471. esc,
  39472. down,
  39473. up,
  39474. enter,
  39475. numpadEnter
  39476. } = EVENT_CODE;
  39477. if (code !== tab) {
  39478. e.preventDefault();
  39479. e.stopPropagation();
  39480. }
  39481. switch (code) {
  39482. case tab:
  39483. case esc:
  39484. break;
  39485. case down:
  39486. onForward();
  39487. break;
  39488. case up:
  39489. onBackward();
  39490. break;
  39491. case enter:
  39492. case numpadEnter:
  39493. onKeyboardSelect();
  39494. break;
  39495. }
  39496. };
  39497. return () => {
  39498. var _a, _b, _c, _d;
  39499. const {
  39500. data,
  39501. width
  39502. } = props2;
  39503. const {
  39504. height,
  39505. multiple,
  39506. scrollbarAlwaysOn
  39507. } = select.props;
  39508. const List = vue.unref(isSized) ? FixedSizeList$1 : DynamicSizeList$1;
  39509. return vue.createVNode("div", {
  39510. "class": [ns.b("dropdown"), ns.is("multiple", multiple)],
  39511. "style": {
  39512. width: `${width}px`
  39513. }
  39514. }, [(_a = slots.header) == null ? void 0 : _a.call(slots), ((_b = slots.loading) == null ? void 0 : _b.call(slots)) || ((_c = slots.empty) == null ? void 0 : _c.call(slots)) || vue.createVNode(List, vue.mergeProps({
  39515. "ref": listRef
  39516. }, vue.unref(listProps), {
  39517. "className": ns.be("dropdown", "list"),
  39518. "scrollbarAlwaysOn": scrollbarAlwaysOn,
  39519. "data": data,
  39520. "height": height,
  39521. "width": width,
  39522. "total": data.length,
  39523. "onKeydown": onKeydown
  39524. }), {
  39525. default: (props3) => vue.createVNode(Item, props3, null)
  39526. }), (_d = slots.footer) == null ? void 0 : _d.call(slots)]);
  39527. };
  39528. }
  39529. });
  39530. function useAllowCreate(props, states) {
  39531. const { aliasProps, getLabel, getValue } = useProps(props);
  39532. const createOptionCount = vue.ref(0);
  39533. const cachedSelectedOption = vue.ref();
  39534. const enableAllowCreateMode = vue.computed(() => {
  39535. return props.allowCreate && props.filterable;
  39536. });
  39537. function hasExistingOption(query) {
  39538. const hasOption = (option) => getLabel(option) === query;
  39539. return props.options && props.options.some(hasOption) || states.createdOptions.some(hasOption);
  39540. }
  39541. function selectNewOption(option) {
  39542. if (!enableAllowCreateMode.value) {
  39543. return;
  39544. }
  39545. if (props.multiple && option.created) {
  39546. createOptionCount.value++;
  39547. } else {
  39548. cachedSelectedOption.value = option;
  39549. }
  39550. }
  39551. function createNewOption(query) {
  39552. if (enableAllowCreateMode.value) {
  39553. if (query && query.length > 0) {
  39554. if (hasExistingOption(query)) {
  39555. return;
  39556. }
  39557. const newOption = {
  39558. [aliasProps.value.value]: query,
  39559. [aliasProps.value.label]: query,
  39560. created: true,
  39561. [aliasProps.value.disabled]: false
  39562. };
  39563. if (states.createdOptions.length >= createOptionCount.value) {
  39564. states.createdOptions[createOptionCount.value] = newOption;
  39565. } else {
  39566. states.createdOptions.push(newOption);
  39567. }
  39568. } else {
  39569. if (props.multiple) {
  39570. states.createdOptions.length = createOptionCount.value;
  39571. } else {
  39572. const selectedOption = cachedSelectedOption.value;
  39573. states.createdOptions.length = 0;
  39574. if (selectedOption && selectedOption.created) {
  39575. states.createdOptions.push(selectedOption);
  39576. }
  39577. }
  39578. }
  39579. }
  39580. }
  39581. function removeNewOption(option) {
  39582. if (!enableAllowCreateMode.value || !option || !option.created || option.created && props.reserveKeyword && states.inputValue === getLabel(option)) {
  39583. return;
  39584. }
  39585. const idx = states.createdOptions.findIndex((it) => getValue(it) === getValue(option));
  39586. if (~idx) {
  39587. states.createdOptions.splice(idx, 1);
  39588. createOptionCount.value--;
  39589. }
  39590. }
  39591. function clearAllNewOption() {
  39592. if (enableAllowCreateMode.value) {
  39593. states.createdOptions.length = 0;
  39594. createOptionCount.value = 0;
  39595. }
  39596. }
  39597. return {
  39598. createNewOption,
  39599. removeNewOption,
  39600. selectNewOption,
  39601. clearAllNewOption
  39602. };
  39603. }
  39604. const MINIMUM_INPUT_WIDTH = 11;
  39605. const useSelect$1 = (props, emit) => {
  39606. const { t } = useLocale();
  39607. const nsSelect = useNamespace("select");
  39608. const nsInput = useNamespace("input");
  39609. const { form: elForm, formItem: elFormItem } = useFormItem();
  39610. const { inputId } = useFormItemInputId(props, {
  39611. formItemContext: elFormItem
  39612. });
  39613. const { aliasProps, getLabel, getValue, getDisabled, getOptions } = useProps(props);
  39614. const { valueOnClear, isEmptyValue } = useEmptyValues(props);
  39615. const states = vue.reactive({
  39616. inputValue: "",
  39617. cachedOptions: [],
  39618. createdOptions: [],
  39619. hoveringIndex: -1,
  39620. inputHovering: false,
  39621. selectionWidth: 0,
  39622. calculatorWidth: 0,
  39623. collapseItemWidth: 0,
  39624. previousQuery: null,
  39625. previousValue: void 0,
  39626. selectedLabel: "",
  39627. menuVisibleOnFocus: false,
  39628. isBeforeHide: false
  39629. });
  39630. const popperSize = vue.ref(-1);
  39631. const selectRef = vue.ref();
  39632. const selectionRef = vue.ref();
  39633. const tooltipRef = vue.ref();
  39634. const tagTooltipRef = vue.ref();
  39635. const inputRef = vue.ref();
  39636. const calculatorRef = vue.ref();
  39637. const prefixRef = vue.ref();
  39638. const suffixRef = vue.ref();
  39639. const menuRef = vue.ref();
  39640. const tagMenuRef = vue.ref();
  39641. const collapseItemRef = vue.ref();
  39642. const {
  39643. isComposing,
  39644. handleCompositionStart,
  39645. handleCompositionEnd,
  39646. handleCompositionUpdate
  39647. } = useComposition({
  39648. afterComposition: (e) => onInput(e)
  39649. });
  39650. const { wrapperRef, isFocused, handleBlur } = useFocusController(inputRef, {
  39651. beforeFocus() {
  39652. return selectDisabled.value;
  39653. },
  39654. afterFocus() {
  39655. if (props.automaticDropdown && !expanded.value) {
  39656. expanded.value = true;
  39657. states.menuVisibleOnFocus = true;
  39658. }
  39659. },
  39660. beforeBlur(event) {
  39661. var _a, _b;
  39662. return ((_a = tooltipRef.value) == null ? void 0 : _a.isFocusInsideContent(event)) || ((_b = tagTooltipRef.value) == null ? void 0 : _b.isFocusInsideContent(event));
  39663. },
  39664. afterBlur() {
  39665. expanded.value = false;
  39666. states.menuVisibleOnFocus = false;
  39667. }
  39668. });
  39669. const allOptions = vue.ref([]);
  39670. const filteredOptions = vue.ref([]);
  39671. const expanded = vue.ref(false);
  39672. const selectDisabled = vue.computed(() => props.disabled || (elForm == null ? void 0 : elForm.disabled));
  39673. const needStatusIcon = vue.computed(() => {
  39674. var _a;
  39675. return (_a = elForm == null ? void 0 : elForm.statusIcon) != null ? _a : false;
  39676. });
  39677. const popupHeight = vue.computed(() => {
  39678. const totalHeight = filteredOptions.value.length * props.itemHeight;
  39679. return totalHeight > props.height ? props.height : totalHeight;
  39680. });
  39681. const hasModelValue = vue.computed(() => {
  39682. return props.multiple ? isArray$1(props.modelValue) && props.modelValue.length > 0 : !isEmptyValue(props.modelValue);
  39683. });
  39684. const showClearBtn = vue.computed(() => {
  39685. return props.clearable && !selectDisabled.value && states.inputHovering && hasModelValue.value;
  39686. });
  39687. const iconComponent = vue.computed(() => props.remote && props.filterable ? "" : arrow_down_default);
  39688. const iconReverse = vue.computed(() => iconComponent.value && nsSelect.is("reverse", expanded.value));
  39689. const validateState = vue.computed(() => (elFormItem == null ? void 0 : elFormItem.validateState) || "");
  39690. const validateIcon = vue.computed(() => {
  39691. if (!validateState.value)
  39692. return;
  39693. return ValidateComponentsMap[validateState.value];
  39694. });
  39695. const debounce$1 = vue.computed(() => props.remote ? 300 : 0);
  39696. const emptyText = vue.computed(() => {
  39697. if (props.loading) {
  39698. return props.loadingText || t("el.select.loading");
  39699. } else {
  39700. if (props.remote && !states.inputValue && allOptions.value.length === 0)
  39701. return false;
  39702. if (props.filterable && states.inputValue && allOptions.value.length > 0 && filteredOptions.value.length === 0) {
  39703. return props.noMatchText || t("el.select.noMatch");
  39704. }
  39705. if (allOptions.value.length === 0) {
  39706. return props.noDataText || t("el.select.noData");
  39707. }
  39708. }
  39709. return null;
  39710. });
  39711. const filterOptions = (query) => {
  39712. const isValidOption = (o) => {
  39713. if (props.filterable && isFunction$1(props.filterMethod))
  39714. return true;
  39715. if (props.filterable && props.remote && isFunction$1(props.remoteMethod))
  39716. return true;
  39717. const regexp = new RegExp(escapeStringRegexp(query), "i");
  39718. return query ? regexp.test(getLabel(o) || "") : true;
  39719. };
  39720. if (props.loading) {
  39721. return [];
  39722. }
  39723. return [...states.createdOptions, ...props.options].reduce((all, item) => {
  39724. const options = getOptions(item);
  39725. if (isArray$1(options)) {
  39726. const filtered = options.filter(isValidOption);
  39727. if (filtered.length > 0) {
  39728. all.push({
  39729. label: getLabel(item),
  39730. type: "Group"
  39731. }, ...filtered);
  39732. }
  39733. } else if (props.remote || isValidOption(item)) {
  39734. all.push(item);
  39735. }
  39736. return all;
  39737. }, []);
  39738. };
  39739. const updateOptions = () => {
  39740. allOptions.value = filterOptions("");
  39741. filteredOptions.value = filterOptions(states.inputValue);
  39742. };
  39743. const allOptionsValueMap = vue.computed(() => {
  39744. const valueMap = /* @__PURE__ */ new Map();
  39745. allOptions.value.forEach((option, index) => {
  39746. valueMap.set(getValueKey(getValue(option)), { option, index });
  39747. });
  39748. return valueMap;
  39749. });
  39750. const filteredOptionsValueMap = vue.computed(() => {
  39751. const valueMap = /* @__PURE__ */ new Map();
  39752. filteredOptions.value.forEach((option, index) => {
  39753. valueMap.set(getValueKey(getValue(option)), { option, index });
  39754. });
  39755. return valueMap;
  39756. });
  39757. const optionsAllDisabled = vue.computed(() => filteredOptions.value.every((option) => getDisabled(option)));
  39758. const selectSize = useFormSize();
  39759. const collapseTagSize = vue.computed(() => selectSize.value === "small" ? "small" : "default");
  39760. const calculatePopperSize = () => {
  39761. var _a;
  39762. popperSize.value = ((_a = selectRef.value) == null ? void 0 : _a.offsetWidth) || 200;
  39763. };
  39764. const getGapWidth = () => {
  39765. if (!selectionRef.value)
  39766. return 0;
  39767. const style = window.getComputedStyle(selectionRef.value);
  39768. return Number.parseFloat(style.gap || "6px");
  39769. };
  39770. const tagStyle = vue.computed(() => {
  39771. const gapWidth = getGapWidth();
  39772. const maxWidth = collapseItemRef.value && props.maxCollapseTags === 1 ? states.selectionWidth - states.collapseItemWidth - gapWidth : states.selectionWidth;
  39773. return { maxWidth: `${maxWidth}px` };
  39774. });
  39775. const collapseTagStyle = vue.computed(() => {
  39776. return { maxWidth: `${states.selectionWidth}px` };
  39777. });
  39778. const inputStyle = vue.computed(() => ({
  39779. width: `${Math.max(states.calculatorWidth, MINIMUM_INPUT_WIDTH)}px`
  39780. }));
  39781. const shouldShowPlaceholder = vue.computed(() => {
  39782. if (isArray$1(props.modelValue)) {
  39783. return props.modelValue.length === 0 && !states.inputValue;
  39784. }
  39785. return props.filterable ? !states.inputValue : true;
  39786. });
  39787. const currentPlaceholder = vue.computed(() => {
  39788. var _a;
  39789. const _placeholder = (_a = props.placeholder) != null ? _a : t("el.select.placeholder");
  39790. return props.multiple || !hasModelValue.value ? _placeholder : states.selectedLabel;
  39791. });
  39792. const popperRef = vue.computed(() => {
  39793. var _a, _b;
  39794. return (_b = (_a = tooltipRef.value) == null ? void 0 : _a.popperRef) == null ? void 0 : _b.contentRef;
  39795. });
  39796. const indexRef = vue.computed(() => {
  39797. if (props.multiple) {
  39798. const len = props.modelValue.length;
  39799. if (props.modelValue.length > 0 && filteredOptionsValueMap.value.has(props.modelValue[len - 1])) {
  39800. const { index } = filteredOptionsValueMap.value.get(props.modelValue[len - 1]);
  39801. return index;
  39802. }
  39803. } else {
  39804. if (!isEmptyValue(props.modelValue) && filteredOptionsValueMap.value.has(props.modelValue)) {
  39805. const { index } = filteredOptionsValueMap.value.get(props.modelValue);
  39806. return index;
  39807. }
  39808. }
  39809. return -1;
  39810. });
  39811. const dropdownMenuVisible = vue.computed({
  39812. get() {
  39813. return expanded.value && emptyText.value !== false;
  39814. },
  39815. set(val) {
  39816. expanded.value = val;
  39817. }
  39818. });
  39819. const showTagList = vue.computed(() => {
  39820. if (!props.multiple) {
  39821. return [];
  39822. }
  39823. return props.collapseTags ? states.cachedOptions.slice(0, props.maxCollapseTags) : states.cachedOptions;
  39824. });
  39825. const collapseTagList = vue.computed(() => {
  39826. if (!props.multiple) {
  39827. return [];
  39828. }
  39829. return props.collapseTags ? states.cachedOptions.slice(props.maxCollapseTags) : [];
  39830. });
  39831. const {
  39832. createNewOption,
  39833. removeNewOption,
  39834. selectNewOption,
  39835. clearAllNewOption
  39836. } = useAllowCreate(props, states);
  39837. const toggleMenu = () => {
  39838. if (selectDisabled.value)
  39839. return;
  39840. if (states.menuVisibleOnFocus) {
  39841. states.menuVisibleOnFocus = false;
  39842. } else {
  39843. expanded.value = !expanded.value;
  39844. }
  39845. };
  39846. const onInputChange = () => {
  39847. if (states.inputValue.length > 0 && !expanded.value) {
  39848. expanded.value = true;
  39849. }
  39850. createNewOption(states.inputValue);
  39851. handleQueryChange(states.inputValue);
  39852. };
  39853. const debouncedOnInputChange = debounce(onInputChange, debounce$1.value);
  39854. const handleQueryChange = (val) => {
  39855. if (states.previousQuery === val || isComposing.value) {
  39856. return;
  39857. }
  39858. states.previousQuery = val;
  39859. if (props.filterable && isFunction$1(props.filterMethod)) {
  39860. props.filterMethod(val);
  39861. } else if (props.filterable && props.remote && isFunction$1(props.remoteMethod)) {
  39862. props.remoteMethod(val);
  39863. }
  39864. if (props.defaultFirstOption && (props.filterable || props.remote) && filteredOptions.value.length) {
  39865. vue.nextTick(checkDefaultFirstOption);
  39866. } else {
  39867. vue.nextTick(updateHoveringIndex);
  39868. }
  39869. };
  39870. const checkDefaultFirstOption = () => {
  39871. const optionsInDropdown = filteredOptions.value.filter((n) => !n.disabled && n.type !== "Group");
  39872. const userCreatedOption = optionsInDropdown.find((n) => n.created);
  39873. const firstOriginOption = optionsInDropdown[0];
  39874. states.hoveringIndex = getValueIndex(filteredOptions.value, userCreatedOption || firstOriginOption);
  39875. };
  39876. const emitChange = (val) => {
  39877. if (!isEqual$1(props.modelValue, val)) {
  39878. emit(CHANGE_EVENT, val);
  39879. }
  39880. };
  39881. const update = (val) => {
  39882. emit(UPDATE_MODEL_EVENT, val);
  39883. emitChange(val);
  39884. states.previousValue = props.multiple ? String(val) : val;
  39885. };
  39886. const getValueIndex = (arr = [], value) => {
  39887. if (!isObject$1(value)) {
  39888. return arr.indexOf(value);
  39889. }
  39890. const valueKey = props.valueKey;
  39891. let index = -1;
  39892. arr.some((item, i) => {
  39893. if (get(item, valueKey) === get(value, valueKey)) {
  39894. index = i;
  39895. return true;
  39896. }
  39897. return false;
  39898. });
  39899. return index;
  39900. };
  39901. const getValueKey = (item) => {
  39902. return isObject$1(item) ? get(item, props.valueKey) : item;
  39903. };
  39904. const handleResize = () => {
  39905. calculatePopperSize();
  39906. };
  39907. const resetSelectionWidth = () => {
  39908. states.selectionWidth = selectionRef.value.getBoundingClientRect().width;
  39909. };
  39910. const resetCalculatorWidth = () => {
  39911. states.calculatorWidth = calculatorRef.value.getBoundingClientRect().width;
  39912. };
  39913. const resetCollapseItemWidth = () => {
  39914. states.collapseItemWidth = collapseItemRef.value.getBoundingClientRect().width;
  39915. };
  39916. const updateTooltip = () => {
  39917. var _a, _b;
  39918. (_b = (_a = tooltipRef.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a);
  39919. };
  39920. const updateTagTooltip = () => {
  39921. var _a, _b;
  39922. (_b = (_a = tagTooltipRef.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a);
  39923. };
  39924. const onSelect = (option) => {
  39925. if (props.multiple) {
  39926. let selectedOptions = props.modelValue.slice();
  39927. const index = getValueIndex(selectedOptions, getValue(option));
  39928. if (index > -1) {
  39929. selectedOptions = [
  39930. ...selectedOptions.slice(0, index),
  39931. ...selectedOptions.slice(index + 1)
  39932. ];
  39933. states.cachedOptions.splice(index, 1);
  39934. removeNewOption(option);
  39935. } else if (props.multipleLimit <= 0 || selectedOptions.length < props.multipleLimit) {
  39936. selectedOptions = [...selectedOptions, getValue(option)];
  39937. states.cachedOptions.push(option);
  39938. selectNewOption(option);
  39939. }
  39940. update(selectedOptions);
  39941. if (option.created) {
  39942. handleQueryChange("");
  39943. }
  39944. if (props.filterable && !props.reserveKeyword) {
  39945. states.inputValue = "";
  39946. }
  39947. } else {
  39948. states.selectedLabel = getLabel(option);
  39949. update(getValue(option));
  39950. expanded.value = false;
  39951. selectNewOption(option);
  39952. if (!option.created) {
  39953. clearAllNewOption();
  39954. }
  39955. }
  39956. focus();
  39957. };
  39958. const deleteTag = (event, option) => {
  39959. let selectedOptions = props.modelValue.slice();
  39960. const index = getValueIndex(selectedOptions, getValue(option));
  39961. if (index > -1 && !selectDisabled.value) {
  39962. selectedOptions = [
  39963. ...props.modelValue.slice(0, index),
  39964. ...props.modelValue.slice(index + 1)
  39965. ];
  39966. states.cachedOptions.splice(index, 1);
  39967. update(selectedOptions);
  39968. emit("remove-tag", getValue(option));
  39969. removeNewOption(option);
  39970. }
  39971. event.stopPropagation();
  39972. focus();
  39973. };
  39974. const focus = () => {
  39975. var _a;
  39976. (_a = inputRef.value) == null ? void 0 : _a.focus();
  39977. };
  39978. const blur = () => {
  39979. var _a;
  39980. if (expanded.value) {
  39981. expanded.value = false;
  39982. vue.nextTick(() => {
  39983. var _a2;
  39984. return (_a2 = inputRef.value) == null ? void 0 : _a2.blur();
  39985. });
  39986. return;
  39987. }
  39988. (_a = inputRef.value) == null ? void 0 : _a.blur();
  39989. };
  39990. const handleEsc = () => {
  39991. if (states.inputValue.length > 0) {
  39992. states.inputValue = "";
  39993. } else {
  39994. expanded.value = false;
  39995. }
  39996. };
  39997. const getLastNotDisabledIndex = (value) => findLastIndex(value, (it) => !states.cachedOptions.some((option) => getValue(option) === it && getDisabled(option)));
  39998. const handleDel = (e) => {
  39999. if (!props.multiple)
  40000. return;
  40001. if (e.code === EVENT_CODE.delete)
  40002. return;
  40003. if (states.inputValue.length === 0) {
  40004. e.preventDefault();
  40005. const selected = props.modelValue.slice();
  40006. const lastNotDisabledIndex = getLastNotDisabledIndex(selected);
  40007. if (lastNotDisabledIndex < 0)
  40008. return;
  40009. const removeTagValue = selected[lastNotDisabledIndex];
  40010. selected.splice(lastNotDisabledIndex, 1);
  40011. const option = states.cachedOptions[lastNotDisabledIndex];
  40012. states.cachedOptions.splice(lastNotDisabledIndex, 1);
  40013. removeNewOption(option);
  40014. update(selected);
  40015. emit("remove-tag", removeTagValue);
  40016. }
  40017. };
  40018. const handleClear = () => {
  40019. let emptyValue;
  40020. if (isArray$1(props.modelValue)) {
  40021. emptyValue = [];
  40022. } else {
  40023. emptyValue = valueOnClear.value;
  40024. }
  40025. if (props.multiple) {
  40026. states.cachedOptions = [];
  40027. } else {
  40028. states.selectedLabel = "";
  40029. }
  40030. expanded.value = false;
  40031. update(emptyValue);
  40032. emit("clear");
  40033. clearAllNewOption();
  40034. focus();
  40035. };
  40036. const onKeyboardNavigate = (direction, hoveringIndex = void 0) => {
  40037. const options = filteredOptions.value;
  40038. if (!["forward", "backward"].includes(direction) || selectDisabled.value || options.length <= 0 || optionsAllDisabled.value || isComposing.value) {
  40039. return;
  40040. }
  40041. if (!expanded.value) {
  40042. return toggleMenu();
  40043. }
  40044. if (hoveringIndex === void 0) {
  40045. hoveringIndex = states.hoveringIndex;
  40046. }
  40047. let newIndex = -1;
  40048. if (direction === "forward") {
  40049. newIndex = hoveringIndex + 1;
  40050. if (newIndex >= options.length) {
  40051. newIndex = 0;
  40052. }
  40053. } else if (direction === "backward") {
  40054. newIndex = hoveringIndex - 1;
  40055. if (newIndex < 0 || newIndex >= options.length) {
  40056. newIndex = options.length - 1;
  40057. }
  40058. }
  40059. const option = options[newIndex];
  40060. if (getDisabled(option) || option.type === "Group") {
  40061. return onKeyboardNavigate(direction, newIndex);
  40062. } else {
  40063. states.hoveringIndex = newIndex;
  40064. scrollToItem(newIndex);
  40065. }
  40066. };
  40067. const onKeyboardSelect = () => {
  40068. if (!expanded.value) {
  40069. return toggleMenu();
  40070. } else if (~states.hoveringIndex && filteredOptions.value[states.hoveringIndex]) {
  40071. onSelect(filteredOptions.value[states.hoveringIndex]);
  40072. }
  40073. };
  40074. const onHoverOption = (idx) => {
  40075. states.hoveringIndex = idx != null ? idx : -1;
  40076. };
  40077. const updateHoveringIndex = () => {
  40078. if (!props.multiple) {
  40079. states.hoveringIndex = filteredOptions.value.findIndex((item) => {
  40080. return getValueKey(item) === getValueKey(props.modelValue);
  40081. });
  40082. } else {
  40083. states.hoveringIndex = filteredOptions.value.findIndex((item) => props.modelValue.some((modelValue) => getValueKey(modelValue) === getValueKey(item)));
  40084. }
  40085. };
  40086. const onInput = (event) => {
  40087. states.inputValue = event.target.value;
  40088. if (props.remote) {
  40089. debouncedOnInputChange();
  40090. } else {
  40091. return onInputChange();
  40092. }
  40093. };
  40094. const handleClickOutside = (event) => {
  40095. expanded.value = false;
  40096. if (isFocused.value) {
  40097. const _event = new FocusEvent("focus", event);
  40098. handleBlur(_event);
  40099. }
  40100. };
  40101. const handleMenuEnter = () => {
  40102. states.isBeforeHide = false;
  40103. return vue.nextTick(() => {
  40104. if (~indexRef.value) {
  40105. scrollToItem(states.hoveringIndex);
  40106. }
  40107. });
  40108. };
  40109. const scrollToItem = (index) => {
  40110. menuRef.value.scrollToItem(index);
  40111. };
  40112. const getOption = (value, cachedOptions) => {
  40113. const selectValue = getValueKey(value);
  40114. if (allOptionsValueMap.value.has(selectValue)) {
  40115. const { option } = allOptionsValueMap.value.get(selectValue);
  40116. return option;
  40117. }
  40118. if (cachedOptions && cachedOptions.length) {
  40119. const option = cachedOptions.find((option2) => getValueKey(getValue(option2)) === selectValue);
  40120. if (option) {
  40121. return option;
  40122. }
  40123. }
  40124. return {
  40125. [aliasProps.value.value]: value,
  40126. [aliasProps.value.label]: value
  40127. };
  40128. };
  40129. const initStates = (needUpdateSelectedLabel = false) => {
  40130. if (props.multiple) {
  40131. if (props.modelValue.length > 0) {
  40132. const cachedOptions = states.cachedOptions.slice();
  40133. states.cachedOptions.length = 0;
  40134. states.previousValue = props.modelValue.toString();
  40135. for (const value of props.modelValue) {
  40136. const option = getOption(value, cachedOptions);
  40137. states.cachedOptions.push(option);
  40138. }
  40139. } else {
  40140. states.cachedOptions = [];
  40141. states.previousValue = void 0;
  40142. }
  40143. } else {
  40144. if (hasModelValue.value) {
  40145. states.previousValue = props.modelValue;
  40146. const options = filteredOptions.value;
  40147. const selectedItemIndex = options.findIndex((option) => getValueKey(getValue(option)) === getValueKey(props.modelValue));
  40148. if (~selectedItemIndex) {
  40149. states.selectedLabel = getLabel(options[selectedItemIndex]);
  40150. } else {
  40151. if (!states.selectedLabel || needUpdateSelectedLabel) {
  40152. states.selectedLabel = getValueKey(props.modelValue);
  40153. }
  40154. }
  40155. } else {
  40156. states.selectedLabel = "";
  40157. states.previousValue = void 0;
  40158. }
  40159. }
  40160. clearAllNewOption();
  40161. calculatePopperSize();
  40162. };
  40163. vue.watch(expanded, (val) => {
  40164. if (val) {
  40165. handleQueryChange("");
  40166. } else {
  40167. states.inputValue = "";
  40168. states.previousQuery = null;
  40169. states.isBeforeHide = true;
  40170. createNewOption("");
  40171. }
  40172. emit("visible-change", val);
  40173. });
  40174. vue.watch(() => props.modelValue, (val, oldVal) => {
  40175. var _a;
  40176. const isValEmpty = !val || isArray$1(val) && val.length === 0;
  40177. if (isValEmpty || props.multiple && !isEqual$1(val.toString(), states.previousValue) || !props.multiple && getValueKey(val) !== getValueKey(states.previousValue)) {
  40178. initStates(true);
  40179. }
  40180. if (!isEqual$1(val, oldVal) && props.validateEvent) {
  40181. (_a = elFormItem == null ? void 0 : elFormItem.validate) == null ? void 0 : _a.call(elFormItem, "change").catch((err) => debugWarn());
  40182. }
  40183. }, {
  40184. deep: true
  40185. });
  40186. vue.watch(() => props.options, () => {
  40187. const input = inputRef.value;
  40188. if (!input || input && document.activeElement !== input) {
  40189. initStates();
  40190. }
  40191. }, {
  40192. deep: true,
  40193. flush: "post"
  40194. });
  40195. vue.watch(() => filteredOptions.value, () => {
  40196. return menuRef.value && vue.nextTick(menuRef.value.resetScrollTop);
  40197. });
  40198. vue.watchEffect(() => {
  40199. if (states.isBeforeHide)
  40200. return;
  40201. updateOptions();
  40202. });
  40203. vue.watchEffect(() => {
  40204. const { valueKey, options } = props;
  40205. const duplicateValue = /* @__PURE__ */ new Map();
  40206. for (const item of options) {
  40207. const optionValue = getValue(item);
  40208. let v = optionValue;
  40209. if (isObject$1(v)) {
  40210. v = get(optionValue, valueKey);
  40211. }
  40212. if (duplicateValue.get(v)) {
  40213. break;
  40214. } else {
  40215. duplicateValue.set(v, true);
  40216. }
  40217. }
  40218. });
  40219. vue.onMounted(() => {
  40220. initStates();
  40221. });
  40222. useResizeObserver(selectRef, handleResize);
  40223. useResizeObserver(selectionRef, resetSelectionWidth);
  40224. useResizeObserver(calculatorRef, resetCalculatorWidth);
  40225. useResizeObserver(menuRef, updateTooltip);
  40226. useResizeObserver(wrapperRef, updateTooltip);
  40227. useResizeObserver(tagMenuRef, updateTagTooltip);
  40228. useResizeObserver(collapseItemRef, resetCollapseItemWidth);
  40229. return {
  40230. inputId,
  40231. collapseTagSize,
  40232. currentPlaceholder,
  40233. expanded,
  40234. emptyText,
  40235. popupHeight,
  40236. debounce: debounce$1,
  40237. allOptions,
  40238. filteredOptions,
  40239. iconComponent,
  40240. iconReverse,
  40241. tagStyle,
  40242. collapseTagStyle,
  40243. inputStyle,
  40244. popperSize,
  40245. dropdownMenuVisible,
  40246. hasModelValue,
  40247. shouldShowPlaceholder,
  40248. selectDisabled,
  40249. selectSize,
  40250. needStatusIcon,
  40251. showClearBtn,
  40252. states,
  40253. isFocused,
  40254. nsSelect,
  40255. nsInput,
  40256. calculatorRef,
  40257. inputRef,
  40258. menuRef,
  40259. tagMenuRef,
  40260. tooltipRef,
  40261. tagTooltipRef,
  40262. selectRef,
  40263. wrapperRef,
  40264. selectionRef,
  40265. prefixRef,
  40266. suffixRef,
  40267. collapseItemRef,
  40268. popperRef,
  40269. validateState,
  40270. validateIcon,
  40271. showTagList,
  40272. collapseTagList,
  40273. debouncedOnInputChange,
  40274. deleteTag,
  40275. getLabel,
  40276. getValue,
  40277. getDisabled,
  40278. getValueKey,
  40279. handleClear,
  40280. handleClickOutside,
  40281. handleDel,
  40282. handleEsc,
  40283. focus,
  40284. blur,
  40285. handleMenuEnter,
  40286. handleResize,
  40287. resetSelectionWidth,
  40288. resetCalculatorWidth,
  40289. updateTooltip,
  40290. updateTagTooltip,
  40291. updateOptions,
  40292. toggleMenu,
  40293. scrollTo: scrollToItem,
  40294. onInput,
  40295. onKeyboardNavigate,
  40296. onKeyboardSelect,
  40297. onSelect,
  40298. onHover: onHoverOption,
  40299. handleCompositionStart,
  40300. handleCompositionEnd,
  40301. handleCompositionUpdate
  40302. };
  40303. };
  40304. var useSelect$2 = useSelect$1;
  40305. const _sfc_main$M = vue.defineComponent({
  40306. name: "ElSelectV2",
  40307. components: {
  40308. ElSelectMenu,
  40309. ElTag,
  40310. ElTooltip,
  40311. ElIcon
  40312. },
  40313. directives: { ClickOutside },
  40314. props: SelectProps,
  40315. emits: selectEmits,
  40316. setup(props, { emit }) {
  40317. const modelValue = vue.computed(() => {
  40318. const { modelValue: rawModelValue, multiple } = props;
  40319. const fallback = multiple ? [] : void 0;
  40320. if (isArray$1(rawModelValue)) {
  40321. return multiple ? rawModelValue : fallback;
  40322. }
  40323. return multiple ? fallback : rawModelValue;
  40324. });
  40325. const API = useSelect$2(vue.reactive({
  40326. ...vue.toRefs(props),
  40327. modelValue
  40328. }), emit);
  40329. vue.provide(selectV2InjectionKey, {
  40330. props: vue.reactive({
  40331. ...vue.toRefs(props),
  40332. height: API.popupHeight,
  40333. modelValue
  40334. }),
  40335. expanded: API.expanded,
  40336. tooltipRef: API.tooltipRef,
  40337. onSelect: API.onSelect,
  40338. onHover: API.onHover,
  40339. onKeyboardNavigate: API.onKeyboardNavigate,
  40340. onKeyboardSelect: API.onKeyboardSelect
  40341. });
  40342. const selectedLabel = vue.computed(() => {
  40343. if (!props.multiple) {
  40344. return API.states.selectedLabel;
  40345. }
  40346. return API.states.cachedOptions.map((i) => i.label);
  40347. });
  40348. return {
  40349. ...API,
  40350. modelValue,
  40351. selectedLabel
  40352. };
  40353. }
  40354. });
  40355. function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
  40356. const _component_el_tag = vue.resolveComponent("el-tag");
  40357. const _component_el_tooltip = vue.resolveComponent("el-tooltip");
  40358. const _component_el_icon = vue.resolveComponent("el-icon");
  40359. const _component_el_select_menu = vue.resolveComponent("el-select-menu");
  40360. const _directive_click_outside = vue.resolveDirective("click-outside");
  40361. return vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  40362. ref: "selectRef",
  40363. class: vue.normalizeClass([_ctx.nsSelect.b(), _ctx.nsSelect.m(_ctx.selectSize)]),
  40364. onMouseenter: ($event) => _ctx.states.inputHovering = true,
  40365. onMouseleave: ($event) => _ctx.states.inputHovering = false
  40366. }, [
  40367. vue.createVNode(_component_el_tooltip, {
  40368. ref: "tooltipRef",
  40369. visible: _ctx.dropdownMenuVisible,
  40370. teleported: _ctx.teleported,
  40371. "popper-class": [_ctx.nsSelect.e("popper"), _ctx.popperClass],
  40372. "gpu-acceleration": false,
  40373. "stop-popper-mouse-event": false,
  40374. "popper-options": _ctx.popperOptions,
  40375. "fallback-placements": _ctx.fallbackPlacements,
  40376. effect: _ctx.effect,
  40377. placement: _ctx.placement,
  40378. pure: "",
  40379. transition: `${_ctx.nsSelect.namespace.value}-zoom-in-top`,
  40380. trigger: "click",
  40381. persistent: _ctx.persistent,
  40382. "append-to": _ctx.appendTo,
  40383. "show-arrow": _ctx.showArrow,
  40384. offset: _ctx.offset,
  40385. onBeforeShow: _ctx.handleMenuEnter,
  40386. onHide: ($event) => _ctx.states.isBeforeHide = false
  40387. }, {
  40388. default: vue.withCtx(() => [
  40389. vue.createElementVNode("div", {
  40390. ref: "wrapperRef",
  40391. class: vue.normalizeClass([
  40392. _ctx.nsSelect.e("wrapper"),
  40393. _ctx.nsSelect.is("focused", _ctx.isFocused),
  40394. _ctx.nsSelect.is("hovering", _ctx.states.inputHovering),
  40395. _ctx.nsSelect.is("filterable", _ctx.filterable),
  40396. _ctx.nsSelect.is("disabled", _ctx.selectDisabled)
  40397. ]),
  40398. onClick: vue.withModifiers(_ctx.toggleMenu, ["prevent"])
  40399. }, [
  40400. _ctx.$slots.prefix ? (vue.openBlock(), vue.createElementBlock("div", {
  40401. key: 0,
  40402. ref: "prefixRef",
  40403. class: vue.normalizeClass(_ctx.nsSelect.e("prefix"))
  40404. }, [
  40405. vue.renderSlot(_ctx.$slots, "prefix")
  40406. ], 2)) : vue.createCommentVNode("v-if", true),
  40407. vue.createElementVNode("div", {
  40408. ref: "selectionRef",
  40409. class: vue.normalizeClass([
  40410. _ctx.nsSelect.e("selection"),
  40411. _ctx.nsSelect.is("near", _ctx.multiple && !_ctx.$slots.prefix && !!_ctx.modelValue.length)
  40412. ])
  40413. }, [
  40414. _ctx.multiple ? vue.renderSlot(_ctx.$slots, "tag", { key: 0 }, () => [
  40415. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.showTagList, (item) => {
  40416. return vue.openBlock(), vue.createElementBlock("div", {
  40417. key: _ctx.getValueKey(_ctx.getValue(item)),
  40418. class: vue.normalizeClass(_ctx.nsSelect.e("selected-item"))
  40419. }, [
  40420. vue.createVNode(_component_el_tag, {
  40421. closable: !_ctx.selectDisabled && !_ctx.getDisabled(item),
  40422. size: _ctx.collapseTagSize,
  40423. type: _ctx.tagType,
  40424. effect: _ctx.tagEffect,
  40425. "disable-transitions": "",
  40426. style: vue.normalizeStyle(_ctx.tagStyle),
  40427. onClose: ($event) => _ctx.deleteTag($event, item)
  40428. }, {
  40429. default: vue.withCtx(() => [
  40430. vue.createElementVNode("span", {
  40431. class: vue.normalizeClass(_ctx.nsSelect.e("tags-text"))
  40432. }, [
  40433. vue.renderSlot(_ctx.$slots, "label", {
  40434. label: _ctx.getLabel(item),
  40435. value: _ctx.getValue(item)
  40436. }, () => [
  40437. vue.createTextVNode(vue.toDisplayString(_ctx.getLabel(item)), 1)
  40438. ])
  40439. ], 2)
  40440. ]),
  40441. _: 2
  40442. }, 1032, ["closable", "size", "type", "effect", "style", "onClose"])
  40443. ], 2);
  40444. }), 128)),
  40445. _ctx.collapseTags && _ctx.modelValue.length > _ctx.maxCollapseTags ? (vue.openBlock(), vue.createBlock(_component_el_tooltip, {
  40446. key: 0,
  40447. ref: "tagTooltipRef",
  40448. disabled: _ctx.dropdownMenuVisible || !_ctx.collapseTagsTooltip,
  40449. "fallback-placements": ["bottom", "top", "right", "left"],
  40450. effect: _ctx.effect,
  40451. placement: "bottom",
  40452. teleported: _ctx.teleported
  40453. }, {
  40454. default: vue.withCtx(() => [
  40455. vue.createElementVNode("div", {
  40456. ref: "collapseItemRef",
  40457. class: vue.normalizeClass(_ctx.nsSelect.e("selected-item"))
  40458. }, [
  40459. vue.createVNode(_component_el_tag, {
  40460. closable: false,
  40461. size: _ctx.collapseTagSize,
  40462. type: _ctx.tagType,
  40463. effect: _ctx.tagEffect,
  40464. style: vue.normalizeStyle(_ctx.collapseTagStyle),
  40465. "disable-transitions": ""
  40466. }, {
  40467. default: vue.withCtx(() => [
  40468. vue.createElementVNode("span", {
  40469. class: vue.normalizeClass(_ctx.nsSelect.e("tags-text"))
  40470. }, " + " + vue.toDisplayString(_ctx.modelValue.length - _ctx.maxCollapseTags), 3)
  40471. ]),
  40472. _: 1
  40473. }, 8, ["size", "type", "effect", "style"])
  40474. ], 2)
  40475. ]),
  40476. content: vue.withCtx(() => [
  40477. vue.createElementVNode("div", {
  40478. ref: "tagMenuRef",
  40479. class: vue.normalizeClass(_ctx.nsSelect.e("selection"))
  40480. }, [
  40481. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.collapseTagList, (selected) => {
  40482. return vue.openBlock(), vue.createElementBlock("div", {
  40483. key: _ctx.getValueKey(_ctx.getValue(selected)),
  40484. class: vue.normalizeClass(_ctx.nsSelect.e("selected-item"))
  40485. }, [
  40486. vue.createVNode(_component_el_tag, {
  40487. class: "in-tooltip",
  40488. closable: !_ctx.selectDisabled && !_ctx.getDisabled(selected),
  40489. size: _ctx.collapseTagSize,
  40490. type: _ctx.tagType,
  40491. effect: _ctx.tagEffect,
  40492. "disable-transitions": "",
  40493. onClose: ($event) => _ctx.deleteTag($event, selected)
  40494. }, {
  40495. default: vue.withCtx(() => [
  40496. vue.createElementVNode("span", {
  40497. class: vue.normalizeClass(_ctx.nsSelect.e("tags-text"))
  40498. }, [
  40499. vue.renderSlot(_ctx.$slots, "label", {
  40500. label: _ctx.getLabel(selected),
  40501. value: _ctx.getValue(selected)
  40502. }, () => [
  40503. vue.createTextVNode(vue.toDisplayString(_ctx.getLabel(selected)), 1)
  40504. ])
  40505. ], 2)
  40506. ]),
  40507. _: 2
  40508. }, 1032, ["closable", "size", "type", "effect", "onClose"])
  40509. ], 2);
  40510. }), 128))
  40511. ], 2)
  40512. ]),
  40513. _: 3
  40514. }, 8, ["disabled", "effect", "teleported"])) : vue.createCommentVNode("v-if", true)
  40515. ]) : vue.createCommentVNode("v-if", true),
  40516. vue.createElementVNode("div", {
  40517. class: vue.normalizeClass([
  40518. _ctx.nsSelect.e("selected-item"),
  40519. _ctx.nsSelect.e("input-wrapper"),
  40520. _ctx.nsSelect.is("hidden", !_ctx.filterable)
  40521. ])
  40522. }, [
  40523. vue.withDirectives(vue.createElementVNode("input", {
  40524. id: _ctx.inputId,
  40525. ref: "inputRef",
  40526. "onUpdate:modelValue": ($event) => _ctx.states.inputValue = $event,
  40527. style: vue.normalizeStyle(_ctx.inputStyle),
  40528. autocomplete: _ctx.autocomplete,
  40529. tabindex: _ctx.tabindex,
  40530. "aria-autocomplete": "list",
  40531. "aria-haspopup": "listbox",
  40532. autocapitalize: "off",
  40533. "aria-expanded": _ctx.expanded,
  40534. "aria-label": _ctx.ariaLabel,
  40535. class: vue.normalizeClass([_ctx.nsSelect.e("input"), _ctx.nsSelect.is(_ctx.selectSize)]),
  40536. disabled: _ctx.selectDisabled,
  40537. role: "combobox",
  40538. readonly: !_ctx.filterable,
  40539. spellcheck: "false",
  40540. type: "text",
  40541. name: _ctx.name,
  40542. onInput: _ctx.onInput,
  40543. onCompositionstart: _ctx.handleCompositionStart,
  40544. onCompositionupdate: _ctx.handleCompositionUpdate,
  40545. onCompositionend: _ctx.handleCompositionEnd,
  40546. onKeydown: [
  40547. vue.withKeys(vue.withModifiers(($event) => _ctx.onKeyboardNavigate("backward"), ["stop", "prevent"]), ["up"]),
  40548. vue.withKeys(vue.withModifiers(($event) => _ctx.onKeyboardNavigate("forward"), ["stop", "prevent"]), ["down"]),
  40549. vue.withKeys(vue.withModifiers(_ctx.onKeyboardSelect, ["stop", "prevent"]), ["enter"]),
  40550. vue.withKeys(vue.withModifiers(_ctx.handleEsc, ["stop", "prevent"]), ["esc"]),
  40551. vue.withKeys(vue.withModifiers(_ctx.handleDel, ["stop"]), ["delete"])
  40552. ],
  40553. onClick: vue.withModifiers(_ctx.toggleMenu, ["stop"])
  40554. }, null, 46, ["id", "onUpdate:modelValue", "autocomplete", "tabindex", "aria-expanded", "aria-label", "disabled", "readonly", "name", "onInput", "onCompositionstart", "onCompositionupdate", "onCompositionend", "onKeydown", "onClick"]), [
  40555. [vue.vModelText, _ctx.states.inputValue]
  40556. ]),
  40557. _ctx.filterable ? (vue.openBlock(), vue.createElementBlock("span", {
  40558. key: 0,
  40559. ref: "calculatorRef",
  40560. "aria-hidden": "true",
  40561. class: vue.normalizeClass(_ctx.nsSelect.e("input-calculator")),
  40562. textContent: vue.toDisplayString(_ctx.states.inputValue)
  40563. }, null, 10, ["textContent"])) : vue.createCommentVNode("v-if", true)
  40564. ], 2),
  40565. _ctx.shouldShowPlaceholder ? (vue.openBlock(), vue.createElementBlock("div", {
  40566. key: 1,
  40567. class: vue.normalizeClass([
  40568. _ctx.nsSelect.e("selected-item"),
  40569. _ctx.nsSelect.e("placeholder"),
  40570. _ctx.nsSelect.is("transparent", !_ctx.hasModelValue || _ctx.expanded && !_ctx.states.inputValue)
  40571. ])
  40572. }, [
  40573. _ctx.hasModelValue ? vue.renderSlot(_ctx.$slots, "label", {
  40574. key: 0,
  40575. label: _ctx.currentPlaceholder,
  40576. value: _ctx.modelValue
  40577. }, () => [
  40578. vue.createElementVNode("span", null, vue.toDisplayString(_ctx.currentPlaceholder), 1)
  40579. ]) : (vue.openBlock(), vue.createElementBlock("span", { key: 1 }, vue.toDisplayString(_ctx.currentPlaceholder), 1))
  40580. ], 2)) : vue.createCommentVNode("v-if", true)
  40581. ], 2),
  40582. vue.createElementVNode("div", {
  40583. ref: "suffixRef",
  40584. class: vue.normalizeClass(_ctx.nsSelect.e("suffix"))
  40585. }, [
  40586. _ctx.iconComponent ? vue.withDirectives((vue.openBlock(), vue.createBlock(_component_el_icon, {
  40587. key: 0,
  40588. class: vue.normalizeClass([_ctx.nsSelect.e("caret"), _ctx.nsInput.e("icon"), _ctx.iconReverse])
  40589. }, {
  40590. default: vue.withCtx(() => [
  40591. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.iconComponent)))
  40592. ]),
  40593. _: 1
  40594. }, 8, ["class"])), [
  40595. [vue.vShow, !_ctx.showClearBtn]
  40596. ]) : vue.createCommentVNode("v-if", true),
  40597. _ctx.showClearBtn && _ctx.clearIcon ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
  40598. key: 1,
  40599. class: vue.normalizeClass([
  40600. _ctx.nsSelect.e("caret"),
  40601. _ctx.nsInput.e("icon"),
  40602. _ctx.nsSelect.e("clear")
  40603. ]),
  40604. onClick: vue.withModifiers(_ctx.handleClear, ["prevent", "stop"])
  40605. }, {
  40606. default: vue.withCtx(() => [
  40607. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.clearIcon)))
  40608. ]),
  40609. _: 1
  40610. }, 8, ["class", "onClick"])) : vue.createCommentVNode("v-if", true),
  40611. _ctx.validateState && _ctx.validateIcon && _ctx.needStatusIcon ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
  40612. key: 2,
  40613. class: vue.normalizeClass([_ctx.nsInput.e("icon"), _ctx.nsInput.e("validateIcon")])
  40614. }, {
  40615. default: vue.withCtx(() => [
  40616. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.validateIcon)))
  40617. ]),
  40618. _: 1
  40619. }, 8, ["class"])) : vue.createCommentVNode("v-if", true)
  40620. ], 2)
  40621. ], 10, ["onClick"])
  40622. ]),
  40623. content: vue.withCtx(() => [
  40624. vue.createVNode(_component_el_select_menu, {
  40625. ref: "menuRef",
  40626. data: _ctx.filteredOptions,
  40627. width: _ctx.popperSize,
  40628. "hovering-index": _ctx.states.hoveringIndex,
  40629. "scrollbar-always-on": _ctx.scrollbarAlwaysOn
  40630. }, vue.createSlots({
  40631. default: vue.withCtx((scope) => [
  40632. vue.renderSlot(_ctx.$slots, "default", vue.normalizeProps(vue.guardReactiveProps(scope)))
  40633. ]),
  40634. _: 2
  40635. }, [
  40636. _ctx.$slots.header ? {
  40637. name: "header",
  40638. fn: vue.withCtx(() => [
  40639. vue.createElementVNode("div", {
  40640. class: vue.normalizeClass(_ctx.nsSelect.be("dropdown", "header"))
  40641. }, [
  40642. vue.renderSlot(_ctx.$slots, "header")
  40643. ], 2)
  40644. ])
  40645. } : void 0,
  40646. _ctx.$slots.loading && _ctx.loading ? {
  40647. name: "loading",
  40648. fn: vue.withCtx(() => [
  40649. vue.createElementVNode("div", {
  40650. class: vue.normalizeClass(_ctx.nsSelect.be("dropdown", "loading"))
  40651. }, [
  40652. vue.renderSlot(_ctx.$slots, "loading")
  40653. ], 2)
  40654. ])
  40655. } : _ctx.loading || _ctx.filteredOptions.length === 0 ? {
  40656. name: "empty",
  40657. fn: vue.withCtx(() => [
  40658. vue.createElementVNode("div", {
  40659. class: vue.normalizeClass(_ctx.nsSelect.be("dropdown", "empty"))
  40660. }, [
  40661. vue.renderSlot(_ctx.$slots, "empty", {}, () => [
  40662. vue.createElementVNode("span", null, vue.toDisplayString(_ctx.emptyText), 1)
  40663. ])
  40664. ], 2)
  40665. ])
  40666. } : void 0,
  40667. _ctx.$slots.footer ? {
  40668. name: "footer",
  40669. fn: vue.withCtx(() => [
  40670. vue.createElementVNode("div", {
  40671. class: vue.normalizeClass(_ctx.nsSelect.be("dropdown", "footer"))
  40672. }, [
  40673. vue.renderSlot(_ctx.$slots, "footer")
  40674. ], 2)
  40675. ])
  40676. } : void 0
  40677. ]), 1032, ["data", "width", "hovering-index", "scrollbar-always-on"])
  40678. ]),
  40679. _: 3
  40680. }, 8, ["visible", "teleported", "popper-class", "popper-options", "fallback-placements", "effect", "placement", "transition", "persistent", "append-to", "show-arrow", "offset", "onBeforeShow", "onHide"])
  40681. ], 42, ["onMouseenter", "onMouseleave"])), [
  40682. [_directive_click_outside, _ctx.handleClickOutside, _ctx.popperRef]
  40683. ]);
  40684. }
  40685. var Select = /* @__PURE__ */ _export_sfc(_sfc_main$M, [["render", _sfc_render$5], ["__file", "select.vue"]]);
  40686. const ElSelectV2 = withInstall(Select);
  40687. const skeletonProps = buildProps({
  40688. animated: {
  40689. type: Boolean,
  40690. default: false
  40691. },
  40692. count: {
  40693. type: Number,
  40694. default: 1
  40695. },
  40696. rows: {
  40697. type: Number,
  40698. default: 3
  40699. },
  40700. loading: {
  40701. type: Boolean,
  40702. default: true
  40703. },
  40704. throttle: {
  40705. type: definePropType([Number, Object])
  40706. }
  40707. });
  40708. const skeletonItemProps = buildProps({
  40709. variant: {
  40710. type: String,
  40711. values: [
  40712. "circle",
  40713. "rect",
  40714. "h1",
  40715. "h3",
  40716. "text",
  40717. "caption",
  40718. "p",
  40719. "image",
  40720. "button"
  40721. ],
  40722. default: "text"
  40723. }
  40724. });
  40725. const __default__$E = vue.defineComponent({
  40726. name: "ElSkeletonItem"
  40727. });
  40728. const _sfc_main$L = /* @__PURE__ */ vue.defineComponent({
  40729. ...__default__$E,
  40730. props: skeletonItemProps,
  40731. setup(__props) {
  40732. const ns = useNamespace("skeleton");
  40733. return (_ctx, _cache) => {
  40734. return vue.openBlock(), vue.createElementBlock("div", {
  40735. class: vue.normalizeClass([vue.unref(ns).e("item"), vue.unref(ns).e(_ctx.variant)])
  40736. }, [
  40737. _ctx.variant === "image" ? (vue.openBlock(), vue.createBlock(vue.unref(picture_filled_default), { key: 0 })) : vue.createCommentVNode("v-if", true)
  40738. ], 2);
  40739. };
  40740. }
  40741. });
  40742. var SkeletonItem = /* @__PURE__ */ _export_sfc(_sfc_main$L, [["__file", "skeleton-item.vue"]]);
  40743. const __default__$D = vue.defineComponent({
  40744. name: "ElSkeleton"
  40745. });
  40746. const _sfc_main$K = /* @__PURE__ */ vue.defineComponent({
  40747. ...__default__$D,
  40748. props: skeletonProps,
  40749. setup(__props, { expose }) {
  40750. const props = __props;
  40751. const ns = useNamespace("skeleton");
  40752. const uiLoading = useThrottleRender(vue.toRef(props, "loading"), props.throttle);
  40753. expose({
  40754. uiLoading
  40755. });
  40756. return (_ctx, _cache) => {
  40757. return vue.unref(uiLoading) ? (vue.openBlock(), vue.createElementBlock("div", vue.mergeProps({
  40758. key: 0,
  40759. class: [vue.unref(ns).b(), vue.unref(ns).is("animated", _ctx.animated)]
  40760. }, _ctx.$attrs), [
  40761. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.count, (i) => {
  40762. return vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: i }, [
  40763. vue.unref(uiLoading) ? vue.renderSlot(_ctx.$slots, "template", { key: i }, () => [
  40764. vue.createVNode(SkeletonItem, {
  40765. class: vue.normalizeClass(vue.unref(ns).is("first")),
  40766. variant: "p"
  40767. }, null, 8, ["class"]),
  40768. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.rows, (item) => {
  40769. return vue.openBlock(), vue.createBlock(SkeletonItem, {
  40770. key: item,
  40771. class: vue.normalizeClass([
  40772. vue.unref(ns).e("paragraph"),
  40773. vue.unref(ns).is("last", item === _ctx.rows && _ctx.rows > 1)
  40774. ]),
  40775. variant: "p"
  40776. }, null, 8, ["class"]);
  40777. }), 128))
  40778. ]) : vue.createCommentVNode("v-if", true)
  40779. ], 64);
  40780. }), 128))
  40781. ], 16)) : vue.renderSlot(_ctx.$slots, "default", vue.normalizeProps(vue.mergeProps({ key: 1 }, _ctx.$attrs)));
  40782. };
  40783. }
  40784. });
  40785. var Skeleton = /* @__PURE__ */ _export_sfc(_sfc_main$K, [["__file", "skeleton.vue"]]);
  40786. const ElSkeleton = withInstall(Skeleton, {
  40787. SkeletonItem
  40788. });
  40789. const ElSkeletonItem = withNoopInstall(SkeletonItem);
  40790. const sliderContextKey = Symbol("sliderContextKey");
  40791. const sliderProps = buildProps({
  40792. modelValue: {
  40793. type: definePropType([Number, Array]),
  40794. default: 0
  40795. },
  40796. id: {
  40797. type: String,
  40798. default: void 0
  40799. },
  40800. min: {
  40801. type: Number,
  40802. default: 0
  40803. },
  40804. max: {
  40805. type: Number,
  40806. default: 100
  40807. },
  40808. step: {
  40809. type: Number,
  40810. default: 1
  40811. },
  40812. showInput: Boolean,
  40813. showInputControls: {
  40814. type: Boolean,
  40815. default: true
  40816. },
  40817. size: useSizeProp,
  40818. inputSize: useSizeProp,
  40819. showStops: Boolean,
  40820. showTooltip: {
  40821. type: Boolean,
  40822. default: true
  40823. },
  40824. formatTooltip: {
  40825. type: definePropType(Function),
  40826. default: void 0
  40827. },
  40828. disabled: Boolean,
  40829. range: Boolean,
  40830. vertical: Boolean,
  40831. height: String,
  40832. debounce: {
  40833. type: Number,
  40834. default: 300
  40835. },
  40836. rangeStartLabel: {
  40837. type: String,
  40838. default: void 0
  40839. },
  40840. rangeEndLabel: {
  40841. type: String,
  40842. default: void 0
  40843. },
  40844. formatValueText: {
  40845. type: definePropType(Function),
  40846. default: void 0
  40847. },
  40848. tooltipClass: {
  40849. type: String,
  40850. default: void 0
  40851. },
  40852. placement: {
  40853. type: String,
  40854. values: Ee,
  40855. default: "top"
  40856. },
  40857. marks: {
  40858. type: definePropType(Object)
  40859. },
  40860. validateEvent: {
  40861. type: Boolean,
  40862. default: true
  40863. },
  40864. ...useAriaProps(["ariaLabel"])
  40865. });
  40866. const isValidValue$1 = (value) => isNumber(value) || isArray$1(value) && value.every(isNumber);
  40867. const sliderEmits = {
  40868. [UPDATE_MODEL_EVENT]: isValidValue$1,
  40869. [INPUT_EVENT]: isValidValue$1,
  40870. [CHANGE_EVENT]: isValidValue$1
  40871. };
  40872. const useLifecycle = (props, initData, resetSize) => {
  40873. const sliderWrapper = vue.ref();
  40874. vue.onMounted(async () => {
  40875. if (props.range) {
  40876. if (isArray$1(props.modelValue)) {
  40877. initData.firstValue = Math.max(props.min, props.modelValue[0]);
  40878. initData.secondValue = Math.min(props.max, props.modelValue[1]);
  40879. } else {
  40880. initData.firstValue = props.min;
  40881. initData.secondValue = props.max;
  40882. }
  40883. initData.oldValue = [initData.firstValue, initData.secondValue];
  40884. } else {
  40885. if (!isNumber(props.modelValue) || Number.isNaN(props.modelValue)) {
  40886. initData.firstValue = props.min;
  40887. } else {
  40888. initData.firstValue = Math.min(props.max, Math.max(props.min, props.modelValue));
  40889. }
  40890. initData.oldValue = initData.firstValue;
  40891. }
  40892. useEventListener(window, "resize", resetSize);
  40893. await vue.nextTick();
  40894. resetSize();
  40895. });
  40896. return {
  40897. sliderWrapper
  40898. };
  40899. };
  40900. const useMarks = (props) => {
  40901. return vue.computed(() => {
  40902. if (!props.marks) {
  40903. return [];
  40904. }
  40905. const marksKeys = Object.keys(props.marks);
  40906. return marksKeys.map(Number.parseFloat).sort((a, b) => a - b).filter((point) => point <= props.max && point >= props.min).map((point) => ({
  40907. point,
  40908. position: (point - props.min) * 100 / (props.max - props.min),
  40909. mark: props.marks[point]
  40910. }));
  40911. });
  40912. };
  40913. const useSlide = (props, initData, emit) => {
  40914. const { form: elForm, formItem: elFormItem } = useFormItem();
  40915. const slider = vue.shallowRef();
  40916. const firstButton = vue.ref();
  40917. const secondButton = vue.ref();
  40918. const buttonRefs = {
  40919. firstButton,
  40920. secondButton
  40921. };
  40922. const sliderDisabled = vue.computed(() => {
  40923. return props.disabled || (elForm == null ? void 0 : elForm.disabled) || false;
  40924. });
  40925. const minValue = vue.computed(() => {
  40926. return Math.min(initData.firstValue, initData.secondValue);
  40927. });
  40928. const maxValue = vue.computed(() => {
  40929. return Math.max(initData.firstValue, initData.secondValue);
  40930. });
  40931. const barSize = vue.computed(() => {
  40932. return props.range ? `${100 * (maxValue.value - minValue.value) / (props.max - props.min)}%` : `${100 * (initData.firstValue - props.min) / (props.max - props.min)}%`;
  40933. });
  40934. const barStart = vue.computed(() => {
  40935. return props.range ? `${100 * (minValue.value - props.min) / (props.max - props.min)}%` : "0%";
  40936. });
  40937. const runwayStyle = vue.computed(() => {
  40938. return props.vertical ? { height: props.height } : {};
  40939. });
  40940. const barStyle = vue.computed(() => {
  40941. return props.vertical ? {
  40942. height: barSize.value,
  40943. bottom: barStart.value
  40944. } : {
  40945. width: barSize.value,
  40946. left: barStart.value
  40947. };
  40948. });
  40949. const resetSize = () => {
  40950. if (slider.value) {
  40951. initData.sliderSize = slider.value[`client${props.vertical ? "Height" : "Width"}`];
  40952. }
  40953. };
  40954. const getButtonRefByPercent = (percent) => {
  40955. const targetValue = props.min + percent * (props.max - props.min) / 100;
  40956. if (!props.range) {
  40957. return firstButton;
  40958. }
  40959. let buttonRefName;
  40960. if (Math.abs(minValue.value - targetValue) < Math.abs(maxValue.value - targetValue)) {
  40961. buttonRefName = initData.firstValue < initData.secondValue ? "firstButton" : "secondButton";
  40962. } else {
  40963. buttonRefName = initData.firstValue > initData.secondValue ? "firstButton" : "secondButton";
  40964. }
  40965. return buttonRefs[buttonRefName];
  40966. };
  40967. const setPosition = (percent) => {
  40968. const buttonRef = getButtonRefByPercent(percent);
  40969. buttonRef.value.setPosition(percent);
  40970. return buttonRef;
  40971. };
  40972. const setFirstValue = (firstValue) => {
  40973. initData.firstValue = firstValue != null ? firstValue : props.min;
  40974. _emit(props.range ? [minValue.value, maxValue.value] : firstValue != null ? firstValue : props.min);
  40975. };
  40976. const setSecondValue = (secondValue) => {
  40977. initData.secondValue = secondValue;
  40978. if (props.range) {
  40979. _emit([minValue.value, maxValue.value]);
  40980. }
  40981. };
  40982. const _emit = (val) => {
  40983. emit(UPDATE_MODEL_EVENT, val);
  40984. emit(INPUT_EVENT, val);
  40985. };
  40986. const emitChange = async () => {
  40987. await vue.nextTick();
  40988. emit(CHANGE_EVENT, props.range ? [minValue.value, maxValue.value] : props.modelValue);
  40989. };
  40990. const handleSliderPointerEvent = (event) => {
  40991. var _a, _b, _c, _d, _e, _f;
  40992. if (sliderDisabled.value || initData.dragging)
  40993. return;
  40994. resetSize();
  40995. let newPercent = 0;
  40996. if (props.vertical) {
  40997. const clientY = (_c = (_b = (_a = event.touches) == null ? void 0 : _a.item(0)) == null ? void 0 : _b.clientY) != null ? _c : event.clientY;
  40998. const sliderOffsetBottom = slider.value.getBoundingClientRect().bottom;
  40999. newPercent = (sliderOffsetBottom - clientY) / initData.sliderSize * 100;
  41000. } else {
  41001. const clientX = (_f = (_e = (_d = event.touches) == null ? void 0 : _d.item(0)) == null ? void 0 : _e.clientX) != null ? _f : event.clientX;
  41002. const sliderOffsetLeft = slider.value.getBoundingClientRect().left;
  41003. newPercent = (clientX - sliderOffsetLeft) / initData.sliderSize * 100;
  41004. }
  41005. if (newPercent < 0 || newPercent > 100)
  41006. return;
  41007. return setPosition(newPercent);
  41008. };
  41009. const onSliderWrapperPrevent = (event) => {
  41010. var _a, _b;
  41011. if (((_a = buttonRefs["firstButton"].value) == null ? void 0 : _a.dragging) || ((_b = buttonRefs["secondButton"].value) == null ? void 0 : _b.dragging)) {
  41012. event.preventDefault();
  41013. }
  41014. };
  41015. const onSliderDown = async (event) => {
  41016. const buttonRef = handleSliderPointerEvent(event);
  41017. if (buttonRef) {
  41018. await vue.nextTick();
  41019. buttonRef.value.onButtonDown(event);
  41020. }
  41021. };
  41022. const onSliderClick = (event) => {
  41023. const buttonRef = handleSliderPointerEvent(event);
  41024. if (buttonRef) {
  41025. emitChange();
  41026. }
  41027. };
  41028. const onSliderMarkerDown = (position) => {
  41029. if (sliderDisabled.value || initData.dragging)
  41030. return;
  41031. setPosition(position);
  41032. };
  41033. return {
  41034. elFormItem,
  41035. slider,
  41036. firstButton,
  41037. secondButton,
  41038. sliderDisabled,
  41039. minValue,
  41040. maxValue,
  41041. runwayStyle,
  41042. barStyle,
  41043. resetSize,
  41044. setPosition,
  41045. emitChange,
  41046. onSliderWrapperPrevent,
  41047. onSliderClick,
  41048. onSliderDown,
  41049. onSliderMarkerDown,
  41050. setFirstValue,
  41051. setSecondValue
  41052. };
  41053. };
  41054. const useTooltip = (props, formatTooltip, showTooltip) => {
  41055. const tooltip = vue.ref();
  41056. const tooltipVisible = vue.ref(false);
  41057. const enableFormat = vue.computed(() => {
  41058. return formatTooltip.value instanceof Function;
  41059. });
  41060. const formatValue = vue.computed(() => {
  41061. return enableFormat.value && formatTooltip.value(props.modelValue) || props.modelValue;
  41062. });
  41063. const displayTooltip = debounce(() => {
  41064. showTooltip.value && (tooltipVisible.value = true);
  41065. }, 50);
  41066. const hideTooltip = debounce(() => {
  41067. showTooltip.value && (tooltipVisible.value = false);
  41068. }, 50);
  41069. return {
  41070. tooltip,
  41071. tooltipVisible,
  41072. formatValue,
  41073. displayTooltip,
  41074. hideTooltip
  41075. };
  41076. };
  41077. const useSliderButton = (props, initData, emit) => {
  41078. const {
  41079. disabled,
  41080. min,
  41081. max,
  41082. step,
  41083. showTooltip,
  41084. precision,
  41085. sliderSize,
  41086. formatTooltip,
  41087. emitChange,
  41088. resetSize,
  41089. updateDragging
  41090. } = vue.inject(sliderContextKey);
  41091. const { tooltip, tooltipVisible, formatValue, displayTooltip, hideTooltip } = useTooltip(props, formatTooltip, showTooltip);
  41092. const button = vue.ref();
  41093. const currentPosition = vue.computed(() => {
  41094. return `${(props.modelValue - min.value) / (max.value - min.value) * 100}%`;
  41095. });
  41096. const wrapperStyle = vue.computed(() => {
  41097. return props.vertical ? { bottom: currentPosition.value } : { left: currentPosition.value };
  41098. });
  41099. const handleMouseEnter = () => {
  41100. initData.hovering = true;
  41101. displayTooltip();
  41102. };
  41103. const handleMouseLeave = () => {
  41104. initData.hovering = false;
  41105. if (!initData.dragging) {
  41106. hideTooltip();
  41107. }
  41108. };
  41109. const onButtonDown = (event) => {
  41110. if (disabled.value)
  41111. return;
  41112. event.preventDefault();
  41113. onDragStart(event);
  41114. window.addEventListener("mousemove", onDragging);
  41115. window.addEventListener("touchmove", onDragging);
  41116. window.addEventListener("mouseup", onDragEnd);
  41117. window.addEventListener("touchend", onDragEnd);
  41118. window.addEventListener("contextmenu", onDragEnd);
  41119. button.value.focus();
  41120. };
  41121. const incrementPosition = (amount) => {
  41122. if (disabled.value)
  41123. return;
  41124. initData.newPosition = Number.parseFloat(currentPosition.value) + amount / (max.value - min.value) * 100;
  41125. setPosition(initData.newPosition);
  41126. emitChange();
  41127. };
  41128. const onLeftKeyDown = () => {
  41129. incrementPosition(-step.value);
  41130. };
  41131. const onRightKeyDown = () => {
  41132. incrementPosition(step.value);
  41133. };
  41134. const onPageDownKeyDown = () => {
  41135. incrementPosition(-step.value * 4);
  41136. };
  41137. const onPageUpKeyDown = () => {
  41138. incrementPosition(step.value * 4);
  41139. };
  41140. const onHomeKeyDown = () => {
  41141. if (disabled.value)
  41142. return;
  41143. setPosition(0);
  41144. emitChange();
  41145. };
  41146. const onEndKeyDown = () => {
  41147. if (disabled.value)
  41148. return;
  41149. setPosition(100);
  41150. emitChange();
  41151. };
  41152. const onKeyDown = (event) => {
  41153. let isPreventDefault = true;
  41154. switch (event.code) {
  41155. case EVENT_CODE.left:
  41156. case EVENT_CODE.down:
  41157. onLeftKeyDown();
  41158. break;
  41159. case EVENT_CODE.right:
  41160. case EVENT_CODE.up:
  41161. onRightKeyDown();
  41162. break;
  41163. case EVENT_CODE.home:
  41164. onHomeKeyDown();
  41165. break;
  41166. case EVENT_CODE.end:
  41167. onEndKeyDown();
  41168. break;
  41169. case EVENT_CODE.pageDown:
  41170. onPageDownKeyDown();
  41171. break;
  41172. case EVENT_CODE.pageUp:
  41173. onPageUpKeyDown();
  41174. break;
  41175. default:
  41176. isPreventDefault = false;
  41177. break;
  41178. }
  41179. isPreventDefault && event.preventDefault();
  41180. };
  41181. const getClientXY = (event) => {
  41182. let clientX;
  41183. let clientY;
  41184. if (event.type.startsWith("touch")) {
  41185. clientY = event.touches[0].clientY;
  41186. clientX = event.touches[0].clientX;
  41187. } else {
  41188. clientY = event.clientY;
  41189. clientX = event.clientX;
  41190. }
  41191. return {
  41192. clientX,
  41193. clientY
  41194. };
  41195. };
  41196. const onDragStart = (event) => {
  41197. initData.dragging = true;
  41198. initData.isClick = true;
  41199. const { clientX, clientY } = getClientXY(event);
  41200. if (props.vertical) {
  41201. initData.startY = clientY;
  41202. } else {
  41203. initData.startX = clientX;
  41204. }
  41205. initData.startPosition = Number.parseFloat(currentPosition.value);
  41206. initData.newPosition = initData.startPosition;
  41207. };
  41208. const onDragging = (event) => {
  41209. if (initData.dragging) {
  41210. initData.isClick = false;
  41211. displayTooltip();
  41212. resetSize();
  41213. let diff;
  41214. const { clientX, clientY } = getClientXY(event);
  41215. if (props.vertical) {
  41216. initData.currentY = clientY;
  41217. diff = (initData.startY - initData.currentY) / sliderSize.value * 100;
  41218. } else {
  41219. initData.currentX = clientX;
  41220. diff = (initData.currentX - initData.startX) / sliderSize.value * 100;
  41221. }
  41222. initData.newPosition = initData.startPosition + diff;
  41223. setPosition(initData.newPosition);
  41224. }
  41225. };
  41226. const onDragEnd = () => {
  41227. if (initData.dragging) {
  41228. setTimeout(() => {
  41229. initData.dragging = false;
  41230. if (!initData.hovering) {
  41231. hideTooltip();
  41232. }
  41233. if (!initData.isClick) {
  41234. setPosition(initData.newPosition);
  41235. }
  41236. emitChange();
  41237. }, 0);
  41238. window.removeEventListener("mousemove", onDragging);
  41239. window.removeEventListener("touchmove", onDragging);
  41240. window.removeEventListener("mouseup", onDragEnd);
  41241. window.removeEventListener("touchend", onDragEnd);
  41242. window.removeEventListener("contextmenu", onDragEnd);
  41243. }
  41244. };
  41245. const setPosition = async (newPosition) => {
  41246. if (newPosition === null || Number.isNaN(+newPosition))
  41247. return;
  41248. if (newPosition < 0) {
  41249. newPosition = 0;
  41250. } else if (newPosition > 100) {
  41251. newPosition = 100;
  41252. }
  41253. const lengthPerStep = 100 / ((max.value - min.value) / step.value);
  41254. const steps = Math.round(newPosition / lengthPerStep);
  41255. let value = steps * lengthPerStep * (max.value - min.value) * 0.01 + min.value;
  41256. value = Number.parseFloat(value.toFixed(precision.value));
  41257. if (value !== props.modelValue) {
  41258. emit(UPDATE_MODEL_EVENT, value);
  41259. }
  41260. if (!initData.dragging && props.modelValue !== initData.oldValue) {
  41261. initData.oldValue = props.modelValue;
  41262. }
  41263. await vue.nextTick();
  41264. initData.dragging && displayTooltip();
  41265. tooltip.value.updatePopper();
  41266. };
  41267. vue.watch(() => initData.dragging, (val) => {
  41268. updateDragging(val);
  41269. });
  41270. useEventListener(button, "touchstart", onButtonDown, { passive: false });
  41271. return {
  41272. disabled,
  41273. button,
  41274. tooltip,
  41275. tooltipVisible,
  41276. showTooltip,
  41277. wrapperStyle,
  41278. formatValue,
  41279. handleMouseEnter,
  41280. handleMouseLeave,
  41281. onButtonDown,
  41282. onKeyDown,
  41283. setPosition
  41284. };
  41285. };
  41286. const useStops = (props, initData, minValue, maxValue) => {
  41287. const stops = vue.computed(() => {
  41288. if (!props.showStops || props.min > props.max)
  41289. return [];
  41290. if (props.step === 0) {
  41291. return [];
  41292. }
  41293. const stopCount = (props.max - props.min) / props.step;
  41294. const stepWidth = 100 * props.step / (props.max - props.min);
  41295. const result = Array.from({ length: stopCount - 1 }).map((_, index) => (index + 1) * stepWidth);
  41296. if (props.range) {
  41297. return result.filter((step) => {
  41298. return step < 100 * (minValue.value - props.min) / (props.max - props.min) || step > 100 * (maxValue.value - props.min) / (props.max - props.min);
  41299. });
  41300. } else {
  41301. return result.filter((step) => step > 100 * (initData.firstValue - props.min) / (props.max - props.min));
  41302. }
  41303. });
  41304. const getStopStyle = (position) => {
  41305. return props.vertical ? { bottom: `${position}%` } : { left: `${position}%` };
  41306. };
  41307. return {
  41308. stops,
  41309. getStopStyle
  41310. };
  41311. };
  41312. const useWatch = (props, initData, minValue, maxValue, emit, elFormItem) => {
  41313. const _emit = (val) => {
  41314. emit(UPDATE_MODEL_EVENT, val);
  41315. emit(INPUT_EVENT, val);
  41316. };
  41317. const valueChanged = () => {
  41318. if (props.range) {
  41319. return ![minValue.value, maxValue.value].every((item, index) => item === initData.oldValue[index]);
  41320. } else {
  41321. return props.modelValue !== initData.oldValue;
  41322. }
  41323. };
  41324. const setValues = () => {
  41325. var _a, _b;
  41326. if (props.min > props.max) {
  41327. throwError("Slider", "min should not be greater than max.");
  41328. }
  41329. const val = props.modelValue;
  41330. if (props.range && isArray$1(val)) {
  41331. if (val[1] < props.min) {
  41332. _emit([props.min, props.min]);
  41333. } else if (val[0] > props.max) {
  41334. _emit([props.max, props.max]);
  41335. } else if (val[0] < props.min) {
  41336. _emit([props.min, val[1]]);
  41337. } else if (val[1] > props.max) {
  41338. _emit([val[0], props.max]);
  41339. } else {
  41340. initData.firstValue = val[0];
  41341. initData.secondValue = val[1];
  41342. if (valueChanged()) {
  41343. if (props.validateEvent) {
  41344. (_a = elFormItem == null ? void 0 : elFormItem.validate) == null ? void 0 : _a.call(elFormItem, "change").catch((err) => debugWarn());
  41345. }
  41346. initData.oldValue = val.slice();
  41347. }
  41348. }
  41349. } else if (!props.range && isNumber(val) && !Number.isNaN(val)) {
  41350. if (val < props.min) {
  41351. _emit(props.min);
  41352. } else if (val > props.max) {
  41353. _emit(props.max);
  41354. } else {
  41355. initData.firstValue = val;
  41356. if (valueChanged()) {
  41357. if (props.validateEvent) {
  41358. (_b = elFormItem == null ? void 0 : elFormItem.validate) == null ? void 0 : _b.call(elFormItem, "change").catch((err) => debugWarn());
  41359. }
  41360. initData.oldValue = val;
  41361. }
  41362. }
  41363. }
  41364. };
  41365. setValues();
  41366. vue.watch(() => initData.dragging, (val) => {
  41367. if (!val) {
  41368. setValues();
  41369. }
  41370. });
  41371. vue.watch(() => props.modelValue, (val, oldVal) => {
  41372. if (initData.dragging || isArray$1(val) && isArray$1(oldVal) && val.every((item, index) => item === oldVal[index]) && initData.firstValue === val[0] && initData.secondValue === val[1]) {
  41373. return;
  41374. }
  41375. setValues();
  41376. }, {
  41377. deep: true
  41378. });
  41379. vue.watch(() => [props.min, props.max], () => {
  41380. setValues();
  41381. });
  41382. };
  41383. const sliderButtonProps = buildProps({
  41384. modelValue: {
  41385. type: Number,
  41386. default: 0
  41387. },
  41388. vertical: Boolean,
  41389. tooltipClass: String,
  41390. placement: {
  41391. type: String,
  41392. values: Ee,
  41393. default: "top"
  41394. }
  41395. });
  41396. const sliderButtonEmits = {
  41397. [UPDATE_MODEL_EVENT]: (value) => isNumber(value)
  41398. };
  41399. const __default__$C = vue.defineComponent({
  41400. name: "ElSliderButton"
  41401. });
  41402. const _sfc_main$J = /* @__PURE__ */ vue.defineComponent({
  41403. ...__default__$C,
  41404. props: sliderButtonProps,
  41405. emits: sliderButtonEmits,
  41406. setup(__props, { expose, emit }) {
  41407. const props = __props;
  41408. const ns = useNamespace("slider");
  41409. const initData = vue.reactive({
  41410. hovering: false,
  41411. dragging: false,
  41412. isClick: false,
  41413. startX: 0,
  41414. currentX: 0,
  41415. startY: 0,
  41416. currentY: 0,
  41417. startPosition: 0,
  41418. newPosition: 0,
  41419. oldValue: props.modelValue
  41420. });
  41421. const {
  41422. disabled,
  41423. button,
  41424. tooltip,
  41425. showTooltip,
  41426. tooltipVisible,
  41427. wrapperStyle,
  41428. formatValue,
  41429. handleMouseEnter,
  41430. handleMouseLeave,
  41431. onButtonDown,
  41432. onKeyDown,
  41433. setPosition
  41434. } = useSliderButton(props, initData, emit);
  41435. const { hovering, dragging } = vue.toRefs(initData);
  41436. expose({
  41437. onButtonDown,
  41438. onKeyDown,
  41439. setPosition,
  41440. hovering,
  41441. dragging
  41442. });
  41443. return (_ctx, _cache) => {
  41444. return vue.openBlock(), vue.createElementBlock("div", {
  41445. ref_key: "button",
  41446. ref: button,
  41447. class: vue.normalizeClass([vue.unref(ns).e("button-wrapper"), { hover: vue.unref(hovering), dragging: vue.unref(dragging) }]),
  41448. style: vue.normalizeStyle(vue.unref(wrapperStyle)),
  41449. tabindex: vue.unref(disabled) ? -1 : 0,
  41450. onMouseenter: vue.unref(handleMouseEnter),
  41451. onMouseleave: vue.unref(handleMouseLeave),
  41452. onMousedown: vue.unref(onButtonDown),
  41453. onFocus: vue.unref(handleMouseEnter),
  41454. onBlur: vue.unref(handleMouseLeave),
  41455. onKeydown: vue.unref(onKeyDown)
  41456. }, [
  41457. vue.createVNode(vue.unref(ElTooltip), {
  41458. ref_key: "tooltip",
  41459. ref: tooltip,
  41460. visible: vue.unref(tooltipVisible),
  41461. placement: _ctx.placement,
  41462. "fallback-placements": ["top", "bottom", "right", "left"],
  41463. "stop-popper-mouse-event": false,
  41464. "popper-class": _ctx.tooltipClass,
  41465. disabled: !vue.unref(showTooltip),
  41466. persistent: vue.unref(showTooltip)
  41467. }, {
  41468. content: vue.withCtx(() => [
  41469. vue.createElementVNode("span", null, vue.toDisplayString(vue.unref(formatValue)), 1)
  41470. ]),
  41471. default: vue.withCtx(() => [
  41472. vue.createElementVNode("div", {
  41473. class: vue.normalizeClass([vue.unref(ns).e("button"), { hover: vue.unref(hovering), dragging: vue.unref(dragging) }])
  41474. }, null, 2)
  41475. ]),
  41476. _: 1
  41477. }, 8, ["visible", "placement", "popper-class", "disabled", "persistent"])
  41478. ], 46, ["tabindex", "onMouseenter", "onMouseleave", "onMousedown", "onFocus", "onBlur", "onKeydown"]);
  41479. };
  41480. }
  41481. });
  41482. var SliderButton = /* @__PURE__ */ _export_sfc(_sfc_main$J, [["__file", "button.vue"]]);
  41483. const sliderMarkerProps = buildProps({
  41484. mark: {
  41485. type: definePropType([String, Object]),
  41486. default: void 0
  41487. }
  41488. });
  41489. var SliderMarker = vue.defineComponent({
  41490. name: "ElSliderMarker",
  41491. props: sliderMarkerProps,
  41492. setup(props) {
  41493. const ns = useNamespace("slider");
  41494. const label = vue.computed(() => {
  41495. return isString$1(props.mark) ? props.mark : props.mark.label;
  41496. });
  41497. const style = vue.computed(() => isString$1(props.mark) ? void 0 : props.mark.style);
  41498. return () => vue.h("div", {
  41499. class: ns.e("marks-text"),
  41500. style: style.value
  41501. }, label.value);
  41502. }
  41503. });
  41504. const __default__$B = vue.defineComponent({
  41505. name: "ElSlider"
  41506. });
  41507. const _sfc_main$I = /* @__PURE__ */ vue.defineComponent({
  41508. ...__default__$B,
  41509. props: sliderProps,
  41510. emits: sliderEmits,
  41511. setup(__props, { expose, emit }) {
  41512. const props = __props;
  41513. const ns = useNamespace("slider");
  41514. const { t } = useLocale();
  41515. const initData = vue.reactive({
  41516. firstValue: 0,
  41517. secondValue: 0,
  41518. oldValue: 0,
  41519. dragging: false,
  41520. sliderSize: 1
  41521. });
  41522. const {
  41523. elFormItem,
  41524. slider,
  41525. firstButton,
  41526. secondButton,
  41527. sliderDisabled,
  41528. minValue,
  41529. maxValue,
  41530. runwayStyle,
  41531. barStyle,
  41532. resetSize,
  41533. emitChange,
  41534. onSliderWrapperPrevent,
  41535. onSliderClick,
  41536. onSliderDown,
  41537. onSliderMarkerDown,
  41538. setFirstValue,
  41539. setSecondValue
  41540. } = useSlide(props, initData, emit);
  41541. const { stops, getStopStyle } = useStops(props, initData, minValue, maxValue);
  41542. const { inputId, isLabeledByFormItem } = useFormItemInputId(props, {
  41543. formItemContext: elFormItem
  41544. });
  41545. const sliderWrapperSize = useFormSize();
  41546. const sliderInputSize = vue.computed(() => props.inputSize || sliderWrapperSize.value);
  41547. const groupLabel = vue.computed(() => {
  41548. return props.ariaLabel || t("el.slider.defaultLabel", {
  41549. min: props.min,
  41550. max: props.max
  41551. });
  41552. });
  41553. const firstButtonLabel = vue.computed(() => {
  41554. if (props.range) {
  41555. return props.rangeStartLabel || t("el.slider.defaultRangeStartLabel");
  41556. } else {
  41557. return groupLabel.value;
  41558. }
  41559. });
  41560. const firstValueText = vue.computed(() => {
  41561. return props.formatValueText ? props.formatValueText(firstValue.value) : `${firstValue.value}`;
  41562. });
  41563. const secondButtonLabel = vue.computed(() => {
  41564. return props.rangeEndLabel || t("el.slider.defaultRangeEndLabel");
  41565. });
  41566. const secondValueText = vue.computed(() => {
  41567. return props.formatValueText ? props.formatValueText(secondValue.value) : `${secondValue.value}`;
  41568. });
  41569. const sliderKls = vue.computed(() => [
  41570. ns.b(),
  41571. ns.m(sliderWrapperSize.value),
  41572. ns.is("vertical", props.vertical),
  41573. { [ns.m("with-input")]: props.showInput }
  41574. ]);
  41575. const markList = useMarks(props);
  41576. useWatch(props, initData, minValue, maxValue, emit, elFormItem);
  41577. const precision = vue.computed(() => {
  41578. const precisions = [props.min, props.max, props.step].map((item) => {
  41579. const decimal = `${item}`.split(".")[1];
  41580. return decimal ? decimal.length : 0;
  41581. });
  41582. return Math.max.apply(null, precisions);
  41583. });
  41584. const { sliderWrapper } = useLifecycle(props, initData, resetSize);
  41585. const { firstValue, secondValue, sliderSize } = vue.toRefs(initData);
  41586. const updateDragging = (val) => {
  41587. initData.dragging = val;
  41588. };
  41589. useEventListener(sliderWrapper, "touchstart", onSliderWrapperPrevent, {
  41590. passive: false
  41591. });
  41592. useEventListener(sliderWrapper, "touchmove", onSliderWrapperPrevent, {
  41593. passive: false
  41594. });
  41595. vue.provide(sliderContextKey, {
  41596. ...vue.toRefs(props),
  41597. sliderSize,
  41598. disabled: sliderDisabled,
  41599. precision,
  41600. emitChange,
  41601. resetSize,
  41602. updateDragging
  41603. });
  41604. expose({
  41605. onSliderClick
  41606. });
  41607. return (_ctx, _cache) => {
  41608. var _a, _b;
  41609. return vue.openBlock(), vue.createElementBlock("div", {
  41610. id: _ctx.range ? vue.unref(inputId) : void 0,
  41611. ref_key: "sliderWrapper",
  41612. ref: sliderWrapper,
  41613. class: vue.normalizeClass(vue.unref(sliderKls)),
  41614. role: _ctx.range ? "group" : void 0,
  41615. "aria-label": _ctx.range && !vue.unref(isLabeledByFormItem) ? vue.unref(groupLabel) : void 0,
  41616. "aria-labelledby": _ctx.range && vue.unref(isLabeledByFormItem) ? (_a = vue.unref(elFormItem)) == null ? void 0 : _a.labelId : void 0
  41617. }, [
  41618. vue.createElementVNode("div", {
  41619. ref_key: "slider",
  41620. ref: slider,
  41621. class: vue.normalizeClass([
  41622. vue.unref(ns).e("runway"),
  41623. { "show-input": _ctx.showInput && !_ctx.range },
  41624. vue.unref(ns).is("disabled", vue.unref(sliderDisabled))
  41625. ]),
  41626. style: vue.normalizeStyle(vue.unref(runwayStyle)),
  41627. onMousedown: vue.unref(onSliderDown),
  41628. onTouchstartPassive: vue.unref(onSliderDown)
  41629. }, [
  41630. vue.createElementVNode("div", {
  41631. class: vue.normalizeClass(vue.unref(ns).e("bar")),
  41632. style: vue.normalizeStyle(vue.unref(barStyle))
  41633. }, null, 6),
  41634. vue.createVNode(SliderButton, {
  41635. id: !_ctx.range ? vue.unref(inputId) : void 0,
  41636. ref_key: "firstButton",
  41637. ref: firstButton,
  41638. "model-value": vue.unref(firstValue),
  41639. vertical: _ctx.vertical,
  41640. "tooltip-class": _ctx.tooltipClass,
  41641. placement: _ctx.placement,
  41642. role: "slider",
  41643. "aria-label": _ctx.range || !vue.unref(isLabeledByFormItem) ? vue.unref(firstButtonLabel) : void 0,
  41644. "aria-labelledby": !_ctx.range && vue.unref(isLabeledByFormItem) ? (_b = vue.unref(elFormItem)) == null ? void 0 : _b.labelId : void 0,
  41645. "aria-valuemin": _ctx.min,
  41646. "aria-valuemax": _ctx.range ? vue.unref(secondValue) : _ctx.max,
  41647. "aria-valuenow": vue.unref(firstValue),
  41648. "aria-valuetext": vue.unref(firstValueText),
  41649. "aria-orientation": _ctx.vertical ? "vertical" : "horizontal",
  41650. "aria-disabled": vue.unref(sliderDisabled),
  41651. "onUpdate:modelValue": vue.unref(setFirstValue)
  41652. }, null, 8, ["id", "model-value", "vertical", "tooltip-class", "placement", "aria-label", "aria-labelledby", "aria-valuemin", "aria-valuemax", "aria-valuenow", "aria-valuetext", "aria-orientation", "aria-disabled", "onUpdate:modelValue"]),
  41653. _ctx.range ? (vue.openBlock(), vue.createBlock(SliderButton, {
  41654. key: 0,
  41655. ref_key: "secondButton",
  41656. ref: secondButton,
  41657. "model-value": vue.unref(secondValue),
  41658. vertical: _ctx.vertical,
  41659. "tooltip-class": _ctx.tooltipClass,
  41660. placement: _ctx.placement,
  41661. role: "slider",
  41662. "aria-label": vue.unref(secondButtonLabel),
  41663. "aria-valuemin": vue.unref(firstValue),
  41664. "aria-valuemax": _ctx.max,
  41665. "aria-valuenow": vue.unref(secondValue),
  41666. "aria-valuetext": vue.unref(secondValueText),
  41667. "aria-orientation": _ctx.vertical ? "vertical" : "horizontal",
  41668. "aria-disabled": vue.unref(sliderDisabled),
  41669. "onUpdate:modelValue": vue.unref(setSecondValue)
  41670. }, null, 8, ["model-value", "vertical", "tooltip-class", "placement", "aria-label", "aria-valuemin", "aria-valuemax", "aria-valuenow", "aria-valuetext", "aria-orientation", "aria-disabled", "onUpdate:modelValue"])) : vue.createCommentVNode("v-if", true),
  41671. _ctx.showStops ? (vue.openBlock(), vue.createElementBlock("div", { key: 1 }, [
  41672. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(stops), (item, key) => {
  41673. return vue.openBlock(), vue.createElementBlock("div", {
  41674. key,
  41675. class: vue.normalizeClass(vue.unref(ns).e("stop")),
  41676. style: vue.normalizeStyle(vue.unref(getStopStyle)(item))
  41677. }, null, 6);
  41678. }), 128))
  41679. ])) : vue.createCommentVNode("v-if", true),
  41680. vue.unref(markList).length > 0 ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 2 }, [
  41681. vue.createElementVNode("div", null, [
  41682. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(markList), (item, key) => {
  41683. return vue.openBlock(), vue.createElementBlock("div", {
  41684. key,
  41685. style: vue.normalizeStyle(vue.unref(getStopStyle)(item.position)),
  41686. class: vue.normalizeClass([vue.unref(ns).e("stop"), vue.unref(ns).e("marks-stop")])
  41687. }, null, 6);
  41688. }), 128))
  41689. ]),
  41690. vue.createElementVNode("div", {
  41691. class: vue.normalizeClass(vue.unref(ns).e("marks"))
  41692. }, [
  41693. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(markList), (item, key) => {
  41694. return vue.openBlock(), vue.createBlock(vue.unref(SliderMarker), {
  41695. key,
  41696. mark: item.mark,
  41697. style: vue.normalizeStyle(vue.unref(getStopStyle)(item.position)),
  41698. onMousedown: vue.withModifiers(($event) => vue.unref(onSliderMarkerDown)(item.position), ["stop"])
  41699. }, null, 8, ["mark", "style", "onMousedown"]);
  41700. }), 128))
  41701. ], 2)
  41702. ], 64)) : vue.createCommentVNode("v-if", true)
  41703. ], 46, ["onMousedown", "onTouchstartPassive"]),
  41704. _ctx.showInput && !_ctx.range ? (vue.openBlock(), vue.createBlock(vue.unref(ElInputNumber), {
  41705. key: 0,
  41706. ref: "input",
  41707. "model-value": vue.unref(firstValue),
  41708. class: vue.normalizeClass(vue.unref(ns).e("input")),
  41709. step: _ctx.step,
  41710. disabled: vue.unref(sliderDisabled),
  41711. controls: _ctx.showInputControls,
  41712. min: _ctx.min,
  41713. max: _ctx.max,
  41714. precision: vue.unref(precision),
  41715. debounce: _ctx.debounce,
  41716. size: vue.unref(sliderInputSize),
  41717. "onUpdate:modelValue": vue.unref(setFirstValue),
  41718. onChange: vue.unref(emitChange)
  41719. }, null, 8, ["model-value", "class", "step", "disabled", "controls", "min", "max", "precision", "debounce", "size", "onUpdate:modelValue", "onChange"])) : vue.createCommentVNode("v-if", true)
  41720. ], 10, ["id", "role", "aria-label", "aria-labelledby"]);
  41721. };
  41722. }
  41723. });
  41724. var Slider = /* @__PURE__ */ _export_sfc(_sfc_main$I, [["__file", "slider.vue"]]);
  41725. const ElSlider = withInstall(Slider);
  41726. const spaceItemProps = buildProps({
  41727. prefixCls: {
  41728. type: String
  41729. }
  41730. });
  41731. const SpaceItem = vue.defineComponent({
  41732. name: "ElSpaceItem",
  41733. props: spaceItemProps,
  41734. setup(props, { slots }) {
  41735. const ns = useNamespace("space");
  41736. const classes = vue.computed(() => `${props.prefixCls || ns.b()}__item`);
  41737. return () => vue.h("div", { class: classes.value }, vue.renderSlot(slots, "default"));
  41738. }
  41739. });
  41740. const SIZE_MAP = {
  41741. small: 8,
  41742. default: 12,
  41743. large: 16
  41744. };
  41745. function useSpace(props) {
  41746. const ns = useNamespace("space");
  41747. const classes = vue.computed(() => [ns.b(), ns.m(props.direction), props.class]);
  41748. const horizontalSize = vue.ref(0);
  41749. const verticalSize = vue.ref(0);
  41750. const containerStyle = vue.computed(() => {
  41751. const wrapKls = props.wrap || props.fill ? { flexWrap: "wrap" } : {};
  41752. const alignment = {
  41753. alignItems: props.alignment
  41754. };
  41755. const gap = {
  41756. rowGap: `${verticalSize.value}px`,
  41757. columnGap: `${horizontalSize.value}px`
  41758. };
  41759. return [wrapKls, alignment, gap, props.style];
  41760. });
  41761. const itemStyle = vue.computed(() => {
  41762. return props.fill ? { flexGrow: 1, minWidth: `${props.fillRatio}%` } : {};
  41763. });
  41764. vue.watchEffect(() => {
  41765. const { size = "small", wrap, direction: dir, fill } = props;
  41766. if (isArray$1(size)) {
  41767. const [h = 0, v = 0] = size;
  41768. horizontalSize.value = h;
  41769. verticalSize.value = v;
  41770. } else {
  41771. let val;
  41772. if (isNumber(size)) {
  41773. val = size;
  41774. } else {
  41775. val = SIZE_MAP[size || "small"] || SIZE_MAP.small;
  41776. }
  41777. if ((wrap || fill) && dir === "horizontal") {
  41778. horizontalSize.value = verticalSize.value = val;
  41779. } else {
  41780. if (dir === "horizontal") {
  41781. horizontalSize.value = val;
  41782. verticalSize.value = 0;
  41783. } else {
  41784. verticalSize.value = val;
  41785. horizontalSize.value = 0;
  41786. }
  41787. }
  41788. }
  41789. });
  41790. return {
  41791. classes,
  41792. containerStyle,
  41793. itemStyle
  41794. };
  41795. }
  41796. const spaceProps = buildProps({
  41797. direction: {
  41798. type: String,
  41799. values: ["horizontal", "vertical"],
  41800. default: "horizontal"
  41801. },
  41802. class: {
  41803. type: definePropType([
  41804. String,
  41805. Object,
  41806. Array
  41807. ]),
  41808. default: ""
  41809. },
  41810. style: {
  41811. type: definePropType([String, Array, Object]),
  41812. default: ""
  41813. },
  41814. alignment: {
  41815. type: definePropType(String),
  41816. default: "center"
  41817. },
  41818. prefixCls: {
  41819. type: String
  41820. },
  41821. spacer: {
  41822. type: definePropType([Object, String, Number, Array]),
  41823. default: null,
  41824. validator: (val) => vue.isVNode(val) || isNumber(val) || isString$1(val)
  41825. },
  41826. wrap: Boolean,
  41827. fill: Boolean,
  41828. fillRatio: {
  41829. type: Number,
  41830. default: 100
  41831. },
  41832. size: {
  41833. type: [String, Array, Number],
  41834. values: componentSizes,
  41835. validator: (val) => {
  41836. return isNumber(val) || isArray$1(val) && val.length === 2 && val.every(isNumber);
  41837. }
  41838. }
  41839. });
  41840. const Space = vue.defineComponent({
  41841. name: "ElSpace",
  41842. props: spaceProps,
  41843. setup(props, { slots }) {
  41844. const { classes, containerStyle, itemStyle } = useSpace(props);
  41845. function extractChildren(children, parentKey = "", extractedChildren = []) {
  41846. const { prefixCls } = props;
  41847. children.forEach((child, loopKey) => {
  41848. if (isFragment(child)) {
  41849. if (isArray$1(child.children)) {
  41850. child.children.forEach((nested, key) => {
  41851. if (isFragment(nested) && isArray$1(nested.children)) {
  41852. extractChildren(nested.children, `${parentKey + key}-`, extractedChildren);
  41853. } else {
  41854. extractedChildren.push(vue.createVNode(SpaceItem, {
  41855. style: itemStyle.value,
  41856. prefixCls,
  41857. key: `nested-${parentKey + key}`
  41858. }, {
  41859. default: () => [nested]
  41860. }, PatchFlags.PROPS | PatchFlags.STYLE, ["style", "prefixCls"]));
  41861. }
  41862. });
  41863. }
  41864. } else if (isValidElementNode(child)) {
  41865. extractedChildren.push(vue.createVNode(SpaceItem, {
  41866. style: itemStyle.value,
  41867. prefixCls,
  41868. key: `LoopKey${parentKey + loopKey}`
  41869. }, {
  41870. default: () => [child]
  41871. }, PatchFlags.PROPS | PatchFlags.STYLE, ["style", "prefixCls"]));
  41872. }
  41873. });
  41874. return extractedChildren;
  41875. }
  41876. return () => {
  41877. var _a;
  41878. const { spacer, direction } = props;
  41879. const children = vue.renderSlot(slots, "default", { key: 0 }, () => []);
  41880. if (((_a = children.children) != null ? _a : []).length === 0)
  41881. return null;
  41882. if (isArray$1(children.children)) {
  41883. let extractedChildren = extractChildren(children.children);
  41884. if (spacer) {
  41885. const len = extractedChildren.length - 1;
  41886. extractedChildren = extractedChildren.reduce((acc, child, idx) => {
  41887. const children2 = [...acc, child];
  41888. if (idx !== len) {
  41889. children2.push(vue.createVNode("span", {
  41890. style: [
  41891. itemStyle.value,
  41892. direction === "vertical" ? "width: 100%" : null
  41893. ],
  41894. key: idx
  41895. }, [
  41896. vue.isVNode(spacer) ? spacer : vue.createTextVNode(spacer, PatchFlags.TEXT)
  41897. ], PatchFlags.STYLE));
  41898. }
  41899. return children2;
  41900. }, []);
  41901. }
  41902. return vue.createVNode("div", {
  41903. class: classes.value,
  41904. style: containerStyle.value
  41905. }, extractedChildren, PatchFlags.STYLE | PatchFlags.CLASS);
  41906. }
  41907. return children.children;
  41908. };
  41909. }
  41910. });
  41911. const ElSpace = withInstall(Space);
  41912. const statisticProps = buildProps({
  41913. decimalSeparator: {
  41914. type: String,
  41915. default: "."
  41916. },
  41917. groupSeparator: {
  41918. type: String,
  41919. default: ","
  41920. },
  41921. precision: {
  41922. type: Number,
  41923. default: 0
  41924. },
  41925. formatter: Function,
  41926. value: {
  41927. type: definePropType([Number, Object]),
  41928. default: 0
  41929. },
  41930. prefix: String,
  41931. suffix: String,
  41932. title: String,
  41933. valueStyle: {
  41934. type: definePropType([String, Object, Array])
  41935. }
  41936. });
  41937. const __default__$A = vue.defineComponent({
  41938. name: "ElStatistic"
  41939. });
  41940. const _sfc_main$H = /* @__PURE__ */ vue.defineComponent({
  41941. ...__default__$A,
  41942. props: statisticProps,
  41943. setup(__props, { expose }) {
  41944. const props = __props;
  41945. const ns = useNamespace("statistic");
  41946. const displayValue = vue.computed(() => {
  41947. const { value, formatter, precision, decimalSeparator, groupSeparator } = props;
  41948. if (isFunction$1(formatter))
  41949. return formatter(value);
  41950. if (!isNumber(value) || Number.isNaN(value))
  41951. return value;
  41952. let [integer, decimal = ""] = String(value).split(".");
  41953. decimal = decimal.padEnd(precision, "0").slice(0, precision > 0 ? precision : 0);
  41954. integer = integer.replace(/\B(?=(\d{3})+(?!\d))/g, groupSeparator);
  41955. return [integer, decimal].join(decimal ? decimalSeparator : "");
  41956. });
  41957. expose({
  41958. displayValue
  41959. });
  41960. return (_ctx, _cache) => {
  41961. return vue.openBlock(), vue.createElementBlock("div", {
  41962. class: vue.normalizeClass(vue.unref(ns).b())
  41963. }, [
  41964. _ctx.$slots.title || _ctx.title ? (vue.openBlock(), vue.createElementBlock("div", {
  41965. key: 0,
  41966. class: vue.normalizeClass(vue.unref(ns).e("head"))
  41967. }, [
  41968. vue.renderSlot(_ctx.$slots, "title", {}, () => [
  41969. vue.createTextVNode(vue.toDisplayString(_ctx.title), 1)
  41970. ])
  41971. ], 2)) : vue.createCommentVNode("v-if", true),
  41972. vue.createElementVNode("div", {
  41973. class: vue.normalizeClass(vue.unref(ns).e("content"))
  41974. }, [
  41975. _ctx.$slots.prefix || _ctx.prefix ? (vue.openBlock(), vue.createElementBlock("div", {
  41976. key: 0,
  41977. class: vue.normalizeClass(vue.unref(ns).e("prefix"))
  41978. }, [
  41979. vue.renderSlot(_ctx.$slots, "prefix", {}, () => [
  41980. vue.createElementVNode("span", null, vue.toDisplayString(_ctx.prefix), 1)
  41981. ])
  41982. ], 2)) : vue.createCommentVNode("v-if", true),
  41983. vue.createElementVNode("span", {
  41984. class: vue.normalizeClass(vue.unref(ns).e("number")),
  41985. style: vue.normalizeStyle(_ctx.valueStyle)
  41986. }, vue.toDisplayString(vue.unref(displayValue)), 7),
  41987. _ctx.$slots.suffix || _ctx.suffix ? (vue.openBlock(), vue.createElementBlock("div", {
  41988. key: 1,
  41989. class: vue.normalizeClass(vue.unref(ns).e("suffix"))
  41990. }, [
  41991. vue.renderSlot(_ctx.$slots, "suffix", {}, () => [
  41992. vue.createElementVNode("span", null, vue.toDisplayString(_ctx.suffix), 1)
  41993. ])
  41994. ], 2)) : vue.createCommentVNode("v-if", true)
  41995. ], 2)
  41996. ], 2);
  41997. };
  41998. }
  41999. });
  42000. var Statistic = /* @__PURE__ */ _export_sfc(_sfc_main$H, [["__file", "statistic.vue"]]);
  42001. const ElStatistic = withInstall(Statistic);
  42002. const countdownProps = buildProps({
  42003. format: {
  42004. type: String,
  42005. default: "HH:mm:ss"
  42006. },
  42007. prefix: String,
  42008. suffix: String,
  42009. title: String,
  42010. value: {
  42011. type: definePropType([Number, Object]),
  42012. default: 0
  42013. },
  42014. valueStyle: {
  42015. type: definePropType([String, Object, Array])
  42016. }
  42017. });
  42018. const countdownEmits = {
  42019. finish: () => true,
  42020. [CHANGE_EVENT]: (value) => isNumber(value)
  42021. };
  42022. const timeUnits = [
  42023. ["Y", 1e3 * 60 * 60 * 24 * 365],
  42024. ["M", 1e3 * 60 * 60 * 24 * 30],
  42025. ["D", 1e3 * 60 * 60 * 24],
  42026. ["H", 1e3 * 60 * 60],
  42027. ["m", 1e3 * 60],
  42028. ["s", 1e3],
  42029. ["S", 1]
  42030. ];
  42031. const getTime = (value) => {
  42032. return isNumber(value) ? new Date(value).getTime() : value.valueOf();
  42033. };
  42034. const formatTime$1 = (timestamp, format) => {
  42035. let timeLeft = timestamp;
  42036. const escapeRegex = /\[([^\]]*)]/g;
  42037. const replacedText = timeUnits.reduce((current, [name, unit]) => {
  42038. const replaceRegex = new RegExp(`${name}+(?![^\\[\\]]*\\])`, "g");
  42039. if (replaceRegex.test(current)) {
  42040. const value = Math.floor(timeLeft / unit);
  42041. timeLeft -= value * unit;
  42042. return current.replace(replaceRegex, (match) => String(value).padStart(match.length, "0"));
  42043. }
  42044. return current;
  42045. }, format);
  42046. return replacedText.replace(escapeRegex, "$1");
  42047. };
  42048. const __default__$z = vue.defineComponent({
  42049. name: "ElCountdown"
  42050. });
  42051. const _sfc_main$G = /* @__PURE__ */ vue.defineComponent({
  42052. ...__default__$z,
  42053. props: countdownProps,
  42054. emits: countdownEmits,
  42055. setup(__props, { expose, emit }) {
  42056. const props = __props;
  42057. let timer;
  42058. const rawValue = vue.ref(0);
  42059. const displayValue = vue.computed(() => formatTime$1(rawValue.value, props.format));
  42060. const formatter = (val) => formatTime$1(val, props.format);
  42061. const stopTimer = () => {
  42062. if (timer) {
  42063. cAF(timer);
  42064. timer = void 0;
  42065. }
  42066. };
  42067. const startTimer = () => {
  42068. const timestamp = getTime(props.value);
  42069. const frameFunc = () => {
  42070. let diff = timestamp - Date.now();
  42071. emit("change", diff);
  42072. if (diff <= 0) {
  42073. diff = 0;
  42074. stopTimer();
  42075. emit("finish");
  42076. } else {
  42077. timer = rAF(frameFunc);
  42078. }
  42079. rawValue.value = diff;
  42080. };
  42081. timer = rAF(frameFunc);
  42082. };
  42083. vue.onMounted(() => {
  42084. rawValue.value = getTime(props.value) - Date.now();
  42085. vue.watch(() => [props.value, props.format], () => {
  42086. stopTimer();
  42087. startTimer();
  42088. }, {
  42089. immediate: true
  42090. });
  42091. });
  42092. vue.onBeforeUnmount(() => {
  42093. stopTimer();
  42094. });
  42095. expose({
  42096. displayValue
  42097. });
  42098. return (_ctx, _cache) => {
  42099. return vue.openBlock(), vue.createBlock(vue.unref(ElStatistic), {
  42100. value: rawValue.value,
  42101. title: _ctx.title,
  42102. prefix: _ctx.prefix,
  42103. suffix: _ctx.suffix,
  42104. "value-style": _ctx.valueStyle,
  42105. formatter
  42106. }, vue.createSlots({
  42107. _: 2
  42108. }, [
  42109. vue.renderList(_ctx.$slots, (_, name) => {
  42110. return {
  42111. name,
  42112. fn: vue.withCtx(() => [
  42113. vue.renderSlot(_ctx.$slots, name)
  42114. ])
  42115. };
  42116. })
  42117. ]), 1032, ["value", "title", "prefix", "suffix", "value-style"]);
  42118. };
  42119. }
  42120. });
  42121. var Countdown = /* @__PURE__ */ _export_sfc(_sfc_main$G, [["__file", "countdown.vue"]]);
  42122. const ElCountdown = withInstall(Countdown);
  42123. const stepsProps = buildProps({
  42124. space: {
  42125. type: [Number, String],
  42126. default: ""
  42127. },
  42128. active: {
  42129. type: Number,
  42130. default: 0
  42131. },
  42132. direction: {
  42133. type: String,
  42134. default: "horizontal",
  42135. values: ["horizontal", "vertical"]
  42136. },
  42137. alignCenter: {
  42138. type: Boolean
  42139. },
  42140. simple: {
  42141. type: Boolean
  42142. },
  42143. finishStatus: {
  42144. type: String,
  42145. values: ["wait", "process", "finish", "error", "success"],
  42146. default: "finish"
  42147. },
  42148. processStatus: {
  42149. type: String,
  42150. values: ["wait", "process", "finish", "error", "success"],
  42151. default: "process"
  42152. }
  42153. });
  42154. const stepsEmits = {
  42155. [CHANGE_EVENT]: (newVal, oldVal) => [newVal, oldVal].every(isNumber)
  42156. };
  42157. const __default__$y = vue.defineComponent({
  42158. name: "ElSteps"
  42159. });
  42160. const _sfc_main$F = /* @__PURE__ */ vue.defineComponent({
  42161. ...__default__$y,
  42162. props: stepsProps,
  42163. emits: stepsEmits,
  42164. setup(__props, { emit }) {
  42165. const props = __props;
  42166. const ns = useNamespace("steps");
  42167. const {
  42168. children: steps,
  42169. addChild: addStep,
  42170. removeChild: removeStep
  42171. } = useOrderedChildren(vue.getCurrentInstance(), "ElStep");
  42172. vue.watch(steps, () => {
  42173. steps.value.forEach((instance, index) => {
  42174. instance.setIndex(index);
  42175. });
  42176. });
  42177. vue.provide("ElSteps", { props, steps, addStep, removeStep });
  42178. vue.watch(() => props.active, (newVal, oldVal) => {
  42179. emit(CHANGE_EVENT, newVal, oldVal);
  42180. });
  42181. return (_ctx, _cache) => {
  42182. return vue.openBlock(), vue.createElementBlock("div", {
  42183. class: vue.normalizeClass([vue.unref(ns).b(), vue.unref(ns).m(_ctx.simple ? "simple" : _ctx.direction)])
  42184. }, [
  42185. vue.renderSlot(_ctx.$slots, "default")
  42186. ], 2);
  42187. };
  42188. }
  42189. });
  42190. var Steps = /* @__PURE__ */ _export_sfc(_sfc_main$F, [["__file", "steps.vue"]]);
  42191. const stepProps = buildProps({
  42192. title: {
  42193. type: String,
  42194. default: ""
  42195. },
  42196. icon: {
  42197. type: iconPropType
  42198. },
  42199. description: {
  42200. type: String,
  42201. default: ""
  42202. },
  42203. status: {
  42204. type: String,
  42205. values: ["", "wait", "process", "finish", "error", "success"],
  42206. default: ""
  42207. }
  42208. });
  42209. const __default__$x = vue.defineComponent({
  42210. name: "ElStep"
  42211. });
  42212. const _sfc_main$E = vue.defineComponent({
  42213. ...__default__$x,
  42214. props: stepProps,
  42215. setup(__props) {
  42216. const props = __props;
  42217. const ns = useNamespace("step");
  42218. const index = vue.ref(-1);
  42219. const lineStyle = vue.ref({});
  42220. const internalStatus = vue.ref("");
  42221. const parent = vue.inject("ElSteps");
  42222. const currentInstance = vue.getCurrentInstance();
  42223. vue.onMounted(() => {
  42224. vue.watch([
  42225. () => parent.props.active,
  42226. () => parent.props.processStatus,
  42227. () => parent.props.finishStatus
  42228. ], ([active]) => {
  42229. updateStatus(active);
  42230. }, { immediate: true });
  42231. });
  42232. vue.onBeforeUnmount(() => {
  42233. parent.removeStep(stepItemState.uid);
  42234. });
  42235. const currentStatus = vue.computed(() => {
  42236. return props.status || internalStatus.value;
  42237. });
  42238. const prevStatus = vue.computed(() => {
  42239. const prevStep = parent.steps.value[index.value - 1];
  42240. return prevStep ? prevStep.currentStatus : "wait";
  42241. });
  42242. const isCenter = vue.computed(() => {
  42243. return parent.props.alignCenter;
  42244. });
  42245. const isVertical = vue.computed(() => {
  42246. return parent.props.direction === "vertical";
  42247. });
  42248. const isSimple = vue.computed(() => {
  42249. return parent.props.simple;
  42250. });
  42251. const stepsCount = vue.computed(() => {
  42252. return parent.steps.value.length;
  42253. });
  42254. const isLast = vue.computed(() => {
  42255. var _a;
  42256. return ((_a = parent.steps.value[stepsCount.value - 1]) == null ? void 0 : _a.uid) === (currentInstance == null ? void 0 : currentInstance.uid);
  42257. });
  42258. const space = vue.computed(() => {
  42259. return isSimple.value ? "" : parent.props.space;
  42260. });
  42261. const containerKls = vue.computed(() => {
  42262. return [
  42263. ns.b(),
  42264. ns.is(isSimple.value ? "simple" : parent.props.direction),
  42265. ns.is("flex", isLast.value && !space.value && !isCenter.value),
  42266. ns.is("center", isCenter.value && !isVertical.value && !isSimple.value)
  42267. ];
  42268. });
  42269. const style = vue.computed(() => {
  42270. const style2 = {
  42271. flexBasis: isNumber(space.value) ? `${space.value}px` : space.value ? space.value : `${100 / (stepsCount.value - (isCenter.value ? 0 : 1))}%`
  42272. };
  42273. if (isVertical.value)
  42274. return style2;
  42275. if (isLast.value) {
  42276. style2.maxWidth = `${100 / stepsCount.value}%`;
  42277. }
  42278. return style2;
  42279. });
  42280. const setIndex = (val) => {
  42281. index.value = val;
  42282. };
  42283. const calcProgress = (status) => {
  42284. const isWait = status === "wait";
  42285. const style2 = {
  42286. transitionDelay: `${isWait ? "-" : ""}${150 * index.value}ms`
  42287. };
  42288. const step = status === parent.props.processStatus || isWait ? 0 : 100;
  42289. style2.borderWidth = step && !isSimple.value ? "1px" : 0;
  42290. style2[parent.props.direction === "vertical" ? "height" : "width"] = `${step}%`;
  42291. lineStyle.value = style2;
  42292. };
  42293. const updateStatus = (activeIndex) => {
  42294. if (activeIndex > index.value) {
  42295. internalStatus.value = parent.props.finishStatus;
  42296. } else if (activeIndex === index.value && prevStatus.value !== "error") {
  42297. internalStatus.value = parent.props.processStatus;
  42298. } else {
  42299. internalStatus.value = "wait";
  42300. }
  42301. const prevChild = parent.steps.value[index.value - 1];
  42302. if (prevChild)
  42303. prevChild.calcProgress(internalStatus.value);
  42304. };
  42305. const stepItemState = vue.reactive({
  42306. uid: currentInstance.uid,
  42307. currentStatus,
  42308. setIndex,
  42309. calcProgress
  42310. });
  42311. parent.addStep(stepItemState);
  42312. return (_ctx, _cache) => {
  42313. return vue.openBlock(), vue.createElementBlock("div", {
  42314. style: vue.normalizeStyle(vue.unref(style)),
  42315. class: vue.normalizeClass(vue.unref(containerKls))
  42316. }, [
  42317. vue.createCommentVNode(" icon & line "),
  42318. vue.createElementVNode("div", {
  42319. class: vue.normalizeClass([vue.unref(ns).e("head"), vue.unref(ns).is(vue.unref(currentStatus))])
  42320. }, [
  42321. !vue.unref(isSimple) ? (vue.openBlock(), vue.createElementBlock("div", {
  42322. key: 0,
  42323. class: vue.normalizeClass(vue.unref(ns).e("line"))
  42324. }, [
  42325. vue.createElementVNode("i", {
  42326. class: vue.normalizeClass(vue.unref(ns).e("line-inner")),
  42327. style: vue.normalizeStyle(lineStyle.value)
  42328. }, null, 6)
  42329. ], 2)) : vue.createCommentVNode("v-if", true),
  42330. vue.createElementVNode("div", {
  42331. class: vue.normalizeClass([vue.unref(ns).e("icon"), vue.unref(ns).is(_ctx.icon || _ctx.$slots.icon ? "icon" : "text")])
  42332. }, [
  42333. vue.renderSlot(_ctx.$slots, "icon", {}, () => [
  42334. _ctx.icon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  42335. key: 0,
  42336. class: vue.normalizeClass(vue.unref(ns).e("icon-inner"))
  42337. }, {
  42338. default: vue.withCtx(() => [
  42339. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.icon)))
  42340. ]),
  42341. _: 1
  42342. }, 8, ["class"])) : vue.unref(currentStatus) === "success" ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  42343. key: 1,
  42344. class: vue.normalizeClass([vue.unref(ns).e("icon-inner"), vue.unref(ns).is("status")])
  42345. }, {
  42346. default: vue.withCtx(() => [
  42347. vue.createVNode(vue.unref(check_default))
  42348. ]),
  42349. _: 1
  42350. }, 8, ["class"])) : vue.unref(currentStatus) === "error" ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  42351. key: 2,
  42352. class: vue.normalizeClass([vue.unref(ns).e("icon-inner"), vue.unref(ns).is("status")])
  42353. }, {
  42354. default: vue.withCtx(() => [
  42355. vue.createVNode(vue.unref(close_default))
  42356. ]),
  42357. _: 1
  42358. }, 8, ["class"])) : !vue.unref(isSimple) ? (vue.openBlock(), vue.createElementBlock("div", {
  42359. key: 3,
  42360. class: vue.normalizeClass(vue.unref(ns).e("icon-inner"))
  42361. }, vue.toDisplayString(index.value + 1), 3)) : vue.createCommentVNode("v-if", true)
  42362. ])
  42363. ], 2)
  42364. ], 2),
  42365. vue.createCommentVNode(" title & description "),
  42366. vue.createElementVNode("div", {
  42367. class: vue.normalizeClass(vue.unref(ns).e("main"))
  42368. }, [
  42369. vue.createElementVNode("div", {
  42370. class: vue.normalizeClass([vue.unref(ns).e("title"), vue.unref(ns).is(vue.unref(currentStatus))])
  42371. }, [
  42372. vue.renderSlot(_ctx.$slots, "title", {}, () => [
  42373. vue.createTextVNode(vue.toDisplayString(_ctx.title), 1)
  42374. ])
  42375. ], 2),
  42376. vue.unref(isSimple) ? (vue.openBlock(), vue.createElementBlock("div", {
  42377. key: 0,
  42378. class: vue.normalizeClass(vue.unref(ns).e("arrow"))
  42379. }, null, 2)) : (vue.openBlock(), vue.createElementBlock("div", {
  42380. key: 1,
  42381. class: vue.normalizeClass([vue.unref(ns).e("description"), vue.unref(ns).is(vue.unref(currentStatus))])
  42382. }, [
  42383. vue.renderSlot(_ctx.$slots, "description", {}, () => [
  42384. vue.createTextVNode(vue.toDisplayString(_ctx.description), 1)
  42385. ])
  42386. ], 2))
  42387. ], 2)
  42388. ], 6);
  42389. };
  42390. }
  42391. });
  42392. var Step = /* @__PURE__ */ _export_sfc(_sfc_main$E, [["__file", "item.vue"]]);
  42393. const ElSteps = withInstall(Steps, {
  42394. Step
  42395. });
  42396. const ElStep = withNoopInstall(Step);
  42397. const switchProps = buildProps({
  42398. modelValue: {
  42399. type: [Boolean, String, Number],
  42400. default: false
  42401. },
  42402. disabled: Boolean,
  42403. loading: Boolean,
  42404. size: {
  42405. type: String,
  42406. validator: isValidComponentSize
  42407. },
  42408. width: {
  42409. type: [String, Number],
  42410. default: ""
  42411. },
  42412. inlinePrompt: Boolean,
  42413. inactiveActionIcon: {
  42414. type: iconPropType
  42415. },
  42416. activeActionIcon: {
  42417. type: iconPropType
  42418. },
  42419. activeIcon: {
  42420. type: iconPropType
  42421. },
  42422. inactiveIcon: {
  42423. type: iconPropType
  42424. },
  42425. activeText: {
  42426. type: String,
  42427. default: ""
  42428. },
  42429. inactiveText: {
  42430. type: String,
  42431. default: ""
  42432. },
  42433. activeValue: {
  42434. type: [Boolean, String, Number],
  42435. default: true
  42436. },
  42437. inactiveValue: {
  42438. type: [Boolean, String, Number],
  42439. default: false
  42440. },
  42441. name: {
  42442. type: String,
  42443. default: ""
  42444. },
  42445. validateEvent: {
  42446. type: Boolean,
  42447. default: true
  42448. },
  42449. beforeChange: {
  42450. type: definePropType(Function)
  42451. },
  42452. id: String,
  42453. tabindex: {
  42454. type: [String, Number]
  42455. },
  42456. ...useAriaProps(["ariaLabel"])
  42457. });
  42458. const switchEmits = {
  42459. [UPDATE_MODEL_EVENT]: (val) => isBoolean(val) || isString$1(val) || isNumber(val),
  42460. [CHANGE_EVENT]: (val) => isBoolean(val) || isString$1(val) || isNumber(val),
  42461. [INPUT_EVENT]: (val) => isBoolean(val) || isString$1(val) || isNumber(val)
  42462. };
  42463. const COMPONENT_NAME$8 = "ElSwitch";
  42464. const __default__$w = vue.defineComponent({
  42465. name: COMPONENT_NAME$8
  42466. });
  42467. const _sfc_main$D = /* @__PURE__ */ vue.defineComponent({
  42468. ...__default__$w,
  42469. props: switchProps,
  42470. emits: switchEmits,
  42471. setup(__props, { expose, emit }) {
  42472. const props = __props;
  42473. const { formItem } = useFormItem();
  42474. const switchSize = useFormSize();
  42475. const ns = useNamespace("switch");
  42476. const { inputId } = useFormItemInputId(props, {
  42477. formItemContext: formItem
  42478. });
  42479. const switchDisabled = useFormDisabled(vue.computed(() => props.loading));
  42480. const isControlled = vue.ref(props.modelValue !== false);
  42481. const input = vue.ref();
  42482. const core = vue.ref();
  42483. const switchKls = vue.computed(() => [
  42484. ns.b(),
  42485. ns.m(switchSize.value),
  42486. ns.is("disabled", switchDisabled.value),
  42487. ns.is("checked", checked.value)
  42488. ]);
  42489. const labelLeftKls = vue.computed(() => [
  42490. ns.e("label"),
  42491. ns.em("label", "left"),
  42492. ns.is("active", !checked.value)
  42493. ]);
  42494. const labelRightKls = vue.computed(() => [
  42495. ns.e("label"),
  42496. ns.em("label", "right"),
  42497. ns.is("active", checked.value)
  42498. ]);
  42499. const coreStyle = vue.computed(() => ({
  42500. width: addUnit(props.width)
  42501. }));
  42502. vue.watch(() => props.modelValue, () => {
  42503. isControlled.value = true;
  42504. });
  42505. const actualValue = vue.computed(() => {
  42506. return isControlled.value ? props.modelValue : false;
  42507. });
  42508. const checked = vue.computed(() => actualValue.value === props.activeValue);
  42509. if (![props.activeValue, props.inactiveValue].includes(actualValue.value)) {
  42510. emit(UPDATE_MODEL_EVENT, props.inactiveValue);
  42511. emit(CHANGE_EVENT, props.inactiveValue);
  42512. emit(INPUT_EVENT, props.inactiveValue);
  42513. }
  42514. vue.watch(checked, (val) => {
  42515. var _a;
  42516. input.value.checked = val;
  42517. if (props.validateEvent) {
  42518. (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "change").catch((err) => debugWarn());
  42519. }
  42520. });
  42521. const handleChange = () => {
  42522. const val = checked.value ? props.inactiveValue : props.activeValue;
  42523. emit(UPDATE_MODEL_EVENT, val);
  42524. emit(CHANGE_EVENT, val);
  42525. emit(INPUT_EVENT, val);
  42526. vue.nextTick(() => {
  42527. input.value.checked = checked.value;
  42528. });
  42529. };
  42530. const switchValue = () => {
  42531. if (switchDisabled.value)
  42532. return;
  42533. const { beforeChange } = props;
  42534. if (!beforeChange) {
  42535. handleChange();
  42536. return;
  42537. }
  42538. const shouldChange = beforeChange();
  42539. const isPromiseOrBool = [
  42540. isPromise(shouldChange),
  42541. isBoolean(shouldChange)
  42542. ].includes(true);
  42543. if (!isPromiseOrBool) {
  42544. throwError(COMPONENT_NAME$8, "beforeChange must return type `Promise<boolean>` or `boolean`");
  42545. }
  42546. if (isPromise(shouldChange)) {
  42547. shouldChange.then((result) => {
  42548. if (result) {
  42549. handleChange();
  42550. }
  42551. }).catch((e) => {
  42552. });
  42553. } else if (shouldChange) {
  42554. handleChange();
  42555. }
  42556. };
  42557. const focus = () => {
  42558. var _a, _b;
  42559. (_b = (_a = input.value) == null ? void 0 : _a.focus) == null ? void 0 : _b.call(_a);
  42560. };
  42561. vue.onMounted(() => {
  42562. input.value.checked = checked.value;
  42563. });
  42564. expose({
  42565. focus,
  42566. checked
  42567. });
  42568. return (_ctx, _cache) => {
  42569. return vue.openBlock(), vue.createElementBlock("div", {
  42570. class: vue.normalizeClass(vue.unref(switchKls)),
  42571. onClick: vue.withModifiers(switchValue, ["prevent"])
  42572. }, [
  42573. vue.createElementVNode("input", {
  42574. id: vue.unref(inputId),
  42575. ref_key: "input",
  42576. ref: input,
  42577. class: vue.normalizeClass(vue.unref(ns).e("input")),
  42578. type: "checkbox",
  42579. role: "switch",
  42580. "aria-checked": vue.unref(checked),
  42581. "aria-disabled": vue.unref(switchDisabled),
  42582. "aria-label": _ctx.ariaLabel,
  42583. name: _ctx.name,
  42584. "true-value": _ctx.activeValue,
  42585. "false-value": _ctx.inactiveValue,
  42586. disabled: vue.unref(switchDisabled),
  42587. tabindex: _ctx.tabindex,
  42588. onChange: handleChange,
  42589. onKeydown: vue.withKeys(switchValue, ["enter"])
  42590. }, null, 42, ["id", "aria-checked", "aria-disabled", "aria-label", "name", "true-value", "false-value", "disabled", "tabindex", "onKeydown"]),
  42591. !_ctx.inlinePrompt && (_ctx.inactiveIcon || _ctx.inactiveText) ? (vue.openBlock(), vue.createElementBlock("span", {
  42592. key: 0,
  42593. class: vue.normalizeClass(vue.unref(labelLeftKls))
  42594. }, [
  42595. _ctx.inactiveIcon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 0 }, {
  42596. default: vue.withCtx(() => [
  42597. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.inactiveIcon)))
  42598. ]),
  42599. _: 1
  42600. })) : vue.createCommentVNode("v-if", true),
  42601. !_ctx.inactiveIcon && _ctx.inactiveText ? (vue.openBlock(), vue.createElementBlock("span", {
  42602. key: 1,
  42603. "aria-hidden": vue.unref(checked)
  42604. }, vue.toDisplayString(_ctx.inactiveText), 9, ["aria-hidden"])) : vue.createCommentVNode("v-if", true)
  42605. ], 2)) : vue.createCommentVNode("v-if", true),
  42606. vue.createElementVNode("span", {
  42607. ref_key: "core",
  42608. ref: core,
  42609. class: vue.normalizeClass(vue.unref(ns).e("core")),
  42610. style: vue.normalizeStyle(vue.unref(coreStyle))
  42611. }, [
  42612. _ctx.inlinePrompt ? (vue.openBlock(), vue.createElementBlock("div", {
  42613. key: 0,
  42614. class: vue.normalizeClass(vue.unref(ns).e("inner"))
  42615. }, [
  42616. _ctx.activeIcon || _ctx.inactiveIcon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  42617. key: 0,
  42618. class: vue.normalizeClass(vue.unref(ns).is("icon"))
  42619. }, {
  42620. default: vue.withCtx(() => [
  42621. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(checked) ? _ctx.activeIcon : _ctx.inactiveIcon)))
  42622. ]),
  42623. _: 1
  42624. }, 8, ["class"])) : _ctx.activeText || _ctx.inactiveText ? (vue.openBlock(), vue.createElementBlock("span", {
  42625. key: 1,
  42626. class: vue.normalizeClass(vue.unref(ns).is("text")),
  42627. "aria-hidden": !vue.unref(checked)
  42628. }, vue.toDisplayString(vue.unref(checked) ? _ctx.activeText : _ctx.inactiveText), 11, ["aria-hidden"])) : vue.createCommentVNode("v-if", true)
  42629. ], 2)) : vue.createCommentVNode("v-if", true),
  42630. vue.createElementVNode("div", {
  42631. class: vue.normalizeClass(vue.unref(ns).e("action"))
  42632. }, [
  42633. _ctx.loading ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  42634. key: 0,
  42635. class: vue.normalizeClass(vue.unref(ns).is("loading"))
  42636. }, {
  42637. default: vue.withCtx(() => [
  42638. vue.createVNode(vue.unref(loading_default))
  42639. ]),
  42640. _: 1
  42641. }, 8, ["class"])) : vue.unref(checked) ? vue.renderSlot(_ctx.$slots, "active-action", { key: 1 }, () => [
  42642. _ctx.activeActionIcon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 0 }, {
  42643. default: vue.withCtx(() => [
  42644. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.activeActionIcon)))
  42645. ]),
  42646. _: 1
  42647. })) : vue.createCommentVNode("v-if", true)
  42648. ]) : !vue.unref(checked) ? vue.renderSlot(_ctx.$slots, "inactive-action", { key: 2 }, () => [
  42649. _ctx.inactiveActionIcon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 0 }, {
  42650. default: vue.withCtx(() => [
  42651. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.inactiveActionIcon)))
  42652. ]),
  42653. _: 1
  42654. })) : vue.createCommentVNode("v-if", true)
  42655. ]) : vue.createCommentVNode("v-if", true)
  42656. ], 2)
  42657. ], 6),
  42658. !_ctx.inlinePrompt && (_ctx.activeIcon || _ctx.activeText) ? (vue.openBlock(), vue.createElementBlock("span", {
  42659. key: 1,
  42660. class: vue.normalizeClass(vue.unref(labelRightKls))
  42661. }, [
  42662. _ctx.activeIcon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 0 }, {
  42663. default: vue.withCtx(() => [
  42664. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.activeIcon)))
  42665. ]),
  42666. _: 1
  42667. })) : vue.createCommentVNode("v-if", true),
  42668. !_ctx.activeIcon && _ctx.activeText ? (vue.openBlock(), vue.createElementBlock("span", {
  42669. key: 1,
  42670. "aria-hidden": !vue.unref(checked)
  42671. }, vue.toDisplayString(_ctx.activeText), 9, ["aria-hidden"])) : vue.createCommentVNode("v-if", true)
  42672. ], 2)) : vue.createCommentVNode("v-if", true)
  42673. ], 10, ["onClick"]);
  42674. };
  42675. }
  42676. });
  42677. var Switch = /* @__PURE__ */ _export_sfc(_sfc_main$D, [["__file", "switch.vue"]]);
  42678. const ElSwitch = withInstall(Switch);
  42679. const getCell = function(event) {
  42680. var _a;
  42681. return (_a = event.target) == null ? void 0 : _a.closest("td");
  42682. };
  42683. const orderBy = function(array, sortKey, reverse, sortMethod, sortBy) {
  42684. if (!sortKey && !sortMethod && (!sortBy || isArray$1(sortBy) && !sortBy.length)) {
  42685. return array;
  42686. }
  42687. if (isString$1(reverse)) {
  42688. reverse = reverse === "descending" ? -1 : 1;
  42689. } else {
  42690. reverse = reverse && reverse < 0 ? -1 : 1;
  42691. }
  42692. const getKey = sortMethod ? null : function(value, index) {
  42693. if (sortBy) {
  42694. if (!isArray$1(sortBy)) {
  42695. sortBy = [sortBy];
  42696. }
  42697. return sortBy.map((by) => {
  42698. if (isString$1(by)) {
  42699. return get(value, by);
  42700. } else {
  42701. return by(value, index, array);
  42702. }
  42703. });
  42704. }
  42705. if (sortKey !== "$key") {
  42706. if (isObject$1(value) && "$value" in value)
  42707. value = value.$value;
  42708. }
  42709. return [isObject$1(value) ? get(value, sortKey) : value];
  42710. };
  42711. const compare = function(a, b) {
  42712. if (sortMethod) {
  42713. return sortMethod(a.value, b.value);
  42714. }
  42715. for (let i = 0, len = a.key.length; i < len; i++) {
  42716. if (a.key[i] < b.key[i]) {
  42717. return -1;
  42718. }
  42719. if (a.key[i] > b.key[i]) {
  42720. return 1;
  42721. }
  42722. }
  42723. return 0;
  42724. };
  42725. return array.map((value, index) => {
  42726. return {
  42727. value,
  42728. index,
  42729. key: getKey ? getKey(value, index) : null
  42730. };
  42731. }).sort((a, b) => {
  42732. let order = compare(a, b);
  42733. if (!order) {
  42734. order = a.index - b.index;
  42735. }
  42736. return order * +reverse;
  42737. }).map((item) => item.value);
  42738. };
  42739. const getColumnById = function(table, columnId) {
  42740. let column = null;
  42741. table.columns.forEach((item) => {
  42742. if (item.id === columnId) {
  42743. column = item;
  42744. }
  42745. });
  42746. return column;
  42747. };
  42748. const getColumnByKey = function(table, columnKey) {
  42749. let column = null;
  42750. for (let i = 0; i < table.columns.length; i++) {
  42751. const item = table.columns[i];
  42752. if (item.columnKey === columnKey) {
  42753. column = item;
  42754. break;
  42755. }
  42756. }
  42757. if (!column)
  42758. throwError("ElTable", `No column matching with column-key: ${columnKey}`);
  42759. return column;
  42760. };
  42761. const getColumnByCell = function(table, cell, namespace) {
  42762. const matches = (cell.className || "").match(new RegExp(`${namespace}-table_[^\\s]+`, "gm"));
  42763. if (matches) {
  42764. return getColumnById(table, matches[0]);
  42765. }
  42766. return null;
  42767. };
  42768. const getRowIdentity = (row, rowKey) => {
  42769. if (!row)
  42770. throw new Error("Row is required when get row identity");
  42771. if (isString$1(rowKey)) {
  42772. if (!rowKey.includes(".")) {
  42773. return `${row[rowKey]}`;
  42774. }
  42775. const key = rowKey.split(".");
  42776. let current = row;
  42777. for (const element of key) {
  42778. current = current[element];
  42779. }
  42780. return `${current}`;
  42781. } else if (isFunction$1(rowKey)) {
  42782. return rowKey.call(null, row);
  42783. }
  42784. };
  42785. const getKeysMap = function(array, rowKey) {
  42786. const arrayMap = {};
  42787. (array || []).forEach((row, index) => {
  42788. arrayMap[getRowIdentity(row, rowKey)] = { row, index };
  42789. });
  42790. return arrayMap;
  42791. };
  42792. function mergeOptions(defaults, config) {
  42793. const options = {};
  42794. let key;
  42795. for (key in defaults) {
  42796. options[key] = defaults[key];
  42797. }
  42798. for (key in config) {
  42799. if (hasOwn(config, key)) {
  42800. const value = config[key];
  42801. if (typeof value !== "undefined") {
  42802. options[key] = value;
  42803. }
  42804. }
  42805. }
  42806. return options;
  42807. }
  42808. function parseWidth(width) {
  42809. if (width === "")
  42810. return width;
  42811. if (width !== void 0) {
  42812. width = Number.parseInt(width, 10);
  42813. if (Number.isNaN(width)) {
  42814. width = "";
  42815. }
  42816. }
  42817. return width;
  42818. }
  42819. function parseMinWidth(minWidth) {
  42820. if (minWidth === "")
  42821. return minWidth;
  42822. if (minWidth !== void 0) {
  42823. minWidth = parseWidth(minWidth);
  42824. if (Number.isNaN(minWidth)) {
  42825. minWidth = 80;
  42826. }
  42827. }
  42828. return minWidth;
  42829. }
  42830. function parseHeight(height) {
  42831. if (isNumber(height)) {
  42832. return height;
  42833. }
  42834. if (isString$1(height)) {
  42835. if (/^\d+(?:px)?$/.test(height)) {
  42836. return Number.parseInt(height, 10);
  42837. } else {
  42838. return height;
  42839. }
  42840. }
  42841. return null;
  42842. }
  42843. function compose(...funcs) {
  42844. if (funcs.length === 0) {
  42845. return (arg) => arg;
  42846. }
  42847. if (funcs.length === 1) {
  42848. return funcs[0];
  42849. }
  42850. return funcs.reduce((a, b) => (...args) => a(b(...args)));
  42851. }
  42852. function toggleRowStatus(statusArr, row, newVal, tableTreeProps, selectable, rowIndex) {
  42853. let _rowIndex = rowIndex != null ? rowIndex : 0;
  42854. let changed = false;
  42855. const index = statusArr.indexOf(row);
  42856. const included = index !== -1;
  42857. const isRowSelectable = selectable == null ? void 0 : selectable.call(null, row, rowIndex);
  42858. const toggleStatus = (type) => {
  42859. if (type === "add") {
  42860. statusArr.push(row);
  42861. } else {
  42862. statusArr.splice(index, 1);
  42863. }
  42864. changed = true;
  42865. };
  42866. const getChildrenCount = (row2) => {
  42867. let count = 0;
  42868. const children = (tableTreeProps == null ? void 0 : tableTreeProps.children) && row2[tableTreeProps.children];
  42869. if (children && isArray$1(children)) {
  42870. count += children.length;
  42871. children.forEach((item) => {
  42872. count += getChildrenCount(item);
  42873. });
  42874. }
  42875. return count;
  42876. };
  42877. if (!selectable || isRowSelectable) {
  42878. if (isBoolean(newVal)) {
  42879. if (newVal && !included) {
  42880. toggleStatus("add");
  42881. } else if (!newVal && included) {
  42882. toggleStatus("remove");
  42883. }
  42884. } else {
  42885. included ? toggleStatus("remove") : toggleStatus("add");
  42886. }
  42887. }
  42888. if (!(tableTreeProps == null ? void 0 : tableTreeProps.checkStrictly) && (tableTreeProps == null ? void 0 : tableTreeProps.children) && isArray$1(row[tableTreeProps.children])) {
  42889. row[tableTreeProps.children].forEach((item) => {
  42890. toggleRowStatus(statusArr, item, newVal != null ? newVal : !included, tableTreeProps, selectable, _rowIndex + 1);
  42891. _rowIndex += getChildrenCount(item) + 1;
  42892. });
  42893. }
  42894. return changed;
  42895. }
  42896. function walkTreeNode(root, cb, childrenKey = "children", lazyKey = "hasChildren") {
  42897. const isNil = (array) => !(isArray$1(array) && array.length);
  42898. function _walker(parent, children, level) {
  42899. cb(parent, children, level);
  42900. children.forEach((item) => {
  42901. if (item[lazyKey]) {
  42902. cb(item, null, level + 1);
  42903. return;
  42904. }
  42905. const children2 = item[childrenKey];
  42906. if (!isNil(children2)) {
  42907. _walker(item, children2, level + 1);
  42908. }
  42909. });
  42910. }
  42911. root.forEach((item) => {
  42912. if (item[lazyKey]) {
  42913. cb(item, null, 0);
  42914. return;
  42915. }
  42916. const children = item[childrenKey];
  42917. if (!isNil(children)) {
  42918. _walker(item, children, 0);
  42919. }
  42920. });
  42921. }
  42922. const getTableOverflowTooltipProps = (props, content) => {
  42923. return {
  42924. content,
  42925. ...props,
  42926. popperOptions: {
  42927. strategy: "fixed",
  42928. ...props.popperOptions
  42929. }
  42930. };
  42931. };
  42932. let removePopper = null;
  42933. function createTablePopper(props, popperContent, trigger, table) {
  42934. if ((removePopper == null ? void 0 : removePopper.trigger) === trigger) {
  42935. merge(removePopper.vm.component.props, getTableOverflowTooltipProps(props, popperContent));
  42936. return;
  42937. }
  42938. removePopper == null ? void 0 : removePopper();
  42939. const parentNode = table == null ? void 0 : table.refs.tableWrapper;
  42940. const ns = parentNode == null ? void 0 : parentNode.dataset.prefix;
  42941. const vm = vue.createVNode(ElTooltip, {
  42942. virtualTriggering: true,
  42943. virtualRef: trigger,
  42944. appendTo: parentNode,
  42945. placement: "top",
  42946. transition: "none",
  42947. offset: 0,
  42948. hideAfter: 0,
  42949. ...getTableOverflowTooltipProps(props, popperContent)
  42950. });
  42951. vm.appContext = { ...table.appContext, ...table };
  42952. const container = document.createElement("div");
  42953. vue.render(vm, container);
  42954. vm.component.exposed.onOpen();
  42955. const scrollContainer = parentNode == null ? void 0 : parentNode.querySelector(`.${ns}-scrollbar__wrap`);
  42956. removePopper = () => {
  42957. vue.render(null, container);
  42958. scrollContainer == null ? void 0 : scrollContainer.removeEventListener("scroll", removePopper);
  42959. removePopper = null;
  42960. };
  42961. removePopper.trigger = trigger;
  42962. removePopper.vm = vm;
  42963. scrollContainer == null ? void 0 : scrollContainer.addEventListener("scroll", removePopper);
  42964. }
  42965. function getCurrentColumns(column) {
  42966. if (column.children) {
  42967. return flatMap(column.children, getCurrentColumns);
  42968. } else {
  42969. return [column];
  42970. }
  42971. }
  42972. function getColSpan(colSpan, column) {
  42973. return colSpan + column.colSpan;
  42974. }
  42975. const isFixedColumn = (index, fixed, store, realColumns) => {
  42976. let start = 0;
  42977. let after = index;
  42978. const columns = store.states.columns.value;
  42979. if (realColumns) {
  42980. const curColumns = getCurrentColumns(realColumns[index]);
  42981. const preColumns = columns.slice(0, columns.indexOf(curColumns[0]));
  42982. start = preColumns.reduce(getColSpan, 0);
  42983. after = start + curColumns.reduce(getColSpan, 0) - 1;
  42984. } else {
  42985. start = index;
  42986. }
  42987. let fixedLayout;
  42988. switch (fixed) {
  42989. case "left":
  42990. if (after < store.states.fixedLeafColumnsLength.value) {
  42991. fixedLayout = "left";
  42992. }
  42993. break;
  42994. case "right":
  42995. if (start >= columns.length - store.states.rightFixedLeafColumnsLength.value) {
  42996. fixedLayout = "right";
  42997. }
  42998. break;
  42999. default:
  43000. if (after < store.states.fixedLeafColumnsLength.value) {
  43001. fixedLayout = "left";
  43002. } else if (start >= columns.length - store.states.rightFixedLeafColumnsLength.value) {
  43003. fixedLayout = "right";
  43004. }
  43005. }
  43006. return fixedLayout ? {
  43007. direction: fixedLayout,
  43008. start,
  43009. after
  43010. } : {};
  43011. };
  43012. const getFixedColumnsClass = (namespace, index, fixed, store, realColumns, offset = 0) => {
  43013. const classes = [];
  43014. const { direction, start, after } = isFixedColumn(index, fixed, store, realColumns);
  43015. if (direction) {
  43016. const isLeft = direction === "left";
  43017. classes.push(`${namespace}-fixed-column--${direction}`);
  43018. if (isLeft && after + offset === store.states.fixedLeafColumnsLength.value - 1) {
  43019. classes.push("is-last-column");
  43020. } else if (!isLeft && start - offset === store.states.columns.value.length - store.states.rightFixedLeafColumnsLength.value) {
  43021. classes.push("is-first-column");
  43022. }
  43023. }
  43024. return classes;
  43025. };
  43026. function getOffset(offset, column) {
  43027. return offset + (column.realWidth === null || Number.isNaN(column.realWidth) ? Number(column.width) : column.realWidth);
  43028. }
  43029. const getFixedColumnOffset = (index, fixed, store, realColumns) => {
  43030. const {
  43031. direction,
  43032. start = 0,
  43033. after = 0
  43034. } = isFixedColumn(index, fixed, store, realColumns);
  43035. if (!direction) {
  43036. return;
  43037. }
  43038. const styles = {};
  43039. const isLeft = direction === "left";
  43040. const columns = store.states.columns.value;
  43041. if (isLeft) {
  43042. styles.left = columns.slice(0, start).reduce(getOffset, 0);
  43043. } else {
  43044. styles.right = columns.slice(after + 1).reverse().reduce(getOffset, 0);
  43045. }
  43046. return styles;
  43047. };
  43048. const ensurePosition = (style, key) => {
  43049. if (!style)
  43050. return;
  43051. if (!Number.isNaN(style[key])) {
  43052. style[key] = `${style[key]}px`;
  43053. }
  43054. };
  43055. function useExpand(watcherData) {
  43056. const instance = vue.getCurrentInstance();
  43057. const defaultExpandAll = vue.ref(false);
  43058. const expandRows = vue.ref([]);
  43059. const updateExpandRows = () => {
  43060. const data = watcherData.data.value || [];
  43061. const rowKey = watcherData.rowKey.value;
  43062. if (defaultExpandAll.value) {
  43063. expandRows.value = data.slice();
  43064. } else if (rowKey) {
  43065. const expandRowsMap = getKeysMap(expandRows.value, rowKey);
  43066. expandRows.value = data.reduce((prev, row) => {
  43067. const rowId = getRowIdentity(row, rowKey);
  43068. const rowInfo = expandRowsMap[rowId];
  43069. if (rowInfo) {
  43070. prev.push(row);
  43071. }
  43072. return prev;
  43073. }, []);
  43074. } else {
  43075. expandRows.value = [];
  43076. }
  43077. };
  43078. const toggleRowExpansion = (row, expanded) => {
  43079. const changed = toggleRowStatus(expandRows.value, row, expanded);
  43080. if (changed) {
  43081. instance.emit("expand-change", row, expandRows.value.slice());
  43082. }
  43083. };
  43084. const setExpandRowKeys = (rowKeys) => {
  43085. instance.store.assertRowKey();
  43086. const data = watcherData.data.value || [];
  43087. const rowKey = watcherData.rowKey.value;
  43088. const keysMap = getKeysMap(data, rowKey);
  43089. expandRows.value = rowKeys.reduce((prev, cur) => {
  43090. const info = keysMap[cur];
  43091. if (info) {
  43092. prev.push(info.row);
  43093. }
  43094. return prev;
  43095. }, []);
  43096. };
  43097. const isRowExpanded = (row) => {
  43098. const rowKey = watcherData.rowKey.value;
  43099. if (rowKey) {
  43100. const expandMap = getKeysMap(expandRows.value, rowKey);
  43101. return !!expandMap[getRowIdentity(row, rowKey)];
  43102. }
  43103. return expandRows.value.includes(row);
  43104. };
  43105. return {
  43106. updateExpandRows,
  43107. toggleRowExpansion,
  43108. setExpandRowKeys,
  43109. isRowExpanded,
  43110. states: {
  43111. expandRows,
  43112. defaultExpandAll
  43113. }
  43114. };
  43115. }
  43116. function useCurrent(watcherData) {
  43117. const instance = vue.getCurrentInstance();
  43118. const _currentRowKey = vue.ref(null);
  43119. const currentRow = vue.ref(null);
  43120. const setCurrentRowKey = (key) => {
  43121. instance.store.assertRowKey();
  43122. _currentRowKey.value = key;
  43123. setCurrentRowByKey(key);
  43124. };
  43125. const restoreCurrentRowKey = () => {
  43126. _currentRowKey.value = null;
  43127. };
  43128. const setCurrentRowByKey = (key) => {
  43129. const { data, rowKey } = watcherData;
  43130. let _currentRow = null;
  43131. if (rowKey.value) {
  43132. _currentRow = (vue.unref(data) || []).find((item) => getRowIdentity(item, rowKey.value) === key);
  43133. }
  43134. currentRow.value = _currentRow;
  43135. instance.emit("current-change", currentRow.value, null);
  43136. };
  43137. const updateCurrentRow = (_currentRow) => {
  43138. const oldCurrentRow = currentRow.value;
  43139. if (_currentRow && _currentRow !== oldCurrentRow) {
  43140. currentRow.value = _currentRow;
  43141. instance.emit("current-change", currentRow.value, oldCurrentRow);
  43142. return;
  43143. }
  43144. if (!_currentRow && oldCurrentRow) {
  43145. currentRow.value = null;
  43146. instance.emit("current-change", null, oldCurrentRow);
  43147. }
  43148. };
  43149. const updateCurrentRowData = () => {
  43150. const rowKey = watcherData.rowKey.value;
  43151. const data = watcherData.data.value || [];
  43152. const oldCurrentRow = currentRow.value;
  43153. if (!data.includes(oldCurrentRow) && oldCurrentRow) {
  43154. if (rowKey) {
  43155. const currentRowKey = getRowIdentity(oldCurrentRow, rowKey);
  43156. setCurrentRowByKey(currentRowKey);
  43157. } else {
  43158. currentRow.value = null;
  43159. }
  43160. if (currentRow.value === null) {
  43161. instance.emit("current-change", null, oldCurrentRow);
  43162. }
  43163. } else if (_currentRowKey.value) {
  43164. setCurrentRowByKey(_currentRowKey.value);
  43165. restoreCurrentRowKey();
  43166. }
  43167. };
  43168. return {
  43169. setCurrentRowKey,
  43170. restoreCurrentRowKey,
  43171. setCurrentRowByKey,
  43172. updateCurrentRow,
  43173. updateCurrentRowData,
  43174. states: {
  43175. _currentRowKey,
  43176. currentRow
  43177. }
  43178. };
  43179. }
  43180. function useTree$2(watcherData) {
  43181. const expandRowKeys = vue.ref([]);
  43182. const treeData = vue.ref({});
  43183. const indent = vue.ref(16);
  43184. const lazy = vue.ref(false);
  43185. const lazyTreeNodeMap = vue.ref({});
  43186. const lazyColumnIdentifier = vue.ref("hasChildren");
  43187. const childrenColumnName = vue.ref("children");
  43188. const checkStrictly = vue.ref(false);
  43189. const instance = vue.getCurrentInstance();
  43190. const normalizedData = vue.computed(() => {
  43191. if (!watcherData.rowKey.value)
  43192. return {};
  43193. const data = watcherData.data.value || [];
  43194. return normalize(data);
  43195. });
  43196. const normalizedLazyNode = vue.computed(() => {
  43197. const rowKey = watcherData.rowKey.value;
  43198. const keys = Object.keys(lazyTreeNodeMap.value);
  43199. const res = {};
  43200. if (!keys.length)
  43201. return res;
  43202. keys.forEach((key) => {
  43203. if (lazyTreeNodeMap.value[key].length) {
  43204. const item = { children: [] };
  43205. lazyTreeNodeMap.value[key].forEach((row) => {
  43206. const currentRowKey = getRowIdentity(row, rowKey);
  43207. item.children.push(currentRowKey);
  43208. if (row[lazyColumnIdentifier.value] && !res[currentRowKey]) {
  43209. res[currentRowKey] = { children: [] };
  43210. }
  43211. });
  43212. res[key] = item;
  43213. }
  43214. });
  43215. return res;
  43216. });
  43217. const normalize = (data) => {
  43218. const rowKey = watcherData.rowKey.value;
  43219. const res = {};
  43220. walkTreeNode(data, (parent, children, level) => {
  43221. const parentId = getRowIdentity(parent, rowKey);
  43222. if (isArray$1(children)) {
  43223. res[parentId] = {
  43224. children: children.map((row) => getRowIdentity(row, rowKey)),
  43225. level
  43226. };
  43227. } else if (lazy.value) {
  43228. res[parentId] = {
  43229. children: [],
  43230. lazy: true,
  43231. level
  43232. };
  43233. }
  43234. }, childrenColumnName.value, lazyColumnIdentifier.value);
  43235. return res;
  43236. };
  43237. const updateTreeData = (ifChangeExpandRowKeys = false, ifExpandAll = ((_a) => (_a = instance.store) == null ? void 0 : _a.states.defaultExpandAll.value)()) => {
  43238. var _a2;
  43239. const nested = normalizedData.value;
  43240. const normalizedLazyNode_ = normalizedLazyNode.value;
  43241. const keys = Object.keys(nested);
  43242. const newTreeData = {};
  43243. if (keys.length) {
  43244. const oldTreeData = vue.unref(treeData);
  43245. const rootLazyRowKeys = [];
  43246. const getExpanded = (oldValue, key) => {
  43247. if (ifChangeExpandRowKeys) {
  43248. if (expandRowKeys.value) {
  43249. return ifExpandAll || expandRowKeys.value.includes(key);
  43250. } else {
  43251. return !!(ifExpandAll || (oldValue == null ? void 0 : oldValue.expanded));
  43252. }
  43253. } else {
  43254. const included = ifExpandAll || expandRowKeys.value && expandRowKeys.value.includes(key);
  43255. return !!((oldValue == null ? void 0 : oldValue.expanded) || included);
  43256. }
  43257. };
  43258. keys.forEach((key) => {
  43259. const oldValue = oldTreeData[key];
  43260. const newValue = { ...nested[key] };
  43261. newValue.expanded = getExpanded(oldValue, key);
  43262. if (newValue.lazy) {
  43263. const { loaded = false, loading = false } = oldValue || {};
  43264. newValue.loaded = !!loaded;
  43265. newValue.loading = !!loading;
  43266. rootLazyRowKeys.push(key);
  43267. }
  43268. newTreeData[key] = newValue;
  43269. });
  43270. const lazyKeys = Object.keys(normalizedLazyNode_);
  43271. if (lazy.value && lazyKeys.length && rootLazyRowKeys.length) {
  43272. lazyKeys.forEach((key) => {
  43273. const oldValue = oldTreeData[key];
  43274. const lazyNodeChildren = normalizedLazyNode_[key].children;
  43275. if (rootLazyRowKeys.includes(key)) {
  43276. if (newTreeData[key].children.length !== 0) {
  43277. throw new Error("[ElTable]children must be an empty array.");
  43278. }
  43279. newTreeData[key].children = lazyNodeChildren;
  43280. } else {
  43281. const { loaded = false, loading = false } = oldValue || {};
  43282. newTreeData[key] = {
  43283. lazy: true,
  43284. loaded: !!loaded,
  43285. loading: !!loading,
  43286. expanded: getExpanded(oldValue, key),
  43287. children: lazyNodeChildren,
  43288. level: ""
  43289. };
  43290. }
  43291. });
  43292. }
  43293. }
  43294. treeData.value = newTreeData;
  43295. (_a2 = instance.store) == null ? void 0 : _a2.updateTableScrollY();
  43296. };
  43297. vue.watch(() => expandRowKeys.value, () => {
  43298. updateTreeData(true);
  43299. });
  43300. vue.watch(() => normalizedData.value, () => {
  43301. updateTreeData();
  43302. });
  43303. vue.watch(() => normalizedLazyNode.value, () => {
  43304. updateTreeData();
  43305. });
  43306. const updateTreeExpandKeys = (value) => {
  43307. expandRowKeys.value = value;
  43308. updateTreeData();
  43309. };
  43310. const toggleTreeExpansion = (row, expanded) => {
  43311. instance.store.assertRowKey();
  43312. const rowKey = watcherData.rowKey.value;
  43313. const id = getRowIdentity(row, rowKey);
  43314. const data = id && treeData.value[id];
  43315. if (id && data && "expanded" in data) {
  43316. const oldExpanded = data.expanded;
  43317. expanded = isUndefined(expanded) ? !data.expanded : expanded;
  43318. treeData.value[id].expanded = expanded;
  43319. if (oldExpanded !== expanded) {
  43320. instance.emit("expand-change", row, expanded);
  43321. }
  43322. instance.store.updateTableScrollY();
  43323. }
  43324. };
  43325. const loadOrToggle = (row) => {
  43326. instance.store.assertRowKey();
  43327. const rowKey = watcherData.rowKey.value;
  43328. const id = getRowIdentity(row, rowKey);
  43329. const data = treeData.value[id];
  43330. if (lazy.value && data && "loaded" in data && !data.loaded) {
  43331. loadData(row, id, data);
  43332. } else {
  43333. toggleTreeExpansion(row, void 0);
  43334. }
  43335. };
  43336. const loadData = (row, key, treeNode) => {
  43337. const { load } = instance.props;
  43338. if (load && !treeData.value[key].loaded) {
  43339. treeData.value[key].loading = true;
  43340. load(row, treeNode, (data) => {
  43341. if (!isArray$1(data)) {
  43342. throw new TypeError("[ElTable] data must be an array");
  43343. }
  43344. treeData.value[key].loading = false;
  43345. treeData.value[key].loaded = true;
  43346. treeData.value[key].expanded = true;
  43347. if (data.length) {
  43348. lazyTreeNodeMap.value[key] = data;
  43349. }
  43350. instance.emit("expand-change", row, true);
  43351. });
  43352. }
  43353. };
  43354. const updateKeyChildren = (key, data) => {
  43355. const { lazy: lazy2, rowKey } = instance.props;
  43356. if (!lazy2)
  43357. return;
  43358. if (!rowKey)
  43359. throw new Error("[Table] rowKey is required in updateKeyChild");
  43360. if (lazyTreeNodeMap.value[key]) {
  43361. lazyTreeNodeMap.value[key] = data;
  43362. }
  43363. };
  43364. return {
  43365. loadData,
  43366. loadOrToggle,
  43367. toggleTreeExpansion,
  43368. updateTreeExpandKeys,
  43369. updateTreeData,
  43370. updateKeyChildren,
  43371. normalize,
  43372. states: {
  43373. expandRowKeys,
  43374. treeData,
  43375. indent,
  43376. lazy,
  43377. lazyTreeNodeMap,
  43378. lazyColumnIdentifier,
  43379. childrenColumnName,
  43380. checkStrictly
  43381. }
  43382. };
  43383. }
  43384. const sortData = (data, states) => {
  43385. const sortingColumn = states.sortingColumn;
  43386. if (!sortingColumn || isString$1(sortingColumn.sortable)) {
  43387. return data;
  43388. }
  43389. return orderBy(data, states.sortProp, states.sortOrder, sortingColumn.sortMethod, sortingColumn.sortBy);
  43390. };
  43391. const doFlattenColumns = (columns) => {
  43392. const result = [];
  43393. columns.forEach((column) => {
  43394. if (column.children && column.children.length > 0) {
  43395. result.push.apply(result, doFlattenColumns(column.children));
  43396. } else {
  43397. result.push(column);
  43398. }
  43399. });
  43400. return result;
  43401. };
  43402. function useWatcher$1() {
  43403. var _a;
  43404. const instance = vue.getCurrentInstance();
  43405. const { size: tableSize } = vue.toRefs((_a = instance.proxy) == null ? void 0 : _a.$props);
  43406. const rowKey = vue.ref(null);
  43407. const data = vue.ref([]);
  43408. const _data = vue.ref([]);
  43409. const isComplex = vue.ref(false);
  43410. const _columns = vue.ref([]);
  43411. const originColumns = vue.ref([]);
  43412. const columns = vue.ref([]);
  43413. const fixedColumns = vue.ref([]);
  43414. const rightFixedColumns = vue.ref([]);
  43415. const leafColumns = vue.ref([]);
  43416. const fixedLeafColumns = vue.ref([]);
  43417. const rightFixedLeafColumns = vue.ref([]);
  43418. const updateOrderFns = [];
  43419. const leafColumnsLength = vue.ref(0);
  43420. const fixedLeafColumnsLength = vue.ref(0);
  43421. const rightFixedLeafColumnsLength = vue.ref(0);
  43422. const isAllSelected = vue.ref(false);
  43423. const selection = vue.ref([]);
  43424. const reserveSelection = vue.ref(false);
  43425. const selectOnIndeterminate = vue.ref(false);
  43426. const selectable = vue.ref(null);
  43427. const filters = vue.ref({});
  43428. const filteredData = vue.ref(null);
  43429. const sortingColumn = vue.ref(null);
  43430. const sortProp = vue.ref(null);
  43431. const sortOrder = vue.ref(null);
  43432. const hoverRow = vue.ref(null);
  43433. vue.watch(data, () => {
  43434. var _a2;
  43435. if (instance.state) {
  43436. scheduleLayout(false);
  43437. const needUpdateFixed = instance.props.tableLayout === "auto";
  43438. if (needUpdateFixed) {
  43439. (_a2 = instance.refs.tableHeaderRef) == null ? void 0 : _a2.updateFixedColumnStyle();
  43440. }
  43441. }
  43442. }, {
  43443. deep: true
  43444. });
  43445. const assertRowKey = () => {
  43446. if (!rowKey.value)
  43447. throw new Error("[ElTable] prop row-key is required");
  43448. };
  43449. const updateChildFixed = (column) => {
  43450. var _a2;
  43451. (_a2 = column.children) == null ? void 0 : _a2.forEach((childColumn) => {
  43452. childColumn.fixed = column.fixed;
  43453. updateChildFixed(childColumn);
  43454. });
  43455. };
  43456. let selectionInitialFixed = void 0;
  43457. const updateColumns = () => {
  43458. _columns.value.forEach((column) => {
  43459. updateChildFixed(column);
  43460. });
  43461. fixedColumns.value = _columns.value.filter((column) => column.fixed === true || column.fixed === "left");
  43462. rightFixedColumns.value = _columns.value.filter((column) => column.fixed === "right");
  43463. if (isUndefined(selectionInitialFixed) && _columns.value[0] && _columns.value[0].type === "selection") {
  43464. selectionInitialFixed = Boolean(_columns.value[0].fixed);
  43465. }
  43466. if (fixedColumns.value.length > 0 && _columns.value[0] && _columns.value[0].type === "selection") {
  43467. if (!_columns.value[0].fixed) {
  43468. _columns.value[0].fixed = true;
  43469. fixedColumns.value.unshift(_columns.value[0]);
  43470. } else {
  43471. const hasNotSelectionColumns = fixedColumns.value.some((column) => column.type !== "selection");
  43472. if (!hasNotSelectionColumns) {
  43473. _columns.value[0].fixed = selectionInitialFixed;
  43474. if (!selectionInitialFixed)
  43475. fixedColumns.value.shift();
  43476. } else {
  43477. selectionInitialFixed = void 0;
  43478. }
  43479. }
  43480. }
  43481. const notFixedColumns = _columns.value.filter((column) => !column.fixed);
  43482. originColumns.value = [].concat(fixedColumns.value).concat(notFixedColumns).concat(rightFixedColumns.value);
  43483. const leafColumns2 = doFlattenColumns(notFixedColumns);
  43484. const fixedLeafColumns2 = doFlattenColumns(fixedColumns.value);
  43485. const rightFixedLeafColumns2 = doFlattenColumns(rightFixedColumns.value);
  43486. leafColumnsLength.value = leafColumns2.length;
  43487. fixedLeafColumnsLength.value = fixedLeafColumns2.length;
  43488. rightFixedLeafColumnsLength.value = rightFixedLeafColumns2.length;
  43489. columns.value = [].concat(fixedLeafColumns2).concat(leafColumns2).concat(rightFixedLeafColumns2);
  43490. isComplex.value = fixedColumns.value.length > 0 || rightFixedColumns.value.length > 0;
  43491. };
  43492. const scheduleLayout = (needUpdateColumns, immediate = false) => {
  43493. if (needUpdateColumns) {
  43494. updateColumns();
  43495. }
  43496. if (immediate) {
  43497. instance.state.doLayout();
  43498. } else {
  43499. instance.state.debouncedUpdateLayout();
  43500. }
  43501. };
  43502. const isSelected = (row) => {
  43503. return selection.value.some((item) => isEqual$1(item, row));
  43504. };
  43505. const clearSelection = () => {
  43506. isAllSelected.value = false;
  43507. const oldSelection = selection.value;
  43508. selection.value = [];
  43509. if (oldSelection.length) {
  43510. instance.emit("selection-change", []);
  43511. }
  43512. };
  43513. const cleanSelection = () => {
  43514. let deleted;
  43515. if (rowKey.value) {
  43516. deleted = [];
  43517. const selectedMap = getKeysMap(selection.value, rowKey.value);
  43518. const dataMap = getKeysMap(data.value, rowKey.value);
  43519. for (const key in selectedMap) {
  43520. if (hasOwn(selectedMap, key) && !dataMap[key]) {
  43521. deleted.push(selectedMap[key].row);
  43522. }
  43523. }
  43524. } else {
  43525. deleted = selection.value.filter((item) => !data.value.includes(item));
  43526. }
  43527. if (deleted.length) {
  43528. const newSelection = selection.value.filter((item) => !deleted.includes(item));
  43529. selection.value = newSelection;
  43530. instance.emit("selection-change", newSelection.slice());
  43531. }
  43532. };
  43533. const getSelectionRows = () => {
  43534. return (selection.value || []).slice();
  43535. };
  43536. const toggleRowSelection = (row, selected, emitChange = true, ignoreSelectable = false) => {
  43537. var _a2, _b, _c, _d;
  43538. const treeProps = {
  43539. children: (_b = (_a2 = instance == null ? void 0 : instance.store) == null ? void 0 : _a2.states) == null ? void 0 : _b.childrenColumnName.value,
  43540. checkStrictly: (_d = (_c = instance == null ? void 0 : instance.store) == null ? void 0 : _c.states) == null ? void 0 : _d.checkStrictly.value
  43541. };
  43542. const changed = toggleRowStatus(selection.value, row, selected, treeProps, ignoreSelectable ? void 0 : selectable.value);
  43543. if (changed) {
  43544. const newSelection = (selection.value || []).slice();
  43545. if (emitChange) {
  43546. instance.emit("select", newSelection, row);
  43547. }
  43548. instance.emit("selection-change", newSelection);
  43549. }
  43550. };
  43551. const _toggleAllSelection = () => {
  43552. var _a2, _b;
  43553. const value = selectOnIndeterminate.value ? !isAllSelected.value : !(isAllSelected.value || selection.value.length);
  43554. isAllSelected.value = value;
  43555. let selectionChanged = false;
  43556. let childrenCount = 0;
  43557. const rowKey2 = (_b = (_a2 = instance == null ? void 0 : instance.store) == null ? void 0 : _a2.states) == null ? void 0 : _b.rowKey.value;
  43558. const { childrenColumnName } = instance.store.states;
  43559. const treeProps = {
  43560. children: childrenColumnName.value,
  43561. checkStrictly: false
  43562. };
  43563. data.value.forEach((row, index) => {
  43564. const rowIndex = index + childrenCount;
  43565. if (toggleRowStatus(selection.value, row, value, treeProps, selectable.value, rowIndex)) {
  43566. selectionChanged = true;
  43567. }
  43568. childrenCount += getChildrenCount(getRowIdentity(row, rowKey2));
  43569. });
  43570. if (selectionChanged) {
  43571. instance.emit("selection-change", selection.value ? selection.value.slice() : []);
  43572. }
  43573. instance.emit("select-all", (selection.value || []).slice());
  43574. };
  43575. const updateSelectionByRowKey = () => {
  43576. const selectedMap = getKeysMap(selection.value, rowKey.value);
  43577. data.value.forEach((row) => {
  43578. const rowId = getRowIdentity(row, rowKey.value);
  43579. const rowInfo = selectedMap[rowId];
  43580. if (rowInfo) {
  43581. selection.value[rowInfo.index] = row;
  43582. }
  43583. });
  43584. };
  43585. const updateAllSelected = () => {
  43586. var _a2;
  43587. if (((_a2 = data.value) == null ? void 0 : _a2.length) === 0) {
  43588. isAllSelected.value = false;
  43589. return;
  43590. }
  43591. const { childrenColumnName } = instance.store.states;
  43592. const selectedMap = rowKey.value ? getKeysMap(selection.value, rowKey.value) : void 0;
  43593. let rowIndex = 0;
  43594. let selectedCount = 0;
  43595. const isSelected2 = (row) => {
  43596. if (selectedMap) {
  43597. return !!selectedMap[getRowIdentity(row, rowKey.value)];
  43598. } else {
  43599. return selection.value.includes(row);
  43600. }
  43601. };
  43602. const checkSelectedStatus = (data2) => {
  43603. var _a3;
  43604. for (const row of data2) {
  43605. const isRowSelectable = selectable.value && selectable.value.call(null, row, rowIndex);
  43606. if (!isSelected2(row)) {
  43607. if (!selectable.value || isRowSelectable) {
  43608. return false;
  43609. }
  43610. } else {
  43611. selectedCount++;
  43612. }
  43613. rowIndex++;
  43614. if (((_a3 = row[childrenColumnName.value]) == null ? void 0 : _a3.length) && !checkSelectedStatus(row[childrenColumnName.value])) {
  43615. return false;
  43616. }
  43617. }
  43618. return true;
  43619. };
  43620. const isAllSelected_ = checkSelectedStatus(data.value || []);
  43621. isAllSelected.value = selectedCount === 0 ? false : isAllSelected_;
  43622. };
  43623. const getChildrenCount = (rowKey2) => {
  43624. var _a2;
  43625. if (!instance || !instance.store)
  43626. return 0;
  43627. const { treeData } = instance.store.states;
  43628. let count = 0;
  43629. const children = (_a2 = treeData.value[rowKey2]) == null ? void 0 : _a2.children;
  43630. if (children) {
  43631. count += children.length;
  43632. children.forEach((childKey) => {
  43633. count += getChildrenCount(childKey);
  43634. });
  43635. }
  43636. return count;
  43637. };
  43638. const updateFilters = (columns2, values) => {
  43639. if (!isArray$1(columns2)) {
  43640. columns2 = [columns2];
  43641. }
  43642. const filters_ = {};
  43643. columns2.forEach((col) => {
  43644. filters.value[col.id] = values;
  43645. filters_[col.columnKey || col.id] = values;
  43646. });
  43647. return filters_;
  43648. };
  43649. const updateSort = (column, prop, order) => {
  43650. if (sortingColumn.value && sortingColumn.value !== column) {
  43651. sortingColumn.value.order = null;
  43652. }
  43653. sortingColumn.value = column;
  43654. sortProp.value = prop;
  43655. sortOrder.value = order;
  43656. };
  43657. const execFilter = () => {
  43658. let sourceData = vue.unref(_data);
  43659. Object.keys(filters.value).forEach((columnId) => {
  43660. const values = filters.value[columnId];
  43661. if (!values || values.length === 0)
  43662. return;
  43663. const column = getColumnById({
  43664. columns: columns.value
  43665. }, columnId);
  43666. if (column && column.filterMethod) {
  43667. sourceData = sourceData.filter((row) => {
  43668. return values.some((value) => column.filterMethod.call(null, value, row, column));
  43669. });
  43670. }
  43671. });
  43672. filteredData.value = sourceData;
  43673. };
  43674. const execSort = () => {
  43675. data.value = sortData(filteredData.value, {
  43676. sortingColumn: sortingColumn.value,
  43677. sortProp: sortProp.value,
  43678. sortOrder: sortOrder.value
  43679. });
  43680. };
  43681. const execQuery = (ignore = void 0) => {
  43682. if (!(ignore && ignore.filter)) {
  43683. execFilter();
  43684. }
  43685. execSort();
  43686. };
  43687. const clearFilter = (columnKeys) => {
  43688. const { tableHeaderRef } = instance.refs;
  43689. if (!tableHeaderRef)
  43690. return;
  43691. const panels = Object.assign({}, tableHeaderRef.filterPanels);
  43692. const keys = Object.keys(panels);
  43693. if (!keys.length)
  43694. return;
  43695. if (isString$1(columnKeys)) {
  43696. columnKeys = [columnKeys];
  43697. }
  43698. if (isArray$1(columnKeys)) {
  43699. const columns_ = columnKeys.map((key) => getColumnByKey({
  43700. columns: columns.value
  43701. }, key));
  43702. keys.forEach((key) => {
  43703. const column = columns_.find((col) => col.id === key);
  43704. if (column) {
  43705. column.filteredValue = [];
  43706. }
  43707. });
  43708. instance.store.commit("filterChange", {
  43709. column: columns_,
  43710. values: [],
  43711. silent: true,
  43712. multi: true
  43713. });
  43714. } else {
  43715. keys.forEach((key) => {
  43716. const column = columns.value.find((col) => col.id === key);
  43717. if (column) {
  43718. column.filteredValue = [];
  43719. }
  43720. });
  43721. filters.value = {};
  43722. instance.store.commit("filterChange", {
  43723. column: {},
  43724. values: [],
  43725. silent: true
  43726. });
  43727. }
  43728. };
  43729. const clearSort = () => {
  43730. if (!sortingColumn.value)
  43731. return;
  43732. updateSort(null, null, null);
  43733. instance.store.commit("changeSortCondition", {
  43734. silent: true
  43735. });
  43736. };
  43737. const {
  43738. setExpandRowKeys,
  43739. toggleRowExpansion,
  43740. updateExpandRows,
  43741. states: expandStates,
  43742. isRowExpanded
  43743. } = useExpand({
  43744. data,
  43745. rowKey
  43746. });
  43747. const {
  43748. updateTreeExpandKeys,
  43749. toggleTreeExpansion,
  43750. updateTreeData,
  43751. updateKeyChildren,
  43752. loadOrToggle,
  43753. states: treeStates
  43754. } = useTree$2({
  43755. data,
  43756. rowKey
  43757. });
  43758. const {
  43759. updateCurrentRowData,
  43760. updateCurrentRow,
  43761. setCurrentRowKey,
  43762. states: currentData
  43763. } = useCurrent({
  43764. data,
  43765. rowKey
  43766. });
  43767. const setExpandRowKeysAdapter = (val) => {
  43768. setExpandRowKeys(val);
  43769. updateTreeExpandKeys(val);
  43770. };
  43771. const toggleRowExpansionAdapter = (row, expanded) => {
  43772. const hasExpandColumn = columns.value.some(({ type }) => type === "expand");
  43773. if (hasExpandColumn) {
  43774. toggleRowExpansion(row, expanded);
  43775. } else {
  43776. toggleTreeExpansion(row, expanded);
  43777. }
  43778. };
  43779. return {
  43780. assertRowKey,
  43781. updateColumns,
  43782. scheduleLayout,
  43783. isSelected,
  43784. clearSelection,
  43785. cleanSelection,
  43786. getSelectionRows,
  43787. toggleRowSelection,
  43788. _toggleAllSelection,
  43789. toggleAllSelection: null,
  43790. updateSelectionByRowKey,
  43791. updateAllSelected,
  43792. updateFilters,
  43793. updateCurrentRow,
  43794. updateSort,
  43795. execFilter,
  43796. execSort,
  43797. execQuery,
  43798. clearFilter,
  43799. clearSort,
  43800. toggleRowExpansion,
  43801. setExpandRowKeysAdapter,
  43802. setCurrentRowKey,
  43803. toggleRowExpansionAdapter,
  43804. isRowExpanded,
  43805. updateExpandRows,
  43806. updateCurrentRowData,
  43807. loadOrToggle,
  43808. updateTreeData,
  43809. updateKeyChildren,
  43810. states: {
  43811. tableSize,
  43812. rowKey,
  43813. data,
  43814. _data,
  43815. isComplex,
  43816. _columns,
  43817. originColumns,
  43818. columns,
  43819. fixedColumns,
  43820. rightFixedColumns,
  43821. leafColumns,
  43822. fixedLeafColumns,
  43823. rightFixedLeafColumns,
  43824. updateOrderFns,
  43825. leafColumnsLength,
  43826. fixedLeafColumnsLength,
  43827. rightFixedLeafColumnsLength,
  43828. isAllSelected,
  43829. selection,
  43830. reserveSelection,
  43831. selectOnIndeterminate,
  43832. selectable,
  43833. filters,
  43834. filteredData,
  43835. sortingColumn,
  43836. sortProp,
  43837. sortOrder,
  43838. hoverRow,
  43839. ...expandStates,
  43840. ...treeStates,
  43841. ...currentData
  43842. }
  43843. };
  43844. }
  43845. function replaceColumn(array, column) {
  43846. return array.map((item) => {
  43847. var _a;
  43848. if (item.id === column.id) {
  43849. return column;
  43850. } else if ((_a = item.children) == null ? void 0 : _a.length) {
  43851. item.children = replaceColumn(item.children, column);
  43852. }
  43853. return item;
  43854. });
  43855. }
  43856. function sortColumn(array) {
  43857. array.forEach((item) => {
  43858. var _a, _b;
  43859. item.no = (_a = item.getColumnIndex) == null ? void 0 : _a.call(item);
  43860. if ((_b = item.children) == null ? void 0 : _b.length) {
  43861. sortColumn(item.children);
  43862. }
  43863. });
  43864. array.sort((cur, pre) => cur.no - pre.no);
  43865. }
  43866. function useStore() {
  43867. const instance = vue.getCurrentInstance();
  43868. const watcher = useWatcher$1();
  43869. const ns = useNamespace("table");
  43870. const mutations = {
  43871. setData(states, data) {
  43872. const dataInstanceChanged = vue.unref(states._data) !== data;
  43873. states.data.value = data;
  43874. states._data.value = data;
  43875. instance.store.execQuery();
  43876. instance.store.updateCurrentRowData();
  43877. instance.store.updateExpandRows();
  43878. instance.store.updateTreeData(instance.store.states.defaultExpandAll.value);
  43879. if (vue.unref(states.reserveSelection)) {
  43880. instance.store.assertRowKey();
  43881. instance.store.updateSelectionByRowKey();
  43882. } else {
  43883. if (dataInstanceChanged) {
  43884. instance.store.clearSelection();
  43885. } else {
  43886. instance.store.cleanSelection();
  43887. }
  43888. }
  43889. instance.store.updateAllSelected();
  43890. if (instance.$ready) {
  43891. instance.store.scheduleLayout();
  43892. }
  43893. },
  43894. insertColumn(states, column, parent, updateColumnOrder) {
  43895. const array = vue.unref(states._columns);
  43896. let newColumns = [];
  43897. if (!parent) {
  43898. array.push(column);
  43899. newColumns = array;
  43900. } else {
  43901. if (parent && !parent.children) {
  43902. parent.children = [];
  43903. }
  43904. parent.children.push(column);
  43905. newColumns = replaceColumn(array, parent);
  43906. }
  43907. sortColumn(newColumns);
  43908. states._columns.value = newColumns;
  43909. states.updateOrderFns.push(updateColumnOrder);
  43910. if (column.type === "selection") {
  43911. states.selectable.value = column.selectable;
  43912. states.reserveSelection.value = column.reserveSelection;
  43913. }
  43914. if (instance.$ready) {
  43915. instance.store.updateColumns();
  43916. instance.store.scheduleLayout();
  43917. }
  43918. },
  43919. updateColumnOrder(states, column) {
  43920. var _a;
  43921. const newColumnIndex = (_a = column.getColumnIndex) == null ? void 0 : _a.call(column);
  43922. if (newColumnIndex === column.no)
  43923. return;
  43924. sortColumn(states._columns.value);
  43925. if (instance.$ready) {
  43926. instance.store.updateColumns();
  43927. }
  43928. },
  43929. removeColumn(states, column, parent, updateColumnOrder) {
  43930. const array = vue.unref(states._columns) || [];
  43931. if (parent) {
  43932. parent.children.splice(parent.children.findIndex((item) => item.id === column.id), 1);
  43933. vue.nextTick(() => {
  43934. var _a;
  43935. if (((_a = parent.children) == null ? void 0 : _a.length) === 0) {
  43936. delete parent.children;
  43937. }
  43938. });
  43939. states._columns.value = replaceColumn(array, parent);
  43940. } else {
  43941. const index = array.indexOf(column);
  43942. if (index > -1) {
  43943. array.splice(index, 1);
  43944. states._columns.value = array;
  43945. }
  43946. }
  43947. const updateFnIndex = states.updateOrderFns.indexOf(updateColumnOrder);
  43948. updateFnIndex > -1 && states.updateOrderFns.splice(updateFnIndex, 1);
  43949. if (instance.$ready) {
  43950. instance.store.updateColumns();
  43951. instance.store.scheduleLayout();
  43952. }
  43953. },
  43954. sort(states, options) {
  43955. const { prop, order, init } = options;
  43956. if (prop) {
  43957. const column = vue.unref(states.columns).find((column2) => column2.property === prop);
  43958. if (column) {
  43959. column.order = order;
  43960. instance.store.updateSort(column, prop, order);
  43961. instance.store.commit("changeSortCondition", { init });
  43962. }
  43963. }
  43964. },
  43965. changeSortCondition(states, options) {
  43966. const { sortingColumn, sortProp, sortOrder } = states;
  43967. const columnValue = vue.unref(sortingColumn), propValue = vue.unref(sortProp), orderValue = vue.unref(sortOrder);
  43968. if (orderValue === null) {
  43969. states.sortingColumn.value = null;
  43970. states.sortProp.value = null;
  43971. }
  43972. const ignore = { filter: true };
  43973. instance.store.execQuery(ignore);
  43974. if (!options || !(options.silent || options.init)) {
  43975. instance.emit("sort-change", {
  43976. column: columnValue,
  43977. prop: propValue,
  43978. order: orderValue
  43979. });
  43980. }
  43981. instance.store.updateTableScrollY();
  43982. },
  43983. filterChange(_states, options) {
  43984. const { column, values, silent } = options;
  43985. const newFilters = instance.store.updateFilters(column, values);
  43986. instance.store.execQuery();
  43987. if (!silent) {
  43988. instance.emit("filter-change", newFilters);
  43989. }
  43990. instance.store.updateTableScrollY();
  43991. },
  43992. toggleAllSelection() {
  43993. instance.store.toggleAllSelection();
  43994. },
  43995. rowSelectedChanged(_states, row) {
  43996. instance.store.toggleRowSelection(row);
  43997. instance.store.updateAllSelected();
  43998. },
  43999. setHoverRow(states, row) {
  44000. states.hoverRow.value = row;
  44001. },
  44002. setCurrentRow(_states, row) {
  44003. instance.store.updateCurrentRow(row);
  44004. }
  44005. };
  44006. const commit = function(name, ...args) {
  44007. const mutations2 = instance.store.mutations;
  44008. if (mutations2[name]) {
  44009. mutations2[name].apply(instance, [instance.store.states].concat(args));
  44010. } else {
  44011. throw new Error(`Action not found: ${name}`);
  44012. }
  44013. };
  44014. const updateTableScrollY = function() {
  44015. vue.nextTick(() => instance.layout.updateScrollY.apply(instance.layout));
  44016. };
  44017. return {
  44018. ns,
  44019. ...watcher,
  44020. mutations,
  44021. commit,
  44022. updateTableScrollY
  44023. };
  44024. }
  44025. const InitialStateMap = {
  44026. rowKey: "rowKey",
  44027. defaultExpandAll: "defaultExpandAll",
  44028. selectOnIndeterminate: "selectOnIndeterminate",
  44029. indent: "indent",
  44030. lazy: "lazy",
  44031. data: "data",
  44032. ["treeProps.hasChildren"]: {
  44033. key: "lazyColumnIdentifier",
  44034. default: "hasChildren"
  44035. },
  44036. ["treeProps.children"]: {
  44037. key: "childrenColumnName",
  44038. default: "children"
  44039. },
  44040. ["treeProps.checkStrictly"]: {
  44041. key: "checkStrictly",
  44042. default: false
  44043. }
  44044. };
  44045. function createStore(table, props) {
  44046. if (!table) {
  44047. throw new Error("Table is required.");
  44048. }
  44049. const store = useStore();
  44050. store.toggleAllSelection = debounce(store._toggleAllSelection, 10);
  44051. Object.keys(InitialStateMap).forEach((key) => {
  44052. handleValue(getArrKeysValue(props, key), key, store);
  44053. });
  44054. proxyTableProps(store, props);
  44055. return store;
  44056. }
  44057. function proxyTableProps(store, props) {
  44058. Object.keys(InitialStateMap).forEach((key) => {
  44059. vue.watch(() => getArrKeysValue(props, key), (value) => {
  44060. handleValue(value, key, store);
  44061. });
  44062. });
  44063. }
  44064. function handleValue(value, propsKey, store) {
  44065. let newVal = value;
  44066. let storeKey = InitialStateMap[propsKey];
  44067. if (typeof InitialStateMap[propsKey] === "object") {
  44068. storeKey = storeKey.key;
  44069. newVal = newVal || InitialStateMap[propsKey].default;
  44070. }
  44071. store.states[storeKey].value = newVal;
  44072. }
  44073. function getArrKeysValue(props, keys) {
  44074. if (keys.includes(".")) {
  44075. const keyList = keys.split(".");
  44076. let value = props;
  44077. keyList.forEach((key) => {
  44078. value = value[key];
  44079. });
  44080. return value;
  44081. } else {
  44082. return props[keys];
  44083. }
  44084. }
  44085. class TableLayout {
  44086. constructor(options) {
  44087. this.observers = [];
  44088. this.table = null;
  44089. this.store = null;
  44090. this.columns = [];
  44091. this.fit = true;
  44092. this.showHeader = true;
  44093. this.height = vue.ref(null);
  44094. this.scrollX = vue.ref(false);
  44095. this.scrollY = vue.ref(false);
  44096. this.bodyWidth = vue.ref(null);
  44097. this.fixedWidth = vue.ref(null);
  44098. this.rightFixedWidth = vue.ref(null);
  44099. this.gutterWidth = 0;
  44100. for (const name in options) {
  44101. if (hasOwn(options, name)) {
  44102. if (vue.isRef(this[name])) {
  44103. this[name].value = options[name];
  44104. } else {
  44105. this[name] = options[name];
  44106. }
  44107. }
  44108. }
  44109. if (!this.table) {
  44110. throw new Error("Table is required for Table Layout");
  44111. }
  44112. if (!this.store) {
  44113. throw new Error("Store is required for Table Layout");
  44114. }
  44115. }
  44116. updateScrollY() {
  44117. const height = this.height.value;
  44118. if (height === null)
  44119. return false;
  44120. const scrollBarRef = this.table.refs.scrollBarRef;
  44121. if (this.table.vnode.el && (scrollBarRef == null ? void 0 : scrollBarRef.wrapRef)) {
  44122. let scrollY = true;
  44123. const prevScrollY = this.scrollY.value;
  44124. scrollY = scrollBarRef.wrapRef.scrollHeight > scrollBarRef.wrapRef.clientHeight;
  44125. this.scrollY.value = scrollY;
  44126. return prevScrollY !== scrollY;
  44127. }
  44128. return false;
  44129. }
  44130. setHeight(value, prop = "height") {
  44131. if (!isClient)
  44132. return;
  44133. const el = this.table.vnode.el;
  44134. value = parseHeight(value);
  44135. this.height.value = Number(value);
  44136. if (!el && (value || value === 0))
  44137. return vue.nextTick(() => this.setHeight(value, prop));
  44138. if (isNumber(value)) {
  44139. el.style[prop] = `${value}px`;
  44140. this.updateElsHeight();
  44141. } else if (isString$1(value)) {
  44142. el.style[prop] = value;
  44143. this.updateElsHeight();
  44144. }
  44145. }
  44146. setMaxHeight(value) {
  44147. this.setHeight(value, "max-height");
  44148. }
  44149. getFlattenColumns() {
  44150. const flattenColumns = [];
  44151. const columns = this.table.store.states.columns.value;
  44152. columns.forEach((column) => {
  44153. if (column.isColumnGroup) {
  44154. flattenColumns.push.apply(flattenColumns, column.columns);
  44155. } else {
  44156. flattenColumns.push(column);
  44157. }
  44158. });
  44159. return flattenColumns;
  44160. }
  44161. updateElsHeight() {
  44162. this.updateScrollY();
  44163. this.notifyObservers("scrollable");
  44164. }
  44165. headerDisplayNone(elm) {
  44166. if (!elm)
  44167. return true;
  44168. let headerChild = elm;
  44169. while (headerChild.tagName !== "DIV") {
  44170. if (getComputedStyle(headerChild).display === "none") {
  44171. return true;
  44172. }
  44173. headerChild = headerChild.parentElement;
  44174. }
  44175. return false;
  44176. }
  44177. updateColumnsWidth() {
  44178. if (!isClient)
  44179. return;
  44180. const fit = this.fit;
  44181. const bodyWidth = this.table.vnode.el.clientWidth;
  44182. let bodyMinWidth = 0;
  44183. const flattenColumns = this.getFlattenColumns();
  44184. const flexColumns = flattenColumns.filter((column) => !isNumber(column.width));
  44185. flattenColumns.forEach((column) => {
  44186. if (isNumber(column.width) && column.realWidth)
  44187. column.realWidth = null;
  44188. });
  44189. if (flexColumns.length > 0 && fit) {
  44190. flattenColumns.forEach((column) => {
  44191. bodyMinWidth += Number(column.width || column.minWidth || 80);
  44192. });
  44193. if (bodyMinWidth <= bodyWidth) {
  44194. this.scrollX.value = false;
  44195. const totalFlexWidth = bodyWidth - bodyMinWidth;
  44196. if (flexColumns.length === 1) {
  44197. flexColumns[0].realWidth = Number(flexColumns[0].minWidth || 80) + totalFlexWidth;
  44198. } else {
  44199. const allColumnsWidth = flexColumns.reduce((prev, column) => prev + Number(column.minWidth || 80), 0);
  44200. const flexWidthPerPixel = totalFlexWidth / allColumnsWidth;
  44201. let noneFirstWidth = 0;
  44202. flexColumns.forEach((column, index) => {
  44203. if (index === 0)
  44204. return;
  44205. const flexWidth = Math.floor(Number(column.minWidth || 80) * flexWidthPerPixel);
  44206. noneFirstWidth += flexWidth;
  44207. column.realWidth = Number(column.minWidth || 80) + flexWidth;
  44208. });
  44209. flexColumns[0].realWidth = Number(flexColumns[0].minWidth || 80) + totalFlexWidth - noneFirstWidth;
  44210. }
  44211. } else {
  44212. this.scrollX.value = true;
  44213. flexColumns.forEach((column) => {
  44214. column.realWidth = Number(column.minWidth);
  44215. });
  44216. }
  44217. this.bodyWidth.value = Math.max(bodyMinWidth, bodyWidth);
  44218. this.table.state.resizeState.value.width = this.bodyWidth.value;
  44219. } else {
  44220. flattenColumns.forEach((column) => {
  44221. if (!column.width && !column.minWidth) {
  44222. column.realWidth = 80;
  44223. } else {
  44224. column.realWidth = Number(column.width || column.minWidth);
  44225. }
  44226. bodyMinWidth += column.realWidth;
  44227. });
  44228. this.scrollX.value = bodyMinWidth > bodyWidth;
  44229. this.bodyWidth.value = bodyMinWidth;
  44230. }
  44231. const fixedColumns = this.store.states.fixedColumns.value;
  44232. if (fixedColumns.length > 0) {
  44233. let fixedWidth = 0;
  44234. fixedColumns.forEach((column) => {
  44235. fixedWidth += Number(column.realWidth || column.width);
  44236. });
  44237. this.fixedWidth.value = fixedWidth;
  44238. }
  44239. const rightFixedColumns = this.store.states.rightFixedColumns.value;
  44240. if (rightFixedColumns.length > 0) {
  44241. let rightFixedWidth = 0;
  44242. rightFixedColumns.forEach((column) => {
  44243. rightFixedWidth += Number(column.realWidth || column.width);
  44244. });
  44245. this.rightFixedWidth.value = rightFixedWidth;
  44246. }
  44247. this.notifyObservers("columns");
  44248. }
  44249. addObserver(observer) {
  44250. this.observers.push(observer);
  44251. }
  44252. removeObserver(observer) {
  44253. const index = this.observers.indexOf(observer);
  44254. if (index !== -1) {
  44255. this.observers.splice(index, 1);
  44256. }
  44257. }
  44258. notifyObservers(event) {
  44259. const observers = this.observers;
  44260. observers.forEach((observer) => {
  44261. var _a, _b;
  44262. switch (event) {
  44263. case "columns":
  44264. (_a = observer.state) == null ? void 0 : _a.onColumnsChange(this);
  44265. break;
  44266. case "scrollable":
  44267. (_b = observer.state) == null ? void 0 : _b.onScrollableChange(this);
  44268. break;
  44269. default:
  44270. throw new Error(`Table Layout don't have event ${event}.`);
  44271. }
  44272. });
  44273. }
  44274. }
  44275. var TableLayout$1 = TableLayout;
  44276. const { CheckboxGroup: ElCheckboxGroup } = ElCheckbox;
  44277. const _sfc_main$C = vue.defineComponent({
  44278. name: "ElTableFilterPanel",
  44279. components: {
  44280. ElCheckbox,
  44281. ElCheckboxGroup,
  44282. ElScrollbar,
  44283. ElTooltip,
  44284. ElIcon,
  44285. ArrowDown: arrow_down_default,
  44286. ArrowUp: arrow_up_default
  44287. },
  44288. directives: { ClickOutside },
  44289. props: {
  44290. placement: {
  44291. type: String,
  44292. default: "bottom-start"
  44293. },
  44294. store: {
  44295. type: Object
  44296. },
  44297. column: {
  44298. type: Object
  44299. },
  44300. upDataColumn: {
  44301. type: Function
  44302. },
  44303. appendTo: {
  44304. type: String
  44305. }
  44306. },
  44307. setup(props) {
  44308. const instance = vue.getCurrentInstance();
  44309. const { t } = useLocale();
  44310. const ns = useNamespace("table-filter");
  44311. const parent = instance == null ? void 0 : instance.parent;
  44312. if (!parent.filterPanels.value[props.column.id]) {
  44313. parent.filterPanels.value[props.column.id] = instance;
  44314. }
  44315. const tooltipVisible = vue.ref(false);
  44316. const tooltip = vue.ref(null);
  44317. const filters = vue.computed(() => {
  44318. return props.column && props.column.filters;
  44319. });
  44320. const filterClassName = vue.computed(() => {
  44321. if (props.column.filterClassName) {
  44322. return `${ns.b()} ${props.column.filterClassName}`;
  44323. }
  44324. return ns.b();
  44325. });
  44326. const filterValue = vue.computed({
  44327. get: () => {
  44328. var _a;
  44329. return (((_a = props.column) == null ? void 0 : _a.filteredValue) || [])[0];
  44330. },
  44331. set: (value) => {
  44332. if (filteredValue.value) {
  44333. if (typeof value !== "undefined" && value !== null) {
  44334. filteredValue.value.splice(0, 1, value);
  44335. } else {
  44336. filteredValue.value.splice(0, 1);
  44337. }
  44338. }
  44339. }
  44340. });
  44341. const filteredValue = vue.computed({
  44342. get() {
  44343. if (props.column) {
  44344. return props.column.filteredValue || [];
  44345. }
  44346. return [];
  44347. },
  44348. set(value) {
  44349. if (props.column) {
  44350. props.upDataColumn("filteredValue", value);
  44351. }
  44352. }
  44353. });
  44354. const multiple = vue.computed(() => {
  44355. if (props.column) {
  44356. return props.column.filterMultiple;
  44357. }
  44358. return true;
  44359. });
  44360. const isActive = (filter) => {
  44361. return filter.value === filterValue.value;
  44362. };
  44363. const hidden = () => {
  44364. tooltipVisible.value = false;
  44365. };
  44366. const showFilterPanel = (e) => {
  44367. e.stopPropagation();
  44368. tooltipVisible.value = !tooltipVisible.value;
  44369. };
  44370. const hideFilterPanel = () => {
  44371. tooltipVisible.value = false;
  44372. };
  44373. const handleConfirm = () => {
  44374. confirmFilter(filteredValue.value);
  44375. hidden();
  44376. };
  44377. const handleReset = () => {
  44378. filteredValue.value = [];
  44379. confirmFilter(filteredValue.value);
  44380. hidden();
  44381. };
  44382. const handleSelect = (_filterValue) => {
  44383. filterValue.value = _filterValue;
  44384. if (typeof _filterValue !== "undefined" && _filterValue !== null) {
  44385. confirmFilter(filteredValue.value);
  44386. } else {
  44387. confirmFilter([]);
  44388. }
  44389. hidden();
  44390. };
  44391. const confirmFilter = (filteredValue2) => {
  44392. props.store.commit("filterChange", {
  44393. column: props.column,
  44394. values: filteredValue2
  44395. });
  44396. props.store.updateAllSelected();
  44397. };
  44398. vue.watch(tooltipVisible, (value) => {
  44399. if (props.column) {
  44400. props.upDataColumn("filterOpened", value);
  44401. }
  44402. }, {
  44403. immediate: true
  44404. });
  44405. const popperPaneRef = vue.computed(() => {
  44406. var _a, _b;
  44407. return (_b = (_a = tooltip.value) == null ? void 0 : _a.popperRef) == null ? void 0 : _b.contentRef;
  44408. });
  44409. return {
  44410. tooltipVisible,
  44411. multiple,
  44412. filterClassName,
  44413. filteredValue,
  44414. filterValue,
  44415. filters,
  44416. handleConfirm,
  44417. handleReset,
  44418. handleSelect,
  44419. isActive,
  44420. t,
  44421. ns,
  44422. showFilterPanel,
  44423. hideFilterPanel,
  44424. popperPaneRef,
  44425. tooltip
  44426. };
  44427. }
  44428. });
  44429. function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
  44430. const _component_el_checkbox = vue.resolveComponent("el-checkbox");
  44431. const _component_el_checkbox_group = vue.resolveComponent("el-checkbox-group");
  44432. const _component_el_scrollbar = vue.resolveComponent("el-scrollbar");
  44433. const _component_arrow_up = vue.resolveComponent("arrow-up");
  44434. const _component_arrow_down = vue.resolveComponent("arrow-down");
  44435. const _component_el_icon = vue.resolveComponent("el-icon");
  44436. const _component_el_tooltip = vue.resolveComponent("el-tooltip");
  44437. const _directive_click_outside = vue.resolveDirective("click-outside");
  44438. return vue.openBlock(), vue.createBlock(_component_el_tooltip, {
  44439. ref: "tooltip",
  44440. visible: _ctx.tooltipVisible,
  44441. offset: 0,
  44442. placement: _ctx.placement,
  44443. "show-arrow": false,
  44444. "stop-popper-mouse-event": false,
  44445. teleported: "",
  44446. effect: "light",
  44447. pure: "",
  44448. "popper-class": _ctx.filterClassName,
  44449. persistent: "",
  44450. "append-to": _ctx.appendTo
  44451. }, {
  44452. content: vue.withCtx(() => [
  44453. _ctx.multiple ? (vue.openBlock(), vue.createElementBlock("div", { key: 0 }, [
  44454. vue.createElementVNode("div", {
  44455. class: vue.normalizeClass(_ctx.ns.e("content"))
  44456. }, [
  44457. vue.createVNode(_component_el_scrollbar, {
  44458. "wrap-class": _ctx.ns.e("wrap")
  44459. }, {
  44460. default: vue.withCtx(() => [
  44461. vue.createVNode(_component_el_checkbox_group, {
  44462. modelValue: _ctx.filteredValue,
  44463. "onUpdate:modelValue": ($event) => _ctx.filteredValue = $event,
  44464. class: vue.normalizeClass(_ctx.ns.e("checkbox-group"))
  44465. }, {
  44466. default: vue.withCtx(() => [
  44467. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.filters, (filter) => {
  44468. return vue.openBlock(), vue.createBlock(_component_el_checkbox, {
  44469. key: filter.value,
  44470. value: filter.value
  44471. }, {
  44472. default: vue.withCtx(() => [
  44473. vue.createTextVNode(vue.toDisplayString(filter.text), 1)
  44474. ]),
  44475. _: 2
  44476. }, 1032, ["value"]);
  44477. }), 128))
  44478. ]),
  44479. _: 1
  44480. }, 8, ["modelValue", "onUpdate:modelValue", "class"])
  44481. ]),
  44482. _: 1
  44483. }, 8, ["wrap-class"])
  44484. ], 2),
  44485. vue.createElementVNode("div", {
  44486. class: vue.normalizeClass(_ctx.ns.e("bottom"))
  44487. }, [
  44488. vue.createElementVNode("button", {
  44489. class: vue.normalizeClass({ [_ctx.ns.is("disabled")]: _ctx.filteredValue.length === 0 }),
  44490. disabled: _ctx.filteredValue.length === 0,
  44491. type: "button",
  44492. onClick: _ctx.handleConfirm
  44493. }, vue.toDisplayString(_ctx.t("el.table.confirmFilter")), 11, ["disabled", "onClick"]),
  44494. vue.createElementVNode("button", {
  44495. type: "button",
  44496. onClick: _ctx.handleReset
  44497. }, vue.toDisplayString(_ctx.t("el.table.resetFilter")), 9, ["onClick"])
  44498. ], 2)
  44499. ])) : (vue.openBlock(), vue.createElementBlock("ul", {
  44500. key: 1,
  44501. class: vue.normalizeClass(_ctx.ns.e("list"))
  44502. }, [
  44503. vue.createElementVNode("li", {
  44504. class: vue.normalizeClass([
  44505. _ctx.ns.e("list-item"),
  44506. {
  44507. [_ctx.ns.is("active")]: _ctx.filterValue === void 0 || _ctx.filterValue === null
  44508. }
  44509. ]),
  44510. onClick: ($event) => _ctx.handleSelect(null)
  44511. }, vue.toDisplayString(_ctx.t("el.table.clearFilter")), 11, ["onClick"]),
  44512. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.filters, (filter) => {
  44513. return vue.openBlock(), vue.createElementBlock("li", {
  44514. key: filter.value,
  44515. class: vue.normalizeClass([_ctx.ns.e("list-item"), _ctx.ns.is("active", _ctx.isActive(filter))]),
  44516. label: filter.value,
  44517. onClick: ($event) => _ctx.handleSelect(filter.value)
  44518. }, vue.toDisplayString(filter.text), 11, ["label", "onClick"]);
  44519. }), 128))
  44520. ], 2))
  44521. ]),
  44522. default: vue.withCtx(() => [
  44523. vue.withDirectives((vue.openBlock(), vue.createElementBlock("span", {
  44524. class: vue.normalizeClass([
  44525. `${_ctx.ns.namespace.value}-table__column-filter-trigger`,
  44526. `${_ctx.ns.namespace.value}-none-outline`
  44527. ]),
  44528. onClick: _ctx.showFilterPanel
  44529. }, [
  44530. vue.createVNode(_component_el_icon, null, {
  44531. default: vue.withCtx(() => [
  44532. vue.renderSlot(_ctx.$slots, "filter-icon", {}, () => [
  44533. _ctx.column.filterOpened ? (vue.openBlock(), vue.createBlock(_component_arrow_up, { key: 0 })) : (vue.openBlock(), vue.createBlock(_component_arrow_down, { key: 1 }))
  44534. ])
  44535. ]),
  44536. _: 3
  44537. })
  44538. ], 10, ["onClick"])), [
  44539. [_directive_click_outside, _ctx.hideFilterPanel, _ctx.popperPaneRef]
  44540. ])
  44541. ]),
  44542. _: 3
  44543. }, 8, ["visible", "placement", "popper-class", "append-to"]);
  44544. }
  44545. var FilterPanel = /* @__PURE__ */ _export_sfc(_sfc_main$C, [["render", _sfc_render$4], ["__file", "filter-panel.vue"]]);
  44546. function useLayoutObserver(root) {
  44547. const instance = vue.getCurrentInstance();
  44548. vue.onBeforeMount(() => {
  44549. tableLayout.value.addObserver(instance);
  44550. });
  44551. vue.onMounted(() => {
  44552. onColumnsChange(tableLayout.value);
  44553. onScrollableChange(tableLayout.value);
  44554. });
  44555. vue.onUpdated(() => {
  44556. onColumnsChange(tableLayout.value);
  44557. onScrollableChange(tableLayout.value);
  44558. });
  44559. vue.onUnmounted(() => {
  44560. tableLayout.value.removeObserver(instance);
  44561. });
  44562. const tableLayout = vue.computed(() => {
  44563. const layout = root.layout;
  44564. if (!layout) {
  44565. throw new Error("Can not find table layout.");
  44566. }
  44567. return layout;
  44568. });
  44569. const onColumnsChange = (layout) => {
  44570. var _a;
  44571. const cols = ((_a = root.vnode.el) == null ? void 0 : _a.querySelectorAll("colgroup > col")) || [];
  44572. if (!cols.length)
  44573. return;
  44574. const flattenColumns = layout.getFlattenColumns();
  44575. const columnsMap = {};
  44576. flattenColumns.forEach((column) => {
  44577. columnsMap[column.id] = column;
  44578. });
  44579. for (let i = 0, j = cols.length; i < j; i++) {
  44580. const col = cols[i];
  44581. const name = col.getAttribute("name");
  44582. const column = columnsMap[name];
  44583. if (column) {
  44584. col.setAttribute("width", column.realWidth || column.width);
  44585. }
  44586. }
  44587. };
  44588. const onScrollableChange = (layout) => {
  44589. var _a, _b;
  44590. const cols = ((_a = root.vnode.el) == null ? void 0 : _a.querySelectorAll("colgroup > col[name=gutter]")) || [];
  44591. for (let i = 0, j = cols.length; i < j; i++) {
  44592. const col = cols[i];
  44593. col.setAttribute("width", layout.scrollY.value ? layout.gutterWidth : "0");
  44594. }
  44595. const ths = ((_b = root.vnode.el) == null ? void 0 : _b.querySelectorAll("th.gutter")) || [];
  44596. for (let i = 0, j = ths.length; i < j; i++) {
  44597. const th = ths[i];
  44598. th.style.width = layout.scrollY.value ? `${layout.gutterWidth}px` : "0";
  44599. th.style.display = layout.scrollY.value ? "" : "none";
  44600. }
  44601. };
  44602. return {
  44603. tableLayout: tableLayout.value,
  44604. onColumnsChange,
  44605. onScrollableChange
  44606. };
  44607. }
  44608. const TABLE_INJECTION_KEY = Symbol("ElTable");
  44609. function useEvent(props, emit) {
  44610. const instance = vue.getCurrentInstance();
  44611. const parent = vue.inject(TABLE_INJECTION_KEY);
  44612. const handleFilterClick = (event) => {
  44613. event.stopPropagation();
  44614. return;
  44615. };
  44616. const handleHeaderClick = (event, column) => {
  44617. if (!column.filters && column.sortable) {
  44618. handleSortClick(event, column, false);
  44619. } else if (column.filterable && !column.sortable) {
  44620. handleFilterClick(event);
  44621. }
  44622. parent == null ? void 0 : parent.emit("header-click", column, event);
  44623. };
  44624. const handleHeaderContextMenu = (event, column) => {
  44625. parent == null ? void 0 : parent.emit("header-contextmenu", column, event);
  44626. };
  44627. const draggingColumn = vue.ref(null);
  44628. const dragging = vue.ref(false);
  44629. const dragState = vue.ref({});
  44630. const handleMouseDown = (event, column) => {
  44631. if (!isClient)
  44632. return;
  44633. if (column.children && column.children.length > 0)
  44634. return;
  44635. if (draggingColumn.value && props.border) {
  44636. dragging.value = true;
  44637. const table = parent;
  44638. emit("set-drag-visible", true);
  44639. const tableEl = table == null ? void 0 : table.vnode.el;
  44640. const tableLeft = tableEl.getBoundingClientRect().left;
  44641. const columnEl = instance.vnode.el.querySelector(`th.${column.id}`);
  44642. const columnRect = columnEl.getBoundingClientRect();
  44643. const minLeft = columnRect.left - tableLeft + 30;
  44644. addClass(columnEl, "noclick");
  44645. dragState.value = {
  44646. startMouseLeft: event.clientX,
  44647. startLeft: columnRect.right - tableLeft,
  44648. startColumnLeft: columnRect.left - tableLeft,
  44649. tableLeft
  44650. };
  44651. const resizeProxy = table == null ? void 0 : table.refs.resizeProxy;
  44652. resizeProxy.style.left = `${dragState.value.startLeft}px`;
  44653. document.onselectstart = function() {
  44654. return false;
  44655. };
  44656. document.ondragstart = function() {
  44657. return false;
  44658. };
  44659. const handleMouseMove2 = (event2) => {
  44660. const deltaLeft = event2.clientX - dragState.value.startMouseLeft;
  44661. const proxyLeft = dragState.value.startLeft + deltaLeft;
  44662. resizeProxy.style.left = `${Math.max(minLeft, proxyLeft)}px`;
  44663. };
  44664. const handleMouseUp = () => {
  44665. if (dragging.value) {
  44666. const { startColumnLeft, startLeft } = dragState.value;
  44667. const finalLeft = Number.parseInt(resizeProxy.style.left, 10);
  44668. const columnWidth = finalLeft - startColumnLeft;
  44669. column.width = column.realWidth = columnWidth;
  44670. table == null ? void 0 : table.emit("header-dragend", column.width, startLeft - startColumnLeft, column, event);
  44671. requestAnimationFrame(() => {
  44672. props.store.scheduleLayout(false, true);
  44673. });
  44674. document.body.style.cursor = "";
  44675. dragging.value = false;
  44676. draggingColumn.value = null;
  44677. dragState.value = {};
  44678. emit("set-drag-visible", false);
  44679. }
  44680. document.removeEventListener("mousemove", handleMouseMove2);
  44681. document.removeEventListener("mouseup", handleMouseUp);
  44682. document.onselectstart = null;
  44683. document.ondragstart = null;
  44684. setTimeout(() => {
  44685. removeClass(columnEl, "noclick");
  44686. }, 0);
  44687. };
  44688. document.addEventListener("mousemove", handleMouseMove2);
  44689. document.addEventListener("mouseup", handleMouseUp);
  44690. }
  44691. };
  44692. const handleMouseMove = (event, column) => {
  44693. var _a;
  44694. if (column.children && column.children.length > 0)
  44695. return;
  44696. const el = event.target;
  44697. if (!isElement$1(el)) {
  44698. return;
  44699. }
  44700. const target = el == null ? void 0 : el.closest("th");
  44701. if (!column || !column.resizable || !target)
  44702. return;
  44703. if (!dragging.value && props.border) {
  44704. const rect = target.getBoundingClientRect();
  44705. const bodyStyle = document.body.style;
  44706. const isLastTh = ((_a = target.parentNode) == null ? void 0 : _a.lastElementChild) === target;
  44707. if (rect.width > 12 && rect.right - event.pageX < 8 && !isLastTh) {
  44708. bodyStyle.cursor = "col-resize";
  44709. if (hasClass(target, "is-sortable")) {
  44710. target.style.cursor = "col-resize";
  44711. }
  44712. draggingColumn.value = column;
  44713. } else if (!dragging.value) {
  44714. bodyStyle.cursor = "";
  44715. if (hasClass(target, "is-sortable")) {
  44716. target.style.cursor = "pointer";
  44717. }
  44718. draggingColumn.value = null;
  44719. }
  44720. }
  44721. };
  44722. const handleMouseOut = () => {
  44723. if (!isClient)
  44724. return;
  44725. document.body.style.cursor = "";
  44726. };
  44727. const toggleOrder = ({ order, sortOrders }) => {
  44728. if (order === "")
  44729. return sortOrders[0];
  44730. const index = sortOrders.indexOf(order || null);
  44731. return sortOrders[index > sortOrders.length - 2 ? 0 : index + 1];
  44732. };
  44733. const handleSortClick = (event, column, givenOrder) => {
  44734. var _a;
  44735. event.stopPropagation();
  44736. const order = column.order === givenOrder ? null : givenOrder || toggleOrder(column);
  44737. const target = (_a = event.target) == null ? void 0 : _a.closest("th");
  44738. if (target) {
  44739. if (hasClass(target, "noclick")) {
  44740. removeClass(target, "noclick");
  44741. return;
  44742. }
  44743. }
  44744. if (!column.sortable)
  44745. return;
  44746. const clickTarget = event.currentTarget;
  44747. if (["ascending", "descending"].some((str) => hasClass(clickTarget, str) && !column.sortOrders.includes(str))) {
  44748. return;
  44749. }
  44750. const states = props.store.states;
  44751. let sortProp = states.sortProp.value;
  44752. let sortOrder;
  44753. const sortingColumn = states.sortingColumn.value;
  44754. if (sortingColumn !== column || sortingColumn === column && sortingColumn.order === null) {
  44755. if (sortingColumn) {
  44756. sortingColumn.order = null;
  44757. }
  44758. states.sortingColumn.value = column;
  44759. sortProp = column.property;
  44760. }
  44761. if (!order) {
  44762. sortOrder = column.order = null;
  44763. } else {
  44764. sortOrder = column.order = order;
  44765. }
  44766. states.sortProp.value = sortProp;
  44767. states.sortOrder.value = sortOrder;
  44768. parent == null ? void 0 : parent.store.commit("changeSortCondition");
  44769. };
  44770. return {
  44771. handleHeaderClick,
  44772. handleHeaderContextMenu,
  44773. handleMouseDown,
  44774. handleMouseMove,
  44775. handleMouseOut,
  44776. handleSortClick,
  44777. handleFilterClick
  44778. };
  44779. }
  44780. function useStyle$2(props) {
  44781. const parent = vue.inject(TABLE_INJECTION_KEY);
  44782. const ns = useNamespace("table");
  44783. const getHeaderRowStyle = (rowIndex) => {
  44784. const headerRowStyle = parent == null ? void 0 : parent.props.headerRowStyle;
  44785. if (isFunction$1(headerRowStyle)) {
  44786. return headerRowStyle.call(null, { rowIndex });
  44787. }
  44788. return headerRowStyle;
  44789. };
  44790. const getHeaderRowClass = (rowIndex) => {
  44791. const classes = [];
  44792. const headerRowClassName = parent == null ? void 0 : parent.props.headerRowClassName;
  44793. if (isString$1(headerRowClassName)) {
  44794. classes.push(headerRowClassName);
  44795. } else if (isFunction$1(headerRowClassName)) {
  44796. classes.push(headerRowClassName.call(null, { rowIndex }));
  44797. }
  44798. return classes.join(" ");
  44799. };
  44800. const getHeaderCellStyle = (rowIndex, columnIndex, row, column) => {
  44801. var _a;
  44802. let headerCellStyles = (_a = parent == null ? void 0 : parent.props.headerCellStyle) != null ? _a : {};
  44803. if (isFunction$1(headerCellStyles)) {
  44804. headerCellStyles = headerCellStyles.call(null, {
  44805. rowIndex,
  44806. columnIndex,
  44807. row,
  44808. column
  44809. });
  44810. }
  44811. const fixedStyle = getFixedColumnOffset(columnIndex, column.fixed, props.store, row);
  44812. ensurePosition(fixedStyle, "left");
  44813. ensurePosition(fixedStyle, "right");
  44814. return Object.assign({}, headerCellStyles, fixedStyle);
  44815. };
  44816. const getHeaderCellClass = (rowIndex, columnIndex, row, column) => {
  44817. const fixedClasses = getFixedColumnsClass(ns.b(), columnIndex, column.fixed, props.store, row);
  44818. const classes = [
  44819. column.id,
  44820. column.order,
  44821. column.headerAlign,
  44822. column.className,
  44823. column.labelClassName,
  44824. ...fixedClasses
  44825. ];
  44826. if (!column.children) {
  44827. classes.push("is-leaf");
  44828. }
  44829. if (column.sortable) {
  44830. classes.push("is-sortable");
  44831. }
  44832. const headerCellClassName = parent == null ? void 0 : parent.props.headerCellClassName;
  44833. if (isString$1(headerCellClassName)) {
  44834. classes.push(headerCellClassName);
  44835. } else if (isFunction$1(headerCellClassName)) {
  44836. classes.push(headerCellClassName.call(null, {
  44837. rowIndex,
  44838. columnIndex,
  44839. row,
  44840. column
  44841. }));
  44842. }
  44843. classes.push(ns.e("cell"));
  44844. return classes.filter((className) => Boolean(className)).join(" ");
  44845. };
  44846. return {
  44847. getHeaderRowStyle,
  44848. getHeaderRowClass,
  44849. getHeaderCellStyle,
  44850. getHeaderCellClass
  44851. };
  44852. }
  44853. const getAllColumns = (columns) => {
  44854. const result = [];
  44855. columns.forEach((column) => {
  44856. if (column.children) {
  44857. result.push(column);
  44858. result.push.apply(result, getAllColumns(column.children));
  44859. } else {
  44860. result.push(column);
  44861. }
  44862. });
  44863. return result;
  44864. };
  44865. const convertToRows = (originColumns) => {
  44866. let maxLevel = 1;
  44867. const traverse = (column, parent) => {
  44868. if (parent) {
  44869. column.level = parent.level + 1;
  44870. if (maxLevel < column.level) {
  44871. maxLevel = column.level;
  44872. }
  44873. }
  44874. if (column.children) {
  44875. let colSpan = 0;
  44876. column.children.forEach((subColumn) => {
  44877. traverse(subColumn, column);
  44878. colSpan += subColumn.colSpan;
  44879. });
  44880. column.colSpan = colSpan;
  44881. } else {
  44882. column.colSpan = 1;
  44883. }
  44884. };
  44885. originColumns.forEach((column) => {
  44886. column.level = 1;
  44887. traverse(column, void 0);
  44888. });
  44889. const rows = [];
  44890. for (let i = 0; i < maxLevel; i++) {
  44891. rows.push([]);
  44892. }
  44893. const allColumns = getAllColumns(originColumns);
  44894. allColumns.forEach((column) => {
  44895. if (!column.children) {
  44896. column.rowSpan = maxLevel - column.level + 1;
  44897. } else {
  44898. column.rowSpan = 1;
  44899. column.children.forEach((col) => col.isSubColumn = true);
  44900. }
  44901. rows[column.level - 1].push(column);
  44902. });
  44903. return rows;
  44904. };
  44905. function useUtils$1(props) {
  44906. const parent = vue.inject(TABLE_INJECTION_KEY);
  44907. const columnRows = vue.computed(() => {
  44908. return convertToRows(props.store.states.originColumns.value);
  44909. });
  44910. const isGroup = vue.computed(() => {
  44911. const result = columnRows.value.length > 1;
  44912. if (result && parent) {
  44913. parent.state.isGroup.value = true;
  44914. }
  44915. return result;
  44916. });
  44917. const toggleAllSelection = (event) => {
  44918. event.stopPropagation();
  44919. parent == null ? void 0 : parent.store.commit("toggleAllSelection");
  44920. };
  44921. return {
  44922. isGroup,
  44923. toggleAllSelection,
  44924. columnRows
  44925. };
  44926. }
  44927. var TableHeader = vue.defineComponent({
  44928. name: "ElTableHeader",
  44929. components: {
  44930. ElCheckbox
  44931. },
  44932. props: {
  44933. fixed: {
  44934. type: String,
  44935. default: ""
  44936. },
  44937. store: {
  44938. required: true,
  44939. type: Object
  44940. },
  44941. border: Boolean,
  44942. defaultSort: {
  44943. type: Object,
  44944. default: () => {
  44945. return {
  44946. prop: "",
  44947. order: ""
  44948. };
  44949. }
  44950. },
  44951. appendFilterPanelTo: {
  44952. type: String
  44953. }
  44954. },
  44955. setup(props, { emit }) {
  44956. const instance = vue.getCurrentInstance();
  44957. const parent = vue.inject(TABLE_INJECTION_KEY);
  44958. const ns = useNamespace("table");
  44959. const filterPanels = vue.ref({});
  44960. const { onColumnsChange, onScrollableChange } = useLayoutObserver(parent);
  44961. const isTableLayoutAuto = (parent == null ? void 0 : parent.props.tableLayout) === "auto";
  44962. const saveIndexSelection = vue.reactive(/* @__PURE__ */ new Map());
  44963. const theadRef = vue.ref();
  44964. const updateFixedColumnStyle = () => {
  44965. setTimeout(() => {
  44966. if (saveIndexSelection.size > 0) {
  44967. saveIndexSelection.forEach((column, key) => {
  44968. const el = theadRef.value.querySelector(`.${key.replace(/\s/g, ".")}`);
  44969. if (el) {
  44970. const width = el.getBoundingClientRect().width;
  44971. column.width = width;
  44972. }
  44973. });
  44974. saveIndexSelection.clear();
  44975. }
  44976. });
  44977. };
  44978. vue.watch(saveIndexSelection, updateFixedColumnStyle);
  44979. vue.onMounted(async () => {
  44980. await vue.nextTick();
  44981. await vue.nextTick();
  44982. const { prop, order } = props.defaultSort;
  44983. parent == null ? void 0 : parent.store.commit("sort", { prop, order, init: true });
  44984. updateFixedColumnStyle();
  44985. });
  44986. const {
  44987. handleHeaderClick,
  44988. handleHeaderContextMenu,
  44989. handleMouseDown,
  44990. handleMouseMove,
  44991. handleMouseOut,
  44992. handleSortClick,
  44993. handleFilterClick
  44994. } = useEvent(props, emit);
  44995. const {
  44996. getHeaderRowStyle,
  44997. getHeaderRowClass,
  44998. getHeaderCellStyle,
  44999. getHeaderCellClass
  45000. } = useStyle$2(props);
  45001. const { isGroup, toggleAllSelection, columnRows } = useUtils$1(props);
  45002. instance.state = {
  45003. onColumnsChange,
  45004. onScrollableChange
  45005. };
  45006. instance.filterPanels = filterPanels;
  45007. return {
  45008. ns,
  45009. filterPanels,
  45010. onColumnsChange,
  45011. onScrollableChange,
  45012. columnRows,
  45013. getHeaderRowClass,
  45014. getHeaderRowStyle,
  45015. getHeaderCellClass,
  45016. getHeaderCellStyle,
  45017. handleHeaderClick,
  45018. handleHeaderContextMenu,
  45019. handleMouseDown,
  45020. handleMouseMove,
  45021. handleMouseOut,
  45022. handleSortClick,
  45023. handleFilterClick,
  45024. isGroup,
  45025. toggleAllSelection,
  45026. saveIndexSelection,
  45027. isTableLayoutAuto,
  45028. theadRef,
  45029. updateFixedColumnStyle
  45030. };
  45031. },
  45032. render() {
  45033. const {
  45034. ns,
  45035. isGroup,
  45036. columnRows,
  45037. getHeaderCellStyle,
  45038. getHeaderCellClass,
  45039. getHeaderRowClass,
  45040. getHeaderRowStyle,
  45041. handleHeaderClick,
  45042. handleHeaderContextMenu,
  45043. handleMouseDown,
  45044. handleMouseMove,
  45045. handleSortClick,
  45046. handleMouseOut,
  45047. store,
  45048. $parent,
  45049. saveIndexSelection,
  45050. isTableLayoutAuto
  45051. } = this;
  45052. let rowSpan = 1;
  45053. return vue.h("thead", {
  45054. ref: "theadRef",
  45055. class: { [ns.is("group")]: isGroup }
  45056. }, columnRows.map((subColumns, rowIndex) => vue.h("tr", {
  45057. class: getHeaderRowClass(rowIndex),
  45058. key: rowIndex,
  45059. style: getHeaderRowStyle(rowIndex)
  45060. }, subColumns.map((column, cellIndex) => {
  45061. if (column.rowSpan > rowSpan) {
  45062. rowSpan = column.rowSpan;
  45063. }
  45064. const _class = getHeaderCellClass(rowIndex, cellIndex, subColumns, column);
  45065. if (isTableLayoutAuto && column.fixed) {
  45066. saveIndexSelection.set(_class, column);
  45067. }
  45068. return vue.h("th", {
  45069. class: _class,
  45070. colspan: column.colSpan,
  45071. key: `${column.id}-thead`,
  45072. rowspan: column.rowSpan,
  45073. style: getHeaderCellStyle(rowIndex, cellIndex, subColumns, column),
  45074. onClick: ($event) => {
  45075. if ($event.currentTarget.classList.contains("noclick")) {
  45076. return;
  45077. }
  45078. handleHeaderClick($event, column);
  45079. },
  45080. onContextmenu: ($event) => handleHeaderContextMenu($event, column),
  45081. onMousedown: ($event) => handleMouseDown($event, column),
  45082. onMousemove: ($event) => handleMouseMove($event, column),
  45083. onMouseout: handleMouseOut
  45084. }, [
  45085. vue.h("div", {
  45086. class: [
  45087. "cell",
  45088. column.filteredValue && column.filteredValue.length > 0 ? "highlight" : ""
  45089. ]
  45090. }, [
  45091. column.renderHeader ? column.renderHeader({
  45092. column,
  45093. $index: cellIndex,
  45094. store,
  45095. _self: $parent
  45096. }) : column.label,
  45097. column.sortable && vue.h("span", {
  45098. onClick: ($event) => handleSortClick($event, column),
  45099. class: "caret-wrapper"
  45100. }, [
  45101. vue.h("i", {
  45102. onClick: ($event) => handleSortClick($event, column, "ascending"),
  45103. class: "sort-caret ascending"
  45104. }),
  45105. vue.h("i", {
  45106. onClick: ($event) => handleSortClick($event, column, "descending"),
  45107. class: "sort-caret descending"
  45108. })
  45109. ]),
  45110. column.filterable && vue.h(FilterPanel, {
  45111. store,
  45112. placement: column.filterPlacement || "bottom-start",
  45113. appendTo: $parent.appendFilterPanelTo,
  45114. column,
  45115. upDataColumn: (key, value) => {
  45116. column[key] = value;
  45117. }
  45118. }, {
  45119. "filter-icon": () => column.renderFilterIcon ? column.renderFilterIcon({
  45120. filterOpened: column.filterOpened
  45121. }) : null
  45122. })
  45123. ])
  45124. ]);
  45125. }))));
  45126. }
  45127. });
  45128. function isGreaterThan(a, b, epsilon = 0.03) {
  45129. return a - b > epsilon;
  45130. }
  45131. function useEvents(props) {
  45132. const parent = vue.inject(TABLE_INJECTION_KEY);
  45133. const tooltipContent = vue.ref("");
  45134. const tooltipTrigger = vue.ref(vue.h("div"));
  45135. const handleEvent = (event, row, name) => {
  45136. var _a;
  45137. const table = parent;
  45138. const cell = getCell(event);
  45139. let column;
  45140. const namespace = (_a = table == null ? void 0 : table.vnode.el) == null ? void 0 : _a.dataset.prefix;
  45141. if (cell) {
  45142. column = getColumnByCell({
  45143. columns: props.store.states.columns.value
  45144. }, cell, namespace);
  45145. if (column) {
  45146. table == null ? void 0 : table.emit(`cell-${name}`, row, column, cell, event);
  45147. }
  45148. }
  45149. table == null ? void 0 : table.emit(`row-${name}`, row, column, event);
  45150. };
  45151. const handleDoubleClick = (event, row) => {
  45152. handleEvent(event, row, "dblclick");
  45153. };
  45154. const handleClick = (event, row) => {
  45155. props.store.commit("setCurrentRow", row);
  45156. handleEvent(event, row, "click");
  45157. };
  45158. const handleContextMenu = (event, row) => {
  45159. handleEvent(event, row, "contextmenu");
  45160. };
  45161. const handleMouseEnter = debounce((index) => {
  45162. props.store.commit("setHoverRow", index);
  45163. }, 30);
  45164. const handleMouseLeave = debounce(() => {
  45165. props.store.commit("setHoverRow", null);
  45166. }, 30);
  45167. const getPadding = (el) => {
  45168. const style = window.getComputedStyle(el, null);
  45169. const paddingLeft = Number.parseInt(style.paddingLeft, 10) || 0;
  45170. const paddingRight = Number.parseInt(style.paddingRight, 10) || 0;
  45171. const paddingTop = Number.parseInt(style.paddingTop, 10) || 0;
  45172. const paddingBottom = Number.parseInt(style.paddingBottom, 10) || 0;
  45173. return {
  45174. left: paddingLeft,
  45175. right: paddingRight,
  45176. top: paddingTop,
  45177. bottom: paddingBottom
  45178. };
  45179. };
  45180. const toggleRowClassByCell = (rowSpan, event, toggle) => {
  45181. let node = event.target.parentNode;
  45182. while (rowSpan > 1) {
  45183. node = node == null ? void 0 : node.nextSibling;
  45184. if (!node || node.nodeName !== "TR")
  45185. break;
  45186. toggle(node, "hover-row hover-fixed-row");
  45187. rowSpan--;
  45188. }
  45189. };
  45190. const handleCellMouseEnter = (event, row, tooltipOptions) => {
  45191. var _a;
  45192. const table = parent;
  45193. const cell = getCell(event);
  45194. const namespace = (_a = table == null ? void 0 : table.vnode.el) == null ? void 0 : _a.dataset.prefix;
  45195. if (cell) {
  45196. const column = getColumnByCell({
  45197. columns: props.store.states.columns.value
  45198. }, cell, namespace);
  45199. if (cell.rowSpan > 1) {
  45200. toggleRowClassByCell(cell.rowSpan, event, addClass);
  45201. }
  45202. const hoverState = table.hoverState = { cell, column, row };
  45203. table == null ? void 0 : table.emit("cell-mouse-enter", hoverState.row, hoverState.column, hoverState.cell, event);
  45204. }
  45205. if (!tooltipOptions) {
  45206. return;
  45207. }
  45208. const cellChild = event.target.querySelector(".cell");
  45209. if (!(hasClass(cellChild, `${namespace}-tooltip`) && cellChild.childNodes.length)) {
  45210. return;
  45211. }
  45212. const range = document.createRange();
  45213. range.setStart(cellChild, 0);
  45214. range.setEnd(cellChild, cellChild.childNodes.length);
  45215. const { width: rangeWidth, height: rangeHeight } = range.getBoundingClientRect();
  45216. const { width: cellChildWidth, height: cellChildHeight } = cellChild.getBoundingClientRect();
  45217. const { top, left, right, bottom } = getPadding(cellChild);
  45218. const horizontalPadding = left + right;
  45219. const verticalPadding = top + bottom;
  45220. if (isGreaterThan(rangeWidth + horizontalPadding, cellChildWidth) || isGreaterThan(rangeHeight + verticalPadding, cellChildHeight) || isGreaterThan(cellChild.scrollWidth, cellChildWidth)) {
  45221. createTablePopper(tooltipOptions, cell.innerText || cell.textContent, cell, table);
  45222. }
  45223. };
  45224. const handleCellMouseLeave = (event) => {
  45225. const cell = getCell(event);
  45226. if (!cell)
  45227. return;
  45228. if (cell.rowSpan > 1) {
  45229. toggleRowClassByCell(cell.rowSpan, event, removeClass);
  45230. }
  45231. const oldHoverState = parent == null ? void 0 : parent.hoverState;
  45232. parent == null ? void 0 : parent.emit("cell-mouse-leave", oldHoverState == null ? void 0 : oldHoverState.row, oldHoverState == null ? void 0 : oldHoverState.column, oldHoverState == null ? void 0 : oldHoverState.cell, event);
  45233. };
  45234. return {
  45235. handleDoubleClick,
  45236. handleClick,
  45237. handleContextMenu,
  45238. handleMouseEnter,
  45239. handleMouseLeave,
  45240. handleCellMouseEnter,
  45241. handleCellMouseLeave,
  45242. tooltipContent,
  45243. tooltipTrigger
  45244. };
  45245. }
  45246. function useStyles$1(props) {
  45247. const parent = vue.inject(TABLE_INJECTION_KEY);
  45248. const ns = useNamespace("table");
  45249. const getRowStyle = (row, rowIndex) => {
  45250. const rowStyle = parent == null ? void 0 : parent.props.rowStyle;
  45251. if (isFunction$1(rowStyle)) {
  45252. return rowStyle.call(null, {
  45253. row,
  45254. rowIndex
  45255. });
  45256. }
  45257. return rowStyle || null;
  45258. };
  45259. const getRowClass = (row, rowIndex) => {
  45260. const classes = [ns.e("row")];
  45261. if ((parent == null ? void 0 : parent.props.highlightCurrentRow) && row === props.store.states.currentRow.value) {
  45262. classes.push("current-row");
  45263. }
  45264. if (props.stripe && rowIndex % 2 === 1) {
  45265. classes.push(ns.em("row", "striped"));
  45266. }
  45267. const rowClassName = parent == null ? void 0 : parent.props.rowClassName;
  45268. if (isString$1(rowClassName)) {
  45269. classes.push(rowClassName);
  45270. } else if (isFunction$1(rowClassName)) {
  45271. classes.push(rowClassName.call(null, {
  45272. row,
  45273. rowIndex
  45274. }));
  45275. }
  45276. return classes;
  45277. };
  45278. const getCellStyle = (rowIndex, columnIndex, row, column) => {
  45279. const cellStyle = parent == null ? void 0 : parent.props.cellStyle;
  45280. let cellStyles = cellStyle != null ? cellStyle : {};
  45281. if (isFunction$1(cellStyle)) {
  45282. cellStyles = cellStyle.call(null, {
  45283. rowIndex,
  45284. columnIndex,
  45285. row,
  45286. column
  45287. });
  45288. }
  45289. const fixedStyle = getFixedColumnOffset(columnIndex, props == null ? void 0 : props.fixed, props.store);
  45290. ensurePosition(fixedStyle, "left");
  45291. ensurePosition(fixedStyle, "right");
  45292. return Object.assign({}, cellStyles, fixedStyle);
  45293. };
  45294. const getCellClass = (rowIndex, columnIndex, row, column, offset) => {
  45295. const fixedClasses = getFixedColumnsClass(ns.b(), columnIndex, props == null ? void 0 : props.fixed, props.store, void 0, offset);
  45296. const classes = [column.id, column.align, column.className, ...fixedClasses];
  45297. const cellClassName = parent == null ? void 0 : parent.props.cellClassName;
  45298. if (isString$1(cellClassName)) {
  45299. classes.push(cellClassName);
  45300. } else if (isFunction$1(cellClassName)) {
  45301. classes.push(cellClassName.call(null, {
  45302. rowIndex,
  45303. columnIndex,
  45304. row,
  45305. column
  45306. }));
  45307. }
  45308. classes.push(ns.e("cell"));
  45309. return classes.filter((className) => Boolean(className)).join(" ");
  45310. };
  45311. const getSpan = (row, column, rowIndex, columnIndex) => {
  45312. let rowspan = 1;
  45313. let colspan = 1;
  45314. const fn = parent == null ? void 0 : parent.props.spanMethod;
  45315. if (isFunction$1(fn)) {
  45316. const result = fn({
  45317. row,
  45318. column,
  45319. rowIndex,
  45320. columnIndex
  45321. });
  45322. if (isArray$1(result)) {
  45323. rowspan = result[0];
  45324. colspan = result[1];
  45325. } else if (typeof result === "object") {
  45326. rowspan = result.rowspan;
  45327. colspan = result.colspan;
  45328. }
  45329. }
  45330. return { rowspan, colspan };
  45331. };
  45332. const getColspanRealWidth = (columns, colspan, index) => {
  45333. if (colspan < 1) {
  45334. return columns[index].realWidth;
  45335. }
  45336. const widthArr = columns.map(({ realWidth, width }) => realWidth || width).slice(index, index + colspan);
  45337. return Number(widthArr.reduce((acc, width) => Number(acc) + Number(width), -1));
  45338. };
  45339. return {
  45340. getRowStyle,
  45341. getRowClass,
  45342. getCellStyle,
  45343. getCellClass,
  45344. getSpan,
  45345. getColspanRealWidth
  45346. };
  45347. }
  45348. const __default__$v = vue.defineComponent({
  45349. name: "TableTdWrapper"
  45350. });
  45351. const _sfc_main$B = /* @__PURE__ */ vue.defineComponent({
  45352. ...__default__$v,
  45353. props: {
  45354. colspan: {
  45355. type: Number,
  45356. default: 1
  45357. },
  45358. rowspan: {
  45359. type: Number,
  45360. default: 1
  45361. }
  45362. },
  45363. setup(__props) {
  45364. return (_ctx, _cache) => {
  45365. return vue.openBlock(), vue.createElementBlock("td", {
  45366. colspan: __props.colspan,
  45367. rowspan: __props.rowspan
  45368. }, [
  45369. vue.renderSlot(_ctx.$slots, "default")
  45370. ], 8, ["colspan", "rowspan"]);
  45371. };
  45372. }
  45373. });
  45374. var TdWrapper = /* @__PURE__ */ _export_sfc(_sfc_main$B, [["__file", "td-wrapper.vue"]]);
  45375. function useRender$1(props) {
  45376. const parent = vue.inject(TABLE_INJECTION_KEY);
  45377. const ns = useNamespace("table");
  45378. const {
  45379. handleDoubleClick,
  45380. handleClick,
  45381. handleContextMenu,
  45382. handleMouseEnter,
  45383. handleMouseLeave,
  45384. handleCellMouseEnter,
  45385. handleCellMouseLeave,
  45386. tooltipContent,
  45387. tooltipTrigger
  45388. } = useEvents(props);
  45389. const {
  45390. getRowStyle,
  45391. getRowClass,
  45392. getCellStyle,
  45393. getCellClass,
  45394. getSpan,
  45395. getColspanRealWidth
  45396. } = useStyles$1(props);
  45397. const firstDefaultColumnIndex = vue.computed(() => {
  45398. return props.store.states.columns.value.findIndex(({ type }) => type === "default");
  45399. });
  45400. const getKeyOfRow = (row, index) => {
  45401. const rowKey = parent.props.rowKey;
  45402. if (rowKey) {
  45403. return getRowIdentity(row, rowKey);
  45404. }
  45405. return index;
  45406. };
  45407. const rowRender = (row, $index, treeRowData, expanded = false) => {
  45408. const { tooltipEffect, tooltipOptions, store } = props;
  45409. const { indent, columns } = store.states;
  45410. const rowClasses = getRowClass(row, $index);
  45411. let display = true;
  45412. if (treeRowData) {
  45413. rowClasses.push(ns.em("row", `level-${treeRowData.level}`));
  45414. display = treeRowData.display;
  45415. }
  45416. const displayStyle = display ? null : {
  45417. display: "none"
  45418. };
  45419. return vue.h("tr", {
  45420. style: [displayStyle, getRowStyle(row, $index)],
  45421. class: rowClasses,
  45422. key: getKeyOfRow(row, $index),
  45423. onDblclick: ($event) => handleDoubleClick($event, row),
  45424. onClick: ($event) => handleClick($event, row),
  45425. onContextmenu: ($event) => handleContextMenu($event, row),
  45426. onMouseenter: () => handleMouseEnter($index),
  45427. onMouseleave: handleMouseLeave
  45428. }, columns.value.map((column, cellIndex) => {
  45429. const { rowspan, colspan } = getSpan(row, column, $index, cellIndex);
  45430. if (!rowspan || !colspan) {
  45431. return null;
  45432. }
  45433. const columnData = Object.assign({}, column);
  45434. columnData.realWidth = getColspanRealWidth(columns.value, colspan, cellIndex);
  45435. const data = {
  45436. store: props.store,
  45437. _self: props.context || parent,
  45438. column: columnData,
  45439. row,
  45440. $index,
  45441. cellIndex,
  45442. expanded
  45443. };
  45444. if (cellIndex === firstDefaultColumnIndex.value && treeRowData) {
  45445. data.treeNode = {
  45446. indent: treeRowData.level * indent.value,
  45447. level: treeRowData.level
  45448. };
  45449. if (isBoolean(treeRowData.expanded)) {
  45450. data.treeNode.expanded = treeRowData.expanded;
  45451. if ("loading" in treeRowData) {
  45452. data.treeNode.loading = treeRowData.loading;
  45453. }
  45454. if ("noLazyChildren" in treeRowData) {
  45455. data.treeNode.noLazyChildren = treeRowData.noLazyChildren;
  45456. }
  45457. }
  45458. }
  45459. const baseKey = `${getKeyOfRow(row, $index)},${cellIndex}`;
  45460. const patchKey = columnData.columnKey || columnData.rawColumnKey || "";
  45461. const mergedTooltipOptions = column.showOverflowTooltip && merge({
  45462. effect: tooltipEffect
  45463. }, tooltipOptions, column.showOverflowTooltip);
  45464. return vue.h(TdWrapper, {
  45465. style: getCellStyle($index, cellIndex, row, column),
  45466. class: getCellClass($index, cellIndex, row, column, colspan - 1),
  45467. key: `${patchKey}${baseKey}`,
  45468. rowspan,
  45469. colspan,
  45470. onMouseenter: ($event) => handleCellMouseEnter($event, row, mergedTooltipOptions),
  45471. onMouseleave: handleCellMouseLeave
  45472. }, {
  45473. default: () => cellChildren(cellIndex, column, data)
  45474. });
  45475. }));
  45476. };
  45477. const cellChildren = (cellIndex, column, data) => {
  45478. return column.renderCell(data);
  45479. };
  45480. const wrappedRowRender = (row, $index) => {
  45481. const store = props.store;
  45482. const { isRowExpanded, assertRowKey } = store;
  45483. const { treeData, lazyTreeNodeMap, childrenColumnName, rowKey } = store.states;
  45484. const columns = store.states.columns.value;
  45485. const hasExpandColumn = columns.some(({ type }) => type === "expand");
  45486. if (hasExpandColumn) {
  45487. const expanded = isRowExpanded(row);
  45488. const tr = rowRender(row, $index, void 0, expanded);
  45489. const renderExpanded = parent.renderExpanded;
  45490. if (expanded) {
  45491. if (!renderExpanded) {
  45492. console.error("[Element Error]renderExpanded is required.");
  45493. return tr;
  45494. }
  45495. return [
  45496. [
  45497. tr,
  45498. vue.h("tr", {
  45499. key: `expanded-row__${tr.key}`
  45500. }, [
  45501. vue.h("td", {
  45502. colspan: columns.length,
  45503. class: `${ns.e("cell")} ${ns.e("expanded-cell")}`
  45504. }, [renderExpanded({ row, $index, store, expanded })])
  45505. ])
  45506. ]
  45507. ];
  45508. } else {
  45509. return [[tr]];
  45510. }
  45511. } else if (Object.keys(treeData.value).length) {
  45512. assertRowKey();
  45513. const key = getRowIdentity(row, rowKey.value);
  45514. let cur = treeData.value[key];
  45515. let treeRowData = null;
  45516. if (cur) {
  45517. treeRowData = {
  45518. expanded: cur.expanded,
  45519. level: cur.level,
  45520. display: true
  45521. };
  45522. if (isBoolean(cur.lazy)) {
  45523. if (isBoolean(cur.loaded) && cur.loaded) {
  45524. treeRowData.noLazyChildren = !(cur.children && cur.children.length);
  45525. }
  45526. treeRowData.loading = cur.loading;
  45527. }
  45528. }
  45529. const tmp = [rowRender(row, $index, treeRowData)];
  45530. if (cur) {
  45531. let i = 0;
  45532. const traverse = (children, parent2) => {
  45533. if (!(children && children.length && parent2))
  45534. return;
  45535. children.forEach((node) => {
  45536. const innerTreeRowData = {
  45537. display: parent2.display && parent2.expanded,
  45538. level: parent2.level + 1,
  45539. expanded: false,
  45540. noLazyChildren: false,
  45541. loading: false
  45542. };
  45543. const childKey = getRowIdentity(node, rowKey.value);
  45544. if (childKey === void 0 || childKey === null) {
  45545. throw new Error("For nested data item, row-key is required.");
  45546. }
  45547. cur = { ...treeData.value[childKey] };
  45548. if (cur) {
  45549. innerTreeRowData.expanded = cur.expanded;
  45550. cur.level = cur.level || innerTreeRowData.level;
  45551. cur.display = !!(cur.expanded && innerTreeRowData.display);
  45552. if (isBoolean(cur.lazy)) {
  45553. if (isBoolean(cur.loaded) && cur.loaded) {
  45554. innerTreeRowData.noLazyChildren = !(cur.children && cur.children.length);
  45555. }
  45556. innerTreeRowData.loading = cur.loading;
  45557. }
  45558. }
  45559. i++;
  45560. tmp.push(rowRender(node, $index + i, innerTreeRowData));
  45561. if (cur) {
  45562. const nodes2 = lazyTreeNodeMap.value[childKey] || node[childrenColumnName.value];
  45563. traverse(nodes2, cur);
  45564. }
  45565. });
  45566. };
  45567. cur.display = true;
  45568. const nodes = lazyTreeNodeMap.value[key] || row[childrenColumnName.value];
  45569. traverse(nodes, cur);
  45570. }
  45571. return tmp;
  45572. } else {
  45573. return rowRender(row, $index, void 0);
  45574. }
  45575. };
  45576. return {
  45577. wrappedRowRender,
  45578. tooltipContent,
  45579. tooltipTrigger
  45580. };
  45581. }
  45582. const defaultProps$2 = {
  45583. store: {
  45584. required: true,
  45585. type: Object
  45586. },
  45587. stripe: Boolean,
  45588. tooltipEffect: String,
  45589. tooltipOptions: {
  45590. type: Object
  45591. },
  45592. context: {
  45593. default: () => ({}),
  45594. type: Object
  45595. },
  45596. rowClassName: [String, Function],
  45597. rowStyle: [Object, Function],
  45598. fixed: {
  45599. type: String,
  45600. default: ""
  45601. },
  45602. highlight: Boolean
  45603. };
  45604. var defaultProps$3 = defaultProps$2;
  45605. var TableBody = vue.defineComponent({
  45606. name: "ElTableBody",
  45607. props: defaultProps$3,
  45608. setup(props) {
  45609. const instance = vue.getCurrentInstance();
  45610. const parent = vue.inject(TABLE_INJECTION_KEY);
  45611. const ns = useNamespace("table");
  45612. const { wrappedRowRender, tooltipContent, tooltipTrigger } = useRender$1(props);
  45613. const { onColumnsChange, onScrollableChange } = useLayoutObserver(parent);
  45614. const hoveredCellList = [];
  45615. vue.watch(props.store.states.hoverRow, (newVal, oldVal) => {
  45616. var _a;
  45617. const el = instance == null ? void 0 : instance.vnode.el;
  45618. const rows = Array.from((el == null ? void 0 : el.children) || []).filter((e) => e == null ? void 0 : e.classList.contains(`${ns.e("row")}`));
  45619. let rowNum = newVal;
  45620. const childNodes = (_a = rows[rowNum]) == null ? void 0 : _a.childNodes;
  45621. if (childNodes == null ? void 0 : childNodes.length) {
  45622. let control = 0;
  45623. const indexes = Array.from(childNodes).reduce((acc, item, index) => {
  45624. var _a2, _b;
  45625. if (((_a2 = childNodes[index]) == null ? void 0 : _a2.colSpan) > 1) {
  45626. control = (_b = childNodes[index]) == null ? void 0 : _b.colSpan;
  45627. }
  45628. if (item.nodeName !== "TD" && control === 0) {
  45629. acc.push(index);
  45630. }
  45631. control > 0 && control--;
  45632. return acc;
  45633. }, []);
  45634. indexes.forEach((rowIndex) => {
  45635. var _a2;
  45636. rowNum = newVal;
  45637. while (rowNum > 0) {
  45638. const preChildNodes = (_a2 = rows[rowNum - 1]) == null ? void 0 : _a2.childNodes;
  45639. if (preChildNodes[rowIndex] && preChildNodes[rowIndex].nodeName === "TD" && preChildNodes[rowIndex].rowSpan > 1) {
  45640. addClass(preChildNodes[rowIndex], "hover-cell");
  45641. hoveredCellList.push(preChildNodes[rowIndex]);
  45642. break;
  45643. }
  45644. rowNum--;
  45645. }
  45646. });
  45647. } else {
  45648. hoveredCellList.forEach((item) => removeClass(item, "hover-cell"));
  45649. hoveredCellList.length = 0;
  45650. }
  45651. if (!props.store.states.isComplex.value || !isClient)
  45652. return;
  45653. rAF(() => {
  45654. const oldRow = rows[oldVal];
  45655. const newRow = rows[newVal];
  45656. if (oldRow && !oldRow.classList.contains("hover-fixed-row")) {
  45657. removeClass(oldRow, "hover-row");
  45658. }
  45659. if (newRow) {
  45660. addClass(newRow, "hover-row");
  45661. }
  45662. });
  45663. });
  45664. vue.onUnmounted(() => {
  45665. var _a;
  45666. (_a = removePopper) == null ? void 0 : _a();
  45667. });
  45668. return {
  45669. ns,
  45670. onColumnsChange,
  45671. onScrollableChange,
  45672. wrappedRowRender,
  45673. tooltipContent,
  45674. tooltipTrigger
  45675. };
  45676. },
  45677. render() {
  45678. const { wrappedRowRender, store } = this;
  45679. const data = store.states.data.value || [];
  45680. return vue.h("tbody", { tabIndex: -1 }, [
  45681. data.reduce((acc, row) => {
  45682. return acc.concat(wrappedRowRender(row, acc.length));
  45683. }, [])
  45684. ]);
  45685. }
  45686. });
  45687. function useMapState() {
  45688. const table = vue.inject(TABLE_INJECTION_KEY);
  45689. const store = table == null ? void 0 : table.store;
  45690. const leftFixedLeafCount = vue.computed(() => {
  45691. return store.states.fixedLeafColumnsLength.value;
  45692. });
  45693. const rightFixedLeafCount = vue.computed(() => {
  45694. return store.states.rightFixedColumns.value.length;
  45695. });
  45696. const columnsCount = vue.computed(() => {
  45697. return store.states.columns.value.length;
  45698. });
  45699. const leftFixedCount = vue.computed(() => {
  45700. return store.states.fixedColumns.value.length;
  45701. });
  45702. const rightFixedCount = vue.computed(() => {
  45703. return store.states.rightFixedColumns.value.length;
  45704. });
  45705. return {
  45706. leftFixedLeafCount,
  45707. rightFixedLeafCount,
  45708. columnsCount,
  45709. leftFixedCount,
  45710. rightFixedCount,
  45711. columns: store.states.columns
  45712. };
  45713. }
  45714. function useStyle$1(props) {
  45715. const { columns } = useMapState();
  45716. const ns = useNamespace("table");
  45717. const getCellClasses = (columns2, cellIndex) => {
  45718. const column = columns2[cellIndex];
  45719. const classes = [
  45720. ns.e("cell"),
  45721. column.id,
  45722. column.align,
  45723. column.labelClassName,
  45724. ...getFixedColumnsClass(ns.b(), cellIndex, column.fixed, props.store)
  45725. ];
  45726. if (column.className) {
  45727. classes.push(column.className);
  45728. }
  45729. if (!column.children) {
  45730. classes.push(ns.is("leaf"));
  45731. }
  45732. return classes;
  45733. };
  45734. const getCellStyles = (column, cellIndex) => {
  45735. const fixedStyle = getFixedColumnOffset(cellIndex, column.fixed, props.store);
  45736. ensurePosition(fixedStyle, "left");
  45737. ensurePosition(fixedStyle, "right");
  45738. return fixedStyle;
  45739. };
  45740. return {
  45741. getCellClasses,
  45742. getCellStyles,
  45743. columns
  45744. };
  45745. }
  45746. var TableFooter = vue.defineComponent({
  45747. name: "ElTableFooter",
  45748. props: {
  45749. fixed: {
  45750. type: String,
  45751. default: ""
  45752. },
  45753. store: {
  45754. required: true,
  45755. type: Object
  45756. },
  45757. summaryMethod: Function,
  45758. sumText: String,
  45759. border: Boolean,
  45760. defaultSort: {
  45761. type: Object,
  45762. default: () => {
  45763. return {
  45764. prop: "",
  45765. order: ""
  45766. };
  45767. }
  45768. }
  45769. },
  45770. setup(props) {
  45771. const { getCellClasses, getCellStyles, columns } = useStyle$1(props);
  45772. const ns = useNamespace("table");
  45773. return {
  45774. ns,
  45775. getCellClasses,
  45776. getCellStyles,
  45777. columns
  45778. };
  45779. },
  45780. render() {
  45781. const { columns, getCellStyles, getCellClasses, summaryMethod, sumText } = this;
  45782. const data = this.store.states.data.value;
  45783. let sums = [];
  45784. if (summaryMethod) {
  45785. sums = summaryMethod({
  45786. columns,
  45787. data
  45788. });
  45789. } else {
  45790. columns.forEach((column, index) => {
  45791. if (index === 0) {
  45792. sums[index] = sumText;
  45793. return;
  45794. }
  45795. const values = data.map((item) => Number(item[column.property]));
  45796. const precisions = [];
  45797. let notNumber = true;
  45798. values.forEach((value) => {
  45799. if (!Number.isNaN(+value)) {
  45800. notNumber = false;
  45801. const decimal = `${value}`.split(".")[1];
  45802. precisions.push(decimal ? decimal.length : 0);
  45803. }
  45804. });
  45805. const precision = Math.max.apply(null, precisions);
  45806. if (!notNumber) {
  45807. sums[index] = values.reduce((prev, curr) => {
  45808. const value = Number(curr);
  45809. if (!Number.isNaN(+value)) {
  45810. return Number.parseFloat((prev + curr).toFixed(Math.min(precision, 20)));
  45811. } else {
  45812. return prev;
  45813. }
  45814. }, 0);
  45815. } else {
  45816. sums[index] = "";
  45817. }
  45818. });
  45819. }
  45820. return vue.h(vue.h("tfoot", [
  45821. vue.h("tr", {}, [
  45822. ...columns.map((column, cellIndex) => vue.h("td", {
  45823. key: cellIndex,
  45824. colspan: column.colSpan,
  45825. rowspan: column.rowSpan,
  45826. class: getCellClasses(columns, cellIndex),
  45827. style: getCellStyles(column, cellIndex)
  45828. }, [
  45829. vue.h("div", {
  45830. class: ["cell", column.labelClassName]
  45831. }, [sums[cellIndex]])
  45832. ]))
  45833. ])
  45834. ]));
  45835. }
  45836. });
  45837. function useUtils(store) {
  45838. const setCurrentRow = (row) => {
  45839. store.commit("setCurrentRow", row);
  45840. };
  45841. const getSelectionRows = () => {
  45842. return store.getSelectionRows();
  45843. };
  45844. const toggleRowSelection = (row, selected, ignoreSelectable = true) => {
  45845. store.toggleRowSelection(row, selected, false, ignoreSelectable);
  45846. store.updateAllSelected();
  45847. };
  45848. const clearSelection = () => {
  45849. store.clearSelection();
  45850. };
  45851. const clearFilter = (columnKeys) => {
  45852. store.clearFilter(columnKeys);
  45853. };
  45854. const toggleAllSelection = () => {
  45855. store.commit("toggleAllSelection");
  45856. };
  45857. const toggleRowExpansion = (row, expanded) => {
  45858. store.toggleRowExpansionAdapter(row, expanded);
  45859. };
  45860. const clearSort = () => {
  45861. store.clearSort();
  45862. };
  45863. const sort = (prop, order) => {
  45864. store.commit("sort", { prop, order });
  45865. };
  45866. const updateKeyChildren = (key, data) => {
  45867. store.updateKeyChildren(key, data);
  45868. };
  45869. return {
  45870. setCurrentRow,
  45871. getSelectionRows,
  45872. toggleRowSelection,
  45873. clearSelection,
  45874. clearFilter,
  45875. toggleAllSelection,
  45876. toggleRowExpansion,
  45877. clearSort,
  45878. sort,
  45879. updateKeyChildren
  45880. };
  45881. }
  45882. function useStyle(props, layout, store, table) {
  45883. const isHidden = vue.ref(false);
  45884. const renderExpanded = vue.ref(null);
  45885. const resizeProxyVisible = vue.ref(false);
  45886. const setDragVisible = (visible) => {
  45887. resizeProxyVisible.value = visible;
  45888. };
  45889. const resizeState = vue.ref({
  45890. width: null,
  45891. height: null,
  45892. headerHeight: null
  45893. });
  45894. const isGroup = vue.ref(false);
  45895. const scrollbarViewStyle = {
  45896. display: "inline-block",
  45897. verticalAlign: "middle"
  45898. };
  45899. const tableWidth = vue.ref();
  45900. const tableScrollHeight = vue.ref(0);
  45901. const bodyScrollHeight = vue.ref(0);
  45902. const headerScrollHeight = vue.ref(0);
  45903. const footerScrollHeight = vue.ref(0);
  45904. const appendScrollHeight = vue.ref(0);
  45905. vue.watchEffect(() => {
  45906. layout.setHeight(props.height);
  45907. });
  45908. vue.watchEffect(() => {
  45909. layout.setMaxHeight(props.maxHeight);
  45910. });
  45911. vue.watch(() => [props.currentRowKey, store.states.rowKey], ([currentRowKey, rowKey]) => {
  45912. if (!vue.unref(rowKey) || !vue.unref(currentRowKey))
  45913. return;
  45914. store.setCurrentRowKey(`${currentRowKey}`);
  45915. }, {
  45916. immediate: true
  45917. });
  45918. vue.watch(() => props.data, (data) => {
  45919. table.store.commit("setData", data);
  45920. }, {
  45921. immediate: true,
  45922. deep: true
  45923. });
  45924. vue.watchEffect(() => {
  45925. if (props.expandRowKeys) {
  45926. store.setExpandRowKeysAdapter(props.expandRowKeys);
  45927. }
  45928. });
  45929. const handleMouseLeave = () => {
  45930. table.store.commit("setHoverRow", null);
  45931. if (table.hoverState)
  45932. table.hoverState = null;
  45933. };
  45934. const handleHeaderFooterMousewheel = (event, data) => {
  45935. const { pixelX, pixelY } = data;
  45936. if (Math.abs(pixelX) >= Math.abs(pixelY)) {
  45937. table.refs.bodyWrapper.scrollLeft += data.pixelX / 5;
  45938. }
  45939. };
  45940. const shouldUpdateHeight = vue.computed(() => {
  45941. return props.height || props.maxHeight || store.states.fixedColumns.value.length > 0 || store.states.rightFixedColumns.value.length > 0;
  45942. });
  45943. const tableBodyStyles = vue.computed(() => {
  45944. return {
  45945. width: layout.bodyWidth.value ? `${layout.bodyWidth.value}px` : ""
  45946. };
  45947. });
  45948. const doLayout = () => {
  45949. if (shouldUpdateHeight.value) {
  45950. layout.updateElsHeight();
  45951. }
  45952. layout.updateColumnsWidth();
  45953. requestAnimationFrame(syncPosition);
  45954. };
  45955. vue.onMounted(async () => {
  45956. await vue.nextTick();
  45957. store.updateColumns();
  45958. bindEvents();
  45959. requestAnimationFrame(doLayout);
  45960. const el = table.vnode.el;
  45961. const tableHeader = table.refs.headerWrapper;
  45962. if (props.flexible && el && el.parentElement) {
  45963. el.parentElement.style.minWidth = "0";
  45964. }
  45965. resizeState.value = {
  45966. width: tableWidth.value = el.offsetWidth,
  45967. height: el.offsetHeight,
  45968. headerHeight: props.showHeader && tableHeader ? tableHeader.offsetHeight : null
  45969. };
  45970. store.states.columns.value.forEach((column) => {
  45971. if (column.filteredValue && column.filteredValue.length) {
  45972. table.store.commit("filterChange", {
  45973. column,
  45974. values: column.filteredValue,
  45975. silent: true
  45976. });
  45977. }
  45978. });
  45979. table.$ready = true;
  45980. });
  45981. const setScrollClassByEl = (el, className) => {
  45982. if (!el)
  45983. return;
  45984. const classList = Array.from(el.classList).filter((item) => !item.startsWith("is-scrolling-"));
  45985. classList.push(layout.scrollX.value ? className : "is-scrolling-none");
  45986. el.className = classList.join(" ");
  45987. };
  45988. const setScrollClass = (className) => {
  45989. const { tableWrapper } = table.refs;
  45990. setScrollClassByEl(tableWrapper, className);
  45991. };
  45992. const hasScrollClass = (className) => {
  45993. const { tableWrapper } = table.refs;
  45994. return !!(tableWrapper && tableWrapper.classList.contains(className));
  45995. };
  45996. const syncPosition = function() {
  45997. if (!table.refs.scrollBarRef)
  45998. return;
  45999. if (!layout.scrollX.value) {
  46000. const scrollingNoneClass = "is-scrolling-none";
  46001. if (!hasScrollClass(scrollingNoneClass)) {
  46002. setScrollClass(scrollingNoneClass);
  46003. }
  46004. return;
  46005. }
  46006. const scrollContainer = table.refs.scrollBarRef.wrapRef;
  46007. if (!scrollContainer)
  46008. return;
  46009. const { scrollLeft, offsetWidth, scrollWidth } = scrollContainer;
  46010. const { headerWrapper, footerWrapper } = table.refs;
  46011. if (headerWrapper)
  46012. headerWrapper.scrollLeft = scrollLeft;
  46013. if (footerWrapper)
  46014. footerWrapper.scrollLeft = scrollLeft;
  46015. const maxScrollLeftPosition = scrollWidth - offsetWidth - 1;
  46016. if (scrollLeft >= maxScrollLeftPosition) {
  46017. setScrollClass("is-scrolling-right");
  46018. } else if (scrollLeft === 0) {
  46019. setScrollClass("is-scrolling-left");
  46020. } else {
  46021. setScrollClass("is-scrolling-middle");
  46022. }
  46023. };
  46024. const bindEvents = () => {
  46025. if (!table.refs.scrollBarRef)
  46026. return;
  46027. if (table.refs.scrollBarRef.wrapRef) {
  46028. useEventListener(table.refs.scrollBarRef.wrapRef, "scroll", syncPosition, {
  46029. passive: true
  46030. });
  46031. }
  46032. if (props.fit) {
  46033. useResizeObserver(table.vnode.el, resizeListener);
  46034. } else {
  46035. useEventListener(window, "resize", resizeListener);
  46036. }
  46037. useResizeObserver(table.refs.bodyWrapper, () => {
  46038. var _a, _b;
  46039. resizeListener();
  46040. (_b = (_a = table.refs) == null ? void 0 : _a.scrollBarRef) == null ? void 0 : _b.update();
  46041. });
  46042. };
  46043. const resizeListener = () => {
  46044. var _a, _b, _c, _d;
  46045. const el = table.vnode.el;
  46046. if (!table.$ready || !el)
  46047. return;
  46048. let shouldUpdateLayout = false;
  46049. const {
  46050. width: oldWidth,
  46051. height: oldHeight,
  46052. headerHeight: oldHeaderHeight
  46053. } = resizeState.value;
  46054. const width = tableWidth.value = el.offsetWidth;
  46055. if (oldWidth !== width) {
  46056. shouldUpdateLayout = true;
  46057. }
  46058. const height = el.offsetHeight;
  46059. if ((props.height || shouldUpdateHeight.value) && oldHeight !== height) {
  46060. shouldUpdateLayout = true;
  46061. }
  46062. const tableHeader = props.tableLayout === "fixed" ? table.refs.headerWrapper : (_a = table.refs.tableHeaderRef) == null ? void 0 : _a.$el;
  46063. if (props.showHeader && (tableHeader == null ? void 0 : tableHeader.offsetHeight) !== oldHeaderHeight) {
  46064. shouldUpdateLayout = true;
  46065. }
  46066. tableScrollHeight.value = ((_b = table.refs.tableWrapper) == null ? void 0 : _b.scrollHeight) || 0;
  46067. headerScrollHeight.value = (tableHeader == null ? void 0 : tableHeader.scrollHeight) || 0;
  46068. footerScrollHeight.value = ((_c = table.refs.footerWrapper) == null ? void 0 : _c.offsetHeight) || 0;
  46069. appendScrollHeight.value = ((_d = table.refs.appendWrapper) == null ? void 0 : _d.offsetHeight) || 0;
  46070. bodyScrollHeight.value = tableScrollHeight.value - headerScrollHeight.value - footerScrollHeight.value - appendScrollHeight.value;
  46071. if (shouldUpdateLayout) {
  46072. resizeState.value = {
  46073. width,
  46074. height,
  46075. headerHeight: props.showHeader && (tableHeader == null ? void 0 : tableHeader.offsetHeight) || 0
  46076. };
  46077. doLayout();
  46078. }
  46079. };
  46080. const tableSize = useFormSize();
  46081. const bodyWidth = vue.computed(() => {
  46082. const { bodyWidth: bodyWidth_, scrollY, gutterWidth } = layout;
  46083. return bodyWidth_.value ? `${bodyWidth_.value - (scrollY.value ? gutterWidth : 0)}px` : "";
  46084. });
  46085. const tableLayout = vue.computed(() => {
  46086. if (props.maxHeight)
  46087. return "fixed";
  46088. return props.tableLayout;
  46089. });
  46090. const emptyBlockStyle = vue.computed(() => {
  46091. if (props.data && props.data.length)
  46092. return null;
  46093. let height = "100%";
  46094. if (props.height && bodyScrollHeight.value) {
  46095. height = `${bodyScrollHeight.value}px`;
  46096. }
  46097. const width = tableWidth.value;
  46098. return {
  46099. width: width ? `${width}px` : "",
  46100. height
  46101. };
  46102. });
  46103. const scrollbarStyle = vue.computed(() => {
  46104. if (props.height) {
  46105. return {
  46106. height: "100%"
  46107. };
  46108. }
  46109. if (props.maxHeight) {
  46110. if (!Number.isNaN(Number(props.maxHeight))) {
  46111. return {
  46112. maxHeight: `${props.maxHeight - headerScrollHeight.value - footerScrollHeight.value}px`
  46113. };
  46114. } else {
  46115. return {
  46116. maxHeight: `calc(${props.maxHeight} - ${headerScrollHeight.value + footerScrollHeight.value}px)`
  46117. };
  46118. }
  46119. }
  46120. return {};
  46121. });
  46122. const handleFixedMousewheel = (event, data) => {
  46123. const bodyWrapper = table.refs.bodyWrapper;
  46124. if (Math.abs(data.spinY) > 0) {
  46125. const currentScrollTop = bodyWrapper.scrollTop;
  46126. if (data.pixelY < 0 && currentScrollTop !== 0) {
  46127. event.preventDefault();
  46128. }
  46129. if (data.pixelY > 0 && bodyWrapper.scrollHeight - bodyWrapper.clientHeight > currentScrollTop) {
  46130. event.preventDefault();
  46131. }
  46132. bodyWrapper.scrollTop += Math.ceil(data.pixelY / 5);
  46133. } else {
  46134. bodyWrapper.scrollLeft += Math.ceil(data.pixelX / 5);
  46135. }
  46136. };
  46137. return {
  46138. isHidden,
  46139. renderExpanded,
  46140. setDragVisible,
  46141. isGroup,
  46142. handleMouseLeave,
  46143. handleHeaderFooterMousewheel,
  46144. tableSize,
  46145. emptyBlockStyle,
  46146. handleFixedMousewheel,
  46147. resizeProxyVisible,
  46148. bodyWidth,
  46149. resizeState,
  46150. doLayout,
  46151. tableBodyStyles,
  46152. tableLayout,
  46153. scrollbarViewStyle,
  46154. scrollbarStyle
  46155. };
  46156. }
  46157. function useKeyRender(table) {
  46158. const observer = vue.ref();
  46159. const initWatchDom = () => {
  46160. const el = table.vnode.el;
  46161. const columnsWrapper = el.querySelector(".hidden-columns");
  46162. const config = { childList: true, subtree: true };
  46163. const updateOrderFns = table.store.states.updateOrderFns;
  46164. observer.value = new MutationObserver(() => {
  46165. updateOrderFns.forEach((fn) => fn());
  46166. });
  46167. observer.value.observe(columnsWrapper, config);
  46168. };
  46169. vue.onMounted(() => {
  46170. initWatchDom();
  46171. });
  46172. vue.onUnmounted(() => {
  46173. var _a;
  46174. (_a = observer.value) == null ? void 0 : _a.disconnect();
  46175. });
  46176. }
  46177. var defaultProps$1 = {
  46178. data: {
  46179. type: Array,
  46180. default: () => []
  46181. },
  46182. size: useSizeProp,
  46183. width: [String, Number],
  46184. height: [String, Number],
  46185. maxHeight: [String, Number],
  46186. fit: {
  46187. type: Boolean,
  46188. default: true
  46189. },
  46190. stripe: Boolean,
  46191. border: Boolean,
  46192. rowKey: [String, Function],
  46193. showHeader: {
  46194. type: Boolean,
  46195. default: true
  46196. },
  46197. showSummary: Boolean,
  46198. sumText: String,
  46199. summaryMethod: Function,
  46200. rowClassName: [String, Function],
  46201. rowStyle: [Object, Function],
  46202. cellClassName: [String, Function],
  46203. cellStyle: [Object, Function],
  46204. headerRowClassName: [String, Function],
  46205. headerRowStyle: [Object, Function],
  46206. headerCellClassName: [String, Function],
  46207. headerCellStyle: [Object, Function],
  46208. highlightCurrentRow: Boolean,
  46209. currentRowKey: [String, Number],
  46210. emptyText: String,
  46211. expandRowKeys: Array,
  46212. defaultExpandAll: Boolean,
  46213. defaultSort: Object,
  46214. tooltipEffect: String,
  46215. tooltipOptions: Object,
  46216. spanMethod: Function,
  46217. selectOnIndeterminate: {
  46218. type: Boolean,
  46219. default: true
  46220. },
  46221. indent: {
  46222. type: Number,
  46223. default: 16
  46224. },
  46225. treeProps: {
  46226. type: Object,
  46227. default: () => {
  46228. return {
  46229. hasChildren: "hasChildren",
  46230. children: "children",
  46231. checkStrictly: false
  46232. };
  46233. }
  46234. },
  46235. lazy: Boolean,
  46236. load: Function,
  46237. style: {
  46238. type: Object,
  46239. default: () => ({})
  46240. },
  46241. className: {
  46242. type: String,
  46243. default: ""
  46244. },
  46245. tableLayout: {
  46246. type: String,
  46247. default: "fixed"
  46248. },
  46249. scrollbarAlwaysOn: Boolean,
  46250. flexible: Boolean,
  46251. showOverflowTooltip: [Boolean, Object],
  46252. appendFilterPanelTo: String,
  46253. scrollbarTabindex: {
  46254. type: [Number, String],
  46255. default: void 0
  46256. }
  46257. };
  46258. function hColgroup(props) {
  46259. const isAuto = props.tableLayout === "auto";
  46260. let columns = props.columns || [];
  46261. if (isAuto) {
  46262. if (columns.every((column) => column.width === void 0)) {
  46263. columns = [];
  46264. }
  46265. }
  46266. const getPropsData = (column) => {
  46267. const propsData = {
  46268. key: `${props.tableLayout}_${column.id}`,
  46269. style: {},
  46270. name: void 0
  46271. };
  46272. if (isAuto) {
  46273. propsData.style = {
  46274. width: `${column.width}px`
  46275. };
  46276. } else {
  46277. propsData.name = column.id;
  46278. }
  46279. return propsData;
  46280. };
  46281. return vue.h("colgroup", {}, columns.map((column) => vue.h("col", getPropsData(column))));
  46282. }
  46283. hColgroup.props = ["columns", "tableLayout"];
  46284. const useScrollbar$1 = () => {
  46285. const scrollBarRef = vue.ref();
  46286. const scrollTo = (options, yCoord) => {
  46287. const scrollbar = scrollBarRef.value;
  46288. if (scrollbar) {
  46289. scrollbar.scrollTo(options, yCoord);
  46290. }
  46291. };
  46292. const setScrollPosition = (position, offset) => {
  46293. const scrollbar = scrollBarRef.value;
  46294. if (scrollbar && isNumber(offset) && ["Top", "Left"].includes(position)) {
  46295. scrollbar[`setScroll${position}`](offset);
  46296. }
  46297. };
  46298. const setScrollTop = (top) => setScrollPosition("Top", top);
  46299. const setScrollLeft = (left) => setScrollPosition("Left", left);
  46300. return {
  46301. scrollBarRef,
  46302. scrollTo,
  46303. setScrollTop,
  46304. setScrollLeft
  46305. };
  46306. };
  46307. let tableIdSeed = 1;
  46308. const _sfc_main$A = vue.defineComponent({
  46309. name: "ElTable",
  46310. directives: {
  46311. Mousewheel
  46312. },
  46313. components: {
  46314. TableHeader,
  46315. TableBody,
  46316. TableFooter,
  46317. ElScrollbar,
  46318. hColgroup
  46319. },
  46320. props: defaultProps$1,
  46321. emits: [
  46322. "select",
  46323. "select-all",
  46324. "selection-change",
  46325. "cell-mouse-enter",
  46326. "cell-mouse-leave",
  46327. "cell-contextmenu",
  46328. "cell-click",
  46329. "cell-dblclick",
  46330. "row-click",
  46331. "row-contextmenu",
  46332. "row-dblclick",
  46333. "header-click",
  46334. "header-contextmenu",
  46335. "sort-change",
  46336. "filter-change",
  46337. "current-change",
  46338. "header-dragend",
  46339. "expand-change",
  46340. "scroll"
  46341. ],
  46342. setup(props) {
  46343. const { t } = useLocale();
  46344. const ns = useNamespace("table");
  46345. const table = vue.getCurrentInstance();
  46346. vue.provide(TABLE_INJECTION_KEY, table);
  46347. const store = createStore(table, props);
  46348. table.store = store;
  46349. const layout = new TableLayout$1({
  46350. store: table.store,
  46351. table,
  46352. fit: props.fit,
  46353. showHeader: props.showHeader
  46354. });
  46355. table.layout = layout;
  46356. const isEmpty = vue.computed(() => (store.states.data.value || []).length === 0);
  46357. const {
  46358. setCurrentRow,
  46359. getSelectionRows,
  46360. toggleRowSelection,
  46361. clearSelection,
  46362. clearFilter,
  46363. toggleAllSelection,
  46364. toggleRowExpansion,
  46365. clearSort,
  46366. sort,
  46367. updateKeyChildren
  46368. } = useUtils(store);
  46369. const {
  46370. isHidden,
  46371. renderExpanded,
  46372. setDragVisible,
  46373. isGroup,
  46374. handleMouseLeave,
  46375. handleHeaderFooterMousewheel,
  46376. tableSize,
  46377. emptyBlockStyle,
  46378. handleFixedMousewheel,
  46379. resizeProxyVisible,
  46380. bodyWidth,
  46381. resizeState,
  46382. doLayout,
  46383. tableBodyStyles,
  46384. tableLayout,
  46385. scrollbarViewStyle,
  46386. scrollbarStyle
  46387. } = useStyle(props, layout, store, table);
  46388. const { scrollBarRef, scrollTo, setScrollLeft, setScrollTop } = useScrollbar$1();
  46389. const debouncedUpdateLayout = debounce(doLayout, 50);
  46390. const tableId = `${ns.namespace.value}-table_${tableIdSeed++}`;
  46391. table.tableId = tableId;
  46392. table.state = {
  46393. isGroup,
  46394. resizeState,
  46395. doLayout,
  46396. debouncedUpdateLayout
  46397. };
  46398. const computedSumText = vue.computed(() => {
  46399. var _a;
  46400. return (_a = props.sumText) != null ? _a : t("el.table.sumText");
  46401. });
  46402. const computedEmptyText = vue.computed(() => {
  46403. var _a;
  46404. return (_a = props.emptyText) != null ? _a : t("el.table.emptyText");
  46405. });
  46406. const columns = vue.computed(() => {
  46407. return convertToRows(store.states.originColumns.value)[0];
  46408. });
  46409. useKeyRender(table);
  46410. vue.onBeforeUnmount(() => {
  46411. debouncedUpdateLayout.cancel();
  46412. });
  46413. return {
  46414. ns,
  46415. layout,
  46416. store,
  46417. columns,
  46418. handleHeaderFooterMousewheel,
  46419. handleMouseLeave,
  46420. tableId,
  46421. tableSize,
  46422. isHidden,
  46423. isEmpty,
  46424. renderExpanded,
  46425. resizeProxyVisible,
  46426. resizeState,
  46427. isGroup,
  46428. bodyWidth,
  46429. tableBodyStyles,
  46430. emptyBlockStyle,
  46431. debouncedUpdateLayout,
  46432. handleFixedMousewheel,
  46433. setCurrentRow,
  46434. getSelectionRows,
  46435. toggleRowSelection,
  46436. clearSelection,
  46437. clearFilter,
  46438. toggleAllSelection,
  46439. toggleRowExpansion,
  46440. clearSort,
  46441. doLayout,
  46442. sort,
  46443. updateKeyChildren,
  46444. t,
  46445. setDragVisible,
  46446. context: table,
  46447. computedSumText,
  46448. computedEmptyText,
  46449. tableLayout,
  46450. scrollbarViewStyle,
  46451. scrollbarStyle,
  46452. scrollBarRef,
  46453. scrollTo,
  46454. setScrollLeft,
  46455. setScrollTop
  46456. };
  46457. }
  46458. });
  46459. function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
  46460. const _component_hColgroup = vue.resolveComponent("hColgroup");
  46461. const _component_table_header = vue.resolveComponent("table-header");
  46462. const _component_table_body = vue.resolveComponent("table-body");
  46463. const _component_table_footer = vue.resolveComponent("table-footer");
  46464. const _component_el_scrollbar = vue.resolveComponent("el-scrollbar");
  46465. const _directive_mousewheel = vue.resolveDirective("mousewheel");
  46466. return vue.openBlock(), vue.createElementBlock("div", {
  46467. ref: "tableWrapper",
  46468. class: vue.normalizeClass([
  46469. {
  46470. [_ctx.ns.m("fit")]: _ctx.fit,
  46471. [_ctx.ns.m("striped")]: _ctx.stripe,
  46472. [_ctx.ns.m("border")]: _ctx.border || _ctx.isGroup,
  46473. [_ctx.ns.m("hidden")]: _ctx.isHidden,
  46474. [_ctx.ns.m("group")]: _ctx.isGroup,
  46475. [_ctx.ns.m("fluid-height")]: _ctx.maxHeight,
  46476. [_ctx.ns.m("scrollable-x")]: _ctx.layout.scrollX.value,
  46477. [_ctx.ns.m("scrollable-y")]: _ctx.layout.scrollY.value,
  46478. [_ctx.ns.m("enable-row-hover")]: !_ctx.store.states.isComplex.value,
  46479. [_ctx.ns.m("enable-row-transition")]: (_ctx.store.states.data.value || []).length !== 0 && (_ctx.store.states.data.value || []).length < 100,
  46480. "has-footer": _ctx.showSummary
  46481. },
  46482. _ctx.ns.m(_ctx.tableSize),
  46483. _ctx.className,
  46484. _ctx.ns.b(),
  46485. _ctx.ns.m(`layout-${_ctx.tableLayout}`)
  46486. ]),
  46487. style: vue.normalizeStyle(_ctx.style),
  46488. "data-prefix": _ctx.ns.namespace.value,
  46489. onMouseleave: _ctx.handleMouseLeave
  46490. }, [
  46491. vue.createElementVNode("div", {
  46492. class: vue.normalizeClass(_ctx.ns.e("inner-wrapper"))
  46493. }, [
  46494. vue.createElementVNode("div", {
  46495. ref: "hiddenColumns",
  46496. class: "hidden-columns"
  46497. }, [
  46498. vue.renderSlot(_ctx.$slots, "default")
  46499. ], 512),
  46500. _ctx.showHeader && _ctx.tableLayout === "fixed" ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  46501. key: 0,
  46502. ref: "headerWrapper",
  46503. class: vue.normalizeClass(_ctx.ns.e("header-wrapper"))
  46504. }, [
  46505. vue.createElementVNode("table", {
  46506. ref: "tableHeader",
  46507. class: vue.normalizeClass(_ctx.ns.e("header")),
  46508. style: vue.normalizeStyle(_ctx.tableBodyStyles),
  46509. border: "0",
  46510. cellpadding: "0",
  46511. cellspacing: "0"
  46512. }, [
  46513. vue.createVNode(_component_hColgroup, {
  46514. columns: _ctx.store.states.columns.value,
  46515. "table-layout": _ctx.tableLayout
  46516. }, null, 8, ["columns", "table-layout"]),
  46517. vue.createVNode(_component_table_header, {
  46518. ref: "tableHeaderRef",
  46519. border: _ctx.border,
  46520. "default-sort": _ctx.defaultSort,
  46521. store: _ctx.store,
  46522. "append-filter-panel-to": _ctx.appendFilterPanelTo,
  46523. onSetDragVisible: _ctx.setDragVisible
  46524. }, null, 8, ["border", "default-sort", "store", "append-filter-panel-to", "onSetDragVisible"])
  46525. ], 6)
  46526. ], 2)), [
  46527. [_directive_mousewheel, _ctx.handleHeaderFooterMousewheel]
  46528. ]) : vue.createCommentVNode("v-if", true),
  46529. vue.createElementVNode("div", {
  46530. ref: "bodyWrapper",
  46531. class: vue.normalizeClass(_ctx.ns.e("body-wrapper"))
  46532. }, [
  46533. vue.createVNode(_component_el_scrollbar, {
  46534. ref: "scrollBarRef",
  46535. "view-style": _ctx.scrollbarViewStyle,
  46536. "wrap-style": _ctx.scrollbarStyle,
  46537. always: _ctx.scrollbarAlwaysOn,
  46538. tabindex: _ctx.scrollbarTabindex,
  46539. onScroll: ($event) => _ctx.$emit("scroll", $event)
  46540. }, {
  46541. default: vue.withCtx(() => [
  46542. vue.createElementVNode("table", {
  46543. ref: "tableBody",
  46544. class: vue.normalizeClass(_ctx.ns.e("body")),
  46545. cellspacing: "0",
  46546. cellpadding: "0",
  46547. border: "0",
  46548. style: vue.normalizeStyle({
  46549. width: _ctx.bodyWidth,
  46550. tableLayout: _ctx.tableLayout
  46551. })
  46552. }, [
  46553. vue.createVNode(_component_hColgroup, {
  46554. columns: _ctx.store.states.columns.value,
  46555. "table-layout": _ctx.tableLayout
  46556. }, null, 8, ["columns", "table-layout"]),
  46557. _ctx.showHeader && _ctx.tableLayout === "auto" ? (vue.openBlock(), vue.createBlock(_component_table_header, {
  46558. key: 0,
  46559. ref: "tableHeaderRef",
  46560. class: vue.normalizeClass(_ctx.ns.e("body-header")),
  46561. border: _ctx.border,
  46562. "default-sort": _ctx.defaultSort,
  46563. store: _ctx.store,
  46564. "append-filter-panel-to": _ctx.appendFilterPanelTo,
  46565. onSetDragVisible: _ctx.setDragVisible
  46566. }, null, 8, ["class", "border", "default-sort", "store", "append-filter-panel-to", "onSetDragVisible"])) : vue.createCommentVNode("v-if", true),
  46567. vue.createVNode(_component_table_body, {
  46568. context: _ctx.context,
  46569. highlight: _ctx.highlightCurrentRow,
  46570. "row-class-name": _ctx.rowClassName,
  46571. "tooltip-effect": _ctx.tooltipEffect,
  46572. "tooltip-options": _ctx.tooltipOptions,
  46573. "row-style": _ctx.rowStyle,
  46574. store: _ctx.store,
  46575. stripe: _ctx.stripe
  46576. }, null, 8, ["context", "highlight", "row-class-name", "tooltip-effect", "tooltip-options", "row-style", "store", "stripe"]),
  46577. _ctx.showSummary && _ctx.tableLayout === "auto" ? (vue.openBlock(), vue.createBlock(_component_table_footer, {
  46578. key: 1,
  46579. class: vue.normalizeClass(_ctx.ns.e("body-footer")),
  46580. border: _ctx.border,
  46581. "default-sort": _ctx.defaultSort,
  46582. store: _ctx.store,
  46583. "sum-text": _ctx.computedSumText,
  46584. "summary-method": _ctx.summaryMethod
  46585. }, null, 8, ["class", "border", "default-sort", "store", "sum-text", "summary-method"])) : vue.createCommentVNode("v-if", true)
  46586. ], 6),
  46587. _ctx.isEmpty ? (vue.openBlock(), vue.createElementBlock("div", {
  46588. key: 0,
  46589. ref: "emptyBlock",
  46590. style: vue.normalizeStyle(_ctx.emptyBlockStyle),
  46591. class: vue.normalizeClass(_ctx.ns.e("empty-block"))
  46592. }, [
  46593. vue.createElementVNode("span", {
  46594. class: vue.normalizeClass(_ctx.ns.e("empty-text"))
  46595. }, [
  46596. vue.renderSlot(_ctx.$slots, "empty", {}, () => [
  46597. vue.createTextVNode(vue.toDisplayString(_ctx.computedEmptyText), 1)
  46598. ])
  46599. ], 2)
  46600. ], 6)) : vue.createCommentVNode("v-if", true),
  46601. _ctx.$slots.append ? (vue.openBlock(), vue.createElementBlock("div", {
  46602. key: 1,
  46603. ref: "appendWrapper",
  46604. class: vue.normalizeClass(_ctx.ns.e("append-wrapper"))
  46605. }, [
  46606. vue.renderSlot(_ctx.$slots, "append")
  46607. ], 2)) : vue.createCommentVNode("v-if", true)
  46608. ]),
  46609. _: 3
  46610. }, 8, ["view-style", "wrap-style", "always", "tabindex", "onScroll"])
  46611. ], 2),
  46612. _ctx.showSummary && _ctx.tableLayout === "fixed" ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  46613. key: 1,
  46614. ref: "footerWrapper",
  46615. class: vue.normalizeClass(_ctx.ns.e("footer-wrapper"))
  46616. }, [
  46617. vue.createElementVNode("table", {
  46618. class: vue.normalizeClass(_ctx.ns.e("footer")),
  46619. cellspacing: "0",
  46620. cellpadding: "0",
  46621. border: "0",
  46622. style: vue.normalizeStyle(_ctx.tableBodyStyles)
  46623. }, [
  46624. vue.createVNode(_component_hColgroup, {
  46625. columns: _ctx.store.states.columns.value,
  46626. "table-layout": _ctx.tableLayout
  46627. }, null, 8, ["columns", "table-layout"]),
  46628. vue.createVNode(_component_table_footer, {
  46629. border: _ctx.border,
  46630. "default-sort": _ctx.defaultSort,
  46631. store: _ctx.store,
  46632. "sum-text": _ctx.computedSumText,
  46633. "summary-method": _ctx.summaryMethod
  46634. }, null, 8, ["border", "default-sort", "store", "sum-text", "summary-method"])
  46635. ], 6)
  46636. ], 2)), [
  46637. [vue.vShow, !_ctx.isEmpty],
  46638. [_directive_mousewheel, _ctx.handleHeaderFooterMousewheel]
  46639. ]) : vue.createCommentVNode("v-if", true),
  46640. _ctx.border || _ctx.isGroup ? (vue.openBlock(), vue.createElementBlock("div", {
  46641. key: 2,
  46642. class: vue.normalizeClass(_ctx.ns.e("border-left-patch"))
  46643. }, null, 2)) : vue.createCommentVNode("v-if", true)
  46644. ], 2),
  46645. vue.withDirectives(vue.createElementVNode("div", {
  46646. ref: "resizeProxy",
  46647. class: vue.normalizeClass(_ctx.ns.e("column-resize-proxy"))
  46648. }, null, 2), [
  46649. [vue.vShow, _ctx.resizeProxyVisible]
  46650. ])
  46651. ], 46, ["data-prefix", "onMouseleave"]);
  46652. }
  46653. var Table = /* @__PURE__ */ _export_sfc(_sfc_main$A, [["render", _sfc_render$3], ["__file", "table.vue"]]);
  46654. const defaultClassNames = {
  46655. selection: "table-column--selection",
  46656. expand: "table__expand-column"
  46657. };
  46658. const cellStarts = {
  46659. default: {
  46660. order: ""
  46661. },
  46662. selection: {
  46663. width: 48,
  46664. minWidth: 48,
  46665. realWidth: 48,
  46666. order: ""
  46667. },
  46668. expand: {
  46669. width: 48,
  46670. minWidth: 48,
  46671. realWidth: 48,
  46672. order: ""
  46673. },
  46674. index: {
  46675. width: 48,
  46676. minWidth: 48,
  46677. realWidth: 48,
  46678. order: ""
  46679. }
  46680. };
  46681. const getDefaultClassName = (type) => {
  46682. return defaultClassNames[type] || "";
  46683. };
  46684. const cellForced = {
  46685. selection: {
  46686. renderHeader({ store, column }) {
  46687. function isDisabled() {
  46688. return store.states.data.value && store.states.data.value.length === 0;
  46689. }
  46690. return vue.h(ElCheckbox, {
  46691. disabled: isDisabled(),
  46692. size: store.states.tableSize.value,
  46693. indeterminate: store.states.selection.value.length > 0 && !store.states.isAllSelected.value,
  46694. "onUpdate:modelValue": store.toggleAllSelection,
  46695. modelValue: store.states.isAllSelected.value,
  46696. ariaLabel: column.label
  46697. });
  46698. },
  46699. renderCell({
  46700. row,
  46701. column,
  46702. store,
  46703. $index
  46704. }) {
  46705. return vue.h(ElCheckbox, {
  46706. disabled: column.selectable ? !column.selectable.call(null, row, $index) : false,
  46707. size: store.states.tableSize.value,
  46708. onChange: () => {
  46709. store.commit("rowSelectedChanged", row);
  46710. },
  46711. onClick: (event) => event.stopPropagation(),
  46712. modelValue: store.isSelected(row),
  46713. ariaLabel: column.label
  46714. });
  46715. },
  46716. sortable: false,
  46717. resizable: false
  46718. },
  46719. index: {
  46720. renderHeader({ column }) {
  46721. return column.label || "#";
  46722. },
  46723. renderCell({
  46724. column,
  46725. $index
  46726. }) {
  46727. let i = $index + 1;
  46728. const index = column.index;
  46729. if (isNumber(index)) {
  46730. i = $index + index;
  46731. } else if (isFunction$1(index)) {
  46732. i = index($index);
  46733. }
  46734. return vue.h("div", {}, [i]);
  46735. },
  46736. sortable: false
  46737. },
  46738. expand: {
  46739. renderHeader({ column }) {
  46740. return column.label || "";
  46741. },
  46742. renderCell({
  46743. row,
  46744. store,
  46745. expanded
  46746. }) {
  46747. const { ns } = store;
  46748. const classes = [ns.e("expand-icon")];
  46749. if (expanded) {
  46750. classes.push(ns.em("expand-icon", "expanded"));
  46751. }
  46752. const callback = function(e) {
  46753. e.stopPropagation();
  46754. store.toggleRowExpansion(row);
  46755. };
  46756. return vue.h("div", {
  46757. class: classes,
  46758. onClick: callback
  46759. }, {
  46760. default: () => {
  46761. return [
  46762. vue.h(ElIcon, null, {
  46763. default: () => {
  46764. return [vue.h(arrow_right_default)];
  46765. }
  46766. })
  46767. ];
  46768. }
  46769. });
  46770. },
  46771. sortable: false,
  46772. resizable: false
  46773. }
  46774. };
  46775. function defaultRenderCell({
  46776. row,
  46777. column,
  46778. $index
  46779. }) {
  46780. var _a;
  46781. const property = column.property;
  46782. const value = property && getProp(row, property).value;
  46783. if (column && column.formatter) {
  46784. return column.formatter(row, column, value, $index);
  46785. }
  46786. return ((_a = value == null ? void 0 : value.toString) == null ? void 0 : _a.call(value)) || "";
  46787. }
  46788. function treeCellPrefix({
  46789. row,
  46790. treeNode,
  46791. store
  46792. }, createPlaceholder = false) {
  46793. const { ns } = store;
  46794. if (!treeNode) {
  46795. if (createPlaceholder) {
  46796. return [
  46797. vue.h("span", {
  46798. class: ns.e("placeholder")
  46799. })
  46800. ];
  46801. }
  46802. return null;
  46803. }
  46804. const ele = [];
  46805. const callback = function(e) {
  46806. e.stopPropagation();
  46807. if (treeNode.loading) {
  46808. return;
  46809. }
  46810. store.loadOrToggle(row);
  46811. };
  46812. if (treeNode.indent) {
  46813. ele.push(vue.h("span", {
  46814. class: ns.e("indent"),
  46815. style: { "padding-left": `${treeNode.indent}px` }
  46816. }));
  46817. }
  46818. if (isBoolean(treeNode.expanded) && !treeNode.noLazyChildren) {
  46819. const expandClasses = [
  46820. ns.e("expand-icon"),
  46821. treeNode.expanded ? ns.em("expand-icon", "expanded") : ""
  46822. ];
  46823. let icon = arrow_right_default;
  46824. if (treeNode.loading) {
  46825. icon = loading_default;
  46826. }
  46827. ele.push(vue.h("div", {
  46828. class: expandClasses,
  46829. onClick: callback
  46830. }, {
  46831. default: () => {
  46832. return [
  46833. vue.h(ElIcon, { class: { [ns.is("loading")]: treeNode.loading } }, {
  46834. default: () => [vue.h(icon)]
  46835. })
  46836. ];
  46837. }
  46838. }));
  46839. } else {
  46840. ele.push(vue.h("span", {
  46841. class: ns.e("placeholder")
  46842. }));
  46843. }
  46844. return ele;
  46845. }
  46846. function getAllAliases(props, aliases) {
  46847. return props.reduce((prev, cur) => {
  46848. prev[cur] = cur;
  46849. return prev;
  46850. }, aliases);
  46851. }
  46852. function useWatcher(owner, props_) {
  46853. const instance = vue.getCurrentInstance();
  46854. const registerComplexWatchers = () => {
  46855. const props = ["fixed"];
  46856. const aliases = {
  46857. realWidth: "width",
  46858. realMinWidth: "minWidth"
  46859. };
  46860. const allAliases = getAllAliases(props, aliases);
  46861. Object.keys(allAliases).forEach((key) => {
  46862. const columnKey = aliases[key];
  46863. if (hasOwn(props_, columnKey)) {
  46864. vue.watch(() => props_[columnKey], (newVal) => {
  46865. let value = newVal;
  46866. if (columnKey === "width" && key === "realWidth") {
  46867. value = parseWidth(newVal);
  46868. }
  46869. if (columnKey === "minWidth" && key === "realMinWidth") {
  46870. value = parseMinWidth(newVal);
  46871. }
  46872. instance.columnConfig.value[columnKey] = value;
  46873. instance.columnConfig.value[key] = value;
  46874. const updateColumns = columnKey === "fixed";
  46875. owner.value.store.scheduleLayout(updateColumns);
  46876. });
  46877. }
  46878. });
  46879. };
  46880. const registerNormalWatchers = () => {
  46881. const props = [
  46882. "label",
  46883. "filters",
  46884. "filterMultiple",
  46885. "filteredValue",
  46886. "sortable",
  46887. "index",
  46888. "formatter",
  46889. "className",
  46890. "labelClassName",
  46891. "filterClassName",
  46892. "showOverflowTooltip"
  46893. ];
  46894. const aliases = {
  46895. property: "prop",
  46896. align: "realAlign",
  46897. headerAlign: "realHeaderAlign"
  46898. };
  46899. const allAliases = getAllAliases(props, aliases);
  46900. Object.keys(allAliases).forEach((key) => {
  46901. const columnKey = aliases[key];
  46902. if (hasOwn(props_, columnKey)) {
  46903. vue.watch(() => props_[columnKey], (newVal) => {
  46904. instance.columnConfig.value[key] = newVal;
  46905. });
  46906. }
  46907. });
  46908. };
  46909. return {
  46910. registerComplexWatchers,
  46911. registerNormalWatchers
  46912. };
  46913. }
  46914. function useRender(props, slots, owner) {
  46915. const instance = vue.getCurrentInstance();
  46916. const columnId = vue.ref("");
  46917. const isSubColumn = vue.ref(false);
  46918. const realAlign = vue.ref();
  46919. const realHeaderAlign = vue.ref();
  46920. const ns = useNamespace("table");
  46921. vue.watchEffect(() => {
  46922. realAlign.value = props.align ? `is-${props.align}` : null;
  46923. realAlign.value;
  46924. });
  46925. vue.watchEffect(() => {
  46926. realHeaderAlign.value = props.headerAlign ? `is-${props.headerAlign}` : realAlign.value;
  46927. realHeaderAlign.value;
  46928. });
  46929. const columnOrTableParent = vue.computed(() => {
  46930. let parent = instance.vnode.vParent || instance.parent;
  46931. while (parent && !parent.tableId && !parent.columnId) {
  46932. parent = parent.vnode.vParent || parent.parent;
  46933. }
  46934. return parent;
  46935. });
  46936. const hasTreeColumn = vue.computed(() => {
  46937. const { store } = instance.parent;
  46938. if (!store)
  46939. return false;
  46940. const { treeData } = store.states;
  46941. const treeDataValue = treeData.value;
  46942. return treeDataValue && Object.keys(treeDataValue).length > 0;
  46943. });
  46944. const realWidth = vue.ref(parseWidth(props.width));
  46945. const realMinWidth = vue.ref(parseMinWidth(props.minWidth));
  46946. const setColumnWidth = (column) => {
  46947. if (realWidth.value)
  46948. column.width = realWidth.value;
  46949. if (realMinWidth.value) {
  46950. column.minWidth = realMinWidth.value;
  46951. }
  46952. if (!realWidth.value && realMinWidth.value) {
  46953. column.width = void 0;
  46954. }
  46955. if (!column.minWidth) {
  46956. column.minWidth = 80;
  46957. }
  46958. column.realWidth = Number(column.width === void 0 ? column.minWidth : column.width);
  46959. return column;
  46960. };
  46961. const setColumnForcedProps = (column) => {
  46962. const type = column.type;
  46963. const source = cellForced[type] || {};
  46964. Object.keys(source).forEach((prop) => {
  46965. const value = source[prop];
  46966. if (prop !== "className" && value !== void 0) {
  46967. column[prop] = value;
  46968. }
  46969. });
  46970. const className = getDefaultClassName(type);
  46971. if (className) {
  46972. const forceClass = `${vue.unref(ns.namespace)}-${className}`;
  46973. column.className = column.className ? `${column.className} ${forceClass}` : forceClass;
  46974. }
  46975. return column;
  46976. };
  46977. const checkSubColumn = (children) => {
  46978. if (isArray$1(children)) {
  46979. children.forEach((child) => check(child));
  46980. } else {
  46981. check(children);
  46982. }
  46983. function check(item) {
  46984. var _a;
  46985. if (((_a = item == null ? void 0 : item.type) == null ? void 0 : _a.name) === "ElTableColumn") {
  46986. item.vParent = instance;
  46987. }
  46988. }
  46989. };
  46990. const setColumnRenders = (column) => {
  46991. if (props.renderHeader) ; else if (column.type !== "selection") {
  46992. column.renderHeader = (scope) => {
  46993. instance.columnConfig.value["label"];
  46994. return vue.renderSlot(slots, "header", scope, () => [column.label]);
  46995. };
  46996. }
  46997. if (slots["filter-icon"]) {
  46998. column.renderFilterIcon = (scope) => {
  46999. return vue.renderSlot(slots, "filter-icon", scope);
  47000. };
  47001. }
  47002. let originRenderCell = column.renderCell;
  47003. if (column.type === "expand") {
  47004. column.renderCell = (data) => vue.h("div", {
  47005. class: "cell"
  47006. }, [originRenderCell(data)]);
  47007. owner.value.renderExpanded = (data) => {
  47008. return slots.default ? slots.default(data) : slots.default;
  47009. };
  47010. } else {
  47011. originRenderCell = originRenderCell || defaultRenderCell;
  47012. column.renderCell = (data) => {
  47013. let children = null;
  47014. if (slots.default) {
  47015. const vnodes = slots.default(data);
  47016. children = vnodes.some((v) => v.type !== vue.Comment) ? vnodes : originRenderCell(data);
  47017. } else {
  47018. children = originRenderCell(data);
  47019. }
  47020. const { columns } = owner.value.store.states;
  47021. const firstUserColumnIndex = columns.value.findIndex((item) => item.type === "default");
  47022. const shouldCreatePlaceholder = hasTreeColumn.value && data.cellIndex === firstUserColumnIndex;
  47023. const prefix = treeCellPrefix(data, shouldCreatePlaceholder);
  47024. const props2 = {
  47025. class: "cell",
  47026. style: {}
  47027. };
  47028. if (column.showOverflowTooltip) {
  47029. props2.class = `${props2.class} ${vue.unref(ns.namespace)}-tooltip`;
  47030. props2.style = {
  47031. width: `${(data.column.realWidth || Number(data.column.width)) - 1}px`
  47032. };
  47033. }
  47034. checkSubColumn(children);
  47035. return vue.h("div", props2, [prefix, children]);
  47036. };
  47037. }
  47038. return column;
  47039. };
  47040. const getPropsData = (...propsKey) => {
  47041. return propsKey.reduce((prev, cur) => {
  47042. if (isArray$1(cur)) {
  47043. cur.forEach((key) => {
  47044. prev[key] = props[key];
  47045. });
  47046. }
  47047. return prev;
  47048. }, {});
  47049. };
  47050. const getColumnElIndex = (children, child) => {
  47051. return Array.prototype.indexOf.call(children, child);
  47052. };
  47053. const updateColumnOrder = () => {
  47054. owner.value.store.commit("updateColumnOrder", instance.columnConfig.value);
  47055. };
  47056. return {
  47057. columnId,
  47058. realAlign,
  47059. isSubColumn,
  47060. realHeaderAlign,
  47061. columnOrTableParent,
  47062. setColumnWidth,
  47063. setColumnForcedProps,
  47064. setColumnRenders,
  47065. getPropsData,
  47066. getColumnElIndex,
  47067. updateColumnOrder
  47068. };
  47069. }
  47070. var defaultProps = {
  47071. type: {
  47072. type: String,
  47073. default: "default"
  47074. },
  47075. label: String,
  47076. className: String,
  47077. labelClassName: String,
  47078. property: String,
  47079. prop: String,
  47080. width: {
  47081. type: [String, Number],
  47082. default: ""
  47083. },
  47084. minWidth: {
  47085. type: [String, Number],
  47086. default: ""
  47087. },
  47088. renderHeader: Function,
  47089. sortable: {
  47090. type: [Boolean, String],
  47091. default: false
  47092. },
  47093. sortMethod: Function,
  47094. sortBy: [String, Function, Array],
  47095. resizable: {
  47096. type: Boolean,
  47097. default: true
  47098. },
  47099. columnKey: String,
  47100. align: String,
  47101. headerAlign: String,
  47102. showOverflowTooltip: {
  47103. type: [Boolean, Object],
  47104. default: void 0
  47105. },
  47106. fixed: [Boolean, String],
  47107. formatter: Function,
  47108. selectable: Function,
  47109. reserveSelection: Boolean,
  47110. filterMethod: Function,
  47111. filteredValue: Array,
  47112. filters: Array,
  47113. filterPlacement: String,
  47114. filterMultiple: {
  47115. type: Boolean,
  47116. default: true
  47117. },
  47118. filterClassName: String,
  47119. index: [Number, Function],
  47120. sortOrders: {
  47121. type: Array,
  47122. default: () => {
  47123. return ["ascending", "descending", null];
  47124. },
  47125. validator: (val) => {
  47126. return val.every((order) => ["ascending", "descending", null].includes(order));
  47127. }
  47128. }
  47129. };
  47130. let columnIdSeed = 1;
  47131. var ElTableColumn$1 = vue.defineComponent({
  47132. name: "ElTableColumn",
  47133. components: {
  47134. ElCheckbox
  47135. },
  47136. props: defaultProps,
  47137. setup(props, { slots }) {
  47138. const instance = vue.getCurrentInstance();
  47139. const columnConfig = vue.ref({});
  47140. const owner = vue.computed(() => {
  47141. let parent2 = instance.parent;
  47142. while (parent2 && !parent2.tableId) {
  47143. parent2 = parent2.parent;
  47144. }
  47145. return parent2;
  47146. });
  47147. const { registerNormalWatchers, registerComplexWatchers } = useWatcher(owner, props);
  47148. const {
  47149. columnId,
  47150. isSubColumn,
  47151. realHeaderAlign,
  47152. columnOrTableParent,
  47153. setColumnWidth,
  47154. setColumnForcedProps,
  47155. setColumnRenders,
  47156. getPropsData,
  47157. getColumnElIndex,
  47158. realAlign,
  47159. updateColumnOrder
  47160. } = useRender(props, slots, owner);
  47161. const parent = columnOrTableParent.value;
  47162. columnId.value = `${parent.tableId || parent.columnId}_column_${columnIdSeed++}`;
  47163. vue.onBeforeMount(() => {
  47164. isSubColumn.value = owner.value !== parent;
  47165. const type = props.type || "default";
  47166. const sortable = props.sortable === "" ? true : props.sortable;
  47167. const showOverflowTooltip = isUndefined(props.showOverflowTooltip) ? parent.props.showOverflowTooltip : props.showOverflowTooltip;
  47168. const defaults = {
  47169. ...cellStarts[type],
  47170. id: columnId.value,
  47171. type,
  47172. property: props.prop || props.property,
  47173. align: realAlign,
  47174. headerAlign: realHeaderAlign,
  47175. showOverflowTooltip,
  47176. filterable: props.filters || props.filterMethod,
  47177. filteredValue: [],
  47178. filterPlacement: "",
  47179. filterClassName: "",
  47180. isColumnGroup: false,
  47181. isSubColumn: false,
  47182. filterOpened: false,
  47183. sortable,
  47184. index: props.index,
  47185. rawColumnKey: instance.vnode.key
  47186. };
  47187. const basicProps = [
  47188. "columnKey",
  47189. "label",
  47190. "className",
  47191. "labelClassName",
  47192. "type",
  47193. "renderHeader",
  47194. "formatter",
  47195. "fixed",
  47196. "resizable"
  47197. ];
  47198. const sortProps = ["sortMethod", "sortBy", "sortOrders"];
  47199. const selectProps = ["selectable", "reserveSelection"];
  47200. const filterProps = [
  47201. "filterMethod",
  47202. "filters",
  47203. "filterMultiple",
  47204. "filterOpened",
  47205. "filteredValue",
  47206. "filterPlacement",
  47207. "filterClassName"
  47208. ];
  47209. let column = getPropsData(basicProps, sortProps, selectProps, filterProps);
  47210. column = mergeOptions(defaults, column);
  47211. const chains = compose(setColumnRenders, setColumnWidth, setColumnForcedProps);
  47212. column = chains(column);
  47213. columnConfig.value = column;
  47214. registerNormalWatchers();
  47215. registerComplexWatchers();
  47216. });
  47217. vue.onMounted(() => {
  47218. var _a;
  47219. const parent2 = columnOrTableParent.value;
  47220. const children = isSubColumn.value ? parent2.vnode.el.children : (_a = parent2.refs.hiddenColumns) == null ? void 0 : _a.children;
  47221. const getColumnIndex = () => getColumnElIndex(children || [], instance.vnode.el);
  47222. columnConfig.value.getColumnIndex = getColumnIndex;
  47223. const columnIndex = getColumnIndex();
  47224. columnIndex > -1 && owner.value.store.commit("insertColumn", columnConfig.value, isSubColumn.value ? parent2.columnConfig.value : null, updateColumnOrder);
  47225. });
  47226. vue.onBeforeUnmount(() => {
  47227. const getColumnIndex = columnConfig.value.getColumnIndex;
  47228. const columnIndex = getColumnIndex ? getColumnIndex() : -1;
  47229. columnIndex > -1 && owner.value.store.commit("removeColumn", columnConfig.value, isSubColumn.value ? parent.columnConfig.value : null, updateColumnOrder);
  47230. });
  47231. instance.columnId = columnId.value;
  47232. instance.columnConfig = columnConfig;
  47233. return;
  47234. },
  47235. render() {
  47236. var _a, _b, _c;
  47237. try {
  47238. const renderDefault = (_b = (_a = this.$slots).default) == null ? void 0 : _b.call(_a, {
  47239. row: {},
  47240. column: {},
  47241. $index: -1
  47242. });
  47243. const children = [];
  47244. if (isArray$1(renderDefault)) {
  47245. for (const childNode of renderDefault) {
  47246. if (((_c = childNode.type) == null ? void 0 : _c.name) === "ElTableColumn" || childNode.shapeFlag & 2) {
  47247. children.push(childNode);
  47248. } else if (childNode.type === vue.Fragment && isArray$1(childNode.children)) {
  47249. childNode.children.forEach((vnode2) => {
  47250. if ((vnode2 == null ? void 0 : vnode2.patchFlag) !== 1024 && !isString$1(vnode2 == null ? void 0 : vnode2.children)) {
  47251. children.push(vnode2);
  47252. }
  47253. });
  47254. }
  47255. }
  47256. }
  47257. const vnode = vue.h("div", children);
  47258. return vnode;
  47259. } catch (e) {
  47260. return vue.h("div", []);
  47261. }
  47262. }
  47263. });
  47264. const ElTable = withInstall(Table, {
  47265. TableColumn: ElTableColumn$1
  47266. });
  47267. const ElTableColumn = withNoopInstall(ElTableColumn$1);
  47268. var SortOrder = /* @__PURE__ */ ((SortOrder2) => {
  47269. SortOrder2["ASC"] = "asc";
  47270. SortOrder2["DESC"] = "desc";
  47271. return SortOrder2;
  47272. })(SortOrder || {});
  47273. var Alignment = /* @__PURE__ */ ((Alignment2) => {
  47274. Alignment2["CENTER"] = "center";
  47275. Alignment2["RIGHT"] = "right";
  47276. return Alignment2;
  47277. })(Alignment || {});
  47278. var FixedDir = /* @__PURE__ */ ((FixedDir2) => {
  47279. FixedDir2["LEFT"] = "left";
  47280. FixedDir2["RIGHT"] = "right";
  47281. return FixedDir2;
  47282. })(FixedDir || {});
  47283. const oppositeOrderMap = {
  47284. ["asc" /* ASC */]: "desc" /* DESC */,
  47285. ["desc" /* DESC */]: "asc" /* ASC */
  47286. };
  47287. const placeholderSign = Symbol("placeholder");
  47288. const calcColumnStyle = (column, fixedColumn, fixed) => {
  47289. var _a;
  47290. const flex = {
  47291. flexGrow: 0,
  47292. flexShrink: 0,
  47293. ...fixed ? {} : {
  47294. flexGrow: column.flexGrow || 0,
  47295. flexShrink: column.flexShrink || 1
  47296. }
  47297. };
  47298. if (!fixed) {
  47299. flex.flexShrink = 1;
  47300. }
  47301. const style = {
  47302. ...(_a = column.style) != null ? _a : {},
  47303. ...flex,
  47304. flexBasis: "auto",
  47305. width: column.width
  47306. };
  47307. if (!fixedColumn) {
  47308. if (column.maxWidth)
  47309. style.maxWidth = column.maxWidth;
  47310. if (column.minWidth)
  47311. style.minWidth = column.minWidth;
  47312. }
  47313. return style;
  47314. };
  47315. function useColumns(props, columns, fixed) {
  47316. const _columns = vue.computed(() => vue.unref(columns).map((column, index) => {
  47317. var _a, _b;
  47318. return {
  47319. ...column,
  47320. key: (_b = (_a = column.key) != null ? _a : column.dataKey) != null ? _b : index
  47321. };
  47322. }));
  47323. const visibleColumns = vue.computed(() => {
  47324. return vue.unref(_columns).filter((column) => !column.hidden);
  47325. });
  47326. const fixedColumnsOnLeft = vue.computed(() => vue.unref(visibleColumns).filter((column) => column.fixed === "left" || column.fixed === true));
  47327. const fixedColumnsOnRight = vue.computed(() => vue.unref(visibleColumns).filter((column) => column.fixed === "right"));
  47328. const normalColumns = vue.computed(() => vue.unref(visibleColumns).filter((column) => !column.fixed));
  47329. const mainColumns = vue.computed(() => {
  47330. const ret = [];
  47331. vue.unref(fixedColumnsOnLeft).forEach((column) => {
  47332. ret.push({
  47333. ...column,
  47334. placeholderSign
  47335. });
  47336. });
  47337. vue.unref(normalColumns).forEach((column) => {
  47338. ret.push(column);
  47339. });
  47340. vue.unref(fixedColumnsOnRight).forEach((column) => {
  47341. ret.push({
  47342. ...column,
  47343. placeholderSign
  47344. });
  47345. });
  47346. return ret;
  47347. });
  47348. const hasFixedColumns = vue.computed(() => {
  47349. return vue.unref(fixedColumnsOnLeft).length || vue.unref(fixedColumnsOnRight).length;
  47350. });
  47351. const columnsStyles = vue.computed(() => {
  47352. return vue.unref(_columns).reduce((style, column) => {
  47353. style[column.key] = calcColumnStyle(column, vue.unref(fixed), props.fixed);
  47354. return style;
  47355. }, {});
  47356. });
  47357. const columnsTotalWidth = vue.computed(() => {
  47358. return vue.unref(visibleColumns).reduce((width, column) => width + column.width, 0);
  47359. });
  47360. const getColumn = (key) => {
  47361. return vue.unref(_columns).find((column) => column.key === key);
  47362. };
  47363. const getColumnStyle = (key) => {
  47364. return vue.unref(columnsStyles)[key];
  47365. };
  47366. const updateColumnWidth = (column, width) => {
  47367. column.width = width;
  47368. };
  47369. function onColumnSorted(e) {
  47370. var _a;
  47371. const { key } = e.currentTarget.dataset;
  47372. if (!key)
  47373. return;
  47374. const { sortState, sortBy } = props;
  47375. let order = SortOrder.ASC;
  47376. if (isObject$1(sortState)) {
  47377. order = oppositeOrderMap[sortState[key]];
  47378. } else {
  47379. order = oppositeOrderMap[sortBy.order];
  47380. }
  47381. (_a = props.onColumnSort) == null ? void 0 : _a.call(props, { column: getColumn(key), key, order });
  47382. }
  47383. return {
  47384. columns: _columns,
  47385. columnsStyles,
  47386. columnsTotalWidth,
  47387. fixedColumnsOnLeft,
  47388. fixedColumnsOnRight,
  47389. hasFixedColumns,
  47390. mainColumns,
  47391. normalColumns,
  47392. visibleColumns,
  47393. getColumn,
  47394. getColumnStyle,
  47395. updateColumnWidth,
  47396. onColumnSorted
  47397. };
  47398. }
  47399. const useScrollbar = (props, {
  47400. mainTableRef,
  47401. leftTableRef,
  47402. rightTableRef,
  47403. onMaybeEndReached
  47404. }) => {
  47405. const scrollPos = vue.ref({ scrollLeft: 0, scrollTop: 0 });
  47406. function doScroll(params) {
  47407. var _a, _b, _c;
  47408. const { scrollTop } = params;
  47409. (_a = mainTableRef.value) == null ? void 0 : _a.scrollTo(params);
  47410. (_b = leftTableRef.value) == null ? void 0 : _b.scrollToTop(scrollTop);
  47411. (_c = rightTableRef.value) == null ? void 0 : _c.scrollToTop(scrollTop);
  47412. }
  47413. function scrollTo(params) {
  47414. scrollPos.value = params;
  47415. doScroll(params);
  47416. }
  47417. function scrollToTop(scrollTop) {
  47418. scrollPos.value.scrollTop = scrollTop;
  47419. doScroll(vue.unref(scrollPos));
  47420. }
  47421. function scrollToLeft(scrollLeft) {
  47422. var _a, _b;
  47423. scrollPos.value.scrollLeft = scrollLeft;
  47424. (_b = (_a = mainTableRef.value) == null ? void 0 : _a.scrollTo) == null ? void 0 : _b.call(_a, vue.unref(scrollPos));
  47425. }
  47426. function onScroll(params) {
  47427. var _a;
  47428. scrollTo(params);
  47429. (_a = props.onScroll) == null ? void 0 : _a.call(props, params);
  47430. }
  47431. function onVerticalScroll({ scrollTop }) {
  47432. const { scrollTop: currentScrollTop } = vue.unref(scrollPos);
  47433. if (scrollTop !== currentScrollTop)
  47434. scrollToTop(scrollTop);
  47435. }
  47436. function scrollToRow(row, strategy = "auto") {
  47437. var _a;
  47438. (_a = mainTableRef.value) == null ? void 0 : _a.scrollToRow(row, strategy);
  47439. }
  47440. vue.watch(() => vue.unref(scrollPos).scrollTop, (cur, prev) => {
  47441. if (cur > prev)
  47442. onMaybeEndReached();
  47443. });
  47444. return {
  47445. scrollPos,
  47446. scrollTo,
  47447. scrollToLeft,
  47448. scrollToTop,
  47449. scrollToRow,
  47450. onScroll,
  47451. onVerticalScroll
  47452. };
  47453. };
  47454. const useRow = (props, {
  47455. mainTableRef,
  47456. leftTableRef,
  47457. rightTableRef,
  47458. tableInstance,
  47459. ns,
  47460. isScrolling
  47461. }) => {
  47462. const vm = vue.getCurrentInstance();
  47463. const { emit } = vm;
  47464. const isResetting = vue.shallowRef(false);
  47465. const expandedRowKeys = vue.ref(props.defaultExpandedRowKeys || []);
  47466. const lastRenderedRowIndex = vue.ref(-1);
  47467. const resetIndex = vue.shallowRef(null);
  47468. const rowHeights = vue.ref({});
  47469. const pendingRowHeights = vue.ref({});
  47470. const leftTableHeights = vue.shallowRef({});
  47471. const mainTableHeights = vue.shallowRef({});
  47472. const rightTableHeights = vue.shallowRef({});
  47473. const isDynamic = vue.computed(() => isNumber(props.estimatedRowHeight));
  47474. function onRowsRendered(params) {
  47475. var _a;
  47476. (_a = props.onRowsRendered) == null ? void 0 : _a.call(props, params);
  47477. if (params.rowCacheEnd > vue.unref(lastRenderedRowIndex)) {
  47478. lastRenderedRowIndex.value = params.rowCacheEnd;
  47479. }
  47480. }
  47481. function onRowHovered({ hovered, rowKey }) {
  47482. if (isScrolling.value) {
  47483. return;
  47484. }
  47485. const tableRoot = tableInstance.vnode.el;
  47486. const rows = tableRoot.querySelectorAll(`[rowkey="${String(rowKey)}"]`);
  47487. rows.forEach((row) => {
  47488. if (hovered) {
  47489. row.classList.add(ns.is("hovered"));
  47490. } else {
  47491. row.classList.remove(ns.is("hovered"));
  47492. }
  47493. });
  47494. }
  47495. function onRowExpanded({
  47496. expanded,
  47497. rowData,
  47498. rowIndex,
  47499. rowKey
  47500. }) {
  47501. var _a, _b;
  47502. const _expandedRowKeys = [...vue.unref(expandedRowKeys)];
  47503. const currentKeyIndex = _expandedRowKeys.indexOf(rowKey);
  47504. if (expanded) {
  47505. if (currentKeyIndex === -1)
  47506. _expandedRowKeys.push(rowKey);
  47507. } else {
  47508. if (currentKeyIndex > -1)
  47509. _expandedRowKeys.splice(currentKeyIndex, 1);
  47510. }
  47511. expandedRowKeys.value = _expandedRowKeys;
  47512. emit("update:expandedRowKeys", _expandedRowKeys);
  47513. (_a = props.onRowExpand) == null ? void 0 : _a.call(props, {
  47514. expanded,
  47515. rowData,
  47516. rowIndex,
  47517. rowKey
  47518. });
  47519. (_b = props.onExpandedRowsChange) == null ? void 0 : _b.call(props, _expandedRowKeys);
  47520. }
  47521. const flushingRowHeights = debounce(() => {
  47522. var _a, _b, _c, _d;
  47523. isResetting.value = true;
  47524. rowHeights.value = { ...vue.unref(rowHeights), ...vue.unref(pendingRowHeights) };
  47525. resetAfterIndex(vue.unref(resetIndex), false);
  47526. pendingRowHeights.value = {};
  47527. resetIndex.value = null;
  47528. (_a = mainTableRef.value) == null ? void 0 : _a.forceUpdate();
  47529. (_b = leftTableRef.value) == null ? void 0 : _b.forceUpdate();
  47530. (_c = rightTableRef.value) == null ? void 0 : _c.forceUpdate();
  47531. (_d = vm.proxy) == null ? void 0 : _d.$forceUpdate();
  47532. isResetting.value = false;
  47533. }, 0);
  47534. function resetAfterIndex(index, forceUpdate = false) {
  47535. if (!vue.unref(isDynamic))
  47536. return;
  47537. [mainTableRef, leftTableRef, rightTableRef].forEach((tableRef) => {
  47538. const table = vue.unref(tableRef);
  47539. if (table)
  47540. table.resetAfterRowIndex(index, forceUpdate);
  47541. });
  47542. }
  47543. function resetHeights(rowKey, height, rowIdx) {
  47544. const resetIdx = vue.unref(resetIndex);
  47545. if (resetIdx === null) {
  47546. resetIndex.value = rowIdx;
  47547. } else {
  47548. if (resetIdx > rowIdx) {
  47549. resetIndex.value = rowIdx;
  47550. }
  47551. }
  47552. pendingRowHeights.value[rowKey] = height;
  47553. }
  47554. function onRowHeightChange({ rowKey, height, rowIndex }, fixedDir) {
  47555. if (!fixedDir) {
  47556. mainTableHeights.value[rowKey] = height;
  47557. } else {
  47558. if (fixedDir === FixedDir.RIGHT) {
  47559. rightTableHeights.value[rowKey] = height;
  47560. } else {
  47561. leftTableHeights.value[rowKey] = height;
  47562. }
  47563. }
  47564. const maximumHeight = Math.max(...[leftTableHeights, rightTableHeights, mainTableHeights].map((records) => records.value[rowKey] || 0));
  47565. if (vue.unref(rowHeights)[rowKey] !== maximumHeight) {
  47566. resetHeights(rowKey, maximumHeight, rowIndex);
  47567. flushingRowHeights();
  47568. }
  47569. }
  47570. return {
  47571. expandedRowKeys,
  47572. lastRenderedRowIndex,
  47573. isDynamic,
  47574. isResetting,
  47575. rowHeights,
  47576. resetAfterIndex,
  47577. onRowExpanded,
  47578. onRowHovered,
  47579. onRowsRendered,
  47580. onRowHeightChange
  47581. };
  47582. };
  47583. const useData = (props, { expandedRowKeys, lastRenderedRowIndex, resetAfterIndex }) => {
  47584. const depthMap = vue.ref({});
  47585. const flattenedData = vue.computed(() => {
  47586. const depths = {};
  47587. const { data: data2, rowKey } = props;
  47588. const _expandedRowKeys = vue.unref(expandedRowKeys);
  47589. if (!_expandedRowKeys || !_expandedRowKeys.length)
  47590. return data2;
  47591. const array = [];
  47592. const keysSet = /* @__PURE__ */ new Set();
  47593. _expandedRowKeys.forEach((x) => keysSet.add(x));
  47594. let copy = data2.slice();
  47595. copy.forEach((x) => depths[x[rowKey]] = 0);
  47596. while (copy.length > 0) {
  47597. const item = copy.shift();
  47598. array.push(item);
  47599. if (keysSet.has(item[rowKey]) && isArray$1(item.children) && item.children.length > 0) {
  47600. copy = [...item.children, ...copy];
  47601. item.children.forEach((child) => depths[child[rowKey]] = depths[item[rowKey]] + 1);
  47602. }
  47603. }
  47604. depthMap.value = depths;
  47605. return array;
  47606. });
  47607. const data = vue.computed(() => {
  47608. const { data: data2, expandColumnKey } = props;
  47609. return expandColumnKey ? vue.unref(flattenedData) : data2;
  47610. });
  47611. vue.watch(data, (val, prev) => {
  47612. if (val !== prev) {
  47613. lastRenderedRowIndex.value = -1;
  47614. resetAfterIndex(0, true);
  47615. }
  47616. });
  47617. return {
  47618. data,
  47619. depthMap
  47620. };
  47621. };
  47622. const sumReducer = (sum2, num) => sum2 + num;
  47623. const sum = (listLike) => {
  47624. return isArray$1(listLike) ? listLike.reduce(sumReducer, 0) : listLike;
  47625. };
  47626. const tryCall = (fLike, params, defaultRet = {}) => {
  47627. return isFunction$1(fLike) ? fLike(params) : fLike != null ? fLike : defaultRet;
  47628. };
  47629. const enforceUnit = (style) => {
  47630. ["width", "maxWidth", "minWidth", "height"].forEach((key) => {
  47631. style[key] = addUnit(style[key]);
  47632. });
  47633. return style;
  47634. };
  47635. const componentToSlot = (ComponentLike) => vue.isVNode(ComponentLike) ? (props) => vue.h(ComponentLike, props) : ComponentLike;
  47636. const useStyles = (props, {
  47637. columnsTotalWidth,
  47638. rowsHeight,
  47639. fixedColumnsOnLeft,
  47640. fixedColumnsOnRight
  47641. }) => {
  47642. const bodyWidth = vue.computed(() => {
  47643. const { fixed, width, vScrollbarSize } = props;
  47644. const ret = width - vScrollbarSize;
  47645. return fixed ? Math.max(Math.round(vue.unref(columnsTotalWidth)), ret) : ret;
  47646. });
  47647. const headerWidth = vue.computed(() => vue.unref(bodyWidth) + props.vScrollbarSize);
  47648. const mainTableHeight = vue.computed(() => {
  47649. const { height = 0, maxHeight = 0, footerHeight: footerHeight2, hScrollbarSize } = props;
  47650. if (maxHeight > 0) {
  47651. const _fixedRowsHeight = vue.unref(fixedRowsHeight);
  47652. const _rowsHeight = vue.unref(rowsHeight);
  47653. const _headerHeight = vue.unref(headerHeight);
  47654. const total = _headerHeight + _fixedRowsHeight + _rowsHeight + hScrollbarSize;
  47655. return Math.min(total, maxHeight - footerHeight2);
  47656. }
  47657. return height - footerHeight2;
  47658. });
  47659. const fixedTableHeight = vue.computed(() => {
  47660. const { maxHeight } = props;
  47661. const tableHeight = vue.unref(mainTableHeight);
  47662. if (isNumber(maxHeight) && maxHeight > 0)
  47663. return tableHeight;
  47664. const totalHeight = vue.unref(rowsHeight) + vue.unref(headerHeight) + vue.unref(fixedRowsHeight);
  47665. return Math.min(tableHeight, totalHeight);
  47666. });
  47667. const mapColumn = (column) => column.width;
  47668. const leftTableWidth = vue.computed(() => sum(vue.unref(fixedColumnsOnLeft).map(mapColumn)));
  47669. const rightTableWidth = vue.computed(() => sum(vue.unref(fixedColumnsOnRight).map(mapColumn)));
  47670. const headerHeight = vue.computed(() => sum(props.headerHeight));
  47671. const fixedRowsHeight = vue.computed(() => {
  47672. var _a;
  47673. return (((_a = props.fixedData) == null ? void 0 : _a.length) || 0) * props.rowHeight;
  47674. });
  47675. const windowHeight = vue.computed(() => {
  47676. return vue.unref(mainTableHeight) - vue.unref(headerHeight) - vue.unref(fixedRowsHeight);
  47677. });
  47678. const rootStyle = vue.computed(() => {
  47679. const { style = {}, height, width } = props;
  47680. return enforceUnit({
  47681. ...style,
  47682. height,
  47683. width
  47684. });
  47685. });
  47686. const footerHeight = vue.computed(() => enforceUnit({ height: props.footerHeight }));
  47687. const emptyStyle = vue.computed(() => ({
  47688. top: addUnit(vue.unref(headerHeight)),
  47689. bottom: addUnit(props.footerHeight),
  47690. width: addUnit(props.width)
  47691. }));
  47692. return {
  47693. bodyWidth,
  47694. fixedTableHeight,
  47695. mainTableHeight,
  47696. leftTableWidth,
  47697. rightTableWidth,
  47698. headerWidth,
  47699. windowHeight,
  47700. footerHeight,
  47701. emptyStyle,
  47702. rootStyle,
  47703. headerHeight
  47704. };
  47705. };
  47706. const useAutoResize = (props) => {
  47707. const sizer = vue.ref();
  47708. const width$ = vue.ref(0);
  47709. const height$ = vue.ref(0);
  47710. let resizerStopper;
  47711. vue.onMounted(() => {
  47712. resizerStopper = useResizeObserver(sizer, ([entry]) => {
  47713. const { width, height } = entry.contentRect;
  47714. const { paddingLeft, paddingRight, paddingTop, paddingBottom } = getComputedStyle(entry.target);
  47715. const left = Number.parseInt(paddingLeft) || 0;
  47716. const right = Number.parseInt(paddingRight) || 0;
  47717. const top = Number.parseInt(paddingTop) || 0;
  47718. const bottom = Number.parseInt(paddingBottom) || 0;
  47719. width$.value = width - left - right;
  47720. height$.value = height - top - bottom;
  47721. }).stop;
  47722. });
  47723. vue.onBeforeUnmount(() => {
  47724. resizerStopper == null ? void 0 : resizerStopper();
  47725. });
  47726. vue.watch([width$, height$], ([width, height]) => {
  47727. var _a;
  47728. (_a = props.onResize) == null ? void 0 : _a.call(props, {
  47729. width,
  47730. height
  47731. });
  47732. });
  47733. return {
  47734. sizer,
  47735. width: width$,
  47736. height: height$
  47737. };
  47738. };
  47739. function useTable(props) {
  47740. const mainTableRef = vue.ref();
  47741. const leftTableRef = vue.ref();
  47742. const rightTableRef = vue.ref();
  47743. const {
  47744. columns,
  47745. columnsStyles,
  47746. columnsTotalWidth,
  47747. fixedColumnsOnLeft,
  47748. fixedColumnsOnRight,
  47749. hasFixedColumns,
  47750. mainColumns,
  47751. onColumnSorted
  47752. } = useColumns(props, vue.toRef(props, "columns"), vue.toRef(props, "fixed"));
  47753. const {
  47754. scrollTo,
  47755. scrollToLeft,
  47756. scrollToTop,
  47757. scrollToRow,
  47758. onScroll,
  47759. onVerticalScroll,
  47760. scrollPos
  47761. } = useScrollbar(props, {
  47762. mainTableRef,
  47763. leftTableRef,
  47764. rightTableRef,
  47765. onMaybeEndReached
  47766. });
  47767. const ns = useNamespace("table-v2");
  47768. const instance = vue.getCurrentInstance();
  47769. const isScrolling = vue.shallowRef(false);
  47770. const {
  47771. expandedRowKeys,
  47772. lastRenderedRowIndex,
  47773. isDynamic,
  47774. isResetting,
  47775. rowHeights,
  47776. resetAfterIndex,
  47777. onRowExpanded,
  47778. onRowHeightChange,
  47779. onRowHovered,
  47780. onRowsRendered
  47781. } = useRow(props, {
  47782. mainTableRef,
  47783. leftTableRef,
  47784. rightTableRef,
  47785. tableInstance: instance,
  47786. ns,
  47787. isScrolling
  47788. });
  47789. const { data, depthMap } = useData(props, {
  47790. expandedRowKeys,
  47791. lastRenderedRowIndex,
  47792. resetAfterIndex
  47793. });
  47794. const rowsHeight = vue.computed(() => {
  47795. const { estimatedRowHeight, rowHeight } = props;
  47796. const _data = vue.unref(data);
  47797. if (isNumber(estimatedRowHeight)) {
  47798. return Object.values(vue.unref(rowHeights)).reduce((acc, curr) => acc + curr, 0);
  47799. }
  47800. return _data.length * rowHeight;
  47801. });
  47802. const {
  47803. bodyWidth,
  47804. fixedTableHeight,
  47805. mainTableHeight,
  47806. leftTableWidth,
  47807. rightTableWidth,
  47808. headerWidth,
  47809. windowHeight,
  47810. footerHeight,
  47811. emptyStyle,
  47812. rootStyle,
  47813. headerHeight
  47814. } = useStyles(props, {
  47815. columnsTotalWidth,
  47816. fixedColumnsOnLeft,
  47817. fixedColumnsOnRight,
  47818. rowsHeight
  47819. });
  47820. const containerRef = vue.ref();
  47821. const showEmpty = vue.computed(() => {
  47822. const noData = vue.unref(data).length === 0;
  47823. return isArray$1(props.fixedData) ? props.fixedData.length === 0 && noData : noData;
  47824. });
  47825. function getRowHeight(rowIndex) {
  47826. const { estimatedRowHeight, rowHeight, rowKey } = props;
  47827. if (!estimatedRowHeight)
  47828. return rowHeight;
  47829. return vue.unref(rowHeights)[vue.unref(data)[rowIndex][rowKey]] || estimatedRowHeight;
  47830. }
  47831. function onMaybeEndReached() {
  47832. const { onEndReached } = props;
  47833. if (!onEndReached)
  47834. return;
  47835. const { scrollTop } = vue.unref(scrollPos);
  47836. const _totalHeight = vue.unref(rowsHeight);
  47837. const clientHeight = vue.unref(windowHeight);
  47838. const heightUntilEnd = _totalHeight - (scrollTop + clientHeight) + props.hScrollbarSize;
  47839. if (vue.unref(lastRenderedRowIndex) >= 0 && _totalHeight === scrollTop + vue.unref(mainTableHeight) - vue.unref(headerHeight)) {
  47840. onEndReached(heightUntilEnd);
  47841. }
  47842. }
  47843. vue.watch(() => props.expandedRowKeys, (val) => expandedRowKeys.value = val, {
  47844. deep: true
  47845. });
  47846. return {
  47847. columns,
  47848. containerRef,
  47849. mainTableRef,
  47850. leftTableRef,
  47851. rightTableRef,
  47852. isDynamic,
  47853. isResetting,
  47854. isScrolling,
  47855. hasFixedColumns,
  47856. columnsStyles,
  47857. columnsTotalWidth,
  47858. data,
  47859. expandedRowKeys,
  47860. depthMap,
  47861. fixedColumnsOnLeft,
  47862. fixedColumnsOnRight,
  47863. mainColumns,
  47864. bodyWidth,
  47865. emptyStyle,
  47866. rootStyle,
  47867. headerWidth,
  47868. footerHeight,
  47869. mainTableHeight,
  47870. fixedTableHeight,
  47871. leftTableWidth,
  47872. rightTableWidth,
  47873. showEmpty,
  47874. getRowHeight,
  47875. onColumnSorted,
  47876. onRowHovered,
  47877. onRowExpanded,
  47878. onRowsRendered,
  47879. onRowHeightChange,
  47880. scrollTo,
  47881. scrollToLeft,
  47882. scrollToTop,
  47883. scrollToRow,
  47884. onScroll,
  47885. onVerticalScroll
  47886. };
  47887. }
  47888. const TableV2InjectionKey = Symbol("tableV2");
  47889. const classType = String;
  47890. const columns = {
  47891. type: definePropType(Array),
  47892. required: true
  47893. };
  47894. const fixedDataType = {
  47895. type: definePropType(Array)
  47896. };
  47897. const dataType = {
  47898. ...fixedDataType,
  47899. required: true
  47900. };
  47901. const expandColumnKey = String;
  47902. const expandKeys = {
  47903. type: definePropType(Array),
  47904. default: () => mutable([])
  47905. };
  47906. const requiredNumber = {
  47907. type: Number,
  47908. required: true
  47909. };
  47910. const rowKey = {
  47911. type: definePropType([String, Number, Symbol]),
  47912. default: "id"
  47913. };
  47914. const styleType = {
  47915. type: definePropType(Object)
  47916. };
  47917. const tableV2RowProps = buildProps({
  47918. class: String,
  47919. columns,
  47920. columnsStyles: {
  47921. type: definePropType(Object),
  47922. required: true
  47923. },
  47924. depth: Number,
  47925. expandColumnKey,
  47926. estimatedRowHeight: {
  47927. ...virtualizedGridProps.estimatedRowHeight,
  47928. default: void 0
  47929. },
  47930. isScrolling: Boolean,
  47931. onRowExpand: {
  47932. type: definePropType(Function)
  47933. },
  47934. onRowHover: {
  47935. type: definePropType(Function)
  47936. },
  47937. onRowHeightChange: {
  47938. type: definePropType(Function)
  47939. },
  47940. rowData: {
  47941. type: definePropType(Object),
  47942. required: true
  47943. },
  47944. rowEventHandlers: {
  47945. type: definePropType(Object)
  47946. },
  47947. rowIndex: {
  47948. type: Number,
  47949. required: true
  47950. },
  47951. rowKey,
  47952. style: {
  47953. type: definePropType(Object)
  47954. }
  47955. });
  47956. const requiredNumberType = {
  47957. type: Number,
  47958. required: true
  47959. };
  47960. const tableV2HeaderProps = buildProps({
  47961. class: String,
  47962. columns,
  47963. fixedHeaderData: {
  47964. type: definePropType(Array)
  47965. },
  47966. headerData: {
  47967. type: definePropType(Array),
  47968. required: true
  47969. },
  47970. headerHeight: {
  47971. type: definePropType([Number, Array]),
  47972. default: 50
  47973. },
  47974. rowWidth: requiredNumberType,
  47975. rowHeight: {
  47976. type: Number,
  47977. default: 50
  47978. },
  47979. height: requiredNumberType,
  47980. width: requiredNumberType
  47981. });
  47982. const tableV2GridProps = buildProps({
  47983. columns,
  47984. data: dataType,
  47985. fixedData: fixedDataType,
  47986. estimatedRowHeight: tableV2RowProps.estimatedRowHeight,
  47987. width: requiredNumber,
  47988. height: requiredNumber,
  47989. headerWidth: requiredNumber,
  47990. headerHeight: tableV2HeaderProps.headerHeight,
  47991. bodyWidth: requiredNumber,
  47992. rowHeight: requiredNumber,
  47993. cache: virtualizedListProps.cache,
  47994. useIsScrolling: Boolean,
  47995. scrollbarAlwaysOn: virtualizedGridProps.scrollbarAlwaysOn,
  47996. scrollbarStartGap: virtualizedGridProps.scrollbarStartGap,
  47997. scrollbarEndGap: virtualizedGridProps.scrollbarEndGap,
  47998. class: classType,
  47999. style: styleType,
  48000. containerStyle: styleType,
  48001. getRowHeight: {
  48002. type: definePropType(Function),
  48003. required: true
  48004. },
  48005. rowKey: tableV2RowProps.rowKey,
  48006. onRowsRendered: {
  48007. type: definePropType(Function)
  48008. },
  48009. onScroll: {
  48010. type: definePropType(Function)
  48011. }
  48012. });
  48013. const tableV2Props = buildProps({
  48014. cache: tableV2GridProps.cache,
  48015. estimatedRowHeight: tableV2RowProps.estimatedRowHeight,
  48016. rowKey,
  48017. headerClass: {
  48018. type: definePropType([
  48019. String,
  48020. Function
  48021. ])
  48022. },
  48023. headerProps: {
  48024. type: definePropType([
  48025. Object,
  48026. Function
  48027. ])
  48028. },
  48029. headerCellProps: {
  48030. type: definePropType([
  48031. Object,
  48032. Function
  48033. ])
  48034. },
  48035. headerHeight: tableV2HeaderProps.headerHeight,
  48036. footerHeight: {
  48037. type: Number,
  48038. default: 0
  48039. },
  48040. rowClass: {
  48041. type: definePropType([String, Function])
  48042. },
  48043. rowProps: {
  48044. type: definePropType([Object, Function])
  48045. },
  48046. rowHeight: {
  48047. type: Number,
  48048. default: 50
  48049. },
  48050. cellProps: {
  48051. type: definePropType([
  48052. Object,
  48053. Function
  48054. ])
  48055. },
  48056. columns,
  48057. data: dataType,
  48058. dataGetter: {
  48059. type: definePropType(Function)
  48060. },
  48061. fixedData: fixedDataType,
  48062. expandColumnKey: tableV2RowProps.expandColumnKey,
  48063. expandedRowKeys: expandKeys,
  48064. defaultExpandedRowKeys: expandKeys,
  48065. class: classType,
  48066. fixed: Boolean,
  48067. style: {
  48068. type: definePropType(Object)
  48069. },
  48070. width: requiredNumber,
  48071. height: requiredNumber,
  48072. maxHeight: Number,
  48073. useIsScrolling: Boolean,
  48074. indentSize: {
  48075. type: Number,
  48076. default: 12
  48077. },
  48078. iconSize: {
  48079. type: Number,
  48080. default: 12
  48081. },
  48082. hScrollbarSize: virtualizedGridProps.hScrollbarSize,
  48083. vScrollbarSize: virtualizedGridProps.vScrollbarSize,
  48084. scrollbarAlwaysOn: virtualizedScrollbarProps.alwaysOn,
  48085. sortBy: {
  48086. type: definePropType(Object),
  48087. default: () => ({})
  48088. },
  48089. sortState: {
  48090. type: definePropType(Object),
  48091. default: void 0
  48092. },
  48093. onColumnSort: {
  48094. type: definePropType(Function)
  48095. },
  48096. onExpandedRowsChange: {
  48097. type: definePropType(Function)
  48098. },
  48099. onEndReached: {
  48100. type: definePropType(Function)
  48101. },
  48102. onRowExpand: tableV2RowProps.onRowExpand,
  48103. onScroll: tableV2GridProps.onScroll,
  48104. onRowsRendered: tableV2GridProps.onRowsRendered,
  48105. rowEventHandlers: tableV2RowProps.rowEventHandlers
  48106. });
  48107. const TableV2Cell = (props, {
  48108. slots
  48109. }) => {
  48110. var _a;
  48111. const {
  48112. cellData,
  48113. style
  48114. } = props;
  48115. const displayText = ((_a = cellData == null ? void 0 : cellData.toString) == null ? void 0 : _a.call(cellData)) || "";
  48116. const defaultSlot = vue.renderSlot(slots, "default", props, () => [displayText]);
  48117. return vue.createVNode("div", {
  48118. "class": props.class,
  48119. "title": displayText,
  48120. "style": style
  48121. }, [defaultSlot]);
  48122. };
  48123. TableV2Cell.displayName = "ElTableV2Cell";
  48124. TableV2Cell.inheritAttrs = false;
  48125. var TableCell = TableV2Cell;
  48126. const HeaderCell = (props, {
  48127. slots
  48128. }) => vue.renderSlot(slots, "default", props, () => {
  48129. var _a, _b;
  48130. return [vue.createVNode("div", {
  48131. "class": props.class,
  48132. "title": (_a = props.column) == null ? void 0 : _a.title
  48133. }, [(_b = props.column) == null ? void 0 : _b.title])];
  48134. });
  48135. HeaderCell.displayName = "ElTableV2HeaderCell";
  48136. HeaderCell.inheritAttrs = false;
  48137. var HeaderCell$1 = HeaderCell;
  48138. const tableV2HeaderRowProps = buildProps({
  48139. class: String,
  48140. columns,
  48141. columnsStyles: {
  48142. type: definePropType(Object),
  48143. required: true
  48144. },
  48145. headerIndex: Number,
  48146. style: { type: definePropType(Object) }
  48147. });
  48148. const TableV2HeaderRow = vue.defineComponent({
  48149. name: "ElTableV2HeaderRow",
  48150. props: tableV2HeaderRowProps,
  48151. setup(props, {
  48152. slots
  48153. }) {
  48154. return () => {
  48155. const {
  48156. columns,
  48157. columnsStyles,
  48158. headerIndex,
  48159. style
  48160. } = props;
  48161. let Cells = columns.map((column, columnIndex) => {
  48162. return slots.cell({
  48163. columns,
  48164. column,
  48165. columnIndex,
  48166. headerIndex,
  48167. style: columnsStyles[column.key]
  48168. });
  48169. });
  48170. if (slots.header) {
  48171. Cells = slots.header({
  48172. cells: Cells.map((node) => {
  48173. if (isArray$1(node) && node.length === 1) {
  48174. return node[0];
  48175. }
  48176. return node;
  48177. }),
  48178. columns,
  48179. headerIndex
  48180. });
  48181. }
  48182. return vue.createVNode("div", {
  48183. "class": props.class,
  48184. "style": style,
  48185. "role": "row"
  48186. }, [Cells]);
  48187. };
  48188. }
  48189. });
  48190. var HeaderRow = TableV2HeaderRow;
  48191. const COMPONENT_NAME$7 = "ElTableV2Header";
  48192. const TableV2Header = vue.defineComponent({
  48193. name: COMPONENT_NAME$7,
  48194. props: tableV2HeaderProps,
  48195. setup(props, {
  48196. slots,
  48197. expose
  48198. }) {
  48199. const ns = useNamespace("table-v2");
  48200. const scrollLeftInfo = vue.inject("tableV2GridScrollLeft");
  48201. const headerRef = vue.ref();
  48202. const headerStyle = vue.computed(() => enforceUnit({
  48203. width: props.width,
  48204. height: props.height
  48205. }));
  48206. const rowStyle = vue.computed(() => enforceUnit({
  48207. width: props.rowWidth,
  48208. height: props.height
  48209. }));
  48210. const headerHeights = vue.computed(() => castArray$1(vue.unref(props.headerHeight)));
  48211. const scrollToLeft = (left) => {
  48212. const headerEl = vue.unref(headerRef);
  48213. vue.nextTick(() => {
  48214. (headerEl == null ? void 0 : headerEl.scroll) && headerEl.scroll({
  48215. left
  48216. });
  48217. });
  48218. };
  48219. const renderFixedRows = () => {
  48220. const fixedRowClassName = ns.e("fixed-header-row");
  48221. const {
  48222. columns,
  48223. fixedHeaderData,
  48224. rowHeight
  48225. } = props;
  48226. return fixedHeaderData == null ? void 0 : fixedHeaderData.map((fixedRowData, fixedRowIndex) => {
  48227. var _a;
  48228. const style = enforceUnit({
  48229. height: rowHeight,
  48230. width: "100%"
  48231. });
  48232. return (_a = slots.fixed) == null ? void 0 : _a.call(slots, {
  48233. class: fixedRowClassName,
  48234. columns,
  48235. rowData: fixedRowData,
  48236. rowIndex: -(fixedRowIndex + 1),
  48237. style
  48238. });
  48239. });
  48240. };
  48241. const renderDynamicRows = () => {
  48242. const dynamicRowClassName = ns.e("dynamic-header-row");
  48243. const {
  48244. columns
  48245. } = props;
  48246. return vue.unref(headerHeights).map((rowHeight, rowIndex) => {
  48247. var _a;
  48248. const style = enforceUnit({
  48249. width: "100%",
  48250. height: rowHeight
  48251. });
  48252. return (_a = slots.dynamic) == null ? void 0 : _a.call(slots, {
  48253. class: dynamicRowClassName,
  48254. columns,
  48255. headerIndex: rowIndex,
  48256. style
  48257. });
  48258. });
  48259. };
  48260. vue.onUpdated(() => {
  48261. if (scrollLeftInfo == null ? void 0 : scrollLeftInfo.value) {
  48262. scrollToLeft(scrollLeftInfo.value);
  48263. }
  48264. });
  48265. expose({
  48266. scrollToLeft
  48267. });
  48268. return () => {
  48269. if (props.height <= 0)
  48270. return;
  48271. return vue.createVNode("div", {
  48272. "ref": headerRef,
  48273. "class": props.class,
  48274. "style": vue.unref(headerStyle),
  48275. "role": "rowgroup"
  48276. }, [vue.createVNode("div", {
  48277. "style": vue.unref(rowStyle),
  48278. "class": ns.e("header")
  48279. }, [renderDynamicRows(), renderFixedRows()])]);
  48280. };
  48281. }
  48282. });
  48283. var Header = TableV2Header;
  48284. const useTableRow = (props) => {
  48285. const {
  48286. isScrolling
  48287. } = vue.inject(TableV2InjectionKey);
  48288. const measured = vue.ref(false);
  48289. const rowRef = vue.ref();
  48290. const measurable = vue.computed(() => {
  48291. return isNumber(props.estimatedRowHeight) && props.rowIndex >= 0;
  48292. });
  48293. const doMeasure = (isInit = false) => {
  48294. const $rowRef = vue.unref(rowRef);
  48295. if (!$rowRef)
  48296. return;
  48297. const {
  48298. columns,
  48299. onRowHeightChange,
  48300. rowKey,
  48301. rowIndex,
  48302. style
  48303. } = props;
  48304. const {
  48305. height
  48306. } = $rowRef.getBoundingClientRect();
  48307. measured.value = true;
  48308. vue.nextTick(() => {
  48309. if (isInit || height !== Number.parseInt(style.height)) {
  48310. const firstColumn = columns[0];
  48311. const isPlaceholder = (firstColumn == null ? void 0 : firstColumn.placeholderSign) === placeholderSign;
  48312. onRowHeightChange == null ? void 0 : onRowHeightChange({
  48313. rowKey,
  48314. height,
  48315. rowIndex
  48316. }, firstColumn && !isPlaceholder && firstColumn.fixed);
  48317. }
  48318. });
  48319. };
  48320. const eventHandlers = vue.computed(() => {
  48321. const {
  48322. rowData,
  48323. rowIndex,
  48324. rowKey,
  48325. onRowHover
  48326. } = props;
  48327. const handlers = props.rowEventHandlers || {};
  48328. const eventHandlers2 = {};
  48329. Object.entries(handlers).forEach(([eventName, handler]) => {
  48330. if (isFunction$1(handler)) {
  48331. eventHandlers2[eventName] = (event) => {
  48332. handler({
  48333. event,
  48334. rowData,
  48335. rowIndex,
  48336. rowKey
  48337. });
  48338. };
  48339. }
  48340. });
  48341. if (onRowHover) {
  48342. [{
  48343. name: "onMouseleave",
  48344. hovered: false
  48345. }, {
  48346. name: "onMouseenter",
  48347. hovered: true
  48348. }].forEach(({
  48349. name,
  48350. hovered
  48351. }) => {
  48352. const existedHandler = eventHandlers2[name];
  48353. eventHandlers2[name] = (event) => {
  48354. onRowHover({
  48355. event,
  48356. hovered,
  48357. rowData,
  48358. rowIndex,
  48359. rowKey
  48360. });
  48361. existedHandler == null ? void 0 : existedHandler(event);
  48362. };
  48363. });
  48364. }
  48365. return eventHandlers2;
  48366. });
  48367. const onExpand = (expanded) => {
  48368. const {
  48369. onRowExpand,
  48370. rowData,
  48371. rowIndex,
  48372. rowKey
  48373. } = props;
  48374. onRowExpand == null ? void 0 : onRowExpand({
  48375. expanded,
  48376. rowData,
  48377. rowIndex,
  48378. rowKey
  48379. });
  48380. };
  48381. vue.onMounted(() => {
  48382. if (vue.unref(measurable)) {
  48383. doMeasure(true);
  48384. }
  48385. });
  48386. return {
  48387. isScrolling,
  48388. measurable,
  48389. measured,
  48390. rowRef,
  48391. eventHandlers,
  48392. onExpand
  48393. };
  48394. };
  48395. const COMPONENT_NAME$6 = "ElTableV2TableRow";
  48396. const TableV2Row = vue.defineComponent({
  48397. name: COMPONENT_NAME$6,
  48398. props: tableV2RowProps,
  48399. setup(props, {
  48400. expose,
  48401. slots,
  48402. attrs
  48403. }) {
  48404. const {
  48405. eventHandlers,
  48406. isScrolling,
  48407. measurable,
  48408. measured,
  48409. rowRef,
  48410. onExpand
  48411. } = useTableRow(props);
  48412. expose({
  48413. onExpand
  48414. });
  48415. return () => {
  48416. const {
  48417. columns,
  48418. columnsStyles,
  48419. expandColumnKey,
  48420. depth,
  48421. rowData,
  48422. rowIndex,
  48423. style
  48424. } = props;
  48425. let ColumnCells = columns.map((column, columnIndex) => {
  48426. const expandable = isArray$1(rowData.children) && rowData.children.length > 0 && column.key === expandColumnKey;
  48427. return slots.cell({
  48428. column,
  48429. columns,
  48430. columnIndex,
  48431. depth,
  48432. style: columnsStyles[column.key],
  48433. rowData,
  48434. rowIndex,
  48435. isScrolling: vue.unref(isScrolling),
  48436. expandIconProps: expandable ? {
  48437. rowData,
  48438. rowIndex,
  48439. onExpand
  48440. } : void 0
  48441. });
  48442. });
  48443. if (slots.row) {
  48444. ColumnCells = slots.row({
  48445. cells: ColumnCells.map((node) => {
  48446. if (isArray$1(node) && node.length === 1) {
  48447. return node[0];
  48448. }
  48449. return node;
  48450. }),
  48451. style,
  48452. columns,
  48453. depth,
  48454. rowData,
  48455. rowIndex,
  48456. isScrolling: vue.unref(isScrolling)
  48457. });
  48458. }
  48459. if (vue.unref(measurable)) {
  48460. const {
  48461. height,
  48462. ...exceptHeightStyle
  48463. } = style || {};
  48464. const _measured = vue.unref(measured);
  48465. return vue.createVNode("div", vue.mergeProps({
  48466. "ref": rowRef,
  48467. "class": props.class,
  48468. "style": _measured ? style : exceptHeightStyle,
  48469. "role": "row"
  48470. }, attrs, vue.unref(eventHandlers)), [ColumnCells]);
  48471. }
  48472. return vue.createVNode("div", vue.mergeProps(attrs, {
  48473. "ref": rowRef,
  48474. "class": props.class,
  48475. "style": style,
  48476. "role": "row"
  48477. }, vue.unref(eventHandlers)), [ColumnCells]);
  48478. };
  48479. }
  48480. });
  48481. var Row = TableV2Row;
  48482. const SortIcon = (props) => {
  48483. const {
  48484. sortOrder
  48485. } = props;
  48486. return vue.createVNode(ElIcon, {
  48487. "size": 14,
  48488. "class": props.class
  48489. }, {
  48490. default: () => [sortOrder === SortOrder.ASC ? vue.createVNode(sort_up_default, null, null) : vue.createVNode(sort_down_default, null, null)]
  48491. });
  48492. };
  48493. var SortIcon$1 = SortIcon;
  48494. const ExpandIcon = (props) => {
  48495. const {
  48496. expanded,
  48497. expandable,
  48498. onExpand,
  48499. style,
  48500. size
  48501. } = props;
  48502. const expandIconProps = {
  48503. onClick: expandable ? () => onExpand(!expanded) : void 0,
  48504. class: props.class
  48505. };
  48506. return vue.createVNode(ElIcon, vue.mergeProps(expandIconProps, {
  48507. "size": size,
  48508. "style": style
  48509. }), {
  48510. default: () => [vue.createVNode(arrow_right_default, null, null)]
  48511. });
  48512. };
  48513. var ExpandIcon$1 = ExpandIcon;
  48514. const COMPONENT_NAME$5 = "ElTableV2Grid";
  48515. const useTableGrid = (props) => {
  48516. const headerRef = vue.ref();
  48517. const bodyRef = vue.ref();
  48518. const scrollLeft = vue.ref(0);
  48519. const totalHeight = vue.computed(() => {
  48520. const {
  48521. data,
  48522. rowHeight,
  48523. estimatedRowHeight
  48524. } = props;
  48525. if (estimatedRowHeight) {
  48526. return;
  48527. }
  48528. return data.length * rowHeight;
  48529. });
  48530. const fixedRowHeight = vue.computed(() => {
  48531. const {
  48532. fixedData,
  48533. rowHeight
  48534. } = props;
  48535. return ((fixedData == null ? void 0 : fixedData.length) || 0) * rowHeight;
  48536. });
  48537. const headerHeight = vue.computed(() => sum(props.headerHeight));
  48538. const gridHeight = vue.computed(() => {
  48539. const {
  48540. height
  48541. } = props;
  48542. return Math.max(0, height - vue.unref(headerHeight) - vue.unref(fixedRowHeight));
  48543. });
  48544. const hasHeader = vue.computed(() => {
  48545. return vue.unref(headerHeight) + vue.unref(fixedRowHeight) > 0;
  48546. });
  48547. const itemKey = ({
  48548. data,
  48549. rowIndex
  48550. }) => data[rowIndex][props.rowKey];
  48551. function onItemRendered({
  48552. rowCacheStart,
  48553. rowCacheEnd,
  48554. rowVisibleStart,
  48555. rowVisibleEnd
  48556. }) {
  48557. var _a;
  48558. (_a = props.onRowsRendered) == null ? void 0 : _a.call(props, {
  48559. rowCacheStart,
  48560. rowCacheEnd,
  48561. rowVisibleStart,
  48562. rowVisibleEnd
  48563. });
  48564. }
  48565. function resetAfterRowIndex(index, forceUpdate2) {
  48566. var _a;
  48567. (_a = bodyRef.value) == null ? void 0 : _a.resetAfterRowIndex(index, forceUpdate2);
  48568. }
  48569. function scrollTo(leftOrOptions, top) {
  48570. const header$ = vue.unref(headerRef);
  48571. const body$ = vue.unref(bodyRef);
  48572. if (isObject$1(leftOrOptions)) {
  48573. header$ == null ? void 0 : header$.scrollToLeft(leftOrOptions.scrollLeft);
  48574. scrollLeft.value = leftOrOptions.scrollLeft;
  48575. body$ == null ? void 0 : body$.scrollTo(leftOrOptions);
  48576. } else {
  48577. header$ == null ? void 0 : header$.scrollToLeft(leftOrOptions);
  48578. scrollLeft.value = leftOrOptions;
  48579. body$ == null ? void 0 : body$.scrollTo({
  48580. scrollLeft: leftOrOptions,
  48581. scrollTop: top
  48582. });
  48583. }
  48584. }
  48585. function scrollToTop(scrollTop) {
  48586. var _a;
  48587. (_a = vue.unref(bodyRef)) == null ? void 0 : _a.scrollTo({
  48588. scrollTop
  48589. });
  48590. }
  48591. function scrollToRow(row, strategy) {
  48592. var _a;
  48593. (_a = vue.unref(bodyRef)) == null ? void 0 : _a.scrollToItem(row, 1, strategy);
  48594. }
  48595. function forceUpdate() {
  48596. var _a, _b;
  48597. (_a = vue.unref(bodyRef)) == null ? void 0 : _a.$forceUpdate();
  48598. (_b = vue.unref(headerRef)) == null ? void 0 : _b.$forceUpdate();
  48599. }
  48600. return {
  48601. bodyRef,
  48602. forceUpdate,
  48603. fixedRowHeight,
  48604. gridHeight,
  48605. hasHeader,
  48606. headerHeight,
  48607. headerRef,
  48608. totalHeight,
  48609. itemKey,
  48610. onItemRendered,
  48611. resetAfterRowIndex,
  48612. scrollTo,
  48613. scrollToTop,
  48614. scrollToRow,
  48615. scrollLeft
  48616. };
  48617. };
  48618. const TableGrid = vue.defineComponent({
  48619. name: COMPONENT_NAME$5,
  48620. props: tableV2GridProps,
  48621. setup(props, {
  48622. slots,
  48623. expose
  48624. }) {
  48625. const {
  48626. ns
  48627. } = vue.inject(TableV2InjectionKey);
  48628. const {
  48629. bodyRef,
  48630. fixedRowHeight,
  48631. gridHeight,
  48632. hasHeader,
  48633. headerRef,
  48634. headerHeight,
  48635. totalHeight,
  48636. forceUpdate,
  48637. itemKey,
  48638. onItemRendered,
  48639. resetAfterRowIndex,
  48640. scrollTo,
  48641. scrollToTop,
  48642. scrollToRow,
  48643. scrollLeft
  48644. } = useTableGrid(props);
  48645. vue.provide("tableV2GridScrollLeft", scrollLeft);
  48646. expose({
  48647. forceUpdate,
  48648. totalHeight,
  48649. scrollTo,
  48650. scrollToTop,
  48651. scrollToRow,
  48652. resetAfterRowIndex
  48653. });
  48654. const getColumnWidth = () => props.bodyWidth;
  48655. return () => {
  48656. const {
  48657. cache,
  48658. columns,
  48659. data,
  48660. fixedData,
  48661. useIsScrolling,
  48662. scrollbarAlwaysOn,
  48663. scrollbarEndGap,
  48664. scrollbarStartGap,
  48665. style,
  48666. rowHeight,
  48667. bodyWidth,
  48668. estimatedRowHeight,
  48669. headerWidth,
  48670. height,
  48671. width,
  48672. getRowHeight,
  48673. onScroll
  48674. } = props;
  48675. const isDynamicRowEnabled = isNumber(estimatedRowHeight);
  48676. const Grid = isDynamicRowEnabled ? DynamicSizeGrid$1 : FixedSizeGrid$1;
  48677. const _headerHeight = vue.unref(headerHeight);
  48678. return vue.createVNode("div", {
  48679. "role": "table",
  48680. "class": [ns.e("table"), props.class],
  48681. "style": style
  48682. }, [vue.createVNode(Grid, {
  48683. "ref": bodyRef,
  48684. "data": data,
  48685. "useIsScrolling": useIsScrolling,
  48686. "itemKey": itemKey,
  48687. "columnCache": 0,
  48688. "columnWidth": isDynamicRowEnabled ? getColumnWidth : bodyWidth,
  48689. "totalColumn": 1,
  48690. "totalRow": data.length,
  48691. "rowCache": cache,
  48692. "rowHeight": isDynamicRowEnabled ? getRowHeight : rowHeight,
  48693. "width": width,
  48694. "height": vue.unref(gridHeight),
  48695. "class": ns.e("body"),
  48696. "role": "rowgroup",
  48697. "scrollbarStartGap": scrollbarStartGap,
  48698. "scrollbarEndGap": scrollbarEndGap,
  48699. "scrollbarAlwaysOn": scrollbarAlwaysOn,
  48700. "onScroll": onScroll,
  48701. "onItemRendered": onItemRendered,
  48702. "perfMode": false
  48703. }, {
  48704. default: (params) => {
  48705. var _a;
  48706. const rowData = data[params.rowIndex];
  48707. return (_a = slots.row) == null ? void 0 : _a.call(slots, {
  48708. ...params,
  48709. columns,
  48710. rowData
  48711. });
  48712. }
  48713. }), vue.unref(hasHeader) && vue.createVNode(Header, {
  48714. "ref": headerRef,
  48715. "class": ns.e("header-wrapper"),
  48716. "columns": columns,
  48717. "headerData": data,
  48718. "headerHeight": props.headerHeight,
  48719. "fixedHeaderData": fixedData,
  48720. "rowWidth": headerWidth,
  48721. "rowHeight": rowHeight,
  48722. "width": width,
  48723. "height": Math.min(_headerHeight + vue.unref(fixedRowHeight), height)
  48724. }, {
  48725. dynamic: slots.header,
  48726. fixed: slots.row
  48727. })]);
  48728. };
  48729. }
  48730. });
  48731. function _isSlot$5(s) {
  48732. return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !vue.isVNode(s);
  48733. }
  48734. const MainTable = (props, {
  48735. slots
  48736. }) => {
  48737. const {
  48738. mainTableRef,
  48739. ...rest
  48740. } = props;
  48741. return vue.createVNode(TableGrid, vue.mergeProps({
  48742. "ref": mainTableRef
  48743. }, rest), _isSlot$5(slots) ? slots : {
  48744. default: () => [slots]
  48745. });
  48746. };
  48747. function _isSlot$4(s) {
  48748. return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !vue.isVNode(s);
  48749. }
  48750. const LeftTable$1 = (props, {
  48751. slots
  48752. }) => {
  48753. if (!props.columns.length)
  48754. return;
  48755. const {
  48756. leftTableRef,
  48757. ...rest
  48758. } = props;
  48759. return vue.createVNode(TableGrid, vue.mergeProps({
  48760. "ref": leftTableRef
  48761. }, rest), _isSlot$4(slots) ? slots : {
  48762. default: () => [slots]
  48763. });
  48764. };
  48765. function _isSlot$3(s) {
  48766. return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !vue.isVNode(s);
  48767. }
  48768. const LeftTable = (props, {
  48769. slots
  48770. }) => {
  48771. if (!props.columns.length)
  48772. return;
  48773. const {
  48774. rightTableRef,
  48775. ...rest
  48776. } = props;
  48777. return vue.createVNode(TableGrid, vue.mergeProps({
  48778. "ref": rightTableRef
  48779. }, rest), _isSlot$3(slots) ? slots : {
  48780. default: () => [slots]
  48781. });
  48782. };
  48783. function _isSlot$2(s) {
  48784. return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !vue.isVNode(s);
  48785. }
  48786. const RowRenderer = (props, {
  48787. slots
  48788. }) => {
  48789. const {
  48790. columns,
  48791. columnsStyles,
  48792. depthMap,
  48793. expandColumnKey,
  48794. expandedRowKeys,
  48795. estimatedRowHeight,
  48796. hasFixedColumns,
  48797. rowData,
  48798. rowIndex,
  48799. style,
  48800. isScrolling,
  48801. rowProps,
  48802. rowClass,
  48803. rowKey,
  48804. rowEventHandlers,
  48805. ns,
  48806. onRowHovered,
  48807. onRowExpanded
  48808. } = props;
  48809. const rowKls = tryCall(rowClass, {
  48810. columns,
  48811. rowData,
  48812. rowIndex
  48813. }, "");
  48814. const additionalProps = tryCall(rowProps, {
  48815. columns,
  48816. rowData,
  48817. rowIndex
  48818. });
  48819. const _rowKey = rowData[rowKey];
  48820. const depth = depthMap[_rowKey] || 0;
  48821. const canExpand = Boolean(expandColumnKey);
  48822. const isFixedRow = rowIndex < 0;
  48823. const kls = [ns.e("row"), rowKls, {
  48824. [ns.e(`row-depth-${depth}`)]: canExpand && rowIndex >= 0,
  48825. [ns.is("expanded")]: canExpand && expandedRowKeys.includes(_rowKey),
  48826. [ns.is("fixed")]: !depth && isFixedRow,
  48827. [ns.is("customized")]: Boolean(slots.row)
  48828. }];
  48829. const onRowHover = hasFixedColumns ? onRowHovered : void 0;
  48830. const _rowProps = {
  48831. ...additionalProps,
  48832. columns,
  48833. columnsStyles,
  48834. class: kls,
  48835. depth,
  48836. expandColumnKey,
  48837. estimatedRowHeight: isFixedRow ? void 0 : estimatedRowHeight,
  48838. isScrolling,
  48839. rowIndex,
  48840. rowData,
  48841. rowKey: _rowKey,
  48842. rowEventHandlers,
  48843. style
  48844. };
  48845. const handlerMosueEnter = (e) => {
  48846. onRowHover == null ? void 0 : onRowHover({
  48847. hovered: true,
  48848. rowKey: _rowKey,
  48849. event: e,
  48850. rowData,
  48851. rowIndex
  48852. });
  48853. };
  48854. const handlerMouseLeave = (e) => {
  48855. onRowHover == null ? void 0 : onRowHover({
  48856. hovered: false,
  48857. rowKey: _rowKey,
  48858. event: e,
  48859. rowData,
  48860. rowIndex
  48861. });
  48862. };
  48863. return vue.createVNode(Row, vue.mergeProps(_rowProps, {
  48864. "onRowExpand": onRowExpanded,
  48865. "onMouseenter": handlerMosueEnter,
  48866. "onMouseleave": handlerMouseLeave,
  48867. "rowkey": _rowKey
  48868. }), _isSlot$2(slots) ? slots : {
  48869. default: () => [slots]
  48870. });
  48871. };
  48872. const CellRenderer = ({
  48873. columns,
  48874. column,
  48875. columnIndex,
  48876. depth,
  48877. expandIconProps,
  48878. isScrolling,
  48879. rowData,
  48880. rowIndex,
  48881. style,
  48882. expandedRowKeys,
  48883. ns,
  48884. cellProps: _cellProps,
  48885. expandColumnKey,
  48886. indentSize,
  48887. iconSize,
  48888. rowKey
  48889. }, {
  48890. slots
  48891. }) => {
  48892. const cellStyle = enforceUnit(style);
  48893. if (column.placeholderSign === placeholderSign) {
  48894. return vue.createVNode("div", {
  48895. "class": ns.em("row-cell", "placeholder"),
  48896. "style": cellStyle
  48897. }, null);
  48898. }
  48899. const {
  48900. cellRenderer,
  48901. dataKey,
  48902. dataGetter
  48903. } = column;
  48904. const cellData = isFunction$1(dataGetter) ? dataGetter({
  48905. columns,
  48906. column,
  48907. columnIndex,
  48908. rowData,
  48909. rowIndex
  48910. }) : get(rowData, dataKey != null ? dataKey : "");
  48911. const extraCellProps = tryCall(_cellProps, {
  48912. cellData,
  48913. columns,
  48914. column,
  48915. columnIndex,
  48916. rowIndex,
  48917. rowData
  48918. });
  48919. const cellProps = {
  48920. class: ns.e("cell-text"),
  48921. columns,
  48922. column,
  48923. columnIndex,
  48924. cellData,
  48925. isScrolling,
  48926. rowData,
  48927. rowIndex
  48928. };
  48929. const columnCellRenderer = componentToSlot(cellRenderer);
  48930. const Cell = columnCellRenderer ? columnCellRenderer(cellProps) : vue.renderSlot(slots, "default", cellProps, () => [vue.createVNode(TableCell, cellProps, null)]);
  48931. const kls = [ns.e("row-cell"), column.class, column.align === Alignment.CENTER && ns.is("align-center"), column.align === Alignment.RIGHT && ns.is("align-right")];
  48932. const expandable = rowIndex >= 0 && expandColumnKey && column.key === expandColumnKey;
  48933. const expanded = rowIndex >= 0 && expandedRowKeys.includes(rowData[rowKey]);
  48934. let IconOrPlaceholder;
  48935. const iconStyle = `margin-inline-start: ${depth * indentSize}px;`;
  48936. if (expandable) {
  48937. if (isObject$1(expandIconProps)) {
  48938. IconOrPlaceholder = vue.createVNode(ExpandIcon$1, vue.mergeProps(expandIconProps, {
  48939. "class": [ns.e("expand-icon"), ns.is("expanded", expanded)],
  48940. "size": iconSize,
  48941. "expanded": expanded,
  48942. "style": iconStyle,
  48943. "expandable": true
  48944. }), null);
  48945. } else {
  48946. IconOrPlaceholder = vue.createVNode("div", {
  48947. "style": [iconStyle, `width: ${iconSize}px; height: ${iconSize}px;`].join(" ")
  48948. }, null);
  48949. }
  48950. }
  48951. return vue.createVNode("div", vue.mergeProps({
  48952. "class": kls,
  48953. "style": cellStyle
  48954. }, extraCellProps, {
  48955. "role": "cell"
  48956. }), [IconOrPlaceholder, Cell]);
  48957. };
  48958. CellRenderer.inheritAttrs = false;
  48959. function _isSlot$1(s) {
  48960. return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !vue.isVNode(s);
  48961. }
  48962. const HeaderRenderer = ({
  48963. columns,
  48964. columnsStyles,
  48965. headerIndex,
  48966. style,
  48967. headerClass,
  48968. headerProps,
  48969. ns
  48970. }, {
  48971. slots
  48972. }) => {
  48973. const param = {
  48974. columns,
  48975. headerIndex
  48976. };
  48977. const kls = [ns.e("header-row"), tryCall(headerClass, param, ""), {
  48978. [ns.is("customized")]: Boolean(slots.header)
  48979. }];
  48980. const extraProps = {
  48981. ...tryCall(headerProps, param),
  48982. columnsStyles,
  48983. class: kls,
  48984. columns,
  48985. headerIndex,
  48986. style
  48987. };
  48988. return vue.createVNode(HeaderRow, extraProps, _isSlot$1(slots) ? slots : {
  48989. default: () => [slots]
  48990. });
  48991. };
  48992. const HeaderCellRenderer = (props, {
  48993. slots
  48994. }) => {
  48995. const {
  48996. column,
  48997. ns,
  48998. style,
  48999. onColumnSorted
  49000. } = props;
  49001. const cellStyle = enforceUnit(style);
  49002. if (column.placeholderSign === placeholderSign) {
  49003. return vue.createVNode("div", {
  49004. "class": ns.em("header-row-cell", "placeholder"),
  49005. "style": cellStyle
  49006. }, null);
  49007. }
  49008. const {
  49009. headerCellRenderer,
  49010. headerClass,
  49011. sortable
  49012. } = column;
  49013. const cellProps = {
  49014. ...props,
  49015. class: ns.e("header-cell-text")
  49016. };
  49017. const columnCellRenderer = componentToSlot(headerCellRenderer);
  49018. const Cell = columnCellRenderer ? columnCellRenderer(cellProps) : vue.renderSlot(slots, "default", cellProps, () => [vue.createVNode(HeaderCell$1, cellProps, null)]);
  49019. const {
  49020. sortBy,
  49021. sortState,
  49022. headerCellProps
  49023. } = props;
  49024. let sorting, sortOrder;
  49025. if (sortState) {
  49026. const order = sortState[column.key];
  49027. sorting = Boolean(oppositeOrderMap[order]);
  49028. sortOrder = sorting ? order : SortOrder.ASC;
  49029. } else {
  49030. sorting = column.key === sortBy.key;
  49031. sortOrder = sorting ? sortBy.order : SortOrder.ASC;
  49032. }
  49033. const cellKls = [ns.e("header-cell"), tryCall(headerClass, props, ""), column.align === Alignment.CENTER && ns.is("align-center"), column.align === Alignment.RIGHT && ns.is("align-right"), sortable && ns.is("sortable")];
  49034. const cellWrapperProps = {
  49035. ...tryCall(headerCellProps, props),
  49036. onClick: column.sortable ? onColumnSorted : void 0,
  49037. class: cellKls,
  49038. style: cellStyle,
  49039. ["data-key"]: column.key
  49040. };
  49041. return vue.createVNode("div", vue.mergeProps(cellWrapperProps, {
  49042. "role": "columnheader"
  49043. }), [Cell, sortable && vue.createVNode(SortIcon$1, {
  49044. "class": [ns.e("sort-icon"), sorting && ns.is("sorting")],
  49045. "sortOrder": sortOrder
  49046. }, null)]);
  49047. };
  49048. const Footer$1 = (props, {
  49049. slots
  49050. }) => {
  49051. var _a;
  49052. return vue.createVNode("div", {
  49053. "class": props.class,
  49054. "style": props.style
  49055. }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
  49056. };
  49057. Footer$1.displayName = "ElTableV2Footer";
  49058. const Footer = (props, {
  49059. slots
  49060. }) => {
  49061. const defaultSlot = vue.renderSlot(slots, "default", {}, () => [vue.createVNode(ElEmpty, null, null)]);
  49062. return vue.createVNode("div", {
  49063. "class": props.class,
  49064. "style": props.style
  49065. }, [defaultSlot]);
  49066. };
  49067. Footer.displayName = "ElTableV2Empty";
  49068. const Overlay = (props, {
  49069. slots
  49070. }) => {
  49071. var _a;
  49072. return vue.createVNode("div", {
  49073. "class": props.class,
  49074. "style": props.style
  49075. }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
  49076. };
  49077. Overlay.displayName = "ElTableV2Overlay";
  49078. function _isSlot(s) {
  49079. return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !vue.isVNode(s);
  49080. }
  49081. const COMPONENT_NAME$4 = "ElTableV2";
  49082. const TableV2 = vue.defineComponent({
  49083. name: COMPONENT_NAME$4,
  49084. props: tableV2Props,
  49085. setup(props, {
  49086. slots,
  49087. expose
  49088. }) {
  49089. const ns = useNamespace("table-v2");
  49090. const {
  49091. columnsStyles,
  49092. fixedColumnsOnLeft,
  49093. fixedColumnsOnRight,
  49094. mainColumns,
  49095. mainTableHeight,
  49096. fixedTableHeight,
  49097. leftTableWidth,
  49098. rightTableWidth,
  49099. data,
  49100. depthMap,
  49101. expandedRowKeys,
  49102. hasFixedColumns,
  49103. mainTableRef,
  49104. leftTableRef,
  49105. rightTableRef,
  49106. isDynamic,
  49107. isResetting,
  49108. isScrolling,
  49109. bodyWidth,
  49110. emptyStyle,
  49111. rootStyle,
  49112. headerWidth,
  49113. footerHeight,
  49114. showEmpty,
  49115. scrollTo,
  49116. scrollToLeft,
  49117. scrollToTop,
  49118. scrollToRow,
  49119. getRowHeight,
  49120. onColumnSorted,
  49121. onRowHeightChange,
  49122. onRowHovered,
  49123. onRowExpanded,
  49124. onRowsRendered,
  49125. onScroll,
  49126. onVerticalScroll
  49127. } = useTable(props);
  49128. expose({
  49129. scrollTo,
  49130. scrollToLeft,
  49131. scrollToTop,
  49132. scrollToRow
  49133. });
  49134. vue.provide(TableV2InjectionKey, {
  49135. ns,
  49136. isResetting,
  49137. isScrolling
  49138. });
  49139. return () => {
  49140. const {
  49141. cache,
  49142. cellProps,
  49143. estimatedRowHeight,
  49144. expandColumnKey,
  49145. fixedData,
  49146. headerHeight,
  49147. headerClass,
  49148. headerProps,
  49149. headerCellProps,
  49150. sortBy,
  49151. sortState,
  49152. rowHeight,
  49153. rowClass,
  49154. rowEventHandlers,
  49155. rowKey,
  49156. rowProps,
  49157. scrollbarAlwaysOn,
  49158. indentSize,
  49159. iconSize,
  49160. useIsScrolling,
  49161. vScrollbarSize,
  49162. width
  49163. } = props;
  49164. const _data = vue.unref(data);
  49165. const mainTableProps = {
  49166. cache,
  49167. class: ns.e("main"),
  49168. columns: vue.unref(mainColumns),
  49169. data: _data,
  49170. fixedData,
  49171. estimatedRowHeight,
  49172. bodyWidth: vue.unref(bodyWidth) + vScrollbarSize,
  49173. headerHeight,
  49174. headerWidth: vue.unref(headerWidth),
  49175. height: vue.unref(mainTableHeight),
  49176. mainTableRef,
  49177. rowKey,
  49178. rowHeight,
  49179. scrollbarAlwaysOn,
  49180. scrollbarStartGap: 2,
  49181. scrollbarEndGap: vScrollbarSize,
  49182. useIsScrolling,
  49183. width,
  49184. getRowHeight,
  49185. onRowsRendered,
  49186. onScroll
  49187. };
  49188. const leftColumnsWidth = vue.unref(leftTableWidth);
  49189. const _fixedTableHeight = vue.unref(fixedTableHeight);
  49190. const leftTableProps = {
  49191. cache,
  49192. class: ns.e("left"),
  49193. columns: vue.unref(fixedColumnsOnLeft),
  49194. data: _data,
  49195. estimatedRowHeight,
  49196. leftTableRef,
  49197. rowHeight,
  49198. bodyWidth: leftColumnsWidth,
  49199. headerWidth: leftColumnsWidth,
  49200. headerHeight,
  49201. height: _fixedTableHeight,
  49202. rowKey,
  49203. scrollbarAlwaysOn,
  49204. scrollbarStartGap: 2,
  49205. scrollbarEndGap: vScrollbarSize,
  49206. useIsScrolling,
  49207. width: leftColumnsWidth,
  49208. getRowHeight,
  49209. onScroll: onVerticalScroll
  49210. };
  49211. const rightColumnsWidth = vue.unref(rightTableWidth);
  49212. const rightColumnsWidthWithScrollbar = rightColumnsWidth + vScrollbarSize;
  49213. const rightTableProps = {
  49214. cache,
  49215. class: ns.e("right"),
  49216. columns: vue.unref(fixedColumnsOnRight),
  49217. data: _data,
  49218. estimatedRowHeight,
  49219. rightTableRef,
  49220. rowHeight,
  49221. bodyWidth: rightColumnsWidthWithScrollbar,
  49222. headerWidth: rightColumnsWidthWithScrollbar,
  49223. headerHeight,
  49224. height: _fixedTableHeight,
  49225. rowKey,
  49226. scrollbarAlwaysOn,
  49227. scrollbarStartGap: 2,
  49228. scrollbarEndGap: vScrollbarSize,
  49229. width: rightColumnsWidthWithScrollbar,
  49230. style: `--${vue.unref(ns.namespace)}-table-scrollbar-size: ${vScrollbarSize}px`,
  49231. useIsScrolling,
  49232. getRowHeight,
  49233. onScroll: onVerticalScroll
  49234. };
  49235. const _columnsStyles = vue.unref(columnsStyles);
  49236. const tableRowProps = {
  49237. ns,
  49238. depthMap: vue.unref(depthMap),
  49239. columnsStyles: _columnsStyles,
  49240. expandColumnKey,
  49241. expandedRowKeys: vue.unref(expandedRowKeys),
  49242. estimatedRowHeight,
  49243. hasFixedColumns: vue.unref(hasFixedColumns),
  49244. rowProps,
  49245. rowClass,
  49246. rowKey,
  49247. rowEventHandlers,
  49248. onRowHovered,
  49249. onRowExpanded,
  49250. onRowHeightChange
  49251. };
  49252. const tableCellProps = {
  49253. cellProps,
  49254. expandColumnKey,
  49255. indentSize,
  49256. iconSize,
  49257. rowKey,
  49258. expandedRowKeys: vue.unref(expandedRowKeys),
  49259. ns
  49260. };
  49261. const tableHeaderProps = {
  49262. ns,
  49263. headerClass,
  49264. headerProps,
  49265. columnsStyles: _columnsStyles
  49266. };
  49267. const tableHeaderCellProps = {
  49268. ns,
  49269. sortBy,
  49270. sortState,
  49271. headerCellProps,
  49272. onColumnSorted
  49273. };
  49274. const tableSlots = {
  49275. row: (props2) => vue.createVNode(RowRenderer, vue.mergeProps(props2, tableRowProps), {
  49276. row: slots.row,
  49277. cell: (props3) => {
  49278. let _slot;
  49279. return slots.cell ? vue.createVNode(CellRenderer, vue.mergeProps(props3, tableCellProps, {
  49280. "style": _columnsStyles[props3.column.key]
  49281. }), _isSlot(_slot = slots.cell(props3)) ? _slot : {
  49282. default: () => [_slot]
  49283. }) : vue.createVNode(CellRenderer, vue.mergeProps(props3, tableCellProps, {
  49284. "style": _columnsStyles[props3.column.key]
  49285. }), null);
  49286. }
  49287. }),
  49288. header: (props2) => vue.createVNode(HeaderRenderer, vue.mergeProps(props2, tableHeaderProps), {
  49289. header: slots.header,
  49290. cell: (props3) => {
  49291. let _slot2;
  49292. return slots["header-cell"] ? vue.createVNode(HeaderCellRenderer, vue.mergeProps(props3, tableHeaderCellProps, {
  49293. "style": _columnsStyles[props3.column.key]
  49294. }), _isSlot(_slot2 = slots["header-cell"](props3)) ? _slot2 : {
  49295. default: () => [_slot2]
  49296. }) : vue.createVNode(HeaderCellRenderer, vue.mergeProps(props3, tableHeaderCellProps, {
  49297. "style": _columnsStyles[props3.column.key]
  49298. }), null);
  49299. }
  49300. })
  49301. };
  49302. const rootKls = [props.class, ns.b(), ns.e("root"), {
  49303. [ns.is("dynamic")]: vue.unref(isDynamic)
  49304. }];
  49305. const footerProps = {
  49306. class: ns.e("footer"),
  49307. style: vue.unref(footerHeight)
  49308. };
  49309. return vue.createVNode("div", {
  49310. "class": rootKls,
  49311. "style": vue.unref(rootStyle)
  49312. }, [vue.createVNode(MainTable, mainTableProps, _isSlot(tableSlots) ? tableSlots : {
  49313. default: () => [tableSlots]
  49314. }), vue.createVNode(LeftTable$1, leftTableProps, _isSlot(tableSlots) ? tableSlots : {
  49315. default: () => [tableSlots]
  49316. }), vue.createVNode(LeftTable, rightTableProps, _isSlot(tableSlots) ? tableSlots : {
  49317. default: () => [tableSlots]
  49318. }), slots.footer && vue.createVNode(Footer$1, footerProps, {
  49319. default: slots.footer
  49320. }), vue.unref(showEmpty) && vue.createVNode(Footer, {
  49321. "class": ns.e("empty"),
  49322. "style": vue.unref(emptyStyle)
  49323. }, {
  49324. default: slots.empty
  49325. }), slots.overlay && vue.createVNode(Overlay, {
  49326. "class": ns.e("overlay")
  49327. }, {
  49328. default: slots.overlay
  49329. })]);
  49330. };
  49331. }
  49332. });
  49333. var TableV2$1 = TableV2;
  49334. const autoResizerProps = buildProps({
  49335. disableWidth: Boolean,
  49336. disableHeight: Boolean,
  49337. onResize: {
  49338. type: definePropType(Function)
  49339. }
  49340. });
  49341. const AutoResizer = vue.defineComponent({
  49342. name: "ElAutoResizer",
  49343. props: autoResizerProps,
  49344. setup(props, {
  49345. slots
  49346. }) {
  49347. const ns = useNamespace("auto-resizer");
  49348. const {
  49349. height,
  49350. width,
  49351. sizer
  49352. } = useAutoResize(props);
  49353. const style = {
  49354. width: "100%",
  49355. height: "100%"
  49356. };
  49357. return () => {
  49358. var _a;
  49359. return vue.createVNode("div", {
  49360. "ref": sizer,
  49361. "class": ns.b(),
  49362. "style": style
  49363. }, [(_a = slots.default) == null ? void 0 : _a.call(slots, {
  49364. height: height.value,
  49365. width: width.value
  49366. })]);
  49367. };
  49368. }
  49369. });
  49370. const ElTableV2 = withInstall(TableV2$1);
  49371. const ElAutoResizer = withInstall(AutoResizer);
  49372. const tabsRootContextKey = Symbol("tabsRootContextKey");
  49373. const tabBarProps = buildProps({
  49374. tabs: {
  49375. type: definePropType(Array),
  49376. default: () => mutable([])
  49377. }
  49378. });
  49379. const COMPONENT_NAME$3 = "ElTabBar";
  49380. const __default__$u = vue.defineComponent({
  49381. name: COMPONENT_NAME$3
  49382. });
  49383. const _sfc_main$z = /* @__PURE__ */ vue.defineComponent({
  49384. ...__default__$u,
  49385. props: tabBarProps,
  49386. setup(__props, { expose }) {
  49387. const props = __props;
  49388. const instance = vue.getCurrentInstance();
  49389. const rootTabs = vue.inject(tabsRootContextKey);
  49390. if (!rootTabs)
  49391. throwError(COMPONENT_NAME$3, "<el-tabs><el-tab-bar /></el-tabs>");
  49392. const ns = useNamespace("tabs");
  49393. const barRef = vue.ref();
  49394. const barStyle = vue.ref();
  49395. const getBarStyle = () => {
  49396. let offset = 0;
  49397. let tabSize = 0;
  49398. const sizeName = ["top", "bottom"].includes(rootTabs.props.tabPosition) ? "width" : "height";
  49399. const sizeDir = sizeName === "width" ? "x" : "y";
  49400. const position = sizeDir === "x" ? "left" : "top";
  49401. props.tabs.every((tab) => {
  49402. var _a, _b;
  49403. const $el = (_b = (_a = instance.parent) == null ? void 0 : _a.refs) == null ? void 0 : _b[`tab-${tab.uid}`];
  49404. if (!$el)
  49405. return false;
  49406. if (!tab.active) {
  49407. return true;
  49408. }
  49409. offset = $el[`offset${capitalize(position)}`];
  49410. tabSize = $el[`client${capitalize(sizeName)}`];
  49411. const tabStyles = window.getComputedStyle($el);
  49412. if (sizeName === "width") {
  49413. tabSize -= Number.parseFloat(tabStyles.paddingLeft) + Number.parseFloat(tabStyles.paddingRight);
  49414. offset += Number.parseFloat(tabStyles.paddingLeft);
  49415. }
  49416. return false;
  49417. });
  49418. return {
  49419. [sizeName]: `${tabSize}px`,
  49420. transform: `translate${capitalize(sizeDir)}(${offset}px)`
  49421. };
  49422. };
  49423. const update = () => barStyle.value = getBarStyle();
  49424. const saveObserver = [];
  49425. const observerTabs = () => {
  49426. var _a;
  49427. saveObserver.forEach((observer) => observer.stop());
  49428. saveObserver.length = 0;
  49429. const list = (_a = instance.parent) == null ? void 0 : _a.refs;
  49430. if (!list)
  49431. return;
  49432. for (const key in list) {
  49433. if (key.startsWith("tab-")) {
  49434. const _el = list[key];
  49435. if (_el) {
  49436. saveObserver.push(useResizeObserver(_el, update));
  49437. }
  49438. }
  49439. }
  49440. };
  49441. vue.watch(() => props.tabs, async () => {
  49442. await vue.nextTick();
  49443. update();
  49444. observerTabs();
  49445. }, { immediate: true });
  49446. const barObserever = useResizeObserver(barRef, () => update());
  49447. vue.onBeforeUnmount(() => {
  49448. saveObserver.forEach((observer) => observer.stop());
  49449. saveObserver.length = 0;
  49450. barObserever.stop();
  49451. });
  49452. expose({
  49453. ref: barRef,
  49454. update
  49455. });
  49456. return (_ctx, _cache) => {
  49457. return vue.openBlock(), vue.createElementBlock("div", {
  49458. ref_key: "barRef",
  49459. ref: barRef,
  49460. class: vue.normalizeClass([vue.unref(ns).e("active-bar"), vue.unref(ns).is(vue.unref(rootTabs).props.tabPosition)]),
  49461. style: vue.normalizeStyle(barStyle.value)
  49462. }, null, 6);
  49463. };
  49464. }
  49465. });
  49466. var TabBar = /* @__PURE__ */ _export_sfc(_sfc_main$z, [["__file", "tab-bar.vue"]]);
  49467. const tabNavProps = buildProps({
  49468. panes: {
  49469. type: definePropType(Array),
  49470. default: () => mutable([])
  49471. },
  49472. currentName: {
  49473. type: [String, Number],
  49474. default: ""
  49475. },
  49476. editable: Boolean,
  49477. type: {
  49478. type: String,
  49479. values: ["card", "border-card", ""],
  49480. default: ""
  49481. },
  49482. stretch: Boolean
  49483. });
  49484. const tabNavEmits = {
  49485. tabClick: (tab, tabName, ev) => ev instanceof Event,
  49486. tabRemove: (tab, ev) => ev instanceof Event
  49487. };
  49488. const COMPONENT_NAME$2 = "ElTabNav";
  49489. const TabNav = vue.defineComponent({
  49490. name: COMPONENT_NAME$2,
  49491. props: tabNavProps,
  49492. emits: tabNavEmits,
  49493. setup(props, {
  49494. expose,
  49495. emit
  49496. }) {
  49497. const rootTabs = vue.inject(tabsRootContextKey);
  49498. if (!rootTabs)
  49499. throwError(COMPONENT_NAME$2, `<el-tabs><tab-nav /></el-tabs>`);
  49500. const ns = useNamespace("tabs");
  49501. const visibility = useDocumentVisibility();
  49502. const focused = useWindowFocus();
  49503. const navScroll$ = vue.ref();
  49504. const nav$ = vue.ref();
  49505. const el$ = vue.ref();
  49506. const tabBarRef = vue.ref();
  49507. const scrollable = vue.ref(false);
  49508. const navOffset = vue.ref(0);
  49509. const isFocus = vue.ref(false);
  49510. const focusable = vue.ref(true);
  49511. const sizeName = vue.computed(() => ["top", "bottom"].includes(rootTabs.props.tabPosition) ? "width" : "height");
  49512. const navStyle = vue.computed(() => {
  49513. const dir = sizeName.value === "width" ? "X" : "Y";
  49514. return {
  49515. transform: `translate${dir}(-${navOffset.value}px)`
  49516. };
  49517. });
  49518. const scrollPrev = () => {
  49519. if (!navScroll$.value)
  49520. return;
  49521. const containerSize = navScroll$.value[`offset${capitalize(sizeName.value)}`];
  49522. const currentOffset = navOffset.value;
  49523. if (!currentOffset)
  49524. return;
  49525. const newOffset = currentOffset > containerSize ? currentOffset - containerSize : 0;
  49526. navOffset.value = newOffset;
  49527. };
  49528. const scrollNext = () => {
  49529. if (!navScroll$.value || !nav$.value)
  49530. return;
  49531. const navSize = nav$.value[`offset${capitalize(sizeName.value)}`];
  49532. const containerSize = navScroll$.value[`offset${capitalize(sizeName.value)}`];
  49533. const currentOffset = navOffset.value;
  49534. if (navSize - currentOffset <= containerSize)
  49535. return;
  49536. const newOffset = navSize - currentOffset > containerSize * 2 ? currentOffset + containerSize : navSize - containerSize;
  49537. navOffset.value = newOffset;
  49538. };
  49539. const scrollToActiveTab = async () => {
  49540. const nav = nav$.value;
  49541. if (!scrollable.value || !el$.value || !navScroll$.value || !nav)
  49542. return;
  49543. await vue.nextTick();
  49544. const activeTab = el$.value.querySelector(".is-active");
  49545. if (!activeTab)
  49546. return;
  49547. const navScroll = navScroll$.value;
  49548. const isHorizontal = ["top", "bottom"].includes(rootTabs.props.tabPosition);
  49549. const activeTabBounding = activeTab.getBoundingClientRect();
  49550. const navScrollBounding = navScroll.getBoundingClientRect();
  49551. const maxOffset = isHorizontal ? nav.offsetWidth - navScrollBounding.width : nav.offsetHeight - navScrollBounding.height;
  49552. const currentOffset = navOffset.value;
  49553. let newOffset = currentOffset;
  49554. if (isHorizontal) {
  49555. if (activeTabBounding.left < navScrollBounding.left) {
  49556. newOffset = currentOffset - (navScrollBounding.left - activeTabBounding.left);
  49557. }
  49558. if (activeTabBounding.right > navScrollBounding.right) {
  49559. newOffset = currentOffset + activeTabBounding.right - navScrollBounding.right;
  49560. }
  49561. } else {
  49562. if (activeTabBounding.top < navScrollBounding.top) {
  49563. newOffset = currentOffset - (navScrollBounding.top - activeTabBounding.top);
  49564. }
  49565. if (activeTabBounding.bottom > navScrollBounding.bottom) {
  49566. newOffset = currentOffset + (activeTabBounding.bottom - navScrollBounding.bottom);
  49567. }
  49568. }
  49569. newOffset = Math.max(newOffset, 0);
  49570. navOffset.value = Math.min(newOffset, maxOffset);
  49571. };
  49572. const update = () => {
  49573. var _a;
  49574. if (!nav$.value || !navScroll$.value)
  49575. return;
  49576. props.stretch && ((_a = tabBarRef.value) == null ? void 0 : _a.update());
  49577. const navSize = nav$.value[`offset${capitalize(sizeName.value)}`];
  49578. const containerSize = navScroll$.value[`offset${capitalize(sizeName.value)}`];
  49579. const currentOffset = navOffset.value;
  49580. if (containerSize < navSize) {
  49581. scrollable.value = scrollable.value || {};
  49582. scrollable.value.prev = currentOffset;
  49583. scrollable.value.next = currentOffset + containerSize < navSize;
  49584. if (navSize - currentOffset < containerSize) {
  49585. navOffset.value = navSize - containerSize;
  49586. }
  49587. } else {
  49588. scrollable.value = false;
  49589. if (currentOffset > 0) {
  49590. navOffset.value = 0;
  49591. }
  49592. }
  49593. };
  49594. const changeTab = (event) => {
  49595. let step = 0;
  49596. switch (event.code) {
  49597. case EVENT_CODE.left:
  49598. case EVENT_CODE.up:
  49599. step = -1;
  49600. break;
  49601. case EVENT_CODE.right:
  49602. case EVENT_CODE.down:
  49603. step = 1;
  49604. break;
  49605. default:
  49606. return;
  49607. }
  49608. const tabList = Array.from(event.currentTarget.querySelectorAll("[role=tab]:not(.is-disabled)"));
  49609. const currentIndex = tabList.indexOf(event.target);
  49610. let nextIndex = currentIndex + step;
  49611. if (nextIndex < 0) {
  49612. nextIndex = tabList.length - 1;
  49613. } else if (nextIndex >= tabList.length) {
  49614. nextIndex = 0;
  49615. }
  49616. tabList[nextIndex].focus({
  49617. preventScroll: true
  49618. });
  49619. tabList[nextIndex].click();
  49620. setFocus();
  49621. };
  49622. const setFocus = () => {
  49623. if (focusable.value)
  49624. isFocus.value = true;
  49625. };
  49626. const removeFocus = () => isFocus.value = false;
  49627. vue.watch(visibility, (visibility2) => {
  49628. if (visibility2 === "hidden") {
  49629. focusable.value = false;
  49630. } else if (visibility2 === "visible") {
  49631. setTimeout(() => focusable.value = true, 50);
  49632. }
  49633. });
  49634. vue.watch(focused, (focused2) => {
  49635. if (focused2) {
  49636. setTimeout(() => focusable.value = true, 50);
  49637. } else {
  49638. focusable.value = false;
  49639. }
  49640. });
  49641. useResizeObserver(el$, update);
  49642. vue.onMounted(() => setTimeout(() => scrollToActiveTab(), 0));
  49643. vue.onUpdated(() => update());
  49644. expose({
  49645. scrollToActiveTab,
  49646. removeFocus
  49647. });
  49648. return () => {
  49649. const scrollBtn = scrollable.value ? [vue.createVNode("span", {
  49650. "class": [ns.e("nav-prev"), ns.is("disabled", !scrollable.value.prev)],
  49651. "onClick": scrollPrev
  49652. }, [vue.createVNode(ElIcon, null, {
  49653. default: () => [vue.createVNode(arrow_left_default, null, null)]
  49654. })]), vue.createVNode("span", {
  49655. "class": [ns.e("nav-next"), ns.is("disabled", !scrollable.value.next)],
  49656. "onClick": scrollNext
  49657. }, [vue.createVNode(ElIcon, null, {
  49658. default: () => [vue.createVNode(arrow_right_default, null, null)]
  49659. })])] : null;
  49660. const tabs = props.panes.map((pane, index) => {
  49661. var _a, _b, _c, _d;
  49662. const uid = pane.uid;
  49663. const disabled = pane.props.disabled;
  49664. const tabName = (_b = (_a = pane.props.name) != null ? _a : pane.index) != null ? _b : `${index}`;
  49665. const closable = !disabled && (pane.isClosable || props.editable);
  49666. pane.index = `${index}`;
  49667. const btnClose = closable ? vue.createVNode(ElIcon, {
  49668. "class": "is-icon-close",
  49669. "onClick": (ev) => emit("tabRemove", pane, ev)
  49670. }, {
  49671. default: () => [vue.createVNode(close_default, null, null)]
  49672. }) : null;
  49673. const tabLabelContent = ((_d = (_c = pane.slots).label) == null ? void 0 : _d.call(_c)) || pane.props.label;
  49674. const tabindex = !disabled && pane.active ? 0 : -1;
  49675. return vue.createVNode("div", {
  49676. "ref": `tab-${uid}`,
  49677. "class": [ns.e("item"), ns.is(rootTabs.props.tabPosition), ns.is("active", pane.active), ns.is("disabled", disabled), ns.is("closable", closable), ns.is("focus", isFocus.value)],
  49678. "id": `tab-${tabName}`,
  49679. "key": `tab-${uid}`,
  49680. "aria-controls": `pane-${tabName}`,
  49681. "role": "tab",
  49682. "aria-selected": pane.active,
  49683. "tabindex": tabindex,
  49684. "onFocus": () => setFocus(),
  49685. "onBlur": () => removeFocus(),
  49686. "onClick": (ev) => {
  49687. removeFocus();
  49688. emit("tabClick", pane, tabName, ev);
  49689. },
  49690. "onKeydown": (ev) => {
  49691. if (closable && (ev.code === EVENT_CODE.delete || ev.code === EVENT_CODE.backspace)) {
  49692. emit("tabRemove", pane, ev);
  49693. }
  49694. }
  49695. }, [...[tabLabelContent, btnClose]]);
  49696. });
  49697. return vue.createVNode("div", {
  49698. "ref": el$,
  49699. "class": [ns.e("nav-wrap"), ns.is("scrollable", !!scrollable.value), ns.is(rootTabs.props.tabPosition)]
  49700. }, [scrollBtn, vue.createVNode("div", {
  49701. "class": ns.e("nav-scroll"),
  49702. "ref": navScroll$
  49703. }, [vue.createVNode("div", {
  49704. "class": [ns.e("nav"), ns.is(rootTabs.props.tabPosition), ns.is("stretch", props.stretch && ["top", "bottom"].includes(rootTabs.props.tabPosition))],
  49705. "ref": nav$,
  49706. "style": navStyle.value,
  49707. "role": "tablist",
  49708. "onKeydown": changeTab
  49709. }, [...[!props.type ? vue.createVNode(TabBar, {
  49710. "ref": tabBarRef,
  49711. "tabs": [...props.panes]
  49712. }, null) : null, tabs]])])]);
  49713. };
  49714. }
  49715. });
  49716. const tabsProps = buildProps({
  49717. type: {
  49718. type: String,
  49719. values: ["card", "border-card", ""],
  49720. default: ""
  49721. },
  49722. closable: Boolean,
  49723. addable: Boolean,
  49724. modelValue: {
  49725. type: [String, Number]
  49726. },
  49727. editable: Boolean,
  49728. tabPosition: {
  49729. type: String,
  49730. values: ["top", "right", "bottom", "left"],
  49731. default: "top"
  49732. },
  49733. beforeLeave: {
  49734. type: definePropType(Function),
  49735. default: () => true
  49736. },
  49737. stretch: Boolean
  49738. });
  49739. const isPaneName = (value) => isString$1(value) || isNumber(value);
  49740. const tabsEmits = {
  49741. [UPDATE_MODEL_EVENT]: (name) => isPaneName(name),
  49742. tabClick: (pane, ev) => ev instanceof Event,
  49743. tabChange: (name) => isPaneName(name),
  49744. edit: (paneName, action) => ["remove", "add"].includes(action),
  49745. tabRemove: (name) => isPaneName(name),
  49746. tabAdd: () => true
  49747. };
  49748. const Tabs = vue.defineComponent({
  49749. name: "ElTabs",
  49750. props: tabsProps,
  49751. emits: tabsEmits,
  49752. setup(props, {
  49753. emit,
  49754. slots,
  49755. expose
  49756. }) {
  49757. var _a;
  49758. const ns = useNamespace("tabs");
  49759. const isVertical = vue.computed(() => ["left", "right"].includes(props.tabPosition));
  49760. const {
  49761. children: panes,
  49762. addChild: sortPane,
  49763. removeChild: unregisterPane
  49764. } = useOrderedChildren(vue.getCurrentInstance(), "ElTabPane");
  49765. const nav$ = vue.ref();
  49766. const currentName = vue.ref((_a = props.modelValue) != null ? _a : "0");
  49767. const setCurrentName = async (value, trigger = false) => {
  49768. var _a2, _b, _c;
  49769. if (currentName.value === value || isUndefined(value))
  49770. return;
  49771. try {
  49772. const canLeave = await ((_a2 = props.beforeLeave) == null ? void 0 : _a2.call(props, value, currentName.value));
  49773. if (canLeave !== false) {
  49774. currentName.value = value;
  49775. if (trigger) {
  49776. emit(UPDATE_MODEL_EVENT, value);
  49777. emit("tabChange", value);
  49778. }
  49779. (_c = (_b = nav$.value) == null ? void 0 : _b.removeFocus) == null ? void 0 : _c.call(_b);
  49780. }
  49781. } catch (e) {
  49782. }
  49783. };
  49784. const handleTabClick = (tab, tabName, event) => {
  49785. if (tab.props.disabled)
  49786. return;
  49787. setCurrentName(tabName, true);
  49788. emit("tabClick", tab, event);
  49789. };
  49790. const handleTabRemove = (pane, ev) => {
  49791. if (pane.props.disabled || isUndefined(pane.props.name))
  49792. return;
  49793. ev.stopPropagation();
  49794. emit("edit", pane.props.name, "remove");
  49795. emit("tabRemove", pane.props.name);
  49796. };
  49797. const handleTabAdd = () => {
  49798. emit("edit", void 0, "add");
  49799. emit("tabAdd");
  49800. };
  49801. vue.watch(() => props.modelValue, (modelValue) => setCurrentName(modelValue));
  49802. vue.watch(currentName, async () => {
  49803. var _a2;
  49804. await vue.nextTick();
  49805. (_a2 = nav$.value) == null ? void 0 : _a2.scrollToActiveTab();
  49806. });
  49807. vue.provide(tabsRootContextKey, {
  49808. props,
  49809. currentName,
  49810. registerPane: (pane) => {
  49811. panes.value.push(pane);
  49812. },
  49813. sortPane,
  49814. unregisterPane
  49815. });
  49816. expose({
  49817. currentName
  49818. });
  49819. const TabNavRenderer = ({
  49820. render
  49821. }) => {
  49822. return render();
  49823. };
  49824. return () => {
  49825. const addSlot = slots["add-icon"];
  49826. const newButton = props.editable || props.addable ? vue.createVNode("div", {
  49827. "class": [ns.e("new-tab"), isVertical.value && ns.e("new-tab-vertical")],
  49828. "tabindex": "0",
  49829. "onClick": handleTabAdd,
  49830. "onKeydown": (ev) => {
  49831. if ([EVENT_CODE.enter, EVENT_CODE.numpadEnter].includes(ev.code))
  49832. handleTabAdd();
  49833. }
  49834. }, [addSlot ? vue.renderSlot(slots, "add-icon") : vue.createVNode(ElIcon, {
  49835. "class": ns.is("icon-plus")
  49836. }, {
  49837. default: () => [vue.createVNode(plus_default, null, null)]
  49838. })]) : null;
  49839. const header = vue.createVNode("div", {
  49840. "class": [ns.e("header"), isVertical.value && ns.e("header-vertical"), ns.is(props.tabPosition)]
  49841. }, [vue.createVNode(TabNavRenderer, {
  49842. "render": () => {
  49843. const hasLabelSlot = panes.value.some((pane) => pane.slots.label);
  49844. return vue.createVNode(TabNav, {
  49845. ref: nav$,
  49846. currentName: currentName.value,
  49847. editable: props.editable,
  49848. type: props.type,
  49849. panes: panes.value,
  49850. stretch: props.stretch,
  49851. onTabClick: handleTabClick,
  49852. onTabRemove: handleTabRemove
  49853. }, {
  49854. $stable: !hasLabelSlot
  49855. });
  49856. }
  49857. }, null), newButton]);
  49858. const panels = vue.createVNode("div", {
  49859. "class": ns.e("content")
  49860. }, [vue.renderSlot(slots, "default")]);
  49861. return vue.createVNode("div", {
  49862. "class": [ns.b(), ns.m(props.tabPosition), {
  49863. [ns.m("card")]: props.type === "card",
  49864. [ns.m("border-card")]: props.type === "border-card"
  49865. }]
  49866. }, [panels, header]);
  49867. };
  49868. }
  49869. });
  49870. const tabPaneProps = buildProps({
  49871. label: {
  49872. type: String,
  49873. default: ""
  49874. },
  49875. name: {
  49876. type: [String, Number]
  49877. },
  49878. closable: Boolean,
  49879. disabled: Boolean,
  49880. lazy: Boolean
  49881. });
  49882. const COMPONENT_NAME$1 = "ElTabPane";
  49883. const __default__$t = vue.defineComponent({
  49884. name: COMPONENT_NAME$1
  49885. });
  49886. const _sfc_main$y = /* @__PURE__ */ vue.defineComponent({
  49887. ...__default__$t,
  49888. props: tabPaneProps,
  49889. setup(__props) {
  49890. const props = __props;
  49891. const instance = vue.getCurrentInstance();
  49892. const slots = vue.useSlots();
  49893. const tabsRoot = vue.inject(tabsRootContextKey);
  49894. if (!tabsRoot)
  49895. throwError(COMPONENT_NAME$1, "usage: <el-tabs><el-tab-pane /></el-tabs/>");
  49896. const ns = useNamespace("tab-pane");
  49897. const index = vue.ref();
  49898. const isClosable = vue.computed(() => props.closable || tabsRoot.props.closable);
  49899. const active = computedEager(() => {
  49900. var _a;
  49901. return tabsRoot.currentName.value === ((_a = props.name) != null ? _a : index.value);
  49902. });
  49903. const loaded = vue.ref(active.value);
  49904. const paneName = vue.computed(() => {
  49905. var _a;
  49906. return (_a = props.name) != null ? _a : index.value;
  49907. });
  49908. const shouldBeRender = computedEager(() => !props.lazy || loaded.value || active.value);
  49909. vue.watch(active, (val) => {
  49910. if (val)
  49911. loaded.value = true;
  49912. });
  49913. const pane = vue.reactive({
  49914. uid: instance.uid,
  49915. slots,
  49916. props,
  49917. paneName,
  49918. active,
  49919. index,
  49920. isClosable
  49921. });
  49922. tabsRoot.registerPane(pane);
  49923. vue.onMounted(() => {
  49924. tabsRoot.sortPane(pane);
  49925. });
  49926. vue.onUnmounted(() => {
  49927. tabsRoot.unregisterPane(pane.uid);
  49928. });
  49929. return (_ctx, _cache) => {
  49930. return vue.unref(shouldBeRender) ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  49931. key: 0,
  49932. id: `pane-${vue.unref(paneName)}`,
  49933. class: vue.normalizeClass(vue.unref(ns).b()),
  49934. role: "tabpanel",
  49935. "aria-hidden": !vue.unref(active),
  49936. "aria-labelledby": `tab-${vue.unref(paneName)}`
  49937. }, [
  49938. vue.renderSlot(_ctx.$slots, "default")
  49939. ], 10, ["id", "aria-hidden", "aria-labelledby"])), [
  49940. [vue.vShow, vue.unref(active)]
  49941. ]) : vue.createCommentVNode("v-if", true);
  49942. };
  49943. }
  49944. });
  49945. var TabPane = /* @__PURE__ */ _export_sfc(_sfc_main$y, [["__file", "tab-pane.vue"]]);
  49946. const ElTabs = withInstall(Tabs, {
  49947. TabPane
  49948. });
  49949. const ElTabPane = withNoopInstall(TabPane);
  49950. const textProps = buildProps({
  49951. type: {
  49952. type: String,
  49953. values: ["primary", "success", "info", "warning", "danger", ""],
  49954. default: ""
  49955. },
  49956. size: {
  49957. type: String,
  49958. values: componentSizes,
  49959. default: ""
  49960. },
  49961. truncated: Boolean,
  49962. lineClamp: {
  49963. type: [String, Number]
  49964. },
  49965. tag: {
  49966. type: String,
  49967. default: "span"
  49968. }
  49969. });
  49970. const __default__$s = vue.defineComponent({
  49971. name: "ElText"
  49972. });
  49973. const _sfc_main$x = /* @__PURE__ */ vue.defineComponent({
  49974. ...__default__$s,
  49975. props: textProps,
  49976. setup(__props) {
  49977. const props = __props;
  49978. const textSize = useFormSize();
  49979. const ns = useNamespace("text");
  49980. const textKls = vue.computed(() => [
  49981. ns.b(),
  49982. ns.m(props.type),
  49983. ns.m(textSize.value),
  49984. ns.is("truncated", props.truncated),
  49985. ns.is("line-clamp", !isUndefined(props.lineClamp))
  49986. ]);
  49987. return (_ctx, _cache) => {
  49988. return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.tag), {
  49989. class: vue.normalizeClass(vue.unref(textKls)),
  49990. style: vue.normalizeStyle({ "-webkit-line-clamp": _ctx.lineClamp })
  49991. }, {
  49992. default: vue.withCtx(() => [
  49993. vue.renderSlot(_ctx.$slots, "default")
  49994. ]),
  49995. _: 3
  49996. }, 8, ["class", "style"]);
  49997. };
  49998. }
  49999. });
  50000. var Text = /* @__PURE__ */ _export_sfc(_sfc_main$x, [["__file", "text.vue"]]);
  50001. const ElText = withInstall(Text);
  50002. const timeSelectProps = buildProps({
  50003. format: {
  50004. type: String,
  50005. default: "HH:mm"
  50006. },
  50007. modelValue: String,
  50008. disabled: Boolean,
  50009. editable: {
  50010. type: Boolean,
  50011. default: true
  50012. },
  50013. effect: {
  50014. type: definePropType(String),
  50015. default: "light"
  50016. },
  50017. clearable: {
  50018. type: Boolean,
  50019. default: true
  50020. },
  50021. size: useSizeProp,
  50022. placeholder: String,
  50023. start: {
  50024. type: String,
  50025. default: "09:00"
  50026. },
  50027. end: {
  50028. type: String,
  50029. default: "18:00"
  50030. },
  50031. step: {
  50032. type: String,
  50033. default: "00:30"
  50034. },
  50035. minTime: String,
  50036. maxTime: String,
  50037. name: String,
  50038. prefixIcon: {
  50039. type: definePropType([String, Object]),
  50040. default: () => clock_default
  50041. },
  50042. clearIcon: {
  50043. type: definePropType([String, Object]),
  50044. default: () => circle_close_default
  50045. },
  50046. ...useEmptyValuesProps
  50047. });
  50048. const parseTime = (time) => {
  50049. const values = (time || "").split(":");
  50050. if (values.length >= 2) {
  50051. let hours = Number.parseInt(values[0], 10);
  50052. const minutes = Number.parseInt(values[1], 10);
  50053. const timeUpper = time.toUpperCase();
  50054. if (timeUpper.includes("AM") && hours === 12) {
  50055. hours = 0;
  50056. } else if (timeUpper.includes("PM") && hours !== 12) {
  50057. hours += 12;
  50058. }
  50059. return {
  50060. hours,
  50061. minutes
  50062. };
  50063. }
  50064. return null;
  50065. };
  50066. const compareTime = (time1, time2) => {
  50067. const value1 = parseTime(time1);
  50068. if (!value1)
  50069. return -1;
  50070. const value2 = parseTime(time2);
  50071. if (!value2)
  50072. return -1;
  50073. const minutes1 = value1.minutes + value1.hours * 60;
  50074. const minutes2 = value2.minutes + value2.hours * 60;
  50075. if (minutes1 === minutes2) {
  50076. return 0;
  50077. }
  50078. return minutes1 > minutes2 ? 1 : -1;
  50079. };
  50080. const padTime = (time) => {
  50081. return `${time}`.padStart(2, "0");
  50082. };
  50083. const formatTime = (time) => {
  50084. return `${padTime(time.hours)}:${padTime(time.minutes)}`;
  50085. };
  50086. const nextTime = (time, step) => {
  50087. const timeValue = parseTime(time);
  50088. if (!timeValue)
  50089. return "";
  50090. const stepValue = parseTime(step);
  50091. if (!stepValue)
  50092. return "";
  50093. const next = {
  50094. hours: timeValue.hours,
  50095. minutes: timeValue.minutes
  50096. };
  50097. next.minutes += stepValue.minutes;
  50098. next.hours += stepValue.hours;
  50099. next.hours += Math.floor(next.minutes / 60);
  50100. next.minutes = next.minutes % 60;
  50101. return formatTime(next);
  50102. };
  50103. const __default__$r = vue.defineComponent({
  50104. name: "ElTimeSelect"
  50105. });
  50106. const _sfc_main$w = /* @__PURE__ */ vue.defineComponent({
  50107. ...__default__$r,
  50108. props: timeSelectProps,
  50109. emits: ["change", "blur", "focus", "clear", "update:modelValue"],
  50110. setup(__props, { expose }) {
  50111. const props = __props;
  50112. dayjs.extend(customParseFormat);
  50113. const { Option: ElOption } = ElSelect;
  50114. const nsInput = useNamespace("input");
  50115. const select = vue.ref();
  50116. const _disabled = useFormDisabled();
  50117. const { lang } = useLocale();
  50118. const value = vue.computed(() => props.modelValue);
  50119. const start = vue.computed(() => {
  50120. const time = parseTime(props.start);
  50121. return time ? formatTime(time) : null;
  50122. });
  50123. const end = vue.computed(() => {
  50124. const time = parseTime(props.end);
  50125. return time ? formatTime(time) : null;
  50126. });
  50127. const step = vue.computed(() => {
  50128. const time = parseTime(props.step);
  50129. return time ? formatTime(time) : null;
  50130. });
  50131. const minTime = vue.computed(() => {
  50132. const time = parseTime(props.minTime || "");
  50133. return time ? formatTime(time) : null;
  50134. });
  50135. const maxTime = vue.computed(() => {
  50136. const time = parseTime(props.maxTime || "");
  50137. return time ? formatTime(time) : null;
  50138. });
  50139. const items = vue.computed(() => {
  50140. const result = [];
  50141. if (props.start && props.end && props.step) {
  50142. let current = start.value;
  50143. let currentTime;
  50144. while (current && end.value && compareTime(current, end.value) <= 0) {
  50145. currentTime = dayjs(current, "HH:mm").locale(lang.value).format(props.format);
  50146. result.push({
  50147. value: currentTime,
  50148. disabled: compareTime(current, minTime.value || "-1:-1") <= 0 || compareTime(current, maxTime.value || "100:100") >= 0
  50149. });
  50150. current = nextTime(current, step.value);
  50151. }
  50152. }
  50153. return result;
  50154. });
  50155. const blur = () => {
  50156. var _a, _b;
  50157. (_b = (_a = select.value) == null ? void 0 : _a.blur) == null ? void 0 : _b.call(_a);
  50158. };
  50159. const focus = () => {
  50160. var _a, _b;
  50161. (_b = (_a = select.value) == null ? void 0 : _a.focus) == null ? void 0 : _b.call(_a);
  50162. };
  50163. expose({
  50164. blur,
  50165. focus
  50166. });
  50167. return (_ctx, _cache) => {
  50168. return vue.openBlock(), vue.createBlock(vue.unref(ElSelect), {
  50169. ref_key: "select",
  50170. ref: select,
  50171. "model-value": vue.unref(value),
  50172. disabled: vue.unref(_disabled),
  50173. clearable: _ctx.clearable,
  50174. "clear-icon": _ctx.clearIcon,
  50175. size: _ctx.size,
  50176. effect: _ctx.effect,
  50177. placeholder: _ctx.placeholder,
  50178. "default-first-option": "",
  50179. filterable: _ctx.editable,
  50180. "empty-values": _ctx.emptyValues,
  50181. "value-on-clear": _ctx.valueOnClear,
  50182. "onUpdate:modelValue": (event) => _ctx.$emit("update:modelValue", event),
  50183. onChange: (event) => _ctx.$emit("change", event),
  50184. onBlur: (event) => _ctx.$emit("blur", event),
  50185. onFocus: (event) => _ctx.$emit("focus", event),
  50186. onClear: () => _ctx.$emit("clear")
  50187. }, {
  50188. prefix: vue.withCtx(() => [
  50189. _ctx.prefixIcon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  50190. key: 0,
  50191. class: vue.normalizeClass(vue.unref(nsInput).e("prefix-icon"))
  50192. }, {
  50193. default: vue.withCtx(() => [
  50194. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.prefixIcon)))
  50195. ]),
  50196. _: 1
  50197. }, 8, ["class"])) : vue.createCommentVNode("v-if", true)
  50198. ]),
  50199. default: vue.withCtx(() => [
  50200. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(items), (item) => {
  50201. return vue.openBlock(), vue.createBlock(vue.unref(ElOption), {
  50202. key: item.value,
  50203. label: item.value,
  50204. value: item.value,
  50205. disabled: item.disabled
  50206. }, null, 8, ["label", "value", "disabled"]);
  50207. }), 128))
  50208. ]),
  50209. _: 1
  50210. }, 8, ["model-value", "disabled", "clearable", "clear-icon", "size", "effect", "placeholder", "filterable", "empty-values", "value-on-clear", "onUpdate:modelValue", "onChange", "onBlur", "onFocus", "onClear"]);
  50211. };
  50212. }
  50213. });
  50214. var TimeSelect = /* @__PURE__ */ _export_sfc(_sfc_main$w, [["__file", "time-select.vue"]]);
  50215. const ElTimeSelect = withInstall(TimeSelect);
  50216. const Timeline = vue.defineComponent({
  50217. name: "ElTimeline",
  50218. setup(_, { slots }) {
  50219. const ns = useNamespace("timeline");
  50220. vue.provide("timeline", slots);
  50221. return () => {
  50222. return vue.h("ul", { class: [ns.b()] }, [vue.renderSlot(slots, "default")]);
  50223. };
  50224. }
  50225. });
  50226. var Timeline$1 = Timeline;
  50227. const timelineItemProps = buildProps({
  50228. timestamp: {
  50229. type: String,
  50230. default: ""
  50231. },
  50232. hideTimestamp: Boolean,
  50233. center: Boolean,
  50234. placement: {
  50235. type: String,
  50236. values: ["top", "bottom"],
  50237. default: "bottom"
  50238. },
  50239. type: {
  50240. type: String,
  50241. values: ["primary", "success", "warning", "danger", "info"],
  50242. default: ""
  50243. },
  50244. color: {
  50245. type: String,
  50246. default: ""
  50247. },
  50248. size: {
  50249. type: String,
  50250. values: ["normal", "large"],
  50251. default: "normal"
  50252. },
  50253. icon: {
  50254. type: iconPropType
  50255. },
  50256. hollow: Boolean
  50257. });
  50258. const __default__$q = vue.defineComponent({
  50259. name: "ElTimelineItem"
  50260. });
  50261. const _sfc_main$v = /* @__PURE__ */ vue.defineComponent({
  50262. ...__default__$q,
  50263. props: timelineItemProps,
  50264. setup(__props) {
  50265. const props = __props;
  50266. const ns = useNamespace("timeline-item");
  50267. const defaultNodeKls = vue.computed(() => [
  50268. ns.e("node"),
  50269. ns.em("node", props.size || ""),
  50270. ns.em("node", props.type || ""),
  50271. ns.is("hollow", props.hollow)
  50272. ]);
  50273. return (_ctx, _cache) => {
  50274. return vue.openBlock(), vue.createElementBlock("li", {
  50275. class: vue.normalizeClass([vue.unref(ns).b(), { [vue.unref(ns).e("center")]: _ctx.center }])
  50276. }, [
  50277. vue.createElementVNode("div", {
  50278. class: vue.normalizeClass(vue.unref(ns).e("tail"))
  50279. }, null, 2),
  50280. !_ctx.$slots.dot ? (vue.openBlock(), vue.createElementBlock("div", {
  50281. key: 0,
  50282. class: vue.normalizeClass(vue.unref(defaultNodeKls)),
  50283. style: vue.normalizeStyle({
  50284. backgroundColor: _ctx.color
  50285. })
  50286. }, [
  50287. _ctx.icon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  50288. key: 0,
  50289. class: vue.normalizeClass(vue.unref(ns).e("icon"))
  50290. }, {
  50291. default: vue.withCtx(() => [
  50292. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.icon)))
  50293. ]),
  50294. _: 1
  50295. }, 8, ["class"])) : vue.createCommentVNode("v-if", true)
  50296. ], 6)) : vue.createCommentVNode("v-if", true),
  50297. _ctx.$slots.dot ? (vue.openBlock(), vue.createElementBlock("div", {
  50298. key: 1,
  50299. class: vue.normalizeClass(vue.unref(ns).e("dot"))
  50300. }, [
  50301. vue.renderSlot(_ctx.$slots, "dot")
  50302. ], 2)) : vue.createCommentVNode("v-if", true),
  50303. vue.createElementVNode("div", {
  50304. class: vue.normalizeClass(vue.unref(ns).e("wrapper"))
  50305. }, [
  50306. !_ctx.hideTimestamp && _ctx.placement === "top" ? (vue.openBlock(), vue.createElementBlock("div", {
  50307. key: 0,
  50308. class: vue.normalizeClass([vue.unref(ns).e("timestamp"), vue.unref(ns).is("top")])
  50309. }, vue.toDisplayString(_ctx.timestamp), 3)) : vue.createCommentVNode("v-if", true),
  50310. vue.createElementVNode("div", {
  50311. class: vue.normalizeClass(vue.unref(ns).e("content"))
  50312. }, [
  50313. vue.renderSlot(_ctx.$slots, "default")
  50314. ], 2),
  50315. !_ctx.hideTimestamp && _ctx.placement === "bottom" ? (vue.openBlock(), vue.createElementBlock("div", {
  50316. key: 1,
  50317. class: vue.normalizeClass([vue.unref(ns).e("timestamp"), vue.unref(ns).is("bottom")])
  50318. }, vue.toDisplayString(_ctx.timestamp), 3)) : vue.createCommentVNode("v-if", true)
  50319. ], 2)
  50320. ], 2);
  50321. };
  50322. }
  50323. });
  50324. var TimelineItem = /* @__PURE__ */ _export_sfc(_sfc_main$v, [["__file", "timeline-item.vue"]]);
  50325. const ElTimeline = withInstall(Timeline$1, {
  50326. TimelineItem
  50327. });
  50328. const ElTimelineItem = withNoopInstall(TimelineItem);
  50329. const tooltipV2CommonProps = buildProps({
  50330. nowrap: Boolean
  50331. });
  50332. var TooltipV2Sides = /* @__PURE__ */ ((TooltipV2Sides2) => {
  50333. TooltipV2Sides2["top"] = "top";
  50334. TooltipV2Sides2["bottom"] = "bottom";
  50335. TooltipV2Sides2["left"] = "left";
  50336. TooltipV2Sides2["right"] = "right";
  50337. return TooltipV2Sides2;
  50338. })(TooltipV2Sides || {});
  50339. const tooltipV2Sides = Object.values(TooltipV2Sides);
  50340. const tooltipV2ArrowProps = buildProps({
  50341. width: {
  50342. type: Number,
  50343. default: 10
  50344. },
  50345. height: {
  50346. type: Number,
  50347. default: 10
  50348. },
  50349. style: {
  50350. type: definePropType(Object),
  50351. default: null
  50352. }
  50353. });
  50354. const tooltipV2ArrowSpecialProps = buildProps({
  50355. side: {
  50356. type: definePropType(String),
  50357. values: tooltipV2Sides,
  50358. required: true
  50359. }
  50360. });
  50361. const tooltipV2Strategies = ["absolute", "fixed"];
  50362. const tooltipV2Placements = [
  50363. "top-start",
  50364. "top-end",
  50365. "top",
  50366. "bottom-start",
  50367. "bottom-end",
  50368. "bottom",
  50369. "left-start",
  50370. "left-end",
  50371. "left",
  50372. "right-start",
  50373. "right-end",
  50374. "right"
  50375. ];
  50376. const tooltipV2ContentProps = buildProps({
  50377. arrowPadding: {
  50378. type: definePropType(Number),
  50379. default: 5
  50380. },
  50381. effect: {
  50382. type: definePropType(String),
  50383. default: "light"
  50384. },
  50385. contentClass: String,
  50386. placement: {
  50387. type: definePropType(String),
  50388. values: tooltipV2Placements,
  50389. default: "bottom"
  50390. },
  50391. reference: {
  50392. type: definePropType(Object),
  50393. default: null
  50394. },
  50395. offset: {
  50396. type: Number,
  50397. default: 8
  50398. },
  50399. strategy: {
  50400. type: definePropType(String),
  50401. values: tooltipV2Strategies,
  50402. default: "absolute"
  50403. },
  50404. showArrow: Boolean,
  50405. ...useAriaProps(["ariaLabel"])
  50406. });
  50407. const tooltipV2RootProps = buildProps({
  50408. delayDuration: {
  50409. type: Number,
  50410. default: 300
  50411. },
  50412. defaultOpen: Boolean,
  50413. open: {
  50414. type: Boolean,
  50415. default: void 0
  50416. },
  50417. onOpenChange: {
  50418. type: definePropType(Function)
  50419. },
  50420. "onUpdate:open": {
  50421. type: definePropType(Function)
  50422. }
  50423. });
  50424. const EventHandler = {
  50425. type: definePropType(Function)
  50426. };
  50427. const tooltipV2TriggerProps = buildProps({
  50428. onBlur: EventHandler,
  50429. onClick: EventHandler,
  50430. onFocus: EventHandler,
  50431. onMouseDown: EventHandler,
  50432. onMouseEnter: EventHandler,
  50433. onMouseLeave: EventHandler
  50434. });
  50435. const tooltipV2Props = buildProps({
  50436. ...tooltipV2RootProps,
  50437. ...tooltipV2ArrowProps,
  50438. ...tooltipV2TriggerProps,
  50439. ...tooltipV2ContentProps,
  50440. alwaysOn: Boolean,
  50441. fullTransition: Boolean,
  50442. transitionProps: {
  50443. type: definePropType(Object),
  50444. default: null
  50445. },
  50446. teleported: Boolean,
  50447. to: {
  50448. type: definePropType(String),
  50449. default: "body"
  50450. }
  50451. });
  50452. const tooltipV2RootKey = Symbol("tooltipV2");
  50453. const tooltipV2ContentKey = Symbol("tooltipV2Content");
  50454. const TOOLTIP_V2_OPEN = "tooltip_v2.open";
  50455. const __default__$p = vue.defineComponent({
  50456. name: "ElTooltipV2Root"
  50457. });
  50458. const _sfc_main$u = /* @__PURE__ */ vue.defineComponent({
  50459. ...__default__$p,
  50460. props: tooltipV2RootProps,
  50461. setup(__props, { expose }) {
  50462. const props = __props;
  50463. const _open = vue.ref(props.defaultOpen);
  50464. const triggerRef = vue.ref(null);
  50465. const open = vue.computed({
  50466. get: () => isPropAbsent(props.open) ? _open.value : props.open,
  50467. set: (open2) => {
  50468. var _a;
  50469. _open.value = open2;
  50470. (_a = props["onUpdate:open"]) == null ? void 0 : _a.call(props, open2);
  50471. }
  50472. });
  50473. const isOpenDelayed = vue.computed(() => isNumber(props.delayDuration) && props.delayDuration > 0);
  50474. const { start: onDelayedOpen, stop: clearTimer } = useTimeoutFn(() => {
  50475. open.value = true;
  50476. }, vue.computed(() => props.delayDuration), {
  50477. immediate: false
  50478. });
  50479. const ns = useNamespace("tooltip-v2");
  50480. const contentId = useId();
  50481. const onNormalOpen = () => {
  50482. clearTimer();
  50483. open.value = true;
  50484. };
  50485. const onDelayOpen = () => {
  50486. vue.unref(isOpenDelayed) ? onDelayedOpen() : onNormalOpen();
  50487. };
  50488. const onOpen = onNormalOpen;
  50489. const onClose = () => {
  50490. clearTimer();
  50491. open.value = false;
  50492. };
  50493. const onChange = (open2) => {
  50494. var _a;
  50495. if (open2) {
  50496. document.dispatchEvent(new CustomEvent(TOOLTIP_V2_OPEN));
  50497. onOpen();
  50498. }
  50499. (_a = props.onOpenChange) == null ? void 0 : _a.call(props, open2);
  50500. };
  50501. vue.watch(open, onChange);
  50502. vue.onMounted(() => {
  50503. document.addEventListener(TOOLTIP_V2_OPEN, onClose);
  50504. });
  50505. vue.onBeforeUnmount(() => {
  50506. clearTimer();
  50507. document.removeEventListener(TOOLTIP_V2_OPEN, onClose);
  50508. });
  50509. vue.provide(tooltipV2RootKey, {
  50510. contentId,
  50511. triggerRef,
  50512. ns,
  50513. onClose,
  50514. onDelayOpen,
  50515. onOpen
  50516. });
  50517. expose({
  50518. onOpen,
  50519. onClose
  50520. });
  50521. return (_ctx, _cache) => {
  50522. return vue.renderSlot(_ctx.$slots, "default", { open: vue.unref(open) });
  50523. };
  50524. }
  50525. });
  50526. var TooltipV2Root = /* @__PURE__ */ _export_sfc(_sfc_main$u, [["__file", "root.vue"]]);
  50527. const __default__$o = vue.defineComponent({
  50528. name: "ElTooltipV2Arrow"
  50529. });
  50530. const _sfc_main$t = /* @__PURE__ */ vue.defineComponent({
  50531. ...__default__$o,
  50532. props: {
  50533. ...tooltipV2ArrowProps,
  50534. ...tooltipV2ArrowSpecialProps
  50535. },
  50536. setup(__props) {
  50537. const props = __props;
  50538. const { ns } = vue.inject(tooltipV2RootKey);
  50539. const { arrowRef } = vue.inject(tooltipV2ContentKey);
  50540. const arrowStyle = vue.computed(() => {
  50541. const { style, width, height } = props;
  50542. const namespace = ns.namespace.value;
  50543. return {
  50544. [`--${namespace}-tooltip-v2-arrow-width`]: `${width}px`,
  50545. [`--${namespace}-tooltip-v2-arrow-height`]: `${height}px`,
  50546. [`--${namespace}-tooltip-v2-arrow-border-width`]: `${width / 2}px`,
  50547. [`--${namespace}-tooltip-v2-arrow-cover-width`]: width / 2 - 1,
  50548. ...style || {}
  50549. };
  50550. });
  50551. return (_ctx, _cache) => {
  50552. return vue.openBlock(), vue.createElementBlock("span", {
  50553. ref_key: "arrowRef",
  50554. ref: arrowRef,
  50555. style: vue.normalizeStyle(vue.unref(arrowStyle)),
  50556. class: vue.normalizeClass(vue.unref(ns).e("arrow"))
  50557. }, null, 6);
  50558. };
  50559. }
  50560. });
  50561. var TooltipV2Arrow = /* @__PURE__ */ _export_sfc(_sfc_main$t, [["__file", "arrow.vue"]]);
  50562. const visualHiddenProps = buildProps({
  50563. style: {
  50564. type: definePropType([String, Object, Array]),
  50565. default: () => ({})
  50566. }
  50567. });
  50568. const __default__$n = vue.defineComponent({
  50569. name: "ElVisuallyHidden"
  50570. });
  50571. const _sfc_main$s = /* @__PURE__ */ vue.defineComponent({
  50572. ...__default__$n,
  50573. props: visualHiddenProps,
  50574. setup(__props) {
  50575. const props = __props;
  50576. const computedStyle = vue.computed(() => {
  50577. return [
  50578. props.style,
  50579. {
  50580. position: "absolute",
  50581. border: 0,
  50582. width: 1,
  50583. height: 1,
  50584. padding: 0,
  50585. margin: -1,
  50586. overflow: "hidden",
  50587. clip: "rect(0, 0, 0, 0)",
  50588. whiteSpace: "nowrap",
  50589. wordWrap: "normal"
  50590. }
  50591. ];
  50592. });
  50593. return (_ctx, _cache) => {
  50594. return vue.openBlock(), vue.createElementBlock("span", vue.mergeProps(_ctx.$attrs, { style: vue.unref(computedStyle) }), [
  50595. vue.renderSlot(_ctx.$slots, "default")
  50596. ], 16);
  50597. };
  50598. }
  50599. });
  50600. var ElVisuallyHidden = /* @__PURE__ */ _export_sfc(_sfc_main$s, [["__file", "visual-hidden.vue"]]);
  50601. const __default__$m = vue.defineComponent({
  50602. name: "ElTooltipV2Content"
  50603. });
  50604. const _sfc_main$r = /* @__PURE__ */ vue.defineComponent({
  50605. ...__default__$m,
  50606. props: { ...tooltipV2ContentProps, ...tooltipV2CommonProps },
  50607. setup(__props) {
  50608. const props = __props;
  50609. const { triggerRef, contentId } = vue.inject(tooltipV2RootKey);
  50610. const placement = vue.ref(props.placement);
  50611. const strategy = vue.ref(props.strategy);
  50612. const arrowRef = vue.ref(null);
  50613. const { referenceRef, contentRef, middlewareData, x, y, update } = useFloating$1({
  50614. placement,
  50615. strategy,
  50616. middleware: vue.computed(() => {
  50617. const middleware = [offset(props.offset)];
  50618. if (props.showArrow) {
  50619. middleware.push(arrowMiddleware({
  50620. arrowRef
  50621. }));
  50622. }
  50623. return middleware;
  50624. })
  50625. });
  50626. const zIndex = useZIndex().nextZIndex();
  50627. const ns = useNamespace("tooltip-v2");
  50628. const side = vue.computed(() => {
  50629. return placement.value.split("-")[0];
  50630. });
  50631. const contentStyle = vue.computed(() => {
  50632. return {
  50633. position: vue.unref(strategy),
  50634. top: `${vue.unref(y) || 0}px`,
  50635. left: `${vue.unref(x) || 0}px`,
  50636. zIndex
  50637. };
  50638. });
  50639. const arrowStyle = vue.computed(() => {
  50640. if (!props.showArrow)
  50641. return {};
  50642. const { arrow } = vue.unref(middlewareData);
  50643. return {
  50644. [`--${ns.namespace.value}-tooltip-v2-arrow-x`]: `${arrow == null ? void 0 : arrow.x}px` || "",
  50645. [`--${ns.namespace.value}-tooltip-v2-arrow-y`]: `${arrow == null ? void 0 : arrow.y}px` || ""
  50646. };
  50647. });
  50648. const contentClass = vue.computed(() => [
  50649. ns.e("content"),
  50650. ns.is("dark", props.effect === "dark"),
  50651. ns.is(vue.unref(strategy)),
  50652. props.contentClass
  50653. ]);
  50654. vue.watch(arrowRef, () => update());
  50655. vue.watch(() => props.placement, (val) => placement.value = val);
  50656. vue.onMounted(() => {
  50657. vue.watch(() => props.reference || triggerRef.value, (el) => {
  50658. referenceRef.value = el || void 0;
  50659. }, {
  50660. immediate: true
  50661. });
  50662. });
  50663. vue.provide(tooltipV2ContentKey, { arrowRef });
  50664. return (_ctx, _cache) => {
  50665. return vue.openBlock(), vue.createElementBlock("div", {
  50666. ref_key: "contentRef",
  50667. ref: contentRef,
  50668. style: vue.normalizeStyle(vue.unref(contentStyle)),
  50669. "data-tooltip-v2-root": ""
  50670. }, [
  50671. !_ctx.nowrap ? (vue.openBlock(), vue.createElementBlock("div", {
  50672. key: 0,
  50673. "data-side": vue.unref(side),
  50674. class: vue.normalizeClass(vue.unref(contentClass))
  50675. }, [
  50676. vue.renderSlot(_ctx.$slots, "default", {
  50677. contentStyle: vue.unref(contentStyle),
  50678. contentClass: vue.unref(contentClass)
  50679. }),
  50680. vue.createVNode(vue.unref(ElVisuallyHidden), {
  50681. id: vue.unref(contentId),
  50682. role: "tooltip"
  50683. }, {
  50684. default: vue.withCtx(() => [
  50685. _ctx.ariaLabel ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  50686. vue.createTextVNode(vue.toDisplayString(_ctx.ariaLabel), 1)
  50687. ], 64)) : vue.renderSlot(_ctx.$slots, "default", { key: 1 })
  50688. ]),
  50689. _: 3
  50690. }, 8, ["id"]),
  50691. vue.renderSlot(_ctx.$slots, "arrow", {
  50692. style: vue.normalizeStyle(vue.unref(arrowStyle)),
  50693. side: vue.unref(side)
  50694. })
  50695. ], 10, ["data-side"])) : vue.createCommentVNode("v-if", true)
  50696. ], 4);
  50697. };
  50698. }
  50699. });
  50700. var TooltipV2Content = /* @__PURE__ */ _export_sfc(_sfc_main$r, [["__file", "content.vue"]]);
  50701. const forwardRefProps = buildProps({
  50702. setRef: {
  50703. type: definePropType(Function),
  50704. required: true
  50705. },
  50706. onlyChild: Boolean
  50707. });
  50708. var ForwardRef = vue.defineComponent({
  50709. props: forwardRefProps,
  50710. setup(props, {
  50711. slots
  50712. }) {
  50713. const fragmentRef = vue.ref();
  50714. const setRef = composeRefs(fragmentRef, (el) => {
  50715. if (el) {
  50716. props.setRef(el.nextElementSibling);
  50717. } else {
  50718. props.setRef(null);
  50719. }
  50720. });
  50721. return () => {
  50722. var _a;
  50723. const [firstChild] = ((_a = slots.default) == null ? void 0 : _a.call(slots)) || [];
  50724. const child = props.onlyChild ? ensureOnlyChild(firstChild.children) : firstChild.children;
  50725. return vue.createVNode(vue.Fragment, {
  50726. "ref": setRef
  50727. }, [child]);
  50728. };
  50729. }
  50730. });
  50731. const __default__$l = vue.defineComponent({
  50732. name: "ElTooltipV2Trigger"
  50733. });
  50734. const _sfc_main$q = /* @__PURE__ */ vue.defineComponent({
  50735. ...__default__$l,
  50736. props: {
  50737. ...tooltipV2CommonProps,
  50738. ...tooltipV2TriggerProps
  50739. },
  50740. setup(__props) {
  50741. const props = __props;
  50742. const { onClose, onOpen, onDelayOpen, triggerRef, contentId } = vue.inject(tooltipV2RootKey);
  50743. let isMousedown = false;
  50744. const setTriggerRef = (el) => {
  50745. triggerRef.value = el;
  50746. };
  50747. const onMouseup = () => {
  50748. isMousedown = false;
  50749. };
  50750. const onMouseenter = composeEventHandlers(props.onMouseEnter, onDelayOpen);
  50751. const onMouseleave = composeEventHandlers(props.onMouseLeave, onClose);
  50752. const onMousedown = composeEventHandlers(props.onMouseDown, () => {
  50753. onClose();
  50754. isMousedown = true;
  50755. document.addEventListener("mouseup", onMouseup, { once: true });
  50756. });
  50757. const onFocus = composeEventHandlers(props.onFocus, () => {
  50758. if (!isMousedown)
  50759. onOpen();
  50760. });
  50761. const onBlur = composeEventHandlers(props.onBlur, onClose);
  50762. const onClick = composeEventHandlers(props.onClick, (e) => {
  50763. if (e.detail === 0)
  50764. onClose();
  50765. });
  50766. const events = {
  50767. blur: onBlur,
  50768. click: onClick,
  50769. focus: onFocus,
  50770. mousedown: onMousedown,
  50771. mouseenter: onMouseenter,
  50772. mouseleave: onMouseleave
  50773. };
  50774. const setEvents = (el, events2, type) => {
  50775. if (el) {
  50776. Object.entries(events2).forEach(([name, handler]) => {
  50777. el[type](name, handler);
  50778. });
  50779. }
  50780. };
  50781. vue.watch(triggerRef, (triggerEl, previousTriggerEl) => {
  50782. setEvents(triggerEl, events, "addEventListener");
  50783. setEvents(previousTriggerEl, events, "removeEventListener");
  50784. if (triggerEl) {
  50785. triggerEl.setAttribute("aria-describedby", contentId.value);
  50786. }
  50787. });
  50788. vue.onBeforeUnmount(() => {
  50789. setEvents(triggerRef.value, events, "removeEventListener");
  50790. document.removeEventListener("mouseup", onMouseup);
  50791. });
  50792. return (_ctx, _cache) => {
  50793. return _ctx.nowrap ? (vue.openBlock(), vue.createBlock(vue.unref(ForwardRef), {
  50794. key: 0,
  50795. "set-ref": setTriggerRef,
  50796. "only-child": ""
  50797. }, {
  50798. default: vue.withCtx(() => [
  50799. vue.renderSlot(_ctx.$slots, "default")
  50800. ]),
  50801. _: 3
  50802. })) : (vue.openBlock(), vue.createElementBlock("button", vue.mergeProps({
  50803. key: 1,
  50804. ref_key: "triggerRef",
  50805. ref: triggerRef
  50806. }, _ctx.$attrs), [
  50807. vue.renderSlot(_ctx.$slots, "default")
  50808. ], 16));
  50809. };
  50810. }
  50811. });
  50812. var TooltipV2Trigger = /* @__PURE__ */ _export_sfc(_sfc_main$q, [["__file", "trigger.vue"]]);
  50813. const __default__$k = vue.defineComponent({
  50814. name: "ElTooltipV2"
  50815. });
  50816. const _sfc_main$p = /* @__PURE__ */ vue.defineComponent({
  50817. ...__default__$k,
  50818. props: tooltipV2Props,
  50819. setup(__props) {
  50820. const props = __props;
  50821. const refedProps = vue.toRefs(props);
  50822. const arrowProps = vue.reactive(pick(refedProps, Object.keys(tooltipV2ArrowProps)));
  50823. const contentProps = vue.reactive(pick(refedProps, Object.keys(tooltipV2ContentProps)));
  50824. const rootProps = vue.reactive(pick(refedProps, Object.keys(tooltipV2RootProps)));
  50825. const triggerProps = vue.reactive(pick(refedProps, Object.keys(tooltipV2TriggerProps)));
  50826. return (_ctx, _cache) => {
  50827. return vue.openBlock(), vue.createBlock(TooltipV2Root, vue.normalizeProps(vue.guardReactiveProps(rootProps)), {
  50828. default: vue.withCtx(({ open }) => [
  50829. vue.createVNode(TooltipV2Trigger, vue.mergeProps(triggerProps, { nowrap: "" }), {
  50830. default: vue.withCtx(() => [
  50831. vue.renderSlot(_ctx.$slots, "trigger")
  50832. ]),
  50833. _: 3
  50834. }, 16),
  50835. vue.createVNode(vue.unref(ElTeleport$1), {
  50836. to: _ctx.to,
  50837. disabled: !_ctx.teleported
  50838. }, {
  50839. default: vue.withCtx(() => [
  50840. _ctx.fullTransition ? (vue.openBlock(), vue.createBlock(vue.Transition, vue.normalizeProps(vue.mergeProps({ key: 0 }, _ctx.transitionProps)), {
  50841. default: vue.withCtx(() => [
  50842. _ctx.alwaysOn || open ? (vue.openBlock(), vue.createBlock(TooltipV2Content, vue.normalizeProps(vue.mergeProps({ key: 0 }, contentProps)), {
  50843. arrow: vue.withCtx(({ style, side }) => [
  50844. _ctx.showArrow ? (vue.openBlock(), vue.createBlock(TooltipV2Arrow, vue.mergeProps({ key: 0 }, arrowProps, {
  50845. style,
  50846. side
  50847. }), null, 16, ["style", "side"])) : vue.createCommentVNode("v-if", true)
  50848. ]),
  50849. default: vue.withCtx(() => [
  50850. vue.renderSlot(_ctx.$slots, "default")
  50851. ]),
  50852. _: 3
  50853. }, 16)) : vue.createCommentVNode("v-if", true)
  50854. ]),
  50855. _: 2
  50856. }, 1040)) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  50857. _ctx.alwaysOn || open ? (vue.openBlock(), vue.createBlock(TooltipV2Content, vue.normalizeProps(vue.mergeProps({ key: 0 }, contentProps)), {
  50858. arrow: vue.withCtx(({ style, side }) => [
  50859. _ctx.showArrow ? (vue.openBlock(), vue.createBlock(TooltipV2Arrow, vue.mergeProps({ key: 0 }, arrowProps, {
  50860. style,
  50861. side
  50862. }), null, 16, ["style", "side"])) : vue.createCommentVNode("v-if", true)
  50863. ]),
  50864. default: vue.withCtx(() => [
  50865. vue.renderSlot(_ctx.$slots, "default")
  50866. ]),
  50867. _: 3
  50868. }, 16)) : vue.createCommentVNode("v-if", true)
  50869. ], 64))
  50870. ]),
  50871. _: 2
  50872. }, 1032, ["to", "disabled"])
  50873. ]),
  50874. _: 3
  50875. }, 16);
  50876. };
  50877. }
  50878. });
  50879. var TooltipV2 = /* @__PURE__ */ _export_sfc(_sfc_main$p, [["__file", "tooltip.vue"]]);
  50880. const ElTooltipV2 = withInstall(TooltipV2);
  50881. const LEFT_CHECK_CHANGE_EVENT = "left-check-change";
  50882. const RIGHT_CHECK_CHANGE_EVENT = "right-check-change";
  50883. const transferProps = buildProps({
  50884. data: {
  50885. type: definePropType(Array),
  50886. default: () => []
  50887. },
  50888. titles: {
  50889. type: definePropType(Array),
  50890. default: () => []
  50891. },
  50892. buttonTexts: {
  50893. type: definePropType(Array),
  50894. default: () => []
  50895. },
  50896. filterPlaceholder: String,
  50897. filterMethod: {
  50898. type: definePropType(Function)
  50899. },
  50900. leftDefaultChecked: {
  50901. type: definePropType(Array),
  50902. default: () => []
  50903. },
  50904. rightDefaultChecked: {
  50905. type: definePropType(Array),
  50906. default: () => []
  50907. },
  50908. renderContent: {
  50909. type: definePropType(Function)
  50910. },
  50911. modelValue: {
  50912. type: definePropType(Array),
  50913. default: () => []
  50914. },
  50915. format: {
  50916. type: definePropType(Object),
  50917. default: () => ({})
  50918. },
  50919. filterable: Boolean,
  50920. props: {
  50921. type: definePropType(Object),
  50922. default: () => mutable({
  50923. label: "label",
  50924. key: "key",
  50925. disabled: "disabled"
  50926. })
  50927. },
  50928. targetOrder: {
  50929. type: String,
  50930. values: ["original", "push", "unshift"],
  50931. default: "original"
  50932. },
  50933. validateEvent: {
  50934. type: Boolean,
  50935. default: true
  50936. }
  50937. });
  50938. const transferCheckedChangeFn = (value, movedKeys) => [value, movedKeys].every(isArray$1) || isArray$1(value) && isNil(movedKeys);
  50939. const transferEmits = {
  50940. [CHANGE_EVENT]: (value, direction, movedKeys) => [value, movedKeys].every(isArray$1) && ["left", "right"].includes(direction),
  50941. [UPDATE_MODEL_EVENT]: (value) => isArray$1(value),
  50942. [LEFT_CHECK_CHANGE_EVENT]: transferCheckedChangeFn,
  50943. [RIGHT_CHECK_CHANGE_EVENT]: transferCheckedChangeFn
  50944. };
  50945. const CHECKED_CHANGE_EVENT = "checked-change";
  50946. const transferPanelProps = buildProps({
  50947. data: transferProps.data,
  50948. optionRender: {
  50949. type: definePropType(Function)
  50950. },
  50951. placeholder: String,
  50952. title: String,
  50953. filterable: Boolean,
  50954. format: transferProps.format,
  50955. filterMethod: transferProps.filterMethod,
  50956. defaultChecked: transferProps.leftDefaultChecked,
  50957. props: transferProps.props
  50958. });
  50959. const transferPanelEmits = {
  50960. [CHECKED_CHANGE_EVENT]: transferCheckedChangeFn
  50961. };
  50962. const usePropsAlias = (props) => {
  50963. const initProps = {
  50964. label: "label",
  50965. key: "key",
  50966. disabled: "disabled"
  50967. };
  50968. return vue.computed(() => ({
  50969. ...initProps,
  50970. ...props.props
  50971. }));
  50972. };
  50973. const useCheck$1 = (props, panelState, emit) => {
  50974. const propsAlias = usePropsAlias(props);
  50975. const filteredData = vue.computed(() => {
  50976. return props.data.filter((item) => {
  50977. if (isFunction$1(props.filterMethod)) {
  50978. return props.filterMethod(panelState.query, item);
  50979. } else {
  50980. const label = String(item[propsAlias.value.label] || item[propsAlias.value.key]);
  50981. return label.toLowerCase().includes(panelState.query.toLowerCase());
  50982. }
  50983. });
  50984. });
  50985. const checkableData = vue.computed(() => filteredData.value.filter((item) => !item[propsAlias.value.disabled]));
  50986. const checkedSummary = vue.computed(() => {
  50987. const checkedLength = panelState.checked.length;
  50988. const dataLength = props.data.length;
  50989. const { noChecked, hasChecked } = props.format;
  50990. if (noChecked && hasChecked) {
  50991. return checkedLength > 0 ? hasChecked.replace(/\${checked}/g, checkedLength.toString()).replace(/\${total}/g, dataLength.toString()) : noChecked.replace(/\${total}/g, dataLength.toString());
  50992. } else {
  50993. return `${checkedLength}/${dataLength}`;
  50994. }
  50995. });
  50996. const isIndeterminate = vue.computed(() => {
  50997. const checkedLength = panelState.checked.length;
  50998. return checkedLength > 0 && checkedLength < checkableData.value.length;
  50999. });
  51000. const updateAllChecked = () => {
  51001. const checkableDataKeys = checkableData.value.map((item) => item[propsAlias.value.key]);
  51002. panelState.allChecked = checkableDataKeys.length > 0 && checkableDataKeys.every((item) => panelState.checked.includes(item));
  51003. };
  51004. const handleAllCheckedChange = (value) => {
  51005. panelState.checked = value ? checkableData.value.map((item) => item[propsAlias.value.key]) : [];
  51006. };
  51007. vue.watch(() => panelState.checked, (val, oldVal) => {
  51008. updateAllChecked();
  51009. if (panelState.checkChangeByUser) {
  51010. const movedKeys = val.concat(oldVal).filter((v) => !val.includes(v) || !oldVal.includes(v));
  51011. emit(CHECKED_CHANGE_EVENT, val, movedKeys);
  51012. } else {
  51013. emit(CHECKED_CHANGE_EVENT, val);
  51014. panelState.checkChangeByUser = true;
  51015. }
  51016. });
  51017. vue.watch(checkableData, () => {
  51018. updateAllChecked();
  51019. });
  51020. vue.watch(() => props.data, () => {
  51021. const checked = [];
  51022. const filteredDataKeys = filteredData.value.map((item) => item[propsAlias.value.key]);
  51023. panelState.checked.forEach((item) => {
  51024. if (filteredDataKeys.includes(item)) {
  51025. checked.push(item);
  51026. }
  51027. });
  51028. panelState.checkChangeByUser = false;
  51029. panelState.checked = checked;
  51030. });
  51031. vue.watch(() => props.defaultChecked, (val, oldVal) => {
  51032. if (oldVal && val.length === oldVal.length && val.every((item) => oldVal.includes(item)))
  51033. return;
  51034. const checked = [];
  51035. const checkableDataKeys = checkableData.value.map((item) => item[propsAlias.value.key]);
  51036. val.forEach((item) => {
  51037. if (checkableDataKeys.includes(item)) {
  51038. checked.push(item);
  51039. }
  51040. });
  51041. panelState.checkChangeByUser = false;
  51042. panelState.checked = checked;
  51043. }, {
  51044. immediate: true
  51045. });
  51046. return {
  51047. filteredData,
  51048. checkableData,
  51049. checkedSummary,
  51050. isIndeterminate,
  51051. updateAllChecked,
  51052. handleAllCheckedChange
  51053. };
  51054. };
  51055. const useCheckedChange = (checkedState, emit) => {
  51056. const onSourceCheckedChange = (val, movedKeys) => {
  51057. checkedState.leftChecked = val;
  51058. if (!movedKeys)
  51059. return;
  51060. emit(LEFT_CHECK_CHANGE_EVENT, val, movedKeys);
  51061. };
  51062. const onTargetCheckedChange = (val, movedKeys) => {
  51063. checkedState.rightChecked = val;
  51064. if (!movedKeys)
  51065. return;
  51066. emit(RIGHT_CHECK_CHANGE_EVENT, val, movedKeys);
  51067. };
  51068. return {
  51069. onSourceCheckedChange,
  51070. onTargetCheckedChange
  51071. };
  51072. };
  51073. const useComputedData = (props) => {
  51074. const propsAlias = usePropsAlias(props);
  51075. const dataObj = vue.computed(() => props.data.reduce((o, cur) => (o[cur[propsAlias.value.key]] = cur) && o, {}));
  51076. const sourceData = vue.computed(() => props.data.filter((item) => !props.modelValue.includes(item[propsAlias.value.key])));
  51077. const targetData = vue.computed(() => {
  51078. if (props.targetOrder === "original") {
  51079. return props.data.filter((item) => props.modelValue.includes(item[propsAlias.value.key]));
  51080. } else {
  51081. return props.modelValue.reduce((arr, cur) => {
  51082. const val = dataObj.value[cur];
  51083. if (val) {
  51084. arr.push(val);
  51085. }
  51086. return arr;
  51087. }, []);
  51088. }
  51089. });
  51090. return {
  51091. sourceData,
  51092. targetData
  51093. };
  51094. };
  51095. const useMove = (props, checkedState, emit) => {
  51096. const propsAlias = usePropsAlias(props);
  51097. const _emit = (value, direction, movedKeys) => {
  51098. emit(UPDATE_MODEL_EVENT, value);
  51099. emit(CHANGE_EVENT, value, direction, movedKeys);
  51100. };
  51101. const addToLeft = () => {
  51102. const currentValue = props.modelValue.slice();
  51103. checkedState.rightChecked.forEach((item) => {
  51104. const index = currentValue.indexOf(item);
  51105. if (index > -1) {
  51106. currentValue.splice(index, 1);
  51107. }
  51108. });
  51109. _emit(currentValue, "left", checkedState.rightChecked);
  51110. };
  51111. const addToRight = () => {
  51112. let currentValue = props.modelValue.slice();
  51113. const itemsToBeMoved = props.data.filter((item) => {
  51114. const itemKey = item[propsAlias.value.key];
  51115. return checkedState.leftChecked.includes(itemKey) && !props.modelValue.includes(itemKey);
  51116. }).map((item) => item[propsAlias.value.key]);
  51117. currentValue = props.targetOrder === "unshift" ? itemsToBeMoved.concat(currentValue) : currentValue.concat(itemsToBeMoved);
  51118. if (props.targetOrder === "original") {
  51119. currentValue = props.data.filter((item) => currentValue.includes(item[propsAlias.value.key])).map((item) => item[propsAlias.value.key]);
  51120. }
  51121. _emit(currentValue, "right", checkedState.leftChecked);
  51122. };
  51123. return {
  51124. addToLeft,
  51125. addToRight
  51126. };
  51127. };
  51128. const __default__$j = vue.defineComponent({
  51129. name: "ElTransferPanel"
  51130. });
  51131. const _sfc_main$o = /* @__PURE__ */ vue.defineComponent({
  51132. ...__default__$j,
  51133. props: transferPanelProps,
  51134. emits: transferPanelEmits,
  51135. setup(__props, { expose, emit }) {
  51136. const props = __props;
  51137. const slots = vue.useSlots();
  51138. const OptionContent = ({ option }) => option;
  51139. const { t } = useLocale();
  51140. const ns = useNamespace("transfer");
  51141. const panelState = vue.reactive({
  51142. checked: [],
  51143. allChecked: false,
  51144. query: "",
  51145. checkChangeByUser: true
  51146. });
  51147. const propsAlias = usePropsAlias(props);
  51148. const {
  51149. filteredData,
  51150. checkedSummary,
  51151. isIndeterminate,
  51152. handleAllCheckedChange
  51153. } = useCheck$1(props, panelState, emit);
  51154. const hasNoMatch = vue.computed(() => !isEmpty(panelState.query) && isEmpty(filteredData.value));
  51155. const hasFooter = vue.computed(() => !isEmpty(slots.default()[0].children));
  51156. const { checked, allChecked, query } = vue.toRefs(panelState);
  51157. expose({
  51158. query
  51159. });
  51160. return (_ctx, _cache) => {
  51161. return vue.openBlock(), vue.createElementBlock("div", {
  51162. class: vue.normalizeClass(vue.unref(ns).b("panel"))
  51163. }, [
  51164. vue.createElementVNode("p", {
  51165. class: vue.normalizeClass(vue.unref(ns).be("panel", "header"))
  51166. }, [
  51167. vue.createVNode(vue.unref(ElCheckbox), {
  51168. modelValue: vue.unref(allChecked),
  51169. "onUpdate:modelValue": ($event) => vue.isRef(allChecked) ? allChecked.value = $event : null,
  51170. indeterminate: vue.unref(isIndeterminate),
  51171. "validate-event": false,
  51172. onChange: vue.unref(handleAllCheckedChange)
  51173. }, {
  51174. default: vue.withCtx(() => [
  51175. vue.createTextVNode(vue.toDisplayString(_ctx.title) + " ", 1),
  51176. vue.createElementVNode("span", null, vue.toDisplayString(vue.unref(checkedSummary)), 1)
  51177. ]),
  51178. _: 1
  51179. }, 8, ["modelValue", "onUpdate:modelValue", "indeterminate", "onChange"])
  51180. ], 2),
  51181. vue.createElementVNode("div", {
  51182. class: vue.normalizeClass([vue.unref(ns).be("panel", "body"), vue.unref(ns).is("with-footer", vue.unref(hasFooter))])
  51183. }, [
  51184. _ctx.filterable ? (vue.openBlock(), vue.createBlock(vue.unref(ElInput), {
  51185. key: 0,
  51186. modelValue: vue.unref(query),
  51187. "onUpdate:modelValue": ($event) => vue.isRef(query) ? query.value = $event : null,
  51188. class: vue.normalizeClass(vue.unref(ns).be("panel", "filter")),
  51189. size: "default",
  51190. placeholder: _ctx.placeholder,
  51191. "prefix-icon": vue.unref(search_default),
  51192. clearable: "",
  51193. "validate-event": false
  51194. }, null, 8, ["modelValue", "onUpdate:modelValue", "class", "placeholder", "prefix-icon"])) : vue.createCommentVNode("v-if", true),
  51195. vue.withDirectives(vue.createVNode(vue.unref(ElCheckboxGroup$1), {
  51196. modelValue: vue.unref(checked),
  51197. "onUpdate:modelValue": ($event) => vue.isRef(checked) ? checked.value = $event : null,
  51198. "validate-event": false,
  51199. class: vue.normalizeClass([vue.unref(ns).is("filterable", _ctx.filterable), vue.unref(ns).be("panel", "list")])
  51200. }, {
  51201. default: vue.withCtx(() => [
  51202. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(filteredData), (item) => {
  51203. return vue.openBlock(), vue.createBlock(vue.unref(ElCheckbox), {
  51204. key: item[vue.unref(propsAlias).key],
  51205. class: vue.normalizeClass(vue.unref(ns).be("panel", "item")),
  51206. value: item[vue.unref(propsAlias).key],
  51207. disabled: item[vue.unref(propsAlias).disabled],
  51208. "validate-event": false
  51209. }, {
  51210. default: vue.withCtx(() => {
  51211. var _a;
  51212. return [
  51213. vue.createVNode(OptionContent, {
  51214. option: (_a = _ctx.optionRender) == null ? void 0 : _a.call(_ctx, item)
  51215. }, null, 8, ["option"])
  51216. ];
  51217. }),
  51218. _: 2
  51219. }, 1032, ["class", "value", "disabled"]);
  51220. }), 128))
  51221. ]),
  51222. _: 1
  51223. }, 8, ["modelValue", "onUpdate:modelValue", "class"]), [
  51224. [vue.vShow, !vue.unref(hasNoMatch) && !vue.unref(isEmpty)(_ctx.data)]
  51225. ]),
  51226. vue.withDirectives(vue.createElementVNode("div", {
  51227. class: vue.normalizeClass(vue.unref(ns).be("panel", "empty"))
  51228. }, [
  51229. vue.renderSlot(_ctx.$slots, "empty", {}, () => [
  51230. vue.createTextVNode(vue.toDisplayString(vue.unref(hasNoMatch) ? vue.unref(t)("el.transfer.noMatch") : vue.unref(t)("el.transfer.noData")), 1)
  51231. ])
  51232. ], 2), [
  51233. [vue.vShow, vue.unref(hasNoMatch) || vue.unref(isEmpty)(_ctx.data)]
  51234. ])
  51235. ], 2),
  51236. vue.unref(hasFooter) ? (vue.openBlock(), vue.createElementBlock("p", {
  51237. key: 0,
  51238. class: vue.normalizeClass(vue.unref(ns).be("panel", "footer"))
  51239. }, [
  51240. vue.renderSlot(_ctx.$slots, "default")
  51241. ], 2)) : vue.createCommentVNode("v-if", true)
  51242. ], 2);
  51243. };
  51244. }
  51245. });
  51246. var TransferPanel = /* @__PURE__ */ _export_sfc(_sfc_main$o, [["__file", "transfer-panel.vue"]]);
  51247. const __default__$i = vue.defineComponent({
  51248. name: "ElTransfer"
  51249. });
  51250. const _sfc_main$n = /* @__PURE__ */ vue.defineComponent({
  51251. ...__default__$i,
  51252. props: transferProps,
  51253. emits: transferEmits,
  51254. setup(__props, { expose, emit }) {
  51255. const props = __props;
  51256. const slots = vue.useSlots();
  51257. const { t } = useLocale();
  51258. const ns = useNamespace("transfer");
  51259. const { formItem } = useFormItem();
  51260. const checkedState = vue.reactive({
  51261. leftChecked: [],
  51262. rightChecked: []
  51263. });
  51264. const propsAlias = usePropsAlias(props);
  51265. const { sourceData, targetData } = useComputedData(props);
  51266. const { onSourceCheckedChange, onTargetCheckedChange } = useCheckedChange(checkedState, emit);
  51267. const { addToLeft, addToRight } = useMove(props, checkedState, emit);
  51268. const leftPanel = vue.ref();
  51269. const rightPanel = vue.ref();
  51270. const clearQuery = (which) => {
  51271. switch (which) {
  51272. case "left":
  51273. leftPanel.value.query = "";
  51274. break;
  51275. case "right":
  51276. rightPanel.value.query = "";
  51277. break;
  51278. }
  51279. };
  51280. const hasButtonTexts = vue.computed(() => props.buttonTexts.length === 2);
  51281. const leftPanelTitle = vue.computed(() => props.titles[0] || t("el.transfer.titles.0"));
  51282. const rightPanelTitle = vue.computed(() => props.titles[1] || t("el.transfer.titles.1"));
  51283. const panelFilterPlaceholder = vue.computed(() => props.filterPlaceholder || t("el.transfer.filterPlaceholder"));
  51284. vue.watch(() => props.modelValue, () => {
  51285. var _a;
  51286. if (props.validateEvent) {
  51287. (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "change").catch((err) => debugWarn());
  51288. }
  51289. });
  51290. const optionRender = vue.computed(() => (option) => {
  51291. var _a;
  51292. if (props.renderContent)
  51293. return props.renderContent(vue.h, option);
  51294. const defaultSlotVNodes = (((_a = slots.default) == null ? void 0 : _a.call(slots, { option })) || []).filter((node) => node.type !== vue.Comment);
  51295. if (defaultSlotVNodes.length) {
  51296. return defaultSlotVNodes;
  51297. }
  51298. return vue.h("span", option[propsAlias.value.label] || option[propsAlias.value.key]);
  51299. });
  51300. expose({
  51301. clearQuery,
  51302. leftPanel,
  51303. rightPanel
  51304. });
  51305. return (_ctx, _cache) => {
  51306. return vue.openBlock(), vue.createElementBlock("div", {
  51307. class: vue.normalizeClass(vue.unref(ns).b())
  51308. }, [
  51309. vue.createVNode(TransferPanel, {
  51310. ref_key: "leftPanel",
  51311. ref: leftPanel,
  51312. data: vue.unref(sourceData),
  51313. "option-render": vue.unref(optionRender),
  51314. placeholder: vue.unref(panelFilterPlaceholder),
  51315. title: vue.unref(leftPanelTitle),
  51316. filterable: _ctx.filterable,
  51317. format: _ctx.format,
  51318. "filter-method": _ctx.filterMethod,
  51319. "default-checked": _ctx.leftDefaultChecked,
  51320. props: props.props,
  51321. onCheckedChange: vue.unref(onSourceCheckedChange)
  51322. }, {
  51323. empty: vue.withCtx(() => [
  51324. vue.renderSlot(_ctx.$slots, "left-empty")
  51325. ]),
  51326. default: vue.withCtx(() => [
  51327. vue.renderSlot(_ctx.$slots, "left-footer")
  51328. ]),
  51329. _: 3
  51330. }, 8, ["data", "option-render", "placeholder", "title", "filterable", "format", "filter-method", "default-checked", "props", "onCheckedChange"]),
  51331. vue.createElementVNode("div", {
  51332. class: vue.normalizeClass(vue.unref(ns).e("buttons"))
  51333. }, [
  51334. vue.createVNode(vue.unref(ElButton), {
  51335. type: "primary",
  51336. class: vue.normalizeClass([vue.unref(ns).e("button"), vue.unref(ns).is("with-texts", vue.unref(hasButtonTexts))]),
  51337. disabled: vue.unref(isEmpty)(checkedState.rightChecked),
  51338. onClick: vue.unref(addToLeft)
  51339. }, {
  51340. default: vue.withCtx(() => [
  51341. vue.createVNode(vue.unref(ElIcon), null, {
  51342. default: vue.withCtx(() => [
  51343. vue.createVNode(vue.unref(arrow_left_default))
  51344. ]),
  51345. _: 1
  51346. }),
  51347. !vue.unref(isUndefined)(_ctx.buttonTexts[0]) ? (vue.openBlock(), vue.createElementBlock("span", { key: 0 }, vue.toDisplayString(_ctx.buttonTexts[0]), 1)) : vue.createCommentVNode("v-if", true)
  51348. ]),
  51349. _: 1
  51350. }, 8, ["class", "disabled", "onClick"]),
  51351. vue.createVNode(vue.unref(ElButton), {
  51352. type: "primary",
  51353. class: vue.normalizeClass([vue.unref(ns).e("button"), vue.unref(ns).is("with-texts", vue.unref(hasButtonTexts))]),
  51354. disabled: vue.unref(isEmpty)(checkedState.leftChecked),
  51355. onClick: vue.unref(addToRight)
  51356. }, {
  51357. default: vue.withCtx(() => [
  51358. !vue.unref(isUndefined)(_ctx.buttonTexts[1]) ? (vue.openBlock(), vue.createElementBlock("span", { key: 0 }, vue.toDisplayString(_ctx.buttonTexts[1]), 1)) : vue.createCommentVNode("v-if", true),
  51359. vue.createVNode(vue.unref(ElIcon), null, {
  51360. default: vue.withCtx(() => [
  51361. vue.createVNode(vue.unref(arrow_right_default))
  51362. ]),
  51363. _: 1
  51364. })
  51365. ]),
  51366. _: 1
  51367. }, 8, ["class", "disabled", "onClick"])
  51368. ], 2),
  51369. vue.createVNode(TransferPanel, {
  51370. ref_key: "rightPanel",
  51371. ref: rightPanel,
  51372. data: vue.unref(targetData),
  51373. "option-render": vue.unref(optionRender),
  51374. placeholder: vue.unref(panelFilterPlaceholder),
  51375. filterable: _ctx.filterable,
  51376. format: _ctx.format,
  51377. "filter-method": _ctx.filterMethod,
  51378. title: vue.unref(rightPanelTitle),
  51379. "default-checked": _ctx.rightDefaultChecked,
  51380. props: props.props,
  51381. onCheckedChange: vue.unref(onTargetCheckedChange)
  51382. }, {
  51383. empty: vue.withCtx(() => [
  51384. vue.renderSlot(_ctx.$slots, "right-empty")
  51385. ]),
  51386. default: vue.withCtx(() => [
  51387. vue.renderSlot(_ctx.$slots, "right-footer")
  51388. ]),
  51389. _: 3
  51390. }, 8, ["data", "option-render", "placeholder", "filterable", "format", "filter-method", "title", "default-checked", "props", "onCheckedChange"])
  51391. ], 2);
  51392. };
  51393. }
  51394. });
  51395. var Transfer = /* @__PURE__ */ _export_sfc(_sfc_main$n, [["__file", "transfer.vue"]]);
  51396. const ElTransfer = withInstall(Transfer);
  51397. const NODE_KEY = "$treeNodeId";
  51398. const markNodeData = function(node, data) {
  51399. if (!data || data[NODE_KEY])
  51400. return;
  51401. Object.defineProperty(data, NODE_KEY, {
  51402. value: node.id,
  51403. enumerable: false,
  51404. configurable: false,
  51405. writable: false
  51406. });
  51407. };
  51408. const getNodeKey = function(key, data) {
  51409. if (!key)
  51410. return data[NODE_KEY];
  51411. return data[key];
  51412. };
  51413. const handleCurrentChange = (store, emit, setCurrent) => {
  51414. const preCurrentNode = store.value.currentNode;
  51415. setCurrent();
  51416. const currentNode = store.value.currentNode;
  51417. if (preCurrentNode === currentNode)
  51418. return;
  51419. emit("current-change", currentNode ? currentNode.data : null, currentNode);
  51420. };
  51421. const getChildState = (node) => {
  51422. let all = true;
  51423. let none = true;
  51424. let allWithoutDisable = true;
  51425. for (let i = 0, j = node.length; i < j; i++) {
  51426. const n = node[i];
  51427. if (n.checked !== true || n.indeterminate) {
  51428. all = false;
  51429. if (!n.disabled) {
  51430. allWithoutDisable = false;
  51431. }
  51432. }
  51433. if (n.checked !== false || n.indeterminate) {
  51434. none = false;
  51435. }
  51436. }
  51437. return { all, none, allWithoutDisable, half: !all && !none };
  51438. };
  51439. const reInitChecked = function(node) {
  51440. if (node.childNodes.length === 0 || node.loading)
  51441. return;
  51442. const { all, none, half } = getChildState(node.childNodes);
  51443. if (all) {
  51444. node.checked = true;
  51445. node.indeterminate = false;
  51446. } else if (half) {
  51447. node.checked = false;
  51448. node.indeterminate = true;
  51449. } else if (none) {
  51450. node.checked = false;
  51451. node.indeterminate = false;
  51452. }
  51453. const parent = node.parent;
  51454. if (!parent || parent.level === 0)
  51455. return;
  51456. if (!node.store.checkStrictly) {
  51457. reInitChecked(parent);
  51458. }
  51459. };
  51460. const getPropertyFromData = function(node, prop) {
  51461. const props = node.store.props;
  51462. const data = node.data || {};
  51463. const config = props[prop];
  51464. if (isFunction$1(config)) {
  51465. return config(data, node);
  51466. } else if (isString$1(config)) {
  51467. return data[config];
  51468. } else if (isUndefined(config)) {
  51469. const dataProp = data[prop];
  51470. return dataProp === void 0 ? "" : dataProp;
  51471. }
  51472. };
  51473. let nodeIdSeed = 0;
  51474. class Node {
  51475. constructor(options) {
  51476. this.id = nodeIdSeed++;
  51477. this.text = null;
  51478. this.checked = false;
  51479. this.indeterminate = false;
  51480. this.data = null;
  51481. this.expanded = false;
  51482. this.parent = null;
  51483. this.visible = true;
  51484. this.isCurrent = false;
  51485. this.canFocus = false;
  51486. for (const name in options) {
  51487. if (hasOwn(options, name)) {
  51488. this[name] = options[name];
  51489. }
  51490. }
  51491. this.level = 0;
  51492. this.loaded = false;
  51493. this.childNodes = [];
  51494. this.loading = false;
  51495. if (this.parent) {
  51496. this.level = this.parent.level + 1;
  51497. }
  51498. }
  51499. initialize() {
  51500. const store = this.store;
  51501. if (!store) {
  51502. throw new Error("[Node]store is required!");
  51503. }
  51504. store.registerNode(this);
  51505. const props = store.props;
  51506. if (props && typeof props.isLeaf !== "undefined") {
  51507. const isLeaf = getPropertyFromData(this, "isLeaf");
  51508. if (isBoolean(isLeaf)) {
  51509. this.isLeafByUser = isLeaf;
  51510. }
  51511. }
  51512. if (store.lazy !== true && this.data) {
  51513. this.setData(this.data);
  51514. if (store.defaultExpandAll) {
  51515. this.expanded = true;
  51516. this.canFocus = true;
  51517. }
  51518. } else if (this.level > 0 && store.lazy && store.defaultExpandAll && !this.isLeafByUser) {
  51519. this.expand();
  51520. }
  51521. if (!isArray$1(this.data)) {
  51522. markNodeData(this, this.data);
  51523. }
  51524. if (!this.data)
  51525. return;
  51526. const defaultExpandedKeys = store.defaultExpandedKeys;
  51527. const key = store.key;
  51528. if (key && defaultExpandedKeys && defaultExpandedKeys.includes(this.key)) {
  51529. this.expand(null, store.autoExpandParent);
  51530. }
  51531. if (key && store.currentNodeKey !== void 0 && this.key === store.currentNodeKey) {
  51532. store.currentNode = this;
  51533. store.currentNode.isCurrent = true;
  51534. }
  51535. if (store.lazy) {
  51536. store._initDefaultCheckedNode(this);
  51537. }
  51538. this.updateLeafState();
  51539. if (this.parent && (this.level === 1 || this.parent.expanded === true))
  51540. this.canFocus = true;
  51541. }
  51542. setData(data) {
  51543. if (!isArray$1(data)) {
  51544. markNodeData(this, data);
  51545. }
  51546. this.data = data;
  51547. this.childNodes = [];
  51548. let children;
  51549. if (this.level === 0 && isArray$1(this.data)) {
  51550. children = this.data;
  51551. } else {
  51552. children = getPropertyFromData(this, "children") || [];
  51553. }
  51554. for (let i = 0, j = children.length; i < j; i++) {
  51555. this.insertChild({ data: children[i] });
  51556. }
  51557. }
  51558. get label() {
  51559. return getPropertyFromData(this, "label");
  51560. }
  51561. get key() {
  51562. const nodeKey = this.store.key;
  51563. if (this.data)
  51564. return this.data[nodeKey];
  51565. return null;
  51566. }
  51567. get disabled() {
  51568. return getPropertyFromData(this, "disabled");
  51569. }
  51570. get nextSibling() {
  51571. const parent = this.parent;
  51572. if (parent) {
  51573. const index = parent.childNodes.indexOf(this);
  51574. if (index > -1) {
  51575. return parent.childNodes[index + 1];
  51576. }
  51577. }
  51578. return null;
  51579. }
  51580. get previousSibling() {
  51581. const parent = this.parent;
  51582. if (parent) {
  51583. const index = parent.childNodes.indexOf(this);
  51584. if (index > -1) {
  51585. return index > 0 ? parent.childNodes[index - 1] : null;
  51586. }
  51587. }
  51588. return null;
  51589. }
  51590. contains(target, deep = true) {
  51591. return (this.childNodes || []).some((child) => child === target || deep && child.contains(target));
  51592. }
  51593. remove() {
  51594. const parent = this.parent;
  51595. if (parent) {
  51596. parent.removeChild(this);
  51597. }
  51598. }
  51599. insertChild(child, index, batch) {
  51600. if (!child)
  51601. throw new Error("InsertChild error: child is required.");
  51602. if (!(child instanceof Node)) {
  51603. if (!batch) {
  51604. const children = this.getChildren(true);
  51605. if (!children.includes(child.data)) {
  51606. if (isUndefined(index) || index < 0) {
  51607. children.push(child.data);
  51608. } else {
  51609. children.splice(index, 0, child.data);
  51610. }
  51611. }
  51612. }
  51613. Object.assign(child, {
  51614. parent: this,
  51615. store: this.store
  51616. });
  51617. child = vue.reactive(new Node(child));
  51618. if (child instanceof Node) {
  51619. child.initialize();
  51620. }
  51621. }
  51622. child.level = this.level + 1;
  51623. if (isUndefined(index) || index < 0) {
  51624. this.childNodes.push(child);
  51625. } else {
  51626. this.childNodes.splice(index, 0, child);
  51627. }
  51628. this.updateLeafState();
  51629. }
  51630. insertBefore(child, ref) {
  51631. let index;
  51632. if (ref) {
  51633. index = this.childNodes.indexOf(ref);
  51634. }
  51635. this.insertChild(child, index);
  51636. }
  51637. insertAfter(child, ref) {
  51638. let index;
  51639. if (ref) {
  51640. index = this.childNodes.indexOf(ref);
  51641. if (index !== -1)
  51642. index += 1;
  51643. }
  51644. this.insertChild(child, index);
  51645. }
  51646. removeChild(child) {
  51647. const children = this.getChildren() || [];
  51648. const dataIndex = children.indexOf(child.data);
  51649. if (dataIndex > -1) {
  51650. children.splice(dataIndex, 1);
  51651. }
  51652. const index = this.childNodes.indexOf(child);
  51653. if (index > -1) {
  51654. this.store && this.store.deregisterNode(child);
  51655. child.parent = null;
  51656. this.childNodes.splice(index, 1);
  51657. }
  51658. this.updateLeafState();
  51659. }
  51660. removeChildByData(data) {
  51661. let targetNode = null;
  51662. for (let i = 0; i < this.childNodes.length; i++) {
  51663. if (this.childNodes[i].data === data) {
  51664. targetNode = this.childNodes[i];
  51665. break;
  51666. }
  51667. }
  51668. if (targetNode) {
  51669. this.removeChild(targetNode);
  51670. }
  51671. }
  51672. expand(callback, expandParent) {
  51673. const done = () => {
  51674. if (expandParent) {
  51675. let parent = this.parent;
  51676. while (parent.level > 0) {
  51677. parent.expanded = true;
  51678. parent = parent.parent;
  51679. }
  51680. }
  51681. this.expanded = true;
  51682. if (callback)
  51683. callback();
  51684. this.childNodes.forEach((item) => {
  51685. item.canFocus = true;
  51686. });
  51687. };
  51688. if (this.shouldLoadData()) {
  51689. this.loadData((data) => {
  51690. if (isArray$1(data)) {
  51691. if (this.checked) {
  51692. this.setChecked(true, true);
  51693. } else if (!this.store.checkStrictly) {
  51694. reInitChecked(this);
  51695. }
  51696. done();
  51697. }
  51698. });
  51699. } else {
  51700. done();
  51701. }
  51702. }
  51703. doCreateChildren(array, defaultProps = {}) {
  51704. array.forEach((item) => {
  51705. this.insertChild(Object.assign({ data: item }, defaultProps), void 0, true);
  51706. });
  51707. }
  51708. collapse() {
  51709. this.expanded = false;
  51710. this.childNodes.forEach((item) => {
  51711. item.canFocus = false;
  51712. });
  51713. }
  51714. shouldLoadData() {
  51715. return this.store.lazy === true && this.store.load && !this.loaded;
  51716. }
  51717. updateLeafState() {
  51718. if (this.store.lazy === true && this.loaded !== true && typeof this.isLeafByUser !== "undefined") {
  51719. this.isLeaf = this.isLeafByUser;
  51720. return;
  51721. }
  51722. const childNodes = this.childNodes;
  51723. if (!this.store.lazy || this.store.lazy === true && this.loaded === true) {
  51724. this.isLeaf = !childNodes || childNodes.length === 0;
  51725. return;
  51726. }
  51727. this.isLeaf = false;
  51728. }
  51729. setChecked(value, deep, recursion, passValue) {
  51730. this.indeterminate = value === "half";
  51731. this.checked = value === true;
  51732. if (this.store.checkStrictly)
  51733. return;
  51734. if (!(this.shouldLoadData() && !this.store.checkDescendants)) {
  51735. const { all, allWithoutDisable } = getChildState(this.childNodes);
  51736. if (!this.isLeaf && !all && allWithoutDisable) {
  51737. this.checked = false;
  51738. value = false;
  51739. }
  51740. const handleDescendants = () => {
  51741. if (deep) {
  51742. const childNodes = this.childNodes;
  51743. for (let i = 0, j = childNodes.length; i < j; i++) {
  51744. const child = childNodes[i];
  51745. passValue = passValue || value !== false;
  51746. const isCheck = child.disabled ? child.checked : passValue;
  51747. child.setChecked(isCheck, deep, true, passValue);
  51748. }
  51749. const { half, all: all2 } = getChildState(childNodes);
  51750. if (!all2) {
  51751. this.checked = all2;
  51752. this.indeterminate = half;
  51753. }
  51754. }
  51755. };
  51756. if (this.shouldLoadData()) {
  51757. this.loadData(() => {
  51758. handleDescendants();
  51759. reInitChecked(this);
  51760. }, {
  51761. checked: value !== false
  51762. });
  51763. return;
  51764. } else {
  51765. handleDescendants();
  51766. }
  51767. }
  51768. const parent = this.parent;
  51769. if (!parent || parent.level === 0)
  51770. return;
  51771. if (!recursion) {
  51772. reInitChecked(parent);
  51773. }
  51774. }
  51775. getChildren(forceInit = false) {
  51776. if (this.level === 0)
  51777. return this.data;
  51778. const data = this.data;
  51779. if (!data)
  51780. return null;
  51781. const props = this.store.props;
  51782. let children = "children";
  51783. if (props) {
  51784. children = props.children || "children";
  51785. }
  51786. if (data[children] === void 0) {
  51787. data[children] = null;
  51788. }
  51789. if (forceInit && !data[children]) {
  51790. data[children] = [];
  51791. }
  51792. return data[children];
  51793. }
  51794. updateChildren() {
  51795. const newData = this.getChildren() || [];
  51796. const oldData = this.childNodes.map((node) => node.data);
  51797. const newDataMap = {};
  51798. const newNodes = [];
  51799. newData.forEach((item, index) => {
  51800. const key = item[NODE_KEY];
  51801. const isNodeExists = !!key && oldData.findIndex((data) => data[NODE_KEY] === key) >= 0;
  51802. if (isNodeExists) {
  51803. newDataMap[key] = { index, data: item };
  51804. } else {
  51805. newNodes.push({ index, data: item });
  51806. }
  51807. });
  51808. if (!this.store.lazy) {
  51809. oldData.forEach((item) => {
  51810. if (!newDataMap[item[NODE_KEY]])
  51811. this.removeChildByData(item);
  51812. });
  51813. }
  51814. newNodes.forEach(({ index, data }) => {
  51815. this.insertChild({ data }, index);
  51816. });
  51817. this.updateLeafState();
  51818. }
  51819. loadData(callback, defaultProps = {}) {
  51820. if (this.store.lazy === true && this.store.load && !this.loaded && (!this.loading || Object.keys(defaultProps).length)) {
  51821. this.loading = true;
  51822. const resolve = (children) => {
  51823. this.childNodes = [];
  51824. this.doCreateChildren(children, defaultProps);
  51825. this.loaded = true;
  51826. this.loading = false;
  51827. this.updateLeafState();
  51828. if (callback) {
  51829. callback.call(this, children);
  51830. }
  51831. };
  51832. const reject = () => {
  51833. this.loading = false;
  51834. };
  51835. this.store.load(this, resolve, reject);
  51836. } else {
  51837. if (callback) {
  51838. callback.call(this);
  51839. }
  51840. }
  51841. }
  51842. eachNode(callback) {
  51843. const arr = [this];
  51844. while (arr.length) {
  51845. const node = arr.shift();
  51846. arr.unshift(...node.childNodes);
  51847. callback(node);
  51848. }
  51849. }
  51850. reInitChecked() {
  51851. if (this.store.checkStrictly)
  51852. return;
  51853. reInitChecked(this);
  51854. }
  51855. }
  51856. var Node$1 = Node;
  51857. class TreeStore {
  51858. constructor(options) {
  51859. this.currentNode = null;
  51860. this.currentNodeKey = null;
  51861. for (const option in options) {
  51862. if (hasOwn(options, option)) {
  51863. this[option] = options[option];
  51864. }
  51865. }
  51866. this.nodesMap = {};
  51867. }
  51868. initialize() {
  51869. this.root = new Node$1({
  51870. data: this.data,
  51871. store: this
  51872. });
  51873. this.root.initialize();
  51874. if (this.lazy && this.load) {
  51875. const loadFn = this.load;
  51876. loadFn(this.root, (data) => {
  51877. this.root.doCreateChildren(data);
  51878. this._initDefaultCheckedNodes();
  51879. });
  51880. } else {
  51881. this._initDefaultCheckedNodes();
  51882. }
  51883. }
  51884. filter(value) {
  51885. const filterNodeMethod = this.filterNodeMethod;
  51886. const lazy = this.lazy;
  51887. const traverse = function(node) {
  51888. const childNodes = node.root ? node.root.childNodes : node.childNodes;
  51889. childNodes.forEach((child) => {
  51890. child.visible = filterNodeMethod.call(child, value, child.data, child);
  51891. traverse(child);
  51892. });
  51893. if (!node.visible && childNodes.length) {
  51894. let allHidden = true;
  51895. allHidden = !childNodes.some((child) => child.visible);
  51896. if (node.root) {
  51897. node.root.visible = allHidden === false;
  51898. } else {
  51899. node.visible = allHidden === false;
  51900. }
  51901. }
  51902. if (!value)
  51903. return;
  51904. if (node.visible && !node.isLeaf) {
  51905. if (!lazy || node.loaded) {
  51906. node.expand();
  51907. }
  51908. }
  51909. };
  51910. traverse(this);
  51911. }
  51912. setData(newVal) {
  51913. const instanceChanged = newVal !== this.root.data;
  51914. if (instanceChanged) {
  51915. this.nodesMap = {};
  51916. this.root.setData(newVal);
  51917. this._initDefaultCheckedNodes();
  51918. this.setCurrentNodeKey(this.currentNodeKey);
  51919. } else {
  51920. this.root.updateChildren();
  51921. }
  51922. }
  51923. getNode(data) {
  51924. if (data instanceof Node$1)
  51925. return data;
  51926. const key = isObject$1(data) ? getNodeKey(this.key, data) : data;
  51927. return this.nodesMap[key] || null;
  51928. }
  51929. insertBefore(data, refData) {
  51930. const refNode = this.getNode(refData);
  51931. refNode.parent.insertBefore({ data }, refNode);
  51932. }
  51933. insertAfter(data, refData) {
  51934. const refNode = this.getNode(refData);
  51935. refNode.parent.insertAfter({ data }, refNode);
  51936. }
  51937. remove(data) {
  51938. const node = this.getNode(data);
  51939. if (node && node.parent) {
  51940. if (node === this.currentNode) {
  51941. this.currentNode = null;
  51942. }
  51943. node.parent.removeChild(node);
  51944. }
  51945. }
  51946. append(data, parentData) {
  51947. const parentNode = !isPropAbsent(parentData) ? this.getNode(parentData) : this.root;
  51948. if (parentNode) {
  51949. parentNode.insertChild({ data });
  51950. }
  51951. }
  51952. _initDefaultCheckedNodes() {
  51953. const defaultCheckedKeys = this.defaultCheckedKeys || [];
  51954. const nodesMap = this.nodesMap;
  51955. defaultCheckedKeys.forEach((checkedKey) => {
  51956. const node = nodesMap[checkedKey];
  51957. if (node) {
  51958. node.setChecked(true, !this.checkStrictly);
  51959. }
  51960. });
  51961. }
  51962. _initDefaultCheckedNode(node) {
  51963. const defaultCheckedKeys = this.defaultCheckedKeys || [];
  51964. if (defaultCheckedKeys.includes(node.key)) {
  51965. node.setChecked(true, !this.checkStrictly);
  51966. }
  51967. }
  51968. setDefaultCheckedKey(newVal) {
  51969. if (newVal !== this.defaultCheckedKeys) {
  51970. this.defaultCheckedKeys = newVal;
  51971. this._initDefaultCheckedNodes();
  51972. }
  51973. }
  51974. registerNode(node) {
  51975. const key = this.key;
  51976. if (!node || !node.data)
  51977. return;
  51978. if (!key) {
  51979. this.nodesMap[node.id] = node;
  51980. } else {
  51981. const nodeKey = node.key;
  51982. if (nodeKey !== void 0)
  51983. this.nodesMap[node.key] = node;
  51984. }
  51985. }
  51986. deregisterNode(node) {
  51987. const key = this.key;
  51988. if (!key || !node || !node.data)
  51989. return;
  51990. node.childNodes.forEach((child) => {
  51991. this.deregisterNode(child);
  51992. });
  51993. delete this.nodesMap[node.key];
  51994. }
  51995. getCheckedNodes(leafOnly = false, includeHalfChecked = false) {
  51996. const checkedNodes = [];
  51997. const traverse = function(node) {
  51998. const childNodes = node.root ? node.root.childNodes : node.childNodes;
  51999. childNodes.forEach((child) => {
  52000. if ((child.checked || includeHalfChecked && child.indeterminate) && (!leafOnly || leafOnly && child.isLeaf)) {
  52001. checkedNodes.push(child.data);
  52002. }
  52003. traverse(child);
  52004. });
  52005. };
  52006. traverse(this);
  52007. return checkedNodes;
  52008. }
  52009. getCheckedKeys(leafOnly = false) {
  52010. return this.getCheckedNodes(leafOnly).map((data) => (data || {})[this.key]);
  52011. }
  52012. getHalfCheckedNodes() {
  52013. const nodes = [];
  52014. const traverse = function(node) {
  52015. const childNodes = node.root ? node.root.childNodes : node.childNodes;
  52016. childNodes.forEach((child) => {
  52017. if (child.indeterminate) {
  52018. nodes.push(child.data);
  52019. }
  52020. traverse(child);
  52021. });
  52022. };
  52023. traverse(this);
  52024. return nodes;
  52025. }
  52026. getHalfCheckedKeys() {
  52027. return this.getHalfCheckedNodes().map((data) => (data || {})[this.key]);
  52028. }
  52029. _getAllNodes() {
  52030. const allNodes = [];
  52031. const nodesMap = this.nodesMap;
  52032. for (const nodeKey in nodesMap) {
  52033. if (hasOwn(nodesMap, nodeKey)) {
  52034. allNodes.push(nodesMap[nodeKey]);
  52035. }
  52036. }
  52037. return allNodes;
  52038. }
  52039. updateChildren(key, data) {
  52040. const node = this.nodesMap[key];
  52041. if (!node)
  52042. return;
  52043. const childNodes = node.childNodes;
  52044. for (let i = childNodes.length - 1; i >= 0; i--) {
  52045. const child = childNodes[i];
  52046. this.remove(child.data);
  52047. }
  52048. for (let i = 0, j = data.length; i < j; i++) {
  52049. const child = data[i];
  52050. this.append(child, node.data);
  52051. }
  52052. }
  52053. _setCheckedKeys(key, leafOnly = false, checkedKeys) {
  52054. const allNodes = this._getAllNodes().sort((a, b) => a.level - b.level);
  52055. const cache = /* @__PURE__ */ Object.create(null);
  52056. const keys = Object.keys(checkedKeys);
  52057. allNodes.forEach((node) => node.setChecked(false, false));
  52058. const cacheCheckedChild = (node) => {
  52059. node.childNodes.forEach((child) => {
  52060. var _a;
  52061. cache[child.data[key]] = true;
  52062. if ((_a = child.childNodes) == null ? void 0 : _a.length) {
  52063. cacheCheckedChild(child);
  52064. }
  52065. });
  52066. };
  52067. for (let i = 0, j = allNodes.length; i < j; i++) {
  52068. const node = allNodes[i];
  52069. const nodeKey = node.data[key].toString();
  52070. const checked = keys.includes(nodeKey);
  52071. if (!checked) {
  52072. if (node.checked && !cache[nodeKey]) {
  52073. node.setChecked(false, false);
  52074. }
  52075. continue;
  52076. }
  52077. if (node.childNodes.length) {
  52078. cacheCheckedChild(node);
  52079. }
  52080. if (node.isLeaf || this.checkStrictly) {
  52081. node.setChecked(true, false);
  52082. continue;
  52083. }
  52084. node.setChecked(true, true);
  52085. if (leafOnly) {
  52086. node.setChecked(false, false);
  52087. const traverse = function(node2) {
  52088. const childNodes = node2.childNodes;
  52089. childNodes.forEach((child) => {
  52090. if (!child.isLeaf) {
  52091. child.setChecked(false, false);
  52092. }
  52093. traverse(child);
  52094. });
  52095. };
  52096. traverse(node);
  52097. }
  52098. }
  52099. }
  52100. setCheckedNodes(array, leafOnly = false) {
  52101. const key = this.key;
  52102. const checkedKeys = {};
  52103. array.forEach((item) => {
  52104. checkedKeys[(item || {})[key]] = true;
  52105. });
  52106. this._setCheckedKeys(key, leafOnly, checkedKeys);
  52107. }
  52108. setCheckedKeys(keys, leafOnly = false) {
  52109. this.defaultCheckedKeys = keys;
  52110. const key = this.key;
  52111. const checkedKeys = {};
  52112. keys.forEach((key2) => {
  52113. checkedKeys[key2] = true;
  52114. });
  52115. this._setCheckedKeys(key, leafOnly, checkedKeys);
  52116. }
  52117. setDefaultExpandedKeys(keys) {
  52118. keys = keys || [];
  52119. this.defaultExpandedKeys = keys;
  52120. keys.forEach((key) => {
  52121. const node = this.getNode(key);
  52122. if (node)
  52123. node.expand(null, this.autoExpandParent);
  52124. });
  52125. }
  52126. setChecked(data, checked, deep) {
  52127. const node = this.getNode(data);
  52128. if (node) {
  52129. node.setChecked(!!checked, deep);
  52130. }
  52131. }
  52132. getCurrentNode() {
  52133. return this.currentNode;
  52134. }
  52135. setCurrentNode(currentNode) {
  52136. const prevCurrentNode = this.currentNode;
  52137. if (prevCurrentNode) {
  52138. prevCurrentNode.isCurrent = false;
  52139. }
  52140. this.currentNode = currentNode;
  52141. this.currentNode.isCurrent = true;
  52142. }
  52143. setUserCurrentNode(node, shouldAutoExpandParent = true) {
  52144. const key = node[this.key];
  52145. const currNode = this.nodesMap[key];
  52146. this.setCurrentNode(currNode);
  52147. if (shouldAutoExpandParent && this.currentNode.level > 1) {
  52148. this.currentNode.parent.expand(null, true);
  52149. }
  52150. }
  52151. setCurrentNodeKey(key, shouldAutoExpandParent = true) {
  52152. this.currentNodeKey = key;
  52153. if (key === null || key === void 0) {
  52154. this.currentNode && (this.currentNode.isCurrent = false);
  52155. this.currentNode = null;
  52156. return;
  52157. }
  52158. const node = this.getNode(key);
  52159. if (node) {
  52160. this.setCurrentNode(node);
  52161. if (shouldAutoExpandParent && this.currentNode.level > 1) {
  52162. this.currentNode.parent.expand(null, true);
  52163. }
  52164. }
  52165. }
  52166. }
  52167. const _sfc_main$m = vue.defineComponent({
  52168. name: "ElTreeNodeContent",
  52169. props: {
  52170. node: {
  52171. type: Object,
  52172. required: true
  52173. },
  52174. renderContent: Function
  52175. },
  52176. setup(props) {
  52177. const ns = useNamespace("tree");
  52178. const nodeInstance = vue.inject("NodeInstance");
  52179. const tree = vue.inject("RootTree");
  52180. return () => {
  52181. const node = props.node;
  52182. const { data, store } = node;
  52183. return props.renderContent ? props.renderContent(vue.h, { _self: nodeInstance, node, data, store }) : vue.renderSlot(tree.ctx.slots, "default", { node, data }, () => [
  52184. vue.h("span", { class: ns.be("node", "label") }, [node.label])
  52185. ]);
  52186. };
  52187. }
  52188. });
  52189. var NodeContent = /* @__PURE__ */ _export_sfc(_sfc_main$m, [["__file", "tree-node-content.vue"]]);
  52190. function useNodeExpandEventBroadcast(props) {
  52191. const parentNodeMap = vue.inject("TreeNodeMap", null);
  52192. const currentNodeMap = {
  52193. treeNodeExpand: (node) => {
  52194. if (props.node !== node) {
  52195. props.node.collapse();
  52196. }
  52197. },
  52198. children: []
  52199. };
  52200. if (parentNodeMap) {
  52201. parentNodeMap.children.push(currentNodeMap);
  52202. }
  52203. vue.provide("TreeNodeMap", currentNodeMap);
  52204. return {
  52205. broadcastExpanded: (node) => {
  52206. if (!props.accordion)
  52207. return;
  52208. for (const childNode of currentNodeMap.children) {
  52209. childNode.treeNodeExpand(node);
  52210. }
  52211. }
  52212. };
  52213. }
  52214. const dragEventsKey = Symbol("dragEvents");
  52215. function useDragNodeHandler({ props, ctx, el$, dropIndicator$, store }) {
  52216. const ns = useNamespace("tree");
  52217. const dragState = vue.ref({
  52218. showDropIndicator: false,
  52219. draggingNode: null,
  52220. dropNode: null,
  52221. allowDrop: true,
  52222. dropType: null
  52223. });
  52224. const treeNodeDragStart = ({ event, treeNode }) => {
  52225. if (isFunction$1(props.allowDrag) && !props.allowDrag(treeNode.node)) {
  52226. event.preventDefault();
  52227. return false;
  52228. }
  52229. event.dataTransfer.effectAllowed = "move";
  52230. try {
  52231. event.dataTransfer.setData("text/plain", "");
  52232. } catch (e) {
  52233. }
  52234. dragState.value.draggingNode = treeNode;
  52235. ctx.emit("node-drag-start", treeNode.node, event);
  52236. };
  52237. const treeNodeDragOver = ({ event, treeNode }) => {
  52238. const dropNode = treeNode;
  52239. const oldDropNode = dragState.value.dropNode;
  52240. if (oldDropNode && oldDropNode.node.id !== dropNode.node.id) {
  52241. removeClass(oldDropNode.$el, ns.is("drop-inner"));
  52242. }
  52243. const draggingNode = dragState.value.draggingNode;
  52244. if (!draggingNode || !dropNode)
  52245. return;
  52246. let dropPrev = true;
  52247. let dropInner = true;
  52248. let dropNext = true;
  52249. let userAllowDropInner = true;
  52250. if (isFunction$1(props.allowDrop)) {
  52251. dropPrev = props.allowDrop(draggingNode.node, dropNode.node, "prev");
  52252. userAllowDropInner = dropInner = props.allowDrop(draggingNode.node, dropNode.node, "inner");
  52253. dropNext = props.allowDrop(draggingNode.node, dropNode.node, "next");
  52254. }
  52255. event.dataTransfer.dropEffect = dropInner || dropPrev || dropNext ? "move" : "none";
  52256. if ((dropPrev || dropInner || dropNext) && (oldDropNode == null ? void 0 : oldDropNode.node.id) !== dropNode.node.id) {
  52257. if (oldDropNode) {
  52258. ctx.emit("node-drag-leave", draggingNode.node, oldDropNode.node, event);
  52259. }
  52260. ctx.emit("node-drag-enter", draggingNode.node, dropNode.node, event);
  52261. }
  52262. if (dropPrev || dropInner || dropNext) {
  52263. dragState.value.dropNode = dropNode;
  52264. } else {
  52265. dragState.value.dropNode = null;
  52266. }
  52267. if (dropNode.node.nextSibling === draggingNode.node) {
  52268. dropNext = false;
  52269. }
  52270. if (dropNode.node.previousSibling === draggingNode.node) {
  52271. dropPrev = false;
  52272. }
  52273. if (dropNode.node.contains(draggingNode.node, false)) {
  52274. dropInner = false;
  52275. }
  52276. if (draggingNode.node === dropNode.node || draggingNode.node.contains(dropNode.node)) {
  52277. dropPrev = false;
  52278. dropInner = false;
  52279. dropNext = false;
  52280. }
  52281. const targetPosition = dropNode.$el.querySelector(`.${ns.be("node", "content")}`).getBoundingClientRect();
  52282. const treePosition = el$.value.getBoundingClientRect();
  52283. let dropType;
  52284. const prevPercent = dropPrev ? dropInner ? 0.25 : dropNext ? 0.45 : 1 : -1;
  52285. const nextPercent = dropNext ? dropInner ? 0.75 : dropPrev ? 0.55 : 0 : 1;
  52286. let indicatorTop = -9999;
  52287. const distance = event.clientY - targetPosition.top;
  52288. if (distance < targetPosition.height * prevPercent) {
  52289. dropType = "before";
  52290. } else if (distance > targetPosition.height * nextPercent) {
  52291. dropType = "after";
  52292. } else if (dropInner) {
  52293. dropType = "inner";
  52294. } else {
  52295. dropType = "none";
  52296. }
  52297. const iconPosition = dropNode.$el.querySelector(`.${ns.be("node", "expand-icon")}`).getBoundingClientRect();
  52298. const dropIndicator = dropIndicator$.value;
  52299. if (dropType === "before") {
  52300. indicatorTop = iconPosition.top - treePosition.top;
  52301. } else if (dropType === "after") {
  52302. indicatorTop = iconPosition.bottom - treePosition.top;
  52303. }
  52304. dropIndicator.style.top = `${indicatorTop}px`;
  52305. dropIndicator.style.left = `${iconPosition.right - treePosition.left}px`;
  52306. if (dropType === "inner") {
  52307. addClass(dropNode.$el, ns.is("drop-inner"));
  52308. } else {
  52309. removeClass(dropNode.$el, ns.is("drop-inner"));
  52310. }
  52311. dragState.value.showDropIndicator = dropType === "before" || dropType === "after";
  52312. dragState.value.allowDrop = dragState.value.showDropIndicator || userAllowDropInner;
  52313. dragState.value.dropType = dropType;
  52314. ctx.emit("node-drag-over", draggingNode.node, dropNode.node, event);
  52315. };
  52316. const treeNodeDragEnd = (event) => {
  52317. const { draggingNode, dropType, dropNode } = dragState.value;
  52318. event.preventDefault();
  52319. if (event.dataTransfer) {
  52320. event.dataTransfer.dropEffect = "move";
  52321. }
  52322. if (draggingNode && dropNode) {
  52323. const draggingNodeCopy = { data: draggingNode.node.data };
  52324. if (dropType !== "none") {
  52325. draggingNode.node.remove();
  52326. }
  52327. if (dropType === "before") {
  52328. dropNode.node.parent.insertBefore(draggingNodeCopy, dropNode.node);
  52329. } else if (dropType === "after") {
  52330. dropNode.node.parent.insertAfter(draggingNodeCopy, dropNode.node);
  52331. } else if (dropType === "inner") {
  52332. dropNode.node.insertChild(draggingNodeCopy);
  52333. }
  52334. if (dropType !== "none") {
  52335. store.value.registerNode(draggingNodeCopy);
  52336. if (store.value.key) {
  52337. draggingNode.node.eachNode((node) => {
  52338. var _a;
  52339. (_a = store.value.nodesMap[node.data[store.value.key]]) == null ? void 0 : _a.setChecked(node.checked, !store.value.checkStrictly);
  52340. });
  52341. }
  52342. }
  52343. removeClass(dropNode.$el, ns.is("drop-inner"));
  52344. ctx.emit("node-drag-end", draggingNode.node, dropNode.node, dropType, event);
  52345. if (dropType !== "none") {
  52346. ctx.emit("node-drop", draggingNode.node, dropNode.node, dropType, event);
  52347. }
  52348. }
  52349. if (draggingNode && !dropNode) {
  52350. ctx.emit("node-drag-end", draggingNode.node, null, dropType, event);
  52351. }
  52352. dragState.value.showDropIndicator = false;
  52353. dragState.value.draggingNode = null;
  52354. dragState.value.dropNode = null;
  52355. dragState.value.allowDrop = true;
  52356. };
  52357. vue.provide(dragEventsKey, {
  52358. treeNodeDragStart,
  52359. treeNodeDragOver,
  52360. treeNodeDragEnd
  52361. });
  52362. return {
  52363. dragState
  52364. };
  52365. }
  52366. const _sfc_main$l = vue.defineComponent({
  52367. name: "ElTreeNode",
  52368. components: {
  52369. ElCollapseTransition,
  52370. ElCheckbox,
  52371. NodeContent,
  52372. ElIcon,
  52373. Loading: loading_default
  52374. },
  52375. props: {
  52376. node: {
  52377. type: Node$1,
  52378. default: () => ({})
  52379. },
  52380. props: {
  52381. type: Object,
  52382. default: () => ({})
  52383. },
  52384. accordion: Boolean,
  52385. renderContent: Function,
  52386. renderAfterExpand: Boolean,
  52387. showCheckbox: {
  52388. type: Boolean,
  52389. default: false
  52390. }
  52391. },
  52392. emits: ["node-expand"],
  52393. setup(props, ctx) {
  52394. const ns = useNamespace("tree");
  52395. const { broadcastExpanded } = useNodeExpandEventBroadcast(props);
  52396. const tree = vue.inject("RootTree");
  52397. const expanded = vue.ref(false);
  52398. const childNodeRendered = vue.ref(false);
  52399. const oldChecked = vue.ref(null);
  52400. const oldIndeterminate = vue.ref(null);
  52401. const node$ = vue.ref(null);
  52402. const dragEvents = vue.inject(dragEventsKey);
  52403. const instance = vue.getCurrentInstance();
  52404. vue.provide("NodeInstance", instance);
  52405. if (props.node.expanded) {
  52406. expanded.value = true;
  52407. childNodeRendered.value = true;
  52408. }
  52409. const childrenKey = tree.props.props["children"] || "children";
  52410. vue.watch(() => {
  52411. const children = props.node.data[childrenKey];
  52412. return children && [...children];
  52413. }, () => {
  52414. props.node.updateChildren();
  52415. });
  52416. vue.watch(() => props.node.indeterminate, (val) => {
  52417. handleSelectChange(props.node.checked, val);
  52418. });
  52419. vue.watch(() => props.node.checked, (val) => {
  52420. handleSelectChange(val, props.node.indeterminate);
  52421. });
  52422. vue.watch(() => props.node.childNodes.length, () => props.node.reInitChecked());
  52423. vue.watch(() => props.node.expanded, (val) => {
  52424. vue.nextTick(() => expanded.value = val);
  52425. if (val) {
  52426. childNodeRendered.value = true;
  52427. }
  52428. });
  52429. const getNodeKey$1 = (node) => {
  52430. return getNodeKey(tree.props.nodeKey, node.data);
  52431. };
  52432. const getNodeClass = (node) => {
  52433. const nodeClassFunc = props.props.class;
  52434. if (!nodeClassFunc) {
  52435. return {};
  52436. }
  52437. let className;
  52438. if (isFunction$1(nodeClassFunc)) {
  52439. const { data } = node;
  52440. className = nodeClassFunc(data, node);
  52441. } else {
  52442. className = nodeClassFunc;
  52443. }
  52444. if (isString$1(className)) {
  52445. return { [className]: true };
  52446. } else {
  52447. return className;
  52448. }
  52449. };
  52450. const handleSelectChange = (checked, indeterminate) => {
  52451. if (oldChecked.value !== checked || oldIndeterminate.value !== indeterminate) {
  52452. tree.ctx.emit("check-change", props.node.data, checked, indeterminate);
  52453. }
  52454. oldChecked.value = checked;
  52455. oldIndeterminate.value = indeterminate;
  52456. };
  52457. const handleClick = (e) => {
  52458. handleCurrentChange(tree.store, tree.ctx.emit, () => {
  52459. var _a;
  52460. const nodeKeyProp = (_a = tree == null ? void 0 : tree.props) == null ? void 0 : _a.nodeKey;
  52461. if (nodeKeyProp) {
  52462. const curNodeKey = getNodeKey$1(props.node);
  52463. tree.store.value.setCurrentNodeKey(curNodeKey);
  52464. } else {
  52465. tree.store.value.setCurrentNode(props.node);
  52466. }
  52467. });
  52468. tree.currentNode.value = props.node;
  52469. if (tree.props.expandOnClickNode) {
  52470. handleExpandIconClick();
  52471. }
  52472. if (tree.props.checkOnClickNode && !props.node.disabled) {
  52473. handleCheckChange(null, {
  52474. target: { checked: !props.node.checked }
  52475. });
  52476. }
  52477. tree.ctx.emit("node-click", props.node.data, props.node, instance, e);
  52478. };
  52479. const handleContextMenu = (event) => {
  52480. if (tree.instance.vnode.props["onNodeContextmenu"]) {
  52481. event.stopPropagation();
  52482. event.preventDefault();
  52483. }
  52484. tree.ctx.emit("node-contextmenu", event, props.node.data, props.node, instance);
  52485. };
  52486. const handleExpandIconClick = () => {
  52487. if (props.node.isLeaf)
  52488. return;
  52489. if (expanded.value) {
  52490. tree.ctx.emit("node-collapse", props.node.data, props.node, instance);
  52491. props.node.collapse();
  52492. } else {
  52493. props.node.expand(() => {
  52494. ctx.emit("node-expand", props.node.data, props.node, instance);
  52495. });
  52496. }
  52497. };
  52498. const handleCheckChange = (value, ev) => {
  52499. props.node.setChecked(ev.target.checked, !tree.props.checkStrictly);
  52500. vue.nextTick(() => {
  52501. const store = tree.store.value;
  52502. tree.ctx.emit("check", props.node.data, {
  52503. checkedNodes: store.getCheckedNodes(),
  52504. checkedKeys: store.getCheckedKeys(),
  52505. halfCheckedNodes: store.getHalfCheckedNodes(),
  52506. halfCheckedKeys: store.getHalfCheckedKeys()
  52507. });
  52508. });
  52509. };
  52510. const handleChildNodeExpand = (nodeData, node, instance2) => {
  52511. broadcastExpanded(node);
  52512. tree.ctx.emit("node-expand", nodeData, node, instance2);
  52513. };
  52514. const handleDragStart = (event) => {
  52515. if (!tree.props.draggable)
  52516. return;
  52517. dragEvents.treeNodeDragStart({ event, treeNode: props });
  52518. };
  52519. const handleDragOver = (event) => {
  52520. event.preventDefault();
  52521. if (!tree.props.draggable)
  52522. return;
  52523. dragEvents.treeNodeDragOver({
  52524. event,
  52525. treeNode: { $el: node$.value, node: props.node }
  52526. });
  52527. };
  52528. const handleDrop = (event) => {
  52529. event.preventDefault();
  52530. };
  52531. const handleDragEnd = (event) => {
  52532. if (!tree.props.draggable)
  52533. return;
  52534. dragEvents.treeNodeDragEnd(event);
  52535. };
  52536. return {
  52537. ns,
  52538. node$,
  52539. tree,
  52540. expanded,
  52541. childNodeRendered,
  52542. oldChecked,
  52543. oldIndeterminate,
  52544. getNodeKey: getNodeKey$1,
  52545. getNodeClass,
  52546. handleSelectChange,
  52547. handleClick,
  52548. handleContextMenu,
  52549. handleExpandIconClick,
  52550. handleCheckChange,
  52551. handleChildNodeExpand,
  52552. handleDragStart,
  52553. handleDragOver,
  52554. handleDrop,
  52555. handleDragEnd,
  52556. CaretRight: caret_right_default
  52557. };
  52558. }
  52559. });
  52560. function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
  52561. const _component_el_icon = vue.resolveComponent("el-icon");
  52562. const _component_el_checkbox = vue.resolveComponent("el-checkbox");
  52563. const _component_loading = vue.resolveComponent("loading");
  52564. const _component_node_content = vue.resolveComponent("node-content");
  52565. const _component_el_tree_node = vue.resolveComponent("el-tree-node");
  52566. const _component_el_collapse_transition = vue.resolveComponent("el-collapse-transition");
  52567. return vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  52568. ref: "node$",
  52569. class: vue.normalizeClass([
  52570. _ctx.ns.b("node"),
  52571. _ctx.ns.is("expanded", _ctx.expanded),
  52572. _ctx.ns.is("current", _ctx.node.isCurrent),
  52573. _ctx.ns.is("hidden", !_ctx.node.visible),
  52574. _ctx.ns.is("focusable", !_ctx.node.disabled),
  52575. _ctx.ns.is("checked", !_ctx.node.disabled && _ctx.node.checked),
  52576. _ctx.getNodeClass(_ctx.node)
  52577. ]),
  52578. role: "treeitem",
  52579. tabindex: "-1",
  52580. "aria-expanded": _ctx.expanded,
  52581. "aria-disabled": _ctx.node.disabled,
  52582. "aria-checked": _ctx.node.checked,
  52583. draggable: _ctx.tree.props.draggable,
  52584. "data-key": _ctx.getNodeKey(_ctx.node),
  52585. onClick: vue.withModifiers(_ctx.handleClick, ["stop"]),
  52586. onContextmenu: _ctx.handleContextMenu,
  52587. onDragstart: vue.withModifiers(_ctx.handleDragStart, ["stop"]),
  52588. onDragover: vue.withModifiers(_ctx.handleDragOver, ["stop"]),
  52589. onDragend: vue.withModifiers(_ctx.handleDragEnd, ["stop"]),
  52590. onDrop: vue.withModifiers(_ctx.handleDrop, ["stop"])
  52591. }, [
  52592. vue.createElementVNode("div", {
  52593. class: vue.normalizeClass(_ctx.ns.be("node", "content")),
  52594. style: vue.normalizeStyle({ paddingLeft: (_ctx.node.level - 1) * _ctx.tree.props.indent + "px" })
  52595. }, [
  52596. _ctx.tree.props.icon || _ctx.CaretRight ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
  52597. key: 0,
  52598. class: vue.normalizeClass([
  52599. _ctx.ns.be("node", "expand-icon"),
  52600. _ctx.ns.is("leaf", _ctx.node.isLeaf),
  52601. {
  52602. expanded: !_ctx.node.isLeaf && _ctx.expanded
  52603. }
  52604. ]),
  52605. onClick: vue.withModifiers(_ctx.handleExpandIconClick, ["stop"])
  52606. }, {
  52607. default: vue.withCtx(() => [
  52608. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.tree.props.icon || _ctx.CaretRight)))
  52609. ]),
  52610. _: 1
  52611. }, 8, ["class", "onClick"])) : vue.createCommentVNode("v-if", true),
  52612. _ctx.showCheckbox ? (vue.openBlock(), vue.createBlock(_component_el_checkbox, {
  52613. key: 1,
  52614. "model-value": _ctx.node.checked,
  52615. indeterminate: _ctx.node.indeterminate,
  52616. disabled: !!_ctx.node.disabled,
  52617. onClick: vue.withModifiers(() => {
  52618. }, ["stop"]),
  52619. onChange: _ctx.handleCheckChange
  52620. }, null, 8, ["model-value", "indeterminate", "disabled", "onClick", "onChange"])) : vue.createCommentVNode("v-if", true),
  52621. _ctx.node.loading ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
  52622. key: 2,
  52623. class: vue.normalizeClass([_ctx.ns.be("node", "loading-icon"), _ctx.ns.is("loading")])
  52624. }, {
  52625. default: vue.withCtx(() => [
  52626. vue.createVNode(_component_loading)
  52627. ]),
  52628. _: 1
  52629. }, 8, ["class"])) : vue.createCommentVNode("v-if", true),
  52630. vue.createVNode(_component_node_content, {
  52631. node: _ctx.node,
  52632. "render-content": _ctx.renderContent
  52633. }, null, 8, ["node", "render-content"])
  52634. ], 6),
  52635. vue.createVNode(_component_el_collapse_transition, null, {
  52636. default: vue.withCtx(() => [
  52637. !_ctx.renderAfterExpand || _ctx.childNodeRendered ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  52638. key: 0,
  52639. class: vue.normalizeClass(_ctx.ns.be("node", "children")),
  52640. role: "group",
  52641. "aria-expanded": _ctx.expanded
  52642. }, [
  52643. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.node.childNodes, (child) => {
  52644. return vue.openBlock(), vue.createBlock(_component_el_tree_node, {
  52645. key: _ctx.getNodeKey(child),
  52646. "render-content": _ctx.renderContent,
  52647. "render-after-expand": _ctx.renderAfterExpand,
  52648. "show-checkbox": _ctx.showCheckbox,
  52649. node: child,
  52650. accordion: _ctx.accordion,
  52651. props: _ctx.props,
  52652. onNodeExpand: _ctx.handleChildNodeExpand
  52653. }, null, 8, ["render-content", "render-after-expand", "show-checkbox", "node", "accordion", "props", "onNodeExpand"]);
  52654. }), 128))
  52655. ], 10, ["aria-expanded"])), [
  52656. [vue.vShow, _ctx.expanded]
  52657. ]) : vue.createCommentVNode("v-if", true)
  52658. ]),
  52659. _: 1
  52660. })
  52661. ], 42, ["aria-expanded", "aria-disabled", "aria-checked", "draggable", "data-key", "onClick", "onContextmenu", "onDragstart", "onDragover", "onDragend", "onDrop"])), [
  52662. [vue.vShow, _ctx.node.visible]
  52663. ]);
  52664. }
  52665. var ElTreeNode$1 = /* @__PURE__ */ _export_sfc(_sfc_main$l, [["render", _sfc_render$2], ["__file", "tree-node.vue"]]);
  52666. function useKeydown({ el$ }, store) {
  52667. const ns = useNamespace("tree");
  52668. const treeItems = vue.shallowRef([]);
  52669. const checkboxItems = vue.shallowRef([]);
  52670. vue.onMounted(() => {
  52671. initTabIndex();
  52672. });
  52673. vue.onUpdated(() => {
  52674. treeItems.value = Array.from(el$.value.querySelectorAll("[role=treeitem]"));
  52675. checkboxItems.value = Array.from(el$.value.querySelectorAll("input[type=checkbox]"));
  52676. });
  52677. vue.watch(checkboxItems, (val) => {
  52678. val.forEach((checkbox) => {
  52679. checkbox.setAttribute("tabindex", "-1");
  52680. });
  52681. });
  52682. const handleKeydown = (ev) => {
  52683. const currentItem = ev.target;
  52684. if (!currentItem.className.includes(ns.b("node")))
  52685. return;
  52686. const code = ev.code;
  52687. treeItems.value = Array.from(el$.value.querySelectorAll(`.${ns.is("focusable")}[role=treeitem]`));
  52688. const currentIndex = treeItems.value.indexOf(currentItem);
  52689. let nextIndex;
  52690. if ([EVENT_CODE.up, EVENT_CODE.down].includes(code)) {
  52691. ev.preventDefault();
  52692. if (code === EVENT_CODE.up) {
  52693. nextIndex = currentIndex === -1 ? 0 : currentIndex !== 0 ? currentIndex - 1 : treeItems.value.length - 1;
  52694. const startIndex = nextIndex;
  52695. while (true) {
  52696. if (store.value.getNode(treeItems.value[nextIndex].dataset.key).canFocus)
  52697. break;
  52698. nextIndex--;
  52699. if (nextIndex === startIndex) {
  52700. nextIndex = -1;
  52701. break;
  52702. }
  52703. if (nextIndex < 0) {
  52704. nextIndex = treeItems.value.length - 1;
  52705. }
  52706. }
  52707. } else {
  52708. nextIndex = currentIndex === -1 ? 0 : currentIndex < treeItems.value.length - 1 ? currentIndex + 1 : 0;
  52709. const startIndex = nextIndex;
  52710. while (true) {
  52711. if (store.value.getNode(treeItems.value[nextIndex].dataset.key).canFocus)
  52712. break;
  52713. nextIndex++;
  52714. if (nextIndex === startIndex) {
  52715. nextIndex = -1;
  52716. break;
  52717. }
  52718. if (nextIndex >= treeItems.value.length) {
  52719. nextIndex = 0;
  52720. }
  52721. }
  52722. }
  52723. nextIndex !== -1 && treeItems.value[nextIndex].focus();
  52724. }
  52725. if ([EVENT_CODE.left, EVENT_CODE.right].includes(code)) {
  52726. ev.preventDefault();
  52727. currentItem.click();
  52728. }
  52729. const hasInput = currentItem.querySelector('[type="checkbox"]');
  52730. if ([EVENT_CODE.enter, EVENT_CODE.numpadEnter, EVENT_CODE.space].includes(code) && hasInput) {
  52731. ev.preventDefault();
  52732. hasInput.click();
  52733. }
  52734. };
  52735. useEventListener(el$, "keydown", handleKeydown);
  52736. const initTabIndex = () => {
  52737. var _a;
  52738. treeItems.value = Array.from(el$.value.querySelectorAll(`.${ns.is("focusable")}[role=treeitem]`));
  52739. checkboxItems.value = Array.from(el$.value.querySelectorAll("input[type=checkbox]"));
  52740. const checkedItem = el$.value.querySelectorAll(`.${ns.is("checked")}[role=treeitem]`);
  52741. if (checkedItem.length) {
  52742. checkedItem[0].setAttribute("tabindex", "0");
  52743. return;
  52744. }
  52745. (_a = treeItems.value[0]) == null ? void 0 : _a.setAttribute("tabindex", "0");
  52746. };
  52747. }
  52748. const _sfc_main$k = vue.defineComponent({
  52749. name: "ElTree",
  52750. components: { ElTreeNode: ElTreeNode$1 },
  52751. props: {
  52752. data: {
  52753. type: Array,
  52754. default: () => []
  52755. },
  52756. emptyText: {
  52757. type: String
  52758. },
  52759. renderAfterExpand: {
  52760. type: Boolean,
  52761. default: true
  52762. },
  52763. nodeKey: String,
  52764. checkStrictly: Boolean,
  52765. defaultExpandAll: Boolean,
  52766. expandOnClickNode: {
  52767. type: Boolean,
  52768. default: true
  52769. },
  52770. checkOnClickNode: Boolean,
  52771. checkDescendants: {
  52772. type: Boolean,
  52773. default: false
  52774. },
  52775. autoExpandParent: {
  52776. type: Boolean,
  52777. default: true
  52778. },
  52779. defaultCheckedKeys: Array,
  52780. defaultExpandedKeys: Array,
  52781. currentNodeKey: [String, Number],
  52782. renderContent: Function,
  52783. showCheckbox: {
  52784. type: Boolean,
  52785. default: false
  52786. },
  52787. draggable: {
  52788. type: Boolean,
  52789. default: false
  52790. },
  52791. allowDrag: Function,
  52792. allowDrop: Function,
  52793. props: {
  52794. type: Object,
  52795. default: () => ({
  52796. children: "children",
  52797. label: "label",
  52798. disabled: "disabled"
  52799. })
  52800. },
  52801. lazy: {
  52802. type: Boolean,
  52803. default: false
  52804. },
  52805. highlightCurrent: Boolean,
  52806. load: Function,
  52807. filterNodeMethod: Function,
  52808. accordion: Boolean,
  52809. indent: {
  52810. type: Number,
  52811. default: 18
  52812. },
  52813. icon: {
  52814. type: iconPropType
  52815. }
  52816. },
  52817. emits: [
  52818. "check-change",
  52819. "current-change",
  52820. "node-click",
  52821. "node-contextmenu",
  52822. "node-collapse",
  52823. "node-expand",
  52824. "check",
  52825. "node-drag-start",
  52826. "node-drag-end",
  52827. "node-drop",
  52828. "node-drag-leave",
  52829. "node-drag-enter",
  52830. "node-drag-over"
  52831. ],
  52832. setup(props, ctx) {
  52833. const { t } = useLocale();
  52834. const ns = useNamespace("tree");
  52835. const selectInfo = vue.inject(selectKey, null);
  52836. const store = vue.ref(new TreeStore({
  52837. key: props.nodeKey,
  52838. data: props.data,
  52839. lazy: props.lazy,
  52840. props: props.props,
  52841. load: props.load,
  52842. currentNodeKey: props.currentNodeKey,
  52843. checkStrictly: props.checkStrictly,
  52844. checkDescendants: props.checkDescendants,
  52845. defaultCheckedKeys: props.defaultCheckedKeys,
  52846. defaultExpandedKeys: props.defaultExpandedKeys,
  52847. autoExpandParent: props.autoExpandParent,
  52848. defaultExpandAll: props.defaultExpandAll,
  52849. filterNodeMethod: props.filterNodeMethod
  52850. }));
  52851. store.value.initialize();
  52852. const root = vue.ref(store.value.root);
  52853. const currentNode = vue.ref(null);
  52854. const el$ = vue.ref(null);
  52855. const dropIndicator$ = vue.ref(null);
  52856. const { broadcastExpanded } = useNodeExpandEventBroadcast(props);
  52857. const { dragState } = useDragNodeHandler({
  52858. props,
  52859. ctx,
  52860. el$,
  52861. dropIndicator$,
  52862. store
  52863. });
  52864. useKeydown({ el$ }, store);
  52865. const isEmpty = vue.computed(() => {
  52866. const { childNodes } = root.value;
  52867. const hasFilteredOptions = selectInfo ? selectInfo.hasFilteredOptions !== 0 : false;
  52868. return (!childNodes || childNodes.length === 0 || childNodes.every(({ visible }) => !visible)) && !hasFilteredOptions;
  52869. });
  52870. vue.watch(() => props.currentNodeKey, (newVal) => {
  52871. store.value.setCurrentNodeKey(newVal);
  52872. });
  52873. vue.watch(() => props.defaultCheckedKeys, (newVal) => {
  52874. store.value.setDefaultCheckedKey(newVal);
  52875. });
  52876. vue.watch(() => props.defaultExpandedKeys, (newVal) => {
  52877. store.value.setDefaultExpandedKeys(newVal);
  52878. });
  52879. vue.watch(() => props.data, (newVal) => {
  52880. store.value.setData(newVal);
  52881. }, { deep: true });
  52882. vue.watch(() => props.checkStrictly, (newVal) => {
  52883. store.value.checkStrictly = newVal;
  52884. });
  52885. const filter = (value) => {
  52886. if (!props.filterNodeMethod)
  52887. throw new Error("[Tree] filterNodeMethod is required when filter");
  52888. store.value.filter(value);
  52889. };
  52890. const getNodeKey$1 = (node) => {
  52891. return getNodeKey(props.nodeKey, node.data);
  52892. };
  52893. const getNodePath = (data) => {
  52894. if (!props.nodeKey)
  52895. throw new Error("[Tree] nodeKey is required in getNodePath");
  52896. const node = store.value.getNode(data);
  52897. if (!node)
  52898. return [];
  52899. const path = [node.data];
  52900. let parent = node.parent;
  52901. while (parent && parent !== root.value) {
  52902. path.push(parent.data);
  52903. parent = parent.parent;
  52904. }
  52905. return path.reverse();
  52906. };
  52907. const getCheckedNodes = (leafOnly, includeHalfChecked) => {
  52908. return store.value.getCheckedNodes(leafOnly, includeHalfChecked);
  52909. };
  52910. const getCheckedKeys = (leafOnly) => {
  52911. return store.value.getCheckedKeys(leafOnly);
  52912. };
  52913. const getCurrentNode = () => {
  52914. const currentNode2 = store.value.getCurrentNode();
  52915. return currentNode2 ? currentNode2.data : null;
  52916. };
  52917. const getCurrentKey = () => {
  52918. if (!props.nodeKey)
  52919. throw new Error("[Tree] nodeKey is required in getCurrentKey");
  52920. const currentNode2 = getCurrentNode();
  52921. return currentNode2 ? currentNode2[props.nodeKey] : null;
  52922. };
  52923. const setCheckedNodes = (nodes, leafOnly) => {
  52924. if (!props.nodeKey)
  52925. throw new Error("[Tree] nodeKey is required in setCheckedNodes");
  52926. store.value.setCheckedNodes(nodes, leafOnly);
  52927. };
  52928. const setCheckedKeys = (keys, leafOnly) => {
  52929. if (!props.nodeKey)
  52930. throw new Error("[Tree] nodeKey is required in setCheckedKeys");
  52931. store.value.setCheckedKeys(keys, leafOnly);
  52932. };
  52933. const setChecked = (data, checked, deep) => {
  52934. store.value.setChecked(data, checked, deep);
  52935. };
  52936. const getHalfCheckedNodes = () => {
  52937. return store.value.getHalfCheckedNodes();
  52938. };
  52939. const getHalfCheckedKeys = () => {
  52940. return store.value.getHalfCheckedKeys();
  52941. };
  52942. const setCurrentNode = (node, shouldAutoExpandParent = true) => {
  52943. if (!props.nodeKey)
  52944. throw new Error("[Tree] nodeKey is required in setCurrentNode");
  52945. handleCurrentChange(store, ctx.emit, () => {
  52946. broadcastExpanded(node);
  52947. store.value.setUserCurrentNode(node, shouldAutoExpandParent);
  52948. });
  52949. };
  52950. const setCurrentKey = (key, shouldAutoExpandParent = true) => {
  52951. if (!props.nodeKey)
  52952. throw new Error("[Tree] nodeKey is required in setCurrentKey");
  52953. handleCurrentChange(store, ctx.emit, () => {
  52954. broadcastExpanded();
  52955. store.value.setCurrentNodeKey(key, shouldAutoExpandParent);
  52956. });
  52957. };
  52958. const getNode = (data) => {
  52959. return store.value.getNode(data);
  52960. };
  52961. const remove = (data) => {
  52962. store.value.remove(data);
  52963. };
  52964. const append = (data, parentNode) => {
  52965. store.value.append(data, parentNode);
  52966. };
  52967. const insertBefore = (data, refNode) => {
  52968. store.value.insertBefore(data, refNode);
  52969. };
  52970. const insertAfter = (data, refNode) => {
  52971. store.value.insertAfter(data, refNode);
  52972. };
  52973. const handleNodeExpand = (nodeData, node, instance) => {
  52974. broadcastExpanded(node);
  52975. ctx.emit("node-expand", nodeData, node, instance);
  52976. };
  52977. const updateKeyChildren = (key, data) => {
  52978. if (!props.nodeKey)
  52979. throw new Error("[Tree] nodeKey is required in updateKeyChild");
  52980. store.value.updateChildren(key, data);
  52981. };
  52982. vue.provide("RootTree", {
  52983. ctx,
  52984. props,
  52985. store,
  52986. root,
  52987. currentNode,
  52988. instance: vue.getCurrentInstance()
  52989. });
  52990. vue.provide(formItemContextKey, void 0);
  52991. return {
  52992. ns,
  52993. store,
  52994. root,
  52995. currentNode,
  52996. dragState,
  52997. el$,
  52998. dropIndicator$,
  52999. isEmpty,
  53000. filter,
  53001. getNodeKey: getNodeKey$1,
  53002. getNodePath,
  53003. getCheckedNodes,
  53004. getCheckedKeys,
  53005. getCurrentNode,
  53006. getCurrentKey,
  53007. setCheckedNodes,
  53008. setCheckedKeys,
  53009. setChecked,
  53010. getHalfCheckedNodes,
  53011. getHalfCheckedKeys,
  53012. setCurrentNode,
  53013. setCurrentKey,
  53014. t,
  53015. getNode,
  53016. remove,
  53017. append,
  53018. insertBefore,
  53019. insertAfter,
  53020. handleNodeExpand,
  53021. updateKeyChildren
  53022. };
  53023. }
  53024. });
  53025. function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
  53026. const _component_el_tree_node = vue.resolveComponent("el-tree-node");
  53027. return vue.openBlock(), vue.createElementBlock("div", {
  53028. ref: "el$",
  53029. class: vue.normalizeClass([
  53030. _ctx.ns.b(),
  53031. _ctx.ns.is("dragging", !!_ctx.dragState.draggingNode),
  53032. _ctx.ns.is("drop-not-allow", !_ctx.dragState.allowDrop),
  53033. _ctx.ns.is("drop-inner", _ctx.dragState.dropType === "inner"),
  53034. { [_ctx.ns.m("highlight-current")]: _ctx.highlightCurrent }
  53035. ]),
  53036. role: "tree"
  53037. }, [
  53038. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.root.childNodes, (child) => {
  53039. return vue.openBlock(), vue.createBlock(_component_el_tree_node, {
  53040. key: _ctx.getNodeKey(child),
  53041. node: child,
  53042. props: _ctx.props,
  53043. accordion: _ctx.accordion,
  53044. "render-after-expand": _ctx.renderAfterExpand,
  53045. "show-checkbox": _ctx.showCheckbox,
  53046. "render-content": _ctx.renderContent,
  53047. onNodeExpand: _ctx.handleNodeExpand
  53048. }, null, 8, ["node", "props", "accordion", "render-after-expand", "show-checkbox", "render-content", "onNodeExpand"]);
  53049. }), 128)),
  53050. _ctx.isEmpty ? (vue.openBlock(), vue.createElementBlock("div", {
  53051. key: 0,
  53052. class: vue.normalizeClass(_ctx.ns.e("empty-block"))
  53053. }, [
  53054. vue.renderSlot(_ctx.$slots, "empty", {}, () => {
  53055. var _a;
  53056. return [
  53057. vue.createElementVNode("span", {
  53058. class: vue.normalizeClass(_ctx.ns.e("empty-text"))
  53059. }, vue.toDisplayString((_a = _ctx.emptyText) != null ? _a : _ctx.t("el.tree.emptyText")), 3)
  53060. ];
  53061. })
  53062. ], 2)) : vue.createCommentVNode("v-if", true),
  53063. vue.withDirectives(vue.createElementVNode("div", {
  53064. ref: "dropIndicator$",
  53065. class: vue.normalizeClass(_ctx.ns.e("drop-indicator"))
  53066. }, null, 2), [
  53067. [vue.vShow, _ctx.dragState.showDropIndicator]
  53068. ])
  53069. ], 2);
  53070. }
  53071. var Tree = /* @__PURE__ */ _export_sfc(_sfc_main$k, [["render", _sfc_render$1], ["__file", "tree.vue"]]);
  53072. const ElTree = withInstall(Tree);
  53073. const useSelect = (props, { attrs, emit }, {
  53074. select,
  53075. tree,
  53076. key
  53077. }) => {
  53078. const ns = useNamespace("tree-select");
  53079. vue.watch(() => props.data, () => {
  53080. if (props.filterable) {
  53081. vue.nextTick(() => {
  53082. var _a, _b;
  53083. (_b = tree.value) == null ? void 0 : _b.filter((_a = select.value) == null ? void 0 : _a.states.inputValue);
  53084. });
  53085. }
  53086. }, { flush: "post" });
  53087. const result = {
  53088. ...pick(vue.toRefs(props), Object.keys(ElSelect.props)),
  53089. ...attrs,
  53090. "onUpdate:modelValue": (value) => emit(UPDATE_MODEL_EVENT, value),
  53091. valueKey: key,
  53092. popperClass: vue.computed(() => {
  53093. const classes = [ns.e("popper")];
  53094. if (props.popperClass)
  53095. classes.push(props.popperClass);
  53096. return classes.join(" ");
  53097. }),
  53098. filterMethod: (keyword = "") => {
  53099. var _a;
  53100. if (props.filterMethod) {
  53101. props.filterMethod(keyword);
  53102. } else if (props.remoteMethod) {
  53103. props.remoteMethod(keyword);
  53104. } else {
  53105. (_a = tree.value) == null ? void 0 : _a.filter(keyword);
  53106. }
  53107. }
  53108. };
  53109. return result;
  53110. };
  53111. const component = vue.defineComponent({
  53112. extends: ElOption,
  53113. setup(props, ctx) {
  53114. const result = ElOption.setup(props, ctx);
  53115. delete result.selectOptionClick;
  53116. const vm = vue.getCurrentInstance().proxy;
  53117. vue.nextTick(() => {
  53118. if (!result.select.states.cachedOptions.get(vm.value)) {
  53119. result.select.onOptionCreate(vm);
  53120. }
  53121. });
  53122. vue.watch(() => ctx.attrs.visible, (val) => {
  53123. result.states.visible = val;
  53124. }, {
  53125. immediate: true
  53126. });
  53127. return result;
  53128. },
  53129. methods: {
  53130. selectOptionClick() {
  53131. this.$el.parentElement.click();
  53132. }
  53133. }
  53134. });
  53135. var TreeSelectOption = component;
  53136. function isValidValue(val) {
  53137. return val || val === 0;
  53138. }
  53139. function isValidArray(val) {
  53140. return isArray$1(val) && val.length;
  53141. }
  53142. function toValidArray(val) {
  53143. return isArray$1(val) ? val : isValidValue(val) ? [val] : [];
  53144. }
  53145. function treeFind(treeData, findCallback, getChildren, resultCallback, parent) {
  53146. for (let i = 0; i < treeData.length; i++) {
  53147. const data = treeData[i];
  53148. if (findCallback(data, i, treeData, parent)) {
  53149. return resultCallback ? resultCallback(data, i, treeData, parent) : data;
  53150. } else {
  53151. const children = getChildren(data);
  53152. if (isValidArray(children)) {
  53153. const find = treeFind(children, findCallback, getChildren, resultCallback, data);
  53154. if (find)
  53155. return find;
  53156. }
  53157. }
  53158. }
  53159. }
  53160. function treeEach(treeData, callback, getChildren, parent) {
  53161. for (let i = 0; i < treeData.length; i++) {
  53162. const data = treeData[i];
  53163. callback(data, i, treeData, parent);
  53164. const children = getChildren(data);
  53165. if (isValidArray(children)) {
  53166. treeEach(children, callback, getChildren, data);
  53167. }
  53168. }
  53169. }
  53170. const useTree$1 = (props, { attrs, slots, emit }, {
  53171. select,
  53172. tree,
  53173. key
  53174. }) => {
  53175. vue.watch(() => props.modelValue, () => {
  53176. if (props.showCheckbox) {
  53177. vue.nextTick(() => {
  53178. const treeInstance = tree.value;
  53179. if (treeInstance && !isEqual$1(treeInstance.getCheckedKeys(), toValidArray(props.modelValue))) {
  53180. treeInstance.setCheckedKeys(toValidArray(props.modelValue));
  53181. }
  53182. });
  53183. }
  53184. }, {
  53185. immediate: true,
  53186. deep: true
  53187. });
  53188. const propsMap = vue.computed(() => ({
  53189. value: key.value,
  53190. label: "label",
  53191. children: "children",
  53192. disabled: "disabled",
  53193. isLeaf: "isLeaf",
  53194. ...props.props
  53195. }));
  53196. const getNodeValByProp = (prop, data) => {
  53197. var _a;
  53198. const propVal = propsMap.value[prop];
  53199. if (isFunction$1(propVal)) {
  53200. return propVal(data, (_a = tree.value) == null ? void 0 : _a.getNode(getNodeValByProp("value", data)));
  53201. } else {
  53202. return data[propVal];
  53203. }
  53204. };
  53205. const defaultExpandedParentKeys = toValidArray(props.modelValue).map((value) => {
  53206. return treeFind(props.data || [], (data) => getNodeValByProp("value", data) === value, (data) => getNodeValByProp("children", data), (data, index, array, parent) => parent && getNodeValByProp("value", parent));
  53207. }).filter((item) => isValidValue(item));
  53208. const cacheOptions = vue.computed(() => {
  53209. if (!props.renderAfterExpand && !props.lazy)
  53210. return [];
  53211. const options = [];
  53212. treeEach(props.data.concat(props.cacheData), (node) => {
  53213. const value = getNodeValByProp("value", node);
  53214. options.push({
  53215. value,
  53216. currentLabel: getNodeValByProp("label", node),
  53217. isDisabled: getNodeValByProp("disabled", node)
  53218. });
  53219. }, (data) => getNodeValByProp("children", data));
  53220. return options;
  53221. });
  53222. const getChildCheckedKeys = () => {
  53223. var _a;
  53224. return (_a = tree.value) == null ? void 0 : _a.getCheckedKeys().filter((checkedKey) => {
  53225. var _a2;
  53226. const node = (_a2 = tree.value) == null ? void 0 : _a2.getNode(checkedKey);
  53227. return !isNil(node) && isEmpty(node.childNodes);
  53228. });
  53229. };
  53230. return {
  53231. ...pick(vue.toRefs(props), Object.keys(ElTree.props)),
  53232. ...attrs,
  53233. nodeKey: key,
  53234. expandOnClickNode: vue.computed(() => {
  53235. return !props.checkStrictly && props.expandOnClickNode;
  53236. }),
  53237. defaultExpandedKeys: vue.computed(() => {
  53238. return props.defaultExpandedKeys ? props.defaultExpandedKeys.concat(defaultExpandedParentKeys) : defaultExpandedParentKeys;
  53239. }),
  53240. renderContent: (h, { node, data, store }) => {
  53241. return h(TreeSelectOption, {
  53242. value: getNodeValByProp("value", data),
  53243. label: getNodeValByProp("label", data),
  53244. disabled: getNodeValByProp("disabled", data),
  53245. visible: node.visible
  53246. }, props.renderContent ? () => props.renderContent(h, { node, data, store }) : slots.default ? () => slots.default({ node, data, store }) : void 0);
  53247. },
  53248. filterNodeMethod: (value, data, node) => {
  53249. if (props.filterNodeMethod)
  53250. return props.filterNodeMethod(value, data, node);
  53251. if (!value)
  53252. return true;
  53253. const regexp = new RegExp(escapeStringRegexp(value), "i");
  53254. return regexp.test(getNodeValByProp("label", data) || "");
  53255. },
  53256. onNodeClick: (data, node, e) => {
  53257. var _a, _b, _c, _d;
  53258. (_a = attrs.onNodeClick) == null ? void 0 : _a.call(attrs, data, node, e);
  53259. if (props.showCheckbox && props.checkOnClickNode)
  53260. return;
  53261. if (!props.showCheckbox && (props.checkStrictly || node.isLeaf)) {
  53262. if (!getNodeValByProp("disabled", data)) {
  53263. const option = (_b = select.value) == null ? void 0 : _b.states.options.get(getNodeValByProp("value", data));
  53264. (_c = select.value) == null ? void 0 : _c.handleOptionSelect(option);
  53265. }
  53266. } else if (props.expandOnClickNode) {
  53267. e.proxy.handleExpandIconClick();
  53268. }
  53269. (_d = select.value) == null ? void 0 : _d.focus();
  53270. },
  53271. onCheck: (data, params) => {
  53272. var _a;
  53273. if (!props.showCheckbox)
  53274. return;
  53275. const dataValue = getNodeValByProp("value", data);
  53276. const dataMap = {};
  53277. treeEach([tree.value.store.root], (node) => dataMap[node.key] = node, (node) => node.childNodes);
  53278. const uncachedCheckedKeys = params.checkedKeys;
  53279. const cachedKeys = props.multiple ? toValidArray(props.modelValue).filter((item) => !(item in dataMap) && !uncachedCheckedKeys.includes(item)) : [];
  53280. const checkedKeys = cachedKeys.concat(uncachedCheckedKeys);
  53281. if (props.checkStrictly) {
  53282. emit(UPDATE_MODEL_EVENT, props.multiple ? checkedKeys : checkedKeys.includes(dataValue) ? dataValue : void 0);
  53283. } else {
  53284. if (props.multiple) {
  53285. const childKeys = getChildCheckedKeys();
  53286. emit(UPDATE_MODEL_EVENT, cachedKeys.concat(childKeys));
  53287. } else {
  53288. const firstLeaf = treeFind([data], (data2) => !isValidArray(getNodeValByProp("children", data2)) && !getNodeValByProp("disabled", data2), (data2) => getNodeValByProp("children", data2));
  53289. const firstLeafKey = firstLeaf ? getNodeValByProp("value", firstLeaf) : void 0;
  53290. const hasCheckedChild = isValidValue(props.modelValue) && !!treeFind([data], (data2) => getNodeValByProp("value", data2) === props.modelValue, (data2) => getNodeValByProp("children", data2));
  53291. emit(UPDATE_MODEL_EVENT, firstLeafKey === props.modelValue || hasCheckedChild ? void 0 : firstLeafKey);
  53292. }
  53293. }
  53294. vue.nextTick(() => {
  53295. var _a2;
  53296. const checkedKeys2 = toValidArray(props.modelValue);
  53297. tree.value.setCheckedKeys(checkedKeys2);
  53298. (_a2 = attrs.onCheck) == null ? void 0 : _a2.call(attrs, data, {
  53299. checkedKeys: tree.value.getCheckedKeys(),
  53300. checkedNodes: tree.value.getCheckedNodes(),
  53301. halfCheckedKeys: tree.value.getHalfCheckedKeys(),
  53302. halfCheckedNodes: tree.value.getHalfCheckedNodes()
  53303. });
  53304. });
  53305. (_a = select.value) == null ? void 0 : _a.focus();
  53306. },
  53307. onNodeExpand: (data, node, e) => {
  53308. var _a;
  53309. (_a = attrs.onNodeExpand) == null ? void 0 : _a.call(attrs, data, node, e);
  53310. vue.nextTick(() => {
  53311. if (!props.checkStrictly && props.lazy && props.multiple && node.checked) {
  53312. const dataMap = {};
  53313. const uncachedCheckedKeys = tree.value.getCheckedKeys();
  53314. treeEach([tree.value.store.root], (node2) => dataMap[node2.key] = node2, (node2) => node2.childNodes);
  53315. const cachedKeys = toValidArray(props.modelValue).filter((item) => !(item in dataMap) && !uncachedCheckedKeys.includes(item));
  53316. const childKeys = getChildCheckedKeys();
  53317. emit(UPDATE_MODEL_EVENT, cachedKeys.concat(childKeys));
  53318. }
  53319. });
  53320. },
  53321. cacheOptions
  53322. };
  53323. };
  53324. var CacheOptions = vue.defineComponent({
  53325. props: {
  53326. data: {
  53327. type: Array,
  53328. default: () => []
  53329. }
  53330. },
  53331. setup(props) {
  53332. const select = vue.inject(selectKey);
  53333. vue.watch(() => props.data, () => {
  53334. var _a;
  53335. props.data.forEach((item) => {
  53336. if (!select.states.cachedOptions.has(item.value)) {
  53337. select.states.cachedOptions.set(item.value, item);
  53338. }
  53339. });
  53340. const inputs = ((_a = select.selectRef) == null ? void 0 : _a.querySelectorAll("input")) || [];
  53341. if (isClient && !Array.from(inputs).includes(document.activeElement)) {
  53342. select.setSelected();
  53343. }
  53344. }, { flush: "post", immediate: true });
  53345. return () => void 0;
  53346. }
  53347. });
  53348. const _sfc_main$j = vue.defineComponent({
  53349. name: "ElTreeSelect",
  53350. inheritAttrs: false,
  53351. props: {
  53352. ...ElSelect.props,
  53353. ...ElTree.props,
  53354. cacheData: {
  53355. type: Array,
  53356. default: () => []
  53357. }
  53358. },
  53359. setup(props, context) {
  53360. const { slots, expose } = context;
  53361. const select = vue.ref();
  53362. const tree = vue.ref();
  53363. const key = vue.computed(() => props.nodeKey || props.valueKey || "value");
  53364. const selectProps = useSelect(props, context, { select, tree, key });
  53365. const { cacheOptions, ...treeProps } = useTree$1(props, context, {
  53366. select,
  53367. tree,
  53368. key
  53369. });
  53370. const methods = vue.reactive({});
  53371. expose(methods);
  53372. vue.onMounted(() => {
  53373. Object.assign(methods, {
  53374. ...pick(tree.value, [
  53375. "filter",
  53376. "updateKeyChildren",
  53377. "getCheckedNodes",
  53378. "setCheckedNodes",
  53379. "getCheckedKeys",
  53380. "setCheckedKeys",
  53381. "setChecked",
  53382. "getHalfCheckedNodes",
  53383. "getHalfCheckedKeys",
  53384. "getCurrentKey",
  53385. "getCurrentNode",
  53386. "setCurrentKey",
  53387. "setCurrentNode",
  53388. "getNode",
  53389. "remove",
  53390. "append",
  53391. "insertBefore",
  53392. "insertAfter"
  53393. ]),
  53394. ...pick(select.value, ["focus", "blur", "selectedLabel"])
  53395. });
  53396. });
  53397. return () => vue.h(ElSelect, vue.reactive({
  53398. ...selectProps,
  53399. ref: (ref2) => select.value = ref2
  53400. }), {
  53401. ...slots,
  53402. default: () => [
  53403. vue.h(CacheOptions, { data: cacheOptions.value }),
  53404. vue.h(ElTree, vue.reactive({
  53405. ...treeProps,
  53406. ref: (ref2) => tree.value = ref2
  53407. }))
  53408. ]
  53409. });
  53410. }
  53411. });
  53412. var TreeSelect = /* @__PURE__ */ _export_sfc(_sfc_main$j, [["__file", "tree-select.vue"]]);
  53413. const ElTreeSelect = withInstall(TreeSelect);
  53414. const ROOT_TREE_INJECTION_KEY = Symbol();
  53415. const EMPTY_NODE = {
  53416. key: -1,
  53417. level: -1,
  53418. data: {}
  53419. };
  53420. var TreeOptionsEnum = /* @__PURE__ */ ((TreeOptionsEnum2) => {
  53421. TreeOptionsEnum2["KEY"] = "id";
  53422. TreeOptionsEnum2["LABEL"] = "label";
  53423. TreeOptionsEnum2["CHILDREN"] = "children";
  53424. TreeOptionsEnum2["DISABLED"] = "disabled";
  53425. TreeOptionsEnum2["CLASS"] = "";
  53426. return TreeOptionsEnum2;
  53427. })(TreeOptionsEnum || {});
  53428. var SetOperationEnum = /* @__PURE__ */ ((SetOperationEnum2) => {
  53429. SetOperationEnum2["ADD"] = "add";
  53430. SetOperationEnum2["DELETE"] = "delete";
  53431. return SetOperationEnum2;
  53432. })(SetOperationEnum || {});
  53433. const itemSize = {
  53434. type: Number,
  53435. default: 26
  53436. };
  53437. const treeProps = buildProps({
  53438. data: {
  53439. type: definePropType(Array),
  53440. default: () => mutable([])
  53441. },
  53442. emptyText: {
  53443. type: String
  53444. },
  53445. height: {
  53446. type: Number,
  53447. default: 200
  53448. },
  53449. props: {
  53450. type: definePropType(Object),
  53451. default: () => mutable({
  53452. children: "children" /* CHILDREN */,
  53453. label: "label" /* LABEL */,
  53454. disabled: "disabled" /* DISABLED */,
  53455. value: "id" /* KEY */,
  53456. class: "" /* CLASS */
  53457. })
  53458. },
  53459. highlightCurrent: {
  53460. type: Boolean,
  53461. default: false
  53462. },
  53463. showCheckbox: {
  53464. type: Boolean,
  53465. default: false
  53466. },
  53467. defaultCheckedKeys: {
  53468. type: definePropType(Array),
  53469. default: () => mutable([])
  53470. },
  53471. checkStrictly: {
  53472. type: Boolean,
  53473. default: false
  53474. },
  53475. defaultExpandedKeys: {
  53476. type: definePropType(Array),
  53477. default: () => mutable([])
  53478. },
  53479. indent: {
  53480. type: Number,
  53481. default: 16
  53482. },
  53483. itemSize,
  53484. icon: {
  53485. type: iconPropType
  53486. },
  53487. expandOnClickNode: {
  53488. type: Boolean,
  53489. default: true
  53490. },
  53491. checkOnClickNode: {
  53492. type: Boolean,
  53493. default: false
  53494. },
  53495. currentNodeKey: {
  53496. type: definePropType([String, Number])
  53497. },
  53498. accordion: {
  53499. type: Boolean,
  53500. default: false
  53501. },
  53502. filterMethod: {
  53503. type: definePropType(Function)
  53504. },
  53505. perfMode: {
  53506. type: Boolean,
  53507. default: true
  53508. }
  53509. });
  53510. const treeNodeProps = buildProps({
  53511. node: {
  53512. type: definePropType(Object),
  53513. default: () => mutable(EMPTY_NODE)
  53514. },
  53515. expanded: {
  53516. type: Boolean,
  53517. default: false
  53518. },
  53519. checked: {
  53520. type: Boolean,
  53521. default: false
  53522. },
  53523. indeterminate: {
  53524. type: Boolean,
  53525. default: false
  53526. },
  53527. showCheckbox: {
  53528. type: Boolean,
  53529. default: false
  53530. },
  53531. disabled: {
  53532. type: Boolean,
  53533. default: false
  53534. },
  53535. current: {
  53536. type: Boolean,
  53537. default: false
  53538. },
  53539. hiddenExpandIcon: {
  53540. type: Boolean,
  53541. default: false
  53542. },
  53543. itemSize
  53544. });
  53545. const treeNodeContentProps = buildProps({
  53546. node: {
  53547. type: definePropType(Object),
  53548. required: true
  53549. }
  53550. });
  53551. const NODE_CLICK = "node-click";
  53552. const NODE_DROP = "node-drop";
  53553. const NODE_EXPAND = "node-expand";
  53554. const NODE_COLLAPSE = "node-collapse";
  53555. const CURRENT_CHANGE = "current-change";
  53556. const NODE_CHECK = "check";
  53557. const NODE_CHECK_CHANGE = "check-change";
  53558. const NODE_CONTEXTMENU = "node-contextmenu";
  53559. const treeEmits = {
  53560. [NODE_CLICK]: (data, node, e) => data && node && e,
  53561. [NODE_DROP]: (data, node, e) => data && node && e,
  53562. [NODE_EXPAND]: (data, node) => data && node,
  53563. [NODE_COLLAPSE]: (data, node) => data && node,
  53564. [CURRENT_CHANGE]: (data, node) => data && node,
  53565. [NODE_CHECK]: (data, checkedInfo) => data && checkedInfo,
  53566. [NODE_CHECK_CHANGE]: (data, checked) => data && isBoolean(checked),
  53567. [NODE_CONTEXTMENU]: (evt, data, node) => evt && data && node
  53568. };
  53569. const treeNodeEmits = {
  53570. click: (node, e) => !!(node && e),
  53571. drop: (node, e) => !!(node && e),
  53572. toggle: (node) => !!node,
  53573. check: (node, checked) => node && isBoolean(checked)
  53574. };
  53575. function useCheck(props, tree) {
  53576. const checkedKeys = vue.ref(/* @__PURE__ */ new Set());
  53577. const indeterminateKeys = vue.ref(/* @__PURE__ */ new Set());
  53578. const { emit } = vue.getCurrentInstance();
  53579. vue.watch([() => tree.value, () => props.defaultCheckedKeys], () => {
  53580. return vue.nextTick(() => {
  53581. _setCheckedKeys(props.defaultCheckedKeys);
  53582. });
  53583. }, {
  53584. immediate: true
  53585. });
  53586. const updateCheckedKeys = () => {
  53587. if (!tree.value || !props.showCheckbox || props.checkStrictly) {
  53588. return;
  53589. }
  53590. const { levelTreeNodeMap, maxLevel } = tree.value;
  53591. const checkedKeySet = checkedKeys.value;
  53592. const indeterminateKeySet = /* @__PURE__ */ new Set();
  53593. for (let level = maxLevel - 1; level >= 1; --level) {
  53594. const nodes = levelTreeNodeMap.get(level);
  53595. if (!nodes)
  53596. continue;
  53597. nodes.forEach((node) => {
  53598. const children = node.children;
  53599. if (children) {
  53600. let allChecked = true;
  53601. let hasChecked = false;
  53602. for (const childNode of children) {
  53603. const key = childNode.key;
  53604. if (checkedKeySet.has(key)) {
  53605. hasChecked = true;
  53606. } else if (indeterminateKeySet.has(key)) {
  53607. allChecked = false;
  53608. hasChecked = true;
  53609. break;
  53610. } else {
  53611. allChecked = false;
  53612. }
  53613. }
  53614. if (allChecked) {
  53615. checkedKeySet.add(node.key);
  53616. } else if (hasChecked) {
  53617. indeterminateKeySet.add(node.key);
  53618. checkedKeySet.delete(node.key);
  53619. } else {
  53620. checkedKeySet.delete(node.key);
  53621. indeterminateKeySet.delete(node.key);
  53622. }
  53623. }
  53624. });
  53625. }
  53626. indeterminateKeys.value = indeterminateKeySet;
  53627. };
  53628. const isChecked = (node) => checkedKeys.value.has(node.key);
  53629. const isIndeterminate = (node) => indeterminateKeys.value.has(node.key);
  53630. const toggleCheckbox = (node, isChecked2, nodeClick = true, immediateUpdate = true) => {
  53631. const checkedKeySet = checkedKeys.value;
  53632. const toggle = (node2, checked) => {
  53633. checkedKeySet[checked ? SetOperationEnum.ADD : SetOperationEnum.DELETE](node2.key);
  53634. const children = node2.children;
  53635. if (!props.checkStrictly && children) {
  53636. children.forEach((childNode) => {
  53637. if (!childNode.disabled) {
  53638. toggle(childNode, checked);
  53639. }
  53640. });
  53641. }
  53642. };
  53643. toggle(node, isChecked2);
  53644. if (immediateUpdate) {
  53645. updateCheckedKeys();
  53646. }
  53647. if (nodeClick) {
  53648. afterNodeCheck(node, isChecked2);
  53649. }
  53650. };
  53651. const afterNodeCheck = (node, checked) => {
  53652. const { checkedNodes, checkedKeys: checkedKeys2 } = getChecked();
  53653. const { halfCheckedNodes, halfCheckedKeys } = getHalfChecked();
  53654. emit(NODE_CHECK, node.data, {
  53655. checkedKeys: checkedKeys2,
  53656. checkedNodes,
  53657. halfCheckedKeys,
  53658. halfCheckedNodes
  53659. });
  53660. emit(NODE_CHECK_CHANGE, node.data, checked);
  53661. };
  53662. function getCheckedKeys(leafOnly = false) {
  53663. return getChecked(leafOnly).checkedKeys;
  53664. }
  53665. function getCheckedNodes(leafOnly = false) {
  53666. return getChecked(leafOnly).checkedNodes;
  53667. }
  53668. function getHalfCheckedKeys() {
  53669. return getHalfChecked().halfCheckedKeys;
  53670. }
  53671. function getHalfCheckedNodes() {
  53672. return getHalfChecked().halfCheckedNodes;
  53673. }
  53674. function getChecked(leafOnly = false) {
  53675. const checkedNodes = [];
  53676. const keys = [];
  53677. if ((tree == null ? void 0 : tree.value) && props.showCheckbox) {
  53678. const { treeNodeMap } = tree.value;
  53679. checkedKeys.value.forEach((key) => {
  53680. const node = treeNodeMap.get(key);
  53681. if (node && (!leafOnly || leafOnly && node.isLeaf)) {
  53682. keys.push(key);
  53683. checkedNodes.push(node.data);
  53684. }
  53685. });
  53686. }
  53687. return {
  53688. checkedKeys: keys,
  53689. checkedNodes
  53690. };
  53691. }
  53692. function getHalfChecked() {
  53693. const halfCheckedNodes = [];
  53694. const halfCheckedKeys = [];
  53695. if ((tree == null ? void 0 : tree.value) && props.showCheckbox) {
  53696. const { treeNodeMap } = tree.value;
  53697. indeterminateKeys.value.forEach((key) => {
  53698. const node = treeNodeMap.get(key);
  53699. if (node) {
  53700. halfCheckedKeys.push(key);
  53701. halfCheckedNodes.push(node.data);
  53702. }
  53703. });
  53704. }
  53705. return {
  53706. halfCheckedNodes,
  53707. halfCheckedKeys
  53708. };
  53709. }
  53710. function setCheckedKeys(keys) {
  53711. checkedKeys.value.clear();
  53712. indeterminateKeys.value.clear();
  53713. vue.nextTick(() => {
  53714. _setCheckedKeys(keys);
  53715. });
  53716. }
  53717. function setChecked(key, isChecked2) {
  53718. if ((tree == null ? void 0 : tree.value) && props.showCheckbox) {
  53719. const node = tree.value.treeNodeMap.get(key);
  53720. if (node) {
  53721. toggleCheckbox(node, isChecked2, false);
  53722. }
  53723. }
  53724. }
  53725. function _setCheckedKeys(keys) {
  53726. if (tree == null ? void 0 : tree.value) {
  53727. const { treeNodeMap } = tree.value;
  53728. if (props.showCheckbox && treeNodeMap && (keys == null ? void 0 : keys.length) > 0) {
  53729. for (const key of keys) {
  53730. const node = treeNodeMap.get(key);
  53731. if (node && !isChecked(node)) {
  53732. toggleCheckbox(node, true, false, false);
  53733. }
  53734. }
  53735. updateCheckedKeys();
  53736. }
  53737. }
  53738. }
  53739. return {
  53740. updateCheckedKeys,
  53741. toggleCheckbox,
  53742. isChecked,
  53743. isIndeterminate,
  53744. getCheckedKeys,
  53745. getCheckedNodes,
  53746. getHalfCheckedKeys,
  53747. getHalfCheckedNodes,
  53748. setChecked,
  53749. setCheckedKeys
  53750. };
  53751. }
  53752. function useFilter(props, tree) {
  53753. const hiddenNodeKeySet = vue.ref(/* @__PURE__ */ new Set([]));
  53754. const hiddenExpandIconKeySet = vue.ref(/* @__PURE__ */ new Set([]));
  53755. const filterable = vue.computed(() => {
  53756. return isFunction$1(props.filterMethod);
  53757. });
  53758. function doFilter(query) {
  53759. var _a;
  53760. if (!filterable.value) {
  53761. return;
  53762. }
  53763. const expandKeySet = /* @__PURE__ */ new Set();
  53764. const hiddenExpandIconKeys = hiddenExpandIconKeySet.value;
  53765. const hiddenKeys = hiddenNodeKeySet.value;
  53766. const family = [];
  53767. const nodes = ((_a = tree.value) == null ? void 0 : _a.treeNodes) || [];
  53768. const filter = props.filterMethod;
  53769. hiddenKeys.clear();
  53770. function traverse(nodes2) {
  53771. nodes2.forEach((node) => {
  53772. family.push(node);
  53773. if (filter == null ? void 0 : filter(query, node.data, node)) {
  53774. family.forEach((member) => {
  53775. expandKeySet.add(member.key);
  53776. });
  53777. } else if (node.isLeaf) {
  53778. hiddenKeys.add(node.key);
  53779. }
  53780. const children = node.children;
  53781. if (children) {
  53782. traverse(children);
  53783. }
  53784. if (!node.isLeaf) {
  53785. if (!expandKeySet.has(node.key)) {
  53786. hiddenKeys.add(node.key);
  53787. } else if (children) {
  53788. let allHidden = true;
  53789. for (const childNode of children) {
  53790. if (!hiddenKeys.has(childNode.key)) {
  53791. allHidden = false;
  53792. break;
  53793. }
  53794. }
  53795. if (allHidden) {
  53796. hiddenExpandIconKeys.add(node.key);
  53797. } else {
  53798. hiddenExpandIconKeys.delete(node.key);
  53799. }
  53800. }
  53801. }
  53802. family.pop();
  53803. });
  53804. }
  53805. traverse(nodes);
  53806. return expandKeySet;
  53807. }
  53808. function isForceHiddenExpandIcon(node) {
  53809. return hiddenExpandIconKeySet.value.has(node.key);
  53810. }
  53811. return {
  53812. hiddenExpandIconKeySet,
  53813. hiddenNodeKeySet,
  53814. doFilter,
  53815. isForceHiddenExpandIcon
  53816. };
  53817. }
  53818. function useTree(props, emit) {
  53819. const expandedKeySet = vue.ref(new Set(props.defaultExpandedKeys));
  53820. const currentKey = vue.ref();
  53821. const tree = vue.shallowRef();
  53822. const listRef = vue.ref();
  53823. vue.watch(() => props.currentNodeKey, (key) => {
  53824. currentKey.value = key;
  53825. }, {
  53826. immediate: true
  53827. });
  53828. vue.watch(() => props.data, (data) => {
  53829. setData(data);
  53830. }, {
  53831. immediate: true
  53832. });
  53833. const {
  53834. isIndeterminate,
  53835. isChecked,
  53836. toggleCheckbox,
  53837. getCheckedKeys,
  53838. getCheckedNodes,
  53839. getHalfCheckedKeys,
  53840. getHalfCheckedNodes,
  53841. setChecked,
  53842. setCheckedKeys
  53843. } = useCheck(props, tree);
  53844. const { doFilter, hiddenNodeKeySet, isForceHiddenExpandIcon } = useFilter(props, tree);
  53845. const valueKey = vue.computed(() => {
  53846. var _a;
  53847. return ((_a = props.props) == null ? void 0 : _a.value) || TreeOptionsEnum.KEY;
  53848. });
  53849. const childrenKey = vue.computed(() => {
  53850. var _a;
  53851. return ((_a = props.props) == null ? void 0 : _a.children) || TreeOptionsEnum.CHILDREN;
  53852. });
  53853. const disabledKey = vue.computed(() => {
  53854. var _a;
  53855. return ((_a = props.props) == null ? void 0 : _a.disabled) || TreeOptionsEnum.DISABLED;
  53856. });
  53857. const labelKey = vue.computed(() => {
  53858. var _a;
  53859. return ((_a = props.props) == null ? void 0 : _a.label) || TreeOptionsEnum.LABEL;
  53860. });
  53861. const flattenTree = vue.computed(() => {
  53862. var _a;
  53863. const expandedKeys = expandedKeySet.value;
  53864. const hiddenKeys = hiddenNodeKeySet.value;
  53865. const flattenNodes = [];
  53866. const nodes = ((_a = tree.value) == null ? void 0 : _a.treeNodes) || [];
  53867. const stack = [];
  53868. for (let i = nodes.length - 1; i >= 0; --i) {
  53869. stack.push(nodes[i]);
  53870. }
  53871. while (stack.length) {
  53872. const node = stack.pop();
  53873. if (hiddenKeys.has(node.key))
  53874. continue;
  53875. flattenNodes.push(node);
  53876. if (node.children && expandedKeys.has(node.key)) {
  53877. for (let i = node.children.length - 1; i >= 0; --i) {
  53878. stack.push(node.children[i]);
  53879. }
  53880. }
  53881. }
  53882. return flattenNodes;
  53883. });
  53884. const isNotEmpty = vue.computed(() => {
  53885. return flattenTree.value.length > 0;
  53886. });
  53887. function createTree(data) {
  53888. const treeNodeMap = /* @__PURE__ */ new Map();
  53889. const levelTreeNodeMap = /* @__PURE__ */ new Map();
  53890. let maxLevel = 1;
  53891. function traverse(nodes, level = 1, parent = void 0) {
  53892. var _a;
  53893. const siblings = [];
  53894. for (const rawNode of nodes) {
  53895. const value = getKey(rawNode);
  53896. const node = {
  53897. level,
  53898. key: value,
  53899. data: rawNode
  53900. };
  53901. node.label = getLabel(rawNode);
  53902. node.parent = parent;
  53903. const children = getChildren(rawNode);
  53904. node.disabled = getDisabled(rawNode);
  53905. node.isLeaf = !children || children.length === 0;
  53906. if (children && children.length) {
  53907. node.children = traverse(children, level + 1, node);
  53908. }
  53909. siblings.push(node);
  53910. treeNodeMap.set(value, node);
  53911. if (!levelTreeNodeMap.has(level)) {
  53912. levelTreeNodeMap.set(level, []);
  53913. }
  53914. (_a = levelTreeNodeMap.get(level)) == null ? void 0 : _a.push(node);
  53915. }
  53916. if (level > maxLevel) {
  53917. maxLevel = level;
  53918. }
  53919. return siblings;
  53920. }
  53921. const treeNodes = traverse(data);
  53922. return {
  53923. treeNodeMap,
  53924. levelTreeNodeMap,
  53925. maxLevel,
  53926. treeNodes
  53927. };
  53928. }
  53929. function filter(query) {
  53930. const keys = doFilter(query);
  53931. if (keys) {
  53932. expandedKeySet.value = keys;
  53933. }
  53934. }
  53935. function getChildren(node) {
  53936. return node[childrenKey.value];
  53937. }
  53938. function getKey(node) {
  53939. if (!node) {
  53940. return "";
  53941. }
  53942. return node[valueKey.value];
  53943. }
  53944. function getDisabled(node) {
  53945. return node[disabledKey.value];
  53946. }
  53947. function getLabel(node) {
  53948. return node[labelKey.value];
  53949. }
  53950. function toggleExpand(node) {
  53951. const expandedKeys = expandedKeySet.value;
  53952. if (expandedKeys.has(node.key)) {
  53953. collapseNode(node);
  53954. } else {
  53955. expandNode(node);
  53956. }
  53957. }
  53958. function setExpandedKeys(keys) {
  53959. const expandedKeys = /* @__PURE__ */ new Set();
  53960. const nodeMap = tree.value.treeNodeMap;
  53961. keys.forEach((k) => {
  53962. let node = nodeMap.get(k);
  53963. while (node && !expandedKeys.has(node.key)) {
  53964. expandedKeys.add(node.key);
  53965. node = node.parent;
  53966. }
  53967. });
  53968. expandedKeySet.value = expandedKeys;
  53969. }
  53970. function handleNodeClick(node, e) {
  53971. emit(NODE_CLICK, node.data, node, e);
  53972. handleCurrentChange(node);
  53973. if (props.expandOnClickNode) {
  53974. toggleExpand(node);
  53975. }
  53976. if (props.showCheckbox && props.checkOnClickNode && !node.disabled) {
  53977. toggleCheckbox(node, !isChecked(node), true);
  53978. }
  53979. }
  53980. function handleNodeDrop(node, e) {
  53981. emit(NODE_DROP, node.data, node, e);
  53982. }
  53983. function handleCurrentChange(node) {
  53984. if (!isCurrent(node)) {
  53985. currentKey.value = node.key;
  53986. emit(CURRENT_CHANGE, node.data, node);
  53987. }
  53988. }
  53989. function handleNodeCheck(node, checked) {
  53990. toggleCheckbox(node, checked);
  53991. }
  53992. function expandNode(node) {
  53993. const keySet = expandedKeySet.value;
  53994. if (tree.value && props.accordion) {
  53995. const { treeNodeMap } = tree.value;
  53996. keySet.forEach((key) => {
  53997. const treeNode = treeNodeMap.get(key);
  53998. if (node && node.level === (treeNode == null ? void 0 : treeNode.level)) {
  53999. keySet.delete(key);
  54000. }
  54001. });
  54002. }
  54003. keySet.add(node.key);
  54004. emit(NODE_EXPAND, node.data, node);
  54005. }
  54006. function collapseNode(node) {
  54007. expandedKeySet.value.delete(node.key);
  54008. emit(NODE_COLLAPSE, node.data, node);
  54009. }
  54010. function isExpanded(node) {
  54011. return expandedKeySet.value.has(node.key);
  54012. }
  54013. function isDisabled(node) {
  54014. return !!node.disabled;
  54015. }
  54016. function isCurrent(node) {
  54017. const current = currentKey.value;
  54018. return current !== void 0 && current === node.key;
  54019. }
  54020. function getCurrentNode() {
  54021. var _a, _b;
  54022. if (!currentKey.value)
  54023. return void 0;
  54024. return (_b = (_a = tree.value) == null ? void 0 : _a.treeNodeMap.get(currentKey.value)) == null ? void 0 : _b.data;
  54025. }
  54026. function getCurrentKey() {
  54027. return currentKey.value;
  54028. }
  54029. function setCurrentKey(key) {
  54030. currentKey.value = key;
  54031. }
  54032. function setData(data) {
  54033. vue.nextTick(() => tree.value = createTree(data));
  54034. }
  54035. function getNode(data) {
  54036. var _a;
  54037. const key = isObject$1(data) ? getKey(data) : data;
  54038. return (_a = tree.value) == null ? void 0 : _a.treeNodeMap.get(key);
  54039. }
  54040. function scrollToNode(key, strategy = "auto") {
  54041. const node = getNode(key);
  54042. if (node && listRef.value) {
  54043. listRef.value.scrollToItem(flattenTree.value.indexOf(node), strategy);
  54044. }
  54045. }
  54046. function scrollTo(offset) {
  54047. var _a;
  54048. (_a = listRef.value) == null ? void 0 : _a.scrollTo(offset);
  54049. }
  54050. return {
  54051. tree,
  54052. flattenTree,
  54053. isNotEmpty,
  54054. listRef,
  54055. getKey,
  54056. getChildren,
  54057. toggleExpand,
  54058. toggleCheckbox,
  54059. isExpanded,
  54060. isChecked,
  54061. isIndeterminate,
  54062. isDisabled,
  54063. isCurrent,
  54064. isForceHiddenExpandIcon,
  54065. handleNodeClick,
  54066. handleNodeDrop,
  54067. handleNodeCheck,
  54068. getCurrentNode,
  54069. getCurrentKey,
  54070. setCurrentKey,
  54071. getCheckedKeys,
  54072. getCheckedNodes,
  54073. getHalfCheckedKeys,
  54074. getHalfCheckedNodes,
  54075. setChecked,
  54076. setCheckedKeys,
  54077. filter,
  54078. setData,
  54079. getNode,
  54080. expandNode,
  54081. collapseNode,
  54082. setExpandedKeys,
  54083. scrollToNode,
  54084. scrollTo
  54085. };
  54086. }
  54087. var ElNodeContent = vue.defineComponent({
  54088. name: "ElTreeNodeContent",
  54089. props: treeNodeContentProps,
  54090. setup(props) {
  54091. const tree = vue.inject(ROOT_TREE_INJECTION_KEY);
  54092. const ns = useNamespace("tree");
  54093. return () => {
  54094. const node = props.node;
  54095. const { data } = node;
  54096. return (tree == null ? void 0 : tree.ctx.slots.default) ? tree.ctx.slots.default({ node, data }) : vue.h("span", { class: ns.be("node", "label") }, [node == null ? void 0 : node.label]);
  54097. };
  54098. }
  54099. });
  54100. const __default__$h = vue.defineComponent({
  54101. name: "ElTreeNode"
  54102. });
  54103. const _sfc_main$i = /* @__PURE__ */ vue.defineComponent({
  54104. ...__default__$h,
  54105. props: treeNodeProps,
  54106. emits: treeNodeEmits,
  54107. setup(__props, { emit }) {
  54108. const props = __props;
  54109. const tree = vue.inject(ROOT_TREE_INJECTION_KEY);
  54110. const ns = useNamespace("tree");
  54111. const indent = vue.computed(() => {
  54112. var _a;
  54113. return (_a = tree == null ? void 0 : tree.props.indent) != null ? _a : 16;
  54114. });
  54115. const icon = vue.computed(() => {
  54116. var _a;
  54117. return (_a = tree == null ? void 0 : tree.props.icon) != null ? _a : caret_right_default;
  54118. });
  54119. const getNodeClass = (node) => {
  54120. const nodeClassFunc = tree == null ? void 0 : tree.props.props.class;
  54121. if (!nodeClassFunc)
  54122. return {};
  54123. let className;
  54124. if (isFunction$1(nodeClassFunc)) {
  54125. const { data } = node;
  54126. className = nodeClassFunc(data, node);
  54127. } else {
  54128. className = nodeClassFunc;
  54129. }
  54130. return isString$1(className) ? { [className]: true } : className;
  54131. };
  54132. const handleClick = (e) => {
  54133. emit("click", props.node, e);
  54134. };
  54135. const handleDrop = (e) => {
  54136. emit("drop", props.node, e);
  54137. };
  54138. const handleExpandIconClick = () => {
  54139. emit("toggle", props.node);
  54140. };
  54141. const handleCheckChange = (value) => {
  54142. emit("check", props.node, value);
  54143. };
  54144. const handleContextMenu = (event) => {
  54145. var _a, _b, _c, _d;
  54146. if ((_c = (_b = (_a = tree == null ? void 0 : tree.instance) == null ? void 0 : _a.vnode) == null ? void 0 : _b.props) == null ? void 0 : _c["onNodeContextmenu"]) {
  54147. event.stopPropagation();
  54148. event.preventDefault();
  54149. }
  54150. tree == null ? void 0 : tree.ctx.emit(NODE_CONTEXTMENU, event, (_d = props.node) == null ? void 0 : _d.data, props.node);
  54151. };
  54152. return (_ctx, _cache) => {
  54153. var _a, _b, _c;
  54154. return vue.openBlock(), vue.createElementBlock("div", {
  54155. ref: "node$",
  54156. class: vue.normalizeClass([
  54157. vue.unref(ns).b("node"),
  54158. vue.unref(ns).is("expanded", _ctx.expanded),
  54159. vue.unref(ns).is("current", _ctx.current),
  54160. vue.unref(ns).is("focusable", !_ctx.disabled),
  54161. vue.unref(ns).is("checked", !_ctx.disabled && _ctx.checked),
  54162. getNodeClass(_ctx.node)
  54163. ]),
  54164. role: "treeitem",
  54165. tabindex: "-1",
  54166. "aria-expanded": _ctx.expanded,
  54167. "aria-disabled": _ctx.disabled,
  54168. "aria-checked": _ctx.checked,
  54169. "data-key": (_a = _ctx.node) == null ? void 0 : _a.key,
  54170. onClick: vue.withModifiers(handleClick, ["stop"]),
  54171. onContextmenu: handleContextMenu,
  54172. onDragover: vue.withModifiers(() => {
  54173. }, ["prevent"]),
  54174. onDragenter: vue.withModifiers(() => {
  54175. }, ["prevent"]),
  54176. onDrop: vue.withModifiers(handleDrop, ["stop"])
  54177. }, [
  54178. vue.createElementVNode("div", {
  54179. class: vue.normalizeClass(vue.unref(ns).be("node", "content")),
  54180. style: vue.normalizeStyle({
  54181. paddingLeft: `${(_ctx.node.level - 1) * vue.unref(indent)}px`,
  54182. height: _ctx.itemSize + "px"
  54183. })
  54184. }, [
  54185. vue.unref(icon) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  54186. key: 0,
  54187. class: vue.normalizeClass([
  54188. vue.unref(ns).is("leaf", !!((_b = _ctx.node) == null ? void 0 : _b.isLeaf)),
  54189. vue.unref(ns).is("hidden", _ctx.hiddenExpandIcon),
  54190. {
  54191. expanded: !((_c = _ctx.node) == null ? void 0 : _c.isLeaf) && _ctx.expanded
  54192. },
  54193. vue.unref(ns).be("node", "expand-icon")
  54194. ]),
  54195. onClick: vue.withModifiers(handleExpandIconClick, ["stop"])
  54196. }, {
  54197. default: vue.withCtx(() => [
  54198. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(icon))))
  54199. ]),
  54200. _: 1
  54201. }, 8, ["class", "onClick"])) : vue.createCommentVNode("v-if", true),
  54202. _ctx.showCheckbox ? (vue.openBlock(), vue.createBlock(vue.unref(ElCheckbox), {
  54203. key: 1,
  54204. "model-value": _ctx.checked,
  54205. indeterminate: _ctx.indeterminate,
  54206. disabled: _ctx.disabled,
  54207. onChange: handleCheckChange,
  54208. onClick: vue.withModifiers(() => {
  54209. }, ["stop"])
  54210. }, null, 8, ["model-value", "indeterminate", "disabled", "onClick"])) : vue.createCommentVNode("v-if", true),
  54211. vue.createVNode(vue.unref(ElNodeContent), { node: _ctx.node }, null, 8, ["node"])
  54212. ], 6)
  54213. ], 42, ["aria-expanded", "aria-disabled", "aria-checked", "data-key", "onClick", "onDragover", "onDragenter", "onDrop"]);
  54214. };
  54215. }
  54216. });
  54217. var ElTreeNode = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["__file", "tree-node.vue"]]);
  54218. const __default__$g = vue.defineComponent({
  54219. name: "ElTreeV2"
  54220. });
  54221. const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
  54222. ...__default__$g,
  54223. props: treeProps,
  54224. emits: treeEmits,
  54225. setup(__props, { expose, emit }) {
  54226. const props = __props;
  54227. const slots = vue.useSlots();
  54228. const treeNodeSize = vue.computed(() => props.itemSize);
  54229. vue.provide(ROOT_TREE_INJECTION_KEY, {
  54230. ctx: {
  54231. emit,
  54232. slots
  54233. },
  54234. props,
  54235. instance: vue.getCurrentInstance()
  54236. });
  54237. vue.provide(formItemContextKey, void 0);
  54238. const { t } = useLocale();
  54239. const ns = useNamespace("tree");
  54240. const {
  54241. flattenTree,
  54242. isNotEmpty,
  54243. listRef,
  54244. toggleExpand,
  54245. isExpanded,
  54246. isIndeterminate,
  54247. isChecked,
  54248. isDisabled,
  54249. isCurrent,
  54250. isForceHiddenExpandIcon,
  54251. handleNodeClick,
  54252. handleNodeDrop,
  54253. handleNodeCheck,
  54254. toggleCheckbox,
  54255. getCurrentNode,
  54256. getCurrentKey,
  54257. setCurrentKey,
  54258. getCheckedKeys,
  54259. getCheckedNodes,
  54260. getHalfCheckedKeys,
  54261. getHalfCheckedNodes,
  54262. setChecked,
  54263. setCheckedKeys,
  54264. filter,
  54265. setData,
  54266. getNode,
  54267. expandNode,
  54268. collapseNode,
  54269. setExpandedKeys,
  54270. scrollToNode,
  54271. scrollTo
  54272. } = useTree(props, emit);
  54273. expose({
  54274. toggleCheckbox,
  54275. getCurrentNode,
  54276. getCurrentKey,
  54277. setCurrentKey,
  54278. getCheckedKeys,
  54279. getCheckedNodes,
  54280. getHalfCheckedKeys,
  54281. getHalfCheckedNodes,
  54282. setChecked,
  54283. setCheckedKeys,
  54284. filter,
  54285. setData,
  54286. getNode,
  54287. expandNode,
  54288. collapseNode,
  54289. setExpandedKeys,
  54290. scrollToNode,
  54291. scrollTo
  54292. });
  54293. return (_ctx, _cache) => {
  54294. return vue.openBlock(), vue.createElementBlock("div", {
  54295. class: vue.normalizeClass([vue.unref(ns).b(), { [vue.unref(ns).m("highlight-current")]: _ctx.highlightCurrent }]),
  54296. role: "tree"
  54297. }, [
  54298. vue.unref(isNotEmpty) ? (vue.openBlock(), vue.createBlock(vue.unref(FixedSizeList$1), {
  54299. key: 0,
  54300. ref_key: "listRef",
  54301. ref: listRef,
  54302. "class-name": vue.unref(ns).b("virtual-list"),
  54303. data: vue.unref(flattenTree),
  54304. total: vue.unref(flattenTree).length,
  54305. height: _ctx.height,
  54306. "item-size": vue.unref(treeNodeSize),
  54307. "perf-mode": _ctx.perfMode
  54308. }, {
  54309. default: vue.withCtx(({ data, index, style }) => [
  54310. (vue.openBlock(), vue.createBlock(ElTreeNode, {
  54311. key: data[index].key,
  54312. style: vue.normalizeStyle(style),
  54313. node: data[index],
  54314. expanded: vue.unref(isExpanded)(data[index]),
  54315. "show-checkbox": _ctx.showCheckbox,
  54316. checked: vue.unref(isChecked)(data[index]),
  54317. indeterminate: vue.unref(isIndeterminate)(data[index]),
  54318. "item-size": vue.unref(treeNodeSize),
  54319. disabled: vue.unref(isDisabled)(data[index]),
  54320. current: vue.unref(isCurrent)(data[index]),
  54321. "hidden-expand-icon": vue.unref(isForceHiddenExpandIcon)(data[index]),
  54322. onClick: vue.unref(handleNodeClick),
  54323. onToggle: vue.unref(toggleExpand),
  54324. onCheck: vue.unref(handleNodeCheck),
  54325. onDrop: vue.unref(handleNodeDrop)
  54326. }, null, 8, ["style", "node", "expanded", "show-checkbox", "checked", "indeterminate", "item-size", "disabled", "current", "hidden-expand-icon", "onClick", "onToggle", "onCheck", "onDrop"]))
  54327. ]),
  54328. _: 1
  54329. }, 8, ["class-name", "data", "total", "height", "item-size", "perf-mode"])) : (vue.openBlock(), vue.createElementBlock("div", {
  54330. key: 1,
  54331. class: vue.normalizeClass(vue.unref(ns).e("empty-block"))
  54332. }, [
  54333. vue.renderSlot(_ctx.$slots, "empty", {}, () => {
  54334. var _a;
  54335. return [
  54336. vue.createElementVNode("span", {
  54337. class: vue.normalizeClass(vue.unref(ns).e("empty-text"))
  54338. }, vue.toDisplayString((_a = _ctx.emptyText) != null ? _a : vue.unref(t)("el.tree.emptyText")), 3)
  54339. ];
  54340. })
  54341. ], 2))
  54342. ], 2);
  54343. };
  54344. }
  54345. });
  54346. var TreeV2 = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["__file", "tree.vue"]]);
  54347. const ElTreeV2 = withInstall(TreeV2);
  54348. const uploadContextKey = Symbol("uploadContextKey");
  54349. const SCOPE$2 = "ElUpload";
  54350. class UploadAjaxError extends Error {
  54351. constructor(message, status, method, url) {
  54352. super(message);
  54353. this.name = "UploadAjaxError";
  54354. this.status = status;
  54355. this.method = method;
  54356. this.url = url;
  54357. }
  54358. }
  54359. function getError(action, option, xhr) {
  54360. let msg;
  54361. if (xhr.response) {
  54362. msg = `${xhr.response.error || xhr.response}`;
  54363. } else if (xhr.responseText) {
  54364. msg = `${xhr.responseText}`;
  54365. } else {
  54366. msg = `fail to ${option.method} ${action} ${xhr.status}`;
  54367. }
  54368. return new UploadAjaxError(msg, xhr.status, option.method, action);
  54369. }
  54370. function getBody(xhr) {
  54371. const text = xhr.responseText || xhr.response;
  54372. if (!text) {
  54373. return text;
  54374. }
  54375. try {
  54376. return JSON.parse(text);
  54377. } catch (e) {
  54378. return text;
  54379. }
  54380. }
  54381. const ajaxUpload = (option) => {
  54382. if (typeof XMLHttpRequest === "undefined")
  54383. throwError(SCOPE$2, "XMLHttpRequest is undefined");
  54384. const xhr = new XMLHttpRequest();
  54385. const action = option.action;
  54386. if (xhr.upload) {
  54387. xhr.upload.addEventListener("progress", (evt) => {
  54388. const progressEvt = evt;
  54389. progressEvt.percent = evt.total > 0 ? evt.loaded / evt.total * 100 : 0;
  54390. option.onProgress(progressEvt);
  54391. });
  54392. }
  54393. const formData = new FormData();
  54394. if (option.data) {
  54395. for (const [key, value] of Object.entries(option.data)) {
  54396. if (isArray$1(value) && value.length)
  54397. formData.append(key, ...value);
  54398. else
  54399. formData.append(key, value);
  54400. }
  54401. }
  54402. formData.append(option.filename, option.file, option.file.name);
  54403. xhr.addEventListener("error", () => {
  54404. option.onError(getError(action, option, xhr));
  54405. });
  54406. xhr.addEventListener("load", () => {
  54407. if (xhr.status < 200 || xhr.status >= 300) {
  54408. return option.onError(getError(action, option, xhr));
  54409. }
  54410. option.onSuccess(getBody(xhr));
  54411. });
  54412. xhr.open(option.method, action, true);
  54413. if (option.withCredentials && "withCredentials" in xhr) {
  54414. xhr.withCredentials = true;
  54415. }
  54416. const headers = option.headers || {};
  54417. if (headers instanceof Headers) {
  54418. headers.forEach((value, key) => xhr.setRequestHeader(key, value));
  54419. } else {
  54420. for (const [key, value] of Object.entries(headers)) {
  54421. if (isNil(value))
  54422. continue;
  54423. xhr.setRequestHeader(key, String(value));
  54424. }
  54425. }
  54426. xhr.send(formData);
  54427. return xhr;
  54428. };
  54429. const uploadListTypes = ["text", "picture", "picture-card"];
  54430. let fileId = 1;
  54431. const genFileId = () => Date.now() + fileId++;
  54432. const uploadBaseProps = buildProps({
  54433. action: {
  54434. type: String,
  54435. default: "#"
  54436. },
  54437. headers: {
  54438. type: definePropType(Object)
  54439. },
  54440. method: {
  54441. type: String,
  54442. default: "post"
  54443. },
  54444. data: {
  54445. type: definePropType([Object, Function, Promise]),
  54446. default: () => mutable({})
  54447. },
  54448. multiple: Boolean,
  54449. name: {
  54450. type: String,
  54451. default: "file"
  54452. },
  54453. drag: Boolean,
  54454. withCredentials: Boolean,
  54455. showFileList: {
  54456. type: Boolean,
  54457. default: true
  54458. },
  54459. accept: {
  54460. type: String,
  54461. default: ""
  54462. },
  54463. fileList: {
  54464. type: definePropType(Array),
  54465. default: () => mutable([])
  54466. },
  54467. autoUpload: {
  54468. type: Boolean,
  54469. default: true
  54470. },
  54471. listType: {
  54472. type: String,
  54473. values: uploadListTypes,
  54474. default: "text"
  54475. },
  54476. httpRequest: {
  54477. type: definePropType(Function),
  54478. default: ajaxUpload
  54479. },
  54480. disabled: Boolean,
  54481. limit: Number
  54482. });
  54483. const uploadProps = buildProps({
  54484. ...uploadBaseProps,
  54485. beforeUpload: {
  54486. type: definePropType(Function),
  54487. default: NOOP
  54488. },
  54489. beforeRemove: {
  54490. type: definePropType(Function)
  54491. },
  54492. onRemove: {
  54493. type: definePropType(Function),
  54494. default: NOOP
  54495. },
  54496. onChange: {
  54497. type: definePropType(Function),
  54498. default: NOOP
  54499. },
  54500. onPreview: {
  54501. type: definePropType(Function),
  54502. default: NOOP
  54503. },
  54504. onSuccess: {
  54505. type: definePropType(Function),
  54506. default: NOOP
  54507. },
  54508. onProgress: {
  54509. type: definePropType(Function),
  54510. default: NOOP
  54511. },
  54512. onError: {
  54513. type: definePropType(Function),
  54514. default: NOOP
  54515. },
  54516. onExceed: {
  54517. type: definePropType(Function),
  54518. default: NOOP
  54519. },
  54520. crossorigin: {
  54521. type: definePropType(String)
  54522. }
  54523. });
  54524. const uploadListProps = buildProps({
  54525. files: {
  54526. type: definePropType(Array),
  54527. default: () => mutable([])
  54528. },
  54529. disabled: {
  54530. type: Boolean,
  54531. default: false
  54532. },
  54533. handlePreview: {
  54534. type: definePropType(Function),
  54535. default: NOOP
  54536. },
  54537. listType: {
  54538. type: String,
  54539. values: uploadListTypes,
  54540. default: "text"
  54541. },
  54542. crossorigin: {
  54543. type: definePropType(String)
  54544. }
  54545. });
  54546. const uploadListEmits = {
  54547. remove: (file) => !!file
  54548. };
  54549. const __default__$f = vue.defineComponent({
  54550. name: "ElUploadList"
  54551. });
  54552. const _sfc_main$g = /* @__PURE__ */ vue.defineComponent({
  54553. ...__default__$f,
  54554. props: uploadListProps,
  54555. emits: uploadListEmits,
  54556. setup(__props, { emit }) {
  54557. const props = __props;
  54558. const { t } = useLocale();
  54559. const nsUpload = useNamespace("upload");
  54560. const nsIcon = useNamespace("icon");
  54561. const nsList = useNamespace("list");
  54562. const disabled = useFormDisabled();
  54563. const focusing = vue.ref(false);
  54564. const containerKls = vue.computed(() => [
  54565. nsUpload.b("list"),
  54566. nsUpload.bm("list", props.listType),
  54567. nsUpload.is("disabled", props.disabled)
  54568. ]);
  54569. const handleRemove = (file) => {
  54570. emit("remove", file);
  54571. };
  54572. return (_ctx, _cache) => {
  54573. return vue.openBlock(), vue.createBlock(vue.TransitionGroup, {
  54574. tag: "ul",
  54575. class: vue.normalizeClass(vue.unref(containerKls)),
  54576. name: vue.unref(nsList).b()
  54577. }, {
  54578. default: vue.withCtx(() => [
  54579. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.files, (file, index) => {
  54580. return vue.openBlock(), vue.createElementBlock("li", {
  54581. key: file.uid || file.name,
  54582. class: vue.normalizeClass([
  54583. vue.unref(nsUpload).be("list", "item"),
  54584. vue.unref(nsUpload).is(file.status),
  54585. { focusing: focusing.value }
  54586. ]),
  54587. tabindex: "0",
  54588. onKeydown: vue.withKeys(($event) => !vue.unref(disabled) && handleRemove(file), ["delete"]),
  54589. onFocus: ($event) => focusing.value = true,
  54590. onBlur: ($event) => focusing.value = false,
  54591. onClick: ($event) => focusing.value = false
  54592. }, [
  54593. vue.renderSlot(_ctx.$slots, "default", {
  54594. file,
  54595. index
  54596. }, () => [
  54597. _ctx.listType === "picture" || file.status !== "uploading" && _ctx.listType === "picture-card" ? (vue.openBlock(), vue.createElementBlock("img", {
  54598. key: 0,
  54599. class: vue.normalizeClass(vue.unref(nsUpload).be("list", "item-thumbnail")),
  54600. src: file.url,
  54601. crossorigin: _ctx.crossorigin,
  54602. alt: ""
  54603. }, null, 10, ["src", "crossorigin"])) : vue.createCommentVNode("v-if", true),
  54604. file.status === "uploading" || _ctx.listType !== "picture-card" ? (vue.openBlock(), vue.createElementBlock("div", {
  54605. key: 1,
  54606. class: vue.normalizeClass(vue.unref(nsUpload).be("list", "item-info"))
  54607. }, [
  54608. vue.createElementVNode("a", {
  54609. class: vue.normalizeClass(vue.unref(nsUpload).be("list", "item-name")),
  54610. onClick: vue.withModifiers(($event) => _ctx.handlePreview(file), ["prevent"])
  54611. }, [
  54612. vue.createVNode(vue.unref(ElIcon), {
  54613. class: vue.normalizeClass(vue.unref(nsIcon).m("document"))
  54614. }, {
  54615. default: vue.withCtx(() => [
  54616. vue.createVNode(vue.unref(document_default))
  54617. ]),
  54618. _: 1
  54619. }, 8, ["class"]),
  54620. vue.createElementVNode("span", {
  54621. class: vue.normalizeClass(vue.unref(nsUpload).be("list", "item-file-name")),
  54622. title: file.name
  54623. }, vue.toDisplayString(file.name), 11, ["title"])
  54624. ], 10, ["onClick"]),
  54625. file.status === "uploading" ? (vue.openBlock(), vue.createBlock(vue.unref(ElProgress), {
  54626. key: 0,
  54627. type: _ctx.listType === "picture-card" ? "circle" : "line",
  54628. "stroke-width": _ctx.listType === "picture-card" ? 6 : 2,
  54629. percentage: Number(file.percentage),
  54630. style: vue.normalizeStyle(_ctx.listType === "picture-card" ? "" : "margin-top: 0.5rem")
  54631. }, null, 8, ["type", "stroke-width", "percentage", "style"])) : vue.createCommentVNode("v-if", true)
  54632. ], 2)) : vue.createCommentVNode("v-if", true),
  54633. vue.createElementVNode("label", {
  54634. class: vue.normalizeClass(vue.unref(nsUpload).be("list", "item-status-label"))
  54635. }, [
  54636. _ctx.listType === "text" ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  54637. key: 0,
  54638. class: vue.normalizeClass([vue.unref(nsIcon).m("upload-success"), vue.unref(nsIcon).m("circle-check")])
  54639. }, {
  54640. default: vue.withCtx(() => [
  54641. vue.createVNode(vue.unref(circle_check_default))
  54642. ]),
  54643. _: 1
  54644. }, 8, ["class"])) : ["picture-card", "picture"].includes(_ctx.listType) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  54645. key: 1,
  54646. class: vue.normalizeClass([vue.unref(nsIcon).m("upload-success"), vue.unref(nsIcon).m("check")])
  54647. }, {
  54648. default: vue.withCtx(() => [
  54649. vue.createVNode(vue.unref(check_default))
  54650. ]),
  54651. _: 1
  54652. }, 8, ["class"])) : vue.createCommentVNode("v-if", true)
  54653. ], 2),
  54654. !vue.unref(disabled) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  54655. key: 2,
  54656. class: vue.normalizeClass(vue.unref(nsIcon).m("close")),
  54657. onClick: ($event) => handleRemove(file)
  54658. }, {
  54659. default: vue.withCtx(() => [
  54660. vue.createVNode(vue.unref(close_default))
  54661. ]),
  54662. _: 2
  54663. }, 1032, ["class", "onClick"])) : vue.createCommentVNode("v-if", true),
  54664. vue.createCommentVNode(" Due to close btn only appears when li gets focused disappears after li gets blurred, thus keyboard navigation can never reach close btn"),
  54665. vue.createCommentVNode(" This is a bug which needs to be fixed "),
  54666. vue.createCommentVNode(" TODO: Fix the incorrect navigation interaction "),
  54667. !vue.unref(disabled) ? (vue.openBlock(), vue.createElementBlock("i", {
  54668. key: 3,
  54669. class: vue.normalizeClass(vue.unref(nsIcon).m("close-tip"))
  54670. }, vue.toDisplayString(vue.unref(t)("el.upload.deleteTip")), 3)) : vue.createCommentVNode("v-if", true),
  54671. _ctx.listType === "picture-card" ? (vue.openBlock(), vue.createElementBlock("span", {
  54672. key: 4,
  54673. class: vue.normalizeClass(vue.unref(nsUpload).be("list", "item-actions"))
  54674. }, [
  54675. vue.createElementVNode("span", {
  54676. class: vue.normalizeClass(vue.unref(nsUpload).be("list", "item-preview")),
  54677. onClick: ($event) => _ctx.handlePreview(file)
  54678. }, [
  54679. vue.createVNode(vue.unref(ElIcon), {
  54680. class: vue.normalizeClass(vue.unref(nsIcon).m("zoom-in"))
  54681. }, {
  54682. default: vue.withCtx(() => [
  54683. vue.createVNode(vue.unref(zoom_in_default))
  54684. ]),
  54685. _: 1
  54686. }, 8, ["class"])
  54687. ], 10, ["onClick"]),
  54688. !vue.unref(disabled) ? (vue.openBlock(), vue.createElementBlock("span", {
  54689. key: 0,
  54690. class: vue.normalizeClass(vue.unref(nsUpload).be("list", "item-delete")),
  54691. onClick: ($event) => handleRemove(file)
  54692. }, [
  54693. vue.createVNode(vue.unref(ElIcon), {
  54694. class: vue.normalizeClass(vue.unref(nsIcon).m("delete"))
  54695. }, {
  54696. default: vue.withCtx(() => [
  54697. vue.createVNode(vue.unref(delete_default))
  54698. ]),
  54699. _: 1
  54700. }, 8, ["class"])
  54701. ], 10, ["onClick"])) : vue.createCommentVNode("v-if", true)
  54702. ], 2)) : vue.createCommentVNode("v-if", true)
  54703. ])
  54704. ], 42, ["onKeydown", "onFocus", "onBlur", "onClick"]);
  54705. }), 128)),
  54706. vue.renderSlot(_ctx.$slots, "append")
  54707. ]),
  54708. _: 3
  54709. }, 8, ["class", "name"]);
  54710. };
  54711. }
  54712. });
  54713. var UploadList = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["__file", "upload-list.vue"]]);
  54714. const uploadDraggerProps = buildProps({
  54715. disabled: {
  54716. type: Boolean,
  54717. default: false
  54718. }
  54719. });
  54720. const uploadDraggerEmits = {
  54721. file: (file) => isArray$1(file)
  54722. };
  54723. const COMPONENT_NAME = "ElUploadDrag";
  54724. const __default__$e = vue.defineComponent({
  54725. name: COMPONENT_NAME
  54726. });
  54727. const _sfc_main$f = /* @__PURE__ */ vue.defineComponent({
  54728. ...__default__$e,
  54729. props: uploadDraggerProps,
  54730. emits: uploadDraggerEmits,
  54731. setup(__props, { emit }) {
  54732. const uploaderContext = vue.inject(uploadContextKey);
  54733. if (!uploaderContext) {
  54734. throwError(COMPONENT_NAME, "usage: <el-upload><el-upload-dragger /></el-upload>");
  54735. }
  54736. const ns = useNamespace("upload");
  54737. const dragover = vue.ref(false);
  54738. const disabled = useFormDisabled();
  54739. const onDrop = (e) => {
  54740. if (disabled.value)
  54741. return;
  54742. dragover.value = false;
  54743. e.stopPropagation();
  54744. const files = Array.from(e.dataTransfer.files);
  54745. emit("file", files);
  54746. };
  54747. const onDragover = () => {
  54748. if (!disabled.value)
  54749. dragover.value = true;
  54750. };
  54751. return (_ctx, _cache) => {
  54752. return vue.openBlock(), vue.createElementBlock("div", {
  54753. class: vue.normalizeClass([vue.unref(ns).b("dragger"), vue.unref(ns).is("dragover", dragover.value)]),
  54754. onDrop: vue.withModifiers(onDrop, ["prevent"]),
  54755. onDragover: vue.withModifiers(onDragover, ["prevent"]),
  54756. onDragleave: vue.withModifiers(($event) => dragover.value = false, ["prevent"])
  54757. }, [
  54758. vue.renderSlot(_ctx.$slots, "default")
  54759. ], 42, ["onDrop", "onDragover", "onDragleave"]);
  54760. };
  54761. }
  54762. });
  54763. var UploadDragger = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__file", "upload-dragger.vue"]]);
  54764. const uploadContentProps = buildProps({
  54765. ...uploadBaseProps,
  54766. beforeUpload: {
  54767. type: definePropType(Function),
  54768. default: NOOP
  54769. },
  54770. onRemove: {
  54771. type: definePropType(Function),
  54772. default: NOOP
  54773. },
  54774. onStart: {
  54775. type: definePropType(Function),
  54776. default: NOOP
  54777. },
  54778. onSuccess: {
  54779. type: definePropType(Function),
  54780. default: NOOP
  54781. },
  54782. onProgress: {
  54783. type: definePropType(Function),
  54784. default: NOOP
  54785. },
  54786. onError: {
  54787. type: definePropType(Function),
  54788. default: NOOP
  54789. },
  54790. onExceed: {
  54791. type: definePropType(Function),
  54792. default: NOOP
  54793. }
  54794. });
  54795. const __default__$d = vue.defineComponent({
  54796. name: "ElUploadContent",
  54797. inheritAttrs: false
  54798. });
  54799. const _sfc_main$e = /* @__PURE__ */ vue.defineComponent({
  54800. ...__default__$d,
  54801. props: uploadContentProps,
  54802. setup(__props, { expose }) {
  54803. const props = __props;
  54804. const ns = useNamespace("upload");
  54805. const disabled = useFormDisabled();
  54806. const requests = vue.shallowRef({});
  54807. const inputRef = vue.shallowRef();
  54808. const uploadFiles = (files) => {
  54809. if (files.length === 0)
  54810. return;
  54811. const { autoUpload, limit, fileList, multiple, onStart, onExceed } = props;
  54812. if (limit && fileList.length + files.length > limit) {
  54813. onExceed(files, fileList);
  54814. return;
  54815. }
  54816. if (!multiple) {
  54817. files = files.slice(0, 1);
  54818. }
  54819. for (const file of files) {
  54820. const rawFile = file;
  54821. rawFile.uid = genFileId();
  54822. onStart(rawFile);
  54823. if (autoUpload)
  54824. upload(rawFile);
  54825. }
  54826. };
  54827. const upload = async (rawFile) => {
  54828. inputRef.value.value = "";
  54829. if (!props.beforeUpload) {
  54830. return doUpload(rawFile);
  54831. }
  54832. let hookResult;
  54833. let beforeData = {};
  54834. try {
  54835. const originData = props.data;
  54836. const beforeUploadPromise = props.beforeUpload(rawFile);
  54837. beforeData = isPlainObject$1(props.data) ? cloneDeep(props.data) : props.data;
  54838. hookResult = await beforeUploadPromise;
  54839. if (isPlainObject$1(props.data) && isEqual$1(originData, beforeData)) {
  54840. beforeData = cloneDeep(props.data);
  54841. }
  54842. } catch (e) {
  54843. hookResult = false;
  54844. }
  54845. if (hookResult === false) {
  54846. props.onRemove(rawFile);
  54847. return;
  54848. }
  54849. let file = rawFile;
  54850. if (hookResult instanceof Blob) {
  54851. if (hookResult instanceof File) {
  54852. file = hookResult;
  54853. } else {
  54854. file = new File([hookResult], rawFile.name, {
  54855. type: rawFile.type
  54856. });
  54857. }
  54858. }
  54859. doUpload(Object.assign(file, {
  54860. uid: rawFile.uid
  54861. }), beforeData);
  54862. };
  54863. const resolveData = async (data, rawFile) => {
  54864. if (isFunction$1(data)) {
  54865. return data(rawFile);
  54866. }
  54867. return data;
  54868. };
  54869. const doUpload = async (rawFile, beforeData) => {
  54870. const {
  54871. headers,
  54872. data,
  54873. method,
  54874. withCredentials,
  54875. name: filename,
  54876. action,
  54877. onProgress,
  54878. onSuccess,
  54879. onError,
  54880. httpRequest
  54881. } = props;
  54882. try {
  54883. beforeData = await resolveData(beforeData != null ? beforeData : data, rawFile);
  54884. } catch (e) {
  54885. props.onRemove(rawFile);
  54886. return;
  54887. }
  54888. const { uid } = rawFile;
  54889. const options = {
  54890. headers: headers || {},
  54891. withCredentials,
  54892. file: rawFile,
  54893. data: beforeData,
  54894. method,
  54895. filename,
  54896. action,
  54897. onProgress: (evt) => {
  54898. onProgress(evt, rawFile);
  54899. },
  54900. onSuccess: (res) => {
  54901. onSuccess(res, rawFile);
  54902. delete requests.value[uid];
  54903. },
  54904. onError: (err) => {
  54905. onError(err, rawFile);
  54906. delete requests.value[uid];
  54907. }
  54908. };
  54909. const request = httpRequest(options);
  54910. requests.value[uid] = request;
  54911. if (request instanceof Promise) {
  54912. request.then(options.onSuccess, options.onError);
  54913. }
  54914. };
  54915. const handleChange = (e) => {
  54916. const files = e.target.files;
  54917. if (!files)
  54918. return;
  54919. uploadFiles(Array.from(files));
  54920. };
  54921. const handleClick = () => {
  54922. if (!disabled.value) {
  54923. inputRef.value.value = "";
  54924. inputRef.value.click();
  54925. }
  54926. };
  54927. const handleKeydown = () => {
  54928. handleClick();
  54929. };
  54930. const abort = (file) => {
  54931. const _reqs = entriesOf(requests.value).filter(file ? ([uid]) => String(file.uid) === uid : () => true);
  54932. _reqs.forEach(([uid, req]) => {
  54933. if (req instanceof XMLHttpRequest)
  54934. req.abort();
  54935. delete requests.value[uid];
  54936. });
  54937. };
  54938. expose({
  54939. abort,
  54940. upload
  54941. });
  54942. return (_ctx, _cache) => {
  54943. return vue.openBlock(), vue.createElementBlock("div", {
  54944. class: vue.normalizeClass([
  54945. vue.unref(ns).b(),
  54946. vue.unref(ns).m(_ctx.listType),
  54947. vue.unref(ns).is("drag", _ctx.drag),
  54948. vue.unref(ns).is("disabled", vue.unref(disabled))
  54949. ]),
  54950. tabindex: vue.unref(disabled) ? "-1" : "0",
  54951. onClick: handleClick,
  54952. onKeydown: vue.withKeys(vue.withModifiers(handleKeydown, ["self"]), ["enter", "space"])
  54953. }, [
  54954. _ctx.drag ? (vue.openBlock(), vue.createBlock(UploadDragger, {
  54955. key: 0,
  54956. disabled: vue.unref(disabled),
  54957. onFile: uploadFiles
  54958. }, {
  54959. default: vue.withCtx(() => [
  54960. vue.renderSlot(_ctx.$slots, "default")
  54961. ]),
  54962. _: 3
  54963. }, 8, ["disabled"])) : vue.renderSlot(_ctx.$slots, "default", { key: 1 }),
  54964. vue.createElementVNode("input", {
  54965. ref_key: "inputRef",
  54966. ref: inputRef,
  54967. class: vue.normalizeClass(vue.unref(ns).e("input")),
  54968. name: _ctx.name,
  54969. disabled: vue.unref(disabled),
  54970. multiple: _ctx.multiple,
  54971. accept: _ctx.accept,
  54972. type: "file",
  54973. onChange: handleChange,
  54974. onClick: vue.withModifiers(() => {
  54975. }, ["stop"])
  54976. }, null, 42, ["name", "disabled", "multiple", "accept", "onClick"])
  54977. ], 42, ["tabindex", "onKeydown"]);
  54978. };
  54979. }
  54980. });
  54981. var UploadContent = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["__file", "upload-content.vue"]]);
  54982. const SCOPE$1 = "ElUpload";
  54983. const revokeFileObjectURL = (file) => {
  54984. var _a;
  54985. if ((_a = file.url) == null ? void 0 : _a.startsWith("blob:")) {
  54986. URL.revokeObjectURL(file.url);
  54987. }
  54988. };
  54989. const useHandlers = (props, uploadRef) => {
  54990. const uploadFiles = useVModel(props, "fileList", void 0, { passive: true });
  54991. const getFile = (rawFile) => uploadFiles.value.find((file) => file.uid === rawFile.uid);
  54992. function abort(file) {
  54993. var _a;
  54994. (_a = uploadRef.value) == null ? void 0 : _a.abort(file);
  54995. }
  54996. function clearFiles(states = ["ready", "uploading", "success", "fail"]) {
  54997. uploadFiles.value = uploadFiles.value.filter((row) => !states.includes(row.status));
  54998. }
  54999. function removeFile(file) {
  55000. uploadFiles.value = uploadFiles.value.filter((uploadFile) => uploadFile !== file);
  55001. }
  55002. const handleError = (err, rawFile) => {
  55003. const file = getFile(rawFile);
  55004. if (!file)
  55005. return;
  55006. console.error(err);
  55007. file.status = "fail";
  55008. removeFile(file);
  55009. props.onError(err, file, uploadFiles.value);
  55010. props.onChange(file, uploadFiles.value);
  55011. };
  55012. const handleProgress = (evt, rawFile) => {
  55013. const file = getFile(rawFile);
  55014. if (!file)
  55015. return;
  55016. props.onProgress(evt, file, uploadFiles.value);
  55017. file.status = "uploading";
  55018. file.percentage = Math.round(evt.percent);
  55019. };
  55020. const handleSuccess = (response, rawFile) => {
  55021. const file = getFile(rawFile);
  55022. if (!file)
  55023. return;
  55024. file.status = "success";
  55025. file.response = response;
  55026. props.onSuccess(response, file, uploadFiles.value);
  55027. props.onChange(file, uploadFiles.value);
  55028. };
  55029. const handleStart = (file) => {
  55030. if (isNil(file.uid))
  55031. file.uid = genFileId();
  55032. const uploadFile = {
  55033. name: file.name,
  55034. percentage: 0,
  55035. status: "ready",
  55036. size: file.size,
  55037. raw: file,
  55038. uid: file.uid
  55039. };
  55040. if (props.listType === "picture-card" || props.listType === "picture") {
  55041. try {
  55042. uploadFile.url = URL.createObjectURL(file);
  55043. } catch (err) {
  55044. debugWarn(SCOPE$1, err.message);
  55045. props.onError(err, uploadFile, uploadFiles.value);
  55046. }
  55047. }
  55048. uploadFiles.value = [...uploadFiles.value, uploadFile];
  55049. props.onChange(uploadFile, uploadFiles.value);
  55050. };
  55051. const handleRemove = async (file) => {
  55052. const uploadFile = file instanceof File ? getFile(file) : file;
  55053. if (!uploadFile)
  55054. throwError(SCOPE$1, "file to be removed not found");
  55055. const doRemove = (file2) => {
  55056. abort(file2);
  55057. removeFile(file2);
  55058. props.onRemove(file2, uploadFiles.value);
  55059. revokeFileObjectURL(file2);
  55060. };
  55061. if (props.beforeRemove) {
  55062. const before = await props.beforeRemove(uploadFile, uploadFiles.value);
  55063. if (before !== false)
  55064. doRemove(uploadFile);
  55065. } else {
  55066. doRemove(uploadFile);
  55067. }
  55068. };
  55069. function submit() {
  55070. uploadFiles.value.filter(({ status }) => status === "ready").forEach(({ raw }) => {
  55071. var _a;
  55072. return raw && ((_a = uploadRef.value) == null ? void 0 : _a.upload(raw));
  55073. });
  55074. }
  55075. vue.watch(() => props.listType, (val) => {
  55076. if (val !== "picture-card" && val !== "picture") {
  55077. return;
  55078. }
  55079. uploadFiles.value = uploadFiles.value.map((file) => {
  55080. const { raw, url } = file;
  55081. if (!url && raw) {
  55082. try {
  55083. file.url = URL.createObjectURL(raw);
  55084. } catch (err) {
  55085. props.onError(err, file, uploadFiles.value);
  55086. }
  55087. }
  55088. return file;
  55089. });
  55090. });
  55091. vue.watch(uploadFiles, (files) => {
  55092. for (const file of files) {
  55093. file.uid || (file.uid = genFileId());
  55094. file.status || (file.status = "success");
  55095. }
  55096. }, { immediate: true, deep: true });
  55097. return {
  55098. uploadFiles,
  55099. abort,
  55100. clearFiles,
  55101. handleError,
  55102. handleProgress,
  55103. handleStart,
  55104. handleSuccess,
  55105. handleRemove,
  55106. submit,
  55107. revokeFileObjectURL
  55108. };
  55109. };
  55110. const __default__$c = vue.defineComponent({
  55111. name: "ElUpload"
  55112. });
  55113. const _sfc_main$d = /* @__PURE__ */ vue.defineComponent({
  55114. ...__default__$c,
  55115. props: uploadProps,
  55116. setup(__props, { expose }) {
  55117. const props = __props;
  55118. const disabled = useFormDisabled();
  55119. const uploadRef = vue.shallowRef();
  55120. const {
  55121. abort,
  55122. submit,
  55123. clearFiles,
  55124. uploadFiles,
  55125. handleStart,
  55126. handleError,
  55127. handleRemove,
  55128. handleSuccess,
  55129. handleProgress,
  55130. revokeFileObjectURL
  55131. } = useHandlers(props, uploadRef);
  55132. const isPictureCard = vue.computed(() => props.listType === "picture-card");
  55133. const uploadContentProps = vue.computed(() => ({
  55134. ...props,
  55135. fileList: uploadFiles.value,
  55136. onStart: handleStart,
  55137. onProgress: handleProgress,
  55138. onSuccess: handleSuccess,
  55139. onError: handleError,
  55140. onRemove: handleRemove
  55141. }));
  55142. vue.onBeforeUnmount(() => {
  55143. uploadFiles.value.forEach(revokeFileObjectURL);
  55144. });
  55145. vue.provide(uploadContextKey, {
  55146. accept: vue.toRef(props, "accept")
  55147. });
  55148. expose({
  55149. abort,
  55150. submit,
  55151. clearFiles,
  55152. handleStart,
  55153. handleRemove
  55154. });
  55155. return (_ctx, _cache) => {
  55156. return vue.openBlock(), vue.createElementBlock("div", null, [
  55157. vue.unref(isPictureCard) && _ctx.showFileList ? (vue.openBlock(), vue.createBlock(UploadList, {
  55158. key: 0,
  55159. disabled: vue.unref(disabled),
  55160. "list-type": _ctx.listType,
  55161. files: vue.unref(uploadFiles),
  55162. crossorigin: _ctx.crossorigin,
  55163. "handle-preview": _ctx.onPreview,
  55164. onRemove: vue.unref(handleRemove)
  55165. }, vue.createSlots({
  55166. append: vue.withCtx(() => [
  55167. vue.createVNode(UploadContent, vue.mergeProps({
  55168. ref_key: "uploadRef",
  55169. ref: uploadRef
  55170. }, vue.unref(uploadContentProps)), {
  55171. default: vue.withCtx(() => [
  55172. _ctx.$slots.trigger ? vue.renderSlot(_ctx.$slots, "trigger", { key: 0 }) : vue.createCommentVNode("v-if", true),
  55173. !_ctx.$slots.trigger && _ctx.$slots.default ? vue.renderSlot(_ctx.$slots, "default", { key: 1 }) : vue.createCommentVNode("v-if", true)
  55174. ]),
  55175. _: 3
  55176. }, 16)
  55177. ]),
  55178. _: 2
  55179. }, [
  55180. _ctx.$slots.file ? {
  55181. name: "default",
  55182. fn: vue.withCtx(({ file, index }) => [
  55183. vue.renderSlot(_ctx.$slots, "file", {
  55184. file,
  55185. index
  55186. })
  55187. ])
  55188. } : void 0
  55189. ]), 1032, ["disabled", "list-type", "files", "crossorigin", "handle-preview", "onRemove"])) : vue.createCommentVNode("v-if", true),
  55190. !vue.unref(isPictureCard) || vue.unref(isPictureCard) && !_ctx.showFileList ? (vue.openBlock(), vue.createBlock(UploadContent, vue.mergeProps({
  55191. key: 1,
  55192. ref_key: "uploadRef",
  55193. ref: uploadRef
  55194. }, vue.unref(uploadContentProps)), {
  55195. default: vue.withCtx(() => [
  55196. _ctx.$slots.trigger ? vue.renderSlot(_ctx.$slots, "trigger", { key: 0 }) : vue.createCommentVNode("v-if", true),
  55197. !_ctx.$slots.trigger && _ctx.$slots.default ? vue.renderSlot(_ctx.$slots, "default", { key: 1 }) : vue.createCommentVNode("v-if", true)
  55198. ]),
  55199. _: 3
  55200. }, 16)) : vue.createCommentVNode("v-if", true),
  55201. _ctx.$slots.trigger ? vue.renderSlot(_ctx.$slots, "default", { key: 2 }) : vue.createCommentVNode("v-if", true),
  55202. vue.renderSlot(_ctx.$slots, "tip"),
  55203. !vue.unref(isPictureCard) && _ctx.showFileList ? (vue.openBlock(), vue.createBlock(UploadList, {
  55204. key: 3,
  55205. disabled: vue.unref(disabled),
  55206. "list-type": _ctx.listType,
  55207. files: vue.unref(uploadFiles),
  55208. crossorigin: _ctx.crossorigin,
  55209. "handle-preview": _ctx.onPreview,
  55210. onRemove: vue.unref(handleRemove)
  55211. }, vue.createSlots({
  55212. _: 2
  55213. }, [
  55214. _ctx.$slots.file ? {
  55215. name: "default",
  55216. fn: vue.withCtx(({ file, index }) => [
  55217. vue.renderSlot(_ctx.$slots, "file", {
  55218. file,
  55219. index
  55220. })
  55221. ])
  55222. } : void 0
  55223. ]), 1032, ["disabled", "list-type", "files", "crossorigin", "handle-preview", "onRemove"])) : vue.createCommentVNode("v-if", true)
  55224. ]);
  55225. };
  55226. }
  55227. });
  55228. var Upload = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["__file", "upload.vue"]]);
  55229. const ElUpload = withInstall(Upload);
  55230. const watermarkProps = buildProps({
  55231. zIndex: {
  55232. type: Number,
  55233. default: 9
  55234. },
  55235. rotate: {
  55236. type: Number,
  55237. default: -22
  55238. },
  55239. width: Number,
  55240. height: Number,
  55241. image: String,
  55242. content: {
  55243. type: definePropType([String, Array]),
  55244. default: "Element Plus"
  55245. },
  55246. font: {
  55247. type: definePropType(Object)
  55248. },
  55249. gap: {
  55250. type: definePropType(Array),
  55251. default: () => [100, 100]
  55252. },
  55253. offset: {
  55254. type: definePropType(Array)
  55255. }
  55256. });
  55257. function toLowercaseSeparator(key) {
  55258. return key.replace(/([A-Z])/g, "-$1").toLowerCase();
  55259. }
  55260. function getStyleStr(style) {
  55261. return Object.keys(style).map((key) => `${toLowercaseSeparator(key)}: ${style[key]};`).join(" ");
  55262. }
  55263. function getPixelRatio() {
  55264. return window.devicePixelRatio || 1;
  55265. }
  55266. const reRendering = (mutation, watermarkElement) => {
  55267. let flag = false;
  55268. if (mutation.removedNodes.length && watermarkElement) {
  55269. flag = Array.from(mutation.removedNodes).includes(watermarkElement);
  55270. }
  55271. if (mutation.type === "attributes" && mutation.target === watermarkElement) {
  55272. flag = true;
  55273. }
  55274. return flag;
  55275. };
  55276. const FontGap = 3;
  55277. function prepareCanvas(width, height, ratio = 1) {
  55278. const canvas = document.createElement("canvas");
  55279. const ctx = canvas.getContext("2d");
  55280. const realWidth = width * ratio;
  55281. const realHeight = height * ratio;
  55282. canvas.setAttribute("width", `${realWidth}px`);
  55283. canvas.setAttribute("height", `${realHeight}px`);
  55284. ctx.save();
  55285. return [ctx, canvas, realWidth, realHeight];
  55286. }
  55287. function useClips() {
  55288. function getClips(content, rotate, ratio, width, height, font, gapX, gapY) {
  55289. const [ctx, canvas, contentWidth, contentHeight] = prepareCanvas(width, height, ratio);
  55290. if (content instanceof HTMLImageElement) {
  55291. ctx.drawImage(content, 0, 0, contentWidth, contentHeight);
  55292. } else {
  55293. const {
  55294. color,
  55295. fontSize,
  55296. fontStyle,
  55297. fontWeight,
  55298. fontFamily,
  55299. textAlign,
  55300. textBaseline
  55301. } = font;
  55302. const mergedFontSize = Number(fontSize) * ratio;
  55303. ctx.font = `${fontStyle} normal ${fontWeight} ${mergedFontSize}px/${height}px ${fontFamily}`;
  55304. ctx.fillStyle = color;
  55305. ctx.textAlign = textAlign;
  55306. ctx.textBaseline = textBaseline;
  55307. const contents = isArray$1(content) ? content : [content];
  55308. contents == null ? void 0 : contents.forEach((item, index) => {
  55309. ctx.fillText(item != null ? item : "", contentWidth / 2, index * (mergedFontSize + FontGap * ratio));
  55310. });
  55311. }
  55312. const angle = Math.PI / 180 * Number(rotate);
  55313. const maxSize = Math.max(width, height);
  55314. const [rCtx, rCanvas, realMaxSize] = prepareCanvas(maxSize, maxSize, ratio);
  55315. rCtx.translate(realMaxSize / 2, realMaxSize / 2);
  55316. rCtx.rotate(angle);
  55317. if (contentWidth > 0 && contentHeight > 0) {
  55318. rCtx.drawImage(canvas, -contentWidth / 2, -contentHeight / 2);
  55319. }
  55320. function getRotatePos(x, y) {
  55321. const targetX = x * Math.cos(angle) - y * Math.sin(angle);
  55322. const targetY = x * Math.sin(angle) + y * Math.cos(angle);
  55323. return [targetX, targetY];
  55324. }
  55325. let left = 0;
  55326. let right = 0;
  55327. let top = 0;
  55328. let bottom = 0;
  55329. const halfWidth = contentWidth / 2;
  55330. const halfHeight = contentHeight / 2;
  55331. const points = [
  55332. [0 - halfWidth, 0 - halfHeight],
  55333. [0 + halfWidth, 0 - halfHeight],
  55334. [0 + halfWidth, 0 + halfHeight],
  55335. [0 - halfWidth, 0 + halfHeight]
  55336. ];
  55337. points.forEach(([x, y]) => {
  55338. const [targetX, targetY] = getRotatePos(x, y);
  55339. left = Math.min(left, targetX);
  55340. right = Math.max(right, targetX);
  55341. top = Math.min(top, targetY);
  55342. bottom = Math.max(bottom, targetY);
  55343. });
  55344. const cutLeft = left + realMaxSize / 2;
  55345. const cutTop = top + realMaxSize / 2;
  55346. const cutWidth = right - left;
  55347. const cutHeight = bottom - top;
  55348. const realGapX = gapX * ratio;
  55349. const realGapY = gapY * ratio;
  55350. const filledWidth = (cutWidth + realGapX) * 2;
  55351. const filledHeight = cutHeight + realGapY;
  55352. const [fCtx, fCanvas] = prepareCanvas(filledWidth, filledHeight);
  55353. function drawImg(targetX = 0, targetY = 0) {
  55354. fCtx.drawImage(rCanvas, cutLeft, cutTop, cutWidth, cutHeight, targetX, targetY, cutWidth, cutHeight);
  55355. }
  55356. drawImg();
  55357. drawImg(cutWidth + realGapX, -cutHeight / 2 - realGapY / 2);
  55358. drawImg(cutWidth + realGapX, +cutHeight / 2 + realGapY / 2);
  55359. return [fCanvas.toDataURL(), filledWidth / ratio, filledHeight / ratio];
  55360. }
  55361. return getClips;
  55362. }
  55363. const __default__$b = vue.defineComponent({
  55364. name: "ElWatermark"
  55365. });
  55366. const _sfc_main$c = /* @__PURE__ */ vue.defineComponent({
  55367. ...__default__$b,
  55368. props: watermarkProps,
  55369. setup(__props) {
  55370. const props = __props;
  55371. const style = {
  55372. position: "relative"
  55373. };
  55374. const color = vue.computed(() => {
  55375. var _a, _b;
  55376. return (_b = (_a = props.font) == null ? void 0 : _a.color) != null ? _b : "rgba(0,0,0,.15)";
  55377. });
  55378. const fontSize = vue.computed(() => {
  55379. var _a, _b;
  55380. return (_b = (_a = props.font) == null ? void 0 : _a.fontSize) != null ? _b : 16;
  55381. });
  55382. const fontWeight = vue.computed(() => {
  55383. var _a, _b;
  55384. return (_b = (_a = props.font) == null ? void 0 : _a.fontWeight) != null ? _b : "normal";
  55385. });
  55386. const fontStyle = vue.computed(() => {
  55387. var _a, _b;
  55388. return (_b = (_a = props.font) == null ? void 0 : _a.fontStyle) != null ? _b : "normal";
  55389. });
  55390. const fontFamily = vue.computed(() => {
  55391. var _a, _b;
  55392. return (_b = (_a = props.font) == null ? void 0 : _a.fontFamily) != null ? _b : "sans-serif";
  55393. });
  55394. const textAlign = vue.computed(() => {
  55395. var _a, _b;
  55396. return (_b = (_a = props.font) == null ? void 0 : _a.textAlign) != null ? _b : "center";
  55397. });
  55398. const textBaseline = vue.computed(() => {
  55399. var _a, _b;
  55400. return (_b = (_a = props.font) == null ? void 0 : _a.textBaseline) != null ? _b : "hanging";
  55401. });
  55402. const gapX = vue.computed(() => props.gap[0]);
  55403. const gapY = vue.computed(() => props.gap[1]);
  55404. const gapXCenter = vue.computed(() => gapX.value / 2);
  55405. const gapYCenter = vue.computed(() => gapY.value / 2);
  55406. const offsetLeft = vue.computed(() => {
  55407. var _a, _b;
  55408. return (_b = (_a = props.offset) == null ? void 0 : _a[0]) != null ? _b : gapXCenter.value;
  55409. });
  55410. const offsetTop = vue.computed(() => {
  55411. var _a, _b;
  55412. return (_b = (_a = props.offset) == null ? void 0 : _a[1]) != null ? _b : gapYCenter.value;
  55413. });
  55414. const getMarkStyle = () => {
  55415. const markStyle = {
  55416. zIndex: props.zIndex,
  55417. position: "absolute",
  55418. left: 0,
  55419. top: 0,
  55420. width: "100%",
  55421. height: "100%",
  55422. pointerEvents: "none",
  55423. backgroundRepeat: "repeat"
  55424. };
  55425. let positionLeft = offsetLeft.value - gapXCenter.value;
  55426. let positionTop = offsetTop.value - gapYCenter.value;
  55427. if (positionLeft > 0) {
  55428. markStyle.left = `${positionLeft}px`;
  55429. markStyle.width = `calc(100% - ${positionLeft}px)`;
  55430. positionLeft = 0;
  55431. }
  55432. if (positionTop > 0) {
  55433. markStyle.top = `${positionTop}px`;
  55434. markStyle.height = `calc(100% - ${positionTop}px)`;
  55435. positionTop = 0;
  55436. }
  55437. markStyle.backgroundPosition = `${positionLeft}px ${positionTop}px`;
  55438. return markStyle;
  55439. };
  55440. const containerRef = vue.shallowRef(null);
  55441. const watermarkRef = vue.shallowRef();
  55442. const stopObservation = vue.ref(false);
  55443. const destroyWatermark = () => {
  55444. if (watermarkRef.value) {
  55445. watermarkRef.value.remove();
  55446. watermarkRef.value = void 0;
  55447. }
  55448. };
  55449. const appendWatermark = (base64Url, markWidth) => {
  55450. var _a;
  55451. if (containerRef.value && watermarkRef.value) {
  55452. stopObservation.value = true;
  55453. watermarkRef.value.setAttribute("style", getStyleStr({
  55454. ...getMarkStyle(),
  55455. backgroundImage: `url('${base64Url}')`,
  55456. backgroundSize: `${Math.floor(markWidth)}px`
  55457. }));
  55458. (_a = containerRef.value) == null ? void 0 : _a.append(watermarkRef.value);
  55459. setTimeout(() => {
  55460. stopObservation.value = false;
  55461. });
  55462. }
  55463. };
  55464. const getMarkSize = (ctx) => {
  55465. let defaultWidth = 120;
  55466. let defaultHeight = 64;
  55467. const image = props.image;
  55468. const content = props.content;
  55469. const width = props.width;
  55470. const height = props.height;
  55471. if (!image && ctx.measureText) {
  55472. ctx.font = `${Number(fontSize.value)}px ${fontFamily.value}`;
  55473. const contents = isArray$1(content) ? content : [content];
  55474. const sizes = contents.map((item) => {
  55475. const metrics = ctx.measureText(item);
  55476. return [
  55477. metrics.width,
  55478. metrics.fontBoundingBoxAscent !== void 0 ? metrics.fontBoundingBoxAscent + metrics.fontBoundingBoxDescent : metrics.actualBoundingBoxAscent + metrics.actualBoundingBoxDescent
  55479. ];
  55480. });
  55481. defaultWidth = Math.ceil(Math.max(...sizes.map((size) => size[0])));
  55482. defaultHeight = Math.ceil(Math.max(...sizes.map((size) => size[1]))) * contents.length + (contents.length - 1) * FontGap;
  55483. }
  55484. return [width != null ? width : defaultWidth, height != null ? height : defaultHeight];
  55485. };
  55486. const getClips = useClips();
  55487. const renderWatermark = () => {
  55488. const canvas = document.createElement("canvas");
  55489. const ctx = canvas.getContext("2d");
  55490. const image = props.image;
  55491. const content = props.content;
  55492. const rotate = props.rotate;
  55493. if (ctx) {
  55494. if (!watermarkRef.value) {
  55495. watermarkRef.value = document.createElement("div");
  55496. }
  55497. const ratio = getPixelRatio();
  55498. const [markWidth, markHeight] = getMarkSize(ctx);
  55499. const drawCanvas = (drawContent) => {
  55500. const [textClips, clipWidth] = getClips(drawContent || "", rotate, ratio, markWidth, markHeight, {
  55501. color: color.value,
  55502. fontSize: fontSize.value,
  55503. fontStyle: fontStyle.value,
  55504. fontWeight: fontWeight.value,
  55505. fontFamily: fontFamily.value,
  55506. textAlign: textAlign.value,
  55507. textBaseline: textBaseline.value
  55508. }, gapX.value, gapY.value);
  55509. appendWatermark(textClips, clipWidth);
  55510. };
  55511. if (image) {
  55512. const img = new Image();
  55513. img.onload = () => {
  55514. drawCanvas(img);
  55515. };
  55516. img.onerror = () => {
  55517. drawCanvas(content);
  55518. };
  55519. img.crossOrigin = "anonymous";
  55520. img.referrerPolicy = "no-referrer";
  55521. img.src = image;
  55522. } else {
  55523. drawCanvas(content);
  55524. }
  55525. }
  55526. };
  55527. vue.onMounted(() => {
  55528. renderWatermark();
  55529. });
  55530. vue.watch(() => props, () => {
  55531. renderWatermark();
  55532. }, {
  55533. deep: true,
  55534. flush: "post"
  55535. });
  55536. vue.onBeforeUnmount(() => {
  55537. destroyWatermark();
  55538. });
  55539. const onMutate = (mutations) => {
  55540. if (stopObservation.value) {
  55541. return;
  55542. }
  55543. mutations.forEach((mutation) => {
  55544. if (reRendering(mutation, watermarkRef.value)) {
  55545. destroyWatermark();
  55546. renderWatermark();
  55547. }
  55548. });
  55549. };
  55550. useMutationObserver(containerRef, onMutate, {
  55551. attributes: true,
  55552. subtree: true,
  55553. childList: true
  55554. });
  55555. return (_ctx, _cache) => {
  55556. return vue.openBlock(), vue.createElementBlock("div", {
  55557. ref_key: "containerRef",
  55558. ref: containerRef,
  55559. style: vue.normalizeStyle([style])
  55560. }, [
  55561. vue.renderSlot(_ctx.$slots, "default")
  55562. ], 4);
  55563. };
  55564. }
  55565. });
  55566. var Watermark = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["__file", "watermark.vue"]]);
  55567. const ElWatermark = withInstall(Watermark);
  55568. const maskProps = buildProps({
  55569. zIndex: {
  55570. type: Number,
  55571. default: 1001
  55572. },
  55573. visible: Boolean,
  55574. fill: {
  55575. type: String,
  55576. default: "rgba(0,0,0,0.5)"
  55577. },
  55578. pos: {
  55579. type: definePropType(Object)
  55580. },
  55581. targetAreaClickable: {
  55582. type: Boolean,
  55583. default: true
  55584. }
  55585. });
  55586. const useTarget = (target, open, gap, mergedMask, scrollIntoViewOptions) => {
  55587. const posInfo = vue.ref(null);
  55588. const getTargetEl = () => {
  55589. let targetEl;
  55590. if (isString$1(target.value)) {
  55591. targetEl = document.querySelector(target.value);
  55592. } else if (isFunction$1(target.value)) {
  55593. targetEl = target.value();
  55594. } else {
  55595. targetEl = target.value;
  55596. }
  55597. return targetEl;
  55598. };
  55599. const updatePosInfo = () => {
  55600. const targetEl = getTargetEl();
  55601. if (!targetEl || !open.value) {
  55602. posInfo.value = null;
  55603. return;
  55604. }
  55605. if (!isInViewPort(targetEl)) {
  55606. targetEl.scrollIntoView(scrollIntoViewOptions.value);
  55607. }
  55608. const { left, top, width, height } = targetEl.getBoundingClientRect();
  55609. posInfo.value = {
  55610. left,
  55611. top,
  55612. width,
  55613. height,
  55614. radius: 0
  55615. };
  55616. };
  55617. vue.onMounted(() => {
  55618. vue.watch([open, target], () => {
  55619. updatePosInfo();
  55620. }, {
  55621. immediate: true
  55622. });
  55623. window.addEventListener("resize", updatePosInfo);
  55624. });
  55625. vue.onBeforeUnmount(() => {
  55626. window.removeEventListener("resize", updatePosInfo);
  55627. });
  55628. const getGapOffset = (index) => {
  55629. var _a;
  55630. return (_a = isArray$1(gap.value.offset) ? gap.value.offset[index] : gap.value.offset) != null ? _a : 6;
  55631. };
  55632. const mergedPosInfo = vue.computed(() => {
  55633. var _a;
  55634. if (!posInfo.value)
  55635. return posInfo.value;
  55636. const gapOffsetX = getGapOffset(0);
  55637. const gapOffsetY = getGapOffset(1);
  55638. const gapRadius = ((_a = gap.value) == null ? void 0 : _a.radius) || 2;
  55639. return {
  55640. left: posInfo.value.left - gapOffsetX,
  55641. top: posInfo.value.top - gapOffsetY,
  55642. width: posInfo.value.width + gapOffsetX * 2,
  55643. height: posInfo.value.height + gapOffsetY * 2,
  55644. radius: gapRadius
  55645. };
  55646. });
  55647. const triggerTarget = vue.computed(() => {
  55648. const targetEl = getTargetEl();
  55649. if (!mergedMask.value || !targetEl || !window.DOMRect) {
  55650. return targetEl || void 0;
  55651. }
  55652. return {
  55653. getBoundingClientRect() {
  55654. var _a, _b, _c, _d;
  55655. return window.DOMRect.fromRect({
  55656. width: ((_a = mergedPosInfo.value) == null ? void 0 : _a.width) || 0,
  55657. height: ((_b = mergedPosInfo.value) == null ? void 0 : _b.height) || 0,
  55658. x: ((_c = mergedPosInfo.value) == null ? void 0 : _c.left) || 0,
  55659. y: ((_d = mergedPosInfo.value) == null ? void 0 : _d.top) || 0
  55660. });
  55661. }
  55662. };
  55663. });
  55664. return {
  55665. mergedPosInfo,
  55666. triggerTarget
  55667. };
  55668. };
  55669. const tourKey = Symbol("ElTour");
  55670. function isInViewPort(element) {
  55671. const viewWidth = window.innerWidth || document.documentElement.clientWidth;
  55672. const viewHeight = window.innerHeight || document.documentElement.clientHeight;
  55673. const { top, right, bottom, left } = element.getBoundingClientRect();
  55674. return top >= 0 && left >= 0 && right <= viewWidth && bottom <= viewHeight;
  55675. }
  55676. const useFloating = (referenceRef, contentRef, arrowRef, placement, strategy, offset$1, zIndex, showArrow) => {
  55677. const x = vue.ref();
  55678. const y = vue.ref();
  55679. const middlewareData = vue.ref({});
  55680. const states = {
  55681. x,
  55682. y,
  55683. placement,
  55684. strategy,
  55685. middlewareData
  55686. };
  55687. const middleware = vue.computed(() => {
  55688. const _middleware = [
  55689. offset(vue.unref(offset$1)),
  55690. flip(),
  55691. shift(),
  55692. overflowMiddleware()
  55693. ];
  55694. if (vue.unref(showArrow) && vue.unref(arrowRef)) {
  55695. _middleware.push(arrow({
  55696. element: vue.unref(arrowRef)
  55697. }));
  55698. }
  55699. return _middleware;
  55700. });
  55701. const update = async () => {
  55702. if (!isClient)
  55703. return;
  55704. const referenceEl = vue.unref(referenceRef);
  55705. const contentEl = vue.unref(contentRef);
  55706. if (!referenceEl || !contentEl)
  55707. return;
  55708. const data = await computePosition(referenceEl, contentEl, {
  55709. placement: vue.unref(placement),
  55710. strategy: vue.unref(strategy),
  55711. middleware: vue.unref(middleware)
  55712. });
  55713. keysOf(states).forEach((key) => {
  55714. states[key].value = data[key];
  55715. });
  55716. };
  55717. const contentStyle = vue.computed(() => {
  55718. if (!vue.unref(referenceRef)) {
  55719. return {
  55720. position: "fixed",
  55721. top: "50%",
  55722. left: "50%",
  55723. transform: "translate3d(-50%, -50%, 0)",
  55724. maxWidth: "100vw",
  55725. zIndex: vue.unref(zIndex)
  55726. };
  55727. }
  55728. const { overflow } = vue.unref(middlewareData);
  55729. return {
  55730. position: vue.unref(strategy),
  55731. zIndex: vue.unref(zIndex),
  55732. top: vue.unref(y) != null ? `${vue.unref(y)}px` : "",
  55733. left: vue.unref(x) != null ? `${vue.unref(x)}px` : "",
  55734. maxWidth: (overflow == null ? void 0 : overflow.maxWidth) ? `${overflow == null ? void 0 : overflow.maxWidth}px` : ""
  55735. };
  55736. });
  55737. const arrowStyle = vue.computed(() => {
  55738. if (!vue.unref(showArrow))
  55739. return {};
  55740. const { arrow: arrow2 } = vue.unref(middlewareData);
  55741. return {
  55742. left: (arrow2 == null ? void 0 : arrow2.x) != null ? `${arrow2 == null ? void 0 : arrow2.x}px` : "",
  55743. top: (arrow2 == null ? void 0 : arrow2.y) != null ? `${arrow2 == null ? void 0 : arrow2.y}px` : ""
  55744. };
  55745. });
  55746. let cleanup;
  55747. vue.onMounted(() => {
  55748. const referenceEl = vue.unref(referenceRef);
  55749. const contentEl = vue.unref(contentRef);
  55750. if (referenceEl && contentEl) {
  55751. cleanup = autoUpdate(referenceEl, contentEl, update);
  55752. }
  55753. vue.watchEffect(() => {
  55754. update();
  55755. });
  55756. });
  55757. vue.onBeforeUnmount(() => {
  55758. cleanup && cleanup();
  55759. });
  55760. return {
  55761. update,
  55762. contentStyle,
  55763. arrowStyle
  55764. };
  55765. };
  55766. const overflowMiddleware = () => {
  55767. return {
  55768. name: "overflow",
  55769. async fn(state) {
  55770. const overflow = await detectOverflow(state);
  55771. let overWidth = 0;
  55772. if (overflow.left > 0)
  55773. overWidth = overflow.left;
  55774. if (overflow.right > 0)
  55775. overWidth = overflow.right;
  55776. const floatingWidth = state.rects.floating.width;
  55777. return {
  55778. data: {
  55779. maxWidth: floatingWidth - overWidth
  55780. }
  55781. };
  55782. }
  55783. };
  55784. };
  55785. const __default__$a = vue.defineComponent({
  55786. name: "ElTourMask",
  55787. inheritAttrs: false
  55788. });
  55789. const _sfc_main$b = /* @__PURE__ */ vue.defineComponent({
  55790. ...__default__$a,
  55791. props: maskProps,
  55792. setup(__props) {
  55793. const props = __props;
  55794. const { ns } = vue.inject(tourKey);
  55795. const radius = vue.computed(() => {
  55796. var _a, _b;
  55797. return (_b = (_a = props.pos) == null ? void 0 : _a.radius) != null ? _b : 2;
  55798. });
  55799. const roundInfo = vue.computed(() => {
  55800. const v = radius.value;
  55801. const baseInfo = `a${v},${v} 0 0 1`;
  55802. return {
  55803. topRight: `${baseInfo} ${v},${v}`,
  55804. bottomRight: `${baseInfo} ${-v},${v}`,
  55805. bottomLeft: `${baseInfo} ${-v},${-v}`,
  55806. topLeft: `${baseInfo} ${v},${-v}`
  55807. };
  55808. });
  55809. const path = vue.computed(() => {
  55810. const width = window.innerWidth;
  55811. const height = window.innerHeight;
  55812. const info = roundInfo.value;
  55813. const _path = `M${width},0 L0,0 L0,${height} L${width},${height} L${width},0 Z`;
  55814. const _radius = radius.value;
  55815. return props.pos ? `${_path} M${props.pos.left + _radius},${props.pos.top} h${props.pos.width - _radius * 2} ${info.topRight} v${props.pos.height - _radius * 2} ${info.bottomRight} h${-props.pos.width + _radius * 2} ${info.bottomLeft} v${-props.pos.height + _radius * 2} ${info.topLeft} z` : _path;
  55816. });
  55817. const pathStyle = vue.computed(() => {
  55818. return {
  55819. fill: props.fill,
  55820. pointerEvents: "auto",
  55821. cursor: "auto"
  55822. };
  55823. });
  55824. useLockscreen(vue.toRef(props, "visible"), {
  55825. ns
  55826. });
  55827. return (_ctx, _cache) => {
  55828. return _ctx.visible ? (vue.openBlock(), vue.createElementBlock("div", vue.mergeProps({
  55829. key: 0,
  55830. class: vue.unref(ns).e("mask"),
  55831. style: {
  55832. position: "fixed",
  55833. left: 0,
  55834. right: 0,
  55835. top: 0,
  55836. bottom: 0,
  55837. zIndex: _ctx.zIndex,
  55838. pointerEvents: _ctx.pos && _ctx.targetAreaClickable ? "none" : "auto"
  55839. }
  55840. }, _ctx.$attrs), [
  55841. (vue.openBlock(), vue.createElementBlock("svg", { style: {
  55842. width: "100%",
  55843. height: "100%"
  55844. } }, [
  55845. vue.createElementVNode("path", {
  55846. class: vue.normalizeClass(vue.unref(ns).e("hollow")),
  55847. style: vue.normalizeStyle(vue.unref(pathStyle)),
  55848. d: vue.unref(path)
  55849. }, null, 14, ["d"])
  55850. ]))
  55851. ], 16)) : vue.createCommentVNode("v-if", true);
  55852. };
  55853. }
  55854. });
  55855. var ElTourMask = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__file", "mask.vue"]]);
  55856. const tourStrategies = ["absolute", "fixed"];
  55857. const tourPlacements = [
  55858. "top-start",
  55859. "top-end",
  55860. "top",
  55861. "bottom-start",
  55862. "bottom-end",
  55863. "bottom",
  55864. "left-start",
  55865. "left-end",
  55866. "left",
  55867. "right-start",
  55868. "right-end",
  55869. "right"
  55870. ];
  55871. const tourContentProps = buildProps({
  55872. placement: {
  55873. type: definePropType(String),
  55874. values: tourPlacements,
  55875. default: "bottom"
  55876. },
  55877. reference: {
  55878. type: definePropType(Object),
  55879. default: null
  55880. },
  55881. strategy: {
  55882. type: definePropType(String),
  55883. values: tourStrategies,
  55884. default: "absolute"
  55885. },
  55886. offset: {
  55887. type: Number,
  55888. default: 10
  55889. },
  55890. showArrow: Boolean,
  55891. zIndex: {
  55892. type: Number,
  55893. default: 2001
  55894. }
  55895. });
  55896. const tourContentEmits = {
  55897. close: () => true
  55898. };
  55899. const __default__$9 = vue.defineComponent({
  55900. name: "ElTourContent"
  55901. });
  55902. const _sfc_main$a = /* @__PURE__ */ vue.defineComponent({
  55903. ...__default__$9,
  55904. props: tourContentProps,
  55905. emits: tourContentEmits,
  55906. setup(__props, { emit }) {
  55907. const props = __props;
  55908. const placement = vue.ref(props.placement);
  55909. const strategy = vue.ref(props.strategy);
  55910. const contentRef = vue.ref(null);
  55911. const arrowRef = vue.ref(null);
  55912. vue.watch(() => props.placement, () => {
  55913. placement.value = props.placement;
  55914. });
  55915. const { contentStyle, arrowStyle } = useFloating(vue.toRef(props, "reference"), contentRef, arrowRef, placement, strategy, vue.toRef(props, "offset"), vue.toRef(props, "zIndex"), vue.toRef(props, "showArrow"));
  55916. const side = vue.computed(() => {
  55917. return placement.value.split("-")[0];
  55918. });
  55919. const { ns } = vue.inject(tourKey);
  55920. const onCloseRequested = () => {
  55921. emit("close");
  55922. };
  55923. const onFocusoutPrevented = (event) => {
  55924. if (event.detail.focusReason === "pointer") {
  55925. event.preventDefault();
  55926. }
  55927. };
  55928. return (_ctx, _cache) => {
  55929. return vue.openBlock(), vue.createElementBlock("div", {
  55930. ref_key: "contentRef",
  55931. ref: contentRef,
  55932. style: vue.normalizeStyle(vue.unref(contentStyle)),
  55933. class: vue.normalizeClass(vue.unref(ns).e("content")),
  55934. "data-side": vue.unref(side),
  55935. tabindex: "-1"
  55936. }, [
  55937. vue.createVNode(vue.unref(ElFocusTrap), {
  55938. loop: "",
  55939. trapped: "",
  55940. "focus-start-el": "container",
  55941. "focus-trap-el": contentRef.value || void 0,
  55942. onReleaseRequested: onCloseRequested,
  55943. onFocusoutPrevented
  55944. }, {
  55945. default: vue.withCtx(() => [
  55946. vue.renderSlot(_ctx.$slots, "default")
  55947. ]),
  55948. _: 3
  55949. }, 8, ["focus-trap-el"]),
  55950. _ctx.showArrow ? (vue.openBlock(), vue.createElementBlock("span", {
  55951. key: 0,
  55952. ref_key: "arrowRef",
  55953. ref: arrowRef,
  55954. style: vue.normalizeStyle(vue.unref(arrowStyle)),
  55955. class: vue.normalizeClass(vue.unref(ns).e("arrow"))
  55956. }, null, 6)) : vue.createCommentVNode("v-if", true)
  55957. ], 14, ["data-side"]);
  55958. };
  55959. }
  55960. });
  55961. var ElTourContent = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["__file", "content.vue"]]);
  55962. var ElTourSteps = vue.defineComponent({
  55963. name: "ElTourSteps",
  55964. props: {
  55965. current: {
  55966. type: Number,
  55967. default: 0
  55968. }
  55969. },
  55970. emits: ["update-total"],
  55971. setup(props, { slots, emit }) {
  55972. let cacheTotal = 0;
  55973. return () => {
  55974. var _a, _b;
  55975. const children = (_a = slots.default) == null ? void 0 : _a.call(slots);
  55976. const result = [];
  55977. let total = 0;
  55978. function filterSteps(children2) {
  55979. if (!isArray$1(children2))
  55980. return;
  55981. children2.forEach((item) => {
  55982. var _a2;
  55983. const name = (_a2 = (item == null ? void 0 : item.type) || {}) == null ? void 0 : _a2.name;
  55984. if (name === "ElTourStep") {
  55985. result.push(item);
  55986. total += 1;
  55987. }
  55988. });
  55989. }
  55990. if (children.length) {
  55991. filterSteps(flattedChildren((_b = children[0]) == null ? void 0 : _b.children));
  55992. }
  55993. if (cacheTotal !== total) {
  55994. cacheTotal = total;
  55995. emit("update-total", total);
  55996. }
  55997. if (result.length) {
  55998. return result[props.current];
  55999. }
  56000. return null;
  56001. };
  56002. }
  56003. });
  56004. const tourProps = buildProps({
  56005. modelValue: Boolean,
  56006. current: {
  56007. type: Number,
  56008. default: 0
  56009. },
  56010. showArrow: {
  56011. type: Boolean,
  56012. default: true
  56013. },
  56014. showClose: {
  56015. type: Boolean,
  56016. default: true
  56017. },
  56018. closeIcon: {
  56019. type: iconPropType
  56020. },
  56021. placement: tourContentProps.placement,
  56022. contentStyle: {
  56023. type: definePropType([Object])
  56024. },
  56025. mask: {
  56026. type: definePropType([Boolean, Object]),
  56027. default: true
  56028. },
  56029. gap: {
  56030. type: definePropType(Object),
  56031. default: () => ({
  56032. offset: 6,
  56033. radius: 2
  56034. })
  56035. },
  56036. zIndex: {
  56037. type: Number
  56038. },
  56039. scrollIntoViewOptions: {
  56040. type: definePropType([Boolean, Object]),
  56041. default: () => ({
  56042. block: "center"
  56043. })
  56044. },
  56045. type: {
  56046. type: definePropType(String)
  56047. },
  56048. appendTo: {
  56049. type: definePropType([String, Object]),
  56050. default: "body"
  56051. },
  56052. closeOnPressEscape: {
  56053. type: Boolean,
  56054. default: true
  56055. },
  56056. targetAreaClickable: {
  56057. type: Boolean,
  56058. default: true
  56059. }
  56060. });
  56061. const tourEmits = {
  56062. [UPDATE_MODEL_EVENT]: (value) => isBoolean(value),
  56063. ["update:current"]: (current) => isNumber(current),
  56064. close: (current) => isNumber(current),
  56065. finish: () => true,
  56066. change: (current) => isNumber(current)
  56067. };
  56068. const __default__$8 = vue.defineComponent({
  56069. name: "ElTour"
  56070. });
  56071. const _sfc_main$9 = /* @__PURE__ */ vue.defineComponent({
  56072. ...__default__$8,
  56073. props: tourProps,
  56074. emits: tourEmits,
  56075. setup(__props, { emit }) {
  56076. const props = __props;
  56077. const ns = useNamespace("tour");
  56078. const total = vue.ref(0);
  56079. const currentStep = vue.ref();
  56080. const current = useVModel(props, "current", emit, {
  56081. passive: true
  56082. });
  56083. const currentTarget = vue.computed(() => {
  56084. var _a;
  56085. return (_a = currentStep.value) == null ? void 0 : _a.target;
  56086. });
  56087. const kls = vue.computed(() => [
  56088. ns.b(),
  56089. mergedType.value === "primary" ? ns.m("primary") : ""
  56090. ]);
  56091. const mergedPlacement = vue.computed(() => {
  56092. var _a;
  56093. return ((_a = currentStep.value) == null ? void 0 : _a.placement) || props.placement;
  56094. });
  56095. const mergedContentStyle = vue.computed(() => {
  56096. var _a, _b;
  56097. return (_b = (_a = currentStep.value) == null ? void 0 : _a.contentStyle) != null ? _b : props.contentStyle;
  56098. });
  56099. const mergedMask = vue.computed(() => {
  56100. var _a, _b;
  56101. return (_b = (_a = currentStep.value) == null ? void 0 : _a.mask) != null ? _b : props.mask;
  56102. });
  56103. const mergedShowMask = vue.computed(() => !!mergedMask.value && props.modelValue);
  56104. const mergedMaskStyle = vue.computed(() => isBoolean(mergedMask.value) ? void 0 : mergedMask.value);
  56105. const mergedShowArrow = vue.computed(() => {
  56106. var _a, _b;
  56107. return !!currentTarget.value && ((_b = (_a = currentStep.value) == null ? void 0 : _a.showArrow) != null ? _b : props.showArrow);
  56108. });
  56109. const mergedScrollIntoViewOptions = vue.computed(() => {
  56110. var _a, _b;
  56111. return (_b = (_a = currentStep.value) == null ? void 0 : _a.scrollIntoViewOptions) != null ? _b : props.scrollIntoViewOptions;
  56112. });
  56113. const mergedType = vue.computed(() => {
  56114. var _a, _b;
  56115. return (_b = (_a = currentStep.value) == null ? void 0 : _a.type) != null ? _b : props.type;
  56116. });
  56117. const { nextZIndex } = useZIndex();
  56118. const nowZIndex = nextZIndex();
  56119. const mergedZIndex = vue.computed(() => {
  56120. var _a;
  56121. return (_a = props.zIndex) != null ? _a : nowZIndex;
  56122. });
  56123. const { mergedPosInfo: pos, triggerTarget } = useTarget(currentTarget, vue.toRef(props, "modelValue"), vue.toRef(props, "gap"), mergedMask, mergedScrollIntoViewOptions);
  56124. vue.watch(() => props.modelValue, (val) => {
  56125. if (!val) {
  56126. current.value = 0;
  56127. }
  56128. });
  56129. const onEscClose = () => {
  56130. if (props.closeOnPressEscape) {
  56131. emit("update:modelValue", false);
  56132. emit("close", current.value);
  56133. }
  56134. };
  56135. const onUpdateTotal = (val) => {
  56136. total.value = val;
  56137. };
  56138. const slots = vue.useSlots();
  56139. vue.provide(tourKey, {
  56140. currentStep,
  56141. current,
  56142. total,
  56143. showClose: vue.toRef(props, "showClose"),
  56144. closeIcon: vue.toRef(props, "closeIcon"),
  56145. mergedType,
  56146. ns,
  56147. slots,
  56148. updateModelValue(modelValue) {
  56149. emit("update:modelValue", modelValue);
  56150. },
  56151. onClose() {
  56152. emit("close", current.value);
  56153. },
  56154. onFinish() {
  56155. emit("finish");
  56156. },
  56157. onChange() {
  56158. emit("change", current.value);
  56159. }
  56160. });
  56161. return (_ctx, _cache) => {
  56162. return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
  56163. vue.createVNode(vue.unref(ElTeleport$1), { to: _ctx.appendTo }, {
  56164. default: vue.withCtx(() => {
  56165. var _a, _b;
  56166. return [
  56167. vue.createElementVNode("div", vue.mergeProps({ class: vue.unref(kls) }, _ctx.$attrs), [
  56168. vue.createVNode(ElTourMask, {
  56169. visible: vue.unref(mergedShowMask),
  56170. fill: (_a = vue.unref(mergedMaskStyle)) == null ? void 0 : _a.color,
  56171. style: vue.normalizeStyle((_b = vue.unref(mergedMaskStyle)) == null ? void 0 : _b.style),
  56172. pos: vue.unref(pos),
  56173. "z-index": vue.unref(mergedZIndex),
  56174. "target-area-clickable": _ctx.targetAreaClickable
  56175. }, null, 8, ["visible", "fill", "style", "pos", "z-index", "target-area-clickable"]),
  56176. _ctx.modelValue ? (vue.openBlock(), vue.createBlock(ElTourContent, {
  56177. key: vue.unref(current),
  56178. reference: vue.unref(triggerTarget),
  56179. placement: vue.unref(mergedPlacement),
  56180. "show-arrow": vue.unref(mergedShowArrow),
  56181. "z-index": vue.unref(mergedZIndex),
  56182. style: vue.normalizeStyle(vue.unref(mergedContentStyle)),
  56183. onClose: onEscClose
  56184. }, {
  56185. default: vue.withCtx(() => [
  56186. vue.createVNode(vue.unref(ElTourSteps), {
  56187. current: vue.unref(current),
  56188. onUpdateTotal
  56189. }, {
  56190. default: vue.withCtx(() => [
  56191. vue.renderSlot(_ctx.$slots, "default")
  56192. ]),
  56193. _: 3
  56194. }, 8, ["current"])
  56195. ]),
  56196. _: 3
  56197. }, 8, ["reference", "placement", "show-arrow", "z-index", "style"])) : vue.createCommentVNode("v-if", true)
  56198. ], 16)
  56199. ];
  56200. }),
  56201. _: 3
  56202. }, 8, ["to"]),
  56203. vue.createCommentVNode(" just for IDE "),
  56204. vue.createCommentVNode("v-if", true)
  56205. ], 64);
  56206. };
  56207. }
  56208. });
  56209. var Tour = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__file", "tour.vue"]]);
  56210. const tourStepProps = buildProps({
  56211. target: {
  56212. type: definePropType([String, Object, Function])
  56213. },
  56214. title: String,
  56215. description: String,
  56216. showClose: {
  56217. type: Boolean,
  56218. default: void 0
  56219. },
  56220. closeIcon: {
  56221. type: iconPropType
  56222. },
  56223. showArrow: {
  56224. type: Boolean,
  56225. default: void 0
  56226. },
  56227. placement: tourContentProps.placement,
  56228. mask: {
  56229. type: definePropType([Boolean, Object]),
  56230. default: void 0
  56231. },
  56232. contentStyle: {
  56233. type: definePropType([Object])
  56234. },
  56235. prevButtonProps: {
  56236. type: definePropType(Object)
  56237. },
  56238. nextButtonProps: {
  56239. type: definePropType(Object)
  56240. },
  56241. scrollIntoViewOptions: {
  56242. type: definePropType([Boolean, Object]),
  56243. default: void 0
  56244. },
  56245. type: {
  56246. type: definePropType(String)
  56247. }
  56248. });
  56249. const tourStepEmits = {
  56250. close: () => true
  56251. };
  56252. const __default__$7 = vue.defineComponent({
  56253. name: "ElTourStep"
  56254. });
  56255. const _sfc_main$8 = /* @__PURE__ */ vue.defineComponent({
  56256. ...__default__$7,
  56257. props: tourStepProps,
  56258. emits: tourStepEmits,
  56259. setup(__props, { emit }) {
  56260. const props = __props;
  56261. const { Close } = CloseComponents;
  56262. const { t } = useLocale();
  56263. const {
  56264. currentStep,
  56265. current,
  56266. total,
  56267. showClose,
  56268. closeIcon,
  56269. mergedType,
  56270. ns,
  56271. slots: tourSlots,
  56272. updateModelValue,
  56273. onClose: tourOnClose,
  56274. onFinish: tourOnFinish,
  56275. onChange
  56276. } = vue.inject(tourKey);
  56277. vue.watch(props, (val) => {
  56278. currentStep.value = val;
  56279. }, {
  56280. immediate: true
  56281. });
  56282. const mergedShowClose = vue.computed(() => {
  56283. var _a;
  56284. return (_a = props.showClose) != null ? _a : showClose.value;
  56285. });
  56286. const mergedCloseIcon = vue.computed(() => {
  56287. var _a, _b;
  56288. return (_b = (_a = props.closeIcon) != null ? _a : closeIcon.value) != null ? _b : Close;
  56289. });
  56290. const filterButtonProps = (btnProps) => {
  56291. if (!btnProps)
  56292. return;
  56293. return omit(btnProps, ["children", "onClick"]);
  56294. };
  56295. const onPrev = () => {
  56296. var _a, _b;
  56297. current.value -= 1;
  56298. if ((_a = props.prevButtonProps) == null ? void 0 : _a.onClick) {
  56299. (_b = props.prevButtonProps) == null ? void 0 : _b.onClick();
  56300. }
  56301. onChange();
  56302. };
  56303. const onNext = () => {
  56304. var _a;
  56305. if (current.value >= total.value - 1) {
  56306. onFinish();
  56307. } else {
  56308. current.value += 1;
  56309. }
  56310. if ((_a = props.nextButtonProps) == null ? void 0 : _a.onClick) {
  56311. props.nextButtonProps.onClick();
  56312. }
  56313. onChange();
  56314. };
  56315. const onFinish = () => {
  56316. onClose();
  56317. tourOnFinish();
  56318. };
  56319. const onClose = () => {
  56320. updateModelValue(false);
  56321. tourOnClose();
  56322. emit("close");
  56323. };
  56324. return (_ctx, _cache) => {
  56325. return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
  56326. vue.unref(mergedShowClose) ? (vue.openBlock(), vue.createElementBlock("button", {
  56327. key: 0,
  56328. "aria-label": "Close",
  56329. class: vue.normalizeClass(vue.unref(ns).e("closebtn")),
  56330. type: "button",
  56331. onClick: onClose
  56332. }, [
  56333. vue.createVNode(vue.unref(ElIcon), {
  56334. class: vue.normalizeClass(vue.unref(ns).e("close"))
  56335. }, {
  56336. default: vue.withCtx(() => [
  56337. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(mergedCloseIcon))))
  56338. ]),
  56339. _: 1
  56340. }, 8, ["class"])
  56341. ], 2)) : vue.createCommentVNode("v-if", true),
  56342. vue.createElementVNode("header", {
  56343. class: vue.normalizeClass([vue.unref(ns).e("header"), { "show-close": vue.unref(showClose) }])
  56344. }, [
  56345. vue.renderSlot(_ctx.$slots, "header", {}, () => [
  56346. vue.createElementVNode("span", {
  56347. role: "heading",
  56348. class: vue.normalizeClass(vue.unref(ns).e("title"))
  56349. }, vue.toDisplayString(_ctx.title), 3)
  56350. ])
  56351. ], 2),
  56352. vue.createElementVNode("div", {
  56353. class: vue.normalizeClass(vue.unref(ns).e("body"))
  56354. }, [
  56355. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  56356. vue.createElementVNode("span", null, vue.toDisplayString(_ctx.description), 1)
  56357. ])
  56358. ], 2),
  56359. vue.createElementVNode("footer", {
  56360. class: vue.normalizeClass(vue.unref(ns).e("footer"))
  56361. }, [
  56362. vue.createElementVNode("div", {
  56363. class: vue.normalizeClass(vue.unref(ns).b("indicators"))
  56364. }, [
  56365. vue.unref(tourSlots).indicators ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(tourSlots).indicators), {
  56366. key: 0,
  56367. current: vue.unref(current),
  56368. total: vue.unref(total)
  56369. }, null, 8, ["current", "total"])) : (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 1 }, vue.renderList(vue.unref(total), (item, index) => {
  56370. return vue.openBlock(), vue.createElementBlock("span", {
  56371. key: item,
  56372. class: vue.normalizeClass([vue.unref(ns).b("indicator"), index === vue.unref(current) ? "is-active" : ""])
  56373. }, null, 2);
  56374. }), 128))
  56375. ], 2),
  56376. vue.createElementVNode("div", {
  56377. class: vue.normalizeClass(vue.unref(ns).b("buttons"))
  56378. }, [
  56379. vue.unref(current) > 0 ? (vue.openBlock(), vue.createBlock(vue.unref(ElButton), vue.mergeProps({
  56380. key: 0,
  56381. size: "small",
  56382. type: vue.unref(mergedType)
  56383. }, filterButtonProps(_ctx.prevButtonProps), { onClick: onPrev }), {
  56384. default: vue.withCtx(() => {
  56385. var _a, _b;
  56386. return [
  56387. vue.createTextVNode(vue.toDisplayString((_b = (_a = _ctx.prevButtonProps) == null ? void 0 : _a.children) != null ? _b : vue.unref(t)("el.tour.previous")), 1)
  56388. ];
  56389. }),
  56390. _: 1
  56391. }, 16, ["type"])) : vue.createCommentVNode("v-if", true),
  56392. vue.unref(current) <= vue.unref(total) - 1 ? (vue.openBlock(), vue.createBlock(vue.unref(ElButton), vue.mergeProps({
  56393. key: 1,
  56394. size: "small",
  56395. type: vue.unref(mergedType) === "primary" ? "default" : "primary"
  56396. }, filterButtonProps(_ctx.nextButtonProps), { onClick: onNext }), {
  56397. default: vue.withCtx(() => {
  56398. var _a, _b;
  56399. return [
  56400. vue.createTextVNode(vue.toDisplayString((_b = (_a = _ctx.nextButtonProps) == null ? void 0 : _a.children) != null ? _b : vue.unref(current) === vue.unref(total) - 1 ? vue.unref(t)("el.tour.finish") : vue.unref(t)("el.tour.next")), 1)
  56401. ];
  56402. }),
  56403. _: 1
  56404. }, 16, ["type"])) : vue.createCommentVNode("v-if", true)
  56405. ], 2)
  56406. ], 2)
  56407. ], 64);
  56408. };
  56409. }
  56410. });
  56411. var TourStep = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__file", "step.vue"]]);
  56412. const ElTour = withInstall(Tour, {
  56413. TourStep
  56414. });
  56415. const ElTourStep = withNoopInstall(TourStep);
  56416. const anchorProps = buildProps({
  56417. container: {
  56418. type: definePropType([
  56419. String,
  56420. Object
  56421. ])
  56422. },
  56423. offset: {
  56424. type: Number,
  56425. default: 0
  56426. },
  56427. bound: {
  56428. type: Number,
  56429. default: 15
  56430. },
  56431. duration: {
  56432. type: Number,
  56433. default: 300
  56434. },
  56435. marker: {
  56436. type: Boolean,
  56437. default: true
  56438. },
  56439. type: {
  56440. type: definePropType(String),
  56441. default: "default"
  56442. },
  56443. direction: {
  56444. type: definePropType(String),
  56445. default: "vertical"
  56446. }
  56447. });
  56448. const anchorEmits = {
  56449. change: (href) => isString$1(href),
  56450. click: (e, href) => e instanceof MouseEvent && (isString$1(href) || isUndefined(href))
  56451. };
  56452. const anchorKey = Symbol("anchor");
  56453. const __default__$6 = vue.defineComponent({
  56454. name: "ElAnchor"
  56455. });
  56456. const _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({
  56457. ...__default__$6,
  56458. props: anchorProps,
  56459. emits: anchorEmits,
  56460. setup(__props, { expose, emit }) {
  56461. const props = __props;
  56462. const currentAnchor = vue.ref("");
  56463. const anchorRef = vue.ref(null);
  56464. const markerRef = vue.ref(null);
  56465. const containerEl = vue.ref();
  56466. const links = {};
  56467. let isScrolling = false;
  56468. let currentScrollTop = 0;
  56469. const ns = useNamespace("anchor");
  56470. const cls = vue.computed(() => [
  56471. ns.b(),
  56472. props.type === "underline" ? ns.m("underline") : "",
  56473. ns.m(props.direction)
  56474. ]);
  56475. const addLink = (state) => {
  56476. links[state.href] = state.el;
  56477. };
  56478. const removeLink = (href) => {
  56479. delete links[href];
  56480. };
  56481. const setCurrentAnchor = (href) => {
  56482. const activeHref = currentAnchor.value;
  56483. if (activeHref !== href) {
  56484. currentAnchor.value = href;
  56485. emit("change", href);
  56486. }
  56487. };
  56488. let clearAnimate = null;
  56489. const scrollToAnchor = (href) => {
  56490. if (!containerEl.value)
  56491. return;
  56492. const target = getElement(href);
  56493. if (!target)
  56494. return;
  56495. if (clearAnimate)
  56496. clearAnimate();
  56497. isScrolling = true;
  56498. const scrollEle = getScrollElement(target, containerEl.value);
  56499. const distance = getOffsetTopDistance(target, scrollEle);
  56500. const max = scrollEle.scrollHeight - scrollEle.clientHeight;
  56501. const to = Math.min(distance - props.offset, max);
  56502. clearAnimate = animateScrollTo(containerEl.value, currentScrollTop, to, props.duration, () => {
  56503. setTimeout(() => {
  56504. isScrolling = false;
  56505. }, 20);
  56506. });
  56507. };
  56508. const scrollTo = (href) => {
  56509. if (href) {
  56510. setCurrentAnchor(href);
  56511. scrollToAnchor(href);
  56512. }
  56513. };
  56514. const handleClick = (e, href) => {
  56515. emit("click", e, href);
  56516. scrollTo(href);
  56517. };
  56518. const handleScroll = throttleByRaf(() => {
  56519. if (containerEl.value) {
  56520. currentScrollTop = getScrollTop(containerEl.value);
  56521. }
  56522. const currentHref = getCurrentHref();
  56523. if (isScrolling || isUndefined(currentHref))
  56524. return;
  56525. setCurrentAnchor(currentHref);
  56526. });
  56527. const getCurrentHref = () => {
  56528. if (!containerEl.value)
  56529. return;
  56530. const scrollTop = getScrollTop(containerEl.value);
  56531. const anchorTopList = [];
  56532. for (const href of Object.keys(links)) {
  56533. const target = getElement(href);
  56534. if (!target)
  56535. continue;
  56536. const scrollEle = getScrollElement(target, containerEl.value);
  56537. const distance = getOffsetTopDistance(target, scrollEle);
  56538. anchorTopList.push({
  56539. top: distance - props.offset - props.bound,
  56540. href
  56541. });
  56542. }
  56543. anchorTopList.sort((prev, next) => prev.top - next.top);
  56544. for (let i = 0; i < anchorTopList.length; i++) {
  56545. const item = anchorTopList[i];
  56546. const next = anchorTopList[i + 1];
  56547. if (i === 0 && scrollTop === 0) {
  56548. return "";
  56549. }
  56550. if (item.top <= scrollTop && (!next || next.top > scrollTop)) {
  56551. return item.href;
  56552. }
  56553. }
  56554. };
  56555. const getContainer = () => {
  56556. const el = getElement(props.container);
  56557. if (!el || isWindow$1(el)) {
  56558. containerEl.value = window;
  56559. } else {
  56560. containerEl.value = el;
  56561. }
  56562. };
  56563. useEventListener(containerEl, "scroll", handleScroll);
  56564. const markerStyle = vue.computed(() => {
  56565. if (!anchorRef.value || !markerRef.value || !currentAnchor.value)
  56566. return {};
  56567. const currentLinkEl = links[currentAnchor.value];
  56568. if (!currentLinkEl)
  56569. return {};
  56570. const anchorRect = anchorRef.value.getBoundingClientRect();
  56571. const markerRect = markerRef.value.getBoundingClientRect();
  56572. const linkRect = currentLinkEl.getBoundingClientRect();
  56573. if (props.direction === "horizontal") {
  56574. const left = linkRect.left - anchorRect.left;
  56575. return {
  56576. left: `${left}px`,
  56577. width: `${linkRect.width}px`,
  56578. opacity: 1
  56579. };
  56580. } else {
  56581. const top = linkRect.top - anchorRect.top + (linkRect.height - markerRect.height) / 2;
  56582. return {
  56583. top: `${top}px`,
  56584. opacity: 1
  56585. };
  56586. }
  56587. });
  56588. vue.onMounted(() => {
  56589. getContainer();
  56590. const hash = decodeURIComponent(window.location.hash);
  56591. const target = getElement(hash);
  56592. if (target) {
  56593. scrollTo(hash);
  56594. } else {
  56595. handleScroll();
  56596. }
  56597. });
  56598. vue.watch(() => props.container, () => {
  56599. getContainer();
  56600. });
  56601. vue.provide(anchorKey, {
  56602. ns,
  56603. direction: props.direction,
  56604. currentAnchor,
  56605. addLink,
  56606. removeLink,
  56607. handleClick
  56608. });
  56609. expose({
  56610. scrollTo
  56611. });
  56612. return (_ctx, _cache) => {
  56613. return vue.openBlock(), vue.createElementBlock("div", {
  56614. ref_key: "anchorRef",
  56615. ref: anchorRef,
  56616. class: vue.normalizeClass(vue.unref(cls))
  56617. }, [
  56618. _ctx.marker ? (vue.openBlock(), vue.createElementBlock("div", {
  56619. key: 0,
  56620. ref_key: "markerRef",
  56621. ref: markerRef,
  56622. class: vue.normalizeClass(vue.unref(ns).e("marker")),
  56623. style: vue.normalizeStyle(vue.unref(markerStyle))
  56624. }, null, 6)) : vue.createCommentVNode("v-if", true),
  56625. vue.createElementVNode("div", {
  56626. class: vue.normalizeClass(vue.unref(ns).e("list"))
  56627. }, [
  56628. vue.renderSlot(_ctx.$slots, "default")
  56629. ], 2)
  56630. ], 2);
  56631. };
  56632. }
  56633. });
  56634. var Anchor = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__file", "anchor.vue"]]);
  56635. const anchorLinkProps = buildProps({
  56636. title: String,
  56637. href: String
  56638. });
  56639. const __default__$5 = vue.defineComponent({
  56640. name: "ElAnchorLink"
  56641. });
  56642. const _sfc_main$6 = /* @__PURE__ */ vue.defineComponent({
  56643. ...__default__$5,
  56644. props: anchorLinkProps,
  56645. setup(__props) {
  56646. const props = __props;
  56647. const linkRef = vue.ref(null);
  56648. const {
  56649. ns,
  56650. direction,
  56651. currentAnchor,
  56652. addLink,
  56653. removeLink,
  56654. handleClick: contextHandleClick
  56655. } = vue.inject(anchorKey);
  56656. const cls = vue.computed(() => [
  56657. ns.e("link"),
  56658. ns.is("active", currentAnchor.value === props.href)
  56659. ]);
  56660. const handleClick = (e) => {
  56661. contextHandleClick(e, props.href);
  56662. };
  56663. vue.watch(() => props.href, (val, oldVal) => {
  56664. vue.nextTick(() => {
  56665. if (oldVal)
  56666. removeLink(oldVal);
  56667. if (val) {
  56668. addLink({
  56669. href: val,
  56670. el: linkRef.value
  56671. });
  56672. }
  56673. });
  56674. });
  56675. vue.onMounted(() => {
  56676. const { href } = props;
  56677. if (href) {
  56678. addLink({
  56679. href,
  56680. el: linkRef.value
  56681. });
  56682. }
  56683. });
  56684. vue.onBeforeUnmount(() => {
  56685. const { href } = props;
  56686. if (href) {
  56687. removeLink(href);
  56688. }
  56689. });
  56690. return (_ctx, _cache) => {
  56691. return vue.openBlock(), vue.createElementBlock("div", {
  56692. class: vue.normalizeClass(vue.unref(ns).e("item"))
  56693. }, [
  56694. vue.createElementVNode("a", {
  56695. ref_key: "linkRef",
  56696. ref: linkRef,
  56697. class: vue.normalizeClass(vue.unref(cls)),
  56698. href: _ctx.href,
  56699. onClick: handleClick
  56700. }, [
  56701. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  56702. vue.createTextVNode(vue.toDisplayString(_ctx.title), 1)
  56703. ])
  56704. ], 10, ["href"]),
  56705. _ctx.$slots["sub-link"] && vue.unref(direction) === "vertical" ? (vue.openBlock(), vue.createElementBlock("div", {
  56706. key: 0,
  56707. class: vue.normalizeClass(vue.unref(ns).e("list"))
  56708. }, [
  56709. vue.renderSlot(_ctx.$slots, "sub-link")
  56710. ], 2)) : vue.createCommentVNode("v-if", true)
  56711. ], 2);
  56712. };
  56713. }
  56714. });
  56715. var AnchorLink = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__file", "anchor-link.vue"]]);
  56716. const ElAnchor = withInstall(Anchor, {
  56717. AnchorLink
  56718. });
  56719. const ElAnchorLink = withNoopInstall(AnchorLink);
  56720. const segmentedProps = buildProps({
  56721. direction: {
  56722. type: definePropType(String),
  56723. default: "horizontal"
  56724. },
  56725. options: {
  56726. type: definePropType(Array),
  56727. default: () => []
  56728. },
  56729. modelValue: {
  56730. type: [String, Number, Boolean],
  56731. default: void 0
  56732. },
  56733. block: Boolean,
  56734. size: useSizeProp,
  56735. disabled: Boolean,
  56736. validateEvent: {
  56737. type: Boolean,
  56738. default: true
  56739. },
  56740. id: String,
  56741. name: String,
  56742. ...useAriaProps(["ariaLabel"])
  56743. });
  56744. const segmentedEmits = {
  56745. [UPDATE_MODEL_EVENT]: (val) => isString$1(val) || isNumber(val) || isBoolean(val),
  56746. [CHANGE_EVENT]: (val) => isString$1(val) || isNumber(val) || isBoolean(val)
  56747. };
  56748. const __default__$4 = vue.defineComponent({
  56749. name: "ElSegmented"
  56750. });
  56751. const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
  56752. ...__default__$4,
  56753. props: segmentedProps,
  56754. emits: segmentedEmits,
  56755. setup(__props, { emit }) {
  56756. const props = __props;
  56757. const ns = useNamespace("segmented");
  56758. const segmentedId = useId();
  56759. const segmentedSize = useFormSize();
  56760. const _disabled = useFormDisabled();
  56761. const { formItem } = useFormItem();
  56762. const { inputId, isLabeledByFormItem } = useFormItemInputId(props, {
  56763. formItemContext: formItem
  56764. });
  56765. const segmentedRef = vue.ref(null);
  56766. const activeElement = useActiveElement();
  56767. const state = vue.reactive({
  56768. isInit: false,
  56769. width: 0,
  56770. height: 0,
  56771. translateX: 0,
  56772. translateY: 0,
  56773. focusVisible: false
  56774. });
  56775. const handleChange = (item) => {
  56776. const value = getValue(item);
  56777. emit(UPDATE_MODEL_EVENT, value);
  56778. emit(CHANGE_EVENT, value);
  56779. };
  56780. const getValue = (item) => {
  56781. return isObject$1(item) ? item.value : item;
  56782. };
  56783. const getLabel = (item) => {
  56784. return isObject$1(item) ? item.label : item;
  56785. };
  56786. const getDisabled = (item) => {
  56787. return !!(_disabled.value || (isObject$1(item) ? item.disabled : false));
  56788. };
  56789. const getSelected = (item) => {
  56790. return props.modelValue === getValue(item);
  56791. };
  56792. const getOption = (value) => {
  56793. return props.options.find((item) => getValue(item) === value);
  56794. };
  56795. const getItemCls = (item) => {
  56796. return [
  56797. ns.e("item"),
  56798. ns.is("selected", getSelected(item)),
  56799. ns.is("disabled", getDisabled(item))
  56800. ];
  56801. };
  56802. const updateSelect = () => {
  56803. if (!segmentedRef.value)
  56804. return;
  56805. const selectedItem = segmentedRef.value.querySelector(".is-selected");
  56806. const selectedItemInput = segmentedRef.value.querySelector(".is-selected input");
  56807. if (!selectedItem || !selectedItemInput) {
  56808. state.width = 0;
  56809. state.height = 0;
  56810. state.translateX = 0;
  56811. state.translateY = 0;
  56812. state.focusVisible = false;
  56813. return;
  56814. }
  56815. const rect = selectedItem.getBoundingClientRect();
  56816. state.isInit = true;
  56817. if (props.direction === "vertical") {
  56818. state.height = rect.height;
  56819. state.translateY = selectedItem.offsetTop;
  56820. } else {
  56821. state.width = rect.width;
  56822. state.translateX = selectedItem.offsetLeft;
  56823. }
  56824. try {
  56825. state.focusVisible = selectedItemInput.matches(":focus-visible");
  56826. } catch (e) {
  56827. }
  56828. };
  56829. const segmentedCls = vue.computed(() => [
  56830. ns.b(),
  56831. ns.m(segmentedSize.value),
  56832. ns.is("block", props.block)
  56833. ]);
  56834. const selectedStyle = vue.computed(() => ({
  56835. width: props.direction === "vertical" ? "100%" : `${state.width}px`,
  56836. height: props.direction === "vertical" ? `${state.height}px` : "100%",
  56837. transform: props.direction === "vertical" ? `translateY(${state.translateY}px)` : `translateX(${state.translateX}px)`,
  56838. display: state.isInit ? "block" : "none"
  56839. }));
  56840. const selectedCls = vue.computed(() => [
  56841. ns.e("item-selected"),
  56842. ns.is("disabled", getDisabled(getOption(props.modelValue))),
  56843. ns.is("focus-visible", state.focusVisible)
  56844. ]);
  56845. const name = vue.computed(() => {
  56846. return props.name || segmentedId.value;
  56847. });
  56848. useResizeObserver(segmentedRef, updateSelect);
  56849. vue.watch(activeElement, updateSelect);
  56850. vue.watch(() => props.modelValue, () => {
  56851. var _a;
  56852. updateSelect();
  56853. if (props.validateEvent) {
  56854. (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "change").catch((err) => debugWarn());
  56855. }
  56856. }, {
  56857. flush: "post"
  56858. });
  56859. return (_ctx, _cache) => {
  56860. return _ctx.options.length ? (vue.openBlock(), vue.createElementBlock("div", {
  56861. key: 0,
  56862. id: vue.unref(inputId),
  56863. ref_key: "segmentedRef",
  56864. ref: segmentedRef,
  56865. class: vue.normalizeClass(vue.unref(segmentedCls)),
  56866. role: "radiogroup",
  56867. "aria-label": !vue.unref(isLabeledByFormItem) ? _ctx.ariaLabel || "segmented" : void 0,
  56868. "aria-labelledby": vue.unref(isLabeledByFormItem) ? vue.unref(formItem).labelId : void 0
  56869. }, [
  56870. vue.createElementVNode("div", {
  56871. class: vue.normalizeClass([vue.unref(ns).e("group"), vue.unref(ns).m(props.direction)])
  56872. }, [
  56873. vue.createElementVNode("div", {
  56874. style: vue.normalizeStyle(vue.unref(selectedStyle)),
  56875. class: vue.normalizeClass(vue.unref(selectedCls))
  56876. }, null, 6),
  56877. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.options, (item, index) => {
  56878. return vue.openBlock(), vue.createElementBlock("label", {
  56879. key: index,
  56880. class: vue.normalizeClass(getItemCls(item))
  56881. }, [
  56882. vue.createElementVNode("input", {
  56883. class: vue.normalizeClass(vue.unref(ns).e("item-input")),
  56884. type: "radio",
  56885. name: vue.unref(name),
  56886. disabled: getDisabled(item),
  56887. checked: getSelected(item),
  56888. onChange: ($event) => handleChange(item)
  56889. }, null, 42, ["name", "disabled", "checked", "onChange"]),
  56890. vue.createElementVNode("div", {
  56891. class: vue.normalizeClass(vue.unref(ns).e("item-label"))
  56892. }, [
  56893. vue.renderSlot(_ctx.$slots, "default", { item }, () => [
  56894. vue.createTextVNode(vue.toDisplayString(getLabel(item)), 1)
  56895. ])
  56896. ], 2)
  56897. ], 2);
  56898. }), 128))
  56899. ], 2)
  56900. ], 10, ["id", "aria-label", "aria-labelledby"])) : vue.createCommentVNode("v-if", true);
  56901. };
  56902. }
  56903. });
  56904. var Segmented = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__file", "segmented.vue"]]);
  56905. const ElSegmented = withInstall(Segmented);
  56906. const filterOption = (pattern, option) => {
  56907. const lowerCase = pattern.toLowerCase();
  56908. const label = option.label || option.value;
  56909. return label.toLowerCase().includes(lowerCase);
  56910. };
  56911. const getMentionCtx = (inputEl, prefix, split) => {
  56912. const { selectionEnd } = inputEl;
  56913. if (selectionEnd === null)
  56914. return;
  56915. const inputValue = inputEl.value;
  56916. const prefixArray = castArray$1(prefix);
  56917. let splitIndex = -1;
  56918. let mentionCtx;
  56919. for (let i = selectionEnd - 1; i >= 0; --i) {
  56920. const char = inputValue[i];
  56921. if (char === split || char === "\n" || char === "\r") {
  56922. splitIndex = i;
  56923. continue;
  56924. }
  56925. if (prefixArray.includes(char)) {
  56926. const end = splitIndex === -1 ? selectionEnd : splitIndex;
  56927. const pattern = inputValue.slice(i + 1, end);
  56928. mentionCtx = {
  56929. pattern,
  56930. start: i + 1,
  56931. end,
  56932. prefix: char,
  56933. prefixIndex: i,
  56934. splitIndex,
  56935. selectionEnd
  56936. };
  56937. break;
  56938. }
  56939. }
  56940. return mentionCtx;
  56941. };
  56942. const getCursorPosition = (element, options = {
  56943. debug: false,
  56944. useSelectionEnd: false
  56945. }) => {
  56946. const selectionStart = element.selectionStart !== null ? element.selectionStart : 0;
  56947. const selectionEnd = element.selectionEnd !== null ? element.selectionEnd : 0;
  56948. const position = options.useSelectionEnd ? selectionEnd : selectionStart;
  56949. const properties = [
  56950. "direction",
  56951. "boxSizing",
  56952. "width",
  56953. "height",
  56954. "overflowX",
  56955. "overflowY",
  56956. "borderTopWidth",
  56957. "borderRightWidth",
  56958. "borderBottomWidth",
  56959. "borderLeftWidth",
  56960. "borderStyle",
  56961. "paddingTop",
  56962. "paddingRight",
  56963. "paddingBottom",
  56964. "paddingLeft",
  56965. "fontStyle",
  56966. "fontVariant",
  56967. "fontWeight",
  56968. "fontStretch",
  56969. "fontSize",
  56970. "fontSizeAdjust",
  56971. "lineHeight",
  56972. "fontFamily",
  56973. "textAlign",
  56974. "textTransform",
  56975. "textIndent",
  56976. "textDecoration",
  56977. "letterSpacing",
  56978. "wordSpacing",
  56979. "tabSize",
  56980. "MozTabSize"
  56981. ];
  56982. if (options.debug) {
  56983. const el = document.querySelector("#input-textarea-caret-position-mirror-div");
  56984. if (el == null ? void 0 : el.parentNode)
  56985. el.parentNode.removeChild(el);
  56986. }
  56987. const div = document.createElement("div");
  56988. div.id = "input-textarea-caret-position-mirror-div";
  56989. document.body.appendChild(div);
  56990. const style = div.style;
  56991. const computed = window.getComputedStyle(element);
  56992. const isInput = element.nodeName === "INPUT";
  56993. style.whiteSpace = isInput ? "nowrap" : "pre-wrap";
  56994. if (!isInput)
  56995. style.wordWrap = "break-word";
  56996. style.position = "absolute";
  56997. if (!options.debug)
  56998. style.visibility = "hidden";
  56999. properties.forEach((prop) => {
  57000. if (isInput && prop === "lineHeight") {
  57001. if (computed.boxSizing === "border-box") {
  57002. const height = Number.parseInt(computed.height);
  57003. const outerHeight = Number.parseInt(computed.paddingTop) + Number.parseInt(computed.paddingBottom) + Number.parseInt(computed.borderTopWidth) + Number.parseInt(computed.borderBottomWidth);
  57004. const targetHeight = outerHeight + Number.parseInt(computed.lineHeight);
  57005. if (height > targetHeight) {
  57006. style.lineHeight = `${height - outerHeight}px`;
  57007. } else if (height === targetHeight) {
  57008. style.lineHeight = computed.lineHeight;
  57009. } else {
  57010. style.lineHeight = "0";
  57011. }
  57012. } else {
  57013. style.lineHeight = computed.height;
  57014. }
  57015. } else {
  57016. style[prop] = computed[prop];
  57017. }
  57018. });
  57019. if (isFirefox()) {
  57020. if (element.scrollHeight > Number.parseInt(computed.height)) {
  57021. style.overflowY = "scroll";
  57022. }
  57023. } else {
  57024. style.overflow = "hidden";
  57025. }
  57026. div.textContent = element.value.slice(0, Math.max(0, position));
  57027. if (isInput && div.textContent) {
  57028. div.textContent = div.textContent.replace(/\s/g, "\xA0");
  57029. }
  57030. const span = document.createElement("span");
  57031. span.textContent = element.value.slice(Math.max(0, position)) || ".";
  57032. span.style.position = "relative";
  57033. span.style.left = `${-element.scrollLeft}px`;
  57034. span.style.top = `${-element.scrollTop}px`;
  57035. div.appendChild(span);
  57036. const relativePosition = {
  57037. top: span.offsetTop + Number.parseInt(computed.borderTopWidth),
  57038. left: span.offsetLeft + Number.parseInt(computed.borderLeftWidth),
  57039. height: Number.parseInt(computed.fontSize) * 1.5
  57040. };
  57041. if (options.debug) {
  57042. span.style.backgroundColor = "#aaa";
  57043. } else {
  57044. document.body.removeChild(div);
  57045. }
  57046. if (relativePosition.left >= element.clientWidth) {
  57047. relativePosition.left = element.clientWidth;
  57048. }
  57049. return relativePosition;
  57050. };
  57051. const mentionProps = buildProps({
  57052. ...inputProps,
  57053. options: {
  57054. type: definePropType(Array),
  57055. default: () => []
  57056. },
  57057. prefix: {
  57058. type: definePropType([String, Array]),
  57059. default: "@",
  57060. validator: (val) => {
  57061. if (isString$1(val))
  57062. return val.length === 1;
  57063. return val.every((v) => isString$1(v) && v.length === 1);
  57064. }
  57065. },
  57066. split: {
  57067. type: String,
  57068. default: " ",
  57069. validator: (val) => val.length === 1
  57070. },
  57071. filterOption: {
  57072. type: definePropType([Boolean, Function]),
  57073. default: () => filterOption,
  57074. validator: (val) => {
  57075. if (val === false)
  57076. return true;
  57077. return isFunction$1(val);
  57078. }
  57079. },
  57080. placement: {
  57081. type: definePropType(String),
  57082. default: "bottom"
  57083. },
  57084. showArrow: Boolean,
  57085. offset: {
  57086. type: Number,
  57087. default: 0
  57088. },
  57089. whole: Boolean,
  57090. checkIsWhole: {
  57091. type: definePropType(Function)
  57092. },
  57093. modelValue: String,
  57094. loading: Boolean,
  57095. popperClass: {
  57096. type: String,
  57097. default: ""
  57098. },
  57099. popperOptions: {
  57100. type: definePropType(Object),
  57101. default: () => ({})
  57102. }
  57103. });
  57104. const mentionEmits = {
  57105. [UPDATE_MODEL_EVENT]: (value) => isString$1(value),
  57106. search: (pattern, prefix) => isString$1(pattern) && isString$1(prefix),
  57107. select: (option, prefix) => isString$1(option.value) && isString$1(prefix),
  57108. focus: (evt) => evt instanceof FocusEvent,
  57109. blur: (evt) => evt instanceof FocusEvent
  57110. };
  57111. const mentionDropdownProps = buildProps({
  57112. options: {
  57113. type: definePropType(Array),
  57114. default: () => []
  57115. },
  57116. loading: Boolean,
  57117. disabled: Boolean,
  57118. contentId: String,
  57119. ariaLabel: String
  57120. });
  57121. const mentionDropdownEmits = {
  57122. select: (option) => isString$1(option.value)
  57123. };
  57124. const __default__$3 = vue.defineComponent({
  57125. name: "ElMentionDropdown"
  57126. });
  57127. const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
  57128. ...__default__$3,
  57129. props: mentionDropdownProps,
  57130. emits: mentionDropdownEmits,
  57131. setup(__props, { expose, emit }) {
  57132. const props = __props;
  57133. const ns = useNamespace("mention");
  57134. const { t } = useLocale();
  57135. const hoveringIndex = vue.ref(-1);
  57136. const scrollbarRef = vue.ref();
  57137. const optionRefs = vue.ref();
  57138. const dropdownRef = vue.ref();
  57139. const optionkls = (item, index) => [
  57140. ns.be("dropdown", "item"),
  57141. ns.is("hovering", hoveringIndex.value === index),
  57142. ns.is("disabled", item.disabled || props.disabled)
  57143. ];
  57144. const handleSelect = (item) => {
  57145. if (item.disabled || props.disabled)
  57146. return;
  57147. emit("select", item);
  57148. };
  57149. const handleMouseEnter = (index) => {
  57150. hoveringIndex.value = index;
  57151. };
  57152. const filteredAllDisabled = vue.computed(() => props.disabled || props.options.every((item) => item.disabled));
  57153. const hoverOption = vue.computed(() => props.options[hoveringIndex.value]);
  57154. const selectHoverOption = () => {
  57155. if (!hoverOption.value)
  57156. return;
  57157. emit("select", hoverOption.value);
  57158. };
  57159. const navigateOptions = (direction) => {
  57160. const { options } = props;
  57161. if (options.length === 0 || filteredAllDisabled.value)
  57162. return;
  57163. if (direction === "next") {
  57164. hoveringIndex.value++;
  57165. if (hoveringIndex.value === options.length) {
  57166. hoveringIndex.value = 0;
  57167. }
  57168. } else if (direction === "prev") {
  57169. hoveringIndex.value--;
  57170. if (hoveringIndex.value < 0) {
  57171. hoveringIndex.value = options.length - 1;
  57172. }
  57173. }
  57174. const option = options[hoveringIndex.value];
  57175. if (option.disabled) {
  57176. navigateOptions(direction);
  57177. return;
  57178. }
  57179. vue.nextTick(() => scrollToOption(option));
  57180. };
  57181. const scrollToOption = (option) => {
  57182. var _a, _b, _c, _d;
  57183. const { options } = props;
  57184. const index = options.findIndex((item) => item.value === option.value);
  57185. const target = (_a = optionRefs.value) == null ? void 0 : _a[index];
  57186. if (target) {
  57187. const menu = (_c = (_b = dropdownRef.value) == null ? void 0 : _b.querySelector) == null ? void 0 : _c.call(_b, `.${ns.be("dropdown", "wrap")}`);
  57188. if (menu) {
  57189. scrollIntoView(menu, target);
  57190. }
  57191. }
  57192. (_d = scrollbarRef.value) == null ? void 0 : _d.handleScroll();
  57193. };
  57194. const resetHoveringIndex = () => {
  57195. if (filteredAllDisabled.value || props.options.length === 0) {
  57196. hoveringIndex.value = -1;
  57197. } else {
  57198. hoveringIndex.value = 0;
  57199. }
  57200. };
  57201. vue.watch(() => props.options, resetHoveringIndex, {
  57202. immediate: true
  57203. });
  57204. expose({
  57205. hoveringIndex,
  57206. navigateOptions,
  57207. selectHoverOption,
  57208. hoverOption
  57209. });
  57210. return (_ctx, _cache) => {
  57211. return vue.openBlock(), vue.createElementBlock("div", {
  57212. ref_key: "dropdownRef",
  57213. ref: dropdownRef,
  57214. class: vue.normalizeClass(vue.unref(ns).b("dropdown"))
  57215. }, [
  57216. _ctx.$slots.header ? (vue.openBlock(), vue.createElementBlock("div", {
  57217. key: 0,
  57218. class: vue.normalizeClass(vue.unref(ns).be("dropdown", "header"))
  57219. }, [
  57220. vue.renderSlot(_ctx.$slots, "header")
  57221. ], 2)) : vue.createCommentVNode("v-if", true),
  57222. vue.withDirectives(vue.createVNode(vue.unref(ElScrollbar), {
  57223. id: _ctx.contentId,
  57224. ref_key: "scrollbarRef",
  57225. ref: scrollbarRef,
  57226. tag: "ul",
  57227. "wrap-class": vue.unref(ns).be("dropdown", "wrap"),
  57228. "view-class": vue.unref(ns).be("dropdown", "list"),
  57229. role: "listbox",
  57230. "aria-label": _ctx.ariaLabel,
  57231. "aria-orientation": "vertical"
  57232. }, {
  57233. default: vue.withCtx(() => [
  57234. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.options, (item, index) => {
  57235. return vue.openBlock(), vue.createElementBlock("li", {
  57236. id: `${_ctx.contentId}-${index}`,
  57237. ref_for: true,
  57238. ref_key: "optionRefs",
  57239. ref: optionRefs,
  57240. key: index,
  57241. class: vue.normalizeClass(optionkls(item, index)),
  57242. role: "option",
  57243. "aria-disabled": item.disabled || _ctx.disabled || void 0,
  57244. "aria-selected": hoveringIndex.value === index,
  57245. onMousemove: ($event) => handleMouseEnter(index),
  57246. onClick: vue.withModifiers(($event) => handleSelect(item), ["stop"])
  57247. }, [
  57248. vue.renderSlot(_ctx.$slots, "label", {
  57249. item,
  57250. index
  57251. }, () => {
  57252. var _a;
  57253. return [
  57254. vue.createElementVNode("span", null, vue.toDisplayString((_a = item.label) != null ? _a : item.value), 1)
  57255. ];
  57256. })
  57257. ], 42, ["id", "aria-disabled", "aria-selected", "onMousemove", "onClick"]);
  57258. }), 128))
  57259. ]),
  57260. _: 3
  57261. }, 8, ["id", "wrap-class", "view-class", "aria-label"]), [
  57262. [vue.vShow, _ctx.options.length > 0 && !_ctx.loading]
  57263. ]),
  57264. _ctx.loading ? (vue.openBlock(), vue.createElementBlock("div", {
  57265. key: 1,
  57266. class: vue.normalizeClass(vue.unref(ns).be("dropdown", "loading"))
  57267. }, [
  57268. vue.renderSlot(_ctx.$slots, "loading", {}, () => [
  57269. vue.createTextVNode(vue.toDisplayString(vue.unref(t)("el.mention.loading")), 1)
  57270. ])
  57271. ], 2)) : vue.createCommentVNode("v-if", true),
  57272. _ctx.$slots.footer ? (vue.openBlock(), vue.createElementBlock("div", {
  57273. key: 2,
  57274. class: vue.normalizeClass(vue.unref(ns).be("dropdown", "footer"))
  57275. }, [
  57276. vue.renderSlot(_ctx.$slots, "footer")
  57277. ], 2)) : vue.createCommentVNode("v-if", true)
  57278. ], 2);
  57279. };
  57280. }
  57281. });
  57282. var ElMentionDropdown = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__file", "mention-dropdown.vue"]]);
  57283. const __default__$2 = vue.defineComponent({
  57284. name: "ElMention",
  57285. inheritAttrs: false
  57286. });
  57287. const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
  57288. ...__default__$2,
  57289. props: mentionProps,
  57290. emits: mentionEmits,
  57291. setup(__props, { expose, emit }) {
  57292. const props = __props;
  57293. const passInputProps = vue.computed(() => pick(props, Object.keys(inputProps)));
  57294. const ns = useNamespace("mention");
  57295. const disabled = useFormDisabled();
  57296. const contentId = useId();
  57297. const elInputRef = vue.ref();
  57298. const tooltipRef = vue.ref();
  57299. const dropdownRef = vue.ref();
  57300. const visible = vue.ref(false);
  57301. const cursorStyle = vue.ref();
  57302. const mentionCtx = vue.ref();
  57303. const computedPlacement = vue.computed(() => props.showArrow ? props.placement : `${props.placement}-start`);
  57304. const computedFallbackPlacements = vue.computed(() => props.showArrow ? ["bottom", "top"] : ["bottom-start", "top-start"]);
  57305. const filteredOptions = vue.computed(() => {
  57306. const { filterOption, options } = props;
  57307. if (!mentionCtx.value || !filterOption)
  57308. return options;
  57309. return options.filter((option) => filterOption(mentionCtx.value.pattern, option));
  57310. });
  57311. const dropdownVisible = vue.computed(() => {
  57312. return visible.value && (!!filteredOptions.value.length || props.loading);
  57313. });
  57314. const hoveringId = vue.computed(() => {
  57315. var _a;
  57316. return `${contentId.value}-${(_a = dropdownRef.value) == null ? void 0 : _a.hoveringIndex}`;
  57317. });
  57318. const handleInputChange = (value) => {
  57319. emit("update:modelValue", value);
  57320. syncAfterCursorMove();
  57321. };
  57322. const handleInputKeyDown = (event) => {
  57323. var _a, _b, _c, _d;
  57324. if (!("code" in event) || ((_a = elInputRef.value) == null ? void 0 : _a.isComposing))
  57325. return;
  57326. switch (event.code) {
  57327. case EVENT_CODE.left:
  57328. case EVENT_CODE.right:
  57329. syncAfterCursorMove();
  57330. break;
  57331. case EVENT_CODE.up:
  57332. case EVENT_CODE.down:
  57333. if (!visible.value)
  57334. return;
  57335. event.preventDefault();
  57336. (_b = dropdownRef.value) == null ? void 0 : _b.navigateOptions(event.code === EVENT_CODE.up ? "prev" : "next");
  57337. break;
  57338. case EVENT_CODE.enter:
  57339. case EVENT_CODE.numpadEnter:
  57340. if (!visible.value)
  57341. return;
  57342. event.preventDefault();
  57343. if ((_c = dropdownRef.value) == null ? void 0 : _c.hoverOption) {
  57344. (_d = dropdownRef.value) == null ? void 0 : _d.selectHoverOption();
  57345. } else {
  57346. visible.value = false;
  57347. }
  57348. break;
  57349. case EVENT_CODE.esc:
  57350. if (!visible.value)
  57351. return;
  57352. event.preventDefault();
  57353. visible.value = false;
  57354. break;
  57355. case EVENT_CODE.backspace:
  57356. if (props.whole && mentionCtx.value) {
  57357. const { splitIndex, selectionEnd, pattern, prefixIndex, prefix } = mentionCtx.value;
  57358. const inputEl = getInputEl();
  57359. if (!inputEl)
  57360. return;
  57361. const inputValue = inputEl.value;
  57362. const matchOption = props.options.find((item) => item.value === pattern);
  57363. const isWhole = isFunction$1(props.checkIsWhole) ? props.checkIsWhole(pattern, prefix) : matchOption;
  57364. if (isWhole && splitIndex !== -1 && splitIndex + 1 === selectionEnd) {
  57365. event.preventDefault();
  57366. const newValue = inputValue.slice(0, prefixIndex) + inputValue.slice(splitIndex + 1);
  57367. emit(UPDATE_MODEL_EVENT, newValue);
  57368. const newSelectionEnd = prefixIndex;
  57369. vue.nextTick(() => {
  57370. inputEl.selectionStart = newSelectionEnd;
  57371. inputEl.selectionEnd = newSelectionEnd;
  57372. syncDropdownVisible();
  57373. });
  57374. }
  57375. }
  57376. }
  57377. };
  57378. const { wrapperRef } = useFocusController(elInputRef, {
  57379. beforeFocus() {
  57380. return disabled.value;
  57381. },
  57382. afterFocus() {
  57383. syncAfterCursorMove();
  57384. },
  57385. beforeBlur(event) {
  57386. var _a;
  57387. return (_a = tooltipRef.value) == null ? void 0 : _a.isFocusInsideContent(event);
  57388. },
  57389. afterBlur() {
  57390. visible.value = false;
  57391. }
  57392. });
  57393. const handleInputMouseDown = () => {
  57394. syncAfterCursorMove();
  57395. };
  57396. const handleSelect = (item) => {
  57397. if (!mentionCtx.value)
  57398. return;
  57399. const inputEl = getInputEl();
  57400. if (!inputEl)
  57401. return;
  57402. const inputValue = inputEl.value;
  57403. const { split } = props;
  57404. const newEndPart = inputValue.slice(mentionCtx.value.end);
  57405. const alreadySeparated = newEndPart.startsWith(split);
  57406. const newMiddlePart = `${item.value}${alreadySeparated ? "" : split}`;
  57407. const newValue = inputValue.slice(0, mentionCtx.value.start) + newMiddlePart + newEndPart;
  57408. emit(UPDATE_MODEL_EVENT, newValue);
  57409. emit("select", item, mentionCtx.value.prefix);
  57410. const newSelectionEnd = mentionCtx.value.start + newMiddlePart.length + (alreadySeparated ? 1 : 0);
  57411. vue.nextTick(() => {
  57412. inputEl.selectionStart = newSelectionEnd;
  57413. inputEl.selectionEnd = newSelectionEnd;
  57414. inputEl.focus();
  57415. syncDropdownVisible();
  57416. });
  57417. };
  57418. const getInputEl = () => {
  57419. var _a, _b;
  57420. return props.type === "textarea" ? (_a = elInputRef.value) == null ? void 0 : _a.textarea : (_b = elInputRef.value) == null ? void 0 : _b.input;
  57421. };
  57422. const syncAfterCursorMove = () => {
  57423. setTimeout(() => {
  57424. syncCursor();
  57425. syncDropdownVisible();
  57426. vue.nextTick(() => {
  57427. var _a;
  57428. return (_a = tooltipRef.value) == null ? void 0 : _a.updatePopper();
  57429. });
  57430. }, 0);
  57431. };
  57432. const syncCursor = () => {
  57433. const inputEl = getInputEl();
  57434. if (!inputEl)
  57435. return;
  57436. const caretPosition = getCursorPosition(inputEl);
  57437. const inputRect = inputEl.getBoundingClientRect();
  57438. const elInputRect = elInputRef.value.$el.getBoundingClientRect();
  57439. cursorStyle.value = {
  57440. position: "absolute",
  57441. width: 0,
  57442. height: `${caretPosition.height}px`,
  57443. left: `${caretPosition.left + inputRect.left - elInputRect.left}px`,
  57444. top: `${caretPosition.top + inputRect.top - elInputRect.top}px`
  57445. };
  57446. };
  57447. const syncDropdownVisible = () => {
  57448. const inputEl = getInputEl();
  57449. if (document.activeElement !== inputEl) {
  57450. visible.value = false;
  57451. return;
  57452. }
  57453. const { prefix, split } = props;
  57454. mentionCtx.value = getMentionCtx(inputEl, prefix, split);
  57455. if (mentionCtx.value && mentionCtx.value.splitIndex === -1) {
  57456. visible.value = true;
  57457. emit("search", mentionCtx.value.pattern, mentionCtx.value.prefix);
  57458. return;
  57459. }
  57460. visible.value = false;
  57461. };
  57462. expose({
  57463. input: elInputRef,
  57464. tooltip: tooltipRef,
  57465. dropdownVisible
  57466. });
  57467. return (_ctx, _cache) => {
  57468. return vue.openBlock(), vue.createElementBlock("div", {
  57469. ref_key: "wrapperRef",
  57470. ref: wrapperRef,
  57471. class: vue.normalizeClass(vue.unref(ns).b())
  57472. }, [
  57473. vue.createVNode(vue.unref(ElInput), vue.mergeProps(vue.mergeProps(vue.unref(passInputProps), _ctx.$attrs), {
  57474. ref_key: "elInputRef",
  57475. ref: elInputRef,
  57476. "model-value": _ctx.modelValue,
  57477. disabled: vue.unref(disabled),
  57478. role: vue.unref(dropdownVisible) ? "combobox" : void 0,
  57479. "aria-activedescendant": vue.unref(dropdownVisible) ? vue.unref(hoveringId) || "" : void 0,
  57480. "aria-controls": vue.unref(dropdownVisible) ? vue.unref(contentId) : void 0,
  57481. "aria-expanded": vue.unref(dropdownVisible) || void 0,
  57482. "aria-label": _ctx.ariaLabel,
  57483. "aria-autocomplete": vue.unref(dropdownVisible) ? "none" : void 0,
  57484. "aria-haspopup": vue.unref(dropdownVisible) ? "listbox" : void 0,
  57485. onInput: handleInputChange,
  57486. onKeydown: handleInputKeyDown,
  57487. onMousedown: handleInputMouseDown
  57488. }), vue.createSlots({
  57489. _: 2
  57490. }, [
  57491. vue.renderList(_ctx.$slots, (_, name) => {
  57492. return {
  57493. name,
  57494. fn: vue.withCtx((slotProps) => [
  57495. vue.renderSlot(_ctx.$slots, name, vue.normalizeProps(vue.guardReactiveProps(slotProps)))
  57496. ])
  57497. };
  57498. })
  57499. ]), 1040, ["model-value", "disabled", "role", "aria-activedescendant", "aria-controls", "aria-expanded", "aria-label", "aria-autocomplete", "aria-haspopup"]),
  57500. vue.createVNode(vue.unref(ElTooltip), {
  57501. ref_key: "tooltipRef",
  57502. ref: tooltipRef,
  57503. visible: vue.unref(dropdownVisible),
  57504. "popper-class": [vue.unref(ns).e("popper"), _ctx.popperClass],
  57505. "popper-options": _ctx.popperOptions,
  57506. placement: vue.unref(computedPlacement),
  57507. "fallback-placements": vue.unref(computedFallbackPlacements),
  57508. effect: "light",
  57509. pure: "",
  57510. offset: _ctx.offset,
  57511. "show-arrow": _ctx.showArrow
  57512. }, {
  57513. default: vue.withCtx(() => [
  57514. vue.createElementVNode("div", {
  57515. style: vue.normalizeStyle(cursorStyle.value)
  57516. }, null, 4)
  57517. ]),
  57518. content: vue.withCtx(() => {
  57519. var _a;
  57520. return [
  57521. vue.createVNode(ElMentionDropdown, {
  57522. ref_key: "dropdownRef",
  57523. ref: dropdownRef,
  57524. options: vue.unref(filteredOptions),
  57525. disabled: vue.unref(disabled),
  57526. loading: _ctx.loading,
  57527. "content-id": vue.unref(contentId),
  57528. "aria-label": _ctx.ariaLabel,
  57529. onSelect: handleSelect,
  57530. onClick: vue.withModifiers((_a = elInputRef.value) == null ? void 0 : _a.focus, ["stop"])
  57531. }, vue.createSlots({
  57532. _: 2
  57533. }, [
  57534. vue.renderList(_ctx.$slots, (_, name) => {
  57535. return {
  57536. name,
  57537. fn: vue.withCtx((slotProps) => [
  57538. vue.renderSlot(_ctx.$slots, name, vue.normalizeProps(vue.guardReactiveProps(slotProps)))
  57539. ])
  57540. };
  57541. })
  57542. ]), 1032, ["options", "disabled", "loading", "content-id", "aria-label", "onClick"])
  57543. ];
  57544. }),
  57545. _: 3
  57546. }, 8, ["visible", "popper-class", "popper-options", "placement", "fallback-placements", "offset", "show-arrow"])
  57547. ], 2);
  57548. };
  57549. }
  57550. });
  57551. var Mention = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__file", "mention.vue"]]);
  57552. const ElMention = withInstall(Mention);
  57553. var Components = [
  57554. ElAffix,
  57555. ElAlert,
  57556. ElAutocomplete,
  57557. ElAutoResizer,
  57558. ElAvatar,
  57559. ElBacktop,
  57560. ElBadge,
  57561. ElBreadcrumb,
  57562. ElBreadcrumbItem,
  57563. ElButton,
  57564. ElButtonGroup$1,
  57565. ElCalendar,
  57566. ElCard,
  57567. ElCarousel,
  57568. ElCarouselItem,
  57569. ElCascader,
  57570. ElCascaderPanel,
  57571. ElCheckTag,
  57572. ElCheckbox,
  57573. ElCheckboxButton,
  57574. ElCheckboxGroup$1,
  57575. ElCol,
  57576. ElCollapse,
  57577. ElCollapseItem,
  57578. ElCollapseTransition,
  57579. ElColorPicker,
  57580. ElConfigProvider,
  57581. ElContainer,
  57582. ElAside,
  57583. ElFooter,
  57584. ElHeader,
  57585. ElMain,
  57586. ElDatePicker,
  57587. ElDescriptions,
  57588. ElDescriptionsItem,
  57589. ElDialog,
  57590. ElDivider,
  57591. ElDrawer,
  57592. ElDropdown,
  57593. ElDropdownItem,
  57594. ElDropdownMenu,
  57595. ElEmpty,
  57596. ElForm,
  57597. ElFormItem,
  57598. ElIcon,
  57599. ElImage,
  57600. ElImageViewer,
  57601. ElInput,
  57602. ElInputNumber,
  57603. ElInputTag,
  57604. ElLink,
  57605. ElMenu,
  57606. ElMenuItem,
  57607. ElMenuItemGroup,
  57608. ElSubMenu,
  57609. ElPageHeader,
  57610. ElPagination,
  57611. ElPopconfirm,
  57612. ElPopover,
  57613. ElPopper,
  57614. ElProgress,
  57615. ElRadio,
  57616. ElRadioButton,
  57617. ElRadioGroup,
  57618. ElRate,
  57619. ElResult,
  57620. ElRow,
  57621. ElScrollbar,
  57622. ElSelect,
  57623. ElOption,
  57624. ElOptionGroup,
  57625. ElSelectV2,
  57626. ElSkeleton,
  57627. ElSkeletonItem,
  57628. ElSlider,
  57629. ElSpace,
  57630. ElStatistic,
  57631. ElCountdown,
  57632. ElSteps,
  57633. ElStep,
  57634. ElSwitch,
  57635. ElTable,
  57636. ElTableColumn,
  57637. ElTableV2,
  57638. ElTabs,
  57639. ElTabPane,
  57640. ElTag,
  57641. ElText,
  57642. ElTimePicker,
  57643. ElTimeSelect,
  57644. ElTimeline,
  57645. ElTimelineItem,
  57646. ElTooltip,
  57647. ElTooltipV2,
  57648. ElTransfer,
  57649. ElTree,
  57650. ElTreeSelect,
  57651. ElTreeV2,
  57652. ElUpload,
  57653. ElWatermark,
  57654. ElTour,
  57655. ElTourStep,
  57656. ElAnchor,
  57657. ElAnchorLink,
  57658. ElSegmented,
  57659. ElMention
  57660. ];
  57661. const SCOPE = "ElInfiniteScroll";
  57662. const CHECK_INTERVAL = 50;
  57663. const DEFAULT_DELAY = 200;
  57664. const DEFAULT_DISTANCE = 0;
  57665. const attributes = {
  57666. delay: {
  57667. type: Number,
  57668. default: DEFAULT_DELAY
  57669. },
  57670. distance: {
  57671. type: Number,
  57672. default: DEFAULT_DISTANCE
  57673. },
  57674. disabled: {
  57675. type: Boolean,
  57676. default: false
  57677. },
  57678. immediate: {
  57679. type: Boolean,
  57680. default: true
  57681. }
  57682. };
  57683. const getScrollOptions = (el, instance) => {
  57684. return Object.entries(attributes).reduce((acm, [name, option]) => {
  57685. var _a, _b;
  57686. const { type, default: defaultValue } = option;
  57687. const attrVal = el.getAttribute(`infinite-scroll-${name}`);
  57688. let value = (_b = (_a = instance[attrVal]) != null ? _a : attrVal) != null ? _b : defaultValue;
  57689. value = value === "false" ? false : value;
  57690. value = type(value);
  57691. acm[name] = Number.isNaN(value) ? defaultValue : value;
  57692. return acm;
  57693. }, {});
  57694. };
  57695. const destroyObserver = (el) => {
  57696. const { observer } = el[SCOPE];
  57697. if (observer) {
  57698. observer.disconnect();
  57699. delete el[SCOPE].observer;
  57700. }
  57701. };
  57702. const handleScroll = (el, cb) => {
  57703. const { container, containerEl, instance, observer, lastScrollTop } = el[SCOPE];
  57704. const { disabled, distance } = getScrollOptions(el, instance);
  57705. const { clientHeight, scrollHeight, scrollTop } = containerEl;
  57706. const delta = scrollTop - lastScrollTop;
  57707. el[SCOPE].lastScrollTop = scrollTop;
  57708. if (observer || disabled || delta < 0)
  57709. return;
  57710. let shouldTrigger = false;
  57711. if (container === el) {
  57712. shouldTrigger = scrollHeight - (clientHeight + scrollTop) <= distance;
  57713. } else {
  57714. const { clientTop, scrollHeight: height } = el;
  57715. const offsetTop = getOffsetTopDistance(el, containerEl);
  57716. shouldTrigger = scrollTop + clientHeight >= offsetTop + clientTop + height - distance;
  57717. }
  57718. if (shouldTrigger) {
  57719. cb.call(instance);
  57720. }
  57721. };
  57722. function checkFull(el, cb) {
  57723. const { containerEl, instance } = el[SCOPE];
  57724. const { disabled } = getScrollOptions(el, instance);
  57725. if (disabled || containerEl.clientHeight === 0)
  57726. return;
  57727. if (containerEl.scrollHeight <= containerEl.clientHeight) {
  57728. cb.call(instance);
  57729. } else {
  57730. destroyObserver(el);
  57731. }
  57732. }
  57733. const InfiniteScroll = {
  57734. async mounted(el, binding) {
  57735. const { instance, value: cb } = binding;
  57736. if (!isFunction$1(cb)) {
  57737. throwError(SCOPE, "'v-infinite-scroll' binding value must be a function");
  57738. }
  57739. await vue.nextTick();
  57740. const { delay, immediate } = getScrollOptions(el, instance);
  57741. const container = getScrollContainer(el, true);
  57742. const containerEl = container === window ? document.documentElement : container;
  57743. const onScroll = throttle(handleScroll.bind(null, el, cb), delay);
  57744. if (!container)
  57745. return;
  57746. el[SCOPE] = {
  57747. instance,
  57748. container,
  57749. containerEl,
  57750. delay,
  57751. cb,
  57752. onScroll,
  57753. lastScrollTop: containerEl.scrollTop
  57754. };
  57755. if (immediate) {
  57756. const observer = new MutationObserver(throttle(checkFull.bind(null, el, cb), CHECK_INTERVAL));
  57757. el[SCOPE].observer = observer;
  57758. observer.observe(el, { childList: true, subtree: true });
  57759. checkFull(el, cb);
  57760. }
  57761. container.addEventListener("scroll", onScroll);
  57762. },
  57763. unmounted(el) {
  57764. if (!el[SCOPE])
  57765. return;
  57766. const { container, onScroll } = el[SCOPE];
  57767. container == null ? void 0 : container.removeEventListener("scroll", onScroll);
  57768. destroyObserver(el);
  57769. },
  57770. async updated(el) {
  57771. if (!el[SCOPE]) {
  57772. await vue.nextTick();
  57773. } else {
  57774. const { containerEl, cb, observer } = el[SCOPE];
  57775. if (containerEl.clientHeight && observer) {
  57776. checkFull(el, cb);
  57777. }
  57778. }
  57779. }
  57780. };
  57781. var InfiniteScroll$1 = InfiniteScroll;
  57782. const _InfiniteScroll = InfiniteScroll$1;
  57783. _InfiniteScroll.install = (app) => {
  57784. app.directive("InfiniteScroll", _InfiniteScroll);
  57785. };
  57786. const ElInfiniteScroll = _InfiniteScroll;
  57787. function createLoadingComponent(options) {
  57788. let afterLeaveTimer;
  57789. const afterLeaveFlag = vue.ref(false);
  57790. const data = vue.reactive({
  57791. ...options,
  57792. originalPosition: "",
  57793. originalOverflow: "",
  57794. visible: false
  57795. });
  57796. function setText(text) {
  57797. data.text = text;
  57798. }
  57799. function destroySelf() {
  57800. const target = data.parent;
  57801. const ns = vm.ns;
  57802. if (!target.vLoadingAddClassList) {
  57803. let loadingNumber = target.getAttribute("loading-number");
  57804. loadingNumber = Number.parseInt(loadingNumber) - 1;
  57805. if (!loadingNumber) {
  57806. removeClass(target, ns.bm("parent", "relative"));
  57807. target.removeAttribute("loading-number");
  57808. } else {
  57809. target.setAttribute("loading-number", loadingNumber.toString());
  57810. }
  57811. removeClass(target, ns.bm("parent", "hidden"));
  57812. }
  57813. removeElLoadingChild();
  57814. loadingInstance.unmount();
  57815. }
  57816. function removeElLoadingChild() {
  57817. var _a, _b;
  57818. (_b = (_a = vm.$el) == null ? void 0 : _a.parentNode) == null ? void 0 : _b.removeChild(vm.$el);
  57819. }
  57820. function close() {
  57821. var _a;
  57822. if (options.beforeClose && !options.beforeClose())
  57823. return;
  57824. afterLeaveFlag.value = true;
  57825. clearTimeout(afterLeaveTimer);
  57826. afterLeaveTimer = setTimeout(handleAfterLeave, 400);
  57827. data.visible = false;
  57828. (_a = options.closed) == null ? void 0 : _a.call(options);
  57829. }
  57830. function handleAfterLeave() {
  57831. if (!afterLeaveFlag.value)
  57832. return;
  57833. const target = data.parent;
  57834. afterLeaveFlag.value = false;
  57835. target.vLoadingAddClassList = void 0;
  57836. destroySelf();
  57837. }
  57838. const elLoadingComponent = vue.defineComponent({
  57839. name: "ElLoading",
  57840. setup(_, { expose }) {
  57841. const { ns, zIndex } = useGlobalComponentSettings("loading");
  57842. expose({
  57843. ns,
  57844. zIndex
  57845. });
  57846. return () => {
  57847. const svg = data.spinner || data.svg;
  57848. const spinner = vue.h("svg", {
  57849. class: "circular",
  57850. viewBox: data.svgViewBox ? data.svgViewBox : "0 0 50 50",
  57851. ...svg ? { innerHTML: svg } : {}
  57852. }, [
  57853. vue.h("circle", {
  57854. class: "path",
  57855. cx: "25",
  57856. cy: "25",
  57857. r: "20",
  57858. fill: "none"
  57859. })
  57860. ]);
  57861. const spinnerText = data.text ? vue.h("p", { class: ns.b("text") }, [data.text]) : void 0;
  57862. return vue.h(vue.Transition, {
  57863. name: ns.b("fade"),
  57864. onAfterLeave: handleAfterLeave
  57865. }, {
  57866. default: vue.withCtx(() => [
  57867. vue.withDirectives(vue.createVNode("div", {
  57868. style: {
  57869. backgroundColor: data.background || ""
  57870. },
  57871. class: [
  57872. ns.b("mask"),
  57873. data.customClass,
  57874. data.fullscreen ? "is-fullscreen" : ""
  57875. ]
  57876. }, [
  57877. vue.h("div", {
  57878. class: ns.b("spinner")
  57879. }, [spinner, spinnerText])
  57880. ]), [[vue.vShow, data.visible]])
  57881. ])
  57882. });
  57883. };
  57884. }
  57885. });
  57886. const loadingInstance = vue.createApp(elLoadingComponent);
  57887. const vm = loadingInstance.mount(document.createElement("div"));
  57888. return {
  57889. ...vue.toRefs(data),
  57890. setText,
  57891. removeElLoadingChild,
  57892. close,
  57893. handleAfterLeave,
  57894. vm,
  57895. get $el() {
  57896. return vm.$el;
  57897. }
  57898. };
  57899. }
  57900. let fullscreenInstance = void 0;
  57901. const Loading = function(options = {}) {
  57902. if (!isClient)
  57903. return void 0;
  57904. const resolved = resolveOptions(options);
  57905. if (resolved.fullscreen && fullscreenInstance) {
  57906. return fullscreenInstance;
  57907. }
  57908. const instance = createLoadingComponent({
  57909. ...resolved,
  57910. closed: () => {
  57911. var _a;
  57912. (_a = resolved.closed) == null ? void 0 : _a.call(resolved);
  57913. if (resolved.fullscreen)
  57914. fullscreenInstance = void 0;
  57915. }
  57916. });
  57917. addStyle(resolved, resolved.parent, instance);
  57918. addClassList(resolved, resolved.parent, instance);
  57919. resolved.parent.vLoadingAddClassList = () => addClassList(resolved, resolved.parent, instance);
  57920. let loadingNumber = resolved.parent.getAttribute("loading-number");
  57921. if (!loadingNumber) {
  57922. loadingNumber = "1";
  57923. } else {
  57924. loadingNumber = `${Number.parseInt(loadingNumber) + 1}`;
  57925. }
  57926. resolved.parent.setAttribute("loading-number", loadingNumber);
  57927. resolved.parent.appendChild(instance.$el);
  57928. vue.nextTick(() => instance.visible.value = resolved.visible);
  57929. if (resolved.fullscreen) {
  57930. fullscreenInstance = instance;
  57931. }
  57932. return instance;
  57933. };
  57934. const resolveOptions = (options) => {
  57935. var _a, _b, _c, _d;
  57936. let target;
  57937. if (isString$1(options.target)) {
  57938. target = (_a = document.querySelector(options.target)) != null ? _a : document.body;
  57939. } else {
  57940. target = options.target || document.body;
  57941. }
  57942. return {
  57943. parent: target === document.body || options.body ? document.body : target,
  57944. background: options.background || "",
  57945. svg: options.svg || "",
  57946. svgViewBox: options.svgViewBox || "",
  57947. spinner: options.spinner || false,
  57948. text: options.text || "",
  57949. fullscreen: target === document.body && ((_b = options.fullscreen) != null ? _b : true),
  57950. lock: (_c = options.lock) != null ? _c : false,
  57951. customClass: options.customClass || "",
  57952. visible: (_d = options.visible) != null ? _d : true,
  57953. beforeClose: options.beforeClose,
  57954. closed: options.closed,
  57955. target
  57956. };
  57957. };
  57958. const addStyle = async (options, parent, instance) => {
  57959. const { nextZIndex } = instance.vm.zIndex || instance.vm._.exposed.zIndex;
  57960. const maskStyle = {};
  57961. if (options.fullscreen) {
  57962. instance.originalPosition.value = getStyle(document.body, "position");
  57963. instance.originalOverflow.value = getStyle(document.body, "overflow");
  57964. maskStyle.zIndex = nextZIndex();
  57965. } else if (options.parent === document.body) {
  57966. instance.originalPosition.value = getStyle(document.body, "position");
  57967. await vue.nextTick();
  57968. for (const property of ["top", "left"]) {
  57969. const scroll = property === "top" ? "scrollTop" : "scrollLeft";
  57970. maskStyle[property] = `${options.target.getBoundingClientRect()[property] + document.body[scroll] + document.documentElement[scroll] - Number.parseInt(getStyle(document.body, `margin-${property}`), 10)}px`;
  57971. }
  57972. for (const property of ["height", "width"]) {
  57973. maskStyle[property] = `${options.target.getBoundingClientRect()[property]}px`;
  57974. }
  57975. } else {
  57976. instance.originalPosition.value = getStyle(parent, "position");
  57977. }
  57978. for (const [key, value] of Object.entries(maskStyle)) {
  57979. instance.$el.style[key] = value;
  57980. }
  57981. };
  57982. const addClassList = (options, parent, instance) => {
  57983. const ns = instance.vm.ns || instance.vm._.exposed.ns;
  57984. if (!["absolute", "fixed", "sticky"].includes(instance.originalPosition.value)) {
  57985. addClass(parent, ns.bm("parent", "relative"));
  57986. } else {
  57987. removeClass(parent, ns.bm("parent", "relative"));
  57988. }
  57989. if (options.fullscreen && options.lock) {
  57990. addClass(parent, ns.bm("parent", "hidden"));
  57991. } else {
  57992. removeClass(parent, ns.bm("parent", "hidden"));
  57993. }
  57994. };
  57995. const INSTANCE_KEY = Symbol("ElLoading");
  57996. const createInstance = (el, binding) => {
  57997. var _a, _b, _c, _d;
  57998. const vm = binding.instance;
  57999. const getBindingProp = (key) => isObject$1(binding.value) ? binding.value[key] : void 0;
  58000. const resolveExpression = (key) => {
  58001. const data = isString$1(key) && (vm == null ? void 0 : vm[key]) || key;
  58002. if (data)
  58003. return vue.ref(data);
  58004. else
  58005. return data;
  58006. };
  58007. const getProp = (name) => resolveExpression(getBindingProp(name) || el.getAttribute(`element-loading-${hyphenate(name)}`));
  58008. const fullscreen = (_a = getBindingProp("fullscreen")) != null ? _a : binding.modifiers.fullscreen;
  58009. const options = {
  58010. text: getProp("text"),
  58011. svg: getProp("svg"),
  58012. svgViewBox: getProp("svgViewBox"),
  58013. spinner: getProp("spinner"),
  58014. background: getProp("background"),
  58015. customClass: getProp("customClass"),
  58016. fullscreen,
  58017. target: (_b = getBindingProp("target")) != null ? _b : fullscreen ? void 0 : el,
  58018. body: (_c = getBindingProp("body")) != null ? _c : binding.modifiers.body,
  58019. lock: (_d = getBindingProp("lock")) != null ? _d : binding.modifiers.lock
  58020. };
  58021. el[INSTANCE_KEY] = {
  58022. options,
  58023. instance: Loading(options)
  58024. };
  58025. };
  58026. const updateOptions = (newOptions, originalOptions) => {
  58027. for (const key of Object.keys(originalOptions)) {
  58028. if (vue.isRef(originalOptions[key]))
  58029. originalOptions[key].value = newOptions[key];
  58030. }
  58031. };
  58032. const vLoading = {
  58033. mounted(el, binding) {
  58034. if (binding.value) {
  58035. createInstance(el, binding);
  58036. }
  58037. },
  58038. updated(el, binding) {
  58039. const instance = el[INSTANCE_KEY];
  58040. if (binding.oldValue !== binding.value) {
  58041. if (binding.value && !binding.oldValue) {
  58042. createInstance(el, binding);
  58043. } else if (binding.value && binding.oldValue) {
  58044. if (isObject$1(binding.value))
  58045. updateOptions(binding.value, instance.options);
  58046. } else {
  58047. instance == null ? void 0 : instance.instance.close();
  58048. }
  58049. }
  58050. },
  58051. unmounted(el) {
  58052. var _a;
  58053. (_a = el[INSTANCE_KEY]) == null ? void 0 : _a.instance.close();
  58054. el[INSTANCE_KEY] = null;
  58055. }
  58056. };
  58057. const ElLoading = {
  58058. install(app) {
  58059. app.directive("loading", vLoading);
  58060. app.config.globalProperties.$loading = Loading;
  58061. },
  58062. directive: vLoading,
  58063. service: Loading
  58064. };
  58065. const messageTypes = ["success", "info", "warning", "error"];
  58066. const messageDefaults = mutable({
  58067. customClass: "",
  58068. center: false,
  58069. dangerouslyUseHTMLString: false,
  58070. duration: 3e3,
  58071. icon: void 0,
  58072. id: "",
  58073. message: "",
  58074. onClose: void 0,
  58075. showClose: false,
  58076. type: "info",
  58077. plain: false,
  58078. offset: 16,
  58079. zIndex: 0,
  58080. grouping: false,
  58081. repeatNum: 1,
  58082. appendTo: isClient ? document.body : void 0
  58083. });
  58084. const messageProps = buildProps({
  58085. customClass: {
  58086. type: String,
  58087. default: messageDefaults.customClass
  58088. },
  58089. center: {
  58090. type: Boolean,
  58091. default: messageDefaults.center
  58092. },
  58093. dangerouslyUseHTMLString: {
  58094. type: Boolean,
  58095. default: messageDefaults.dangerouslyUseHTMLString
  58096. },
  58097. duration: {
  58098. type: Number,
  58099. default: messageDefaults.duration
  58100. },
  58101. icon: {
  58102. type: iconPropType,
  58103. default: messageDefaults.icon
  58104. },
  58105. id: {
  58106. type: String,
  58107. default: messageDefaults.id
  58108. },
  58109. message: {
  58110. type: definePropType([
  58111. String,
  58112. Object,
  58113. Function
  58114. ]),
  58115. default: messageDefaults.message
  58116. },
  58117. onClose: {
  58118. type: definePropType(Function),
  58119. default: messageDefaults.onClose
  58120. },
  58121. showClose: {
  58122. type: Boolean,
  58123. default: messageDefaults.showClose
  58124. },
  58125. type: {
  58126. type: String,
  58127. values: messageTypes,
  58128. default: messageDefaults.type
  58129. },
  58130. plain: {
  58131. type: Boolean,
  58132. default: messageDefaults.plain
  58133. },
  58134. offset: {
  58135. type: Number,
  58136. default: messageDefaults.offset
  58137. },
  58138. zIndex: {
  58139. type: Number,
  58140. default: messageDefaults.zIndex
  58141. },
  58142. grouping: {
  58143. type: Boolean,
  58144. default: messageDefaults.grouping
  58145. },
  58146. repeatNum: {
  58147. type: Number,
  58148. default: messageDefaults.repeatNum
  58149. }
  58150. });
  58151. const messageEmits = {
  58152. destroy: () => true
  58153. };
  58154. const instances = vue.shallowReactive([]);
  58155. const getInstance = (id) => {
  58156. const idx = instances.findIndex((instance) => instance.id === id);
  58157. const current = instances[idx];
  58158. let prev;
  58159. if (idx > 0) {
  58160. prev = instances[idx - 1];
  58161. }
  58162. return { current, prev };
  58163. };
  58164. const getLastOffset = (id) => {
  58165. const { prev } = getInstance(id);
  58166. if (!prev)
  58167. return 0;
  58168. return prev.vm.exposed.bottom.value;
  58169. };
  58170. const getOffsetOrSpace = (id, offset) => {
  58171. const idx = instances.findIndex((instance) => instance.id === id);
  58172. return idx > 0 ? 16 : offset;
  58173. };
  58174. const __default__$1 = vue.defineComponent({
  58175. name: "ElMessage"
  58176. });
  58177. const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
  58178. ...__default__$1,
  58179. props: messageProps,
  58180. emits: messageEmits,
  58181. setup(__props, { expose }) {
  58182. const props = __props;
  58183. const { Close } = TypeComponents;
  58184. const { ns, zIndex } = useGlobalComponentSettings("message");
  58185. const { currentZIndex, nextZIndex } = zIndex;
  58186. const messageRef = vue.ref();
  58187. const visible = vue.ref(false);
  58188. const height = vue.ref(0);
  58189. let stopTimer = void 0;
  58190. const badgeType = vue.computed(() => props.type ? props.type === "error" ? "danger" : props.type : "info");
  58191. const typeClass = vue.computed(() => {
  58192. const type = props.type;
  58193. return { [ns.bm("icon", type)]: type && TypeComponentsMap[type] };
  58194. });
  58195. const iconComponent = vue.computed(() => props.icon || TypeComponentsMap[props.type] || "");
  58196. const lastOffset = vue.computed(() => getLastOffset(props.id));
  58197. const offset = vue.computed(() => getOffsetOrSpace(props.id, props.offset) + lastOffset.value);
  58198. const bottom = vue.computed(() => height.value + offset.value);
  58199. const customStyle = vue.computed(() => ({
  58200. top: `${offset.value}px`,
  58201. zIndex: currentZIndex.value
  58202. }));
  58203. function startTimer() {
  58204. if (props.duration === 0)
  58205. return;
  58206. ({ stop: stopTimer } = useTimeoutFn(() => {
  58207. close();
  58208. }, props.duration));
  58209. }
  58210. function clearTimer() {
  58211. stopTimer == null ? void 0 : stopTimer();
  58212. }
  58213. function close() {
  58214. visible.value = false;
  58215. }
  58216. function keydown({ code }) {
  58217. if (code === EVENT_CODE.esc) {
  58218. close();
  58219. }
  58220. }
  58221. vue.onMounted(() => {
  58222. startTimer();
  58223. nextZIndex();
  58224. visible.value = true;
  58225. });
  58226. vue.watch(() => props.repeatNum, () => {
  58227. clearTimer();
  58228. startTimer();
  58229. });
  58230. useEventListener(document, "keydown", keydown);
  58231. useResizeObserver(messageRef, () => {
  58232. height.value = messageRef.value.getBoundingClientRect().height;
  58233. });
  58234. expose({
  58235. visible,
  58236. bottom,
  58237. close
  58238. });
  58239. return (_ctx, _cache) => {
  58240. return vue.openBlock(), vue.createBlock(vue.Transition, {
  58241. name: vue.unref(ns).b("fade"),
  58242. onBeforeLeave: _ctx.onClose,
  58243. onAfterLeave: ($event) => _ctx.$emit("destroy"),
  58244. persisted: ""
  58245. }, {
  58246. default: vue.withCtx(() => [
  58247. vue.withDirectives(vue.createElementVNode("div", {
  58248. id: _ctx.id,
  58249. ref_key: "messageRef",
  58250. ref: messageRef,
  58251. class: vue.normalizeClass([
  58252. vue.unref(ns).b(),
  58253. { [vue.unref(ns).m(_ctx.type)]: _ctx.type },
  58254. vue.unref(ns).is("center", _ctx.center),
  58255. vue.unref(ns).is("closable", _ctx.showClose),
  58256. vue.unref(ns).is("plain", _ctx.plain),
  58257. _ctx.customClass
  58258. ]),
  58259. style: vue.normalizeStyle(vue.unref(customStyle)),
  58260. role: "alert",
  58261. onMouseenter: clearTimer,
  58262. onMouseleave: startTimer
  58263. }, [
  58264. _ctx.repeatNum > 1 ? (vue.openBlock(), vue.createBlock(vue.unref(ElBadge), {
  58265. key: 0,
  58266. value: _ctx.repeatNum,
  58267. type: vue.unref(badgeType),
  58268. class: vue.normalizeClass(vue.unref(ns).e("badge"))
  58269. }, null, 8, ["value", "type", "class"])) : vue.createCommentVNode("v-if", true),
  58270. vue.unref(iconComponent) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  58271. key: 1,
  58272. class: vue.normalizeClass([vue.unref(ns).e("icon"), vue.unref(typeClass)])
  58273. }, {
  58274. default: vue.withCtx(() => [
  58275. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(iconComponent))))
  58276. ]),
  58277. _: 1
  58278. }, 8, ["class"])) : vue.createCommentVNode("v-if", true),
  58279. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  58280. !_ctx.dangerouslyUseHTMLString ? (vue.openBlock(), vue.createElementBlock("p", {
  58281. key: 0,
  58282. class: vue.normalizeClass(vue.unref(ns).e("content"))
  58283. }, vue.toDisplayString(_ctx.message), 3)) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  58284. vue.createCommentVNode(" Caution here, message could've been compromised, never use user's input as message "),
  58285. vue.createElementVNode("p", {
  58286. class: vue.normalizeClass(vue.unref(ns).e("content")),
  58287. innerHTML: _ctx.message
  58288. }, null, 10, ["innerHTML"])
  58289. ], 2112))
  58290. ]),
  58291. _ctx.showClose ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  58292. key: 2,
  58293. class: vue.normalizeClass(vue.unref(ns).e("closeBtn")),
  58294. onClick: vue.withModifiers(close, ["stop"])
  58295. }, {
  58296. default: vue.withCtx(() => [
  58297. vue.createVNode(vue.unref(Close))
  58298. ]),
  58299. _: 1
  58300. }, 8, ["class", "onClick"])) : vue.createCommentVNode("v-if", true)
  58301. ], 46, ["id"]), [
  58302. [vue.vShow, visible.value]
  58303. ])
  58304. ]),
  58305. _: 3
  58306. }, 8, ["name", "onBeforeLeave", "onAfterLeave"]);
  58307. };
  58308. }
  58309. });
  58310. var MessageConstructor = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__file", "message.vue"]]);
  58311. let seed$1 = 1;
  58312. const normalizeOptions = (params) => {
  58313. const options = !params || isString$1(params) || vue.isVNode(params) || isFunction$1(params) ? { message: params } : params;
  58314. const normalized = {
  58315. ...messageDefaults,
  58316. ...options
  58317. };
  58318. if (!normalized.appendTo) {
  58319. normalized.appendTo = document.body;
  58320. } else if (isString$1(normalized.appendTo)) {
  58321. let appendTo = document.querySelector(normalized.appendTo);
  58322. if (!isElement$1(appendTo)) {
  58323. appendTo = document.body;
  58324. }
  58325. normalized.appendTo = appendTo;
  58326. }
  58327. if (isBoolean(messageConfig.grouping) && !normalized.grouping) {
  58328. normalized.grouping = messageConfig.grouping;
  58329. }
  58330. if (isNumber(messageConfig.duration) && normalized.duration === 3e3) {
  58331. normalized.duration = messageConfig.duration;
  58332. }
  58333. if (isNumber(messageConfig.offset) && normalized.offset === 16) {
  58334. normalized.offset = messageConfig.offset;
  58335. }
  58336. if (isBoolean(messageConfig.showClose) && !normalized.showClose) {
  58337. normalized.showClose = messageConfig.showClose;
  58338. }
  58339. return normalized;
  58340. };
  58341. const closeMessage = (instance) => {
  58342. const idx = instances.indexOf(instance);
  58343. if (idx === -1)
  58344. return;
  58345. instances.splice(idx, 1);
  58346. const { handler } = instance;
  58347. handler.close();
  58348. };
  58349. const createMessage = ({ appendTo, ...options }, context) => {
  58350. const id = `message_${seed$1++}`;
  58351. const userOnClose = options.onClose;
  58352. const container = document.createElement("div");
  58353. const props = {
  58354. ...options,
  58355. id,
  58356. onClose: () => {
  58357. userOnClose == null ? void 0 : userOnClose();
  58358. closeMessage(instance);
  58359. },
  58360. onDestroy: () => {
  58361. vue.render(null, container);
  58362. }
  58363. };
  58364. const vnode = vue.createVNode(MessageConstructor, props, isFunction$1(props.message) || vue.isVNode(props.message) ? {
  58365. default: isFunction$1(props.message) ? props.message : () => props.message
  58366. } : null);
  58367. vnode.appContext = context || message._context;
  58368. vue.render(vnode, container);
  58369. appendTo.appendChild(container.firstElementChild);
  58370. const vm = vnode.component;
  58371. const handler = {
  58372. close: () => {
  58373. vm.exposed.visible.value = false;
  58374. }
  58375. };
  58376. const instance = {
  58377. id,
  58378. vnode,
  58379. vm,
  58380. handler,
  58381. props: vnode.component.props
  58382. };
  58383. return instance;
  58384. };
  58385. const message = (options = {}, context) => {
  58386. if (!isClient)
  58387. return { close: () => void 0 };
  58388. const normalized = normalizeOptions(options);
  58389. if (normalized.grouping && instances.length) {
  58390. const instance2 = instances.find(({ vnode: vm }) => {
  58391. var _a;
  58392. return ((_a = vm.props) == null ? void 0 : _a.message) === normalized.message;
  58393. });
  58394. if (instance2) {
  58395. instance2.props.repeatNum += 1;
  58396. instance2.props.type = normalized.type;
  58397. return instance2.handler;
  58398. }
  58399. }
  58400. if (isNumber(messageConfig.max) && instances.length >= messageConfig.max) {
  58401. return { close: () => void 0 };
  58402. }
  58403. const instance = createMessage(normalized, context);
  58404. instances.push(instance);
  58405. return instance.handler;
  58406. };
  58407. messageTypes.forEach((type) => {
  58408. message[type] = (options = {}, appContext) => {
  58409. const normalized = normalizeOptions(options);
  58410. return message({ ...normalized, type }, appContext);
  58411. };
  58412. });
  58413. function closeAll$1(type) {
  58414. for (const instance of instances) {
  58415. if (!type || type === instance.props.type) {
  58416. instance.handler.close();
  58417. }
  58418. }
  58419. }
  58420. message.closeAll = closeAll$1;
  58421. message._context = null;
  58422. var Message = message;
  58423. const ElMessage = withInstallFunction(Message, "$message");
  58424. const _sfc_main$1 = vue.defineComponent({
  58425. name: "ElMessageBox",
  58426. directives: {
  58427. TrapFocus
  58428. },
  58429. components: {
  58430. ElButton,
  58431. ElFocusTrap,
  58432. ElInput,
  58433. ElOverlay,
  58434. ElIcon,
  58435. ...TypeComponents
  58436. },
  58437. inheritAttrs: false,
  58438. props: {
  58439. buttonSize: {
  58440. type: String,
  58441. validator: isValidComponentSize
  58442. },
  58443. modal: {
  58444. type: Boolean,
  58445. default: true
  58446. },
  58447. lockScroll: {
  58448. type: Boolean,
  58449. default: true
  58450. },
  58451. showClose: {
  58452. type: Boolean,
  58453. default: true
  58454. },
  58455. closeOnClickModal: {
  58456. type: Boolean,
  58457. default: true
  58458. },
  58459. closeOnPressEscape: {
  58460. type: Boolean,
  58461. default: true
  58462. },
  58463. closeOnHashChange: {
  58464. type: Boolean,
  58465. default: true
  58466. },
  58467. center: Boolean,
  58468. draggable: Boolean,
  58469. overflow: Boolean,
  58470. roundButton: {
  58471. default: false,
  58472. type: Boolean
  58473. },
  58474. container: {
  58475. type: String,
  58476. default: "body"
  58477. },
  58478. boxType: {
  58479. type: String,
  58480. default: ""
  58481. }
  58482. },
  58483. emits: ["vanish", "action"],
  58484. setup(props, { emit }) {
  58485. const {
  58486. locale,
  58487. zIndex,
  58488. ns,
  58489. size: btnSize
  58490. } = useGlobalComponentSettings("message-box", vue.computed(() => props.buttonSize));
  58491. const { t } = locale;
  58492. const { nextZIndex } = zIndex;
  58493. const visible = vue.ref(false);
  58494. const state = vue.reactive({
  58495. autofocus: true,
  58496. beforeClose: null,
  58497. callback: null,
  58498. cancelButtonText: "",
  58499. cancelButtonClass: "",
  58500. confirmButtonText: "",
  58501. confirmButtonClass: "",
  58502. customClass: "",
  58503. customStyle: {},
  58504. dangerouslyUseHTMLString: false,
  58505. distinguishCancelAndClose: false,
  58506. icon: "",
  58507. inputPattern: null,
  58508. inputPlaceholder: "",
  58509. inputType: "text",
  58510. inputValue: null,
  58511. inputValidator: null,
  58512. inputErrorMessage: "",
  58513. message: null,
  58514. modalFade: true,
  58515. modalClass: "",
  58516. showCancelButton: false,
  58517. showConfirmButton: true,
  58518. type: "",
  58519. title: void 0,
  58520. showInput: false,
  58521. action: "",
  58522. confirmButtonLoading: false,
  58523. cancelButtonLoading: false,
  58524. confirmButtonLoadingIcon: vue.markRaw(loading_default),
  58525. cancelButtonLoadingIcon: vue.markRaw(loading_default),
  58526. confirmButtonDisabled: false,
  58527. editorErrorMessage: "",
  58528. validateError: false,
  58529. zIndex: nextZIndex()
  58530. });
  58531. const typeClass = vue.computed(() => {
  58532. const type = state.type;
  58533. return { [ns.bm("icon", type)]: type && TypeComponentsMap[type] };
  58534. });
  58535. const contentId = useId();
  58536. const inputId = useId();
  58537. const iconComponent = vue.computed(() => state.icon || TypeComponentsMap[state.type] || "");
  58538. const hasMessage = vue.computed(() => !!state.message);
  58539. const rootRef = vue.ref();
  58540. const headerRef = vue.ref();
  58541. const focusStartRef = vue.ref();
  58542. const inputRef = vue.ref();
  58543. const confirmRef = vue.ref();
  58544. const confirmButtonClasses = vue.computed(() => state.confirmButtonClass);
  58545. vue.watch(() => state.inputValue, async (val) => {
  58546. await vue.nextTick();
  58547. if (props.boxType === "prompt" && val !== null) {
  58548. validate();
  58549. }
  58550. }, { immediate: true });
  58551. vue.watch(() => visible.value, (val) => {
  58552. var _a, _b;
  58553. if (val) {
  58554. if (props.boxType !== "prompt") {
  58555. if (state.autofocus) {
  58556. focusStartRef.value = (_b = (_a = confirmRef.value) == null ? void 0 : _a.$el) != null ? _b : rootRef.value;
  58557. } else {
  58558. focusStartRef.value = rootRef.value;
  58559. }
  58560. }
  58561. state.zIndex = nextZIndex();
  58562. }
  58563. if (props.boxType !== "prompt")
  58564. return;
  58565. if (val) {
  58566. vue.nextTick().then(() => {
  58567. var _a2;
  58568. if (inputRef.value && inputRef.value.$el) {
  58569. if (state.autofocus) {
  58570. focusStartRef.value = (_a2 = getInputElement()) != null ? _a2 : rootRef.value;
  58571. } else {
  58572. focusStartRef.value = rootRef.value;
  58573. }
  58574. }
  58575. });
  58576. } else {
  58577. state.editorErrorMessage = "";
  58578. state.validateError = false;
  58579. }
  58580. });
  58581. const draggable = vue.computed(() => props.draggable);
  58582. const overflow = vue.computed(() => props.overflow);
  58583. useDraggable(rootRef, headerRef, draggable, overflow);
  58584. vue.onMounted(async () => {
  58585. await vue.nextTick();
  58586. if (props.closeOnHashChange) {
  58587. window.addEventListener("hashchange", doClose);
  58588. }
  58589. });
  58590. vue.onBeforeUnmount(() => {
  58591. if (props.closeOnHashChange) {
  58592. window.removeEventListener("hashchange", doClose);
  58593. }
  58594. });
  58595. function doClose() {
  58596. if (!visible.value)
  58597. return;
  58598. visible.value = false;
  58599. vue.nextTick(() => {
  58600. if (state.action)
  58601. emit("action", state.action);
  58602. });
  58603. }
  58604. const handleWrapperClick = () => {
  58605. if (props.closeOnClickModal) {
  58606. handleAction(state.distinguishCancelAndClose ? "close" : "cancel");
  58607. }
  58608. };
  58609. const overlayEvent = useSameTarget(handleWrapperClick);
  58610. const handleInputEnter = (e) => {
  58611. if (state.inputType !== "textarea") {
  58612. e.preventDefault();
  58613. return handleAction("confirm");
  58614. }
  58615. };
  58616. const handleAction = (action) => {
  58617. var _a;
  58618. if (props.boxType === "prompt" && action === "confirm" && !validate()) {
  58619. return;
  58620. }
  58621. state.action = action;
  58622. if (state.beforeClose) {
  58623. (_a = state.beforeClose) == null ? void 0 : _a.call(state, action, state, doClose);
  58624. } else {
  58625. doClose();
  58626. }
  58627. };
  58628. const validate = () => {
  58629. if (props.boxType === "prompt") {
  58630. const inputPattern = state.inputPattern;
  58631. if (inputPattern && !inputPattern.test(state.inputValue || "")) {
  58632. state.editorErrorMessage = state.inputErrorMessage || t("el.messagebox.error");
  58633. state.validateError = true;
  58634. return false;
  58635. }
  58636. const inputValidator = state.inputValidator;
  58637. if (isFunction$1(inputValidator)) {
  58638. const validateResult = inputValidator(state.inputValue);
  58639. if (validateResult === false) {
  58640. state.editorErrorMessage = state.inputErrorMessage || t("el.messagebox.error");
  58641. state.validateError = true;
  58642. return false;
  58643. }
  58644. if (isString$1(validateResult)) {
  58645. state.editorErrorMessage = validateResult;
  58646. state.validateError = true;
  58647. return false;
  58648. }
  58649. }
  58650. }
  58651. state.editorErrorMessage = "";
  58652. state.validateError = false;
  58653. return true;
  58654. };
  58655. const getInputElement = () => {
  58656. const inputRefs = inputRef.value.$refs;
  58657. return inputRefs.input || inputRefs.textarea;
  58658. };
  58659. const handleClose = () => {
  58660. handleAction("close");
  58661. };
  58662. const onCloseRequested = () => {
  58663. if (props.closeOnPressEscape) {
  58664. handleClose();
  58665. }
  58666. };
  58667. if (props.lockScroll) {
  58668. useLockscreen(visible);
  58669. }
  58670. return {
  58671. ...vue.toRefs(state),
  58672. ns,
  58673. overlayEvent,
  58674. visible,
  58675. hasMessage,
  58676. typeClass,
  58677. contentId,
  58678. inputId,
  58679. btnSize,
  58680. iconComponent,
  58681. confirmButtonClasses,
  58682. rootRef,
  58683. focusStartRef,
  58684. headerRef,
  58685. inputRef,
  58686. confirmRef,
  58687. doClose,
  58688. handleClose,
  58689. onCloseRequested,
  58690. handleWrapperClick,
  58691. handleInputEnter,
  58692. handleAction,
  58693. t
  58694. };
  58695. }
  58696. });
  58697. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  58698. const _component_el_icon = vue.resolveComponent("el-icon");
  58699. const _component_close = vue.resolveComponent("close");
  58700. const _component_el_input = vue.resolveComponent("el-input");
  58701. const _component_el_button = vue.resolveComponent("el-button");
  58702. const _component_el_focus_trap = vue.resolveComponent("el-focus-trap");
  58703. const _component_el_overlay = vue.resolveComponent("el-overlay");
  58704. return vue.openBlock(), vue.createBlock(vue.Transition, {
  58705. name: "fade-in-linear",
  58706. onAfterLeave: ($event) => _ctx.$emit("vanish"),
  58707. persisted: ""
  58708. }, {
  58709. default: vue.withCtx(() => [
  58710. vue.withDirectives(vue.createVNode(_component_el_overlay, {
  58711. "z-index": _ctx.zIndex,
  58712. "overlay-class": [_ctx.ns.is("message-box"), _ctx.modalClass],
  58713. mask: _ctx.modal
  58714. }, {
  58715. default: vue.withCtx(() => [
  58716. vue.createElementVNode("div", {
  58717. role: "dialog",
  58718. "aria-label": _ctx.title,
  58719. "aria-modal": "true",
  58720. "aria-describedby": !_ctx.showInput ? _ctx.contentId : void 0,
  58721. class: vue.normalizeClass(`${_ctx.ns.namespace.value}-overlay-message-box`),
  58722. onClick: _ctx.overlayEvent.onClick,
  58723. onMousedown: _ctx.overlayEvent.onMousedown,
  58724. onMouseup: _ctx.overlayEvent.onMouseup
  58725. }, [
  58726. vue.createVNode(_component_el_focus_trap, {
  58727. loop: "",
  58728. trapped: _ctx.visible,
  58729. "focus-trap-el": _ctx.rootRef,
  58730. "focus-start-el": _ctx.focusStartRef,
  58731. onReleaseRequested: _ctx.onCloseRequested
  58732. }, {
  58733. default: vue.withCtx(() => [
  58734. vue.createElementVNode("div", {
  58735. ref: "rootRef",
  58736. class: vue.normalizeClass([
  58737. _ctx.ns.b(),
  58738. _ctx.customClass,
  58739. _ctx.ns.is("draggable", _ctx.draggable),
  58740. { [_ctx.ns.m("center")]: _ctx.center }
  58741. ]),
  58742. style: vue.normalizeStyle(_ctx.customStyle),
  58743. tabindex: "-1",
  58744. onClick: vue.withModifiers(() => {
  58745. }, ["stop"])
  58746. }, [
  58747. _ctx.title !== null && _ctx.title !== void 0 ? (vue.openBlock(), vue.createElementBlock("div", {
  58748. key: 0,
  58749. ref: "headerRef",
  58750. class: vue.normalizeClass([_ctx.ns.e("header"), { "show-close": _ctx.showClose }])
  58751. }, [
  58752. vue.createElementVNode("div", {
  58753. class: vue.normalizeClass(_ctx.ns.e("title"))
  58754. }, [
  58755. _ctx.iconComponent && _ctx.center ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
  58756. key: 0,
  58757. class: vue.normalizeClass([_ctx.ns.e("status"), _ctx.typeClass])
  58758. }, {
  58759. default: vue.withCtx(() => [
  58760. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.iconComponent)))
  58761. ]),
  58762. _: 1
  58763. }, 8, ["class"])) : vue.createCommentVNode("v-if", true),
  58764. vue.createElementVNode("span", null, vue.toDisplayString(_ctx.title), 1)
  58765. ], 2),
  58766. _ctx.showClose ? (vue.openBlock(), vue.createElementBlock("button", {
  58767. key: 0,
  58768. type: "button",
  58769. class: vue.normalizeClass(_ctx.ns.e("headerbtn")),
  58770. "aria-label": _ctx.t("el.messagebox.close"),
  58771. onClick: ($event) => _ctx.handleAction(_ctx.distinguishCancelAndClose ? "close" : "cancel"),
  58772. onKeydown: vue.withKeys(vue.withModifiers(($event) => _ctx.handleAction(_ctx.distinguishCancelAndClose ? "close" : "cancel"), ["prevent"]), ["enter"])
  58773. }, [
  58774. vue.createVNode(_component_el_icon, {
  58775. class: vue.normalizeClass(_ctx.ns.e("close"))
  58776. }, {
  58777. default: vue.withCtx(() => [
  58778. vue.createVNode(_component_close)
  58779. ]),
  58780. _: 1
  58781. }, 8, ["class"])
  58782. ], 42, ["aria-label", "onClick", "onKeydown"])) : vue.createCommentVNode("v-if", true)
  58783. ], 2)) : vue.createCommentVNode("v-if", true),
  58784. vue.createElementVNode("div", {
  58785. id: _ctx.contentId,
  58786. class: vue.normalizeClass(_ctx.ns.e("content"))
  58787. }, [
  58788. vue.createElementVNode("div", {
  58789. class: vue.normalizeClass(_ctx.ns.e("container"))
  58790. }, [
  58791. _ctx.iconComponent && !_ctx.center && _ctx.hasMessage ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
  58792. key: 0,
  58793. class: vue.normalizeClass([_ctx.ns.e("status"), _ctx.typeClass])
  58794. }, {
  58795. default: vue.withCtx(() => [
  58796. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.iconComponent)))
  58797. ]),
  58798. _: 1
  58799. }, 8, ["class"])) : vue.createCommentVNode("v-if", true),
  58800. _ctx.hasMessage ? (vue.openBlock(), vue.createElementBlock("div", {
  58801. key: 1,
  58802. class: vue.normalizeClass(_ctx.ns.e("message"))
  58803. }, [
  58804. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  58805. !_ctx.dangerouslyUseHTMLString ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.showInput ? "label" : "p"), {
  58806. key: 0,
  58807. for: _ctx.showInput ? _ctx.inputId : void 0
  58808. }, {
  58809. default: vue.withCtx(() => [
  58810. vue.createTextVNode(vue.toDisplayString(!_ctx.dangerouslyUseHTMLString ? _ctx.message : ""), 1)
  58811. ]),
  58812. _: 1
  58813. }, 8, ["for"])) : (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.showInput ? "label" : "p"), {
  58814. key: 1,
  58815. for: _ctx.showInput ? _ctx.inputId : void 0,
  58816. innerHTML: _ctx.message
  58817. }, null, 8, ["for", "innerHTML"]))
  58818. ])
  58819. ], 2)) : vue.createCommentVNode("v-if", true)
  58820. ], 2),
  58821. vue.withDirectives(vue.createElementVNode("div", {
  58822. class: vue.normalizeClass(_ctx.ns.e("input"))
  58823. }, [
  58824. vue.createVNode(_component_el_input, {
  58825. id: _ctx.inputId,
  58826. ref: "inputRef",
  58827. modelValue: _ctx.inputValue,
  58828. "onUpdate:modelValue": ($event) => _ctx.inputValue = $event,
  58829. type: _ctx.inputType,
  58830. placeholder: _ctx.inputPlaceholder,
  58831. "aria-invalid": _ctx.validateError,
  58832. class: vue.normalizeClass({ invalid: _ctx.validateError }),
  58833. onKeydown: vue.withKeys(_ctx.handleInputEnter, ["enter"])
  58834. }, null, 8, ["id", "modelValue", "onUpdate:modelValue", "type", "placeholder", "aria-invalid", "class", "onKeydown"]),
  58835. vue.createElementVNode("div", {
  58836. class: vue.normalizeClass(_ctx.ns.e("errormsg")),
  58837. style: vue.normalizeStyle({
  58838. visibility: !!_ctx.editorErrorMessage ? "visible" : "hidden"
  58839. })
  58840. }, vue.toDisplayString(_ctx.editorErrorMessage), 7)
  58841. ], 2), [
  58842. [vue.vShow, _ctx.showInput]
  58843. ])
  58844. ], 10, ["id"]),
  58845. vue.createElementVNode("div", {
  58846. class: vue.normalizeClass(_ctx.ns.e("btns"))
  58847. }, [
  58848. _ctx.showCancelButton ? (vue.openBlock(), vue.createBlock(_component_el_button, {
  58849. key: 0,
  58850. loading: _ctx.cancelButtonLoading,
  58851. "loading-icon": _ctx.cancelButtonLoadingIcon,
  58852. class: vue.normalizeClass([_ctx.cancelButtonClass]),
  58853. round: _ctx.roundButton,
  58854. size: _ctx.btnSize,
  58855. onClick: ($event) => _ctx.handleAction("cancel"),
  58856. onKeydown: vue.withKeys(vue.withModifiers(($event) => _ctx.handleAction("cancel"), ["prevent"]), ["enter"])
  58857. }, {
  58858. default: vue.withCtx(() => [
  58859. vue.createTextVNode(vue.toDisplayString(_ctx.cancelButtonText || _ctx.t("el.messagebox.cancel")), 1)
  58860. ]),
  58861. _: 1
  58862. }, 8, ["loading", "loading-icon", "class", "round", "size", "onClick", "onKeydown"])) : vue.createCommentVNode("v-if", true),
  58863. vue.withDirectives(vue.createVNode(_component_el_button, {
  58864. ref: "confirmRef",
  58865. type: "primary",
  58866. loading: _ctx.confirmButtonLoading,
  58867. "loading-icon": _ctx.confirmButtonLoadingIcon,
  58868. class: vue.normalizeClass([_ctx.confirmButtonClasses]),
  58869. round: _ctx.roundButton,
  58870. disabled: _ctx.confirmButtonDisabled,
  58871. size: _ctx.btnSize,
  58872. onClick: ($event) => _ctx.handleAction("confirm"),
  58873. onKeydown: vue.withKeys(vue.withModifiers(($event) => _ctx.handleAction("confirm"), ["prevent"]), ["enter"])
  58874. }, {
  58875. default: vue.withCtx(() => [
  58876. vue.createTextVNode(vue.toDisplayString(_ctx.confirmButtonText || _ctx.t("el.messagebox.confirm")), 1)
  58877. ]),
  58878. _: 1
  58879. }, 8, ["loading", "loading-icon", "class", "round", "disabled", "size", "onClick", "onKeydown"]), [
  58880. [vue.vShow, _ctx.showConfirmButton]
  58881. ])
  58882. ], 2)
  58883. ], 14, ["onClick"])
  58884. ]),
  58885. _: 3
  58886. }, 8, ["trapped", "focus-trap-el", "focus-start-el", "onReleaseRequested"])
  58887. ], 42, ["aria-label", "aria-describedby", "onClick", "onMousedown", "onMouseup"])
  58888. ]),
  58889. _: 3
  58890. }, 8, ["z-index", "overlay-class", "mask"]), [
  58891. [vue.vShow, _ctx.visible]
  58892. ])
  58893. ]),
  58894. _: 3
  58895. }, 8, ["onAfterLeave"]);
  58896. }
  58897. var MessageBoxConstructor = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render], ["__file", "index.vue"]]);
  58898. const messageInstance = /* @__PURE__ */ new Map();
  58899. const getAppendToElement = (props) => {
  58900. let appendTo = document.body;
  58901. if (props.appendTo) {
  58902. if (isString$1(props.appendTo)) {
  58903. appendTo = document.querySelector(props.appendTo);
  58904. }
  58905. if (isElement$1(props.appendTo)) {
  58906. appendTo = props.appendTo;
  58907. }
  58908. if (!isElement$1(appendTo)) {
  58909. appendTo = document.body;
  58910. }
  58911. }
  58912. return appendTo;
  58913. };
  58914. const initInstance = (props, container, appContext = null) => {
  58915. const vnode = vue.createVNode(MessageBoxConstructor, props, isFunction$1(props.message) || vue.isVNode(props.message) ? {
  58916. default: isFunction$1(props.message) ? props.message : () => props.message
  58917. } : null);
  58918. vnode.appContext = appContext;
  58919. vue.render(vnode, container);
  58920. getAppendToElement(props).appendChild(container.firstElementChild);
  58921. return vnode.component;
  58922. };
  58923. const genContainer = () => {
  58924. return document.createElement("div");
  58925. };
  58926. const showMessage = (options, appContext) => {
  58927. const container = genContainer();
  58928. options.onVanish = () => {
  58929. vue.render(null, container);
  58930. messageInstance.delete(vm);
  58931. };
  58932. options.onAction = (action) => {
  58933. const currentMsg = messageInstance.get(vm);
  58934. let resolve;
  58935. if (options.showInput) {
  58936. resolve = { value: vm.inputValue, action };
  58937. } else {
  58938. resolve = action;
  58939. }
  58940. if (options.callback) {
  58941. options.callback(resolve, instance.proxy);
  58942. } else {
  58943. if (action === "cancel" || action === "close") {
  58944. if (options.distinguishCancelAndClose && action !== "cancel") {
  58945. currentMsg.reject("close");
  58946. } else {
  58947. currentMsg.reject("cancel");
  58948. }
  58949. } else {
  58950. currentMsg.resolve(resolve);
  58951. }
  58952. }
  58953. };
  58954. const instance = initInstance(options, container, appContext);
  58955. const vm = instance.proxy;
  58956. for (const prop in options) {
  58957. if (hasOwn(options, prop) && !hasOwn(vm.$props, prop)) {
  58958. vm[prop] = options[prop];
  58959. }
  58960. }
  58961. vm.visible = true;
  58962. return vm;
  58963. };
  58964. function MessageBox(options, appContext = null) {
  58965. if (!isClient)
  58966. return Promise.reject();
  58967. let callback;
  58968. if (isString$1(options) || vue.isVNode(options)) {
  58969. options = {
  58970. message: options
  58971. };
  58972. } else {
  58973. callback = options.callback;
  58974. }
  58975. return new Promise((resolve, reject) => {
  58976. const vm = showMessage(options, appContext != null ? appContext : MessageBox._context);
  58977. messageInstance.set(vm, {
  58978. options,
  58979. callback,
  58980. resolve,
  58981. reject
  58982. });
  58983. });
  58984. }
  58985. const MESSAGE_BOX_VARIANTS = ["alert", "confirm", "prompt"];
  58986. const MESSAGE_BOX_DEFAULT_OPTS = {
  58987. alert: { closeOnPressEscape: false, closeOnClickModal: false },
  58988. confirm: { showCancelButton: true },
  58989. prompt: { showCancelButton: true, showInput: true }
  58990. };
  58991. MESSAGE_BOX_VARIANTS.forEach((boxType) => {
  58992. MessageBox[boxType] = messageBoxFactory(boxType);
  58993. });
  58994. function messageBoxFactory(boxType) {
  58995. return (message, title, options, appContext) => {
  58996. let titleOrOpts = "";
  58997. if (isObject$1(title)) {
  58998. options = title;
  58999. titleOrOpts = "";
  59000. } else if (isUndefined(title)) {
  59001. titleOrOpts = "";
  59002. } else {
  59003. titleOrOpts = title;
  59004. }
  59005. return MessageBox(Object.assign({
  59006. title: titleOrOpts,
  59007. message,
  59008. type: "",
  59009. ...MESSAGE_BOX_DEFAULT_OPTS[boxType]
  59010. }, options, {
  59011. boxType
  59012. }), appContext);
  59013. };
  59014. }
  59015. MessageBox.close = () => {
  59016. messageInstance.forEach((_, vm) => {
  59017. vm.doClose();
  59018. });
  59019. messageInstance.clear();
  59020. };
  59021. MessageBox._context = null;
  59022. const _MessageBox = MessageBox;
  59023. _MessageBox.install = (app) => {
  59024. _MessageBox._context = app._context;
  59025. app.config.globalProperties.$msgbox = _MessageBox;
  59026. app.config.globalProperties.$messageBox = _MessageBox;
  59027. app.config.globalProperties.$alert = _MessageBox.alert;
  59028. app.config.globalProperties.$confirm = _MessageBox.confirm;
  59029. app.config.globalProperties.$prompt = _MessageBox.prompt;
  59030. };
  59031. const ElMessageBox = _MessageBox;
  59032. const notificationTypes = [
  59033. "success",
  59034. "info",
  59035. "warning",
  59036. "error"
  59037. ];
  59038. const notificationProps = buildProps({
  59039. customClass: {
  59040. type: String,
  59041. default: ""
  59042. },
  59043. dangerouslyUseHTMLString: Boolean,
  59044. duration: {
  59045. type: Number,
  59046. default: 4500
  59047. },
  59048. icon: {
  59049. type: iconPropType
  59050. },
  59051. id: {
  59052. type: String,
  59053. default: ""
  59054. },
  59055. message: {
  59056. type: definePropType([
  59057. String,
  59058. Object,
  59059. Function
  59060. ]),
  59061. default: ""
  59062. },
  59063. offset: {
  59064. type: Number,
  59065. default: 0
  59066. },
  59067. onClick: {
  59068. type: definePropType(Function),
  59069. default: () => void 0
  59070. },
  59071. onClose: {
  59072. type: definePropType(Function),
  59073. required: true
  59074. },
  59075. position: {
  59076. type: String,
  59077. values: ["top-right", "top-left", "bottom-right", "bottom-left"],
  59078. default: "top-right"
  59079. },
  59080. showClose: {
  59081. type: Boolean,
  59082. default: true
  59083. },
  59084. title: {
  59085. type: String,
  59086. default: ""
  59087. },
  59088. type: {
  59089. type: String,
  59090. values: [...notificationTypes, ""],
  59091. default: ""
  59092. },
  59093. zIndex: Number
  59094. });
  59095. const notificationEmits = {
  59096. destroy: () => true
  59097. };
  59098. const __default__ = vue.defineComponent({
  59099. name: "ElNotification"
  59100. });
  59101. const _sfc_main = /* @__PURE__ */ vue.defineComponent({
  59102. ...__default__,
  59103. props: notificationProps,
  59104. emits: notificationEmits,
  59105. setup(__props, { expose }) {
  59106. const props = __props;
  59107. const { ns, zIndex } = useGlobalComponentSettings("notification");
  59108. const { nextZIndex, currentZIndex } = zIndex;
  59109. const { Close } = CloseComponents;
  59110. const visible = vue.ref(false);
  59111. let timer = void 0;
  59112. const typeClass = vue.computed(() => {
  59113. const type = props.type;
  59114. return type && TypeComponentsMap[props.type] ? ns.m(type) : "";
  59115. });
  59116. const iconComponent = vue.computed(() => {
  59117. if (!props.type)
  59118. return props.icon;
  59119. return TypeComponentsMap[props.type] || props.icon;
  59120. });
  59121. const horizontalClass = vue.computed(() => props.position.endsWith("right") ? "right" : "left");
  59122. const verticalProperty = vue.computed(() => props.position.startsWith("top") ? "top" : "bottom");
  59123. const positionStyle = vue.computed(() => {
  59124. var _a;
  59125. return {
  59126. [verticalProperty.value]: `${props.offset}px`,
  59127. zIndex: (_a = props.zIndex) != null ? _a : currentZIndex.value
  59128. };
  59129. });
  59130. function startTimer() {
  59131. if (props.duration > 0) {
  59132. ({ stop: timer } = useTimeoutFn(() => {
  59133. if (visible.value)
  59134. close();
  59135. }, props.duration));
  59136. }
  59137. }
  59138. function clearTimer() {
  59139. timer == null ? void 0 : timer();
  59140. }
  59141. function close() {
  59142. visible.value = false;
  59143. }
  59144. function onKeydown({ code }) {
  59145. if (code === EVENT_CODE.delete || code === EVENT_CODE.backspace) {
  59146. clearTimer();
  59147. } else if (code === EVENT_CODE.esc) {
  59148. if (visible.value) {
  59149. close();
  59150. }
  59151. } else {
  59152. startTimer();
  59153. }
  59154. }
  59155. vue.onMounted(() => {
  59156. startTimer();
  59157. nextZIndex();
  59158. visible.value = true;
  59159. });
  59160. useEventListener(document, "keydown", onKeydown);
  59161. expose({
  59162. visible,
  59163. close
  59164. });
  59165. return (_ctx, _cache) => {
  59166. return vue.openBlock(), vue.createBlock(vue.Transition, {
  59167. name: vue.unref(ns).b("fade"),
  59168. onBeforeLeave: _ctx.onClose,
  59169. onAfterLeave: ($event) => _ctx.$emit("destroy"),
  59170. persisted: ""
  59171. }, {
  59172. default: vue.withCtx(() => [
  59173. vue.withDirectives(vue.createElementVNode("div", {
  59174. id: _ctx.id,
  59175. class: vue.normalizeClass([vue.unref(ns).b(), _ctx.customClass, vue.unref(horizontalClass)]),
  59176. style: vue.normalizeStyle(vue.unref(positionStyle)),
  59177. role: "alert",
  59178. onMouseenter: clearTimer,
  59179. onMouseleave: startTimer,
  59180. onClick: _ctx.onClick
  59181. }, [
  59182. vue.unref(iconComponent) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  59183. key: 0,
  59184. class: vue.normalizeClass([vue.unref(ns).e("icon"), vue.unref(typeClass)])
  59185. }, {
  59186. default: vue.withCtx(() => [
  59187. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(iconComponent))))
  59188. ]),
  59189. _: 1
  59190. }, 8, ["class"])) : vue.createCommentVNode("v-if", true),
  59191. vue.createElementVNode("div", {
  59192. class: vue.normalizeClass(vue.unref(ns).e("group"))
  59193. }, [
  59194. vue.createElementVNode("h2", {
  59195. class: vue.normalizeClass(vue.unref(ns).e("title")),
  59196. textContent: vue.toDisplayString(_ctx.title)
  59197. }, null, 10, ["textContent"]),
  59198. vue.withDirectives(vue.createElementVNode("div", {
  59199. class: vue.normalizeClass(vue.unref(ns).e("content")),
  59200. style: vue.normalizeStyle(!!_ctx.title ? void 0 : { margin: 0 })
  59201. }, [
  59202. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  59203. !_ctx.dangerouslyUseHTMLString ? (vue.openBlock(), vue.createElementBlock("p", { key: 0 }, vue.toDisplayString(_ctx.message), 1)) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  59204. vue.createCommentVNode(" Caution here, message could've been compromised, never use user's input as message "),
  59205. vue.createElementVNode("p", { innerHTML: _ctx.message }, null, 8, ["innerHTML"])
  59206. ], 2112))
  59207. ])
  59208. ], 6), [
  59209. [vue.vShow, _ctx.message]
  59210. ]),
  59211. _ctx.showClose ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  59212. key: 0,
  59213. class: vue.normalizeClass(vue.unref(ns).e("closeBtn")),
  59214. onClick: vue.withModifiers(close, ["stop"])
  59215. }, {
  59216. default: vue.withCtx(() => [
  59217. vue.createVNode(vue.unref(Close))
  59218. ]),
  59219. _: 1
  59220. }, 8, ["class", "onClick"])) : vue.createCommentVNode("v-if", true)
  59221. ], 2)
  59222. ], 46, ["id", "onClick"]), [
  59223. [vue.vShow, visible.value]
  59224. ])
  59225. ]),
  59226. _: 3
  59227. }, 8, ["name", "onBeforeLeave", "onAfterLeave"]);
  59228. };
  59229. }
  59230. });
  59231. var NotificationConstructor = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "notification.vue"]]);
  59232. const notifications = {
  59233. "top-left": [],
  59234. "top-right": [],
  59235. "bottom-left": [],
  59236. "bottom-right": []
  59237. };
  59238. const GAP_SIZE = 16;
  59239. let seed = 1;
  59240. const notify = function(options = {}, context) {
  59241. if (!isClient)
  59242. return { close: () => void 0 };
  59243. if (isString$1(options) || vue.isVNode(options)) {
  59244. options = { message: options };
  59245. }
  59246. const position = options.position || "top-right";
  59247. let verticalOffset = options.offset || 0;
  59248. notifications[position].forEach(({ vm: vm2 }) => {
  59249. var _a;
  59250. verticalOffset += (((_a = vm2.el) == null ? void 0 : _a.offsetHeight) || 0) + GAP_SIZE;
  59251. });
  59252. verticalOffset += GAP_SIZE;
  59253. const id = `notification_${seed++}`;
  59254. const userOnClose = options.onClose;
  59255. const props = {
  59256. ...options,
  59257. offset: verticalOffset,
  59258. id,
  59259. onClose: () => {
  59260. close(id, position, userOnClose);
  59261. }
  59262. };
  59263. let appendTo = document.body;
  59264. if (isElement$1(options.appendTo)) {
  59265. appendTo = options.appendTo;
  59266. } else if (isString$1(options.appendTo)) {
  59267. appendTo = document.querySelector(options.appendTo);
  59268. }
  59269. if (!isElement$1(appendTo)) {
  59270. appendTo = document.body;
  59271. }
  59272. const container = document.createElement("div");
  59273. const vm = vue.createVNode(NotificationConstructor, props, isFunction$1(props.message) ? props.message : vue.isVNode(props.message) ? () => props.message : null);
  59274. vm.appContext = isUndefined(context) ? notify._context : context;
  59275. vm.props.onDestroy = () => {
  59276. vue.render(null, container);
  59277. };
  59278. vue.render(vm, container);
  59279. notifications[position].push({ vm });
  59280. appendTo.appendChild(container.firstElementChild);
  59281. return {
  59282. close: () => {
  59283. vm.component.exposed.visible.value = false;
  59284. }
  59285. };
  59286. };
  59287. notificationTypes.forEach((type) => {
  59288. notify[type] = (options = {}, appContext) => {
  59289. if (isString$1(options) || vue.isVNode(options)) {
  59290. options = {
  59291. message: options
  59292. };
  59293. }
  59294. return notify({ ...options, type }, appContext);
  59295. };
  59296. });
  59297. function close(id, position, userOnClose) {
  59298. const orientedNotifications = notifications[position];
  59299. const idx = orientedNotifications.findIndex(({ vm: vm2 }) => {
  59300. var _a;
  59301. return ((_a = vm2.component) == null ? void 0 : _a.props.id) === id;
  59302. });
  59303. if (idx === -1)
  59304. return;
  59305. const { vm } = orientedNotifications[idx];
  59306. if (!vm)
  59307. return;
  59308. userOnClose == null ? void 0 : userOnClose(vm);
  59309. const removedHeight = vm.el.offsetHeight;
  59310. const verticalPos = position.split("-")[0];
  59311. orientedNotifications.splice(idx, 1);
  59312. const len = orientedNotifications.length;
  59313. if (len < 1)
  59314. return;
  59315. for (let i = idx; i < len; i++) {
  59316. const { el, component } = orientedNotifications[i].vm;
  59317. const pos = Number.parseInt(el.style[verticalPos], 10) - removedHeight - GAP_SIZE;
  59318. component.props.offset = pos;
  59319. }
  59320. }
  59321. function closeAll() {
  59322. for (const orientedNotifications of Object.values(notifications)) {
  59323. orientedNotifications.forEach(({ vm }) => {
  59324. vm.component.exposed.visible.value = false;
  59325. });
  59326. }
  59327. }
  59328. notify.closeAll = closeAll;
  59329. notify._context = null;
  59330. var Notify = notify;
  59331. const ElNotification = withInstallFunction(Notify, "$notify");
  59332. var Plugins = [
  59333. ElInfiniteScroll,
  59334. ElLoading,
  59335. ElMessage,
  59336. ElMessageBox,
  59337. ElNotification,
  59338. ElPopoverDirective
  59339. ];
  59340. var installer = makeInstaller([...Components, ...Plugins]);
  59341. const install = installer.install;
  59342. const version = installer.version;
  59343. exports.BAR_MAP = BAR_MAP;
  59344. exports.CAROUSEL_ITEM_NAME = CAROUSEL_ITEM_NAME;
  59345. exports.CASCADER_PANEL_INJECTION_KEY = CASCADER_PANEL_INJECTION_KEY;
  59346. exports.CHANGE_EVENT = CHANGE_EVENT;
  59347. exports.ClickOutside = ClickOutside;
  59348. exports.CommonPicker = CommonPicker;
  59349. exports.CommonProps = CommonProps;
  59350. exports.DEFAULT_EMPTY_VALUES = DEFAULT_EMPTY_VALUES;
  59351. exports.DEFAULT_FORMATS_DATE = DEFAULT_FORMATS_DATE;
  59352. exports.DEFAULT_FORMATS_DATEPICKER = DEFAULT_FORMATS_DATEPICKER;
  59353. exports.DEFAULT_FORMATS_TIME = DEFAULT_FORMATS_TIME;
  59354. exports.DEFAULT_VALUE_ON_CLEAR = DEFAULT_VALUE_ON_CLEAR;
  59355. exports.DROPDOWN_COLLECTION_INJECTION_KEY = COLLECTION_INJECTION_KEY;
  59356. exports.DROPDOWN_COLLECTION_ITEM_INJECTION_KEY = COLLECTION_ITEM_INJECTION_KEY;
  59357. exports.DROPDOWN_INJECTION_KEY = DROPDOWN_INJECTION_KEY;
  59358. exports.DefaultProps = DefaultProps;
  59359. exports.DynamicSizeGrid = DynamicSizeGrid$1;
  59360. exports.DynamicSizeList = DynamicSizeList$1;
  59361. exports.EVENT_CODE = EVENT_CODE;
  59362. exports.Effect = Effect;
  59363. exports.ElAffix = ElAffix;
  59364. exports.ElAlert = ElAlert;
  59365. exports.ElAnchor = ElAnchor;
  59366. exports.ElAnchorLink = ElAnchorLink;
  59367. exports.ElAside = ElAside;
  59368. exports.ElAutoResizer = ElAutoResizer;
  59369. exports.ElAutocomplete = ElAutocomplete;
  59370. exports.ElAvatar = ElAvatar;
  59371. exports.ElBacktop = ElBacktop;
  59372. exports.ElBadge = ElBadge;
  59373. exports.ElBreadcrumb = ElBreadcrumb;
  59374. exports.ElBreadcrumbItem = ElBreadcrumbItem;
  59375. exports.ElButton = ElButton;
  59376. exports.ElButtonGroup = ElButtonGroup$1;
  59377. exports.ElCalendar = ElCalendar;
  59378. exports.ElCard = ElCard;
  59379. exports.ElCarousel = ElCarousel;
  59380. exports.ElCarouselItem = ElCarouselItem;
  59381. exports.ElCascader = ElCascader;
  59382. exports.ElCascaderPanel = ElCascaderPanel;
  59383. exports.ElCheckTag = ElCheckTag;
  59384. exports.ElCheckbox = ElCheckbox;
  59385. exports.ElCheckboxButton = ElCheckboxButton;
  59386. exports.ElCheckboxGroup = ElCheckboxGroup$1;
  59387. exports.ElCol = ElCol;
  59388. exports.ElCollapse = ElCollapse;
  59389. exports.ElCollapseItem = ElCollapseItem;
  59390. exports.ElCollapseTransition = ElCollapseTransition;
  59391. exports.ElCollection = ElCollection;
  59392. exports.ElCollectionItem = ElCollectionItem;
  59393. exports.ElColorPicker = ElColorPicker;
  59394. exports.ElConfigProvider = ElConfigProvider;
  59395. exports.ElContainer = ElContainer;
  59396. exports.ElCountdown = ElCountdown;
  59397. exports.ElDatePicker = ElDatePicker;
  59398. exports.ElDescriptions = ElDescriptions;
  59399. exports.ElDescriptionsItem = ElDescriptionsItem;
  59400. exports.ElDialog = ElDialog;
  59401. exports.ElDivider = ElDivider;
  59402. exports.ElDrawer = ElDrawer;
  59403. exports.ElDropdown = ElDropdown;
  59404. exports.ElDropdownItem = ElDropdownItem;
  59405. exports.ElDropdownMenu = ElDropdownMenu;
  59406. exports.ElEmpty = ElEmpty;
  59407. exports.ElFooter = ElFooter;
  59408. exports.ElForm = ElForm;
  59409. exports.ElFormItem = ElFormItem;
  59410. exports.ElHeader = ElHeader;
  59411. exports.ElIcon = ElIcon;
  59412. exports.ElImage = ElImage;
  59413. exports.ElImageViewer = ElImageViewer;
  59414. exports.ElInfiniteScroll = ElInfiniteScroll;
  59415. exports.ElInput = ElInput;
  59416. exports.ElInputNumber = ElInputNumber;
  59417. exports.ElInputTag = ElInputTag;
  59418. exports.ElLink = ElLink;
  59419. exports.ElLoading = ElLoading;
  59420. exports.ElLoadingDirective = vLoading;
  59421. exports.ElLoadingService = Loading;
  59422. exports.ElMain = ElMain;
  59423. exports.ElMention = ElMention;
  59424. exports.ElMenu = ElMenu;
  59425. exports.ElMenuItem = ElMenuItem;
  59426. exports.ElMenuItemGroup = ElMenuItemGroup;
  59427. exports.ElMessage = ElMessage;
  59428. exports.ElMessageBox = ElMessageBox;
  59429. exports.ElNotification = ElNotification;
  59430. exports.ElOption = ElOption;
  59431. exports.ElOptionGroup = ElOptionGroup;
  59432. exports.ElOverlay = ElOverlay;
  59433. exports.ElPageHeader = ElPageHeader;
  59434. exports.ElPagination = ElPagination;
  59435. exports.ElPopconfirm = ElPopconfirm;
  59436. exports.ElPopover = ElPopover;
  59437. exports.ElPopoverDirective = ElPopoverDirective;
  59438. exports.ElPopper = ElPopper;
  59439. exports.ElPopperArrow = ElPopperArrow;
  59440. exports.ElPopperContent = ElPopperContent;
  59441. exports.ElPopperTrigger = ElPopperTrigger;
  59442. exports.ElProgress = ElProgress;
  59443. exports.ElRadio = ElRadio;
  59444. exports.ElRadioButton = ElRadioButton;
  59445. exports.ElRadioGroup = ElRadioGroup;
  59446. exports.ElRate = ElRate;
  59447. exports.ElResult = ElResult;
  59448. exports.ElRow = ElRow;
  59449. exports.ElScrollbar = ElScrollbar;
  59450. exports.ElSegmented = ElSegmented;
  59451. exports.ElSelect = ElSelect;
  59452. exports.ElSelectV2 = ElSelectV2;
  59453. exports.ElSkeleton = ElSkeleton;
  59454. exports.ElSkeletonItem = ElSkeletonItem;
  59455. exports.ElSlider = ElSlider;
  59456. exports.ElSpace = ElSpace;
  59457. exports.ElStatistic = ElStatistic;
  59458. exports.ElStep = ElStep;
  59459. exports.ElSteps = ElSteps;
  59460. exports.ElSubMenu = ElSubMenu;
  59461. exports.ElSwitch = ElSwitch;
  59462. exports.ElTabPane = ElTabPane;
  59463. exports.ElTable = ElTable;
  59464. exports.ElTableColumn = ElTableColumn;
  59465. exports.ElTableV2 = ElTableV2;
  59466. exports.ElTabs = ElTabs;
  59467. exports.ElTag = ElTag;
  59468. exports.ElText = ElText;
  59469. exports.ElTimePicker = ElTimePicker;
  59470. exports.ElTimeSelect = ElTimeSelect;
  59471. exports.ElTimeline = ElTimeline;
  59472. exports.ElTimelineItem = ElTimelineItem;
  59473. exports.ElTooltip = ElTooltip;
  59474. exports.ElTour = ElTour;
  59475. exports.ElTourStep = ElTourStep;
  59476. exports.ElTransfer = ElTransfer;
  59477. exports.ElTree = ElTree;
  59478. exports.ElTreeSelect = ElTreeSelect;
  59479. exports.ElTreeV2 = ElTreeV2;
  59480. exports.ElUpload = ElUpload;
  59481. exports.ElWatermark = ElWatermark;
  59482. exports.FIRST_KEYS = FIRST_KEYS;
  59483. exports.FIRST_LAST_KEYS = FIRST_LAST_KEYS;
  59484. exports.FORWARD_REF_INJECTION_KEY = FORWARD_REF_INJECTION_KEY;
  59485. exports.FixedSizeGrid = FixedSizeGrid$1;
  59486. exports.FixedSizeList = FixedSizeList$1;
  59487. exports.GAP = GAP;
  59488. exports.ID_INJECTION_KEY = ID_INJECTION_KEY;
  59489. exports.INPUT_EVENT = INPUT_EVENT;
  59490. exports.INSTALLED_KEY = INSTALLED_KEY;
  59491. exports.IconComponentMap = IconComponentMap;
  59492. exports.IconMap = IconMap;
  59493. exports.LAST_KEYS = LAST_KEYS;
  59494. exports.LEFT_CHECK_CHANGE_EVENT = LEFT_CHECK_CHANGE_EVENT;
  59495. exports.Mousewheel = Mousewheel;
  59496. exports.POPPER_CONTENT_INJECTION_KEY = POPPER_CONTENT_INJECTION_KEY;
  59497. exports.POPPER_INJECTION_KEY = POPPER_INJECTION_KEY;
  59498. exports.RIGHT_CHECK_CHANGE_EVENT = RIGHT_CHECK_CHANGE_EVENT;
  59499. exports.ROOT_PICKER_INJECTION_KEY = ROOT_PICKER_INJECTION_KEY;
  59500. exports.RowAlign = RowAlign;
  59501. exports.RowJustify = RowJustify;
  59502. exports.SCOPE = SCOPE$3;
  59503. exports.SIZE_INJECTION_KEY = SIZE_INJECTION_KEY;
  59504. exports.TOOLTIP_INJECTION_KEY = TOOLTIP_INJECTION_KEY;
  59505. exports.TableV2 = TableV2$1;
  59506. exports.TableV2Alignment = Alignment;
  59507. exports.TableV2FixedDir = FixedDir;
  59508. exports.TableV2Placeholder = placeholderSign;
  59509. exports.TableV2SortOrder = SortOrder;
  59510. exports.TimePickPanel = TimePickPanel;
  59511. exports.TrapFocus = TrapFocus;
  59512. exports.UPDATE_MODEL_EVENT = UPDATE_MODEL_EVENT;
  59513. exports.WEEK_DAYS = WEEK_DAYS;
  59514. exports.ZINDEX_INJECTION_KEY = ZINDEX_INJECTION_KEY;
  59515. exports.affixEmits = affixEmits;
  59516. exports.affixProps = affixProps;
  59517. exports.alertEffects = alertEffects;
  59518. exports.alertEmits = alertEmits;
  59519. exports.alertProps = alertProps;
  59520. exports.anchorEmits = anchorEmits;
  59521. exports.anchorProps = anchorProps;
  59522. exports.ariaProps = ariaProps;
  59523. exports.arrowMiddleware = arrowMiddleware;
  59524. exports.autoResizerProps = autoResizerProps;
  59525. exports.autocompleteEmits = autocompleteEmits;
  59526. exports.autocompleteProps = autocompleteProps;
  59527. exports.avatarEmits = avatarEmits;
  59528. exports.avatarProps = avatarProps;
  59529. exports.backtopEmits = backtopEmits;
  59530. exports.backtopProps = backtopProps;
  59531. exports.badgeProps = badgeProps;
  59532. exports.breadcrumbItemProps = breadcrumbItemProps;
  59533. exports.breadcrumbKey = breadcrumbKey;
  59534. exports.breadcrumbProps = breadcrumbProps;
  59535. exports.buildLocaleContext = buildLocaleContext;
  59536. exports.buildTimeList = buildTimeList;
  59537. exports.buildTranslator = buildTranslator;
  59538. exports.buttonEmits = buttonEmits;
  59539. exports.buttonGroupContextKey = buttonGroupContextKey;
  59540. exports.buttonNativeTypes = buttonNativeTypes;
  59541. exports.buttonProps = buttonProps;
  59542. exports.buttonTypes = buttonTypes;
  59543. exports.calendarEmits = calendarEmits;
  59544. exports.calendarProps = calendarProps;
  59545. exports.cardProps = cardProps;
  59546. exports.carouselContextKey = carouselContextKey;
  59547. exports.carouselEmits = carouselEmits;
  59548. exports.carouselItemProps = carouselItemProps;
  59549. exports.carouselProps = carouselProps;
  59550. exports.cascaderEmits = cascaderEmits;
  59551. exports.cascaderProps = cascaderProps;
  59552. exports.checkTagEmits = checkTagEmits;
  59553. exports.checkTagProps = checkTagProps;
  59554. exports.checkboxEmits = checkboxEmits;
  59555. exports.checkboxGroupContextKey = checkboxGroupContextKey;
  59556. exports.checkboxGroupEmits = checkboxGroupEmits;
  59557. exports.checkboxGroupProps = checkboxGroupProps;
  59558. exports.checkboxProps = checkboxProps;
  59559. exports.colProps = colProps;
  59560. exports.collapseContextKey = collapseContextKey;
  59561. exports.collapseEmits = collapseEmits;
  59562. exports.collapseItemProps = collapseItemProps;
  59563. exports.collapseProps = collapseProps;
  59564. exports.colorPickerContextKey = colorPickerContextKey;
  59565. exports.colorPickerEmits = colorPickerEmits;
  59566. exports.colorPickerProps = colorPickerProps;
  59567. exports.componentSizeMap = componentSizeMap;
  59568. exports.componentSizes = componentSizes;
  59569. exports.configProviderContextKey = configProviderContextKey;
  59570. exports.configProviderProps = configProviderProps;
  59571. exports.countdownEmits = countdownEmits;
  59572. exports.countdownProps = countdownProps;
  59573. exports.createModelToggleComposable = createModelToggleComposable;
  59574. exports.dateEquals = dateEquals;
  59575. exports.datePickTypes = datePickTypes;
  59576. exports.datePickerProps = datePickerProps;
  59577. exports.dayOrDaysToDate = dayOrDaysToDate;
  59578. exports.dayjs = dayjs;
  59579. exports["default"] = installer;
  59580. exports.defaultInitialZIndex = defaultInitialZIndex;
  59581. exports.defaultNamespace = defaultNamespace;
  59582. exports.descriptionItemProps = descriptionItemProps;
  59583. exports.descriptionProps = descriptionProps;
  59584. exports.dialogEmits = dialogEmits;
  59585. exports.dialogInjectionKey = dialogInjectionKey;
  59586. exports.dialogProps = dialogProps;
  59587. exports.dividerProps = dividerProps;
  59588. exports.drawerEmits = drawerEmits;
  59589. exports.drawerProps = drawerProps;
  59590. exports.dropdownItemProps = dropdownItemProps;
  59591. exports.dropdownMenuProps = dropdownMenuProps;
  59592. exports.dropdownProps = dropdownProps;
  59593. exports.elPaginationKey = elPaginationKey;
  59594. exports.emitChangeFn = emitChangeFn;
  59595. exports.emptyProps = emptyProps;
  59596. exports.emptyValuesContextKey = emptyValuesContextKey;
  59597. exports.extractDateFormat = extractDateFormat;
  59598. exports.extractTimeFormat = extractTimeFormat;
  59599. exports.formContextKey = formContextKey;
  59600. exports.formEmits = formEmits;
  59601. exports.formItemContextKey = formItemContextKey;
  59602. exports.formItemProps = formItemProps;
  59603. exports.formItemValidateStates = formItemValidateStates;
  59604. exports.formMetaProps = formMetaProps;
  59605. exports.formProps = formProps;
  59606. exports.formatter = formatter;
  59607. exports.genFileId = genFileId;
  59608. exports.getPositionDataWithUnit = getPositionDataWithUnit;
  59609. exports.iconProps = iconProps;
  59610. exports.imageEmits = imageEmits;
  59611. exports.imageProps = imageProps;
  59612. exports.imageViewerEmits = imageViewerEmits;
  59613. exports.imageViewerProps = imageViewerProps;
  59614. exports.inputEmits = inputEmits;
  59615. exports.inputNumberEmits = inputNumberEmits;
  59616. exports.inputNumberProps = inputNumberProps;
  59617. exports.inputProps = inputProps;
  59618. exports.inputTagEmits = inputTagEmits;
  59619. exports.inputTagProps = inputTagProps;
  59620. exports.install = install;
  59621. exports.linkEmits = linkEmits;
  59622. exports.linkProps = linkProps;
  59623. exports.localeContextKey = localeContextKey;
  59624. exports.makeInstaller = makeInstaller;
  59625. exports.makeList = makeList;
  59626. exports.mentionEmits = mentionEmits;
  59627. exports.mentionProps = mentionProps;
  59628. exports.menuEmits = menuEmits;
  59629. exports.menuItemEmits = menuItemEmits;
  59630. exports.menuItemGroupProps = menuItemGroupProps;
  59631. exports.menuItemProps = menuItemProps;
  59632. exports.menuProps = menuProps;
  59633. exports.messageConfig = messageConfig;
  59634. exports.messageDefaults = messageDefaults;
  59635. exports.messageEmits = messageEmits;
  59636. exports.messageProps = messageProps;
  59637. exports.messageTypes = messageTypes;
  59638. exports.namespaceContextKey = namespaceContextKey;
  59639. exports.notificationEmits = notificationEmits;
  59640. exports.notificationProps = notificationProps;
  59641. exports.notificationTypes = notificationTypes;
  59642. exports.overlayEmits = overlayEmits;
  59643. exports.overlayProps = overlayProps;
  59644. exports.pageHeaderEmits = pageHeaderEmits;
  59645. exports.pageHeaderProps = pageHeaderProps;
  59646. exports.paginationEmits = paginationEmits;
  59647. exports.paginationProps = paginationProps;
  59648. exports.parseDate = parseDate;
  59649. exports.popconfirmEmits = popconfirmEmits;
  59650. exports.popconfirmProps = popconfirmProps;
  59651. exports.popoverEmits = popoverEmits;
  59652. exports.popoverProps = popoverProps;
  59653. exports.popperArrowProps = popperArrowProps;
  59654. exports.popperContentEmits = popperContentEmits;
  59655. exports.popperContentProps = popperContentProps;
  59656. exports.popperCoreConfigProps = popperCoreConfigProps;
  59657. exports.popperProps = popperProps;
  59658. exports.popperTriggerProps = popperTriggerProps;
  59659. exports.progressProps = progressProps;
  59660. exports.provideGlobalConfig = provideGlobalConfig;
  59661. exports.radioButtonProps = radioButtonProps;
  59662. exports.radioEmits = radioEmits;
  59663. exports.radioGroupEmits = radioGroupEmits;
  59664. exports.radioGroupKey = radioGroupKey;
  59665. exports.radioGroupProps = radioGroupProps;
  59666. exports.radioProps = radioProps;
  59667. exports.radioPropsBase = radioPropsBase;
  59668. exports.rangeArr = rangeArr;
  59669. exports.rateEmits = rateEmits;
  59670. exports.rateProps = rateProps;
  59671. exports.renderThumbStyle = renderThumbStyle$1;
  59672. exports.resultProps = resultProps;
  59673. exports.roleTypes = roleTypes;
  59674. exports.rowContextKey = rowContextKey;
  59675. exports.rowProps = rowProps;
  59676. exports.scrollbarContextKey = scrollbarContextKey;
  59677. exports.scrollbarEmits = scrollbarEmits;
  59678. exports.scrollbarProps = scrollbarProps;
  59679. exports.segmentedEmits = segmentedEmits;
  59680. exports.segmentedProps = segmentedProps;
  59681. exports.selectGroupKey = selectGroupKey;
  59682. exports.selectKey = selectKey;
  59683. exports.selectV2InjectionKey = selectV2InjectionKey;
  59684. exports.skeletonItemProps = skeletonItemProps;
  59685. exports.skeletonProps = skeletonProps;
  59686. exports.sliderContextKey = sliderContextKey;
  59687. exports.sliderEmits = sliderEmits;
  59688. exports.sliderProps = sliderProps;
  59689. exports.spaceItemProps = spaceItemProps;
  59690. exports.spaceProps = spaceProps;
  59691. exports.statisticProps = statisticProps;
  59692. exports.stepProps = stepProps;
  59693. exports.stepsEmits = stepsEmits;
  59694. exports.stepsProps = stepsProps;
  59695. exports.subMenuProps = subMenuProps;
  59696. exports.switchEmits = switchEmits;
  59697. exports.switchProps = switchProps;
  59698. exports.tabBarProps = tabBarProps;
  59699. exports.tabNavEmits = tabNavEmits;
  59700. exports.tabNavProps = tabNavProps;
  59701. exports.tabPaneProps = tabPaneProps;
  59702. exports.tableV2Props = tableV2Props;
  59703. exports.tableV2RowProps = tableV2RowProps;
  59704. exports.tabsEmits = tabsEmits;
  59705. exports.tabsProps = tabsProps;
  59706. exports.tabsRootContextKey = tabsRootContextKey;
  59707. exports.tagEmits = tagEmits;
  59708. exports.tagProps = tagProps;
  59709. exports.textProps = textProps;
  59710. exports.thumbProps = thumbProps;
  59711. exports.timePickerDefaultProps = timePickerDefaultProps;
  59712. exports.timePickerRngeTriggerProps = timePickerRngeTriggerProps;
  59713. exports.timeSelectProps = timeSelectProps;
  59714. exports.timeUnits = timeUnits$1;
  59715. exports.timelineItemProps = timelineItemProps;
  59716. exports.tooltipEmits = tooltipEmits;
  59717. exports.tourContentEmits = tourContentEmits;
  59718. exports.tourContentProps = tourContentProps;
  59719. exports.tourEmits = tourEmits;
  59720. exports.tourPlacements = tourPlacements;
  59721. exports.tourProps = tourProps;
  59722. exports.tourStepEmits = tourStepEmits;
  59723. exports.tourStepProps = tourStepProps;
  59724. exports.tourStrategies = tourStrategies;
  59725. exports.transferCheckedChangeFn = transferCheckedChangeFn;
  59726. exports.transferEmits = transferEmits;
  59727. exports.transferProps = transferProps;
  59728. exports.translate = translate;
  59729. exports.uploadBaseProps = uploadBaseProps;
  59730. exports.uploadContentProps = uploadContentProps;
  59731. exports.uploadContextKey = uploadContextKey;
  59732. exports.uploadDraggerEmits = uploadDraggerEmits;
  59733. exports.uploadDraggerProps = uploadDraggerProps;
  59734. exports.uploadListEmits = uploadListEmits;
  59735. exports.uploadListProps = uploadListProps;
  59736. exports.uploadListTypes = uploadListTypes;
  59737. exports.uploadProps = uploadProps;
  59738. exports.useAriaProps = useAriaProps;
  59739. exports.useAttrs = useAttrs;
  59740. exports.useCalcInputWidth = useCalcInputWidth;
  59741. exports.useCascaderConfig = useCascaderConfig;
  59742. exports.useComposition = useComposition;
  59743. exports.useCursor = useCursor;
  59744. exports.useDelayedRender = useDelayedRender;
  59745. exports.useDelayedToggle = useDelayedToggle;
  59746. exports.useDelayedToggleProps = useDelayedToggleProps;
  59747. exports.useDeprecated = useDeprecated;
  59748. exports.useDialog = useDialog;
  59749. exports.useDisabled = useDisabled;
  59750. exports.useDraggable = useDraggable;
  59751. exports.useEmptyValues = useEmptyValues;
  59752. exports.useEmptyValuesProps = useEmptyValuesProps;
  59753. exports.useEscapeKeydown = useEscapeKeydown;
  59754. exports.useFloating = useFloating$1;
  59755. exports.useFloatingProps = useFloatingProps;
  59756. exports.useFocus = useFocus;
  59757. exports.useFocusController = useFocusController;
  59758. exports.useFormDisabled = useFormDisabled;
  59759. exports.useFormItem = useFormItem;
  59760. exports.useFormItemInputId = useFormItemInputId;
  59761. exports.useFormSize = useFormSize;
  59762. exports.useForwardRef = useForwardRef;
  59763. exports.useForwardRefDirective = useForwardRefDirective;
  59764. exports.useGetDerivedNamespace = useGetDerivedNamespace;
  59765. exports.useGlobalComponentSettings = useGlobalComponentSettings;
  59766. exports.useGlobalConfig = useGlobalConfig;
  59767. exports.useGlobalSize = useGlobalSize;
  59768. exports.useId = useId;
  59769. exports.useIdInjection = useIdInjection;
  59770. exports.useLocale = useLocale;
  59771. exports.useLockscreen = useLockscreen;
  59772. exports.useModal = useModal;
  59773. exports.useModelToggle = useModelToggle;
  59774. exports.useModelToggleEmits = useModelToggleEmits;
  59775. exports.useModelToggleProps = useModelToggleProps;
  59776. exports.useNamespace = useNamespace;
  59777. exports.useOrderedChildren = useOrderedChildren;
  59778. exports.usePopper = usePopper;
  59779. exports.usePopperArrowProps = usePopperArrowProps;
  59780. exports.usePopperContainer = usePopperContainer;
  59781. exports.usePopperContainerId = usePopperContainerId;
  59782. exports.usePopperContentEmits = usePopperContentEmits;
  59783. exports.usePopperContentProps = usePopperContentProps;
  59784. exports.usePopperCoreConfigProps = usePopperCoreConfigProps;
  59785. exports.usePopperProps = usePopperProps;
  59786. exports.usePopperTriggerProps = usePopperTriggerProps;
  59787. exports.usePreventGlobal = usePreventGlobal;
  59788. exports.useProp = useProp;
  59789. exports.useSameTarget = useSameTarget;
  59790. exports.useSize = useSize;
  59791. exports.useSizeProp = useSizeProp;
  59792. exports.useSizeProps = useSizeProps;
  59793. exports.useSpace = useSpace;
  59794. exports.useTeleport = useTeleport;
  59795. exports.useThrottleRender = useThrottleRender;
  59796. exports.useTimeout = useTimeout;
  59797. exports.useTooltipContentProps = useTooltipContentProps;
  59798. exports.useTooltipModelToggle = useTooltipModelToggle;
  59799. exports.useTooltipModelToggleEmits = useTooltipModelToggleEmits;
  59800. exports.useTooltipModelToggleProps = useTooltipModelToggleProps;
  59801. exports.useTooltipProps = useTooltipProps;
  59802. exports.useTooltipTriggerProps = useTooltipTriggerProps;
  59803. exports.useTransitionFallthrough = useTransitionFallthrough;
  59804. exports.useTransitionFallthroughEmits = useTransitionFallthroughEmits;
  59805. exports.useZIndex = useZIndex;
  59806. exports.vLoading = vLoading;
  59807. exports.vRepeatClick = vRepeatClick;
  59808. exports.valueEquals = valueEquals;
  59809. exports.version = version;
  59810. exports.virtualizedGridProps = virtualizedGridProps;
  59811. exports.virtualizedListProps = virtualizedListProps;
  59812. exports.virtualizedProps = virtualizedProps;
  59813. exports.virtualizedScrollbarProps = virtualizedScrollbarProps;
  59814. exports.watermarkProps = watermarkProps;
  59815. exports.zIndexContextKey = zIndexContextKey;
  59816. Object.defineProperty(exports, '__esModule', { value: true });
  59817. }));