index.full.js 2.2 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545345463454734548345493455034551345523455334554345553455634557345583455934560345613456234563345643456534566345673456834569345703457134572345733457434575345763457734578345793458034581345823458334584345853458634587345883458934590345913459234593345943459534596345973459834599346003460134602346033460434605346063460734608346093461034611346123461334614346153461634617346183461934620346213462234623346243462534626346273462834629346303463134632346333463434635346363463734638346393464034641346423464334644346453464634647346483464934650346513465234653346543465534656346573465834659346603466134662346633466434665346663466734668346693467034671346723467334674346753467634677346783467934680346813468234683346843468534686346873468834689346903469134692346933469434695346963469734698346993470034701347023470334704347053470634707347083470934710347113471234713347143471534716347173471834719347203472134722347233472434725347263472734728347293473034731347323473334734347353473634737347383473934740347413474234743347443474534746347473474834749347503475134752347533475434755347563475734758347593476034761347623476334764347653476634767347683476934770347713477234773347743477534776347773477834779347803478134782347833478434785347863478734788347893479034791347923479334794347953479634797347983479934800348013480234803348043480534806348073480834809348103481134812348133481434815348163481734818348193482034821348223482334824348253482634827348283482934830348313483234833348343483534836348373483834839348403484134842348433484434845348463484734848348493485034851348523485334854348553485634857348583485934860348613486234863348643486534866348673486834869348703487134872348733487434875348763487734878348793488034881348823488334884348853488634887348883488934890348913489234893348943489534896348973489834899349003490134902349033490434905349063490734908349093491034911349123491334914349153491634917349183491934920349213492234923349243492534926349273492834929349303493134932349333493434935349363493734938349393494034941349423494334944349453494634947349483494934950349513495234953349543495534956349573495834959349603496134962349633496434965349663496734968349693497034971349723497334974349753497634977349783497934980349813498234983349843498534986349873498834989349903499134992349933499434995349963499734998349993500035001350023500335004350053500635007350083500935010350113501235013350143501535016350173501835019350203502135022350233502435025350263502735028350293503035031350323503335034350353503635037350383503935040350413504235043350443504535046350473504835049350503505135052350533505435055350563505735058350593506035061350623506335064350653506635067350683506935070350713507235073350743507535076350773507835079350803508135082350833508435085350863508735088350893509035091350923509335094350953509635097350983509935100351013510235103351043510535106351073510835109351103511135112351133511435115351163511735118351193512035121351223512335124351253512635127351283512935130351313513235133351343513535136351373513835139351403514135142351433514435145351463514735148351493515035151351523515335154351553515635157351583515935160351613516235163351643516535166351673516835169351703517135172351733517435175351763517735178351793518035181351823518335184351853518635187351883518935190351913519235193351943519535196351973519835199352003520135202352033520435205352063520735208352093521035211352123521335214352153521635217352183521935220352213522235223352243522535226352273522835229352303523135232352333523435235352363523735238352393524035241352423524335244352453524635247352483524935250352513525235253352543525535256352573525835259352603526135262352633526435265352663526735268352693527035271352723527335274352753527635277352783527935280352813528235283352843528535286352873528835289352903529135292352933529435295352963529735298352993530035301353023530335304353053530635307353083530935310353113531235313353143531535316353173531835319353203532135322353233532435325353263532735328353293533035331353323533335334353353533635337353383533935340353413534235343353443534535346353473534835349353503535135352353533535435355353563535735358353593536035361353623536335364353653536635367353683536935370353713537235373353743537535376353773537835379353803538135382353833538435385353863538735388353893539035391353923539335394353953539635397353983539935400354013540235403354043540535406354073540835409354103541135412354133541435415354163541735418354193542035421354223542335424354253542635427354283542935430354313543235433354343543535436354373543835439354403544135442354433544435445354463544735448354493545035451354523545335454354553545635457354583545935460354613546235463354643546535466354673546835469354703547135472354733547435475354763547735478354793548035481354823548335484354853548635487354883548935490354913549235493354943549535496354973549835499355003550135502355033550435505355063550735508355093551035511355123551335514355153551635517355183551935520355213552235523355243552535526355273552835529355303553135532355333553435535355363553735538355393554035541355423554335544355453554635547355483554935550355513555235553355543555535556355573555835559355603556135562355633556435565355663556735568355693557035571355723557335574355753557635577355783557935580355813558235583355843558535586355873558835589355903559135592355933559435595355963559735598355993560035601356023560335604356053560635607356083560935610356113561235613356143561535616356173561835619356203562135622356233562435625356263562735628356293563035631356323563335634356353563635637356383563935640356413564235643356443564535646356473564835649356503565135652356533565435655356563565735658356593566035661356623566335664356653566635667356683566935670356713567235673356743567535676356773567835679356803568135682356833568435685356863568735688356893569035691356923569335694356953569635697356983569935700357013570235703357043570535706357073570835709357103571135712357133571435715357163571735718357193572035721357223572335724357253572635727357283572935730357313573235733357343573535736357373573835739357403574135742357433574435745357463574735748357493575035751357523575335754357553575635757357583575935760357613576235763357643576535766357673576835769357703577135772357733577435775357763577735778357793578035781357823578335784357853578635787357883578935790357913579235793357943579535796357973579835799358003580135802358033580435805358063580735808358093581035811358123581335814358153581635817358183581935820358213582235823358243582535826358273582835829358303583135832358333583435835358363583735838358393584035841358423584335844358453584635847358483584935850358513585235853358543585535856358573585835859358603586135862358633586435865358663586735868358693587035871358723587335874358753587635877358783587935880358813588235883358843588535886358873588835889358903589135892358933589435895358963589735898358993590035901359023590335904359053590635907359083590935910359113591235913359143591535916359173591835919359203592135922359233592435925359263592735928359293593035931359323593335934359353593635937359383593935940359413594235943359443594535946359473594835949359503595135952359533595435955359563595735958359593596035961359623596335964359653596635967359683596935970359713597235973359743597535976359773597835979359803598135982359833598435985359863598735988359893599035991359923599335994359953599635997359983599936000360013600236003360043600536006360073600836009360103601136012360133601436015360163601736018360193602036021360223602336024360253602636027360283602936030360313603236033360343603536036360373603836039360403604136042360433604436045360463604736048360493605036051360523605336054360553605636057360583605936060360613606236063360643606536066360673606836069360703607136072360733607436075360763607736078360793608036081360823608336084360853608636087360883608936090360913609236093360943609536096360973609836099361003610136102361033610436105361063610736108361093611036111361123611336114361153611636117361183611936120361213612236123361243612536126361273612836129361303613136132361333613436135361363613736138361393614036141361423614336144361453614636147361483614936150361513615236153361543615536156361573615836159361603616136162361633616436165361663616736168361693617036171361723617336174361753617636177361783617936180361813618236183361843618536186361873618836189361903619136192361933619436195361963619736198361993620036201362023620336204362053620636207362083620936210362113621236213362143621536216362173621836219362203622136222362233622436225362263622736228362293623036231362323623336234362353623636237362383623936240362413624236243362443624536246362473624836249362503625136252362533625436255362563625736258362593626036261362623626336264362653626636267362683626936270362713627236273362743627536276362773627836279362803628136282362833628436285362863628736288362893629036291362923629336294362953629636297362983629936300363013630236303363043630536306363073630836309363103631136312363133631436315363163631736318363193632036321363223632336324363253632636327363283632936330363313633236333363343633536336363373633836339363403634136342363433634436345363463634736348363493635036351363523635336354363553635636357363583635936360363613636236363363643636536366363673636836369363703637136372363733637436375363763637736378363793638036381363823638336384363853638636387363883638936390363913639236393363943639536396363973639836399364003640136402364033640436405364063640736408364093641036411364123641336414364153641636417364183641936420364213642236423364243642536426364273642836429364303643136432364333643436435364363643736438364393644036441364423644336444364453644636447364483644936450364513645236453364543645536456364573645836459364603646136462364633646436465364663646736468364693647036471364723647336474364753647636477364783647936480364813648236483364843648536486364873648836489364903649136492364933649436495364963649736498364993650036501365023650336504365053650636507365083650936510365113651236513365143651536516365173651836519365203652136522365233652436525365263652736528365293653036531365323653336534365353653636537365383653936540365413654236543365443654536546365473654836549365503655136552365533655436555365563655736558365593656036561365623656336564365653656636567365683656936570365713657236573365743657536576365773657836579365803658136582365833658436585365863658736588365893659036591365923659336594365953659636597365983659936600366013660236603366043660536606366073660836609366103661136612366133661436615366163661736618366193662036621366223662336624366253662636627366283662936630366313663236633366343663536636366373663836639366403664136642366433664436645366463664736648366493665036651366523665336654366553665636657366583665936660366613666236663366643666536666366673666836669366703667136672366733667436675366763667736678366793668036681366823668336684366853668636687366883668936690366913669236693366943669536696366973669836699367003670136702367033670436705367063670736708367093671036711367123671336714367153671636717367183671936720367213672236723367243672536726367273672836729367303673136732367333673436735367363673736738367393674036741367423674336744367453674636747367483674936750367513675236753367543675536756367573675836759367603676136762367633676436765367663676736768367693677036771367723677336774367753677636777367783677936780367813678236783367843678536786367873678836789367903679136792367933679436795367963679736798367993680036801368023680336804368053680636807368083680936810368113681236813368143681536816368173681836819368203682136822368233682436825368263682736828368293683036831368323683336834368353683636837368383683936840368413684236843368443684536846368473684836849368503685136852368533685436855368563685736858368593686036861368623686336864368653686636867368683686936870368713687236873368743687536876368773687836879368803688136882368833688436885368863688736888368893689036891368923689336894368953689636897368983689936900369013690236903369043690536906369073690836909369103691136912369133691436915369163691736918369193692036921369223692336924369253692636927369283692936930369313693236933369343693536936369373693836939369403694136942369433694436945369463694736948369493695036951369523695336954369553695636957369583695936960369613696236963369643696536966369673696836969369703697136972369733697436975369763697736978369793698036981369823698336984369853698636987369883698936990369913699236993369943699536996369973699836999370003700137002370033700437005370063700737008370093701037011370123701337014370153701637017370183701937020370213702237023370243702537026370273702837029370303703137032370333703437035370363703737038370393704037041370423704337044370453704637047370483704937050370513705237053370543705537056370573705837059370603706137062370633706437065370663706737068370693707037071370723707337074370753707637077370783707937080370813708237083370843708537086370873708837089370903709137092370933709437095370963709737098370993710037101371023710337104371053710637107371083710937110371113711237113371143711537116371173711837119371203712137122371233712437125371263712737128371293713037131371323713337134371353713637137371383713937140371413714237143371443714537146371473714837149371503715137152371533715437155371563715737158371593716037161371623716337164371653716637167371683716937170371713717237173371743717537176371773717837179371803718137182371833718437185371863718737188371893719037191371923719337194371953719637197371983719937200372013720237203372043720537206372073720837209372103721137212372133721437215372163721737218372193722037221372223722337224372253722637227372283722937230372313723237233372343723537236372373723837239372403724137242372433724437245372463724737248372493725037251372523725337254372553725637257372583725937260372613726237263372643726537266372673726837269372703727137272372733727437275372763727737278372793728037281372823728337284372853728637287372883728937290372913729237293372943729537296372973729837299373003730137302373033730437305373063730737308373093731037311373123731337314373153731637317373183731937320373213732237323373243732537326373273732837329373303733137332373333733437335373363733737338373393734037341373423734337344373453734637347373483734937350373513735237353373543735537356373573735837359373603736137362373633736437365373663736737368373693737037371373723737337374373753737637377373783737937380373813738237383373843738537386373873738837389373903739137392373933739437395373963739737398373993740037401374023740337404374053740637407374083740937410374113741237413374143741537416374173741837419374203742137422374233742437425374263742737428374293743037431374323743337434374353743637437374383743937440374413744237443374443744537446374473744837449374503745137452374533745437455374563745737458374593746037461374623746337464374653746637467374683746937470374713747237473374743747537476374773747837479374803748137482374833748437485374863748737488374893749037491374923749337494374953749637497374983749937500375013750237503375043750537506375073750837509375103751137512375133751437515375163751737518375193752037521375223752337524375253752637527375283752937530375313753237533375343753537536375373753837539375403754137542375433754437545375463754737548375493755037551375523755337554375553755637557375583755937560375613756237563375643756537566375673756837569375703757137572375733757437575375763757737578375793758037581375823758337584375853758637587375883758937590375913759237593375943759537596375973759837599376003760137602376033760437605376063760737608376093761037611376123761337614376153761637617376183761937620376213762237623376243762537626376273762837629376303763137632376333763437635376363763737638376393764037641376423764337644376453764637647376483764937650376513765237653376543765537656376573765837659376603766137662376633766437665376663766737668376693767037671376723767337674376753767637677376783767937680376813768237683376843768537686376873768837689376903769137692376933769437695376963769737698376993770037701377023770337704377053770637707377083770937710377113771237713377143771537716377173771837719377203772137722377233772437725377263772737728377293773037731377323773337734377353773637737377383773937740377413774237743377443774537746377473774837749377503775137752377533775437755377563775737758377593776037761377623776337764377653776637767377683776937770377713777237773377743777537776377773777837779377803778137782377833778437785377863778737788377893779037791377923779337794377953779637797377983779937800378013780237803378043780537806378073780837809378103781137812378133781437815378163781737818378193782037821378223782337824378253782637827378283782937830378313783237833378343783537836378373783837839378403784137842378433784437845378463784737848378493785037851378523785337854378553785637857378583785937860378613786237863378643786537866378673786837869378703787137872378733787437875378763787737878378793788037881378823788337884378853788637887378883788937890378913789237893378943789537896378973789837899379003790137902379033790437905379063790737908379093791037911379123791337914379153791637917379183791937920379213792237923379243792537926379273792837929379303793137932379333793437935379363793737938379393794037941379423794337944379453794637947379483794937950379513795237953379543795537956379573795837959379603796137962379633796437965379663796737968379693797037971379723797337974379753797637977379783797937980379813798237983379843798537986379873798837989379903799137992379933799437995379963799737998379993800038001380023800338004380053800638007380083800938010380113801238013380143801538016380173801838019380203802138022380233802438025380263802738028380293803038031380323803338034380353803638037380383803938040380413804238043380443804538046380473804838049380503805138052380533805438055380563805738058380593806038061380623806338064380653806638067380683806938070380713807238073380743807538076380773807838079380803808138082380833808438085380863808738088380893809038091380923809338094380953809638097380983809938100381013810238103381043810538106381073810838109381103811138112381133811438115381163811738118381193812038121381223812338124381253812638127381283812938130381313813238133381343813538136381373813838139381403814138142381433814438145381463814738148381493815038151381523815338154381553815638157381583815938160381613816238163381643816538166381673816838169381703817138172381733817438175381763817738178381793818038181381823818338184381853818638187381883818938190381913819238193381943819538196381973819838199382003820138202382033820438205382063820738208382093821038211382123821338214382153821638217382183821938220382213822238223382243822538226382273822838229382303823138232382333823438235382363823738238382393824038241382423824338244382453824638247382483824938250382513825238253382543825538256382573825838259382603826138262382633826438265382663826738268382693827038271382723827338274382753827638277382783827938280382813828238283382843828538286382873828838289382903829138292382933829438295382963829738298382993830038301383023830338304383053830638307383083830938310383113831238313383143831538316383173831838319383203832138322383233832438325383263832738328383293833038331383323833338334383353833638337383383833938340383413834238343383443834538346383473834838349383503835138352383533835438355383563835738358383593836038361383623836338364383653836638367383683836938370383713837238373383743837538376383773837838379383803838138382383833838438385383863838738388383893839038391383923839338394383953839638397383983839938400384013840238403384043840538406384073840838409384103841138412384133841438415384163841738418384193842038421384223842338424384253842638427384283842938430384313843238433384343843538436384373843838439384403844138442384433844438445384463844738448384493845038451384523845338454384553845638457384583845938460384613846238463384643846538466384673846838469384703847138472384733847438475384763847738478384793848038481384823848338484384853848638487384883848938490384913849238493384943849538496384973849838499385003850138502385033850438505385063850738508385093851038511385123851338514385153851638517385183851938520385213852238523385243852538526385273852838529385303853138532385333853438535385363853738538385393854038541385423854338544385453854638547385483854938550385513855238553385543855538556385573855838559385603856138562385633856438565385663856738568385693857038571385723857338574385753857638577385783857938580385813858238583385843858538586385873858838589385903859138592385933859438595385963859738598385993860038601386023860338604386053860638607386083860938610386113861238613386143861538616386173861838619386203862138622386233862438625386263862738628386293863038631386323863338634386353863638637386383863938640386413864238643386443864538646386473864838649386503865138652386533865438655386563865738658386593866038661386623866338664386653866638667386683866938670386713867238673386743867538676386773867838679386803868138682386833868438685386863868738688386893869038691386923869338694386953869638697386983869938700387013870238703387043870538706387073870838709387103871138712387133871438715387163871738718387193872038721387223872338724387253872638727387283872938730387313873238733387343873538736387373873838739387403874138742387433874438745387463874738748387493875038751387523875338754387553875638757387583875938760387613876238763387643876538766387673876838769387703877138772387733877438775387763877738778387793878038781387823878338784387853878638787387883878938790387913879238793387943879538796387973879838799388003880138802388033880438805388063880738808388093881038811388123881338814388153881638817388183881938820388213882238823388243882538826388273882838829388303883138832388333883438835388363883738838388393884038841388423884338844388453884638847388483884938850388513885238853388543885538856388573885838859388603886138862388633886438865388663886738868388693887038871388723887338874388753887638877388783887938880388813888238883388843888538886388873888838889388903889138892388933889438895388963889738898388993890038901389023890338904389053890638907389083890938910389113891238913389143891538916389173891838919389203892138922389233892438925389263892738928389293893038931389323893338934389353893638937389383893938940389413894238943389443894538946389473894838949389503895138952389533895438955389563895738958389593896038961389623896338964389653896638967389683896938970389713897238973389743897538976389773897838979389803898138982389833898438985389863898738988389893899038991389923899338994389953899638997389983899939000390013900239003390043900539006390073900839009390103901139012390133901439015390163901739018390193902039021390223902339024390253902639027390283902939030390313903239033390343903539036390373903839039390403904139042390433904439045390463904739048390493905039051390523905339054390553905639057390583905939060390613906239063390643906539066390673906839069390703907139072390733907439075390763907739078390793908039081390823908339084390853908639087390883908939090390913909239093390943909539096390973909839099391003910139102391033910439105391063910739108391093911039111391123911339114391153911639117391183911939120391213912239123391243912539126391273912839129391303913139132391333913439135391363913739138391393914039141391423914339144391453914639147391483914939150391513915239153391543915539156391573915839159391603916139162391633916439165391663916739168391693917039171391723917339174391753917639177391783917939180391813918239183391843918539186391873918839189391903919139192391933919439195391963919739198391993920039201392023920339204392053920639207392083920939210392113921239213392143921539216392173921839219392203922139222392233922439225392263922739228392293923039231392323923339234392353923639237392383923939240392413924239243392443924539246392473924839249392503925139252392533925439255392563925739258392593926039261392623926339264392653926639267392683926939270392713927239273392743927539276392773927839279392803928139282392833928439285392863928739288392893929039291392923929339294392953929639297392983929939300393013930239303393043930539306393073930839309393103931139312393133931439315393163931739318393193932039321393223932339324393253932639327393283932939330393313933239333393343933539336393373933839339393403934139342393433934439345393463934739348393493935039351393523935339354393553935639357393583935939360393613936239363393643936539366393673936839369393703937139372393733937439375393763937739378393793938039381393823938339384393853938639387393883938939390393913939239393393943939539396393973939839399394003940139402394033940439405394063940739408394093941039411394123941339414394153941639417394183941939420394213942239423394243942539426394273942839429394303943139432394333943439435394363943739438394393944039441394423944339444394453944639447394483944939450394513945239453394543945539456394573945839459394603946139462394633946439465394663946739468394693947039471394723947339474394753947639477394783947939480394813948239483394843948539486394873948839489394903949139492394933949439495394963949739498394993950039501395023950339504395053950639507395083950939510395113951239513395143951539516395173951839519395203952139522395233952439525395263952739528395293953039531395323953339534395353953639537395383953939540395413954239543395443954539546395473954839549395503955139552395533955439555395563955739558395593956039561395623956339564395653956639567395683956939570395713957239573395743957539576395773957839579395803958139582395833958439585395863958739588395893959039591395923959339594395953959639597395983959939600396013960239603396043960539606396073960839609396103961139612396133961439615396163961739618396193962039621396223962339624396253962639627396283962939630396313963239633396343963539636396373963839639396403964139642396433964439645396463964739648396493965039651396523965339654396553965639657396583965939660396613966239663396643966539666396673966839669396703967139672396733967439675396763967739678396793968039681396823968339684396853968639687396883968939690396913969239693396943969539696396973969839699397003970139702397033970439705397063970739708397093971039711397123971339714397153971639717397183971939720397213972239723397243972539726397273972839729397303973139732397333973439735397363973739738397393974039741397423974339744397453974639747397483974939750397513975239753397543975539756397573975839759397603976139762397633976439765397663976739768397693977039771397723977339774397753977639777397783977939780397813978239783397843978539786397873978839789397903979139792397933979439795397963979739798397993980039801398023980339804398053980639807398083980939810398113981239813398143981539816398173981839819398203982139822398233982439825398263982739828398293983039831398323983339834398353983639837398383983939840398413984239843398443984539846398473984839849398503985139852398533985439855398563985739858398593986039861398623986339864398653986639867398683986939870398713987239873398743987539876398773987839879398803988139882398833988439885398863988739888398893989039891398923989339894398953989639897398983989939900399013990239903399043990539906399073990839909399103991139912399133991439915399163991739918399193992039921399223992339924399253992639927399283992939930399313993239933399343993539936399373993839939399403994139942399433994439945399463994739948399493995039951399523995339954399553995639957399583995939960399613996239963399643996539966399673996839969399703997139972399733997439975399763997739978399793998039981399823998339984399853998639987399883998939990399913999239993399943999539996399973999839999400004000140002400034000440005400064000740008400094001040011400124001340014400154001640017400184001940020400214002240023400244002540026400274002840029400304003140032400334003440035400364003740038400394004040041400424004340044400454004640047400484004940050400514005240053400544005540056400574005840059400604006140062400634006440065400664006740068400694007040071400724007340074400754007640077400784007940080400814008240083400844008540086400874008840089400904009140092400934009440095400964009740098400994010040101401024010340104401054010640107401084010940110401114011240113401144011540116401174011840119401204012140122401234012440125401264012740128401294013040131401324013340134401354013640137401384013940140401414014240143401444014540146401474014840149401504015140152401534015440155401564015740158401594016040161401624016340164401654016640167401684016940170401714017240173401744017540176401774017840179401804018140182401834018440185401864018740188401894019040191401924019340194401954019640197401984019940200402014020240203402044020540206402074020840209402104021140212402134021440215402164021740218402194022040221402224022340224402254022640227402284022940230402314023240233402344023540236402374023840239402404024140242402434024440245402464024740248402494025040251402524025340254402554025640257402584025940260402614026240263402644026540266402674026840269402704027140272402734027440275402764027740278402794028040281402824028340284402854028640287402884028940290402914029240293402944029540296402974029840299403004030140302403034030440305403064030740308403094031040311403124031340314403154031640317403184031940320403214032240323403244032540326403274032840329403304033140332403334033440335403364033740338403394034040341403424034340344403454034640347403484034940350403514035240353403544035540356403574035840359403604036140362403634036440365403664036740368403694037040371403724037340374403754037640377403784037940380403814038240383403844038540386403874038840389403904039140392403934039440395403964039740398403994040040401404024040340404404054040640407404084040940410404114041240413404144041540416404174041840419404204042140422404234042440425404264042740428404294043040431404324043340434404354043640437404384043940440404414044240443404444044540446404474044840449404504045140452404534045440455404564045740458404594046040461404624046340464404654046640467404684046940470404714047240473404744047540476404774047840479404804048140482404834048440485404864048740488404894049040491404924049340494404954049640497404984049940500405014050240503405044050540506405074050840509405104051140512405134051440515405164051740518405194052040521405224052340524405254052640527405284052940530405314053240533405344053540536405374053840539405404054140542405434054440545405464054740548405494055040551405524055340554405554055640557405584055940560405614056240563405644056540566405674056840569405704057140572405734057440575405764057740578405794058040581405824058340584405854058640587405884058940590405914059240593405944059540596405974059840599406004060140602406034060440605406064060740608406094061040611406124061340614406154061640617406184061940620406214062240623406244062540626406274062840629406304063140632406334063440635406364063740638406394064040641406424064340644406454064640647406484064940650406514065240653406544065540656406574065840659406604066140662406634066440665406664066740668406694067040671406724067340674406754067640677406784067940680406814068240683406844068540686406874068840689406904069140692406934069440695406964069740698406994070040701407024070340704407054070640707407084070940710407114071240713407144071540716407174071840719407204072140722407234072440725407264072740728407294073040731407324073340734407354073640737407384073940740407414074240743407444074540746407474074840749407504075140752407534075440755407564075740758407594076040761407624076340764407654076640767407684076940770407714077240773407744077540776407774077840779407804078140782407834078440785407864078740788407894079040791407924079340794407954079640797407984079940800408014080240803408044080540806408074080840809408104081140812408134081440815408164081740818408194082040821408224082340824408254082640827408284082940830408314083240833408344083540836408374083840839408404084140842408434084440845408464084740848408494085040851408524085340854408554085640857408584085940860408614086240863408644086540866408674086840869408704087140872408734087440875408764087740878408794088040881408824088340884408854088640887408884088940890408914089240893408944089540896408974089840899409004090140902409034090440905409064090740908409094091040911409124091340914409154091640917409184091940920409214092240923409244092540926409274092840929409304093140932409334093440935409364093740938409394094040941409424094340944409454094640947409484094940950409514095240953409544095540956409574095840959409604096140962409634096440965409664096740968409694097040971409724097340974409754097640977409784097940980409814098240983409844098540986409874098840989409904099140992409934099440995409964099740998409994100041001410024100341004410054100641007410084100941010410114101241013410144101541016410174101841019410204102141022410234102441025410264102741028410294103041031410324103341034410354103641037410384103941040410414104241043410444104541046410474104841049410504105141052410534105441055410564105741058410594106041061410624106341064410654106641067410684106941070410714107241073410744107541076410774107841079410804108141082410834108441085410864108741088410894109041091410924109341094410954109641097410984109941100411014110241103411044110541106411074110841109411104111141112411134111441115411164111741118411194112041121411224112341124411254112641127411284112941130411314113241133411344113541136411374113841139411404114141142411434114441145411464114741148411494115041151411524115341154411554115641157411584115941160411614116241163411644116541166411674116841169411704117141172411734117441175411764117741178411794118041181411824118341184411854118641187411884118941190411914119241193411944119541196411974119841199412004120141202412034120441205412064120741208412094121041211412124121341214412154121641217412184121941220412214122241223412244122541226412274122841229412304123141232412334123441235412364123741238412394124041241412424124341244412454124641247412484124941250412514125241253412544125541256412574125841259412604126141262412634126441265412664126741268412694127041271412724127341274412754127641277412784127941280412814128241283412844128541286412874128841289412904129141292412934129441295412964129741298412994130041301413024130341304413054130641307413084130941310413114131241313413144131541316413174131841319413204132141322413234132441325413264132741328413294133041331413324133341334413354133641337413384133941340413414134241343413444134541346413474134841349413504135141352413534135441355413564135741358413594136041361413624136341364413654136641367413684136941370413714137241373413744137541376413774137841379413804138141382413834138441385413864138741388413894139041391413924139341394413954139641397413984139941400414014140241403414044140541406414074140841409414104141141412414134141441415414164141741418414194142041421414224142341424414254142641427414284142941430414314143241433414344143541436414374143841439414404144141442414434144441445414464144741448414494145041451414524145341454414554145641457414584145941460414614146241463414644146541466414674146841469414704147141472414734147441475414764147741478414794148041481414824148341484414854148641487414884148941490414914149241493414944149541496414974149841499415004150141502415034150441505415064150741508415094151041511415124151341514415154151641517415184151941520415214152241523415244152541526415274152841529415304153141532415334153441535415364153741538415394154041541415424154341544415454154641547415484154941550415514155241553415544155541556415574155841559415604156141562415634156441565415664156741568415694157041571415724157341574415754157641577415784157941580415814158241583415844158541586415874158841589415904159141592415934159441595415964159741598415994160041601416024160341604416054160641607416084160941610416114161241613416144161541616416174161841619416204162141622416234162441625416264162741628416294163041631416324163341634416354163641637416384163941640416414164241643416444164541646416474164841649416504165141652416534165441655416564165741658416594166041661416624166341664416654166641667416684166941670416714167241673416744167541676416774167841679416804168141682416834168441685416864168741688416894169041691416924169341694416954169641697416984169941700417014170241703417044170541706417074170841709417104171141712417134171441715417164171741718417194172041721417224172341724417254172641727417284172941730417314173241733417344173541736417374173841739417404174141742417434174441745417464174741748417494175041751417524175341754417554175641757417584175941760417614176241763417644176541766417674176841769417704177141772417734177441775417764177741778417794178041781417824178341784417854178641787417884178941790417914179241793417944179541796417974179841799418004180141802418034180441805418064180741808418094181041811418124181341814418154181641817418184181941820418214182241823418244182541826418274182841829418304183141832418334183441835418364183741838418394184041841418424184341844418454184641847418484184941850418514185241853418544185541856418574185841859418604186141862418634186441865418664186741868418694187041871418724187341874418754187641877418784187941880418814188241883418844188541886418874188841889418904189141892418934189441895418964189741898418994190041901419024190341904419054190641907419084190941910419114191241913419144191541916419174191841919419204192141922419234192441925419264192741928419294193041931419324193341934419354193641937419384193941940419414194241943419444194541946419474194841949419504195141952419534195441955419564195741958419594196041961419624196341964419654196641967419684196941970419714197241973419744197541976419774197841979419804198141982419834198441985419864198741988419894199041991419924199341994419954199641997419984199942000420014200242003420044200542006420074200842009420104201142012420134201442015420164201742018420194202042021420224202342024420254202642027420284202942030420314203242033420344203542036420374203842039420404204142042420434204442045420464204742048420494205042051420524205342054420554205642057420584205942060420614206242063420644206542066420674206842069420704207142072420734207442075420764207742078420794208042081420824208342084420854208642087420884208942090420914209242093420944209542096420974209842099421004210142102421034210442105421064210742108421094211042111421124211342114421154211642117421184211942120421214212242123421244212542126421274212842129421304213142132421334213442135421364213742138421394214042141421424214342144421454214642147421484214942150421514215242153421544215542156421574215842159421604216142162421634216442165421664216742168421694217042171421724217342174421754217642177421784217942180421814218242183421844218542186421874218842189421904219142192421934219442195421964219742198421994220042201422024220342204422054220642207422084220942210422114221242213422144221542216422174221842219422204222142222422234222442225422264222742228422294223042231422324223342234422354223642237422384223942240422414224242243422444224542246422474224842249422504225142252422534225442255422564225742258422594226042261422624226342264422654226642267422684226942270422714227242273422744227542276422774227842279422804228142282422834228442285422864228742288422894229042291422924229342294422954229642297422984229942300423014230242303423044230542306423074230842309423104231142312423134231442315423164231742318423194232042321423224232342324423254232642327423284232942330423314233242333423344233542336423374233842339423404234142342423434234442345423464234742348423494235042351423524235342354423554235642357423584235942360423614236242363423644236542366423674236842369423704237142372423734237442375423764237742378423794238042381423824238342384423854238642387423884238942390423914239242393423944239542396423974239842399424004240142402424034240442405424064240742408424094241042411424124241342414424154241642417424184241942420424214242242423424244242542426424274242842429424304243142432424334243442435424364243742438424394244042441424424244342444424454244642447424484244942450424514245242453424544245542456424574245842459424604246142462424634246442465424664246742468424694247042471424724247342474424754247642477424784247942480424814248242483424844248542486424874248842489424904249142492424934249442495424964249742498424994250042501425024250342504425054250642507425084250942510425114251242513425144251542516425174251842519425204252142522425234252442525425264252742528425294253042531425324253342534425354253642537425384253942540425414254242543425444254542546425474254842549425504255142552425534255442555425564255742558425594256042561425624256342564425654256642567425684256942570425714257242573425744257542576425774257842579425804258142582425834258442585425864258742588425894259042591425924259342594425954259642597425984259942600426014260242603426044260542606426074260842609426104261142612426134261442615426164261742618426194262042621426224262342624426254262642627426284262942630426314263242633426344263542636426374263842639426404264142642426434264442645426464264742648426494265042651426524265342654426554265642657426584265942660426614266242663426644266542666426674266842669426704267142672426734267442675426764267742678426794268042681426824268342684426854268642687426884268942690426914269242693426944269542696426974269842699427004270142702427034270442705427064270742708427094271042711427124271342714427154271642717427184271942720427214272242723427244272542726427274272842729427304273142732427334273442735427364273742738427394274042741427424274342744427454274642747427484274942750427514275242753427544275542756427574275842759427604276142762427634276442765427664276742768427694277042771427724277342774427754277642777427784277942780427814278242783427844278542786427874278842789427904279142792427934279442795427964279742798427994280042801428024280342804428054280642807428084280942810428114281242813428144281542816428174281842819428204282142822428234282442825428264282742828428294283042831428324283342834428354283642837428384283942840428414284242843428444284542846428474284842849428504285142852428534285442855428564285742858428594286042861428624286342864428654286642867428684286942870428714287242873428744287542876428774287842879428804288142882428834288442885428864288742888428894289042891428924289342894428954289642897428984289942900429014290242903429044290542906429074290842909429104291142912429134291442915429164291742918429194292042921429224292342924429254292642927429284292942930429314293242933429344293542936429374293842939429404294142942429434294442945429464294742948429494295042951429524295342954429554295642957429584295942960429614296242963429644296542966429674296842969429704297142972429734297442975429764297742978429794298042981429824298342984429854298642987429884298942990429914299242993429944299542996429974299842999430004300143002430034300443005430064300743008430094301043011430124301343014430154301643017430184301943020430214302243023430244302543026430274302843029430304303143032430334303443035430364303743038430394304043041430424304343044430454304643047430484304943050430514305243053430544305543056430574305843059430604306143062430634306443065430664306743068430694307043071430724307343074430754307643077430784307943080430814308243083430844308543086430874308843089430904309143092430934309443095430964309743098430994310043101431024310343104431054310643107431084310943110431114311243113431144311543116431174311843119431204312143122431234312443125431264312743128431294313043131431324313343134431354313643137431384313943140431414314243143431444314543146431474314843149431504315143152431534315443155431564315743158431594316043161431624316343164431654316643167431684316943170431714317243173431744317543176431774317843179431804318143182431834318443185431864318743188431894319043191431924319343194431954319643197431984319943200432014320243203432044320543206432074320843209432104321143212432134321443215432164321743218432194322043221432224322343224432254322643227432284322943230432314323243233432344323543236432374323843239432404324143242432434324443245432464324743248432494325043251432524325343254432554325643257432584325943260432614326243263432644326543266432674326843269432704327143272432734327443275432764327743278432794328043281432824328343284432854328643287432884328943290432914329243293432944329543296432974329843299433004330143302433034330443305433064330743308433094331043311433124331343314433154331643317433184331943320433214332243323433244332543326433274332843329433304333143332433334333443335433364333743338433394334043341433424334343344433454334643347433484334943350433514335243353433544335543356433574335843359433604336143362433634336443365433664336743368433694337043371433724337343374433754337643377433784337943380433814338243383433844338543386433874338843389433904339143392433934339443395433964339743398433994340043401434024340343404434054340643407434084340943410434114341243413434144341543416434174341843419434204342143422434234342443425434264342743428434294343043431434324343343434434354343643437434384343943440434414344243443434444344543446434474344843449434504345143452434534345443455434564345743458434594346043461434624346343464434654346643467434684346943470434714347243473434744347543476434774347843479434804348143482434834348443485434864348743488434894349043491434924349343494434954349643497434984349943500435014350243503435044350543506435074350843509435104351143512435134351443515435164351743518435194352043521435224352343524435254352643527435284352943530435314353243533435344353543536435374353843539435404354143542435434354443545435464354743548435494355043551435524355343554435554355643557435584355943560435614356243563435644356543566435674356843569435704357143572435734357443575435764357743578435794358043581435824358343584435854358643587435884358943590435914359243593435944359543596435974359843599436004360143602436034360443605436064360743608436094361043611436124361343614436154361643617436184361943620436214362243623436244362543626436274362843629436304363143632436334363443635436364363743638436394364043641436424364343644436454364643647436484364943650436514365243653436544365543656436574365843659436604366143662436634366443665436664366743668436694367043671436724367343674436754367643677436784367943680436814368243683436844368543686436874368843689436904369143692436934369443695436964369743698436994370043701437024370343704437054370643707437084370943710437114371243713437144371543716437174371843719437204372143722437234372443725437264372743728437294373043731437324373343734437354373643737437384373943740437414374243743437444374543746437474374843749437504375143752437534375443755437564375743758437594376043761437624376343764437654376643767437684376943770437714377243773437744377543776437774377843779437804378143782437834378443785437864378743788437894379043791437924379343794437954379643797437984379943800438014380243803438044380543806438074380843809438104381143812438134381443815438164381743818438194382043821438224382343824438254382643827438284382943830438314383243833438344383543836438374383843839438404384143842438434384443845438464384743848438494385043851438524385343854438554385643857438584385943860438614386243863438644386543866438674386843869438704387143872438734387443875438764387743878438794388043881438824388343884438854388643887438884388943890438914389243893438944389543896438974389843899439004390143902439034390443905439064390743908439094391043911439124391343914439154391643917439184391943920439214392243923439244392543926439274392843929439304393143932439334393443935439364393743938439394394043941439424394343944439454394643947439484394943950439514395243953439544395543956439574395843959439604396143962439634396443965439664396743968439694397043971439724397343974439754397643977439784397943980439814398243983439844398543986439874398843989439904399143992439934399443995439964399743998439994400044001440024400344004440054400644007440084400944010440114401244013440144401544016440174401844019440204402144022440234402444025440264402744028440294403044031440324403344034440354403644037440384403944040440414404244043440444404544046440474404844049440504405144052440534405444055440564405744058440594406044061440624406344064440654406644067440684406944070440714407244073440744407544076440774407844079440804408144082440834408444085440864408744088440894409044091440924409344094440954409644097440984409944100441014410244103441044410544106441074410844109441104411144112441134411444115441164411744118441194412044121441224412344124441254412644127441284412944130441314413244133441344413544136441374413844139441404414144142441434414444145441464414744148441494415044151441524415344154441554415644157441584415944160441614416244163441644416544166441674416844169441704417144172441734417444175441764417744178441794418044181441824418344184441854418644187441884418944190441914419244193441944419544196441974419844199442004420144202442034420444205442064420744208442094421044211442124421344214442154421644217442184421944220442214422244223442244422544226442274422844229442304423144232442334423444235442364423744238442394424044241442424424344244442454424644247442484424944250442514425244253442544425544256442574425844259442604426144262442634426444265442664426744268442694427044271442724427344274442754427644277442784427944280442814428244283442844428544286442874428844289442904429144292442934429444295442964429744298442994430044301443024430344304443054430644307443084430944310443114431244313443144431544316443174431844319443204432144322443234432444325443264432744328443294433044331443324433344334443354433644337443384433944340443414434244343443444434544346443474434844349443504435144352443534435444355443564435744358443594436044361443624436344364443654436644367443684436944370443714437244373443744437544376443774437844379443804438144382443834438444385443864438744388443894439044391443924439344394443954439644397443984439944400444014440244403444044440544406444074440844409444104441144412444134441444415444164441744418444194442044421444224442344424444254442644427444284442944430444314443244433444344443544436444374443844439444404444144442444434444444445444464444744448444494445044451444524445344454444554445644457444584445944460444614446244463444644446544466444674446844469444704447144472444734447444475444764447744478444794448044481444824448344484444854448644487444884448944490444914449244493444944449544496444974449844499445004450144502445034450444505445064450744508445094451044511445124451344514445154451644517445184451944520445214452244523445244452544526445274452844529445304453144532445334453444535445364453744538445394454044541445424454344544445454454644547445484454944550445514455244553445544455544556445574455844559445604456144562445634456444565445664456744568445694457044571445724457344574445754457644577445784457944580445814458244583445844458544586445874458844589445904459144592445934459444595445964459744598445994460044601446024460344604446054460644607446084460944610446114461244613446144461544616446174461844619446204462144622446234462444625446264462744628446294463044631446324463344634446354463644637446384463944640446414464244643446444464544646446474464844649446504465144652446534465444655446564465744658446594466044661446624466344664446654466644667446684466944670446714467244673446744467544676446774467844679446804468144682446834468444685446864468744688446894469044691446924469344694446954469644697446984469944700447014470244703447044470544706447074470844709447104471144712447134471444715447164471744718447194472044721447224472344724447254472644727447284472944730447314473244733447344473544736447374473844739447404474144742447434474444745447464474744748447494475044751447524475344754447554475644757447584475944760447614476244763447644476544766447674476844769447704477144772447734477444775447764477744778447794478044781447824478344784447854478644787447884478944790447914479244793447944479544796447974479844799448004480144802448034480444805448064480744808448094481044811448124481344814448154481644817448184481944820448214482244823448244482544826448274482844829448304483144832448334483444835448364483744838448394484044841448424484344844448454484644847448484484944850448514485244853448544485544856448574485844859448604486144862448634486444865448664486744868448694487044871448724487344874448754487644877448784487944880448814488244883448844488544886448874488844889448904489144892448934489444895448964489744898448994490044901449024490344904449054490644907449084490944910449114491244913449144491544916449174491844919449204492144922449234492444925449264492744928449294493044931449324493344934449354493644937449384493944940449414494244943449444494544946449474494844949449504495144952449534495444955449564495744958449594496044961449624496344964449654496644967449684496944970449714497244973449744497544976449774497844979449804498144982449834498444985449864498744988449894499044991449924499344994449954499644997449984499945000450014500245003450044500545006450074500845009450104501145012450134501445015450164501745018450194502045021450224502345024450254502645027450284502945030450314503245033450344503545036450374503845039450404504145042450434504445045450464504745048450494505045051450524505345054450554505645057450584505945060450614506245063450644506545066450674506845069450704507145072450734507445075450764507745078450794508045081450824508345084450854508645087450884508945090450914509245093450944509545096450974509845099451004510145102451034510445105451064510745108451094511045111451124511345114451154511645117451184511945120451214512245123451244512545126451274512845129451304513145132451334513445135451364513745138451394514045141451424514345144451454514645147451484514945150451514515245153451544515545156451574515845159451604516145162451634516445165451664516745168451694517045171451724517345174451754517645177451784517945180451814518245183451844518545186451874518845189451904519145192451934519445195451964519745198451994520045201452024520345204452054520645207452084520945210452114521245213452144521545216452174521845219452204522145222452234522445225452264522745228452294523045231452324523345234452354523645237452384523945240452414524245243452444524545246452474524845249452504525145252452534525445255452564525745258452594526045261452624526345264452654526645267452684526945270452714527245273452744527545276452774527845279452804528145282452834528445285452864528745288452894529045291452924529345294452954529645297452984529945300453014530245303453044530545306453074530845309453104531145312453134531445315453164531745318453194532045321453224532345324453254532645327453284532945330453314533245333453344533545336453374533845339453404534145342453434534445345453464534745348453494535045351453524535345354453554535645357453584535945360453614536245363453644536545366453674536845369453704537145372453734537445375453764537745378453794538045381453824538345384453854538645387453884538945390453914539245393453944539545396453974539845399454004540145402454034540445405454064540745408454094541045411454124541345414454154541645417454184541945420454214542245423454244542545426454274542845429454304543145432454334543445435454364543745438454394544045441454424544345444454454544645447454484544945450454514545245453454544545545456454574545845459454604546145462454634546445465454664546745468454694547045471454724547345474454754547645477454784547945480454814548245483454844548545486454874548845489454904549145492454934549445495454964549745498454994550045501455024550345504455054550645507455084550945510455114551245513455144551545516455174551845519455204552145522455234552445525455264552745528455294553045531455324553345534455354553645537455384553945540455414554245543455444554545546455474554845549455504555145552455534555445555455564555745558455594556045561455624556345564455654556645567455684556945570455714557245573455744557545576455774557845579455804558145582455834558445585455864558745588455894559045591455924559345594455954559645597455984559945600456014560245603456044560545606456074560845609456104561145612456134561445615456164561745618456194562045621456224562345624456254562645627456284562945630456314563245633456344563545636456374563845639456404564145642456434564445645456464564745648456494565045651456524565345654456554565645657456584565945660456614566245663456644566545666456674566845669456704567145672456734567445675456764567745678456794568045681456824568345684456854568645687456884568945690456914569245693456944569545696456974569845699457004570145702457034570445705457064570745708457094571045711457124571345714457154571645717457184571945720457214572245723457244572545726457274572845729457304573145732457334573445735457364573745738457394574045741457424574345744457454574645747457484574945750457514575245753457544575545756457574575845759457604576145762457634576445765457664576745768457694577045771457724577345774457754577645777457784577945780457814578245783457844578545786457874578845789457904579145792457934579445795457964579745798457994580045801458024580345804458054580645807458084580945810458114581245813458144581545816458174581845819458204582145822458234582445825458264582745828458294583045831458324583345834458354583645837458384583945840458414584245843458444584545846458474584845849458504585145852458534585445855458564585745858458594586045861458624586345864458654586645867458684586945870458714587245873458744587545876458774587845879458804588145882458834588445885458864588745888458894589045891458924589345894458954589645897458984589945900459014590245903459044590545906459074590845909459104591145912459134591445915459164591745918459194592045921459224592345924459254592645927459284592945930459314593245933459344593545936459374593845939459404594145942459434594445945459464594745948459494595045951459524595345954459554595645957459584595945960459614596245963459644596545966459674596845969459704597145972459734597445975459764597745978459794598045981459824598345984459854598645987459884598945990459914599245993459944599545996459974599845999460004600146002460034600446005460064600746008460094601046011460124601346014460154601646017460184601946020460214602246023460244602546026460274602846029460304603146032460334603446035460364603746038460394604046041460424604346044460454604646047460484604946050460514605246053460544605546056460574605846059460604606146062460634606446065460664606746068460694607046071460724607346074460754607646077460784607946080460814608246083460844608546086460874608846089460904609146092460934609446095460964609746098460994610046101461024610346104461054610646107461084610946110461114611246113461144611546116461174611846119461204612146122461234612446125461264612746128461294613046131461324613346134461354613646137461384613946140461414614246143461444614546146461474614846149461504615146152461534615446155461564615746158461594616046161461624616346164461654616646167461684616946170461714617246173461744617546176461774617846179461804618146182461834618446185461864618746188461894619046191461924619346194461954619646197461984619946200462014620246203462044620546206462074620846209462104621146212462134621446215462164621746218462194622046221462224622346224462254622646227462284622946230462314623246233462344623546236462374623846239462404624146242462434624446245462464624746248462494625046251462524625346254462554625646257462584625946260462614626246263462644626546266462674626846269462704627146272462734627446275462764627746278462794628046281462824628346284462854628646287462884628946290462914629246293462944629546296462974629846299463004630146302463034630446305463064630746308463094631046311463124631346314463154631646317463184631946320463214632246323463244632546326463274632846329463304633146332463334633446335463364633746338463394634046341463424634346344463454634646347463484634946350463514635246353463544635546356463574635846359463604636146362463634636446365463664636746368463694637046371463724637346374463754637646377463784637946380463814638246383463844638546386463874638846389463904639146392463934639446395463964639746398463994640046401464024640346404464054640646407464084640946410464114641246413464144641546416464174641846419464204642146422464234642446425464264642746428464294643046431464324643346434464354643646437464384643946440464414644246443464444644546446464474644846449464504645146452464534645446455464564645746458464594646046461464624646346464464654646646467464684646946470464714647246473464744647546476464774647846479464804648146482464834648446485464864648746488464894649046491464924649346494464954649646497464984649946500465014650246503465044650546506465074650846509465104651146512465134651446515465164651746518465194652046521465224652346524465254652646527465284652946530465314653246533465344653546536465374653846539465404654146542465434654446545465464654746548465494655046551465524655346554465554655646557465584655946560465614656246563465644656546566465674656846569465704657146572465734657446575465764657746578465794658046581465824658346584465854658646587465884658946590465914659246593465944659546596465974659846599466004660146602466034660446605466064660746608466094661046611466124661346614466154661646617466184661946620466214662246623466244662546626466274662846629466304663146632466334663446635466364663746638466394664046641466424664346644466454664646647466484664946650466514665246653466544665546656466574665846659466604666146662466634666446665466664666746668466694667046671466724667346674466754667646677466784667946680466814668246683466844668546686466874668846689466904669146692466934669446695466964669746698466994670046701467024670346704467054670646707467084670946710467114671246713467144671546716467174671846719467204672146722467234672446725467264672746728467294673046731467324673346734467354673646737467384673946740467414674246743467444674546746467474674846749467504675146752467534675446755467564675746758467594676046761467624676346764467654676646767467684676946770467714677246773467744677546776467774677846779467804678146782467834678446785467864678746788467894679046791467924679346794467954679646797467984679946800468014680246803468044680546806468074680846809468104681146812468134681446815468164681746818468194682046821468224682346824468254682646827468284682946830468314683246833468344683546836468374683846839468404684146842468434684446845468464684746848468494685046851468524685346854468554685646857468584685946860468614686246863468644686546866468674686846869468704687146872468734687446875468764687746878468794688046881468824688346884468854688646887468884688946890468914689246893468944689546896468974689846899469004690146902469034690446905469064690746908469094691046911469124691346914469154691646917469184691946920469214692246923469244692546926469274692846929469304693146932469334693446935469364693746938469394694046941469424694346944469454694646947469484694946950469514695246953469544695546956469574695846959469604696146962469634696446965469664696746968469694697046971469724697346974469754697646977469784697946980469814698246983469844698546986469874698846989469904699146992469934699446995469964699746998469994700047001470024700347004470054700647007470084700947010470114701247013470144701547016470174701847019470204702147022470234702447025470264702747028470294703047031470324703347034470354703647037470384703947040470414704247043470444704547046470474704847049470504705147052470534705447055470564705747058470594706047061470624706347064470654706647067470684706947070470714707247073470744707547076470774707847079470804708147082470834708447085470864708747088470894709047091470924709347094470954709647097470984709947100471014710247103471044710547106471074710847109471104711147112471134711447115471164711747118471194712047121471224712347124471254712647127471284712947130471314713247133471344713547136471374713847139471404714147142471434714447145471464714747148471494715047151471524715347154471554715647157471584715947160471614716247163471644716547166471674716847169471704717147172471734717447175471764717747178471794718047181471824718347184471854718647187471884718947190471914719247193471944719547196471974719847199472004720147202472034720447205472064720747208472094721047211472124721347214472154721647217472184721947220472214722247223472244722547226472274722847229472304723147232472334723447235472364723747238472394724047241472424724347244472454724647247472484724947250472514725247253472544725547256472574725847259472604726147262472634726447265472664726747268472694727047271472724727347274472754727647277472784727947280472814728247283472844728547286472874728847289472904729147292472934729447295472964729747298472994730047301473024730347304473054730647307473084730947310473114731247313473144731547316473174731847319473204732147322473234732447325473264732747328473294733047331473324733347334473354733647337473384733947340473414734247343473444734547346473474734847349473504735147352473534735447355473564735747358473594736047361473624736347364473654736647367473684736947370473714737247373473744737547376473774737847379473804738147382473834738447385473864738747388473894739047391473924739347394473954739647397473984739947400474014740247403474044740547406474074740847409474104741147412474134741447415474164741747418474194742047421474224742347424474254742647427474284742947430474314743247433474344743547436474374743847439474404744147442474434744447445474464744747448474494745047451474524745347454474554745647457474584745947460474614746247463474644746547466474674746847469474704747147472474734747447475474764747747478474794748047481474824748347484474854748647487474884748947490474914749247493474944749547496474974749847499475004750147502475034750447505475064750747508475094751047511475124751347514475154751647517475184751947520475214752247523475244752547526475274752847529475304753147532475334753447535475364753747538475394754047541475424754347544475454754647547475484754947550475514755247553475544755547556475574755847559475604756147562475634756447565475664756747568475694757047571475724757347574475754757647577475784757947580475814758247583475844758547586475874758847589475904759147592475934759447595475964759747598475994760047601476024760347604476054760647607476084760947610476114761247613476144761547616476174761847619476204762147622476234762447625476264762747628476294763047631476324763347634476354763647637476384763947640476414764247643476444764547646476474764847649476504765147652476534765447655476564765747658476594766047661476624766347664476654766647667476684766947670476714767247673476744767547676476774767847679476804768147682476834768447685476864768747688476894769047691476924769347694476954769647697476984769947700477014770247703477044770547706477074770847709477104771147712477134771447715477164771747718477194772047721477224772347724477254772647727477284772947730477314773247733477344773547736477374773847739477404774147742477434774447745477464774747748477494775047751477524775347754477554775647757477584775947760477614776247763477644776547766477674776847769477704777147772477734777447775477764777747778477794778047781477824778347784477854778647787477884778947790477914779247793477944779547796477974779847799478004780147802478034780447805478064780747808478094781047811478124781347814478154781647817478184781947820478214782247823478244782547826478274782847829478304783147832478334783447835478364783747838478394784047841478424784347844478454784647847478484784947850478514785247853478544785547856478574785847859478604786147862478634786447865478664786747868478694787047871478724787347874478754787647877478784787947880478814788247883478844788547886478874788847889478904789147892478934789447895478964789747898478994790047901479024790347904479054790647907479084790947910479114791247913479144791547916479174791847919479204792147922479234792447925479264792747928479294793047931479324793347934479354793647937479384793947940479414794247943479444794547946479474794847949479504795147952479534795447955479564795747958479594796047961479624796347964479654796647967479684796947970479714797247973479744797547976479774797847979479804798147982479834798447985479864798747988479894799047991479924799347994479954799647997479984799948000480014800248003480044800548006480074800848009480104801148012480134801448015480164801748018480194802048021480224802348024480254802648027480284802948030480314803248033480344803548036480374803848039480404804148042480434804448045480464804748048480494805048051480524805348054480554805648057480584805948060480614806248063480644806548066480674806848069480704807148072480734807448075480764807748078480794808048081480824808348084480854808648087480884808948090480914809248093480944809548096480974809848099481004810148102481034810448105481064810748108481094811048111481124811348114481154811648117481184811948120481214812248123481244812548126481274812848129481304813148132481334813448135481364813748138481394814048141481424814348144481454814648147481484814948150481514815248153481544815548156481574815848159481604816148162481634816448165481664816748168481694817048171481724817348174481754817648177481784817948180481814818248183481844818548186481874818848189481904819148192481934819448195481964819748198481994820048201482024820348204482054820648207482084820948210482114821248213482144821548216482174821848219482204822148222482234822448225482264822748228482294823048231482324823348234482354823648237482384823948240482414824248243482444824548246482474824848249482504825148252482534825448255482564825748258482594826048261482624826348264482654826648267482684826948270482714827248273482744827548276482774827848279482804828148282482834828448285482864828748288482894829048291482924829348294482954829648297482984829948300483014830248303483044830548306483074830848309483104831148312483134831448315483164831748318483194832048321483224832348324483254832648327483284832948330483314833248333483344833548336483374833848339483404834148342483434834448345483464834748348483494835048351483524835348354483554835648357483584835948360483614836248363483644836548366483674836848369483704837148372483734837448375483764837748378483794838048381483824838348384483854838648387483884838948390483914839248393483944839548396483974839848399484004840148402484034840448405484064840748408484094841048411484124841348414484154841648417484184841948420484214842248423484244842548426484274842848429484304843148432484334843448435484364843748438484394844048441484424844348444484454844648447484484844948450484514845248453484544845548456484574845848459484604846148462484634846448465484664846748468484694847048471484724847348474484754847648477484784847948480484814848248483484844848548486484874848848489484904849148492484934849448495484964849748498484994850048501485024850348504485054850648507485084850948510485114851248513485144851548516485174851848519485204852148522485234852448525485264852748528485294853048531485324853348534485354853648537485384853948540485414854248543485444854548546485474854848549485504855148552485534855448555485564855748558485594856048561485624856348564485654856648567485684856948570485714857248573485744857548576485774857848579485804858148582485834858448585485864858748588485894859048591485924859348594485954859648597485984859948600486014860248603486044860548606486074860848609486104861148612486134861448615486164861748618486194862048621486224862348624486254862648627486284862948630486314863248633486344863548636486374863848639486404864148642486434864448645486464864748648486494865048651486524865348654486554865648657486584865948660486614866248663486644866548666486674866848669486704867148672486734867448675486764867748678486794868048681486824868348684486854868648687486884868948690486914869248693486944869548696486974869848699487004870148702487034870448705487064870748708487094871048711487124871348714487154871648717487184871948720487214872248723487244872548726487274872848729487304873148732487334873448735487364873748738487394874048741487424874348744487454874648747487484874948750487514875248753487544875548756487574875848759487604876148762487634876448765487664876748768487694877048771487724877348774487754877648777487784877948780487814878248783487844878548786487874878848789487904879148792487934879448795487964879748798487994880048801488024880348804488054880648807488084880948810488114881248813488144881548816488174881848819488204882148822488234882448825488264882748828488294883048831488324883348834488354883648837488384883948840488414884248843488444884548846488474884848849488504885148852488534885448855488564885748858488594886048861488624886348864488654886648867488684886948870488714887248873488744887548876488774887848879488804888148882488834888448885488864888748888488894889048891488924889348894488954889648897488984889948900489014890248903489044890548906489074890848909489104891148912489134891448915489164891748918489194892048921489224892348924489254892648927489284892948930489314893248933489344893548936489374893848939489404894148942489434894448945489464894748948489494895048951489524895348954489554895648957489584895948960489614896248963489644896548966489674896848969489704897148972489734897448975489764897748978489794898048981489824898348984489854898648987489884898948990489914899248993489944899548996489974899848999490004900149002490034900449005490064900749008490094901049011490124901349014490154901649017490184901949020490214902249023490244902549026490274902849029490304903149032490334903449035490364903749038490394904049041490424904349044490454904649047490484904949050490514905249053490544905549056490574905849059490604906149062490634906449065490664906749068490694907049071490724907349074490754907649077490784907949080490814908249083490844908549086490874908849089490904909149092490934909449095490964909749098490994910049101491024910349104491054910649107491084910949110491114911249113491144911549116491174911849119491204912149122491234912449125491264912749128491294913049131491324913349134491354913649137491384913949140491414914249143491444914549146491474914849149491504915149152491534915449155491564915749158491594916049161491624916349164491654916649167491684916949170491714917249173491744917549176491774917849179491804918149182491834918449185491864918749188491894919049191491924919349194491954919649197491984919949200492014920249203492044920549206492074920849209492104921149212492134921449215492164921749218492194922049221492224922349224492254922649227492284922949230492314923249233492344923549236492374923849239492404924149242492434924449245492464924749248492494925049251492524925349254492554925649257492584925949260492614926249263492644926549266492674926849269492704927149272492734927449275492764927749278492794928049281492824928349284492854928649287492884928949290492914929249293492944929549296492974929849299493004930149302493034930449305493064930749308493094931049311493124931349314493154931649317493184931949320493214932249323493244932549326493274932849329493304933149332493334933449335493364933749338493394934049341493424934349344493454934649347493484934949350493514935249353493544935549356493574935849359493604936149362493634936449365493664936749368493694937049371493724937349374493754937649377493784937949380493814938249383493844938549386493874938849389493904939149392493934939449395493964939749398493994940049401494024940349404494054940649407494084940949410494114941249413494144941549416494174941849419494204942149422494234942449425494264942749428494294943049431494324943349434494354943649437494384943949440494414944249443494444944549446494474944849449494504945149452494534945449455494564945749458494594946049461494624946349464494654946649467494684946949470494714947249473494744947549476494774947849479494804948149482494834948449485494864948749488494894949049491494924949349494494954949649497494984949949500495014950249503495044950549506495074950849509495104951149512495134951449515495164951749518495194952049521495224952349524495254952649527495284952949530495314953249533495344953549536495374953849539495404954149542495434954449545495464954749548495494955049551495524955349554495554955649557495584955949560495614956249563495644956549566495674956849569495704957149572495734957449575495764957749578495794958049581495824958349584495854958649587495884958949590495914959249593495944959549596495974959849599496004960149602496034960449605496064960749608496094961049611496124961349614496154961649617496184961949620496214962249623496244962549626496274962849629496304963149632496334963449635496364963749638496394964049641496424964349644496454964649647496484964949650496514965249653496544965549656496574965849659496604966149662496634966449665496664966749668496694967049671496724967349674496754967649677496784967949680496814968249683496844968549686496874968849689496904969149692496934969449695496964969749698496994970049701497024970349704497054970649707497084970949710497114971249713497144971549716497174971849719497204972149722497234972449725497264972749728497294973049731497324973349734497354973649737497384973949740497414974249743497444974549746497474974849749497504975149752497534975449755497564975749758497594976049761497624976349764497654976649767497684976949770497714977249773497744977549776497774977849779497804978149782497834978449785497864978749788497894979049791497924979349794497954979649797497984979949800498014980249803498044980549806498074980849809498104981149812498134981449815498164981749818498194982049821498224982349824498254982649827498284982949830498314983249833498344983549836498374983849839498404984149842498434984449845498464984749848498494985049851498524985349854498554985649857498584985949860498614986249863498644986549866498674986849869498704987149872498734987449875498764987749878498794988049881498824988349884498854988649887498884988949890498914989249893498944989549896498974989849899499004990149902499034990449905499064990749908499094991049911499124991349914499154991649917499184991949920499214992249923499244992549926499274992849929499304993149932499334993449935499364993749938499394994049941499424994349944499454994649947499484994949950499514995249953499544995549956499574995849959499604996149962499634996449965499664996749968499694997049971499724997349974499754997649977499784997949980499814998249983499844998549986499874998849989499904999149992499934999449995499964999749998499995000050001500025000350004500055000650007500085000950010500115001250013500145001550016500175001850019500205002150022500235002450025500265002750028500295003050031500325003350034500355003650037500385003950040500415004250043500445004550046500475004850049500505005150052500535005450055500565005750058500595006050061500625006350064500655006650067500685006950070500715007250073500745007550076500775007850079500805008150082500835008450085500865008750088500895009050091500925009350094500955009650097500985009950100501015010250103501045010550106501075010850109501105011150112501135011450115501165011750118501195012050121501225012350124501255012650127501285012950130501315013250133501345013550136501375013850139501405014150142501435014450145501465014750148501495015050151501525015350154501555015650157501585015950160501615016250163501645016550166501675016850169501705017150172501735017450175501765017750178501795018050181501825018350184501855018650187501885018950190501915019250193501945019550196501975019850199502005020150202502035020450205502065020750208502095021050211502125021350214502155021650217502185021950220502215022250223502245022550226502275022850229502305023150232502335023450235502365023750238502395024050241502425024350244502455024650247502485024950250502515025250253502545025550256502575025850259502605026150262502635026450265502665026750268502695027050271502725027350274502755027650277502785027950280502815028250283502845028550286502875028850289502905029150292502935029450295502965029750298502995030050301503025030350304503055030650307503085030950310503115031250313503145031550316503175031850319503205032150322503235032450325503265032750328503295033050331503325033350334503355033650337503385033950340503415034250343503445034550346503475034850349503505035150352503535035450355503565035750358503595036050361503625036350364503655036650367503685036950370503715037250373503745037550376503775037850379503805038150382503835038450385503865038750388503895039050391503925039350394503955039650397503985039950400504015040250403504045040550406504075040850409504105041150412504135041450415504165041750418504195042050421504225042350424504255042650427504285042950430504315043250433504345043550436504375043850439504405044150442504435044450445504465044750448504495045050451504525045350454504555045650457504585045950460504615046250463504645046550466504675046850469504705047150472504735047450475504765047750478504795048050481504825048350484504855048650487504885048950490504915049250493504945049550496504975049850499505005050150502505035050450505505065050750508505095051050511505125051350514505155051650517505185051950520505215052250523505245052550526505275052850529505305053150532505335053450535505365053750538505395054050541505425054350544505455054650547505485054950550505515055250553505545055550556505575055850559505605056150562505635056450565505665056750568505695057050571505725057350574505755057650577505785057950580505815058250583505845058550586505875058850589505905059150592505935059450595505965059750598505995060050601506025060350604506055060650607506085060950610506115061250613506145061550616506175061850619506205062150622506235062450625506265062750628506295063050631506325063350634506355063650637506385063950640506415064250643506445064550646506475064850649506505065150652506535065450655506565065750658506595066050661506625066350664506655066650667506685066950670506715067250673506745067550676506775067850679506805068150682506835068450685506865068750688506895069050691506925069350694506955069650697506985069950700507015070250703507045070550706507075070850709507105071150712507135071450715507165071750718507195072050721507225072350724507255072650727507285072950730507315073250733507345073550736507375073850739507405074150742507435074450745507465074750748507495075050751507525075350754507555075650757507585075950760507615076250763507645076550766507675076850769507705077150772507735077450775507765077750778507795078050781507825078350784507855078650787507885078950790507915079250793507945079550796507975079850799508005080150802508035080450805508065080750808508095081050811508125081350814508155081650817508185081950820508215082250823508245082550826508275082850829508305083150832508335083450835508365083750838508395084050841508425084350844508455084650847508485084950850508515085250853508545085550856508575085850859508605086150862508635086450865508665086750868508695087050871508725087350874508755087650877508785087950880508815088250883508845088550886508875088850889508905089150892508935089450895508965089750898508995090050901509025090350904509055090650907509085090950910509115091250913509145091550916509175091850919509205092150922509235092450925509265092750928509295093050931509325093350934509355093650937509385093950940509415094250943509445094550946509475094850949509505095150952509535095450955509565095750958509595096050961509625096350964509655096650967509685096950970509715097250973509745097550976509775097850979509805098150982509835098450985509865098750988509895099050991509925099350994509955099650997509985099951000510015100251003510045100551006510075100851009510105101151012510135101451015510165101751018510195102051021510225102351024510255102651027510285102951030510315103251033510345103551036510375103851039510405104151042510435104451045510465104751048510495105051051510525105351054510555105651057510585105951060510615106251063510645106551066510675106851069510705107151072510735107451075510765107751078510795108051081510825108351084510855108651087510885108951090510915109251093510945109551096510975109851099511005110151102511035110451105511065110751108511095111051111511125111351114511155111651117511185111951120511215112251123511245112551126511275112851129511305113151132511335113451135511365113751138511395114051141511425114351144511455114651147511485114951150511515115251153511545115551156511575115851159511605116151162511635116451165511665116751168511695117051171511725117351174511755117651177511785117951180511815118251183511845118551186511875118851189511905119151192511935119451195511965119751198511995120051201512025120351204512055120651207512085120951210512115121251213512145121551216512175121851219512205122151222512235122451225512265122751228512295123051231512325123351234512355123651237512385123951240512415124251243512445124551246512475124851249512505125151252512535125451255512565125751258512595126051261512625126351264512655126651267512685126951270512715127251273512745127551276512775127851279512805128151282512835128451285512865128751288512895129051291512925129351294512955129651297512985129951300513015130251303513045130551306513075130851309513105131151312513135131451315513165131751318513195132051321513225132351324513255132651327513285132951330513315133251333513345133551336513375133851339513405134151342513435134451345513465134751348513495135051351513525135351354513555135651357513585135951360513615136251363513645136551366513675136851369513705137151372513735137451375513765137751378513795138051381513825138351384513855138651387513885138951390513915139251393513945139551396513975139851399514005140151402514035140451405514065140751408514095141051411514125141351414514155141651417514185141951420514215142251423514245142551426514275142851429514305143151432514335143451435514365143751438514395144051441514425144351444514455144651447514485144951450514515145251453514545145551456514575145851459514605146151462514635146451465514665146751468514695147051471514725147351474514755147651477514785147951480514815148251483514845148551486514875148851489514905149151492514935149451495514965149751498514995150051501515025150351504515055150651507515085150951510515115151251513515145151551516515175151851519515205152151522515235152451525515265152751528515295153051531515325153351534515355153651537515385153951540515415154251543515445154551546515475154851549515505155151552515535155451555515565155751558515595156051561515625156351564515655156651567515685156951570515715157251573515745157551576515775157851579515805158151582515835158451585515865158751588515895159051591515925159351594515955159651597515985159951600516015160251603516045160551606516075160851609516105161151612516135161451615516165161751618516195162051621516225162351624516255162651627516285162951630516315163251633516345163551636516375163851639516405164151642516435164451645516465164751648516495165051651516525165351654516555165651657516585165951660516615166251663516645166551666516675166851669516705167151672516735167451675516765167751678516795168051681516825168351684516855168651687516885168951690516915169251693516945169551696516975169851699517005170151702517035170451705517065170751708517095171051711517125171351714517155171651717517185171951720517215172251723517245172551726517275172851729517305173151732517335173451735517365173751738517395174051741517425174351744517455174651747517485174951750517515175251753517545175551756517575175851759517605176151762517635176451765517665176751768517695177051771517725177351774517755177651777517785177951780517815178251783517845178551786517875178851789517905179151792517935179451795517965179751798517995180051801518025180351804518055180651807518085180951810518115181251813518145181551816518175181851819518205182151822518235182451825518265182751828518295183051831518325183351834518355183651837518385183951840518415184251843518445184551846518475184851849518505185151852518535185451855518565185751858518595186051861518625186351864518655186651867518685186951870518715187251873518745187551876518775187851879518805188151882518835188451885518865188751888518895189051891518925189351894518955189651897518985189951900519015190251903519045190551906519075190851909519105191151912519135191451915519165191751918519195192051921519225192351924519255192651927519285192951930519315193251933519345193551936519375193851939519405194151942519435194451945519465194751948519495195051951519525195351954519555195651957519585195951960519615196251963519645196551966519675196851969519705197151972519735197451975519765197751978519795198051981519825198351984519855198651987519885198951990519915199251993519945199551996519975199851999520005200152002520035200452005520065200752008520095201052011520125201352014520155201652017520185201952020520215202252023520245202552026520275202852029520305203152032520335203452035520365203752038520395204052041520425204352044520455204652047520485204952050520515205252053520545205552056520575205852059520605206152062520635206452065520665206752068520695207052071520725207352074520755207652077520785207952080520815208252083520845208552086520875208852089520905209152092520935209452095520965209752098520995210052101521025210352104521055210652107521085210952110521115211252113521145211552116521175211852119521205212152122521235212452125521265212752128521295213052131521325213352134521355213652137521385213952140521415214252143521445214552146521475214852149521505215152152521535215452155521565215752158521595216052161521625216352164521655216652167521685216952170521715217252173521745217552176521775217852179521805218152182521835218452185521865218752188521895219052191521925219352194521955219652197521985219952200522015220252203522045220552206522075220852209522105221152212522135221452215522165221752218522195222052221522225222352224522255222652227522285222952230522315223252233522345223552236522375223852239522405224152242522435224452245522465224752248522495225052251522525225352254522555225652257522585225952260522615226252263522645226552266522675226852269522705227152272522735227452275522765227752278522795228052281522825228352284522855228652287522885228952290522915229252293522945229552296522975229852299523005230152302523035230452305523065230752308523095231052311523125231352314523155231652317523185231952320523215232252323523245232552326523275232852329523305233152332523335233452335523365233752338523395234052341523425234352344523455234652347523485234952350523515235252353523545235552356523575235852359523605236152362523635236452365523665236752368523695237052371523725237352374523755237652377523785237952380523815238252383523845238552386523875238852389523905239152392523935239452395523965239752398523995240052401524025240352404524055240652407524085240952410524115241252413524145241552416524175241852419524205242152422524235242452425524265242752428524295243052431524325243352434524355243652437524385243952440524415244252443524445244552446524475244852449524505245152452524535245452455524565245752458524595246052461524625246352464524655246652467524685246952470524715247252473524745247552476524775247852479524805248152482524835248452485524865248752488524895249052491524925249352494524955249652497524985249952500525015250252503525045250552506525075250852509525105251152512525135251452515525165251752518525195252052521525225252352524525255252652527525285252952530525315253252533525345253552536525375253852539525405254152542525435254452545525465254752548525495255052551525525255352554525555255652557525585255952560525615256252563525645256552566525675256852569525705257152572525735257452575525765257752578525795258052581525825258352584525855258652587525885258952590525915259252593525945259552596525975259852599526005260152602526035260452605526065260752608526095261052611526125261352614526155261652617526185261952620526215262252623526245262552626526275262852629526305263152632526335263452635526365263752638526395264052641526425264352644526455264652647526485264952650526515265252653526545265552656526575265852659526605266152662526635266452665526665266752668526695267052671526725267352674526755267652677526785267952680526815268252683526845268552686526875268852689526905269152692526935269452695526965269752698526995270052701527025270352704527055270652707527085270952710527115271252713527145271552716527175271852719527205272152722527235272452725527265272752728527295273052731527325273352734527355273652737527385273952740527415274252743527445274552746527475274852749527505275152752527535275452755527565275752758527595276052761527625276352764527655276652767527685276952770527715277252773527745277552776527775277852779527805278152782527835278452785527865278752788527895279052791527925279352794527955279652797527985279952800528015280252803528045280552806528075280852809528105281152812528135281452815528165281752818528195282052821528225282352824528255282652827528285282952830528315283252833528345283552836528375283852839528405284152842528435284452845528465284752848528495285052851528525285352854528555285652857528585285952860528615286252863528645286552866528675286852869528705287152872528735287452875528765287752878528795288052881528825288352884528855288652887528885288952890528915289252893528945289552896528975289852899529005290152902529035290452905529065290752908529095291052911529125291352914529155291652917529185291952920529215292252923529245292552926529275292852929529305293152932529335293452935529365293752938529395294052941529425294352944529455294652947529485294952950529515295252953529545295552956529575295852959529605296152962529635296452965529665296752968529695297052971529725297352974529755297652977529785297952980529815298252983529845298552986529875298852989529905299152992529935299452995529965299752998529995300053001530025300353004530055300653007530085300953010530115301253013530145301553016530175301853019530205302153022530235302453025530265302753028530295303053031530325303353034530355303653037530385303953040530415304253043530445304553046530475304853049530505305153052530535305453055530565305753058530595306053061530625306353064530655306653067530685306953070530715307253073530745307553076530775307853079530805308153082530835308453085530865308753088530895309053091530925309353094530955309653097530985309953100531015310253103531045310553106531075310853109531105311153112531135311453115531165311753118531195312053121531225312353124531255312653127531285312953130531315313253133531345313553136531375313853139531405314153142531435314453145531465314753148531495315053151531525315353154531555315653157531585315953160531615316253163531645316553166531675316853169531705317153172531735317453175531765317753178531795318053181531825318353184531855318653187531885318953190531915319253193531945319553196531975319853199532005320153202532035320453205532065320753208532095321053211532125321353214532155321653217532185321953220532215322253223532245322553226532275322853229532305323153232532335323453235532365323753238532395324053241532425324353244532455324653247532485324953250532515325253253532545325553256532575325853259532605326153262532635326453265532665326753268532695327053271532725327353274532755327653277532785327953280532815328253283532845328553286532875328853289532905329153292532935329453295532965329753298532995330053301533025330353304533055330653307533085330953310533115331253313533145331553316533175331853319533205332153322533235332453325533265332753328533295333053331533325333353334533355333653337533385333953340533415334253343533445334553346533475334853349533505335153352533535335453355533565335753358533595336053361533625336353364533655336653367533685336953370533715337253373533745337553376533775337853379533805338153382533835338453385533865338753388533895339053391533925339353394533955339653397533985339953400534015340253403534045340553406534075340853409534105341153412534135341453415534165341753418534195342053421534225342353424534255342653427534285342953430534315343253433534345343553436534375343853439534405344153442534435344453445534465344753448534495345053451534525345353454534555345653457534585345953460534615346253463534645346553466534675346853469534705347153472534735347453475534765347753478534795348053481534825348353484534855348653487534885348953490534915349253493534945349553496534975349853499535005350153502535035350453505535065350753508535095351053511535125351353514535155351653517535185351953520535215352253523535245352553526535275352853529535305353153532535335353453535535365353753538535395354053541535425354353544535455354653547535485354953550535515355253553535545355553556535575355853559535605356153562535635356453565535665356753568535695357053571535725357353574535755357653577535785357953580535815358253583535845358553586535875358853589535905359153592535935359453595535965359753598535995360053601536025360353604536055360653607536085360953610536115361253613536145361553616536175361853619536205362153622536235362453625536265362753628536295363053631536325363353634536355363653637536385363953640536415364253643536445364553646536475364853649536505365153652536535365453655536565365753658536595366053661536625366353664536655366653667536685366953670536715367253673536745367553676536775367853679536805368153682536835368453685536865368753688536895369053691536925369353694536955369653697536985369953700537015370253703537045370553706537075370853709537105371153712537135371453715537165371753718537195372053721537225372353724537255372653727537285372953730537315373253733537345373553736537375373853739537405374153742537435374453745537465374753748537495375053751537525375353754537555375653757537585375953760537615376253763537645376553766537675376853769537705377153772537735377453775537765377753778537795378053781537825378353784537855378653787537885378953790537915379253793537945379553796537975379853799538005380153802538035380453805538065380753808538095381053811538125381353814538155381653817538185381953820538215382253823538245382553826538275382853829538305383153832538335383453835538365383753838538395384053841538425384353844538455384653847538485384953850538515385253853538545385553856538575385853859538605386153862538635386453865538665386753868538695387053871538725387353874538755387653877538785387953880538815388253883538845388553886538875388853889538905389153892538935389453895538965389753898538995390053901539025390353904539055390653907539085390953910539115391253913539145391553916539175391853919539205392153922539235392453925539265392753928539295393053931539325393353934539355393653937539385393953940539415394253943539445394553946539475394853949539505395153952539535395453955539565395753958539595396053961539625396353964539655396653967539685396953970539715397253973539745397553976539775397853979539805398153982539835398453985539865398753988539895399053991539925399353994539955399653997539985399954000540015400254003540045400554006540075400854009540105401154012540135401454015540165401754018540195402054021540225402354024540255402654027540285402954030540315403254033540345403554036540375403854039540405404154042540435404454045540465404754048540495405054051540525405354054540555405654057540585405954060540615406254063540645406554066540675406854069540705407154072540735407454075540765407754078540795408054081540825408354084540855408654087540885408954090540915409254093540945409554096540975409854099541005410154102541035410454105541065410754108541095411054111541125411354114541155411654117541185411954120541215412254123541245412554126541275412854129541305413154132541335413454135541365413754138541395414054141541425414354144541455414654147541485414954150541515415254153541545415554156541575415854159541605416154162541635416454165541665416754168541695417054171541725417354174541755417654177541785417954180541815418254183541845418554186541875418854189541905419154192541935419454195541965419754198541995420054201542025420354204542055420654207542085420954210542115421254213542145421554216542175421854219542205422154222542235422454225542265422754228542295423054231542325423354234542355423654237542385423954240542415424254243542445424554246542475424854249542505425154252542535425454255542565425754258542595426054261542625426354264542655426654267542685426954270542715427254273542745427554276542775427854279542805428154282542835428454285542865428754288542895429054291542925429354294542955429654297542985429954300543015430254303543045430554306543075430854309543105431154312543135431454315543165431754318543195432054321543225432354324543255432654327543285432954330543315433254333543345433554336543375433854339543405434154342543435434454345543465434754348543495435054351543525435354354543555435654357543585435954360543615436254363543645436554366543675436854369543705437154372543735437454375543765437754378543795438054381543825438354384543855438654387543885438954390543915439254393543945439554396543975439854399544005440154402544035440454405544065440754408544095441054411544125441354414544155441654417544185441954420544215442254423544245442554426544275442854429544305443154432544335443454435544365443754438544395444054441544425444354444544455444654447544485444954450544515445254453544545445554456544575445854459544605446154462544635446454465544665446754468544695447054471544725447354474544755447654477544785447954480544815448254483544845448554486544875448854489544905449154492544935449454495544965449754498544995450054501545025450354504545055450654507545085450954510545115451254513545145451554516545175451854519545205452154522545235452454525545265452754528545295453054531545325453354534545355453654537545385453954540545415454254543545445454554546545475454854549545505455154552545535455454555545565455754558545595456054561545625456354564545655456654567545685456954570545715457254573545745457554576545775457854579545805458154582545835458454585545865458754588545895459054591545925459354594545955459654597545985459954600546015460254603546045460554606546075460854609546105461154612546135461454615546165461754618546195462054621546225462354624546255462654627546285462954630546315463254633546345463554636546375463854639546405464154642546435464454645546465464754648546495465054651546525465354654546555465654657546585465954660546615466254663546645466554666546675466854669546705467154672546735467454675546765467754678546795468054681546825468354684546855468654687546885468954690546915469254693546945469554696546975469854699547005470154702547035470454705547065470754708547095471054711547125471354714547155471654717547185471954720547215472254723547245472554726547275472854729547305473154732547335473454735547365473754738547395474054741547425474354744547455474654747547485474954750547515475254753547545475554756547575475854759547605476154762547635476454765547665476754768547695477054771547725477354774547755477654777547785477954780547815478254783547845478554786547875478854789547905479154792547935479454795547965479754798547995480054801548025480354804548055480654807548085480954810548115481254813548145481554816548175481854819548205482154822548235482454825548265482754828548295483054831548325483354834548355483654837548385483954840548415484254843548445484554846548475484854849548505485154852548535485454855548565485754858548595486054861548625486354864548655486654867548685486954870548715487254873548745487554876548775487854879548805488154882548835488454885548865488754888548895489054891548925489354894548955489654897548985489954900549015490254903549045490554906549075490854909549105491154912549135491454915549165491754918549195492054921549225492354924549255492654927549285492954930549315493254933549345493554936549375493854939549405494154942549435494454945549465494754948549495495054951549525495354954549555495654957549585495954960549615496254963549645496554966549675496854969549705497154972549735497454975549765497754978549795498054981549825498354984549855498654987549885498954990549915499254993549945499554996549975499854999550005500155002550035500455005550065500755008550095501055011550125501355014550155501655017550185501955020550215502255023550245502555026550275502855029550305503155032550335503455035550365503755038550395504055041550425504355044550455504655047550485504955050550515505255053550545505555056550575505855059550605506155062550635506455065550665506755068550695507055071550725507355074550755507655077550785507955080550815508255083550845508555086550875508855089550905509155092550935509455095550965509755098550995510055101551025510355104551055510655107551085510955110551115511255113551145511555116551175511855119551205512155122551235512455125551265512755128551295513055131551325513355134551355513655137551385513955140551415514255143551445514555146551475514855149551505515155152551535515455155551565515755158551595516055161551625516355164551655516655167551685516955170551715517255173551745517555176551775517855179551805518155182551835518455185551865518755188551895519055191551925519355194551955519655197551985519955200552015520255203552045520555206552075520855209552105521155212552135521455215552165521755218552195522055221552225522355224552255522655227552285522955230552315523255233552345523555236552375523855239552405524155242552435524455245552465524755248552495525055251552525525355254552555525655257552585525955260552615526255263552645526555266552675526855269552705527155272552735527455275552765527755278552795528055281552825528355284552855528655287552885528955290552915529255293552945529555296552975529855299553005530155302553035530455305553065530755308553095531055311553125531355314553155531655317553185531955320553215532255323553245532555326553275532855329553305533155332553335533455335553365533755338553395534055341553425534355344553455534655347553485534955350553515535255353553545535555356553575535855359553605536155362553635536455365553665536755368553695537055371553725537355374553755537655377553785537955380553815538255383553845538555386553875538855389553905539155392553935539455395553965539755398553995540055401554025540355404554055540655407554085540955410554115541255413554145541555416554175541855419554205542155422554235542455425554265542755428554295543055431554325543355434554355543655437554385543955440554415544255443554445544555446554475544855449554505545155452554535545455455554565545755458554595546055461554625546355464554655546655467554685546955470554715547255473554745547555476554775547855479554805548155482554835548455485554865548755488554895549055491554925549355494554955549655497554985549955500555015550255503555045550555506555075550855509555105551155512555135551455515555165551755518555195552055521555225552355524555255552655527555285552955530555315553255533555345553555536555375553855539555405554155542555435554455545555465554755548555495555055551555525555355554555555555655557555585555955560555615556255563555645556555566555675556855569555705557155572555735557455575555765557755578555795558055581555825558355584555855558655587555885558955590555915559255593555945559555596555975559855599556005560155602556035560455605556065560755608556095561055611556125561355614556155561655617556185561955620556215562255623556245562555626556275562855629556305563155632556335563455635556365563755638556395564055641556425564355644556455564655647556485564955650556515565255653556545565555656556575565855659556605566155662556635566455665556665566755668556695567055671556725567355674556755567655677556785567955680556815568255683556845568555686556875568855689556905569155692556935569455695556965569755698556995570055701557025570355704557055570655707557085570955710557115571255713557145571555716557175571855719557205572155722557235572455725557265572755728557295573055731557325573355734557355573655737557385573955740557415574255743557445574555746557475574855749557505575155752557535575455755557565575755758557595576055761557625576355764557655576655767557685576955770557715577255773557745577555776557775577855779557805578155782557835578455785557865578755788557895579055791557925579355794557955579655797557985579955800558015580255803558045580555806558075580855809558105581155812558135581455815558165581755818558195582055821558225582355824558255582655827558285582955830558315583255833558345583555836558375583855839558405584155842558435584455845558465584755848558495585055851558525585355854558555585655857558585585955860558615586255863558645586555866558675586855869558705587155872558735587455875558765587755878558795588055881558825588355884558855588655887558885588955890558915589255893558945589555896558975589855899559005590155902559035590455905559065590755908559095591055911559125591355914559155591655917559185591955920559215592255923559245592555926559275592855929559305593155932559335593455935559365593755938559395594055941559425594355944559455594655947559485594955950559515595255953559545595555956559575595855959559605596155962559635596455965559665596755968559695597055971559725597355974559755597655977559785597955980559815598255983559845598555986559875598855989559905599155992559935599455995559965599755998559995600056001560025600356004560055600656007560085600956010560115601256013560145601556016560175601856019560205602156022560235602456025560265602756028560295603056031560325603356034560355603656037560385603956040560415604256043560445604556046560475604856049560505605156052560535605456055560565605756058560595606056061560625606356064560655606656067560685606956070560715607256073560745607556076560775607856079560805608156082560835608456085560865608756088560895609056091560925609356094560955609656097560985609956100561015610256103561045610556106561075610856109561105611156112561135611456115561165611756118561195612056121561225612356124561255612656127561285612956130561315613256133561345613556136561375613856139561405614156142561435614456145561465614756148561495615056151561525615356154561555615656157561585615956160561615616256163561645616556166561675616856169561705617156172561735617456175561765617756178561795618056181561825618356184561855618656187561885618956190561915619256193561945619556196561975619856199562005620156202562035620456205562065620756208562095621056211562125621356214562155621656217562185621956220562215622256223562245622556226562275622856229562305623156232562335623456235562365623756238562395624056241562425624356244562455624656247562485624956250562515625256253562545625556256562575625856259562605626156262562635626456265562665626756268562695627056271562725627356274562755627656277562785627956280562815628256283562845628556286562875628856289562905629156292562935629456295562965629756298562995630056301563025630356304563055630656307563085630956310563115631256313563145631556316563175631856319563205632156322563235632456325563265632756328563295633056331563325633356334563355633656337563385633956340563415634256343563445634556346563475634856349563505635156352563535635456355563565635756358563595636056361563625636356364563655636656367563685636956370563715637256373563745637556376563775637856379563805638156382563835638456385563865638756388563895639056391563925639356394563955639656397563985639956400564015640256403564045640556406564075640856409564105641156412564135641456415564165641756418564195642056421564225642356424564255642656427564285642956430564315643256433564345643556436564375643856439564405644156442564435644456445564465644756448564495645056451564525645356454564555645656457564585645956460564615646256463564645646556466564675646856469564705647156472564735647456475564765647756478564795648056481564825648356484564855648656487564885648956490564915649256493564945649556496564975649856499565005650156502565035650456505565065650756508565095651056511565125651356514565155651656517565185651956520565215652256523565245652556526565275652856529565305653156532565335653456535565365653756538565395654056541565425654356544565455654656547565485654956550565515655256553565545655556556565575655856559565605656156562565635656456565565665656756568565695657056571565725657356574565755657656577565785657956580565815658256583565845658556586565875658856589565905659156592565935659456595565965659756598565995660056601566025660356604566055660656607566085660956610566115661256613566145661556616566175661856619566205662156622566235662456625566265662756628566295663056631566325663356634566355663656637566385663956640566415664256643566445664556646566475664856649566505665156652566535665456655566565665756658566595666056661566625666356664566655666656667566685666956670566715667256673566745667556676566775667856679566805668156682566835668456685566865668756688566895669056691566925669356694566955669656697566985669956700567015670256703567045670556706567075670856709567105671156712567135671456715567165671756718567195672056721567225672356724567255672656727567285672956730567315673256733567345673556736567375673856739567405674156742567435674456745567465674756748567495675056751567525675356754567555675656757567585675956760567615676256763567645676556766567675676856769567705677156772567735677456775567765677756778567795678056781567825678356784567855678656787567885678956790567915679256793567945679556796567975679856799568005680156802568035680456805568065680756808568095681056811568125681356814568155681656817568185681956820568215682256823568245682556826568275682856829568305683156832568335683456835568365683756838568395684056841568425684356844568455684656847568485684956850568515685256853568545685556856568575685856859568605686156862568635686456865568665686756868568695687056871568725687356874568755687656877568785687956880568815688256883568845688556886568875688856889568905689156892568935689456895568965689756898568995690056901569025690356904569055690656907569085690956910569115691256913569145691556916569175691856919569205692156922569235692456925569265692756928569295693056931569325693356934569355693656937569385693956940569415694256943569445694556946569475694856949569505695156952569535695456955569565695756958569595696056961569625696356964569655696656967569685696956970569715697256973569745697556976569775697856979569805698156982569835698456985569865698756988569895699056991569925699356994569955699656997569985699957000570015700257003570045700557006570075700857009570105701157012570135701457015570165701757018570195702057021570225702357024570255702657027570285702957030570315703257033570345703557036570375703857039570405704157042570435704457045570465704757048570495705057051570525705357054570555705657057570585705957060570615706257063570645706557066570675706857069570705707157072570735707457075570765707757078570795708057081570825708357084570855708657087570885708957090570915709257093570945709557096570975709857099571005710157102571035710457105571065710757108571095711057111571125711357114571155711657117571185711957120571215712257123571245712557126571275712857129571305713157132571335713457135571365713757138571395714057141571425714357144571455714657147571485714957150571515715257153571545715557156571575715857159571605716157162571635716457165571665716757168571695717057171571725717357174571755717657177571785717957180571815718257183571845718557186571875718857189571905719157192571935719457195571965719757198571995720057201572025720357204572055720657207572085720957210572115721257213572145721557216572175721857219572205722157222572235722457225572265722757228572295723057231572325723357234572355723657237572385723957240572415724257243572445724557246572475724857249572505725157252572535725457255572565725757258572595726057261572625726357264572655726657267572685726957270572715727257273572745727557276572775727857279572805728157282572835728457285572865728757288572895729057291572925729357294572955729657297572985729957300573015730257303573045730557306573075730857309573105731157312573135731457315573165731757318573195732057321573225732357324573255732657327573285732957330573315733257333573345733557336573375733857339573405734157342573435734457345573465734757348573495735057351573525735357354573555735657357573585735957360573615736257363573645736557366573675736857369573705737157372573735737457375573765737757378573795738057381573825738357384573855738657387573885738957390573915739257393573945739557396573975739857399574005740157402574035740457405574065740757408574095741057411574125741357414574155741657417574185741957420574215742257423574245742557426574275742857429574305743157432574335743457435574365743757438574395744057441574425744357444574455744657447574485744957450574515745257453574545745557456574575745857459574605746157462574635746457465574665746757468574695747057471574725747357474574755747657477574785747957480574815748257483574845748557486574875748857489574905749157492574935749457495574965749757498574995750057501575025750357504575055750657507575085750957510575115751257513575145751557516575175751857519575205752157522575235752457525575265752757528575295753057531575325753357534575355753657537575385753957540575415754257543575445754557546575475754857549575505755157552575535755457555575565755757558575595756057561575625756357564575655756657567575685756957570575715757257573575745757557576575775757857579575805758157582575835758457585575865758757588575895759057591575925759357594575955759657597575985759957600576015760257603576045760557606576075760857609576105761157612576135761457615576165761757618576195762057621576225762357624576255762657627576285762957630576315763257633576345763557636576375763857639576405764157642576435764457645576465764757648576495765057651576525765357654576555765657657576585765957660576615766257663576645766557666576675766857669576705767157672576735767457675576765767757678576795768057681576825768357684576855768657687576885768957690576915769257693576945769557696576975769857699577005770157702577035770457705577065770757708577095771057711577125771357714577155771657717577185771957720577215772257723577245772557726577275772857729577305773157732577335773457735577365773757738577395774057741577425774357744577455774657747577485774957750577515775257753577545775557756577575775857759577605776157762577635776457765577665776757768577695777057771577725777357774577755777657777577785777957780577815778257783577845778557786577875778857789577905779157792577935779457795577965779757798577995780057801578025780357804578055780657807578085780957810578115781257813578145781557816578175781857819578205782157822578235782457825578265782757828578295783057831578325783357834578355783657837578385783957840578415784257843578445784557846578475784857849578505785157852578535785457855578565785757858578595786057861578625786357864578655786657867578685786957870578715787257873578745787557876578775787857879578805788157882578835788457885578865788757888578895789057891578925789357894578955789657897578985789957900579015790257903579045790557906579075790857909579105791157912579135791457915579165791757918579195792057921579225792357924579255792657927579285792957930579315793257933579345793557936579375793857939579405794157942579435794457945579465794757948579495795057951579525795357954579555795657957579585795957960579615796257963579645796557966579675796857969579705797157972579735797457975579765797757978579795798057981579825798357984579855798657987579885798957990579915799257993579945799557996579975799857999580005800158002580035800458005580065800758008580095801058011580125801358014580155801658017580185801958020580215802258023580245802558026580275802858029580305803158032580335803458035580365803758038580395804058041580425804358044580455804658047580485804958050580515805258053580545805558056580575805858059580605806158062580635806458065580665806758068580695807058071580725807358074580755807658077580785807958080580815808258083580845808558086580875808858089580905809158092580935809458095580965809758098580995810058101581025810358104581055810658107581085810958110581115811258113581145811558116581175811858119581205812158122581235812458125581265812758128581295813058131581325813358134581355813658137581385813958140581415814258143581445814558146581475814858149581505815158152581535815458155581565815758158581595816058161581625816358164581655816658167581685816958170581715817258173581745817558176581775817858179581805818158182581835818458185581865818758188581895819058191581925819358194581955819658197581985819958200582015820258203582045820558206582075820858209582105821158212582135821458215582165821758218582195822058221582225822358224582255822658227582285822958230582315823258233582345823558236582375823858239582405824158242582435824458245582465824758248582495825058251582525825358254582555825658257582585825958260582615826258263582645826558266582675826858269582705827158272582735827458275582765827758278582795828058281582825828358284582855828658287582885828958290582915829258293582945829558296582975829858299583005830158302583035830458305583065830758308583095831058311583125831358314583155831658317583185831958320583215832258323583245832558326583275832858329583305833158332583335833458335583365833758338583395834058341583425834358344583455834658347583485834958350583515835258353583545835558356583575835858359583605836158362583635836458365583665836758368583695837058371583725837358374583755837658377583785837958380583815838258383583845838558386583875838858389583905839158392583935839458395583965839758398583995840058401584025840358404584055840658407584085840958410584115841258413584145841558416584175841858419584205842158422584235842458425584265842758428584295843058431584325843358434584355843658437584385843958440584415844258443584445844558446584475844858449584505845158452584535845458455584565845758458584595846058461584625846358464584655846658467584685846958470584715847258473584745847558476584775847858479584805848158482584835848458485584865848758488584895849058491584925849358494584955849658497584985849958500585015850258503585045850558506585075850858509585105851158512585135851458515585165851758518585195852058521585225852358524585255852658527585285852958530585315853258533585345853558536585375853858539585405854158542585435854458545585465854758548585495855058551585525855358554585555855658557585585855958560585615856258563585645856558566585675856858569585705857158572585735857458575585765857758578585795858058581585825858358584585855858658587585885858958590585915859258593585945859558596585975859858599586005860158602586035860458605586065860758608586095861058611586125861358614586155861658617586185861958620586215862258623586245862558626586275862858629586305863158632586335863458635586365863758638586395864058641586425864358644586455864658647586485864958650586515865258653586545865558656586575865858659586605866158662586635866458665586665866758668586695867058671586725867358674586755867658677586785867958680586815868258683586845868558686586875868858689586905869158692586935869458695586965869758698586995870058701587025870358704587055870658707587085870958710587115871258713587145871558716587175871858719587205872158722587235872458725587265872758728587295873058731587325873358734587355873658737587385873958740587415874258743587445874558746587475874858749587505875158752587535875458755587565875758758587595876058761587625876358764587655876658767587685876958770587715877258773587745877558776587775877858779587805878158782587835878458785587865878758788587895879058791587925879358794587955879658797587985879958800588015880258803588045880558806588075880858809588105881158812588135881458815588165881758818588195882058821588225882358824588255882658827588285882958830588315883258833588345883558836588375883858839588405884158842588435884458845588465884758848588495885058851588525885358854588555885658857588585885958860588615886258863588645886558866588675886858869588705887158872588735887458875588765887758878588795888058881588825888358884588855888658887588885888958890588915889258893588945889558896588975889858899589005890158902589035890458905589065890758908589095891058911589125891358914589155891658917589185891958920589215892258923589245892558926589275892858929589305893158932589335893458935589365893758938589395894058941589425894358944589455894658947589485894958950589515895258953589545895558956589575895858959589605896158962589635896458965589665896758968589695897058971589725897358974589755897658977589785897958980589815898258983589845898558986589875898858989589905899158992589935899458995589965899758998589995900059001590025900359004590055900659007590085900959010590115901259013590145901559016590175901859019590205902159022590235902459025590265902759028590295903059031590325903359034590355903659037590385903959040590415904259043590445904559046590475904859049590505905159052590535905459055590565905759058590595906059061590625906359064590655906659067590685906959070590715907259073590745907559076590775907859079590805908159082590835908459085590865908759088590895909059091590925909359094590955909659097590985909959100591015910259103591045910559106591075910859109591105911159112591135911459115591165911759118591195912059121591225912359124591255912659127591285912959130591315913259133591345913559136591375913859139591405914159142591435914459145591465914759148591495915059151591525915359154591555915659157591585915959160591615916259163591645916559166591675916859169591705917159172591735917459175591765917759178591795918059181591825918359184591855918659187591885918959190591915919259193591945919559196591975919859199592005920159202592035920459205592065920759208592095921059211592125921359214592155921659217592185921959220592215922259223592245922559226592275922859229592305923159232592335923459235592365923759238592395924059241592425924359244592455924659247592485924959250592515925259253592545925559256592575925859259592605926159262592635926459265592665926759268592695927059271592725927359274592755927659277592785927959280592815928259283592845928559286592875928859289592905929159292592935929459295592965929759298592995930059301593025930359304593055930659307593085930959310593115931259313593145931559316593175931859319593205932159322593235932459325593265932759328593295933059331593325933359334593355933659337593385933959340593415934259343593445934559346593475934859349593505935159352593535935459355593565935759358593595936059361593625936359364593655936659367593685936959370593715937259373593745937559376593775937859379593805938159382593835938459385593865938759388593895939059391593925939359394593955939659397593985939959400594015940259403594045940559406594075940859409594105941159412594135941459415594165941759418594195942059421594225942359424594255942659427594285942959430594315943259433594345943559436594375943859439594405944159442594435944459445594465944759448594495945059451594525945359454594555945659457594585945959460594615946259463594645946559466594675946859469594705947159472594735947459475594765947759478594795948059481594825948359484594855948659487594885948959490594915949259493594945949559496594975949859499595005950159502595035950459505595065950759508595095951059511595125951359514595155951659517595185951959520595215952259523595245952559526595275952859529595305953159532595335953459535595365953759538595395954059541595425954359544595455954659547595485954959550595515955259553595545955559556595575955859559595605956159562595635956459565595665956759568595695957059571595725957359574595755957659577595785957959580595815958259583595845958559586595875958859589595905959159592595935959459595595965959759598595995960059601596025960359604596055960659607596085960959610596115961259613596145961559616596175961859619596205962159622596235962459625596265962759628596295963059631596325963359634596355963659637596385963959640596415964259643596445964559646596475964859649596505965159652596535965459655596565965759658596595966059661596625966359664596655966659667596685966959670596715967259673596745967559676596775967859679596805968159682596835968459685596865968759688596895969059691596925969359694596955969659697596985969959700597015970259703597045970559706597075970859709597105971159712597135971459715597165971759718597195972059721597225972359724597255972659727597285972959730597315973259733597345973559736597375973859739597405974159742597435974459745597465974759748597495975059751597525975359754597555975659757597585975959760597615976259763597645976559766597675976859769597705977159772597735977459775597765977759778597795978059781597825978359784597855978659787597885978959790597915979259793597945979559796597975979859799598005980159802598035980459805598065980759808598095981059811598125981359814598155981659817598185981959820598215982259823598245982559826598275982859829598305983159832598335983459835598365983759838598395984059841598425984359844598455984659847598485984959850598515985259853598545985559856598575985859859598605986159862598635986459865598665986759868598695987059871598725987359874598755987659877598785987959880598815988259883598845988559886598875988859889598905989159892598935989459895598965989759898598995990059901599025990359904599055990659907599085990959910599115991259913599145991559916599175991859919599205992159922599235992459925599265992759928599295993059931599325993359934599355993659937599385993959940599415994259943599445994559946599475994859949599505995159952599535995459955599565995759958599595996059961599625996359964599655996659967599685996959970599715997259973599745997559976599775997859979599805998159982599835998459985599865998759988599895999059991599925999359994599955999659997599985999960000600016000260003600046000560006600076000860009600106001160012600136001460015600166001760018600196002060021600226002360024600256002660027600286002960030600316003260033600346003560036600376003860039600406004160042600436004460045600466004760048600496005060051600526005360054600556005660057600586005960060600616006260063600646006560066600676006860069600706007160072600736007460075600766007760078600796008060081600826008360084600856008660087600886008960090600916009260093600946009560096600976009860099601006010160102601036010460105601066010760108601096011060111601126011360114601156011660117601186011960120601216012260123601246012560126601276012860129601306013160132601336013460135601366013760138601396014060141601426014360144601456014660147601486014960150601516015260153601546015560156601576015860159601606016160162601636016460165601666016760168601696017060171601726017360174601756017660177601786017960180601816018260183601846018560186601876018860189601906019160192601936019460195601966019760198601996020060201602026020360204602056020660207602086020960210602116021260213602146021560216602176021860219602206022160222602236022460225602266022760228602296023060231602326023360234602356023660237602386023960240602416024260243602446024560246602476024860249602506025160252602536025460255602566025760258602596026060261602626026360264602656026660267602686026960270602716027260273602746027560276602776027860279602806028160282602836028460285602866028760288602896029060291602926029360294602956029660297602986029960300603016030260303603046030560306603076030860309603106031160312603136031460315603166031760318603196032060321603226032360324603256032660327603286032960330603316033260333603346033560336603376033860339603406034160342603436034460345603466034760348603496035060351603526035360354603556035660357603586035960360603616036260363603646036560366603676036860369603706037160372603736037460375603766037760378603796038060381603826038360384603856038660387603886038960390603916039260393603946039560396603976039860399604006040160402604036040460405604066040760408604096041060411604126041360414604156041660417604186041960420604216042260423604246042560426604276042860429604306043160432604336043460435604366043760438604396044060441604426044360444604456044660447604486044960450604516045260453604546045560456604576045860459604606046160462604636046460465604666046760468604696047060471604726047360474604756047660477604786047960480604816048260483604846048560486604876048860489604906049160492604936049460495604966049760498604996050060501605026050360504605056050660507605086050960510605116051260513605146051560516605176051860519605206052160522605236052460525605266052760528605296053060531605326053360534605356053660537605386053960540605416054260543605446054560546605476054860549605506055160552605536055460555605566055760558605596056060561605626056360564605656056660567605686056960570605716057260573605746057560576605776057860579605806058160582605836058460585605866058760588605896059060591605926059360594605956059660597605986059960600606016060260603606046060560606606076060860609606106061160612606136061460615606166061760618606196062060621606226062360624606256062660627606286062960630606316063260633606346063560636606376063860639606406064160642606436064460645606466064760648606496065060651606526065360654606556065660657606586065960660606616066260663606646066560666606676066860669606706067160672606736067460675606766067760678606796068060681606826068360684606856068660687606886068960690606916069260693606946069560696606976069860699607006070160702607036070460705607066070760708607096071060711607126071360714607156071660717607186071960720607216072260723607246072560726607276072860729607306073160732607336073460735607366073760738607396074060741607426074360744607456074660747607486074960750607516075260753607546075560756607576075860759607606076160762607636076460765607666076760768607696077060771607726077360774607756077660777607786077960780607816078260783607846078560786607876078860789607906079160792607936079460795607966079760798607996080060801608026080360804608056080660807608086080960810608116081260813608146081560816608176081860819608206082160822608236082460825608266082760828608296083060831608326083360834608356083660837608386083960840608416084260843608446084560846608476084860849608506085160852608536085460855608566085760858608596086060861608626086360864608656086660867608686086960870608716087260873608746087560876608776087860879608806088160882608836088460885608866088760888608896089060891608926089360894608956089660897608986089960900609016090260903609046090560906609076090860909609106091160912609136091460915609166091760918609196092060921609226092360924609256092660927609286092960930609316093260933609346093560936609376093860939609406094160942609436094460945609466094760948609496095060951609526095360954609556095660957609586095960960609616096260963609646096560966609676096860969609706097160972609736097460975609766097760978609796098060981609826098360984609856098660987609886098960990609916099260993609946099560996609976099860999610006100161002610036100461005610066100761008610096101061011610126101361014610156101661017610186101961020610216102261023610246102561026610276102861029610306103161032610336103461035610366103761038610396104061041610426104361044610456104661047610486104961050610516105261053610546105561056610576105861059610606106161062610636106461065610666106761068610696107061071610726107361074610756107661077610786107961080610816108261083610846108561086610876108861089610906109161092610936109461095610966109761098610996110061101611026110361104611056110661107611086110961110611116111261113611146111561116611176111861119611206112161122611236112461125611266112761128611296113061131611326113361134611356113661137611386113961140611416114261143611446114561146611476114861149611506115161152611536115461155611566115761158611596116061161611626116361164611656116661167611686116961170611716117261173611746117561176611776117861179611806118161182611836118461185611866118761188611896119061191611926119361194611956119661197611986119961200612016120261203612046120561206612076120861209612106121161212612136121461215612166121761218612196122061221612226122361224612256122661227612286122961230612316123261233612346123561236612376123861239612406124161242612436124461245612466124761248612496125061251612526125361254612556125661257612586125961260612616126261263612646126561266612676126861269612706127161272612736127461275612766127761278612796128061281612826128361284612856128661287612886128961290612916129261293612946129561296612976129861299613006130161302613036130461305613066130761308613096131061311613126131361314613156131661317613186131961320613216132261323613246132561326613276132861329613306133161332613336133461335613366133761338613396134061341613426134361344613456134661347613486134961350613516135261353613546135561356613576135861359613606136161362613636136461365613666136761368613696137061371613726137361374613756137661377613786137961380613816138261383613846138561386613876138861389613906139161392613936139461395613966139761398613996140061401614026140361404614056140661407614086140961410614116141261413614146141561416614176141861419614206142161422614236142461425614266142761428614296143061431614326143361434614356143661437614386143961440614416144261443614446144561446614476144861449614506145161452614536145461455614566145761458614596146061461614626146361464614656146661467614686146961470614716147261473614746147561476614776147861479614806148161482614836148461485614866148761488614896149061491614926149361494614956149661497614986149961500615016150261503615046150561506615076150861509615106151161512615136151461515615166151761518615196152061521615226152361524615256152661527615286152961530615316153261533615346153561536615376153861539615406154161542615436154461545615466154761548615496155061551615526155361554615556155661557615586155961560615616156261563615646156561566615676156861569615706157161572615736157461575615766157761578615796158061581615826158361584615856158661587615886158961590615916159261593615946159561596615976159861599616006160161602616036160461605616066160761608616096161061611616126161361614616156161661617616186161961620616216162261623616246162561626616276162861629616306163161632616336163461635616366163761638616396164061641616426164361644616456164661647616486164961650616516165261653616546165561656616576165861659616606166161662616636166461665616666166761668616696167061671616726167361674616756167661677616786167961680616816168261683616846168561686616876168861689616906169161692616936169461695616966169761698616996170061701617026170361704617056170661707617086170961710617116171261713617146171561716617176171861719617206172161722617236172461725617266172761728617296173061731617326173361734617356173661737617386173961740617416174261743617446174561746617476174861749617506175161752617536175461755617566175761758617596176061761617626176361764617656176661767617686176961770617716177261773617746177561776617776177861779617806178161782617836178461785617866178761788617896179061791617926179361794617956179661797617986179961800618016180261803618046180561806618076180861809618106181161812618136181461815618166181761818618196182061821618226182361824618256182661827618286182961830618316183261833618346183561836618376183861839618406184161842618436184461845618466184761848618496185061851618526185361854618556185661857618586185961860618616186261863618646186561866618676186861869618706187161872618736187461875618766187761878618796188061881618826188361884618856188661887618886188961890618916189261893618946189561896618976189861899619006190161902619036190461905619066190761908619096191061911619126191361914619156191661917619186191961920619216192261923619246192561926619276192861929619306193161932619336193461935619366193761938619396194061941619426194361944619456194661947619486194961950619516195261953619546195561956619576195861959619606196161962619636196461965619666196761968619696197061971619726197361974619756197661977619786197961980619816198261983619846198561986619876198861989619906199161992619936199461995619966199761998619996200062001620026200362004620056200662007620086200962010620116201262013620146201562016620176201862019620206202162022620236202462025620266202762028620296203062031620326203362034620356203662037620386203962040620416204262043620446204562046620476204862049620506205162052620536205462055620566205762058620596206062061620626206362064620656206662067620686206962070620716207262073620746207562076620776207862079620806208162082620836208462085620866208762088620896209062091620926209362094620956209662097620986209962100621016210262103621046210562106621076210862109621106211162112621136211462115621166211762118621196212062121621226212362124621256212662127621286212962130621316213262133621346213562136621376213862139621406214162142621436214462145621466214762148621496215062151621526215362154621556215662157621586215962160621616216262163621646216562166621676216862169621706217162172621736217462175621766217762178621796218062181621826218362184621856218662187621886218962190621916219262193621946219562196621976219862199622006220162202622036220462205622066220762208622096221062211622126221362214622156221662217622186221962220622216222262223622246222562226622276222862229622306223162232622336223462235622366223762238622396224062241622426224362244622456224662247622486224962250622516225262253622546225562256622576225862259622606226162262622636226462265622666226762268622696227062271622726227362274622756227662277622786227962280622816228262283622846228562286622876228862289622906229162292622936229462295622966229762298622996230062301623026230362304623056230662307623086230962310623116231262313623146231562316623176231862319623206232162322623236232462325623266232762328623296233062331623326233362334623356233662337623386233962340623416234262343623446234562346623476234862349623506235162352623536235462355623566235762358623596236062361623626236362364623656236662367623686236962370623716237262373623746237562376623776237862379623806238162382623836238462385623866238762388623896239062391623926239362394623956239662397623986239962400624016240262403624046240562406624076240862409624106241162412624136241462415624166241762418624196242062421624226242362424624256242662427624286242962430624316243262433624346243562436624376243862439624406244162442624436244462445624466244762448624496245062451624526245362454624556245662457624586245962460624616246262463624646246562466624676246862469624706247162472624736247462475624766247762478624796248062481624826248362484624856248662487624886248962490624916249262493624946249562496624976249862499625006250162502625036250462505625066250762508625096251062511625126251362514625156251662517625186251962520625216252262523625246252562526625276252862529625306253162532625336253462535625366253762538625396254062541625426254362544625456254662547625486254962550625516255262553625546255562556625576255862559625606256162562625636256462565625666256762568625696257062571625726257362574625756257662577625786257962580625816258262583625846258562586625876258862589625906259162592625936259462595625966259762598625996260062601626026260362604626056260662607626086260962610626116261262613626146261562616626176261862619626206262162622626236262462625626266262762628626296263062631626326263362634626356263662637626386263962640626416264262643626446264562646626476264862649626506265162652626536265462655626566265762658626596266062661626626266362664626656266662667626686266962670626716267262673626746267562676626776267862679626806268162682626836268462685626866268762688626896269062691626926269362694626956269662697626986269962700627016270262703627046270562706627076270862709627106271162712627136271462715627166271762718627196272062721627226272362724627256272662727627286272962730627316273262733627346273562736627376273862739627406274162742627436274462745627466274762748627496275062751627526275362754627556275662757627586275962760627616276262763627646276562766627676276862769627706277162772627736277462775627766277762778627796278062781627826278362784627856278662787627886278962790627916279262793627946279562796627976279862799628006280162802628036280462805628066280762808628096281062811628126281362814628156281662817628186281962820628216282262823628246282562826628276282862829628306283162832628336283462835628366283762838628396284062841628426284362844628456284662847628486284962850628516285262853628546285562856628576285862859628606286162862628636286462865628666286762868628696287062871628726287362874628756287662877628786287962880628816288262883628846288562886628876288862889628906289162892628936289462895628966289762898628996290062901629026290362904629056290662907629086290962910629116291262913629146291562916629176291862919629206292162922629236292462925629266292762928629296293062931629326293362934629356293662937629386293962940629416294262943629446294562946629476294862949629506295162952629536295462955629566295762958629596296062961629626296362964629656296662967629686296962970629716297262973629746297562976629776297862979629806298162982629836298462985629866298762988629896299062991629926299362994629956299662997629986299963000630016300263003630046300563006630076300863009630106301163012630136301463015630166301763018630196302063021630226302363024630256302663027630286302963030630316303263033630346303563036630376303863039630406304163042630436304463045630466304763048630496305063051630526305363054630556305663057630586305963060630616306263063630646306563066630676306863069630706307163072630736307463075630766307763078630796308063081630826308363084630856308663087630886308963090630916309263093630946309563096630976309863099631006310163102631036310463105631066310763108631096311063111631126311363114631156311663117631186311963120631216312263123631246312563126631276312863129631306313163132631336313463135631366313763138631396314063141631426314363144631456314663147631486314963150631516315263153631546315563156631576315863159631606316163162631636316463165631666316763168631696317063171631726317363174631756317663177631786317963180631816318263183631846318563186631876318863189631906319163192631936319463195631966319763198631996320063201632026320363204632056320663207632086320963210632116321263213632146321563216632176321863219632206322163222632236322463225632266322763228632296323063231632326323363234632356323663237632386323963240632416324263243632446324563246632476324863249632506325163252632536325463255632566325763258632596326063261632626326363264632656326663267632686326963270632716327263273632746327563276632776327863279632806328163282632836328463285632866328763288632896329063291632926329363294632956329663297632986329963300633016330263303633046330563306633076330863309633106331163312633136331463315633166331763318633196332063321633226332363324633256332663327633286332963330633316333263333633346333563336633376333863339633406334163342633436334463345633466334763348633496335063351633526335363354633556335663357633586335963360633616336263363633646336563366633676336863369633706337163372633736337463375633766337763378633796338063381633826338363384633856338663387633886338963390633916339263393633946339563396633976339863399634006340163402634036340463405634066340763408634096341063411634126341363414634156341663417634186341963420634216342263423634246342563426634276342863429634306343163432634336343463435634366343763438634396344063441634426344363444634456344663447634486344963450634516345263453634546345563456634576345863459634606346163462634636346463465634666346763468634696347063471634726347363474634756347663477634786347963480634816348263483634846348563486634876348863489634906349163492634936349463495634966349763498634996350063501635026350363504635056350663507635086350963510635116351263513635146351563516635176351863519635206352163522635236352463525635266352763528635296353063531635326353363534635356353663537635386353963540635416354263543635446354563546635476354863549635506355163552635536355463555635566355763558635596356063561635626356363564635656356663567635686356963570635716357263573635746357563576635776357863579635806358163582635836358463585635866358763588635896359063591635926359363594635956359663597635986359963600636016360263603636046360563606636076360863609636106361163612636136361463615636166361763618636196362063621636226362363624636256362663627636286362963630636316363263633636346363563636636376363863639636406364163642636436364463645636466364763648636496365063651636526365363654636556365663657636586365963660636616366263663636646366563666636676366863669636706367163672636736367463675636766367763678636796368063681636826368363684636856368663687636886368963690636916369263693636946369563696636976369863699637006370163702637036370463705637066370763708637096371063711637126371363714637156371663717637186371963720637216372263723637246372563726637276372863729637306373163732637336373463735637366373763738637396374063741637426374363744637456374663747637486374963750637516375263753637546375563756637576375863759637606376163762637636376463765637666376763768637696377063771637726377363774637756377663777637786377963780637816378263783637846378563786637876378863789637906379163792637936379463795637966379763798637996380063801638026380363804638056380663807638086380963810638116381263813638146381563816638176381863819638206382163822638236382463825638266382763828638296383063831638326383363834638356383663837638386383963840638416384263843638446384563846638476384863849638506385163852638536385463855638566385763858638596386063861638626386363864638656386663867638686386963870638716387263873638746387563876638776387863879638806388163882638836388463885638866388763888638896389063891638926389363894638956389663897638986389963900639016390263903639046390563906639076390863909639106391163912639136391463915639166391763918639196392063921639226392363924639256392663927639286392963930639316393263933639346393563936639376393863939639406394163942639436394463945639466394763948639496395063951639526395363954639556395663957639586395963960639616396263963639646396563966639676396863969639706397163972639736397463975639766397763978639796398063981639826398363984639856398663987639886398963990639916399263993639946399563996639976399863999640006400164002640036400464005640066400764008640096401064011640126401364014640156401664017640186401964020640216402264023640246402564026640276402864029640306403164032640336403464035640366403764038640396404064041640426404364044640456404664047640486404964050640516405264053640546405564056640576405864059640606406164062640636406464065640666406764068640696407064071640726407364074640756407664077640786407964080640816408264083640846408564086640876408864089640906409164092640936409464095640966409764098640996410064101641026410364104641056410664107641086410964110641116411264113641146411564116641176411864119641206412164122641236412464125641266412764128641296413064131641326413364134641356413664137641386413964140641416414264143641446414564146641476414864149641506415164152641536415464155641566415764158641596416064161641626416364164641656416664167641686416964170641716417264173641746417564176641776417864179641806418164182641836418464185641866418764188641896419064191641926419364194641956419664197641986419964200642016420264203642046420564206642076420864209642106421164212642136421464215642166421764218642196422064221642226422364224642256422664227642286422964230642316423264233642346423564236642376423864239642406424164242642436424464245642466424764248642496425064251642526425364254642556425664257642586425964260642616426264263642646426564266642676426864269642706427164272642736427464275642766427764278642796428064281642826428364284642856428664287642886428964290642916429264293642946429564296642976429864299643006430164302643036430464305643066430764308643096431064311643126431364314643156431664317643186431964320643216432264323643246432564326643276432864329643306433164332643336433464335643366433764338643396434064341643426434364344643456434664347643486434964350643516435264353643546435564356643576435864359643606436164362643636436464365643666436764368643696437064371643726437364374643756437664377643786437964380643816438264383643846438564386643876438864389643906439164392643936439464395643966439764398643996440064401644026440364404644056440664407644086440964410644116441264413644146441564416644176441864419644206442164422644236442464425644266442764428644296443064431644326443364434644356443664437644386443964440644416444264443644446444564446644476444864449644506445164452644536445464455644566445764458644596446064461644626446364464644656446664467644686446964470644716447264473644746447564476644776447864479644806448164482644836448464485644866448764488644896449064491644926449364494644956449664497644986449964500645016450264503645046450564506645076450864509645106451164512645136451464515645166451764518645196452064521645226452364524645256452664527645286452964530645316453264533645346453564536645376453864539645406454164542645436454464545645466454764548645496455064551645526455364554645556455664557645586455964560645616456264563645646456564566645676456864569645706457164572645736457464575645766457764578645796458064581645826458364584645856458664587645886458964590645916459264593645946459564596645976459864599646006460164602646036460464605646066460764608646096461064611646126461364614646156461664617646186461964620646216462264623646246462564626646276462864629646306463164632646336463464635646366463764638646396464064641646426464364644646456464664647646486464964650646516465264653646546465564656646576465864659646606466164662646636466464665646666466764668646696467064671646726467364674646756467664677646786467964680646816468264683646846468564686646876468864689646906469164692646936469464695646966469764698646996470064701647026470364704647056470664707647086470964710647116471264713647146471564716647176471864719647206472164722647236472464725647266472764728647296473064731647326473364734647356473664737647386473964740647416474264743647446474564746647476474864749647506475164752647536475464755647566475764758647596476064761647626476364764647656476664767647686476964770647716477264773647746477564776647776477864779647806478164782647836478464785647866478764788647896479064791647926479364794647956479664797647986479964800648016480264803648046480564806648076480864809648106481164812648136481464815648166481764818648196482064821648226482364824648256482664827648286482964830648316483264833648346483564836648376483864839648406484164842648436484464845648466484764848648496485064851648526485364854648556485664857648586485964860648616486264863648646486564866648676486864869648706487164872648736487464875648766487764878648796488064881648826488364884648856488664887648886488964890648916489264893648946489564896648976489864899649006490164902649036490464905649066490764908649096491064911649126491364914649156491664917649186491964920649216492264923649246492564926649276492864929649306493164932649336493464935649366493764938649396494064941649426494364944649456494664947649486494964950649516495264953649546495564956649576495864959649606496164962649636496464965649666496764968649696497064971649726497364974649756497664977649786497964980649816498264983649846498564986649876498864989649906499164992649936499464995649966499764998649996500065001650026500365004650056500665007650086500965010650116501265013650146501565016650176501865019650206502165022650236502465025650266502765028650296503065031650326503365034650356503665037650386503965040650416504265043650446504565046650476504865049650506505165052650536505465055650566505765058650596506065061650626506365064650656506665067650686506965070650716507265073650746507565076650776507865079650806508165082650836508465085650866508765088650896509065091650926509365094650956509665097650986509965100651016510265103651046510565106651076510865109651106511165112651136511465115651166511765118651196512065121651226512365124651256512665127651286512965130651316513265133651346513565136651376513865139651406514165142651436514465145651466514765148651496515065151651526515365154651556515665157651586515965160651616516265163651646516565166651676516865169651706517165172651736517465175651766517765178651796518065181651826518365184651856518665187651886518965190651916519265193651946519565196651976519865199652006520165202652036520465205652066520765208652096521065211652126521365214652156521665217652186521965220652216522265223652246522565226652276522865229652306523165232652336523465235652366523765238652396524065241652426524365244652456524665247652486524965250652516525265253652546525565256652576525865259652606526165262652636526465265652666526765268652696527065271652726527365274652756527665277652786527965280652816528265283652846528565286652876528865289652906529165292652936529465295652966529765298652996530065301653026530365304653056530665307653086530965310653116531265313653146531565316653176531865319653206532165322653236532465325653266532765328653296533065331653326533365334653356533665337653386533965340653416534265343653446534565346653476534865349653506535165352653536535465355653566535765358653596536065361653626536365364653656536665367653686536965370653716537265373653746537565376653776537865379653806538165382653836538465385653866538765388653896539065391653926539365394653956539665397653986539965400654016540265403654046540565406654076540865409654106541165412654136541465415654166541765418654196542065421654226542365424654256542665427654286542965430654316543265433654346543565436654376543865439654406544165442654436544465445654466544765448654496545065451654526545365454654556545665457654586545965460654616546265463654646546565466654676546865469654706547165472654736547465475654766547765478654796548065481654826548365484654856548665487654886548965490654916549265493654946549565496654976549865499655006550165502655036550465505655066550765508655096551065511655126551365514655156551665517655186551965520655216552265523655246552565526655276552865529655306553165532655336553465535655366553765538655396554065541655426554365544655456554665547655486554965550655516555265553655546555565556655576555865559655606556165562655636556465565655666556765568655696557065571655726557365574655756557665577655786557965580655816558265583655846558565586655876558865589655906559165592655936559465595655966559765598655996560065601656026560365604656056560665607656086560965610656116561265613656146561565616656176561865619656206562165622656236562465625656266562765628656296563065631656326563365634656356563665637656386563965640656416564265643656446564565646656476564865649656506565165652656536565465655656566565765658656596566065661656626566365664656656566665667656686566965670656716567265673656746567565676656776567865679656806568165682656836568465685656866568765688656896569065691656926569365694656956569665697656986569965700657016570265703657046570565706657076570865709657106571165712657136571465715657166571765718657196572065721657226572365724657256572665727657286572965730657316573265733657346573565736657376573865739657406574165742657436574465745657466574765748657496575065751657526575365754657556575665757657586575965760657616576265763657646576565766657676576865769657706577165772657736577465775657766577765778657796578065781657826578365784657856578665787657886578965790657916579265793657946579565796657976579865799658006580165802658036580465805658066580765808658096581065811658126581365814658156581665817658186581965820658216582265823658246582565826658276582865829658306583165832658336583465835658366583765838658396584065841658426584365844658456584665847658486584965850658516585265853658546585565856658576585865859658606586165862658636586465865658666586765868658696587065871658726587365874658756587665877658786587965880658816588265883658846588565886658876588865889658906589165892658936589465895658966589765898658996590065901659026590365904659056590665907659086590965910659116591265913659146591565916659176591865919659206592165922659236592465925659266592765928659296593065931659326593365934659356593665937659386593965940659416594265943659446594565946659476594865949659506595165952659536595465955659566595765958659596596065961659626596365964659656596665967659686596965970659716597265973659746597565976659776597865979659806598165982659836598465985659866598765988659896599065991659926599365994659956599665997659986599966000660016600266003660046600566006660076600866009660106601166012660136601466015660166601766018660196602066021660226602366024660256602666027660286602966030660316603266033660346603566036660376603866039660406604166042660436604466045660466604766048660496605066051660526605366054660556605666057660586605966060660616606266063660646606566066660676606866069660706607166072660736607466075660766607766078660796608066081660826608366084660856608666087660886608966090660916609266093660946609566096660976609866099661006610166102661036610466105661066610766108661096611066111661126611366114661156611666117661186611966120661216612266123661246612566126661276612866129661306613166132661336613466135661366613766138661396614066141661426614366144661456614666147661486614966150661516615266153661546615566156661576615866159661606616166162661636616466165661666616766168661696617066171661726617366174661756617666177661786617966180661816618266183661846618566186661876618866189661906619166192661936619466195661966619766198661996620066201662026620366204662056620666207662086620966210662116621266213662146621566216662176621866219662206622166222662236622466225662266622766228662296623066231662326623366234662356623666237662386623966240662416624266243662446624566246662476624866249662506625166252662536625466255662566625766258662596626066261662626626366264662656626666267662686626966270
  1. /*! Element Plus v2.11.7 */
  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 isHTMLElement$2 = (e) => {
  9. if (typeof Element === "undefined")
  10. return false;
  11. return e instanceof Element;
  12. };
  13. const isVisible = (element) => {
  14. const computed = getComputedStyle(element);
  15. return computed.position === "fixed" ? false : element.offsetParent !== null;
  16. };
  17. const obtainAllFocusableElements$1 = (element) => {
  18. return Array.from(element.querySelectorAll(FOCUSABLE_ELEMENT_SELECTORS)).filter((item) => isFocusable(item) && isVisible(item));
  19. };
  20. const isFocusable = (element) => {
  21. if (element.tabIndex > 0 || element.tabIndex === 0 && element.getAttribute("tabIndex") !== null) {
  22. return true;
  23. }
  24. if (element.tabIndex < 0 || element.hasAttribute("disabled") || element.getAttribute("aria-disabled") === "true") {
  25. return false;
  26. }
  27. switch (element.nodeName) {
  28. case "A": {
  29. return !!element.href && element.rel !== "ignore";
  30. }
  31. case "INPUT": {
  32. return !(element.type === "hidden" || element.type === "file");
  33. }
  34. case "BUTTON":
  35. case "SELECT":
  36. case "TEXTAREA": {
  37. return true;
  38. }
  39. default: {
  40. return false;
  41. }
  42. }
  43. };
  44. const triggerEvent = function(elm, name, ...opts) {
  45. let eventName;
  46. if (name.includes("mouse") || name.includes("click")) {
  47. eventName = "MouseEvents";
  48. } else if (name.includes("key")) {
  49. eventName = "KeyboardEvent";
  50. } else {
  51. eventName = "HTMLEvents";
  52. }
  53. const evt = document.createEvent(eventName);
  54. evt.initEvent(name, ...opts);
  55. elm.dispatchEvent(evt);
  56. return elm;
  57. };
  58. const isLeaf = (el) => !el.getAttribute("aria-owns");
  59. const getSibling = (el, distance, elClass) => {
  60. const { parentNode } = el;
  61. if (!parentNode)
  62. return null;
  63. const siblings = parentNode.querySelectorAll(elClass);
  64. const index = Array.prototype.indexOf.call(siblings, el);
  65. return siblings[index + distance] || null;
  66. };
  67. const focusElement = (el, options) => {
  68. if (!el || !el.focus)
  69. return;
  70. let cleanup = false;
  71. if (isHTMLElement$2(el) && !isFocusable(el) && !el.getAttribute("tabindex")) {
  72. el.setAttribute("tabindex", "-1");
  73. cleanup = true;
  74. }
  75. el.focus(options);
  76. if (isHTMLElement$2(el) && cleanup) {
  77. el.removeAttribute("tabindex");
  78. }
  79. };
  80. const focusNode = (el) => {
  81. if (!el)
  82. return;
  83. focusElement(el);
  84. !isLeaf(el) && el.click();
  85. };
  86. const EVENT_CODE = {
  87. tab: "Tab",
  88. enter: "Enter",
  89. space: "Space",
  90. left: "ArrowLeft",
  91. up: "ArrowUp",
  92. right: "ArrowRight",
  93. down: "ArrowDown",
  94. esc: "Escape",
  95. delete: "Delete",
  96. backspace: "Backspace",
  97. numpadEnter: "NumpadEnter",
  98. pageUp: "PageUp",
  99. pageDown: "PageDown",
  100. home: "Home",
  101. end: "End"
  102. };
  103. const datePickTypes = [
  104. "year",
  105. "years",
  106. "month",
  107. "months",
  108. "date",
  109. "dates",
  110. "week",
  111. "datetime",
  112. "datetimerange",
  113. "daterange",
  114. "monthrange",
  115. "yearrange"
  116. ];
  117. const WEEK_DAYS = [
  118. "sun",
  119. "mon",
  120. "tue",
  121. "wed",
  122. "thu",
  123. "fri",
  124. "sat"
  125. ];
  126. const UPDATE_MODEL_EVENT = "update:modelValue";
  127. const CHANGE_EVENT = "change";
  128. const INPUT_EVENT = "input";
  129. const INSTALLED_KEY = Symbol("INSTALLED_KEY");
  130. const componentSizes = ["", "default", "small", "large"];
  131. const componentSizeMap = {
  132. large: 40,
  133. default: 32,
  134. small: 24
  135. };
  136. const columnAlignment = ["left", "center", "right"];
  137. const MINIMUM_INPUT_WIDTH = 11;
  138. const BORDER_HORIZONTAL_WIDTH = 2;
  139. function computedEager(fn, options) {
  140. var _a;
  141. const result = vue.shallowRef();
  142. vue.watchEffect(() => {
  143. result.value = fn();
  144. }, {
  145. ...options,
  146. flush: (_a = options == null ? void 0 : options.flush) != null ? _a : "sync"
  147. });
  148. return vue.readonly(result);
  149. }
  150. function tryOnScopeDispose(fn) {
  151. if (vue.getCurrentScope()) {
  152. vue.onScopeDispose(fn);
  153. return true;
  154. }
  155. return false;
  156. }
  157. function toValue(r) {
  158. return typeof r === "function" ? r() : vue.unref(r);
  159. }
  160. function toReactive(objectRef) {
  161. if (!vue.isRef(objectRef))
  162. return vue.reactive(objectRef);
  163. const proxy = new Proxy({}, {
  164. get(_, p, receiver) {
  165. return vue.unref(Reflect.get(objectRef.value, p, receiver));
  166. },
  167. set(_, p, value) {
  168. if (vue.isRef(objectRef.value[p]) && !vue.isRef(value))
  169. objectRef.value[p].value = value;
  170. else
  171. objectRef.value[p] = value;
  172. return true;
  173. },
  174. deleteProperty(_, p) {
  175. return Reflect.deleteProperty(objectRef.value, p);
  176. },
  177. has(_, p) {
  178. return Reflect.has(objectRef.value, p);
  179. },
  180. ownKeys() {
  181. return Object.keys(objectRef.value);
  182. },
  183. getOwnPropertyDescriptor() {
  184. return {
  185. enumerable: true,
  186. configurable: true
  187. };
  188. }
  189. });
  190. return vue.reactive(proxy);
  191. }
  192. function reactiveComputed(fn) {
  193. return toReactive(vue.computed(fn));
  194. }
  195. const isClient = typeof window !== "undefined" && typeof document !== "undefined";
  196. typeof WorkerGlobalScope !== "undefined" && globalThis instanceof WorkerGlobalScope;
  197. const isDef = (val) => typeof val !== "undefined";
  198. const notNullish = (val) => val != null;
  199. const toString$1 = Object.prototype.toString;
  200. const isObject$2 = (val) => toString$1.call(val) === "[object Object]";
  201. const clamp$2 = (n, min, max) => Math.min(max, Math.max(min, n));
  202. const noop$1 = () => {
  203. };
  204. const isIOS = /* @__PURE__ */ getIsIOS();
  205. function getIsIOS() {
  206. var _a, _b;
  207. return isClient && ((_a = window == null ? void 0 : window.navigator) == null ? void 0 : _a.userAgent) && (/iP(?:ad|hone|od)/.test(window.navigator.userAgent) || ((_b = window == null ? void 0 : window.navigator) == null ? void 0 : _b.maxTouchPoints) > 2 && /iPad|Macintosh/.test(window == null ? void 0 : window.navigator.userAgent));
  208. }
  209. function createFilterWrapper(filter, fn) {
  210. function wrapper(...args) {
  211. return new Promise((resolve, reject) => {
  212. Promise.resolve(filter(() => fn.apply(this, args), { fn, thisArg: this, args })).then(resolve).catch(reject);
  213. });
  214. }
  215. return wrapper;
  216. }
  217. function debounceFilter(ms, options = {}) {
  218. let timer;
  219. let maxTimer;
  220. let lastRejector = noop$1;
  221. const _clearTimeout = (timer2) => {
  222. clearTimeout(timer2);
  223. lastRejector();
  224. lastRejector = noop$1;
  225. };
  226. const filter = (invoke) => {
  227. const duration = toValue(ms);
  228. const maxDuration = toValue(options.maxWait);
  229. if (timer)
  230. _clearTimeout(timer);
  231. if (duration <= 0 || maxDuration !== void 0 && maxDuration <= 0) {
  232. if (maxTimer) {
  233. _clearTimeout(maxTimer);
  234. maxTimer = null;
  235. }
  236. return Promise.resolve(invoke());
  237. }
  238. return new Promise((resolve, reject) => {
  239. lastRejector = options.rejectOnCancel ? reject : resolve;
  240. if (maxDuration && !maxTimer) {
  241. maxTimer = setTimeout(() => {
  242. if (timer)
  243. _clearTimeout(timer);
  244. maxTimer = null;
  245. resolve(invoke());
  246. }, maxDuration);
  247. }
  248. timer = setTimeout(() => {
  249. if (maxTimer)
  250. _clearTimeout(maxTimer);
  251. maxTimer = null;
  252. resolve(invoke());
  253. }, duration);
  254. });
  255. };
  256. return filter;
  257. }
  258. function throttleFilter(...args) {
  259. let lastExec = 0;
  260. let timer;
  261. let isLeading = true;
  262. let lastRejector = noop$1;
  263. let lastValue;
  264. let ms;
  265. let trailing;
  266. let leading;
  267. let rejectOnCancel;
  268. if (!vue.isRef(args[0]) && typeof args[0] === "object")
  269. ({ delay: ms, trailing = true, leading = true, rejectOnCancel = false } = args[0]);
  270. else
  271. [ms, trailing = true, leading = true, rejectOnCancel = false] = args;
  272. const clear = () => {
  273. if (timer) {
  274. clearTimeout(timer);
  275. timer = void 0;
  276. lastRejector();
  277. lastRejector = noop$1;
  278. }
  279. };
  280. const filter = (_invoke) => {
  281. const duration = toValue(ms);
  282. const elapsed = Date.now() - lastExec;
  283. const invoke = () => {
  284. return lastValue = _invoke();
  285. };
  286. clear();
  287. if (duration <= 0) {
  288. lastExec = Date.now();
  289. return invoke();
  290. }
  291. if (elapsed > duration && (leading || !isLeading)) {
  292. lastExec = Date.now();
  293. invoke();
  294. } else if (trailing) {
  295. lastValue = new Promise((resolve, reject) => {
  296. lastRejector = rejectOnCancel ? reject : resolve;
  297. timer = setTimeout(() => {
  298. lastExec = Date.now();
  299. isLeading = true;
  300. resolve(invoke());
  301. clear();
  302. }, Math.max(0, duration - elapsed));
  303. });
  304. }
  305. if (!leading && !timer)
  306. timer = setTimeout(() => isLeading = true, duration);
  307. isLeading = false;
  308. return lastValue;
  309. };
  310. return filter;
  311. }
  312. function getLifeCycleTarget(target) {
  313. return target || vue.getCurrentInstance();
  314. }
  315. function useDebounceFn(fn, ms = 200, options = {}) {
  316. return createFilterWrapper(
  317. debounceFilter(ms, options),
  318. fn
  319. );
  320. }
  321. function refDebounced(value, ms = 200, options = {}) {
  322. const debounced = vue.ref(value.value);
  323. const updater = useDebounceFn(() => {
  324. debounced.value = value.value;
  325. }, ms, options);
  326. vue.watch(value, () => updater());
  327. return debounced;
  328. }
  329. function useThrottleFn(fn, ms = 200, trailing = false, leading = true, rejectOnCancel = false) {
  330. return createFilterWrapper(
  331. throttleFilter(ms, trailing, leading, rejectOnCancel),
  332. fn
  333. );
  334. }
  335. function tryOnMounted(fn, sync = true, target) {
  336. const instance = getLifeCycleTarget();
  337. if (instance)
  338. vue.onMounted(fn, target);
  339. else if (sync)
  340. fn();
  341. else
  342. vue.nextTick(fn);
  343. }
  344. function useTimeoutFn(cb, interval, options = {}) {
  345. const {
  346. immediate = true
  347. } = options;
  348. const isPending = vue.ref(false);
  349. let timer = null;
  350. function clear() {
  351. if (timer) {
  352. clearTimeout(timer);
  353. timer = null;
  354. }
  355. }
  356. function stop() {
  357. isPending.value = false;
  358. clear();
  359. }
  360. function start(...args) {
  361. clear();
  362. isPending.value = true;
  363. timer = setTimeout(() => {
  364. isPending.value = false;
  365. timer = null;
  366. cb(...args);
  367. }, toValue(interval));
  368. }
  369. if (immediate) {
  370. isPending.value = true;
  371. if (isClient)
  372. start();
  373. }
  374. tryOnScopeDispose(stop);
  375. return {
  376. isPending: vue.readonly(isPending),
  377. start,
  378. stop
  379. };
  380. }
  381. function unrefElement(elRef) {
  382. var _a;
  383. const plain = toValue(elRef);
  384. return (_a = plain == null ? void 0 : plain.$el) != null ? _a : plain;
  385. }
  386. const defaultWindow = isClient ? window : void 0;
  387. const defaultDocument = isClient ? window.document : void 0;
  388. function useEventListener(...args) {
  389. let target;
  390. let events;
  391. let listeners;
  392. let options;
  393. if (typeof args[0] === "string" || Array.isArray(args[0])) {
  394. [events, listeners, options] = args;
  395. target = defaultWindow;
  396. } else {
  397. [target, events, listeners, options] = args;
  398. }
  399. if (!target)
  400. return noop$1;
  401. if (!Array.isArray(events))
  402. events = [events];
  403. if (!Array.isArray(listeners))
  404. listeners = [listeners];
  405. const cleanups = [];
  406. const cleanup = () => {
  407. cleanups.forEach((fn) => fn());
  408. cleanups.length = 0;
  409. };
  410. const register = (el, event, listener, options2) => {
  411. el.addEventListener(event, listener, options2);
  412. return () => el.removeEventListener(event, listener, options2);
  413. };
  414. const stopWatch = vue.watch(
  415. () => [unrefElement(target), toValue(options)],
  416. ([el, options2]) => {
  417. cleanup();
  418. if (!el)
  419. return;
  420. const optionsClone = isObject$2(options2) ? { ...options2 } : options2;
  421. cleanups.push(
  422. ...events.flatMap((event) => {
  423. return listeners.map((listener) => register(el, event, listener, optionsClone));
  424. })
  425. );
  426. },
  427. { immediate: true, flush: "post" }
  428. );
  429. const stop = () => {
  430. stopWatch();
  431. cleanup();
  432. };
  433. tryOnScopeDispose(stop);
  434. return stop;
  435. }
  436. let _iOSWorkaround = false;
  437. function onClickOutside(target, handler, options = {}) {
  438. const { window = defaultWindow, ignore = [], capture = true, detectIframe = false } = options;
  439. if (!window)
  440. return noop$1;
  441. if (isIOS && !_iOSWorkaround) {
  442. _iOSWorkaround = true;
  443. Array.from(window.document.body.children).forEach((el) => el.addEventListener("click", noop$1));
  444. window.document.documentElement.addEventListener("click", noop$1);
  445. }
  446. let shouldListen = true;
  447. const shouldIgnore = (event) => {
  448. return ignore.some((target2) => {
  449. if (typeof target2 === "string") {
  450. return Array.from(window.document.querySelectorAll(target2)).some((el) => el === event.target || event.composedPath().includes(el));
  451. } else {
  452. const el = unrefElement(target2);
  453. return el && (event.target === el || event.composedPath().includes(el));
  454. }
  455. });
  456. };
  457. const listener = (event) => {
  458. const el = unrefElement(target);
  459. if (!el || el === event.target || event.composedPath().includes(el))
  460. return;
  461. if (event.detail === 0)
  462. shouldListen = !shouldIgnore(event);
  463. if (!shouldListen) {
  464. shouldListen = true;
  465. return;
  466. }
  467. handler(event);
  468. };
  469. const cleanup = [
  470. useEventListener(window, "click", listener, { passive: true, capture }),
  471. useEventListener(window, "pointerdown", (e) => {
  472. const el = unrefElement(target);
  473. shouldListen = !shouldIgnore(e) && !!(el && !e.composedPath().includes(el));
  474. }, { passive: true }),
  475. detectIframe && useEventListener(window, "blur", (event) => {
  476. setTimeout(() => {
  477. var _a;
  478. const el = unrefElement(target);
  479. if (((_a = window.document.activeElement) == null ? void 0 : _a.tagName) === "IFRAME" && !(el == null ? void 0 : el.contains(window.document.activeElement))) {
  480. handler(event);
  481. }
  482. }, 0);
  483. })
  484. ].filter(Boolean);
  485. const stop = () => cleanup.forEach((fn) => fn());
  486. return stop;
  487. }
  488. function useMounted() {
  489. const isMounted = vue.ref(false);
  490. const instance = vue.getCurrentInstance();
  491. if (instance) {
  492. vue.onMounted(() => {
  493. isMounted.value = true;
  494. }, instance);
  495. }
  496. return isMounted;
  497. }
  498. function useSupported(callback) {
  499. const isMounted = useMounted();
  500. return vue.computed(() => {
  501. isMounted.value;
  502. return Boolean(callback());
  503. });
  504. }
  505. function useMutationObserver(target, callback, options = {}) {
  506. const { window = defaultWindow, ...mutationOptions } = options;
  507. let observer;
  508. const isSupported = useSupported(() => window && "MutationObserver" in window);
  509. const cleanup = () => {
  510. if (observer) {
  511. observer.disconnect();
  512. observer = void 0;
  513. }
  514. };
  515. const targets = vue.computed(() => {
  516. const value = toValue(target);
  517. const items = (Array.isArray(value) ? value : [value]).map(unrefElement).filter(notNullish);
  518. return new Set(items);
  519. });
  520. const stopWatch = vue.watch(
  521. () => targets.value,
  522. (targets2) => {
  523. cleanup();
  524. if (isSupported.value && targets2.size) {
  525. observer = new MutationObserver(callback);
  526. targets2.forEach((el) => observer.observe(el, mutationOptions));
  527. }
  528. },
  529. { immediate: true, flush: "post" }
  530. );
  531. const takeRecords = () => {
  532. return observer == null ? void 0 : observer.takeRecords();
  533. };
  534. const stop = () => {
  535. cleanup();
  536. stopWatch();
  537. };
  538. tryOnScopeDispose(stop);
  539. return {
  540. isSupported,
  541. stop,
  542. takeRecords
  543. };
  544. }
  545. function useActiveElement(options = {}) {
  546. var _a;
  547. const {
  548. window = defaultWindow,
  549. deep = true,
  550. triggerOnRemoval = false
  551. } = options;
  552. const document = (_a = options.document) != null ? _a : window == null ? void 0 : window.document;
  553. const getDeepActiveElement = () => {
  554. var _a2;
  555. let element = document == null ? void 0 : document.activeElement;
  556. if (deep) {
  557. while (element == null ? void 0 : element.shadowRoot)
  558. element = (_a2 = element == null ? void 0 : element.shadowRoot) == null ? void 0 : _a2.activeElement;
  559. }
  560. return element;
  561. };
  562. const activeElement = vue.ref();
  563. const trigger = () => {
  564. activeElement.value = getDeepActiveElement();
  565. };
  566. if (window) {
  567. useEventListener(window, "blur", (event) => {
  568. if (event.relatedTarget !== null)
  569. return;
  570. trigger();
  571. }, true);
  572. useEventListener(window, "focus", trigger, true);
  573. }
  574. if (triggerOnRemoval) {
  575. useMutationObserver(document, (mutations) => {
  576. mutations.filter((m) => m.removedNodes.length).map((n) => Array.from(n.removedNodes)).flat().forEach((node) => {
  577. if (node === activeElement.value)
  578. trigger();
  579. });
  580. }, {
  581. childList: true,
  582. subtree: true
  583. });
  584. }
  585. trigger();
  586. return activeElement;
  587. }
  588. function useMediaQuery(query, options = {}) {
  589. const { window = defaultWindow } = options;
  590. const isSupported = useSupported(() => window && "matchMedia" in window && typeof window.matchMedia === "function");
  591. let mediaQuery;
  592. const matches = vue.ref(false);
  593. const handler = (event) => {
  594. matches.value = event.matches;
  595. };
  596. const cleanup = () => {
  597. if (!mediaQuery)
  598. return;
  599. if ("removeEventListener" in mediaQuery)
  600. mediaQuery.removeEventListener("change", handler);
  601. else
  602. mediaQuery.removeListener(handler);
  603. };
  604. const stopWatch = vue.watchEffect(() => {
  605. if (!isSupported.value)
  606. return;
  607. cleanup();
  608. mediaQuery = window.matchMedia(toValue(query));
  609. if ("addEventListener" in mediaQuery)
  610. mediaQuery.addEventListener("change", handler);
  611. else
  612. mediaQuery.addListener(handler);
  613. matches.value = mediaQuery.matches;
  614. });
  615. tryOnScopeDispose(() => {
  616. stopWatch();
  617. cleanup();
  618. mediaQuery = void 0;
  619. });
  620. return matches;
  621. }
  622. function cloneFnJSON(source) {
  623. return JSON.parse(JSON.stringify(source));
  624. }
  625. function useCssVar(prop, target, options = {}) {
  626. const { window = defaultWindow, initialValue = "", observe = false } = options;
  627. const variable = vue.ref(initialValue);
  628. const elRef = vue.computed(() => {
  629. var _a;
  630. return unrefElement(target) || ((_a = window == null ? void 0 : window.document) == null ? void 0 : _a.documentElement);
  631. });
  632. function updateCssVar() {
  633. var _a;
  634. const key = toValue(prop);
  635. const el = toValue(elRef);
  636. if (el && window) {
  637. const value = (_a = window.getComputedStyle(el).getPropertyValue(key)) == null ? void 0 : _a.trim();
  638. variable.value = value || initialValue;
  639. }
  640. }
  641. if (observe) {
  642. useMutationObserver(elRef, updateCssVar, {
  643. attributeFilter: ["style", "class"],
  644. window
  645. });
  646. }
  647. vue.watch(
  648. [elRef, () => toValue(prop)],
  649. updateCssVar,
  650. { immediate: true }
  651. );
  652. vue.watch(
  653. variable,
  654. (val) => {
  655. var _a;
  656. if ((_a = elRef.value) == null ? void 0 : _a.style)
  657. elRef.value.style.setProperty(toValue(prop), val);
  658. }
  659. );
  660. return variable;
  661. }
  662. function useDocumentVisibility(options = {}) {
  663. const { document = defaultDocument } = options;
  664. if (!document)
  665. return vue.ref("visible");
  666. const visibility = vue.ref(document.visibilityState);
  667. useEventListener(document, "visibilitychange", () => {
  668. visibility.value = document.visibilityState;
  669. });
  670. return visibility;
  671. }
  672. function useResizeObserver(target, callback, options = {}) {
  673. const { window = defaultWindow, ...observerOptions } = options;
  674. let observer;
  675. const isSupported = useSupported(() => window && "ResizeObserver" in window);
  676. const cleanup = () => {
  677. if (observer) {
  678. observer.disconnect();
  679. observer = void 0;
  680. }
  681. };
  682. const targets = vue.computed(() => Array.isArray(target) ? target.map((el) => unrefElement(el)) : [unrefElement(target)]);
  683. const stopWatch = vue.watch(
  684. targets,
  685. (els) => {
  686. cleanup();
  687. if (isSupported.value && window) {
  688. observer = new ResizeObserver(callback);
  689. for (const _el of els)
  690. _el && observer.observe(_el, observerOptions);
  691. }
  692. },
  693. { immediate: true, flush: "post" }
  694. );
  695. const stop = () => {
  696. cleanup();
  697. stopWatch();
  698. };
  699. tryOnScopeDispose(stop);
  700. return {
  701. isSupported,
  702. stop
  703. };
  704. }
  705. function useElementBounding(target, options = {}) {
  706. const {
  707. reset = true,
  708. windowResize = true,
  709. windowScroll = true,
  710. immediate = true
  711. } = options;
  712. const height = vue.ref(0);
  713. const bottom = vue.ref(0);
  714. const left = vue.ref(0);
  715. const right = vue.ref(0);
  716. const top = vue.ref(0);
  717. const width = vue.ref(0);
  718. const x = vue.ref(0);
  719. const y = vue.ref(0);
  720. function update() {
  721. const el = unrefElement(target);
  722. if (!el) {
  723. if (reset) {
  724. height.value = 0;
  725. bottom.value = 0;
  726. left.value = 0;
  727. right.value = 0;
  728. top.value = 0;
  729. width.value = 0;
  730. x.value = 0;
  731. y.value = 0;
  732. }
  733. return;
  734. }
  735. const rect = el.getBoundingClientRect();
  736. height.value = rect.height;
  737. bottom.value = rect.bottom;
  738. left.value = rect.left;
  739. right.value = rect.right;
  740. top.value = rect.top;
  741. width.value = rect.width;
  742. x.value = rect.x;
  743. y.value = rect.y;
  744. }
  745. useResizeObserver(target, update);
  746. vue.watch(() => unrefElement(target), (ele) => !ele && update());
  747. useMutationObserver(target, update, {
  748. attributeFilter: ["style", "class"]
  749. });
  750. if (windowScroll)
  751. useEventListener("scroll", update, { capture: true, passive: true });
  752. if (windowResize)
  753. useEventListener("resize", update, { passive: true });
  754. tryOnMounted(() => {
  755. if (immediate)
  756. update();
  757. });
  758. return {
  759. height,
  760. bottom,
  761. left,
  762. right,
  763. top,
  764. width,
  765. x,
  766. y,
  767. update
  768. };
  769. }
  770. function useElementSize(target, initialSize = { width: 0, height: 0 }, options = {}) {
  771. const { window = defaultWindow, box = "content-box" } = options;
  772. const isSVG = vue.computed(() => {
  773. var _a, _b;
  774. return (_b = (_a = unrefElement(target)) == null ? void 0 : _a.namespaceURI) == null ? void 0 : _b.includes("svg");
  775. });
  776. const width = vue.ref(initialSize.width);
  777. const height = vue.ref(initialSize.height);
  778. const { stop: stop1 } = useResizeObserver(
  779. target,
  780. ([entry]) => {
  781. const boxSize = box === "border-box" ? entry.borderBoxSize : box === "content-box" ? entry.contentBoxSize : entry.devicePixelContentBoxSize;
  782. if (window && isSVG.value) {
  783. const $elem = unrefElement(target);
  784. if ($elem) {
  785. const rect = $elem.getBoundingClientRect();
  786. width.value = rect.width;
  787. height.value = rect.height;
  788. }
  789. } else {
  790. if (boxSize) {
  791. const formatBoxSize = Array.isArray(boxSize) ? boxSize : [boxSize];
  792. width.value = formatBoxSize.reduce((acc, { inlineSize }) => acc + inlineSize, 0);
  793. height.value = formatBoxSize.reduce((acc, { blockSize }) => acc + blockSize, 0);
  794. } else {
  795. width.value = entry.contentRect.width;
  796. height.value = entry.contentRect.height;
  797. }
  798. }
  799. },
  800. options
  801. );
  802. tryOnMounted(() => {
  803. const ele = unrefElement(target);
  804. if (ele) {
  805. width.value = "offsetWidth" in ele ? ele.offsetWidth : initialSize.width;
  806. height.value = "offsetHeight" in ele ? ele.offsetHeight : initialSize.height;
  807. }
  808. });
  809. const stop2 = vue.watch(
  810. () => unrefElement(target),
  811. (ele) => {
  812. width.value = ele ? initialSize.width : 0;
  813. height.value = ele ? initialSize.height : 0;
  814. }
  815. );
  816. function stop() {
  817. stop1();
  818. stop2();
  819. }
  820. return {
  821. width,
  822. height,
  823. stop
  824. };
  825. }
  826. function useIntersectionObserver(target, callback, options = {}) {
  827. const {
  828. root,
  829. rootMargin = "0px",
  830. threshold = 0.1,
  831. window = defaultWindow,
  832. immediate = true
  833. } = options;
  834. const isSupported = useSupported(() => window && "IntersectionObserver" in window);
  835. const targets = vue.computed(() => {
  836. const _target = toValue(target);
  837. return (Array.isArray(_target) ? _target : [_target]).map(unrefElement).filter(notNullish);
  838. });
  839. let cleanup = noop$1;
  840. const isActive = vue.ref(immediate);
  841. const stopWatch = isSupported.value ? vue.watch(
  842. () => [targets.value, unrefElement(root), isActive.value],
  843. ([targets2, root2]) => {
  844. cleanup();
  845. if (!isActive.value)
  846. return;
  847. if (!targets2.length)
  848. return;
  849. const observer = new IntersectionObserver(
  850. callback,
  851. {
  852. root: unrefElement(root2),
  853. rootMargin,
  854. threshold
  855. }
  856. );
  857. targets2.forEach((el) => el && observer.observe(el));
  858. cleanup = () => {
  859. observer.disconnect();
  860. cleanup = noop$1;
  861. };
  862. },
  863. { immediate, flush: "post" }
  864. ) : noop$1;
  865. const stop = () => {
  866. cleanup();
  867. stopWatch();
  868. isActive.value = false;
  869. };
  870. tryOnScopeDispose(stop);
  871. return {
  872. isSupported,
  873. isActive,
  874. pause() {
  875. cleanup();
  876. isActive.value = false;
  877. },
  878. resume() {
  879. isActive.value = true;
  880. },
  881. stop
  882. };
  883. }
  884. function useVModel(props, key, emit, options = {}) {
  885. var _a, _b, _c;
  886. const {
  887. clone = false,
  888. passive = false,
  889. eventName,
  890. deep = false,
  891. defaultValue,
  892. shouldEmit
  893. } = options;
  894. const vm = vue.getCurrentInstance();
  895. 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));
  896. let event = eventName;
  897. if (!key) {
  898. {
  899. key = "modelValue";
  900. }
  901. }
  902. event = event || `update:${key.toString()}`;
  903. const cloneFn = (val) => !clone ? val : typeof clone === "function" ? clone(val) : cloneFnJSON(val);
  904. const getValue = () => isDef(props[key]) ? cloneFn(props[key]) : defaultValue;
  905. const triggerEmit = (value) => {
  906. if (shouldEmit) {
  907. if (shouldEmit(value))
  908. _emit(event, value);
  909. } else {
  910. _emit(event, value);
  911. }
  912. };
  913. if (passive) {
  914. const initialValue = getValue();
  915. const proxy = vue.ref(initialValue);
  916. let isUpdating = false;
  917. vue.watch(
  918. () => props[key],
  919. (v) => {
  920. if (!isUpdating) {
  921. isUpdating = true;
  922. proxy.value = cloneFn(v);
  923. vue.nextTick(() => isUpdating = false);
  924. }
  925. }
  926. );
  927. vue.watch(
  928. proxy,
  929. (v) => {
  930. if (!isUpdating && (v !== props[key] || deep))
  931. triggerEmit(v);
  932. },
  933. { deep }
  934. );
  935. return proxy;
  936. } else {
  937. return vue.computed({
  938. get() {
  939. return getValue();
  940. },
  941. set(value) {
  942. triggerEmit(value);
  943. }
  944. });
  945. }
  946. }
  947. function useWindowFocus(options = {}) {
  948. const { window = defaultWindow } = options;
  949. if (!window)
  950. return vue.ref(false);
  951. const focused = vue.ref(window.document.hasFocus());
  952. useEventListener(window, "blur", () => {
  953. focused.value = false;
  954. });
  955. useEventListener(window, "focus", () => {
  956. focused.value = true;
  957. });
  958. return focused;
  959. }
  960. function useWindowSize(options = {}) {
  961. const {
  962. window = defaultWindow,
  963. initialWidth = Number.POSITIVE_INFINITY,
  964. initialHeight = Number.POSITIVE_INFINITY,
  965. listenOrientation = true,
  966. includeScrollbar = true
  967. } = options;
  968. const width = vue.ref(initialWidth);
  969. const height = vue.ref(initialHeight);
  970. const update = () => {
  971. if (window) {
  972. if (includeScrollbar) {
  973. width.value = window.innerWidth;
  974. height.value = window.innerHeight;
  975. } else {
  976. width.value = window.document.documentElement.clientWidth;
  977. height.value = window.document.documentElement.clientHeight;
  978. }
  979. }
  980. };
  981. update();
  982. tryOnMounted(update);
  983. useEventListener("resize", update, { passive: true });
  984. if (listenOrientation) {
  985. const matches = useMediaQuery("(orientation: portrait)");
  986. vue.watch(matches, () => update());
  987. }
  988. return { width, height };
  989. }
  990. const isFirefox = () => isClient && /firefox/i.test(window.navigator.userAgent);
  991. const isAndroid = () => isClient && /android/i.test(window.navigator.userAgent);
  992. const composeEventHandlers = (theirsHandler, oursHandler, { checkForDefaultPrevented = true } = {}) => {
  993. const handleEvent = (event) => {
  994. const shouldPrevent = theirsHandler == null ? void 0 : theirsHandler(event);
  995. if (checkForDefaultPrevented === false || !shouldPrevent) {
  996. return oursHandler == null ? void 0 : oursHandler(event);
  997. }
  998. };
  999. return handleEvent;
  1000. };
  1001. const whenMouse = (handler) => {
  1002. return (e) => e.pointerType === "mouse" ? handler(e) : void 0;
  1003. };
  1004. const getEventCode = (event) => {
  1005. if (event.code && event.code !== "Unidentified")
  1006. return event.code;
  1007. const key = getEventKey(event);
  1008. if (key) {
  1009. if (Object.values(EVENT_CODE).includes(key))
  1010. return key;
  1011. switch (key) {
  1012. case " ":
  1013. return EVENT_CODE.space;
  1014. default:
  1015. return "";
  1016. }
  1017. }
  1018. return "";
  1019. };
  1020. const getEventKey = (event) => {
  1021. let key = event.key && event.key !== "Unidentified" ? event.key : "";
  1022. if (!key && event.type === "keyup" && isAndroid()) {
  1023. const target = event.target;
  1024. key = target.value.charAt(target.selectionStart - 1);
  1025. }
  1026. return key;
  1027. };
  1028. const getOffsetTop = (el) => {
  1029. let offset = 0;
  1030. let parent = el;
  1031. while (parent) {
  1032. offset += parent.offsetTop;
  1033. parent = parent.offsetParent;
  1034. }
  1035. return offset;
  1036. };
  1037. const getOffsetTopDistance = (el, containerEl) => {
  1038. return Math.abs(getOffsetTop(el) - getOffsetTop(containerEl));
  1039. };
  1040. const getClientXY = (event) => {
  1041. let clientX;
  1042. let clientY;
  1043. if (event.type === "touchend") {
  1044. clientY = event.changedTouches[0].clientY;
  1045. clientX = event.changedTouches[0].clientX;
  1046. } else if (event.type.startsWith("touch")) {
  1047. clientY = event.touches[0].clientY;
  1048. clientX = event.touches[0].clientX;
  1049. } else {
  1050. clientY = event.clientY;
  1051. clientX = event.clientX;
  1052. }
  1053. return {
  1054. clientX,
  1055. clientY
  1056. };
  1057. };
  1058. function easeInOutCubic(t, b, c, d) {
  1059. const cc = c - b;
  1060. t /= d / 2;
  1061. if (t < 1) {
  1062. return cc / 2 * t * t * t + b;
  1063. }
  1064. return cc / 2 * ((t -= 2) * t * t + 2) + b;
  1065. }
  1066. const NOOP = () => {
  1067. };
  1068. const hasOwnProperty$p = Object.prototype.hasOwnProperty;
  1069. const hasOwn = (val, key) => hasOwnProperty$p.call(val, key);
  1070. const isArray$1 = Array.isArray;
  1071. const isDate$1 = (val) => toTypeString(val) === "[object Date]";
  1072. const isFunction$1 = (val) => typeof val === "function";
  1073. const isString$1 = (val) => typeof val === "string";
  1074. const isObject$1 = (val) => val !== null && typeof val === "object";
  1075. const isPromise = (val) => {
  1076. return isObject$1(val) && isFunction$1(val.then) && isFunction$1(val.catch);
  1077. };
  1078. const objectToString$1 = Object.prototype.toString;
  1079. const toTypeString = (value) => objectToString$1.call(value);
  1080. const isPlainObject$1 = (val) => toTypeString(val) === "[object Object]";
  1081. const cacheStringFunction = (fn) => {
  1082. const cache = /* @__PURE__ */ Object.create(null);
  1083. return (str) => {
  1084. const hit = cache[str];
  1085. return hit || (cache[str] = fn(str));
  1086. };
  1087. };
  1088. const camelizeRE = /-(\w)/g;
  1089. const camelize = cacheStringFunction((str) => {
  1090. return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
  1091. });
  1092. const hyphenateRE = /\B([A-Z])/g;
  1093. const hyphenate = cacheStringFunction((str) => str.replace(hyphenateRE, "-$1").toLowerCase());
  1094. const capitalize$2 = cacheStringFunction((str) => str.charAt(0).toUpperCase() + str.slice(1));
  1095. var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
  1096. var freeSelf = typeof self == "object" && self && self.Object === Object && self;
  1097. var root = freeGlobal || freeSelf || Function("return this")();
  1098. var Symbol$1 = root.Symbol;
  1099. var objectProto$s = Object.prototype;
  1100. var hasOwnProperty$o = objectProto$s.hasOwnProperty;
  1101. var nativeObjectToString$3 = objectProto$s.toString;
  1102. var symToStringTag$1 = Symbol$1 ? Symbol$1.toStringTag : void 0;
  1103. function getRawTag(value) {
  1104. var isOwn = hasOwnProperty$o.call(value, symToStringTag$1), tag = value[symToStringTag$1];
  1105. try {
  1106. value[symToStringTag$1] = void 0;
  1107. var unmasked = true;
  1108. } catch (e) {
  1109. }
  1110. var result = nativeObjectToString$3.call(value);
  1111. if (unmasked) {
  1112. if (isOwn) {
  1113. value[symToStringTag$1] = tag;
  1114. } else {
  1115. delete value[symToStringTag$1];
  1116. }
  1117. }
  1118. return result;
  1119. }
  1120. var objectProto$r = Object.prototype;
  1121. var nativeObjectToString$2 = objectProto$r.toString;
  1122. function objectToString(value) {
  1123. return nativeObjectToString$2.call(value);
  1124. }
  1125. var nullTag = "[object Null]";
  1126. var undefinedTag = "[object Undefined]";
  1127. var symToStringTag = Symbol$1 ? Symbol$1.toStringTag : void 0;
  1128. function baseGetTag(value) {
  1129. if (value == null) {
  1130. return value === void 0 ? undefinedTag : nullTag;
  1131. }
  1132. return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
  1133. }
  1134. function isObjectLike(value) {
  1135. return value != null && typeof value == "object";
  1136. }
  1137. var symbolTag$3 = "[object Symbol]";
  1138. function isSymbol(value) {
  1139. return typeof value == "symbol" || isObjectLike(value) && baseGetTag(value) == symbolTag$3;
  1140. }
  1141. var NAN$2 = 0 / 0;
  1142. function baseToNumber(value) {
  1143. if (typeof value == "number") {
  1144. return value;
  1145. }
  1146. if (isSymbol(value)) {
  1147. return NAN$2;
  1148. }
  1149. return +value;
  1150. }
  1151. function arrayMap(array, iteratee) {
  1152. var index = -1, length = array == null ? 0 : array.length, result = Array(length);
  1153. while (++index < length) {
  1154. result[index] = iteratee(array[index], index, array);
  1155. }
  1156. return result;
  1157. }
  1158. var isArray = Array.isArray;
  1159. var INFINITY$5 = 1 / 0;
  1160. var symbolProto$2 = Symbol$1 ? Symbol$1.prototype : void 0;
  1161. var symbolToString = symbolProto$2 ? symbolProto$2.toString : void 0;
  1162. function baseToString(value) {
  1163. if (typeof value == "string") {
  1164. return value;
  1165. }
  1166. if (isArray(value)) {
  1167. return arrayMap(value, baseToString) + "";
  1168. }
  1169. if (isSymbol(value)) {
  1170. return symbolToString ? symbolToString.call(value) : "";
  1171. }
  1172. var result = value + "";
  1173. return result == "0" && 1 / value == -INFINITY$5 ? "-0" : result;
  1174. }
  1175. function createMathOperation(operator, defaultValue) {
  1176. return function(value, other) {
  1177. var result;
  1178. if (value === void 0 && other === void 0) {
  1179. return defaultValue;
  1180. }
  1181. if (value !== void 0) {
  1182. result = value;
  1183. }
  1184. if (other !== void 0) {
  1185. if (result === void 0) {
  1186. return other;
  1187. }
  1188. if (typeof value == "string" || typeof other == "string") {
  1189. value = baseToString(value);
  1190. other = baseToString(other);
  1191. } else {
  1192. value = baseToNumber(value);
  1193. other = baseToNumber(other);
  1194. }
  1195. result = operator(value, other);
  1196. }
  1197. return result;
  1198. };
  1199. }
  1200. var add = createMathOperation(function(augend, addend) {
  1201. return augend + addend;
  1202. }, 0);
  1203. var reWhitespace = /\s/;
  1204. function trimmedEndIndex(string) {
  1205. var index = string.length;
  1206. while (index-- && reWhitespace.test(string.charAt(index))) {
  1207. }
  1208. return index;
  1209. }
  1210. var reTrimStart$2 = /^\s+/;
  1211. function baseTrim(string) {
  1212. return string ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart$2, "") : string;
  1213. }
  1214. function isObject(value) {
  1215. var type = typeof value;
  1216. return value != null && (type == "object" || type == "function");
  1217. }
  1218. var NAN$1 = 0 / 0;
  1219. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  1220. var reIsBinary = /^0b[01]+$/i;
  1221. var reIsOctal = /^0o[0-7]+$/i;
  1222. var freeParseInt = parseInt;
  1223. function toNumber(value) {
  1224. if (typeof value == "number") {
  1225. return value;
  1226. }
  1227. if (isSymbol(value)) {
  1228. return NAN$1;
  1229. }
  1230. if (isObject(value)) {
  1231. var other = typeof value.valueOf == "function" ? value.valueOf() : value;
  1232. value = isObject(other) ? other + "" : other;
  1233. }
  1234. if (typeof value != "string") {
  1235. return value === 0 ? value : +value;
  1236. }
  1237. value = baseTrim(value);
  1238. var isBinary = reIsBinary.test(value);
  1239. return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN$1 : +value;
  1240. }
  1241. var INFINITY$4 = 1 / 0;
  1242. var MAX_INTEGER = 17976931348623157e292;
  1243. function toFinite(value) {
  1244. if (!value) {
  1245. return value === 0 ? value : 0;
  1246. }
  1247. value = toNumber(value);
  1248. if (value === INFINITY$4 || value === -INFINITY$4) {
  1249. var sign = value < 0 ? -1 : 1;
  1250. return sign * MAX_INTEGER;
  1251. }
  1252. return value === value ? value : 0;
  1253. }
  1254. function toInteger(value) {
  1255. var result = toFinite(value), remainder = result % 1;
  1256. return result === result ? remainder ? result - remainder : result : 0;
  1257. }
  1258. var FUNC_ERROR_TEXT$b = "Expected a function";
  1259. function after(n, func) {
  1260. if (typeof func != "function") {
  1261. throw new TypeError(FUNC_ERROR_TEXT$b);
  1262. }
  1263. n = toInteger(n);
  1264. return function() {
  1265. if (--n < 1) {
  1266. return func.apply(this, arguments);
  1267. }
  1268. };
  1269. }
  1270. function identity(value) {
  1271. return value;
  1272. }
  1273. var asyncTag = "[object AsyncFunction]";
  1274. var funcTag$2 = "[object Function]";
  1275. var genTag$1 = "[object GeneratorFunction]";
  1276. var proxyTag = "[object Proxy]";
  1277. function isFunction(value) {
  1278. if (!isObject(value)) {
  1279. return false;
  1280. }
  1281. var tag = baseGetTag(value);
  1282. return tag == funcTag$2 || tag == genTag$1 || tag == asyncTag || tag == proxyTag;
  1283. }
  1284. var coreJsData = root["__core-js_shared__"];
  1285. var maskSrcKey = function() {
  1286. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || "");
  1287. return uid ? "Symbol(src)_1." + uid : "";
  1288. }();
  1289. function isMasked(func) {
  1290. return !!maskSrcKey && maskSrcKey in func;
  1291. }
  1292. var funcProto$2 = Function.prototype;
  1293. var funcToString$2 = funcProto$2.toString;
  1294. function toSource(func) {
  1295. if (func != null) {
  1296. try {
  1297. return funcToString$2.call(func);
  1298. } catch (e) {
  1299. }
  1300. try {
  1301. return func + "";
  1302. } catch (e) {
  1303. }
  1304. }
  1305. return "";
  1306. }
  1307. var reRegExpChar$1 = /[\\^$.*+?()[\]{}|]/g;
  1308. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  1309. var funcProto$1 = Function.prototype;
  1310. var objectProto$q = Object.prototype;
  1311. var funcToString$1 = funcProto$1.toString;
  1312. var hasOwnProperty$n = objectProto$q.hasOwnProperty;
  1313. var reIsNative = RegExp("^" + funcToString$1.call(hasOwnProperty$n).replace(reRegExpChar$1, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$");
  1314. function baseIsNative(value) {
  1315. if (!isObject(value) || isMasked(value)) {
  1316. return false;
  1317. }
  1318. var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
  1319. return pattern.test(toSource(value));
  1320. }
  1321. function getValue$1(object, key) {
  1322. return object == null ? void 0 : object[key];
  1323. }
  1324. function getNative(object, key) {
  1325. var value = getValue$1(object, key);
  1326. return baseIsNative(value) ? value : void 0;
  1327. }
  1328. var WeakMap$1 = getNative(root, "WeakMap");
  1329. var metaMap = WeakMap$1 && new WeakMap$1();
  1330. var baseSetData = !metaMap ? identity : function(func, data) {
  1331. metaMap.set(func, data);
  1332. return func;
  1333. };
  1334. var objectCreate = Object.create;
  1335. var baseCreate = function() {
  1336. function object() {
  1337. }
  1338. return function(proto) {
  1339. if (!isObject(proto)) {
  1340. return {};
  1341. }
  1342. if (objectCreate) {
  1343. return objectCreate(proto);
  1344. }
  1345. object.prototype = proto;
  1346. var result = new object();
  1347. object.prototype = void 0;
  1348. return result;
  1349. };
  1350. }();
  1351. function createCtor(Ctor) {
  1352. return function() {
  1353. var args = arguments;
  1354. switch (args.length) {
  1355. case 0:
  1356. return new Ctor();
  1357. case 1:
  1358. return new Ctor(args[0]);
  1359. case 2:
  1360. return new Ctor(args[0], args[1]);
  1361. case 3:
  1362. return new Ctor(args[0], args[1], args[2]);
  1363. case 4:
  1364. return new Ctor(args[0], args[1], args[2], args[3]);
  1365. case 5:
  1366. return new Ctor(args[0], args[1], args[2], args[3], args[4]);
  1367. case 6:
  1368. return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
  1369. case 7:
  1370. return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
  1371. }
  1372. var thisBinding = baseCreate(Ctor.prototype), result = Ctor.apply(thisBinding, args);
  1373. return isObject(result) ? result : thisBinding;
  1374. };
  1375. }
  1376. var WRAP_BIND_FLAG$8 = 1;
  1377. function createBind(func, bitmask, thisArg) {
  1378. var isBind = bitmask & WRAP_BIND_FLAG$8, Ctor = createCtor(func);
  1379. function wrapper() {
  1380. var fn = this && this !== root && this instanceof wrapper ? Ctor : func;
  1381. return fn.apply(isBind ? thisArg : this, arguments);
  1382. }
  1383. return wrapper;
  1384. }
  1385. function apply(func, thisArg, args) {
  1386. switch (args.length) {
  1387. case 0:
  1388. return func.call(thisArg);
  1389. case 1:
  1390. return func.call(thisArg, args[0]);
  1391. case 2:
  1392. return func.call(thisArg, args[0], args[1]);
  1393. case 3:
  1394. return func.call(thisArg, args[0], args[1], args[2]);
  1395. }
  1396. return func.apply(thisArg, args);
  1397. }
  1398. var nativeMax$g = Math.max;
  1399. function composeArgs(args, partials, holders, isCurried) {
  1400. 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;
  1401. while (++leftIndex < leftLength) {
  1402. result[leftIndex] = partials[leftIndex];
  1403. }
  1404. while (++argsIndex < holdersLength) {
  1405. if (isUncurried || argsIndex < argsLength) {
  1406. result[holders[argsIndex]] = args[argsIndex];
  1407. }
  1408. }
  1409. while (rangeLength--) {
  1410. result[leftIndex++] = args[argsIndex++];
  1411. }
  1412. return result;
  1413. }
  1414. var nativeMax$f = Math.max;
  1415. function composeArgsRight(args, partials, holders, isCurried) {
  1416. 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;
  1417. while (++argsIndex < rangeLength) {
  1418. result[argsIndex] = args[argsIndex];
  1419. }
  1420. var offset = argsIndex;
  1421. while (++rightIndex < rightLength) {
  1422. result[offset + rightIndex] = partials[rightIndex];
  1423. }
  1424. while (++holdersIndex < holdersLength) {
  1425. if (isUncurried || argsIndex < argsLength) {
  1426. result[offset + holders[holdersIndex]] = args[argsIndex++];
  1427. }
  1428. }
  1429. return result;
  1430. }
  1431. function countHolders(array, placeholder) {
  1432. var length = array.length, result = 0;
  1433. while (length--) {
  1434. if (array[length] === placeholder) {
  1435. ++result;
  1436. }
  1437. }
  1438. return result;
  1439. }
  1440. function baseLodash() {
  1441. }
  1442. var MAX_ARRAY_LENGTH$6 = 4294967295;
  1443. function LazyWrapper(value) {
  1444. this.__wrapped__ = value;
  1445. this.__actions__ = [];
  1446. this.__dir__ = 1;
  1447. this.__filtered__ = false;
  1448. this.__iteratees__ = [];
  1449. this.__takeCount__ = MAX_ARRAY_LENGTH$6;
  1450. this.__views__ = [];
  1451. }
  1452. LazyWrapper.prototype = baseCreate(baseLodash.prototype);
  1453. LazyWrapper.prototype.constructor = LazyWrapper;
  1454. function noop() {
  1455. }
  1456. var getData = !metaMap ? noop : function(func) {
  1457. return metaMap.get(func);
  1458. };
  1459. var realNames = {};
  1460. var objectProto$p = Object.prototype;
  1461. var hasOwnProperty$m = objectProto$p.hasOwnProperty;
  1462. function getFuncName(func) {
  1463. var result = func.name + "", array = realNames[result], length = hasOwnProperty$m.call(realNames, result) ? array.length : 0;
  1464. while (length--) {
  1465. var data = array[length], otherFunc = data.func;
  1466. if (otherFunc == null || otherFunc == func) {
  1467. return data.name;
  1468. }
  1469. }
  1470. return result;
  1471. }
  1472. function LodashWrapper(value, chainAll) {
  1473. this.__wrapped__ = value;
  1474. this.__actions__ = [];
  1475. this.__chain__ = !!chainAll;
  1476. this.__index__ = 0;
  1477. this.__values__ = void 0;
  1478. }
  1479. LodashWrapper.prototype = baseCreate(baseLodash.prototype);
  1480. LodashWrapper.prototype.constructor = LodashWrapper;
  1481. function copyArray(source, array) {
  1482. var index = -1, length = source.length;
  1483. array || (array = Array(length));
  1484. while (++index < length) {
  1485. array[index] = source[index];
  1486. }
  1487. return array;
  1488. }
  1489. function wrapperClone(wrapper) {
  1490. if (wrapper instanceof LazyWrapper) {
  1491. return wrapper.clone();
  1492. }
  1493. var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
  1494. result.__actions__ = copyArray(wrapper.__actions__);
  1495. result.__index__ = wrapper.__index__;
  1496. result.__values__ = wrapper.__values__;
  1497. return result;
  1498. }
  1499. var objectProto$o = Object.prototype;
  1500. var hasOwnProperty$l = objectProto$o.hasOwnProperty;
  1501. function lodash(value) {
  1502. if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
  1503. if (value instanceof LodashWrapper) {
  1504. return value;
  1505. }
  1506. if (hasOwnProperty$l.call(value, "__wrapped__")) {
  1507. return wrapperClone(value);
  1508. }
  1509. }
  1510. return new LodashWrapper(value);
  1511. }
  1512. lodash.prototype = baseLodash.prototype;
  1513. lodash.prototype.constructor = lodash;
  1514. function isLaziable(func) {
  1515. var funcName = getFuncName(func), other = lodash[funcName];
  1516. if (typeof other != "function" || !(funcName in LazyWrapper.prototype)) {
  1517. return false;
  1518. }
  1519. if (func === other) {
  1520. return true;
  1521. }
  1522. var data = getData(other);
  1523. return !!data && func === data[0];
  1524. }
  1525. var HOT_COUNT = 800;
  1526. var HOT_SPAN = 16;
  1527. var nativeNow = Date.now;
  1528. function shortOut(func) {
  1529. var count = 0, lastCalled = 0;
  1530. return function() {
  1531. var stamp = nativeNow(), remaining = HOT_SPAN - (stamp - lastCalled);
  1532. lastCalled = stamp;
  1533. if (remaining > 0) {
  1534. if (++count >= HOT_COUNT) {
  1535. return arguments[0];
  1536. }
  1537. } else {
  1538. count = 0;
  1539. }
  1540. return func.apply(void 0, arguments);
  1541. };
  1542. }
  1543. var setData = shortOut(baseSetData);
  1544. var reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/;
  1545. var reSplitDetails = /,? & /;
  1546. function getWrapDetails(source) {
  1547. var match = source.match(reWrapDetails);
  1548. return match ? match[1].split(reSplitDetails) : [];
  1549. }
  1550. var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/;
  1551. function insertWrapDetails(source, details) {
  1552. var length = details.length;
  1553. if (!length) {
  1554. return source;
  1555. }
  1556. var lastIndex = length - 1;
  1557. details[lastIndex] = (length > 1 ? "& " : "") + details[lastIndex];
  1558. details = details.join(length > 2 ? ", " : " ");
  1559. return source.replace(reWrapComment, "{\n/* [wrapped with " + details + "] */\n");
  1560. }
  1561. function constant(value) {
  1562. return function() {
  1563. return value;
  1564. };
  1565. }
  1566. var defineProperty = function() {
  1567. try {
  1568. var func = getNative(Object, "defineProperty");
  1569. func({}, "", {});
  1570. return func;
  1571. } catch (e) {
  1572. }
  1573. }();
  1574. var baseSetToString = !defineProperty ? identity : function(func, string) {
  1575. return defineProperty(func, "toString", {
  1576. "configurable": true,
  1577. "enumerable": false,
  1578. "value": constant(string),
  1579. "writable": true
  1580. });
  1581. };
  1582. var setToString = shortOut(baseSetToString);
  1583. function arrayEach(array, iteratee) {
  1584. var index = -1, length = array == null ? 0 : array.length;
  1585. while (++index < length) {
  1586. if (iteratee(array[index], index, array) === false) {
  1587. break;
  1588. }
  1589. }
  1590. return array;
  1591. }
  1592. function baseFindIndex(array, predicate, fromIndex, fromRight) {
  1593. var length = array.length, index = fromIndex + (fromRight ? 1 : -1);
  1594. while (fromRight ? index-- : ++index < length) {
  1595. if (predicate(array[index], index, array)) {
  1596. return index;
  1597. }
  1598. }
  1599. return -1;
  1600. }
  1601. function baseIsNaN(value) {
  1602. return value !== value;
  1603. }
  1604. function strictIndexOf(array, value, fromIndex) {
  1605. var index = fromIndex - 1, length = array.length;
  1606. while (++index < length) {
  1607. if (array[index] === value) {
  1608. return index;
  1609. }
  1610. }
  1611. return -1;
  1612. }
  1613. function baseIndexOf(array, value, fromIndex) {
  1614. return value === value ? strictIndexOf(array, value, fromIndex) : baseFindIndex(array, baseIsNaN, fromIndex);
  1615. }
  1616. function arrayIncludes(array, value) {
  1617. var length = array == null ? 0 : array.length;
  1618. return !!length && baseIndexOf(array, value, 0) > -1;
  1619. }
  1620. var WRAP_BIND_FLAG$7 = 1;
  1621. var WRAP_BIND_KEY_FLAG$6 = 2;
  1622. var WRAP_CURRY_FLAG$6 = 8;
  1623. var WRAP_CURRY_RIGHT_FLAG$3 = 16;
  1624. var WRAP_PARTIAL_FLAG$6 = 32;
  1625. var WRAP_PARTIAL_RIGHT_FLAG$3 = 64;
  1626. var WRAP_ARY_FLAG$4 = 128;
  1627. var WRAP_REARG_FLAG$3 = 256;
  1628. var WRAP_FLIP_FLAG$2 = 512;
  1629. var wrapFlags = [
  1630. ["ary", WRAP_ARY_FLAG$4],
  1631. ["bind", WRAP_BIND_FLAG$7],
  1632. ["bindKey", WRAP_BIND_KEY_FLAG$6],
  1633. ["curry", WRAP_CURRY_FLAG$6],
  1634. ["curryRight", WRAP_CURRY_RIGHT_FLAG$3],
  1635. ["flip", WRAP_FLIP_FLAG$2],
  1636. ["partial", WRAP_PARTIAL_FLAG$6],
  1637. ["partialRight", WRAP_PARTIAL_RIGHT_FLAG$3],
  1638. ["rearg", WRAP_REARG_FLAG$3]
  1639. ];
  1640. function updateWrapDetails(details, bitmask) {
  1641. arrayEach(wrapFlags, function(pair) {
  1642. var value = "_." + pair[0];
  1643. if (bitmask & pair[1] && !arrayIncludes(details, value)) {
  1644. details.push(value);
  1645. }
  1646. });
  1647. return details.sort();
  1648. }
  1649. function setWrapToString(wrapper, reference, bitmask) {
  1650. var source = reference + "";
  1651. return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
  1652. }
  1653. var WRAP_BIND_FLAG$6 = 1;
  1654. var WRAP_BIND_KEY_FLAG$5 = 2;
  1655. var WRAP_CURRY_BOUND_FLAG$1 = 4;
  1656. var WRAP_CURRY_FLAG$5 = 8;
  1657. var WRAP_PARTIAL_FLAG$5 = 32;
  1658. var WRAP_PARTIAL_RIGHT_FLAG$2 = 64;
  1659. function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
  1660. 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;
  1661. bitmask |= isCurry ? WRAP_PARTIAL_FLAG$5 : WRAP_PARTIAL_RIGHT_FLAG$2;
  1662. bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG$2 : WRAP_PARTIAL_FLAG$5);
  1663. if (!(bitmask & WRAP_CURRY_BOUND_FLAG$1)) {
  1664. bitmask &= ~(WRAP_BIND_FLAG$6 | WRAP_BIND_KEY_FLAG$5);
  1665. }
  1666. var newData = [
  1667. func,
  1668. bitmask,
  1669. thisArg,
  1670. newPartials,
  1671. newHolders,
  1672. newPartialsRight,
  1673. newHoldersRight,
  1674. argPos,
  1675. ary,
  1676. arity
  1677. ];
  1678. var result = wrapFunc.apply(void 0, newData);
  1679. if (isLaziable(func)) {
  1680. setData(result, newData);
  1681. }
  1682. result.placeholder = placeholder;
  1683. return setWrapToString(result, func, bitmask);
  1684. }
  1685. function getHolder(func) {
  1686. var object = func;
  1687. return object.placeholder;
  1688. }
  1689. var MAX_SAFE_INTEGER$5 = 9007199254740991;
  1690. var reIsUint = /^(?:0|[1-9]\d*)$/;
  1691. function isIndex(value, length) {
  1692. var type = typeof value;
  1693. length = length == null ? MAX_SAFE_INTEGER$5 : length;
  1694. return !!length && (type == "number" || type != "symbol" && reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length);
  1695. }
  1696. var nativeMin$e = Math.min;
  1697. function reorder(array, indexes) {
  1698. var arrLength = array.length, length = nativeMin$e(indexes.length, arrLength), oldArray = copyArray(array);
  1699. while (length--) {
  1700. var index = indexes[length];
  1701. array[length] = isIndex(index, arrLength) ? oldArray[index] : void 0;
  1702. }
  1703. return array;
  1704. }
  1705. var PLACEHOLDER$1 = "__lodash_placeholder__";
  1706. function replaceHolders(array, placeholder) {
  1707. var index = -1, length = array.length, resIndex = 0, result = [];
  1708. while (++index < length) {
  1709. var value = array[index];
  1710. if (value === placeholder || value === PLACEHOLDER$1) {
  1711. array[index] = PLACEHOLDER$1;
  1712. result[resIndex++] = index;
  1713. }
  1714. }
  1715. return result;
  1716. }
  1717. var WRAP_BIND_FLAG$5 = 1;
  1718. var WRAP_BIND_KEY_FLAG$4 = 2;
  1719. var WRAP_CURRY_FLAG$4 = 8;
  1720. var WRAP_CURRY_RIGHT_FLAG$2 = 16;
  1721. var WRAP_ARY_FLAG$3 = 128;
  1722. var WRAP_FLIP_FLAG$1 = 512;
  1723. function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
  1724. 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);
  1725. function wrapper() {
  1726. var length = arguments.length, args = Array(length), index = length;
  1727. while (index--) {
  1728. args[index] = arguments[index];
  1729. }
  1730. if (isCurried) {
  1731. var placeholder = getHolder(wrapper), holdersCount = countHolders(args, placeholder);
  1732. }
  1733. if (partials) {
  1734. args = composeArgs(args, partials, holders, isCurried);
  1735. }
  1736. if (partialsRight) {
  1737. args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
  1738. }
  1739. length -= holdersCount;
  1740. if (isCurried && length < arity) {
  1741. var newHolders = replaceHolders(args, placeholder);
  1742. return createRecurry(func, bitmask, createHybrid, wrapper.placeholder, thisArg, args, newHolders, argPos, ary, arity - length);
  1743. }
  1744. var thisBinding = isBind ? thisArg : this, fn = isBindKey ? thisBinding[func] : func;
  1745. length = args.length;
  1746. if (argPos) {
  1747. args = reorder(args, argPos);
  1748. } else if (isFlip && length > 1) {
  1749. args.reverse();
  1750. }
  1751. if (isAry && ary < length) {
  1752. args.length = ary;
  1753. }
  1754. if (this && this !== root && this instanceof wrapper) {
  1755. fn = Ctor || createCtor(fn);
  1756. }
  1757. return fn.apply(thisBinding, args);
  1758. }
  1759. return wrapper;
  1760. }
  1761. function createCurry(func, bitmask, arity) {
  1762. var Ctor = createCtor(func);
  1763. function wrapper() {
  1764. var length = arguments.length, args = Array(length), index = length, placeholder = getHolder(wrapper);
  1765. while (index--) {
  1766. args[index] = arguments[index];
  1767. }
  1768. var holders = length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder ? [] : replaceHolders(args, placeholder);
  1769. length -= holders.length;
  1770. if (length < arity) {
  1771. return createRecurry(func, bitmask, createHybrid, wrapper.placeholder, void 0, args, holders, void 0, void 0, arity - length);
  1772. }
  1773. var fn = this && this !== root && this instanceof wrapper ? Ctor : func;
  1774. return apply(fn, this, args);
  1775. }
  1776. return wrapper;
  1777. }
  1778. var WRAP_BIND_FLAG$4 = 1;
  1779. function createPartial(func, bitmask, thisArg, partials) {
  1780. var isBind = bitmask & WRAP_BIND_FLAG$4, Ctor = createCtor(func);
  1781. function wrapper() {
  1782. var argsIndex = -1, argsLength = arguments.length, leftIndex = -1, leftLength = partials.length, args = Array(leftLength + argsLength), fn = this && this !== root && this instanceof wrapper ? Ctor : func;
  1783. while (++leftIndex < leftLength) {
  1784. args[leftIndex] = partials[leftIndex];
  1785. }
  1786. while (argsLength--) {
  1787. args[leftIndex++] = arguments[++argsIndex];
  1788. }
  1789. return apply(fn, isBind ? thisArg : this, args);
  1790. }
  1791. return wrapper;
  1792. }
  1793. var PLACEHOLDER = "__lodash_placeholder__";
  1794. var WRAP_BIND_FLAG$3 = 1;
  1795. var WRAP_BIND_KEY_FLAG$3 = 2;
  1796. var WRAP_CURRY_BOUND_FLAG = 4;
  1797. var WRAP_CURRY_FLAG$3 = 8;
  1798. var WRAP_ARY_FLAG$2 = 128;
  1799. var WRAP_REARG_FLAG$2 = 256;
  1800. var nativeMin$d = Math.min;
  1801. function mergeData(data, source) {
  1802. 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);
  1803. 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;
  1804. if (!(isCommon || isCombo)) {
  1805. return data;
  1806. }
  1807. if (srcBitmask & WRAP_BIND_FLAG$3) {
  1808. data[2] = source[2];
  1809. newBitmask |= bitmask & WRAP_BIND_FLAG$3 ? 0 : WRAP_CURRY_BOUND_FLAG;
  1810. }
  1811. var value = source[3];
  1812. if (value) {
  1813. var partials = data[3];
  1814. data[3] = partials ? composeArgs(partials, value, source[4]) : value;
  1815. data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
  1816. }
  1817. value = source[5];
  1818. if (value) {
  1819. partials = data[5];
  1820. data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
  1821. data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
  1822. }
  1823. value = source[7];
  1824. if (value) {
  1825. data[7] = value;
  1826. }
  1827. if (srcBitmask & WRAP_ARY_FLAG$2) {
  1828. data[8] = data[8] == null ? source[8] : nativeMin$d(data[8], source[8]);
  1829. }
  1830. if (data[9] == null) {
  1831. data[9] = source[9];
  1832. }
  1833. data[0] = source[0];
  1834. data[1] = newBitmask;
  1835. return data;
  1836. }
  1837. var FUNC_ERROR_TEXT$a = "Expected a function";
  1838. var WRAP_BIND_FLAG$2 = 1;
  1839. var WRAP_BIND_KEY_FLAG$2 = 2;
  1840. var WRAP_CURRY_FLAG$2 = 8;
  1841. var WRAP_CURRY_RIGHT_FLAG$1 = 16;
  1842. var WRAP_PARTIAL_FLAG$4 = 32;
  1843. var WRAP_PARTIAL_RIGHT_FLAG$1 = 64;
  1844. var nativeMax$e = Math.max;
  1845. function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
  1846. var isBindKey = bitmask & WRAP_BIND_KEY_FLAG$2;
  1847. if (!isBindKey && typeof func != "function") {
  1848. throw new TypeError(FUNC_ERROR_TEXT$a);
  1849. }
  1850. var length = partials ? partials.length : 0;
  1851. if (!length) {
  1852. bitmask &= ~(WRAP_PARTIAL_FLAG$4 | WRAP_PARTIAL_RIGHT_FLAG$1);
  1853. partials = holders = void 0;
  1854. }
  1855. ary = ary === void 0 ? ary : nativeMax$e(toInteger(ary), 0);
  1856. arity = arity === void 0 ? arity : toInteger(arity);
  1857. length -= holders ? holders.length : 0;
  1858. if (bitmask & WRAP_PARTIAL_RIGHT_FLAG$1) {
  1859. var partialsRight = partials, holdersRight = holders;
  1860. partials = holders = void 0;
  1861. }
  1862. var data = isBindKey ? void 0 : getData(func);
  1863. var newData = [
  1864. func,
  1865. bitmask,
  1866. thisArg,
  1867. partials,
  1868. holders,
  1869. partialsRight,
  1870. holdersRight,
  1871. argPos,
  1872. ary,
  1873. arity
  1874. ];
  1875. if (data) {
  1876. mergeData(newData, data);
  1877. }
  1878. func = newData[0];
  1879. bitmask = newData[1];
  1880. thisArg = newData[2];
  1881. partials = newData[3];
  1882. holders = newData[4];
  1883. arity = newData[9] = newData[9] === void 0 ? isBindKey ? 0 : func.length : nativeMax$e(newData[9] - length, 0);
  1884. if (!arity && bitmask & (WRAP_CURRY_FLAG$2 | WRAP_CURRY_RIGHT_FLAG$1)) {
  1885. bitmask &= ~(WRAP_CURRY_FLAG$2 | WRAP_CURRY_RIGHT_FLAG$1);
  1886. }
  1887. if (!bitmask || bitmask == WRAP_BIND_FLAG$2) {
  1888. var result = createBind(func, bitmask, thisArg);
  1889. } else if (bitmask == WRAP_CURRY_FLAG$2 || bitmask == WRAP_CURRY_RIGHT_FLAG$1) {
  1890. result = createCurry(func, bitmask, arity);
  1891. } else if ((bitmask == WRAP_PARTIAL_FLAG$4 || bitmask == (WRAP_BIND_FLAG$2 | WRAP_PARTIAL_FLAG$4)) && !holders.length) {
  1892. result = createPartial(func, bitmask, thisArg, partials);
  1893. } else {
  1894. result = createHybrid.apply(void 0, newData);
  1895. }
  1896. var setter = data ? baseSetData : setData;
  1897. return setWrapToString(setter(result, newData), func, bitmask);
  1898. }
  1899. var WRAP_ARY_FLAG$1 = 128;
  1900. function ary(func, n, guard) {
  1901. n = guard ? void 0 : n;
  1902. n = func && n == null ? func.length : n;
  1903. return createWrap(func, WRAP_ARY_FLAG$1, void 0, void 0, void 0, void 0, n);
  1904. }
  1905. function baseAssignValue(object, key, value) {
  1906. if (key == "__proto__" && defineProperty) {
  1907. defineProperty(object, key, {
  1908. "configurable": true,
  1909. "enumerable": true,
  1910. "value": value,
  1911. "writable": true
  1912. });
  1913. } else {
  1914. object[key] = value;
  1915. }
  1916. }
  1917. function eq(value, other) {
  1918. return value === other || value !== value && other !== other;
  1919. }
  1920. var objectProto$n = Object.prototype;
  1921. var hasOwnProperty$k = objectProto$n.hasOwnProperty;
  1922. function assignValue(object, key, value) {
  1923. var objValue = object[key];
  1924. if (!(hasOwnProperty$k.call(object, key) && eq(objValue, value)) || value === void 0 && !(key in object)) {
  1925. baseAssignValue(object, key, value);
  1926. }
  1927. }
  1928. function copyObject(source, props, object, customizer) {
  1929. var isNew = !object;
  1930. object || (object = {});
  1931. var index = -1, length = props.length;
  1932. while (++index < length) {
  1933. var key = props[index];
  1934. var newValue = customizer ? customizer(object[key], source[key], key, object, source) : void 0;
  1935. if (newValue === void 0) {
  1936. newValue = source[key];
  1937. }
  1938. if (isNew) {
  1939. baseAssignValue(object, key, newValue);
  1940. } else {
  1941. assignValue(object, key, newValue);
  1942. }
  1943. }
  1944. return object;
  1945. }
  1946. var nativeMax$d = Math.max;
  1947. function overRest(func, start, transform) {
  1948. start = nativeMax$d(start === void 0 ? func.length - 1 : start, 0);
  1949. return function() {
  1950. var args = arguments, index = -1, length = nativeMax$d(args.length - start, 0), array = Array(length);
  1951. while (++index < length) {
  1952. array[index] = args[start + index];
  1953. }
  1954. index = -1;
  1955. var otherArgs = Array(start + 1);
  1956. while (++index < start) {
  1957. otherArgs[index] = args[index];
  1958. }
  1959. otherArgs[start] = transform(array);
  1960. return apply(func, this, otherArgs);
  1961. };
  1962. }
  1963. function baseRest(func, start) {
  1964. return setToString(overRest(func, start, identity), func + "");
  1965. }
  1966. var MAX_SAFE_INTEGER$4 = 9007199254740991;
  1967. function isLength(value) {
  1968. return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER$4;
  1969. }
  1970. function isArrayLike(value) {
  1971. return value != null && isLength(value.length) && !isFunction(value);
  1972. }
  1973. function isIterateeCall(value, index, object) {
  1974. if (!isObject(object)) {
  1975. return false;
  1976. }
  1977. var type = typeof index;
  1978. if (type == "number" ? isArrayLike(object) && isIndex(index, object.length) : type == "string" && index in object) {
  1979. return eq(object[index], value);
  1980. }
  1981. return false;
  1982. }
  1983. function createAssigner(assigner) {
  1984. return baseRest(function(object, sources) {
  1985. var index = -1, length = sources.length, customizer = length > 1 ? sources[length - 1] : void 0, guard = length > 2 ? sources[2] : void 0;
  1986. customizer = assigner.length > 3 && typeof customizer == "function" ? (length--, customizer) : void 0;
  1987. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  1988. customizer = length < 3 ? void 0 : customizer;
  1989. length = 1;
  1990. }
  1991. object = Object(object);
  1992. while (++index < length) {
  1993. var source = sources[index];
  1994. if (source) {
  1995. assigner(object, source, index, customizer);
  1996. }
  1997. }
  1998. return object;
  1999. });
  2000. }
  2001. var objectProto$m = Object.prototype;
  2002. function isPrototype(value) {
  2003. var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto$m;
  2004. return value === proto;
  2005. }
  2006. function baseTimes(n, iteratee) {
  2007. var index = -1, result = Array(n);
  2008. while (++index < n) {
  2009. result[index] = iteratee(index);
  2010. }
  2011. return result;
  2012. }
  2013. var argsTag$3 = "[object Arguments]";
  2014. function baseIsArguments(value) {
  2015. return isObjectLike(value) && baseGetTag(value) == argsTag$3;
  2016. }
  2017. var objectProto$l = Object.prototype;
  2018. var hasOwnProperty$j = objectProto$l.hasOwnProperty;
  2019. var propertyIsEnumerable$1 = objectProto$l.propertyIsEnumerable;
  2020. var isArguments = baseIsArguments(function() {
  2021. return arguments;
  2022. }()) ? baseIsArguments : function(value) {
  2023. return isObjectLike(value) && hasOwnProperty$j.call(value, "callee") && !propertyIsEnumerable$1.call(value, "callee");
  2024. };
  2025. function stubFalse() {
  2026. return false;
  2027. }
  2028. var freeExports$2 = typeof exports == "object" && exports && !exports.nodeType && exports;
  2029. var freeModule$2 = freeExports$2 && typeof module == "object" && module && !module.nodeType && module;
  2030. var moduleExports$2 = freeModule$2 && freeModule$2.exports === freeExports$2;
  2031. var Buffer$1 = moduleExports$2 ? root.Buffer : void 0;
  2032. var nativeIsBuffer = Buffer$1 ? Buffer$1.isBuffer : void 0;
  2033. var isBuffer = nativeIsBuffer || stubFalse;
  2034. var argsTag$2 = "[object Arguments]";
  2035. var arrayTag$2 = "[object Array]";
  2036. var boolTag$4 = "[object Boolean]";
  2037. var dateTag$4 = "[object Date]";
  2038. var errorTag$3 = "[object Error]";
  2039. var funcTag$1 = "[object Function]";
  2040. var mapTag$9 = "[object Map]";
  2041. var numberTag$4 = "[object Number]";
  2042. var objectTag$4 = "[object Object]";
  2043. var regexpTag$4 = "[object RegExp]";
  2044. var setTag$9 = "[object Set]";
  2045. var stringTag$4 = "[object String]";
  2046. var weakMapTag$3 = "[object WeakMap]";
  2047. var arrayBufferTag$4 = "[object ArrayBuffer]";
  2048. var dataViewTag$4 = "[object DataView]";
  2049. var float32Tag$2 = "[object Float32Array]";
  2050. var float64Tag$2 = "[object Float64Array]";
  2051. var int8Tag$2 = "[object Int8Array]";
  2052. var int16Tag$2 = "[object Int16Array]";
  2053. var int32Tag$2 = "[object Int32Array]";
  2054. var uint8Tag$2 = "[object Uint8Array]";
  2055. var uint8ClampedTag$2 = "[object Uint8ClampedArray]";
  2056. var uint16Tag$2 = "[object Uint16Array]";
  2057. var uint32Tag$2 = "[object Uint32Array]";
  2058. var typedArrayTags = {};
  2059. 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;
  2060. 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;
  2061. function baseIsTypedArray(value) {
  2062. return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
  2063. }
  2064. function baseUnary(func) {
  2065. return function(value) {
  2066. return func(value);
  2067. };
  2068. }
  2069. var freeExports$1 = typeof exports == "object" && exports && !exports.nodeType && exports;
  2070. var freeModule$1 = freeExports$1 && typeof module == "object" && module && !module.nodeType && module;
  2071. var moduleExports$1 = freeModule$1 && freeModule$1.exports === freeExports$1;
  2072. var freeProcess = moduleExports$1 && freeGlobal.process;
  2073. var nodeUtil = function() {
  2074. try {
  2075. var types = freeModule$1 && freeModule$1.require && freeModule$1.require("util").types;
  2076. if (types) {
  2077. return types;
  2078. }
  2079. return freeProcess && freeProcess.binding && freeProcess.binding("util");
  2080. } catch (e) {
  2081. }
  2082. }();
  2083. var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
  2084. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  2085. var objectProto$k = Object.prototype;
  2086. var hasOwnProperty$i = objectProto$k.hasOwnProperty;
  2087. function arrayLikeKeys(value, inherited) {
  2088. 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;
  2089. for (var key in value) {
  2090. 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)))) {
  2091. result.push(key);
  2092. }
  2093. }
  2094. return result;
  2095. }
  2096. function overArg(func, transform) {
  2097. return function(arg) {
  2098. return func(transform(arg));
  2099. };
  2100. }
  2101. var nativeKeys = overArg(Object.keys, Object);
  2102. var objectProto$j = Object.prototype;
  2103. var hasOwnProperty$h = objectProto$j.hasOwnProperty;
  2104. function baseKeys(object) {
  2105. if (!isPrototype(object)) {
  2106. return nativeKeys(object);
  2107. }
  2108. var result = [];
  2109. for (var key in Object(object)) {
  2110. if (hasOwnProperty$h.call(object, key) && key != "constructor") {
  2111. result.push(key);
  2112. }
  2113. }
  2114. return result;
  2115. }
  2116. function keys(object) {
  2117. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  2118. }
  2119. var objectProto$i = Object.prototype;
  2120. var hasOwnProperty$g = objectProto$i.hasOwnProperty;
  2121. var assign = createAssigner(function(object, source) {
  2122. if (isPrototype(source) || isArrayLike(source)) {
  2123. copyObject(source, keys(source), object);
  2124. return;
  2125. }
  2126. for (var key in source) {
  2127. if (hasOwnProperty$g.call(source, key)) {
  2128. assignValue(object, key, source[key]);
  2129. }
  2130. }
  2131. });
  2132. function nativeKeysIn(object) {
  2133. var result = [];
  2134. if (object != null) {
  2135. for (var key in Object(object)) {
  2136. result.push(key);
  2137. }
  2138. }
  2139. return result;
  2140. }
  2141. var objectProto$h = Object.prototype;
  2142. var hasOwnProperty$f = objectProto$h.hasOwnProperty;
  2143. function baseKeysIn(object) {
  2144. if (!isObject(object)) {
  2145. return nativeKeysIn(object);
  2146. }
  2147. var isProto = isPrototype(object), result = [];
  2148. for (var key in object) {
  2149. if (!(key == "constructor" && (isProto || !hasOwnProperty$f.call(object, key)))) {
  2150. result.push(key);
  2151. }
  2152. }
  2153. return result;
  2154. }
  2155. function keysIn(object) {
  2156. return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
  2157. }
  2158. var assignIn = createAssigner(function(object, source) {
  2159. copyObject(source, keysIn(source), object);
  2160. });
  2161. var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
  2162. copyObject(source, keysIn(source), object, customizer);
  2163. });
  2164. var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
  2165. copyObject(source, keys(source), object, customizer);
  2166. });
  2167. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/;
  2168. var reIsPlainProp = /^\w*$/;
  2169. function isKey(value, object) {
  2170. if (isArray(value)) {
  2171. return false;
  2172. }
  2173. var type = typeof value;
  2174. if (type == "number" || type == "symbol" || type == "boolean" || value == null || isSymbol(value)) {
  2175. return true;
  2176. }
  2177. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object(object);
  2178. }
  2179. var nativeCreate = getNative(Object, "create");
  2180. function hashClear() {
  2181. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  2182. this.size = 0;
  2183. }
  2184. function hashDelete(key) {
  2185. var result = this.has(key) && delete this.__data__[key];
  2186. this.size -= result ? 1 : 0;
  2187. return result;
  2188. }
  2189. var HASH_UNDEFINED$2 = "__lodash_hash_undefined__";
  2190. var objectProto$g = Object.prototype;
  2191. var hasOwnProperty$e = objectProto$g.hasOwnProperty;
  2192. function hashGet(key) {
  2193. var data = this.__data__;
  2194. if (nativeCreate) {
  2195. var result = data[key];
  2196. return result === HASH_UNDEFINED$2 ? void 0 : result;
  2197. }
  2198. return hasOwnProperty$e.call(data, key) ? data[key] : void 0;
  2199. }
  2200. var objectProto$f = Object.prototype;
  2201. var hasOwnProperty$d = objectProto$f.hasOwnProperty;
  2202. function hashHas(key) {
  2203. var data = this.__data__;
  2204. return nativeCreate ? data[key] !== void 0 : hasOwnProperty$d.call(data, key);
  2205. }
  2206. var HASH_UNDEFINED$1 = "__lodash_hash_undefined__";
  2207. function hashSet(key, value) {
  2208. var data = this.__data__;
  2209. this.size += this.has(key) ? 0 : 1;
  2210. data[key] = nativeCreate && value === void 0 ? HASH_UNDEFINED$1 : value;
  2211. return this;
  2212. }
  2213. function Hash(entries) {
  2214. var index = -1, length = entries == null ? 0 : entries.length;
  2215. this.clear();
  2216. while (++index < length) {
  2217. var entry = entries[index];
  2218. this.set(entry[0], entry[1]);
  2219. }
  2220. }
  2221. Hash.prototype.clear = hashClear;
  2222. Hash.prototype["delete"] = hashDelete;
  2223. Hash.prototype.get = hashGet;
  2224. Hash.prototype.has = hashHas;
  2225. Hash.prototype.set = hashSet;
  2226. function listCacheClear() {
  2227. this.__data__ = [];
  2228. this.size = 0;
  2229. }
  2230. function assocIndexOf(array, key) {
  2231. var length = array.length;
  2232. while (length--) {
  2233. if (eq(array[length][0], key)) {
  2234. return length;
  2235. }
  2236. }
  2237. return -1;
  2238. }
  2239. var arrayProto$5 = Array.prototype;
  2240. var splice$2 = arrayProto$5.splice;
  2241. function listCacheDelete(key) {
  2242. var data = this.__data__, index = assocIndexOf(data, key);
  2243. if (index < 0) {
  2244. return false;
  2245. }
  2246. var lastIndex = data.length - 1;
  2247. if (index == lastIndex) {
  2248. data.pop();
  2249. } else {
  2250. splice$2.call(data, index, 1);
  2251. }
  2252. --this.size;
  2253. return true;
  2254. }
  2255. function listCacheGet(key) {
  2256. var data = this.__data__, index = assocIndexOf(data, key);
  2257. return index < 0 ? void 0 : data[index][1];
  2258. }
  2259. function listCacheHas(key) {
  2260. return assocIndexOf(this.__data__, key) > -1;
  2261. }
  2262. function listCacheSet(key, value) {
  2263. var data = this.__data__, index = assocIndexOf(data, key);
  2264. if (index < 0) {
  2265. ++this.size;
  2266. data.push([key, value]);
  2267. } else {
  2268. data[index][1] = value;
  2269. }
  2270. return this;
  2271. }
  2272. function ListCache(entries) {
  2273. var index = -1, length = entries == null ? 0 : entries.length;
  2274. this.clear();
  2275. while (++index < length) {
  2276. var entry = entries[index];
  2277. this.set(entry[0], entry[1]);
  2278. }
  2279. }
  2280. ListCache.prototype.clear = listCacheClear;
  2281. ListCache.prototype["delete"] = listCacheDelete;
  2282. ListCache.prototype.get = listCacheGet;
  2283. ListCache.prototype.has = listCacheHas;
  2284. ListCache.prototype.set = listCacheSet;
  2285. var Map$1 = getNative(root, "Map");
  2286. function mapCacheClear() {
  2287. this.size = 0;
  2288. this.__data__ = {
  2289. "hash": new Hash(),
  2290. "map": new (Map$1 || ListCache)(),
  2291. "string": new Hash()
  2292. };
  2293. }
  2294. function isKeyable(value) {
  2295. var type = typeof value;
  2296. return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null;
  2297. }
  2298. function getMapData(map, key) {
  2299. var data = map.__data__;
  2300. return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
  2301. }
  2302. function mapCacheDelete(key) {
  2303. var result = getMapData(this, key)["delete"](key);
  2304. this.size -= result ? 1 : 0;
  2305. return result;
  2306. }
  2307. function mapCacheGet(key) {
  2308. return getMapData(this, key).get(key);
  2309. }
  2310. function mapCacheHas(key) {
  2311. return getMapData(this, key).has(key);
  2312. }
  2313. function mapCacheSet(key, value) {
  2314. var data = getMapData(this, key), size = data.size;
  2315. data.set(key, value);
  2316. this.size += data.size == size ? 0 : 1;
  2317. return this;
  2318. }
  2319. function MapCache(entries) {
  2320. var index = -1, length = entries == null ? 0 : entries.length;
  2321. this.clear();
  2322. while (++index < length) {
  2323. var entry = entries[index];
  2324. this.set(entry[0], entry[1]);
  2325. }
  2326. }
  2327. MapCache.prototype.clear = mapCacheClear;
  2328. MapCache.prototype["delete"] = mapCacheDelete;
  2329. MapCache.prototype.get = mapCacheGet;
  2330. MapCache.prototype.has = mapCacheHas;
  2331. MapCache.prototype.set = mapCacheSet;
  2332. var FUNC_ERROR_TEXT$9 = "Expected a function";
  2333. function memoize(func, resolver) {
  2334. if (typeof func != "function" || resolver != null && typeof resolver != "function") {
  2335. throw new TypeError(FUNC_ERROR_TEXT$9);
  2336. }
  2337. var memoized = function() {
  2338. var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache;
  2339. if (cache.has(key)) {
  2340. return cache.get(key);
  2341. }
  2342. var result = func.apply(this, args);
  2343. memoized.cache = cache.set(key, result) || cache;
  2344. return result;
  2345. };
  2346. memoized.cache = new (memoize.Cache || MapCache)();
  2347. return memoized;
  2348. }
  2349. memoize.Cache = MapCache;
  2350. var MAX_MEMOIZE_SIZE = 500;
  2351. function memoizeCapped(func) {
  2352. var result = memoize(func, function(key) {
  2353. if (cache.size === MAX_MEMOIZE_SIZE) {
  2354. cache.clear();
  2355. }
  2356. return key;
  2357. });
  2358. var cache = result.cache;
  2359. return result;
  2360. }
  2361. var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  2362. var reEscapeChar = /\\(\\)?/g;
  2363. var stringToPath = memoizeCapped(function(string) {
  2364. var result = [];
  2365. if (string.charCodeAt(0) === 46) {
  2366. result.push("");
  2367. }
  2368. string.replace(rePropName, function(match, number, quote, subString) {
  2369. result.push(quote ? subString.replace(reEscapeChar, "$1") : number || match);
  2370. });
  2371. return result;
  2372. });
  2373. function toString(value) {
  2374. return value == null ? "" : baseToString(value);
  2375. }
  2376. function castPath(value, object) {
  2377. if (isArray(value)) {
  2378. return value;
  2379. }
  2380. return isKey(value, object) ? [value] : stringToPath(toString(value));
  2381. }
  2382. var INFINITY$3 = 1 / 0;
  2383. function toKey(value) {
  2384. if (typeof value == "string" || isSymbol(value)) {
  2385. return value;
  2386. }
  2387. var result = value + "";
  2388. return result == "0" && 1 / value == -INFINITY$3 ? "-0" : result;
  2389. }
  2390. function baseGet(object, path) {
  2391. path = castPath(path, object);
  2392. var index = 0, length = path.length;
  2393. while (object != null && index < length) {
  2394. object = object[toKey(path[index++])];
  2395. }
  2396. return index && index == length ? object : void 0;
  2397. }
  2398. function get(object, path, defaultValue) {
  2399. var result = object == null ? void 0 : baseGet(object, path);
  2400. return result === void 0 ? defaultValue : result;
  2401. }
  2402. function baseAt(object, paths) {
  2403. var index = -1, length = paths.length, result = Array(length), skip = object == null;
  2404. while (++index < length) {
  2405. result[index] = skip ? void 0 : get(object, paths[index]);
  2406. }
  2407. return result;
  2408. }
  2409. function arrayPush(array, values) {
  2410. var index = -1, length = values.length, offset = array.length;
  2411. while (++index < length) {
  2412. array[offset + index] = values[index];
  2413. }
  2414. return array;
  2415. }
  2416. var spreadableSymbol = Symbol$1 ? Symbol$1.isConcatSpreadable : void 0;
  2417. function isFlattenable(value) {
  2418. return isArray(value) || isArguments(value) || !!(spreadableSymbol && value && value[spreadableSymbol]);
  2419. }
  2420. function baseFlatten(array, depth, predicate, isStrict, result) {
  2421. var index = -1, length = array.length;
  2422. predicate || (predicate = isFlattenable);
  2423. result || (result = []);
  2424. while (++index < length) {
  2425. var value = array[index];
  2426. if (depth > 0 && predicate(value)) {
  2427. if (depth > 1) {
  2428. baseFlatten(value, depth - 1, predicate, isStrict, result);
  2429. } else {
  2430. arrayPush(result, value);
  2431. }
  2432. } else if (!isStrict) {
  2433. result[result.length] = value;
  2434. }
  2435. }
  2436. return result;
  2437. }
  2438. function flatten(array) {
  2439. var length = array == null ? 0 : array.length;
  2440. return length ? baseFlatten(array, 1) : [];
  2441. }
  2442. function flatRest(func) {
  2443. return setToString(overRest(func, void 0, flatten), func + "");
  2444. }
  2445. var at$1 = flatRest(baseAt);
  2446. var getPrototype = overArg(Object.getPrototypeOf, Object);
  2447. var objectTag$3 = "[object Object]";
  2448. var funcProto = Function.prototype;
  2449. var objectProto$e = Object.prototype;
  2450. var funcToString = funcProto.toString;
  2451. var hasOwnProperty$c = objectProto$e.hasOwnProperty;
  2452. var objectCtorString = funcToString.call(Object);
  2453. function isPlainObject(value) {
  2454. if (!isObjectLike(value) || baseGetTag(value) != objectTag$3) {
  2455. return false;
  2456. }
  2457. var proto = getPrototype(value);
  2458. if (proto === null) {
  2459. return true;
  2460. }
  2461. var Ctor = hasOwnProperty$c.call(proto, "constructor") && proto.constructor;
  2462. return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString;
  2463. }
  2464. var domExcTag = "[object DOMException]";
  2465. var errorTag$2 = "[object Error]";
  2466. function isError(value) {
  2467. if (!isObjectLike(value)) {
  2468. return false;
  2469. }
  2470. var tag = baseGetTag(value);
  2471. return tag == errorTag$2 || tag == domExcTag || typeof value.message == "string" && typeof value.name == "string" && !isPlainObject(value);
  2472. }
  2473. var attempt = baseRest(function(func, args) {
  2474. try {
  2475. return apply(func, void 0, args);
  2476. } catch (e) {
  2477. return isError(e) ? e : new Error(e);
  2478. }
  2479. });
  2480. var FUNC_ERROR_TEXT$8 = "Expected a function";
  2481. function before(n, func) {
  2482. var result;
  2483. if (typeof func != "function") {
  2484. throw new TypeError(FUNC_ERROR_TEXT$8);
  2485. }
  2486. n = toInteger(n);
  2487. return function() {
  2488. if (--n > 0) {
  2489. result = func.apply(this, arguments);
  2490. }
  2491. if (n <= 1) {
  2492. func = void 0;
  2493. }
  2494. return result;
  2495. };
  2496. }
  2497. var WRAP_BIND_FLAG$1 = 1;
  2498. var WRAP_PARTIAL_FLAG$3 = 32;
  2499. var bind = baseRest(function(func, thisArg, partials) {
  2500. var bitmask = WRAP_BIND_FLAG$1;
  2501. if (partials.length) {
  2502. var holders = replaceHolders(partials, getHolder(bind));
  2503. bitmask |= WRAP_PARTIAL_FLAG$3;
  2504. }
  2505. return createWrap(func, bitmask, thisArg, partials, holders);
  2506. });
  2507. bind.placeholder = {};
  2508. var bindAll = flatRest(function(object, methodNames) {
  2509. arrayEach(methodNames, function(key) {
  2510. key = toKey(key);
  2511. baseAssignValue(object, key, bind(object[key], object));
  2512. });
  2513. return object;
  2514. });
  2515. var WRAP_BIND_FLAG = 1;
  2516. var WRAP_BIND_KEY_FLAG$1 = 2;
  2517. var WRAP_PARTIAL_FLAG$2 = 32;
  2518. var bindKey = baseRest(function(object, key, partials) {
  2519. var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG$1;
  2520. if (partials.length) {
  2521. var holders = replaceHolders(partials, getHolder(bindKey));
  2522. bitmask |= WRAP_PARTIAL_FLAG$2;
  2523. }
  2524. return createWrap(key, bitmask, object, partials, holders);
  2525. });
  2526. bindKey.placeholder = {};
  2527. function baseSlice(array, start, end) {
  2528. var index = -1, length = array.length;
  2529. if (start < 0) {
  2530. start = -start > length ? 0 : length + start;
  2531. }
  2532. end = end > length ? length : end;
  2533. if (end < 0) {
  2534. end += length;
  2535. }
  2536. length = start > end ? 0 : end - start >>> 0;
  2537. start >>>= 0;
  2538. var result = Array(length);
  2539. while (++index < length) {
  2540. result[index] = array[index + start];
  2541. }
  2542. return result;
  2543. }
  2544. function castSlice(array, start, end) {
  2545. var length = array.length;
  2546. end = end === void 0 ? length : end;
  2547. return !start && end >= length ? array : baseSlice(array, start, end);
  2548. }
  2549. var rsAstralRange$3 = "\\ud800-\\udfff";
  2550. var rsComboMarksRange$4 = "\\u0300-\\u036f";
  2551. var reComboHalfMarksRange$4 = "\\ufe20-\\ufe2f";
  2552. var rsComboSymbolsRange$4 = "\\u20d0-\\u20ff";
  2553. var rsComboRange$4 = rsComboMarksRange$4 + reComboHalfMarksRange$4 + rsComboSymbolsRange$4;
  2554. var rsVarRange$3 = "\\ufe0e\\ufe0f";
  2555. var rsZWJ$3 = "\\u200d";
  2556. var reHasUnicode = RegExp("[" + rsZWJ$3 + rsAstralRange$3 + rsComboRange$4 + rsVarRange$3 + "]");
  2557. function hasUnicode(string) {
  2558. return reHasUnicode.test(string);
  2559. }
  2560. function asciiToArray(string) {
  2561. return string.split("");
  2562. }
  2563. var rsAstralRange$2 = "\\ud800-\\udfff";
  2564. var rsComboMarksRange$3 = "\\u0300-\\u036f";
  2565. var reComboHalfMarksRange$3 = "\\ufe20-\\ufe2f";
  2566. var rsComboSymbolsRange$3 = "\\u20d0-\\u20ff";
  2567. var rsComboRange$3 = rsComboMarksRange$3 + reComboHalfMarksRange$3 + rsComboSymbolsRange$3;
  2568. var rsVarRange$2 = "\\ufe0e\\ufe0f";
  2569. var rsAstral$1 = "[" + rsAstralRange$2 + "]";
  2570. var rsCombo$3 = "[" + rsComboRange$3 + "]";
  2571. var rsFitz$2 = "\\ud83c[\\udffb-\\udfff]";
  2572. var rsModifier$2 = "(?:" + rsCombo$3 + "|" + rsFitz$2 + ")";
  2573. var rsNonAstral$2 = "[^" + rsAstralRange$2 + "]";
  2574. var rsRegional$2 = "(?:\\ud83c[\\udde6-\\uddff]){2}";
  2575. var rsSurrPair$2 = "[\\ud800-\\udbff][\\udc00-\\udfff]";
  2576. var rsZWJ$2 = "\\u200d";
  2577. var reOptMod$2 = rsModifier$2 + "?";
  2578. var rsOptVar$2 = "[" + rsVarRange$2 + "]?";
  2579. var rsOptJoin$2 = "(?:" + rsZWJ$2 + "(?:" + [rsNonAstral$2, rsRegional$2, rsSurrPair$2].join("|") + ")" + rsOptVar$2 + reOptMod$2 + ")*";
  2580. var rsSeq$2 = rsOptVar$2 + reOptMod$2 + rsOptJoin$2;
  2581. var rsSymbol$1 = "(?:" + [rsNonAstral$2 + rsCombo$3 + "?", rsCombo$3, rsRegional$2, rsSurrPair$2, rsAstral$1].join("|") + ")";
  2582. var reUnicode$1 = RegExp(rsFitz$2 + "(?=" + rsFitz$2 + ")|" + rsSymbol$1 + rsSeq$2, "g");
  2583. function unicodeToArray(string) {
  2584. return string.match(reUnicode$1) || [];
  2585. }
  2586. function stringToArray(string) {
  2587. return hasUnicode(string) ? unicodeToArray(string) : asciiToArray(string);
  2588. }
  2589. function createCaseFirst(methodName) {
  2590. return function(string) {
  2591. string = toString(string);
  2592. var strSymbols = hasUnicode(string) ? stringToArray(string) : void 0;
  2593. var chr = strSymbols ? strSymbols[0] : string.charAt(0);
  2594. var trailing = strSymbols ? castSlice(strSymbols, 1).join("") : string.slice(1);
  2595. return chr[methodName]() + trailing;
  2596. };
  2597. }
  2598. var upperFirst = createCaseFirst("toUpperCase");
  2599. function capitalize$1(string) {
  2600. return upperFirst(toString(string).toLowerCase());
  2601. }
  2602. function arrayReduce(array, iteratee, accumulator, initAccum) {
  2603. var index = -1, length = array == null ? 0 : array.length;
  2604. if (initAccum && length) {
  2605. accumulator = array[++index];
  2606. }
  2607. while (++index < length) {
  2608. accumulator = iteratee(accumulator, array[index], index, array);
  2609. }
  2610. return accumulator;
  2611. }
  2612. function basePropertyOf(object) {
  2613. return function(key) {
  2614. return object == null ? void 0 : object[key];
  2615. };
  2616. }
  2617. var deburredLetters = {
  2618. "\xC0": "A",
  2619. "\xC1": "A",
  2620. "\xC2": "A",
  2621. "\xC3": "A",
  2622. "\xC4": "A",
  2623. "\xC5": "A",
  2624. "\xE0": "a",
  2625. "\xE1": "a",
  2626. "\xE2": "a",
  2627. "\xE3": "a",
  2628. "\xE4": "a",
  2629. "\xE5": "a",
  2630. "\xC7": "C",
  2631. "\xE7": "c",
  2632. "\xD0": "D",
  2633. "\xF0": "d",
  2634. "\xC8": "E",
  2635. "\xC9": "E",
  2636. "\xCA": "E",
  2637. "\xCB": "E",
  2638. "\xE8": "e",
  2639. "\xE9": "e",
  2640. "\xEA": "e",
  2641. "\xEB": "e",
  2642. "\xCC": "I",
  2643. "\xCD": "I",
  2644. "\xCE": "I",
  2645. "\xCF": "I",
  2646. "\xEC": "i",
  2647. "\xED": "i",
  2648. "\xEE": "i",
  2649. "\xEF": "i",
  2650. "\xD1": "N",
  2651. "\xF1": "n",
  2652. "\xD2": "O",
  2653. "\xD3": "O",
  2654. "\xD4": "O",
  2655. "\xD5": "O",
  2656. "\xD6": "O",
  2657. "\xD8": "O",
  2658. "\xF2": "o",
  2659. "\xF3": "o",
  2660. "\xF4": "o",
  2661. "\xF5": "o",
  2662. "\xF6": "o",
  2663. "\xF8": "o",
  2664. "\xD9": "U",
  2665. "\xDA": "U",
  2666. "\xDB": "U",
  2667. "\xDC": "U",
  2668. "\xF9": "u",
  2669. "\xFA": "u",
  2670. "\xFB": "u",
  2671. "\xFC": "u",
  2672. "\xDD": "Y",
  2673. "\xFD": "y",
  2674. "\xFF": "y",
  2675. "\xC6": "Ae",
  2676. "\xE6": "ae",
  2677. "\xDE": "Th",
  2678. "\xFE": "th",
  2679. "\xDF": "ss",
  2680. "\u0100": "A",
  2681. "\u0102": "A",
  2682. "\u0104": "A",
  2683. "\u0101": "a",
  2684. "\u0103": "a",
  2685. "\u0105": "a",
  2686. "\u0106": "C",
  2687. "\u0108": "C",
  2688. "\u010A": "C",
  2689. "\u010C": "C",
  2690. "\u0107": "c",
  2691. "\u0109": "c",
  2692. "\u010B": "c",
  2693. "\u010D": "c",
  2694. "\u010E": "D",
  2695. "\u0110": "D",
  2696. "\u010F": "d",
  2697. "\u0111": "d",
  2698. "\u0112": "E",
  2699. "\u0114": "E",
  2700. "\u0116": "E",
  2701. "\u0118": "E",
  2702. "\u011A": "E",
  2703. "\u0113": "e",
  2704. "\u0115": "e",
  2705. "\u0117": "e",
  2706. "\u0119": "e",
  2707. "\u011B": "e",
  2708. "\u011C": "G",
  2709. "\u011E": "G",
  2710. "\u0120": "G",
  2711. "\u0122": "G",
  2712. "\u011D": "g",
  2713. "\u011F": "g",
  2714. "\u0121": "g",
  2715. "\u0123": "g",
  2716. "\u0124": "H",
  2717. "\u0126": "H",
  2718. "\u0125": "h",
  2719. "\u0127": "h",
  2720. "\u0128": "I",
  2721. "\u012A": "I",
  2722. "\u012C": "I",
  2723. "\u012E": "I",
  2724. "\u0130": "I",
  2725. "\u0129": "i",
  2726. "\u012B": "i",
  2727. "\u012D": "i",
  2728. "\u012F": "i",
  2729. "\u0131": "i",
  2730. "\u0134": "J",
  2731. "\u0135": "j",
  2732. "\u0136": "K",
  2733. "\u0137": "k",
  2734. "\u0138": "k",
  2735. "\u0139": "L",
  2736. "\u013B": "L",
  2737. "\u013D": "L",
  2738. "\u013F": "L",
  2739. "\u0141": "L",
  2740. "\u013A": "l",
  2741. "\u013C": "l",
  2742. "\u013E": "l",
  2743. "\u0140": "l",
  2744. "\u0142": "l",
  2745. "\u0143": "N",
  2746. "\u0145": "N",
  2747. "\u0147": "N",
  2748. "\u014A": "N",
  2749. "\u0144": "n",
  2750. "\u0146": "n",
  2751. "\u0148": "n",
  2752. "\u014B": "n",
  2753. "\u014C": "O",
  2754. "\u014E": "O",
  2755. "\u0150": "O",
  2756. "\u014D": "o",
  2757. "\u014F": "o",
  2758. "\u0151": "o",
  2759. "\u0154": "R",
  2760. "\u0156": "R",
  2761. "\u0158": "R",
  2762. "\u0155": "r",
  2763. "\u0157": "r",
  2764. "\u0159": "r",
  2765. "\u015A": "S",
  2766. "\u015C": "S",
  2767. "\u015E": "S",
  2768. "\u0160": "S",
  2769. "\u015B": "s",
  2770. "\u015D": "s",
  2771. "\u015F": "s",
  2772. "\u0161": "s",
  2773. "\u0162": "T",
  2774. "\u0164": "T",
  2775. "\u0166": "T",
  2776. "\u0163": "t",
  2777. "\u0165": "t",
  2778. "\u0167": "t",
  2779. "\u0168": "U",
  2780. "\u016A": "U",
  2781. "\u016C": "U",
  2782. "\u016E": "U",
  2783. "\u0170": "U",
  2784. "\u0172": "U",
  2785. "\u0169": "u",
  2786. "\u016B": "u",
  2787. "\u016D": "u",
  2788. "\u016F": "u",
  2789. "\u0171": "u",
  2790. "\u0173": "u",
  2791. "\u0174": "W",
  2792. "\u0175": "w",
  2793. "\u0176": "Y",
  2794. "\u0177": "y",
  2795. "\u0178": "Y",
  2796. "\u0179": "Z",
  2797. "\u017B": "Z",
  2798. "\u017D": "Z",
  2799. "\u017A": "z",
  2800. "\u017C": "z",
  2801. "\u017E": "z",
  2802. "\u0132": "IJ",
  2803. "\u0133": "ij",
  2804. "\u0152": "Oe",
  2805. "\u0153": "oe",
  2806. "\u0149": "'n",
  2807. "\u017F": "s"
  2808. };
  2809. var deburrLetter = basePropertyOf(deburredLetters);
  2810. var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
  2811. var rsComboMarksRange$2 = "\\u0300-\\u036f";
  2812. var reComboHalfMarksRange$2 = "\\ufe20-\\ufe2f";
  2813. var rsComboSymbolsRange$2 = "\\u20d0-\\u20ff";
  2814. var rsComboRange$2 = rsComboMarksRange$2 + reComboHalfMarksRange$2 + rsComboSymbolsRange$2;
  2815. var rsCombo$2 = "[" + rsComboRange$2 + "]";
  2816. var reComboMark = RegExp(rsCombo$2, "g");
  2817. function deburr(string) {
  2818. string = toString(string);
  2819. return string && string.replace(reLatin, deburrLetter).replace(reComboMark, "");
  2820. }
  2821. var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
  2822. function asciiWords(string) {
  2823. return string.match(reAsciiWord) || [];
  2824. }
  2825. 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 ]/;
  2826. function hasUnicodeWord(string) {
  2827. return reHasUnicodeWord.test(string);
  2828. }
  2829. var rsAstralRange$1 = "\\ud800-\\udfff";
  2830. var rsComboMarksRange$1 = "\\u0300-\\u036f";
  2831. var reComboHalfMarksRange$1 = "\\ufe20-\\ufe2f";
  2832. var rsComboSymbolsRange$1 = "\\u20d0-\\u20ff";
  2833. var rsComboRange$1 = rsComboMarksRange$1 + reComboHalfMarksRange$1 + rsComboSymbolsRange$1;
  2834. var rsDingbatRange = "\\u2700-\\u27bf";
  2835. var rsLowerRange = "a-z\\xdf-\\xf6\\xf8-\\xff";
  2836. var rsMathOpRange = "\\xac\\xb1\\xd7\\xf7";
  2837. var rsNonCharRange = "\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf";
  2838. var rsPunctuationRange = "\\u2000-\\u206f";
  2839. 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";
  2840. var rsUpperRange = "A-Z\\xc0-\\xd6\\xd8-\\xde";
  2841. var rsVarRange$1 = "\\ufe0e\\ufe0f";
  2842. var rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
  2843. var rsApos$1 = "['\u2019]";
  2844. var rsBreak = "[" + rsBreakRange + "]";
  2845. var rsCombo$1 = "[" + rsComboRange$1 + "]";
  2846. var rsDigits = "\\d+";
  2847. var rsDingbat = "[" + rsDingbatRange + "]";
  2848. var rsLower = "[" + rsLowerRange + "]";
  2849. var rsMisc = "[^" + rsAstralRange$1 + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + "]";
  2850. var rsFitz$1 = "\\ud83c[\\udffb-\\udfff]";
  2851. var rsModifier$1 = "(?:" + rsCombo$1 + "|" + rsFitz$1 + ")";
  2852. var rsNonAstral$1 = "[^" + rsAstralRange$1 + "]";
  2853. var rsRegional$1 = "(?:\\ud83c[\\udde6-\\uddff]){2}";
  2854. var rsSurrPair$1 = "[\\ud800-\\udbff][\\udc00-\\udfff]";
  2855. var rsUpper = "[" + rsUpperRange + "]";
  2856. var rsZWJ$1 = "\\u200d";
  2857. var rsMiscLower = "(?:" + rsLower + "|" + rsMisc + ")";
  2858. var rsMiscUpper = "(?:" + rsUpper + "|" + rsMisc + ")";
  2859. var rsOptContrLower = "(?:" + rsApos$1 + "(?:d|ll|m|re|s|t|ve))?";
  2860. var rsOptContrUpper = "(?:" + rsApos$1 + "(?:D|LL|M|RE|S|T|VE))?";
  2861. var reOptMod$1 = rsModifier$1 + "?";
  2862. var rsOptVar$1 = "[" + rsVarRange$1 + "]?";
  2863. var rsOptJoin$1 = "(?:" + rsZWJ$1 + "(?:" + [rsNonAstral$1, rsRegional$1, rsSurrPair$1].join("|") + ")" + rsOptVar$1 + reOptMod$1 + ")*";
  2864. var rsOrdLower = "\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])";
  2865. var rsOrdUpper = "\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])";
  2866. var rsSeq$1 = rsOptVar$1 + reOptMod$1 + rsOptJoin$1;
  2867. var rsEmoji = "(?:" + [rsDingbat, rsRegional$1, rsSurrPair$1].join("|") + ")" + rsSeq$1;
  2868. var reUnicodeWord = RegExp([
  2869. rsUpper + "?" + rsLower + "+" + rsOptContrLower + "(?=" + [rsBreak, rsUpper, "$"].join("|") + ")",
  2870. rsMiscUpper + "+" + rsOptContrUpper + "(?=" + [rsBreak, rsUpper + rsMiscLower, "$"].join("|") + ")",
  2871. rsUpper + "?" + rsMiscLower + "+" + rsOptContrLower,
  2872. rsUpper + "+" + rsOptContrUpper,
  2873. rsOrdUpper,
  2874. rsOrdLower,
  2875. rsDigits,
  2876. rsEmoji
  2877. ].join("|"), "g");
  2878. function unicodeWords(string) {
  2879. return string.match(reUnicodeWord) || [];
  2880. }
  2881. function words(string, pattern, guard) {
  2882. string = toString(string);
  2883. pattern = guard ? void 0 : pattern;
  2884. if (pattern === void 0) {
  2885. return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
  2886. }
  2887. return string.match(pattern) || [];
  2888. }
  2889. var rsApos = "['\u2019]";
  2890. var reApos = RegExp(rsApos, "g");
  2891. function createCompounder(callback) {
  2892. return function(string) {
  2893. return arrayReduce(words(deburr(string).replace(reApos, "")), callback, "");
  2894. };
  2895. }
  2896. var camelCase = createCompounder(function(result, word, index) {
  2897. word = word.toLowerCase();
  2898. return result + (index ? capitalize$1(word) : word);
  2899. });
  2900. function castArray$1() {
  2901. if (!arguments.length) {
  2902. return [];
  2903. }
  2904. var value = arguments[0];
  2905. return isArray(value) ? value : [value];
  2906. }
  2907. var nativeIsFinite$1 = root.isFinite;
  2908. var nativeMin$c = Math.min;
  2909. function createRound(methodName) {
  2910. var func = Math[methodName];
  2911. return function(number, precision) {
  2912. number = toNumber(number);
  2913. precision = precision == null ? 0 : nativeMin$c(toInteger(precision), 292);
  2914. if (precision && nativeIsFinite$1(number)) {
  2915. var pair = (toString(number) + "e").split("e"), value = func(pair[0] + "e" + (+pair[1] + precision));
  2916. pair = (toString(value) + "e").split("e");
  2917. return +(pair[0] + "e" + (+pair[1] - precision));
  2918. }
  2919. return func(number);
  2920. };
  2921. }
  2922. var ceil = createRound("ceil");
  2923. function chain(value) {
  2924. var result = lodash(value);
  2925. result.__chain__ = true;
  2926. return result;
  2927. }
  2928. var nativeCeil$3 = Math.ceil;
  2929. var nativeMax$c = Math.max;
  2930. function chunk(array, size, guard) {
  2931. if (guard ? isIterateeCall(array, size, guard) : size === void 0) {
  2932. size = 1;
  2933. } else {
  2934. size = nativeMax$c(toInteger(size), 0);
  2935. }
  2936. var length = array == null ? 0 : array.length;
  2937. if (!length || size < 1) {
  2938. return [];
  2939. }
  2940. var index = 0, resIndex = 0, result = Array(nativeCeil$3(length / size));
  2941. while (index < length) {
  2942. result[resIndex++] = baseSlice(array, index, index += size);
  2943. }
  2944. return result;
  2945. }
  2946. function baseClamp(number, lower, upper) {
  2947. if (number === number) {
  2948. if (upper !== void 0) {
  2949. number = number <= upper ? number : upper;
  2950. }
  2951. if (lower !== void 0) {
  2952. number = number >= lower ? number : lower;
  2953. }
  2954. }
  2955. return number;
  2956. }
  2957. function clamp$1(number, lower, upper) {
  2958. if (upper === void 0) {
  2959. upper = lower;
  2960. lower = void 0;
  2961. }
  2962. if (upper !== void 0) {
  2963. upper = toNumber(upper);
  2964. upper = upper === upper ? upper : 0;
  2965. }
  2966. if (lower !== void 0) {
  2967. lower = toNumber(lower);
  2968. lower = lower === lower ? lower : 0;
  2969. }
  2970. return baseClamp(toNumber(number), lower, upper);
  2971. }
  2972. function stackClear() {
  2973. this.__data__ = new ListCache();
  2974. this.size = 0;
  2975. }
  2976. function stackDelete(key) {
  2977. var data = this.__data__, result = data["delete"](key);
  2978. this.size = data.size;
  2979. return result;
  2980. }
  2981. function stackGet(key) {
  2982. return this.__data__.get(key);
  2983. }
  2984. function stackHas(key) {
  2985. return this.__data__.has(key);
  2986. }
  2987. var LARGE_ARRAY_SIZE$2 = 200;
  2988. function stackSet(key, value) {
  2989. var data = this.__data__;
  2990. if (data instanceof ListCache) {
  2991. var pairs = data.__data__;
  2992. if (!Map$1 || pairs.length < LARGE_ARRAY_SIZE$2 - 1) {
  2993. pairs.push([key, value]);
  2994. this.size = ++data.size;
  2995. return this;
  2996. }
  2997. data = this.__data__ = new MapCache(pairs);
  2998. }
  2999. data.set(key, value);
  3000. this.size = data.size;
  3001. return this;
  3002. }
  3003. function Stack(entries) {
  3004. var data = this.__data__ = new ListCache(entries);
  3005. this.size = data.size;
  3006. }
  3007. Stack.prototype.clear = stackClear;
  3008. Stack.prototype["delete"] = stackDelete;
  3009. Stack.prototype.get = stackGet;
  3010. Stack.prototype.has = stackHas;
  3011. Stack.prototype.set = stackSet;
  3012. function baseAssign(object, source) {
  3013. return object && copyObject(source, keys(source), object);
  3014. }
  3015. function baseAssignIn(object, source) {
  3016. return object && copyObject(source, keysIn(source), object);
  3017. }
  3018. var freeExports = typeof exports == "object" && exports && !exports.nodeType && exports;
  3019. var freeModule = freeExports && typeof module == "object" && module && !module.nodeType && module;
  3020. var moduleExports = freeModule && freeModule.exports === freeExports;
  3021. var Buffer = moduleExports ? root.Buffer : void 0;
  3022. var allocUnsafe = Buffer ? Buffer.allocUnsafe : void 0;
  3023. function cloneBuffer(buffer, isDeep) {
  3024. if (isDeep) {
  3025. return buffer.slice();
  3026. }
  3027. var length = buffer.length, result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
  3028. buffer.copy(result);
  3029. return result;
  3030. }
  3031. function arrayFilter(array, predicate) {
  3032. var index = -1, length = array == null ? 0 : array.length, resIndex = 0, result = [];
  3033. while (++index < length) {
  3034. var value = array[index];
  3035. if (predicate(value, index, array)) {
  3036. result[resIndex++] = value;
  3037. }
  3038. }
  3039. return result;
  3040. }
  3041. function stubArray() {
  3042. return [];
  3043. }
  3044. var objectProto$d = Object.prototype;
  3045. var propertyIsEnumerable = objectProto$d.propertyIsEnumerable;
  3046. var nativeGetSymbols$1 = Object.getOwnPropertySymbols;
  3047. var getSymbols = !nativeGetSymbols$1 ? stubArray : function(object) {
  3048. if (object == null) {
  3049. return [];
  3050. }
  3051. object = Object(object);
  3052. return arrayFilter(nativeGetSymbols$1(object), function(symbol) {
  3053. return propertyIsEnumerable.call(object, symbol);
  3054. });
  3055. };
  3056. function copySymbols(source, object) {
  3057. return copyObject(source, getSymbols(source), object);
  3058. }
  3059. var nativeGetSymbols = Object.getOwnPropertySymbols;
  3060. var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
  3061. var result = [];
  3062. while (object) {
  3063. arrayPush(result, getSymbols(object));
  3064. object = getPrototype(object);
  3065. }
  3066. return result;
  3067. };
  3068. function copySymbolsIn(source, object) {
  3069. return copyObject(source, getSymbolsIn(source), object);
  3070. }
  3071. function baseGetAllKeys(object, keysFunc, symbolsFunc) {
  3072. var result = keysFunc(object);
  3073. return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
  3074. }
  3075. function getAllKeys(object) {
  3076. return baseGetAllKeys(object, keys, getSymbols);
  3077. }
  3078. function getAllKeysIn(object) {
  3079. return baseGetAllKeys(object, keysIn, getSymbolsIn);
  3080. }
  3081. var DataView = getNative(root, "DataView");
  3082. var Promise$1 = getNative(root, "Promise");
  3083. var Set$1 = getNative(root, "Set");
  3084. var mapTag$8 = "[object Map]";
  3085. var objectTag$2 = "[object Object]";
  3086. var promiseTag = "[object Promise]";
  3087. var setTag$8 = "[object Set]";
  3088. var weakMapTag$2 = "[object WeakMap]";
  3089. var dataViewTag$3 = "[object DataView]";
  3090. var dataViewCtorString = toSource(DataView);
  3091. var mapCtorString = toSource(Map$1);
  3092. var promiseCtorString = toSource(Promise$1);
  3093. var setCtorString = toSource(Set$1);
  3094. var weakMapCtorString = toSource(WeakMap$1);
  3095. var getTag = baseGetTag;
  3096. 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$1 && getTag(new WeakMap$1()) != weakMapTag$2) {
  3097. getTag = function(value) {
  3098. var result = baseGetTag(value), Ctor = result == objectTag$2 ? value.constructor : void 0, ctorString = Ctor ? toSource(Ctor) : "";
  3099. if (ctorString) {
  3100. switch (ctorString) {
  3101. case dataViewCtorString:
  3102. return dataViewTag$3;
  3103. case mapCtorString:
  3104. return mapTag$8;
  3105. case promiseCtorString:
  3106. return promiseTag;
  3107. case setCtorString:
  3108. return setTag$8;
  3109. case weakMapCtorString:
  3110. return weakMapTag$2;
  3111. }
  3112. }
  3113. return result;
  3114. };
  3115. }
  3116. var getTag$1 = getTag;
  3117. var objectProto$c = Object.prototype;
  3118. var hasOwnProperty$b = objectProto$c.hasOwnProperty;
  3119. function initCloneArray(array) {
  3120. var length = array.length, result = new array.constructor(length);
  3121. if (length && typeof array[0] == "string" && hasOwnProperty$b.call(array, "index")) {
  3122. result.index = array.index;
  3123. result.input = array.input;
  3124. }
  3125. return result;
  3126. }
  3127. var Uint8Array = root.Uint8Array;
  3128. function cloneArrayBuffer(arrayBuffer) {
  3129. var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  3130. new Uint8Array(result).set(new Uint8Array(arrayBuffer));
  3131. return result;
  3132. }
  3133. function cloneDataView(dataView, isDeep) {
  3134. var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
  3135. return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
  3136. }
  3137. var reFlags$1 = /\w*$/;
  3138. function cloneRegExp(regexp) {
  3139. var result = new regexp.constructor(regexp.source, reFlags$1.exec(regexp));
  3140. result.lastIndex = regexp.lastIndex;
  3141. return result;
  3142. }
  3143. var symbolProto$1 = Symbol$1 ? Symbol$1.prototype : void 0;
  3144. var symbolValueOf$1 = symbolProto$1 ? symbolProto$1.valueOf : void 0;
  3145. function cloneSymbol(symbol) {
  3146. return symbolValueOf$1 ? Object(symbolValueOf$1.call(symbol)) : {};
  3147. }
  3148. function cloneTypedArray(typedArray, isDeep) {
  3149. var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
  3150. return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
  3151. }
  3152. var boolTag$3 = "[object Boolean]";
  3153. var dateTag$3 = "[object Date]";
  3154. var mapTag$7 = "[object Map]";
  3155. var numberTag$3 = "[object Number]";
  3156. var regexpTag$3 = "[object RegExp]";
  3157. var setTag$7 = "[object Set]";
  3158. var stringTag$3 = "[object String]";
  3159. var symbolTag$2 = "[object Symbol]";
  3160. var arrayBufferTag$3 = "[object ArrayBuffer]";
  3161. var dataViewTag$2 = "[object DataView]";
  3162. var float32Tag$1 = "[object Float32Array]";
  3163. var float64Tag$1 = "[object Float64Array]";
  3164. var int8Tag$1 = "[object Int8Array]";
  3165. var int16Tag$1 = "[object Int16Array]";
  3166. var int32Tag$1 = "[object Int32Array]";
  3167. var uint8Tag$1 = "[object Uint8Array]";
  3168. var uint8ClampedTag$1 = "[object Uint8ClampedArray]";
  3169. var uint16Tag$1 = "[object Uint16Array]";
  3170. var uint32Tag$1 = "[object Uint32Array]";
  3171. function initCloneByTag(object, tag, isDeep) {
  3172. var Ctor = object.constructor;
  3173. switch (tag) {
  3174. case arrayBufferTag$3:
  3175. return cloneArrayBuffer(object);
  3176. case boolTag$3:
  3177. case dateTag$3:
  3178. return new Ctor(+object);
  3179. case dataViewTag$2:
  3180. return cloneDataView(object, isDeep);
  3181. case float32Tag$1:
  3182. case float64Tag$1:
  3183. case int8Tag$1:
  3184. case int16Tag$1:
  3185. case int32Tag$1:
  3186. case uint8Tag$1:
  3187. case uint8ClampedTag$1:
  3188. case uint16Tag$1:
  3189. case uint32Tag$1:
  3190. return cloneTypedArray(object, isDeep);
  3191. case mapTag$7:
  3192. return new Ctor();
  3193. case numberTag$3:
  3194. case stringTag$3:
  3195. return new Ctor(object);
  3196. case regexpTag$3:
  3197. return cloneRegExp(object);
  3198. case setTag$7:
  3199. return new Ctor();
  3200. case symbolTag$2:
  3201. return cloneSymbol(object);
  3202. }
  3203. }
  3204. function initCloneObject(object) {
  3205. return typeof object.constructor == "function" && !isPrototype(object) ? baseCreate(getPrototype(object)) : {};
  3206. }
  3207. var mapTag$6 = "[object Map]";
  3208. function baseIsMap(value) {
  3209. return isObjectLike(value) && getTag$1(value) == mapTag$6;
  3210. }
  3211. var nodeIsMap = nodeUtil && nodeUtil.isMap;
  3212. var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
  3213. var setTag$6 = "[object Set]";
  3214. function baseIsSet(value) {
  3215. return isObjectLike(value) && getTag$1(value) == setTag$6;
  3216. }
  3217. var nodeIsSet = nodeUtil && nodeUtil.isSet;
  3218. var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
  3219. var CLONE_DEEP_FLAG$7 = 1;
  3220. var CLONE_FLAT_FLAG$1 = 2;
  3221. var CLONE_SYMBOLS_FLAG$5 = 4;
  3222. var argsTag$1 = "[object Arguments]";
  3223. var arrayTag$1 = "[object Array]";
  3224. var boolTag$2 = "[object Boolean]";
  3225. var dateTag$2 = "[object Date]";
  3226. var errorTag$1 = "[object Error]";
  3227. var funcTag = "[object Function]";
  3228. var genTag = "[object GeneratorFunction]";
  3229. var mapTag$5 = "[object Map]";
  3230. var numberTag$2 = "[object Number]";
  3231. var objectTag$1 = "[object Object]";
  3232. var regexpTag$2 = "[object RegExp]";
  3233. var setTag$5 = "[object Set]";
  3234. var stringTag$2 = "[object String]";
  3235. var symbolTag$1 = "[object Symbol]";
  3236. var weakMapTag$1 = "[object WeakMap]";
  3237. var arrayBufferTag$2 = "[object ArrayBuffer]";
  3238. var dataViewTag$1 = "[object DataView]";
  3239. var float32Tag = "[object Float32Array]";
  3240. var float64Tag = "[object Float64Array]";
  3241. var int8Tag = "[object Int8Array]";
  3242. var int16Tag = "[object Int16Array]";
  3243. var int32Tag = "[object Int32Array]";
  3244. var uint8Tag = "[object Uint8Array]";
  3245. var uint8ClampedTag = "[object Uint8ClampedArray]";
  3246. var uint16Tag = "[object Uint16Array]";
  3247. var uint32Tag = "[object Uint32Array]";
  3248. var cloneableTags = {};
  3249. 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;
  3250. cloneableTags[errorTag$1] = cloneableTags[funcTag] = cloneableTags[weakMapTag$1] = false;
  3251. function baseClone(value, bitmask, customizer, key, object, stack) {
  3252. var result, isDeep = bitmask & CLONE_DEEP_FLAG$7, isFlat = bitmask & CLONE_FLAT_FLAG$1, isFull = bitmask & CLONE_SYMBOLS_FLAG$5;
  3253. if (customizer) {
  3254. result = object ? customizer(value, key, object, stack) : customizer(value);
  3255. }
  3256. if (result !== void 0) {
  3257. return result;
  3258. }
  3259. if (!isObject(value)) {
  3260. return value;
  3261. }
  3262. var isArr = isArray(value);
  3263. if (isArr) {
  3264. result = initCloneArray(value);
  3265. if (!isDeep) {
  3266. return copyArray(value, result);
  3267. }
  3268. } else {
  3269. var tag = getTag$1(value), isFunc = tag == funcTag || tag == genTag;
  3270. if (isBuffer(value)) {
  3271. return cloneBuffer(value, isDeep);
  3272. }
  3273. if (tag == objectTag$1 || tag == argsTag$1 || isFunc && !object) {
  3274. result = isFlat || isFunc ? {} : initCloneObject(value);
  3275. if (!isDeep) {
  3276. return isFlat ? copySymbolsIn(value, baseAssignIn(result, value)) : copySymbols(value, baseAssign(result, value));
  3277. }
  3278. } else {
  3279. if (!cloneableTags[tag]) {
  3280. return object ? value : {};
  3281. }
  3282. result = initCloneByTag(value, tag, isDeep);
  3283. }
  3284. }
  3285. stack || (stack = new Stack());
  3286. var stacked = stack.get(value);
  3287. if (stacked) {
  3288. return stacked;
  3289. }
  3290. stack.set(value, result);
  3291. if (isSet(value)) {
  3292. value.forEach(function(subValue) {
  3293. result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
  3294. });
  3295. } else if (isMap(value)) {
  3296. value.forEach(function(subValue, key2) {
  3297. result.set(key2, baseClone(subValue, bitmask, customizer, key2, value, stack));
  3298. });
  3299. }
  3300. var keysFunc = isFull ? isFlat ? getAllKeysIn : getAllKeys : isFlat ? keysIn : keys;
  3301. var props = isArr ? void 0 : keysFunc(value);
  3302. arrayEach(props || value, function(subValue, key2) {
  3303. if (props) {
  3304. key2 = subValue;
  3305. subValue = value[key2];
  3306. }
  3307. assignValue(result, key2, baseClone(subValue, bitmask, customizer, key2, value, stack));
  3308. });
  3309. return result;
  3310. }
  3311. var CLONE_SYMBOLS_FLAG$4 = 4;
  3312. function clone(value) {
  3313. return baseClone(value, CLONE_SYMBOLS_FLAG$4);
  3314. }
  3315. var CLONE_DEEP_FLAG$6 = 1;
  3316. var CLONE_SYMBOLS_FLAG$3 = 4;
  3317. function cloneDeep(value) {
  3318. return baseClone(value, CLONE_DEEP_FLAG$6 | CLONE_SYMBOLS_FLAG$3);
  3319. }
  3320. var CLONE_DEEP_FLAG$5 = 1;
  3321. var CLONE_SYMBOLS_FLAG$2 = 4;
  3322. function cloneDeepWith(value, customizer) {
  3323. customizer = typeof customizer == "function" ? customizer : void 0;
  3324. return baseClone(value, CLONE_DEEP_FLAG$5 | CLONE_SYMBOLS_FLAG$2, customizer);
  3325. }
  3326. var CLONE_SYMBOLS_FLAG$1 = 4;
  3327. function cloneWith(value, customizer) {
  3328. customizer = typeof customizer == "function" ? customizer : void 0;
  3329. return baseClone(value, CLONE_SYMBOLS_FLAG$1, customizer);
  3330. }
  3331. function wrapperCommit() {
  3332. return new LodashWrapper(this.value(), this.__chain__);
  3333. }
  3334. function compact(array) {
  3335. var index = -1, length = array == null ? 0 : array.length, resIndex = 0, result = [];
  3336. while (++index < length) {
  3337. var value = array[index];
  3338. if (value) {
  3339. result[resIndex++] = value;
  3340. }
  3341. }
  3342. return result;
  3343. }
  3344. function concat() {
  3345. var length = arguments.length;
  3346. if (!length) {
  3347. return [];
  3348. }
  3349. var args = Array(length - 1), array = arguments[0], index = length;
  3350. while (index--) {
  3351. args[index - 1] = arguments[index];
  3352. }
  3353. return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1));
  3354. }
  3355. var HASH_UNDEFINED = "__lodash_hash_undefined__";
  3356. function setCacheAdd(value) {
  3357. this.__data__.set(value, HASH_UNDEFINED);
  3358. return this;
  3359. }
  3360. function setCacheHas(value) {
  3361. return this.__data__.has(value);
  3362. }
  3363. function SetCache(values) {
  3364. var index = -1, length = values == null ? 0 : values.length;
  3365. this.__data__ = new MapCache();
  3366. while (++index < length) {
  3367. this.add(values[index]);
  3368. }
  3369. }
  3370. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  3371. SetCache.prototype.has = setCacheHas;
  3372. function arraySome(array, predicate) {
  3373. var index = -1, length = array == null ? 0 : array.length;
  3374. while (++index < length) {
  3375. if (predicate(array[index], index, array)) {
  3376. return true;
  3377. }
  3378. }
  3379. return false;
  3380. }
  3381. function cacheHas(cache, key) {
  3382. return cache.has(key);
  3383. }
  3384. var COMPARE_PARTIAL_FLAG$5 = 1;
  3385. var COMPARE_UNORDERED_FLAG$3 = 2;
  3386. function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
  3387. var isPartial = bitmask & COMPARE_PARTIAL_FLAG$5, arrLength = array.length, othLength = other.length;
  3388. if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
  3389. return false;
  3390. }
  3391. var arrStacked = stack.get(array);
  3392. var othStacked = stack.get(other);
  3393. if (arrStacked && othStacked) {
  3394. return arrStacked == other && othStacked == array;
  3395. }
  3396. var index = -1, result = true, seen = bitmask & COMPARE_UNORDERED_FLAG$3 ? new SetCache() : void 0;
  3397. stack.set(array, other);
  3398. stack.set(other, array);
  3399. while (++index < arrLength) {
  3400. var arrValue = array[index], othValue = other[index];
  3401. if (customizer) {
  3402. var compared = isPartial ? customizer(othValue, arrValue, index, other, array, stack) : customizer(arrValue, othValue, index, array, other, stack);
  3403. }
  3404. if (compared !== void 0) {
  3405. if (compared) {
  3406. continue;
  3407. }
  3408. result = false;
  3409. break;
  3410. }
  3411. if (seen) {
  3412. if (!arraySome(other, function(othValue2, othIndex) {
  3413. if (!cacheHas(seen, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) {
  3414. return seen.push(othIndex);
  3415. }
  3416. })) {
  3417. result = false;
  3418. break;
  3419. }
  3420. } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
  3421. result = false;
  3422. break;
  3423. }
  3424. }
  3425. stack["delete"](array);
  3426. stack["delete"](other);
  3427. return result;
  3428. }
  3429. function mapToArray(map) {
  3430. var index = -1, result = Array(map.size);
  3431. map.forEach(function(value, key) {
  3432. result[++index] = [key, value];
  3433. });
  3434. return result;
  3435. }
  3436. function setToArray(set) {
  3437. var index = -1, result = Array(set.size);
  3438. set.forEach(function(value) {
  3439. result[++index] = value;
  3440. });
  3441. return result;
  3442. }
  3443. var COMPARE_PARTIAL_FLAG$4 = 1;
  3444. var COMPARE_UNORDERED_FLAG$2 = 2;
  3445. var boolTag$1 = "[object Boolean]";
  3446. var dateTag$1 = "[object Date]";
  3447. var errorTag = "[object Error]";
  3448. var mapTag$4 = "[object Map]";
  3449. var numberTag$1 = "[object Number]";
  3450. var regexpTag$1 = "[object RegExp]";
  3451. var setTag$4 = "[object Set]";
  3452. var stringTag$1 = "[object String]";
  3453. var symbolTag = "[object Symbol]";
  3454. var arrayBufferTag$1 = "[object ArrayBuffer]";
  3455. var dataViewTag = "[object DataView]";
  3456. var symbolProto = Symbol$1 ? Symbol$1.prototype : void 0;
  3457. var symbolValueOf = symbolProto ? symbolProto.valueOf : void 0;
  3458. function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
  3459. switch (tag) {
  3460. case dataViewTag:
  3461. if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) {
  3462. return false;
  3463. }
  3464. object = object.buffer;
  3465. other = other.buffer;
  3466. case arrayBufferTag$1:
  3467. if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
  3468. return false;
  3469. }
  3470. return true;
  3471. case boolTag$1:
  3472. case dateTag$1:
  3473. case numberTag$1:
  3474. return eq(+object, +other);
  3475. case errorTag:
  3476. return object.name == other.name && object.message == other.message;
  3477. case regexpTag$1:
  3478. case stringTag$1:
  3479. return object == other + "";
  3480. case mapTag$4:
  3481. var convert = mapToArray;
  3482. case setTag$4:
  3483. var isPartial = bitmask & COMPARE_PARTIAL_FLAG$4;
  3484. convert || (convert = setToArray);
  3485. if (object.size != other.size && !isPartial) {
  3486. return false;
  3487. }
  3488. var stacked = stack.get(object);
  3489. if (stacked) {
  3490. return stacked == other;
  3491. }
  3492. bitmask |= COMPARE_UNORDERED_FLAG$2;
  3493. stack.set(object, other);
  3494. var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
  3495. stack["delete"](object);
  3496. return result;
  3497. case symbolTag:
  3498. if (symbolValueOf) {
  3499. return symbolValueOf.call(object) == symbolValueOf.call(other);
  3500. }
  3501. }
  3502. return false;
  3503. }
  3504. var COMPARE_PARTIAL_FLAG$3 = 1;
  3505. var objectProto$b = Object.prototype;
  3506. var hasOwnProperty$a = objectProto$b.hasOwnProperty;
  3507. function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
  3508. var isPartial = bitmask & COMPARE_PARTIAL_FLAG$3, objProps = getAllKeys(object), objLength = objProps.length, othProps = getAllKeys(other), othLength = othProps.length;
  3509. if (objLength != othLength && !isPartial) {
  3510. return false;
  3511. }
  3512. var index = objLength;
  3513. while (index--) {
  3514. var key = objProps[index];
  3515. if (!(isPartial ? key in other : hasOwnProperty$a.call(other, key))) {
  3516. return false;
  3517. }
  3518. }
  3519. var objStacked = stack.get(object);
  3520. var othStacked = stack.get(other);
  3521. if (objStacked && othStacked) {
  3522. return objStacked == other && othStacked == object;
  3523. }
  3524. var result = true;
  3525. stack.set(object, other);
  3526. stack.set(other, object);
  3527. var skipCtor = isPartial;
  3528. while (++index < objLength) {
  3529. key = objProps[index];
  3530. var objValue = object[key], othValue = other[key];
  3531. if (customizer) {
  3532. var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack);
  3533. }
  3534. if (!(compared === void 0 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
  3535. result = false;
  3536. break;
  3537. }
  3538. skipCtor || (skipCtor = key == "constructor");
  3539. }
  3540. if (result && !skipCtor) {
  3541. var objCtor = object.constructor, othCtor = other.constructor;
  3542. if (objCtor != othCtor && ("constructor" in object && "constructor" in other) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) {
  3543. result = false;
  3544. }
  3545. }
  3546. stack["delete"](object);
  3547. stack["delete"](other);
  3548. return result;
  3549. }
  3550. var COMPARE_PARTIAL_FLAG$2 = 1;
  3551. var argsTag = "[object Arguments]";
  3552. var arrayTag = "[object Array]";
  3553. var objectTag = "[object Object]";
  3554. var objectProto$a = Object.prototype;
  3555. var hasOwnProperty$9 = objectProto$a.hasOwnProperty;
  3556. function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
  3557. var objIsArr = isArray(object), othIsArr = isArray(other), objTag = objIsArr ? arrayTag : getTag$1(object), othTag = othIsArr ? arrayTag : getTag$1(other);
  3558. objTag = objTag == argsTag ? objectTag : objTag;
  3559. othTag = othTag == argsTag ? objectTag : othTag;
  3560. var objIsObj = objTag == objectTag, othIsObj = othTag == objectTag, isSameTag = objTag == othTag;
  3561. if (isSameTag && isBuffer(object)) {
  3562. if (!isBuffer(other)) {
  3563. return false;
  3564. }
  3565. objIsArr = true;
  3566. objIsObj = false;
  3567. }
  3568. if (isSameTag && !objIsObj) {
  3569. stack || (stack = new Stack());
  3570. return objIsArr || isTypedArray(object) ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
  3571. }
  3572. if (!(bitmask & COMPARE_PARTIAL_FLAG$2)) {
  3573. var objIsWrapped = objIsObj && hasOwnProperty$9.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty$9.call(other, "__wrapped__");
  3574. if (objIsWrapped || othIsWrapped) {
  3575. var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other;
  3576. stack || (stack = new Stack());
  3577. return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
  3578. }
  3579. }
  3580. if (!isSameTag) {
  3581. return false;
  3582. }
  3583. stack || (stack = new Stack());
  3584. return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
  3585. }
  3586. function baseIsEqual(value, other, bitmask, customizer, stack) {
  3587. if (value === other) {
  3588. return true;
  3589. }
  3590. if (value == null || other == null || !isObjectLike(value) && !isObjectLike(other)) {
  3591. return value !== value && other !== other;
  3592. }
  3593. return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
  3594. }
  3595. var COMPARE_PARTIAL_FLAG$1 = 1;
  3596. var COMPARE_UNORDERED_FLAG$1 = 2;
  3597. function baseIsMatch(object, source, matchData, customizer) {
  3598. var index = matchData.length, length = index, noCustomizer = !customizer;
  3599. if (object == null) {
  3600. return !length;
  3601. }
  3602. object = Object(object);
  3603. while (index--) {
  3604. var data = matchData[index];
  3605. if (noCustomizer && data[2] ? data[1] !== object[data[0]] : !(data[0] in object)) {
  3606. return false;
  3607. }
  3608. }
  3609. while (++index < length) {
  3610. data = matchData[index];
  3611. var key = data[0], objValue = object[key], srcValue = data[1];
  3612. if (noCustomizer && data[2]) {
  3613. if (objValue === void 0 && !(key in object)) {
  3614. return false;
  3615. }
  3616. } else {
  3617. var stack = new Stack();
  3618. if (customizer) {
  3619. var result = customizer(objValue, srcValue, key, object, source, stack);
  3620. }
  3621. if (!(result === void 0 ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG$1 | COMPARE_UNORDERED_FLAG$1, customizer, stack) : result)) {
  3622. return false;
  3623. }
  3624. }
  3625. }
  3626. return true;
  3627. }
  3628. function isStrictComparable(value) {
  3629. return value === value && !isObject(value);
  3630. }
  3631. function getMatchData(object) {
  3632. var result = keys(object), length = result.length;
  3633. while (length--) {
  3634. var key = result[length], value = object[key];
  3635. result[length] = [key, value, isStrictComparable(value)];
  3636. }
  3637. return result;
  3638. }
  3639. function matchesStrictComparable(key, srcValue) {
  3640. return function(object) {
  3641. if (object == null) {
  3642. return false;
  3643. }
  3644. return object[key] === srcValue && (srcValue !== void 0 || key in Object(object));
  3645. };
  3646. }
  3647. function baseMatches(source) {
  3648. var matchData = getMatchData(source);
  3649. if (matchData.length == 1 && matchData[0][2]) {
  3650. return matchesStrictComparable(matchData[0][0], matchData[0][1]);
  3651. }
  3652. return function(object) {
  3653. return object === source || baseIsMatch(object, source, matchData);
  3654. };
  3655. }
  3656. function baseHasIn(object, key) {
  3657. return object != null && key in Object(object);
  3658. }
  3659. function hasPath(object, path, hasFunc) {
  3660. path = castPath(path, object);
  3661. var index = -1, length = path.length, result = false;
  3662. while (++index < length) {
  3663. var key = toKey(path[index]);
  3664. if (!(result = object != null && hasFunc(object, key))) {
  3665. break;
  3666. }
  3667. object = object[key];
  3668. }
  3669. if (result || ++index != length) {
  3670. return result;
  3671. }
  3672. length = object == null ? 0 : object.length;
  3673. return !!length && isLength(length) && isIndex(key, length) && (isArray(object) || isArguments(object));
  3674. }
  3675. function hasIn(object, path) {
  3676. return object != null && hasPath(object, path, baseHasIn);
  3677. }
  3678. var COMPARE_PARTIAL_FLAG = 1;
  3679. var COMPARE_UNORDERED_FLAG = 2;
  3680. function baseMatchesProperty(path, srcValue) {
  3681. if (isKey(path) && isStrictComparable(srcValue)) {
  3682. return matchesStrictComparable(toKey(path), srcValue);
  3683. }
  3684. return function(object) {
  3685. var objValue = get(object, path);
  3686. return objValue === void 0 && objValue === srcValue ? hasIn(object, path) : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
  3687. };
  3688. }
  3689. function baseProperty(key) {
  3690. return function(object) {
  3691. return object == null ? void 0 : object[key];
  3692. };
  3693. }
  3694. function basePropertyDeep(path) {
  3695. return function(object) {
  3696. return baseGet(object, path);
  3697. };
  3698. }
  3699. function property(path) {
  3700. return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
  3701. }
  3702. function baseIteratee(value) {
  3703. if (typeof value == "function") {
  3704. return value;
  3705. }
  3706. if (value == null) {
  3707. return identity;
  3708. }
  3709. if (typeof value == "object") {
  3710. return isArray(value) ? baseMatchesProperty(value[0], value[1]) : baseMatches(value);
  3711. }
  3712. return property(value);
  3713. }
  3714. var FUNC_ERROR_TEXT$7 = "Expected a function";
  3715. function cond(pairs) {
  3716. var length = pairs == null ? 0 : pairs.length, toIteratee = baseIteratee;
  3717. pairs = !length ? [] : arrayMap(pairs, function(pair) {
  3718. if (typeof pair[1] != "function") {
  3719. throw new TypeError(FUNC_ERROR_TEXT$7);
  3720. }
  3721. return [toIteratee(pair[0]), pair[1]];
  3722. });
  3723. return baseRest(function(args) {
  3724. var index = -1;
  3725. while (++index < length) {
  3726. var pair = pairs[index];
  3727. if (apply(pair[0], this, args)) {
  3728. return apply(pair[1], this, args);
  3729. }
  3730. }
  3731. });
  3732. }
  3733. function baseConformsTo(object, source, props) {
  3734. var length = props.length;
  3735. if (object == null) {
  3736. return !length;
  3737. }
  3738. object = Object(object);
  3739. while (length--) {
  3740. var key = props[length], predicate = source[key], value = object[key];
  3741. if (value === void 0 && !(key in object) || !predicate(value)) {
  3742. return false;
  3743. }
  3744. }
  3745. return true;
  3746. }
  3747. function baseConforms(source) {
  3748. var props = keys(source);
  3749. return function(object) {
  3750. return baseConformsTo(object, source, props);
  3751. };
  3752. }
  3753. var CLONE_DEEP_FLAG$4 = 1;
  3754. function conforms(source) {
  3755. return baseConforms(baseClone(source, CLONE_DEEP_FLAG$4));
  3756. }
  3757. function conformsTo(object, source) {
  3758. return source == null || baseConformsTo(object, source, keys(source));
  3759. }
  3760. function arrayAggregator(array, setter, iteratee, accumulator) {
  3761. var index = -1, length = array == null ? 0 : array.length;
  3762. while (++index < length) {
  3763. var value = array[index];
  3764. setter(accumulator, value, iteratee(value), array);
  3765. }
  3766. return accumulator;
  3767. }
  3768. function createBaseFor(fromRight) {
  3769. return function(object, iteratee, keysFunc) {
  3770. var index = -1, iterable = Object(object), props = keysFunc(object), length = props.length;
  3771. while (length--) {
  3772. var key = props[fromRight ? length : ++index];
  3773. if (iteratee(iterable[key], key, iterable) === false) {
  3774. break;
  3775. }
  3776. }
  3777. return object;
  3778. };
  3779. }
  3780. var baseFor = createBaseFor();
  3781. function baseForOwn(object, iteratee) {
  3782. return object && baseFor(object, iteratee, keys);
  3783. }
  3784. function createBaseEach(eachFunc, fromRight) {
  3785. return function(collection, iteratee) {
  3786. if (collection == null) {
  3787. return collection;
  3788. }
  3789. if (!isArrayLike(collection)) {
  3790. return eachFunc(collection, iteratee);
  3791. }
  3792. var length = collection.length, index = fromRight ? length : -1, iterable = Object(collection);
  3793. while (fromRight ? index-- : ++index < length) {
  3794. if (iteratee(iterable[index], index, iterable) === false) {
  3795. break;
  3796. }
  3797. }
  3798. return collection;
  3799. };
  3800. }
  3801. var baseEach = createBaseEach(baseForOwn);
  3802. function baseAggregator(collection, setter, iteratee, accumulator) {
  3803. baseEach(collection, function(value, key, collection2) {
  3804. setter(accumulator, value, iteratee(value), collection2);
  3805. });
  3806. return accumulator;
  3807. }
  3808. function createAggregator(setter, initializer) {
  3809. return function(collection, iteratee) {
  3810. var func = isArray(collection) ? arrayAggregator : baseAggregator, accumulator = initializer ? initializer() : {};
  3811. return func(collection, setter, baseIteratee(iteratee), accumulator);
  3812. };
  3813. }
  3814. var objectProto$9 = Object.prototype;
  3815. var hasOwnProperty$8 = objectProto$9.hasOwnProperty;
  3816. var countBy = createAggregator(function(result, value, key) {
  3817. if (hasOwnProperty$8.call(result, key)) {
  3818. ++result[key];
  3819. } else {
  3820. baseAssignValue(result, key, 1);
  3821. }
  3822. });
  3823. function create(prototype, properties) {
  3824. var result = baseCreate(prototype);
  3825. return properties == null ? result : baseAssign(result, properties);
  3826. }
  3827. var WRAP_CURRY_FLAG$1 = 8;
  3828. function curry(func, arity, guard) {
  3829. arity = guard ? void 0 : arity;
  3830. var result = createWrap(func, WRAP_CURRY_FLAG$1, void 0, void 0, void 0, void 0, void 0, arity);
  3831. result.placeholder = curry.placeholder;
  3832. return result;
  3833. }
  3834. curry.placeholder = {};
  3835. var WRAP_CURRY_RIGHT_FLAG = 16;
  3836. function curryRight(func, arity, guard) {
  3837. arity = guard ? void 0 : arity;
  3838. var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, void 0, void 0, void 0, void 0, void 0, arity);
  3839. result.placeholder = curryRight.placeholder;
  3840. return result;
  3841. }
  3842. curryRight.placeholder = {};
  3843. var now = function() {
  3844. return root.Date.now();
  3845. };
  3846. var FUNC_ERROR_TEXT$6 = "Expected a function";
  3847. var nativeMax$b = Math.max;
  3848. var nativeMin$b = Math.min;
  3849. function debounce(func, wait, options) {
  3850. var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
  3851. if (typeof func != "function") {
  3852. throw new TypeError(FUNC_ERROR_TEXT$6);
  3853. }
  3854. wait = toNumber(wait) || 0;
  3855. if (isObject(options)) {
  3856. leading = !!options.leading;
  3857. maxing = "maxWait" in options;
  3858. maxWait = maxing ? nativeMax$b(toNumber(options.maxWait) || 0, wait) : maxWait;
  3859. trailing = "trailing" in options ? !!options.trailing : trailing;
  3860. }
  3861. function invokeFunc(time) {
  3862. var args = lastArgs, thisArg = lastThis;
  3863. lastArgs = lastThis = void 0;
  3864. lastInvokeTime = time;
  3865. result = func.apply(thisArg, args);
  3866. return result;
  3867. }
  3868. function leadingEdge(time) {
  3869. lastInvokeTime = time;
  3870. timerId = setTimeout(timerExpired, wait);
  3871. return leading ? invokeFunc(time) : result;
  3872. }
  3873. function remainingWait(time) {
  3874. var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
  3875. return maxing ? nativeMin$b(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
  3876. }
  3877. function shouldInvoke(time) {
  3878. var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime;
  3879. return lastCallTime === void 0 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
  3880. }
  3881. function timerExpired() {
  3882. var time = now();
  3883. if (shouldInvoke(time)) {
  3884. return trailingEdge(time);
  3885. }
  3886. timerId = setTimeout(timerExpired, remainingWait(time));
  3887. }
  3888. function trailingEdge(time) {
  3889. timerId = void 0;
  3890. if (trailing && lastArgs) {
  3891. return invokeFunc(time);
  3892. }
  3893. lastArgs = lastThis = void 0;
  3894. return result;
  3895. }
  3896. function cancel() {
  3897. if (timerId !== void 0) {
  3898. clearTimeout(timerId);
  3899. }
  3900. lastInvokeTime = 0;
  3901. lastArgs = lastCallTime = lastThis = timerId = void 0;
  3902. }
  3903. function flush() {
  3904. return timerId === void 0 ? result : trailingEdge(now());
  3905. }
  3906. function debounced() {
  3907. var time = now(), isInvoking = shouldInvoke(time);
  3908. lastArgs = arguments;
  3909. lastThis = this;
  3910. lastCallTime = time;
  3911. if (isInvoking) {
  3912. if (timerId === void 0) {
  3913. return leadingEdge(lastCallTime);
  3914. }
  3915. if (maxing) {
  3916. clearTimeout(timerId);
  3917. timerId = setTimeout(timerExpired, wait);
  3918. return invokeFunc(lastCallTime);
  3919. }
  3920. }
  3921. if (timerId === void 0) {
  3922. timerId = setTimeout(timerExpired, wait);
  3923. }
  3924. return result;
  3925. }
  3926. debounced.cancel = cancel;
  3927. debounced.flush = flush;
  3928. return debounced;
  3929. }
  3930. function defaultTo(value, defaultValue) {
  3931. return value == null || value !== value ? defaultValue : value;
  3932. }
  3933. var objectProto$8 = Object.prototype;
  3934. var hasOwnProperty$7 = objectProto$8.hasOwnProperty;
  3935. var defaults = baseRest(function(object, sources) {
  3936. object = Object(object);
  3937. var index = -1;
  3938. var length = sources.length;
  3939. var guard = length > 2 ? sources[2] : void 0;
  3940. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  3941. length = 1;
  3942. }
  3943. while (++index < length) {
  3944. var source = sources[index];
  3945. var props = keysIn(source);
  3946. var propsIndex = -1;
  3947. var propsLength = props.length;
  3948. while (++propsIndex < propsLength) {
  3949. var key = props[propsIndex];
  3950. var value = object[key];
  3951. if (value === void 0 || eq(value, objectProto$8[key]) && !hasOwnProperty$7.call(object, key)) {
  3952. object[key] = source[key];
  3953. }
  3954. }
  3955. }
  3956. return object;
  3957. });
  3958. function assignMergeValue(object, key, value) {
  3959. if (value !== void 0 && !eq(object[key], value) || value === void 0 && !(key in object)) {
  3960. baseAssignValue(object, key, value);
  3961. }
  3962. }
  3963. function isArrayLikeObject(value) {
  3964. return isObjectLike(value) && isArrayLike(value);
  3965. }
  3966. function safeGet(object, key) {
  3967. if (key === "constructor" && typeof object[key] === "function") {
  3968. return;
  3969. }
  3970. if (key == "__proto__") {
  3971. return;
  3972. }
  3973. return object[key];
  3974. }
  3975. function toPlainObject(value) {
  3976. return copyObject(value, keysIn(value));
  3977. }
  3978. function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
  3979. var objValue = safeGet(object, key), srcValue = safeGet(source, key), stacked = stack.get(srcValue);
  3980. if (stacked) {
  3981. assignMergeValue(object, key, stacked);
  3982. return;
  3983. }
  3984. var newValue = customizer ? customizer(objValue, srcValue, key + "", object, source, stack) : void 0;
  3985. var isCommon = newValue === void 0;
  3986. if (isCommon) {
  3987. var isArr = isArray(srcValue), isBuff = !isArr && isBuffer(srcValue), isTyped = !isArr && !isBuff && isTypedArray(srcValue);
  3988. newValue = srcValue;
  3989. if (isArr || isBuff || isTyped) {
  3990. if (isArray(objValue)) {
  3991. newValue = objValue;
  3992. } else if (isArrayLikeObject(objValue)) {
  3993. newValue = copyArray(objValue);
  3994. } else if (isBuff) {
  3995. isCommon = false;
  3996. newValue = cloneBuffer(srcValue, true);
  3997. } else if (isTyped) {
  3998. isCommon = false;
  3999. newValue = cloneTypedArray(srcValue, true);
  4000. } else {
  4001. newValue = [];
  4002. }
  4003. } else if (isPlainObject(srcValue) || isArguments(srcValue)) {
  4004. newValue = objValue;
  4005. if (isArguments(objValue)) {
  4006. newValue = toPlainObject(objValue);
  4007. } else if (!isObject(objValue) || isFunction(objValue)) {
  4008. newValue = initCloneObject(srcValue);
  4009. }
  4010. } else {
  4011. isCommon = false;
  4012. }
  4013. }
  4014. if (isCommon) {
  4015. stack.set(srcValue, newValue);
  4016. mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
  4017. stack["delete"](srcValue);
  4018. }
  4019. assignMergeValue(object, key, newValue);
  4020. }
  4021. function baseMerge(object, source, srcIndex, customizer, stack) {
  4022. if (object === source) {
  4023. return;
  4024. }
  4025. baseFor(source, function(srcValue, key) {
  4026. stack || (stack = new Stack());
  4027. if (isObject(srcValue)) {
  4028. baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
  4029. } else {
  4030. var newValue = customizer ? customizer(safeGet(object, key), srcValue, key + "", object, source, stack) : void 0;
  4031. if (newValue === void 0) {
  4032. newValue = srcValue;
  4033. }
  4034. assignMergeValue(object, key, newValue);
  4035. }
  4036. }, keysIn);
  4037. }
  4038. function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
  4039. if (isObject(objValue) && isObject(srcValue)) {
  4040. stack.set(srcValue, objValue);
  4041. baseMerge(objValue, srcValue, void 0, customDefaultsMerge, stack);
  4042. stack["delete"](srcValue);
  4043. }
  4044. return objValue;
  4045. }
  4046. var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
  4047. baseMerge(object, source, srcIndex, customizer);
  4048. });
  4049. var defaultsDeep = baseRest(function(args) {
  4050. args.push(void 0, customDefaultsMerge);
  4051. return apply(mergeWith, void 0, args);
  4052. });
  4053. var FUNC_ERROR_TEXT$5 = "Expected a function";
  4054. function baseDelay(func, wait, args) {
  4055. if (typeof func != "function") {
  4056. throw new TypeError(FUNC_ERROR_TEXT$5);
  4057. }
  4058. return setTimeout(function() {
  4059. func.apply(void 0, args);
  4060. }, wait);
  4061. }
  4062. var defer = baseRest(function(func, args) {
  4063. return baseDelay(func, 1, args);
  4064. });
  4065. var delay = baseRest(function(func, wait, args) {
  4066. return baseDelay(func, toNumber(wait) || 0, args);
  4067. });
  4068. function arrayIncludesWith(array, value, comparator) {
  4069. var index = -1, length = array == null ? 0 : array.length;
  4070. while (++index < length) {
  4071. if (comparator(value, array[index])) {
  4072. return true;
  4073. }
  4074. }
  4075. return false;
  4076. }
  4077. var LARGE_ARRAY_SIZE$1 = 200;
  4078. function baseDifference(array, values, iteratee, comparator) {
  4079. var index = -1, includes = arrayIncludes, isCommon = true, length = array.length, result = [], valuesLength = values.length;
  4080. if (!length) {
  4081. return result;
  4082. }
  4083. if (iteratee) {
  4084. values = arrayMap(values, baseUnary(iteratee));
  4085. }
  4086. if (comparator) {
  4087. includes = arrayIncludesWith;
  4088. isCommon = false;
  4089. } else if (values.length >= LARGE_ARRAY_SIZE$1) {
  4090. includes = cacheHas;
  4091. isCommon = false;
  4092. values = new SetCache(values);
  4093. }
  4094. outer:
  4095. while (++index < length) {
  4096. var value = array[index], computed = iteratee == null ? value : iteratee(value);
  4097. value = comparator || value !== 0 ? value : 0;
  4098. if (isCommon && computed === computed) {
  4099. var valuesIndex = valuesLength;
  4100. while (valuesIndex--) {
  4101. if (values[valuesIndex] === computed) {
  4102. continue outer;
  4103. }
  4104. }
  4105. result.push(value);
  4106. } else if (!includes(values, computed, comparator)) {
  4107. result.push(value);
  4108. }
  4109. }
  4110. return result;
  4111. }
  4112. var difference = baseRest(function(array, values) {
  4113. return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true)) : [];
  4114. });
  4115. function last(array) {
  4116. var length = array == null ? 0 : array.length;
  4117. return length ? array[length - 1] : void 0;
  4118. }
  4119. var differenceBy = baseRest(function(array, values) {
  4120. var iteratee = last(values);
  4121. if (isArrayLikeObject(iteratee)) {
  4122. iteratee = void 0;
  4123. }
  4124. return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), baseIteratee(iteratee)) : [];
  4125. });
  4126. var differenceWith = baseRest(function(array, values) {
  4127. var comparator = last(values);
  4128. if (isArrayLikeObject(comparator)) {
  4129. comparator = void 0;
  4130. }
  4131. return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), void 0, comparator) : [];
  4132. });
  4133. var divide = createMathOperation(function(dividend, divisor) {
  4134. return dividend / divisor;
  4135. }, 1);
  4136. function drop(array, n, guard) {
  4137. var length = array == null ? 0 : array.length;
  4138. if (!length) {
  4139. return [];
  4140. }
  4141. n = guard || n === void 0 ? 1 : toInteger(n);
  4142. return baseSlice(array, n < 0 ? 0 : n, length);
  4143. }
  4144. function dropRight(array, n, guard) {
  4145. var length = array == null ? 0 : array.length;
  4146. if (!length) {
  4147. return [];
  4148. }
  4149. n = guard || n === void 0 ? 1 : toInteger(n);
  4150. n = length - n;
  4151. return baseSlice(array, 0, n < 0 ? 0 : n);
  4152. }
  4153. function baseWhile(array, predicate, isDrop, fromRight) {
  4154. var length = array.length, index = fromRight ? length : -1;
  4155. while ((fromRight ? index-- : ++index < length) && predicate(array[index], index, array)) {
  4156. }
  4157. return isDrop ? baseSlice(array, fromRight ? 0 : index, fromRight ? index + 1 : length) : baseSlice(array, fromRight ? index + 1 : 0, fromRight ? length : index);
  4158. }
  4159. function dropRightWhile(array, predicate) {
  4160. return array && array.length ? baseWhile(array, baseIteratee(predicate), true, true) : [];
  4161. }
  4162. function dropWhile(array, predicate) {
  4163. return array && array.length ? baseWhile(array, baseIteratee(predicate), true) : [];
  4164. }
  4165. function castFunction(value) {
  4166. return typeof value == "function" ? value : identity;
  4167. }
  4168. function forEach(collection, iteratee) {
  4169. var func = isArray(collection) ? arrayEach : baseEach;
  4170. return func(collection, castFunction(iteratee));
  4171. }
  4172. function arrayEachRight(array, iteratee) {
  4173. var length = array == null ? 0 : array.length;
  4174. while (length--) {
  4175. if (iteratee(array[length], length, array) === false) {
  4176. break;
  4177. }
  4178. }
  4179. return array;
  4180. }
  4181. var baseForRight = createBaseFor(true);
  4182. function baseForOwnRight(object, iteratee) {
  4183. return object && baseForRight(object, iteratee, keys);
  4184. }
  4185. var baseEachRight = createBaseEach(baseForOwnRight, true);
  4186. function forEachRight(collection, iteratee) {
  4187. var func = isArray(collection) ? arrayEachRight : baseEachRight;
  4188. return func(collection, castFunction(iteratee));
  4189. }
  4190. function endsWith(string, target, position) {
  4191. string = toString(string);
  4192. target = baseToString(target);
  4193. var length = string.length;
  4194. position = position === void 0 ? length : baseClamp(toInteger(position), 0, length);
  4195. var end = position;
  4196. position -= target.length;
  4197. return position >= 0 && string.slice(position, end) == target;
  4198. }
  4199. function baseToPairs(object, props) {
  4200. return arrayMap(props, function(key) {
  4201. return [key, object[key]];
  4202. });
  4203. }
  4204. function setToPairs(set) {
  4205. var index = -1, result = Array(set.size);
  4206. set.forEach(function(value) {
  4207. result[++index] = [value, value];
  4208. });
  4209. return result;
  4210. }
  4211. var mapTag$3 = "[object Map]";
  4212. var setTag$3 = "[object Set]";
  4213. function createToPairs(keysFunc) {
  4214. return function(object) {
  4215. var tag = getTag$1(object);
  4216. if (tag == mapTag$3) {
  4217. return mapToArray(object);
  4218. }
  4219. if (tag == setTag$3) {
  4220. return setToPairs(object);
  4221. }
  4222. return baseToPairs(object, keysFunc(object));
  4223. };
  4224. }
  4225. var toPairs = createToPairs(keys);
  4226. var toPairsIn = createToPairs(keysIn);
  4227. var htmlEscapes = {
  4228. "&": "&amp;",
  4229. "<": "&lt;",
  4230. ">": "&gt;",
  4231. '"': "&quot;",
  4232. "'": "&#39;"
  4233. };
  4234. var escapeHtmlChar = basePropertyOf(htmlEscapes);
  4235. var reUnescapedHtml = /[&<>"']/g;
  4236. var reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
  4237. function escape(string) {
  4238. string = toString(string);
  4239. return string && reHasUnescapedHtml.test(string) ? string.replace(reUnescapedHtml, escapeHtmlChar) : string;
  4240. }
  4241. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
  4242. var reHasRegExpChar = RegExp(reRegExpChar.source);
  4243. function escapeRegExp(string) {
  4244. string = toString(string);
  4245. return string && reHasRegExpChar.test(string) ? string.replace(reRegExpChar, "\\$&") : string;
  4246. }
  4247. function arrayEvery(array, predicate) {
  4248. var index = -1, length = array == null ? 0 : array.length;
  4249. while (++index < length) {
  4250. if (!predicate(array[index], index, array)) {
  4251. return false;
  4252. }
  4253. }
  4254. return true;
  4255. }
  4256. function baseEvery(collection, predicate) {
  4257. var result = true;
  4258. baseEach(collection, function(value, index, collection2) {
  4259. result = !!predicate(value, index, collection2);
  4260. return result;
  4261. });
  4262. return result;
  4263. }
  4264. function every(collection, predicate, guard) {
  4265. var func = isArray(collection) ? arrayEvery : baseEvery;
  4266. if (guard && isIterateeCall(collection, predicate, guard)) {
  4267. predicate = void 0;
  4268. }
  4269. return func(collection, baseIteratee(predicate));
  4270. }
  4271. var MAX_ARRAY_LENGTH$5 = 4294967295;
  4272. function toLength(value) {
  4273. return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH$5) : 0;
  4274. }
  4275. function baseFill(array, value, start, end) {
  4276. var length = array.length;
  4277. start = toInteger(start);
  4278. if (start < 0) {
  4279. start = -start > length ? 0 : length + start;
  4280. }
  4281. end = end === void 0 || end > length ? length : toInteger(end);
  4282. if (end < 0) {
  4283. end += length;
  4284. }
  4285. end = start > end ? 0 : toLength(end);
  4286. while (start < end) {
  4287. array[start++] = value;
  4288. }
  4289. return array;
  4290. }
  4291. function fill(array, value, start, end) {
  4292. var length = array == null ? 0 : array.length;
  4293. if (!length) {
  4294. return [];
  4295. }
  4296. if (start && typeof start != "number" && isIterateeCall(array, value, start)) {
  4297. start = 0;
  4298. end = length;
  4299. }
  4300. return baseFill(array, value, start, end);
  4301. }
  4302. function baseFilter(collection, predicate) {
  4303. var result = [];
  4304. baseEach(collection, function(value, index, collection2) {
  4305. if (predicate(value, index, collection2)) {
  4306. result.push(value);
  4307. }
  4308. });
  4309. return result;
  4310. }
  4311. function filter(collection, predicate) {
  4312. var func = isArray(collection) ? arrayFilter : baseFilter;
  4313. return func(collection, baseIteratee(predicate));
  4314. }
  4315. function createFind(findIndexFunc) {
  4316. return function(collection, predicate, fromIndex) {
  4317. var iterable = Object(collection);
  4318. if (!isArrayLike(collection)) {
  4319. var iteratee = baseIteratee(predicate);
  4320. collection = keys(collection);
  4321. predicate = function(key) {
  4322. return iteratee(iterable[key], key, iterable);
  4323. };
  4324. }
  4325. var index = findIndexFunc(collection, predicate, fromIndex);
  4326. return index > -1 ? iterable[iteratee ? collection[index] : index] : void 0;
  4327. };
  4328. }
  4329. var nativeMax$a = Math.max;
  4330. function findIndex(array, predicate, fromIndex) {
  4331. var length = array == null ? 0 : array.length;
  4332. if (!length) {
  4333. return -1;
  4334. }
  4335. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  4336. if (index < 0) {
  4337. index = nativeMax$a(length + index, 0);
  4338. }
  4339. return baseFindIndex(array, baseIteratee(predicate), index);
  4340. }
  4341. var find = createFind(findIndex);
  4342. function baseFindKey(collection, predicate, eachFunc) {
  4343. var result;
  4344. eachFunc(collection, function(value, key, collection2) {
  4345. if (predicate(value, key, collection2)) {
  4346. result = key;
  4347. return false;
  4348. }
  4349. });
  4350. return result;
  4351. }
  4352. function findKey(object, predicate) {
  4353. return baseFindKey(object, baseIteratee(predicate), baseForOwn);
  4354. }
  4355. var nativeMax$9 = Math.max;
  4356. var nativeMin$a = Math.min;
  4357. function findLastIndex(array, predicate, fromIndex) {
  4358. var length = array == null ? 0 : array.length;
  4359. if (!length) {
  4360. return -1;
  4361. }
  4362. var index = length - 1;
  4363. if (fromIndex !== void 0) {
  4364. index = toInteger(fromIndex);
  4365. index = fromIndex < 0 ? nativeMax$9(length + index, 0) : nativeMin$a(index, length - 1);
  4366. }
  4367. return baseFindIndex(array, baseIteratee(predicate), index, true);
  4368. }
  4369. var findLast = createFind(findLastIndex);
  4370. function findLastKey(object, predicate) {
  4371. return baseFindKey(object, baseIteratee(predicate), baseForOwnRight);
  4372. }
  4373. function head(array) {
  4374. return array && array.length ? array[0] : void 0;
  4375. }
  4376. function baseMap(collection, iteratee) {
  4377. var index = -1, result = isArrayLike(collection) ? Array(collection.length) : [];
  4378. baseEach(collection, function(value, key, collection2) {
  4379. result[++index] = iteratee(value, key, collection2);
  4380. });
  4381. return result;
  4382. }
  4383. function map(collection, iteratee) {
  4384. var func = isArray(collection) ? arrayMap : baseMap;
  4385. return func(collection, baseIteratee(iteratee));
  4386. }
  4387. function flatMap(collection, iteratee) {
  4388. return baseFlatten(map(collection, iteratee), 1);
  4389. }
  4390. var INFINITY$2 = 1 / 0;
  4391. function flatMapDeep(collection, iteratee) {
  4392. return baseFlatten(map(collection, iteratee), INFINITY$2);
  4393. }
  4394. function flatMapDepth(collection, iteratee, depth) {
  4395. depth = depth === void 0 ? 1 : toInteger(depth);
  4396. return baseFlatten(map(collection, iteratee), depth);
  4397. }
  4398. var INFINITY$1 = 1 / 0;
  4399. function flattenDeep(array) {
  4400. var length = array == null ? 0 : array.length;
  4401. return length ? baseFlatten(array, INFINITY$1) : [];
  4402. }
  4403. function flattenDepth(array, depth) {
  4404. var length = array == null ? 0 : array.length;
  4405. if (!length) {
  4406. return [];
  4407. }
  4408. depth = depth === void 0 ? 1 : toInteger(depth);
  4409. return baseFlatten(array, depth);
  4410. }
  4411. var WRAP_FLIP_FLAG = 512;
  4412. function flip$2(func) {
  4413. return createWrap(func, WRAP_FLIP_FLAG);
  4414. }
  4415. var floor$1 = createRound("floor");
  4416. var FUNC_ERROR_TEXT$4 = "Expected a function";
  4417. var WRAP_CURRY_FLAG = 8;
  4418. var WRAP_PARTIAL_FLAG$1 = 32;
  4419. var WRAP_ARY_FLAG = 128;
  4420. var WRAP_REARG_FLAG$1 = 256;
  4421. function createFlow(fromRight) {
  4422. return flatRest(function(funcs) {
  4423. var length = funcs.length, index = length, prereq = LodashWrapper.prototype.thru;
  4424. if (fromRight) {
  4425. funcs.reverse();
  4426. }
  4427. while (index--) {
  4428. var func = funcs[index];
  4429. if (typeof func != "function") {
  4430. throw new TypeError(FUNC_ERROR_TEXT$4);
  4431. }
  4432. if (prereq && !wrapper && getFuncName(func) == "wrapper") {
  4433. var wrapper = new LodashWrapper([], true);
  4434. }
  4435. }
  4436. index = wrapper ? index : length;
  4437. while (++index < length) {
  4438. func = funcs[index];
  4439. var funcName = getFuncName(func), data = funcName == "wrapper" ? getData(func) : void 0;
  4440. 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) {
  4441. wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
  4442. } else {
  4443. wrapper = func.length == 1 && isLaziable(func) ? wrapper[funcName]() : wrapper.thru(func);
  4444. }
  4445. }
  4446. return function() {
  4447. var args = arguments, value = args[0];
  4448. if (wrapper && args.length == 1 && isArray(value)) {
  4449. return wrapper.plant(value).value();
  4450. }
  4451. var index2 = 0, result = length ? funcs[index2].apply(this, args) : value;
  4452. while (++index2 < length) {
  4453. result = funcs[index2].call(this, result);
  4454. }
  4455. return result;
  4456. };
  4457. });
  4458. }
  4459. var flow = createFlow();
  4460. var flowRight = createFlow(true);
  4461. function forIn(object, iteratee) {
  4462. return object == null ? object : baseFor(object, castFunction(iteratee), keysIn);
  4463. }
  4464. function forInRight(object, iteratee) {
  4465. return object == null ? object : baseForRight(object, castFunction(iteratee), keysIn);
  4466. }
  4467. function forOwn(object, iteratee) {
  4468. return object && baseForOwn(object, castFunction(iteratee));
  4469. }
  4470. function forOwnRight(object, iteratee) {
  4471. return object && baseForOwnRight(object, castFunction(iteratee));
  4472. }
  4473. function fromPairs(pairs) {
  4474. var index = -1, length = pairs == null ? 0 : pairs.length, result = {};
  4475. while (++index < length) {
  4476. var pair = pairs[index];
  4477. result[pair[0]] = pair[1];
  4478. }
  4479. return result;
  4480. }
  4481. function baseFunctions(object, props) {
  4482. return arrayFilter(props, function(key) {
  4483. return isFunction(object[key]);
  4484. });
  4485. }
  4486. function functions(object) {
  4487. return object == null ? [] : baseFunctions(object, keys(object));
  4488. }
  4489. function functionsIn(object) {
  4490. return object == null ? [] : baseFunctions(object, keysIn(object));
  4491. }
  4492. var objectProto$7 = Object.prototype;
  4493. var hasOwnProperty$6 = objectProto$7.hasOwnProperty;
  4494. var groupBy = createAggregator(function(result, value, key) {
  4495. if (hasOwnProperty$6.call(result, key)) {
  4496. result[key].push(value);
  4497. } else {
  4498. baseAssignValue(result, key, [value]);
  4499. }
  4500. });
  4501. function baseGt(value, other) {
  4502. return value > other;
  4503. }
  4504. function createRelationalOperation(operator) {
  4505. return function(value, other) {
  4506. if (!(typeof value == "string" && typeof other == "string")) {
  4507. value = toNumber(value);
  4508. other = toNumber(other);
  4509. }
  4510. return operator(value, other);
  4511. };
  4512. }
  4513. var gt$1 = createRelationalOperation(baseGt);
  4514. var gte = createRelationalOperation(function(value, other) {
  4515. return value >= other;
  4516. });
  4517. var objectProto$6 = Object.prototype;
  4518. var hasOwnProperty$5 = objectProto$6.hasOwnProperty;
  4519. function baseHas(object, key) {
  4520. return object != null && hasOwnProperty$5.call(object, key);
  4521. }
  4522. function has(object, path) {
  4523. return object != null && hasPath(object, path, baseHas);
  4524. }
  4525. var nativeMax$8 = Math.max;
  4526. var nativeMin$9 = Math.min;
  4527. function baseInRange(number, start, end) {
  4528. return number >= nativeMin$9(start, end) && number < nativeMax$8(start, end);
  4529. }
  4530. function inRange(number, start, end) {
  4531. start = toFinite(start);
  4532. if (end === void 0) {
  4533. end = start;
  4534. start = 0;
  4535. } else {
  4536. end = toFinite(end);
  4537. }
  4538. number = toNumber(number);
  4539. return baseInRange(number, start, end);
  4540. }
  4541. var stringTag = "[object String]";
  4542. function isString(value) {
  4543. return typeof value == "string" || !isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag;
  4544. }
  4545. function baseValues(object, props) {
  4546. return arrayMap(props, function(key) {
  4547. return object[key];
  4548. });
  4549. }
  4550. function values(object) {
  4551. return object == null ? [] : baseValues(object, keys(object));
  4552. }
  4553. var nativeMax$7 = Math.max;
  4554. function includes(collection, value, fromIndex, guard) {
  4555. collection = isArrayLike(collection) ? collection : values(collection);
  4556. fromIndex = fromIndex && !guard ? toInteger(fromIndex) : 0;
  4557. var length = collection.length;
  4558. if (fromIndex < 0) {
  4559. fromIndex = nativeMax$7(length + fromIndex, 0);
  4560. }
  4561. return isString(collection) ? fromIndex <= length && collection.indexOf(value, fromIndex) > -1 : !!length && baseIndexOf(collection, value, fromIndex) > -1;
  4562. }
  4563. var nativeMax$6 = Math.max;
  4564. function indexOf(array, value, fromIndex) {
  4565. var length = array == null ? 0 : array.length;
  4566. if (!length) {
  4567. return -1;
  4568. }
  4569. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  4570. if (index < 0) {
  4571. index = nativeMax$6(length + index, 0);
  4572. }
  4573. return baseIndexOf(array, value, index);
  4574. }
  4575. function initial$1(array) {
  4576. var length = array == null ? 0 : array.length;
  4577. return length ? baseSlice(array, 0, -1) : [];
  4578. }
  4579. var nativeMin$8 = Math.min;
  4580. function baseIntersection(arrays, iteratee, comparator) {
  4581. var includes = comparator ? arrayIncludesWith : arrayIncludes, length = arrays[0].length, othLength = arrays.length, othIndex = othLength, caches = Array(othLength), maxLength = Infinity, result = [];
  4582. while (othIndex--) {
  4583. var array = arrays[othIndex];
  4584. if (othIndex && iteratee) {
  4585. array = arrayMap(array, baseUnary(iteratee));
  4586. }
  4587. maxLength = nativeMin$8(array.length, maxLength);
  4588. caches[othIndex] = !comparator && (iteratee || length >= 120 && array.length >= 120) ? new SetCache(othIndex && array) : void 0;
  4589. }
  4590. array = arrays[0];
  4591. var index = -1, seen = caches[0];
  4592. outer:
  4593. while (++index < length && result.length < maxLength) {
  4594. var value = array[index], computed = iteratee ? iteratee(value) : value;
  4595. value = comparator || value !== 0 ? value : 0;
  4596. if (!(seen ? cacheHas(seen, computed) : includes(result, computed, comparator))) {
  4597. othIndex = othLength;
  4598. while (--othIndex) {
  4599. var cache = caches[othIndex];
  4600. if (!(cache ? cacheHas(cache, computed) : includes(arrays[othIndex], computed, comparator))) {
  4601. continue outer;
  4602. }
  4603. }
  4604. if (seen) {
  4605. seen.push(computed);
  4606. }
  4607. result.push(value);
  4608. }
  4609. }
  4610. return result;
  4611. }
  4612. function castArrayLikeObject(value) {
  4613. return isArrayLikeObject(value) ? value : [];
  4614. }
  4615. var intersection = baseRest(function(arrays) {
  4616. var mapped = arrayMap(arrays, castArrayLikeObject);
  4617. return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped) : [];
  4618. });
  4619. var intersectionBy = baseRest(function(arrays) {
  4620. var iteratee = last(arrays), mapped = arrayMap(arrays, castArrayLikeObject);
  4621. if (iteratee === last(mapped)) {
  4622. iteratee = void 0;
  4623. } else {
  4624. mapped.pop();
  4625. }
  4626. return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, baseIteratee(iteratee)) : [];
  4627. });
  4628. var intersectionWith = baseRest(function(arrays) {
  4629. var comparator = last(arrays), mapped = arrayMap(arrays, castArrayLikeObject);
  4630. comparator = typeof comparator == "function" ? comparator : void 0;
  4631. if (comparator) {
  4632. mapped.pop();
  4633. }
  4634. return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, void 0, comparator) : [];
  4635. });
  4636. function baseInverter(object, setter, iteratee, accumulator) {
  4637. baseForOwn(object, function(value, key, object2) {
  4638. setter(accumulator, iteratee(value), key, object2);
  4639. });
  4640. return accumulator;
  4641. }
  4642. function createInverter(setter, toIteratee) {
  4643. return function(object, iteratee) {
  4644. return baseInverter(object, setter, toIteratee(iteratee), {});
  4645. };
  4646. }
  4647. var objectProto$5 = Object.prototype;
  4648. var nativeObjectToString$1 = objectProto$5.toString;
  4649. var invert = createInverter(function(result, value, key) {
  4650. if (value != null && typeof value.toString != "function") {
  4651. value = nativeObjectToString$1.call(value);
  4652. }
  4653. result[value] = key;
  4654. }, constant(identity));
  4655. var objectProto$4 = Object.prototype;
  4656. var hasOwnProperty$4 = objectProto$4.hasOwnProperty;
  4657. var nativeObjectToString = objectProto$4.toString;
  4658. var invertBy = createInverter(function(result, value, key) {
  4659. if (value != null && typeof value.toString != "function") {
  4660. value = nativeObjectToString.call(value);
  4661. }
  4662. if (hasOwnProperty$4.call(result, value)) {
  4663. result[value].push(key);
  4664. } else {
  4665. result[value] = [key];
  4666. }
  4667. }, baseIteratee);
  4668. function parent(object, path) {
  4669. return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
  4670. }
  4671. function baseInvoke(object, path, args) {
  4672. path = castPath(path, object);
  4673. object = parent(object, path);
  4674. var func = object == null ? object : object[toKey(last(path))];
  4675. return func == null ? void 0 : apply(func, object, args);
  4676. }
  4677. var invoke = baseRest(baseInvoke);
  4678. var invokeMap = baseRest(function(collection, path, args) {
  4679. var index = -1, isFunc = typeof path == "function", result = isArrayLike(collection) ? Array(collection.length) : [];
  4680. baseEach(collection, function(value) {
  4681. result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
  4682. });
  4683. return result;
  4684. });
  4685. var arrayBufferTag = "[object ArrayBuffer]";
  4686. function baseIsArrayBuffer(value) {
  4687. return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;
  4688. }
  4689. var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer;
  4690. var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
  4691. var boolTag = "[object Boolean]";
  4692. function isBoolean$1(value) {
  4693. return value === true || value === false || isObjectLike(value) && baseGetTag(value) == boolTag;
  4694. }
  4695. var dateTag = "[object Date]";
  4696. function baseIsDate(value) {
  4697. return isObjectLike(value) && baseGetTag(value) == dateTag;
  4698. }
  4699. var nodeIsDate = nodeUtil && nodeUtil.isDate;
  4700. var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
  4701. function isElement$3(value) {
  4702. return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
  4703. }
  4704. var mapTag$2 = "[object Map]";
  4705. var setTag$2 = "[object Set]";
  4706. var objectProto$3 = Object.prototype;
  4707. var hasOwnProperty$3 = objectProto$3.hasOwnProperty;
  4708. function isEmpty$1(value) {
  4709. if (value == null) {
  4710. return true;
  4711. }
  4712. if (isArrayLike(value) && (isArray(value) || typeof value == "string" || typeof value.splice == "function" || isBuffer(value) || isTypedArray(value) || isArguments(value))) {
  4713. return !value.length;
  4714. }
  4715. var tag = getTag$1(value);
  4716. if (tag == mapTag$2 || tag == setTag$2) {
  4717. return !value.size;
  4718. }
  4719. if (isPrototype(value)) {
  4720. return !baseKeys(value).length;
  4721. }
  4722. for (var key in value) {
  4723. if (hasOwnProperty$3.call(value, key)) {
  4724. return false;
  4725. }
  4726. }
  4727. return true;
  4728. }
  4729. function isEqual$1(value, other) {
  4730. return baseIsEqual(value, other);
  4731. }
  4732. function isEqualWith(value, other, customizer) {
  4733. customizer = typeof customizer == "function" ? customizer : void 0;
  4734. var result = customizer ? customizer(value, other) : void 0;
  4735. return result === void 0 ? baseIsEqual(value, other, void 0, customizer) : !!result;
  4736. }
  4737. var nativeIsFinite = root.isFinite;
  4738. function isFinite(value) {
  4739. return typeof value == "number" && nativeIsFinite(value);
  4740. }
  4741. function isInteger(value) {
  4742. return typeof value == "number" && value == toInteger(value);
  4743. }
  4744. function isMatch(object, source) {
  4745. return object === source || baseIsMatch(object, source, getMatchData(source));
  4746. }
  4747. function isMatchWith(object, source, customizer) {
  4748. customizer = typeof customizer == "function" ? customizer : void 0;
  4749. return baseIsMatch(object, source, getMatchData(source), customizer);
  4750. }
  4751. var numberTag = "[object Number]";
  4752. function isNumber$1(value) {
  4753. return typeof value == "number" || isObjectLike(value) && baseGetTag(value) == numberTag;
  4754. }
  4755. function isNaN$1(value) {
  4756. return isNumber$1(value) && value != +value;
  4757. }
  4758. var isMaskable = coreJsData ? isFunction : stubFalse;
  4759. var CORE_ERROR_TEXT = "Unsupported core-js use. Try https://npms.io/search?q=ponyfill.";
  4760. function isNative(value) {
  4761. if (isMaskable(value)) {
  4762. throw new Error(CORE_ERROR_TEXT);
  4763. }
  4764. return baseIsNative(value);
  4765. }
  4766. function isNil(value) {
  4767. return value == null;
  4768. }
  4769. function isNull(value) {
  4770. return value === null;
  4771. }
  4772. var regexpTag = "[object RegExp]";
  4773. function baseIsRegExp(value) {
  4774. return isObjectLike(value) && baseGetTag(value) == regexpTag;
  4775. }
  4776. var nodeIsRegExp = nodeUtil && nodeUtil.isRegExp;
  4777. var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
  4778. var MAX_SAFE_INTEGER$3 = 9007199254740991;
  4779. function isSafeInteger(value) {
  4780. return isInteger(value) && value >= -MAX_SAFE_INTEGER$3 && value <= MAX_SAFE_INTEGER$3;
  4781. }
  4782. function isUndefined$1(value) {
  4783. return value === void 0;
  4784. }
  4785. var weakMapTag = "[object WeakMap]";
  4786. function isWeakMap(value) {
  4787. return isObjectLike(value) && getTag$1(value) == weakMapTag;
  4788. }
  4789. var weakSetTag = "[object WeakSet]";
  4790. function isWeakSet(value) {
  4791. return isObjectLike(value) && baseGetTag(value) == weakSetTag;
  4792. }
  4793. var CLONE_DEEP_FLAG$3 = 1;
  4794. function iteratee(func) {
  4795. return baseIteratee(typeof func == "function" ? func : baseClone(func, CLONE_DEEP_FLAG$3));
  4796. }
  4797. var arrayProto$4 = Array.prototype;
  4798. var nativeJoin = arrayProto$4.join;
  4799. function join(array, separator) {
  4800. return array == null ? "" : nativeJoin.call(array, separator);
  4801. }
  4802. var kebabCase = createCompounder(function(result, word, index) {
  4803. return result + (index ? "-" : "") + word.toLowerCase();
  4804. });
  4805. var keyBy = createAggregator(function(result, value, key) {
  4806. baseAssignValue(result, key, value);
  4807. });
  4808. function strictLastIndexOf(array, value, fromIndex) {
  4809. var index = fromIndex + 1;
  4810. while (index--) {
  4811. if (array[index] === value) {
  4812. return index;
  4813. }
  4814. }
  4815. return index;
  4816. }
  4817. var nativeMax$5 = Math.max;
  4818. var nativeMin$7 = Math.min;
  4819. function lastIndexOf(array, value, fromIndex) {
  4820. var length = array == null ? 0 : array.length;
  4821. if (!length) {
  4822. return -1;
  4823. }
  4824. var index = length;
  4825. if (fromIndex !== void 0) {
  4826. index = toInteger(fromIndex);
  4827. index = index < 0 ? nativeMax$5(length + index, 0) : nativeMin$7(index, length - 1);
  4828. }
  4829. return value === value ? strictLastIndexOf(array, value, index) : baseFindIndex(array, baseIsNaN, index, true);
  4830. }
  4831. var lowerCase = createCompounder(function(result, word, index) {
  4832. return result + (index ? " " : "") + word.toLowerCase();
  4833. });
  4834. var lowerFirst = createCaseFirst("toLowerCase");
  4835. function baseLt(value, other) {
  4836. return value < other;
  4837. }
  4838. var lt$1 = createRelationalOperation(baseLt);
  4839. var lte = createRelationalOperation(function(value, other) {
  4840. return value <= other;
  4841. });
  4842. function mapKeys(object, iteratee) {
  4843. var result = {};
  4844. iteratee = baseIteratee(iteratee);
  4845. baseForOwn(object, function(value, key, object2) {
  4846. baseAssignValue(result, iteratee(value, key, object2), value);
  4847. });
  4848. return result;
  4849. }
  4850. function mapValues(object, iteratee) {
  4851. var result = {};
  4852. iteratee = baseIteratee(iteratee);
  4853. baseForOwn(object, function(value, key, object2) {
  4854. baseAssignValue(result, key, iteratee(value, key, object2));
  4855. });
  4856. return result;
  4857. }
  4858. var CLONE_DEEP_FLAG$2 = 1;
  4859. function matches(source) {
  4860. return baseMatches(baseClone(source, CLONE_DEEP_FLAG$2));
  4861. }
  4862. var CLONE_DEEP_FLAG$1 = 1;
  4863. function matchesProperty(path, srcValue) {
  4864. return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG$1));
  4865. }
  4866. function baseExtremum(array, iteratee, comparator) {
  4867. var index = -1, length = array.length;
  4868. while (++index < length) {
  4869. var value = array[index], current = iteratee(value);
  4870. if (current != null && (computed === void 0 ? current === current && !isSymbol(current) : comparator(current, computed))) {
  4871. var computed = current, result = value;
  4872. }
  4873. }
  4874. return result;
  4875. }
  4876. function max$4(array) {
  4877. return array && array.length ? baseExtremum(array, identity, baseGt) : void 0;
  4878. }
  4879. function maxBy(array, iteratee) {
  4880. return array && array.length ? baseExtremum(array, baseIteratee(iteratee), baseGt) : void 0;
  4881. }
  4882. function baseSum(array, iteratee) {
  4883. var result, index = -1, length = array.length;
  4884. while (++index < length) {
  4885. var current = iteratee(array[index]);
  4886. if (current !== void 0) {
  4887. result = result === void 0 ? current : result + current;
  4888. }
  4889. }
  4890. return result;
  4891. }
  4892. var NAN = 0 / 0;
  4893. function baseMean(array, iteratee) {
  4894. var length = array == null ? 0 : array.length;
  4895. return length ? baseSum(array, iteratee) / length : NAN;
  4896. }
  4897. function mean(array) {
  4898. return baseMean(array, identity);
  4899. }
  4900. function meanBy(array, iteratee) {
  4901. return baseMean(array, baseIteratee(iteratee));
  4902. }
  4903. var merge = createAssigner(function(object, source, srcIndex) {
  4904. baseMerge(object, source, srcIndex);
  4905. });
  4906. var method = baseRest(function(path, args) {
  4907. return function(object) {
  4908. return baseInvoke(object, path, args);
  4909. };
  4910. });
  4911. var methodOf = baseRest(function(object, args) {
  4912. return function(path) {
  4913. return baseInvoke(object, path, args);
  4914. };
  4915. });
  4916. function min$4(array) {
  4917. return array && array.length ? baseExtremum(array, identity, baseLt) : void 0;
  4918. }
  4919. function minBy(array, iteratee) {
  4920. return array && array.length ? baseExtremum(array, baseIteratee(iteratee), baseLt) : void 0;
  4921. }
  4922. function mixin$1(object, source, options) {
  4923. var props = keys(source), methodNames = baseFunctions(source, props);
  4924. var chain = !(isObject(options) && "chain" in options) || !!options.chain, isFunc = isFunction(object);
  4925. arrayEach(methodNames, function(methodName) {
  4926. var func = source[methodName];
  4927. object[methodName] = func;
  4928. if (isFunc) {
  4929. object.prototype[methodName] = function() {
  4930. var chainAll = this.__chain__;
  4931. if (chain || chainAll) {
  4932. var result = object(this.__wrapped__), actions = result.__actions__ = copyArray(this.__actions__);
  4933. actions.push({ "func": func, "args": arguments, "thisArg": object });
  4934. result.__chain__ = chainAll;
  4935. return result;
  4936. }
  4937. return func.apply(object, arrayPush([this.value()], arguments));
  4938. };
  4939. }
  4940. });
  4941. return object;
  4942. }
  4943. var multiply = createMathOperation(function(multiplier, multiplicand) {
  4944. return multiplier * multiplicand;
  4945. }, 1);
  4946. var FUNC_ERROR_TEXT$3 = "Expected a function";
  4947. function negate(predicate) {
  4948. if (typeof predicate != "function") {
  4949. throw new TypeError(FUNC_ERROR_TEXT$3);
  4950. }
  4951. return function() {
  4952. var args = arguments;
  4953. switch (args.length) {
  4954. case 0:
  4955. return !predicate.call(this);
  4956. case 1:
  4957. return !predicate.call(this, args[0]);
  4958. case 2:
  4959. return !predicate.call(this, args[0], args[1]);
  4960. case 3:
  4961. return !predicate.call(this, args[0], args[1], args[2]);
  4962. }
  4963. return !predicate.apply(this, args);
  4964. };
  4965. }
  4966. function iteratorToArray(iterator) {
  4967. var data, result = [];
  4968. while (!(data = iterator.next()).done) {
  4969. result.push(data.value);
  4970. }
  4971. return result;
  4972. }
  4973. var mapTag$1 = "[object Map]";
  4974. var setTag$1 = "[object Set]";
  4975. var symIterator$1 = Symbol$1 ? Symbol$1.iterator : void 0;
  4976. function toArray(value) {
  4977. if (!value) {
  4978. return [];
  4979. }
  4980. if (isArrayLike(value)) {
  4981. return isString(value) ? stringToArray(value) : copyArray(value);
  4982. }
  4983. if (symIterator$1 && value[symIterator$1]) {
  4984. return iteratorToArray(value[symIterator$1]());
  4985. }
  4986. var tag = getTag$1(value), func = tag == mapTag$1 ? mapToArray : tag == setTag$1 ? setToArray : values;
  4987. return func(value);
  4988. }
  4989. function wrapperNext() {
  4990. if (this.__values__ === void 0) {
  4991. this.__values__ = toArray(this.value());
  4992. }
  4993. var done = this.__index__ >= this.__values__.length, value = done ? void 0 : this.__values__[this.__index__++];
  4994. return { "done": done, "value": value };
  4995. }
  4996. function baseNth(array, n) {
  4997. var length = array.length;
  4998. if (!length) {
  4999. return;
  5000. }
  5001. n += n < 0 ? length : 0;
  5002. return isIndex(n, length) ? array[n] : void 0;
  5003. }
  5004. function nth(array, n) {
  5005. return array && array.length ? baseNth(array, toInteger(n)) : void 0;
  5006. }
  5007. function nthArg(n) {
  5008. n = toInteger(n);
  5009. return baseRest(function(args) {
  5010. return baseNth(args, n);
  5011. });
  5012. }
  5013. function baseUnset(object, path) {
  5014. path = castPath(path, object);
  5015. object = parent(object, path);
  5016. return object == null || delete object[toKey(last(path))];
  5017. }
  5018. function customOmitClone(value) {
  5019. return isPlainObject(value) ? void 0 : value;
  5020. }
  5021. var CLONE_DEEP_FLAG = 1;
  5022. var CLONE_FLAT_FLAG = 2;
  5023. var CLONE_SYMBOLS_FLAG = 4;
  5024. var omit = flatRest(function(object, paths) {
  5025. var result = {};
  5026. if (object == null) {
  5027. return result;
  5028. }
  5029. var isDeep = false;
  5030. paths = arrayMap(paths, function(path) {
  5031. path = castPath(path, object);
  5032. isDeep || (isDeep = path.length > 1);
  5033. return path;
  5034. });
  5035. copyObject(object, getAllKeysIn(object), result);
  5036. if (isDeep) {
  5037. result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
  5038. }
  5039. var length = paths.length;
  5040. while (length--) {
  5041. baseUnset(result, paths[length]);
  5042. }
  5043. return result;
  5044. });
  5045. function baseSet(object, path, value, customizer) {
  5046. if (!isObject(object)) {
  5047. return object;
  5048. }
  5049. path = castPath(path, object);
  5050. var index = -1, length = path.length, lastIndex = length - 1, nested = object;
  5051. while (nested != null && ++index < length) {
  5052. var key = toKey(path[index]), newValue = value;
  5053. if (key === "__proto__" || key === "constructor" || key === "prototype") {
  5054. return object;
  5055. }
  5056. if (index != lastIndex) {
  5057. var objValue = nested[key];
  5058. newValue = customizer ? customizer(objValue, key, nested) : void 0;
  5059. if (newValue === void 0) {
  5060. newValue = isObject(objValue) ? objValue : isIndex(path[index + 1]) ? [] : {};
  5061. }
  5062. }
  5063. assignValue(nested, key, newValue);
  5064. nested = nested[key];
  5065. }
  5066. return object;
  5067. }
  5068. function basePickBy(object, paths, predicate) {
  5069. var index = -1, length = paths.length, result = {};
  5070. while (++index < length) {
  5071. var path = paths[index], value = baseGet(object, path);
  5072. if (predicate(value, path)) {
  5073. baseSet(result, castPath(path, object), value);
  5074. }
  5075. }
  5076. return result;
  5077. }
  5078. function pickBy(object, predicate) {
  5079. if (object == null) {
  5080. return {};
  5081. }
  5082. var props = arrayMap(getAllKeysIn(object), function(prop) {
  5083. return [prop];
  5084. });
  5085. predicate = baseIteratee(predicate);
  5086. return basePickBy(object, props, function(value, path) {
  5087. return predicate(value, path[0]);
  5088. });
  5089. }
  5090. function omitBy(object, predicate) {
  5091. return pickBy(object, negate(baseIteratee(predicate)));
  5092. }
  5093. function once(func) {
  5094. return before(2, func);
  5095. }
  5096. function baseSortBy(array, comparer) {
  5097. var length = array.length;
  5098. array.sort(comparer);
  5099. while (length--) {
  5100. array[length] = array[length].value;
  5101. }
  5102. return array;
  5103. }
  5104. function compareAscending(value, other) {
  5105. if (value !== other) {
  5106. var valIsDefined = value !== void 0, valIsNull = value === null, valIsReflexive = value === value, valIsSymbol = isSymbol(value);
  5107. var othIsDefined = other !== void 0, othIsNull = other === null, othIsReflexive = other === other, othIsSymbol = isSymbol(other);
  5108. if (!othIsNull && !othIsSymbol && !valIsSymbol && value > other || valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol || valIsNull && othIsDefined && othIsReflexive || !valIsDefined && othIsReflexive || !valIsReflexive) {
  5109. return 1;
  5110. }
  5111. if (!valIsNull && !valIsSymbol && !othIsSymbol && value < other || othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol || othIsNull && valIsDefined && valIsReflexive || !othIsDefined && valIsReflexive || !othIsReflexive) {
  5112. return -1;
  5113. }
  5114. }
  5115. return 0;
  5116. }
  5117. function compareMultiple(object, other, orders) {
  5118. var index = -1, objCriteria = object.criteria, othCriteria = other.criteria, length = objCriteria.length, ordersLength = orders.length;
  5119. while (++index < length) {
  5120. var result = compareAscending(objCriteria[index], othCriteria[index]);
  5121. if (result) {
  5122. if (index >= ordersLength) {
  5123. return result;
  5124. }
  5125. var order = orders[index];
  5126. return result * (order == "desc" ? -1 : 1);
  5127. }
  5128. }
  5129. return object.index - other.index;
  5130. }
  5131. function baseOrderBy(collection, iteratees, orders) {
  5132. if (iteratees.length) {
  5133. iteratees = arrayMap(iteratees, function(iteratee) {
  5134. if (isArray(iteratee)) {
  5135. return function(value) {
  5136. return baseGet(value, iteratee.length === 1 ? iteratee[0] : iteratee);
  5137. };
  5138. }
  5139. return iteratee;
  5140. });
  5141. } else {
  5142. iteratees = [identity];
  5143. }
  5144. var index = -1;
  5145. iteratees = arrayMap(iteratees, baseUnary(baseIteratee));
  5146. var result = baseMap(collection, function(value, key, collection2) {
  5147. var criteria = arrayMap(iteratees, function(iteratee) {
  5148. return iteratee(value);
  5149. });
  5150. return { "criteria": criteria, "index": ++index, "value": value };
  5151. });
  5152. return baseSortBy(result, function(object, other) {
  5153. return compareMultiple(object, other, orders);
  5154. });
  5155. }
  5156. function orderBy$1(collection, iteratees, orders, guard) {
  5157. if (collection == null) {
  5158. return [];
  5159. }
  5160. if (!isArray(iteratees)) {
  5161. iteratees = iteratees == null ? [] : [iteratees];
  5162. }
  5163. orders = guard ? void 0 : orders;
  5164. if (!isArray(orders)) {
  5165. orders = orders == null ? [] : [orders];
  5166. }
  5167. return baseOrderBy(collection, iteratees, orders);
  5168. }
  5169. function createOver(arrayFunc) {
  5170. return flatRest(function(iteratees) {
  5171. iteratees = arrayMap(iteratees, baseUnary(baseIteratee));
  5172. return baseRest(function(args) {
  5173. var thisArg = this;
  5174. return arrayFunc(iteratees, function(iteratee) {
  5175. return apply(iteratee, thisArg, args);
  5176. });
  5177. });
  5178. });
  5179. }
  5180. var over = createOver(arrayMap);
  5181. var castRest = baseRest;
  5182. var nativeMin$6 = Math.min;
  5183. var overArgs = castRest(function(func, transforms) {
  5184. transforms = transforms.length == 1 && isArray(transforms[0]) ? arrayMap(transforms[0], baseUnary(baseIteratee)) : arrayMap(baseFlatten(transforms, 1), baseUnary(baseIteratee));
  5185. var funcsLength = transforms.length;
  5186. return baseRest(function(args) {
  5187. var index = -1, length = nativeMin$6(args.length, funcsLength);
  5188. while (++index < length) {
  5189. args[index] = transforms[index].call(this, args[index]);
  5190. }
  5191. return apply(func, this, args);
  5192. });
  5193. });
  5194. var overEvery = createOver(arrayEvery);
  5195. var overSome = createOver(arraySome);
  5196. var MAX_SAFE_INTEGER$2 = 9007199254740991;
  5197. var nativeFloor$3 = Math.floor;
  5198. function baseRepeat(string, n) {
  5199. var result = "";
  5200. if (!string || n < 1 || n > MAX_SAFE_INTEGER$2) {
  5201. return result;
  5202. }
  5203. do {
  5204. if (n % 2) {
  5205. result += string;
  5206. }
  5207. n = nativeFloor$3(n / 2);
  5208. if (n) {
  5209. string += string;
  5210. }
  5211. } while (n);
  5212. return result;
  5213. }
  5214. var asciiSize = baseProperty("length");
  5215. var rsAstralRange = "\\ud800-\\udfff";
  5216. var rsComboMarksRange = "\\u0300-\\u036f";
  5217. var reComboHalfMarksRange = "\\ufe20-\\ufe2f";
  5218. var rsComboSymbolsRange = "\\u20d0-\\u20ff";
  5219. var rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange;
  5220. var rsVarRange = "\\ufe0e\\ufe0f";
  5221. var rsAstral = "[" + rsAstralRange + "]";
  5222. var rsCombo = "[" + rsComboRange + "]";
  5223. var rsFitz = "\\ud83c[\\udffb-\\udfff]";
  5224. var rsModifier = "(?:" + rsCombo + "|" + rsFitz + ")";
  5225. var rsNonAstral = "[^" + rsAstralRange + "]";
  5226. var rsRegional = "(?:\\ud83c[\\udde6-\\uddff]){2}";
  5227. var rsSurrPair = "[\\ud800-\\udbff][\\udc00-\\udfff]";
  5228. var rsZWJ = "\\u200d";
  5229. var reOptMod = rsModifier + "?";
  5230. var rsOptVar = "[" + rsVarRange + "]?";
  5231. var rsOptJoin = "(?:" + rsZWJ + "(?:" + [rsNonAstral, rsRegional, rsSurrPair].join("|") + ")" + rsOptVar + reOptMod + ")*";
  5232. var rsSeq = rsOptVar + reOptMod + rsOptJoin;
  5233. var rsSymbol = "(?:" + [rsNonAstral + rsCombo + "?", rsCombo, rsRegional, rsSurrPair, rsAstral].join("|") + ")";
  5234. var reUnicode = RegExp(rsFitz + "(?=" + rsFitz + ")|" + rsSymbol + rsSeq, "g");
  5235. function unicodeSize(string) {
  5236. var result = reUnicode.lastIndex = 0;
  5237. while (reUnicode.test(string)) {
  5238. ++result;
  5239. }
  5240. return result;
  5241. }
  5242. function stringSize(string) {
  5243. return hasUnicode(string) ? unicodeSize(string) : asciiSize(string);
  5244. }
  5245. var nativeCeil$2 = Math.ceil;
  5246. function createPadding(length, chars) {
  5247. chars = chars === void 0 ? " " : baseToString(chars);
  5248. var charsLength = chars.length;
  5249. if (charsLength < 2) {
  5250. return charsLength ? baseRepeat(chars, length) : chars;
  5251. }
  5252. var result = baseRepeat(chars, nativeCeil$2(length / stringSize(chars)));
  5253. return hasUnicode(chars) ? castSlice(stringToArray(result), 0, length).join("") : result.slice(0, length);
  5254. }
  5255. var nativeCeil$1 = Math.ceil;
  5256. var nativeFloor$2 = Math.floor;
  5257. function pad(string, length, chars) {
  5258. string = toString(string);
  5259. length = toInteger(length);
  5260. var strLength = length ? stringSize(string) : 0;
  5261. if (!length || strLength >= length) {
  5262. return string;
  5263. }
  5264. var mid = (length - strLength) / 2;
  5265. return createPadding(nativeFloor$2(mid), chars) + string + createPadding(nativeCeil$1(mid), chars);
  5266. }
  5267. function padEnd(string, length, chars) {
  5268. string = toString(string);
  5269. length = toInteger(length);
  5270. var strLength = length ? stringSize(string) : 0;
  5271. return length && strLength < length ? string + createPadding(length - strLength, chars) : string;
  5272. }
  5273. function padStart(string, length, chars) {
  5274. string = toString(string);
  5275. length = toInteger(length);
  5276. var strLength = length ? stringSize(string) : 0;
  5277. return length && strLength < length ? createPadding(length - strLength, chars) + string : string;
  5278. }
  5279. var reTrimStart$1 = /^\s+/;
  5280. var nativeParseInt = root.parseInt;
  5281. function parseInt$1(string, radix, guard) {
  5282. if (guard || radix == null) {
  5283. radix = 0;
  5284. } else if (radix) {
  5285. radix = +radix;
  5286. }
  5287. return nativeParseInt(toString(string).replace(reTrimStart$1, ""), radix || 0);
  5288. }
  5289. var WRAP_PARTIAL_FLAG = 32;
  5290. var partial = baseRest(function(func, partials) {
  5291. var holders = replaceHolders(partials, getHolder(partial));
  5292. return createWrap(func, WRAP_PARTIAL_FLAG, void 0, partials, holders);
  5293. });
  5294. partial.placeholder = {};
  5295. var WRAP_PARTIAL_RIGHT_FLAG = 64;
  5296. var partialRight = baseRest(function(func, partials) {
  5297. var holders = replaceHolders(partials, getHolder(partialRight));
  5298. return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, void 0, partials, holders);
  5299. });
  5300. partialRight.placeholder = {};
  5301. var partition = createAggregator(function(result, value, key) {
  5302. result[key ? 0 : 1].push(value);
  5303. }, function() {
  5304. return [[], []];
  5305. });
  5306. function basePick(object, paths) {
  5307. return basePickBy(object, paths, function(value, path) {
  5308. return hasIn(object, path);
  5309. });
  5310. }
  5311. var pick = flatRest(function(object, paths) {
  5312. return object == null ? {} : basePick(object, paths);
  5313. });
  5314. function wrapperPlant(value) {
  5315. var result, parent = this;
  5316. while (parent instanceof baseLodash) {
  5317. var clone = wrapperClone(parent);
  5318. clone.__index__ = 0;
  5319. clone.__values__ = void 0;
  5320. if (result) {
  5321. previous.__wrapped__ = clone;
  5322. } else {
  5323. result = clone;
  5324. }
  5325. var previous = clone;
  5326. parent = parent.__wrapped__;
  5327. }
  5328. previous.__wrapped__ = value;
  5329. return result;
  5330. }
  5331. function propertyOf(object) {
  5332. return function(path) {
  5333. return object == null ? void 0 : baseGet(object, path);
  5334. };
  5335. }
  5336. function baseIndexOfWith(array, value, fromIndex, comparator) {
  5337. var index = fromIndex - 1, length = array.length;
  5338. while (++index < length) {
  5339. if (comparator(array[index], value)) {
  5340. return index;
  5341. }
  5342. }
  5343. return -1;
  5344. }
  5345. var arrayProto$3 = Array.prototype;
  5346. var splice$1 = arrayProto$3.splice;
  5347. function basePullAll(array, values, iteratee, comparator) {
  5348. var indexOf = comparator ? baseIndexOfWith : baseIndexOf, index = -1, length = values.length, seen = array;
  5349. if (array === values) {
  5350. values = copyArray(values);
  5351. }
  5352. if (iteratee) {
  5353. seen = arrayMap(array, baseUnary(iteratee));
  5354. }
  5355. while (++index < length) {
  5356. var fromIndex = 0, value = values[index], computed = iteratee ? iteratee(value) : value;
  5357. while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
  5358. if (seen !== array) {
  5359. splice$1.call(seen, fromIndex, 1);
  5360. }
  5361. splice$1.call(array, fromIndex, 1);
  5362. }
  5363. }
  5364. return array;
  5365. }
  5366. function pullAll(array, values) {
  5367. return array && array.length && values && values.length ? basePullAll(array, values) : array;
  5368. }
  5369. var pull = baseRest(pullAll);
  5370. function pullAllBy(array, values, iteratee) {
  5371. return array && array.length && values && values.length ? basePullAll(array, values, baseIteratee(iteratee)) : array;
  5372. }
  5373. function pullAllWith(array, values, comparator) {
  5374. return array && array.length && values && values.length ? basePullAll(array, values, void 0, comparator) : array;
  5375. }
  5376. var arrayProto$2 = Array.prototype;
  5377. var splice = arrayProto$2.splice;
  5378. function basePullAt(array, indexes) {
  5379. var length = array ? indexes.length : 0, lastIndex = length - 1;
  5380. while (length--) {
  5381. var index = indexes[length];
  5382. if (length == lastIndex || index !== previous) {
  5383. var previous = index;
  5384. if (isIndex(index)) {
  5385. splice.call(array, index, 1);
  5386. } else {
  5387. baseUnset(array, index);
  5388. }
  5389. }
  5390. }
  5391. return array;
  5392. }
  5393. var pullAt = flatRest(function(array, indexes) {
  5394. var length = array == null ? 0 : array.length, result = baseAt(array, indexes);
  5395. basePullAt(array, arrayMap(indexes, function(index) {
  5396. return isIndex(index, length) ? +index : index;
  5397. }).sort(compareAscending));
  5398. return result;
  5399. });
  5400. var nativeFloor$1 = Math.floor;
  5401. var nativeRandom$1 = Math.random;
  5402. function baseRandom(lower, upper) {
  5403. return lower + nativeFloor$1(nativeRandom$1() * (upper - lower + 1));
  5404. }
  5405. var freeParseFloat = parseFloat;
  5406. var nativeMin$5 = Math.min;
  5407. var nativeRandom = Math.random;
  5408. function random(lower, upper, floating) {
  5409. if (floating && typeof floating != "boolean" && isIterateeCall(lower, upper, floating)) {
  5410. upper = floating = void 0;
  5411. }
  5412. if (floating === void 0) {
  5413. if (typeof upper == "boolean") {
  5414. floating = upper;
  5415. upper = void 0;
  5416. } else if (typeof lower == "boolean") {
  5417. floating = lower;
  5418. lower = void 0;
  5419. }
  5420. }
  5421. if (lower === void 0 && upper === void 0) {
  5422. lower = 0;
  5423. upper = 1;
  5424. } else {
  5425. lower = toFinite(lower);
  5426. if (upper === void 0) {
  5427. upper = lower;
  5428. lower = 0;
  5429. } else {
  5430. upper = toFinite(upper);
  5431. }
  5432. }
  5433. if (lower > upper) {
  5434. var temp = lower;
  5435. lower = upper;
  5436. upper = temp;
  5437. }
  5438. if (floating || lower % 1 || upper % 1) {
  5439. var rand = nativeRandom();
  5440. return nativeMin$5(lower + rand * (upper - lower + freeParseFloat("1e-" + ((rand + "").length - 1))), upper);
  5441. }
  5442. return baseRandom(lower, upper);
  5443. }
  5444. var nativeCeil = Math.ceil;
  5445. var nativeMax$4 = Math.max;
  5446. function baseRange(start, end, step, fromRight) {
  5447. var index = -1, length = nativeMax$4(nativeCeil((end - start) / (step || 1)), 0), result = Array(length);
  5448. while (length--) {
  5449. result[fromRight ? length : ++index] = start;
  5450. start += step;
  5451. }
  5452. return result;
  5453. }
  5454. function createRange(fromRight) {
  5455. return function(start, end, step) {
  5456. if (step && typeof step != "number" && isIterateeCall(start, end, step)) {
  5457. end = step = void 0;
  5458. }
  5459. start = toFinite(start);
  5460. if (end === void 0) {
  5461. end = start;
  5462. start = 0;
  5463. } else {
  5464. end = toFinite(end);
  5465. }
  5466. step = step === void 0 ? start < end ? 1 : -1 : toFinite(step);
  5467. return baseRange(start, end, step, fromRight);
  5468. };
  5469. }
  5470. var range$1 = createRange();
  5471. var rangeRight = createRange(true);
  5472. var WRAP_REARG_FLAG = 256;
  5473. var rearg = flatRest(function(func, indexes) {
  5474. return createWrap(func, WRAP_REARG_FLAG, void 0, void 0, void 0, indexes);
  5475. });
  5476. function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
  5477. eachFunc(collection, function(value, index, collection2) {
  5478. accumulator = initAccum ? (initAccum = false, value) : iteratee(accumulator, value, index, collection2);
  5479. });
  5480. return accumulator;
  5481. }
  5482. function reduce(collection, iteratee, accumulator) {
  5483. var func = isArray(collection) ? arrayReduce : baseReduce, initAccum = arguments.length < 3;
  5484. return func(collection, baseIteratee(iteratee), accumulator, initAccum, baseEach);
  5485. }
  5486. function arrayReduceRight(array, iteratee, accumulator, initAccum) {
  5487. var length = array == null ? 0 : array.length;
  5488. if (initAccum && length) {
  5489. accumulator = array[--length];
  5490. }
  5491. while (length--) {
  5492. accumulator = iteratee(accumulator, array[length], length, array);
  5493. }
  5494. return accumulator;
  5495. }
  5496. function reduceRight(collection, iteratee, accumulator) {
  5497. var func = isArray(collection) ? arrayReduceRight : baseReduce, initAccum = arguments.length < 3;
  5498. return func(collection, baseIteratee(iteratee), accumulator, initAccum, baseEachRight);
  5499. }
  5500. function reject(collection, predicate) {
  5501. var func = isArray(collection) ? arrayFilter : baseFilter;
  5502. return func(collection, negate(baseIteratee(predicate)));
  5503. }
  5504. function remove(array, predicate) {
  5505. var result = [];
  5506. if (!(array && array.length)) {
  5507. return result;
  5508. }
  5509. var index = -1, indexes = [], length = array.length;
  5510. predicate = baseIteratee(predicate);
  5511. while (++index < length) {
  5512. var value = array[index];
  5513. if (predicate(value, index, array)) {
  5514. result.push(value);
  5515. indexes.push(index);
  5516. }
  5517. }
  5518. basePullAt(array, indexes);
  5519. return result;
  5520. }
  5521. function repeat(string, n, guard) {
  5522. if (guard ? isIterateeCall(string, n, guard) : n === void 0) {
  5523. n = 1;
  5524. } else {
  5525. n = toInteger(n);
  5526. }
  5527. return baseRepeat(toString(string), n);
  5528. }
  5529. function replace() {
  5530. var args = arguments, string = toString(args[0]);
  5531. return args.length < 3 ? string : string.replace(args[1], args[2]);
  5532. }
  5533. var FUNC_ERROR_TEXT$2 = "Expected a function";
  5534. function rest(func, start) {
  5535. if (typeof func != "function") {
  5536. throw new TypeError(FUNC_ERROR_TEXT$2);
  5537. }
  5538. start = start === void 0 ? start : toInteger(start);
  5539. return baseRest(func, start);
  5540. }
  5541. function result(object, path, defaultValue) {
  5542. path = castPath(path, object);
  5543. var index = -1, length = path.length;
  5544. if (!length) {
  5545. length = 1;
  5546. object = void 0;
  5547. }
  5548. while (++index < length) {
  5549. var value = object == null ? void 0 : object[toKey(path[index])];
  5550. if (value === void 0) {
  5551. index = length;
  5552. value = defaultValue;
  5553. }
  5554. object = isFunction(value) ? value.call(object) : value;
  5555. }
  5556. return object;
  5557. }
  5558. var arrayProto$1 = Array.prototype;
  5559. var nativeReverse = arrayProto$1.reverse;
  5560. function reverse(array) {
  5561. return array == null ? array : nativeReverse.call(array);
  5562. }
  5563. var round$2 = createRound("round");
  5564. function arraySample(array) {
  5565. var length = array.length;
  5566. return length ? array[baseRandom(0, length - 1)] : void 0;
  5567. }
  5568. function baseSample(collection) {
  5569. return arraySample(values(collection));
  5570. }
  5571. function sample(collection) {
  5572. var func = isArray(collection) ? arraySample : baseSample;
  5573. return func(collection);
  5574. }
  5575. function shuffleSelf(array, size) {
  5576. var index = -1, length = array.length, lastIndex = length - 1;
  5577. size = size === void 0 ? length : size;
  5578. while (++index < size) {
  5579. var rand = baseRandom(index, lastIndex), value = array[rand];
  5580. array[rand] = array[index];
  5581. array[index] = value;
  5582. }
  5583. array.length = size;
  5584. return array;
  5585. }
  5586. function arraySampleSize(array, n) {
  5587. return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
  5588. }
  5589. function baseSampleSize(collection, n) {
  5590. var array = values(collection);
  5591. return shuffleSelf(array, baseClamp(n, 0, array.length));
  5592. }
  5593. function sampleSize(collection, n, guard) {
  5594. if (guard ? isIterateeCall(collection, n, guard) : n === void 0) {
  5595. n = 1;
  5596. } else {
  5597. n = toInteger(n);
  5598. }
  5599. var func = isArray(collection) ? arraySampleSize : baseSampleSize;
  5600. return func(collection, n);
  5601. }
  5602. function set(object, path, value) {
  5603. return object == null ? object : baseSet(object, path, value);
  5604. }
  5605. function setWith(object, path, value, customizer) {
  5606. customizer = typeof customizer == "function" ? customizer : void 0;
  5607. return object == null ? object : baseSet(object, path, value, customizer);
  5608. }
  5609. function arrayShuffle(array) {
  5610. return shuffleSelf(copyArray(array));
  5611. }
  5612. function baseShuffle(collection) {
  5613. return shuffleSelf(values(collection));
  5614. }
  5615. function shuffle(collection) {
  5616. var func = isArray(collection) ? arrayShuffle : baseShuffle;
  5617. return func(collection);
  5618. }
  5619. var mapTag = "[object Map]";
  5620. var setTag = "[object Set]";
  5621. function size$1(collection) {
  5622. if (collection == null) {
  5623. return 0;
  5624. }
  5625. if (isArrayLike(collection)) {
  5626. return isString(collection) ? stringSize(collection) : collection.length;
  5627. }
  5628. var tag = getTag$1(collection);
  5629. if (tag == mapTag || tag == setTag) {
  5630. return collection.size;
  5631. }
  5632. return baseKeys(collection).length;
  5633. }
  5634. function slice(array, start, end) {
  5635. var length = array == null ? 0 : array.length;
  5636. if (!length) {
  5637. return [];
  5638. }
  5639. if (end && typeof end != "number" && isIterateeCall(array, start, end)) {
  5640. start = 0;
  5641. end = length;
  5642. } else {
  5643. start = start == null ? 0 : toInteger(start);
  5644. end = end === void 0 ? length : toInteger(end);
  5645. }
  5646. return baseSlice(array, start, end);
  5647. }
  5648. var snakeCase = createCompounder(function(result, word, index) {
  5649. return result + (index ? "_" : "") + word.toLowerCase();
  5650. });
  5651. function baseSome(collection, predicate) {
  5652. var result;
  5653. baseEach(collection, function(value, index, collection2) {
  5654. result = predicate(value, index, collection2);
  5655. return !result;
  5656. });
  5657. return !!result;
  5658. }
  5659. function some(collection, predicate, guard) {
  5660. var func = isArray(collection) ? arraySome : baseSome;
  5661. if (guard && isIterateeCall(collection, predicate, guard)) {
  5662. predicate = void 0;
  5663. }
  5664. return func(collection, baseIteratee(predicate));
  5665. }
  5666. var sortBy = baseRest(function(collection, iteratees) {
  5667. if (collection == null) {
  5668. return [];
  5669. }
  5670. var length = iteratees.length;
  5671. if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
  5672. iteratees = [];
  5673. } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
  5674. iteratees = [iteratees[0]];
  5675. }
  5676. return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
  5677. });
  5678. var MAX_ARRAY_LENGTH$4 = 4294967295;
  5679. var MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH$4 - 1;
  5680. var nativeFloor = Math.floor;
  5681. var nativeMin$4 = Math.min;
  5682. function baseSortedIndexBy(array, value, iteratee, retHighest) {
  5683. var low = 0, high = array == null ? 0 : array.length;
  5684. if (high === 0) {
  5685. return 0;
  5686. }
  5687. value = iteratee(value);
  5688. var valIsNaN = value !== value, valIsNull = value === null, valIsSymbol = isSymbol(value), valIsUndefined = value === void 0;
  5689. while (low < high) {
  5690. var mid = nativeFloor((low + high) / 2), computed = iteratee(array[mid]), othIsDefined = computed !== void 0, othIsNull = computed === null, othIsReflexive = computed === computed, othIsSymbol = isSymbol(computed);
  5691. if (valIsNaN) {
  5692. var setLow = retHighest || othIsReflexive;
  5693. } else if (valIsUndefined) {
  5694. setLow = othIsReflexive && (retHighest || othIsDefined);
  5695. } else if (valIsNull) {
  5696. setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
  5697. } else if (valIsSymbol) {
  5698. setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
  5699. } else if (othIsNull || othIsSymbol) {
  5700. setLow = false;
  5701. } else {
  5702. setLow = retHighest ? computed <= value : computed < value;
  5703. }
  5704. if (setLow) {
  5705. low = mid + 1;
  5706. } else {
  5707. high = mid;
  5708. }
  5709. }
  5710. return nativeMin$4(high, MAX_ARRAY_INDEX);
  5711. }
  5712. var MAX_ARRAY_LENGTH$3 = 4294967295;
  5713. var HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH$3 >>> 1;
  5714. function baseSortedIndex(array, value, retHighest) {
  5715. var low = 0, high = array == null ? low : array.length;
  5716. if (typeof value == "number" && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
  5717. while (low < high) {
  5718. var mid = low + high >>> 1, computed = array[mid];
  5719. if (computed !== null && !isSymbol(computed) && (retHighest ? computed <= value : computed < value)) {
  5720. low = mid + 1;
  5721. } else {
  5722. high = mid;
  5723. }
  5724. }
  5725. return high;
  5726. }
  5727. return baseSortedIndexBy(array, value, identity, retHighest);
  5728. }
  5729. function sortedIndex(array, value) {
  5730. return baseSortedIndex(array, value);
  5731. }
  5732. function sortedIndexBy(array, value, iteratee) {
  5733. return baseSortedIndexBy(array, value, baseIteratee(iteratee));
  5734. }
  5735. function sortedIndexOf(array, value) {
  5736. var length = array == null ? 0 : array.length;
  5737. if (length) {
  5738. var index = baseSortedIndex(array, value);
  5739. if (index < length && eq(array[index], value)) {
  5740. return index;
  5741. }
  5742. }
  5743. return -1;
  5744. }
  5745. function sortedLastIndex(array, value) {
  5746. return baseSortedIndex(array, value, true);
  5747. }
  5748. function sortedLastIndexBy(array, value, iteratee) {
  5749. return baseSortedIndexBy(array, value, baseIteratee(iteratee), true);
  5750. }
  5751. function sortedLastIndexOf(array, value) {
  5752. var length = array == null ? 0 : array.length;
  5753. if (length) {
  5754. var index = baseSortedIndex(array, value, true) - 1;
  5755. if (eq(array[index], value)) {
  5756. return index;
  5757. }
  5758. }
  5759. return -1;
  5760. }
  5761. function baseSortedUniq(array, iteratee) {
  5762. var index = -1, length = array.length, resIndex = 0, result = [];
  5763. while (++index < length) {
  5764. var value = array[index], computed = iteratee ? iteratee(value) : value;
  5765. if (!index || !eq(computed, seen)) {
  5766. var seen = computed;
  5767. result[resIndex++] = value === 0 ? 0 : value;
  5768. }
  5769. }
  5770. return result;
  5771. }
  5772. function sortedUniq(array) {
  5773. return array && array.length ? baseSortedUniq(array) : [];
  5774. }
  5775. function sortedUniqBy(array, iteratee) {
  5776. return array && array.length ? baseSortedUniq(array, baseIteratee(iteratee)) : [];
  5777. }
  5778. var MAX_ARRAY_LENGTH$2 = 4294967295;
  5779. function split(string, separator, limit) {
  5780. if (limit && typeof limit != "number" && isIterateeCall(string, separator, limit)) {
  5781. separator = limit = void 0;
  5782. }
  5783. limit = limit === void 0 ? MAX_ARRAY_LENGTH$2 : limit >>> 0;
  5784. if (!limit) {
  5785. return [];
  5786. }
  5787. string = toString(string);
  5788. if (string && (typeof separator == "string" || separator != null && !isRegExp(separator))) {
  5789. separator = baseToString(separator);
  5790. if (!separator && hasUnicode(string)) {
  5791. return castSlice(stringToArray(string), 0, limit);
  5792. }
  5793. }
  5794. return string.split(separator, limit);
  5795. }
  5796. var FUNC_ERROR_TEXT$1 = "Expected a function";
  5797. var nativeMax$3 = Math.max;
  5798. function spread(func, start) {
  5799. if (typeof func != "function") {
  5800. throw new TypeError(FUNC_ERROR_TEXT$1);
  5801. }
  5802. start = start == null ? 0 : nativeMax$3(toInteger(start), 0);
  5803. return baseRest(function(args) {
  5804. var array = args[start], otherArgs = castSlice(args, 0, start);
  5805. if (array) {
  5806. arrayPush(otherArgs, array);
  5807. }
  5808. return apply(func, this, otherArgs);
  5809. });
  5810. }
  5811. var startCase = createCompounder(function(result, word, index) {
  5812. return result + (index ? " " : "") + upperFirst(word);
  5813. });
  5814. function startsWith(string, target, position) {
  5815. string = toString(string);
  5816. position = position == null ? 0 : baseClamp(toInteger(position), 0, string.length);
  5817. target = baseToString(target);
  5818. return string.slice(position, position + target.length) == target;
  5819. }
  5820. function stubObject() {
  5821. return {};
  5822. }
  5823. function stubString() {
  5824. return "";
  5825. }
  5826. function stubTrue() {
  5827. return true;
  5828. }
  5829. var subtract = createMathOperation(function(minuend, subtrahend) {
  5830. return minuend - subtrahend;
  5831. }, 0);
  5832. function sum$1(array) {
  5833. return array && array.length ? baseSum(array, identity) : 0;
  5834. }
  5835. function sumBy(array, iteratee) {
  5836. return array && array.length ? baseSum(array, baseIteratee(iteratee)) : 0;
  5837. }
  5838. function tail(array) {
  5839. var length = array == null ? 0 : array.length;
  5840. return length ? baseSlice(array, 1, length) : [];
  5841. }
  5842. function take(array, n, guard) {
  5843. if (!(array && array.length)) {
  5844. return [];
  5845. }
  5846. n = guard || n === void 0 ? 1 : toInteger(n);
  5847. return baseSlice(array, 0, n < 0 ? 0 : n);
  5848. }
  5849. function takeRight(array, n, guard) {
  5850. var length = array == null ? 0 : array.length;
  5851. if (!length) {
  5852. return [];
  5853. }
  5854. n = guard || n === void 0 ? 1 : toInteger(n);
  5855. n = length - n;
  5856. return baseSlice(array, n < 0 ? 0 : n, length);
  5857. }
  5858. function takeRightWhile(array, predicate) {
  5859. return array && array.length ? baseWhile(array, baseIteratee(predicate), false, true) : [];
  5860. }
  5861. function takeWhile(array, predicate) {
  5862. return array && array.length ? baseWhile(array, baseIteratee(predicate)) : [];
  5863. }
  5864. function tap(value, interceptor) {
  5865. interceptor(value);
  5866. return value;
  5867. }
  5868. var objectProto$2 = Object.prototype;
  5869. var hasOwnProperty$2 = objectProto$2.hasOwnProperty;
  5870. function customDefaultsAssignIn(objValue, srcValue, key, object) {
  5871. if (objValue === void 0 || eq(objValue, objectProto$2[key]) && !hasOwnProperty$2.call(object, key)) {
  5872. return srcValue;
  5873. }
  5874. return objValue;
  5875. }
  5876. var stringEscapes = {
  5877. "\\": "\\",
  5878. "'": "'",
  5879. "\n": "n",
  5880. "\r": "r",
  5881. "\u2028": "u2028",
  5882. "\u2029": "u2029"
  5883. };
  5884. function escapeStringChar(chr) {
  5885. return "\\" + stringEscapes[chr];
  5886. }
  5887. var reInterpolate = /<%=([\s\S]+?)%>/g;
  5888. var reEscape = /<%-([\s\S]+?)%>/g;
  5889. var reEvaluate = /<%([\s\S]+?)%>/g;
  5890. var templateSettings = {
  5891. "escape": reEscape,
  5892. "evaluate": reEvaluate,
  5893. "interpolate": reInterpolate,
  5894. "variable": "",
  5895. "imports": {
  5896. "_": { "escape": escape }
  5897. }
  5898. };
  5899. var INVALID_TEMPL_VAR_ERROR_TEXT = "Invalid `variable` option passed into `_.template`";
  5900. var reEmptyStringLeading = /\b__p \+= '';/g;
  5901. var reEmptyStringMiddle = /\b(__p \+=) '' \+/g;
  5902. var reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
  5903. var reForbiddenIdentifierChars = /[()=,{}\[\]\/\s]/;
  5904. var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
  5905. var reNoMatch = /($^)/;
  5906. var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
  5907. var objectProto$1 = Object.prototype;
  5908. var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
  5909. function template(string, options, guard) {
  5910. var settings = templateSettings.imports._.templateSettings || templateSettings;
  5911. if (guard && isIterateeCall(string, options, guard)) {
  5912. options = void 0;
  5913. }
  5914. string = toString(string);
  5915. options = assignInWith({}, options, settings, customDefaultsAssignIn);
  5916. var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn), importsKeys = keys(imports), importsValues = baseValues(imports, importsKeys);
  5917. var isEscaping, isEvaluating, index = 0, interpolate = options.interpolate || reNoMatch, source = "__p += '";
  5918. var reDelimiters = RegExp((options.escape || reNoMatch).source + "|" + interpolate.source + "|" + (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + "|" + (options.evaluate || reNoMatch).source + "|$", "g");
  5919. var sourceURL = hasOwnProperty$1.call(options, "sourceURL") ? "//# sourceURL=" + (options.sourceURL + "").replace(/\s/g, " ") + "\n" : "";
  5920. string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
  5921. interpolateValue || (interpolateValue = esTemplateValue);
  5922. source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
  5923. if (escapeValue) {
  5924. isEscaping = true;
  5925. source += "' +\n__e(" + escapeValue + ") +\n'";
  5926. }
  5927. if (evaluateValue) {
  5928. isEvaluating = true;
  5929. source += "';\n" + evaluateValue + ";\n__p += '";
  5930. }
  5931. if (interpolateValue) {
  5932. source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
  5933. }
  5934. index = offset + match.length;
  5935. return match;
  5936. });
  5937. source += "';\n";
  5938. var variable = hasOwnProperty$1.call(options, "variable") && options.variable;
  5939. if (!variable) {
  5940. source = "with (obj) {\n" + source + "\n}\n";
  5941. } else if (reForbiddenIdentifierChars.test(variable)) {
  5942. throw new Error(INVALID_TEMPL_VAR_ERROR_TEXT);
  5943. }
  5944. source = (isEvaluating ? source.replace(reEmptyStringLeading, "") : source).replace(reEmptyStringMiddle, "$1").replace(reEmptyStringTrailing, "$1;");
  5945. 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}";
  5946. var result = attempt(function() {
  5947. return Function(importsKeys, sourceURL + "return " + source).apply(void 0, importsValues);
  5948. });
  5949. result.source = source;
  5950. if (isError(result)) {
  5951. throw result;
  5952. }
  5953. return result;
  5954. }
  5955. var FUNC_ERROR_TEXT = "Expected a function";
  5956. function throttle(func, wait, options) {
  5957. var leading = true, trailing = true;
  5958. if (typeof func != "function") {
  5959. throw new TypeError(FUNC_ERROR_TEXT);
  5960. }
  5961. if (isObject(options)) {
  5962. leading = "leading" in options ? !!options.leading : leading;
  5963. trailing = "trailing" in options ? !!options.trailing : trailing;
  5964. }
  5965. return debounce(func, wait, {
  5966. "leading": leading,
  5967. "maxWait": wait,
  5968. "trailing": trailing
  5969. });
  5970. }
  5971. function thru(value, interceptor) {
  5972. return interceptor(value);
  5973. }
  5974. var MAX_SAFE_INTEGER$1 = 9007199254740991;
  5975. var MAX_ARRAY_LENGTH$1 = 4294967295;
  5976. var nativeMin$3 = Math.min;
  5977. function times(n, iteratee) {
  5978. n = toInteger(n);
  5979. if (n < 1 || n > MAX_SAFE_INTEGER$1) {
  5980. return [];
  5981. }
  5982. var index = MAX_ARRAY_LENGTH$1, length = nativeMin$3(n, MAX_ARRAY_LENGTH$1);
  5983. iteratee = castFunction(iteratee);
  5984. n -= MAX_ARRAY_LENGTH$1;
  5985. var result = baseTimes(length, iteratee);
  5986. while (++index < n) {
  5987. iteratee(index);
  5988. }
  5989. return result;
  5990. }
  5991. function wrapperToIterator() {
  5992. return this;
  5993. }
  5994. function baseWrapperValue(value, actions) {
  5995. var result = value;
  5996. if (result instanceof LazyWrapper) {
  5997. result = result.value();
  5998. }
  5999. return arrayReduce(actions, function(result2, action) {
  6000. return action.func.apply(action.thisArg, arrayPush([result2], action.args));
  6001. }, result);
  6002. }
  6003. function wrapperValue() {
  6004. return baseWrapperValue(this.__wrapped__, this.__actions__);
  6005. }
  6006. function toLower(value) {
  6007. return toString(value).toLowerCase();
  6008. }
  6009. function toPath(value) {
  6010. if (isArray(value)) {
  6011. return arrayMap(value, toKey);
  6012. }
  6013. return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));
  6014. }
  6015. var MAX_SAFE_INTEGER = 9007199254740991;
  6016. function toSafeInteger(value) {
  6017. return value ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER) : value === 0 ? value : 0;
  6018. }
  6019. function toUpper(value) {
  6020. return toString(value).toUpperCase();
  6021. }
  6022. function transform(object, iteratee, accumulator) {
  6023. var isArr = isArray(object), isArrLike = isArr || isBuffer(object) || isTypedArray(object);
  6024. iteratee = baseIteratee(iteratee);
  6025. if (accumulator == null) {
  6026. var Ctor = object && object.constructor;
  6027. if (isArrLike) {
  6028. accumulator = isArr ? new Ctor() : [];
  6029. } else if (isObject(object)) {
  6030. accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
  6031. } else {
  6032. accumulator = {};
  6033. }
  6034. }
  6035. (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object2) {
  6036. return iteratee(accumulator, value, index, object2);
  6037. });
  6038. return accumulator;
  6039. }
  6040. function charsEndIndex(strSymbols, chrSymbols) {
  6041. var index = strSymbols.length;
  6042. while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {
  6043. }
  6044. return index;
  6045. }
  6046. function charsStartIndex(strSymbols, chrSymbols) {
  6047. var index = -1, length = strSymbols.length;
  6048. while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {
  6049. }
  6050. return index;
  6051. }
  6052. function trim(string, chars, guard) {
  6053. string = toString(string);
  6054. if (string && (guard || chars === void 0)) {
  6055. return baseTrim(string);
  6056. }
  6057. if (!string || !(chars = baseToString(chars))) {
  6058. return string;
  6059. }
  6060. var strSymbols = stringToArray(string), chrSymbols = stringToArray(chars), start = charsStartIndex(strSymbols, chrSymbols), end = charsEndIndex(strSymbols, chrSymbols) + 1;
  6061. return castSlice(strSymbols, start, end).join("");
  6062. }
  6063. function trimEnd(string, chars, guard) {
  6064. string = toString(string);
  6065. if (string && (guard || chars === void 0)) {
  6066. return string.slice(0, trimmedEndIndex(string) + 1);
  6067. }
  6068. if (!string || !(chars = baseToString(chars))) {
  6069. return string;
  6070. }
  6071. var strSymbols = stringToArray(string), end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
  6072. return castSlice(strSymbols, 0, end).join("");
  6073. }
  6074. var reTrimStart = /^\s+/;
  6075. function trimStart(string, chars, guard) {
  6076. string = toString(string);
  6077. if (string && (guard || chars === void 0)) {
  6078. return string.replace(reTrimStart, "");
  6079. }
  6080. if (!string || !(chars = baseToString(chars))) {
  6081. return string;
  6082. }
  6083. var strSymbols = stringToArray(string), start = charsStartIndex(strSymbols, stringToArray(chars));
  6084. return castSlice(strSymbols, start).join("");
  6085. }
  6086. var DEFAULT_TRUNC_LENGTH = 30;
  6087. var DEFAULT_TRUNC_OMISSION = "...";
  6088. var reFlags = /\w*$/;
  6089. function truncate(string, options) {
  6090. var length = DEFAULT_TRUNC_LENGTH, omission = DEFAULT_TRUNC_OMISSION;
  6091. if (isObject(options)) {
  6092. var separator = "separator" in options ? options.separator : separator;
  6093. length = "length" in options ? toInteger(options.length) : length;
  6094. omission = "omission" in options ? baseToString(options.omission) : omission;
  6095. }
  6096. string = toString(string);
  6097. var strLength = string.length;
  6098. if (hasUnicode(string)) {
  6099. var strSymbols = stringToArray(string);
  6100. strLength = strSymbols.length;
  6101. }
  6102. if (length >= strLength) {
  6103. return string;
  6104. }
  6105. var end = length - stringSize(omission);
  6106. if (end < 1) {
  6107. return omission;
  6108. }
  6109. var result = strSymbols ? castSlice(strSymbols, 0, end).join("") : string.slice(0, end);
  6110. if (separator === void 0) {
  6111. return result + omission;
  6112. }
  6113. if (strSymbols) {
  6114. end += result.length - end;
  6115. }
  6116. if (isRegExp(separator)) {
  6117. if (string.slice(end).search(separator)) {
  6118. var match, substring = result;
  6119. if (!separator.global) {
  6120. separator = RegExp(separator.source, toString(reFlags.exec(separator)) + "g");
  6121. }
  6122. separator.lastIndex = 0;
  6123. while (match = separator.exec(substring)) {
  6124. var newEnd = match.index;
  6125. }
  6126. result = result.slice(0, newEnd === void 0 ? end : newEnd);
  6127. }
  6128. } else if (string.indexOf(baseToString(separator), end) != end) {
  6129. var index = result.lastIndexOf(separator);
  6130. if (index > -1) {
  6131. result = result.slice(0, index);
  6132. }
  6133. }
  6134. return result + omission;
  6135. }
  6136. function unary(func) {
  6137. return ary(func, 1);
  6138. }
  6139. var htmlUnescapes = {
  6140. "&amp;": "&",
  6141. "&lt;": "<",
  6142. "&gt;": ">",
  6143. "&quot;": '"',
  6144. "&#39;": "'"
  6145. };
  6146. var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
  6147. var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g;
  6148. var reHasEscapedHtml = RegExp(reEscapedHtml.source);
  6149. function unescape(string) {
  6150. string = toString(string);
  6151. return string && reHasEscapedHtml.test(string) ? string.replace(reEscapedHtml, unescapeHtmlChar) : string;
  6152. }
  6153. var INFINITY = 1 / 0;
  6154. var createSet = !(Set$1 && 1 / setToArray(new Set$1([, -0]))[1] == INFINITY) ? noop : function(values) {
  6155. return new Set$1(values);
  6156. };
  6157. var LARGE_ARRAY_SIZE = 200;
  6158. function baseUniq(array, iteratee, comparator) {
  6159. var index = -1, includes = arrayIncludes, length = array.length, isCommon = true, result = [], seen = result;
  6160. if (comparator) {
  6161. isCommon = false;
  6162. includes = arrayIncludesWith;
  6163. } else if (length >= LARGE_ARRAY_SIZE) {
  6164. var set = iteratee ? null : createSet(array);
  6165. if (set) {
  6166. return setToArray(set);
  6167. }
  6168. isCommon = false;
  6169. includes = cacheHas;
  6170. seen = new SetCache();
  6171. } else {
  6172. seen = iteratee ? [] : result;
  6173. }
  6174. outer:
  6175. while (++index < length) {
  6176. var value = array[index], computed = iteratee ? iteratee(value) : value;
  6177. value = comparator || value !== 0 ? value : 0;
  6178. if (isCommon && computed === computed) {
  6179. var seenIndex = seen.length;
  6180. while (seenIndex--) {
  6181. if (seen[seenIndex] === computed) {
  6182. continue outer;
  6183. }
  6184. }
  6185. if (iteratee) {
  6186. seen.push(computed);
  6187. }
  6188. result.push(value);
  6189. } else if (!includes(seen, computed, comparator)) {
  6190. if (seen !== result) {
  6191. seen.push(computed);
  6192. }
  6193. result.push(value);
  6194. }
  6195. }
  6196. return result;
  6197. }
  6198. var union = baseRest(function(arrays) {
  6199. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
  6200. });
  6201. var unionBy = baseRest(function(arrays) {
  6202. var iteratee = last(arrays);
  6203. if (isArrayLikeObject(iteratee)) {
  6204. iteratee = void 0;
  6205. }
  6206. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), baseIteratee(iteratee));
  6207. });
  6208. var unionWith = baseRest(function(arrays) {
  6209. var comparator = last(arrays);
  6210. comparator = typeof comparator == "function" ? comparator : void 0;
  6211. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), void 0, comparator);
  6212. });
  6213. function uniq(array) {
  6214. return array && array.length ? baseUniq(array) : [];
  6215. }
  6216. function uniqBy(array, iteratee) {
  6217. return array && array.length ? baseUniq(array, baseIteratee(iteratee)) : [];
  6218. }
  6219. function uniqWith(array, comparator) {
  6220. comparator = typeof comparator == "function" ? comparator : void 0;
  6221. return array && array.length ? baseUniq(array, void 0, comparator) : [];
  6222. }
  6223. var idCounter = 0;
  6224. function uniqueId(prefix) {
  6225. var id = ++idCounter;
  6226. return toString(prefix) + id;
  6227. }
  6228. function unset(object, path) {
  6229. return object == null ? true : baseUnset(object, path);
  6230. }
  6231. var nativeMax$2 = Math.max;
  6232. function unzip(array) {
  6233. if (!(array && array.length)) {
  6234. return [];
  6235. }
  6236. var length = 0;
  6237. array = arrayFilter(array, function(group) {
  6238. if (isArrayLikeObject(group)) {
  6239. length = nativeMax$2(group.length, length);
  6240. return true;
  6241. }
  6242. });
  6243. return baseTimes(length, function(index) {
  6244. return arrayMap(array, baseProperty(index));
  6245. });
  6246. }
  6247. function unzipWith(array, iteratee) {
  6248. if (!(array && array.length)) {
  6249. return [];
  6250. }
  6251. var result = unzip(array);
  6252. if (iteratee == null) {
  6253. return result;
  6254. }
  6255. return arrayMap(result, function(group) {
  6256. return apply(iteratee, void 0, group);
  6257. });
  6258. }
  6259. function baseUpdate(object, path, updater, customizer) {
  6260. return baseSet(object, path, updater(baseGet(object, path)), customizer);
  6261. }
  6262. function update(object, path, updater) {
  6263. return object == null ? object : baseUpdate(object, path, castFunction(updater));
  6264. }
  6265. function updateWith(object, path, updater, customizer) {
  6266. customizer = typeof customizer == "function" ? customizer : void 0;
  6267. return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
  6268. }
  6269. var upperCase = createCompounder(function(result, word, index) {
  6270. return result + (index ? " " : "") + word.toUpperCase();
  6271. });
  6272. function valuesIn(object) {
  6273. return object == null ? [] : baseValues(object, keysIn(object));
  6274. }
  6275. var without = baseRest(function(array, values) {
  6276. return isArrayLikeObject(array) ? baseDifference(array, values) : [];
  6277. });
  6278. function wrap(value, wrapper) {
  6279. return partial(castFunction(wrapper), value);
  6280. }
  6281. var wrapperAt = flatRest(function(paths) {
  6282. var length = paths.length, start = length ? paths[0] : 0, value = this.__wrapped__, interceptor = function(object) {
  6283. return baseAt(object, paths);
  6284. };
  6285. if (length > 1 || this.__actions__.length || !(value instanceof LazyWrapper) || !isIndex(start)) {
  6286. return this.thru(interceptor);
  6287. }
  6288. value = value.slice(start, +start + (length ? 1 : 0));
  6289. value.__actions__.push({
  6290. "func": thru,
  6291. "args": [interceptor],
  6292. "thisArg": void 0
  6293. });
  6294. return new LodashWrapper(value, this.__chain__).thru(function(array) {
  6295. if (length && !array.length) {
  6296. array.push(void 0);
  6297. }
  6298. return array;
  6299. });
  6300. });
  6301. function wrapperChain() {
  6302. return chain(this);
  6303. }
  6304. function wrapperReverse() {
  6305. var value = this.__wrapped__;
  6306. if (value instanceof LazyWrapper) {
  6307. var wrapped = value;
  6308. if (this.__actions__.length) {
  6309. wrapped = new LazyWrapper(this);
  6310. }
  6311. wrapped = wrapped.reverse();
  6312. wrapped.__actions__.push({
  6313. "func": thru,
  6314. "args": [reverse],
  6315. "thisArg": void 0
  6316. });
  6317. return new LodashWrapper(wrapped, this.__chain__);
  6318. }
  6319. return this.thru(reverse);
  6320. }
  6321. function baseXor(arrays, iteratee, comparator) {
  6322. var length = arrays.length;
  6323. if (length < 2) {
  6324. return length ? baseUniq(arrays[0]) : [];
  6325. }
  6326. var index = -1, result = Array(length);
  6327. while (++index < length) {
  6328. var array = arrays[index], othIndex = -1;
  6329. while (++othIndex < length) {
  6330. if (othIndex != index) {
  6331. result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator);
  6332. }
  6333. }
  6334. }
  6335. return baseUniq(baseFlatten(result, 1), iteratee, comparator);
  6336. }
  6337. var xor = baseRest(function(arrays) {
  6338. return baseXor(arrayFilter(arrays, isArrayLikeObject));
  6339. });
  6340. var xorBy = baseRest(function(arrays) {
  6341. var iteratee = last(arrays);
  6342. if (isArrayLikeObject(iteratee)) {
  6343. iteratee = void 0;
  6344. }
  6345. return baseXor(arrayFilter(arrays, isArrayLikeObject), baseIteratee(iteratee));
  6346. });
  6347. var xorWith = baseRest(function(arrays) {
  6348. var comparator = last(arrays);
  6349. comparator = typeof comparator == "function" ? comparator : void 0;
  6350. return baseXor(arrayFilter(arrays, isArrayLikeObject), void 0, comparator);
  6351. });
  6352. var zip = baseRest(unzip);
  6353. function baseZipObject(props, values, assignFunc) {
  6354. var index = -1, length = props.length, valsLength = values.length, result = {};
  6355. while (++index < length) {
  6356. var value = index < valsLength ? values[index] : void 0;
  6357. assignFunc(result, props[index], value);
  6358. }
  6359. return result;
  6360. }
  6361. function zipObject(props, values) {
  6362. return baseZipObject(props || [], values || [], assignValue);
  6363. }
  6364. function zipObjectDeep(props, values) {
  6365. return baseZipObject(props || [], values || [], baseSet);
  6366. }
  6367. var zipWith = baseRest(function(arrays) {
  6368. var length = arrays.length, iteratee = length > 1 ? arrays[length - 1] : void 0;
  6369. iteratee = typeof iteratee == "function" ? (arrays.pop(), iteratee) : void 0;
  6370. return unzipWith(arrays, iteratee);
  6371. });
  6372. var array = {
  6373. chunk,
  6374. compact,
  6375. concat,
  6376. difference,
  6377. differenceBy,
  6378. differenceWith,
  6379. drop,
  6380. dropRight,
  6381. dropRightWhile,
  6382. dropWhile,
  6383. fill,
  6384. findIndex,
  6385. findLastIndex,
  6386. first: head,
  6387. flatten,
  6388. flattenDeep,
  6389. flattenDepth,
  6390. fromPairs,
  6391. head,
  6392. indexOf,
  6393. initial: initial$1,
  6394. intersection,
  6395. intersectionBy,
  6396. intersectionWith,
  6397. join,
  6398. last,
  6399. lastIndexOf,
  6400. nth,
  6401. pull,
  6402. pullAll,
  6403. pullAllBy,
  6404. pullAllWith,
  6405. pullAt,
  6406. remove,
  6407. reverse,
  6408. slice,
  6409. sortedIndex,
  6410. sortedIndexBy,
  6411. sortedIndexOf,
  6412. sortedLastIndex,
  6413. sortedLastIndexBy,
  6414. sortedLastIndexOf,
  6415. sortedUniq,
  6416. sortedUniqBy,
  6417. tail,
  6418. take,
  6419. takeRight,
  6420. takeRightWhile,
  6421. takeWhile,
  6422. union,
  6423. unionBy,
  6424. unionWith,
  6425. uniq,
  6426. uniqBy,
  6427. uniqWith,
  6428. unzip,
  6429. unzipWith,
  6430. without,
  6431. xor,
  6432. xorBy,
  6433. xorWith,
  6434. zip,
  6435. zipObject,
  6436. zipObjectDeep,
  6437. zipWith
  6438. };
  6439. var collection = {
  6440. countBy,
  6441. each: forEach,
  6442. eachRight: forEachRight,
  6443. every,
  6444. filter,
  6445. find,
  6446. findLast,
  6447. flatMap,
  6448. flatMapDeep,
  6449. flatMapDepth,
  6450. forEach,
  6451. forEachRight,
  6452. groupBy,
  6453. includes,
  6454. invokeMap,
  6455. keyBy,
  6456. map,
  6457. orderBy: orderBy$1,
  6458. partition,
  6459. reduce,
  6460. reduceRight,
  6461. reject,
  6462. sample,
  6463. sampleSize,
  6464. shuffle,
  6465. size: size$1,
  6466. some,
  6467. sortBy
  6468. };
  6469. var date = {
  6470. now
  6471. };
  6472. var func = {
  6473. after,
  6474. ary,
  6475. before,
  6476. bind,
  6477. bindKey,
  6478. curry,
  6479. curryRight,
  6480. debounce,
  6481. defer,
  6482. delay,
  6483. flip: flip$2,
  6484. memoize,
  6485. negate,
  6486. once,
  6487. overArgs,
  6488. partial,
  6489. partialRight,
  6490. rearg,
  6491. rest,
  6492. spread,
  6493. throttle,
  6494. unary,
  6495. wrap
  6496. };
  6497. var lang = {
  6498. castArray: castArray$1,
  6499. clone,
  6500. cloneDeep,
  6501. cloneDeepWith,
  6502. cloneWith,
  6503. conformsTo,
  6504. eq,
  6505. gt: gt$1,
  6506. gte,
  6507. isArguments,
  6508. isArray,
  6509. isArrayBuffer,
  6510. isArrayLike,
  6511. isArrayLikeObject,
  6512. isBoolean: isBoolean$1,
  6513. isBuffer,
  6514. isDate,
  6515. isElement: isElement$3,
  6516. isEmpty: isEmpty$1,
  6517. isEqual: isEqual$1,
  6518. isEqualWith,
  6519. isError,
  6520. isFinite,
  6521. isFunction,
  6522. isInteger,
  6523. isLength,
  6524. isMap,
  6525. isMatch,
  6526. isMatchWith,
  6527. isNaN: isNaN$1,
  6528. isNative,
  6529. isNil,
  6530. isNull,
  6531. isNumber: isNumber$1,
  6532. isObject,
  6533. isObjectLike,
  6534. isPlainObject,
  6535. isRegExp,
  6536. isSafeInteger,
  6537. isSet,
  6538. isString,
  6539. isSymbol,
  6540. isTypedArray,
  6541. isUndefined: isUndefined$1,
  6542. isWeakMap,
  6543. isWeakSet,
  6544. lt: lt$1,
  6545. lte,
  6546. toArray,
  6547. toFinite,
  6548. toInteger,
  6549. toLength,
  6550. toNumber,
  6551. toPlainObject,
  6552. toSafeInteger,
  6553. toString
  6554. };
  6555. var math = {
  6556. add,
  6557. ceil,
  6558. divide,
  6559. floor: floor$1,
  6560. max: max$4,
  6561. maxBy,
  6562. mean,
  6563. meanBy,
  6564. min: min$4,
  6565. minBy,
  6566. multiply,
  6567. round: round$2,
  6568. subtract,
  6569. sum: sum$1,
  6570. sumBy
  6571. };
  6572. var number = {
  6573. clamp: clamp$1,
  6574. inRange,
  6575. random
  6576. };
  6577. var object = {
  6578. assign,
  6579. assignIn,
  6580. assignInWith,
  6581. assignWith,
  6582. at: at$1,
  6583. create,
  6584. defaults,
  6585. defaultsDeep,
  6586. entries: toPairs,
  6587. entriesIn: toPairsIn,
  6588. extend: assignIn,
  6589. extendWith: assignInWith,
  6590. findKey,
  6591. findLastKey,
  6592. forIn,
  6593. forInRight,
  6594. forOwn,
  6595. forOwnRight,
  6596. functions,
  6597. functionsIn,
  6598. get,
  6599. has,
  6600. hasIn,
  6601. invert,
  6602. invertBy,
  6603. invoke,
  6604. keys,
  6605. keysIn,
  6606. mapKeys,
  6607. mapValues,
  6608. merge,
  6609. mergeWith,
  6610. omit,
  6611. omitBy,
  6612. pick,
  6613. pickBy,
  6614. result,
  6615. set,
  6616. setWith,
  6617. toPairs,
  6618. toPairsIn,
  6619. transform,
  6620. unset,
  6621. update,
  6622. updateWith,
  6623. values,
  6624. valuesIn
  6625. };
  6626. var seq = {
  6627. at: wrapperAt,
  6628. chain,
  6629. commit: wrapperCommit,
  6630. lodash,
  6631. next: wrapperNext,
  6632. plant: wrapperPlant,
  6633. reverse: wrapperReverse,
  6634. tap,
  6635. thru,
  6636. toIterator: wrapperToIterator,
  6637. toJSON: wrapperValue,
  6638. value: wrapperValue,
  6639. valueOf: wrapperValue,
  6640. wrapperChain
  6641. };
  6642. var string$1 = {
  6643. camelCase,
  6644. capitalize: capitalize$1,
  6645. deburr,
  6646. endsWith,
  6647. escape,
  6648. escapeRegExp,
  6649. kebabCase,
  6650. lowerCase,
  6651. lowerFirst,
  6652. pad,
  6653. padEnd,
  6654. padStart,
  6655. parseInt: parseInt$1,
  6656. repeat,
  6657. replace,
  6658. snakeCase,
  6659. split,
  6660. startCase,
  6661. startsWith,
  6662. template,
  6663. templateSettings,
  6664. toLower,
  6665. toUpper,
  6666. trim,
  6667. trimEnd,
  6668. trimStart,
  6669. truncate,
  6670. unescape,
  6671. upperCase,
  6672. upperFirst,
  6673. words
  6674. };
  6675. var util = {
  6676. attempt,
  6677. bindAll,
  6678. cond,
  6679. conforms,
  6680. constant,
  6681. defaultTo,
  6682. flow,
  6683. flowRight,
  6684. identity,
  6685. iteratee,
  6686. matches,
  6687. matchesProperty,
  6688. method,
  6689. methodOf,
  6690. mixin: mixin$1,
  6691. noop,
  6692. nthArg,
  6693. over,
  6694. overEvery,
  6695. overSome,
  6696. property,
  6697. propertyOf,
  6698. range: range$1,
  6699. rangeRight,
  6700. stubArray,
  6701. stubFalse,
  6702. stubObject,
  6703. stubString,
  6704. stubTrue,
  6705. times,
  6706. toPath,
  6707. uniqueId
  6708. };
  6709. function lazyClone() {
  6710. var result = new LazyWrapper(this.__wrapped__);
  6711. result.__actions__ = copyArray(this.__actions__);
  6712. result.__dir__ = this.__dir__;
  6713. result.__filtered__ = this.__filtered__;
  6714. result.__iteratees__ = copyArray(this.__iteratees__);
  6715. result.__takeCount__ = this.__takeCount__;
  6716. result.__views__ = copyArray(this.__views__);
  6717. return result;
  6718. }
  6719. function lazyReverse() {
  6720. if (this.__filtered__) {
  6721. var result = new LazyWrapper(this);
  6722. result.__dir__ = -1;
  6723. result.__filtered__ = true;
  6724. } else {
  6725. result = this.clone();
  6726. result.__dir__ *= -1;
  6727. }
  6728. return result;
  6729. }
  6730. var nativeMax$1 = Math.max;
  6731. var nativeMin$2 = Math.min;
  6732. function getView(start, end, transforms) {
  6733. var index = -1, length = transforms.length;
  6734. while (++index < length) {
  6735. var data = transforms[index], size = data.size;
  6736. switch (data.type) {
  6737. case "drop":
  6738. start += size;
  6739. break;
  6740. case "dropRight":
  6741. end -= size;
  6742. break;
  6743. case "take":
  6744. end = nativeMin$2(end, start + size);
  6745. break;
  6746. case "takeRight":
  6747. start = nativeMax$1(start, end - size);
  6748. break;
  6749. }
  6750. }
  6751. return { "start": start, "end": end };
  6752. }
  6753. var LAZY_FILTER_FLAG$1 = 1;
  6754. var LAZY_MAP_FLAG = 2;
  6755. var nativeMin$1 = Math.min;
  6756. function lazyValue() {
  6757. 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__);
  6758. if (!isArr || !isRight && arrLength == length && takeCount == length) {
  6759. return baseWrapperValue(array, this.__actions__);
  6760. }
  6761. var result = [];
  6762. outer:
  6763. while (length-- && resIndex < takeCount) {
  6764. index += dir;
  6765. var iterIndex = -1, value = array[index];
  6766. while (++iterIndex < iterLength) {
  6767. var data = iteratees[iterIndex], iteratee = data.iteratee, type = data.type, computed = iteratee(value);
  6768. if (type == LAZY_MAP_FLAG) {
  6769. value = computed;
  6770. } else if (!computed) {
  6771. if (type == LAZY_FILTER_FLAG$1) {
  6772. continue outer;
  6773. } else {
  6774. break outer;
  6775. }
  6776. }
  6777. }
  6778. result[resIndex++] = value;
  6779. }
  6780. return result;
  6781. }
  6782. var VERSION = "4.17.21";
  6783. var WRAP_BIND_KEY_FLAG = 2;
  6784. var LAZY_FILTER_FLAG = 1;
  6785. var LAZY_WHILE_FLAG = 3;
  6786. var MAX_ARRAY_LENGTH = 4294967295;
  6787. var arrayProto = Array.prototype;
  6788. var objectProto = Object.prototype;
  6789. var hasOwnProperty = objectProto.hasOwnProperty;
  6790. var symIterator = Symbol$1 ? Symbol$1.iterator : void 0;
  6791. var nativeMax = Math.max;
  6792. var nativeMin = Math.min;
  6793. var mixin = function(func2) {
  6794. return function(object2, source, options) {
  6795. if (options == null) {
  6796. var isObj = isObject(source), props = isObj && keys(source), methodNames = props && props.length && baseFunctions(source, props);
  6797. if (!(methodNames ? methodNames.length : isObj)) {
  6798. options = source;
  6799. source = object2;
  6800. object2 = this;
  6801. }
  6802. }
  6803. return func2(object2, source, options);
  6804. };
  6805. }(mixin$1);
  6806. lodash.after = func.after;
  6807. lodash.ary = func.ary;
  6808. lodash.assign = object.assign;
  6809. lodash.assignIn = object.assignIn;
  6810. lodash.assignInWith = object.assignInWith;
  6811. lodash.assignWith = object.assignWith;
  6812. lodash.at = object.at;
  6813. lodash.before = func.before;
  6814. lodash.bind = func.bind;
  6815. lodash.bindAll = util.bindAll;
  6816. lodash.bindKey = func.bindKey;
  6817. lodash.castArray = lang.castArray;
  6818. lodash.chain = seq.chain;
  6819. lodash.chunk = array.chunk;
  6820. lodash.compact = array.compact;
  6821. lodash.concat = array.concat;
  6822. lodash.cond = util.cond;
  6823. lodash.conforms = util.conforms;
  6824. lodash.constant = util.constant;
  6825. lodash.countBy = collection.countBy;
  6826. lodash.create = object.create;
  6827. lodash.curry = func.curry;
  6828. lodash.curryRight = func.curryRight;
  6829. lodash.debounce = func.debounce;
  6830. lodash.defaults = object.defaults;
  6831. lodash.defaultsDeep = object.defaultsDeep;
  6832. lodash.defer = func.defer;
  6833. lodash.delay = func.delay;
  6834. lodash.difference = array.difference;
  6835. lodash.differenceBy = array.differenceBy;
  6836. lodash.differenceWith = array.differenceWith;
  6837. lodash.drop = array.drop;
  6838. lodash.dropRight = array.dropRight;
  6839. lodash.dropRightWhile = array.dropRightWhile;
  6840. lodash.dropWhile = array.dropWhile;
  6841. lodash.fill = array.fill;
  6842. lodash.filter = collection.filter;
  6843. lodash.flatMap = collection.flatMap;
  6844. lodash.flatMapDeep = collection.flatMapDeep;
  6845. lodash.flatMapDepth = collection.flatMapDepth;
  6846. lodash.flatten = array.flatten;
  6847. lodash.flattenDeep = array.flattenDeep;
  6848. lodash.flattenDepth = array.flattenDepth;
  6849. lodash.flip = func.flip;
  6850. lodash.flow = util.flow;
  6851. lodash.flowRight = util.flowRight;
  6852. lodash.fromPairs = array.fromPairs;
  6853. lodash.functions = object.functions;
  6854. lodash.functionsIn = object.functionsIn;
  6855. lodash.groupBy = collection.groupBy;
  6856. lodash.initial = array.initial;
  6857. lodash.intersection = array.intersection;
  6858. lodash.intersectionBy = array.intersectionBy;
  6859. lodash.intersectionWith = array.intersectionWith;
  6860. lodash.invert = object.invert;
  6861. lodash.invertBy = object.invertBy;
  6862. lodash.invokeMap = collection.invokeMap;
  6863. lodash.iteratee = util.iteratee;
  6864. lodash.keyBy = collection.keyBy;
  6865. lodash.keys = keys;
  6866. lodash.keysIn = object.keysIn;
  6867. lodash.map = collection.map;
  6868. lodash.mapKeys = object.mapKeys;
  6869. lodash.mapValues = object.mapValues;
  6870. lodash.matches = util.matches;
  6871. lodash.matchesProperty = util.matchesProperty;
  6872. lodash.memoize = func.memoize;
  6873. lodash.merge = object.merge;
  6874. lodash.mergeWith = object.mergeWith;
  6875. lodash.method = util.method;
  6876. lodash.methodOf = util.methodOf;
  6877. lodash.mixin = mixin;
  6878. lodash.negate = negate;
  6879. lodash.nthArg = util.nthArg;
  6880. lodash.omit = object.omit;
  6881. lodash.omitBy = object.omitBy;
  6882. lodash.once = func.once;
  6883. lodash.orderBy = collection.orderBy;
  6884. lodash.over = util.over;
  6885. lodash.overArgs = func.overArgs;
  6886. lodash.overEvery = util.overEvery;
  6887. lodash.overSome = util.overSome;
  6888. lodash.partial = func.partial;
  6889. lodash.partialRight = func.partialRight;
  6890. lodash.partition = collection.partition;
  6891. lodash.pick = object.pick;
  6892. lodash.pickBy = object.pickBy;
  6893. lodash.property = util.property;
  6894. lodash.propertyOf = util.propertyOf;
  6895. lodash.pull = array.pull;
  6896. lodash.pullAll = array.pullAll;
  6897. lodash.pullAllBy = array.pullAllBy;
  6898. lodash.pullAllWith = array.pullAllWith;
  6899. lodash.pullAt = array.pullAt;
  6900. lodash.range = util.range;
  6901. lodash.rangeRight = util.rangeRight;
  6902. lodash.rearg = func.rearg;
  6903. lodash.reject = collection.reject;
  6904. lodash.remove = array.remove;
  6905. lodash.rest = func.rest;
  6906. lodash.reverse = array.reverse;
  6907. lodash.sampleSize = collection.sampleSize;
  6908. lodash.set = object.set;
  6909. lodash.setWith = object.setWith;
  6910. lodash.shuffle = collection.shuffle;
  6911. lodash.slice = array.slice;
  6912. lodash.sortBy = collection.sortBy;
  6913. lodash.sortedUniq = array.sortedUniq;
  6914. lodash.sortedUniqBy = array.sortedUniqBy;
  6915. lodash.split = string$1.split;
  6916. lodash.spread = func.spread;
  6917. lodash.tail = array.tail;
  6918. lodash.take = array.take;
  6919. lodash.takeRight = array.takeRight;
  6920. lodash.takeRightWhile = array.takeRightWhile;
  6921. lodash.takeWhile = array.takeWhile;
  6922. lodash.tap = seq.tap;
  6923. lodash.throttle = func.throttle;
  6924. lodash.thru = thru;
  6925. lodash.toArray = lang.toArray;
  6926. lodash.toPairs = object.toPairs;
  6927. lodash.toPairsIn = object.toPairsIn;
  6928. lodash.toPath = util.toPath;
  6929. lodash.toPlainObject = lang.toPlainObject;
  6930. lodash.transform = object.transform;
  6931. lodash.unary = func.unary;
  6932. lodash.union = array.union;
  6933. lodash.unionBy = array.unionBy;
  6934. lodash.unionWith = array.unionWith;
  6935. lodash.uniq = array.uniq;
  6936. lodash.uniqBy = array.uniqBy;
  6937. lodash.uniqWith = array.uniqWith;
  6938. lodash.unset = object.unset;
  6939. lodash.unzip = array.unzip;
  6940. lodash.unzipWith = array.unzipWith;
  6941. lodash.update = object.update;
  6942. lodash.updateWith = object.updateWith;
  6943. lodash.values = object.values;
  6944. lodash.valuesIn = object.valuesIn;
  6945. lodash.without = array.without;
  6946. lodash.words = string$1.words;
  6947. lodash.wrap = func.wrap;
  6948. lodash.xor = array.xor;
  6949. lodash.xorBy = array.xorBy;
  6950. lodash.xorWith = array.xorWith;
  6951. lodash.zip = array.zip;
  6952. lodash.zipObject = array.zipObject;
  6953. lodash.zipObjectDeep = array.zipObjectDeep;
  6954. lodash.zipWith = array.zipWith;
  6955. lodash.entries = object.toPairs;
  6956. lodash.entriesIn = object.toPairsIn;
  6957. lodash.extend = object.assignIn;
  6958. lodash.extendWith = object.assignInWith;
  6959. mixin(lodash, lodash);
  6960. lodash.add = math.add;
  6961. lodash.attempt = util.attempt;
  6962. lodash.camelCase = string$1.camelCase;
  6963. lodash.capitalize = string$1.capitalize;
  6964. lodash.ceil = math.ceil;
  6965. lodash.clamp = number.clamp;
  6966. lodash.clone = lang.clone;
  6967. lodash.cloneDeep = lang.cloneDeep;
  6968. lodash.cloneDeepWith = lang.cloneDeepWith;
  6969. lodash.cloneWith = lang.cloneWith;
  6970. lodash.conformsTo = lang.conformsTo;
  6971. lodash.deburr = string$1.deburr;
  6972. lodash.defaultTo = util.defaultTo;
  6973. lodash.divide = math.divide;
  6974. lodash.endsWith = string$1.endsWith;
  6975. lodash.eq = lang.eq;
  6976. lodash.escape = string$1.escape;
  6977. lodash.escapeRegExp = string$1.escapeRegExp;
  6978. lodash.every = collection.every;
  6979. lodash.find = collection.find;
  6980. lodash.findIndex = array.findIndex;
  6981. lodash.findKey = object.findKey;
  6982. lodash.findLast = collection.findLast;
  6983. lodash.findLastIndex = array.findLastIndex;
  6984. lodash.findLastKey = object.findLastKey;
  6985. lodash.floor = math.floor;
  6986. lodash.forEach = collection.forEach;
  6987. lodash.forEachRight = collection.forEachRight;
  6988. lodash.forIn = object.forIn;
  6989. lodash.forInRight = object.forInRight;
  6990. lodash.forOwn = object.forOwn;
  6991. lodash.forOwnRight = object.forOwnRight;
  6992. lodash.get = object.get;
  6993. lodash.gt = lang.gt;
  6994. lodash.gte = lang.gte;
  6995. lodash.has = object.has;
  6996. lodash.hasIn = object.hasIn;
  6997. lodash.head = array.head;
  6998. lodash.identity = identity;
  6999. lodash.includes = collection.includes;
  7000. lodash.indexOf = array.indexOf;
  7001. lodash.inRange = number.inRange;
  7002. lodash.invoke = object.invoke;
  7003. lodash.isArguments = lang.isArguments;
  7004. lodash.isArray = isArray;
  7005. lodash.isArrayBuffer = lang.isArrayBuffer;
  7006. lodash.isArrayLike = lang.isArrayLike;
  7007. lodash.isArrayLikeObject = lang.isArrayLikeObject;
  7008. lodash.isBoolean = lang.isBoolean;
  7009. lodash.isBuffer = lang.isBuffer;
  7010. lodash.isDate = lang.isDate;
  7011. lodash.isElement = lang.isElement;
  7012. lodash.isEmpty = lang.isEmpty;
  7013. lodash.isEqual = lang.isEqual;
  7014. lodash.isEqualWith = lang.isEqualWith;
  7015. lodash.isError = lang.isError;
  7016. lodash.isFinite = lang.isFinite;
  7017. lodash.isFunction = lang.isFunction;
  7018. lodash.isInteger = lang.isInteger;
  7019. lodash.isLength = lang.isLength;
  7020. lodash.isMap = lang.isMap;
  7021. lodash.isMatch = lang.isMatch;
  7022. lodash.isMatchWith = lang.isMatchWith;
  7023. lodash.isNaN = lang.isNaN;
  7024. lodash.isNative = lang.isNative;
  7025. lodash.isNil = lang.isNil;
  7026. lodash.isNull = lang.isNull;
  7027. lodash.isNumber = lang.isNumber;
  7028. lodash.isObject = isObject;
  7029. lodash.isObjectLike = lang.isObjectLike;
  7030. lodash.isPlainObject = lang.isPlainObject;
  7031. lodash.isRegExp = lang.isRegExp;
  7032. lodash.isSafeInteger = lang.isSafeInteger;
  7033. lodash.isSet = lang.isSet;
  7034. lodash.isString = lang.isString;
  7035. lodash.isSymbol = lang.isSymbol;
  7036. lodash.isTypedArray = lang.isTypedArray;
  7037. lodash.isUndefined = lang.isUndefined;
  7038. lodash.isWeakMap = lang.isWeakMap;
  7039. lodash.isWeakSet = lang.isWeakSet;
  7040. lodash.join = array.join;
  7041. lodash.kebabCase = string$1.kebabCase;
  7042. lodash.last = last;
  7043. lodash.lastIndexOf = array.lastIndexOf;
  7044. lodash.lowerCase = string$1.lowerCase;
  7045. lodash.lowerFirst = string$1.lowerFirst;
  7046. lodash.lt = lang.lt;
  7047. lodash.lte = lang.lte;
  7048. lodash.max = math.max;
  7049. lodash.maxBy = math.maxBy;
  7050. lodash.mean = math.mean;
  7051. lodash.meanBy = math.meanBy;
  7052. lodash.min = math.min;
  7053. lodash.minBy = math.minBy;
  7054. lodash.stubArray = util.stubArray;
  7055. lodash.stubFalse = util.stubFalse;
  7056. lodash.stubObject = util.stubObject;
  7057. lodash.stubString = util.stubString;
  7058. lodash.stubTrue = util.stubTrue;
  7059. lodash.multiply = math.multiply;
  7060. lodash.nth = array.nth;
  7061. lodash.noop = util.noop;
  7062. lodash.now = date.now;
  7063. lodash.pad = string$1.pad;
  7064. lodash.padEnd = string$1.padEnd;
  7065. lodash.padStart = string$1.padStart;
  7066. lodash.parseInt = string$1.parseInt;
  7067. lodash.random = number.random;
  7068. lodash.reduce = collection.reduce;
  7069. lodash.reduceRight = collection.reduceRight;
  7070. lodash.repeat = string$1.repeat;
  7071. lodash.replace = string$1.replace;
  7072. lodash.result = object.result;
  7073. lodash.round = math.round;
  7074. lodash.sample = collection.sample;
  7075. lodash.size = collection.size;
  7076. lodash.snakeCase = string$1.snakeCase;
  7077. lodash.some = collection.some;
  7078. lodash.sortedIndex = array.sortedIndex;
  7079. lodash.sortedIndexBy = array.sortedIndexBy;
  7080. lodash.sortedIndexOf = array.sortedIndexOf;
  7081. lodash.sortedLastIndex = array.sortedLastIndex;
  7082. lodash.sortedLastIndexBy = array.sortedLastIndexBy;
  7083. lodash.sortedLastIndexOf = array.sortedLastIndexOf;
  7084. lodash.startCase = string$1.startCase;
  7085. lodash.startsWith = string$1.startsWith;
  7086. lodash.subtract = math.subtract;
  7087. lodash.sum = math.sum;
  7088. lodash.sumBy = math.sumBy;
  7089. lodash.template = string$1.template;
  7090. lodash.times = util.times;
  7091. lodash.toFinite = lang.toFinite;
  7092. lodash.toInteger = toInteger;
  7093. lodash.toLength = lang.toLength;
  7094. lodash.toLower = string$1.toLower;
  7095. lodash.toNumber = lang.toNumber;
  7096. lodash.toSafeInteger = lang.toSafeInteger;
  7097. lodash.toString = lang.toString;
  7098. lodash.toUpper = string$1.toUpper;
  7099. lodash.trim = string$1.trim;
  7100. lodash.trimEnd = string$1.trimEnd;
  7101. lodash.trimStart = string$1.trimStart;
  7102. lodash.truncate = string$1.truncate;
  7103. lodash.unescape = string$1.unescape;
  7104. lodash.uniqueId = util.uniqueId;
  7105. lodash.upperCase = string$1.upperCase;
  7106. lodash.upperFirst = string$1.upperFirst;
  7107. lodash.each = collection.forEach;
  7108. lodash.eachRight = collection.forEachRight;
  7109. lodash.first = array.head;
  7110. mixin(lodash, function() {
  7111. var source = {};
  7112. baseForOwn(lodash, function(func2, methodName) {
  7113. if (!hasOwnProperty.call(lodash.prototype, methodName)) {
  7114. source[methodName] = func2;
  7115. }
  7116. });
  7117. return source;
  7118. }(), { "chain": false });
  7119. lodash.VERSION = VERSION;
  7120. (lodash.templateSettings = string$1.templateSettings).imports._ = lodash;
  7121. arrayEach(["bind", "bindKey", "curry", "curryRight", "partial", "partialRight"], function(methodName) {
  7122. lodash[methodName].placeholder = lodash;
  7123. });
  7124. arrayEach(["drop", "take"], function(methodName, index) {
  7125. LazyWrapper.prototype[methodName] = function(n) {
  7126. n = n === void 0 ? 1 : nativeMax(toInteger(n), 0);
  7127. var result = this.__filtered__ && !index ? new LazyWrapper(this) : this.clone();
  7128. if (result.__filtered__) {
  7129. result.__takeCount__ = nativeMin(n, result.__takeCount__);
  7130. } else {
  7131. result.__views__.push({
  7132. "size": nativeMin(n, MAX_ARRAY_LENGTH),
  7133. "type": methodName + (result.__dir__ < 0 ? "Right" : "")
  7134. });
  7135. }
  7136. return result;
  7137. };
  7138. LazyWrapper.prototype[methodName + "Right"] = function(n) {
  7139. return this.reverse()[methodName](n).reverse();
  7140. };
  7141. });
  7142. arrayEach(["filter", "map", "takeWhile"], function(methodName, index) {
  7143. var type = index + 1, isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG;
  7144. LazyWrapper.prototype[methodName] = function(iteratee) {
  7145. var result = this.clone();
  7146. result.__iteratees__.push({
  7147. "iteratee": baseIteratee(iteratee),
  7148. "type": type
  7149. });
  7150. result.__filtered__ = result.__filtered__ || isFilter;
  7151. return result;
  7152. };
  7153. });
  7154. arrayEach(["head", "last"], function(methodName, index) {
  7155. var takeName = "take" + (index ? "Right" : "");
  7156. LazyWrapper.prototype[methodName] = function() {
  7157. return this[takeName](1).value()[0];
  7158. };
  7159. });
  7160. arrayEach(["initial", "tail"], function(methodName, index) {
  7161. var dropName = "drop" + (index ? "" : "Right");
  7162. LazyWrapper.prototype[methodName] = function() {
  7163. return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
  7164. };
  7165. });
  7166. LazyWrapper.prototype.compact = function() {
  7167. return this.filter(identity);
  7168. };
  7169. LazyWrapper.prototype.find = function(predicate) {
  7170. return this.filter(predicate).head();
  7171. };
  7172. LazyWrapper.prototype.findLast = function(predicate) {
  7173. return this.reverse().find(predicate);
  7174. };
  7175. LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
  7176. if (typeof path == "function") {
  7177. return new LazyWrapper(this);
  7178. }
  7179. return this.map(function(value) {
  7180. return baseInvoke(value, path, args);
  7181. });
  7182. });
  7183. LazyWrapper.prototype.reject = function(predicate) {
  7184. return this.filter(negate(baseIteratee(predicate)));
  7185. };
  7186. LazyWrapper.prototype.slice = function(start, end) {
  7187. start = toInteger(start);
  7188. var result = this;
  7189. if (result.__filtered__ && (start > 0 || end < 0)) {
  7190. return new LazyWrapper(result);
  7191. }
  7192. if (start < 0) {
  7193. result = result.takeRight(-start);
  7194. } else if (start) {
  7195. result = result.drop(start);
  7196. }
  7197. if (end !== void 0) {
  7198. end = toInteger(end);
  7199. result = end < 0 ? result.dropRight(-end) : result.take(end - start);
  7200. }
  7201. return result;
  7202. };
  7203. LazyWrapper.prototype.takeRightWhile = function(predicate) {
  7204. return this.reverse().takeWhile(predicate).reverse();
  7205. };
  7206. LazyWrapper.prototype.toArray = function() {
  7207. return this.take(MAX_ARRAY_LENGTH);
  7208. };
  7209. baseForOwn(LazyWrapper.prototype, function(func2, methodName) {
  7210. 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);
  7211. if (!lodashFunc) {
  7212. return;
  7213. }
  7214. lodash.prototype[methodName] = function() {
  7215. var value = this.__wrapped__, args = isTaker ? [1] : arguments, isLazy = value instanceof LazyWrapper, iteratee = args[0], useLazy = isLazy || isArray(value);
  7216. var interceptor = function(value2) {
  7217. var result2 = lodashFunc.apply(lodash, arrayPush([value2], args));
  7218. return isTaker && chainAll ? result2[0] : result2;
  7219. };
  7220. if (useLazy && checkIteratee && typeof iteratee == "function" && iteratee.length != 1) {
  7221. isLazy = useLazy = false;
  7222. }
  7223. var chainAll = this.__chain__, isHybrid = !!this.__actions__.length, isUnwrapped = retUnwrapped && !chainAll, onlyLazy = isLazy && !isHybrid;
  7224. if (!retUnwrapped && useLazy) {
  7225. value = onlyLazy ? value : new LazyWrapper(this);
  7226. var result = func2.apply(value, args);
  7227. result.__actions__.push({ "func": thru, "args": [interceptor], "thisArg": void 0 });
  7228. return new LodashWrapper(result, chainAll);
  7229. }
  7230. if (isUnwrapped && onlyLazy) {
  7231. return func2.apply(this, args);
  7232. }
  7233. result = this.thru(interceptor);
  7234. return isUnwrapped ? isTaker ? result.value()[0] : result.value() : result;
  7235. };
  7236. });
  7237. arrayEach(["pop", "push", "shift", "sort", "splice", "unshift"], function(methodName) {
  7238. var func2 = arrayProto[methodName], chainName = /^(?:push|sort|unshift)$/.test(methodName) ? "tap" : "thru", retUnwrapped = /^(?:pop|shift)$/.test(methodName);
  7239. lodash.prototype[methodName] = function() {
  7240. var args = arguments;
  7241. if (retUnwrapped && !this.__chain__) {
  7242. var value = this.value();
  7243. return func2.apply(isArray(value) ? value : [], args);
  7244. }
  7245. return this[chainName](function(value2) {
  7246. return func2.apply(isArray(value2) ? value2 : [], args);
  7247. });
  7248. };
  7249. });
  7250. baseForOwn(LazyWrapper.prototype, function(func2, methodName) {
  7251. var lodashFunc = lodash[methodName];
  7252. if (lodashFunc) {
  7253. var key = lodashFunc.name + "";
  7254. if (!hasOwnProperty.call(realNames, key)) {
  7255. realNames[key] = [];
  7256. }
  7257. realNames[key].push({ "name": methodName, "func": lodashFunc });
  7258. }
  7259. });
  7260. realNames[createHybrid(void 0, WRAP_BIND_KEY_FLAG).name] = [{
  7261. "name": "wrapper",
  7262. "func": void 0
  7263. }];
  7264. LazyWrapper.prototype.clone = lazyClone;
  7265. LazyWrapper.prototype.reverse = lazyReverse;
  7266. LazyWrapper.prototype.value = lazyValue;
  7267. lodash.prototype.at = seq.at;
  7268. lodash.prototype.chain = seq.wrapperChain;
  7269. lodash.prototype.commit = seq.commit;
  7270. lodash.prototype.next = seq.next;
  7271. lodash.prototype.plant = seq.plant;
  7272. lodash.prototype.reverse = seq.reverse;
  7273. lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = seq.value;
  7274. lodash.prototype.first = lodash.prototype.head;
  7275. if (symIterator) {
  7276. lodash.prototype[symIterator] = seq.toIterator;
  7277. }
  7278. /**
  7279. * @license
  7280. * Lodash (Custom Build) <https://lodash.com/>
  7281. * Build: `lodash modularize exports="es" -o ./`
  7282. * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
  7283. * Released under MIT license <https://lodash.com/license>
  7284. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  7285. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  7286. */
  7287. const isUndefined = (val) => val === void 0;
  7288. const isBoolean = (val) => typeof val === "boolean";
  7289. const isNumber = (val) => typeof val === "number";
  7290. const isEmpty = (val) => !val && val !== 0 || isArray$1(val) && val.length === 0 || isObject$1(val) && !Object.keys(val).length;
  7291. const isElement$2 = (e) => {
  7292. if (typeof Element === "undefined")
  7293. return false;
  7294. return e instanceof Element;
  7295. };
  7296. const isPropAbsent = (prop) => isNil(prop);
  7297. const isStringNumber = (val) => {
  7298. if (!isString$1(val)) {
  7299. return false;
  7300. }
  7301. return !Number.isNaN(Number(val));
  7302. };
  7303. const isWindow$1 = (val) => val === window;
  7304. const rAF = (fn) => isClient ? window.requestAnimationFrame(fn) : setTimeout(fn, 16);
  7305. const cAF = (handle) => isClient ? window.cancelAnimationFrame(handle) : clearTimeout(handle);
  7306. const escapeStringRegexp = (string = "") => string.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
  7307. const capitalize = (str) => capitalize$2(str);
  7308. const keysOf = (arr) => Object.keys(arr);
  7309. const entriesOf = (arr) => Object.entries(arr);
  7310. const getProp = (obj, path, defaultValue) => {
  7311. return {
  7312. get value() {
  7313. return get(obj, path, defaultValue);
  7314. },
  7315. set value(val) {
  7316. set(obj, path, val);
  7317. }
  7318. };
  7319. };
  7320. class ElementPlusError extends Error {
  7321. constructor(m) {
  7322. super(m);
  7323. this.name = "ElementPlusError";
  7324. }
  7325. }
  7326. function throwError(scope, m) {
  7327. throw new ElementPlusError(`[${scope}] ${m}`);
  7328. }
  7329. function debugWarn(scope, message) {
  7330. const error = isString$1(scope) ? new ElementPlusError(`[${scope}] ${message}`) : scope;
  7331. console.warn(error);
  7332. }
  7333. const SCOPE$9 = "utils/dom/style";
  7334. const classNameToArray = (cls = "") => cls.split(" ").filter((item) => !!item.trim());
  7335. const hasClass = (el, cls) => {
  7336. if (!el || !cls)
  7337. return false;
  7338. if (cls.includes(" "))
  7339. throw new Error("className should not contain space.");
  7340. return el.classList.contains(cls);
  7341. };
  7342. const addClass = (el, cls) => {
  7343. if (!el || !cls.trim())
  7344. return;
  7345. el.classList.add(...classNameToArray(cls));
  7346. };
  7347. const removeClass = (el, cls) => {
  7348. if (!el || !cls.trim())
  7349. return;
  7350. el.classList.remove(...classNameToArray(cls));
  7351. };
  7352. const getStyle = (element, styleName) => {
  7353. var _a;
  7354. if (!isClient || !element || !styleName)
  7355. return "";
  7356. let key = camelize(styleName);
  7357. if (key === "float")
  7358. key = "cssFloat";
  7359. try {
  7360. const style = element.style[key];
  7361. if (style)
  7362. return style;
  7363. const computed = (_a = document.defaultView) == null ? void 0 : _a.getComputedStyle(element, "");
  7364. return computed ? computed[key] : "";
  7365. } catch (e) {
  7366. return element.style[key];
  7367. }
  7368. };
  7369. const setStyle = (element, styleName, value) => {
  7370. if (!element || !styleName)
  7371. return;
  7372. if (isObject$1(styleName)) {
  7373. entriesOf(styleName).forEach(([prop, value2]) => setStyle(element, prop, value2));
  7374. } else {
  7375. const key = camelize(styleName);
  7376. element.style[key] = value;
  7377. }
  7378. };
  7379. function addUnit(value, defaultUnit = "px") {
  7380. if (!value)
  7381. return "";
  7382. if (isNumber(value) || isStringNumber(value)) {
  7383. return `${value}${defaultUnit}`;
  7384. } else if (isString$1(value)) {
  7385. return value;
  7386. }
  7387. debugWarn(SCOPE$9, "binding value must be a string or number");
  7388. }
  7389. const isScroll = (el, isVertical) => {
  7390. if (!isClient)
  7391. return false;
  7392. const key = {
  7393. undefined: "overflow",
  7394. true: "overflow-y",
  7395. false: "overflow-x"
  7396. }[String(isVertical)];
  7397. const overflow = getStyle(el, key);
  7398. return ["scroll", "auto", "overlay"].some((s) => overflow.includes(s));
  7399. };
  7400. const getScrollContainer = (el, isVertical) => {
  7401. if (!isClient)
  7402. return;
  7403. let parent = el;
  7404. while (parent) {
  7405. if ([window, document, document.documentElement].includes(parent))
  7406. return window;
  7407. if (isScroll(parent, isVertical))
  7408. return parent;
  7409. parent = parent.parentNode;
  7410. }
  7411. return parent;
  7412. };
  7413. let scrollBarWidth;
  7414. const getScrollBarWidth = (namespace) => {
  7415. var _a;
  7416. if (!isClient)
  7417. return 0;
  7418. if (scrollBarWidth !== void 0)
  7419. return scrollBarWidth;
  7420. const outer = document.createElement("div");
  7421. outer.className = `${namespace}-scrollbar__wrap`;
  7422. outer.style.visibility = "hidden";
  7423. outer.style.width = "100px";
  7424. outer.style.position = "absolute";
  7425. outer.style.top = "-9999px";
  7426. document.body.appendChild(outer);
  7427. const widthNoScroll = outer.offsetWidth;
  7428. outer.style.overflow = "scroll";
  7429. const inner = document.createElement("div");
  7430. inner.style.width = "100%";
  7431. outer.appendChild(inner);
  7432. const widthWithScroll = inner.offsetWidth;
  7433. (_a = outer.parentNode) == null ? void 0 : _a.removeChild(outer);
  7434. scrollBarWidth = widthNoScroll - widthWithScroll;
  7435. return scrollBarWidth;
  7436. };
  7437. function scrollIntoView(container, selected) {
  7438. if (!isClient)
  7439. return;
  7440. if (!selected) {
  7441. container.scrollTop = 0;
  7442. return;
  7443. }
  7444. const offsetParents = [];
  7445. let pointer = selected.offsetParent;
  7446. while (pointer !== null && container !== pointer && container.contains(pointer)) {
  7447. offsetParents.push(pointer);
  7448. pointer = pointer.offsetParent;
  7449. }
  7450. const top = selected.offsetTop + offsetParents.reduce((prev, curr) => prev + curr.offsetTop, 0);
  7451. const bottom = top + selected.offsetHeight;
  7452. const viewRectTop = container.scrollTop;
  7453. const viewRectBottom = viewRectTop + container.clientHeight;
  7454. if (top < viewRectTop) {
  7455. container.scrollTop = top;
  7456. } else if (bottom > viewRectBottom) {
  7457. container.scrollTop = bottom - container.clientHeight;
  7458. }
  7459. }
  7460. function animateScrollTo(container, from, to, duration, callback) {
  7461. const startTime = Date.now();
  7462. let handle;
  7463. const scroll = () => {
  7464. const timestamp = Date.now();
  7465. const time = timestamp - startTime;
  7466. const nextScrollTop = easeInOutCubic(time > duration ? duration : time, from, to, duration);
  7467. if (isWindow$1(container)) {
  7468. container.scrollTo(window.pageXOffset, nextScrollTop);
  7469. } else {
  7470. container.scrollTop = nextScrollTop;
  7471. }
  7472. if (time < duration) {
  7473. handle = rAF(scroll);
  7474. } else if (isFunction$1(callback)) {
  7475. callback();
  7476. }
  7477. };
  7478. scroll();
  7479. return () => {
  7480. handle && cAF(handle);
  7481. };
  7482. }
  7483. const getScrollElement = (target, container) => {
  7484. if (isWindow$1(container)) {
  7485. return target.ownerDocument.documentElement;
  7486. }
  7487. return container;
  7488. };
  7489. const getScrollTop = (container) => {
  7490. if (isWindow$1(container)) {
  7491. return window.scrollY;
  7492. }
  7493. return container.scrollTop;
  7494. };
  7495. const getElement = (target) => {
  7496. if (!isClient || target === "")
  7497. return null;
  7498. if (isString$1(target)) {
  7499. try {
  7500. return document.querySelector(target);
  7501. } catch (e) {
  7502. return null;
  7503. }
  7504. }
  7505. return target;
  7506. };
  7507. let target = !isClient ? void 0 : document.body;
  7508. function createGlobalNode(id) {
  7509. const el = document.createElement("div");
  7510. if (id !== void 0) {
  7511. el.setAttribute("id", id);
  7512. }
  7513. if (target) {
  7514. target.appendChild(el);
  7515. }
  7516. return el;
  7517. }
  7518. function removeGlobalNode(el) {
  7519. el.remove();
  7520. }
  7521. var _sfc_main6 = /* @__PURE__ */ vue.defineComponent({
  7522. name: "ArrowDown",
  7523. __name: "arrow-down",
  7524. setup(__props) {
  7525. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7526. xmlns: "http://www.w3.org/2000/svg",
  7527. viewBox: "0 0 1024 1024"
  7528. }, [
  7529. vue.createElementVNode("path", {
  7530. fill: "currentColor",
  7531. d: "M831.872 340.864 512 652.672 192.128 340.864a30.59 30.59 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.59 30.59 0 0 0-42.752 0z"
  7532. })
  7533. ]));
  7534. }
  7535. });
  7536. var arrow_down_default = _sfc_main6;
  7537. var _sfc_main8 = /* @__PURE__ */ vue.defineComponent({
  7538. name: "ArrowLeft",
  7539. __name: "arrow-left",
  7540. setup(__props) {
  7541. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7542. xmlns: "http://www.w3.org/2000/svg",
  7543. viewBox: "0 0 1024 1024"
  7544. }, [
  7545. vue.createElementVNode("path", {
  7546. fill: "currentColor",
  7547. 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.59 30.59 0 0 0 0-42.752L339.264 511.936l311.872-319.872a30.59 30.59 0 0 0 0-42.688 29.12 29.12 0 0 0-41.728 0"
  7548. })
  7549. ]));
  7550. }
  7551. });
  7552. var arrow_left_default = _sfc_main8;
  7553. var _sfc_main10 = /* @__PURE__ */ vue.defineComponent({
  7554. name: "ArrowRight",
  7555. __name: "arrow-right",
  7556. setup(__props) {
  7557. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7558. xmlns: "http://www.w3.org/2000/svg",
  7559. viewBox: "0 0 1024 1024"
  7560. }, [
  7561. vue.createElementVNode("path", {
  7562. fill: "currentColor",
  7563. d: "M340.864 149.312a30.59 30.59 0 0 0 0 42.752L652.736 512 340.864 831.872a30.59 30.59 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"
  7564. })
  7565. ]));
  7566. }
  7567. });
  7568. var arrow_right_default = _sfc_main10;
  7569. var _sfc_main12 = /* @__PURE__ */ vue.defineComponent({
  7570. name: "ArrowUp",
  7571. __name: "arrow-up",
  7572. setup(__props) {
  7573. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7574. xmlns: "http://www.w3.org/2000/svg",
  7575. viewBox: "0 0 1024 1024"
  7576. }, [
  7577. vue.createElementVNode("path", {
  7578. fill: "currentColor",
  7579. 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"
  7580. })
  7581. ]));
  7582. }
  7583. });
  7584. var arrow_up_default = _sfc_main12;
  7585. var _sfc_main14 = /* @__PURE__ */ vue.defineComponent({
  7586. name: "Back",
  7587. __name: "back",
  7588. setup(__props) {
  7589. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7590. xmlns: "http://www.w3.org/2000/svg",
  7591. viewBox: "0 0 1024 1024"
  7592. }, [
  7593. vue.createElementVNode("path", {
  7594. fill: "currentColor",
  7595. d: "M224 480h640a32 32 0 1 1 0 64H224a32 32 0 0 1 0-64"
  7596. }),
  7597. vue.createElementVNode("path", {
  7598. fill: "currentColor",
  7599. 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"
  7600. })
  7601. ]));
  7602. }
  7603. });
  7604. var back_default = _sfc_main14;
  7605. var _sfc_main29 = /* @__PURE__ */ vue.defineComponent({
  7606. name: "Calendar",
  7607. __name: "calendar",
  7608. setup(__props) {
  7609. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7610. xmlns: "http://www.w3.org/2000/svg",
  7611. viewBox: "0 0 1024 1024"
  7612. }, [
  7613. vue.createElementVNode("path", {
  7614. fill: "currentColor",
  7615. 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"
  7616. })
  7617. ]));
  7618. }
  7619. });
  7620. var calendar_default = _sfc_main29;
  7621. var _sfc_main34 = /* @__PURE__ */ vue.defineComponent({
  7622. name: "CaretRight",
  7623. __name: "caret-right",
  7624. setup(__props) {
  7625. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7626. xmlns: "http://www.w3.org/2000/svg",
  7627. viewBox: "0 0 1024 1024"
  7628. }, [
  7629. vue.createElementVNode("path", {
  7630. fill: "currentColor",
  7631. d: "M384 192v640l384-320.064z"
  7632. })
  7633. ]));
  7634. }
  7635. });
  7636. var caret_right_default = _sfc_main34;
  7637. var _sfc_main35 = /* @__PURE__ */ vue.defineComponent({
  7638. name: "CaretTop",
  7639. __name: "caret-top",
  7640. setup(__props) {
  7641. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7642. xmlns: "http://www.w3.org/2000/svg",
  7643. viewBox: "0 0 1024 1024"
  7644. }, [
  7645. vue.createElementVNode("path", {
  7646. fill: "currentColor",
  7647. d: "M512 320 192 704h639.936z"
  7648. })
  7649. ]));
  7650. }
  7651. });
  7652. var caret_top_default = _sfc_main35;
  7653. var _sfc_main43 = /* @__PURE__ */ vue.defineComponent({
  7654. name: "Check",
  7655. __name: "check",
  7656. setup(__props) {
  7657. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7658. xmlns: "http://www.w3.org/2000/svg",
  7659. viewBox: "0 0 1024 1024"
  7660. }, [
  7661. vue.createElementVNode("path", {
  7662. fill: "currentColor",
  7663. 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"
  7664. })
  7665. ]));
  7666. }
  7667. });
  7668. var check_default = _sfc_main43;
  7669. var _sfc_main48 = /* @__PURE__ */ vue.defineComponent({
  7670. name: "CircleCheckFilled",
  7671. __name: "circle-check-filled",
  7672. setup(__props) {
  7673. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7674. xmlns: "http://www.w3.org/2000/svg",
  7675. viewBox: "0 0 1024 1024"
  7676. }, [
  7677. vue.createElementVNode("path", {
  7678. fill: "currentColor",
  7679. 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.27 38.27 0 0 0 54.336 0l262.4-262.464a38.4 38.4 0 1 0-54.272-54.336z"
  7680. })
  7681. ]));
  7682. }
  7683. });
  7684. var circle_check_filled_default = _sfc_main48;
  7685. var _sfc_main49 = /* @__PURE__ */ vue.defineComponent({
  7686. name: "CircleCheck",
  7687. __name: "circle-check",
  7688. setup(__props) {
  7689. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7690. xmlns: "http://www.w3.org/2000/svg",
  7691. viewBox: "0 0 1024 1024"
  7692. }, [
  7693. vue.createElementVNode("path", {
  7694. fill: "currentColor",
  7695. 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"
  7696. }),
  7697. vue.createElementVNode("path", {
  7698. fill: "currentColor",
  7699. 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.752z"
  7700. })
  7701. ]));
  7702. }
  7703. });
  7704. var circle_check_default = _sfc_main49;
  7705. var _sfc_main50 = /* @__PURE__ */ vue.defineComponent({
  7706. name: "CircleCloseFilled",
  7707. __name: "circle-close-filled",
  7708. setup(__props) {
  7709. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7710. xmlns: "http://www.w3.org/2000/svg",
  7711. viewBox: "0 0 1024 1024"
  7712. }, [
  7713. vue.createElementVNode("path", {
  7714. fill: "currentColor",
  7715. 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"
  7716. })
  7717. ]));
  7718. }
  7719. });
  7720. var circle_close_filled_default = _sfc_main50;
  7721. var _sfc_main51 = /* @__PURE__ */ vue.defineComponent({
  7722. name: "CircleClose",
  7723. __name: "circle-close",
  7724. setup(__props) {
  7725. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7726. xmlns: "http://www.w3.org/2000/svg",
  7727. viewBox: "0 0 1024 1024"
  7728. }, [
  7729. vue.createElementVNode("path", {
  7730. fill: "currentColor",
  7731. 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"
  7732. }),
  7733. vue.createElementVNode("path", {
  7734. fill: "currentColor",
  7735. 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"
  7736. })
  7737. ]));
  7738. }
  7739. });
  7740. var circle_close_default = _sfc_main51;
  7741. var _sfc_main54 = /* @__PURE__ */ vue.defineComponent({
  7742. name: "Clock",
  7743. __name: "clock",
  7744. setup(__props) {
  7745. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7746. xmlns: "http://www.w3.org/2000/svg",
  7747. viewBox: "0 0 1024 1024"
  7748. }, [
  7749. vue.createElementVNode("path", {
  7750. fill: "currentColor",
  7751. 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"
  7752. }),
  7753. vue.createElementVNode("path", {
  7754. fill: "currentColor",
  7755. d: "M480 256a32 32 0 0 1 32 32v256a32 32 0 0 1-64 0V288a32 32 0 0 1 32-32"
  7756. }),
  7757. vue.createElementVNode("path", {
  7758. fill: "currentColor",
  7759. d: "M480 512h256q32 0 32 32t-32 32H480q-32 0-32-32t32-32"
  7760. })
  7761. ]));
  7762. }
  7763. });
  7764. var clock_default = _sfc_main54;
  7765. var _sfc_main56 = /* @__PURE__ */ vue.defineComponent({
  7766. name: "Close",
  7767. __name: "close",
  7768. setup(__props) {
  7769. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7770. xmlns: "http://www.w3.org/2000/svg",
  7771. viewBox: "0 0 1024 1024"
  7772. }, [
  7773. vue.createElementVNode("path", {
  7774. fill: "currentColor",
  7775. 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"
  7776. })
  7777. ]));
  7778. }
  7779. });
  7780. var close_default = _sfc_main56;
  7781. var _sfc_main72 = /* @__PURE__ */ vue.defineComponent({
  7782. name: "DArrowLeft",
  7783. __name: "d-arrow-left",
  7784. setup(__props) {
  7785. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7786. xmlns: "http://www.w3.org/2000/svg",
  7787. viewBox: "0 0 1024 1024"
  7788. }, [
  7789. vue.createElementVNode("path", {
  7790. fill: "currentColor",
  7791. d: "M529.408 149.376a29.12 29.12 0 0 1 41.728 0 30.59 30.59 0 0 1 0 42.688L259.264 511.936l311.872 319.936a30.59 30.59 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.672zm256 0a29.12 29.12 0 0 1 41.728 0 30.59 30.59 0 0 1 0 42.688L515.264 511.936l311.872 319.936a30.59 30.59 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.672z"
  7792. })
  7793. ]));
  7794. }
  7795. });
  7796. var d_arrow_left_default = _sfc_main72;
  7797. var _sfc_main73 = /* @__PURE__ */ vue.defineComponent({
  7798. name: "DArrowRight",
  7799. __name: "d-arrow-right",
  7800. setup(__props) {
  7801. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7802. xmlns: "http://www.w3.org/2000/svg",
  7803. viewBox: "0 0 1024 1024"
  7804. }, [
  7805. vue.createElementVNode("path", {
  7806. fill: "currentColor",
  7807. 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.59 30.59 0 0 1 0-42.752L764.736 512 452.864 192a30.59 30.59 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.59 30.59 0 0 1 0-42.752L508.736 512 196.864 192a30.59 30.59 0 0 1 0-42.688"
  7808. })
  7809. ]));
  7810. }
  7811. });
  7812. var d_arrow_right_default = _sfc_main73;
  7813. var _sfc_main80 = /* @__PURE__ */ vue.defineComponent({
  7814. name: "Delete",
  7815. __name: "delete",
  7816. setup(__props) {
  7817. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7818. xmlns: "http://www.w3.org/2000/svg",
  7819. viewBox: "0 0 1024 1024"
  7820. }, [
  7821. vue.createElementVNode("path", {
  7822. fill: "currentColor",
  7823. 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"
  7824. })
  7825. ]));
  7826. }
  7827. });
  7828. var delete_default = _sfc_main80;
  7829. var _sfc_main90 = /* @__PURE__ */ vue.defineComponent({
  7830. name: "Document",
  7831. __name: "document",
  7832. setup(__props) {
  7833. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7834. xmlns: "http://www.w3.org/2000/svg",
  7835. viewBox: "0 0 1024 1024"
  7836. }, [
  7837. vue.createElementVNode("path", {
  7838. fill: "currentColor",
  7839. 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"
  7840. })
  7841. ]));
  7842. }
  7843. });
  7844. var document_default = _sfc_main90;
  7845. var _sfc_main118 = /* @__PURE__ */ vue.defineComponent({
  7846. name: "FullScreen",
  7847. __name: "full-screen",
  7848. setup(__props) {
  7849. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7850. xmlns: "http://www.w3.org/2000/svg",
  7851. viewBox: "0 0 1024 1024"
  7852. }, [
  7853. vue.createElementVNode("path", {
  7854. fill: "currentColor",
  7855. 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-64zm0 831.872-192-.192a32 32 0 0 1 0-64l192 .192V672a32 32 0 1 1 64 0v256h-64z"
  7856. })
  7857. ]));
  7858. }
  7859. });
  7860. var full_screen_default = _sfc_main118;
  7861. var _sfc_main133 = /* @__PURE__ */ vue.defineComponent({
  7862. name: "Hide",
  7863. __name: "hide",
  7864. setup(__props) {
  7865. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7866. xmlns: "http://www.w3.org/2000/svg",
  7867. viewBox: "0 0 1024 1024"
  7868. }, [
  7869. vue.createElementVNode("path", {
  7870. fill: "currentColor",
  7871. d: "M876.8 156.8c0-9.6-3.2-16-9.6-22.4s-12.8-9.6-22.4-9.6-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 176S0 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.4s3.2 16 9.6 22.4 12.8 9.6 22.4 9.6 16-3.2 22.4-9.6l704-710.4c3.2-6.4 6.4-12.8 6.4-22.4m-646.4 528Q115.2 579.2 76.8 512q43.2-72 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.4m140.8-96Q352 555.2 352 512c0-44.8 16-83.2 48-112s67.2-48 112-48c28.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.6q-43.2 72-153.6 172.8c-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-176S1024 528 1024 512s-48.001-73.6-134.401-176"
  7872. }),
  7873. vue.createElementVNode("path", {
  7874. fill: "currentColor",
  7875. 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 112s-67.2 48-112 48"
  7876. })
  7877. ]));
  7878. }
  7879. });
  7880. var hide_default = _sfc_main133;
  7881. var _sfc_main143 = /* @__PURE__ */ vue.defineComponent({
  7882. name: "InfoFilled",
  7883. __name: "info-filled",
  7884. setup(__props) {
  7885. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7886. xmlns: "http://www.w3.org/2000/svg",
  7887. viewBox: "0 0 1024 1024"
  7888. }, [
  7889. vue.createElementVNode("path", {
  7890. fill: "currentColor",
  7891. 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.99 12.99 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"
  7892. })
  7893. ]));
  7894. }
  7895. });
  7896. var info_filled_default = _sfc_main143;
  7897. var _sfc_main150 = /* @__PURE__ */ vue.defineComponent({
  7898. name: "Loading",
  7899. __name: "loading",
  7900. setup(__props) {
  7901. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7902. xmlns: "http://www.w3.org/2000/svg",
  7903. viewBox: "0 0 1024 1024"
  7904. }, [
  7905. vue.createElementVNode("path", {
  7906. fill: "currentColor",
  7907. 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.248m452.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.248M828.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 0"
  7908. })
  7909. ]));
  7910. }
  7911. });
  7912. var loading_default = _sfc_main150;
  7913. var _sfc_main169 = /* @__PURE__ */ vue.defineComponent({
  7914. name: "Minus",
  7915. __name: "minus",
  7916. setup(__props) {
  7917. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7918. xmlns: "http://www.w3.org/2000/svg",
  7919. viewBox: "0 0 1024 1024"
  7920. }, [
  7921. vue.createElementVNode("path", {
  7922. fill: "currentColor",
  7923. d: "M128 544h768a32 32 0 1 0 0-64H128a32 32 0 0 0 0 64"
  7924. })
  7925. ]));
  7926. }
  7927. });
  7928. var minus_default = _sfc_main169;
  7929. var _sfc_main174 = /* @__PURE__ */ vue.defineComponent({
  7930. name: "MoreFilled",
  7931. __name: "more-filled",
  7932. setup(__props) {
  7933. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7934. xmlns: "http://www.w3.org/2000/svg",
  7935. viewBox: "0 0 1024 1024"
  7936. }, [
  7937. vue.createElementVNode("path", {
  7938. fill: "currentColor",
  7939. 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"
  7940. })
  7941. ]));
  7942. }
  7943. });
  7944. var more_filled_default = _sfc_main174;
  7945. var _sfc_main175 = /* @__PURE__ */ vue.defineComponent({
  7946. name: "More",
  7947. __name: "more",
  7948. setup(__props) {
  7949. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7950. xmlns: "http://www.w3.org/2000/svg",
  7951. viewBox: "0 0 1024 1024"
  7952. }, [
  7953. vue.createElementVNode("path", {
  7954. fill: "currentColor",
  7955. 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"
  7956. })
  7957. ]));
  7958. }
  7959. });
  7960. var more_default = _sfc_main175;
  7961. var _sfc_main195 = /* @__PURE__ */ vue.defineComponent({
  7962. name: "PictureFilled",
  7963. __name: "picture-filled",
  7964. setup(__props) {
  7965. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7966. xmlns: "http://www.w3.org/2000/svg",
  7967. viewBox: "0 0 1024 1024"
  7968. }, [
  7969. vue.createElementVNode("path", {
  7970. fill: "currentColor",
  7971. 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"
  7972. })
  7973. ]));
  7974. }
  7975. });
  7976. var picture_filled_default = _sfc_main195;
  7977. var _sfc_main201 = /* @__PURE__ */ vue.defineComponent({
  7978. name: "Plus",
  7979. __name: "plus",
  7980. setup(__props) {
  7981. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7982. xmlns: "http://www.w3.org/2000/svg",
  7983. viewBox: "0 0 1024 1024"
  7984. }, [
  7985. vue.createElementVNode("path", {
  7986. fill: "currentColor",
  7987. 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"
  7988. })
  7989. ]));
  7990. }
  7991. });
  7992. var plus_default = _sfc_main201;
  7993. var _sfc_main211 = /* @__PURE__ */ vue.defineComponent({
  7994. name: "QuestionFilled",
  7995. __name: "question-filled",
  7996. setup(__props) {
  7997. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  7998. xmlns: "http://www.w3.org/2000/svg",
  7999. viewBox: "0 0 1024 1024"
  8000. }, [
  8001. vue.createElementVNode("path", {
  8002. fill: "currentColor",
  8003. 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.592q0-64.416-42.24-101.376c-28.16-25.344-65.472-37.312-111.232-37.312m-12.672 406.208a54.27 54.27 0 0 0-38.72 14.784 49.4 49.4 0 0 0-15.488 38.016c0 15.488 4.928 28.16 15.488 38.016A54.85 54.85 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.97 51.97 0 0 0-15.488-38.016 55.94 55.94 0 0 0-39.424-14.784"
  8004. })
  8005. ]));
  8006. }
  8007. });
  8008. var question_filled_default = _sfc_main211;
  8009. var _sfc_main215 = /* @__PURE__ */ vue.defineComponent({
  8010. name: "RefreshLeft",
  8011. __name: "refresh-left",
  8012. setup(__props) {
  8013. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  8014. xmlns: "http://www.w3.org/2000/svg",
  8015. viewBox: "0 0 1024 1024"
  8016. }, [
  8017. vue.createElementVNode("path", {
  8018. fill: "currentColor",
  8019. 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"
  8020. })
  8021. ]));
  8022. }
  8023. });
  8024. var refresh_left_default = _sfc_main215;
  8025. var _sfc_main216 = /* @__PURE__ */ vue.defineComponent({
  8026. name: "RefreshRight",
  8027. __name: "refresh-right",
  8028. setup(__props) {
  8029. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  8030. xmlns: "http://www.w3.org/2000/svg",
  8031. viewBox: "0 0 1024 1024"
  8032. }, [
  8033. vue.createElementVNode("path", {
  8034. fill: "currentColor",
  8035. 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.88"
  8036. })
  8037. ]));
  8038. }
  8039. });
  8040. var refresh_right_default = _sfc_main216;
  8041. var _sfc_main222 = /* @__PURE__ */ vue.defineComponent({
  8042. name: "ScaleToOriginal",
  8043. __name: "scale-to-original",
  8044. setup(__props) {
  8045. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  8046. xmlns: "http://www.w3.org/2000/svg",
  8047. viewBox: "0 0 1024 1024"
  8048. }, [
  8049. vue.createElementVNode("path", {
  8050. fill: "currentColor",
  8051. 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.12 30.12 0 0 0-30.118 30.118v301.177a30.118 30.118 0 0 0 60.236 0V331.294a30.12 30.12 0 0 0-30.118-30.118m-361.412 0a30.12 30.12 0 0 0-30.118 30.118v301.177a30.118 30.118 0 1 0 60.236 0V331.294a30.12 30.12 0 0 0-30.118-30.118M512 361.412a30.12 30.12 0 0 0-30.118 30.117v30.118a30.118 30.118 0 0 0 60.236 0V391.53A30.12 30.12 0 0 0 512 361.412M512 512a30.12 30.12 0 0 0-30.118 30.118v30.117a30.118 30.118 0 0 0 60.236 0v-30.117A30.12 30.12 0 0 0 512 512"
  8052. })
  8053. ]));
  8054. }
  8055. });
  8056. var scale_to_original_default = _sfc_main222;
  8057. var _sfc_main225 = /* @__PURE__ */ vue.defineComponent({
  8058. name: "Search",
  8059. __name: "search",
  8060. setup(__props) {
  8061. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  8062. xmlns: "http://www.w3.org/2000/svg",
  8063. viewBox: "0 0 1024 1024"
  8064. }, [
  8065. vue.createElementVNode("path", {
  8066. fill: "currentColor",
  8067. 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"
  8068. })
  8069. ]));
  8070. }
  8071. });
  8072. var search_default = _sfc_main225;
  8073. var _sfc_main242 = /* @__PURE__ */ vue.defineComponent({
  8074. name: "SortDown",
  8075. __name: "sort-down",
  8076. setup(__props) {
  8077. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  8078. xmlns: "http://www.w3.org/2000/svg",
  8079. viewBox: "0 0 1024 1024"
  8080. }, [
  8081. vue.createElementVNode("path", {
  8082. fill: "currentColor",
  8083. 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"
  8084. })
  8085. ]));
  8086. }
  8087. });
  8088. var sort_down_default = _sfc_main242;
  8089. var _sfc_main243 = /* @__PURE__ */ vue.defineComponent({
  8090. name: "SortUp",
  8091. __name: "sort-up",
  8092. setup(__props) {
  8093. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  8094. xmlns: "http://www.w3.org/2000/svg",
  8095. viewBox: "0 0 1024 1024"
  8096. }, [
  8097. vue.createElementVNode("path", {
  8098. fill: "currentColor",
  8099. 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"
  8100. })
  8101. ]));
  8102. }
  8103. });
  8104. var sort_up_default = _sfc_main243;
  8105. var _sfc_main246 = /* @__PURE__ */ vue.defineComponent({
  8106. name: "StarFilled",
  8107. __name: "star-filled",
  8108. setup(__props) {
  8109. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  8110. xmlns: "http://www.w3.org/2000/svg",
  8111. viewBox: "0 0 1024 1024"
  8112. }, [
  8113. vue.createElementVNode("path", {
  8114. fill: "currentColor",
  8115. d: "M313.6 924.48a70.4 70.4 0 0 1-74.152-5.365 70.4 70.4 0 0 1-27.992-68.875l37.888-220.928L88.96 472.96a70.4 70.4 0 0 1 3.788-104.225A70.4 70.4 0 0 1 128 352.896l221.76-32.256 99.2-200.96a70.4 70.4 0 0 1 100.246-28.595 70.4 70.4 0 0 1 25.962 28.595l99.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"
  8116. })
  8117. ]));
  8118. }
  8119. });
  8120. var star_filled_default = _sfc_main246;
  8121. var _sfc_main247 = /* @__PURE__ */ vue.defineComponent({
  8122. name: "Star",
  8123. __name: "star",
  8124. setup(__props) {
  8125. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  8126. xmlns: "http://www.w3.org/2000/svg",
  8127. viewBox: "0 0 1024 1024"
  8128. }, [
  8129. vue.createElementVNode("path", {
  8130. fill: "currentColor",
  8131. 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"
  8132. })
  8133. ]));
  8134. }
  8135. });
  8136. var star_default = _sfc_main247;
  8137. var _sfc_main249 = /* @__PURE__ */ vue.defineComponent({
  8138. name: "SuccessFilled",
  8139. __name: "success-filled",
  8140. setup(__props) {
  8141. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  8142. xmlns: "http://www.w3.org/2000/svg",
  8143. viewBox: "0 0 1024 1024"
  8144. }, [
  8145. vue.createElementVNode("path", {
  8146. fill: "currentColor",
  8147. 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.27 38.27 0 0 0 54.336 0l262.4-262.464a38.4 38.4 0 1 0-54.272-54.336z"
  8148. })
  8149. ]));
  8150. }
  8151. });
  8152. var success_filled_default = _sfc_main249;
  8153. var _sfc_main283 = /* @__PURE__ */ vue.defineComponent({
  8154. name: "View",
  8155. __name: "view",
  8156. setup(__props) {
  8157. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  8158. xmlns: "http://www.w3.org/2000/svg",
  8159. viewBox: "0 0 1024 1024"
  8160. }, [
  8161. vue.createElementVNode("path", {
  8162. fill: "currentColor",
  8163. 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-288m0 64a224 224 0 1 1 0 448 224 224 0 0 1 0-448m0 64a160.19 160.19 0 0 0-160 160c0 88.192 71.744 160 160 160s160-71.808 160-160-71.744-160-160-160"
  8164. })
  8165. ]));
  8166. }
  8167. });
  8168. var view_default = _sfc_main283;
  8169. var _sfc_main287 = /* @__PURE__ */ vue.defineComponent({
  8170. name: "WarningFilled",
  8171. __name: "warning-filled",
  8172. setup(__props) {
  8173. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  8174. xmlns: "http://www.w3.org/2000/svg",
  8175. viewBox: "0 0 1024 1024"
  8176. }, [
  8177. vue.createElementVNode("path", {
  8178. fill: "currentColor",
  8179. d: "M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m0 192a58.43 58.43 0 0 0-58.24 63.744l23.36 256.384a35.072 35.072 0 0 0 69.76 0l23.296-256.384A58.43 58.43 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"
  8180. })
  8181. ]));
  8182. }
  8183. });
  8184. var warning_filled_default = _sfc_main287;
  8185. var _sfc_main292 = /* @__PURE__ */ vue.defineComponent({
  8186. name: "ZoomIn",
  8187. __name: "zoom-in",
  8188. setup(__props) {
  8189. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  8190. xmlns: "http://www.w3.org/2000/svg",
  8191. viewBox: "0 0 1024 1024"
  8192. }, [
  8193. vue.createElementVNode("path", {
  8194. fill: "currentColor",
  8195. 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"
  8196. })
  8197. ]));
  8198. }
  8199. });
  8200. var zoom_in_default = _sfc_main292;
  8201. var _sfc_main293 = /* @__PURE__ */ vue.defineComponent({
  8202. name: "ZoomOut",
  8203. __name: "zoom-out",
  8204. setup(__props) {
  8205. return (_ctx, _cache) => (vue.openBlock(), vue.createElementBlock("svg", {
  8206. xmlns: "http://www.w3.org/2000/svg",
  8207. viewBox: "0 0 1024 1024"
  8208. }, [
  8209. vue.createElementVNode("path", {
  8210. fill: "currentColor",
  8211. 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"
  8212. })
  8213. ]));
  8214. }
  8215. });
  8216. var zoom_out_default = _sfc_main293;
  8217. /*! Element Plus Icons Vue v2.3.2 */
  8218. const epPropKey = "__epPropKey";
  8219. const definePropType = (val) => val;
  8220. const isEpProp = (val) => isObject$1(val) && !!val[epPropKey];
  8221. const buildProp = (prop, key) => {
  8222. if (!isObject$1(prop) || isEpProp(prop))
  8223. return prop;
  8224. const { values, required, default: defaultValue, type, validator } = prop;
  8225. const _validator = values || validator ? (val) => {
  8226. let valid = false;
  8227. let allowedValues = [];
  8228. if (values) {
  8229. allowedValues = Array.from(values);
  8230. if (hasOwn(prop, "default")) {
  8231. allowedValues.push(defaultValue);
  8232. }
  8233. valid || (valid = allowedValues.includes(val));
  8234. }
  8235. if (validator)
  8236. valid || (valid = validator(val));
  8237. if (!valid && allowedValues.length > 0) {
  8238. const allowValuesText = [...new Set(allowedValues)].map((value) => JSON.stringify(value)).join(", ");
  8239. vue.warn(`Invalid prop: validation failed${key ? ` for prop "${key}"` : ""}. Expected one of [${allowValuesText}], got value ${JSON.stringify(val)}.`);
  8240. }
  8241. return valid;
  8242. } : void 0;
  8243. const epProp = {
  8244. type,
  8245. required: !!required,
  8246. validator: _validator,
  8247. [epPropKey]: true
  8248. };
  8249. if (hasOwn(prop, "default"))
  8250. epProp.default = defaultValue;
  8251. return epProp;
  8252. };
  8253. const buildProps = (props) => fromPairs(Object.entries(props).map(([key, option]) => [
  8254. key,
  8255. buildProp(option, key)
  8256. ]));
  8257. const iconPropType = definePropType([
  8258. String,
  8259. Object,
  8260. Function
  8261. ]);
  8262. const CloseComponents = {
  8263. Close: close_default
  8264. };
  8265. const TypeComponents = {
  8266. Close: close_default,
  8267. SuccessFilled: success_filled_default,
  8268. InfoFilled: info_filled_default,
  8269. WarningFilled: warning_filled_default,
  8270. CircleCloseFilled: circle_close_filled_default
  8271. };
  8272. const TypeComponentsMap = {
  8273. primary: info_filled_default,
  8274. success: success_filled_default,
  8275. warning: warning_filled_default,
  8276. error: circle_close_filled_default,
  8277. info: info_filled_default
  8278. };
  8279. const ValidateComponentsMap = {
  8280. validating: loading_default,
  8281. success: circle_check_default,
  8282. error: circle_close_default
  8283. };
  8284. const withInstall = (main, extra) => {
  8285. main.install = (app) => {
  8286. for (const comp of [main, ...Object.values(extra != null ? extra : {})]) {
  8287. app.component(comp.name, comp);
  8288. }
  8289. };
  8290. if (extra) {
  8291. for (const [key, comp] of Object.entries(extra)) {
  8292. main[key] = comp;
  8293. }
  8294. }
  8295. return main;
  8296. };
  8297. const withInstallFunction = (fn, name) => {
  8298. fn.install = (app) => {
  8299. fn._context = app._context;
  8300. app.config.globalProperties[name] = fn;
  8301. };
  8302. return fn;
  8303. };
  8304. const withInstallDirective = (directive, name) => {
  8305. directive.install = (app) => {
  8306. app.directive(name, directive);
  8307. };
  8308. return directive;
  8309. };
  8310. const withNoopInstall = (component) => {
  8311. component.install = NOOP;
  8312. return component;
  8313. };
  8314. const composeRefs = (...refs) => {
  8315. return (el) => {
  8316. refs.forEach((ref) => {
  8317. ref.value = el;
  8318. });
  8319. };
  8320. };
  8321. const isValidComponentSize = (val) => ["", ...componentSizes].includes(val);
  8322. const SCOPE$8 = "utils/vue/vnode";
  8323. var PatchFlags = /* @__PURE__ */ ((PatchFlags2) => {
  8324. PatchFlags2[PatchFlags2["TEXT"] = 1] = "TEXT";
  8325. PatchFlags2[PatchFlags2["CLASS"] = 2] = "CLASS";
  8326. PatchFlags2[PatchFlags2["STYLE"] = 4] = "STYLE";
  8327. PatchFlags2[PatchFlags2["PROPS"] = 8] = "PROPS";
  8328. PatchFlags2[PatchFlags2["FULL_PROPS"] = 16] = "FULL_PROPS";
  8329. PatchFlags2[PatchFlags2["HYDRATE_EVENTS"] = 32] = "HYDRATE_EVENTS";
  8330. PatchFlags2[PatchFlags2["STABLE_FRAGMENT"] = 64] = "STABLE_FRAGMENT";
  8331. PatchFlags2[PatchFlags2["KEYED_FRAGMENT"] = 128] = "KEYED_FRAGMENT";
  8332. PatchFlags2[PatchFlags2["UNKEYED_FRAGMENT"] = 256] = "UNKEYED_FRAGMENT";
  8333. PatchFlags2[PatchFlags2["NEED_PATCH"] = 512] = "NEED_PATCH";
  8334. PatchFlags2[PatchFlags2["DYNAMIC_SLOTS"] = 1024] = "DYNAMIC_SLOTS";
  8335. PatchFlags2[PatchFlags2["HOISTED"] = -1] = "HOISTED";
  8336. PatchFlags2[PatchFlags2["BAIL"] = -2] = "BAIL";
  8337. return PatchFlags2;
  8338. })(PatchFlags || {});
  8339. function isFragment(node) {
  8340. return vue.isVNode(node) && node.type === vue.Fragment;
  8341. }
  8342. function isComment(node) {
  8343. return vue.isVNode(node) && node.type === vue.Comment;
  8344. }
  8345. function isValidElementNode(node) {
  8346. return vue.isVNode(node) && !isFragment(node) && !isComment(node);
  8347. }
  8348. const getNormalizedProps = (node) => {
  8349. if (!vue.isVNode(node)) {
  8350. debugWarn(SCOPE$8, "[getNormalizedProps] must be a VNode");
  8351. return {};
  8352. }
  8353. const raw = node.props || {};
  8354. const type = (vue.isVNode(node.type) ? node.type.props : void 0) || {};
  8355. const props = {};
  8356. Object.keys(type).forEach((key) => {
  8357. if (hasOwn(type[key], "default")) {
  8358. props[key] = type[key].default;
  8359. }
  8360. });
  8361. Object.keys(raw).forEach((key) => {
  8362. props[camelize(key)] = raw[key];
  8363. });
  8364. return props;
  8365. };
  8366. const flattedChildren = (children) => {
  8367. const vNodes = isArray$1(children) ? children : [children];
  8368. const result = [];
  8369. vNodes.forEach((child) => {
  8370. var _a;
  8371. if (isArray$1(child)) {
  8372. result.push(...flattedChildren(child));
  8373. } else if (vue.isVNode(child) && ((_a = child.component) == null ? void 0 : _a.subTree)) {
  8374. result.push(child, ...flattedChildren(child.component.subTree));
  8375. } else if (vue.isVNode(child) && isArray$1(child.children)) {
  8376. result.push(...flattedChildren(child.children));
  8377. } else if (vue.isVNode(child) && child.shapeFlag === 2) {
  8378. result.push(...flattedChildren(child.type()));
  8379. } else {
  8380. result.push(child);
  8381. }
  8382. });
  8383. return result;
  8384. };
  8385. const unique = (arr) => [...new Set(arr)];
  8386. const extractFirst = (arr) => {
  8387. return isArray$1(arr) ? arr[0] : arr;
  8388. };
  8389. const castArray = (arr) => {
  8390. if (!arr && arr !== 0)
  8391. return [];
  8392. return isArray$1(arr) ? arr : [arr];
  8393. };
  8394. const isKorean = (text) => /([\uAC00-\uD7AF\u3130-\u318F])+/gi.test(text);
  8395. const mutable = (val) => val;
  8396. function throttleByRaf(cb) {
  8397. let timer = 0;
  8398. const throttle = (...args) => {
  8399. if (timer) {
  8400. cAF(timer);
  8401. }
  8402. timer = rAF(() => {
  8403. cb(...args);
  8404. timer = 0;
  8405. });
  8406. };
  8407. throttle.cancel = () => {
  8408. cAF(timer);
  8409. timer = 0;
  8410. };
  8411. return throttle;
  8412. }
  8413. const DEFAULT_EXCLUDE_KEYS = ["class", "style"];
  8414. const LISTENER_PREFIX = /^on[A-Z]/;
  8415. const useAttrs = (params = {}) => {
  8416. const { excludeListeners = false, excludeKeys } = params;
  8417. const allExcludeKeys = vue.computed(() => {
  8418. return ((excludeKeys == null ? void 0 : excludeKeys.value) || []).concat(DEFAULT_EXCLUDE_KEYS);
  8419. });
  8420. const instance = vue.getCurrentInstance();
  8421. if (!instance) {
  8422. debugWarn("use-attrs", "getCurrentInstance() returned null. useAttrs() must be called at the top of a setup function");
  8423. return vue.computed(() => ({}));
  8424. }
  8425. return vue.computed(() => {
  8426. var _a;
  8427. return fromPairs(Object.entries((_a = instance.proxy) == null ? void 0 : _a.$attrs).filter(([key]) => !allExcludeKeys.value.includes(key) && !(excludeListeners && LISTENER_PREFIX.test(key))));
  8428. });
  8429. };
  8430. function useCalcInputWidth() {
  8431. const calculatorRef = vue.shallowRef();
  8432. const calculatorWidth = vue.ref(0);
  8433. const inputStyle = vue.computed(() => ({
  8434. minWidth: `${Math.max(calculatorWidth.value, MINIMUM_INPUT_WIDTH)}px`
  8435. }));
  8436. const resetCalculatorWidth = () => {
  8437. var _a, _b;
  8438. calculatorWidth.value = (_b = (_a = calculatorRef.value) == null ? void 0 : _a.getBoundingClientRect().width) != null ? _b : 0;
  8439. };
  8440. useResizeObserver(calculatorRef, resetCalculatorWidth);
  8441. return {
  8442. calculatorRef,
  8443. calculatorWidth,
  8444. inputStyle
  8445. };
  8446. }
  8447. const useDeprecated = ({ from, replacement, scope, version, ref, type = "API" }, condition) => {
  8448. vue.watch(() => vue.unref(condition), (val) => {
  8449. if (val) {
  8450. debugWarn(scope, `[${type}] ${from} is about to be deprecated in version ${version}, please use ${replacement} instead.
  8451. For more detail, please visit: ${ref}
  8452. `);
  8453. }
  8454. }, {
  8455. immediate: true
  8456. });
  8457. };
  8458. const useDraggable = (targetRef, dragRef, draggable, overflow) => {
  8459. const transform = {
  8460. offsetX: 0,
  8461. offsetY: 0
  8462. };
  8463. const isDragging = vue.ref(false);
  8464. const adjustPosition = (moveX, moveY) => {
  8465. if (targetRef.value) {
  8466. const { offsetX, offsetY } = transform;
  8467. const targetRect = targetRef.value.getBoundingClientRect();
  8468. const targetLeft = targetRect.left;
  8469. const targetTop = targetRect.top;
  8470. const targetWidth = targetRect.width;
  8471. const targetHeight = targetRect.height;
  8472. const clientWidth = document.documentElement.clientWidth;
  8473. const clientHeight = document.documentElement.clientHeight;
  8474. const minLeft = -targetLeft + offsetX;
  8475. const minTop = -targetTop + offsetY;
  8476. const maxLeft = clientWidth - targetLeft - targetWidth + offsetX;
  8477. const maxTop = clientHeight - targetTop - (targetHeight < clientHeight ? targetHeight : 0) + offsetY;
  8478. if (!(overflow == null ? void 0 : overflow.value)) {
  8479. moveX = Math.min(Math.max(moveX, minLeft), maxLeft);
  8480. moveY = Math.min(Math.max(moveY, minTop), maxTop);
  8481. }
  8482. transform.offsetX = moveX;
  8483. transform.offsetY = moveY;
  8484. targetRef.value.style.transform = `translate(${addUnit(moveX)}, ${addUnit(moveY)})`;
  8485. }
  8486. };
  8487. const onMousedown = (e) => {
  8488. const downX = e.clientX;
  8489. const downY = e.clientY;
  8490. const { offsetX, offsetY } = transform;
  8491. const onMousemove = (e2) => {
  8492. if (!isDragging.value) {
  8493. isDragging.value = true;
  8494. }
  8495. const moveX = offsetX + e2.clientX - downX;
  8496. const moveY = offsetY + e2.clientY - downY;
  8497. adjustPosition(moveX, moveY);
  8498. };
  8499. const onMouseup = () => {
  8500. isDragging.value = false;
  8501. document.removeEventListener("mousemove", onMousemove);
  8502. document.removeEventListener("mouseup", onMouseup);
  8503. };
  8504. document.addEventListener("mousemove", onMousemove);
  8505. document.addEventListener("mouseup", onMouseup);
  8506. };
  8507. const onDraggable = () => {
  8508. if (dragRef.value && targetRef.value) {
  8509. dragRef.value.addEventListener("mousedown", onMousedown);
  8510. window.addEventListener("resize", updatePosition);
  8511. }
  8512. };
  8513. const offDraggable = () => {
  8514. if (dragRef.value && targetRef.value) {
  8515. dragRef.value.removeEventListener("mousedown", onMousedown);
  8516. window.removeEventListener("resize", updatePosition);
  8517. }
  8518. };
  8519. const resetPosition = () => {
  8520. transform.offsetX = 0;
  8521. transform.offsetY = 0;
  8522. if (targetRef.value) {
  8523. targetRef.value.style.transform = "";
  8524. }
  8525. };
  8526. const updatePosition = () => {
  8527. const { offsetX, offsetY } = transform;
  8528. adjustPosition(offsetX, offsetY);
  8529. };
  8530. vue.onMounted(() => {
  8531. vue.watchEffect(() => {
  8532. if (draggable.value) {
  8533. onDraggable();
  8534. } else {
  8535. offDraggable();
  8536. }
  8537. });
  8538. });
  8539. vue.onBeforeUnmount(() => {
  8540. offDraggable();
  8541. });
  8542. return {
  8543. isDragging,
  8544. resetPosition,
  8545. updatePosition
  8546. };
  8547. };
  8548. const useFocus = (el) => {
  8549. return {
  8550. focus: () => {
  8551. var _a, _b;
  8552. (_b = (_a = el.value) == null ? void 0 : _a.focus) == null ? void 0 : _b.call(_a);
  8553. }
  8554. };
  8555. };
  8556. var English = {
  8557. name: "en",
  8558. el: {
  8559. breadcrumb: {
  8560. label: "Breadcrumb"
  8561. },
  8562. colorpicker: {
  8563. confirm: "OK",
  8564. clear: "Clear",
  8565. defaultLabel: "color picker",
  8566. description: "current color is {color}. press enter to select a new color.",
  8567. alphaLabel: "pick alpha value",
  8568. alphaDescription: "alpha {alpha}, current color is {color}",
  8569. hueLabel: "pick hue value",
  8570. hueDescription: "hue {hue}, current color is {color}",
  8571. svLabel: "pick saturation and brightness value",
  8572. svDescription: "saturation {saturation}, brightness {brightness}, current color is {color}",
  8573. predefineDescription: "select {value} as the color"
  8574. },
  8575. datepicker: {
  8576. now: "Now",
  8577. today: "Today",
  8578. cancel: "Cancel",
  8579. clear: "Clear",
  8580. confirm: "OK",
  8581. dateTablePrompt: "Use the arrow keys and enter to select the day of the month",
  8582. monthTablePrompt: "Use the arrow keys and enter to select the month",
  8583. yearTablePrompt: "Use the arrow keys and enter to select the year",
  8584. selectedDate: "Selected date",
  8585. selectDate: "Select date",
  8586. selectTime: "Select time",
  8587. startDate: "Start Date",
  8588. startTime: "Start Time",
  8589. endDate: "End Date",
  8590. endTime: "End Time",
  8591. prevYear: "Previous Year",
  8592. nextYear: "Next Year",
  8593. prevMonth: "Previous Month",
  8594. nextMonth: "Next Month",
  8595. year: "",
  8596. month1: "January",
  8597. month2: "February",
  8598. month3: "March",
  8599. month4: "April",
  8600. month5: "May",
  8601. month6: "June",
  8602. month7: "July",
  8603. month8: "August",
  8604. month9: "September",
  8605. month10: "October",
  8606. month11: "November",
  8607. month12: "December",
  8608. weeks: {
  8609. sun: "Sun",
  8610. mon: "Mon",
  8611. tue: "Tue",
  8612. wed: "Wed",
  8613. thu: "Thu",
  8614. fri: "Fri",
  8615. sat: "Sat"
  8616. },
  8617. weeksFull: {
  8618. sun: "Sunday",
  8619. mon: "Monday",
  8620. tue: "Tuesday",
  8621. wed: "Wednesday",
  8622. thu: "Thursday",
  8623. fri: "Friday",
  8624. sat: "Saturday"
  8625. },
  8626. months: {
  8627. jan: "Jan",
  8628. feb: "Feb",
  8629. mar: "Mar",
  8630. apr: "Apr",
  8631. may: "May",
  8632. jun: "Jun",
  8633. jul: "Jul",
  8634. aug: "Aug",
  8635. sep: "Sep",
  8636. oct: "Oct",
  8637. nov: "Nov",
  8638. dec: "Dec"
  8639. }
  8640. },
  8641. inputNumber: {
  8642. decrease: "decrease number",
  8643. increase: "increase number"
  8644. },
  8645. select: {
  8646. loading: "Loading",
  8647. noMatch: "No matching data",
  8648. noData: "No data",
  8649. placeholder: "Select"
  8650. },
  8651. mention: {
  8652. loading: "Loading"
  8653. },
  8654. dropdown: {
  8655. toggleDropdown: "Toggle Dropdown"
  8656. },
  8657. cascader: {
  8658. noMatch: "No matching data",
  8659. loading: "Loading",
  8660. placeholder: "Select",
  8661. noData: "No data"
  8662. },
  8663. pagination: {
  8664. goto: "Go to",
  8665. pagesize: "/page",
  8666. total: "Total {total}",
  8667. pageClassifier: "",
  8668. page: "Page",
  8669. prev: "Go to previous page",
  8670. next: "Go to next page",
  8671. currentPage: "page {pager}",
  8672. prevPages: "Previous {pager} pages",
  8673. nextPages: "Next {pager} pages",
  8674. deprecationWarning: "Deprecated usages detected, please refer to the el-pagination documentation for more details"
  8675. },
  8676. dialog: {
  8677. close: "Close this dialog"
  8678. },
  8679. drawer: {
  8680. close: "Close this dialog"
  8681. },
  8682. messagebox: {
  8683. title: "Message",
  8684. confirm: "OK",
  8685. cancel: "Cancel",
  8686. error: "Illegal input",
  8687. close: "Close this dialog"
  8688. },
  8689. upload: {
  8690. deleteTip: "press delete to remove",
  8691. delete: "Delete",
  8692. preview: "Preview",
  8693. continue: "Continue"
  8694. },
  8695. slider: {
  8696. defaultLabel: "slider between {min} and {max}",
  8697. defaultRangeStartLabel: "pick start value",
  8698. defaultRangeEndLabel: "pick end value"
  8699. },
  8700. table: {
  8701. emptyText: "No Data",
  8702. confirmFilter: "Confirm",
  8703. resetFilter: "Reset",
  8704. clearFilter: "All",
  8705. sumText: "Sum"
  8706. },
  8707. tour: {
  8708. next: "Next",
  8709. previous: "Previous",
  8710. finish: "Finish",
  8711. close: "Close this dialog"
  8712. },
  8713. tree: {
  8714. emptyText: "No Data"
  8715. },
  8716. transfer: {
  8717. noMatch: "No matching data",
  8718. noData: "No data",
  8719. titles: ["List 1", "List 2"],
  8720. filterPlaceholder: "Enter keyword",
  8721. noCheckedFormat: "{total} items",
  8722. hasCheckedFormat: "{checked}/{total} checked"
  8723. },
  8724. image: {
  8725. error: "FAILED"
  8726. },
  8727. pageHeader: {
  8728. title: "Back"
  8729. },
  8730. popconfirm: {
  8731. confirmButtonText: "Yes",
  8732. cancelButtonText: "No"
  8733. },
  8734. carousel: {
  8735. leftArrow: "Carousel arrow left",
  8736. rightArrow: "Carousel arrow right",
  8737. indicator: "Carousel switch to index {index}"
  8738. }
  8739. }
  8740. };
  8741. const buildTranslator = (locale) => (path, option) => translate(path, option, vue.unref(locale));
  8742. const translate = (path, option, locale) => get(locale, path, path).replace(/\{(\w+)\}/g, (_, key) => {
  8743. var _a;
  8744. return `${(_a = option == null ? void 0 : option[key]) != null ? _a : `{${key}}`}`;
  8745. });
  8746. const buildLocaleContext = (locale) => {
  8747. const lang = vue.computed(() => vue.unref(locale).name);
  8748. const localeRef = vue.isRef(locale) ? locale : vue.ref(locale);
  8749. return {
  8750. lang,
  8751. locale: localeRef,
  8752. t: buildTranslator(locale)
  8753. };
  8754. };
  8755. const localeContextKey = Symbol("localeContextKey");
  8756. const useLocale = (localeOverrides) => {
  8757. const locale = localeOverrides || vue.inject(localeContextKey, vue.ref());
  8758. return buildLocaleContext(vue.computed(() => locale.value || English));
  8759. };
  8760. const defaultNamespace = "el";
  8761. const statePrefix = "is-";
  8762. const _bem = (namespace, block, blockSuffix, element, modifier) => {
  8763. let cls = `${namespace}-${block}`;
  8764. if (blockSuffix) {
  8765. cls += `-${blockSuffix}`;
  8766. }
  8767. if (element) {
  8768. cls += `__${element}`;
  8769. }
  8770. if (modifier) {
  8771. cls += `--${modifier}`;
  8772. }
  8773. return cls;
  8774. };
  8775. const namespaceContextKey = Symbol("namespaceContextKey");
  8776. const useGetDerivedNamespace = (namespaceOverrides) => {
  8777. const derivedNamespace = namespaceOverrides || (vue.getCurrentInstance() ? vue.inject(namespaceContextKey, vue.ref(defaultNamespace)) : vue.ref(defaultNamespace));
  8778. const namespace = vue.computed(() => {
  8779. return vue.unref(derivedNamespace) || defaultNamespace;
  8780. });
  8781. return namespace;
  8782. };
  8783. const useNamespace = (block, namespaceOverrides) => {
  8784. const namespace = useGetDerivedNamespace(namespaceOverrides);
  8785. const b = (blockSuffix = "") => _bem(namespace.value, block, blockSuffix, "", "");
  8786. const e = (element) => element ? _bem(namespace.value, block, "", element, "") : "";
  8787. const m = (modifier) => modifier ? _bem(namespace.value, block, "", "", modifier) : "";
  8788. const be = (blockSuffix, element) => blockSuffix && element ? _bem(namespace.value, block, blockSuffix, element, "") : "";
  8789. const em = (element, modifier) => element && modifier ? _bem(namespace.value, block, "", element, modifier) : "";
  8790. const bm = (blockSuffix, modifier) => blockSuffix && modifier ? _bem(namespace.value, block, blockSuffix, "", modifier) : "";
  8791. const bem = (blockSuffix, element, modifier) => blockSuffix && element && modifier ? _bem(namespace.value, block, blockSuffix, element, modifier) : "";
  8792. const is = (name, ...args) => {
  8793. const state = args.length >= 1 ? args[0] : true;
  8794. return name && state ? `${statePrefix}${name}` : "";
  8795. };
  8796. const cssVar = (object) => {
  8797. const styles = {};
  8798. for (const key in object) {
  8799. if (object[key]) {
  8800. styles[`--${namespace.value}-${key}`] = object[key];
  8801. }
  8802. }
  8803. return styles;
  8804. };
  8805. const cssVarBlock = (object) => {
  8806. const styles = {};
  8807. for (const key in object) {
  8808. if (object[key]) {
  8809. styles[`--${namespace.value}-${block}-${key}`] = object[key];
  8810. }
  8811. }
  8812. return styles;
  8813. };
  8814. const cssVarName = (name) => `--${namespace.value}-${name}`;
  8815. const cssVarBlockName = (name) => `--${namespace.value}-${block}-${name}`;
  8816. return {
  8817. namespace,
  8818. b,
  8819. e,
  8820. m,
  8821. be,
  8822. em,
  8823. bm,
  8824. bem,
  8825. is,
  8826. cssVar,
  8827. cssVarName,
  8828. cssVarBlock,
  8829. cssVarBlockName
  8830. };
  8831. };
  8832. const useLockscreen = (trigger, options = {}) => {
  8833. if (!vue.isRef(trigger)) {
  8834. throwError("[useLockscreen]", "You need to pass a ref param to this function");
  8835. }
  8836. const ns = options.ns || useNamespace("popup");
  8837. const hiddenCls = vue.computed(() => ns.bm("parent", "hidden"));
  8838. let scrollBarWidth = 0;
  8839. let withoutHiddenClass = false;
  8840. let bodyWidth = "0";
  8841. const cleanup = () => {
  8842. setTimeout(() => {
  8843. if (typeof document === "undefined")
  8844. return;
  8845. if (withoutHiddenClass && document) {
  8846. document.body.style.width = bodyWidth;
  8847. removeClass(document.body, hiddenCls.value);
  8848. }
  8849. }, 200);
  8850. };
  8851. vue.watch(trigger, (val) => {
  8852. if (!val) {
  8853. cleanup();
  8854. return;
  8855. }
  8856. withoutHiddenClass = !hasClass(document.body, hiddenCls.value);
  8857. if (withoutHiddenClass) {
  8858. bodyWidth = document.body.style.width;
  8859. addClass(document.body, hiddenCls.value);
  8860. }
  8861. scrollBarWidth = getScrollBarWidth(ns.namespace.value);
  8862. const bodyHasOverflow = document.documentElement.clientHeight < document.body.scrollHeight;
  8863. const bodyOverflowY = getStyle(document.body, "overflowY");
  8864. if (scrollBarWidth > 0 && (bodyHasOverflow || bodyOverflowY === "scroll") && withoutHiddenClass) {
  8865. document.body.style.width = `calc(100% - ${scrollBarWidth}px)`;
  8866. }
  8867. });
  8868. vue.onScopeDispose(() => cleanup());
  8869. };
  8870. const modalStack = [];
  8871. const closeModal = (e) => {
  8872. if (modalStack.length === 0)
  8873. return;
  8874. const code = getEventCode(e);
  8875. if (code === EVENT_CODE.esc) {
  8876. e.stopPropagation();
  8877. const topModal = modalStack[modalStack.length - 1];
  8878. topModal.handleClose();
  8879. }
  8880. };
  8881. const useModal = (instance, visibleRef) => {
  8882. vue.watch(visibleRef, (val) => {
  8883. if (val) {
  8884. modalStack.push(instance);
  8885. } else {
  8886. modalStack.splice(modalStack.indexOf(instance), 1);
  8887. }
  8888. });
  8889. };
  8890. if (isClient)
  8891. useEventListener(document, "keydown", closeModal);
  8892. const _prop = buildProp({
  8893. type: definePropType(Boolean),
  8894. default: null
  8895. });
  8896. const _event = buildProp({
  8897. type: definePropType(Function)
  8898. });
  8899. const createModelToggleComposable = (name) => {
  8900. const updateEventKey = `update:${name}`;
  8901. const updateEventKeyRaw = `onUpdate:${name}`;
  8902. const useModelToggleEmits2 = [updateEventKey];
  8903. const useModelToggleProps2 = {
  8904. [name]: _prop,
  8905. [updateEventKeyRaw]: _event
  8906. };
  8907. const useModelToggle2 = ({
  8908. indicator,
  8909. toggleReason,
  8910. shouldHideWhenRouteChanges,
  8911. shouldProceed,
  8912. onShow,
  8913. onHide
  8914. }) => {
  8915. const instance = vue.getCurrentInstance();
  8916. const { emit } = instance;
  8917. const props = instance.props;
  8918. const hasUpdateHandler = vue.computed(() => isFunction$1(props[updateEventKeyRaw]));
  8919. const isModelBindingAbsent = vue.computed(() => props[name] === null);
  8920. const doShow = (event) => {
  8921. if (indicator.value === true) {
  8922. return;
  8923. }
  8924. indicator.value = true;
  8925. if (toggleReason) {
  8926. toggleReason.value = event;
  8927. }
  8928. if (isFunction$1(onShow)) {
  8929. onShow(event);
  8930. }
  8931. };
  8932. const doHide = (event) => {
  8933. if (indicator.value === false) {
  8934. return;
  8935. }
  8936. indicator.value = false;
  8937. if (toggleReason) {
  8938. toggleReason.value = event;
  8939. }
  8940. if (isFunction$1(onHide)) {
  8941. onHide(event);
  8942. }
  8943. };
  8944. const show = (event) => {
  8945. if (props.disabled === true || isFunction$1(shouldProceed) && !shouldProceed())
  8946. return;
  8947. const shouldEmit = hasUpdateHandler.value && isClient;
  8948. if (shouldEmit) {
  8949. emit(updateEventKey, true);
  8950. }
  8951. if (isModelBindingAbsent.value || !shouldEmit) {
  8952. doShow(event);
  8953. }
  8954. };
  8955. const hide = (event) => {
  8956. if (props.disabled === true || !isClient)
  8957. return;
  8958. const shouldEmit = hasUpdateHandler.value && isClient;
  8959. if (shouldEmit) {
  8960. emit(updateEventKey, false);
  8961. }
  8962. if (isModelBindingAbsent.value || !shouldEmit) {
  8963. doHide(event);
  8964. }
  8965. };
  8966. const onChange = (val) => {
  8967. if (!isBoolean(val))
  8968. return;
  8969. if (props.disabled && val) {
  8970. if (hasUpdateHandler.value) {
  8971. emit(updateEventKey, false);
  8972. }
  8973. } else if (indicator.value !== val) {
  8974. if (val) {
  8975. doShow();
  8976. } else {
  8977. doHide();
  8978. }
  8979. }
  8980. };
  8981. const toggle = () => {
  8982. if (indicator.value) {
  8983. hide();
  8984. } else {
  8985. show();
  8986. }
  8987. };
  8988. vue.watch(() => props[name], onChange);
  8989. if (shouldHideWhenRouteChanges && instance.appContext.config.globalProperties.$route !== void 0) {
  8990. vue.watch(() => ({
  8991. ...instance.proxy.$route
  8992. }), () => {
  8993. if (shouldHideWhenRouteChanges.value && indicator.value) {
  8994. hide();
  8995. }
  8996. });
  8997. }
  8998. vue.onMounted(() => {
  8999. onChange(props[name]);
  9000. });
  9001. return {
  9002. hide,
  9003. show,
  9004. toggle,
  9005. hasUpdateHandler
  9006. };
  9007. };
  9008. return {
  9009. useModelToggle: useModelToggle2,
  9010. useModelToggleProps: useModelToggleProps2,
  9011. useModelToggleEmits: useModelToggleEmits2
  9012. };
  9013. };
  9014. const { useModelToggle, useModelToggleProps, useModelToggleEmits } = createModelToggleComposable("modelValue");
  9015. const usePreventGlobal = (indicator, evt, cb) => {
  9016. const prevent = (e) => {
  9017. if (cb(e))
  9018. e.stopImmediatePropagation();
  9019. };
  9020. let stop = void 0;
  9021. vue.watch(() => indicator.value, (val) => {
  9022. if (val) {
  9023. stop = useEventListener(document, evt, prevent, true);
  9024. } else {
  9025. stop == null ? void 0 : stop();
  9026. }
  9027. }, { immediate: true });
  9028. };
  9029. const useProp = (name) => {
  9030. const vm = vue.getCurrentInstance();
  9031. return vue.computed(() => {
  9032. var _a, _b;
  9033. return (_b = (_a = vm == null ? void 0 : vm.proxy) == null ? void 0 : _a.$props) == null ? void 0 : _b[name];
  9034. });
  9035. };
  9036. 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});
  9037. const usePopper = (referenceElementRef, popperElementRef, opts = {}) => {
  9038. const stateUpdater = {
  9039. name: "updateState",
  9040. enabled: true,
  9041. phase: "write",
  9042. fn: ({ state }) => {
  9043. const derivedState = deriveState(state);
  9044. Object.assign(states.value, derivedState);
  9045. },
  9046. requires: ["computeStyles"]
  9047. };
  9048. const options = vue.computed(() => {
  9049. const { onFirstUpdate, placement, strategy, modifiers } = vue.unref(opts);
  9050. return {
  9051. onFirstUpdate,
  9052. placement: placement || "bottom",
  9053. strategy: strategy || "absolute",
  9054. modifiers: [
  9055. ...modifiers || [],
  9056. stateUpdater,
  9057. { name: "applyStyles", enabled: false }
  9058. ]
  9059. };
  9060. });
  9061. const instanceRef = vue.shallowRef();
  9062. const states = vue.ref({
  9063. styles: {
  9064. popper: {
  9065. position: vue.unref(options).strategy,
  9066. left: "0",
  9067. top: "0"
  9068. },
  9069. arrow: {
  9070. position: "absolute"
  9071. }
  9072. },
  9073. attributes: {}
  9074. });
  9075. const destroy = () => {
  9076. if (!instanceRef.value)
  9077. return;
  9078. instanceRef.value.destroy();
  9079. instanceRef.value = void 0;
  9080. };
  9081. vue.watch(options, (newOptions) => {
  9082. const instance = vue.unref(instanceRef);
  9083. if (instance) {
  9084. instance.setOptions(newOptions);
  9085. }
  9086. }, {
  9087. deep: true
  9088. });
  9089. vue.watch([referenceElementRef, popperElementRef], ([referenceElement, popperElement]) => {
  9090. destroy();
  9091. if (!referenceElement || !popperElement)
  9092. return;
  9093. instanceRef.value = yn(referenceElement, popperElement, vue.unref(options));
  9094. });
  9095. vue.onBeforeUnmount(() => {
  9096. destroy();
  9097. });
  9098. return {
  9099. state: vue.computed(() => {
  9100. var _a;
  9101. return { ...((_a = vue.unref(instanceRef)) == null ? void 0 : _a.state) || {} };
  9102. }),
  9103. styles: vue.computed(() => vue.unref(states).styles),
  9104. attributes: vue.computed(() => vue.unref(states).attributes),
  9105. update: () => {
  9106. var _a;
  9107. return (_a = vue.unref(instanceRef)) == null ? void 0 : _a.update();
  9108. },
  9109. forceUpdate: () => {
  9110. var _a;
  9111. return (_a = vue.unref(instanceRef)) == null ? void 0 : _a.forceUpdate();
  9112. },
  9113. instanceRef: vue.computed(() => vue.unref(instanceRef))
  9114. };
  9115. };
  9116. function deriveState(state) {
  9117. const elements = Object.keys(state.elements);
  9118. const styles = fromPairs(elements.map((element) => [element, state.styles[element] || {}]));
  9119. const attributes = fromPairs(elements.map((element) => [element, state.attributes[element]]));
  9120. return {
  9121. styles,
  9122. attributes
  9123. };
  9124. }
  9125. const useSameTarget = (handleClick) => {
  9126. if (!handleClick) {
  9127. return { onClick: NOOP, onMousedown: NOOP, onMouseup: NOOP };
  9128. }
  9129. let mousedownTarget = false;
  9130. let mouseupTarget = false;
  9131. const onClick = (e) => {
  9132. if (mousedownTarget && mouseupTarget) {
  9133. handleClick(e);
  9134. }
  9135. mousedownTarget = mouseupTarget = false;
  9136. };
  9137. const onMousedown = (e) => {
  9138. mousedownTarget = e.target === e.currentTarget;
  9139. };
  9140. const onMouseup = (e) => {
  9141. mouseupTarget = e.target === e.currentTarget;
  9142. };
  9143. return { onClick, onMousedown, onMouseup };
  9144. };
  9145. const useTeleport = (contentRenderer, appendToBody) => {
  9146. const isTeleportVisible = vue.ref(false);
  9147. if (!isClient) {
  9148. return {
  9149. isTeleportVisible,
  9150. showTeleport: NOOP,
  9151. hideTeleport: NOOP,
  9152. renderTeleport: NOOP
  9153. };
  9154. }
  9155. let $el = null;
  9156. const showTeleport = () => {
  9157. isTeleportVisible.value = true;
  9158. if ($el !== null)
  9159. return;
  9160. $el = createGlobalNode();
  9161. };
  9162. const hideTeleport = () => {
  9163. isTeleportVisible.value = false;
  9164. if ($el !== null) {
  9165. removeGlobalNode($el);
  9166. $el = null;
  9167. }
  9168. };
  9169. const renderTeleport = () => {
  9170. return appendToBody.value !== true ? contentRenderer() : isTeleportVisible.value ? [vue.h(vue.Teleport, { to: $el }, contentRenderer())] : void 0;
  9171. };
  9172. vue.onUnmounted(hideTeleport);
  9173. return {
  9174. isTeleportVisible,
  9175. showTeleport,
  9176. hideTeleport,
  9177. renderTeleport
  9178. };
  9179. };
  9180. const useThrottleRender = (loading, throttle = 0) => {
  9181. if (throttle === 0)
  9182. return loading;
  9183. const initVal = isObject$1(throttle) && Boolean(throttle.initVal);
  9184. const throttled = vue.ref(initVal);
  9185. let timeoutHandle = null;
  9186. const dispatchThrottling = (timer) => {
  9187. if (isUndefined(timer)) {
  9188. throttled.value = loading.value;
  9189. return;
  9190. }
  9191. if (timeoutHandle) {
  9192. clearTimeout(timeoutHandle);
  9193. }
  9194. timeoutHandle = setTimeout(() => {
  9195. throttled.value = loading.value;
  9196. }, timer);
  9197. };
  9198. const dispatcher = (type) => {
  9199. if (type === "leading") {
  9200. if (isNumber(throttle)) {
  9201. dispatchThrottling(throttle);
  9202. } else {
  9203. dispatchThrottling(throttle.leading);
  9204. }
  9205. } else {
  9206. if (isObject$1(throttle)) {
  9207. dispatchThrottling(throttle.trailing);
  9208. } else {
  9209. throttled.value = false;
  9210. }
  9211. }
  9212. };
  9213. vue.onMounted(() => dispatcher("leading"));
  9214. vue.watch(() => loading.value, (val) => {
  9215. dispatcher(val ? "leading" : "trailing");
  9216. });
  9217. return throttled;
  9218. };
  9219. function useTimeout() {
  9220. let timeoutHandle;
  9221. const registerTimeout = (fn, delay) => {
  9222. cancelTimeout();
  9223. timeoutHandle = window.setTimeout(fn, delay);
  9224. };
  9225. const cancelTimeout = () => window.clearTimeout(timeoutHandle);
  9226. tryOnScopeDispose(() => cancelTimeout());
  9227. return {
  9228. registerTimeout,
  9229. cancelTimeout
  9230. };
  9231. }
  9232. const AFTER_APPEAR = "after-appear";
  9233. const AFTER_ENTER = "after-enter";
  9234. const AFTER_LEAVE = "after-leave";
  9235. const APPEAR = "appear";
  9236. const APPEAR_CANCELLED = "appear-cancelled";
  9237. const BEFORE_ENTER = "before-enter";
  9238. const BEFORE_LEAVE = "before-leave";
  9239. const ENTER = "enter";
  9240. const ENTER_CANCELLED = "enter-cancelled";
  9241. const LEAVE = "leave";
  9242. const LEAVE_CANCELLED = "leave-cancelled";
  9243. const useTransitionFallthroughEmits = [
  9244. AFTER_APPEAR,
  9245. AFTER_ENTER,
  9246. AFTER_LEAVE,
  9247. APPEAR,
  9248. APPEAR_CANCELLED,
  9249. BEFORE_ENTER,
  9250. BEFORE_LEAVE,
  9251. ENTER,
  9252. ENTER_CANCELLED,
  9253. LEAVE,
  9254. LEAVE_CANCELLED
  9255. ];
  9256. const useTransitionFallthrough = () => {
  9257. const { emit } = vue.getCurrentInstance();
  9258. return {
  9259. onAfterAppear: () => {
  9260. emit(AFTER_APPEAR);
  9261. },
  9262. onAfterEnter: () => {
  9263. emit(AFTER_ENTER);
  9264. },
  9265. onAfterLeave: () => {
  9266. emit(AFTER_LEAVE);
  9267. },
  9268. onAppearCancelled: () => {
  9269. emit(APPEAR_CANCELLED);
  9270. },
  9271. onBeforeEnter: () => {
  9272. emit(BEFORE_ENTER);
  9273. },
  9274. onBeforeLeave: () => {
  9275. emit(BEFORE_LEAVE);
  9276. },
  9277. onEnter: () => {
  9278. emit(ENTER);
  9279. },
  9280. onEnterCancelled: () => {
  9281. emit(ENTER_CANCELLED);
  9282. },
  9283. onLeave: () => {
  9284. emit(LEAVE);
  9285. },
  9286. onLeaveCancelled: () => {
  9287. emit(LEAVE_CANCELLED);
  9288. }
  9289. };
  9290. };
  9291. const defaultIdInjection = {
  9292. prefix: Math.floor(Math.random() * 1e4),
  9293. current: 0
  9294. };
  9295. const ID_INJECTION_KEY = Symbol("elIdInjection");
  9296. const useIdInjection = () => {
  9297. return vue.getCurrentInstance() ? vue.inject(ID_INJECTION_KEY, defaultIdInjection) : defaultIdInjection;
  9298. };
  9299. const useId = (deterministicId) => {
  9300. const idInjection = useIdInjection();
  9301. if (!isClient && idInjection === defaultIdInjection) {
  9302. debugWarn("IdInjection", `Looks like you are using server rendering, you must provide a id provider to ensure the hydration process to be succeed
  9303. usage: app.provide(ID_INJECTION_KEY, {
  9304. prefix: number,
  9305. current: number,
  9306. })`);
  9307. }
  9308. const namespace = useGetDerivedNamespace();
  9309. const idRef = computedEager(() => vue.unref(deterministicId) || `${namespace.value}-id-${idInjection.prefix}-${idInjection.current++}`);
  9310. return idRef;
  9311. };
  9312. let registeredEscapeHandlers = [];
  9313. const cachedHandler = (event) => {
  9314. const code = getEventCode(event);
  9315. if (code === EVENT_CODE.esc) {
  9316. registeredEscapeHandlers.forEach((registeredHandler) => registeredHandler(event));
  9317. }
  9318. };
  9319. const useEscapeKeydown = (handler) => {
  9320. vue.onMounted(() => {
  9321. if (registeredEscapeHandlers.length === 0) {
  9322. document.addEventListener("keydown", cachedHandler);
  9323. }
  9324. if (isClient)
  9325. registeredEscapeHandlers.push(handler);
  9326. });
  9327. vue.onBeforeUnmount(() => {
  9328. registeredEscapeHandlers = registeredEscapeHandlers.filter((registeredHandler) => registeredHandler !== handler);
  9329. if (registeredEscapeHandlers.length === 0) {
  9330. if (isClient)
  9331. document.removeEventListener("keydown", cachedHandler);
  9332. }
  9333. });
  9334. };
  9335. const usePopperContainerId = () => {
  9336. const namespace = useGetDerivedNamespace();
  9337. const idInjection = useIdInjection();
  9338. const id = vue.computed(() => {
  9339. return `${namespace.value}-popper-container-${idInjection.prefix}`;
  9340. });
  9341. const selector = vue.computed(() => `#${id.value}`);
  9342. return {
  9343. id,
  9344. selector
  9345. };
  9346. };
  9347. const createContainer = (id) => {
  9348. const container = document.createElement("div");
  9349. container.id = id;
  9350. document.body.appendChild(container);
  9351. return container;
  9352. };
  9353. const usePopperContainer = () => {
  9354. const { id, selector } = usePopperContainerId();
  9355. vue.onBeforeMount(() => {
  9356. if (!isClient)
  9357. return;
  9358. if (!document.body.querySelector(selector.value)) {
  9359. createContainer(id.value);
  9360. }
  9361. });
  9362. return {
  9363. id,
  9364. selector
  9365. };
  9366. };
  9367. const useDelayedRender = ({
  9368. indicator,
  9369. intermediateIndicator,
  9370. shouldSetIntermediate = () => true,
  9371. beforeShow,
  9372. afterShow,
  9373. afterHide,
  9374. beforeHide
  9375. }) => {
  9376. vue.watch(() => vue.unref(indicator), (val) => {
  9377. if (val) {
  9378. beforeShow == null ? void 0 : beforeShow();
  9379. vue.nextTick(() => {
  9380. if (!vue.unref(indicator))
  9381. return;
  9382. if (shouldSetIntermediate("show")) {
  9383. intermediateIndicator.value = true;
  9384. }
  9385. });
  9386. } else {
  9387. beforeHide == null ? void 0 : beforeHide();
  9388. vue.nextTick(() => {
  9389. if (vue.unref(indicator))
  9390. return;
  9391. if (shouldSetIntermediate("hide")) {
  9392. intermediateIndicator.value = false;
  9393. }
  9394. });
  9395. }
  9396. });
  9397. vue.watch(() => intermediateIndicator.value, (val) => {
  9398. if (val) {
  9399. afterShow == null ? void 0 : afterShow();
  9400. } else {
  9401. afterHide == null ? void 0 : afterHide();
  9402. }
  9403. });
  9404. };
  9405. const useDelayedToggleProps = buildProps({
  9406. showAfter: {
  9407. type: Number,
  9408. default: 0
  9409. },
  9410. hideAfter: {
  9411. type: Number,
  9412. default: 200
  9413. },
  9414. autoClose: {
  9415. type: Number,
  9416. default: 0
  9417. }
  9418. });
  9419. const useDelayedToggle = ({
  9420. showAfter,
  9421. hideAfter,
  9422. autoClose,
  9423. open,
  9424. close
  9425. }) => {
  9426. const { registerTimeout } = useTimeout();
  9427. const {
  9428. registerTimeout: registerTimeoutForAutoClose,
  9429. cancelTimeout: cancelTimeoutForAutoClose
  9430. } = useTimeout();
  9431. const onOpen = (event, delay = vue.unref(showAfter)) => {
  9432. registerTimeout(() => {
  9433. open(event);
  9434. const _autoClose = vue.unref(autoClose);
  9435. if (isNumber(_autoClose) && _autoClose > 0) {
  9436. registerTimeoutForAutoClose(() => {
  9437. close(event);
  9438. }, _autoClose);
  9439. }
  9440. }, delay);
  9441. };
  9442. const onClose = (event, delay = vue.unref(hideAfter)) => {
  9443. cancelTimeoutForAutoClose();
  9444. registerTimeout(() => {
  9445. close(event);
  9446. }, delay);
  9447. };
  9448. return {
  9449. onOpen,
  9450. onClose
  9451. };
  9452. };
  9453. const FORWARD_REF_INJECTION_KEY = Symbol("elForwardRef");
  9454. const useForwardRef = (forwardRef) => {
  9455. const setForwardRef = (el) => {
  9456. forwardRef.value = el;
  9457. };
  9458. vue.provide(FORWARD_REF_INJECTION_KEY, {
  9459. setForwardRef
  9460. });
  9461. };
  9462. const useForwardRefDirective = (setForwardRef) => {
  9463. return {
  9464. mounted(el) {
  9465. setForwardRef(el);
  9466. },
  9467. updated(el) {
  9468. setForwardRef(el);
  9469. },
  9470. unmounted() {
  9471. setForwardRef(null);
  9472. }
  9473. };
  9474. };
  9475. const initial = {
  9476. current: 0
  9477. };
  9478. const zIndex = vue.ref(0);
  9479. const defaultInitialZIndex = 2e3;
  9480. const ZINDEX_INJECTION_KEY = Symbol("elZIndexContextKey");
  9481. const zIndexContextKey = Symbol("zIndexContextKey");
  9482. const useZIndex = (zIndexOverrides) => {
  9483. const increasingInjection = vue.getCurrentInstance() ? vue.inject(ZINDEX_INJECTION_KEY, initial) : initial;
  9484. const zIndexInjection = zIndexOverrides || (vue.getCurrentInstance() ? vue.inject(zIndexContextKey, void 0) : void 0);
  9485. const initialZIndex = vue.computed(() => {
  9486. const zIndexFromInjection = vue.unref(zIndexInjection);
  9487. return isNumber(zIndexFromInjection) ? zIndexFromInjection : defaultInitialZIndex;
  9488. });
  9489. const currentZIndex = vue.computed(() => initialZIndex.value + zIndex.value);
  9490. const nextZIndex = () => {
  9491. increasingInjection.current++;
  9492. zIndex.value = increasingInjection.current;
  9493. return currentZIndex.value;
  9494. };
  9495. if (!isClient && !vue.inject(ZINDEX_INJECTION_KEY)) {
  9496. debugWarn("ZIndexInjection", `Looks like you are using server rendering, you must provide a z-index provider to ensure the hydration process to be succeed
  9497. usage: app.provide(ZINDEX_INJECTION_KEY, { current: 0 })`);
  9498. }
  9499. return {
  9500. initialZIndex,
  9501. currentZIndex,
  9502. nextZIndex
  9503. };
  9504. };
  9505. /**
  9506. * Custom positioning reference element.
  9507. * @see https://floating-ui.com/docs/virtual-elements
  9508. */
  9509. const sides = ['top', 'right', 'bottom', 'left'];
  9510. const alignments = ['start', 'end'];
  9511. const placements = /*#__PURE__*/sides.reduce((acc, side) => acc.concat(side, side + "-" + alignments[0], side + "-" + alignments[1]), []);
  9512. const min$3 = Math.min;
  9513. const max$3 = Math.max;
  9514. const round$1 = Math.round;
  9515. const createCoords = v => ({
  9516. x: v,
  9517. y: v
  9518. });
  9519. const oppositeSideMap = {
  9520. left: 'right',
  9521. right: 'left',
  9522. bottom: 'top',
  9523. top: 'bottom'
  9524. };
  9525. const oppositeAlignmentMap = {
  9526. start: 'end',
  9527. end: 'start'
  9528. };
  9529. function clamp(start, value, end) {
  9530. return max$3(start, min$3(value, end));
  9531. }
  9532. function evaluate(value, param) {
  9533. return typeof value === 'function' ? value(param) : value;
  9534. }
  9535. function getSide$1(placement) {
  9536. return placement.split('-')[0];
  9537. }
  9538. function getAlignment$1(placement) {
  9539. return placement.split('-')[1];
  9540. }
  9541. function getOppositeAxis(axis) {
  9542. return axis === 'x' ? 'y' : 'x';
  9543. }
  9544. function getAxisLength(axis) {
  9545. return axis === 'y' ? 'height' : 'width';
  9546. }
  9547. function getSideAxis(placement) {
  9548. return ['top', 'bottom'].includes(getSide$1(placement)) ? 'y' : 'x';
  9549. }
  9550. function getAlignmentAxis(placement) {
  9551. return getOppositeAxis(getSideAxis(placement));
  9552. }
  9553. function getAlignmentSides$1(placement, rects, rtl) {
  9554. if (rtl === void 0) {
  9555. rtl = false;
  9556. }
  9557. const alignment = getAlignment$1(placement);
  9558. const alignmentAxis = getAlignmentAxis(placement);
  9559. const length = getAxisLength(alignmentAxis);
  9560. let mainAlignmentSide = alignmentAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';
  9561. if (rects.reference[length] > rects.floating[length]) {
  9562. mainAlignmentSide = getOppositePlacement$1(mainAlignmentSide);
  9563. }
  9564. return [mainAlignmentSide, getOppositePlacement$1(mainAlignmentSide)];
  9565. }
  9566. function getExpandedPlacements$1(placement) {
  9567. const oppositePlacement = getOppositePlacement$1(placement);
  9568. return [getOppositeAlignmentPlacement$1(placement), oppositePlacement, getOppositeAlignmentPlacement$1(oppositePlacement)];
  9569. }
  9570. function getOppositeAlignmentPlacement$1(placement) {
  9571. return placement.replace(/start|end/g, alignment => oppositeAlignmentMap[alignment]);
  9572. }
  9573. function getSideList(side, isStart, rtl) {
  9574. const lr = ['left', 'right'];
  9575. const rl = ['right', 'left'];
  9576. const tb = ['top', 'bottom'];
  9577. const bt = ['bottom', 'top'];
  9578. switch (side) {
  9579. case 'top':
  9580. case 'bottom':
  9581. if (rtl) return isStart ? rl : lr;
  9582. return isStart ? lr : rl;
  9583. case 'left':
  9584. case 'right':
  9585. return isStart ? tb : bt;
  9586. default:
  9587. return [];
  9588. }
  9589. }
  9590. function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
  9591. const alignment = getAlignment$1(placement);
  9592. let list = getSideList(getSide$1(placement), direction === 'start', rtl);
  9593. if (alignment) {
  9594. list = list.map(side => side + "-" + alignment);
  9595. if (flipAlignment) {
  9596. list = list.concat(list.map(getOppositeAlignmentPlacement$1));
  9597. }
  9598. }
  9599. return list;
  9600. }
  9601. function getOppositePlacement$1(placement) {
  9602. return placement.replace(/left|right|bottom|top/g, side => oppositeSideMap[side]);
  9603. }
  9604. function expandPaddingObject$1(padding) {
  9605. return {
  9606. top: 0,
  9607. right: 0,
  9608. bottom: 0,
  9609. left: 0,
  9610. ...padding
  9611. };
  9612. }
  9613. function getPaddingObject(padding) {
  9614. return typeof padding !== 'number' ? expandPaddingObject$1(padding) : {
  9615. top: padding,
  9616. right: padding,
  9617. bottom: padding,
  9618. left: padding
  9619. };
  9620. }
  9621. function rectToClientRect$1(rect) {
  9622. const {
  9623. x,
  9624. y,
  9625. width,
  9626. height
  9627. } = rect;
  9628. return {
  9629. width,
  9630. height,
  9631. top: y,
  9632. left: x,
  9633. right: x + width,
  9634. bottom: y + height,
  9635. x,
  9636. y
  9637. };
  9638. }
  9639. function computeCoordsFromPlacement$1(_ref, placement, rtl) {
  9640. let {
  9641. reference,
  9642. floating
  9643. } = _ref;
  9644. const sideAxis = getSideAxis(placement);
  9645. const alignmentAxis = getAlignmentAxis(placement);
  9646. const alignLength = getAxisLength(alignmentAxis);
  9647. const side = getSide$1(placement);
  9648. const isVertical = sideAxis === 'y';
  9649. const commonX = reference.x + reference.width / 2 - floating.width / 2;
  9650. const commonY = reference.y + reference.height / 2 - floating.height / 2;
  9651. const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
  9652. let coords;
  9653. switch (side) {
  9654. case 'top':
  9655. coords = {
  9656. x: commonX,
  9657. y: reference.y - floating.height
  9658. };
  9659. break;
  9660. case 'bottom':
  9661. coords = {
  9662. x: commonX,
  9663. y: reference.y + reference.height
  9664. };
  9665. break;
  9666. case 'right':
  9667. coords = {
  9668. x: reference.x + reference.width,
  9669. y: commonY
  9670. };
  9671. break;
  9672. case 'left':
  9673. coords = {
  9674. x: reference.x - floating.width,
  9675. y: commonY
  9676. };
  9677. break;
  9678. default:
  9679. coords = {
  9680. x: reference.x,
  9681. y: reference.y
  9682. };
  9683. }
  9684. switch (getAlignment$1(placement)) {
  9685. case 'start':
  9686. coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
  9687. break;
  9688. case 'end':
  9689. coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
  9690. break;
  9691. }
  9692. return coords;
  9693. }
  9694. /**
  9695. * Computes the `x` and `y` coordinates that will place the floating element
  9696. * next to a given reference element.
  9697. *
  9698. * This export does not have any `platform` interface logic. You will need to
  9699. * write one for the platform you are using Floating UI with.
  9700. */
  9701. const computePosition$3 = async (reference, floating, config) => {
  9702. const {
  9703. placement = 'bottom',
  9704. strategy = 'absolute',
  9705. middleware = [],
  9706. platform
  9707. } = config;
  9708. const validMiddleware = middleware.filter(Boolean);
  9709. const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
  9710. let rects = await platform.getElementRects({
  9711. reference,
  9712. floating,
  9713. strategy
  9714. });
  9715. let {
  9716. x,
  9717. y
  9718. } = computeCoordsFromPlacement$1(rects, placement, rtl);
  9719. let statefulPlacement = placement;
  9720. let middlewareData = {};
  9721. let resetCount = 0;
  9722. for (let i = 0; i < validMiddleware.length; i++) {
  9723. const {
  9724. name,
  9725. fn
  9726. } = validMiddleware[i];
  9727. const {
  9728. x: nextX,
  9729. y: nextY,
  9730. data,
  9731. reset
  9732. } = await fn({
  9733. x,
  9734. y,
  9735. initialPlacement: placement,
  9736. placement: statefulPlacement,
  9737. strategy,
  9738. middlewareData,
  9739. rects,
  9740. platform,
  9741. elements: {
  9742. reference,
  9743. floating
  9744. }
  9745. });
  9746. x = nextX != null ? nextX : x;
  9747. y = nextY != null ? nextY : y;
  9748. middlewareData = {
  9749. ...middlewareData,
  9750. [name]: {
  9751. ...middlewareData[name],
  9752. ...data
  9753. }
  9754. };
  9755. if (reset && resetCount <= 50) {
  9756. resetCount++;
  9757. if (typeof reset === 'object') {
  9758. if (reset.placement) {
  9759. statefulPlacement = reset.placement;
  9760. }
  9761. if (reset.rects) {
  9762. rects = reset.rects === true ? await platform.getElementRects({
  9763. reference,
  9764. floating,
  9765. strategy
  9766. }) : reset.rects;
  9767. }
  9768. ({
  9769. x,
  9770. y
  9771. } = computeCoordsFromPlacement$1(rects, statefulPlacement, rtl));
  9772. }
  9773. i = -1;
  9774. }
  9775. }
  9776. return {
  9777. x,
  9778. y,
  9779. placement: statefulPlacement,
  9780. strategy,
  9781. middlewareData
  9782. };
  9783. };
  9784. /**
  9785. * Resolves with an object of overflow side offsets that determine how much the
  9786. * element is overflowing a given clipping boundary on each side.
  9787. * - positive = overflowing the boundary by that number of pixels
  9788. * - negative = how many pixels left before it will overflow
  9789. * - 0 = lies flush with the boundary
  9790. * @see https://floating-ui.com/docs/detectOverflow
  9791. */
  9792. async function detectOverflow$1(state, options) {
  9793. var _await$platform$isEle;
  9794. if (options === void 0) {
  9795. options = {};
  9796. }
  9797. const {
  9798. x,
  9799. y,
  9800. platform,
  9801. rects,
  9802. elements,
  9803. strategy
  9804. } = state;
  9805. const {
  9806. boundary = 'clippingAncestors',
  9807. rootBoundary = 'viewport',
  9808. elementContext = 'floating',
  9809. altBoundary = false,
  9810. padding = 0
  9811. } = evaluate(options, state);
  9812. const paddingObject = getPaddingObject(padding);
  9813. const altContext = elementContext === 'floating' ? 'reference' : 'floating';
  9814. const element = elements[altBoundary ? altContext : elementContext];
  9815. const clippingClientRect = rectToClientRect$1(await platform.getClippingRect({
  9816. 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))),
  9817. boundary,
  9818. rootBoundary,
  9819. strategy
  9820. }));
  9821. const rect = elementContext === 'floating' ? {
  9822. x,
  9823. y,
  9824. width: rects.floating.width,
  9825. height: rects.floating.height
  9826. } : rects.reference;
  9827. const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating));
  9828. const offsetScale = (await (platform.isElement == null ? void 0 : platform.isElement(offsetParent))) ? (await (platform.getScale == null ? void 0 : platform.getScale(offsetParent))) || {
  9829. x: 1,
  9830. y: 1
  9831. } : {
  9832. x: 1,
  9833. y: 1
  9834. };
  9835. const elementClientRect = rectToClientRect$1(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
  9836. elements,
  9837. rect,
  9838. offsetParent,
  9839. strategy
  9840. }) : rect);
  9841. return {
  9842. top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
  9843. bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
  9844. left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
  9845. right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
  9846. };
  9847. }
  9848. /**
  9849. * Provides data to position an inner element of the floating element so that it
  9850. * appears centered to the reference element.
  9851. * @see https://floating-ui.com/docs/arrow
  9852. */
  9853. const arrow$2 = options => ({
  9854. name: 'arrow',
  9855. options,
  9856. async fn(state) {
  9857. const {
  9858. x,
  9859. y,
  9860. placement,
  9861. rects,
  9862. platform,
  9863. elements,
  9864. middlewareData
  9865. } = state;
  9866. // Since `element` is required, we don't Partial<> the type.
  9867. const {
  9868. element,
  9869. padding = 0
  9870. } = evaluate(options, state) || {};
  9871. if (element == null) {
  9872. return {};
  9873. }
  9874. const paddingObject = getPaddingObject(padding);
  9875. const coords = {
  9876. x,
  9877. y
  9878. };
  9879. const axis = getAlignmentAxis(placement);
  9880. const length = getAxisLength(axis);
  9881. const arrowDimensions = await platform.getDimensions(element);
  9882. const isYAxis = axis === 'y';
  9883. const minProp = isYAxis ? 'top' : 'left';
  9884. const maxProp = isYAxis ? 'bottom' : 'right';
  9885. const clientProp = isYAxis ? 'clientHeight' : 'clientWidth';
  9886. const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
  9887. const startDiff = coords[axis] - rects.reference[axis];
  9888. const arrowOffsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(element));
  9889. let clientSize = arrowOffsetParent ? arrowOffsetParent[clientProp] : 0;
  9890. // DOM platform can return `window` as the `offsetParent`.
  9891. if (!clientSize || !(await (platform.isElement == null ? void 0 : platform.isElement(arrowOffsetParent)))) {
  9892. clientSize = elements.floating[clientProp] || rects.floating[length];
  9893. }
  9894. const centerToReference = endDiff / 2 - startDiff / 2;
  9895. // If the padding is large enough that it causes the arrow to no longer be
  9896. // centered, modify the padding so that it is centered.
  9897. const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1;
  9898. const minPadding = min$3(paddingObject[minProp], largestPossiblePadding);
  9899. const maxPadding = min$3(paddingObject[maxProp], largestPossiblePadding);
  9900. // Make sure the arrow doesn't overflow the floating element if the center
  9901. // point is outside the floating element's bounds.
  9902. const min$1 = minPadding;
  9903. const max = clientSize - arrowDimensions[length] - maxPadding;
  9904. const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
  9905. const offset = clamp(min$1, center, max);
  9906. // If the reference is small enough that the arrow's padding causes it to
  9907. // to point to nothing for an aligned placement, adjust the offset of the
  9908. // floating element itself. To ensure `shift()` continues to take action,
  9909. // a single reset is performed when this is true.
  9910. const shouldAddOffset = !middlewareData.arrow && getAlignment$1(placement) != null && center !== offset && rects.reference[length] / 2 - (center < min$1 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;
  9911. const alignmentOffset = shouldAddOffset ? center < min$1 ? center - min$1 : center - max : 0;
  9912. return {
  9913. [axis]: coords[axis] + alignmentOffset,
  9914. data: {
  9915. [axis]: offset,
  9916. centerOffset: center - offset - alignmentOffset,
  9917. ...(shouldAddOffset && {
  9918. alignmentOffset
  9919. })
  9920. },
  9921. reset: shouldAddOffset
  9922. };
  9923. }
  9924. });
  9925. function getPlacementList(alignment, autoAlignment, allowedPlacements) {
  9926. const allowedPlacementsSortedByAlignment = alignment ? [...allowedPlacements.filter(placement => getAlignment$1(placement) === alignment), ...allowedPlacements.filter(placement => getAlignment$1(placement) !== alignment)] : allowedPlacements.filter(placement => getSide$1(placement) === placement);
  9927. return allowedPlacementsSortedByAlignment.filter(placement => {
  9928. if (alignment) {
  9929. return getAlignment$1(placement) === alignment || (autoAlignment ? getOppositeAlignmentPlacement$1(placement) !== placement : false);
  9930. }
  9931. return true;
  9932. });
  9933. }
  9934. /**
  9935. * Optimizes the visibility of the floating element by choosing the placement
  9936. * that has the most space available automatically, without needing to specify a
  9937. * preferred placement. Alternative to `flip`.
  9938. * @see https://floating-ui.com/docs/autoPlacement
  9939. */
  9940. const autoPlacement = function (options) {
  9941. if (options === void 0) {
  9942. options = {};
  9943. }
  9944. return {
  9945. name: 'autoPlacement',
  9946. options,
  9947. async fn(state) {
  9948. var _middlewareData$autoP, _middlewareData$autoP2, _placementsThatFitOnE;
  9949. const {
  9950. rects,
  9951. middlewareData,
  9952. placement,
  9953. platform,
  9954. elements
  9955. } = state;
  9956. const {
  9957. crossAxis = false,
  9958. alignment,
  9959. allowedPlacements = placements,
  9960. autoAlignment = true,
  9961. ...detectOverflowOptions
  9962. } = evaluate(options, state);
  9963. const placements$1 = alignment !== undefined || allowedPlacements === placements ? getPlacementList(alignment || null, autoAlignment, allowedPlacements) : allowedPlacements;
  9964. const overflow = await detectOverflow$1(state, detectOverflowOptions);
  9965. const currentIndex = ((_middlewareData$autoP = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP.index) || 0;
  9966. const currentPlacement = placements$1[currentIndex];
  9967. if (currentPlacement == null) {
  9968. return {};
  9969. }
  9970. const alignmentSides = getAlignmentSides$1(currentPlacement, rects, await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)));
  9971. // Make `computeCoords` start from the right place.
  9972. if (placement !== currentPlacement) {
  9973. return {
  9974. reset: {
  9975. placement: placements$1[0]
  9976. }
  9977. };
  9978. }
  9979. const currentOverflows = [overflow[getSide$1(currentPlacement)], overflow[alignmentSides[0]], overflow[alignmentSides[1]]];
  9980. const allOverflows = [...(((_middlewareData$autoP2 = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP2.overflows) || []), {
  9981. placement: currentPlacement,
  9982. overflows: currentOverflows
  9983. }];
  9984. const nextPlacement = placements$1[currentIndex + 1];
  9985. // There are more placements to check.
  9986. if (nextPlacement) {
  9987. return {
  9988. data: {
  9989. index: currentIndex + 1,
  9990. overflows: allOverflows
  9991. },
  9992. reset: {
  9993. placement: nextPlacement
  9994. }
  9995. };
  9996. }
  9997. const placementsSortedByMostSpace = allOverflows.map(d => {
  9998. const alignment = getAlignment$1(d.placement);
  9999. return [d.placement, alignment && crossAxis ?
  10000. // Check along the mainAxis and main crossAxis side.
  10001. d.overflows.slice(0, 2).reduce((acc, v) => acc + v, 0) :
  10002. // Check only the mainAxis.
  10003. d.overflows[0], d.overflows];
  10004. }).sort((a, b) => a[1] - b[1]);
  10005. const placementsThatFitOnEachSide = placementsSortedByMostSpace.filter(d => d[2].slice(0,
  10006. // Aligned placements should not check their opposite crossAxis
  10007. // side.
  10008. getAlignment$1(d[0]) ? 2 : 3).every(v => v <= 0));
  10009. const resetPlacement = ((_placementsThatFitOnE = placementsThatFitOnEachSide[0]) == null ? void 0 : _placementsThatFitOnE[0]) || placementsSortedByMostSpace[0][0];
  10010. if (resetPlacement !== placement) {
  10011. return {
  10012. data: {
  10013. index: currentIndex + 1,
  10014. overflows: allOverflows
  10015. },
  10016. reset: {
  10017. placement: resetPlacement
  10018. }
  10019. };
  10020. }
  10021. return {};
  10022. }
  10023. };
  10024. };
  10025. /**
  10026. * Optimizes the visibility of the floating element by flipping the `placement`
  10027. * in order to keep it in view when the preferred placement(s) will overflow the
  10028. * clipping boundary. Alternative to `autoPlacement`.
  10029. * @see https://floating-ui.com/docs/flip
  10030. */
  10031. const flip$1 = function (options) {
  10032. if (options === void 0) {
  10033. options = {};
  10034. }
  10035. return {
  10036. name: 'flip',
  10037. options,
  10038. async fn(state) {
  10039. var _middlewareData$arrow, _middlewareData$flip;
  10040. const {
  10041. placement,
  10042. middlewareData,
  10043. rects,
  10044. initialPlacement,
  10045. platform,
  10046. elements
  10047. } = state;
  10048. const {
  10049. mainAxis: checkMainAxis = true,
  10050. crossAxis: checkCrossAxis = true,
  10051. fallbackPlacements: specifiedFallbackPlacements,
  10052. fallbackStrategy = 'bestFit',
  10053. fallbackAxisSideDirection = 'none',
  10054. flipAlignment = true,
  10055. ...detectOverflowOptions
  10056. } = evaluate(options, state);
  10057. // If a reset by the arrow was caused due to an alignment offset being
  10058. // added, we should skip any logic now since `flip()` has already done its
  10059. // work.
  10060. // https://github.com/floating-ui/floating-ui/issues/2549#issuecomment-1719601643
  10061. if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
  10062. return {};
  10063. }
  10064. const side = getSide$1(placement);
  10065. const initialSideAxis = getSideAxis(initialPlacement);
  10066. const isBasePlacement = getSide$1(initialPlacement) === initialPlacement;
  10067. const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
  10068. const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement$1(initialPlacement)] : getExpandedPlacements$1(initialPlacement));
  10069. const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== 'none';
  10070. if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) {
  10071. fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
  10072. }
  10073. const placements = [initialPlacement, ...fallbackPlacements];
  10074. const overflow = await detectOverflow$1(state, detectOverflowOptions);
  10075. const overflows = [];
  10076. let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
  10077. if (checkMainAxis) {
  10078. overflows.push(overflow[side]);
  10079. }
  10080. if (checkCrossAxis) {
  10081. const sides = getAlignmentSides$1(placement, rects, rtl);
  10082. overflows.push(overflow[sides[0]], overflow[sides[1]]);
  10083. }
  10084. overflowsData = [...overflowsData, {
  10085. placement,
  10086. overflows
  10087. }];
  10088. // One or more sides is overflowing.
  10089. if (!overflows.every(side => side <= 0)) {
  10090. var _middlewareData$flip2, _overflowsData$filter;
  10091. const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
  10092. const nextPlacement = placements[nextIndex];
  10093. if (nextPlacement) {
  10094. // Try next placement and re-run the lifecycle.
  10095. return {
  10096. data: {
  10097. index: nextIndex,
  10098. overflows: overflowsData
  10099. },
  10100. reset: {
  10101. placement: nextPlacement
  10102. }
  10103. };
  10104. }
  10105. // First, find the candidates that fit on the mainAxis side of overflow,
  10106. // then find the placement that fits the best on the main crossAxis side.
  10107. let resetPlacement = (_overflowsData$filter = overflowsData.filter(d => d.overflows[0] <= 0).sort((a, b) => a.overflows[1] - b.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement;
  10108. // Otherwise fallback.
  10109. if (!resetPlacement) {
  10110. switch (fallbackStrategy) {
  10111. case 'bestFit':
  10112. {
  10113. var _overflowsData$filter2;
  10114. const placement = (_overflowsData$filter2 = overflowsData.filter(d => {
  10115. if (hasFallbackAxisSideDirection) {
  10116. const currentSideAxis = getSideAxis(d.placement);
  10117. return currentSideAxis === initialSideAxis ||
  10118. // Create a bias to the `y` side axis due to horizontal
  10119. // reading directions favoring greater width.
  10120. currentSideAxis === 'y';
  10121. }
  10122. return true;
  10123. }).map(d => [d.placement, d.overflows.filter(overflow => overflow > 0).reduce((acc, overflow) => acc + overflow, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$filter2[0];
  10124. if (placement) {
  10125. resetPlacement = placement;
  10126. }
  10127. break;
  10128. }
  10129. case 'initialPlacement':
  10130. resetPlacement = initialPlacement;
  10131. break;
  10132. }
  10133. }
  10134. if (placement !== resetPlacement) {
  10135. return {
  10136. reset: {
  10137. placement: resetPlacement
  10138. }
  10139. };
  10140. }
  10141. }
  10142. return {};
  10143. }
  10144. };
  10145. };
  10146. function getSideOffsets(overflow, rect) {
  10147. return {
  10148. top: overflow.top - rect.height,
  10149. right: overflow.right - rect.width,
  10150. bottom: overflow.bottom - rect.height,
  10151. left: overflow.left - rect.width
  10152. };
  10153. }
  10154. function isAnySideFullyClipped(overflow) {
  10155. return sides.some(side => overflow[side] >= 0);
  10156. }
  10157. /**
  10158. * Provides data to hide the floating element in applicable situations, such as
  10159. * when it is not in the same clipping context as the reference element.
  10160. * @see https://floating-ui.com/docs/hide
  10161. */
  10162. const hide = function (options) {
  10163. if (options === void 0) {
  10164. options = {};
  10165. }
  10166. return {
  10167. name: 'hide',
  10168. options,
  10169. async fn(state) {
  10170. const {
  10171. rects
  10172. } = state;
  10173. const {
  10174. strategy = 'referenceHidden',
  10175. ...detectOverflowOptions
  10176. } = evaluate(options, state);
  10177. switch (strategy) {
  10178. case 'referenceHidden':
  10179. {
  10180. const overflow = await detectOverflow$1(state, {
  10181. ...detectOverflowOptions,
  10182. elementContext: 'reference'
  10183. });
  10184. const offsets = getSideOffsets(overflow, rects.reference);
  10185. return {
  10186. data: {
  10187. referenceHiddenOffsets: offsets,
  10188. referenceHidden: isAnySideFullyClipped(offsets)
  10189. }
  10190. };
  10191. }
  10192. case 'escaped':
  10193. {
  10194. const overflow = await detectOverflow$1(state, {
  10195. ...detectOverflowOptions,
  10196. altBoundary: true
  10197. });
  10198. const offsets = getSideOffsets(overflow, rects.floating);
  10199. return {
  10200. data: {
  10201. escapedOffsets: offsets,
  10202. escaped: isAnySideFullyClipped(offsets)
  10203. }
  10204. };
  10205. }
  10206. default:
  10207. {
  10208. return {};
  10209. }
  10210. }
  10211. }
  10212. };
  10213. };
  10214. function getBoundingRect(rects) {
  10215. const minX = min$3(...rects.map(rect => rect.left));
  10216. const minY = min$3(...rects.map(rect => rect.top));
  10217. const maxX = max$3(...rects.map(rect => rect.right));
  10218. const maxY = max$3(...rects.map(rect => rect.bottom));
  10219. return {
  10220. x: minX,
  10221. y: minY,
  10222. width: maxX - minX,
  10223. height: maxY - minY
  10224. };
  10225. }
  10226. function getRectsByLine(rects) {
  10227. const sortedRects = rects.slice().sort((a, b) => a.y - b.y);
  10228. const groups = [];
  10229. let prevRect = null;
  10230. for (let i = 0; i < sortedRects.length; i++) {
  10231. const rect = sortedRects[i];
  10232. if (!prevRect || rect.y - prevRect.y > prevRect.height / 2) {
  10233. groups.push([rect]);
  10234. } else {
  10235. groups[groups.length - 1].push(rect);
  10236. }
  10237. prevRect = rect;
  10238. }
  10239. return groups.map(rect => rectToClientRect$1(getBoundingRect(rect)));
  10240. }
  10241. /**
  10242. * Provides improved positioning for inline reference elements that can span
  10243. * over multiple lines, such as hyperlinks or range selections.
  10244. * @see https://floating-ui.com/docs/inline
  10245. */
  10246. const inline = function (options) {
  10247. if (options === void 0) {
  10248. options = {};
  10249. }
  10250. return {
  10251. name: 'inline',
  10252. options,
  10253. async fn(state) {
  10254. const {
  10255. placement,
  10256. elements,
  10257. rects,
  10258. platform,
  10259. strategy
  10260. } = state;
  10261. // A MouseEvent's client{X,Y} coords can be up to 2 pixels off a
  10262. // ClientRect's bounds, despite the event listener being triggered. A
  10263. // padding of 2 seems to handle this issue.
  10264. const {
  10265. padding = 2,
  10266. x,
  10267. y
  10268. } = evaluate(options, state);
  10269. const nativeClientRects = Array.from((await (platform.getClientRects == null ? void 0 : platform.getClientRects(elements.reference))) || []);
  10270. const clientRects = getRectsByLine(nativeClientRects);
  10271. const fallback = rectToClientRect$1(getBoundingRect(nativeClientRects));
  10272. const paddingObject = getPaddingObject(padding);
  10273. function getBoundingClientRect() {
  10274. // There are two rects and they are disjoined.
  10275. if (clientRects.length === 2 && clientRects[0].left > clientRects[1].right && x != null && y != null) {
  10276. // Find the first rect in which the point is fully inside.
  10277. return clientRects.find(rect => x > rect.left - paddingObject.left && x < rect.right + paddingObject.right && y > rect.top - paddingObject.top && y < rect.bottom + paddingObject.bottom) || fallback;
  10278. }
  10279. // There are 2 or more connected rects.
  10280. if (clientRects.length >= 2) {
  10281. if (getSideAxis(placement) === 'y') {
  10282. const firstRect = clientRects[0];
  10283. const lastRect = clientRects[clientRects.length - 1];
  10284. const isTop = getSide$1(placement) === 'top';
  10285. const top = firstRect.top;
  10286. const bottom = lastRect.bottom;
  10287. const left = isTop ? firstRect.left : lastRect.left;
  10288. const right = isTop ? firstRect.right : lastRect.right;
  10289. const width = right - left;
  10290. const height = bottom - top;
  10291. return {
  10292. top,
  10293. bottom,
  10294. left,
  10295. right,
  10296. width,
  10297. height,
  10298. x: left,
  10299. y: top
  10300. };
  10301. }
  10302. const isLeftSide = getSide$1(placement) === 'left';
  10303. const maxRight = max$3(...clientRects.map(rect => rect.right));
  10304. const minLeft = min$3(...clientRects.map(rect => rect.left));
  10305. const measureRects = clientRects.filter(rect => isLeftSide ? rect.left === minLeft : rect.right === maxRight);
  10306. const top = measureRects[0].top;
  10307. const bottom = measureRects[measureRects.length - 1].bottom;
  10308. const left = minLeft;
  10309. const right = maxRight;
  10310. const width = right - left;
  10311. const height = bottom - top;
  10312. return {
  10313. top,
  10314. bottom,
  10315. left,
  10316. right,
  10317. width,
  10318. height,
  10319. x: left,
  10320. y: top
  10321. };
  10322. }
  10323. return fallback;
  10324. }
  10325. const resetRects = await platform.getElementRects({
  10326. reference: {
  10327. getBoundingClientRect
  10328. },
  10329. floating: elements.floating,
  10330. strategy
  10331. });
  10332. if (rects.reference.x !== resetRects.reference.x || rects.reference.y !== resetRects.reference.y || rects.reference.width !== resetRects.reference.width || rects.reference.height !== resetRects.reference.height) {
  10333. return {
  10334. reset: {
  10335. rects: resetRects
  10336. }
  10337. };
  10338. }
  10339. return {};
  10340. }
  10341. };
  10342. };
  10343. // For type backwards-compatibility, the `OffsetOptions` type was also
  10344. // Derivable.
  10345. async function convertValueToCoords$1(state, options) {
  10346. const {
  10347. placement,
  10348. platform,
  10349. elements
  10350. } = state;
  10351. const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
  10352. const side = getSide$1(placement);
  10353. const alignment = getAlignment$1(placement);
  10354. const isVertical = getSideAxis(placement) === 'y';
  10355. const mainAxisMulti = ['left', 'top'].includes(side) ? -1 : 1;
  10356. const crossAxisMulti = rtl && isVertical ? -1 : 1;
  10357. const rawValue = evaluate(options, state);
  10358. // eslint-disable-next-line prefer-const
  10359. let {
  10360. mainAxis,
  10361. crossAxis,
  10362. alignmentAxis
  10363. } = typeof rawValue === 'number' ? {
  10364. mainAxis: rawValue,
  10365. crossAxis: 0,
  10366. alignmentAxis: null
  10367. } : {
  10368. mainAxis: 0,
  10369. crossAxis: 0,
  10370. alignmentAxis: null,
  10371. ...rawValue
  10372. };
  10373. if (alignment && typeof alignmentAxis === 'number') {
  10374. crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis;
  10375. }
  10376. return isVertical ? {
  10377. x: crossAxis * crossAxisMulti,
  10378. y: mainAxis * mainAxisMulti
  10379. } : {
  10380. x: mainAxis * mainAxisMulti,
  10381. y: crossAxis * crossAxisMulti
  10382. };
  10383. }
  10384. /**
  10385. * Modifies the placement by translating the floating element along the
  10386. * specified axes.
  10387. * A number (shorthand for `mainAxis` or distance), or an axes configuration
  10388. * object may be passed.
  10389. * @see https://floating-ui.com/docs/offset
  10390. */
  10391. const offset$1 = function (options) {
  10392. if (options === void 0) {
  10393. options = 0;
  10394. }
  10395. return {
  10396. name: 'offset',
  10397. options,
  10398. async fn(state) {
  10399. var _middlewareData$offse, _middlewareData$arrow;
  10400. const {
  10401. x,
  10402. y,
  10403. placement,
  10404. middlewareData
  10405. } = state;
  10406. const diffCoords = await convertValueToCoords$1(state, options);
  10407. // If the placement is the same and the arrow caused an alignment offset
  10408. // then we don't need to change the positioning coordinates.
  10409. if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
  10410. return {};
  10411. }
  10412. return {
  10413. x: x + diffCoords.x,
  10414. y: y + diffCoords.y,
  10415. data: {
  10416. ...diffCoords,
  10417. placement
  10418. }
  10419. };
  10420. }
  10421. };
  10422. };
  10423. /**
  10424. * Optimizes the visibility of the floating element by shifting it in order to
  10425. * keep it in view when it will overflow the clipping boundary.
  10426. * @see https://floating-ui.com/docs/shift
  10427. */
  10428. const shift$1 = function (options) {
  10429. if (options === void 0) {
  10430. options = {};
  10431. }
  10432. return {
  10433. name: 'shift',
  10434. options,
  10435. async fn(state) {
  10436. const {
  10437. x,
  10438. y,
  10439. placement
  10440. } = state;
  10441. const {
  10442. mainAxis: checkMainAxis = true,
  10443. crossAxis: checkCrossAxis = false,
  10444. limiter = {
  10445. fn: _ref => {
  10446. let {
  10447. x,
  10448. y
  10449. } = _ref;
  10450. return {
  10451. x,
  10452. y
  10453. };
  10454. }
  10455. },
  10456. ...detectOverflowOptions
  10457. } = evaluate(options, state);
  10458. const coords = {
  10459. x,
  10460. y
  10461. };
  10462. const overflow = await detectOverflow$1(state, detectOverflowOptions);
  10463. const crossAxis = getSideAxis(getSide$1(placement));
  10464. const mainAxis = getOppositeAxis(crossAxis);
  10465. let mainAxisCoord = coords[mainAxis];
  10466. let crossAxisCoord = coords[crossAxis];
  10467. if (checkMainAxis) {
  10468. const minSide = mainAxis === 'y' ? 'top' : 'left';
  10469. const maxSide = mainAxis === 'y' ? 'bottom' : 'right';
  10470. const min = mainAxisCoord + overflow[minSide];
  10471. const max = mainAxisCoord - overflow[maxSide];
  10472. mainAxisCoord = clamp(min, mainAxisCoord, max);
  10473. }
  10474. if (checkCrossAxis) {
  10475. const minSide = crossAxis === 'y' ? 'top' : 'left';
  10476. const maxSide = crossAxis === 'y' ? 'bottom' : 'right';
  10477. const min = crossAxisCoord + overflow[minSide];
  10478. const max = crossAxisCoord - overflow[maxSide];
  10479. crossAxisCoord = clamp(min, crossAxisCoord, max);
  10480. }
  10481. const limitedCoords = limiter.fn({
  10482. ...state,
  10483. [mainAxis]: mainAxisCoord,
  10484. [crossAxis]: crossAxisCoord
  10485. });
  10486. return {
  10487. ...limitedCoords,
  10488. data: {
  10489. x: limitedCoords.x - x,
  10490. y: limitedCoords.y - y
  10491. }
  10492. };
  10493. }
  10494. };
  10495. };
  10496. /**
  10497. * Built-in `limiter` that will stop `shift()` at a certain point.
  10498. */
  10499. const limitShift = function (options) {
  10500. if (options === void 0) {
  10501. options = {};
  10502. }
  10503. return {
  10504. options,
  10505. fn(state) {
  10506. const {
  10507. x,
  10508. y,
  10509. placement,
  10510. rects,
  10511. middlewareData
  10512. } = state;
  10513. const {
  10514. offset = 0,
  10515. mainAxis: checkMainAxis = true,
  10516. crossAxis: checkCrossAxis = true
  10517. } = evaluate(options, state);
  10518. const coords = {
  10519. x,
  10520. y
  10521. };
  10522. const crossAxis = getSideAxis(placement);
  10523. const mainAxis = getOppositeAxis(crossAxis);
  10524. let mainAxisCoord = coords[mainAxis];
  10525. let crossAxisCoord = coords[crossAxis];
  10526. const rawOffset = evaluate(offset, state);
  10527. const computedOffset = typeof rawOffset === 'number' ? {
  10528. mainAxis: rawOffset,
  10529. crossAxis: 0
  10530. } : {
  10531. mainAxis: 0,
  10532. crossAxis: 0,
  10533. ...rawOffset
  10534. };
  10535. if (checkMainAxis) {
  10536. const len = mainAxis === 'y' ? 'height' : 'width';
  10537. const limitMin = rects.reference[mainAxis] - rects.floating[len] + computedOffset.mainAxis;
  10538. const limitMax = rects.reference[mainAxis] + rects.reference[len] - computedOffset.mainAxis;
  10539. if (mainAxisCoord < limitMin) {
  10540. mainAxisCoord = limitMin;
  10541. } else if (mainAxisCoord > limitMax) {
  10542. mainAxisCoord = limitMax;
  10543. }
  10544. }
  10545. if (checkCrossAxis) {
  10546. var _middlewareData$offse, _middlewareData$offse2;
  10547. const len = mainAxis === 'y' ? 'width' : 'height';
  10548. const isOriginSide = ['top', 'left'].includes(getSide$1(placement));
  10549. const limitMin = rects.reference[crossAxis] - rects.floating[len] + (isOriginSide ? ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse[crossAxis]) || 0 : 0) + (isOriginSide ? 0 : computedOffset.crossAxis);
  10550. const limitMax = rects.reference[crossAxis] + rects.reference[len] + (isOriginSide ? 0 : ((_middlewareData$offse2 = middlewareData.offset) == null ? void 0 : _middlewareData$offse2[crossAxis]) || 0) - (isOriginSide ? computedOffset.crossAxis : 0);
  10551. if (crossAxisCoord < limitMin) {
  10552. crossAxisCoord = limitMin;
  10553. } else if (crossAxisCoord > limitMax) {
  10554. crossAxisCoord = limitMax;
  10555. }
  10556. }
  10557. return {
  10558. [mainAxis]: mainAxisCoord,
  10559. [crossAxis]: crossAxisCoord
  10560. };
  10561. }
  10562. };
  10563. };
  10564. /**
  10565. * Provides data that allows you to change the size of the floating element —
  10566. * for instance, prevent it from overflowing the clipping boundary or match the
  10567. * width of the reference element.
  10568. * @see https://floating-ui.com/docs/size
  10569. */
  10570. const size = function (options) {
  10571. if (options === void 0) {
  10572. options = {};
  10573. }
  10574. return {
  10575. name: 'size',
  10576. options,
  10577. async fn(state) {
  10578. const {
  10579. placement,
  10580. rects,
  10581. platform,
  10582. elements
  10583. } = state;
  10584. const {
  10585. apply = () => {},
  10586. ...detectOverflowOptions
  10587. } = evaluate(options, state);
  10588. const overflow = await detectOverflow$1(state, detectOverflowOptions);
  10589. const side = getSide$1(placement);
  10590. const alignment = getAlignment$1(placement);
  10591. const isYAxis = getSideAxis(placement) === 'y';
  10592. const {
  10593. width,
  10594. height
  10595. } = rects.floating;
  10596. let heightSide;
  10597. let widthSide;
  10598. if (side === 'top' || side === 'bottom') {
  10599. heightSide = side;
  10600. widthSide = alignment === ((await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating))) ? 'start' : 'end') ? 'left' : 'right';
  10601. } else {
  10602. widthSide = side;
  10603. heightSide = alignment === 'end' ? 'top' : 'bottom';
  10604. }
  10605. const maximumClippingHeight = height - overflow.top - overflow.bottom;
  10606. const maximumClippingWidth = width - overflow.left - overflow.right;
  10607. const overflowAvailableHeight = min$3(height - overflow[heightSide], maximumClippingHeight);
  10608. const overflowAvailableWidth = min$3(width - overflow[widthSide], maximumClippingWidth);
  10609. const noShift = !state.middlewareData.shift;
  10610. let availableHeight = overflowAvailableHeight;
  10611. let availableWidth = overflowAvailableWidth;
  10612. if (isYAxis) {
  10613. availableWidth = alignment || noShift ? min$3(overflowAvailableWidth, maximumClippingWidth) : maximumClippingWidth;
  10614. } else {
  10615. availableHeight = alignment || noShift ? min$3(overflowAvailableHeight, maximumClippingHeight) : maximumClippingHeight;
  10616. }
  10617. if (noShift && !alignment) {
  10618. const xMin = max$3(overflow.left, 0);
  10619. const xMax = max$3(overflow.right, 0);
  10620. const yMin = max$3(overflow.top, 0);
  10621. const yMax = max$3(overflow.bottom, 0);
  10622. if (isYAxis) {
  10623. availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max$3(overflow.left, overflow.right));
  10624. } else {
  10625. availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max$3(overflow.top, overflow.bottom));
  10626. }
  10627. }
  10628. await apply({
  10629. ...state,
  10630. availableWidth,
  10631. availableHeight
  10632. });
  10633. const nextDimensions = await platform.getDimensions(elements.floating);
  10634. if (width !== nextDimensions.width || height !== nextDimensions.height) {
  10635. return {
  10636. reset: {
  10637. rects: true
  10638. }
  10639. };
  10640. }
  10641. return {};
  10642. }
  10643. };
  10644. };
  10645. function getNodeName$1(node) {
  10646. if (isNode$1(node)) {
  10647. return (node.nodeName || '').toLowerCase();
  10648. }
  10649. // Mocked nodes in testing environments may not be instances of Node. By
  10650. // returning `#document` an infinite loop won't occur.
  10651. // https://github.com/floating-ui/floating-ui/issues/2317
  10652. return '#document';
  10653. }
  10654. function getWindow$1(node) {
  10655. var _node$ownerDocument;
  10656. return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
  10657. }
  10658. function getDocumentElement$1(node) {
  10659. var _ref;
  10660. return (_ref = (isNode$1(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
  10661. }
  10662. function isNode$1(value) {
  10663. return value instanceof Node || value instanceof getWindow$1(value).Node;
  10664. }
  10665. function isElement$1(value) {
  10666. return value instanceof Element || value instanceof getWindow$1(value).Element;
  10667. }
  10668. function isHTMLElement$1(value) {
  10669. return value instanceof HTMLElement || value instanceof getWindow$1(value).HTMLElement;
  10670. }
  10671. function isShadowRoot$1(value) {
  10672. // Browsers without `ShadowRoot` support.
  10673. if (typeof ShadowRoot === 'undefined') {
  10674. return false;
  10675. }
  10676. return value instanceof ShadowRoot || value instanceof getWindow$1(value).ShadowRoot;
  10677. }
  10678. function isOverflowElement$1(element) {
  10679. const {
  10680. overflow,
  10681. overflowX,
  10682. overflowY,
  10683. display
  10684. } = getComputedStyle$2(element);
  10685. return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !['inline', 'contents'].includes(display);
  10686. }
  10687. function isTableElement$1(element) {
  10688. return ['table', 'td', 'th'].includes(getNodeName$1(element));
  10689. }
  10690. function isTopLayer(element) {
  10691. return [':popover-open', ':modal'].some(selector => {
  10692. try {
  10693. return element.matches(selector);
  10694. } catch (e) {
  10695. return false;
  10696. }
  10697. });
  10698. }
  10699. function isContainingBlock$1(elementOrCss) {
  10700. const webkit = isWebKit();
  10701. const css = isElement$1(elementOrCss) ? getComputedStyle$2(elementOrCss) : elementOrCss;
  10702. // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
  10703. return css.transform !== 'none' || css.perspective !== 'none' || (css.containerType ? css.containerType !== 'normal' : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== 'none' : false) || !webkit && (css.filter ? css.filter !== 'none' : false) || ['transform', 'perspective', 'filter'].some(value => (css.willChange || '').includes(value)) || ['paint', 'layout', 'strict', 'content'].some(value => (css.contain || '').includes(value));
  10704. }
  10705. function getContainingBlock$1(element) {
  10706. let currentNode = getParentNode$1(element);
  10707. while (isHTMLElement$1(currentNode) && !isLastTraversableNode(currentNode)) {
  10708. if (isContainingBlock$1(currentNode)) {
  10709. return currentNode;
  10710. } else if (isTopLayer(currentNode)) {
  10711. return null;
  10712. }
  10713. currentNode = getParentNode$1(currentNode);
  10714. }
  10715. return null;
  10716. }
  10717. function isWebKit() {
  10718. if (typeof CSS === 'undefined' || !CSS.supports) return false;
  10719. return CSS.supports('-webkit-backdrop-filter', 'none');
  10720. }
  10721. function isLastTraversableNode(node) {
  10722. return ['html', 'body', '#document'].includes(getNodeName$1(node));
  10723. }
  10724. function getComputedStyle$2(element) {
  10725. return getWindow$1(element).getComputedStyle(element);
  10726. }
  10727. function getNodeScroll$1(element) {
  10728. if (isElement$1(element)) {
  10729. return {
  10730. scrollLeft: element.scrollLeft,
  10731. scrollTop: element.scrollTop
  10732. };
  10733. }
  10734. return {
  10735. scrollLeft: element.scrollX,
  10736. scrollTop: element.scrollY
  10737. };
  10738. }
  10739. function getParentNode$1(node) {
  10740. if (getNodeName$1(node) === 'html') {
  10741. return node;
  10742. }
  10743. const result =
  10744. // Step into the shadow DOM of the parent of a slotted node.
  10745. node.assignedSlot ||
  10746. // DOM Element detected.
  10747. node.parentNode ||
  10748. // ShadowRoot detected.
  10749. isShadowRoot$1(node) && node.host ||
  10750. // Fallback.
  10751. getDocumentElement$1(node);
  10752. return isShadowRoot$1(result) ? result.host : result;
  10753. }
  10754. function getNearestOverflowAncestor$1(node) {
  10755. const parentNode = getParentNode$1(node);
  10756. if (isLastTraversableNode(parentNode)) {
  10757. return node.ownerDocument ? node.ownerDocument.body : node.body;
  10758. }
  10759. if (isHTMLElement$1(parentNode) && isOverflowElement$1(parentNode)) {
  10760. return parentNode;
  10761. }
  10762. return getNearestOverflowAncestor$1(parentNode);
  10763. }
  10764. function getOverflowAncestors$1(node, list, traverseIframes) {
  10765. var _node$ownerDocument2;
  10766. if (list === void 0) {
  10767. list = [];
  10768. }
  10769. if (traverseIframes === void 0) {
  10770. traverseIframes = true;
  10771. }
  10772. const scrollableAncestor = getNearestOverflowAncestor$1(node);
  10773. const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
  10774. const win = getWindow$1(scrollableAncestor);
  10775. if (isBody) {
  10776. return list.concat(win, win.visualViewport || [], isOverflowElement$1(scrollableAncestor) ? scrollableAncestor : [], win.frameElement && traverseIframes ? getOverflowAncestors$1(win.frameElement) : []);
  10777. }
  10778. return list.concat(scrollableAncestor, getOverflowAncestors$1(scrollableAncestor, [], traverseIframes));
  10779. }
  10780. function getCssDimensions(element) {
  10781. const css = getComputedStyle$2(element);
  10782. // In testing environments, the `width` and `height` properties are empty
  10783. // strings for SVG elements, returning NaN. Fallback to `0` in this case.
  10784. let width = parseFloat(css.width) || 0;
  10785. let height = parseFloat(css.height) || 0;
  10786. const hasOffset = isHTMLElement$1(element);
  10787. const offsetWidth = hasOffset ? element.offsetWidth : width;
  10788. const offsetHeight = hasOffset ? element.offsetHeight : height;
  10789. const shouldFallback = round$1(width) !== offsetWidth || round$1(height) !== offsetHeight;
  10790. if (shouldFallback) {
  10791. width = offsetWidth;
  10792. height = offsetHeight;
  10793. }
  10794. return {
  10795. width,
  10796. height,
  10797. $: shouldFallback
  10798. };
  10799. }
  10800. function unwrapElement(element) {
  10801. return !isElement$1(element) ? element.contextElement : element;
  10802. }
  10803. function getScale(element) {
  10804. const domElement = unwrapElement(element);
  10805. if (!isHTMLElement$1(domElement)) {
  10806. return createCoords(1);
  10807. }
  10808. const rect = domElement.getBoundingClientRect();
  10809. const {
  10810. width,
  10811. height,
  10812. $
  10813. } = getCssDimensions(domElement);
  10814. let x = ($ ? round$1(rect.width) : rect.width) / width;
  10815. let y = ($ ? round$1(rect.height) : rect.height) / height;
  10816. // 0, NaN, or Infinity should always fallback to 1.
  10817. if (!x || !Number.isFinite(x)) {
  10818. x = 1;
  10819. }
  10820. if (!y || !Number.isFinite(y)) {
  10821. y = 1;
  10822. }
  10823. return {
  10824. x,
  10825. y
  10826. };
  10827. }
  10828. const noOffsets = /*#__PURE__*/createCoords(0);
  10829. function getVisualOffsets(element) {
  10830. const win = getWindow$1(element);
  10831. if (!isWebKit() || !win.visualViewport) {
  10832. return noOffsets;
  10833. }
  10834. return {
  10835. x: win.visualViewport.offsetLeft,
  10836. y: win.visualViewport.offsetTop
  10837. };
  10838. }
  10839. function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
  10840. if (isFixed === void 0) {
  10841. isFixed = false;
  10842. }
  10843. if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow$1(element)) {
  10844. return false;
  10845. }
  10846. return isFixed;
  10847. }
  10848. function getBoundingClientRect$1(element, includeScale, isFixedStrategy, offsetParent) {
  10849. if (includeScale === void 0) {
  10850. includeScale = false;
  10851. }
  10852. if (isFixedStrategy === void 0) {
  10853. isFixedStrategy = false;
  10854. }
  10855. const clientRect = element.getBoundingClientRect();
  10856. const domElement = unwrapElement(element);
  10857. let scale = createCoords(1);
  10858. if (includeScale) {
  10859. if (offsetParent) {
  10860. if (isElement$1(offsetParent)) {
  10861. scale = getScale(offsetParent);
  10862. }
  10863. } else {
  10864. scale = getScale(element);
  10865. }
  10866. }
  10867. const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
  10868. let x = (clientRect.left + visualOffsets.x) / scale.x;
  10869. let y = (clientRect.top + visualOffsets.y) / scale.y;
  10870. let width = clientRect.width / scale.x;
  10871. let height = clientRect.height / scale.y;
  10872. if (domElement) {
  10873. const win = getWindow$1(domElement);
  10874. const offsetWin = offsetParent && isElement$1(offsetParent) ? getWindow$1(offsetParent) : offsetParent;
  10875. let currentWin = win;
  10876. let currentIFrame = currentWin.frameElement;
  10877. while (currentIFrame && offsetParent && offsetWin !== currentWin) {
  10878. const iframeScale = getScale(currentIFrame);
  10879. const iframeRect = currentIFrame.getBoundingClientRect();
  10880. const css = getComputedStyle$2(currentIFrame);
  10881. const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
  10882. const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
  10883. x *= iframeScale.x;
  10884. y *= iframeScale.y;
  10885. width *= iframeScale.x;
  10886. height *= iframeScale.y;
  10887. x += left;
  10888. y += top;
  10889. currentWin = getWindow$1(currentIFrame);
  10890. currentIFrame = currentWin.frameElement;
  10891. }
  10892. }
  10893. return rectToClientRect$1({
  10894. width,
  10895. height,
  10896. x,
  10897. y
  10898. });
  10899. }
  10900. function convertOffsetParentRelativeRectToViewportRelativeRect$1(_ref) {
  10901. let {
  10902. elements,
  10903. rect,
  10904. offsetParent,
  10905. strategy
  10906. } = _ref;
  10907. const isFixed = strategy === 'fixed';
  10908. const documentElement = getDocumentElement$1(offsetParent);
  10909. const topLayer = elements ? isTopLayer(elements.floating) : false;
  10910. if (offsetParent === documentElement || topLayer && isFixed) {
  10911. return rect;
  10912. }
  10913. let scroll = {
  10914. scrollLeft: 0,
  10915. scrollTop: 0
  10916. };
  10917. let scale = createCoords(1);
  10918. const offsets = createCoords(0);
  10919. const isOffsetParentAnElement = isHTMLElement$1(offsetParent);
  10920. if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
  10921. if (getNodeName$1(offsetParent) !== 'body' || isOverflowElement$1(documentElement)) {
  10922. scroll = getNodeScroll$1(offsetParent);
  10923. }
  10924. if (isHTMLElement$1(offsetParent)) {
  10925. const offsetRect = getBoundingClientRect$1(offsetParent);
  10926. scale = getScale(offsetParent);
  10927. offsets.x = offsetRect.x + offsetParent.clientLeft;
  10928. offsets.y = offsetRect.y + offsetParent.clientTop;
  10929. }
  10930. }
  10931. return {
  10932. width: rect.width * scale.x,
  10933. height: rect.height * scale.y,
  10934. x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x,
  10935. y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y
  10936. };
  10937. }
  10938. function getClientRects(element) {
  10939. return Array.from(element.getClientRects());
  10940. }
  10941. function getWindowScrollBarX$1(element) {
  10942. // If <html> has a CSS width greater than the viewport, then this will be
  10943. // incorrect for RTL.
  10944. return getBoundingClientRect$1(getDocumentElement$1(element)).left + getNodeScroll$1(element).scrollLeft;
  10945. }
  10946. // Gets the entire size of the scrollable document area, even extending outside
  10947. // of the `<html>` and `<body>` rect bounds if horizontally scrollable.
  10948. function getDocumentRect$1(element) {
  10949. const html = getDocumentElement$1(element);
  10950. const scroll = getNodeScroll$1(element);
  10951. const body = element.ownerDocument.body;
  10952. const width = max$3(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
  10953. const height = max$3(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
  10954. let x = -scroll.scrollLeft + getWindowScrollBarX$1(element);
  10955. const y = -scroll.scrollTop;
  10956. if (getComputedStyle$2(body).direction === 'rtl') {
  10957. x += max$3(html.clientWidth, body.clientWidth) - width;
  10958. }
  10959. return {
  10960. width,
  10961. height,
  10962. x,
  10963. y
  10964. };
  10965. }
  10966. function getViewportRect$1(element, strategy) {
  10967. const win = getWindow$1(element);
  10968. const html = getDocumentElement$1(element);
  10969. const visualViewport = win.visualViewport;
  10970. let width = html.clientWidth;
  10971. let height = html.clientHeight;
  10972. let x = 0;
  10973. let y = 0;
  10974. if (visualViewport) {
  10975. width = visualViewport.width;
  10976. height = visualViewport.height;
  10977. const visualViewportBased = isWebKit();
  10978. if (!visualViewportBased || visualViewportBased && strategy === 'fixed') {
  10979. x = visualViewport.offsetLeft;
  10980. y = visualViewport.offsetTop;
  10981. }
  10982. }
  10983. return {
  10984. width,
  10985. height,
  10986. x,
  10987. y
  10988. };
  10989. }
  10990. // Returns the inner client rect, subtracting scrollbars if present.
  10991. function getInnerBoundingClientRect$1(element, strategy) {
  10992. const clientRect = getBoundingClientRect$1(element, true, strategy === 'fixed');
  10993. const top = clientRect.top + element.clientTop;
  10994. const left = clientRect.left + element.clientLeft;
  10995. const scale = isHTMLElement$1(element) ? getScale(element) : createCoords(1);
  10996. const width = element.clientWidth * scale.x;
  10997. const height = element.clientHeight * scale.y;
  10998. const x = left * scale.x;
  10999. const y = top * scale.y;
  11000. return {
  11001. width,
  11002. height,
  11003. x,
  11004. y
  11005. };
  11006. }
  11007. function getClientRectFromClippingAncestor$1(element, clippingAncestor, strategy) {
  11008. let rect;
  11009. if (clippingAncestor === 'viewport') {
  11010. rect = getViewportRect$1(element, strategy);
  11011. } else if (clippingAncestor === 'document') {
  11012. rect = getDocumentRect$1(getDocumentElement$1(element));
  11013. } else if (isElement$1(clippingAncestor)) {
  11014. rect = getInnerBoundingClientRect$1(clippingAncestor, strategy);
  11015. } else {
  11016. const visualOffsets = getVisualOffsets(element);
  11017. rect = {
  11018. ...clippingAncestor,
  11019. x: clippingAncestor.x - visualOffsets.x,
  11020. y: clippingAncestor.y - visualOffsets.y
  11021. };
  11022. }
  11023. return rectToClientRect$1(rect);
  11024. }
  11025. function hasFixedPositionAncestor(element, stopNode) {
  11026. const parentNode = getParentNode$1(element);
  11027. if (parentNode === stopNode || !isElement$1(parentNode) || isLastTraversableNode(parentNode)) {
  11028. return false;
  11029. }
  11030. return getComputedStyle$2(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode);
  11031. }
  11032. // A "clipping ancestor" is an `overflow` element with the characteristic of
  11033. // clipping (or hiding) child elements. This returns all clipping ancestors
  11034. // of the given element up the tree.
  11035. function getClippingElementAncestors(element, cache) {
  11036. const cachedResult = cache.get(element);
  11037. if (cachedResult) {
  11038. return cachedResult;
  11039. }
  11040. let result = getOverflowAncestors$1(element, [], false).filter(el => isElement$1(el) && getNodeName$1(el) !== 'body');
  11041. let currentContainingBlockComputedStyle = null;
  11042. const elementIsFixed = getComputedStyle$2(element).position === 'fixed';
  11043. let currentNode = elementIsFixed ? getParentNode$1(element) : element;
  11044. // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
  11045. while (isElement$1(currentNode) && !isLastTraversableNode(currentNode)) {
  11046. const computedStyle = getComputedStyle$2(currentNode);
  11047. const currentNodeIsContaining = isContainingBlock$1(currentNode);
  11048. if (!currentNodeIsContaining && computedStyle.position === 'fixed') {
  11049. currentContainingBlockComputedStyle = null;
  11050. }
  11051. const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && ['absolute', 'fixed'].includes(currentContainingBlockComputedStyle.position) || isOverflowElement$1(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
  11052. if (shouldDropCurrentNode) {
  11053. // Drop non-containing blocks.
  11054. result = result.filter(ancestor => ancestor !== currentNode);
  11055. } else {
  11056. // Record last containing block for next iteration.
  11057. currentContainingBlockComputedStyle = computedStyle;
  11058. }
  11059. currentNode = getParentNode$1(currentNode);
  11060. }
  11061. cache.set(element, result);
  11062. return result;
  11063. }
  11064. // Gets the maximum area that the element is visible in due to any number of
  11065. // clipping ancestors.
  11066. function getClippingRect$1(_ref) {
  11067. let {
  11068. element,
  11069. boundary,
  11070. rootBoundary,
  11071. strategy
  11072. } = _ref;
  11073. const elementClippingAncestors = boundary === 'clippingAncestors' ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
  11074. const clippingAncestors = [...elementClippingAncestors, rootBoundary];
  11075. const firstClippingAncestor = clippingAncestors[0];
  11076. const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
  11077. const rect = getClientRectFromClippingAncestor$1(element, clippingAncestor, strategy);
  11078. accRect.top = max$3(rect.top, accRect.top);
  11079. accRect.right = min$3(rect.right, accRect.right);
  11080. accRect.bottom = min$3(rect.bottom, accRect.bottom);
  11081. accRect.left = max$3(rect.left, accRect.left);
  11082. return accRect;
  11083. }, getClientRectFromClippingAncestor$1(element, firstClippingAncestor, strategy));
  11084. return {
  11085. width: clippingRect.right - clippingRect.left,
  11086. height: clippingRect.bottom - clippingRect.top,
  11087. x: clippingRect.left,
  11088. y: clippingRect.top
  11089. };
  11090. }
  11091. function getDimensions$1(element) {
  11092. const {
  11093. width,
  11094. height
  11095. } = getCssDimensions(element);
  11096. return {
  11097. width,
  11098. height
  11099. };
  11100. }
  11101. function getRectRelativeToOffsetParent$1(element, offsetParent, strategy) {
  11102. const isOffsetParentAnElement = isHTMLElement$1(offsetParent);
  11103. const documentElement = getDocumentElement$1(offsetParent);
  11104. const isFixed = strategy === 'fixed';
  11105. const rect = getBoundingClientRect$1(element, true, isFixed, offsetParent);
  11106. let scroll = {
  11107. scrollLeft: 0,
  11108. scrollTop: 0
  11109. };
  11110. const offsets = createCoords(0);
  11111. if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
  11112. if (getNodeName$1(offsetParent) !== 'body' || isOverflowElement$1(documentElement)) {
  11113. scroll = getNodeScroll$1(offsetParent);
  11114. }
  11115. if (isOffsetParentAnElement) {
  11116. const offsetRect = getBoundingClientRect$1(offsetParent, true, isFixed, offsetParent);
  11117. offsets.x = offsetRect.x + offsetParent.clientLeft;
  11118. offsets.y = offsetRect.y + offsetParent.clientTop;
  11119. } else if (documentElement) {
  11120. offsets.x = getWindowScrollBarX$1(documentElement);
  11121. }
  11122. }
  11123. const x = rect.left + scroll.scrollLeft - offsets.x;
  11124. const y = rect.top + scroll.scrollTop - offsets.y;
  11125. return {
  11126. x,
  11127. y,
  11128. width: rect.width,
  11129. height: rect.height
  11130. };
  11131. }
  11132. function isStaticPositioned(element) {
  11133. return getComputedStyle$2(element).position === 'static';
  11134. }
  11135. function getTrueOffsetParent$1(element, polyfill) {
  11136. if (!isHTMLElement$1(element) || getComputedStyle$2(element).position === 'fixed') {
  11137. return null;
  11138. }
  11139. if (polyfill) {
  11140. return polyfill(element);
  11141. }
  11142. return element.offsetParent;
  11143. }
  11144. // Gets the closest ancestor positioned element. Handles some edge cases,
  11145. // such as table ancestors and cross browser bugs.
  11146. function getOffsetParent$1(element, polyfill) {
  11147. const win = getWindow$1(element);
  11148. if (isTopLayer(element)) {
  11149. return win;
  11150. }
  11151. if (!isHTMLElement$1(element)) {
  11152. let svgOffsetParent = getParentNode$1(element);
  11153. while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
  11154. if (isElement$1(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {
  11155. return svgOffsetParent;
  11156. }
  11157. svgOffsetParent = getParentNode$1(svgOffsetParent);
  11158. }
  11159. return win;
  11160. }
  11161. let offsetParent = getTrueOffsetParent$1(element, polyfill);
  11162. while (offsetParent && isTableElement$1(offsetParent) && isStaticPositioned(offsetParent)) {
  11163. offsetParent = getTrueOffsetParent$1(offsetParent, polyfill);
  11164. }
  11165. if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock$1(offsetParent)) {
  11166. return win;
  11167. }
  11168. return offsetParent || getContainingBlock$1(element) || win;
  11169. }
  11170. const getElementRects = async function (data) {
  11171. const getOffsetParentFn = this.getOffsetParent || getOffsetParent$1;
  11172. const getDimensionsFn = this.getDimensions;
  11173. const floatingDimensions = await getDimensionsFn(data.floating);
  11174. return {
  11175. reference: getRectRelativeToOffsetParent$1(data.reference, await getOffsetParentFn(data.floating), data.strategy),
  11176. floating: {
  11177. x: 0,
  11178. y: 0,
  11179. width: floatingDimensions.width,
  11180. height: floatingDimensions.height
  11181. }
  11182. };
  11183. };
  11184. function isRTL$1(element) {
  11185. return getComputedStyle$2(element).direction === 'rtl';
  11186. }
  11187. const platform$1 = {
  11188. convertOffsetParentRelativeRectToViewportRelativeRect: convertOffsetParentRelativeRectToViewportRelativeRect$1,
  11189. getDocumentElement: getDocumentElement$1,
  11190. getClippingRect: getClippingRect$1,
  11191. getOffsetParent: getOffsetParent$1,
  11192. getElementRects,
  11193. getClientRects,
  11194. getDimensions: getDimensions$1,
  11195. getScale,
  11196. isElement: isElement$1,
  11197. isRTL: isRTL$1
  11198. };
  11199. /**
  11200. * Modifies the placement by translating the floating element along the
  11201. * specified axes.
  11202. * A number (shorthand for `mainAxis` or distance), or an axes configuration
  11203. * object may be passed.
  11204. * @see https://floating-ui.com/docs/offset
  11205. */
  11206. offset$1;
  11207. /**
  11208. * Optimizes the visibility of the floating element by choosing the placement
  11209. * that has the most space available automatically, without needing to specify a
  11210. * preferred placement. Alternative to `flip`.
  11211. * @see https://floating-ui.com/docs/autoPlacement
  11212. */
  11213. autoPlacement;
  11214. /**
  11215. * Optimizes the visibility of the floating element by shifting it in order to
  11216. * keep it in view when it will overflow the clipping boundary.
  11217. * @see https://floating-ui.com/docs/shift
  11218. */
  11219. shift$1;
  11220. /**
  11221. * Optimizes the visibility of the floating element by flipping the `placement`
  11222. * in order to keep it in view when the preferred placement(s) will overflow the
  11223. * clipping boundary. Alternative to `autoPlacement`.
  11224. * @see https://floating-ui.com/docs/flip
  11225. */
  11226. flip$1;
  11227. /**
  11228. * Provides data that allows you to change the size of the floating element —
  11229. * for instance, prevent it from overflowing the clipping boundary or match the
  11230. * width of the reference element.
  11231. * @see https://floating-ui.com/docs/size
  11232. */
  11233. size;
  11234. /**
  11235. * Provides data to hide the floating element in applicable situations, such as
  11236. * when it is not in the same clipping context as the reference element.
  11237. * @see https://floating-ui.com/docs/hide
  11238. */
  11239. hide;
  11240. /**
  11241. * Provides data to position an inner element of the floating element so that it
  11242. * appears centered to the reference element.
  11243. * @see https://floating-ui.com/docs/arrow
  11244. */
  11245. const arrow$1 = arrow$2;
  11246. /**
  11247. * Provides improved positioning for inline reference elements that can span
  11248. * over multiple lines, such as hyperlinks or range selections.
  11249. * @see https://floating-ui.com/docs/inline
  11250. */
  11251. inline;
  11252. /**
  11253. * Built-in `limiter` that will stop `shift()` at a certain point.
  11254. */
  11255. limitShift;
  11256. /**
  11257. * Computes the `x` and `y` coordinates that will place the floating element
  11258. * next to a given reference element.
  11259. */
  11260. const computePosition$2 = (reference, floating, options) => {
  11261. // This caches the expensive `getClippingElementAncestors` function so that
  11262. // multiple lifecycle resets re-use the same result. It only lives for a
  11263. // single call. If other functions become expensive, we can add them as well.
  11264. const cache = new Map();
  11265. const mergedOptions = {
  11266. platform: platform$1,
  11267. ...options
  11268. };
  11269. const platformWithCache = {
  11270. ...mergedOptions.platform,
  11271. _c: cache
  11272. };
  11273. return computePosition$3(reference, floating, {
  11274. ...mergedOptions,
  11275. platform: platformWithCache
  11276. });
  11277. };
  11278. const useFloatingProps = buildProps({});
  11279. const unrefReference = (elRef) => {
  11280. if (!isClient)
  11281. return;
  11282. if (!elRef)
  11283. return elRef;
  11284. const unrefEl = unrefElement(elRef);
  11285. if (unrefEl)
  11286. return unrefEl;
  11287. return vue.isRef(elRef) ? unrefEl : elRef;
  11288. };
  11289. const getPositionDataWithUnit = (record, key) => {
  11290. const value = record == null ? void 0 : record[key];
  11291. return isNil(value) ? "" : `${value}px`;
  11292. };
  11293. const useFloating$1 = ({
  11294. middleware,
  11295. placement,
  11296. strategy
  11297. }) => {
  11298. const referenceRef = vue.ref();
  11299. const contentRef = vue.ref();
  11300. const x = vue.ref();
  11301. const y = vue.ref();
  11302. const middlewareData = vue.ref({});
  11303. const states = {
  11304. x,
  11305. y,
  11306. placement,
  11307. strategy,
  11308. middlewareData
  11309. };
  11310. const update = async () => {
  11311. if (!isClient)
  11312. return;
  11313. const referenceEl = unrefReference(referenceRef);
  11314. const contentEl = unrefElement(contentRef);
  11315. if (!referenceEl || !contentEl)
  11316. return;
  11317. const data = await computePosition$2(referenceEl, contentEl, {
  11318. placement: vue.unref(placement),
  11319. strategy: vue.unref(strategy),
  11320. middleware: vue.unref(middleware)
  11321. });
  11322. keysOf(states).forEach((key) => {
  11323. states[key].value = data[key];
  11324. });
  11325. };
  11326. vue.onMounted(() => {
  11327. vue.watchEffect(() => {
  11328. update();
  11329. });
  11330. });
  11331. return {
  11332. ...states,
  11333. update,
  11334. referenceRef,
  11335. contentRef
  11336. };
  11337. };
  11338. const arrowMiddleware = ({
  11339. arrowRef,
  11340. padding
  11341. }) => {
  11342. return {
  11343. name: "arrow",
  11344. options: {
  11345. element: arrowRef,
  11346. padding
  11347. },
  11348. fn(args) {
  11349. const arrowEl = vue.unref(arrowRef);
  11350. if (!arrowEl)
  11351. return {};
  11352. return arrow$1({
  11353. element: arrowEl,
  11354. padding
  11355. }).fn(args);
  11356. }
  11357. };
  11358. };
  11359. function useCursor(input) {
  11360. let selectionInfo;
  11361. function recordCursor() {
  11362. if (input.value == void 0)
  11363. return;
  11364. const { selectionStart, selectionEnd, value } = input.value;
  11365. if (selectionStart == null || selectionEnd == null)
  11366. return;
  11367. const beforeTxt = value.slice(0, Math.max(0, selectionStart));
  11368. const afterTxt = value.slice(Math.max(0, selectionEnd));
  11369. selectionInfo = {
  11370. selectionStart,
  11371. selectionEnd,
  11372. value,
  11373. beforeTxt,
  11374. afterTxt
  11375. };
  11376. }
  11377. function setCursor() {
  11378. if (input.value == void 0 || selectionInfo == void 0)
  11379. return;
  11380. const { value } = input.value;
  11381. const { beforeTxt, afterTxt, selectionStart } = selectionInfo;
  11382. if (beforeTxt == void 0 || afterTxt == void 0 || selectionStart == void 0)
  11383. return;
  11384. let startPos = value.length;
  11385. if (value.endsWith(afterTxt)) {
  11386. startPos = value.length - afterTxt.length;
  11387. } else if (value.startsWith(beforeTxt)) {
  11388. startPos = beforeTxt.length;
  11389. } else {
  11390. const beforeLastChar = beforeTxt[selectionStart - 1];
  11391. const newIndex = value.indexOf(beforeLastChar, selectionStart - 1);
  11392. if (newIndex !== -1) {
  11393. startPos = newIndex + 1;
  11394. }
  11395. }
  11396. input.value.setSelectionRange(startPos, startPos);
  11397. }
  11398. return [recordCursor, setCursor];
  11399. }
  11400. const getOrderedChildren = (vm, childComponentName, children) => {
  11401. const nodes = flattedChildren(vm.subTree).filter((n) => {
  11402. var _a;
  11403. return vue.isVNode(n) && ((_a = n.type) == null ? void 0 : _a.name) === childComponentName && !!n.component;
  11404. });
  11405. const uids = nodes.map((n) => n.component.uid);
  11406. return uids.map((uid) => children[uid]).filter((p) => !!p);
  11407. };
  11408. const useOrderedChildren = (vm, childComponentName) => {
  11409. const children = vue.shallowRef({});
  11410. const orderedChildren = vue.shallowRef([]);
  11411. const nodesMap = /* @__PURE__ */ new WeakMap();
  11412. const addChild = (child) => {
  11413. children.value[child.uid] = child;
  11414. vue.triggerRef(children);
  11415. vue.onMounted(() => {
  11416. const childNode = child.getVnode().el;
  11417. const parentNode = childNode.parentNode;
  11418. if (!nodesMap.has(parentNode)) {
  11419. nodesMap.set(parentNode, []);
  11420. const originalFn = parentNode.insertBefore.bind(parentNode);
  11421. parentNode.insertBefore = (node, anchor) => {
  11422. const shouldSortChildren = nodesMap.get(parentNode).some((el) => node === el || anchor === el);
  11423. if (shouldSortChildren)
  11424. vue.triggerRef(children);
  11425. return originalFn(node, anchor);
  11426. };
  11427. }
  11428. nodesMap.get(parentNode).push(childNode);
  11429. });
  11430. };
  11431. const removeChild = (child) => {
  11432. delete children.value[child.uid];
  11433. vue.triggerRef(children);
  11434. const childNode = child.getVnode().el;
  11435. const parentNode = childNode.parentNode;
  11436. const childNodes = nodesMap.get(parentNode);
  11437. const index = childNodes.indexOf(childNode);
  11438. childNodes.splice(index, 1);
  11439. };
  11440. const sortChildren = () => {
  11441. orderedChildren.value = getOrderedChildren(vm, childComponentName, children.value);
  11442. };
  11443. const IsolatedRenderer = (props) => {
  11444. return props.render();
  11445. };
  11446. const ChildrenSorter = vue.defineComponent({
  11447. setup(_, { slots }) {
  11448. return () => {
  11449. sortChildren();
  11450. return slots.default ? vue.h(IsolatedRenderer, {
  11451. render: slots.default
  11452. }) : null;
  11453. };
  11454. }
  11455. });
  11456. return {
  11457. children: orderedChildren,
  11458. addChild,
  11459. removeChild,
  11460. ChildrenSorter
  11461. };
  11462. };
  11463. const useSizeProp = buildProp({
  11464. type: String,
  11465. values: componentSizes,
  11466. required: false
  11467. });
  11468. const useSizeProps = {
  11469. size: useSizeProp
  11470. };
  11471. const SIZE_INJECTION_KEY = Symbol("size");
  11472. const useGlobalSize = () => {
  11473. const injectedSize = vue.inject(SIZE_INJECTION_KEY, {});
  11474. return vue.computed(() => {
  11475. return vue.unref(injectedSize.size) || "";
  11476. });
  11477. };
  11478. function useFocusController(target, {
  11479. disabled,
  11480. beforeFocus,
  11481. afterFocus,
  11482. beforeBlur,
  11483. afterBlur
  11484. } = {}) {
  11485. const instance = vue.getCurrentInstance();
  11486. const { emit } = instance;
  11487. const wrapperRef = vue.shallowRef();
  11488. const isFocused = vue.ref(false);
  11489. const handleFocus = (event) => {
  11490. const cancelFocus = isFunction$1(beforeFocus) ? beforeFocus(event) : false;
  11491. if (vue.unref(disabled) || isFocused.value || cancelFocus)
  11492. return;
  11493. isFocused.value = true;
  11494. emit("focus", event);
  11495. afterFocus == null ? void 0 : afterFocus();
  11496. };
  11497. const handleBlur = (event) => {
  11498. var _a;
  11499. const cancelBlur = isFunction$1(beforeBlur) ? beforeBlur(event) : false;
  11500. if (vue.unref(disabled) || event.relatedTarget && ((_a = wrapperRef.value) == null ? void 0 : _a.contains(event.relatedTarget)) || cancelBlur)
  11501. return;
  11502. isFocused.value = false;
  11503. emit("blur", event);
  11504. afterBlur == null ? void 0 : afterBlur();
  11505. };
  11506. const handleClick = (event) => {
  11507. var _a, _b;
  11508. if (vue.unref(disabled) || isFocusable(event.target) || ((_a = wrapperRef.value) == null ? void 0 : _a.contains(document.activeElement)) && wrapperRef.value !== document.activeElement)
  11509. return;
  11510. (_b = target.value) == null ? void 0 : _b.focus();
  11511. };
  11512. vue.watch([wrapperRef, () => vue.unref(disabled)], ([el, disabled2]) => {
  11513. if (!el)
  11514. return;
  11515. if (disabled2) {
  11516. el.removeAttribute("tabindex");
  11517. } else {
  11518. el.setAttribute("tabindex", "-1");
  11519. }
  11520. });
  11521. useEventListener(wrapperRef, "focus", handleFocus, true);
  11522. useEventListener(wrapperRef, "blur", handleBlur, true);
  11523. useEventListener(wrapperRef, "click", handleClick, true);
  11524. return {
  11525. isFocused,
  11526. wrapperRef,
  11527. handleFocus,
  11528. handleBlur
  11529. };
  11530. }
  11531. function useComposition({
  11532. afterComposition,
  11533. emit
  11534. }) {
  11535. const isComposing = vue.ref(false);
  11536. const handleCompositionStart = (event) => {
  11537. emit == null ? void 0 : emit("compositionstart", event);
  11538. isComposing.value = true;
  11539. };
  11540. const handleCompositionUpdate = (event) => {
  11541. var _a;
  11542. emit == null ? void 0 : emit("compositionupdate", event);
  11543. const text = (_a = event.target) == null ? void 0 : _a.value;
  11544. const lastCharacter = text[text.length - 1] || "";
  11545. isComposing.value = !isKorean(lastCharacter);
  11546. };
  11547. const handleCompositionEnd = (event) => {
  11548. emit == null ? void 0 : emit("compositionend", event);
  11549. if (isComposing.value) {
  11550. isComposing.value = false;
  11551. vue.nextTick(() => afterComposition(event));
  11552. }
  11553. };
  11554. const handleComposition = (event) => {
  11555. event.type === "compositionend" ? handleCompositionEnd(event) : handleCompositionUpdate(event);
  11556. };
  11557. return {
  11558. isComposing,
  11559. handleComposition,
  11560. handleCompositionStart,
  11561. handleCompositionUpdate,
  11562. handleCompositionEnd
  11563. };
  11564. }
  11565. const emptyValuesContextKey = Symbol("emptyValuesContextKey");
  11566. const SCOPE$7 = "use-empty-values";
  11567. const DEFAULT_EMPTY_VALUES = ["", void 0, null];
  11568. const DEFAULT_VALUE_ON_CLEAR = void 0;
  11569. const useEmptyValuesProps = buildProps({
  11570. emptyValues: Array,
  11571. valueOnClear: {
  11572. type: definePropType([
  11573. String,
  11574. Number,
  11575. Boolean,
  11576. Function
  11577. ]),
  11578. default: void 0,
  11579. validator: (val) => {
  11580. val = isFunction$1(val) ? val() : val;
  11581. if (isArray$1(val)) {
  11582. return val.every((item) => !item);
  11583. }
  11584. return !val;
  11585. }
  11586. }
  11587. });
  11588. const useEmptyValues = (props, defaultValue) => {
  11589. const config = vue.getCurrentInstance() ? vue.inject(emptyValuesContextKey, vue.ref({})) : vue.ref({});
  11590. const emptyValues = vue.computed(() => props.emptyValues || config.value.emptyValues || DEFAULT_EMPTY_VALUES);
  11591. const valueOnClear = vue.computed(() => {
  11592. if (isFunction$1(props.valueOnClear)) {
  11593. return props.valueOnClear();
  11594. } else if (props.valueOnClear !== void 0) {
  11595. return props.valueOnClear;
  11596. } else if (isFunction$1(config.value.valueOnClear)) {
  11597. return config.value.valueOnClear();
  11598. } else if (config.value.valueOnClear !== void 0) {
  11599. return config.value.valueOnClear;
  11600. }
  11601. return defaultValue !== void 0 ? defaultValue : DEFAULT_VALUE_ON_CLEAR;
  11602. });
  11603. const isEmptyValue = (value) => {
  11604. let result = true;
  11605. if (isArray$1(value)) {
  11606. result = emptyValues.value.some((emptyValue) => {
  11607. return isEqual$1(value, emptyValue);
  11608. });
  11609. } else {
  11610. result = emptyValues.value.includes(value);
  11611. }
  11612. return result;
  11613. };
  11614. if (!isEmptyValue(valueOnClear.value)) {
  11615. debugWarn(SCOPE$7, "value-on-clear should be a value of empty-values");
  11616. }
  11617. return {
  11618. emptyValues,
  11619. valueOnClear,
  11620. isEmptyValue
  11621. };
  11622. };
  11623. const ariaProps = buildProps({
  11624. ariaLabel: String,
  11625. ariaOrientation: {
  11626. type: String,
  11627. values: ["horizontal", "vertical", "undefined"]
  11628. },
  11629. ariaControls: String
  11630. });
  11631. const useAriaProps = (arias) => {
  11632. return pick(ariaProps, arias);
  11633. };
  11634. const configProviderContextKey = Symbol();
  11635. const globalConfig = vue.ref();
  11636. function useGlobalConfig(key, defaultValue = void 0) {
  11637. const config = vue.getCurrentInstance() ? vue.inject(configProviderContextKey, globalConfig) : globalConfig;
  11638. if (key) {
  11639. return vue.computed(() => {
  11640. var _a, _b;
  11641. return (_b = (_a = config.value) == null ? void 0 : _a[key]) != null ? _b : defaultValue;
  11642. });
  11643. } else {
  11644. return config;
  11645. }
  11646. }
  11647. function useGlobalComponentSettings(block, sizeFallback) {
  11648. const config = useGlobalConfig();
  11649. const ns = useNamespace(block, vue.computed(() => {
  11650. var _a;
  11651. return ((_a = config.value) == null ? void 0 : _a.namespace) || defaultNamespace;
  11652. }));
  11653. const locale = useLocale(vue.computed(() => {
  11654. var _a;
  11655. return (_a = config.value) == null ? void 0 : _a.locale;
  11656. }));
  11657. const zIndex = useZIndex(vue.computed(() => {
  11658. var _a;
  11659. return ((_a = config.value) == null ? void 0 : _a.zIndex) || defaultInitialZIndex;
  11660. }));
  11661. const size = vue.computed(() => {
  11662. var _a;
  11663. return vue.unref(sizeFallback) || ((_a = config.value) == null ? void 0 : _a.size) || "";
  11664. });
  11665. provideGlobalConfig(vue.computed(() => vue.unref(config) || {}));
  11666. return {
  11667. ns,
  11668. locale,
  11669. zIndex,
  11670. size
  11671. };
  11672. }
  11673. const provideGlobalConfig = (config, app, global = false) => {
  11674. var _a;
  11675. const inSetup = !!vue.getCurrentInstance();
  11676. const oldConfig = inSetup ? useGlobalConfig() : void 0;
  11677. const provideFn = (_a = app == null ? void 0 : app.provide) != null ? _a : inSetup ? vue.provide : void 0;
  11678. if (!provideFn) {
  11679. debugWarn("provideGlobalConfig", "provideGlobalConfig() can only be used inside setup().");
  11680. return;
  11681. }
  11682. const context = vue.computed(() => {
  11683. const cfg = vue.unref(config);
  11684. if (!(oldConfig == null ? void 0 : oldConfig.value))
  11685. return cfg;
  11686. return mergeConfig(oldConfig.value, cfg);
  11687. });
  11688. provideFn(configProviderContextKey, context);
  11689. provideFn(localeContextKey, vue.computed(() => context.value.locale));
  11690. provideFn(namespaceContextKey, vue.computed(() => context.value.namespace));
  11691. provideFn(zIndexContextKey, vue.computed(() => context.value.zIndex));
  11692. provideFn(SIZE_INJECTION_KEY, {
  11693. size: vue.computed(() => context.value.size || "")
  11694. });
  11695. provideFn(emptyValuesContextKey, vue.computed(() => ({
  11696. emptyValues: context.value.emptyValues,
  11697. valueOnClear: context.value.valueOnClear
  11698. })));
  11699. if (global || !globalConfig.value) {
  11700. globalConfig.value = context.value;
  11701. }
  11702. return context;
  11703. };
  11704. const mergeConfig = (a, b) => {
  11705. const keys = [.../* @__PURE__ */ new Set([...keysOf(a), ...keysOf(b)])];
  11706. const obj = {};
  11707. for (const key of keys) {
  11708. obj[key] = b[key] !== void 0 ? b[key] : a[key];
  11709. }
  11710. return obj;
  11711. };
  11712. const configProviderProps = buildProps({
  11713. a11y: {
  11714. type: Boolean,
  11715. default: true
  11716. },
  11717. locale: {
  11718. type: definePropType(Object)
  11719. },
  11720. size: useSizeProp,
  11721. button: {
  11722. type: definePropType(Object)
  11723. },
  11724. card: {
  11725. type: definePropType(Object)
  11726. },
  11727. dialog: {
  11728. type: definePropType(Object)
  11729. },
  11730. link: {
  11731. type: definePropType(Object)
  11732. },
  11733. experimentalFeatures: {
  11734. type: definePropType(Object)
  11735. },
  11736. keyboardNavigation: {
  11737. type: Boolean,
  11738. default: true
  11739. },
  11740. message: {
  11741. type: definePropType(Object)
  11742. },
  11743. zIndex: Number,
  11744. namespace: {
  11745. type: String,
  11746. default: "el"
  11747. },
  11748. ...useEmptyValuesProps
  11749. });
  11750. const messageConfig = {
  11751. placement: "top"
  11752. };
  11753. const ConfigProvider = vue.defineComponent({
  11754. name: "ElConfigProvider",
  11755. props: configProviderProps,
  11756. setup(props, { slots }) {
  11757. const config = provideGlobalConfig(props);
  11758. vue.watch(() => props.message, (val) => {
  11759. var _a, _b;
  11760. Object.assign(messageConfig, (_b = (_a = config == null ? void 0 : config.value) == null ? void 0 : _a.message) != null ? _b : {}, val != null ? val : {});
  11761. }, { immediate: true, deep: true });
  11762. return () => vue.renderSlot(slots, "default", { config: config == null ? void 0 : config.value });
  11763. }
  11764. });
  11765. const ElConfigProvider = withInstall(ConfigProvider);
  11766. const version$1 = "2.11.7";
  11767. const makeInstaller = (components = []) => {
  11768. const install = (app, options) => {
  11769. if (app[INSTALLED_KEY])
  11770. return;
  11771. app[INSTALLED_KEY] = true;
  11772. components.forEach((c) => app.use(c));
  11773. if (options)
  11774. provideGlobalConfig(options, app, true);
  11775. };
  11776. return {
  11777. version: version$1,
  11778. install
  11779. };
  11780. };
  11781. const affixProps = buildProps({
  11782. zIndex: {
  11783. type: definePropType([Number, String]),
  11784. default: 100
  11785. },
  11786. target: {
  11787. type: String,
  11788. default: ""
  11789. },
  11790. offset: {
  11791. type: Number,
  11792. default: 0
  11793. },
  11794. position: {
  11795. type: String,
  11796. values: ["top", "bottom"],
  11797. default: "top"
  11798. }
  11799. });
  11800. const affixEmits = {
  11801. scroll: ({ scrollTop, fixed }) => isNumber(scrollTop) && isBoolean(fixed),
  11802. [CHANGE_EVENT]: (fixed) => isBoolean(fixed)
  11803. };
  11804. var _export_sfc = (sfc, props) => {
  11805. const target = sfc.__vccOpts || sfc;
  11806. for (const [key, val] of props) {
  11807. target[key] = val;
  11808. }
  11809. return target;
  11810. };
  11811. const COMPONENT_NAME$p = "ElAffix";
  11812. const __default__$1Y = vue.defineComponent({
  11813. name: COMPONENT_NAME$p
  11814. });
  11815. const _sfc_main$2v = /* @__PURE__ */ vue.defineComponent({
  11816. ...__default__$1Y,
  11817. props: affixProps,
  11818. emits: affixEmits,
  11819. setup(__props, { expose, emit }) {
  11820. const props = __props;
  11821. const ns = useNamespace("affix");
  11822. const target = vue.shallowRef();
  11823. const root = vue.shallowRef();
  11824. const scrollContainer = vue.shallowRef();
  11825. const { height: windowHeight } = useWindowSize();
  11826. const {
  11827. height: rootHeight,
  11828. width: rootWidth,
  11829. top: rootTop,
  11830. bottom: rootBottom,
  11831. update: updateRoot
  11832. } = useElementBounding(root, { windowScroll: false });
  11833. const targetRect = useElementBounding(target);
  11834. const fixed = vue.ref(false);
  11835. const scrollTop = vue.ref(0);
  11836. const transform = vue.ref(0);
  11837. const rootStyle = vue.computed(() => {
  11838. return {
  11839. height: fixed.value ? `${rootHeight.value}px` : "",
  11840. width: fixed.value ? `${rootWidth.value}px` : ""
  11841. };
  11842. });
  11843. const affixStyle = vue.computed(() => {
  11844. if (!fixed.value)
  11845. return {};
  11846. const offset = props.offset ? addUnit(props.offset) : 0;
  11847. return {
  11848. height: `${rootHeight.value}px`,
  11849. width: `${rootWidth.value}px`,
  11850. top: props.position === "top" ? offset : "",
  11851. bottom: props.position === "bottom" ? offset : "",
  11852. transform: transform.value ? `translateY(${transform.value}px)` : "",
  11853. zIndex: props.zIndex
  11854. };
  11855. });
  11856. const update = () => {
  11857. if (!scrollContainer.value)
  11858. return;
  11859. scrollTop.value = scrollContainer.value instanceof Window ? document.documentElement.scrollTop : scrollContainer.value.scrollTop || 0;
  11860. const { position, target: target2, offset } = props;
  11861. const rootHeightOffset = offset + rootHeight.value;
  11862. if (position === "top") {
  11863. if (target2) {
  11864. const difference = targetRect.bottom.value - rootHeightOffset;
  11865. fixed.value = offset > rootTop.value && targetRect.bottom.value > 0;
  11866. transform.value = difference < 0 ? difference : 0;
  11867. } else {
  11868. fixed.value = offset > rootTop.value;
  11869. }
  11870. } else if (target2) {
  11871. const difference = windowHeight.value - targetRect.top.value - rootHeightOffset;
  11872. fixed.value = windowHeight.value - offset < rootBottom.value && windowHeight.value > targetRect.top.value;
  11873. transform.value = difference < 0 ? -difference : 0;
  11874. } else {
  11875. fixed.value = windowHeight.value - offset < rootBottom.value;
  11876. }
  11877. };
  11878. const updateRootRect = async () => {
  11879. if (!fixed.value) {
  11880. updateRoot();
  11881. return;
  11882. }
  11883. fixed.value = false;
  11884. await vue.nextTick();
  11885. updateRoot();
  11886. fixed.value = true;
  11887. };
  11888. const handleScroll = async () => {
  11889. updateRoot();
  11890. await vue.nextTick();
  11891. emit("scroll", {
  11892. scrollTop: scrollTop.value,
  11893. fixed: fixed.value
  11894. });
  11895. };
  11896. vue.watch(fixed, (val) => emit(CHANGE_EVENT, val));
  11897. vue.onMounted(() => {
  11898. var _a;
  11899. if (props.target) {
  11900. target.value = (_a = document.querySelector(props.target)) != null ? _a : void 0;
  11901. if (!target.value)
  11902. throwError(COMPONENT_NAME$p, `Target does not exist: ${props.target}`);
  11903. } else {
  11904. target.value = document.documentElement;
  11905. }
  11906. scrollContainer.value = getScrollContainer(root.value, true);
  11907. updateRoot();
  11908. });
  11909. useEventListener(scrollContainer, "scroll", handleScroll);
  11910. vue.watchEffect(update);
  11911. expose({
  11912. update,
  11913. updateRoot: updateRootRect
  11914. });
  11915. return (_ctx, _cache) => {
  11916. return vue.openBlock(), vue.createElementBlock("div", {
  11917. ref_key: "root",
  11918. ref: root,
  11919. class: vue.normalizeClass(vue.unref(ns).b()),
  11920. style: vue.normalizeStyle(vue.unref(rootStyle))
  11921. }, [
  11922. vue.createElementVNode("div", {
  11923. class: vue.normalizeClass({ [vue.unref(ns).m("fixed")]: fixed.value }),
  11924. style: vue.normalizeStyle(vue.unref(affixStyle))
  11925. }, [
  11926. vue.renderSlot(_ctx.$slots, "default")
  11927. ], 6)
  11928. ], 6);
  11929. };
  11930. }
  11931. });
  11932. var Affix = /* @__PURE__ */ _export_sfc(_sfc_main$2v, [["__file", "affix.vue"]]);
  11933. const ElAffix = withInstall(Affix);
  11934. const iconProps = buildProps({
  11935. size: {
  11936. type: definePropType([Number, String])
  11937. },
  11938. color: {
  11939. type: String
  11940. }
  11941. });
  11942. const __default__$1X = vue.defineComponent({
  11943. name: "ElIcon",
  11944. inheritAttrs: false
  11945. });
  11946. const _sfc_main$2u = /* @__PURE__ */ vue.defineComponent({
  11947. ...__default__$1X,
  11948. props: iconProps,
  11949. setup(__props) {
  11950. const props = __props;
  11951. const ns = useNamespace("icon");
  11952. const style = vue.computed(() => {
  11953. const { size, color } = props;
  11954. if (!size && !color)
  11955. return {};
  11956. return {
  11957. fontSize: isUndefined(size) ? void 0 : addUnit(size),
  11958. "--color": color
  11959. };
  11960. });
  11961. return (_ctx, _cache) => {
  11962. return vue.openBlock(), vue.createElementBlock("i", vue.mergeProps({
  11963. class: vue.unref(ns).b(),
  11964. style: vue.unref(style)
  11965. }, _ctx.$attrs), [
  11966. vue.renderSlot(_ctx.$slots, "default")
  11967. ], 16);
  11968. };
  11969. }
  11970. });
  11971. var Icon = /* @__PURE__ */ _export_sfc(_sfc_main$2u, [["__file", "icon.vue"]]);
  11972. const ElIcon = withInstall(Icon);
  11973. const alertEffects = ["light", "dark"];
  11974. const alertProps = buildProps({
  11975. title: {
  11976. type: String,
  11977. default: ""
  11978. },
  11979. description: {
  11980. type: String,
  11981. default: ""
  11982. },
  11983. type: {
  11984. type: String,
  11985. values: keysOf(TypeComponentsMap),
  11986. default: "info"
  11987. },
  11988. closable: {
  11989. type: Boolean,
  11990. default: true
  11991. },
  11992. closeText: {
  11993. type: String,
  11994. default: ""
  11995. },
  11996. showIcon: Boolean,
  11997. center: Boolean,
  11998. effect: {
  11999. type: String,
  12000. values: alertEffects,
  12001. default: "light"
  12002. },
  12003. ...useDelayedToggleProps,
  12004. showAfter: Number
  12005. });
  12006. const alertEmits = {
  12007. open: () => true,
  12008. close: (evt) => isUndefined(evt) || evt instanceof Event
  12009. };
  12010. const __default__$1W = vue.defineComponent({
  12011. name: "ElAlert"
  12012. });
  12013. const _sfc_main$2t = /* @__PURE__ */ vue.defineComponent({
  12014. ...__default__$1W,
  12015. props: alertProps,
  12016. emits: alertEmits,
  12017. setup(__props, { emit }) {
  12018. const props = __props;
  12019. const { Close } = TypeComponents;
  12020. const slots = vue.useSlots();
  12021. const ns = useNamespace("alert");
  12022. const visible = vue.ref(isUndefined(props.showAfter));
  12023. const iconComponent = vue.computed(() => TypeComponentsMap[props.type]);
  12024. const hasDesc = vue.computed(() => !!(props.description || slots.default));
  12025. const open = () => {
  12026. visible.value = true;
  12027. emit("open");
  12028. };
  12029. const close = (event) => {
  12030. visible.value = false;
  12031. emit("close", event);
  12032. };
  12033. const { onOpen, onClose } = useDelayedToggle({
  12034. showAfter: vue.toRef(props, "showAfter", 0),
  12035. hideAfter: vue.toRef(props, "hideAfter"),
  12036. autoClose: vue.toRef(props, "autoClose"),
  12037. open,
  12038. close
  12039. });
  12040. if (isClient) {
  12041. onOpen();
  12042. }
  12043. return (_ctx, _cache) => {
  12044. return vue.openBlock(), vue.createBlock(vue.Transition, {
  12045. name: vue.unref(ns).b("fade"),
  12046. persisted: ""
  12047. }, {
  12048. default: vue.withCtx(() => [
  12049. vue.withDirectives(vue.createElementVNode("div", {
  12050. 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)]),
  12051. role: "alert"
  12052. }, [
  12053. _ctx.showIcon && (_ctx.$slots.icon || vue.unref(iconComponent)) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  12054. key: 0,
  12055. class: vue.normalizeClass([vue.unref(ns).e("icon"), vue.unref(ns).is("big", vue.unref(hasDesc))])
  12056. }, {
  12057. default: vue.withCtx(() => [
  12058. vue.renderSlot(_ctx.$slots, "icon", {}, () => [
  12059. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(iconComponent))))
  12060. ])
  12061. ]),
  12062. _: 3
  12063. }, 8, ["class"])) : vue.createCommentVNode("v-if", true),
  12064. vue.createElementVNode("div", {
  12065. class: vue.normalizeClass(vue.unref(ns).e("content"))
  12066. }, [
  12067. _ctx.title || _ctx.$slots.title ? (vue.openBlock(), vue.createElementBlock("span", {
  12068. key: 0,
  12069. class: vue.normalizeClass([vue.unref(ns).e("title"), { "with-description": vue.unref(hasDesc) }])
  12070. }, [
  12071. vue.renderSlot(_ctx.$slots, "title", {}, () => [
  12072. vue.createTextVNode(vue.toDisplayString(_ctx.title), 1)
  12073. ])
  12074. ], 2)) : vue.createCommentVNode("v-if", true),
  12075. vue.unref(hasDesc) ? (vue.openBlock(), vue.createElementBlock("p", {
  12076. key: 1,
  12077. class: vue.normalizeClass(vue.unref(ns).e("description"))
  12078. }, [
  12079. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  12080. vue.createTextVNode(vue.toDisplayString(_ctx.description), 1)
  12081. ])
  12082. ], 2)) : vue.createCommentVNode("v-if", true),
  12083. _ctx.closable ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 2 }, [
  12084. _ctx.closeText ? (vue.openBlock(), vue.createElementBlock("div", {
  12085. key: 0,
  12086. class: vue.normalizeClass([vue.unref(ns).e("close-btn"), vue.unref(ns).is("customed")]),
  12087. onClick: close
  12088. }, vue.toDisplayString(_ctx.closeText), 3)) : (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  12089. key: 1,
  12090. class: vue.normalizeClass(vue.unref(ns).e("close-btn")),
  12091. onClick: vue.unref(onClose)
  12092. }, {
  12093. default: vue.withCtx(() => [
  12094. vue.createVNode(vue.unref(Close))
  12095. ]),
  12096. _: 1
  12097. }, 8, ["class", "onClick"]))
  12098. ], 64)) : vue.createCommentVNode("v-if", true)
  12099. ], 2)
  12100. ], 2), [
  12101. [vue.vShow, visible.value]
  12102. ])
  12103. ]),
  12104. _: 3
  12105. }, 8, ["name"]);
  12106. };
  12107. }
  12108. });
  12109. var Alert = /* @__PURE__ */ _export_sfc(_sfc_main$2t, [["__file", "alert.vue"]]);
  12110. const ElAlert = withInstall(Alert);
  12111. const formContextKey = Symbol("formContextKey");
  12112. const formItemContextKey = Symbol("formItemContextKey");
  12113. const useFormSize = (fallback, ignore = {}) => {
  12114. const emptyRef = vue.ref(void 0);
  12115. const size = ignore.prop ? emptyRef : useProp("size");
  12116. const globalConfig = ignore.global ? emptyRef : useGlobalSize();
  12117. const form = ignore.form ? { size: void 0 } : vue.inject(formContextKey, void 0);
  12118. const formItem = ignore.formItem ? { size: void 0 } : vue.inject(formItemContextKey, void 0);
  12119. return vue.computed(() => size.value || vue.unref(fallback) || (formItem == null ? void 0 : formItem.size) || (form == null ? void 0 : form.size) || globalConfig.value || "");
  12120. };
  12121. const useFormDisabled = (fallback) => {
  12122. const disabled = useProp("disabled");
  12123. const form = vue.inject(formContextKey, void 0);
  12124. return vue.computed(() => disabled.value || vue.unref(fallback) || (form == null ? void 0 : form.disabled) || false);
  12125. };
  12126. const useSize$1 = useFormSize;
  12127. const useDisabled = useFormDisabled;
  12128. const useFormItem = () => {
  12129. const form = vue.inject(formContextKey, void 0);
  12130. const formItem = vue.inject(formItemContextKey, void 0);
  12131. return {
  12132. form,
  12133. formItem
  12134. };
  12135. };
  12136. const useFormItemInputId = (props, {
  12137. formItemContext,
  12138. disableIdGeneration,
  12139. disableIdManagement
  12140. }) => {
  12141. if (!disableIdGeneration) {
  12142. disableIdGeneration = vue.ref(false);
  12143. }
  12144. if (!disableIdManagement) {
  12145. disableIdManagement = vue.ref(false);
  12146. }
  12147. const instance = vue.getCurrentInstance();
  12148. const inLabel = () => {
  12149. let parent = instance == null ? void 0 : instance.parent;
  12150. while (parent) {
  12151. if (parent.type.name === "ElFormItem") {
  12152. return false;
  12153. }
  12154. if (parent.type.name === "ElLabelWrap") {
  12155. return true;
  12156. }
  12157. parent = parent.parent;
  12158. }
  12159. return false;
  12160. };
  12161. const inputId = vue.ref();
  12162. let idUnwatch = void 0;
  12163. const isLabeledByFormItem = vue.computed(() => {
  12164. var _a;
  12165. return !!(!(props.label || props.ariaLabel) && formItemContext && formItemContext.inputIds && ((_a = formItemContext.inputIds) == null ? void 0 : _a.length) <= 1);
  12166. });
  12167. vue.onMounted(() => {
  12168. idUnwatch = vue.watch([vue.toRef(props, "id"), disableIdGeneration], ([id, disableIdGeneration2]) => {
  12169. const newId = id != null ? id : !disableIdGeneration2 ? useId().value : void 0;
  12170. if (newId !== inputId.value) {
  12171. if ((formItemContext == null ? void 0 : formItemContext.removeInputId) && !inLabel()) {
  12172. inputId.value && formItemContext.removeInputId(inputId.value);
  12173. if (!(disableIdManagement == null ? void 0 : disableIdManagement.value) && !disableIdGeneration2 && newId) {
  12174. formItemContext.addInputId(newId);
  12175. }
  12176. }
  12177. inputId.value = newId;
  12178. }
  12179. }, { immediate: true });
  12180. });
  12181. vue.onUnmounted(() => {
  12182. idUnwatch && idUnwatch();
  12183. if (formItemContext == null ? void 0 : formItemContext.removeInputId) {
  12184. inputId.value && formItemContext.removeInputId(inputId.value);
  12185. }
  12186. });
  12187. return {
  12188. isLabeledByFormItem,
  12189. inputId
  12190. };
  12191. };
  12192. const formMetaProps = buildProps({
  12193. size: {
  12194. type: String,
  12195. values: componentSizes
  12196. },
  12197. disabled: Boolean
  12198. });
  12199. const formProps = buildProps({
  12200. ...formMetaProps,
  12201. model: Object,
  12202. rules: {
  12203. type: definePropType(Object)
  12204. },
  12205. labelPosition: {
  12206. type: String,
  12207. values: ["left", "right", "top"],
  12208. default: "right"
  12209. },
  12210. requireAsteriskPosition: {
  12211. type: String,
  12212. values: ["left", "right"],
  12213. default: "left"
  12214. },
  12215. labelWidth: {
  12216. type: [String, Number],
  12217. default: ""
  12218. },
  12219. labelSuffix: {
  12220. type: String,
  12221. default: ""
  12222. },
  12223. inline: Boolean,
  12224. inlineMessage: Boolean,
  12225. statusIcon: Boolean,
  12226. showMessage: {
  12227. type: Boolean,
  12228. default: true
  12229. },
  12230. validateOnRuleChange: {
  12231. type: Boolean,
  12232. default: true
  12233. },
  12234. hideRequiredAsterisk: Boolean,
  12235. scrollToError: Boolean,
  12236. scrollIntoViewOptions: {
  12237. type: definePropType([Object, Boolean]),
  12238. default: true
  12239. }
  12240. });
  12241. const formEmits = {
  12242. validate: (prop, isValid, message) => (isArray$1(prop) || isString$1(prop)) && isBoolean(isValid) && isString$1(message)
  12243. };
  12244. const SCOPE$6 = "ElForm";
  12245. function useFormLabelWidth() {
  12246. const potentialLabelWidthArr = vue.ref([]);
  12247. const autoLabelWidth = vue.computed(() => {
  12248. if (!potentialLabelWidthArr.value.length)
  12249. return "0";
  12250. const max = Math.max(...potentialLabelWidthArr.value);
  12251. return max ? `${max}px` : "";
  12252. });
  12253. function getLabelWidthIndex(width) {
  12254. const index = potentialLabelWidthArr.value.indexOf(width);
  12255. if (index === -1 && autoLabelWidth.value === "0") {
  12256. debugWarn(SCOPE$6, `unexpected width ${width}`);
  12257. }
  12258. return index;
  12259. }
  12260. function registerLabelWidth(val, oldVal) {
  12261. if (val && oldVal) {
  12262. const index = getLabelWidthIndex(oldVal);
  12263. potentialLabelWidthArr.value.splice(index, 1, val);
  12264. } else if (val) {
  12265. potentialLabelWidthArr.value.push(val);
  12266. }
  12267. }
  12268. function deregisterLabelWidth(val) {
  12269. const index = getLabelWidthIndex(val);
  12270. if (index > -1) {
  12271. potentialLabelWidthArr.value.splice(index, 1);
  12272. }
  12273. }
  12274. return {
  12275. autoLabelWidth,
  12276. registerLabelWidth,
  12277. deregisterLabelWidth
  12278. };
  12279. }
  12280. const filterFields = (fields, props) => {
  12281. const normalized = castArray$1(props).map((prop) => isArray$1(prop) ? prop.join(".") : prop);
  12282. return normalized.length > 0 ? fields.filter((field) => field.propString && normalized.includes(field.propString)) : fields;
  12283. };
  12284. const COMPONENT_NAME$o = "ElForm";
  12285. const __default__$1V = vue.defineComponent({
  12286. name: COMPONENT_NAME$o
  12287. });
  12288. const _sfc_main$2s = /* @__PURE__ */ vue.defineComponent({
  12289. ...__default__$1V,
  12290. props: formProps,
  12291. emits: formEmits,
  12292. setup(__props, { expose, emit }) {
  12293. const props = __props;
  12294. const formRef = vue.ref();
  12295. const fields = vue.reactive([]);
  12296. const formSize = useFormSize();
  12297. const ns = useNamespace("form");
  12298. const formClasses = vue.computed(() => {
  12299. const { labelPosition, inline } = props;
  12300. return [
  12301. ns.b(),
  12302. ns.m(formSize.value || "default"),
  12303. {
  12304. [ns.m(`label-${labelPosition}`)]: labelPosition,
  12305. [ns.m("inline")]: inline
  12306. }
  12307. ];
  12308. });
  12309. const getField = (prop) => {
  12310. return filterFields(fields, [prop])[0];
  12311. };
  12312. const addField = (field) => {
  12313. fields.push(field);
  12314. };
  12315. const removeField = (field) => {
  12316. if (field.prop) {
  12317. fields.splice(fields.indexOf(field), 1);
  12318. }
  12319. };
  12320. const resetFields = (properties = []) => {
  12321. if (!props.model) {
  12322. debugWarn(COMPONENT_NAME$o, "model is required for resetFields to work.");
  12323. return;
  12324. }
  12325. filterFields(fields, properties).forEach((field) => field.resetField());
  12326. };
  12327. const clearValidate = (props2 = []) => {
  12328. filterFields(fields, props2).forEach((field) => field.clearValidate());
  12329. };
  12330. const isValidatable = vue.computed(() => {
  12331. const hasModel = !!props.model;
  12332. if (!hasModel) {
  12333. debugWarn(COMPONENT_NAME$o, "model is required for validate to work.");
  12334. }
  12335. return hasModel;
  12336. });
  12337. const obtainValidateFields = (props2) => {
  12338. if (fields.length === 0)
  12339. return [];
  12340. const filteredFields = filterFields(fields, props2);
  12341. if (!filteredFields.length) {
  12342. debugWarn(COMPONENT_NAME$o, "please pass correct props!");
  12343. return [];
  12344. }
  12345. return filteredFields;
  12346. };
  12347. const validate = async (callback) => validateField(void 0, callback);
  12348. const doValidateField = async (props2 = []) => {
  12349. if (!isValidatable.value)
  12350. return false;
  12351. const fields2 = obtainValidateFields(props2);
  12352. if (fields2.length === 0)
  12353. return true;
  12354. let validationErrors = {};
  12355. for (const field of fields2) {
  12356. try {
  12357. await field.validate("");
  12358. if (field.validateState === "error" && !field.error)
  12359. field.resetField();
  12360. } catch (fields3) {
  12361. validationErrors = {
  12362. ...validationErrors,
  12363. ...fields3
  12364. };
  12365. }
  12366. }
  12367. if (Object.keys(validationErrors).length === 0)
  12368. return true;
  12369. return Promise.reject(validationErrors);
  12370. };
  12371. const validateField = async (modelProps = [], callback) => {
  12372. let result = false;
  12373. const shouldThrow = !isFunction$1(callback);
  12374. try {
  12375. result = await doValidateField(modelProps);
  12376. if (result === true) {
  12377. await (callback == null ? void 0 : callback(result));
  12378. }
  12379. return result;
  12380. } catch (e) {
  12381. if (e instanceof Error)
  12382. throw e;
  12383. const invalidFields = e;
  12384. if (props.scrollToError) {
  12385. if (formRef.value) {
  12386. const formItem = formRef.value.querySelector(`.${ns.b()}-item.is-error`);
  12387. formItem == null ? void 0 : formItem.scrollIntoView(props.scrollIntoViewOptions);
  12388. }
  12389. }
  12390. !result && await (callback == null ? void 0 : callback(false, invalidFields));
  12391. return shouldThrow && Promise.reject(invalidFields);
  12392. }
  12393. };
  12394. const scrollToField = (prop) => {
  12395. var _a;
  12396. const field = getField(prop);
  12397. if (field) {
  12398. (_a = field.$el) == null ? void 0 : _a.scrollIntoView(props.scrollIntoViewOptions);
  12399. }
  12400. };
  12401. vue.watch(() => props.rules, () => {
  12402. if (props.validateOnRuleChange) {
  12403. validate().catch((err) => debugWarn(err));
  12404. }
  12405. }, { deep: true, flush: "post" });
  12406. vue.provide(formContextKey, vue.reactive({
  12407. ...vue.toRefs(props),
  12408. emit,
  12409. resetFields,
  12410. clearValidate,
  12411. validateField,
  12412. getField,
  12413. addField,
  12414. removeField,
  12415. ...useFormLabelWidth()
  12416. }));
  12417. expose({
  12418. validate,
  12419. validateField,
  12420. resetFields,
  12421. clearValidate,
  12422. scrollToField,
  12423. getField,
  12424. fields
  12425. });
  12426. return (_ctx, _cache) => {
  12427. return vue.openBlock(), vue.createElementBlock("form", {
  12428. ref_key: "formRef",
  12429. ref: formRef,
  12430. class: vue.normalizeClass(vue.unref(formClasses))
  12431. }, [
  12432. vue.renderSlot(_ctx.$slots, "default")
  12433. ], 2);
  12434. };
  12435. }
  12436. });
  12437. var Form = /* @__PURE__ */ _export_sfc(_sfc_main$2s, [["__file", "form.vue"]]);
  12438. function _extends() {
  12439. _extends = Object.assign ? Object.assign.bind() : function(target) {
  12440. for (var i = 1; i < arguments.length; i++) {
  12441. var source = arguments[i];
  12442. for (var key in source) {
  12443. if (Object.prototype.hasOwnProperty.call(source, key)) {
  12444. target[key] = source[key];
  12445. }
  12446. }
  12447. }
  12448. return target;
  12449. };
  12450. return _extends.apply(this, arguments);
  12451. }
  12452. function _inheritsLoose(subClass, superClass) {
  12453. subClass.prototype = Object.create(superClass.prototype);
  12454. subClass.prototype.constructor = subClass;
  12455. _setPrototypeOf(subClass, superClass);
  12456. }
  12457. function _getPrototypeOf(o) {
  12458. _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf2(o2) {
  12459. return o2.__proto__ || Object.getPrototypeOf(o2);
  12460. };
  12461. return _getPrototypeOf(o);
  12462. }
  12463. function _setPrototypeOf(o, p) {
  12464. _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf2(o2, p2) {
  12465. o2.__proto__ = p2;
  12466. return o2;
  12467. };
  12468. return _setPrototypeOf(o, p);
  12469. }
  12470. function _isNativeReflectConstruct() {
  12471. if (typeof Reflect === "undefined" || !Reflect.construct)
  12472. return false;
  12473. if (Reflect.construct.sham)
  12474. return false;
  12475. if (typeof Proxy === "function")
  12476. return true;
  12477. try {
  12478. Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
  12479. }));
  12480. return true;
  12481. } catch (e) {
  12482. return false;
  12483. }
  12484. }
  12485. function _construct(Parent, args, Class) {
  12486. if (_isNativeReflectConstruct()) {
  12487. _construct = Reflect.construct.bind();
  12488. } else {
  12489. _construct = function _construct2(Parent2, args2, Class2) {
  12490. var a = [null];
  12491. a.push.apply(a, args2);
  12492. var Constructor = Function.bind.apply(Parent2, a);
  12493. var instance = new Constructor();
  12494. if (Class2)
  12495. _setPrototypeOf(instance, Class2.prototype);
  12496. return instance;
  12497. };
  12498. }
  12499. return _construct.apply(null, arguments);
  12500. }
  12501. function _isNativeFunction(fn) {
  12502. return Function.toString.call(fn).indexOf("[native code]") !== -1;
  12503. }
  12504. function _wrapNativeSuper(Class) {
  12505. var _cache = typeof Map === "function" ? /* @__PURE__ */ new Map() : void 0;
  12506. _wrapNativeSuper = function _wrapNativeSuper2(Class2) {
  12507. if (Class2 === null || !_isNativeFunction(Class2))
  12508. return Class2;
  12509. if (typeof Class2 !== "function") {
  12510. throw new TypeError("Super expression must either be null or a function");
  12511. }
  12512. if (typeof _cache !== "undefined") {
  12513. if (_cache.has(Class2))
  12514. return _cache.get(Class2);
  12515. _cache.set(Class2, Wrapper);
  12516. }
  12517. function Wrapper() {
  12518. return _construct(Class2, arguments, _getPrototypeOf(this).constructor);
  12519. }
  12520. Wrapper.prototype = Object.create(Class2.prototype, {
  12521. constructor: {
  12522. value: Wrapper,
  12523. enumerable: false,
  12524. writable: true,
  12525. configurable: true
  12526. }
  12527. });
  12528. return _setPrototypeOf(Wrapper, Class2);
  12529. };
  12530. return _wrapNativeSuper(Class);
  12531. }
  12532. var formatRegExp = /%[sdj%]/g;
  12533. var warning = function warning2() {
  12534. };
  12535. if (typeof process !== "undefined" && process.env && false) {
  12536. warning = function warning3(type4, errors) {
  12537. if (typeof console !== "undefined" && console.warn && typeof ASYNC_VALIDATOR_NO_WARNING === "undefined") {
  12538. if (errors.every(function(e) {
  12539. return typeof e === "string";
  12540. })) {
  12541. console.warn(type4, errors);
  12542. }
  12543. }
  12544. };
  12545. }
  12546. function convertFieldsError(errors) {
  12547. if (!errors || !errors.length)
  12548. return null;
  12549. var fields = {};
  12550. errors.forEach(function(error) {
  12551. var field = error.field;
  12552. fields[field] = fields[field] || [];
  12553. fields[field].push(error);
  12554. });
  12555. return fields;
  12556. }
  12557. function format(template) {
  12558. for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  12559. args[_key - 1] = arguments[_key];
  12560. }
  12561. var i = 0;
  12562. var len = args.length;
  12563. if (typeof template === "function") {
  12564. return template.apply(null, args);
  12565. }
  12566. if (typeof template === "string") {
  12567. var str = template.replace(formatRegExp, function(x) {
  12568. if (x === "%%") {
  12569. return "%";
  12570. }
  12571. if (i >= len) {
  12572. return x;
  12573. }
  12574. switch (x) {
  12575. case "%s":
  12576. return String(args[i++]);
  12577. case "%d":
  12578. return Number(args[i++]);
  12579. case "%j":
  12580. try {
  12581. return JSON.stringify(args[i++]);
  12582. } catch (_) {
  12583. return "[Circular]";
  12584. }
  12585. break;
  12586. default:
  12587. return x;
  12588. }
  12589. });
  12590. return str;
  12591. }
  12592. return template;
  12593. }
  12594. function isNativeStringType(type4) {
  12595. return type4 === "string" || type4 === "url" || type4 === "hex" || type4 === "email" || type4 === "date" || type4 === "pattern";
  12596. }
  12597. function isEmptyValue(value, type4) {
  12598. if (value === void 0 || value === null) {
  12599. return true;
  12600. }
  12601. if (type4 === "array" && Array.isArray(value) && !value.length) {
  12602. return true;
  12603. }
  12604. if (isNativeStringType(type4) && typeof value === "string" && !value) {
  12605. return true;
  12606. }
  12607. return false;
  12608. }
  12609. function asyncParallelArray(arr, func, callback) {
  12610. var results = [];
  12611. var total = 0;
  12612. var arrLength = arr.length;
  12613. function count(errors) {
  12614. results.push.apply(results, errors || []);
  12615. total++;
  12616. if (total === arrLength) {
  12617. callback(results);
  12618. }
  12619. }
  12620. arr.forEach(function(a) {
  12621. func(a, count);
  12622. });
  12623. }
  12624. function asyncSerialArray(arr, func, callback) {
  12625. var index = 0;
  12626. var arrLength = arr.length;
  12627. function next(errors) {
  12628. if (errors && errors.length) {
  12629. callback(errors);
  12630. return;
  12631. }
  12632. var original = index;
  12633. index = index + 1;
  12634. if (original < arrLength) {
  12635. func(arr[original], next);
  12636. } else {
  12637. callback([]);
  12638. }
  12639. }
  12640. next([]);
  12641. }
  12642. function flattenObjArr(objArr) {
  12643. var ret = [];
  12644. Object.keys(objArr).forEach(function(k) {
  12645. ret.push.apply(ret, objArr[k] || []);
  12646. });
  12647. return ret;
  12648. }
  12649. var AsyncValidationError = /* @__PURE__ */ function(_Error) {
  12650. _inheritsLoose(AsyncValidationError2, _Error);
  12651. function AsyncValidationError2(errors, fields) {
  12652. var _this;
  12653. _this = _Error.call(this, "Async Validation Error") || this;
  12654. _this.errors = errors;
  12655. _this.fields = fields;
  12656. return _this;
  12657. }
  12658. return AsyncValidationError2;
  12659. }(/* @__PURE__ */ _wrapNativeSuper(Error));
  12660. function asyncMap(objArr, option, func, callback, source) {
  12661. if (option.first) {
  12662. var _pending = new Promise(function(resolve, reject) {
  12663. var next = function next2(errors) {
  12664. callback(errors);
  12665. return errors.length ? reject(new AsyncValidationError(errors, convertFieldsError(errors))) : resolve(source);
  12666. };
  12667. var flattenArr = flattenObjArr(objArr);
  12668. asyncSerialArray(flattenArr, func, next);
  12669. });
  12670. _pending["catch"](function(e) {
  12671. return e;
  12672. });
  12673. return _pending;
  12674. }
  12675. var firstFields = option.firstFields === true ? Object.keys(objArr) : option.firstFields || [];
  12676. var objArrKeys = Object.keys(objArr);
  12677. var objArrLength = objArrKeys.length;
  12678. var total = 0;
  12679. var results = [];
  12680. var pending = new Promise(function(resolve, reject) {
  12681. var next = function next2(errors) {
  12682. results.push.apply(results, errors);
  12683. total++;
  12684. if (total === objArrLength) {
  12685. callback(results);
  12686. return results.length ? reject(new AsyncValidationError(results, convertFieldsError(results))) : resolve(source);
  12687. }
  12688. };
  12689. if (!objArrKeys.length) {
  12690. callback(results);
  12691. resolve(source);
  12692. }
  12693. objArrKeys.forEach(function(key) {
  12694. var arr = objArr[key];
  12695. if (firstFields.indexOf(key) !== -1) {
  12696. asyncSerialArray(arr, func, next);
  12697. } else {
  12698. asyncParallelArray(arr, func, next);
  12699. }
  12700. });
  12701. });
  12702. pending["catch"](function(e) {
  12703. return e;
  12704. });
  12705. return pending;
  12706. }
  12707. function isErrorObj(obj) {
  12708. return !!(obj && obj.message !== void 0);
  12709. }
  12710. function getValue(value, path) {
  12711. var v = value;
  12712. for (var i = 0; i < path.length; i++) {
  12713. if (v == void 0) {
  12714. return v;
  12715. }
  12716. v = v[path[i]];
  12717. }
  12718. return v;
  12719. }
  12720. function complementError(rule, source) {
  12721. return function(oe) {
  12722. var fieldValue;
  12723. if (rule.fullFields) {
  12724. fieldValue = getValue(source, rule.fullFields);
  12725. } else {
  12726. fieldValue = source[oe.field || rule.fullField];
  12727. }
  12728. if (isErrorObj(oe)) {
  12729. oe.field = oe.field || rule.fullField;
  12730. oe.fieldValue = fieldValue;
  12731. return oe;
  12732. }
  12733. return {
  12734. message: typeof oe === "function" ? oe() : oe,
  12735. fieldValue,
  12736. field: oe.field || rule.fullField
  12737. };
  12738. };
  12739. }
  12740. function deepMerge(target, source) {
  12741. if (source) {
  12742. for (var s in source) {
  12743. if (source.hasOwnProperty(s)) {
  12744. var value = source[s];
  12745. if (typeof value === "object" && typeof target[s] === "object") {
  12746. target[s] = _extends({}, target[s], value);
  12747. } else {
  12748. target[s] = value;
  12749. }
  12750. }
  12751. }
  12752. }
  12753. return target;
  12754. }
  12755. var required$1 = function required(rule, value, source, errors, options, type4) {
  12756. if (rule.required && (!source.hasOwnProperty(rule.field) || isEmptyValue(value, type4 || rule.type))) {
  12757. errors.push(format(options.messages.required, rule.fullField));
  12758. }
  12759. };
  12760. var whitespace = function whitespace2(rule, value, source, errors, options) {
  12761. if (/^\s+$/.test(value) || value === "") {
  12762. errors.push(format(options.messages.whitespace, rule.fullField));
  12763. }
  12764. };
  12765. var urlReg;
  12766. var getUrlRegex = function() {
  12767. if (urlReg) {
  12768. return urlReg;
  12769. }
  12770. var word = "[a-fA-F\\d:]";
  12771. var b = function b2(options) {
  12772. return options && options.includeBoundaries ? "(?:(?<=\\s|^)(?=" + word + ")|(?<=" + word + ")(?=\\s|$))" : "";
  12773. };
  12774. 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}";
  12775. var v6seg = "[a-fA-F\\d]{1,4}";
  12776. 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();
  12777. var v46Exact = new RegExp("(?:^" + v4 + "$)|(?:^" + v6 + "$)");
  12778. var v4exact = new RegExp("^" + v4 + "$");
  12779. var v6exact = new RegExp("^" + v6 + "$");
  12780. var ip = function ip2(options) {
  12781. return options && options.exact ? v46Exact : new RegExp("(?:" + b(options) + v4 + b(options) + ")|(?:" + b(options) + v6 + b(options) + ")", "g");
  12782. };
  12783. ip.v4 = function(options) {
  12784. return options && options.exact ? v4exact : new RegExp("" + b(options) + v4 + b(options), "g");
  12785. };
  12786. ip.v6 = function(options) {
  12787. return options && options.exact ? v6exact : new RegExp("" + b(options) + v6 + b(options), "g");
  12788. };
  12789. var protocol = "(?:(?:[a-z]+:)?//)";
  12790. var auth = "(?:\\S+(?::\\S*)?@)?";
  12791. var ipv4 = ip.v4().source;
  12792. var ipv6 = ip.v6().source;
  12793. var host = "(?:(?:[a-z\\u00a1-\\uffff0-9][-_]*)*[a-z\\u00a1-\\uffff0-9]+)";
  12794. var domain = "(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*";
  12795. var tld = "(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))";
  12796. var port = "(?::\\d{2,5})?";
  12797. var path = '(?:[/?#][^\\s"]*)?';
  12798. var regex = "(?:" + protocol + "|www\\.)" + auth + "(?:localhost|" + ipv4 + "|" + ipv6 + "|" + host + domain + tld + ")" + port + path;
  12799. urlReg = new RegExp("(?:^" + regex + "$)", "i");
  12800. return urlReg;
  12801. };
  12802. var pattern$2 = {
  12803. 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,}))$/,
  12804. hex: /^#?([a-f0-9]{6}|[a-f0-9]{3})$/i
  12805. };
  12806. var types = {
  12807. integer: function integer(value) {
  12808. return types.number(value) && parseInt(value, 10) === value;
  12809. },
  12810. "float": function float(value) {
  12811. return types.number(value) && !types.integer(value);
  12812. },
  12813. array: function array(value) {
  12814. return Array.isArray(value);
  12815. },
  12816. regexp: function regexp(value) {
  12817. if (value instanceof RegExp) {
  12818. return true;
  12819. }
  12820. try {
  12821. return !!new RegExp(value);
  12822. } catch (e) {
  12823. return false;
  12824. }
  12825. },
  12826. date: function date(value) {
  12827. return typeof value.getTime === "function" && typeof value.getMonth === "function" && typeof value.getYear === "function" && !isNaN(value.getTime());
  12828. },
  12829. number: function number(value) {
  12830. if (isNaN(value)) {
  12831. return false;
  12832. }
  12833. return typeof value === "number";
  12834. },
  12835. object: function object(value) {
  12836. return typeof value === "object" && !types.array(value);
  12837. },
  12838. method: function method(value) {
  12839. return typeof value === "function";
  12840. },
  12841. email: function email(value) {
  12842. return typeof value === "string" && value.length <= 320 && !!value.match(pattern$2.email);
  12843. },
  12844. url: function url(value) {
  12845. return typeof value === "string" && value.length <= 2048 && !!value.match(getUrlRegex());
  12846. },
  12847. hex: function hex(value) {
  12848. return typeof value === "string" && !!value.match(pattern$2.hex);
  12849. }
  12850. };
  12851. var type$1 = function type(rule, value, source, errors, options) {
  12852. if (rule.required && value === void 0) {
  12853. required$1(rule, value, source, errors, options);
  12854. return;
  12855. }
  12856. var custom = ["integer", "float", "array", "regexp", "object", "method", "email", "number", "date", "url", "hex"];
  12857. var ruleType = rule.type;
  12858. if (custom.indexOf(ruleType) > -1) {
  12859. if (!types[ruleType](value)) {
  12860. errors.push(format(options.messages.types[ruleType], rule.fullField, rule.type));
  12861. }
  12862. } else if (ruleType && typeof value !== rule.type) {
  12863. errors.push(format(options.messages.types[ruleType], rule.fullField, rule.type));
  12864. }
  12865. };
  12866. var range = function range2(rule, value, source, errors, options) {
  12867. var len = typeof rule.len === "number";
  12868. var min = typeof rule.min === "number";
  12869. var max = typeof rule.max === "number";
  12870. var val = value;
  12871. var key = null;
  12872. var num = typeof value === "number";
  12873. var str = typeof value === "string";
  12874. var arr = Array.isArray(value);
  12875. if (num) {
  12876. key = "number";
  12877. } else if (str) {
  12878. key = "string";
  12879. } else if (arr) {
  12880. key = "array";
  12881. }
  12882. if (!key) {
  12883. return false;
  12884. }
  12885. if (arr) {
  12886. val = value.length;
  12887. }
  12888. if (str) {
  12889. val = value.length;
  12890. }
  12891. if (len) {
  12892. if (val !== rule.len) {
  12893. errors.push(format(options.messages[key].len, rule.fullField, rule.len));
  12894. }
  12895. } else if (min && !max && val < rule.min) {
  12896. errors.push(format(options.messages[key].min, rule.fullField, rule.min));
  12897. } else if (max && !min && val > rule.max) {
  12898. errors.push(format(options.messages[key].max, rule.fullField, rule.max));
  12899. } else if (min && max && (val < rule.min || val > rule.max)) {
  12900. errors.push(format(options.messages[key].range, rule.fullField, rule.min, rule.max));
  12901. }
  12902. };
  12903. var ENUM$1 = "enum";
  12904. var enumerable$1 = function enumerable(rule, value, source, errors, options) {
  12905. rule[ENUM$1] = Array.isArray(rule[ENUM$1]) ? rule[ENUM$1] : [];
  12906. if (rule[ENUM$1].indexOf(value) === -1) {
  12907. errors.push(format(options.messages[ENUM$1], rule.fullField, rule[ENUM$1].join(", ")));
  12908. }
  12909. };
  12910. var pattern$1 = function pattern(rule, value, source, errors, options) {
  12911. if (rule.pattern) {
  12912. if (rule.pattern instanceof RegExp) {
  12913. rule.pattern.lastIndex = 0;
  12914. if (!rule.pattern.test(value)) {
  12915. errors.push(format(options.messages.pattern.mismatch, rule.fullField, value, rule.pattern));
  12916. }
  12917. } else if (typeof rule.pattern === "string") {
  12918. var _pattern = new RegExp(rule.pattern);
  12919. if (!_pattern.test(value)) {
  12920. errors.push(format(options.messages.pattern.mismatch, rule.fullField, value, rule.pattern));
  12921. }
  12922. }
  12923. }
  12924. };
  12925. var rules = {
  12926. required: required$1,
  12927. whitespace,
  12928. type: type$1,
  12929. range,
  12930. "enum": enumerable$1,
  12931. pattern: pattern$1
  12932. };
  12933. var string = function string2(rule, value, callback, source, options) {
  12934. var errors = [];
  12935. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  12936. if (validate) {
  12937. if (isEmptyValue(value, "string") && !rule.required) {
  12938. return callback();
  12939. }
  12940. rules.required(rule, value, source, errors, options, "string");
  12941. if (!isEmptyValue(value, "string")) {
  12942. rules.type(rule, value, source, errors, options);
  12943. rules.range(rule, value, source, errors, options);
  12944. rules.pattern(rule, value, source, errors, options);
  12945. if (rule.whitespace === true) {
  12946. rules.whitespace(rule, value, source, errors, options);
  12947. }
  12948. }
  12949. }
  12950. callback(errors);
  12951. };
  12952. var method2 = function method3(rule, value, callback, source, options) {
  12953. var errors = [];
  12954. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  12955. if (validate) {
  12956. if (isEmptyValue(value) && !rule.required) {
  12957. return callback();
  12958. }
  12959. rules.required(rule, value, source, errors, options);
  12960. if (value !== void 0) {
  12961. rules.type(rule, value, source, errors, options);
  12962. }
  12963. }
  12964. callback(errors);
  12965. };
  12966. var number2 = function number3(rule, value, callback, source, options) {
  12967. var errors = [];
  12968. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  12969. if (validate) {
  12970. if (value === "") {
  12971. value = void 0;
  12972. }
  12973. if (isEmptyValue(value) && !rule.required) {
  12974. return callback();
  12975. }
  12976. rules.required(rule, value, source, errors, options);
  12977. if (value !== void 0) {
  12978. rules.type(rule, value, source, errors, options);
  12979. rules.range(rule, value, source, errors, options);
  12980. }
  12981. }
  12982. callback(errors);
  12983. };
  12984. var _boolean = function _boolean2(rule, value, callback, source, options) {
  12985. var errors = [];
  12986. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  12987. if (validate) {
  12988. if (isEmptyValue(value) && !rule.required) {
  12989. return callback();
  12990. }
  12991. rules.required(rule, value, source, errors, options);
  12992. if (value !== void 0) {
  12993. rules.type(rule, value, source, errors, options);
  12994. }
  12995. }
  12996. callback(errors);
  12997. };
  12998. var regexp2 = function regexp3(rule, value, callback, source, options) {
  12999. var errors = [];
  13000. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  13001. if (validate) {
  13002. if (isEmptyValue(value) && !rule.required) {
  13003. return callback();
  13004. }
  13005. rules.required(rule, value, source, errors, options);
  13006. if (!isEmptyValue(value)) {
  13007. rules.type(rule, value, source, errors, options);
  13008. }
  13009. }
  13010. callback(errors);
  13011. };
  13012. var integer2 = function integer3(rule, value, callback, source, options) {
  13013. var errors = [];
  13014. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  13015. if (validate) {
  13016. if (isEmptyValue(value) && !rule.required) {
  13017. return callback();
  13018. }
  13019. rules.required(rule, value, source, errors, options);
  13020. if (value !== void 0) {
  13021. rules.type(rule, value, source, errors, options);
  13022. rules.range(rule, value, source, errors, options);
  13023. }
  13024. }
  13025. callback(errors);
  13026. };
  13027. var floatFn = function floatFn2(rule, value, callback, source, options) {
  13028. var errors = [];
  13029. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  13030. if (validate) {
  13031. if (isEmptyValue(value) && !rule.required) {
  13032. return callback();
  13033. }
  13034. rules.required(rule, value, source, errors, options);
  13035. if (value !== void 0) {
  13036. rules.type(rule, value, source, errors, options);
  13037. rules.range(rule, value, source, errors, options);
  13038. }
  13039. }
  13040. callback(errors);
  13041. };
  13042. var array2 = function array3(rule, value, callback, source, options) {
  13043. var errors = [];
  13044. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  13045. if (validate) {
  13046. if ((value === void 0 || value === null) && !rule.required) {
  13047. return callback();
  13048. }
  13049. rules.required(rule, value, source, errors, options, "array");
  13050. if (value !== void 0 && value !== null) {
  13051. rules.type(rule, value, source, errors, options);
  13052. rules.range(rule, value, source, errors, options);
  13053. }
  13054. }
  13055. callback(errors);
  13056. };
  13057. var object2 = function object3(rule, value, callback, source, options) {
  13058. var errors = [];
  13059. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  13060. if (validate) {
  13061. if (isEmptyValue(value) && !rule.required) {
  13062. return callback();
  13063. }
  13064. rules.required(rule, value, source, errors, options);
  13065. if (value !== void 0) {
  13066. rules.type(rule, value, source, errors, options);
  13067. }
  13068. }
  13069. callback(errors);
  13070. };
  13071. var ENUM = "enum";
  13072. var enumerable2 = function enumerable3(rule, value, callback, source, options) {
  13073. var errors = [];
  13074. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  13075. if (validate) {
  13076. if (isEmptyValue(value) && !rule.required) {
  13077. return callback();
  13078. }
  13079. rules.required(rule, value, source, errors, options);
  13080. if (value !== void 0) {
  13081. rules[ENUM](rule, value, source, errors, options);
  13082. }
  13083. }
  13084. callback(errors);
  13085. };
  13086. var pattern2 = function pattern3(rule, value, callback, source, options) {
  13087. var errors = [];
  13088. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  13089. if (validate) {
  13090. if (isEmptyValue(value, "string") && !rule.required) {
  13091. return callback();
  13092. }
  13093. rules.required(rule, value, source, errors, options);
  13094. if (!isEmptyValue(value, "string")) {
  13095. rules.pattern(rule, value, source, errors, options);
  13096. }
  13097. }
  13098. callback(errors);
  13099. };
  13100. var date2 = function date3(rule, value, callback, source, options) {
  13101. var errors = [];
  13102. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  13103. if (validate) {
  13104. if (isEmptyValue(value, "date") && !rule.required) {
  13105. return callback();
  13106. }
  13107. rules.required(rule, value, source, errors, options);
  13108. if (!isEmptyValue(value, "date")) {
  13109. var dateObject;
  13110. if (value instanceof Date) {
  13111. dateObject = value;
  13112. } else {
  13113. dateObject = new Date(value);
  13114. }
  13115. rules.type(rule, dateObject, source, errors, options);
  13116. if (dateObject) {
  13117. rules.range(rule, dateObject.getTime(), source, errors, options);
  13118. }
  13119. }
  13120. }
  13121. callback(errors);
  13122. };
  13123. var required2 = function required3(rule, value, callback, source, options) {
  13124. var errors = [];
  13125. var type4 = Array.isArray(value) ? "array" : typeof value;
  13126. rules.required(rule, value, source, errors, options, type4);
  13127. callback(errors);
  13128. };
  13129. var type2 = function type3(rule, value, callback, source, options) {
  13130. var ruleType = rule.type;
  13131. var errors = [];
  13132. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  13133. if (validate) {
  13134. if (isEmptyValue(value, ruleType) && !rule.required) {
  13135. return callback();
  13136. }
  13137. rules.required(rule, value, source, errors, options, ruleType);
  13138. if (!isEmptyValue(value, ruleType)) {
  13139. rules.type(rule, value, source, errors, options);
  13140. }
  13141. }
  13142. callback(errors);
  13143. };
  13144. var any = function any2(rule, value, callback, source, options) {
  13145. var errors = [];
  13146. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  13147. if (validate) {
  13148. if (isEmptyValue(value) && !rule.required) {
  13149. return callback();
  13150. }
  13151. rules.required(rule, value, source, errors, options);
  13152. }
  13153. callback(errors);
  13154. };
  13155. var validators = {
  13156. string,
  13157. method: method2,
  13158. number: number2,
  13159. "boolean": _boolean,
  13160. regexp: regexp2,
  13161. integer: integer2,
  13162. "float": floatFn,
  13163. array: array2,
  13164. object: object2,
  13165. "enum": enumerable2,
  13166. pattern: pattern2,
  13167. date: date2,
  13168. url: type2,
  13169. hex: type2,
  13170. email: type2,
  13171. required: required2,
  13172. any
  13173. };
  13174. function newMessages() {
  13175. return {
  13176. "default": "Validation error on field %s",
  13177. required: "%s is required",
  13178. "enum": "%s must be one of %s",
  13179. whitespace: "%s cannot be empty",
  13180. date: {
  13181. format: "%s date %s is invalid for format %s",
  13182. parse: "%s date could not be parsed, %s is invalid ",
  13183. invalid: "%s date %s is invalid"
  13184. },
  13185. types: {
  13186. string: "%s is not a %s",
  13187. method: "%s is not a %s (function)",
  13188. array: "%s is not an %s",
  13189. object: "%s is not an %s",
  13190. number: "%s is not a %s",
  13191. date: "%s is not a %s",
  13192. "boolean": "%s is not a %s",
  13193. integer: "%s is not an %s",
  13194. "float": "%s is not a %s",
  13195. regexp: "%s is not a valid %s",
  13196. email: "%s is not a valid %s",
  13197. url: "%s is not a valid %s",
  13198. hex: "%s is not a valid %s"
  13199. },
  13200. string: {
  13201. len: "%s must be exactly %s characters",
  13202. min: "%s must be at least %s characters",
  13203. max: "%s cannot be longer than %s characters",
  13204. range: "%s must be between %s and %s characters"
  13205. },
  13206. number: {
  13207. len: "%s must equal %s",
  13208. min: "%s cannot be less than %s",
  13209. max: "%s cannot be greater than %s",
  13210. range: "%s must be between %s and %s"
  13211. },
  13212. array: {
  13213. len: "%s must be exactly %s in length",
  13214. min: "%s cannot be less than %s in length",
  13215. max: "%s cannot be greater than %s in length",
  13216. range: "%s must be between %s and %s in length"
  13217. },
  13218. pattern: {
  13219. mismatch: "%s value %s does not match pattern %s"
  13220. },
  13221. clone: function clone() {
  13222. var cloned = JSON.parse(JSON.stringify(this));
  13223. cloned.clone = this.clone;
  13224. return cloned;
  13225. }
  13226. };
  13227. }
  13228. var messages = newMessages();
  13229. var Schema = /* @__PURE__ */ function() {
  13230. function Schema2(descriptor) {
  13231. this.rules = null;
  13232. this._messages = messages;
  13233. this.define(descriptor);
  13234. }
  13235. var _proto = Schema2.prototype;
  13236. _proto.define = function define(rules2) {
  13237. var _this = this;
  13238. if (!rules2) {
  13239. throw new Error("Cannot configure a schema with no rules");
  13240. }
  13241. if (typeof rules2 !== "object" || Array.isArray(rules2)) {
  13242. throw new Error("Rules must be an object");
  13243. }
  13244. this.rules = {};
  13245. Object.keys(rules2).forEach(function(name) {
  13246. var item = rules2[name];
  13247. _this.rules[name] = Array.isArray(item) ? item : [item];
  13248. });
  13249. };
  13250. _proto.messages = function messages2(_messages) {
  13251. if (_messages) {
  13252. this._messages = deepMerge(newMessages(), _messages);
  13253. }
  13254. return this._messages;
  13255. };
  13256. _proto.validate = function validate(source_, o, oc) {
  13257. var _this2 = this;
  13258. if (o === void 0) {
  13259. o = {};
  13260. }
  13261. if (oc === void 0) {
  13262. oc = function oc2() {
  13263. };
  13264. }
  13265. var source = source_;
  13266. var options = o;
  13267. var callback = oc;
  13268. if (typeof options === "function") {
  13269. callback = options;
  13270. options = {};
  13271. }
  13272. if (!this.rules || Object.keys(this.rules).length === 0) {
  13273. if (callback) {
  13274. callback(null, source);
  13275. }
  13276. return Promise.resolve(source);
  13277. }
  13278. function complete(results) {
  13279. var errors = [];
  13280. var fields = {};
  13281. function add(e) {
  13282. if (Array.isArray(e)) {
  13283. var _errors;
  13284. errors = (_errors = errors).concat.apply(_errors, e);
  13285. } else {
  13286. errors.push(e);
  13287. }
  13288. }
  13289. for (var i = 0; i < results.length; i++) {
  13290. add(results[i]);
  13291. }
  13292. if (!errors.length) {
  13293. callback(null, source);
  13294. } else {
  13295. fields = convertFieldsError(errors);
  13296. callback(errors, fields);
  13297. }
  13298. }
  13299. if (options.messages) {
  13300. var messages$1 = this.messages();
  13301. if (messages$1 === messages) {
  13302. messages$1 = newMessages();
  13303. }
  13304. deepMerge(messages$1, options.messages);
  13305. options.messages = messages$1;
  13306. } else {
  13307. options.messages = this.messages();
  13308. }
  13309. var series = {};
  13310. var keys = options.keys || Object.keys(this.rules);
  13311. keys.forEach(function(z) {
  13312. var arr = _this2.rules[z];
  13313. var value = source[z];
  13314. arr.forEach(function(r) {
  13315. var rule = r;
  13316. if (typeof rule.transform === "function") {
  13317. if (source === source_) {
  13318. source = _extends({}, source);
  13319. }
  13320. value = source[z] = rule.transform(value);
  13321. }
  13322. if (typeof rule === "function") {
  13323. rule = {
  13324. validator: rule
  13325. };
  13326. } else {
  13327. rule = _extends({}, rule);
  13328. }
  13329. rule.validator = _this2.getValidationMethod(rule);
  13330. if (!rule.validator) {
  13331. return;
  13332. }
  13333. rule.field = z;
  13334. rule.fullField = rule.fullField || z;
  13335. rule.type = _this2.getType(rule);
  13336. series[z] = series[z] || [];
  13337. series[z].push({
  13338. rule,
  13339. value,
  13340. source,
  13341. field: z
  13342. });
  13343. });
  13344. });
  13345. var errorFields = {};
  13346. return asyncMap(series, options, function(data, doIt) {
  13347. var rule = data.rule;
  13348. var deep = (rule.type === "object" || rule.type === "array") && (typeof rule.fields === "object" || typeof rule.defaultField === "object");
  13349. deep = deep && (rule.required || !rule.required && data.value);
  13350. rule.field = data.field;
  13351. function addFullField(key, schema) {
  13352. return _extends({}, schema, {
  13353. fullField: rule.fullField + "." + key,
  13354. fullFields: rule.fullFields ? [].concat(rule.fullFields, [key]) : [key]
  13355. });
  13356. }
  13357. function cb(e) {
  13358. if (e === void 0) {
  13359. e = [];
  13360. }
  13361. var errorList = Array.isArray(e) ? e : [e];
  13362. if (!options.suppressWarning && errorList.length) {
  13363. Schema2.warning("async-validator:", errorList);
  13364. }
  13365. if (errorList.length && rule.message !== void 0) {
  13366. errorList = [].concat(rule.message);
  13367. }
  13368. var filledErrors = errorList.map(complementError(rule, source));
  13369. if (options.first && filledErrors.length) {
  13370. errorFields[rule.field] = 1;
  13371. return doIt(filledErrors);
  13372. }
  13373. if (!deep) {
  13374. doIt(filledErrors);
  13375. } else {
  13376. if (rule.required && !data.value) {
  13377. if (rule.message !== void 0) {
  13378. filledErrors = [].concat(rule.message).map(complementError(rule, source));
  13379. } else if (options.error) {
  13380. filledErrors = [options.error(rule, format(options.messages.required, rule.field))];
  13381. }
  13382. return doIt(filledErrors);
  13383. }
  13384. var fieldsSchema = {};
  13385. if (rule.defaultField) {
  13386. Object.keys(data.value).map(function(key) {
  13387. fieldsSchema[key] = rule.defaultField;
  13388. });
  13389. }
  13390. fieldsSchema = _extends({}, fieldsSchema, data.rule.fields);
  13391. var paredFieldsSchema = {};
  13392. Object.keys(fieldsSchema).forEach(function(field) {
  13393. var fieldSchema = fieldsSchema[field];
  13394. var fieldSchemaList = Array.isArray(fieldSchema) ? fieldSchema : [fieldSchema];
  13395. paredFieldsSchema[field] = fieldSchemaList.map(addFullField.bind(null, field));
  13396. });
  13397. var schema = new Schema2(paredFieldsSchema);
  13398. schema.messages(options.messages);
  13399. if (data.rule.options) {
  13400. data.rule.options.messages = options.messages;
  13401. data.rule.options.error = options.error;
  13402. }
  13403. schema.validate(data.value, data.rule.options || options, function(errs) {
  13404. var finalErrors = [];
  13405. if (filledErrors && filledErrors.length) {
  13406. finalErrors.push.apply(finalErrors, filledErrors);
  13407. }
  13408. if (errs && errs.length) {
  13409. finalErrors.push.apply(finalErrors, errs);
  13410. }
  13411. doIt(finalErrors.length ? finalErrors : null);
  13412. });
  13413. }
  13414. }
  13415. var res;
  13416. if (rule.asyncValidator) {
  13417. res = rule.asyncValidator(rule, data.value, cb, data.source, options);
  13418. } else if (rule.validator) {
  13419. try {
  13420. res = rule.validator(rule, data.value, cb, data.source, options);
  13421. } catch (error) {
  13422. console.error == null ? void 0 : console.error(error);
  13423. if (!options.suppressValidatorError) {
  13424. setTimeout(function() {
  13425. throw error;
  13426. }, 0);
  13427. }
  13428. cb(error.message);
  13429. }
  13430. if (res === true) {
  13431. cb();
  13432. } else if (res === false) {
  13433. cb(typeof rule.message === "function" ? rule.message(rule.fullField || rule.field) : rule.message || (rule.fullField || rule.field) + " fails");
  13434. } else if (res instanceof Array) {
  13435. cb(res);
  13436. } else if (res instanceof Error) {
  13437. cb(res.message);
  13438. }
  13439. }
  13440. if (res && res.then) {
  13441. res.then(function() {
  13442. return cb();
  13443. }, function(e) {
  13444. return cb(e);
  13445. });
  13446. }
  13447. }, function(results) {
  13448. complete(results);
  13449. }, source);
  13450. };
  13451. _proto.getType = function getType(rule) {
  13452. if (rule.type === void 0 && rule.pattern instanceof RegExp) {
  13453. rule.type = "pattern";
  13454. }
  13455. if (typeof rule.validator !== "function" && rule.type && !validators.hasOwnProperty(rule.type)) {
  13456. throw new Error(format("Unknown rule type %s", rule.type));
  13457. }
  13458. return rule.type || "string";
  13459. };
  13460. _proto.getValidationMethod = function getValidationMethod(rule) {
  13461. if (typeof rule.validator === "function") {
  13462. return rule.validator;
  13463. }
  13464. var keys = Object.keys(rule);
  13465. var messageIndex = keys.indexOf("message");
  13466. if (messageIndex !== -1) {
  13467. keys.splice(messageIndex, 1);
  13468. }
  13469. if (keys.length === 1 && keys[0] === "required") {
  13470. return validators.required;
  13471. }
  13472. return validators[this.getType(rule)] || void 0;
  13473. };
  13474. return Schema2;
  13475. }();
  13476. Schema.register = function register(type4, validator) {
  13477. if (typeof validator !== "function") {
  13478. throw new Error("Cannot register a validator by type, validator is not a function");
  13479. }
  13480. validators[type4] = validator;
  13481. };
  13482. Schema.warning = warning;
  13483. Schema.messages = messages;
  13484. Schema.validators = validators;
  13485. const formItemValidateStates = [
  13486. "",
  13487. "error",
  13488. "validating",
  13489. "success"
  13490. ];
  13491. const formItemProps = buildProps({
  13492. label: String,
  13493. labelWidth: {
  13494. type: [String, Number],
  13495. default: ""
  13496. },
  13497. labelPosition: {
  13498. type: String,
  13499. values: ["left", "right", "top", ""],
  13500. default: ""
  13501. },
  13502. prop: {
  13503. type: definePropType([String, Array])
  13504. },
  13505. required: {
  13506. type: Boolean,
  13507. default: void 0
  13508. },
  13509. rules: {
  13510. type: definePropType([Object, Array])
  13511. },
  13512. error: String,
  13513. validateStatus: {
  13514. type: String,
  13515. values: formItemValidateStates
  13516. },
  13517. for: String,
  13518. inlineMessage: {
  13519. type: Boolean,
  13520. default: void 0
  13521. },
  13522. showMessage: {
  13523. type: Boolean,
  13524. default: true
  13525. },
  13526. size: {
  13527. type: String,
  13528. values: componentSizes
  13529. }
  13530. });
  13531. const COMPONENT_NAME$n = "ElLabelWrap";
  13532. var FormLabelWrap = vue.defineComponent({
  13533. name: COMPONENT_NAME$n,
  13534. props: {
  13535. isAutoWidth: Boolean,
  13536. updateAll: Boolean
  13537. },
  13538. setup(props, {
  13539. slots
  13540. }) {
  13541. const formContext = vue.inject(formContextKey, void 0);
  13542. const formItemContext = vue.inject(formItemContextKey);
  13543. if (!formItemContext)
  13544. throwError(COMPONENT_NAME$n, "usage: <el-form-item><label-wrap /></el-form-item>");
  13545. const ns = useNamespace("form");
  13546. const el = vue.ref();
  13547. const computedWidth = vue.ref(0);
  13548. const getLabelWidth = () => {
  13549. var _a;
  13550. if ((_a = el.value) == null ? void 0 : _a.firstElementChild) {
  13551. const width = window.getComputedStyle(el.value.firstElementChild).width;
  13552. return Math.ceil(Number.parseFloat(width));
  13553. } else {
  13554. return 0;
  13555. }
  13556. };
  13557. const updateLabelWidth = (action = "update") => {
  13558. vue.nextTick(() => {
  13559. if (slots.default && props.isAutoWidth) {
  13560. if (action === "update") {
  13561. computedWidth.value = getLabelWidth();
  13562. } else if (action === "remove") {
  13563. formContext == null ? void 0 : formContext.deregisterLabelWidth(computedWidth.value);
  13564. }
  13565. }
  13566. });
  13567. };
  13568. const updateLabelWidthFn = () => updateLabelWidth("update");
  13569. vue.onMounted(() => {
  13570. updateLabelWidthFn();
  13571. });
  13572. vue.onBeforeUnmount(() => {
  13573. updateLabelWidth("remove");
  13574. });
  13575. vue.onUpdated(() => updateLabelWidthFn());
  13576. vue.watch(computedWidth, (val, oldVal) => {
  13577. if (props.updateAll) {
  13578. formContext == null ? void 0 : formContext.registerLabelWidth(val, oldVal);
  13579. }
  13580. });
  13581. useResizeObserver(vue.computed(() => {
  13582. var _a, _b;
  13583. return (_b = (_a = el.value) == null ? void 0 : _a.firstElementChild) != null ? _b : null;
  13584. }), updateLabelWidthFn);
  13585. return () => {
  13586. var _a, _b;
  13587. if (!slots)
  13588. return null;
  13589. const {
  13590. isAutoWidth
  13591. } = props;
  13592. if (isAutoWidth) {
  13593. const autoLabelWidth = formContext == null ? void 0 : formContext.autoLabelWidth;
  13594. const hasLabel = formItemContext == null ? void 0 : formItemContext.hasLabel;
  13595. const style = {};
  13596. if (hasLabel && autoLabelWidth && autoLabelWidth !== "auto") {
  13597. const marginWidth = Math.max(0, Number.parseInt(autoLabelWidth, 10) - computedWidth.value);
  13598. const labelPosition = formItemContext.labelPosition || formContext.labelPosition;
  13599. const marginPosition = labelPosition === "left" ? "marginRight" : "marginLeft";
  13600. if (marginWidth) {
  13601. style[marginPosition] = `${marginWidth}px`;
  13602. }
  13603. }
  13604. return vue.createVNode("div", {
  13605. "ref": el,
  13606. "class": [ns.be("item", "label-wrap")],
  13607. "style": style
  13608. }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
  13609. } else {
  13610. return vue.createVNode(vue.Fragment, {
  13611. "ref": el
  13612. }, [(_b = slots.default) == null ? void 0 : _b.call(slots)]);
  13613. }
  13614. };
  13615. }
  13616. });
  13617. const __default__$1U = vue.defineComponent({
  13618. name: "ElFormItem"
  13619. });
  13620. const _sfc_main$2r = /* @__PURE__ */ vue.defineComponent({
  13621. ...__default__$1U,
  13622. props: formItemProps,
  13623. setup(__props, { expose }) {
  13624. const props = __props;
  13625. const slots = vue.useSlots();
  13626. const formContext = vue.inject(formContextKey, void 0);
  13627. const parentFormItemContext = vue.inject(formItemContextKey, void 0);
  13628. const _size = useFormSize(void 0, { formItem: false });
  13629. const ns = useNamespace("form-item");
  13630. const labelId = useId().value;
  13631. const inputIds = vue.ref([]);
  13632. const validateState = vue.ref("");
  13633. const validateStateDebounced = refDebounced(validateState, 100);
  13634. const validateMessage = vue.ref("");
  13635. const formItemRef = vue.ref();
  13636. let initialValue = void 0;
  13637. let isResettingField = false;
  13638. const labelPosition = vue.computed(() => props.labelPosition || (formContext == null ? void 0 : formContext.labelPosition));
  13639. const labelStyle = vue.computed(() => {
  13640. if (labelPosition.value === "top") {
  13641. return {};
  13642. }
  13643. const labelWidth = addUnit(props.labelWidth || (formContext == null ? void 0 : formContext.labelWidth) || "");
  13644. if (labelWidth)
  13645. return { width: labelWidth };
  13646. return {};
  13647. });
  13648. const contentStyle = vue.computed(() => {
  13649. if (labelPosition.value === "top" || (formContext == null ? void 0 : formContext.inline)) {
  13650. return {};
  13651. }
  13652. if (!props.label && !props.labelWidth && isNested) {
  13653. return {};
  13654. }
  13655. const labelWidth = addUnit(props.labelWidth || (formContext == null ? void 0 : formContext.labelWidth) || "");
  13656. if (!props.label && !slots.label) {
  13657. return { marginLeft: labelWidth };
  13658. }
  13659. return {};
  13660. });
  13661. const formItemClasses = vue.computed(() => [
  13662. ns.b(),
  13663. ns.m(_size.value),
  13664. ns.is("error", validateState.value === "error"),
  13665. ns.is("validating", validateState.value === "validating"),
  13666. ns.is("success", validateState.value === "success"),
  13667. ns.is("required", isRequired.value || props.required),
  13668. ns.is("no-asterisk", formContext == null ? void 0 : formContext.hideRequiredAsterisk),
  13669. (formContext == null ? void 0 : formContext.requireAsteriskPosition) === "right" ? "asterisk-right" : "asterisk-left",
  13670. {
  13671. [ns.m("feedback")]: formContext == null ? void 0 : formContext.statusIcon,
  13672. [ns.m(`label-${labelPosition.value}`)]: labelPosition.value
  13673. }
  13674. ]);
  13675. const _inlineMessage = vue.computed(() => isBoolean(props.inlineMessage) ? props.inlineMessage : (formContext == null ? void 0 : formContext.inlineMessage) || false);
  13676. const validateClasses = vue.computed(() => [
  13677. ns.e("error"),
  13678. { [ns.em("error", "inline")]: _inlineMessage.value }
  13679. ]);
  13680. const propString = vue.computed(() => {
  13681. if (!props.prop)
  13682. return "";
  13683. return isArray$1(props.prop) ? props.prop.join(".") : props.prop;
  13684. });
  13685. const hasLabel = vue.computed(() => {
  13686. return !!(props.label || slots.label);
  13687. });
  13688. const labelFor = vue.computed(() => {
  13689. var _a;
  13690. return (_a = props.for) != null ? _a : inputIds.value.length === 1 ? inputIds.value[0] : void 0;
  13691. });
  13692. const isGroup = vue.computed(() => {
  13693. return !labelFor.value && hasLabel.value;
  13694. });
  13695. const isNested = !!parentFormItemContext;
  13696. const fieldValue = vue.computed(() => {
  13697. const model = formContext == null ? void 0 : formContext.model;
  13698. if (!model || !props.prop) {
  13699. return;
  13700. }
  13701. return getProp(model, props.prop).value;
  13702. });
  13703. const normalizedRules = vue.computed(() => {
  13704. const { required } = props;
  13705. const rules = [];
  13706. if (props.rules) {
  13707. rules.push(...castArray$1(props.rules));
  13708. }
  13709. const formRules = formContext == null ? void 0 : formContext.rules;
  13710. if (formRules && props.prop) {
  13711. const _rules = getProp(formRules, props.prop).value;
  13712. if (_rules) {
  13713. rules.push(...castArray$1(_rules));
  13714. }
  13715. }
  13716. if (required !== void 0) {
  13717. const requiredRules = rules.map((rule, i) => [rule, i]).filter(([rule]) => "required" in rule);
  13718. if (requiredRules.length > 0) {
  13719. for (const [rule, i] of requiredRules) {
  13720. if (rule.required === required)
  13721. continue;
  13722. rules[i] = { ...rule, required };
  13723. }
  13724. } else {
  13725. rules.push({ required });
  13726. }
  13727. }
  13728. return rules;
  13729. });
  13730. const validateEnabled = vue.computed(() => normalizedRules.value.length > 0);
  13731. const getFilteredRule = (trigger) => {
  13732. const rules = normalizedRules.value;
  13733. return rules.filter((rule) => {
  13734. if (!rule.trigger || !trigger)
  13735. return true;
  13736. if (isArray$1(rule.trigger)) {
  13737. return rule.trigger.includes(trigger);
  13738. } else {
  13739. return rule.trigger === trigger;
  13740. }
  13741. }).map(({ trigger: trigger2, ...rule }) => rule);
  13742. };
  13743. const isRequired = vue.computed(() => normalizedRules.value.some((rule) => rule.required));
  13744. const shouldShowError = vue.computed(() => {
  13745. var _a;
  13746. return validateStateDebounced.value === "error" && props.showMessage && ((_a = formContext == null ? void 0 : formContext.showMessage) != null ? _a : true);
  13747. });
  13748. const currentLabel = vue.computed(() => `${props.label || ""}${(formContext == null ? void 0 : formContext.labelSuffix) || ""}`);
  13749. const setValidationState = (state) => {
  13750. validateState.value = state;
  13751. };
  13752. const onValidationFailed = (error) => {
  13753. var _a, _b;
  13754. const { errors, fields } = error;
  13755. if (!errors || !fields) {
  13756. console.error(error);
  13757. }
  13758. setValidationState("error");
  13759. validateMessage.value = errors ? (_b = (_a = errors == null ? void 0 : errors[0]) == null ? void 0 : _a.message) != null ? _b : `${props.prop} is required` : "";
  13760. formContext == null ? void 0 : formContext.emit("validate", props.prop, false, validateMessage.value);
  13761. };
  13762. const onValidationSucceeded = () => {
  13763. setValidationState("success");
  13764. formContext == null ? void 0 : formContext.emit("validate", props.prop, true, "");
  13765. };
  13766. const doValidate = async (rules) => {
  13767. const modelName = propString.value;
  13768. const validator = new Schema({
  13769. [modelName]: rules
  13770. });
  13771. return validator.validate({ [modelName]: fieldValue.value }, { firstFields: true }).then(() => {
  13772. onValidationSucceeded();
  13773. return true;
  13774. }).catch((err) => {
  13775. onValidationFailed(err);
  13776. return Promise.reject(err);
  13777. });
  13778. };
  13779. const validate = async (trigger, callback) => {
  13780. if (isResettingField || !props.prop) {
  13781. return false;
  13782. }
  13783. const hasCallback = isFunction$1(callback);
  13784. if (!validateEnabled.value) {
  13785. callback == null ? void 0 : callback(false);
  13786. return false;
  13787. }
  13788. const rules = getFilteredRule(trigger);
  13789. if (rules.length === 0) {
  13790. callback == null ? void 0 : callback(true);
  13791. return true;
  13792. }
  13793. setValidationState("validating");
  13794. return doValidate(rules).then(() => {
  13795. callback == null ? void 0 : callback(true);
  13796. return true;
  13797. }).catch((err) => {
  13798. const { fields } = err;
  13799. callback == null ? void 0 : callback(false, fields);
  13800. return hasCallback ? false : Promise.reject(fields);
  13801. });
  13802. };
  13803. const clearValidate = () => {
  13804. setValidationState("");
  13805. validateMessage.value = "";
  13806. isResettingField = false;
  13807. };
  13808. const resetField = async () => {
  13809. const model = formContext == null ? void 0 : formContext.model;
  13810. if (!model || !props.prop)
  13811. return;
  13812. const computedValue = getProp(model, props.prop);
  13813. isResettingField = true;
  13814. computedValue.value = clone(initialValue);
  13815. await vue.nextTick();
  13816. clearValidate();
  13817. isResettingField = false;
  13818. };
  13819. const addInputId = (id) => {
  13820. if (!inputIds.value.includes(id)) {
  13821. inputIds.value.push(id);
  13822. }
  13823. };
  13824. const removeInputId = (id) => {
  13825. inputIds.value = inputIds.value.filter((listId) => listId !== id);
  13826. };
  13827. vue.watch(() => props.error, (val) => {
  13828. validateMessage.value = val || "";
  13829. setValidationState(val ? "error" : "");
  13830. }, { immediate: true });
  13831. vue.watch(() => props.validateStatus, (val) => setValidationState(val || ""));
  13832. const context = vue.reactive({
  13833. ...vue.toRefs(props),
  13834. $el: formItemRef,
  13835. size: _size,
  13836. validateMessage,
  13837. validateState,
  13838. labelId,
  13839. inputIds,
  13840. isGroup,
  13841. hasLabel,
  13842. fieldValue,
  13843. addInputId,
  13844. removeInputId,
  13845. resetField,
  13846. clearValidate,
  13847. validate,
  13848. propString
  13849. });
  13850. vue.provide(formItemContextKey, context);
  13851. vue.onMounted(() => {
  13852. if (props.prop) {
  13853. formContext == null ? void 0 : formContext.addField(context);
  13854. initialValue = clone(fieldValue.value);
  13855. }
  13856. });
  13857. vue.onBeforeUnmount(() => {
  13858. formContext == null ? void 0 : formContext.removeField(context);
  13859. });
  13860. expose({
  13861. size: _size,
  13862. validateMessage,
  13863. validateState,
  13864. validate,
  13865. clearValidate,
  13866. resetField
  13867. });
  13868. return (_ctx, _cache) => {
  13869. var _a;
  13870. return vue.openBlock(), vue.createElementBlock("div", {
  13871. ref_key: "formItemRef",
  13872. ref: formItemRef,
  13873. class: vue.normalizeClass(vue.unref(formItemClasses)),
  13874. role: vue.unref(isGroup) ? "group" : void 0,
  13875. "aria-labelledby": vue.unref(isGroup) ? vue.unref(labelId) : void 0
  13876. }, [
  13877. vue.createVNode(vue.unref(FormLabelWrap), {
  13878. "is-auto-width": vue.unref(labelStyle).width === "auto",
  13879. "update-all": ((_a = vue.unref(formContext)) == null ? void 0 : _a.labelWidth) === "auto"
  13880. }, {
  13881. default: vue.withCtx(() => [
  13882. !!(_ctx.label || _ctx.$slots.label) ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(labelFor) ? "label" : "div"), {
  13883. key: 0,
  13884. id: vue.unref(labelId),
  13885. for: vue.unref(labelFor),
  13886. class: vue.normalizeClass(vue.unref(ns).e("label")),
  13887. style: vue.normalizeStyle(vue.unref(labelStyle))
  13888. }, {
  13889. default: vue.withCtx(() => [
  13890. vue.renderSlot(_ctx.$slots, "label", { label: vue.unref(currentLabel) }, () => [
  13891. vue.createTextVNode(vue.toDisplayString(vue.unref(currentLabel)), 1)
  13892. ])
  13893. ]),
  13894. _: 3
  13895. }, 8, ["id", "for", "class", "style"])) : vue.createCommentVNode("v-if", true)
  13896. ]),
  13897. _: 3
  13898. }, 8, ["is-auto-width", "update-all"]),
  13899. vue.createElementVNode("div", {
  13900. class: vue.normalizeClass(vue.unref(ns).e("content")),
  13901. style: vue.normalizeStyle(vue.unref(contentStyle))
  13902. }, [
  13903. vue.renderSlot(_ctx.$slots, "default"),
  13904. vue.createVNode(vue.TransitionGroup, {
  13905. name: `${vue.unref(ns).namespace.value}-zoom-in-top`
  13906. }, {
  13907. default: vue.withCtx(() => [
  13908. vue.unref(shouldShowError) ? vue.renderSlot(_ctx.$slots, "error", {
  13909. key: 0,
  13910. error: validateMessage.value
  13911. }, () => [
  13912. vue.createElementVNode("div", {
  13913. class: vue.normalizeClass(vue.unref(validateClasses))
  13914. }, vue.toDisplayString(validateMessage.value), 3)
  13915. ]) : vue.createCommentVNode("v-if", true)
  13916. ]),
  13917. _: 3
  13918. }, 8, ["name"])
  13919. ], 6)
  13920. ], 10, ["role", "aria-labelledby"]);
  13921. };
  13922. }
  13923. });
  13924. var FormItem = /* @__PURE__ */ _export_sfc(_sfc_main$2r, [["__file", "form-item.vue"]]);
  13925. const ElForm = withInstall(Form, {
  13926. FormItem
  13927. });
  13928. const ElFormItem = withNoopInstall(FormItem);
  13929. let hiddenTextarea = void 0;
  13930. const HIDDEN_STYLE = {
  13931. height: "0",
  13932. visibility: "hidden",
  13933. overflow: isFirefox() ? "" : "hidden",
  13934. position: "absolute",
  13935. "z-index": "-1000",
  13936. top: "0",
  13937. right: "0"
  13938. };
  13939. const CONTEXT_STYLE = [
  13940. "letter-spacing",
  13941. "line-height",
  13942. "padding-top",
  13943. "padding-bottom",
  13944. "font-family",
  13945. "font-weight",
  13946. "font-size",
  13947. "text-rendering",
  13948. "text-transform",
  13949. "width",
  13950. "text-indent",
  13951. "padding-left",
  13952. "padding-right",
  13953. "border-width",
  13954. "box-sizing",
  13955. "word-break"
  13956. ];
  13957. const looseToNumber = (val) => {
  13958. const n = Number.parseFloat(val);
  13959. return Number.isNaN(n) ? val : n;
  13960. };
  13961. function calculateNodeStyling(targetElement) {
  13962. const style = window.getComputedStyle(targetElement);
  13963. const boxSizing = style.getPropertyValue("box-sizing");
  13964. const paddingSize = Number.parseFloat(style.getPropertyValue("padding-bottom")) + Number.parseFloat(style.getPropertyValue("padding-top"));
  13965. const borderSize = Number.parseFloat(style.getPropertyValue("border-bottom-width")) + Number.parseFloat(style.getPropertyValue("border-top-width"));
  13966. const contextStyle = CONTEXT_STYLE.map((name) => [
  13967. name,
  13968. style.getPropertyValue(name)
  13969. ]);
  13970. return { contextStyle, paddingSize, borderSize, boxSizing };
  13971. }
  13972. function calcTextareaHeight(targetElement, minRows = 1, maxRows) {
  13973. var _a, _b;
  13974. if (!hiddenTextarea) {
  13975. hiddenTextarea = document.createElement("textarea");
  13976. ((_a = targetElement.parentNode) != null ? _a : document.body).appendChild(hiddenTextarea);
  13977. }
  13978. const { paddingSize, borderSize, boxSizing, contextStyle } = calculateNodeStyling(targetElement);
  13979. contextStyle.forEach(([key, value]) => hiddenTextarea == null ? void 0 : hiddenTextarea.style.setProperty(key, value));
  13980. Object.entries(HIDDEN_STYLE).forEach(([key, value]) => hiddenTextarea == null ? void 0 : hiddenTextarea.style.setProperty(key, value, "important"));
  13981. hiddenTextarea.value = targetElement.value || targetElement.placeholder || "";
  13982. let height = hiddenTextarea.scrollHeight;
  13983. const result = {};
  13984. if (boxSizing === "border-box") {
  13985. height = height + borderSize;
  13986. } else if (boxSizing === "content-box") {
  13987. height = height - paddingSize;
  13988. }
  13989. hiddenTextarea.value = "";
  13990. const singleRowHeight = hiddenTextarea.scrollHeight - paddingSize;
  13991. if (isNumber(minRows)) {
  13992. let minHeight = singleRowHeight * minRows;
  13993. if (boxSizing === "border-box") {
  13994. minHeight = minHeight + paddingSize + borderSize;
  13995. }
  13996. height = Math.max(minHeight, height);
  13997. result.minHeight = `${minHeight}px`;
  13998. }
  13999. if (isNumber(maxRows)) {
  14000. let maxHeight = singleRowHeight * maxRows;
  14001. if (boxSizing === "border-box") {
  14002. maxHeight = maxHeight + paddingSize + borderSize;
  14003. }
  14004. height = Math.min(maxHeight, height);
  14005. }
  14006. result.height = `${height}px`;
  14007. (_b = hiddenTextarea.parentNode) == null ? void 0 : _b.removeChild(hiddenTextarea);
  14008. hiddenTextarea = void 0;
  14009. return result;
  14010. }
  14011. const inputProps = buildProps({
  14012. id: {
  14013. type: String,
  14014. default: void 0
  14015. },
  14016. size: useSizeProp,
  14017. disabled: Boolean,
  14018. modelValue: {
  14019. type: definePropType([
  14020. String,
  14021. Number,
  14022. Object
  14023. ]),
  14024. default: ""
  14025. },
  14026. modelModifiers: {
  14027. type: definePropType(Object),
  14028. default: () => ({})
  14029. },
  14030. maxlength: {
  14031. type: [String, Number]
  14032. },
  14033. minlength: {
  14034. type: [String, Number]
  14035. },
  14036. type: {
  14037. type: String,
  14038. default: "text"
  14039. },
  14040. resize: {
  14041. type: String,
  14042. values: ["none", "both", "horizontal", "vertical"]
  14043. },
  14044. autosize: {
  14045. type: definePropType([Boolean, Object]),
  14046. default: false
  14047. },
  14048. autocomplete: {
  14049. type: definePropType(String),
  14050. default: "off"
  14051. },
  14052. formatter: {
  14053. type: Function
  14054. },
  14055. parser: {
  14056. type: Function
  14057. },
  14058. placeholder: {
  14059. type: String
  14060. },
  14061. form: {
  14062. type: String
  14063. },
  14064. readonly: Boolean,
  14065. clearable: Boolean,
  14066. clearIcon: {
  14067. type: iconPropType,
  14068. default: circle_close_default
  14069. },
  14070. showPassword: Boolean,
  14071. showWordLimit: Boolean,
  14072. wordLimitPosition: {
  14073. type: String,
  14074. values: ["inside", "outside"],
  14075. default: "inside"
  14076. },
  14077. suffixIcon: {
  14078. type: iconPropType
  14079. },
  14080. prefixIcon: {
  14081. type: iconPropType
  14082. },
  14083. containerRole: {
  14084. type: String,
  14085. default: void 0
  14086. },
  14087. tabindex: {
  14088. type: [String, Number],
  14089. default: 0
  14090. },
  14091. validateEvent: {
  14092. type: Boolean,
  14093. default: true
  14094. },
  14095. inputStyle: {
  14096. type: definePropType([Object, Array, String]),
  14097. default: () => mutable({})
  14098. },
  14099. autofocus: Boolean,
  14100. rows: {
  14101. type: Number,
  14102. default: 2
  14103. },
  14104. ...useAriaProps(["ariaLabel"]),
  14105. inputmode: {
  14106. type: definePropType(String),
  14107. default: void 0
  14108. },
  14109. name: String
  14110. });
  14111. const inputEmits = {
  14112. [UPDATE_MODEL_EVENT]: (value) => isString$1(value),
  14113. input: (value) => isString$1(value),
  14114. change: (value) => isString$1(value),
  14115. focus: (evt) => evt instanceof FocusEvent,
  14116. blur: (evt) => evt instanceof FocusEvent,
  14117. clear: () => true,
  14118. mouseleave: (evt) => evt instanceof MouseEvent,
  14119. mouseenter: (evt) => evt instanceof MouseEvent,
  14120. keydown: (evt) => evt instanceof Event,
  14121. compositionstart: (evt) => evt instanceof CompositionEvent,
  14122. compositionupdate: (evt) => evt instanceof CompositionEvent,
  14123. compositionend: (evt) => evt instanceof CompositionEvent
  14124. };
  14125. const COMPONENT_NAME$m = "ElInput";
  14126. const __default__$1T = vue.defineComponent({
  14127. name: COMPONENT_NAME$m,
  14128. inheritAttrs: false
  14129. });
  14130. const _sfc_main$2q = /* @__PURE__ */ vue.defineComponent({
  14131. ...__default__$1T,
  14132. props: inputProps,
  14133. emits: inputEmits,
  14134. setup(__props, { expose, emit }) {
  14135. const props = __props;
  14136. const rawAttrs = vue.useAttrs();
  14137. const attrs = useAttrs();
  14138. const slots = vue.useSlots();
  14139. const containerKls = vue.computed(() => [
  14140. props.type === "textarea" ? nsTextarea.b() : nsInput.b(),
  14141. nsInput.m(inputSize.value),
  14142. nsInput.is("disabled", inputDisabled.value),
  14143. nsInput.is("exceed", inputExceed.value),
  14144. {
  14145. [nsInput.b("group")]: slots.prepend || slots.append,
  14146. [nsInput.m("prefix")]: slots.prefix || props.prefixIcon,
  14147. [nsInput.m("suffix")]: slots.suffix || props.suffixIcon || props.clearable || props.showPassword,
  14148. [nsInput.bm("suffix", "password-clear")]: showClear.value && showPwdVisible.value,
  14149. [nsInput.b("hidden")]: props.type === "hidden"
  14150. },
  14151. rawAttrs.class
  14152. ]);
  14153. const wrapperKls = vue.computed(() => [
  14154. nsInput.e("wrapper"),
  14155. nsInput.is("focus", isFocused.value)
  14156. ]);
  14157. const { form: elForm, formItem: elFormItem } = useFormItem();
  14158. const { inputId } = useFormItemInputId(props, {
  14159. formItemContext: elFormItem
  14160. });
  14161. const inputSize = useFormSize();
  14162. const inputDisabled = useFormDisabled();
  14163. const nsInput = useNamespace("input");
  14164. const nsTextarea = useNamespace("textarea");
  14165. const input = vue.shallowRef();
  14166. const textarea = vue.shallowRef();
  14167. const hovering = vue.ref(false);
  14168. const passwordVisible = vue.ref(false);
  14169. const countStyle = vue.ref();
  14170. const textareaCalcStyle = vue.shallowRef(props.inputStyle);
  14171. const _ref = vue.computed(() => input.value || textarea.value);
  14172. const { wrapperRef, isFocused, handleFocus, handleBlur } = useFocusController(_ref, {
  14173. disabled: inputDisabled,
  14174. afterBlur() {
  14175. var _a;
  14176. if (props.validateEvent) {
  14177. (_a = elFormItem == null ? void 0 : elFormItem.validate) == null ? void 0 : _a.call(elFormItem, "blur").catch((err) => debugWarn(err));
  14178. }
  14179. }
  14180. });
  14181. const needStatusIcon = vue.computed(() => {
  14182. var _a;
  14183. return (_a = elForm == null ? void 0 : elForm.statusIcon) != null ? _a : false;
  14184. });
  14185. const validateState = vue.computed(() => (elFormItem == null ? void 0 : elFormItem.validateState) || "");
  14186. const validateIcon = vue.computed(() => validateState.value && ValidateComponentsMap[validateState.value]);
  14187. const passwordIcon = vue.computed(() => passwordVisible.value ? view_default : hide_default);
  14188. const containerStyle = vue.computed(() => [
  14189. rawAttrs.style
  14190. ]);
  14191. const textareaStyle = vue.computed(() => [
  14192. props.inputStyle,
  14193. textareaCalcStyle.value,
  14194. { resize: props.resize }
  14195. ]);
  14196. const nativeInputValue = vue.computed(() => isNil(props.modelValue) ? "" : String(props.modelValue));
  14197. const showClear = vue.computed(() => props.clearable && !inputDisabled.value && !props.readonly && !!nativeInputValue.value && (isFocused.value || hovering.value));
  14198. const showPwdVisible = vue.computed(() => props.showPassword && !inputDisabled.value && !!nativeInputValue.value);
  14199. const isWordLimitVisible = vue.computed(() => props.showWordLimit && !!props.maxlength && (props.type === "text" || props.type === "textarea") && !inputDisabled.value && !props.readonly && !props.showPassword);
  14200. const textLength = vue.computed(() => nativeInputValue.value.length);
  14201. const inputExceed = vue.computed(() => !!isWordLimitVisible.value && textLength.value > Number(props.maxlength));
  14202. const suffixVisible = vue.computed(() => !!slots.suffix || !!props.suffixIcon || showClear.value || props.showPassword || isWordLimitVisible.value || !!validateState.value && needStatusIcon.value);
  14203. const hasModelModifiers = vue.computed(() => !!Object.keys(props.modelModifiers).length);
  14204. const [recordCursor, setCursor] = useCursor(input);
  14205. useResizeObserver(textarea, (entries) => {
  14206. onceInitSizeTextarea();
  14207. if (!isWordLimitVisible.value || props.resize !== "both")
  14208. return;
  14209. const entry = entries[0];
  14210. const { width } = entry.contentRect;
  14211. countStyle.value = {
  14212. right: `calc(100% - ${width + 15 + 6}px)`
  14213. };
  14214. });
  14215. const resizeTextarea = () => {
  14216. const { type, autosize } = props;
  14217. if (!isClient || type !== "textarea" || !textarea.value)
  14218. return;
  14219. if (autosize) {
  14220. const minRows = isObject$1(autosize) ? autosize.minRows : void 0;
  14221. const maxRows = isObject$1(autosize) ? autosize.maxRows : void 0;
  14222. const textareaStyle2 = calcTextareaHeight(textarea.value, minRows, maxRows);
  14223. textareaCalcStyle.value = {
  14224. overflowY: "hidden",
  14225. ...textareaStyle2
  14226. };
  14227. vue.nextTick(() => {
  14228. textarea.value.offsetHeight;
  14229. textareaCalcStyle.value = textareaStyle2;
  14230. });
  14231. } else {
  14232. textareaCalcStyle.value = {
  14233. minHeight: calcTextareaHeight(textarea.value).minHeight
  14234. };
  14235. }
  14236. };
  14237. const createOnceInitResize = (resizeTextarea2) => {
  14238. let isInit = false;
  14239. return () => {
  14240. var _a;
  14241. if (isInit || !props.autosize)
  14242. return;
  14243. const isElHidden = ((_a = textarea.value) == null ? void 0 : _a.offsetParent) === null;
  14244. if (!isElHidden) {
  14245. setTimeout(resizeTextarea2);
  14246. isInit = true;
  14247. }
  14248. };
  14249. };
  14250. const onceInitSizeTextarea = createOnceInitResize(resizeTextarea);
  14251. const setNativeInputValue = () => {
  14252. const input2 = _ref.value;
  14253. const formatterValue = props.formatter ? props.formatter(nativeInputValue.value) : nativeInputValue.value;
  14254. if (!input2 || input2.value === formatterValue)
  14255. return;
  14256. input2.value = formatterValue;
  14257. };
  14258. const formatValue = (value) => {
  14259. const { trim, number } = props.modelModifiers;
  14260. if (trim) {
  14261. value = value.trim();
  14262. }
  14263. if (number) {
  14264. value = `${looseToNumber(value)}`;
  14265. }
  14266. if (props.formatter && props.parser) {
  14267. value = props.parser(value);
  14268. }
  14269. return value;
  14270. };
  14271. const handleInput = async (event) => {
  14272. if (isComposing.value)
  14273. return;
  14274. const { lazy } = props.modelModifiers;
  14275. let { value } = event.target;
  14276. if (lazy) {
  14277. emit(INPUT_EVENT, value);
  14278. return;
  14279. }
  14280. value = formatValue(value);
  14281. if (String(value) === nativeInputValue.value) {
  14282. if (props.formatter) {
  14283. setNativeInputValue();
  14284. }
  14285. return;
  14286. }
  14287. recordCursor();
  14288. emit(UPDATE_MODEL_EVENT, value);
  14289. emit(INPUT_EVENT, value);
  14290. await vue.nextTick();
  14291. if (props.formatter && props.parser || !hasModelModifiers.value) {
  14292. setNativeInputValue();
  14293. }
  14294. setCursor();
  14295. };
  14296. const handleChange = async (event) => {
  14297. let { value } = event.target;
  14298. value = formatValue(value);
  14299. if (props.modelModifiers.lazy) {
  14300. emit(UPDATE_MODEL_EVENT, value);
  14301. }
  14302. emit(CHANGE_EVENT, value);
  14303. await vue.nextTick();
  14304. setNativeInputValue();
  14305. };
  14306. const {
  14307. isComposing,
  14308. handleCompositionStart,
  14309. handleCompositionUpdate,
  14310. handleCompositionEnd
  14311. } = useComposition({ emit, afterComposition: handleInput });
  14312. const handlePasswordVisible = () => {
  14313. passwordVisible.value = !passwordVisible.value;
  14314. };
  14315. const focus = () => {
  14316. var _a;
  14317. return (_a = _ref.value) == null ? void 0 : _a.focus();
  14318. };
  14319. const blur = () => {
  14320. var _a;
  14321. return (_a = _ref.value) == null ? void 0 : _a.blur();
  14322. };
  14323. const handleMouseLeave = (evt) => {
  14324. hovering.value = false;
  14325. emit("mouseleave", evt);
  14326. };
  14327. const handleMouseEnter = (evt) => {
  14328. hovering.value = true;
  14329. emit("mouseenter", evt);
  14330. };
  14331. const handleKeydown = (evt) => {
  14332. emit("keydown", evt);
  14333. };
  14334. const select = () => {
  14335. var _a;
  14336. (_a = _ref.value) == null ? void 0 : _a.select();
  14337. };
  14338. const clear = () => {
  14339. emit(UPDATE_MODEL_EVENT, "");
  14340. emit(CHANGE_EVENT, "");
  14341. emit("clear");
  14342. emit(INPUT_EVENT, "");
  14343. };
  14344. vue.watch(() => props.modelValue, () => {
  14345. var _a;
  14346. vue.nextTick(() => resizeTextarea());
  14347. if (props.validateEvent) {
  14348. (_a = elFormItem == null ? void 0 : elFormItem.validate) == null ? void 0 : _a.call(elFormItem, "change").catch((err) => debugWarn(err));
  14349. }
  14350. });
  14351. vue.watch(nativeInputValue, (newValue) => {
  14352. if (!_ref.value) {
  14353. return;
  14354. }
  14355. const { trim, number } = props.modelModifiers;
  14356. const elValue = _ref.value.value;
  14357. const displayValue = (number || props.type === "number") && !/^0\d/.test(elValue) ? `${looseToNumber(elValue)}` : elValue;
  14358. if (displayValue === newValue) {
  14359. return;
  14360. }
  14361. if (document.activeElement === _ref.value && _ref.value.type !== "range") {
  14362. if (trim && displayValue.trim() === newValue) {
  14363. return;
  14364. }
  14365. }
  14366. setNativeInputValue();
  14367. });
  14368. vue.watch(() => props.type, async () => {
  14369. await vue.nextTick();
  14370. setNativeInputValue();
  14371. resizeTextarea();
  14372. });
  14373. vue.onMounted(() => {
  14374. if (!props.formatter && props.parser) {
  14375. debugWarn(COMPONENT_NAME$m, "If you set the parser, you also need to set the formatter.");
  14376. }
  14377. setNativeInputValue();
  14378. vue.nextTick(resizeTextarea);
  14379. });
  14380. expose({
  14381. input,
  14382. textarea,
  14383. ref: _ref,
  14384. textareaStyle,
  14385. autosize: vue.toRef(props, "autosize"),
  14386. isComposing,
  14387. focus,
  14388. blur,
  14389. select,
  14390. clear,
  14391. resizeTextarea
  14392. });
  14393. return (_ctx, _cache) => {
  14394. return vue.openBlock(), vue.createElementBlock("div", {
  14395. class: vue.normalizeClass([
  14396. vue.unref(containerKls),
  14397. {
  14398. [vue.unref(nsInput).bm("group", "append")]: _ctx.$slots.append,
  14399. [vue.unref(nsInput).bm("group", "prepend")]: _ctx.$slots.prepend
  14400. }
  14401. ]),
  14402. style: vue.normalizeStyle(vue.unref(containerStyle)),
  14403. onMouseenter: handleMouseEnter,
  14404. onMouseleave: handleMouseLeave
  14405. }, [
  14406. vue.createCommentVNode(" input "),
  14407. _ctx.type !== "textarea" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  14408. vue.createCommentVNode(" prepend slot "),
  14409. _ctx.$slots.prepend ? (vue.openBlock(), vue.createElementBlock("div", {
  14410. key: 0,
  14411. class: vue.normalizeClass(vue.unref(nsInput).be("group", "prepend"))
  14412. }, [
  14413. vue.renderSlot(_ctx.$slots, "prepend")
  14414. ], 2)) : vue.createCommentVNode("v-if", true),
  14415. vue.createElementVNode("div", {
  14416. ref_key: "wrapperRef",
  14417. ref: wrapperRef,
  14418. class: vue.normalizeClass(vue.unref(wrapperKls))
  14419. }, [
  14420. vue.createCommentVNode(" prefix slot "),
  14421. _ctx.$slots.prefix || _ctx.prefixIcon ? (vue.openBlock(), vue.createElementBlock("span", {
  14422. key: 0,
  14423. class: vue.normalizeClass(vue.unref(nsInput).e("prefix"))
  14424. }, [
  14425. vue.createElementVNode("span", {
  14426. class: vue.normalizeClass(vue.unref(nsInput).e("prefix-inner"))
  14427. }, [
  14428. vue.renderSlot(_ctx.$slots, "prefix"),
  14429. _ctx.prefixIcon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  14430. key: 0,
  14431. class: vue.normalizeClass(vue.unref(nsInput).e("icon"))
  14432. }, {
  14433. default: vue.withCtx(() => [
  14434. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.prefixIcon)))
  14435. ]),
  14436. _: 1
  14437. }, 8, ["class"])) : vue.createCommentVNode("v-if", true)
  14438. ], 2)
  14439. ], 2)) : vue.createCommentVNode("v-if", true),
  14440. vue.createElementVNode("input", vue.mergeProps({
  14441. id: vue.unref(inputId),
  14442. ref_key: "input",
  14443. ref: input,
  14444. class: vue.unref(nsInput).e("inner")
  14445. }, vue.unref(attrs), {
  14446. name: _ctx.name,
  14447. minlength: _ctx.minlength,
  14448. maxlength: _ctx.maxlength,
  14449. type: _ctx.showPassword ? passwordVisible.value ? "text" : "password" : _ctx.type,
  14450. disabled: vue.unref(inputDisabled),
  14451. readonly: _ctx.readonly,
  14452. autocomplete: _ctx.autocomplete,
  14453. tabindex: _ctx.tabindex,
  14454. "aria-label": _ctx.ariaLabel,
  14455. placeholder: _ctx.placeholder,
  14456. style: _ctx.inputStyle,
  14457. form: _ctx.form,
  14458. autofocus: _ctx.autofocus,
  14459. role: _ctx.containerRole,
  14460. inputmode: _ctx.inputmode,
  14461. onCompositionstart: vue.unref(handleCompositionStart),
  14462. onCompositionupdate: vue.unref(handleCompositionUpdate),
  14463. onCompositionend: vue.unref(handleCompositionEnd),
  14464. onInput: handleInput,
  14465. onChange: handleChange,
  14466. onKeydown: handleKeydown
  14467. }), null, 16, ["id", "name", "minlength", "maxlength", "type", "disabled", "readonly", "autocomplete", "tabindex", "aria-label", "placeholder", "form", "autofocus", "role", "inputmode", "onCompositionstart", "onCompositionupdate", "onCompositionend"]),
  14468. vue.createCommentVNode(" suffix slot "),
  14469. vue.unref(suffixVisible) ? (vue.openBlock(), vue.createElementBlock("span", {
  14470. key: 1,
  14471. class: vue.normalizeClass(vue.unref(nsInput).e("suffix"))
  14472. }, [
  14473. vue.createElementVNode("span", {
  14474. class: vue.normalizeClass(vue.unref(nsInput).e("suffix-inner"))
  14475. }, [
  14476. !vue.unref(showClear) || !vue.unref(showPwdVisible) || !vue.unref(isWordLimitVisible) ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  14477. vue.renderSlot(_ctx.$slots, "suffix"),
  14478. _ctx.suffixIcon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  14479. key: 0,
  14480. class: vue.normalizeClass(vue.unref(nsInput).e("icon"))
  14481. }, {
  14482. default: vue.withCtx(() => [
  14483. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.suffixIcon)))
  14484. ]),
  14485. _: 1
  14486. }, 8, ["class"])) : vue.createCommentVNode("v-if", true)
  14487. ], 64)) : vue.createCommentVNode("v-if", true),
  14488. vue.unref(showClear) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  14489. key: 1,
  14490. class: vue.normalizeClass([vue.unref(nsInput).e("icon"), vue.unref(nsInput).e("clear")]),
  14491. onMousedown: vue.withModifiers(vue.unref(NOOP), ["prevent"]),
  14492. onClick: clear
  14493. }, {
  14494. default: vue.withCtx(() => [
  14495. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.clearIcon)))
  14496. ]),
  14497. _: 1
  14498. }, 8, ["class", "onMousedown"])) : vue.createCommentVNode("v-if", true),
  14499. vue.unref(showPwdVisible) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  14500. key: 2,
  14501. class: vue.normalizeClass([vue.unref(nsInput).e("icon"), vue.unref(nsInput).e("password")]),
  14502. onClick: handlePasswordVisible,
  14503. onMousedown: vue.withModifiers(vue.unref(NOOP), ["prevent"]),
  14504. onMouseup: vue.withModifiers(vue.unref(NOOP), ["prevent"])
  14505. }, {
  14506. default: vue.withCtx(() => [
  14507. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(passwordIcon))))
  14508. ]),
  14509. _: 1
  14510. }, 8, ["class", "onMousedown", "onMouseup"])) : vue.createCommentVNode("v-if", true),
  14511. vue.unref(isWordLimitVisible) ? (vue.openBlock(), vue.createElementBlock("span", {
  14512. key: 3,
  14513. class: vue.normalizeClass([
  14514. vue.unref(nsInput).e("count"),
  14515. vue.unref(nsInput).is("outside", _ctx.wordLimitPosition === "outside")
  14516. ])
  14517. }, [
  14518. vue.createElementVNode("span", {
  14519. class: vue.normalizeClass(vue.unref(nsInput).e("count-inner"))
  14520. }, vue.toDisplayString(vue.unref(textLength)) + " / " + vue.toDisplayString(_ctx.maxlength), 3)
  14521. ], 2)) : vue.createCommentVNode("v-if", true),
  14522. vue.unref(validateState) && vue.unref(validateIcon) && vue.unref(needStatusIcon) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  14523. key: 4,
  14524. class: vue.normalizeClass([
  14525. vue.unref(nsInput).e("icon"),
  14526. vue.unref(nsInput).e("validateIcon"),
  14527. vue.unref(nsInput).is("loading", vue.unref(validateState) === "validating")
  14528. ])
  14529. }, {
  14530. default: vue.withCtx(() => [
  14531. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(validateIcon))))
  14532. ]),
  14533. _: 1
  14534. }, 8, ["class"])) : vue.createCommentVNode("v-if", true)
  14535. ], 2)
  14536. ], 2)) : vue.createCommentVNode("v-if", true)
  14537. ], 2),
  14538. vue.createCommentVNode(" append slot "),
  14539. _ctx.$slots.append ? (vue.openBlock(), vue.createElementBlock("div", {
  14540. key: 1,
  14541. class: vue.normalizeClass(vue.unref(nsInput).be("group", "append"))
  14542. }, [
  14543. vue.renderSlot(_ctx.$slots, "append")
  14544. ], 2)) : vue.createCommentVNode("v-if", true)
  14545. ], 64)) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  14546. vue.createCommentVNode(" textarea "),
  14547. vue.createElementVNode("textarea", vue.mergeProps({
  14548. id: vue.unref(inputId),
  14549. ref_key: "textarea",
  14550. ref: textarea,
  14551. class: [vue.unref(nsTextarea).e("inner"), vue.unref(nsInput).is("focus", vue.unref(isFocused))]
  14552. }, vue.unref(attrs), {
  14553. minlength: _ctx.minlength,
  14554. maxlength: _ctx.maxlength,
  14555. tabindex: _ctx.tabindex,
  14556. disabled: vue.unref(inputDisabled),
  14557. readonly: _ctx.readonly,
  14558. autocomplete: _ctx.autocomplete,
  14559. style: vue.unref(textareaStyle),
  14560. "aria-label": _ctx.ariaLabel,
  14561. placeholder: _ctx.placeholder,
  14562. form: _ctx.form,
  14563. autofocus: _ctx.autofocus,
  14564. rows: _ctx.rows,
  14565. role: _ctx.containerRole,
  14566. onCompositionstart: vue.unref(handleCompositionStart),
  14567. onCompositionupdate: vue.unref(handleCompositionUpdate),
  14568. onCompositionend: vue.unref(handleCompositionEnd),
  14569. onInput: handleInput,
  14570. onFocus: vue.unref(handleFocus),
  14571. onBlur: vue.unref(handleBlur),
  14572. onChange: handleChange,
  14573. onKeydown: handleKeydown
  14574. }), null, 16, ["id", "minlength", "maxlength", "tabindex", "disabled", "readonly", "autocomplete", "aria-label", "placeholder", "form", "autofocus", "rows", "role", "onCompositionstart", "onCompositionupdate", "onCompositionend", "onFocus", "onBlur"]),
  14575. vue.unref(isWordLimitVisible) ? (vue.openBlock(), vue.createElementBlock("span", {
  14576. key: 0,
  14577. style: vue.normalizeStyle(countStyle.value),
  14578. class: vue.normalizeClass([
  14579. vue.unref(nsInput).e("count"),
  14580. vue.unref(nsInput).is("outside", _ctx.wordLimitPosition === "outside")
  14581. ])
  14582. }, vue.toDisplayString(vue.unref(textLength)) + " / " + vue.toDisplayString(_ctx.maxlength), 7)) : vue.createCommentVNode("v-if", true)
  14583. ], 64))
  14584. ], 38);
  14585. };
  14586. }
  14587. });
  14588. var Input = /* @__PURE__ */ _export_sfc(_sfc_main$2q, [["__file", "input.vue"]]);
  14589. const ElInput = withInstall(Input);
  14590. const GAP = 4;
  14591. const BAR_MAP = {
  14592. vertical: {
  14593. offset: "offsetHeight",
  14594. scroll: "scrollTop",
  14595. scrollSize: "scrollHeight",
  14596. size: "height",
  14597. key: "vertical",
  14598. axis: "Y",
  14599. client: "clientY",
  14600. direction: "top"
  14601. },
  14602. horizontal: {
  14603. offset: "offsetWidth",
  14604. scroll: "scrollLeft",
  14605. scrollSize: "scrollWidth",
  14606. size: "width",
  14607. key: "horizontal",
  14608. axis: "X",
  14609. client: "clientX",
  14610. direction: "left"
  14611. }
  14612. };
  14613. const renderThumbStyle$1 = ({
  14614. move,
  14615. size,
  14616. bar
  14617. }) => ({
  14618. [bar.size]: size,
  14619. transform: `translate${bar.axis}(${move}%)`
  14620. });
  14621. const scrollbarContextKey = Symbol("scrollbarContextKey");
  14622. const thumbProps = buildProps({
  14623. vertical: Boolean,
  14624. size: String,
  14625. move: Number,
  14626. ratio: {
  14627. type: Number,
  14628. required: true
  14629. },
  14630. always: Boolean
  14631. });
  14632. const COMPONENT_NAME$l = "Thumb";
  14633. const _sfc_main$2p = /* @__PURE__ */ vue.defineComponent({
  14634. __name: "thumb",
  14635. props: thumbProps,
  14636. setup(__props) {
  14637. const props = __props;
  14638. const scrollbar = vue.inject(scrollbarContextKey);
  14639. const ns = useNamespace("scrollbar");
  14640. if (!scrollbar)
  14641. throwError(COMPONENT_NAME$l, "can not inject scrollbar context");
  14642. const instance = vue.ref();
  14643. const thumb = vue.ref();
  14644. const thumbState = vue.ref({});
  14645. const visible = vue.ref(false);
  14646. let cursorDown = false;
  14647. let cursorLeave = false;
  14648. let baseScrollHeight = 0;
  14649. let baseScrollWidth = 0;
  14650. let originalOnSelectStart = isClient ? document.onselectstart : null;
  14651. const bar = vue.computed(() => BAR_MAP[props.vertical ? "vertical" : "horizontal"]);
  14652. const thumbStyle = vue.computed(() => renderThumbStyle$1({
  14653. size: props.size,
  14654. move: props.move,
  14655. bar: bar.value
  14656. }));
  14657. const offsetRatio = vue.computed(() => instance.value[bar.value.offset] ** 2 / scrollbar.wrapElement[bar.value.scrollSize] / props.ratio / thumb.value[bar.value.offset]);
  14658. const clickThumbHandler = (e) => {
  14659. var _a;
  14660. e.stopPropagation();
  14661. if (e.ctrlKey || [1, 2].includes(e.button))
  14662. return;
  14663. (_a = window.getSelection()) == null ? void 0 : _a.removeAllRanges();
  14664. startDrag(e);
  14665. const el = e.currentTarget;
  14666. if (!el)
  14667. return;
  14668. thumbState.value[bar.value.axis] = el[bar.value.offset] - (e[bar.value.client] - el.getBoundingClientRect()[bar.value.direction]);
  14669. };
  14670. const clickTrackHandler = (e) => {
  14671. if (!thumb.value || !instance.value || !scrollbar.wrapElement)
  14672. return;
  14673. const offset = Math.abs(e.target.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]);
  14674. const thumbHalf = thumb.value[bar.value.offset] / 2;
  14675. const thumbPositionPercentage = (offset - thumbHalf) * 100 * offsetRatio.value / instance.value[bar.value.offset];
  14676. scrollbar.wrapElement[bar.value.scroll] = thumbPositionPercentage * scrollbar.wrapElement[bar.value.scrollSize] / 100;
  14677. };
  14678. const startDrag = (e) => {
  14679. e.stopImmediatePropagation();
  14680. cursorDown = true;
  14681. baseScrollHeight = scrollbar.wrapElement.scrollHeight;
  14682. baseScrollWidth = scrollbar.wrapElement.scrollWidth;
  14683. document.addEventListener("mousemove", mouseMoveDocumentHandler);
  14684. document.addEventListener("mouseup", mouseUpDocumentHandler);
  14685. originalOnSelectStart = document.onselectstart;
  14686. document.onselectstart = () => false;
  14687. };
  14688. const mouseMoveDocumentHandler = (e) => {
  14689. if (!instance.value || !thumb.value)
  14690. return;
  14691. if (cursorDown === false)
  14692. return;
  14693. const prevPage = thumbState.value[bar.value.axis];
  14694. if (!prevPage)
  14695. return;
  14696. const offset = (instance.value.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]) * -1;
  14697. const thumbClickPosition = thumb.value[bar.value.offset] - prevPage;
  14698. const thumbPositionPercentage = (offset - thumbClickPosition) * 100 * offsetRatio.value / instance.value[bar.value.offset];
  14699. if (bar.value.scroll === "scrollLeft") {
  14700. scrollbar.wrapElement[bar.value.scroll] = thumbPositionPercentage * baseScrollWidth / 100;
  14701. } else {
  14702. scrollbar.wrapElement[bar.value.scroll] = thumbPositionPercentage * baseScrollHeight / 100;
  14703. }
  14704. };
  14705. const mouseUpDocumentHandler = () => {
  14706. cursorDown = false;
  14707. thumbState.value[bar.value.axis] = 0;
  14708. document.removeEventListener("mousemove", mouseMoveDocumentHandler);
  14709. document.removeEventListener("mouseup", mouseUpDocumentHandler);
  14710. restoreOnselectstart();
  14711. if (cursorLeave)
  14712. visible.value = false;
  14713. };
  14714. const mouseMoveScrollbarHandler = () => {
  14715. cursorLeave = false;
  14716. visible.value = !!props.size;
  14717. };
  14718. const mouseLeaveScrollbarHandler = () => {
  14719. cursorLeave = true;
  14720. visible.value = cursorDown;
  14721. };
  14722. vue.onBeforeUnmount(() => {
  14723. restoreOnselectstart();
  14724. document.removeEventListener("mouseup", mouseUpDocumentHandler);
  14725. });
  14726. const restoreOnselectstart = () => {
  14727. if (document.onselectstart !== originalOnSelectStart)
  14728. document.onselectstart = originalOnSelectStart;
  14729. };
  14730. useEventListener(vue.toRef(scrollbar, "scrollbarElement"), "mousemove", mouseMoveScrollbarHandler);
  14731. useEventListener(vue.toRef(scrollbar, "scrollbarElement"), "mouseleave", mouseLeaveScrollbarHandler);
  14732. return (_ctx, _cache) => {
  14733. return vue.openBlock(), vue.createBlock(vue.Transition, {
  14734. name: vue.unref(ns).b("fade"),
  14735. persisted: ""
  14736. }, {
  14737. default: vue.withCtx(() => [
  14738. vue.withDirectives(vue.createElementVNode("div", {
  14739. ref_key: "instance",
  14740. ref: instance,
  14741. class: vue.normalizeClass([vue.unref(ns).e("bar"), vue.unref(ns).is(vue.unref(bar).key)]),
  14742. onMousedown: clickTrackHandler,
  14743. onClick: vue.withModifiers(() => {
  14744. }, ["stop"])
  14745. }, [
  14746. vue.createElementVNode("div", {
  14747. ref_key: "thumb",
  14748. ref: thumb,
  14749. class: vue.normalizeClass(vue.unref(ns).e("thumb")),
  14750. style: vue.normalizeStyle(vue.unref(thumbStyle)),
  14751. onMousedown: clickThumbHandler
  14752. }, null, 38)
  14753. ], 42, ["onClick"]), [
  14754. [vue.vShow, _ctx.always || visible.value]
  14755. ])
  14756. ]),
  14757. _: 1
  14758. }, 8, ["name"]);
  14759. };
  14760. }
  14761. });
  14762. var Thumb = /* @__PURE__ */ _export_sfc(_sfc_main$2p, [["__file", "thumb.vue"]]);
  14763. const barProps = buildProps({
  14764. always: {
  14765. type: Boolean,
  14766. default: true
  14767. },
  14768. minSize: {
  14769. type: Number,
  14770. required: true
  14771. }
  14772. });
  14773. const _sfc_main$2o = /* @__PURE__ */ vue.defineComponent({
  14774. __name: "bar",
  14775. props: barProps,
  14776. setup(__props, { expose }) {
  14777. const props = __props;
  14778. const scrollbar = vue.inject(scrollbarContextKey);
  14779. const moveX = vue.ref(0);
  14780. const moveY = vue.ref(0);
  14781. const sizeWidth = vue.ref("");
  14782. const sizeHeight = vue.ref("");
  14783. const ratioY = vue.ref(1);
  14784. const ratioX = vue.ref(1);
  14785. const handleScroll = (wrap) => {
  14786. if (wrap) {
  14787. const offsetHeight = wrap.offsetHeight - GAP;
  14788. const offsetWidth = wrap.offsetWidth - GAP;
  14789. moveY.value = wrap.scrollTop * 100 / offsetHeight * ratioY.value;
  14790. moveX.value = wrap.scrollLeft * 100 / offsetWidth * ratioX.value;
  14791. }
  14792. };
  14793. const update = () => {
  14794. const wrap = scrollbar == null ? void 0 : scrollbar.wrapElement;
  14795. if (!wrap)
  14796. return;
  14797. const offsetHeight = wrap.offsetHeight - GAP;
  14798. const offsetWidth = wrap.offsetWidth - GAP;
  14799. const originalHeight = offsetHeight ** 2 / wrap.scrollHeight;
  14800. const originalWidth = offsetWidth ** 2 / wrap.scrollWidth;
  14801. const height = Math.max(originalHeight, props.minSize);
  14802. const width = Math.max(originalWidth, props.minSize);
  14803. ratioY.value = originalHeight / (offsetHeight - originalHeight) / (height / (offsetHeight - height));
  14804. ratioX.value = originalWidth / (offsetWidth - originalWidth) / (width / (offsetWidth - width));
  14805. sizeHeight.value = height + GAP < offsetHeight ? `${height}px` : "";
  14806. sizeWidth.value = width + GAP < offsetWidth ? `${width}px` : "";
  14807. };
  14808. expose({
  14809. handleScroll,
  14810. update
  14811. });
  14812. return (_ctx, _cache) => {
  14813. return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
  14814. vue.createVNode(Thumb, {
  14815. move: moveX.value,
  14816. ratio: ratioX.value,
  14817. size: sizeWidth.value,
  14818. always: _ctx.always
  14819. }, null, 8, ["move", "ratio", "size", "always"]),
  14820. vue.createVNode(Thumb, {
  14821. move: moveY.value,
  14822. ratio: ratioY.value,
  14823. size: sizeHeight.value,
  14824. vertical: "",
  14825. always: _ctx.always
  14826. }, null, 8, ["move", "ratio", "size", "always"])
  14827. ], 64);
  14828. };
  14829. }
  14830. });
  14831. var Bar = /* @__PURE__ */ _export_sfc(_sfc_main$2o, [["__file", "bar.vue"]]);
  14832. const scrollbarProps = buildProps({
  14833. distance: {
  14834. type: Number,
  14835. default: 0
  14836. },
  14837. height: {
  14838. type: [String, Number],
  14839. default: ""
  14840. },
  14841. maxHeight: {
  14842. type: [String, Number],
  14843. default: ""
  14844. },
  14845. native: Boolean,
  14846. wrapStyle: {
  14847. type: definePropType([String, Object, Array]),
  14848. default: ""
  14849. },
  14850. wrapClass: {
  14851. type: [String, Array],
  14852. default: ""
  14853. },
  14854. viewClass: {
  14855. type: [String, Array],
  14856. default: ""
  14857. },
  14858. viewStyle: {
  14859. type: [String, Array, Object],
  14860. default: ""
  14861. },
  14862. noresize: Boolean,
  14863. tag: {
  14864. type: String,
  14865. default: "div"
  14866. },
  14867. always: Boolean,
  14868. minSize: {
  14869. type: Number,
  14870. default: 20
  14871. },
  14872. tabindex: {
  14873. type: [String, Number],
  14874. default: void 0
  14875. },
  14876. id: String,
  14877. role: String,
  14878. ...useAriaProps(["ariaLabel", "ariaOrientation"])
  14879. });
  14880. const scrollbarEmits = {
  14881. "end-reached": (direction) => ["left", "right", "top", "bottom"].includes(direction),
  14882. scroll: ({
  14883. scrollTop,
  14884. scrollLeft
  14885. }) => [scrollTop, scrollLeft].every(isNumber)
  14886. };
  14887. const COMPONENT_NAME$k = "ElScrollbar";
  14888. const __default__$1S = vue.defineComponent({
  14889. name: COMPONENT_NAME$k
  14890. });
  14891. const _sfc_main$2n = /* @__PURE__ */ vue.defineComponent({
  14892. ...__default__$1S,
  14893. props: scrollbarProps,
  14894. emits: scrollbarEmits,
  14895. setup(__props, { expose, emit }) {
  14896. const props = __props;
  14897. const ns = useNamespace("scrollbar");
  14898. let stopResizeObserver = void 0;
  14899. let stopWrapResizeObserver = void 0;
  14900. let stopResizeListener = void 0;
  14901. let wrapScrollTop = 0;
  14902. let wrapScrollLeft = 0;
  14903. let direction = "";
  14904. const distanceScrollState = {
  14905. bottom: false,
  14906. top: false,
  14907. right: false,
  14908. left: false
  14909. };
  14910. const scrollbarRef = vue.ref();
  14911. const wrapRef = vue.ref();
  14912. const resizeRef = vue.ref();
  14913. const barRef = vue.ref();
  14914. const wrapStyle = vue.computed(() => {
  14915. const style = {};
  14916. if (props.height)
  14917. style.height = addUnit(props.height);
  14918. if (props.maxHeight)
  14919. style.maxHeight = addUnit(props.maxHeight);
  14920. return [props.wrapStyle, style];
  14921. });
  14922. const wrapKls = vue.computed(() => {
  14923. return [
  14924. props.wrapClass,
  14925. ns.e("wrap"),
  14926. { [ns.em("wrap", "hidden-default")]: !props.native }
  14927. ];
  14928. });
  14929. const resizeKls = vue.computed(() => {
  14930. return [ns.e("view"), props.viewClass];
  14931. });
  14932. const shouldSkipDirection = (direction2) => {
  14933. var _a;
  14934. return (_a = distanceScrollState[direction2]) != null ? _a : false;
  14935. };
  14936. const DIRECTION_PAIRS = {
  14937. top: "bottom",
  14938. bottom: "top",
  14939. left: "right",
  14940. right: "left"
  14941. };
  14942. const updateTriggerStatus = (arrivedStates) => {
  14943. const oppositeDirection = DIRECTION_PAIRS[direction];
  14944. if (!oppositeDirection)
  14945. return;
  14946. const arrived = arrivedStates[direction];
  14947. const oppositeArrived = arrivedStates[oppositeDirection];
  14948. if (arrived && !distanceScrollState[direction]) {
  14949. distanceScrollState[direction] = true;
  14950. }
  14951. if (!oppositeArrived && distanceScrollState[oppositeDirection]) {
  14952. distanceScrollState[oppositeDirection] = false;
  14953. }
  14954. };
  14955. const handleScroll = () => {
  14956. var _a;
  14957. if (wrapRef.value) {
  14958. (_a = barRef.value) == null ? void 0 : _a.handleScroll(wrapRef.value);
  14959. const prevTop = wrapScrollTop;
  14960. const prevLeft = wrapScrollLeft;
  14961. wrapScrollTop = wrapRef.value.scrollTop;
  14962. wrapScrollLeft = wrapRef.value.scrollLeft;
  14963. const arrivedStates = {
  14964. bottom: wrapScrollTop + wrapRef.value.clientHeight >= wrapRef.value.scrollHeight - props.distance,
  14965. top: wrapScrollTop <= props.distance && prevTop !== 0,
  14966. right: wrapScrollLeft + wrapRef.value.clientWidth >= wrapRef.value.scrollWidth - props.distance && prevLeft !== wrapScrollLeft,
  14967. left: wrapScrollLeft <= props.distance && prevLeft !== 0
  14968. };
  14969. emit("scroll", {
  14970. scrollTop: wrapScrollTop,
  14971. scrollLeft: wrapScrollLeft
  14972. });
  14973. if (prevTop !== wrapScrollTop) {
  14974. direction = wrapScrollTop > prevTop ? "bottom" : "top";
  14975. }
  14976. if (prevLeft !== wrapScrollLeft) {
  14977. direction = wrapScrollLeft > prevLeft ? "right" : "left";
  14978. }
  14979. if (props.distance > 0) {
  14980. if (shouldSkipDirection(direction)) {
  14981. return;
  14982. }
  14983. updateTriggerStatus(arrivedStates);
  14984. }
  14985. if (arrivedStates[direction])
  14986. emit("end-reached", direction);
  14987. }
  14988. };
  14989. function scrollTo(arg1, arg2) {
  14990. if (isObject$1(arg1)) {
  14991. wrapRef.value.scrollTo(arg1);
  14992. } else if (isNumber(arg1) && isNumber(arg2)) {
  14993. wrapRef.value.scrollTo(arg1, arg2);
  14994. }
  14995. }
  14996. const setScrollTop = (value) => {
  14997. if (!isNumber(value)) {
  14998. debugWarn(COMPONENT_NAME$k, "value must be a number");
  14999. return;
  15000. }
  15001. wrapRef.value.scrollTop = value;
  15002. };
  15003. const setScrollLeft = (value) => {
  15004. if (!isNumber(value)) {
  15005. debugWarn(COMPONENT_NAME$k, "value must be a number");
  15006. return;
  15007. }
  15008. wrapRef.value.scrollLeft = value;
  15009. };
  15010. const update = () => {
  15011. var _a;
  15012. (_a = barRef.value) == null ? void 0 : _a.update();
  15013. distanceScrollState[direction] = false;
  15014. };
  15015. vue.watch(() => props.noresize, (noresize) => {
  15016. if (noresize) {
  15017. stopResizeObserver == null ? void 0 : stopResizeObserver();
  15018. stopWrapResizeObserver == null ? void 0 : stopWrapResizeObserver();
  15019. stopResizeListener == null ? void 0 : stopResizeListener();
  15020. } else {
  15021. ({ stop: stopResizeObserver } = useResizeObserver(resizeRef, update));
  15022. ({ stop: stopWrapResizeObserver } = useResizeObserver(wrapRef, update));
  15023. stopResizeListener = useEventListener("resize", update);
  15024. }
  15025. }, { immediate: true });
  15026. vue.watch(() => [props.maxHeight, props.height], () => {
  15027. if (!props.native)
  15028. vue.nextTick(() => {
  15029. var _a;
  15030. update();
  15031. if (wrapRef.value) {
  15032. (_a = barRef.value) == null ? void 0 : _a.handleScroll(wrapRef.value);
  15033. }
  15034. });
  15035. });
  15036. vue.provide(scrollbarContextKey, vue.reactive({
  15037. scrollbarElement: scrollbarRef,
  15038. wrapElement: wrapRef
  15039. }));
  15040. vue.onActivated(() => {
  15041. if (wrapRef.value) {
  15042. wrapRef.value.scrollTop = wrapScrollTop;
  15043. wrapRef.value.scrollLeft = wrapScrollLeft;
  15044. }
  15045. });
  15046. vue.onMounted(() => {
  15047. if (!props.native)
  15048. vue.nextTick(() => {
  15049. update();
  15050. });
  15051. });
  15052. vue.onUpdated(() => update());
  15053. expose({
  15054. wrapRef,
  15055. update,
  15056. scrollTo,
  15057. setScrollTop,
  15058. setScrollLeft,
  15059. handleScroll
  15060. });
  15061. return (_ctx, _cache) => {
  15062. return vue.openBlock(), vue.createElementBlock("div", {
  15063. ref_key: "scrollbarRef",
  15064. ref: scrollbarRef,
  15065. class: vue.normalizeClass(vue.unref(ns).b())
  15066. }, [
  15067. vue.createElementVNode("div", {
  15068. ref_key: "wrapRef",
  15069. ref: wrapRef,
  15070. class: vue.normalizeClass(vue.unref(wrapKls)),
  15071. style: vue.normalizeStyle(vue.unref(wrapStyle)),
  15072. tabindex: _ctx.tabindex,
  15073. onScroll: handleScroll
  15074. }, [
  15075. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.tag), {
  15076. id: _ctx.id,
  15077. ref_key: "resizeRef",
  15078. ref: resizeRef,
  15079. class: vue.normalizeClass(vue.unref(resizeKls)),
  15080. style: vue.normalizeStyle(_ctx.viewStyle),
  15081. role: _ctx.role,
  15082. "aria-label": _ctx.ariaLabel,
  15083. "aria-orientation": _ctx.ariaOrientation
  15084. }, {
  15085. default: vue.withCtx(() => [
  15086. vue.renderSlot(_ctx.$slots, "default")
  15087. ]),
  15088. _: 3
  15089. }, 8, ["id", "class", "style", "role", "aria-label", "aria-orientation"]))
  15090. ], 46, ["tabindex"]),
  15091. !_ctx.native ? (vue.openBlock(), vue.createBlock(Bar, {
  15092. key: 0,
  15093. ref_key: "barRef",
  15094. ref: barRef,
  15095. always: _ctx.always,
  15096. "min-size": _ctx.minSize
  15097. }, null, 8, ["always", "min-size"])) : vue.createCommentVNode("v-if", true)
  15098. ], 2);
  15099. };
  15100. }
  15101. });
  15102. var Scrollbar$1 = /* @__PURE__ */ _export_sfc(_sfc_main$2n, [["__file", "scrollbar.vue"]]);
  15103. const ElScrollbar = withInstall(Scrollbar$1);
  15104. const POPPER_INJECTION_KEY = Symbol("popper");
  15105. const POPPER_CONTENT_INJECTION_KEY = Symbol("popperContent");
  15106. const Effect = {
  15107. LIGHT: "light",
  15108. DARK: "dark"
  15109. };
  15110. const roleTypes = [
  15111. "dialog",
  15112. "grid",
  15113. "group",
  15114. "listbox",
  15115. "menu",
  15116. "navigation",
  15117. "tooltip",
  15118. "tree"
  15119. ];
  15120. const popperProps = buildProps({
  15121. role: {
  15122. type: String,
  15123. values: roleTypes,
  15124. default: "tooltip"
  15125. }
  15126. });
  15127. const usePopperProps = popperProps;
  15128. const __default__$1R = vue.defineComponent({
  15129. name: "ElPopper",
  15130. inheritAttrs: false
  15131. });
  15132. const _sfc_main$2m = /* @__PURE__ */ vue.defineComponent({
  15133. ...__default__$1R,
  15134. props: popperProps,
  15135. setup(__props, { expose }) {
  15136. const props = __props;
  15137. const triggerRef = vue.ref();
  15138. const popperInstanceRef = vue.ref();
  15139. const contentRef = vue.ref();
  15140. const referenceRef = vue.ref();
  15141. const role = vue.computed(() => props.role);
  15142. const popperProvides = {
  15143. triggerRef,
  15144. popperInstanceRef,
  15145. contentRef,
  15146. referenceRef,
  15147. role
  15148. };
  15149. expose(popperProvides);
  15150. vue.provide(POPPER_INJECTION_KEY, popperProvides);
  15151. return (_ctx, _cache) => {
  15152. return vue.renderSlot(_ctx.$slots, "default");
  15153. };
  15154. }
  15155. });
  15156. var Popper = /* @__PURE__ */ _export_sfc(_sfc_main$2m, [["__file", "popper.vue"]]);
  15157. const __default__$1Q = vue.defineComponent({
  15158. name: "ElPopperArrow",
  15159. inheritAttrs: false
  15160. });
  15161. const _sfc_main$2l = /* @__PURE__ */ vue.defineComponent({
  15162. ...__default__$1Q,
  15163. setup(__props, { expose }) {
  15164. const ns = useNamespace("popper");
  15165. const { arrowRef, arrowStyle } = vue.inject(POPPER_CONTENT_INJECTION_KEY, void 0);
  15166. vue.onBeforeUnmount(() => {
  15167. arrowRef.value = void 0;
  15168. });
  15169. expose({
  15170. arrowRef
  15171. });
  15172. return (_ctx, _cache) => {
  15173. return vue.openBlock(), vue.createElementBlock("span", {
  15174. ref_key: "arrowRef",
  15175. ref: arrowRef,
  15176. class: vue.normalizeClass(vue.unref(ns).e("arrow")),
  15177. style: vue.normalizeStyle(vue.unref(arrowStyle)),
  15178. "data-popper-arrow": ""
  15179. }, null, 6);
  15180. };
  15181. }
  15182. });
  15183. var ElPopperArrow = /* @__PURE__ */ _export_sfc(_sfc_main$2l, [["__file", "arrow.vue"]]);
  15184. const NAME = "ElOnlyChild";
  15185. const OnlyChild = vue.defineComponent({
  15186. name: NAME,
  15187. setup(_, {
  15188. slots,
  15189. attrs
  15190. }) {
  15191. var _a;
  15192. const forwardRefInjection = vue.inject(FORWARD_REF_INJECTION_KEY);
  15193. const forwardRefDirective = useForwardRefDirective((_a = forwardRefInjection == null ? void 0 : forwardRefInjection.setForwardRef) != null ? _a : NOOP);
  15194. return () => {
  15195. var _a2;
  15196. const defaultSlot = (_a2 = slots.default) == null ? void 0 : _a2.call(slots, attrs);
  15197. if (!defaultSlot)
  15198. return null;
  15199. const [firstLegitNode, length] = findFirstLegitChild(defaultSlot);
  15200. if (!firstLegitNode) {
  15201. debugWarn(NAME, "no valid child node found");
  15202. return null;
  15203. }
  15204. if (length > 1) {
  15205. debugWarn(NAME, "requires exact only one valid child.");
  15206. }
  15207. return vue.withDirectives(vue.cloneVNode(firstLegitNode, attrs), [[forwardRefDirective]]);
  15208. };
  15209. }
  15210. });
  15211. function findFirstLegitChild(node) {
  15212. if (!node)
  15213. return [null, 0];
  15214. const children = node;
  15215. const len = children.filter((c) => c.type !== vue.Comment).length;
  15216. for (const child of children) {
  15217. if (isObject$1(child)) {
  15218. switch (child.type) {
  15219. case vue.Comment:
  15220. continue;
  15221. case vue.Text:
  15222. case "svg":
  15223. return [wrapTextContent(child), len];
  15224. case vue.Fragment:
  15225. return findFirstLegitChild(child.children);
  15226. default:
  15227. return [child, len];
  15228. }
  15229. }
  15230. return [wrapTextContent(child), len];
  15231. }
  15232. return [null, 0];
  15233. }
  15234. function wrapTextContent(s) {
  15235. const ns = useNamespace("only-child");
  15236. return vue.createVNode("span", {
  15237. "class": ns.e("content")
  15238. }, [s]);
  15239. }
  15240. const popperTriggerProps = buildProps({
  15241. virtualRef: {
  15242. type: definePropType(Object)
  15243. },
  15244. virtualTriggering: Boolean,
  15245. onMouseenter: {
  15246. type: definePropType(Function)
  15247. },
  15248. onMouseleave: {
  15249. type: definePropType(Function)
  15250. },
  15251. onClick: {
  15252. type: definePropType(Function)
  15253. },
  15254. onKeydown: {
  15255. type: definePropType(Function)
  15256. },
  15257. onFocus: {
  15258. type: definePropType(Function)
  15259. },
  15260. onBlur: {
  15261. type: definePropType(Function)
  15262. },
  15263. onContextmenu: {
  15264. type: definePropType(Function)
  15265. },
  15266. id: String,
  15267. open: Boolean
  15268. });
  15269. const usePopperTriggerProps = popperTriggerProps;
  15270. const __default__$1P = vue.defineComponent({
  15271. name: "ElPopperTrigger",
  15272. inheritAttrs: false
  15273. });
  15274. const _sfc_main$2k = /* @__PURE__ */ vue.defineComponent({
  15275. ...__default__$1P,
  15276. props: popperTriggerProps,
  15277. setup(__props, { expose }) {
  15278. const props = __props;
  15279. const { role, triggerRef } = vue.inject(POPPER_INJECTION_KEY, void 0);
  15280. useForwardRef(triggerRef);
  15281. const ariaControls = vue.computed(() => {
  15282. return ariaHaspopup.value ? props.id : void 0;
  15283. });
  15284. const ariaDescribedby = vue.computed(() => {
  15285. if (role && role.value === "tooltip") {
  15286. return props.open && props.id ? props.id : void 0;
  15287. }
  15288. return void 0;
  15289. });
  15290. const ariaHaspopup = vue.computed(() => {
  15291. if (role && role.value !== "tooltip") {
  15292. return role.value;
  15293. }
  15294. return void 0;
  15295. });
  15296. const ariaExpanded = vue.computed(() => {
  15297. return ariaHaspopup.value ? `${props.open}` : void 0;
  15298. });
  15299. let virtualTriggerAriaStopWatch = void 0;
  15300. const TRIGGER_ELE_EVENTS = [
  15301. "onMouseenter",
  15302. "onMouseleave",
  15303. "onClick",
  15304. "onKeydown",
  15305. "onFocus",
  15306. "onBlur",
  15307. "onContextmenu"
  15308. ];
  15309. vue.onMounted(() => {
  15310. vue.watch(() => props.virtualRef, (virtualEl) => {
  15311. if (virtualEl) {
  15312. triggerRef.value = unrefElement(virtualEl);
  15313. }
  15314. }, {
  15315. immediate: true
  15316. });
  15317. vue.watch(triggerRef, (el, prevEl) => {
  15318. virtualTriggerAriaStopWatch == null ? void 0 : virtualTriggerAriaStopWatch();
  15319. virtualTriggerAriaStopWatch = void 0;
  15320. if (isElement$2(el)) {
  15321. TRIGGER_ELE_EVENTS.forEach((eventName) => {
  15322. var _a;
  15323. const handler = props[eventName];
  15324. if (handler) {
  15325. el.addEventListener(eventName.slice(2).toLowerCase(), handler, ["onFocus", "onBlur"].includes(eventName));
  15326. (_a = prevEl == null ? void 0 : prevEl.removeEventListener) == null ? void 0 : _a.call(prevEl, eventName.slice(2).toLowerCase(), handler, ["onFocus", "onBlur"].includes(eventName));
  15327. }
  15328. });
  15329. if (isFocusable(el)) {
  15330. virtualTriggerAriaStopWatch = vue.watch([ariaControls, ariaDescribedby, ariaHaspopup, ariaExpanded], (watches) => {
  15331. [
  15332. "aria-controls",
  15333. "aria-describedby",
  15334. "aria-haspopup",
  15335. "aria-expanded"
  15336. ].forEach((key, idx) => {
  15337. isNil(watches[idx]) ? el.removeAttribute(key) : el.setAttribute(key, watches[idx]);
  15338. });
  15339. }, { immediate: true });
  15340. }
  15341. }
  15342. if (isElement$2(prevEl) && isFocusable(prevEl)) {
  15343. [
  15344. "aria-controls",
  15345. "aria-describedby",
  15346. "aria-haspopup",
  15347. "aria-expanded"
  15348. ].forEach((key) => prevEl.removeAttribute(key));
  15349. }
  15350. }, {
  15351. immediate: true
  15352. });
  15353. });
  15354. vue.onBeforeUnmount(() => {
  15355. virtualTriggerAriaStopWatch == null ? void 0 : virtualTriggerAriaStopWatch();
  15356. virtualTriggerAriaStopWatch = void 0;
  15357. if (triggerRef.value && isElement$2(triggerRef.value)) {
  15358. const el = triggerRef.value;
  15359. TRIGGER_ELE_EVENTS.forEach((eventName) => {
  15360. const handler = props[eventName];
  15361. if (handler) {
  15362. el.removeEventListener(eventName.slice(2).toLowerCase(), handler, ["onFocus", "onBlur"].includes(eventName));
  15363. }
  15364. });
  15365. triggerRef.value = void 0;
  15366. }
  15367. });
  15368. expose({
  15369. triggerRef
  15370. });
  15371. return (_ctx, _cache) => {
  15372. return !_ctx.virtualTriggering ? (vue.openBlock(), vue.createBlock(vue.unref(OnlyChild), vue.mergeProps({ key: 0 }, _ctx.$attrs, {
  15373. "aria-controls": vue.unref(ariaControls),
  15374. "aria-describedby": vue.unref(ariaDescribedby),
  15375. "aria-expanded": vue.unref(ariaExpanded),
  15376. "aria-haspopup": vue.unref(ariaHaspopup)
  15377. }), {
  15378. default: vue.withCtx(() => [
  15379. vue.renderSlot(_ctx.$slots, "default")
  15380. ]),
  15381. _: 3
  15382. }, 16, ["aria-controls", "aria-describedby", "aria-expanded", "aria-haspopup"])) : vue.createCommentVNode("v-if", true);
  15383. };
  15384. }
  15385. });
  15386. var ElPopperTrigger = /* @__PURE__ */ _export_sfc(_sfc_main$2k, [["__file", "trigger.vue"]]);
  15387. const FOCUS_AFTER_TRAPPED = "focus-trap.focus-after-trapped";
  15388. const FOCUS_AFTER_RELEASED = "focus-trap.focus-after-released";
  15389. const FOCUSOUT_PREVENTED = "focus-trap.focusout-prevented";
  15390. const FOCUS_AFTER_TRAPPED_OPTS = {
  15391. cancelable: true,
  15392. bubbles: false
  15393. };
  15394. const FOCUSOUT_PREVENTED_OPTS = {
  15395. cancelable: true,
  15396. bubbles: false
  15397. };
  15398. const ON_TRAP_FOCUS_EVT = "focusAfterTrapped";
  15399. const ON_RELEASE_FOCUS_EVT = "focusAfterReleased";
  15400. const FOCUS_TRAP_INJECTION_KEY = Symbol("elFocusTrap");
  15401. const focusReason = vue.ref();
  15402. const lastUserFocusTimestamp = vue.ref(0);
  15403. const lastAutomatedFocusTimestamp = vue.ref(0);
  15404. let focusReasonUserCount = 0;
  15405. const obtainAllFocusableElements = (element) => {
  15406. const nodes = [];
  15407. const walker = document.createTreeWalker(element, NodeFilter.SHOW_ELEMENT, {
  15408. acceptNode: (node) => {
  15409. const isHiddenInput = node.tagName === "INPUT" && node.type === "hidden";
  15410. if (node.disabled || node.hidden || isHiddenInput)
  15411. return NodeFilter.FILTER_SKIP;
  15412. return node.tabIndex >= 0 || node === document.activeElement ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
  15413. }
  15414. });
  15415. while (walker.nextNode())
  15416. nodes.push(walker.currentNode);
  15417. return nodes;
  15418. };
  15419. const getVisibleElement = (elements, container) => {
  15420. for (const element of elements) {
  15421. if (!isHidden(element, container))
  15422. return element;
  15423. }
  15424. };
  15425. const isHidden = (element, container) => {
  15426. if (getComputedStyle(element).visibility === "hidden")
  15427. return true;
  15428. while (element) {
  15429. if (container && element === container)
  15430. return false;
  15431. if (getComputedStyle(element).display === "none")
  15432. return true;
  15433. element = element.parentElement;
  15434. }
  15435. return false;
  15436. };
  15437. const getEdges = (container) => {
  15438. const focusable = obtainAllFocusableElements(container);
  15439. const first = getVisibleElement(focusable, container);
  15440. const last = getVisibleElement(focusable.reverse(), container);
  15441. return [first, last];
  15442. };
  15443. const isSelectable = (element) => {
  15444. return element instanceof HTMLInputElement && "select" in element;
  15445. };
  15446. const tryFocus = (element, shouldSelect) => {
  15447. if (element) {
  15448. const prevFocusedElement = document.activeElement;
  15449. focusElement(element, { preventScroll: true });
  15450. lastAutomatedFocusTimestamp.value = window.performance.now();
  15451. if (element !== prevFocusedElement && isSelectable(element) && shouldSelect) {
  15452. element.select();
  15453. }
  15454. }
  15455. };
  15456. function removeFromStack(list, item) {
  15457. const copy = [...list];
  15458. const idx = list.indexOf(item);
  15459. if (idx !== -1) {
  15460. copy.splice(idx, 1);
  15461. }
  15462. return copy;
  15463. }
  15464. const createFocusableStack = () => {
  15465. let stack = [];
  15466. const push = (layer) => {
  15467. const currentLayer = stack[0];
  15468. if (currentLayer && layer !== currentLayer) {
  15469. currentLayer.pause();
  15470. }
  15471. stack = removeFromStack(stack, layer);
  15472. stack.unshift(layer);
  15473. };
  15474. const remove = (layer) => {
  15475. var _a, _b;
  15476. stack = removeFromStack(stack, layer);
  15477. (_b = (_a = stack[0]) == null ? void 0 : _a.resume) == null ? void 0 : _b.call(_a);
  15478. };
  15479. return {
  15480. push,
  15481. remove
  15482. };
  15483. };
  15484. const focusFirstDescendant = (elements, shouldSelect = false) => {
  15485. const prevFocusedElement = document.activeElement;
  15486. for (const element of elements) {
  15487. tryFocus(element, shouldSelect);
  15488. if (document.activeElement !== prevFocusedElement)
  15489. return;
  15490. }
  15491. };
  15492. const focusableStack = createFocusableStack();
  15493. const isFocusCausedByUserEvent = () => {
  15494. return lastUserFocusTimestamp.value > lastAutomatedFocusTimestamp.value;
  15495. };
  15496. const notifyFocusReasonPointer = () => {
  15497. focusReason.value = "pointer";
  15498. lastUserFocusTimestamp.value = window.performance.now();
  15499. };
  15500. const notifyFocusReasonKeydown = () => {
  15501. focusReason.value = "keyboard";
  15502. lastUserFocusTimestamp.value = window.performance.now();
  15503. };
  15504. const useFocusReason = () => {
  15505. vue.onMounted(() => {
  15506. if (focusReasonUserCount === 0) {
  15507. document.addEventListener("mousedown", notifyFocusReasonPointer);
  15508. document.addEventListener("touchstart", notifyFocusReasonPointer);
  15509. document.addEventListener("keydown", notifyFocusReasonKeydown);
  15510. }
  15511. focusReasonUserCount++;
  15512. });
  15513. vue.onBeforeUnmount(() => {
  15514. focusReasonUserCount--;
  15515. if (focusReasonUserCount <= 0) {
  15516. document.removeEventListener("mousedown", notifyFocusReasonPointer);
  15517. document.removeEventListener("touchstart", notifyFocusReasonPointer);
  15518. document.removeEventListener("keydown", notifyFocusReasonKeydown);
  15519. }
  15520. });
  15521. return {
  15522. focusReason,
  15523. lastUserFocusTimestamp,
  15524. lastAutomatedFocusTimestamp
  15525. };
  15526. };
  15527. const createFocusOutPreventedEvent = (detail) => {
  15528. return new CustomEvent(FOCUSOUT_PREVENTED, {
  15529. ...FOCUSOUT_PREVENTED_OPTS,
  15530. detail
  15531. });
  15532. };
  15533. const _sfc_main$2j = vue.defineComponent({
  15534. name: "ElFocusTrap",
  15535. inheritAttrs: false,
  15536. props: {
  15537. loop: Boolean,
  15538. trapped: Boolean,
  15539. focusTrapEl: Object,
  15540. focusStartEl: {
  15541. type: [Object, String],
  15542. default: "first"
  15543. }
  15544. },
  15545. emits: [
  15546. ON_TRAP_FOCUS_EVT,
  15547. ON_RELEASE_FOCUS_EVT,
  15548. "focusin",
  15549. "focusout",
  15550. "focusout-prevented",
  15551. "release-requested"
  15552. ],
  15553. setup(props, { emit }) {
  15554. const forwardRef = vue.ref();
  15555. let lastFocusBeforeTrapped;
  15556. let lastFocusAfterTrapped;
  15557. const { focusReason } = useFocusReason();
  15558. useEscapeKeydown((event) => {
  15559. if (props.trapped && !focusLayer.paused) {
  15560. emit("release-requested", event);
  15561. }
  15562. });
  15563. const focusLayer = {
  15564. paused: false,
  15565. pause() {
  15566. this.paused = true;
  15567. },
  15568. resume() {
  15569. this.paused = false;
  15570. }
  15571. };
  15572. const onKeydown = (e) => {
  15573. if (!props.loop && !props.trapped)
  15574. return;
  15575. if (focusLayer.paused)
  15576. return;
  15577. const { altKey, ctrlKey, metaKey, currentTarget, shiftKey } = e;
  15578. const { loop } = props;
  15579. const code = getEventCode(e);
  15580. const isTabbing = code === EVENT_CODE.tab && !altKey && !ctrlKey && !metaKey;
  15581. const currentFocusingEl = document.activeElement;
  15582. if (isTabbing && currentFocusingEl) {
  15583. const container = currentTarget;
  15584. const [first, last] = getEdges(container);
  15585. const isTabbable = first && last;
  15586. if (!isTabbable) {
  15587. if (currentFocusingEl === container) {
  15588. const focusoutPreventedEvent = createFocusOutPreventedEvent({
  15589. focusReason: focusReason.value
  15590. });
  15591. emit("focusout-prevented", focusoutPreventedEvent);
  15592. if (!focusoutPreventedEvent.defaultPrevented) {
  15593. e.preventDefault();
  15594. }
  15595. }
  15596. } else {
  15597. if (!shiftKey && currentFocusingEl === last) {
  15598. const focusoutPreventedEvent = createFocusOutPreventedEvent({
  15599. focusReason: focusReason.value
  15600. });
  15601. emit("focusout-prevented", focusoutPreventedEvent);
  15602. if (!focusoutPreventedEvent.defaultPrevented) {
  15603. e.preventDefault();
  15604. if (loop)
  15605. tryFocus(first, true);
  15606. }
  15607. } else if (shiftKey && [first, container].includes(currentFocusingEl)) {
  15608. const focusoutPreventedEvent = createFocusOutPreventedEvent({
  15609. focusReason: focusReason.value
  15610. });
  15611. emit("focusout-prevented", focusoutPreventedEvent);
  15612. if (!focusoutPreventedEvent.defaultPrevented) {
  15613. e.preventDefault();
  15614. if (loop)
  15615. tryFocus(last, true);
  15616. }
  15617. }
  15618. }
  15619. }
  15620. };
  15621. vue.provide(FOCUS_TRAP_INJECTION_KEY, {
  15622. focusTrapRef: forwardRef,
  15623. onKeydown
  15624. });
  15625. vue.watch(() => props.focusTrapEl, (focusTrapEl) => {
  15626. if (focusTrapEl) {
  15627. forwardRef.value = focusTrapEl;
  15628. }
  15629. }, { immediate: true });
  15630. vue.watch([forwardRef], ([forwardRef2], [oldForwardRef]) => {
  15631. if (forwardRef2) {
  15632. forwardRef2.addEventListener("keydown", onKeydown);
  15633. forwardRef2.addEventListener("focusin", onFocusIn);
  15634. forwardRef2.addEventListener("focusout", onFocusOut);
  15635. }
  15636. if (oldForwardRef) {
  15637. oldForwardRef.removeEventListener("keydown", onKeydown);
  15638. oldForwardRef.removeEventListener("focusin", onFocusIn);
  15639. oldForwardRef.removeEventListener("focusout", onFocusOut);
  15640. }
  15641. });
  15642. const trapOnFocus = (e) => {
  15643. emit(ON_TRAP_FOCUS_EVT, e);
  15644. };
  15645. const releaseOnFocus = (e) => emit(ON_RELEASE_FOCUS_EVT, e);
  15646. const onFocusIn = (e) => {
  15647. const trapContainer = vue.unref(forwardRef);
  15648. if (!trapContainer)
  15649. return;
  15650. const target = e.target;
  15651. const relatedTarget = e.relatedTarget;
  15652. const isFocusedInTrap = target && trapContainer.contains(target);
  15653. if (!props.trapped) {
  15654. const isPrevFocusedInTrap = relatedTarget && trapContainer.contains(relatedTarget);
  15655. if (!isPrevFocusedInTrap) {
  15656. lastFocusBeforeTrapped = relatedTarget;
  15657. }
  15658. }
  15659. if (isFocusedInTrap)
  15660. emit("focusin", e);
  15661. if (focusLayer.paused)
  15662. return;
  15663. if (props.trapped) {
  15664. if (isFocusedInTrap) {
  15665. lastFocusAfterTrapped = target;
  15666. } else {
  15667. tryFocus(lastFocusAfterTrapped, true);
  15668. }
  15669. }
  15670. };
  15671. const onFocusOut = (e) => {
  15672. const trapContainer = vue.unref(forwardRef);
  15673. if (focusLayer.paused || !trapContainer)
  15674. return;
  15675. if (props.trapped) {
  15676. const relatedTarget = e.relatedTarget;
  15677. if (!isNil(relatedTarget) && !trapContainer.contains(relatedTarget)) {
  15678. setTimeout(() => {
  15679. if (!focusLayer.paused && props.trapped) {
  15680. const focusoutPreventedEvent = createFocusOutPreventedEvent({
  15681. focusReason: focusReason.value
  15682. });
  15683. emit("focusout-prevented", focusoutPreventedEvent);
  15684. if (!focusoutPreventedEvent.defaultPrevented) {
  15685. tryFocus(lastFocusAfterTrapped, true);
  15686. }
  15687. }
  15688. }, 0);
  15689. }
  15690. } else {
  15691. const target = e.target;
  15692. const isFocusedInTrap = target && trapContainer.contains(target);
  15693. if (!isFocusedInTrap)
  15694. emit("focusout", e);
  15695. }
  15696. };
  15697. async function startTrap() {
  15698. await vue.nextTick();
  15699. const trapContainer = vue.unref(forwardRef);
  15700. if (trapContainer) {
  15701. focusableStack.push(focusLayer);
  15702. const prevFocusedElement = trapContainer.contains(document.activeElement) ? lastFocusBeforeTrapped : document.activeElement;
  15703. lastFocusBeforeTrapped = prevFocusedElement;
  15704. const isPrevFocusContained = trapContainer.contains(prevFocusedElement);
  15705. if (!isPrevFocusContained) {
  15706. const focusEvent = new Event(FOCUS_AFTER_TRAPPED, FOCUS_AFTER_TRAPPED_OPTS);
  15707. trapContainer.addEventListener(FOCUS_AFTER_TRAPPED, trapOnFocus);
  15708. trapContainer.dispatchEvent(focusEvent);
  15709. if (!focusEvent.defaultPrevented) {
  15710. vue.nextTick(() => {
  15711. let focusStartEl = props.focusStartEl;
  15712. if (!isString$1(focusStartEl)) {
  15713. tryFocus(focusStartEl);
  15714. if (document.activeElement !== focusStartEl) {
  15715. focusStartEl = "first";
  15716. }
  15717. }
  15718. if (focusStartEl === "first") {
  15719. focusFirstDescendant(obtainAllFocusableElements(trapContainer), true);
  15720. }
  15721. if (document.activeElement === prevFocusedElement || focusStartEl === "container") {
  15722. tryFocus(trapContainer);
  15723. }
  15724. });
  15725. }
  15726. }
  15727. }
  15728. }
  15729. function stopTrap() {
  15730. const trapContainer = vue.unref(forwardRef);
  15731. if (trapContainer) {
  15732. trapContainer.removeEventListener(FOCUS_AFTER_TRAPPED, trapOnFocus);
  15733. const releasedEvent = new CustomEvent(FOCUS_AFTER_RELEASED, {
  15734. ...FOCUS_AFTER_TRAPPED_OPTS,
  15735. detail: {
  15736. focusReason: focusReason.value
  15737. }
  15738. });
  15739. trapContainer.addEventListener(FOCUS_AFTER_RELEASED, releaseOnFocus);
  15740. trapContainer.dispatchEvent(releasedEvent);
  15741. if (!releasedEvent.defaultPrevented && (focusReason.value == "keyboard" || !isFocusCausedByUserEvent() || trapContainer.contains(document.activeElement))) {
  15742. tryFocus(lastFocusBeforeTrapped != null ? lastFocusBeforeTrapped : document.body);
  15743. }
  15744. trapContainer.removeEventListener(FOCUS_AFTER_RELEASED, releaseOnFocus);
  15745. focusableStack.remove(focusLayer);
  15746. lastFocusBeforeTrapped = null;
  15747. lastFocusAfterTrapped = null;
  15748. }
  15749. }
  15750. vue.onMounted(() => {
  15751. if (props.trapped) {
  15752. startTrap();
  15753. }
  15754. vue.watch(() => props.trapped, (trapped) => {
  15755. if (trapped) {
  15756. startTrap();
  15757. } else {
  15758. stopTrap();
  15759. }
  15760. });
  15761. });
  15762. vue.onBeforeUnmount(() => {
  15763. if (props.trapped) {
  15764. stopTrap();
  15765. }
  15766. if (forwardRef.value) {
  15767. forwardRef.value.removeEventListener("keydown", onKeydown);
  15768. forwardRef.value.removeEventListener("focusin", onFocusIn);
  15769. forwardRef.value.removeEventListener("focusout", onFocusOut);
  15770. forwardRef.value = void 0;
  15771. }
  15772. });
  15773. return {
  15774. onKeydown
  15775. };
  15776. }
  15777. });
  15778. function _sfc_render$l(_ctx, _cache, $props, $setup, $data, $options) {
  15779. return vue.renderSlot(_ctx.$slots, "default", { handleKeydown: _ctx.onKeydown });
  15780. }
  15781. var ElFocusTrap = /* @__PURE__ */ _export_sfc(_sfc_main$2j, [["render", _sfc_render$l], ["__file", "focus-trap.vue"]]);
  15782. const popperArrowProps = buildProps({
  15783. arrowOffset: {
  15784. type: Number,
  15785. default: 5
  15786. }
  15787. });
  15788. const usePopperArrowProps = popperArrowProps;
  15789. const POSITIONING_STRATEGIES = ["fixed", "absolute"];
  15790. const popperCoreConfigProps = buildProps({
  15791. boundariesPadding: {
  15792. type: Number,
  15793. default: 0
  15794. },
  15795. fallbackPlacements: {
  15796. type: definePropType(Array),
  15797. default: void 0
  15798. },
  15799. gpuAcceleration: {
  15800. type: Boolean,
  15801. default: true
  15802. },
  15803. offset: {
  15804. type: Number,
  15805. default: 12
  15806. },
  15807. placement: {
  15808. type: String,
  15809. values: Ee,
  15810. default: "bottom"
  15811. },
  15812. popperOptions: {
  15813. type: definePropType(Object),
  15814. default: () => ({})
  15815. },
  15816. strategy: {
  15817. type: String,
  15818. values: POSITIONING_STRATEGIES,
  15819. default: "absolute"
  15820. }
  15821. });
  15822. const popperContentProps = buildProps({
  15823. ...popperCoreConfigProps,
  15824. ...popperArrowProps,
  15825. id: String,
  15826. style: {
  15827. type: definePropType([String, Array, Object])
  15828. },
  15829. className: {
  15830. type: definePropType([String, Array, Object])
  15831. },
  15832. effect: {
  15833. type: definePropType(String),
  15834. default: "dark"
  15835. },
  15836. visible: Boolean,
  15837. enterable: {
  15838. type: Boolean,
  15839. default: true
  15840. },
  15841. pure: Boolean,
  15842. focusOnShow: Boolean,
  15843. trapping: Boolean,
  15844. popperClass: {
  15845. type: definePropType([String, Array, Object])
  15846. },
  15847. popperStyle: {
  15848. type: definePropType([String, Array, Object])
  15849. },
  15850. referenceEl: {
  15851. type: definePropType(Object)
  15852. },
  15853. triggerTargetEl: {
  15854. type: definePropType(Object)
  15855. },
  15856. stopPopperMouseEvent: {
  15857. type: Boolean,
  15858. default: true
  15859. },
  15860. virtualTriggering: Boolean,
  15861. zIndex: Number,
  15862. ...useAriaProps(["ariaLabel"]),
  15863. loop: Boolean
  15864. });
  15865. const popperContentEmits = {
  15866. mouseenter: (evt) => evt instanceof MouseEvent,
  15867. mouseleave: (evt) => evt instanceof MouseEvent,
  15868. focus: () => true,
  15869. blur: () => true,
  15870. close: () => true
  15871. };
  15872. const usePopperCoreConfigProps = popperCoreConfigProps;
  15873. const usePopperContentProps = popperContentProps;
  15874. const usePopperContentEmits = popperContentEmits;
  15875. const buildPopperOptions = (props, modifiers = []) => {
  15876. const { placement, strategy, popperOptions } = props;
  15877. const options = {
  15878. placement,
  15879. strategy,
  15880. ...popperOptions,
  15881. modifiers: [...genModifiers(props), ...modifiers]
  15882. };
  15883. deriveExtraModifiers(options, popperOptions == null ? void 0 : popperOptions.modifiers);
  15884. return options;
  15885. };
  15886. const unwrapMeasurableEl = ($el) => {
  15887. if (!isClient)
  15888. return;
  15889. return unrefElement($el);
  15890. };
  15891. function genModifiers(options) {
  15892. const { offset, gpuAcceleration, fallbackPlacements } = options;
  15893. return [
  15894. {
  15895. name: "offset",
  15896. options: {
  15897. offset: [0, offset != null ? offset : 12]
  15898. }
  15899. },
  15900. {
  15901. name: "preventOverflow",
  15902. options: {
  15903. padding: {
  15904. top: 0,
  15905. bottom: 0,
  15906. left: 0,
  15907. right: 0
  15908. }
  15909. }
  15910. },
  15911. {
  15912. name: "flip",
  15913. options: {
  15914. padding: 5,
  15915. fallbackPlacements
  15916. }
  15917. },
  15918. {
  15919. name: "computeStyles",
  15920. options: {
  15921. gpuAcceleration
  15922. }
  15923. }
  15924. ];
  15925. }
  15926. function deriveExtraModifiers(options, modifiers) {
  15927. if (modifiers) {
  15928. options.modifiers = [...options.modifiers, ...modifiers != null ? modifiers : []];
  15929. }
  15930. }
  15931. const DEFAULT_ARROW_OFFSET = 0;
  15932. const usePopperContent = (props) => {
  15933. const { popperInstanceRef, contentRef, triggerRef, role } = vue.inject(POPPER_INJECTION_KEY, void 0);
  15934. const arrowRef = vue.ref();
  15935. const arrowOffset = vue.computed(() => props.arrowOffset);
  15936. const eventListenerModifier = vue.computed(() => {
  15937. return {
  15938. name: "eventListeners",
  15939. enabled: !!props.visible
  15940. };
  15941. });
  15942. const arrowModifier = vue.computed(() => {
  15943. var _a;
  15944. const arrowEl = vue.unref(arrowRef);
  15945. const offset = (_a = vue.unref(arrowOffset)) != null ? _a : DEFAULT_ARROW_OFFSET;
  15946. return {
  15947. name: "arrow",
  15948. enabled: !isUndefined$1(arrowEl),
  15949. options: {
  15950. element: arrowEl,
  15951. padding: offset
  15952. }
  15953. };
  15954. });
  15955. const options = vue.computed(() => {
  15956. return {
  15957. onFirstUpdate: () => {
  15958. update();
  15959. },
  15960. ...buildPopperOptions(props, [
  15961. vue.unref(arrowModifier),
  15962. vue.unref(eventListenerModifier)
  15963. ])
  15964. };
  15965. });
  15966. const computedReference = vue.computed(() => unwrapMeasurableEl(props.referenceEl) || vue.unref(triggerRef));
  15967. const { attributes, state, styles, update, forceUpdate, instanceRef } = usePopper(computedReference, contentRef, options);
  15968. vue.watch(instanceRef, (instance) => popperInstanceRef.value = instance, {
  15969. flush: "sync"
  15970. });
  15971. vue.onMounted(() => {
  15972. vue.watch(() => {
  15973. var _a, _b;
  15974. return (_b = (_a = vue.unref(computedReference)) == null ? void 0 : _a.getBoundingClientRect) == null ? void 0 : _b.call(_a);
  15975. }, () => {
  15976. update();
  15977. });
  15978. });
  15979. return {
  15980. attributes,
  15981. arrowRef,
  15982. contentRef,
  15983. instanceRef,
  15984. state,
  15985. styles,
  15986. role,
  15987. forceUpdate,
  15988. update
  15989. };
  15990. };
  15991. const usePopperContentDOM = (props, {
  15992. attributes,
  15993. styles,
  15994. role
  15995. }) => {
  15996. const { nextZIndex } = useZIndex();
  15997. const ns = useNamespace("popper");
  15998. const contentAttrs = vue.computed(() => vue.unref(attributes).popper);
  15999. const contentZIndex = vue.ref(isNumber(props.zIndex) ? props.zIndex : nextZIndex());
  16000. const contentClass = vue.computed(() => [
  16001. ns.b(),
  16002. ns.is("pure", props.pure),
  16003. ns.is(props.effect),
  16004. props.popperClass
  16005. ]);
  16006. const contentStyle = vue.computed(() => {
  16007. return [
  16008. { zIndex: vue.unref(contentZIndex) },
  16009. vue.unref(styles).popper,
  16010. props.popperStyle || {}
  16011. ];
  16012. });
  16013. const ariaModal = vue.computed(() => role.value === "dialog" ? "false" : void 0);
  16014. const arrowStyle = vue.computed(() => vue.unref(styles).arrow || {});
  16015. const updateZIndex = () => {
  16016. contentZIndex.value = isNumber(props.zIndex) ? props.zIndex : nextZIndex();
  16017. };
  16018. return {
  16019. ariaModal,
  16020. arrowStyle,
  16021. contentAttrs,
  16022. contentClass,
  16023. contentStyle,
  16024. contentZIndex,
  16025. updateZIndex
  16026. };
  16027. };
  16028. const usePopperContentFocusTrap = (props, emit) => {
  16029. const trapped = vue.ref(false);
  16030. const focusStartRef = vue.ref();
  16031. const onFocusAfterTrapped = () => {
  16032. emit("focus");
  16033. };
  16034. const onFocusAfterReleased = (event) => {
  16035. var _a;
  16036. if (((_a = event.detail) == null ? void 0 : _a.focusReason) !== "pointer") {
  16037. focusStartRef.value = "first";
  16038. emit("blur");
  16039. }
  16040. };
  16041. const onFocusInTrap = (event) => {
  16042. if (props.visible && !trapped.value) {
  16043. if (event.target) {
  16044. focusStartRef.value = event.target;
  16045. }
  16046. trapped.value = true;
  16047. }
  16048. };
  16049. const onFocusoutPrevented = (event) => {
  16050. if (!props.trapping) {
  16051. if (event.detail.focusReason === "pointer") {
  16052. event.preventDefault();
  16053. }
  16054. trapped.value = false;
  16055. }
  16056. };
  16057. const onReleaseRequested = () => {
  16058. trapped.value = false;
  16059. emit("close");
  16060. };
  16061. return {
  16062. focusStartRef,
  16063. trapped,
  16064. onFocusAfterReleased,
  16065. onFocusAfterTrapped,
  16066. onFocusInTrap,
  16067. onFocusoutPrevented,
  16068. onReleaseRequested
  16069. };
  16070. };
  16071. const __default__$1O = vue.defineComponent({
  16072. name: "ElPopperContent"
  16073. });
  16074. const _sfc_main$2i = /* @__PURE__ */ vue.defineComponent({
  16075. ...__default__$1O,
  16076. props: popperContentProps,
  16077. emits: popperContentEmits,
  16078. setup(__props, { expose, emit }) {
  16079. const props = __props;
  16080. const {
  16081. focusStartRef,
  16082. trapped,
  16083. onFocusAfterReleased,
  16084. onFocusAfterTrapped,
  16085. onFocusInTrap,
  16086. onFocusoutPrevented,
  16087. onReleaseRequested
  16088. } = usePopperContentFocusTrap(props, emit);
  16089. const { attributes, arrowRef, contentRef, styles, instanceRef, role, update } = usePopperContent(props);
  16090. const {
  16091. ariaModal,
  16092. arrowStyle,
  16093. contentAttrs,
  16094. contentClass,
  16095. contentStyle,
  16096. updateZIndex
  16097. } = usePopperContentDOM(props, {
  16098. styles,
  16099. attributes,
  16100. role
  16101. });
  16102. const formItemContext = vue.inject(formItemContextKey, void 0);
  16103. vue.provide(POPPER_CONTENT_INJECTION_KEY, {
  16104. arrowStyle,
  16105. arrowRef
  16106. });
  16107. if (formItemContext) {
  16108. vue.provide(formItemContextKey, {
  16109. ...formItemContext,
  16110. addInputId: NOOP,
  16111. removeInputId: NOOP
  16112. });
  16113. }
  16114. let triggerTargetAriaStopWatch = void 0;
  16115. const updatePopper = (shouldUpdateZIndex = true) => {
  16116. update();
  16117. shouldUpdateZIndex && updateZIndex();
  16118. };
  16119. const togglePopperAlive = () => {
  16120. updatePopper(false);
  16121. if (props.visible && props.focusOnShow) {
  16122. trapped.value = true;
  16123. } else if (props.visible === false) {
  16124. trapped.value = false;
  16125. }
  16126. };
  16127. vue.onMounted(() => {
  16128. vue.watch(() => props.triggerTargetEl, (triggerTargetEl, prevTriggerTargetEl) => {
  16129. triggerTargetAriaStopWatch == null ? void 0 : triggerTargetAriaStopWatch();
  16130. triggerTargetAriaStopWatch = void 0;
  16131. const el = vue.unref(triggerTargetEl || contentRef.value);
  16132. const prevEl = vue.unref(prevTriggerTargetEl || contentRef.value);
  16133. if (isElement$2(el)) {
  16134. triggerTargetAriaStopWatch = vue.watch([role, () => props.ariaLabel, ariaModal, () => props.id], (watches) => {
  16135. ["role", "aria-label", "aria-modal", "id"].forEach((key, idx) => {
  16136. isNil(watches[idx]) ? el.removeAttribute(key) : el.setAttribute(key, watches[idx]);
  16137. });
  16138. }, { immediate: true });
  16139. }
  16140. if (prevEl !== el && isElement$2(prevEl)) {
  16141. ["role", "aria-label", "aria-modal", "id"].forEach((key) => {
  16142. prevEl.removeAttribute(key);
  16143. });
  16144. }
  16145. }, { immediate: true });
  16146. vue.watch(() => props.visible, togglePopperAlive, { immediate: true });
  16147. });
  16148. vue.onBeforeUnmount(() => {
  16149. triggerTargetAriaStopWatch == null ? void 0 : triggerTargetAriaStopWatch();
  16150. triggerTargetAriaStopWatch = void 0;
  16151. });
  16152. expose({
  16153. popperContentRef: contentRef,
  16154. popperInstanceRef: instanceRef,
  16155. updatePopper,
  16156. contentStyle
  16157. });
  16158. return (_ctx, _cache) => {
  16159. return vue.openBlock(), vue.createElementBlock("div", vue.mergeProps({
  16160. ref_key: "contentRef",
  16161. ref: contentRef
  16162. }, vue.unref(contentAttrs), {
  16163. style: vue.unref(contentStyle),
  16164. class: vue.unref(contentClass),
  16165. tabindex: "-1",
  16166. onMouseenter: (e) => _ctx.$emit("mouseenter", e),
  16167. onMouseleave: (e) => _ctx.$emit("mouseleave", e)
  16168. }), [
  16169. vue.createVNode(vue.unref(ElFocusTrap), {
  16170. loop: _ctx.loop,
  16171. trapped: vue.unref(trapped),
  16172. "trap-on-focus-in": true,
  16173. "focus-trap-el": vue.unref(contentRef),
  16174. "focus-start-el": vue.unref(focusStartRef),
  16175. onFocusAfterTrapped: vue.unref(onFocusAfterTrapped),
  16176. onFocusAfterReleased: vue.unref(onFocusAfterReleased),
  16177. onFocusin: vue.unref(onFocusInTrap),
  16178. onFocusoutPrevented: vue.unref(onFocusoutPrevented),
  16179. onReleaseRequested: vue.unref(onReleaseRequested)
  16180. }, {
  16181. default: vue.withCtx(() => [
  16182. vue.renderSlot(_ctx.$slots, "default")
  16183. ]),
  16184. _: 3
  16185. }, 8, ["loop", "trapped", "focus-trap-el", "focus-start-el", "onFocusAfterTrapped", "onFocusAfterReleased", "onFocusin", "onFocusoutPrevented", "onReleaseRequested"])
  16186. ], 16, ["onMouseenter", "onMouseleave"]);
  16187. };
  16188. }
  16189. });
  16190. var ElPopperContent = /* @__PURE__ */ _export_sfc(_sfc_main$2i, [["__file", "content.vue"]]);
  16191. const ElPopper = withInstall(Popper);
  16192. const TOOLTIP_INJECTION_KEY = Symbol("elTooltip");
  16193. const teleportProps = buildProps({
  16194. to: {
  16195. type: definePropType([String, Object]),
  16196. required: true
  16197. },
  16198. disabled: Boolean
  16199. });
  16200. const _sfc_main$2h = /* @__PURE__ */ vue.defineComponent({
  16201. __name: "teleport",
  16202. props: teleportProps,
  16203. setup(__props) {
  16204. return (_ctx, _cache) => {
  16205. return _ctx.disabled ? vue.renderSlot(_ctx.$slots, "default", { key: 0 }) : (vue.openBlock(), vue.createBlock(vue.Teleport, {
  16206. key: 1,
  16207. to: _ctx.to
  16208. }, [
  16209. vue.renderSlot(_ctx.$slots, "default")
  16210. ], 8, ["to"]));
  16211. };
  16212. }
  16213. });
  16214. var Teleport = /* @__PURE__ */ _export_sfc(_sfc_main$2h, [["__file", "teleport.vue"]]);
  16215. const ElTeleport = withInstall(Teleport);
  16216. var ElTeleport$1 = ElTeleport;
  16217. const useTooltipContentProps = buildProps({
  16218. ...useDelayedToggleProps,
  16219. ...popperContentProps,
  16220. appendTo: {
  16221. type: teleportProps.to.type
  16222. },
  16223. content: {
  16224. type: String,
  16225. default: ""
  16226. },
  16227. rawContent: Boolean,
  16228. persistent: Boolean,
  16229. visible: {
  16230. type: definePropType(Boolean),
  16231. default: null
  16232. },
  16233. transition: String,
  16234. teleported: {
  16235. type: Boolean,
  16236. default: true
  16237. },
  16238. disabled: Boolean,
  16239. ...useAriaProps(["ariaLabel"])
  16240. });
  16241. const useTooltipTriggerProps = buildProps({
  16242. ...popperTriggerProps,
  16243. disabled: Boolean,
  16244. trigger: {
  16245. type: definePropType([String, Array]),
  16246. default: "hover"
  16247. },
  16248. triggerKeys: {
  16249. type: definePropType(Array),
  16250. default: () => [EVENT_CODE.enter, EVENT_CODE.numpadEnter, EVENT_CODE.space]
  16251. },
  16252. focusOnTarget: Boolean
  16253. });
  16254. const {
  16255. useModelToggleProps: useTooltipModelToggleProps,
  16256. useModelToggleEmits: useTooltipModelToggleEmits,
  16257. useModelToggle: useTooltipModelToggle
  16258. } = createModelToggleComposable("visible");
  16259. const useTooltipProps = buildProps({
  16260. ...popperProps,
  16261. ...useTooltipModelToggleProps,
  16262. ...useTooltipContentProps,
  16263. ...useTooltipTriggerProps,
  16264. ...popperArrowProps,
  16265. showArrow: {
  16266. type: Boolean,
  16267. default: true
  16268. }
  16269. });
  16270. const tooltipEmits = [
  16271. ...useTooltipModelToggleEmits,
  16272. "before-show",
  16273. "before-hide",
  16274. "show",
  16275. "hide",
  16276. "open",
  16277. "close"
  16278. ];
  16279. const isTriggerType = (trigger, type) => {
  16280. if (isArray$1(trigger)) {
  16281. return trigger.includes(type);
  16282. }
  16283. return trigger === type;
  16284. };
  16285. const whenTrigger = (trigger, type, handler) => {
  16286. return (e) => {
  16287. isTriggerType(vue.unref(trigger), type) && handler(e);
  16288. };
  16289. };
  16290. const __default__$1N = vue.defineComponent({
  16291. name: "ElTooltipTrigger"
  16292. });
  16293. const _sfc_main$2g = /* @__PURE__ */ vue.defineComponent({
  16294. ...__default__$1N,
  16295. props: useTooltipTriggerProps,
  16296. setup(__props, { expose }) {
  16297. const props = __props;
  16298. const ns = useNamespace("tooltip");
  16299. const { controlled, id, open, onOpen, onClose, onToggle } = vue.inject(TOOLTIP_INJECTION_KEY, void 0);
  16300. const triggerRef = vue.ref(null);
  16301. const stopWhenControlledOrDisabled = () => {
  16302. if (vue.unref(controlled) || props.disabled) {
  16303. return true;
  16304. }
  16305. };
  16306. const trigger = vue.toRef(props, "trigger");
  16307. const onMouseenter = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "hover", (e) => {
  16308. onOpen(e);
  16309. if (props.focusOnTarget && e.target) {
  16310. vue.nextTick(() => {
  16311. focusElement(e.target, { preventScroll: true });
  16312. });
  16313. }
  16314. }));
  16315. const onMouseleave = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "hover", onClose));
  16316. const onClick = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "click", (e) => {
  16317. if (e.button === 0) {
  16318. onToggle(e);
  16319. }
  16320. }));
  16321. const onFocus = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "focus", onOpen));
  16322. const onBlur = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "focus", onClose));
  16323. const onContextMenu = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "contextmenu", (e) => {
  16324. e.preventDefault();
  16325. onToggle(e);
  16326. }));
  16327. const onKeydown = composeEventHandlers(stopWhenControlledOrDisabled, (e) => {
  16328. const code = getEventCode(e);
  16329. if (props.triggerKeys.includes(code)) {
  16330. e.preventDefault();
  16331. onToggle(e);
  16332. }
  16333. });
  16334. expose({
  16335. triggerRef
  16336. });
  16337. return (_ctx, _cache) => {
  16338. return vue.openBlock(), vue.createBlock(vue.unref(ElPopperTrigger), {
  16339. id: vue.unref(id),
  16340. "virtual-ref": _ctx.virtualRef,
  16341. open: vue.unref(open),
  16342. "virtual-triggering": _ctx.virtualTriggering,
  16343. class: vue.normalizeClass(vue.unref(ns).e("trigger")),
  16344. onBlur: vue.unref(onBlur),
  16345. onClick: vue.unref(onClick),
  16346. onContextmenu: vue.unref(onContextMenu),
  16347. onFocus: vue.unref(onFocus),
  16348. onMouseenter: vue.unref(onMouseenter),
  16349. onMouseleave: vue.unref(onMouseleave),
  16350. onKeydown: vue.unref(onKeydown)
  16351. }, {
  16352. default: vue.withCtx(() => [
  16353. vue.renderSlot(_ctx.$slots, "default")
  16354. ]),
  16355. _: 3
  16356. }, 8, ["id", "virtual-ref", "open", "virtual-triggering", "class", "onBlur", "onClick", "onContextmenu", "onFocus", "onMouseenter", "onMouseleave", "onKeydown"]);
  16357. };
  16358. }
  16359. });
  16360. var ElTooltipTrigger = /* @__PURE__ */ _export_sfc(_sfc_main$2g, [["__file", "trigger.vue"]]);
  16361. const __default__$1M = vue.defineComponent({
  16362. name: "ElTooltipContent",
  16363. inheritAttrs: false
  16364. });
  16365. const _sfc_main$2f = /* @__PURE__ */ vue.defineComponent({
  16366. ...__default__$1M,
  16367. props: useTooltipContentProps,
  16368. setup(__props, { expose }) {
  16369. const props = __props;
  16370. const { selector } = usePopperContainerId();
  16371. const ns = useNamespace("tooltip");
  16372. const contentRef = vue.ref();
  16373. const popperContentRef = computedEager(() => {
  16374. var _a;
  16375. return (_a = contentRef.value) == null ? void 0 : _a.popperContentRef;
  16376. });
  16377. let stopHandle;
  16378. const {
  16379. controlled,
  16380. id,
  16381. open,
  16382. trigger,
  16383. onClose,
  16384. onOpen,
  16385. onShow,
  16386. onHide,
  16387. onBeforeShow,
  16388. onBeforeHide
  16389. } = vue.inject(TOOLTIP_INJECTION_KEY, void 0);
  16390. const transitionClass = vue.computed(() => {
  16391. return props.transition || `${ns.namespace.value}-fade-in-linear`;
  16392. });
  16393. const persistentRef = vue.computed(() => {
  16394. return props.persistent;
  16395. });
  16396. vue.onBeforeUnmount(() => {
  16397. stopHandle == null ? void 0 : stopHandle();
  16398. });
  16399. const shouldRender = vue.computed(() => {
  16400. return vue.unref(persistentRef) ? true : vue.unref(open);
  16401. });
  16402. const shouldShow = vue.computed(() => {
  16403. return props.disabled ? false : vue.unref(open);
  16404. });
  16405. const appendTo = vue.computed(() => {
  16406. return props.appendTo || selector.value;
  16407. });
  16408. const contentStyle = vue.computed(() => {
  16409. var _a;
  16410. return (_a = props.style) != null ? _a : {};
  16411. });
  16412. const ariaHidden = vue.ref(true);
  16413. const onTransitionLeave = () => {
  16414. onHide();
  16415. isFocusInsideContent() && focusElement(document.body, { preventScroll: true });
  16416. ariaHidden.value = true;
  16417. };
  16418. const stopWhenControlled = () => {
  16419. if (vue.unref(controlled))
  16420. return true;
  16421. };
  16422. const onContentEnter = composeEventHandlers(stopWhenControlled, () => {
  16423. if (props.enterable && isTriggerType(vue.unref(trigger), "hover")) {
  16424. onOpen();
  16425. }
  16426. });
  16427. const onContentLeave = composeEventHandlers(stopWhenControlled, () => {
  16428. if (isTriggerType(vue.unref(trigger), "hover")) {
  16429. onClose();
  16430. }
  16431. });
  16432. const onBeforeEnter = () => {
  16433. var _a, _b;
  16434. (_b = (_a = contentRef.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a);
  16435. onBeforeShow == null ? void 0 : onBeforeShow();
  16436. };
  16437. const onBeforeLeave = () => {
  16438. onBeforeHide == null ? void 0 : onBeforeHide();
  16439. };
  16440. const onAfterShow = () => {
  16441. onShow();
  16442. };
  16443. const onBlur = () => {
  16444. if (!props.virtualTriggering) {
  16445. onClose();
  16446. }
  16447. };
  16448. const isFocusInsideContent = (event) => {
  16449. var _a;
  16450. const popperContent = (_a = contentRef.value) == null ? void 0 : _a.popperContentRef;
  16451. const activeElement = (event == null ? void 0 : event.relatedTarget) || document.activeElement;
  16452. return popperContent == null ? void 0 : popperContent.contains(activeElement);
  16453. };
  16454. vue.watch(() => vue.unref(open), (val) => {
  16455. if (!val) {
  16456. stopHandle == null ? void 0 : stopHandle();
  16457. } else {
  16458. ariaHidden.value = false;
  16459. stopHandle = onClickOutside(popperContentRef, () => {
  16460. if (vue.unref(controlled))
  16461. return;
  16462. const needClose = castArray(vue.unref(trigger)).every((item) => {
  16463. return item !== "hover" && item !== "focus";
  16464. });
  16465. if (needClose) {
  16466. onClose();
  16467. }
  16468. }, { detectIframe: true });
  16469. }
  16470. }, {
  16471. flush: "post"
  16472. });
  16473. vue.watch(() => props.content, () => {
  16474. var _a, _b;
  16475. (_b = (_a = contentRef.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a);
  16476. });
  16477. expose({
  16478. contentRef,
  16479. isFocusInsideContent
  16480. });
  16481. return (_ctx, _cache) => {
  16482. return vue.openBlock(), vue.createBlock(vue.unref(ElTeleport$1), {
  16483. disabled: !_ctx.teleported,
  16484. to: vue.unref(appendTo)
  16485. }, {
  16486. default: vue.withCtx(() => [
  16487. vue.unref(shouldRender) || !ariaHidden.value ? (vue.openBlock(), vue.createBlock(vue.Transition, {
  16488. key: 0,
  16489. name: vue.unref(transitionClass),
  16490. appear: !vue.unref(persistentRef),
  16491. onAfterLeave: onTransitionLeave,
  16492. onBeforeEnter,
  16493. onAfterEnter: onAfterShow,
  16494. onBeforeLeave,
  16495. persisted: ""
  16496. }, {
  16497. default: vue.withCtx(() => [
  16498. vue.withDirectives(vue.createVNode(vue.unref(ElPopperContent), vue.mergeProps({
  16499. id: vue.unref(id),
  16500. ref_key: "contentRef",
  16501. ref: contentRef
  16502. }, _ctx.$attrs, {
  16503. "aria-label": _ctx.ariaLabel,
  16504. "aria-hidden": ariaHidden.value,
  16505. "boundaries-padding": _ctx.boundariesPadding,
  16506. "fallback-placements": _ctx.fallbackPlacements,
  16507. "gpu-acceleration": _ctx.gpuAcceleration,
  16508. offset: _ctx.offset,
  16509. placement: _ctx.placement,
  16510. "popper-options": _ctx.popperOptions,
  16511. "arrow-offset": _ctx.arrowOffset,
  16512. strategy: _ctx.strategy,
  16513. effect: _ctx.effect,
  16514. enterable: _ctx.enterable,
  16515. pure: _ctx.pure,
  16516. "popper-class": _ctx.popperClass,
  16517. "popper-style": [_ctx.popperStyle, vue.unref(contentStyle)],
  16518. "reference-el": _ctx.referenceEl,
  16519. "trigger-target-el": _ctx.triggerTargetEl,
  16520. visible: vue.unref(shouldShow),
  16521. "z-index": _ctx.zIndex,
  16522. loop: _ctx.loop,
  16523. onMouseenter: vue.unref(onContentEnter),
  16524. onMouseleave: vue.unref(onContentLeave),
  16525. onBlur,
  16526. onClose: vue.unref(onClose)
  16527. }), {
  16528. default: vue.withCtx(() => [
  16529. vue.renderSlot(_ctx.$slots, "default")
  16530. ]),
  16531. _: 3
  16532. }, 16, ["id", "aria-label", "aria-hidden", "boundaries-padding", "fallback-placements", "gpu-acceleration", "offset", "placement", "popper-options", "arrow-offset", "strategy", "effect", "enterable", "pure", "popper-class", "popper-style", "reference-el", "trigger-target-el", "visible", "z-index", "loop", "onMouseenter", "onMouseleave", "onClose"]), [
  16533. [vue.vShow, vue.unref(shouldShow)]
  16534. ])
  16535. ]),
  16536. _: 3
  16537. }, 8, ["name", "appear"])) : vue.createCommentVNode("v-if", true)
  16538. ]),
  16539. _: 3
  16540. }, 8, ["disabled", "to"]);
  16541. };
  16542. }
  16543. });
  16544. var ElTooltipContent = /* @__PURE__ */ _export_sfc(_sfc_main$2f, [["__file", "content.vue"]]);
  16545. const __default__$1L = vue.defineComponent({
  16546. name: "ElTooltip"
  16547. });
  16548. const _sfc_main$2e = /* @__PURE__ */ vue.defineComponent({
  16549. ...__default__$1L,
  16550. props: useTooltipProps,
  16551. emits: tooltipEmits,
  16552. setup(__props, { expose, emit }) {
  16553. const props = __props;
  16554. usePopperContainer();
  16555. const ns = useNamespace("tooltip");
  16556. const id = useId();
  16557. const popperRef = vue.ref();
  16558. const contentRef = vue.ref();
  16559. const updatePopper = () => {
  16560. var _a;
  16561. const popperComponent = vue.unref(popperRef);
  16562. if (popperComponent) {
  16563. (_a = popperComponent.popperInstanceRef) == null ? void 0 : _a.update();
  16564. }
  16565. };
  16566. const open = vue.ref(false);
  16567. const toggleReason = vue.ref();
  16568. const { show, hide, hasUpdateHandler } = useTooltipModelToggle({
  16569. indicator: open,
  16570. toggleReason
  16571. });
  16572. const { onOpen, onClose } = useDelayedToggle({
  16573. showAfter: vue.toRef(props, "showAfter"),
  16574. hideAfter: vue.toRef(props, "hideAfter"),
  16575. autoClose: vue.toRef(props, "autoClose"),
  16576. open: show,
  16577. close: hide
  16578. });
  16579. const controlled = vue.computed(() => isBoolean(props.visible) && !hasUpdateHandler.value);
  16580. const kls = vue.computed(() => {
  16581. return [ns.b(), props.popperClass];
  16582. });
  16583. vue.provide(TOOLTIP_INJECTION_KEY, {
  16584. controlled,
  16585. id,
  16586. open: vue.readonly(open),
  16587. trigger: vue.toRef(props, "trigger"),
  16588. onOpen,
  16589. onClose,
  16590. onToggle: (event) => {
  16591. if (vue.unref(open)) {
  16592. onClose(event);
  16593. } else {
  16594. onOpen(event);
  16595. }
  16596. },
  16597. onShow: () => {
  16598. emit("show", toggleReason.value);
  16599. },
  16600. onHide: () => {
  16601. emit("hide", toggleReason.value);
  16602. },
  16603. onBeforeShow: () => {
  16604. emit("before-show", toggleReason.value);
  16605. },
  16606. onBeforeHide: () => {
  16607. emit("before-hide", toggleReason.value);
  16608. },
  16609. updatePopper
  16610. });
  16611. vue.watch(() => props.disabled, (disabled) => {
  16612. if (disabled && open.value) {
  16613. open.value = false;
  16614. }
  16615. });
  16616. const isFocusInsideContent = (event) => {
  16617. var _a;
  16618. return (_a = contentRef.value) == null ? void 0 : _a.isFocusInsideContent(event);
  16619. };
  16620. vue.onDeactivated(() => open.value && hide());
  16621. expose({
  16622. popperRef,
  16623. contentRef,
  16624. isFocusInsideContent,
  16625. updatePopper,
  16626. onOpen,
  16627. onClose,
  16628. hide
  16629. });
  16630. return (_ctx, _cache) => {
  16631. return vue.openBlock(), vue.createBlock(vue.unref(ElPopper), {
  16632. ref_key: "popperRef",
  16633. ref: popperRef,
  16634. role: _ctx.role
  16635. }, {
  16636. default: vue.withCtx(() => [
  16637. vue.createVNode(ElTooltipTrigger, {
  16638. disabled: _ctx.disabled,
  16639. trigger: _ctx.trigger,
  16640. "trigger-keys": _ctx.triggerKeys,
  16641. "virtual-ref": _ctx.virtualRef,
  16642. "virtual-triggering": _ctx.virtualTriggering,
  16643. "focus-on-target": _ctx.focusOnTarget
  16644. }, {
  16645. default: vue.withCtx(() => [
  16646. _ctx.$slots.default ? vue.renderSlot(_ctx.$slots, "default", { key: 0 }) : vue.createCommentVNode("v-if", true)
  16647. ]),
  16648. _: 3
  16649. }, 8, ["disabled", "trigger", "trigger-keys", "virtual-ref", "virtual-triggering", "focus-on-target"]),
  16650. vue.createVNode(ElTooltipContent, {
  16651. ref_key: "contentRef",
  16652. ref: contentRef,
  16653. "aria-label": _ctx.ariaLabel,
  16654. "boundaries-padding": _ctx.boundariesPadding,
  16655. content: _ctx.content,
  16656. disabled: _ctx.disabled,
  16657. effect: _ctx.effect,
  16658. enterable: _ctx.enterable,
  16659. "fallback-placements": _ctx.fallbackPlacements,
  16660. "hide-after": _ctx.hideAfter,
  16661. "gpu-acceleration": _ctx.gpuAcceleration,
  16662. offset: _ctx.offset,
  16663. persistent: _ctx.persistent,
  16664. "popper-class": vue.unref(kls),
  16665. "popper-style": _ctx.popperStyle,
  16666. placement: _ctx.placement,
  16667. "popper-options": _ctx.popperOptions,
  16668. "arrow-offset": _ctx.arrowOffset,
  16669. pure: _ctx.pure,
  16670. "raw-content": _ctx.rawContent,
  16671. "reference-el": _ctx.referenceEl,
  16672. "trigger-target-el": _ctx.triggerTargetEl,
  16673. "show-after": _ctx.showAfter,
  16674. strategy: _ctx.strategy,
  16675. teleported: _ctx.teleported,
  16676. transition: _ctx.transition,
  16677. "virtual-triggering": _ctx.virtualTriggering,
  16678. "z-index": _ctx.zIndex,
  16679. "append-to": _ctx.appendTo,
  16680. loop: _ctx.loop
  16681. }, {
  16682. default: vue.withCtx(() => [
  16683. vue.renderSlot(_ctx.$slots, "content", {}, () => [
  16684. _ctx.rawContent ? (vue.openBlock(), vue.createElementBlock("span", {
  16685. key: 0,
  16686. innerHTML: _ctx.content
  16687. }, null, 8, ["innerHTML"])) : (vue.openBlock(), vue.createElementBlock("span", { key: 1 }, vue.toDisplayString(_ctx.content), 1))
  16688. ]),
  16689. _ctx.showArrow ? (vue.openBlock(), vue.createBlock(vue.unref(ElPopperArrow), { key: 0 })) : vue.createCommentVNode("v-if", true)
  16690. ]),
  16691. _: 3
  16692. }, 8, ["aria-label", "boundaries-padding", "content", "disabled", "effect", "enterable", "fallback-placements", "hide-after", "gpu-acceleration", "offset", "persistent", "popper-class", "popper-style", "placement", "popper-options", "arrow-offset", "pure", "raw-content", "reference-el", "trigger-target-el", "show-after", "strategy", "teleported", "transition", "virtual-triggering", "z-index", "append-to", "loop"])
  16693. ]),
  16694. _: 3
  16695. }, 8, ["role"]);
  16696. };
  16697. }
  16698. });
  16699. var Tooltip = /* @__PURE__ */ _export_sfc(_sfc_main$2e, [["__file", "tooltip.vue"]]);
  16700. const ElTooltip = withInstall(Tooltip);
  16701. const autocompleteProps = buildProps({
  16702. ...inputProps,
  16703. valueKey: {
  16704. type: String,
  16705. default: "value"
  16706. },
  16707. modelValue: {
  16708. type: [String, Number],
  16709. default: ""
  16710. },
  16711. debounce: {
  16712. type: Number,
  16713. default: 300
  16714. },
  16715. placement: {
  16716. type: definePropType(String),
  16717. values: [
  16718. "top",
  16719. "top-start",
  16720. "top-end",
  16721. "bottom",
  16722. "bottom-start",
  16723. "bottom-end"
  16724. ],
  16725. default: "bottom-start"
  16726. },
  16727. fetchSuggestions: {
  16728. type: definePropType([Function, Array]),
  16729. default: NOOP
  16730. },
  16731. popperClass: useTooltipContentProps.popperClass,
  16732. popperStyle: useTooltipContentProps.popperStyle,
  16733. triggerOnFocus: {
  16734. type: Boolean,
  16735. default: true
  16736. },
  16737. selectWhenUnmatched: Boolean,
  16738. hideLoading: Boolean,
  16739. teleported: useTooltipContentProps.teleported,
  16740. appendTo: useTooltipContentProps.appendTo,
  16741. highlightFirstItem: Boolean,
  16742. fitInputWidth: Boolean,
  16743. loopNavigation: {
  16744. type: Boolean,
  16745. default: true
  16746. }
  16747. });
  16748. const autocompleteEmits = {
  16749. [UPDATE_MODEL_EVENT]: (value) => isString$1(value) || isNumber(value),
  16750. [INPUT_EVENT]: (value) => isString$1(value) || isNumber(value),
  16751. [CHANGE_EVENT]: (value) => isString$1(value) || isNumber(value),
  16752. focus: (evt) => evt instanceof FocusEvent,
  16753. blur: (evt) => evt instanceof FocusEvent,
  16754. clear: () => true,
  16755. select: (item) => isObject$1(item)
  16756. };
  16757. const COMPONENT_NAME$j = "ElAutocomplete";
  16758. const __default__$1K = vue.defineComponent({
  16759. name: COMPONENT_NAME$j,
  16760. inheritAttrs: false
  16761. });
  16762. const _sfc_main$2d = /* @__PURE__ */ vue.defineComponent({
  16763. ...__default__$1K,
  16764. props: autocompleteProps,
  16765. emits: autocompleteEmits,
  16766. setup(__props, { expose, emit }) {
  16767. const props = __props;
  16768. const passInputProps = vue.computed(() => pick(props, Object.keys(inputProps)));
  16769. const rawAttrs = vue.useAttrs();
  16770. const disabled = useFormDisabled();
  16771. const ns = useNamespace("autocomplete");
  16772. const inputRef = vue.ref();
  16773. const regionRef = vue.ref();
  16774. const popperRef = vue.ref();
  16775. const listboxRef = vue.ref();
  16776. let readonly = false;
  16777. let ignoreFocusEvent = false;
  16778. const suggestions = vue.ref([]);
  16779. const highlightedIndex = vue.ref(-1);
  16780. const dropdownWidth = vue.ref("");
  16781. const activated = vue.ref(false);
  16782. const suggestionDisabled = vue.ref(false);
  16783. const loading = vue.ref(false);
  16784. const listboxId = useId();
  16785. const styles = vue.computed(() => rawAttrs.style);
  16786. const suggestionVisible = vue.computed(() => {
  16787. const isValidData = suggestions.value.length > 0;
  16788. return (isValidData || loading.value) && activated.value;
  16789. });
  16790. const suggestionLoading = vue.computed(() => !props.hideLoading && loading.value);
  16791. const refInput = vue.computed(() => {
  16792. if (inputRef.value) {
  16793. return Array.from(inputRef.value.$el.querySelectorAll("input"));
  16794. }
  16795. return [];
  16796. });
  16797. const onSuggestionShow = () => {
  16798. if (suggestionVisible.value) {
  16799. dropdownWidth.value = `${inputRef.value.$el.offsetWidth}px`;
  16800. }
  16801. };
  16802. const onHide = () => {
  16803. highlightedIndex.value = -1;
  16804. };
  16805. const getData = async (queryString) => {
  16806. if (suggestionDisabled.value)
  16807. return;
  16808. const cb = (suggestionList) => {
  16809. loading.value = false;
  16810. if (suggestionDisabled.value)
  16811. return;
  16812. if (isArray$1(suggestionList)) {
  16813. suggestions.value = suggestionList;
  16814. highlightedIndex.value = props.highlightFirstItem ? 0 : -1;
  16815. } else {
  16816. throwError(COMPONENT_NAME$j, "autocomplete suggestions must be an array");
  16817. }
  16818. };
  16819. loading.value = true;
  16820. if (isArray$1(props.fetchSuggestions)) {
  16821. cb(props.fetchSuggestions);
  16822. } else {
  16823. const result = await props.fetchSuggestions(queryString, cb);
  16824. if (isArray$1(result))
  16825. cb(result);
  16826. }
  16827. };
  16828. const debounce = vue.computed(() => props.debounce);
  16829. const debouncedGetData = useDebounceFn(getData, debounce);
  16830. const handleInput = (value) => {
  16831. const valuePresented = !!value;
  16832. emit(INPUT_EVENT, value);
  16833. emit(UPDATE_MODEL_EVENT, value);
  16834. suggestionDisabled.value = false;
  16835. activated.value || (activated.value = valuePresented);
  16836. if (!props.triggerOnFocus && !value) {
  16837. suggestionDisabled.value = true;
  16838. suggestions.value = [];
  16839. return;
  16840. }
  16841. debouncedGetData(value);
  16842. };
  16843. const handleMouseDown = (event) => {
  16844. var _a;
  16845. if (disabled.value)
  16846. return;
  16847. if (((_a = event.target) == null ? void 0 : _a.tagName) !== "INPUT" || refInput.value.includes(document.activeElement)) {
  16848. activated.value = true;
  16849. }
  16850. };
  16851. const handleChange = (value) => {
  16852. emit(CHANGE_EVENT, value);
  16853. };
  16854. const handleFocus = (evt) => {
  16855. var _a;
  16856. if (!ignoreFocusEvent) {
  16857. activated.value = true;
  16858. emit("focus", evt);
  16859. const queryString = (_a = props.modelValue) != null ? _a : "";
  16860. if (props.triggerOnFocus && !readonly) {
  16861. debouncedGetData(String(queryString));
  16862. }
  16863. } else {
  16864. ignoreFocusEvent = false;
  16865. }
  16866. };
  16867. const handleBlur = (evt) => {
  16868. setTimeout(() => {
  16869. var _a;
  16870. if ((_a = popperRef.value) == null ? void 0 : _a.isFocusInsideContent()) {
  16871. ignoreFocusEvent = true;
  16872. return;
  16873. }
  16874. activated.value && close();
  16875. emit("blur", evt);
  16876. });
  16877. };
  16878. const handleClear = () => {
  16879. activated.value = false;
  16880. emit(UPDATE_MODEL_EVENT, "");
  16881. emit("clear");
  16882. };
  16883. const handleKeyEnter = async () => {
  16884. var _a;
  16885. if ((_a = inputRef.value) == null ? void 0 : _a.isComposing) {
  16886. return;
  16887. }
  16888. if (suggestionVisible.value && highlightedIndex.value >= 0 && highlightedIndex.value < suggestions.value.length) {
  16889. handleSelect(suggestions.value[highlightedIndex.value]);
  16890. } else {
  16891. if (props.selectWhenUnmatched) {
  16892. emit("select", { value: props.modelValue });
  16893. suggestions.value = [];
  16894. highlightedIndex.value = -1;
  16895. }
  16896. activated.value = true;
  16897. debouncedGetData(String(props.modelValue));
  16898. }
  16899. };
  16900. const handleKeyEscape = (evt) => {
  16901. if (suggestionVisible.value) {
  16902. evt.preventDefault();
  16903. evt.stopPropagation();
  16904. close();
  16905. }
  16906. };
  16907. const close = () => {
  16908. activated.value = false;
  16909. };
  16910. const focus = () => {
  16911. var _a;
  16912. (_a = inputRef.value) == null ? void 0 : _a.focus();
  16913. };
  16914. const blur = () => {
  16915. var _a;
  16916. (_a = inputRef.value) == null ? void 0 : _a.blur();
  16917. };
  16918. const handleSelect = async (item) => {
  16919. emit(INPUT_EVENT, item[props.valueKey]);
  16920. emit(UPDATE_MODEL_EVENT, item[props.valueKey]);
  16921. emit("select", item);
  16922. suggestions.value = [];
  16923. highlightedIndex.value = -1;
  16924. };
  16925. const highlight = (index) => {
  16926. var _a, _b;
  16927. if (!suggestionVisible.value || loading.value)
  16928. return;
  16929. if (index < 0) {
  16930. if (!props.loopNavigation) {
  16931. highlightedIndex.value = -1;
  16932. return;
  16933. }
  16934. index = suggestions.value.length - 1;
  16935. }
  16936. if (index >= suggestions.value.length) {
  16937. index = props.loopNavigation ? 0 : suggestions.value.length - 1;
  16938. }
  16939. const [suggestion, suggestionList] = getSuggestionContext();
  16940. const highlightItem = suggestionList[index];
  16941. const scrollTop = suggestion.scrollTop;
  16942. const { offsetTop, scrollHeight } = highlightItem;
  16943. if (offsetTop + scrollHeight > scrollTop + suggestion.clientHeight) {
  16944. suggestion.scrollTop = offsetTop + scrollHeight - suggestion.clientHeight;
  16945. }
  16946. if (offsetTop < scrollTop) {
  16947. suggestion.scrollTop = offsetTop;
  16948. }
  16949. highlightedIndex.value = index;
  16950. (_b = (_a = inputRef.value) == null ? void 0 : _a.ref) == null ? void 0 : _b.setAttribute("aria-activedescendant", `${listboxId.value}-item-${highlightedIndex.value}`);
  16951. };
  16952. const getSuggestionContext = () => {
  16953. const suggestion = regionRef.value.querySelector(`.${ns.be("suggestion", "wrap")}`);
  16954. const suggestionList = suggestion.querySelectorAll(`.${ns.be("suggestion", "list")} li`);
  16955. return [suggestion, suggestionList];
  16956. };
  16957. const stopHandle = onClickOutside(listboxRef, () => {
  16958. var _a;
  16959. if ((_a = popperRef.value) == null ? void 0 : _a.isFocusInsideContent())
  16960. return;
  16961. suggestionVisible.value && close();
  16962. });
  16963. const handleKeydown = (e) => {
  16964. const code = getEventCode(e);
  16965. switch (code) {
  16966. case EVENT_CODE.up:
  16967. e.preventDefault();
  16968. highlight(highlightedIndex.value - 1);
  16969. break;
  16970. case EVENT_CODE.down:
  16971. e.preventDefault();
  16972. highlight(highlightedIndex.value + 1);
  16973. break;
  16974. case EVENT_CODE.enter:
  16975. e.preventDefault();
  16976. handleKeyEnter();
  16977. break;
  16978. case EVENT_CODE.tab:
  16979. close();
  16980. break;
  16981. case EVENT_CODE.esc:
  16982. handleKeyEscape(e);
  16983. break;
  16984. case EVENT_CODE.home:
  16985. e.preventDefault();
  16986. highlight(0);
  16987. break;
  16988. case EVENT_CODE.end:
  16989. e.preventDefault();
  16990. highlight(suggestions.value.length - 1);
  16991. break;
  16992. case EVENT_CODE.pageUp:
  16993. e.preventDefault();
  16994. highlight(Math.max(0, highlightedIndex.value - 10));
  16995. break;
  16996. case EVENT_CODE.pageDown:
  16997. e.preventDefault();
  16998. highlight(Math.min(suggestions.value.length - 1, highlightedIndex.value + 10));
  16999. break;
  17000. }
  17001. };
  17002. vue.onBeforeUnmount(() => {
  17003. stopHandle == null ? void 0 : stopHandle();
  17004. });
  17005. vue.onMounted(() => {
  17006. var _a;
  17007. const inputElement = (_a = inputRef.value) == null ? void 0 : _a.ref;
  17008. if (!inputElement)
  17009. return;
  17010. [
  17011. { key: "role", value: "textbox" },
  17012. { key: "aria-autocomplete", value: "list" },
  17013. { key: "aria-controls", value: "id" },
  17014. {
  17015. key: "aria-activedescendant",
  17016. value: `${listboxId.value}-item-${highlightedIndex.value}`
  17017. }
  17018. ].forEach(({ key, value }) => inputElement.setAttribute(key, value));
  17019. readonly = inputElement.hasAttribute("readonly");
  17020. });
  17021. expose({
  17022. highlightedIndex,
  17023. activated,
  17024. loading,
  17025. inputRef,
  17026. popperRef,
  17027. suggestions,
  17028. handleSelect,
  17029. handleKeyEnter,
  17030. focus,
  17031. blur,
  17032. close,
  17033. highlight,
  17034. getData
  17035. });
  17036. return (_ctx, _cache) => {
  17037. return vue.openBlock(), vue.createBlock(vue.unref(ElTooltip), {
  17038. ref_key: "popperRef",
  17039. ref: popperRef,
  17040. visible: vue.unref(suggestionVisible),
  17041. placement: _ctx.placement,
  17042. "fallback-placements": ["bottom-start", "top-start"],
  17043. "popper-class": [vue.unref(ns).e("popper"), _ctx.popperClass],
  17044. "popper-style": _ctx.popperStyle,
  17045. teleported: _ctx.teleported,
  17046. "append-to": _ctx.appendTo,
  17047. "gpu-acceleration": false,
  17048. pure: "",
  17049. "manual-mode": "",
  17050. effect: "light",
  17051. trigger: "click",
  17052. transition: `${vue.unref(ns).namespace.value}-zoom-in-top`,
  17053. persistent: "",
  17054. role: "listbox",
  17055. onBeforeShow: onSuggestionShow,
  17056. onHide
  17057. }, {
  17058. content: vue.withCtx(() => [
  17059. vue.createElementVNode("div", {
  17060. ref_key: "regionRef",
  17061. ref: regionRef,
  17062. class: vue.normalizeClass([vue.unref(ns).b("suggestion"), vue.unref(ns).is("loading", vue.unref(suggestionLoading))]),
  17063. style: vue.normalizeStyle({
  17064. [_ctx.fitInputWidth ? "width" : "minWidth"]: dropdownWidth.value,
  17065. outline: "none"
  17066. }),
  17067. role: "region"
  17068. }, [
  17069. _ctx.$slots.header ? (vue.openBlock(), vue.createElementBlock("div", {
  17070. key: 0,
  17071. class: vue.normalizeClass(vue.unref(ns).be("suggestion", "header")),
  17072. onClick: vue.withModifiers(() => {
  17073. }, ["stop"])
  17074. }, [
  17075. vue.renderSlot(_ctx.$slots, "header")
  17076. ], 10, ["onClick"])) : vue.createCommentVNode("v-if", true),
  17077. vue.createVNode(vue.unref(ElScrollbar), {
  17078. id: vue.unref(listboxId),
  17079. tag: "ul",
  17080. "wrap-class": vue.unref(ns).be("suggestion", "wrap"),
  17081. "view-class": vue.unref(ns).be("suggestion", "list"),
  17082. role: "listbox"
  17083. }, {
  17084. default: vue.withCtx(() => [
  17085. vue.unref(suggestionLoading) ? (vue.openBlock(), vue.createElementBlock("li", { key: 0 }, [
  17086. vue.renderSlot(_ctx.$slots, "loading", {}, () => [
  17087. vue.createVNode(vue.unref(ElIcon), {
  17088. class: vue.normalizeClass(vue.unref(ns).is("loading"))
  17089. }, {
  17090. default: vue.withCtx(() => [
  17091. vue.createVNode(vue.unref(loading_default))
  17092. ]),
  17093. _: 1
  17094. }, 8, ["class"])
  17095. ])
  17096. ])) : (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 1 }, vue.renderList(suggestions.value, (item, index) => {
  17097. return vue.openBlock(), vue.createElementBlock("li", {
  17098. id: `${vue.unref(listboxId)}-item-${index}`,
  17099. key: index,
  17100. class: vue.normalizeClass({ highlighted: highlightedIndex.value === index }),
  17101. role: "option",
  17102. "aria-selected": highlightedIndex.value === index,
  17103. onClick: ($event) => handleSelect(item)
  17104. }, [
  17105. vue.renderSlot(_ctx.$slots, "default", { item }, () => [
  17106. vue.createTextVNode(vue.toDisplayString(item[_ctx.valueKey]), 1)
  17107. ])
  17108. ], 10, ["id", "aria-selected", "onClick"]);
  17109. }), 128))
  17110. ]),
  17111. _: 3
  17112. }, 8, ["id", "wrap-class", "view-class"]),
  17113. _ctx.$slots.footer ? (vue.openBlock(), vue.createElementBlock("div", {
  17114. key: 1,
  17115. class: vue.normalizeClass(vue.unref(ns).be("suggestion", "footer")),
  17116. onClick: vue.withModifiers(() => {
  17117. }, ["stop"])
  17118. }, [
  17119. vue.renderSlot(_ctx.$slots, "footer")
  17120. ], 10, ["onClick"])) : vue.createCommentVNode("v-if", true)
  17121. ], 6)
  17122. ]),
  17123. default: vue.withCtx(() => [
  17124. vue.createElementVNode("div", {
  17125. ref_key: "listboxRef",
  17126. ref: listboxRef,
  17127. class: vue.normalizeClass([vue.unref(ns).b(), _ctx.$attrs.class]),
  17128. style: vue.normalizeStyle(vue.unref(styles)),
  17129. role: "combobox",
  17130. "aria-haspopup": "listbox",
  17131. "aria-expanded": vue.unref(suggestionVisible),
  17132. "aria-owns": vue.unref(listboxId)
  17133. }, [
  17134. vue.createVNode(vue.unref(ElInput), vue.mergeProps({
  17135. ref_key: "inputRef",
  17136. ref: inputRef
  17137. }, vue.mergeProps(vue.unref(passInputProps), _ctx.$attrs), {
  17138. "model-value": _ctx.modelValue,
  17139. disabled: vue.unref(disabled),
  17140. onInput: handleInput,
  17141. onChange: handleChange,
  17142. onFocus: handleFocus,
  17143. onBlur: handleBlur,
  17144. onClear: handleClear,
  17145. onKeydown: handleKeydown,
  17146. onMousedown: handleMouseDown
  17147. }), vue.createSlots({
  17148. _: 2
  17149. }, [
  17150. _ctx.$slots.prepend ? {
  17151. name: "prepend",
  17152. fn: vue.withCtx(() => [
  17153. vue.renderSlot(_ctx.$slots, "prepend")
  17154. ])
  17155. } : void 0,
  17156. _ctx.$slots.append ? {
  17157. name: "append",
  17158. fn: vue.withCtx(() => [
  17159. vue.renderSlot(_ctx.$slots, "append")
  17160. ])
  17161. } : void 0,
  17162. _ctx.$slots.prefix ? {
  17163. name: "prefix",
  17164. fn: vue.withCtx(() => [
  17165. vue.renderSlot(_ctx.$slots, "prefix")
  17166. ])
  17167. } : void 0,
  17168. _ctx.$slots.suffix ? {
  17169. name: "suffix",
  17170. fn: vue.withCtx(() => [
  17171. vue.renderSlot(_ctx.$slots, "suffix")
  17172. ])
  17173. } : void 0
  17174. ]), 1040, ["model-value", "disabled"])
  17175. ], 14, ["aria-expanded", "aria-owns"])
  17176. ]),
  17177. _: 3
  17178. }, 8, ["visible", "placement", "popper-class", "popper-style", "teleported", "append-to", "transition"]);
  17179. };
  17180. }
  17181. });
  17182. var Autocomplete = /* @__PURE__ */ _export_sfc(_sfc_main$2d, [["__file", "autocomplete.vue"]]);
  17183. const ElAutocomplete = withInstall(Autocomplete);
  17184. const avatarProps = buildProps({
  17185. size: {
  17186. type: [Number, String],
  17187. values: componentSizes,
  17188. default: "",
  17189. validator: (val) => isNumber(val)
  17190. },
  17191. shape: {
  17192. type: String,
  17193. values: ["circle", "square"],
  17194. default: "circle"
  17195. },
  17196. icon: {
  17197. type: iconPropType
  17198. },
  17199. src: {
  17200. type: String,
  17201. default: ""
  17202. },
  17203. alt: String,
  17204. srcSet: String,
  17205. fit: {
  17206. type: definePropType(String),
  17207. default: "cover"
  17208. }
  17209. });
  17210. const avatarEmits = {
  17211. error: (evt) => evt instanceof Event
  17212. };
  17213. const __default__$1J = vue.defineComponent({
  17214. name: "ElAvatar"
  17215. });
  17216. const _sfc_main$2c = /* @__PURE__ */ vue.defineComponent({
  17217. ...__default__$1J,
  17218. props: avatarProps,
  17219. emits: avatarEmits,
  17220. setup(__props, { emit }) {
  17221. const props = __props;
  17222. const ns = useNamespace("avatar");
  17223. const hasLoadError = vue.ref(false);
  17224. const avatarClass = vue.computed(() => {
  17225. const { size, icon, shape } = props;
  17226. const classList = [ns.b()];
  17227. if (isString$1(size))
  17228. classList.push(ns.m(size));
  17229. if (icon)
  17230. classList.push(ns.m("icon"));
  17231. if (shape)
  17232. classList.push(ns.m(shape));
  17233. return classList;
  17234. });
  17235. const sizeStyle = vue.computed(() => {
  17236. const { size } = props;
  17237. return isNumber(size) ? ns.cssVarBlock({
  17238. size: addUnit(size) || ""
  17239. }) : void 0;
  17240. });
  17241. const fitStyle = vue.computed(() => ({
  17242. objectFit: props.fit
  17243. }));
  17244. vue.watch(() => props.src, () => hasLoadError.value = false);
  17245. function handleError(e) {
  17246. hasLoadError.value = true;
  17247. emit("error", e);
  17248. }
  17249. return (_ctx, _cache) => {
  17250. return vue.openBlock(), vue.createElementBlock("span", {
  17251. class: vue.normalizeClass(vue.unref(avatarClass)),
  17252. style: vue.normalizeStyle(vue.unref(sizeStyle))
  17253. }, [
  17254. (_ctx.src || _ctx.srcSet) && !hasLoadError.value ? (vue.openBlock(), vue.createElementBlock("img", {
  17255. key: 0,
  17256. src: _ctx.src,
  17257. alt: _ctx.alt,
  17258. srcset: _ctx.srcSet,
  17259. style: vue.normalizeStyle(vue.unref(fitStyle)),
  17260. onError: handleError
  17261. }, null, 44, ["src", "alt", "srcset"])) : _ctx.icon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 1 }, {
  17262. default: vue.withCtx(() => [
  17263. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.icon)))
  17264. ]),
  17265. _: 1
  17266. })) : vue.renderSlot(_ctx.$slots, "default", { key: 2 })
  17267. ], 6);
  17268. };
  17269. }
  17270. });
  17271. var Avatar = /* @__PURE__ */ _export_sfc(_sfc_main$2c, [["__file", "avatar.vue"]]);
  17272. const ElAvatar = withInstall(Avatar);
  17273. const backtopProps = {
  17274. visibilityHeight: {
  17275. type: Number,
  17276. default: 200
  17277. },
  17278. target: {
  17279. type: String,
  17280. default: ""
  17281. },
  17282. right: {
  17283. type: Number,
  17284. default: 40
  17285. },
  17286. bottom: {
  17287. type: Number,
  17288. default: 40
  17289. }
  17290. };
  17291. const backtopEmits = {
  17292. click: (evt) => evt instanceof MouseEvent
  17293. };
  17294. const useBackTop = (props, emit, componentName) => {
  17295. const el = vue.shallowRef();
  17296. const container = vue.shallowRef();
  17297. const visible = vue.ref(false);
  17298. const handleScroll = () => {
  17299. if (el.value)
  17300. visible.value = el.value.scrollTop >= props.visibilityHeight;
  17301. };
  17302. const handleClick = (event) => {
  17303. var _a;
  17304. (_a = el.value) == null ? void 0 : _a.scrollTo({ top: 0, behavior: "smooth" });
  17305. emit("click", event);
  17306. };
  17307. const handleScrollThrottled = useThrottleFn(handleScroll, 300, true);
  17308. useEventListener(container, "scroll", handleScrollThrottled);
  17309. vue.onMounted(() => {
  17310. var _a;
  17311. container.value = document;
  17312. el.value = document.documentElement;
  17313. if (props.target) {
  17314. el.value = (_a = document.querySelector(props.target)) != null ? _a : void 0;
  17315. if (!el.value) {
  17316. throwError(componentName, `target does not exist: ${props.target}`);
  17317. }
  17318. container.value = el.value;
  17319. }
  17320. handleScroll();
  17321. });
  17322. return {
  17323. visible,
  17324. handleClick
  17325. };
  17326. };
  17327. const COMPONENT_NAME$i = "ElBacktop";
  17328. const __default__$1I = vue.defineComponent({
  17329. name: COMPONENT_NAME$i
  17330. });
  17331. const _sfc_main$2b = /* @__PURE__ */ vue.defineComponent({
  17332. ...__default__$1I,
  17333. props: backtopProps,
  17334. emits: backtopEmits,
  17335. setup(__props, { emit }) {
  17336. const props = __props;
  17337. const ns = useNamespace("backtop");
  17338. const { handleClick, visible } = useBackTop(props, emit, COMPONENT_NAME$i);
  17339. const backTopStyle = vue.computed(() => ({
  17340. right: `${props.right}px`,
  17341. bottom: `${props.bottom}px`
  17342. }));
  17343. return (_ctx, _cache) => {
  17344. return vue.openBlock(), vue.createBlock(vue.Transition, {
  17345. name: `${vue.unref(ns).namespace.value}-fade-in`
  17346. }, {
  17347. default: vue.withCtx(() => [
  17348. vue.unref(visible) ? (vue.openBlock(), vue.createElementBlock("div", {
  17349. key: 0,
  17350. style: vue.normalizeStyle(vue.unref(backTopStyle)),
  17351. class: vue.normalizeClass(vue.unref(ns).b()),
  17352. onClick: vue.withModifiers(vue.unref(handleClick), ["stop"])
  17353. }, [
  17354. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  17355. vue.createVNode(vue.unref(ElIcon), {
  17356. class: vue.normalizeClass(vue.unref(ns).e("icon"))
  17357. }, {
  17358. default: vue.withCtx(() => [
  17359. vue.createVNode(vue.unref(caret_top_default))
  17360. ]),
  17361. _: 1
  17362. }, 8, ["class"])
  17363. ])
  17364. ], 14, ["onClick"])) : vue.createCommentVNode("v-if", true)
  17365. ]),
  17366. _: 3
  17367. }, 8, ["name"]);
  17368. };
  17369. }
  17370. });
  17371. var Backtop = /* @__PURE__ */ _export_sfc(_sfc_main$2b, [["__file", "backtop.vue"]]);
  17372. const ElBacktop = withInstall(Backtop);
  17373. const badgeProps = buildProps({
  17374. value: {
  17375. type: [String, Number],
  17376. default: ""
  17377. },
  17378. max: {
  17379. type: Number,
  17380. default: 99
  17381. },
  17382. isDot: Boolean,
  17383. hidden: Boolean,
  17384. type: {
  17385. type: String,
  17386. values: ["primary", "success", "warning", "info", "danger"],
  17387. default: "danger"
  17388. },
  17389. showZero: {
  17390. type: Boolean,
  17391. default: true
  17392. },
  17393. color: String,
  17394. badgeStyle: {
  17395. type: definePropType([String, Object, Array])
  17396. },
  17397. offset: {
  17398. type: definePropType(Array),
  17399. default: [0, 0]
  17400. },
  17401. badgeClass: {
  17402. type: String
  17403. }
  17404. });
  17405. const __default__$1H = vue.defineComponent({
  17406. name: "ElBadge"
  17407. });
  17408. const _sfc_main$2a = /* @__PURE__ */ vue.defineComponent({
  17409. ...__default__$1H,
  17410. props: badgeProps,
  17411. setup(__props, { expose }) {
  17412. const props = __props;
  17413. const ns = useNamespace("badge");
  17414. const content = vue.computed(() => {
  17415. if (props.isDot)
  17416. return "";
  17417. if (isNumber(props.value) && isNumber(props.max)) {
  17418. return props.max < props.value ? `${props.max}+` : `${props.value}`;
  17419. }
  17420. return `${props.value}`;
  17421. });
  17422. const style = vue.computed(() => {
  17423. var _a, _b, _c, _d, _e;
  17424. return [
  17425. {
  17426. backgroundColor: props.color,
  17427. marginRight: addUnit(-((_b = (_a = props.offset) == null ? void 0 : _a[0]) != null ? _b : 0)),
  17428. marginTop: addUnit((_d = (_c = props.offset) == null ? void 0 : _c[1]) != null ? _d : 0)
  17429. },
  17430. (_e = props.badgeStyle) != null ? _e : {}
  17431. ];
  17432. });
  17433. expose({
  17434. content
  17435. });
  17436. return (_ctx, _cache) => {
  17437. return vue.openBlock(), vue.createElementBlock("div", {
  17438. class: vue.normalizeClass(vue.unref(ns).b())
  17439. }, [
  17440. vue.renderSlot(_ctx.$slots, "default"),
  17441. vue.createVNode(vue.Transition, {
  17442. name: `${vue.unref(ns).namespace.value}-zoom-in-center`,
  17443. persisted: ""
  17444. }, {
  17445. default: vue.withCtx(() => [
  17446. vue.withDirectives(vue.createElementVNode("sup", {
  17447. class: vue.normalizeClass([
  17448. vue.unref(ns).e("content"),
  17449. vue.unref(ns).em("content", _ctx.type),
  17450. vue.unref(ns).is("fixed", !!_ctx.$slots.default),
  17451. vue.unref(ns).is("dot", _ctx.isDot),
  17452. vue.unref(ns).is("hide-zero", !_ctx.showZero && _ctx.value === 0),
  17453. _ctx.badgeClass
  17454. ]),
  17455. style: vue.normalizeStyle(vue.unref(style))
  17456. }, [
  17457. vue.renderSlot(_ctx.$slots, "content", { value: vue.unref(content) }, () => [
  17458. vue.createTextVNode(vue.toDisplayString(vue.unref(content)), 1)
  17459. ])
  17460. ], 6), [
  17461. [vue.vShow, !_ctx.hidden && (vue.unref(content) || _ctx.isDot || _ctx.$slots.content)]
  17462. ])
  17463. ]),
  17464. _: 3
  17465. }, 8, ["name"])
  17466. ], 2);
  17467. };
  17468. }
  17469. });
  17470. var Badge = /* @__PURE__ */ _export_sfc(_sfc_main$2a, [["__file", "badge.vue"]]);
  17471. const ElBadge = withInstall(Badge);
  17472. const breadcrumbKey = Symbol("breadcrumbKey");
  17473. const breadcrumbProps = buildProps({
  17474. separator: {
  17475. type: String,
  17476. default: "/"
  17477. },
  17478. separatorIcon: {
  17479. type: iconPropType
  17480. }
  17481. });
  17482. const __default__$1G = vue.defineComponent({
  17483. name: "ElBreadcrumb"
  17484. });
  17485. const _sfc_main$29 = /* @__PURE__ */ vue.defineComponent({
  17486. ...__default__$1G,
  17487. props: breadcrumbProps,
  17488. setup(__props) {
  17489. const props = __props;
  17490. const { t } = useLocale();
  17491. const ns = useNamespace("breadcrumb");
  17492. const breadcrumb = vue.ref();
  17493. vue.provide(breadcrumbKey, props);
  17494. vue.onMounted(() => {
  17495. const items = breadcrumb.value.querySelectorAll(`.${ns.e("item")}`);
  17496. if (items.length) {
  17497. items[items.length - 1].setAttribute("aria-current", "page");
  17498. }
  17499. });
  17500. return (_ctx, _cache) => {
  17501. return vue.openBlock(), vue.createElementBlock("div", {
  17502. ref_key: "breadcrumb",
  17503. ref: breadcrumb,
  17504. class: vue.normalizeClass(vue.unref(ns).b()),
  17505. "aria-label": vue.unref(t)("el.breadcrumb.label"),
  17506. role: "navigation"
  17507. }, [
  17508. vue.renderSlot(_ctx.$slots, "default")
  17509. ], 10, ["aria-label"]);
  17510. };
  17511. }
  17512. });
  17513. var Breadcrumb = /* @__PURE__ */ _export_sfc(_sfc_main$29, [["__file", "breadcrumb.vue"]]);
  17514. const breadcrumbItemProps = buildProps({
  17515. to: {
  17516. type: definePropType([String, Object]),
  17517. default: ""
  17518. },
  17519. replace: Boolean
  17520. });
  17521. const __default__$1F = vue.defineComponent({
  17522. name: "ElBreadcrumbItem"
  17523. });
  17524. const _sfc_main$28 = /* @__PURE__ */ vue.defineComponent({
  17525. ...__default__$1F,
  17526. props: breadcrumbItemProps,
  17527. setup(__props) {
  17528. const props = __props;
  17529. const instance = vue.getCurrentInstance();
  17530. const breadcrumbContext = vue.inject(breadcrumbKey, void 0);
  17531. const ns = useNamespace("breadcrumb");
  17532. const router = instance.appContext.config.globalProperties.$router;
  17533. const link = vue.ref();
  17534. const onClick = () => {
  17535. if (!props.to || !router)
  17536. return;
  17537. props.replace ? router.replace(props.to) : router.push(props.to);
  17538. };
  17539. return (_ctx, _cache) => {
  17540. var _a, _b;
  17541. return vue.openBlock(), vue.createElementBlock("span", {
  17542. class: vue.normalizeClass(vue.unref(ns).e("item"))
  17543. }, [
  17544. vue.createElementVNode("span", {
  17545. ref_key: "link",
  17546. ref: link,
  17547. class: vue.normalizeClass([vue.unref(ns).e("inner"), vue.unref(ns).is("link", !!_ctx.to)]),
  17548. role: "link",
  17549. onClick
  17550. }, [
  17551. vue.renderSlot(_ctx.$slots, "default")
  17552. ], 2),
  17553. ((_a = vue.unref(breadcrumbContext)) == null ? void 0 : _a.separatorIcon) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  17554. key: 0,
  17555. class: vue.normalizeClass(vue.unref(ns).e("separator"))
  17556. }, {
  17557. default: vue.withCtx(() => [
  17558. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(breadcrumbContext).separatorIcon)))
  17559. ]),
  17560. _: 1
  17561. }, 8, ["class"])) : (vue.openBlock(), vue.createElementBlock("span", {
  17562. key: 1,
  17563. class: vue.normalizeClass(vue.unref(ns).e("separator")),
  17564. role: "presentation"
  17565. }, vue.toDisplayString((_b = vue.unref(breadcrumbContext)) == null ? void 0 : _b.separator), 3))
  17566. ], 2);
  17567. };
  17568. }
  17569. });
  17570. var BreadcrumbItem = /* @__PURE__ */ _export_sfc(_sfc_main$28, [["__file", "breadcrumb-item.vue"]]);
  17571. const ElBreadcrumb = withInstall(Breadcrumb, {
  17572. BreadcrumbItem
  17573. });
  17574. const ElBreadcrumbItem = withNoopInstall(BreadcrumbItem);
  17575. const buttonGroupContextKey = Symbol("buttonGroupContextKey");
  17576. const useButton = (props, emit) => {
  17577. useDeprecated({
  17578. from: "type.text",
  17579. replacement: "link",
  17580. version: "3.0.0",
  17581. scope: "props",
  17582. ref: "https://element-plus.org/en-US/component/button.html#button-attributes"
  17583. }, vue.computed(() => props.type === "text"));
  17584. const buttonGroupContext = vue.inject(buttonGroupContextKey, void 0);
  17585. const globalConfig = useGlobalConfig("button");
  17586. const { form } = useFormItem();
  17587. const _size = useFormSize(vue.computed(() => buttonGroupContext == null ? void 0 : buttonGroupContext.size));
  17588. const _disabled = useFormDisabled();
  17589. const _ref = vue.ref();
  17590. const slots = vue.useSlots();
  17591. const _type = vue.computed(() => {
  17592. var _a;
  17593. return props.type || (buttonGroupContext == null ? void 0 : buttonGroupContext.type) || ((_a = globalConfig.value) == null ? void 0 : _a.type) || "";
  17594. });
  17595. const autoInsertSpace = vue.computed(() => {
  17596. var _a, _b, _c;
  17597. return (_c = (_b = props.autoInsertSpace) != null ? _b : (_a = globalConfig.value) == null ? void 0 : _a.autoInsertSpace) != null ? _c : false;
  17598. });
  17599. const _plain = vue.computed(() => {
  17600. var _a, _b, _c;
  17601. return (_c = (_b = props.plain) != null ? _b : (_a = globalConfig.value) == null ? void 0 : _a.plain) != null ? _c : false;
  17602. });
  17603. const _round = vue.computed(() => {
  17604. var _a, _b, _c;
  17605. return (_c = (_b = props.round) != null ? _b : (_a = globalConfig.value) == null ? void 0 : _a.round) != null ? _c : false;
  17606. });
  17607. const _text = vue.computed(() => {
  17608. var _a, _b, _c;
  17609. return (_c = (_b = props.text) != null ? _b : (_a = globalConfig.value) == null ? void 0 : _a.text) != null ? _c : false;
  17610. });
  17611. const _props = vue.computed(() => {
  17612. if (props.tag === "button") {
  17613. return {
  17614. ariaDisabled: _disabled.value || props.loading,
  17615. disabled: _disabled.value || props.loading,
  17616. autofocus: props.autofocus,
  17617. type: props.nativeType
  17618. };
  17619. }
  17620. return {};
  17621. });
  17622. const shouldAddSpace = vue.computed(() => {
  17623. var _a;
  17624. const defaultSlot = (_a = slots.default) == null ? void 0 : _a.call(slots);
  17625. if (autoInsertSpace.value && (defaultSlot == null ? void 0 : defaultSlot.length) === 1) {
  17626. const slot = defaultSlot[0];
  17627. if ((slot == null ? void 0 : slot.type) === vue.Text) {
  17628. const text = slot.children;
  17629. return /^\p{Unified_Ideograph}{2}$/u.test(text.trim());
  17630. }
  17631. }
  17632. return false;
  17633. });
  17634. const handleClick = (evt) => {
  17635. if (_disabled.value || props.loading) {
  17636. evt.stopPropagation();
  17637. return;
  17638. }
  17639. if (props.nativeType === "reset") {
  17640. form == null ? void 0 : form.resetFields();
  17641. }
  17642. emit("click", evt);
  17643. };
  17644. return {
  17645. _disabled,
  17646. _size,
  17647. _type,
  17648. _ref,
  17649. _props,
  17650. _plain,
  17651. _round,
  17652. _text,
  17653. shouldAddSpace,
  17654. handleClick
  17655. };
  17656. };
  17657. const buttonTypes = [
  17658. "default",
  17659. "primary",
  17660. "success",
  17661. "warning",
  17662. "info",
  17663. "danger",
  17664. "text",
  17665. ""
  17666. ];
  17667. const buttonNativeTypes = ["button", "submit", "reset"];
  17668. const buttonProps = buildProps({
  17669. size: useSizeProp,
  17670. disabled: Boolean,
  17671. type: {
  17672. type: String,
  17673. values: buttonTypes,
  17674. default: ""
  17675. },
  17676. icon: {
  17677. type: iconPropType
  17678. },
  17679. nativeType: {
  17680. type: String,
  17681. values: buttonNativeTypes,
  17682. default: "button"
  17683. },
  17684. loading: Boolean,
  17685. loadingIcon: {
  17686. type: iconPropType,
  17687. default: () => loading_default
  17688. },
  17689. plain: {
  17690. type: Boolean,
  17691. default: void 0
  17692. },
  17693. text: {
  17694. type: Boolean,
  17695. default: void 0
  17696. },
  17697. link: Boolean,
  17698. bg: Boolean,
  17699. autofocus: Boolean,
  17700. round: {
  17701. type: Boolean,
  17702. default: void 0
  17703. },
  17704. circle: Boolean,
  17705. color: String,
  17706. dark: Boolean,
  17707. autoInsertSpace: {
  17708. type: Boolean,
  17709. default: void 0
  17710. },
  17711. tag: {
  17712. type: definePropType([String, Object]),
  17713. default: "button"
  17714. }
  17715. });
  17716. const buttonEmits = {
  17717. click: (evt) => evt instanceof MouseEvent
  17718. };
  17719. function bound01(n, max) {
  17720. if (isOnePointZero(n)) {
  17721. n = "100%";
  17722. }
  17723. var isPercent = isPercentage(n);
  17724. n = max === 360 ? n : Math.min(max, Math.max(0, parseFloat(n)));
  17725. if (isPercent) {
  17726. n = parseInt(String(n * max), 10) / 100;
  17727. }
  17728. if (Math.abs(n - max) < 1e-6) {
  17729. return 1;
  17730. }
  17731. if (max === 360) {
  17732. n = (n < 0 ? n % max + max : n % max) / parseFloat(String(max));
  17733. } else {
  17734. n = n % max / parseFloat(String(max));
  17735. }
  17736. return n;
  17737. }
  17738. function clamp01(val) {
  17739. return Math.min(1, Math.max(0, val));
  17740. }
  17741. function isOnePointZero(n) {
  17742. return typeof n === "string" && n.indexOf(".") !== -1 && parseFloat(n) === 1;
  17743. }
  17744. function isPercentage(n) {
  17745. return typeof n === "string" && n.indexOf("%") !== -1;
  17746. }
  17747. function boundAlpha(a) {
  17748. a = parseFloat(a);
  17749. if (isNaN(a) || a < 0 || a > 1) {
  17750. a = 1;
  17751. }
  17752. return a;
  17753. }
  17754. function convertToPercentage(n) {
  17755. if (n <= 1) {
  17756. return "".concat(Number(n) * 100, "%");
  17757. }
  17758. return n;
  17759. }
  17760. function pad2(c) {
  17761. return c.length === 1 ? "0" + c : String(c);
  17762. }
  17763. function rgbToRgb(r, g, b) {
  17764. return {
  17765. r: bound01(r, 255) * 255,
  17766. g: bound01(g, 255) * 255,
  17767. b: bound01(b, 255) * 255
  17768. };
  17769. }
  17770. function rgbToHsl(r, g, b) {
  17771. r = bound01(r, 255);
  17772. g = bound01(g, 255);
  17773. b = bound01(b, 255);
  17774. var max = Math.max(r, g, b);
  17775. var min = Math.min(r, g, b);
  17776. var h = 0;
  17777. var s = 0;
  17778. var l = (max + min) / 2;
  17779. if (max === min) {
  17780. s = 0;
  17781. h = 0;
  17782. } else {
  17783. var d = max - min;
  17784. s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
  17785. switch (max) {
  17786. case r:
  17787. h = (g - b) / d + (g < b ? 6 : 0);
  17788. break;
  17789. case g:
  17790. h = (b - r) / d + 2;
  17791. break;
  17792. case b:
  17793. h = (r - g) / d + 4;
  17794. break;
  17795. }
  17796. h /= 6;
  17797. }
  17798. return { h, s, l };
  17799. }
  17800. function hue2rgb(p, q, t) {
  17801. if (t < 0) {
  17802. t += 1;
  17803. }
  17804. if (t > 1) {
  17805. t -= 1;
  17806. }
  17807. if (t < 1 / 6) {
  17808. return p + (q - p) * (6 * t);
  17809. }
  17810. if (t < 1 / 2) {
  17811. return q;
  17812. }
  17813. if (t < 2 / 3) {
  17814. return p + (q - p) * (2 / 3 - t) * 6;
  17815. }
  17816. return p;
  17817. }
  17818. function hslToRgb(h, s, l) {
  17819. var r;
  17820. var g;
  17821. var b;
  17822. h = bound01(h, 360);
  17823. s = bound01(s, 100);
  17824. l = bound01(l, 100);
  17825. if (s === 0) {
  17826. g = l;
  17827. b = l;
  17828. r = l;
  17829. } else {
  17830. var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
  17831. var p = 2 * l - q;
  17832. r = hue2rgb(p, q, h + 1 / 3);
  17833. g = hue2rgb(p, q, h);
  17834. b = hue2rgb(p, q, h - 1 / 3);
  17835. }
  17836. return { r: r * 255, g: g * 255, b: b * 255 };
  17837. }
  17838. function rgbToHsv(r, g, b) {
  17839. r = bound01(r, 255);
  17840. g = bound01(g, 255);
  17841. b = bound01(b, 255);
  17842. var max = Math.max(r, g, b);
  17843. var min = Math.min(r, g, b);
  17844. var h = 0;
  17845. var v = max;
  17846. var d = max - min;
  17847. var s = max === 0 ? 0 : d / max;
  17848. if (max === min) {
  17849. h = 0;
  17850. } else {
  17851. switch (max) {
  17852. case r:
  17853. h = (g - b) / d + (g < b ? 6 : 0);
  17854. break;
  17855. case g:
  17856. h = (b - r) / d + 2;
  17857. break;
  17858. case b:
  17859. h = (r - g) / d + 4;
  17860. break;
  17861. }
  17862. h /= 6;
  17863. }
  17864. return { h, s, v };
  17865. }
  17866. function hsvToRgb(h, s, v) {
  17867. h = bound01(h, 360) * 6;
  17868. s = bound01(s, 100);
  17869. v = bound01(v, 100);
  17870. var i = Math.floor(h);
  17871. var f = h - i;
  17872. var p = v * (1 - s);
  17873. var q = v * (1 - f * s);
  17874. var t = v * (1 - (1 - f) * s);
  17875. var mod = i % 6;
  17876. var r = [v, q, p, p, t, v][mod];
  17877. var g = [t, v, v, q, p, p][mod];
  17878. var b = [p, p, t, v, v, q][mod];
  17879. return { r: r * 255, g: g * 255, b: b * 255 };
  17880. }
  17881. function rgbToHex(r, g, b, allow3Char) {
  17882. var hex = [
  17883. pad2(Math.round(r).toString(16)),
  17884. pad2(Math.round(g).toString(16)),
  17885. pad2(Math.round(b).toString(16))
  17886. ];
  17887. if (allow3Char && hex[0].startsWith(hex[0].charAt(1)) && hex[1].startsWith(hex[1].charAt(1)) && hex[2].startsWith(hex[2].charAt(1))) {
  17888. return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);
  17889. }
  17890. return hex.join("");
  17891. }
  17892. function rgbaToHex(r, g, b, a, allow4Char) {
  17893. var hex = [
  17894. pad2(Math.round(r).toString(16)),
  17895. pad2(Math.round(g).toString(16)),
  17896. pad2(Math.round(b).toString(16)),
  17897. pad2(convertDecimalToHex(a))
  17898. ];
  17899. 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))) {
  17900. return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0);
  17901. }
  17902. return hex.join("");
  17903. }
  17904. function convertDecimalToHex(d) {
  17905. return Math.round(parseFloat(d) * 255).toString(16);
  17906. }
  17907. function convertHexToDecimal(h) {
  17908. return parseIntFromHex(h) / 255;
  17909. }
  17910. function parseIntFromHex(val) {
  17911. return parseInt(val, 16);
  17912. }
  17913. function numberInputToObject(color) {
  17914. return {
  17915. r: color >> 16,
  17916. g: (color & 65280) >> 8,
  17917. b: color & 255
  17918. };
  17919. }
  17920. var names = {
  17921. aliceblue: "#f0f8ff",
  17922. antiquewhite: "#faebd7",
  17923. aqua: "#00ffff",
  17924. aquamarine: "#7fffd4",
  17925. azure: "#f0ffff",
  17926. beige: "#f5f5dc",
  17927. bisque: "#ffe4c4",
  17928. black: "#000000",
  17929. blanchedalmond: "#ffebcd",
  17930. blue: "#0000ff",
  17931. blueviolet: "#8a2be2",
  17932. brown: "#a52a2a",
  17933. burlywood: "#deb887",
  17934. cadetblue: "#5f9ea0",
  17935. chartreuse: "#7fff00",
  17936. chocolate: "#d2691e",
  17937. coral: "#ff7f50",
  17938. cornflowerblue: "#6495ed",
  17939. cornsilk: "#fff8dc",
  17940. crimson: "#dc143c",
  17941. cyan: "#00ffff",
  17942. darkblue: "#00008b",
  17943. darkcyan: "#008b8b",
  17944. darkgoldenrod: "#b8860b",
  17945. darkgray: "#a9a9a9",
  17946. darkgreen: "#006400",
  17947. darkgrey: "#a9a9a9",
  17948. darkkhaki: "#bdb76b",
  17949. darkmagenta: "#8b008b",
  17950. darkolivegreen: "#556b2f",
  17951. darkorange: "#ff8c00",
  17952. darkorchid: "#9932cc",
  17953. darkred: "#8b0000",
  17954. darksalmon: "#e9967a",
  17955. darkseagreen: "#8fbc8f",
  17956. darkslateblue: "#483d8b",
  17957. darkslategray: "#2f4f4f",
  17958. darkslategrey: "#2f4f4f",
  17959. darkturquoise: "#00ced1",
  17960. darkviolet: "#9400d3",
  17961. deeppink: "#ff1493",
  17962. deepskyblue: "#00bfff",
  17963. dimgray: "#696969",
  17964. dimgrey: "#696969",
  17965. dodgerblue: "#1e90ff",
  17966. firebrick: "#b22222",
  17967. floralwhite: "#fffaf0",
  17968. forestgreen: "#228b22",
  17969. fuchsia: "#ff00ff",
  17970. gainsboro: "#dcdcdc",
  17971. ghostwhite: "#f8f8ff",
  17972. goldenrod: "#daa520",
  17973. gold: "#ffd700",
  17974. gray: "#808080",
  17975. green: "#008000",
  17976. greenyellow: "#adff2f",
  17977. grey: "#808080",
  17978. honeydew: "#f0fff0",
  17979. hotpink: "#ff69b4",
  17980. indianred: "#cd5c5c",
  17981. indigo: "#4b0082",
  17982. ivory: "#fffff0",
  17983. khaki: "#f0e68c",
  17984. lavenderblush: "#fff0f5",
  17985. lavender: "#e6e6fa",
  17986. lawngreen: "#7cfc00",
  17987. lemonchiffon: "#fffacd",
  17988. lightblue: "#add8e6",
  17989. lightcoral: "#f08080",
  17990. lightcyan: "#e0ffff",
  17991. lightgoldenrodyellow: "#fafad2",
  17992. lightgray: "#d3d3d3",
  17993. lightgreen: "#90ee90",
  17994. lightgrey: "#d3d3d3",
  17995. lightpink: "#ffb6c1",
  17996. lightsalmon: "#ffa07a",
  17997. lightseagreen: "#20b2aa",
  17998. lightskyblue: "#87cefa",
  17999. lightslategray: "#778899",
  18000. lightslategrey: "#778899",
  18001. lightsteelblue: "#b0c4de",
  18002. lightyellow: "#ffffe0",
  18003. lime: "#00ff00",
  18004. limegreen: "#32cd32",
  18005. linen: "#faf0e6",
  18006. magenta: "#ff00ff",
  18007. maroon: "#800000",
  18008. mediumaquamarine: "#66cdaa",
  18009. mediumblue: "#0000cd",
  18010. mediumorchid: "#ba55d3",
  18011. mediumpurple: "#9370db",
  18012. mediumseagreen: "#3cb371",
  18013. mediumslateblue: "#7b68ee",
  18014. mediumspringgreen: "#00fa9a",
  18015. mediumturquoise: "#48d1cc",
  18016. mediumvioletred: "#c71585",
  18017. midnightblue: "#191970",
  18018. mintcream: "#f5fffa",
  18019. mistyrose: "#ffe4e1",
  18020. moccasin: "#ffe4b5",
  18021. navajowhite: "#ffdead",
  18022. navy: "#000080",
  18023. oldlace: "#fdf5e6",
  18024. olive: "#808000",
  18025. olivedrab: "#6b8e23",
  18026. orange: "#ffa500",
  18027. orangered: "#ff4500",
  18028. orchid: "#da70d6",
  18029. palegoldenrod: "#eee8aa",
  18030. palegreen: "#98fb98",
  18031. paleturquoise: "#afeeee",
  18032. palevioletred: "#db7093",
  18033. papayawhip: "#ffefd5",
  18034. peachpuff: "#ffdab9",
  18035. peru: "#cd853f",
  18036. pink: "#ffc0cb",
  18037. plum: "#dda0dd",
  18038. powderblue: "#b0e0e6",
  18039. purple: "#800080",
  18040. rebeccapurple: "#663399",
  18041. red: "#ff0000",
  18042. rosybrown: "#bc8f8f",
  18043. royalblue: "#4169e1",
  18044. saddlebrown: "#8b4513",
  18045. salmon: "#fa8072",
  18046. sandybrown: "#f4a460",
  18047. seagreen: "#2e8b57",
  18048. seashell: "#fff5ee",
  18049. sienna: "#a0522d",
  18050. silver: "#c0c0c0",
  18051. skyblue: "#87ceeb",
  18052. slateblue: "#6a5acd",
  18053. slategray: "#708090",
  18054. slategrey: "#708090",
  18055. snow: "#fffafa",
  18056. springgreen: "#00ff7f",
  18057. steelblue: "#4682b4",
  18058. tan: "#d2b48c",
  18059. teal: "#008080",
  18060. thistle: "#d8bfd8",
  18061. tomato: "#ff6347",
  18062. turquoise: "#40e0d0",
  18063. violet: "#ee82ee",
  18064. wheat: "#f5deb3",
  18065. white: "#ffffff",
  18066. whitesmoke: "#f5f5f5",
  18067. yellow: "#ffff00",
  18068. yellowgreen: "#9acd32"
  18069. };
  18070. function inputToRGB(color) {
  18071. var rgb = { r: 0, g: 0, b: 0 };
  18072. var a = 1;
  18073. var s = null;
  18074. var v = null;
  18075. var l = null;
  18076. var ok = false;
  18077. var format = false;
  18078. if (typeof color === "string") {
  18079. color = stringInputToObject(color);
  18080. }
  18081. if (typeof color === "object") {
  18082. if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) {
  18083. rgb = rgbToRgb(color.r, color.g, color.b);
  18084. ok = true;
  18085. format = String(color.r).substr(-1) === "%" ? "prgb" : "rgb";
  18086. } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) {
  18087. s = convertToPercentage(color.s);
  18088. v = convertToPercentage(color.v);
  18089. rgb = hsvToRgb(color.h, s, v);
  18090. ok = true;
  18091. format = "hsv";
  18092. } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) {
  18093. s = convertToPercentage(color.s);
  18094. l = convertToPercentage(color.l);
  18095. rgb = hslToRgb(color.h, s, l);
  18096. ok = true;
  18097. format = "hsl";
  18098. }
  18099. if (Object.prototype.hasOwnProperty.call(color, "a")) {
  18100. a = color.a;
  18101. }
  18102. }
  18103. a = boundAlpha(a);
  18104. return {
  18105. ok,
  18106. format: color.format || format,
  18107. r: Math.min(255, Math.max(rgb.r, 0)),
  18108. g: Math.min(255, Math.max(rgb.g, 0)),
  18109. b: Math.min(255, Math.max(rgb.b, 0)),
  18110. a
  18111. };
  18112. }
  18113. var CSS_INTEGER = "[-\\+]?\\d+%?";
  18114. var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?";
  18115. var CSS_UNIT = "(?:".concat(CSS_NUMBER, ")|(?:").concat(CSS_INTEGER, ")");
  18116. var PERMISSIVE_MATCH3 = "[\\s|\\(]+(".concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")\\s*\\)?");
  18117. var PERMISSIVE_MATCH4 = "[\\s|\\(]+(".concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")\\s*\\)?");
  18118. var matchers = {
  18119. CSS_UNIT: new RegExp(CSS_UNIT),
  18120. rgb: new RegExp("rgb" + PERMISSIVE_MATCH3),
  18121. rgba: new RegExp("rgba" + PERMISSIVE_MATCH4),
  18122. hsl: new RegExp("hsl" + PERMISSIVE_MATCH3),
  18123. hsla: new RegExp("hsla" + PERMISSIVE_MATCH4),
  18124. hsv: new RegExp("hsv" + PERMISSIVE_MATCH3),
  18125. hsva: new RegExp("hsva" + PERMISSIVE_MATCH4),
  18126. hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
  18127. hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
  18128. hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
  18129. hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
  18130. };
  18131. function stringInputToObject(color) {
  18132. color = color.trim().toLowerCase();
  18133. if (color.length === 0) {
  18134. return false;
  18135. }
  18136. var named = false;
  18137. if (names[color]) {
  18138. color = names[color];
  18139. named = true;
  18140. } else if (color === "transparent") {
  18141. return { r: 0, g: 0, b: 0, a: 0, format: "name" };
  18142. }
  18143. var match = matchers.rgb.exec(color);
  18144. if (match) {
  18145. return { r: match[1], g: match[2], b: match[3] };
  18146. }
  18147. match = matchers.rgba.exec(color);
  18148. if (match) {
  18149. return { r: match[1], g: match[2], b: match[3], a: match[4] };
  18150. }
  18151. match = matchers.hsl.exec(color);
  18152. if (match) {
  18153. return { h: match[1], s: match[2], l: match[3] };
  18154. }
  18155. match = matchers.hsla.exec(color);
  18156. if (match) {
  18157. return { h: match[1], s: match[2], l: match[3], a: match[4] };
  18158. }
  18159. match = matchers.hsv.exec(color);
  18160. if (match) {
  18161. return { h: match[1], s: match[2], v: match[3] };
  18162. }
  18163. match = matchers.hsva.exec(color);
  18164. if (match) {
  18165. return { h: match[1], s: match[2], v: match[3], a: match[4] };
  18166. }
  18167. match = matchers.hex8.exec(color);
  18168. if (match) {
  18169. return {
  18170. r: parseIntFromHex(match[1]),
  18171. g: parseIntFromHex(match[2]),
  18172. b: parseIntFromHex(match[3]),
  18173. a: convertHexToDecimal(match[4]),
  18174. format: named ? "name" : "hex8"
  18175. };
  18176. }
  18177. match = matchers.hex6.exec(color);
  18178. if (match) {
  18179. return {
  18180. r: parseIntFromHex(match[1]),
  18181. g: parseIntFromHex(match[2]),
  18182. b: parseIntFromHex(match[3]),
  18183. format: named ? "name" : "hex"
  18184. };
  18185. }
  18186. match = matchers.hex4.exec(color);
  18187. if (match) {
  18188. return {
  18189. r: parseIntFromHex(match[1] + match[1]),
  18190. g: parseIntFromHex(match[2] + match[2]),
  18191. b: parseIntFromHex(match[3] + match[3]),
  18192. a: convertHexToDecimal(match[4] + match[4]),
  18193. format: named ? "name" : "hex8"
  18194. };
  18195. }
  18196. match = matchers.hex3.exec(color);
  18197. if (match) {
  18198. return {
  18199. r: parseIntFromHex(match[1] + match[1]),
  18200. g: parseIntFromHex(match[2] + match[2]),
  18201. b: parseIntFromHex(match[3] + match[3]),
  18202. format: named ? "name" : "hex"
  18203. };
  18204. }
  18205. return false;
  18206. }
  18207. function isValidCSSUnit(color) {
  18208. return Boolean(matchers.CSS_UNIT.exec(String(color)));
  18209. }
  18210. var TinyColor = function() {
  18211. function TinyColor2(color, opts) {
  18212. if (color === void 0) {
  18213. color = "";
  18214. }
  18215. if (opts === void 0) {
  18216. opts = {};
  18217. }
  18218. var _a;
  18219. if (color instanceof TinyColor2) {
  18220. return color;
  18221. }
  18222. if (typeof color === "number") {
  18223. color = numberInputToObject(color);
  18224. }
  18225. this.originalInput = color;
  18226. var rgb = inputToRGB(color);
  18227. this.originalInput = color;
  18228. this.r = rgb.r;
  18229. this.g = rgb.g;
  18230. this.b = rgb.b;
  18231. this.a = rgb.a;
  18232. this.roundA = Math.round(100 * this.a) / 100;
  18233. this.format = (_a = opts.format) !== null && _a !== void 0 ? _a : rgb.format;
  18234. this.gradientType = opts.gradientType;
  18235. if (this.r < 1) {
  18236. this.r = Math.round(this.r);
  18237. }
  18238. if (this.g < 1) {
  18239. this.g = Math.round(this.g);
  18240. }
  18241. if (this.b < 1) {
  18242. this.b = Math.round(this.b);
  18243. }
  18244. this.isValid = rgb.ok;
  18245. }
  18246. TinyColor2.prototype.isDark = function() {
  18247. return this.getBrightness() < 128;
  18248. };
  18249. TinyColor2.prototype.isLight = function() {
  18250. return !this.isDark();
  18251. };
  18252. TinyColor2.prototype.getBrightness = function() {
  18253. var rgb = this.toRgb();
  18254. return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1e3;
  18255. };
  18256. TinyColor2.prototype.getLuminance = function() {
  18257. var rgb = this.toRgb();
  18258. var R;
  18259. var G;
  18260. var B;
  18261. var RsRGB = rgb.r / 255;
  18262. var GsRGB = rgb.g / 255;
  18263. var BsRGB = rgb.b / 255;
  18264. if (RsRGB <= 0.03928) {
  18265. R = RsRGB / 12.92;
  18266. } else {
  18267. R = Math.pow((RsRGB + 0.055) / 1.055, 2.4);
  18268. }
  18269. if (GsRGB <= 0.03928) {
  18270. G = GsRGB / 12.92;
  18271. } else {
  18272. G = Math.pow((GsRGB + 0.055) / 1.055, 2.4);
  18273. }
  18274. if (BsRGB <= 0.03928) {
  18275. B = BsRGB / 12.92;
  18276. } else {
  18277. B = Math.pow((BsRGB + 0.055) / 1.055, 2.4);
  18278. }
  18279. return 0.2126 * R + 0.7152 * G + 0.0722 * B;
  18280. };
  18281. TinyColor2.prototype.getAlpha = function() {
  18282. return this.a;
  18283. };
  18284. TinyColor2.prototype.setAlpha = function(alpha) {
  18285. this.a = boundAlpha(alpha);
  18286. this.roundA = Math.round(100 * this.a) / 100;
  18287. return this;
  18288. };
  18289. TinyColor2.prototype.isMonochrome = function() {
  18290. var s = this.toHsl().s;
  18291. return s === 0;
  18292. };
  18293. TinyColor2.prototype.toHsv = function() {
  18294. var hsv = rgbToHsv(this.r, this.g, this.b);
  18295. return { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: this.a };
  18296. };
  18297. TinyColor2.prototype.toHsvString = function() {
  18298. var hsv = rgbToHsv(this.r, this.g, this.b);
  18299. var h = Math.round(hsv.h * 360);
  18300. var s = Math.round(hsv.s * 100);
  18301. var v = Math.round(hsv.v * 100);
  18302. return this.a === 1 ? "hsv(".concat(h, ", ").concat(s, "%, ").concat(v, "%)") : "hsva(".concat(h, ", ").concat(s, "%, ").concat(v, "%, ").concat(this.roundA, ")");
  18303. };
  18304. TinyColor2.prototype.toHsl = function() {
  18305. var hsl = rgbToHsl(this.r, this.g, this.b);
  18306. return { h: hsl.h * 360, s: hsl.s, l: hsl.l, a: this.a };
  18307. };
  18308. TinyColor2.prototype.toHslString = function() {
  18309. var hsl = rgbToHsl(this.r, this.g, this.b);
  18310. var h = Math.round(hsl.h * 360);
  18311. var s = Math.round(hsl.s * 100);
  18312. var l = Math.round(hsl.l * 100);
  18313. return this.a === 1 ? "hsl(".concat(h, ", ").concat(s, "%, ").concat(l, "%)") : "hsla(".concat(h, ", ").concat(s, "%, ").concat(l, "%, ").concat(this.roundA, ")");
  18314. };
  18315. TinyColor2.prototype.toHex = function(allow3Char) {
  18316. if (allow3Char === void 0) {
  18317. allow3Char = false;
  18318. }
  18319. return rgbToHex(this.r, this.g, this.b, allow3Char);
  18320. };
  18321. TinyColor2.prototype.toHexString = function(allow3Char) {
  18322. if (allow3Char === void 0) {
  18323. allow3Char = false;
  18324. }
  18325. return "#" + this.toHex(allow3Char);
  18326. };
  18327. TinyColor2.prototype.toHex8 = function(allow4Char) {
  18328. if (allow4Char === void 0) {
  18329. allow4Char = false;
  18330. }
  18331. return rgbaToHex(this.r, this.g, this.b, this.a, allow4Char);
  18332. };
  18333. TinyColor2.prototype.toHex8String = function(allow4Char) {
  18334. if (allow4Char === void 0) {
  18335. allow4Char = false;
  18336. }
  18337. return "#" + this.toHex8(allow4Char);
  18338. };
  18339. TinyColor2.prototype.toHexShortString = function(allowShortChar) {
  18340. if (allowShortChar === void 0) {
  18341. allowShortChar = false;
  18342. }
  18343. return this.a === 1 ? this.toHexString(allowShortChar) : this.toHex8String(allowShortChar);
  18344. };
  18345. TinyColor2.prototype.toRgb = function() {
  18346. return {
  18347. r: Math.round(this.r),
  18348. g: Math.round(this.g),
  18349. b: Math.round(this.b),
  18350. a: this.a
  18351. };
  18352. };
  18353. TinyColor2.prototype.toRgbString = function() {
  18354. var r = Math.round(this.r);
  18355. var g = Math.round(this.g);
  18356. var b = Math.round(this.b);
  18357. return this.a === 1 ? "rgb(".concat(r, ", ").concat(g, ", ").concat(b, ")") : "rgba(".concat(r, ", ").concat(g, ", ").concat(b, ", ").concat(this.roundA, ")");
  18358. };
  18359. TinyColor2.prototype.toPercentageRgb = function() {
  18360. var fmt = function(x) {
  18361. return "".concat(Math.round(bound01(x, 255) * 100), "%");
  18362. };
  18363. return {
  18364. r: fmt(this.r),
  18365. g: fmt(this.g),
  18366. b: fmt(this.b),
  18367. a: this.a
  18368. };
  18369. };
  18370. TinyColor2.prototype.toPercentageRgbString = function() {
  18371. var rnd = function(x) {
  18372. return Math.round(bound01(x, 255) * 100);
  18373. };
  18374. 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, ")");
  18375. };
  18376. TinyColor2.prototype.toName = function() {
  18377. if (this.a === 0) {
  18378. return "transparent";
  18379. }
  18380. if (this.a < 1) {
  18381. return false;
  18382. }
  18383. var hex = "#" + rgbToHex(this.r, this.g, this.b, false);
  18384. for (var _i = 0, _a = Object.entries(names); _i < _a.length; _i++) {
  18385. var _b = _a[_i], key = _b[0], value = _b[1];
  18386. if (hex === value) {
  18387. return key;
  18388. }
  18389. }
  18390. return false;
  18391. };
  18392. TinyColor2.prototype.toString = function(format) {
  18393. var formatSet = Boolean(format);
  18394. format = format !== null && format !== void 0 ? format : this.format;
  18395. var formattedString = false;
  18396. var hasAlpha = this.a < 1 && this.a >= 0;
  18397. var needsAlphaFormat = !formatSet && hasAlpha && (format.startsWith("hex") || format === "name");
  18398. if (needsAlphaFormat) {
  18399. if (format === "name" && this.a === 0) {
  18400. return this.toName();
  18401. }
  18402. return this.toRgbString();
  18403. }
  18404. if (format === "rgb") {
  18405. formattedString = this.toRgbString();
  18406. }
  18407. if (format === "prgb") {
  18408. formattedString = this.toPercentageRgbString();
  18409. }
  18410. if (format === "hex" || format === "hex6") {
  18411. formattedString = this.toHexString();
  18412. }
  18413. if (format === "hex3") {
  18414. formattedString = this.toHexString(true);
  18415. }
  18416. if (format === "hex4") {
  18417. formattedString = this.toHex8String(true);
  18418. }
  18419. if (format === "hex8") {
  18420. formattedString = this.toHex8String();
  18421. }
  18422. if (format === "name") {
  18423. formattedString = this.toName();
  18424. }
  18425. if (format === "hsl") {
  18426. formattedString = this.toHslString();
  18427. }
  18428. if (format === "hsv") {
  18429. formattedString = this.toHsvString();
  18430. }
  18431. return formattedString || this.toHexString();
  18432. };
  18433. TinyColor2.prototype.toNumber = function() {
  18434. return (Math.round(this.r) << 16) + (Math.round(this.g) << 8) + Math.round(this.b);
  18435. };
  18436. TinyColor2.prototype.clone = function() {
  18437. return new TinyColor2(this.toString());
  18438. };
  18439. TinyColor2.prototype.lighten = function(amount) {
  18440. if (amount === void 0) {
  18441. amount = 10;
  18442. }
  18443. var hsl = this.toHsl();
  18444. hsl.l += amount / 100;
  18445. hsl.l = clamp01(hsl.l);
  18446. return new TinyColor2(hsl);
  18447. };
  18448. TinyColor2.prototype.brighten = function(amount) {
  18449. if (amount === void 0) {
  18450. amount = 10;
  18451. }
  18452. var rgb = this.toRgb();
  18453. rgb.r = Math.max(0, Math.min(255, rgb.r - Math.round(255 * -(amount / 100))));
  18454. rgb.g = Math.max(0, Math.min(255, rgb.g - Math.round(255 * -(amount / 100))));
  18455. rgb.b = Math.max(0, Math.min(255, rgb.b - Math.round(255 * -(amount / 100))));
  18456. return new TinyColor2(rgb);
  18457. };
  18458. TinyColor2.prototype.darken = function(amount) {
  18459. if (amount === void 0) {
  18460. amount = 10;
  18461. }
  18462. var hsl = this.toHsl();
  18463. hsl.l -= amount / 100;
  18464. hsl.l = clamp01(hsl.l);
  18465. return new TinyColor2(hsl);
  18466. };
  18467. TinyColor2.prototype.tint = function(amount) {
  18468. if (amount === void 0) {
  18469. amount = 10;
  18470. }
  18471. return this.mix("white", amount);
  18472. };
  18473. TinyColor2.prototype.shade = function(amount) {
  18474. if (amount === void 0) {
  18475. amount = 10;
  18476. }
  18477. return this.mix("black", amount);
  18478. };
  18479. TinyColor2.prototype.desaturate = function(amount) {
  18480. if (amount === void 0) {
  18481. amount = 10;
  18482. }
  18483. var hsl = this.toHsl();
  18484. hsl.s -= amount / 100;
  18485. hsl.s = clamp01(hsl.s);
  18486. return new TinyColor2(hsl);
  18487. };
  18488. TinyColor2.prototype.saturate = function(amount) {
  18489. if (amount === void 0) {
  18490. amount = 10;
  18491. }
  18492. var hsl = this.toHsl();
  18493. hsl.s += amount / 100;
  18494. hsl.s = clamp01(hsl.s);
  18495. return new TinyColor2(hsl);
  18496. };
  18497. TinyColor2.prototype.greyscale = function() {
  18498. return this.desaturate(100);
  18499. };
  18500. TinyColor2.prototype.spin = function(amount) {
  18501. var hsl = this.toHsl();
  18502. var hue = (hsl.h + amount) % 360;
  18503. hsl.h = hue < 0 ? 360 + hue : hue;
  18504. return new TinyColor2(hsl);
  18505. };
  18506. TinyColor2.prototype.mix = function(color, amount) {
  18507. if (amount === void 0) {
  18508. amount = 50;
  18509. }
  18510. var rgb1 = this.toRgb();
  18511. var rgb2 = new TinyColor2(color).toRgb();
  18512. var p = amount / 100;
  18513. var rgba = {
  18514. r: (rgb2.r - rgb1.r) * p + rgb1.r,
  18515. g: (rgb2.g - rgb1.g) * p + rgb1.g,
  18516. b: (rgb2.b - rgb1.b) * p + rgb1.b,
  18517. a: (rgb2.a - rgb1.a) * p + rgb1.a
  18518. };
  18519. return new TinyColor2(rgba);
  18520. };
  18521. TinyColor2.prototype.analogous = function(results, slices) {
  18522. if (results === void 0) {
  18523. results = 6;
  18524. }
  18525. if (slices === void 0) {
  18526. slices = 30;
  18527. }
  18528. var hsl = this.toHsl();
  18529. var part = 360 / slices;
  18530. var ret = [this];
  18531. for (hsl.h = (hsl.h - (part * results >> 1) + 720) % 360; --results; ) {
  18532. hsl.h = (hsl.h + part) % 360;
  18533. ret.push(new TinyColor2(hsl));
  18534. }
  18535. return ret;
  18536. };
  18537. TinyColor2.prototype.complement = function() {
  18538. var hsl = this.toHsl();
  18539. hsl.h = (hsl.h + 180) % 360;
  18540. return new TinyColor2(hsl);
  18541. };
  18542. TinyColor2.prototype.monochromatic = function(results) {
  18543. if (results === void 0) {
  18544. results = 6;
  18545. }
  18546. var hsv = this.toHsv();
  18547. var h = hsv.h;
  18548. var s = hsv.s;
  18549. var v = hsv.v;
  18550. var res = [];
  18551. var modification = 1 / results;
  18552. while (results--) {
  18553. res.push(new TinyColor2({ h, s, v }));
  18554. v = (v + modification) % 1;
  18555. }
  18556. return res;
  18557. };
  18558. TinyColor2.prototype.splitcomplement = function() {
  18559. var hsl = this.toHsl();
  18560. var h = hsl.h;
  18561. return [
  18562. this,
  18563. new TinyColor2({ h: (h + 72) % 360, s: hsl.s, l: hsl.l }),
  18564. new TinyColor2({ h: (h + 216) % 360, s: hsl.s, l: hsl.l })
  18565. ];
  18566. };
  18567. TinyColor2.prototype.onBackground = function(background) {
  18568. var fg = this.toRgb();
  18569. var bg = new TinyColor2(background).toRgb();
  18570. var alpha = fg.a + bg.a * (1 - fg.a);
  18571. return new TinyColor2({
  18572. r: (fg.r * fg.a + bg.r * bg.a * (1 - fg.a)) / alpha,
  18573. g: (fg.g * fg.a + bg.g * bg.a * (1 - fg.a)) / alpha,
  18574. b: (fg.b * fg.a + bg.b * bg.a * (1 - fg.a)) / alpha,
  18575. a: alpha
  18576. });
  18577. };
  18578. TinyColor2.prototype.triad = function() {
  18579. return this.polyad(3);
  18580. };
  18581. TinyColor2.prototype.tetrad = function() {
  18582. return this.polyad(4);
  18583. };
  18584. TinyColor2.prototype.polyad = function(n) {
  18585. var hsl = this.toHsl();
  18586. var h = hsl.h;
  18587. var result = [this];
  18588. var increment = 360 / n;
  18589. for (var i = 1; i < n; i++) {
  18590. result.push(new TinyColor2({ h: (h + i * increment) % 360, s: hsl.s, l: hsl.l }));
  18591. }
  18592. return result;
  18593. };
  18594. TinyColor2.prototype.equals = function(color) {
  18595. return this.toRgbString() === new TinyColor2(color).toRgbString();
  18596. };
  18597. return TinyColor2;
  18598. }();
  18599. function darken(color, amount = 20) {
  18600. return color.mix("#141414", amount).toString();
  18601. }
  18602. function useButtonCustomStyle(props) {
  18603. const _disabled = useFormDisabled();
  18604. const ns = useNamespace("button");
  18605. return vue.computed(() => {
  18606. let styles = {};
  18607. let buttonColor = props.color;
  18608. if (buttonColor) {
  18609. const match = buttonColor.match(/var\((.*?)\)/);
  18610. if (match) {
  18611. buttonColor = window.getComputedStyle(window.document.documentElement).getPropertyValue(match[1]);
  18612. }
  18613. const color = new TinyColor(buttonColor);
  18614. const activeBgColor = props.dark ? color.tint(20).toString() : darken(color, 20);
  18615. if (props.plain) {
  18616. styles = ns.cssVarBlock({
  18617. "bg-color": props.dark ? darken(color, 90) : color.tint(90).toString(),
  18618. "text-color": buttonColor,
  18619. "border-color": props.dark ? darken(color, 50) : color.tint(50).toString(),
  18620. "hover-text-color": `var(${ns.cssVarName("color-white")})`,
  18621. "hover-bg-color": buttonColor,
  18622. "hover-border-color": buttonColor,
  18623. "active-bg-color": activeBgColor,
  18624. "active-text-color": `var(${ns.cssVarName("color-white")})`,
  18625. "active-border-color": activeBgColor
  18626. });
  18627. if (_disabled.value) {
  18628. styles[ns.cssVarBlockName("disabled-bg-color")] = props.dark ? darken(color, 90) : color.tint(90).toString();
  18629. styles[ns.cssVarBlockName("disabled-text-color")] = props.dark ? darken(color, 50) : color.tint(50).toString();
  18630. styles[ns.cssVarBlockName("disabled-border-color")] = props.dark ? darken(color, 80) : color.tint(80).toString();
  18631. }
  18632. } else {
  18633. const hoverBgColor = props.dark ? darken(color, 30) : color.tint(30).toString();
  18634. const textColor = color.isDark() ? `var(${ns.cssVarName("color-white")})` : `var(${ns.cssVarName("color-black")})`;
  18635. styles = ns.cssVarBlock({
  18636. "bg-color": buttonColor,
  18637. "text-color": textColor,
  18638. "border-color": buttonColor,
  18639. "hover-bg-color": hoverBgColor,
  18640. "hover-text-color": textColor,
  18641. "hover-border-color": hoverBgColor,
  18642. "active-bg-color": activeBgColor,
  18643. "active-border-color": activeBgColor
  18644. });
  18645. if (_disabled.value) {
  18646. const disabledButtonColor = props.dark ? darken(color, 50) : color.tint(50).toString();
  18647. styles[ns.cssVarBlockName("disabled-bg-color")] = disabledButtonColor;
  18648. styles[ns.cssVarBlockName("disabled-text-color")] = props.dark ? "rgba(255, 255, 255, 0.5)" : `var(${ns.cssVarName("color-white")})`;
  18649. styles[ns.cssVarBlockName("disabled-border-color")] = disabledButtonColor;
  18650. }
  18651. }
  18652. }
  18653. return styles;
  18654. });
  18655. }
  18656. const __default__$1E = vue.defineComponent({
  18657. name: "ElButton"
  18658. });
  18659. const _sfc_main$27 = /* @__PURE__ */ vue.defineComponent({
  18660. ...__default__$1E,
  18661. props: buttonProps,
  18662. emits: buttonEmits,
  18663. setup(__props, { expose, emit }) {
  18664. const props = __props;
  18665. const buttonStyle = useButtonCustomStyle(props);
  18666. const ns = useNamespace("button");
  18667. const {
  18668. _ref,
  18669. _size,
  18670. _type,
  18671. _disabled,
  18672. _props,
  18673. _plain,
  18674. _round,
  18675. _text,
  18676. shouldAddSpace,
  18677. handleClick
  18678. } = useButton(props, emit);
  18679. const buttonKls = vue.computed(() => [
  18680. ns.b(),
  18681. ns.m(_type.value),
  18682. ns.m(_size.value),
  18683. ns.is("disabled", _disabled.value),
  18684. ns.is("loading", props.loading),
  18685. ns.is("plain", _plain.value),
  18686. ns.is("round", _round.value),
  18687. ns.is("circle", props.circle),
  18688. ns.is("text", _text.value),
  18689. ns.is("link", props.link),
  18690. ns.is("has-bg", props.bg)
  18691. ]);
  18692. expose({
  18693. ref: _ref,
  18694. size: _size,
  18695. type: _type,
  18696. disabled: _disabled,
  18697. shouldAddSpace
  18698. });
  18699. return (_ctx, _cache) => {
  18700. return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.tag), vue.mergeProps({
  18701. ref_key: "_ref",
  18702. ref: _ref
  18703. }, vue.unref(_props), {
  18704. class: vue.unref(buttonKls),
  18705. style: vue.unref(buttonStyle),
  18706. onClick: vue.unref(handleClick)
  18707. }), {
  18708. default: vue.withCtx(() => [
  18709. _ctx.loading ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  18710. _ctx.$slots.loading ? vue.renderSlot(_ctx.$slots, "loading", { key: 0 }) : (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  18711. key: 1,
  18712. class: vue.normalizeClass(vue.unref(ns).is("loading"))
  18713. }, {
  18714. default: vue.withCtx(() => [
  18715. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.loadingIcon)))
  18716. ]),
  18717. _: 1
  18718. }, 8, ["class"]))
  18719. ], 64)) : _ctx.icon || _ctx.$slots.icon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 1 }, {
  18720. default: vue.withCtx(() => [
  18721. _ctx.icon ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.icon), { key: 0 })) : vue.renderSlot(_ctx.$slots, "icon", { key: 1 })
  18722. ]),
  18723. _: 3
  18724. })) : vue.createCommentVNode("v-if", true),
  18725. _ctx.$slots.default ? (vue.openBlock(), vue.createElementBlock("span", {
  18726. key: 2,
  18727. class: vue.normalizeClass({ [vue.unref(ns).em("text", "expand")]: vue.unref(shouldAddSpace) })
  18728. }, [
  18729. vue.renderSlot(_ctx.$slots, "default")
  18730. ], 2)) : vue.createCommentVNode("v-if", true)
  18731. ]),
  18732. _: 3
  18733. }, 16, ["class", "style", "onClick"]);
  18734. };
  18735. }
  18736. });
  18737. var Button = /* @__PURE__ */ _export_sfc(_sfc_main$27, [["__file", "button.vue"]]);
  18738. const buttonGroupProps = {
  18739. size: buttonProps.size,
  18740. type: buttonProps.type
  18741. };
  18742. const __default__$1D = vue.defineComponent({
  18743. name: "ElButtonGroup"
  18744. });
  18745. const _sfc_main$26 = /* @__PURE__ */ vue.defineComponent({
  18746. ...__default__$1D,
  18747. props: buttonGroupProps,
  18748. setup(__props) {
  18749. const props = __props;
  18750. vue.provide(buttonGroupContextKey, vue.reactive({
  18751. size: vue.toRef(props, "size"),
  18752. type: vue.toRef(props, "type")
  18753. }));
  18754. const ns = useNamespace("button");
  18755. return (_ctx, _cache) => {
  18756. return vue.openBlock(), vue.createElementBlock("div", {
  18757. class: vue.normalizeClass(vue.unref(ns).b("group"))
  18758. }, [
  18759. vue.renderSlot(_ctx.$slots, "default")
  18760. ], 2);
  18761. };
  18762. }
  18763. });
  18764. var ButtonGroup = /* @__PURE__ */ _export_sfc(_sfc_main$26, [["__file", "button-group.vue"]]);
  18765. const ElButton = withInstall(Button, {
  18766. ButtonGroup
  18767. });
  18768. const ElButtonGroup$1 = withNoopInstall(ButtonGroup);
  18769. var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
  18770. var dayjs_min = {exports: {}};
  18771. (function(module, exports) {
  18772. !function(t, e) {
  18773. module.exports = e() ;
  18774. }(commonjsGlobal, function() {
  18775. 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) {
  18776. var e2 = ["th", "st", "nd", "rd"], n2 = t2 % 100;
  18777. return "[" + t2 + (e2[(n2 - 20) % 10] || e2[n2] || e2[0]) + "]";
  18778. } }, m = function(t2, e2, n2) {
  18779. var r2 = String(t2);
  18780. return !r2 || r2.length >= e2 ? t2 : "" + Array(e2 + 1 - r2.length).join(n2) + t2;
  18781. }, v = { s: m, z: function(t2) {
  18782. var e2 = -t2.utcOffset(), n2 = Math.abs(e2), r2 = Math.floor(n2 / 60), i2 = n2 % 60;
  18783. return (e2 <= 0 ? "+" : "-") + m(r2, 2, "0") + ":" + m(i2, 2, "0");
  18784. }, m: function t2(e2, n2) {
  18785. if (e2.date() < n2.date())
  18786. return -t2(n2, e2);
  18787. 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);
  18788. return +(-(r2 + (n2 - i2) / (s2 ? i2 - u2 : u2 - i2)) || 0);
  18789. }, a: function(t2) {
  18790. return t2 < 0 ? Math.ceil(t2) || 0 : Math.floor(t2);
  18791. }, p: function(t2) {
  18792. 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$/, "");
  18793. }, u: function(t2) {
  18794. return t2 === void 0;
  18795. } }, g = "en", D = {};
  18796. D[g] = M;
  18797. var p = "$isDayjsObject", S = function(t2) {
  18798. return t2 instanceof _ || !(!t2 || !t2[p]);
  18799. }, w = function t2(e2, n2, r2) {
  18800. var i2;
  18801. if (!e2)
  18802. return g;
  18803. if (typeof e2 == "string") {
  18804. var s2 = e2.toLowerCase();
  18805. D[s2] && (i2 = s2), n2 && (D[s2] = n2, i2 = s2);
  18806. var u2 = e2.split("-");
  18807. if (!i2 && u2.length > 1)
  18808. return t2(u2[0]);
  18809. } else {
  18810. var a2 = e2.name;
  18811. D[a2] = e2, i2 = a2;
  18812. }
  18813. return !r2 && i2 && (g = i2), i2 || !r2 && g;
  18814. }, O = function(t2, e2) {
  18815. if (S(t2))
  18816. return t2.clone();
  18817. var n2 = typeof e2 == "object" ? e2 : {};
  18818. return n2.date = t2, n2.args = arguments, new _(n2);
  18819. }, b = v;
  18820. b.l = w, b.i = S, b.w = function(t2, e2) {
  18821. return O(t2, { locale: e2.$L, utc: e2.$u, x: e2.$x, $offset: e2.$offset });
  18822. };
  18823. var _ = function() {
  18824. function M2(t2) {
  18825. this.$L = w(t2.locale, null, true), this.parse(t2), this.$x = this.$x || t2.x || {}, this[p] = true;
  18826. }
  18827. var m2 = M2.prototype;
  18828. return m2.parse = function(t2) {
  18829. this.$d = function(t3) {
  18830. var e2 = t3.date, n2 = t3.utc;
  18831. if (e2 === null)
  18832. return new Date(NaN);
  18833. if (b.u(e2))
  18834. return new Date();
  18835. if (e2 instanceof Date)
  18836. return new Date(e2);
  18837. if (typeof e2 == "string" && !/Z$/i.test(e2)) {
  18838. var r2 = e2.match($);
  18839. if (r2) {
  18840. var i2 = r2[2] - 1 || 0, s2 = (r2[7] || "0").substring(0, 3);
  18841. 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);
  18842. }
  18843. }
  18844. return new Date(e2);
  18845. }(t2), this.init();
  18846. }, m2.init = function() {
  18847. var t2 = this.$d;
  18848. 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();
  18849. }, m2.$utils = function() {
  18850. return b;
  18851. }, m2.isValid = function() {
  18852. return !(this.$d.toString() === l);
  18853. }, m2.isSame = function(t2, e2) {
  18854. var n2 = O(t2);
  18855. return this.startOf(e2) <= n2 && n2 <= this.endOf(e2);
  18856. }, m2.isAfter = function(t2, e2) {
  18857. return O(t2) < this.startOf(e2);
  18858. }, m2.isBefore = function(t2, e2) {
  18859. return this.endOf(e2) < O(t2);
  18860. }, m2.$g = function(t2, e2, n2) {
  18861. return b.u(t2) ? this[e2] : this.set(n2, t2);
  18862. }, m2.unix = function() {
  18863. return Math.floor(this.valueOf() / 1e3);
  18864. }, m2.valueOf = function() {
  18865. return this.$d.getTime();
  18866. }, m2.startOf = function(t2, e2) {
  18867. var n2 = this, r2 = !!b.u(e2) || e2, f2 = b.p(t2), l2 = function(t3, e3) {
  18868. var i2 = b.w(n2.$u ? Date.UTC(n2.$y, e3, t3) : new Date(n2.$y, e3, t3), n2);
  18869. return r2 ? i2 : i2.endOf(a);
  18870. }, $2 = function(t3, e3) {
  18871. return b.w(n2.toDate()[t3].apply(n2.toDate("s"), (r2 ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(e3)), n2);
  18872. }, y2 = this.$W, M3 = this.$M, m3 = this.$D, v2 = "set" + (this.$u ? "UTC" : "");
  18873. switch (f2) {
  18874. case h:
  18875. return r2 ? l2(1, 0) : l2(31, 11);
  18876. case c:
  18877. return r2 ? l2(1, M3) : l2(0, M3 + 1);
  18878. case o:
  18879. var g2 = this.$locale().weekStart || 0, D2 = (y2 < g2 ? y2 + 7 : y2) - g2;
  18880. return l2(r2 ? m3 - D2 : m3 + (6 - D2), M3);
  18881. case a:
  18882. case d:
  18883. return $2(v2 + "Hours", 0);
  18884. case u:
  18885. return $2(v2 + "Minutes", 1);
  18886. case s:
  18887. return $2(v2 + "Seconds", 2);
  18888. case i:
  18889. return $2(v2 + "Milliseconds", 3);
  18890. default:
  18891. return this.clone();
  18892. }
  18893. }, m2.endOf = function(t2) {
  18894. return this.startOf(t2, false);
  18895. }, m2.$set = function(t2, e2) {
  18896. 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;
  18897. if (o2 === c || o2 === h) {
  18898. var y2 = this.clone().set(d, 1);
  18899. y2.$d[l2]($2), y2.init(), this.$d = y2.set(d, Math.min(this.$D, y2.daysInMonth())).$d;
  18900. } else
  18901. l2 && this.$d[l2]($2);
  18902. return this.init(), this;
  18903. }, m2.set = function(t2, e2) {
  18904. return this.clone().$set(t2, e2);
  18905. }, m2.get = function(t2) {
  18906. return this[b.p(t2)]();
  18907. }, m2.add = function(r2, f2) {
  18908. var d2, l2 = this;
  18909. r2 = Number(r2);
  18910. var $2 = b.p(f2), y2 = function(t2) {
  18911. var e2 = O(l2);
  18912. return b.w(e2.date(e2.date() + Math.round(t2 * r2)), l2);
  18913. };
  18914. if ($2 === c)
  18915. return this.set(c, this.$M + r2);
  18916. if ($2 === h)
  18917. return this.set(h, this.$y + r2);
  18918. if ($2 === a)
  18919. return y2(1);
  18920. if ($2 === o)
  18921. return y2(7);
  18922. var M3 = (d2 = {}, d2[s] = e, d2[u] = n, d2[i] = t, d2)[$2] || 1, m3 = this.$d.getTime() + r2 * M3;
  18923. return b.w(m3, this);
  18924. }, m2.subtract = function(t2, e2) {
  18925. return this.add(-1 * t2, e2);
  18926. }, m2.format = function(t2) {
  18927. var e2 = this, n2 = this.$locale();
  18928. if (!this.isValid())
  18929. return n2.invalidDate || l;
  18930. 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) {
  18931. return t3 && (t3[n3] || t3(e2, r2)) || i3[n3].slice(0, s3);
  18932. }, d2 = function(t3) {
  18933. return b.s(s2 % 12 || 12, t3, "0");
  18934. }, $2 = f2 || function(t3, e3, n3) {
  18935. var r3 = t3 < 12 ? "AM" : "PM";
  18936. return n3 ? r3.toLowerCase() : r3;
  18937. };
  18938. return r2.replace(y, function(t3, r3) {
  18939. return r3 || function(t4) {
  18940. switch (t4) {
  18941. case "YY":
  18942. return String(e2.$y).slice(-2);
  18943. case "YYYY":
  18944. return b.s(e2.$y, 4, "0");
  18945. case "M":
  18946. return a2 + 1;
  18947. case "MM":
  18948. return b.s(a2 + 1, 2, "0");
  18949. case "MMM":
  18950. return h2(n2.monthsShort, a2, c2, 3);
  18951. case "MMMM":
  18952. return h2(c2, a2);
  18953. case "D":
  18954. return e2.$D;
  18955. case "DD":
  18956. return b.s(e2.$D, 2, "0");
  18957. case "d":
  18958. return String(e2.$W);
  18959. case "dd":
  18960. return h2(n2.weekdaysMin, e2.$W, o2, 2);
  18961. case "ddd":
  18962. return h2(n2.weekdaysShort, e2.$W, o2, 3);
  18963. case "dddd":
  18964. return o2[e2.$W];
  18965. case "H":
  18966. return String(s2);
  18967. case "HH":
  18968. return b.s(s2, 2, "0");
  18969. case "h":
  18970. return d2(1);
  18971. case "hh":
  18972. return d2(2);
  18973. case "a":
  18974. return $2(s2, u2, true);
  18975. case "A":
  18976. return $2(s2, u2, false);
  18977. case "m":
  18978. return String(u2);
  18979. case "mm":
  18980. return b.s(u2, 2, "0");
  18981. case "s":
  18982. return String(e2.$s);
  18983. case "ss":
  18984. return b.s(e2.$s, 2, "0");
  18985. case "SSS":
  18986. return b.s(e2.$ms, 3, "0");
  18987. case "Z":
  18988. return i2;
  18989. }
  18990. return null;
  18991. }(t3) || i2.replace(":", "");
  18992. });
  18993. }, m2.utcOffset = function() {
  18994. return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
  18995. }, m2.diff = function(r2, d2, l2) {
  18996. var $2, y2 = this, M3 = b.p(d2), m3 = O(r2), v2 = (m3.utcOffset() - this.utcOffset()) * e, g2 = this - m3, D2 = function() {
  18997. return b.m(y2, m3);
  18998. };
  18999. switch (M3) {
  19000. case h:
  19001. $2 = D2() / 12;
  19002. break;
  19003. case c:
  19004. $2 = D2();
  19005. break;
  19006. case f:
  19007. $2 = D2() / 3;
  19008. break;
  19009. case o:
  19010. $2 = (g2 - v2) / 6048e5;
  19011. break;
  19012. case a:
  19013. $2 = (g2 - v2) / 864e5;
  19014. break;
  19015. case u:
  19016. $2 = g2 / n;
  19017. break;
  19018. case s:
  19019. $2 = g2 / e;
  19020. break;
  19021. case i:
  19022. $2 = g2 / t;
  19023. break;
  19024. default:
  19025. $2 = g2;
  19026. }
  19027. return l2 ? $2 : b.a($2);
  19028. }, m2.daysInMonth = function() {
  19029. return this.endOf(c).$D;
  19030. }, m2.$locale = function() {
  19031. return D[this.$L];
  19032. }, m2.locale = function(t2, e2) {
  19033. if (!t2)
  19034. return this.$L;
  19035. var n2 = this.clone(), r2 = w(t2, e2, true);
  19036. return r2 && (n2.$L = r2), n2;
  19037. }, m2.clone = function() {
  19038. return b.w(this.$d, this);
  19039. }, m2.toDate = function() {
  19040. return new Date(this.valueOf());
  19041. }, m2.toJSON = function() {
  19042. return this.isValid() ? this.toISOString() : null;
  19043. }, m2.toISOString = function() {
  19044. return this.$d.toISOString();
  19045. }, m2.toString = function() {
  19046. return this.$d.toUTCString();
  19047. }, M2;
  19048. }(), k = _.prototype;
  19049. return O.prototype = k, [["$ms", r], ["$s", i], ["$m", s], ["$H", u], ["$W", a], ["$M", c], ["$y", h], ["$D", d]].forEach(function(t2) {
  19050. k[t2[1]] = function(e2) {
  19051. return this.$g(e2, t2[0], t2[1]);
  19052. };
  19053. }), O.extend = function(t2, e2) {
  19054. return t2.$i || (t2(e2, _, O), t2.$i = true), O;
  19055. }, O.locale = w, O.isDayjs = S, O.unix = function(t2) {
  19056. return O(1e3 * t2);
  19057. }, O.en = D[g], O.Ls = D, O.p = {}, O;
  19058. });
  19059. })(dayjs_min);
  19060. var dayjs = dayjs_min.exports;
  19061. var customParseFormat$1 = {exports: {}};
  19062. (function(module, exports) {
  19063. !function(e, t) {
  19064. module.exports = t() ;
  19065. }(commonjsGlobal, function() {
  19066. 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) {
  19067. return (e2 = +e2) + (e2 > 68 ? 1900 : 2e3);
  19068. };
  19069. var f = function(e2) {
  19070. return function(t2) {
  19071. this[e2] = +t2;
  19072. };
  19073. }, h = [/[+-]\d\d:?(\d\d)?|Z/, function(e2) {
  19074. (this.zone || (this.zone = {})).offset = function(e3) {
  19075. if (!e3)
  19076. return 0;
  19077. if (e3 === "Z")
  19078. return 0;
  19079. var t2 = e3.match(/([+-]|\d\d)/g), n2 = 60 * t2[1] + (+t2[2] || 0);
  19080. return n2 === 0 ? 0 : t2[0] === "+" ? -n2 : n2;
  19081. }(e2);
  19082. }], u = function(e2) {
  19083. var t2 = s[e2];
  19084. return t2 && (t2.indexOf ? t2 : t2.s.concat(t2.f));
  19085. }, d = function(e2, t2) {
  19086. var n2, r2 = s.meridiem;
  19087. if (r2) {
  19088. for (var i2 = 1; i2 <= 24; i2 += 1)
  19089. if (e2.indexOf(r2(i2, 0, t2)) > -1) {
  19090. n2 = i2 > 12;
  19091. break;
  19092. }
  19093. } else
  19094. n2 = e2 === (t2 ? "pm" : "PM");
  19095. return n2;
  19096. }, c = { A: [o, function(e2) {
  19097. this.afternoon = d(e2, false);
  19098. }], a: [o, function(e2) {
  19099. this.afternoon = d(e2, true);
  19100. }], Q: [n, function(e2) {
  19101. this.month = 3 * (e2 - 1) + 1;
  19102. }], S: [n, function(e2) {
  19103. this.milliseconds = 100 * +e2;
  19104. }], SS: [r, function(e2) {
  19105. this.milliseconds = 10 * +e2;
  19106. }], SSS: [/\d{3}/, function(e2) {
  19107. this.milliseconds = +e2;
  19108. }], 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) {
  19109. var t2 = s.ordinal, n2 = e2.match(/\d+/);
  19110. if (this.day = n2[0], t2)
  19111. for (var r2 = 1; r2 <= 31; r2 += 1)
  19112. t2(r2).replace(/\[|\]/g, "") === e2 && (this.day = r2);
  19113. }], w: [i, f("week")], ww: [r, f("week")], M: [i, f("month")], MM: [r, f("month")], MMM: [o, function(e2) {
  19114. var t2 = u("months"), n2 = (u("monthsShort") || t2.map(function(e3) {
  19115. return e3.slice(0, 3);
  19116. })).indexOf(e2) + 1;
  19117. if (n2 < 1)
  19118. throw new Error();
  19119. this.month = n2 % 12 || n2;
  19120. }], MMMM: [o, function(e2) {
  19121. var t2 = u("months").indexOf(e2) + 1;
  19122. if (t2 < 1)
  19123. throw new Error();
  19124. this.month = t2 % 12 || t2;
  19125. }], Y: [/[+-]?\d+/, f("year")], YY: [r, function(e2) {
  19126. this.year = a(e2);
  19127. }], YYYY: [/\d{4}/, f("year")], Z: h, ZZ: h };
  19128. function l(n2) {
  19129. var r2, i2;
  19130. r2 = n2, i2 = s && s.formats;
  19131. for (var o2 = (n2 = r2.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g, function(t2, n3, r3) {
  19132. var o3 = r3 && r3.toUpperCase();
  19133. return n3 || i2[r3] || e[r3] || i2[o3].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, function(e2, t3, n4) {
  19134. return t3 || n4.slice(1);
  19135. });
  19136. })).match(t), a2 = o2.length, f2 = 0; f2 < a2; f2 += 1) {
  19137. var h2 = o2[f2], u2 = c[h2], d2 = u2 && u2[0], l2 = u2 && u2[1];
  19138. o2[f2] = l2 ? { regex: d2, parser: l2 } : h2.replace(/^\[|\]$/g, "");
  19139. }
  19140. return function(e2) {
  19141. for (var t2 = {}, n3 = 0, r3 = 0; n3 < a2; n3 += 1) {
  19142. var i3 = o2[n3];
  19143. if (typeof i3 == "string")
  19144. r3 += i3.length;
  19145. else {
  19146. var s2 = i3.regex, f3 = i3.parser, h3 = e2.slice(r3), u3 = s2.exec(h3)[0];
  19147. f3.call(t2, u3), e2 = e2.replace(u3, "");
  19148. }
  19149. }
  19150. return function(e3) {
  19151. var t3 = e3.afternoon;
  19152. if (t3 !== void 0) {
  19153. var n4 = e3.hours;
  19154. t3 ? n4 < 12 && (e3.hours += 12) : n4 === 12 && (e3.hours = 0), delete e3.afternoon;
  19155. }
  19156. }(t2), t2;
  19157. };
  19158. }
  19159. return function(e2, t2, n2) {
  19160. n2.p.customParseFormat = true, e2 && e2.parseTwoDigitYear && (a = e2.parseTwoDigitYear);
  19161. var r2 = t2.prototype, i2 = r2.parse;
  19162. r2.parse = function(e3) {
  19163. var t3 = e3.date, r3 = e3.utc, o2 = e3.args;
  19164. this.$u = r3;
  19165. var a2 = o2[1];
  19166. if (typeof a2 == "string") {
  19167. var f2 = o2[2] === true, h2 = o2[3] === true, u2 = f2 || h2, d2 = o2[2];
  19168. h2 && (d2 = o2[2]), s = this.$locale(), !f2 && d2 && (s = n2.Ls[d2]), this.$d = function(e4, t4, n3, r4) {
  19169. try {
  19170. if (["x", "X"].indexOf(t4) > -1)
  19171. return new Date((t4 === "X" ? 1e3 : 1) * e4);
  19172. 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;
  19173. o3 && !s2 || (v = s2 > 0 ? s2 - 1 : M2.getMonth());
  19174. var D, w = f3 || 0, g = h3 || 0, y = u3 || 0, L = d3 || 0;
  19175. 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);
  19176. } catch (e5) {
  19177. return new Date("");
  19178. }
  19179. }(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 = {};
  19180. } else if (a2 instanceof Array)
  19181. for (var c2 = a2.length, m = 1; m <= c2; m += 1) {
  19182. o2[1] = a2[m - 1];
  19183. var M = n2.apply(this, o2);
  19184. if (M.isValid()) {
  19185. this.$d = M.$d, this.$L = M.$L, this.init();
  19186. break;
  19187. }
  19188. m === c2 && (this.$d = new Date(""));
  19189. }
  19190. else
  19191. i2.call(this, e3);
  19192. };
  19193. };
  19194. });
  19195. })(customParseFormat$1);
  19196. var customParseFormat = customParseFormat$1.exports;
  19197. const timeUnits$1 = ["hours", "minutes", "seconds"];
  19198. const PICKER_BASE_INJECTION_KEY = "EP_PICKER_BASE";
  19199. const PICKER_POPPER_OPTIONS_INJECTION_KEY = "ElPopperOptions";
  19200. const ROOT_COMMON_PICKER_INJECTION_KEY = Symbol("commonPickerContextKey");
  19201. const DEFAULT_FORMATS_TIME = "HH:mm:ss";
  19202. const DEFAULT_FORMATS_DATE = "YYYY-MM-DD";
  19203. const DEFAULT_FORMATS_DATEPICKER = {
  19204. date: DEFAULT_FORMATS_DATE,
  19205. dates: DEFAULT_FORMATS_DATE,
  19206. week: "gggg[w]ww",
  19207. year: "YYYY",
  19208. years: "YYYY",
  19209. month: "YYYY-MM",
  19210. months: "YYYY-MM",
  19211. datetime: `${DEFAULT_FORMATS_DATE} ${DEFAULT_FORMATS_TIME}`,
  19212. monthrange: "YYYY-MM",
  19213. yearrange: "YYYY",
  19214. daterange: DEFAULT_FORMATS_DATE,
  19215. datetimerange: `${DEFAULT_FORMATS_DATE} ${DEFAULT_FORMATS_TIME}`
  19216. };
  19217. const buildTimeList = (value, bound) => {
  19218. return [
  19219. value > 0 ? value - 1 : void 0,
  19220. value,
  19221. value < bound ? value + 1 : void 0
  19222. ];
  19223. };
  19224. const rangeArr = (n) => Array.from(Array.from({ length: n }).keys());
  19225. const extractDateFormat = (format) => {
  19226. return format.replace(/\W?m{1,2}|\W?ZZ/g, "").replace(/\W?h{1,2}|\W?s{1,3}|\W?a/gi, "").trim();
  19227. };
  19228. const extractTimeFormat = (format) => {
  19229. return format.replace(/\W?D{1,2}|\W?Do|\W?d{1,4}|\W?M{1,4}|\W?Y{2,4}/g, "").trim();
  19230. };
  19231. const dateEquals = function(a, b) {
  19232. const aIsDate = isDate$1(a);
  19233. const bIsDate = isDate$1(b);
  19234. if (aIsDate && bIsDate) {
  19235. return a.getTime() === b.getTime();
  19236. }
  19237. if (!aIsDate && !bIsDate) {
  19238. return a === b;
  19239. }
  19240. return false;
  19241. };
  19242. const valueEquals = function(a, b) {
  19243. const aIsArray = isArray$1(a);
  19244. const bIsArray = isArray$1(b);
  19245. if (aIsArray && bIsArray) {
  19246. if (a.length !== b.length) {
  19247. return false;
  19248. }
  19249. return a.every((item, index) => dateEquals(item, b[index]));
  19250. }
  19251. if (!aIsArray && !bIsArray) {
  19252. return dateEquals(a, b);
  19253. }
  19254. return false;
  19255. };
  19256. const parseDate = function(date, format, lang) {
  19257. const day = isEmpty(format) || format === "x" ? dayjs(date).locale(lang) : dayjs(date, format).locale(lang);
  19258. return day.isValid() ? day : void 0;
  19259. };
  19260. const formatter = function(date, format, lang) {
  19261. if (isEmpty(format))
  19262. return date;
  19263. if (format === "x")
  19264. return +date;
  19265. return dayjs(date).locale(lang).format(format);
  19266. };
  19267. const makeList = (total, method) => {
  19268. var _a;
  19269. const arr = [];
  19270. const disabledArr = method == null ? void 0 : method();
  19271. for (let i = 0; i < total; i++) {
  19272. arr.push((_a = disabledArr == null ? void 0 : disabledArr.includes(i)) != null ? _a : false);
  19273. }
  19274. return arr;
  19275. };
  19276. const dayOrDaysToDate = (dayOrDays) => {
  19277. return isArray$1(dayOrDays) ? dayOrDays.map((d) => d.toDate()) : dayOrDays.toDate();
  19278. };
  19279. const useCommonPicker = (props, emit) => {
  19280. const { lang } = useLocale();
  19281. const pickerVisible = vue.ref(false);
  19282. const pickerActualVisible = vue.ref(false);
  19283. const userInput = vue.ref(null);
  19284. const valueIsEmpty = vue.computed(() => {
  19285. const { modelValue } = props;
  19286. return !modelValue || isArray$1(modelValue) && !modelValue.filter(Boolean).length;
  19287. });
  19288. const emitInput = (input) => {
  19289. if (!valueEquals(props.modelValue, input)) {
  19290. let formatted;
  19291. if (isArray$1(input)) {
  19292. formatted = input.map((item) => formatter(item, props.valueFormat, lang.value));
  19293. } else if (input) {
  19294. formatted = formatter(input, props.valueFormat, lang.value);
  19295. }
  19296. const emitVal = input ? formatted : input;
  19297. emit(UPDATE_MODEL_EVENT, emitVal, lang.value);
  19298. }
  19299. };
  19300. const parsedValue = vue.computed(() => {
  19301. var _a;
  19302. let dayOrDays;
  19303. if (valueIsEmpty.value) {
  19304. if (pickerOptions.value.getDefaultValue) {
  19305. dayOrDays = pickerOptions.value.getDefaultValue();
  19306. }
  19307. } else {
  19308. if (isArray$1(props.modelValue)) {
  19309. dayOrDays = props.modelValue.map((d) => parseDate(d, props.valueFormat, lang.value));
  19310. } else {
  19311. dayOrDays = parseDate((_a = props.modelValue) != null ? _a : "", props.valueFormat, lang.value);
  19312. }
  19313. }
  19314. if (pickerOptions.value.getRangeAvailableTime) {
  19315. const availableResult = pickerOptions.value.getRangeAvailableTime(dayOrDays);
  19316. if (!isEqual$1(availableResult, dayOrDays)) {
  19317. dayOrDays = availableResult;
  19318. if (!valueIsEmpty.value) {
  19319. emitInput(dayOrDaysToDate(dayOrDays));
  19320. }
  19321. }
  19322. }
  19323. if (isArray$1(dayOrDays) && dayOrDays.some((day) => !day)) {
  19324. dayOrDays = [];
  19325. }
  19326. return dayOrDays;
  19327. });
  19328. const pickerOptions = vue.ref({});
  19329. const onSetPickerOption = (e) => {
  19330. pickerOptions.value[e[0]] = e[1];
  19331. pickerOptions.value.panelReady = true;
  19332. };
  19333. const onCalendarChange = (e) => {
  19334. emit("calendar-change", e);
  19335. };
  19336. const onPanelChange = (value, mode, view) => {
  19337. emit("panel-change", value, mode, view);
  19338. };
  19339. const onPick = (date = "", visible = false) => {
  19340. pickerVisible.value = visible;
  19341. let result;
  19342. if (isArray$1(date)) {
  19343. result = date.map((_) => _.toDate());
  19344. } else {
  19345. result = date ? date.toDate() : date;
  19346. }
  19347. userInput.value = null;
  19348. emitInput(result);
  19349. };
  19350. return {
  19351. parsedValue,
  19352. pickerActualVisible,
  19353. pickerOptions,
  19354. pickerVisible,
  19355. userInput,
  19356. valueIsEmpty,
  19357. emitInput,
  19358. onCalendarChange,
  19359. onPanelChange,
  19360. onPick,
  19361. onSetPickerOption
  19362. };
  19363. };
  19364. const disabledTimeListsProps = buildProps({
  19365. disabledHours: {
  19366. type: definePropType(Function)
  19367. },
  19368. disabledMinutes: {
  19369. type: definePropType(Function)
  19370. },
  19371. disabledSeconds: {
  19372. type: definePropType(Function)
  19373. }
  19374. });
  19375. const timePanelSharedProps = buildProps({
  19376. visible: Boolean,
  19377. actualVisible: {
  19378. type: Boolean,
  19379. default: void 0
  19380. },
  19381. format: {
  19382. type: String,
  19383. default: ""
  19384. }
  19385. });
  19386. const timePickerDefaultProps = buildProps({
  19387. automaticDropdown: {
  19388. type: Boolean,
  19389. default: true
  19390. },
  19391. id: {
  19392. type: definePropType([Array, String])
  19393. },
  19394. name: {
  19395. type: definePropType([Array, String])
  19396. },
  19397. popperClass: useTooltipContentProps.popperClass,
  19398. popperStyle: useTooltipContentProps.popperStyle,
  19399. format: String,
  19400. valueFormat: String,
  19401. dateFormat: String,
  19402. timeFormat: String,
  19403. type: {
  19404. type: String,
  19405. default: ""
  19406. },
  19407. clearable: {
  19408. type: Boolean,
  19409. default: true
  19410. },
  19411. clearIcon: {
  19412. type: definePropType([String, Object]),
  19413. default: circle_close_default
  19414. },
  19415. editable: {
  19416. type: Boolean,
  19417. default: true
  19418. },
  19419. prefixIcon: {
  19420. type: definePropType([String, Object]),
  19421. default: ""
  19422. },
  19423. size: useSizeProp,
  19424. readonly: Boolean,
  19425. disabled: Boolean,
  19426. placeholder: {
  19427. type: String,
  19428. default: ""
  19429. },
  19430. popperOptions: {
  19431. type: definePropType(Object),
  19432. default: () => ({})
  19433. },
  19434. modelValue: {
  19435. type: definePropType([Date, Array, String, Number]),
  19436. default: ""
  19437. },
  19438. rangeSeparator: {
  19439. type: String,
  19440. default: "-"
  19441. },
  19442. startPlaceholder: String,
  19443. endPlaceholder: String,
  19444. defaultValue: {
  19445. type: definePropType([Date, Array])
  19446. },
  19447. defaultTime: {
  19448. type: definePropType([Date, Array])
  19449. },
  19450. isRange: Boolean,
  19451. ...disabledTimeListsProps,
  19452. disabledDate: {
  19453. type: Function
  19454. },
  19455. cellClassName: {
  19456. type: Function
  19457. },
  19458. shortcuts: {
  19459. type: Array,
  19460. default: () => []
  19461. },
  19462. arrowControl: Boolean,
  19463. tabindex: {
  19464. type: definePropType([String, Number]),
  19465. default: 0
  19466. },
  19467. validateEvent: {
  19468. type: Boolean,
  19469. default: true
  19470. },
  19471. unlinkPanels: Boolean,
  19472. placement: {
  19473. type: definePropType(String),
  19474. values: Ee,
  19475. default: "bottom"
  19476. },
  19477. fallbackPlacements: {
  19478. type: definePropType(Array),
  19479. default: ["bottom", "top", "right", "left"]
  19480. },
  19481. ...useEmptyValuesProps,
  19482. ...useAriaProps(["ariaLabel"]),
  19483. showNow: {
  19484. type: Boolean,
  19485. default: true
  19486. },
  19487. showConfirm: {
  19488. type: Boolean,
  19489. default: true
  19490. },
  19491. showFooter: {
  19492. type: Boolean,
  19493. default: true
  19494. },
  19495. showWeekNumber: Boolean
  19496. });
  19497. const timePickerRangeTriggerProps = buildProps({
  19498. id: {
  19499. type: definePropType(Array)
  19500. },
  19501. name: {
  19502. type: definePropType(Array)
  19503. },
  19504. modelValue: {
  19505. type: definePropType([Array, String])
  19506. },
  19507. startPlaceholder: String,
  19508. endPlaceholder: String,
  19509. disabled: Boolean
  19510. });
  19511. const timePickerRngeTriggerProps = timePickerRangeTriggerProps;
  19512. const __default__$1C = vue.defineComponent({
  19513. name: "PickerRangeTrigger",
  19514. inheritAttrs: false
  19515. });
  19516. const _sfc_main$25 = /* @__PURE__ */ vue.defineComponent({
  19517. ...__default__$1C,
  19518. props: timePickerRangeTriggerProps,
  19519. emits: [
  19520. "mouseenter",
  19521. "mouseleave",
  19522. "click",
  19523. "touchstart",
  19524. "focus",
  19525. "blur",
  19526. "startInput",
  19527. "endInput",
  19528. "startChange",
  19529. "endChange"
  19530. ],
  19531. setup(__props, { expose, emit }) {
  19532. const props = __props;
  19533. const { formItem } = useFormItem();
  19534. const { inputId } = useFormItemInputId(vue.reactive({ id: vue.computed(() => {
  19535. var _a;
  19536. return (_a = props.id) == null ? void 0 : _a[0];
  19537. }) }), {
  19538. formItemContext: formItem
  19539. });
  19540. const attrs = useAttrs();
  19541. const nsDate = useNamespace("date");
  19542. const nsRange = useNamespace("range");
  19543. const inputRef = vue.ref();
  19544. const endInputRef = vue.ref();
  19545. const { wrapperRef, isFocused } = useFocusController(inputRef, {
  19546. disabled: vue.computed(() => props.disabled)
  19547. });
  19548. const handleClick = (evt) => {
  19549. emit("click", evt);
  19550. };
  19551. const handleMouseEnter = (evt) => {
  19552. emit("mouseenter", evt);
  19553. };
  19554. const handleMouseLeave = (evt) => {
  19555. emit("mouseleave", evt);
  19556. };
  19557. const handleTouchStart = (evt) => {
  19558. emit("touchstart", evt);
  19559. };
  19560. const handleStartInput = (evt) => {
  19561. emit("startInput", evt);
  19562. };
  19563. const handleEndInput = (evt) => {
  19564. emit("endInput", evt);
  19565. };
  19566. const handleStartChange = (evt) => {
  19567. emit("startChange", evt);
  19568. };
  19569. const handleEndChange = (evt) => {
  19570. emit("endChange", evt);
  19571. };
  19572. const focus = () => {
  19573. var _a;
  19574. (_a = inputRef.value) == null ? void 0 : _a.focus();
  19575. };
  19576. const blur = () => {
  19577. var _a, _b;
  19578. (_a = inputRef.value) == null ? void 0 : _a.blur();
  19579. (_b = endInputRef.value) == null ? void 0 : _b.blur();
  19580. };
  19581. expose({
  19582. focus,
  19583. blur
  19584. });
  19585. return (_ctx, _cache) => {
  19586. return vue.openBlock(), vue.createElementBlock("div", {
  19587. ref_key: "wrapperRef",
  19588. ref: wrapperRef,
  19589. class: vue.normalizeClass([vue.unref(nsDate).is("active", vue.unref(isFocused)), _ctx.$attrs.class]),
  19590. style: vue.normalizeStyle(_ctx.$attrs.style),
  19591. onClick: handleClick,
  19592. onMouseenter: handleMouseEnter,
  19593. onMouseleave: handleMouseLeave,
  19594. onTouchstartPassive: handleTouchStart
  19595. }, [
  19596. vue.renderSlot(_ctx.$slots, "prefix"),
  19597. vue.createElementVNode("input", vue.mergeProps(vue.unref(attrs), {
  19598. id: vue.unref(inputId),
  19599. ref_key: "inputRef",
  19600. ref: inputRef,
  19601. name: _ctx.name && _ctx.name[0],
  19602. placeholder: _ctx.startPlaceholder,
  19603. value: _ctx.modelValue && _ctx.modelValue[0],
  19604. class: vue.unref(nsRange).b("input"),
  19605. disabled: _ctx.disabled,
  19606. onInput: handleStartInput,
  19607. onChange: handleStartChange
  19608. }), null, 16, ["id", "name", "placeholder", "value", "disabled"]),
  19609. vue.renderSlot(_ctx.$slots, "range-separator"),
  19610. vue.createElementVNode("input", vue.mergeProps(vue.unref(attrs), {
  19611. id: _ctx.id && _ctx.id[1],
  19612. ref_key: "endInputRef",
  19613. ref: endInputRef,
  19614. name: _ctx.name && _ctx.name[1],
  19615. placeholder: _ctx.endPlaceholder,
  19616. value: _ctx.modelValue && _ctx.modelValue[1],
  19617. class: vue.unref(nsRange).b("input"),
  19618. disabled: _ctx.disabled,
  19619. onInput: handleEndInput,
  19620. onChange: handleEndChange
  19621. }), null, 16, ["id", "name", "placeholder", "value", "disabled"]),
  19622. vue.renderSlot(_ctx.$slots, "suffix")
  19623. ], 38);
  19624. };
  19625. }
  19626. });
  19627. var PickerRangeTrigger = /* @__PURE__ */ _export_sfc(_sfc_main$25, [["__file", "picker-range-trigger.vue"]]);
  19628. const __default__$1B = vue.defineComponent({
  19629. name: "Picker"
  19630. });
  19631. const _sfc_main$24 = /* @__PURE__ */ vue.defineComponent({
  19632. ...__default__$1B,
  19633. props: timePickerDefaultProps,
  19634. emits: [
  19635. UPDATE_MODEL_EVENT,
  19636. CHANGE_EVENT,
  19637. "focus",
  19638. "blur",
  19639. "clear",
  19640. "calendar-change",
  19641. "panel-change",
  19642. "visible-change",
  19643. "keydown"
  19644. ],
  19645. setup(__props, { expose, emit }) {
  19646. const props = __props;
  19647. const attrs = vue.useAttrs();
  19648. const nsDate = useNamespace("date");
  19649. const nsInput = useNamespace("input");
  19650. const nsRange = useNamespace("range");
  19651. const { formItem } = useFormItem();
  19652. const elPopperOptions = vue.inject(PICKER_POPPER_OPTIONS_INJECTION_KEY, {});
  19653. const emptyValues = useEmptyValues(props, null);
  19654. const refPopper = vue.ref();
  19655. const inputRef = vue.ref();
  19656. const valueOnOpen = vue.ref(null);
  19657. let hasJustTabExitedInput = false;
  19658. const pickerDisabled = useFormDisabled();
  19659. const commonPicker = useCommonPicker(props, emit);
  19660. const {
  19661. parsedValue,
  19662. pickerActualVisible,
  19663. userInput,
  19664. pickerVisible,
  19665. pickerOptions,
  19666. valueIsEmpty,
  19667. emitInput,
  19668. onPick,
  19669. onSetPickerOption,
  19670. onCalendarChange,
  19671. onPanelChange
  19672. } = commonPicker;
  19673. const { isFocused, handleFocus, handleBlur } = useFocusController(inputRef, {
  19674. disabled: pickerDisabled,
  19675. beforeFocus() {
  19676. return props.readonly;
  19677. },
  19678. afterFocus() {
  19679. if (!props.automaticDropdown)
  19680. return;
  19681. pickerVisible.value = true;
  19682. },
  19683. beforeBlur(event) {
  19684. var _a;
  19685. return !hasJustTabExitedInput && ((_a = refPopper.value) == null ? void 0 : _a.isFocusInsideContent(event));
  19686. },
  19687. afterBlur() {
  19688. handleChange();
  19689. pickerVisible.value = false;
  19690. hasJustTabExitedInput = false;
  19691. props.validateEvent && (formItem == null ? void 0 : formItem.validate("blur").catch((err) => debugWarn(err)));
  19692. }
  19693. });
  19694. const hovering = vue.ref(false);
  19695. const rangeInputKls = vue.computed(() => [
  19696. nsDate.b("editor"),
  19697. nsDate.bm("editor", props.type),
  19698. nsInput.e("wrapper"),
  19699. nsDate.is("disabled", pickerDisabled.value),
  19700. nsDate.is("active", pickerVisible.value),
  19701. nsRange.b("editor"),
  19702. pickerSize ? nsRange.bm("editor", pickerSize.value) : "",
  19703. attrs.class
  19704. ]);
  19705. const clearIconKls = vue.computed(() => [
  19706. nsInput.e("icon"),
  19707. nsRange.e("close-icon"),
  19708. !showClearBtn.value ? nsRange.em("close-icon", "hidden") : ""
  19709. ]);
  19710. vue.watch(pickerVisible, (val) => {
  19711. if (!val) {
  19712. userInput.value = null;
  19713. vue.nextTick(() => {
  19714. emitChange(props.modelValue);
  19715. });
  19716. } else {
  19717. vue.nextTick(() => {
  19718. if (val) {
  19719. valueOnOpen.value = props.modelValue;
  19720. }
  19721. });
  19722. }
  19723. });
  19724. const emitChange = (val, isClear) => {
  19725. if (isClear || !valueEquals(val, valueOnOpen.value)) {
  19726. emit(CHANGE_EVENT, val);
  19727. isClear && (valueOnOpen.value = val);
  19728. props.validateEvent && (formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn(err)));
  19729. }
  19730. };
  19731. const emitKeydown = (e) => {
  19732. emit("keydown", e);
  19733. };
  19734. const refInput = vue.computed(() => {
  19735. if (inputRef.value) {
  19736. return Array.from(inputRef.value.$el.querySelectorAll("input"));
  19737. }
  19738. return [];
  19739. });
  19740. const setSelectionRange = (start, end, pos) => {
  19741. const _inputs = refInput.value;
  19742. if (!_inputs.length)
  19743. return;
  19744. if (!pos || pos === "min") {
  19745. _inputs[0].setSelectionRange(start, end);
  19746. _inputs[0].focus();
  19747. } else if (pos === "max") {
  19748. _inputs[1].setSelectionRange(start, end);
  19749. _inputs[1].focus();
  19750. }
  19751. };
  19752. const onBeforeShow = () => {
  19753. pickerActualVisible.value = true;
  19754. };
  19755. const onShow = () => {
  19756. emit("visible-change", true);
  19757. };
  19758. const onHide = () => {
  19759. pickerActualVisible.value = false;
  19760. pickerVisible.value = false;
  19761. emit("visible-change", false);
  19762. };
  19763. const handleOpen = () => {
  19764. pickerVisible.value = true;
  19765. };
  19766. const handleClose = () => {
  19767. pickerVisible.value = false;
  19768. };
  19769. const displayValue = vue.computed(() => {
  19770. const formattedValue = formatToString(parsedValue.value);
  19771. if (isArray$1(userInput.value)) {
  19772. return [
  19773. userInput.value[0] || formattedValue && formattedValue[0] || "",
  19774. userInput.value[1] || formattedValue && formattedValue[1] || ""
  19775. ];
  19776. } else if (userInput.value !== null) {
  19777. return userInput.value;
  19778. }
  19779. if (!isTimePicker.value && valueIsEmpty.value)
  19780. return "";
  19781. if (!pickerVisible.value && valueIsEmpty.value)
  19782. return "";
  19783. if (formattedValue) {
  19784. return isDatesPicker.value || isMonthsPicker.value || isYearsPicker.value ? formattedValue.join(", ") : formattedValue;
  19785. }
  19786. return "";
  19787. });
  19788. const isTimeLikePicker = vue.computed(() => props.type.includes("time"));
  19789. const isTimePicker = vue.computed(() => props.type.startsWith("time"));
  19790. const isDatesPicker = vue.computed(() => props.type === "dates");
  19791. const isMonthsPicker = vue.computed(() => props.type === "months");
  19792. const isYearsPicker = vue.computed(() => props.type === "years");
  19793. const triggerIcon = vue.computed(() => props.prefixIcon || (isTimeLikePicker.value ? clock_default : calendar_default));
  19794. const showClearBtn = vue.computed(() => props.clearable && !pickerDisabled.value && !props.readonly && !valueIsEmpty.value && (hovering.value || isFocused.value));
  19795. const onClearIconClick = (event) => {
  19796. if (props.readonly || pickerDisabled.value)
  19797. return;
  19798. if (showClearBtn.value) {
  19799. event.stopPropagation();
  19800. if (pickerOptions.value.handleClear) {
  19801. pickerOptions.value.handleClear();
  19802. } else {
  19803. emitInput(emptyValues.valueOnClear.value);
  19804. }
  19805. emitChange(emptyValues.valueOnClear.value, true);
  19806. onHide();
  19807. }
  19808. emit("clear");
  19809. };
  19810. const onMouseDownInput = async (event) => {
  19811. var _a;
  19812. if (props.readonly || pickerDisabled.value)
  19813. return;
  19814. if (((_a = event.target) == null ? void 0 : _a.tagName) !== "INPUT" || isFocused.value || !props.automaticDropdown) {
  19815. pickerVisible.value = true;
  19816. }
  19817. };
  19818. const onMouseEnter = () => {
  19819. if (props.readonly || pickerDisabled.value)
  19820. return;
  19821. if (!valueIsEmpty.value && props.clearable) {
  19822. hovering.value = true;
  19823. }
  19824. };
  19825. const onMouseLeave = () => {
  19826. hovering.value = false;
  19827. };
  19828. const onTouchStartInput = (event) => {
  19829. var _a;
  19830. if (props.readonly || pickerDisabled.value)
  19831. return;
  19832. if (((_a = event.touches[0].target) == null ? void 0 : _a.tagName) !== "INPUT" || isFocused.value || !props.automaticDropdown) {
  19833. pickerVisible.value = true;
  19834. }
  19835. };
  19836. const isRangeInput = vue.computed(() => {
  19837. return props.type.includes("range");
  19838. });
  19839. const pickerSize = useFormSize();
  19840. const popperEl = vue.computed(() => {
  19841. var _a, _b;
  19842. return (_b = (_a = vue.unref(refPopper)) == null ? void 0 : _a.popperRef) == null ? void 0 : _b.contentRef;
  19843. });
  19844. const stophandle = onClickOutside(inputRef, (e) => {
  19845. const unrefedPopperEl = vue.unref(popperEl);
  19846. const inputEl = unrefElement(inputRef);
  19847. if (unrefedPopperEl && (e.target === unrefedPopperEl || e.composedPath().includes(unrefedPopperEl)) || e.target === inputEl || inputEl && e.composedPath().includes(inputEl))
  19848. return;
  19849. pickerVisible.value = false;
  19850. });
  19851. vue.onBeforeUnmount(() => {
  19852. stophandle == null ? void 0 : stophandle();
  19853. });
  19854. const handleChange = () => {
  19855. if (userInput.value) {
  19856. const value = parseUserInputToDayjs(displayValue.value);
  19857. if (value) {
  19858. if (isValidValue(value)) {
  19859. emitInput(dayOrDaysToDate(value));
  19860. userInput.value = null;
  19861. }
  19862. }
  19863. }
  19864. if (userInput.value === "") {
  19865. emitInput(emptyValues.valueOnClear.value);
  19866. emitChange(emptyValues.valueOnClear.value, true);
  19867. userInput.value = null;
  19868. }
  19869. };
  19870. const parseUserInputToDayjs = (value) => {
  19871. if (!value)
  19872. return null;
  19873. return pickerOptions.value.parseUserInput(value);
  19874. };
  19875. const formatToString = (value) => {
  19876. if (!value)
  19877. return null;
  19878. const res = isArray$1(value) ? value.map((_) => _.format(props.format)) : value.format(props.format);
  19879. return res;
  19880. };
  19881. const isValidValue = (value) => {
  19882. return pickerOptions.value.isValidValue(value);
  19883. };
  19884. const handleKeydownInput = async (event) => {
  19885. if (props.readonly || pickerDisabled.value)
  19886. return;
  19887. const code = getEventCode(event);
  19888. emitKeydown(event);
  19889. if (code === EVENT_CODE.esc) {
  19890. if (pickerVisible.value === true) {
  19891. pickerVisible.value = false;
  19892. event.preventDefault();
  19893. event.stopPropagation();
  19894. }
  19895. return;
  19896. }
  19897. if (code === EVENT_CODE.down) {
  19898. if (pickerOptions.value.handleFocusPicker) {
  19899. event.preventDefault();
  19900. event.stopPropagation();
  19901. }
  19902. if (pickerVisible.value === false) {
  19903. pickerVisible.value = true;
  19904. await vue.nextTick();
  19905. }
  19906. if (pickerOptions.value.handleFocusPicker) {
  19907. pickerOptions.value.handleFocusPicker();
  19908. return;
  19909. }
  19910. }
  19911. if (code === EVENT_CODE.tab) {
  19912. hasJustTabExitedInput = true;
  19913. return;
  19914. }
  19915. if (code === EVENT_CODE.enter || code === EVENT_CODE.numpadEnter) {
  19916. if (!pickerVisible.value) {
  19917. pickerVisible.value = true;
  19918. } else if (userInput.value === null || userInput.value === "" || isValidValue(parseUserInputToDayjs(displayValue.value))) {
  19919. handleChange();
  19920. pickerVisible.value = false;
  19921. }
  19922. event.preventDefault();
  19923. event.stopPropagation();
  19924. return;
  19925. }
  19926. if (userInput.value) {
  19927. event.stopPropagation();
  19928. return;
  19929. }
  19930. if (pickerOptions.value.handleKeydownInput) {
  19931. pickerOptions.value.handleKeydownInput(event);
  19932. }
  19933. };
  19934. const onUserInput = (e) => {
  19935. userInput.value = e;
  19936. if (!pickerVisible.value) {
  19937. pickerVisible.value = true;
  19938. }
  19939. };
  19940. const handleStartInput = (event) => {
  19941. const target = event.target;
  19942. if (userInput.value) {
  19943. userInput.value = [target.value, userInput.value[1]];
  19944. } else {
  19945. userInput.value = [target.value, null];
  19946. }
  19947. };
  19948. const handleEndInput = (event) => {
  19949. const target = event.target;
  19950. if (userInput.value) {
  19951. userInput.value = [userInput.value[0], target.value];
  19952. } else {
  19953. userInput.value = [null, target.value];
  19954. }
  19955. };
  19956. const handleStartChange = () => {
  19957. var _a;
  19958. const values = userInput.value;
  19959. const value = parseUserInputToDayjs(values && values[0]);
  19960. const parsedVal = vue.unref(parsedValue);
  19961. if (value && value.isValid()) {
  19962. userInput.value = [
  19963. formatToString(value),
  19964. ((_a = displayValue.value) == null ? void 0 : _a[1]) || null
  19965. ];
  19966. const newValue = [value, parsedVal && (parsedVal[1] || null)];
  19967. if (isValidValue(newValue)) {
  19968. emitInput(dayOrDaysToDate(newValue));
  19969. userInput.value = null;
  19970. }
  19971. }
  19972. };
  19973. const handleEndChange = () => {
  19974. var _a;
  19975. const values = vue.unref(userInput);
  19976. const value = parseUserInputToDayjs(values && values[1]);
  19977. const parsedVal = vue.unref(parsedValue);
  19978. if (value && value.isValid()) {
  19979. userInput.value = [
  19980. ((_a = vue.unref(displayValue)) == null ? void 0 : _a[0]) || null,
  19981. formatToString(value)
  19982. ];
  19983. const newValue = [parsedVal && parsedVal[0], value];
  19984. if (isValidValue(newValue)) {
  19985. emitInput(dayOrDaysToDate(newValue));
  19986. userInput.value = null;
  19987. }
  19988. }
  19989. };
  19990. const focus = () => {
  19991. var _a;
  19992. (_a = inputRef.value) == null ? void 0 : _a.focus();
  19993. };
  19994. const blur = () => {
  19995. var _a;
  19996. (_a = inputRef.value) == null ? void 0 : _a.blur();
  19997. };
  19998. vue.provide(PICKER_BASE_INJECTION_KEY, {
  19999. props,
  20000. emptyValues
  20001. });
  20002. vue.provide(ROOT_COMMON_PICKER_INJECTION_KEY, commonPicker);
  20003. expose({
  20004. focus,
  20005. blur,
  20006. handleOpen,
  20007. handleClose,
  20008. onPick
  20009. });
  20010. return (_ctx, _cache) => {
  20011. return vue.openBlock(), vue.createBlock(vue.unref(ElTooltip), vue.mergeProps({
  20012. ref_key: "refPopper",
  20013. ref: refPopper,
  20014. visible: vue.unref(pickerVisible),
  20015. effect: "light",
  20016. pure: "",
  20017. trigger: "click"
  20018. }, _ctx.$attrs, {
  20019. role: "dialog",
  20020. teleported: "",
  20021. transition: `${vue.unref(nsDate).namespace.value}-zoom-in-top`,
  20022. "popper-class": [`${vue.unref(nsDate).namespace.value}-picker__popper`, _ctx.popperClass],
  20023. "popper-style": _ctx.popperStyle,
  20024. "popper-options": vue.unref(elPopperOptions),
  20025. "fallback-placements": _ctx.fallbackPlacements,
  20026. "gpu-acceleration": false,
  20027. placement: _ctx.placement,
  20028. "stop-popper-mouse-event": false,
  20029. "hide-after": 0,
  20030. persistent: "",
  20031. onBeforeShow,
  20032. onShow,
  20033. onHide
  20034. }), {
  20035. default: vue.withCtx(() => [
  20036. !vue.unref(isRangeInput) ? (vue.openBlock(), vue.createBlock(vue.unref(ElInput), {
  20037. key: 0,
  20038. id: _ctx.id,
  20039. ref_key: "inputRef",
  20040. ref: inputRef,
  20041. "container-role": "combobox",
  20042. "model-value": vue.unref(displayValue),
  20043. name: _ctx.name,
  20044. size: vue.unref(pickerSize),
  20045. disabled: vue.unref(pickerDisabled),
  20046. placeholder: _ctx.placeholder,
  20047. class: vue.normalizeClass([
  20048. vue.unref(nsDate).b("editor"),
  20049. vue.unref(nsDate).bm("editor", _ctx.type),
  20050. vue.unref(nsDate).is("focus", vue.unref(pickerVisible)),
  20051. _ctx.$attrs.class
  20052. ]),
  20053. style: vue.normalizeStyle(_ctx.$attrs.style),
  20054. readonly: !_ctx.editable || _ctx.readonly || vue.unref(isDatesPicker) || vue.unref(isMonthsPicker) || vue.unref(isYearsPicker) || _ctx.type === "week",
  20055. "aria-label": _ctx.ariaLabel,
  20056. tabindex: _ctx.tabindex,
  20057. "validate-event": false,
  20058. onInput: onUserInput,
  20059. onFocus: vue.unref(handleFocus),
  20060. onBlur: vue.unref(handleBlur),
  20061. onKeydown: handleKeydownInput,
  20062. onChange: handleChange,
  20063. onMousedown: onMouseDownInput,
  20064. onMouseenter: onMouseEnter,
  20065. onMouseleave: onMouseLeave,
  20066. onTouchstartPassive: onTouchStartInput,
  20067. onClick: vue.withModifiers(() => {
  20068. }, ["stop"])
  20069. }, {
  20070. prefix: vue.withCtx(() => [
  20071. vue.unref(triggerIcon) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  20072. key: 0,
  20073. class: vue.normalizeClass(vue.unref(nsInput).e("icon")),
  20074. onMousedown: vue.withModifiers(onMouseDownInput, ["prevent"]),
  20075. onTouchstartPassive: onTouchStartInput
  20076. }, {
  20077. default: vue.withCtx(() => [
  20078. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(triggerIcon))))
  20079. ]),
  20080. _: 1
  20081. }, 8, ["class", "onMousedown"])) : vue.createCommentVNode("v-if", true)
  20082. ]),
  20083. suffix: vue.withCtx(() => [
  20084. vue.unref(showClearBtn) && _ctx.clearIcon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  20085. key: 0,
  20086. class: vue.normalizeClass(`${vue.unref(nsInput).e("icon")} clear-icon`),
  20087. onMousedown: vue.withModifiers(vue.unref(NOOP), ["prevent"]),
  20088. onClick: onClearIconClick
  20089. }, {
  20090. default: vue.withCtx(() => [
  20091. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.clearIcon)))
  20092. ]),
  20093. _: 1
  20094. }, 8, ["class", "onMousedown"])) : vue.createCommentVNode("v-if", true)
  20095. ]),
  20096. _: 1
  20097. }, 8, ["id", "model-value", "name", "size", "disabled", "placeholder", "class", "style", "readonly", "aria-label", "tabindex", "onFocus", "onBlur", "onClick"])) : (vue.openBlock(), vue.createBlock(PickerRangeTrigger, {
  20098. key: 1,
  20099. id: _ctx.id,
  20100. ref_key: "inputRef",
  20101. ref: inputRef,
  20102. "model-value": vue.unref(displayValue),
  20103. name: _ctx.name,
  20104. disabled: vue.unref(pickerDisabled),
  20105. readonly: !_ctx.editable || _ctx.readonly,
  20106. "start-placeholder": _ctx.startPlaceholder,
  20107. "end-placeholder": _ctx.endPlaceholder,
  20108. class: vue.normalizeClass(vue.unref(rangeInputKls)),
  20109. style: vue.normalizeStyle(_ctx.$attrs.style),
  20110. "aria-label": _ctx.ariaLabel,
  20111. tabindex: _ctx.tabindex,
  20112. autocomplete: "off",
  20113. role: "combobox",
  20114. onClick: onMouseDownInput,
  20115. onFocus: vue.unref(handleFocus),
  20116. onBlur: vue.unref(handleBlur),
  20117. onStartInput: handleStartInput,
  20118. onStartChange: handleStartChange,
  20119. onEndInput: handleEndInput,
  20120. onEndChange: handleEndChange,
  20121. onMousedown: onMouseDownInput,
  20122. onMouseenter: onMouseEnter,
  20123. onMouseleave: onMouseLeave,
  20124. onTouchstartPassive: onTouchStartInput,
  20125. onKeydown: handleKeydownInput
  20126. }, {
  20127. prefix: vue.withCtx(() => [
  20128. vue.unref(triggerIcon) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  20129. key: 0,
  20130. class: vue.normalizeClass([vue.unref(nsInput).e("icon"), vue.unref(nsRange).e("icon")])
  20131. }, {
  20132. default: vue.withCtx(() => [
  20133. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(triggerIcon))))
  20134. ]),
  20135. _: 1
  20136. }, 8, ["class"])) : vue.createCommentVNode("v-if", true)
  20137. ]),
  20138. "range-separator": vue.withCtx(() => [
  20139. vue.renderSlot(_ctx.$slots, "range-separator", {}, () => [
  20140. vue.createElementVNode("span", {
  20141. class: vue.normalizeClass(vue.unref(nsRange).b("separator"))
  20142. }, vue.toDisplayString(_ctx.rangeSeparator), 3)
  20143. ])
  20144. ]),
  20145. suffix: vue.withCtx(() => [
  20146. _ctx.clearIcon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  20147. key: 0,
  20148. class: vue.normalizeClass(vue.unref(clearIconKls)),
  20149. onMousedown: vue.withModifiers(vue.unref(NOOP), ["prevent"]),
  20150. onClick: onClearIconClick
  20151. }, {
  20152. default: vue.withCtx(() => [
  20153. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.clearIcon)))
  20154. ]),
  20155. _: 1
  20156. }, 8, ["class", "onMousedown"])) : vue.createCommentVNode("v-if", true)
  20157. ]),
  20158. _: 3
  20159. }, 8, ["id", "model-value", "name", "disabled", "readonly", "start-placeholder", "end-placeholder", "class", "style", "aria-label", "tabindex", "onFocus", "onBlur"]))
  20160. ]),
  20161. content: vue.withCtx(() => [
  20162. vue.renderSlot(_ctx.$slots, "default", {
  20163. visible: vue.unref(pickerVisible),
  20164. actualVisible: vue.unref(pickerActualVisible),
  20165. parsedValue: vue.unref(parsedValue),
  20166. format: _ctx.format,
  20167. dateFormat: _ctx.dateFormat,
  20168. timeFormat: _ctx.timeFormat,
  20169. unlinkPanels: _ctx.unlinkPanels,
  20170. type: _ctx.type,
  20171. defaultValue: _ctx.defaultValue,
  20172. showNow: _ctx.showNow,
  20173. showConfirm: _ctx.showConfirm,
  20174. showFooter: _ctx.showFooter,
  20175. showWeekNumber: _ctx.showWeekNumber,
  20176. onPick: vue.unref(onPick),
  20177. onSelectRange: setSelectionRange,
  20178. onSetPickerOption: vue.unref(onSetPickerOption),
  20179. onCalendarChange: vue.unref(onCalendarChange),
  20180. onPanelChange: vue.unref(onPanelChange),
  20181. onMousedown: vue.withModifiers(() => {
  20182. }, ["stop"])
  20183. })
  20184. ]),
  20185. _: 3
  20186. }, 16, ["visible", "transition", "popper-class", "popper-style", "popper-options", "fallback-placements", "placement"]);
  20187. };
  20188. }
  20189. });
  20190. var CommonPicker = /* @__PURE__ */ _export_sfc(_sfc_main$24, [["__file", "picker.vue"]]);
  20191. const panelTimePickerProps = buildProps({
  20192. ...timePanelSharedProps,
  20193. datetimeRole: String,
  20194. parsedValue: {
  20195. type: definePropType(Object)
  20196. }
  20197. });
  20198. const useTimePanel = ({
  20199. getAvailableHours,
  20200. getAvailableMinutes,
  20201. getAvailableSeconds
  20202. }) => {
  20203. const getAvailableTime = (date, role, first, compareDate) => {
  20204. const availableTimeGetters = {
  20205. hour: getAvailableHours,
  20206. minute: getAvailableMinutes,
  20207. second: getAvailableSeconds
  20208. };
  20209. let result = date;
  20210. ["hour", "minute", "second"].forEach((type) => {
  20211. if (availableTimeGetters[type]) {
  20212. let availableTimeSlots;
  20213. const method = availableTimeGetters[type];
  20214. switch (type) {
  20215. case "minute": {
  20216. availableTimeSlots = method(result.hour(), role, compareDate);
  20217. break;
  20218. }
  20219. case "second": {
  20220. availableTimeSlots = method(result.hour(), result.minute(), role, compareDate);
  20221. break;
  20222. }
  20223. default: {
  20224. availableTimeSlots = method(role, compareDate);
  20225. break;
  20226. }
  20227. }
  20228. if ((availableTimeSlots == null ? void 0 : availableTimeSlots.length) && !availableTimeSlots.includes(result[type]())) {
  20229. const pos = first ? 0 : availableTimeSlots.length - 1;
  20230. result = result[type](availableTimeSlots[pos]);
  20231. }
  20232. }
  20233. });
  20234. return result;
  20235. };
  20236. const timePickerOptions = {};
  20237. const onSetOption = ([key, val]) => {
  20238. timePickerOptions[key] = val;
  20239. };
  20240. return {
  20241. timePickerOptions,
  20242. getAvailableTime,
  20243. onSetOption
  20244. };
  20245. };
  20246. const makeAvailableArr = (disabledList) => {
  20247. const trueOrNumber = (isDisabled, index) => isDisabled || index;
  20248. const getNumber = (predicate) => predicate !== true;
  20249. return disabledList.map(trueOrNumber).filter(getNumber);
  20250. };
  20251. const getTimeLists = (disabledHours, disabledMinutes, disabledSeconds) => {
  20252. const getHoursList = (role, compare) => {
  20253. return makeList(24, disabledHours && (() => disabledHours == null ? void 0 : disabledHours(role, compare)));
  20254. };
  20255. const getMinutesList = (hour, role, compare) => {
  20256. return makeList(60, disabledMinutes && (() => disabledMinutes == null ? void 0 : disabledMinutes(hour, role, compare)));
  20257. };
  20258. const getSecondsList = (hour, minute, role, compare) => {
  20259. return makeList(60, disabledSeconds && (() => disabledSeconds == null ? void 0 : disabledSeconds(hour, minute, role, compare)));
  20260. };
  20261. return {
  20262. getHoursList,
  20263. getMinutesList,
  20264. getSecondsList
  20265. };
  20266. };
  20267. const buildAvailableTimeSlotGetter = (disabledHours, disabledMinutes, disabledSeconds) => {
  20268. const { getHoursList, getMinutesList, getSecondsList } = getTimeLists(disabledHours, disabledMinutes, disabledSeconds);
  20269. const getAvailableHours = (role, compare) => {
  20270. return makeAvailableArr(getHoursList(role, compare));
  20271. };
  20272. const getAvailableMinutes = (hour, role, compare) => {
  20273. return makeAvailableArr(getMinutesList(hour, role, compare));
  20274. };
  20275. const getAvailableSeconds = (hour, minute, role, compare) => {
  20276. return makeAvailableArr(getSecondsList(hour, minute, role, compare));
  20277. };
  20278. return {
  20279. getAvailableHours,
  20280. getAvailableMinutes,
  20281. getAvailableSeconds
  20282. };
  20283. };
  20284. const useOldValue = (props) => {
  20285. const oldValue = vue.ref(props.parsedValue);
  20286. vue.watch(() => props.visible, (val) => {
  20287. if (!val) {
  20288. oldValue.value = props.parsedValue;
  20289. }
  20290. });
  20291. return oldValue;
  20292. };
  20293. const nodeList = /* @__PURE__ */ new Map();
  20294. if (isClient) {
  20295. let startClick;
  20296. document.addEventListener("mousedown", (e) => startClick = e);
  20297. document.addEventListener("mouseup", (e) => {
  20298. if (startClick) {
  20299. for (const handlers of nodeList.values()) {
  20300. for (const { documentHandler } of handlers) {
  20301. documentHandler(e, startClick);
  20302. }
  20303. }
  20304. startClick = void 0;
  20305. }
  20306. });
  20307. }
  20308. function createDocumentHandler(el, binding) {
  20309. let excludes = [];
  20310. if (isArray$1(binding.arg)) {
  20311. excludes = binding.arg;
  20312. } else if (isElement$2(binding.arg)) {
  20313. excludes.push(binding.arg);
  20314. }
  20315. return function(mouseup, mousedown) {
  20316. const popperRef = binding.instance.popperRef;
  20317. const mouseUpTarget = mouseup.target;
  20318. const mouseDownTarget = mousedown == null ? void 0 : mousedown.target;
  20319. const isBound = !binding || !binding.instance;
  20320. const isTargetExists = !mouseUpTarget || !mouseDownTarget;
  20321. const isContainedByEl = el.contains(mouseUpTarget) || el.contains(mouseDownTarget);
  20322. const isSelf = el === mouseUpTarget;
  20323. const isTargetExcluded = excludes.length && excludes.some((item) => item == null ? void 0 : item.contains(mouseUpTarget)) || excludes.length && excludes.includes(mouseDownTarget);
  20324. const isContainedByPopper = popperRef && (popperRef.contains(mouseUpTarget) || popperRef.contains(mouseDownTarget));
  20325. if (isBound || isTargetExists || isContainedByEl || isSelf || isTargetExcluded || isContainedByPopper) {
  20326. return;
  20327. }
  20328. binding.value(mouseup, mousedown);
  20329. };
  20330. }
  20331. const ClickOutside = {
  20332. beforeMount(el, binding) {
  20333. if (!nodeList.has(el)) {
  20334. nodeList.set(el, []);
  20335. }
  20336. nodeList.get(el).push({
  20337. documentHandler: createDocumentHandler(el, binding),
  20338. bindingFn: binding.value
  20339. });
  20340. },
  20341. updated(el, binding) {
  20342. if (!nodeList.has(el)) {
  20343. nodeList.set(el, []);
  20344. }
  20345. const handlers = nodeList.get(el);
  20346. const oldHandlerIndex = handlers.findIndex((item) => item.bindingFn === binding.oldValue);
  20347. const newHandler = {
  20348. documentHandler: createDocumentHandler(el, binding),
  20349. bindingFn: binding.value
  20350. };
  20351. if (oldHandlerIndex >= 0) {
  20352. handlers.splice(oldHandlerIndex, 1, newHandler);
  20353. } else {
  20354. handlers.push(newHandler);
  20355. }
  20356. },
  20357. unmounted(el) {
  20358. nodeList.delete(el);
  20359. }
  20360. };
  20361. const REPEAT_INTERVAL = 100;
  20362. const REPEAT_DELAY = 600;
  20363. const SCOPE$5 = "_RepeatClick";
  20364. const vRepeatClick = {
  20365. beforeMount(el, binding) {
  20366. const value = binding.value;
  20367. const { interval = REPEAT_INTERVAL, delay = REPEAT_DELAY } = isFunction$1(value) ? {} : value;
  20368. let intervalId;
  20369. let delayId;
  20370. const handler = () => isFunction$1(value) ? value() : value.handler();
  20371. const clear = () => {
  20372. if (delayId) {
  20373. clearTimeout(delayId);
  20374. delayId = void 0;
  20375. }
  20376. if (intervalId) {
  20377. clearInterval(intervalId);
  20378. intervalId = void 0;
  20379. }
  20380. };
  20381. const start = (evt) => {
  20382. if (evt.button !== 0)
  20383. return;
  20384. clear();
  20385. handler();
  20386. document.addEventListener("mouseup", clear, { once: true });
  20387. delayId = setTimeout(() => {
  20388. intervalId = setInterval(() => {
  20389. handler();
  20390. }, interval);
  20391. }, delay);
  20392. };
  20393. el[SCOPE$5] = { start, clear };
  20394. el.addEventListener("mousedown", start);
  20395. },
  20396. unmounted(el) {
  20397. if (!el[SCOPE$5])
  20398. return;
  20399. const { start, clear } = el[SCOPE$5];
  20400. if (start) {
  20401. el.removeEventListener("mousedown", start);
  20402. }
  20403. if (clear) {
  20404. clear();
  20405. document.removeEventListener("mouseup", clear);
  20406. }
  20407. el[SCOPE$5] = null;
  20408. }
  20409. };
  20410. const FOCUSABLE_CHILDREN = "_trap-focus-children";
  20411. const FOCUS_STACK = [];
  20412. const FOCUS_HANDLER = (e) => {
  20413. if (FOCUS_STACK.length === 0)
  20414. return;
  20415. const code = getEventCode(e);
  20416. const focusableElement = FOCUS_STACK[FOCUS_STACK.length - 1][FOCUSABLE_CHILDREN];
  20417. if (focusableElement.length > 0 && code === EVENT_CODE.tab) {
  20418. if (focusableElement.length === 1) {
  20419. e.preventDefault();
  20420. if (document.activeElement !== focusableElement[0]) {
  20421. focusableElement[0].focus();
  20422. }
  20423. return;
  20424. }
  20425. const goingBackward = e.shiftKey;
  20426. const isFirst = e.target === focusableElement[0];
  20427. const isLast = e.target === focusableElement[focusableElement.length - 1];
  20428. if (isFirst && goingBackward) {
  20429. e.preventDefault();
  20430. focusableElement[focusableElement.length - 1].focus();
  20431. }
  20432. if (isLast && !goingBackward) {
  20433. e.preventDefault();
  20434. focusableElement[0].focus();
  20435. }
  20436. }
  20437. };
  20438. const TrapFocus = {
  20439. beforeMount(el) {
  20440. el[FOCUSABLE_CHILDREN] = obtainAllFocusableElements$1(el);
  20441. FOCUS_STACK.push(el);
  20442. if (FOCUS_STACK.length <= 1) {
  20443. document.addEventListener("keydown", FOCUS_HANDLER);
  20444. }
  20445. },
  20446. updated(el) {
  20447. vue.nextTick(() => {
  20448. el[FOCUSABLE_CHILDREN] = obtainAllFocusableElements$1(el);
  20449. });
  20450. },
  20451. unmounted() {
  20452. FOCUS_STACK.shift();
  20453. if (FOCUS_STACK.length === 0) {
  20454. document.removeEventListener("keydown", FOCUS_HANDLER);
  20455. }
  20456. }
  20457. };
  20458. 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;/**
  20459. * Checks if an event is supported in the current execution environment.
  20460. *
  20461. * NOTE: This will not work correctly for non-generic events such as `change`,
  20462. * `reset`, `load`, `error`, and `select`.
  20463. *
  20464. * Borrows from Modernizr.
  20465. *
  20466. * @param {string} eventNameSuffix Event name, e.g. "click".
  20467. * @param {?boolean} capture Check if the capture phase is supported.
  20468. * @return {boolean} True if the event is supported.
  20469. * @internal
  20470. * @license Modernizr 3.0.0pre (Custom Build) | MIT
  20471. */
  20472. const SCOPE$4 = "_Mousewheel";
  20473. const mousewheel = function(element, callback) {
  20474. if (element && element.addEventListener) {
  20475. removeWheelHandler(element);
  20476. const fn = function(event) {
  20477. const normalized = Y(event);
  20478. callback && Reflect.apply(callback, this, [event, normalized]);
  20479. };
  20480. element[SCOPE$4] = { wheelHandler: fn };
  20481. element.addEventListener("wheel", fn, { passive: true });
  20482. }
  20483. };
  20484. const removeWheelHandler = (element) => {
  20485. var _a;
  20486. if ((_a = element[SCOPE$4]) == null ? void 0 : _a.wheelHandler) {
  20487. element.removeEventListener("wheel", element[SCOPE$4].wheelHandler);
  20488. element[SCOPE$4] = null;
  20489. }
  20490. };
  20491. const Mousewheel = {
  20492. beforeMount(el, binding) {
  20493. mousewheel(el, binding.value);
  20494. },
  20495. unmounted(el) {
  20496. removeWheelHandler(el);
  20497. },
  20498. updated(el, binding) {
  20499. if (binding.value !== binding.oldValue) {
  20500. mousewheel(el, binding.value);
  20501. }
  20502. }
  20503. };
  20504. const basicTimeSpinnerProps = buildProps({
  20505. role: {
  20506. type: String,
  20507. required: true
  20508. },
  20509. spinnerDate: {
  20510. type: definePropType(Object),
  20511. required: true
  20512. },
  20513. showSeconds: {
  20514. type: Boolean,
  20515. default: true
  20516. },
  20517. arrowControl: Boolean,
  20518. amPmMode: {
  20519. type: definePropType(String),
  20520. default: ""
  20521. },
  20522. ...disabledTimeListsProps
  20523. });
  20524. const _sfc_main$23 = /* @__PURE__ */ vue.defineComponent({
  20525. __name: "basic-time-spinner",
  20526. props: basicTimeSpinnerProps,
  20527. emits: [CHANGE_EVENT, "select-range", "set-option"],
  20528. setup(__props, { emit }) {
  20529. const props = __props;
  20530. const pickerBase = vue.inject(PICKER_BASE_INJECTION_KEY);
  20531. const { isRange, format } = pickerBase.props;
  20532. const ns = useNamespace("time");
  20533. const { getHoursList, getMinutesList, getSecondsList } = getTimeLists(props.disabledHours, props.disabledMinutes, props.disabledSeconds);
  20534. let isScrolling = false;
  20535. const currentScrollbar = vue.ref();
  20536. const listHoursRef = vue.ref();
  20537. const listMinutesRef = vue.ref();
  20538. const listSecondsRef = vue.ref();
  20539. const listRefsMap = {
  20540. hours: listHoursRef,
  20541. minutes: listMinutesRef,
  20542. seconds: listSecondsRef
  20543. };
  20544. const spinnerItems = vue.computed(() => {
  20545. return props.showSeconds ? timeUnits$1 : timeUnits$1.slice(0, 2);
  20546. });
  20547. const timePartials = vue.computed(() => {
  20548. const { spinnerDate } = props;
  20549. const hours = spinnerDate.hour();
  20550. const minutes = spinnerDate.minute();
  20551. const seconds = spinnerDate.second();
  20552. return { hours, minutes, seconds };
  20553. });
  20554. const timeList = vue.computed(() => {
  20555. const { hours, minutes } = vue.unref(timePartials);
  20556. const { role, spinnerDate } = props;
  20557. const compare = !isRange ? spinnerDate : void 0;
  20558. return {
  20559. hours: getHoursList(role, compare),
  20560. minutes: getMinutesList(hours, role, compare),
  20561. seconds: getSecondsList(hours, minutes, role, compare)
  20562. };
  20563. });
  20564. const arrowControlTimeList = vue.computed(() => {
  20565. const { hours, minutes, seconds } = vue.unref(timePartials);
  20566. return {
  20567. hours: buildTimeList(hours, 23),
  20568. minutes: buildTimeList(minutes, 59),
  20569. seconds: buildTimeList(seconds, 59)
  20570. };
  20571. });
  20572. const debouncedResetScroll = debounce((type) => {
  20573. isScrolling = false;
  20574. adjustCurrentSpinner(type);
  20575. }, 200);
  20576. const getAmPmFlag = (hour) => {
  20577. const shouldShowAmPm = !!props.amPmMode;
  20578. if (!shouldShowAmPm)
  20579. return "";
  20580. const isCapital = props.amPmMode === "A";
  20581. let content = hour < 12 ? " am" : " pm";
  20582. if (isCapital)
  20583. content = content.toUpperCase();
  20584. return content;
  20585. };
  20586. const emitSelectRange = (type) => {
  20587. let range = [0, 0];
  20588. const actualFormat = format || DEFAULT_FORMATS_TIME;
  20589. const hourIndex = actualFormat.indexOf("HH");
  20590. const minuteIndex = actualFormat.indexOf("mm");
  20591. const secondIndex = actualFormat.indexOf("ss");
  20592. switch (type) {
  20593. case "hours":
  20594. if (hourIndex !== -1) {
  20595. range = [hourIndex, hourIndex + 2];
  20596. }
  20597. break;
  20598. case "minutes":
  20599. if (minuteIndex !== -1) {
  20600. range = [minuteIndex, minuteIndex + 2];
  20601. }
  20602. break;
  20603. case "seconds":
  20604. if (secondIndex !== -1) {
  20605. range = [secondIndex, secondIndex + 2];
  20606. }
  20607. break;
  20608. }
  20609. const [left, right] = range;
  20610. emit("select-range", left, right);
  20611. currentScrollbar.value = type;
  20612. };
  20613. const adjustCurrentSpinner = (type) => {
  20614. adjustSpinner(type, vue.unref(timePartials)[type]);
  20615. };
  20616. const adjustSpinners = () => {
  20617. adjustCurrentSpinner("hours");
  20618. adjustCurrentSpinner("minutes");
  20619. adjustCurrentSpinner("seconds");
  20620. };
  20621. const getScrollbarElement = (el) => el.querySelector(`.${ns.namespace.value}-scrollbar__wrap`);
  20622. const adjustSpinner = (type, value) => {
  20623. if (props.arrowControl)
  20624. return;
  20625. const scrollbar = vue.unref(listRefsMap[type]);
  20626. if (scrollbar && scrollbar.$el) {
  20627. getScrollbarElement(scrollbar.$el).scrollTop = Math.max(0, value * typeItemHeight(type));
  20628. }
  20629. };
  20630. const typeItemHeight = (type) => {
  20631. const scrollbar = vue.unref(listRefsMap[type]);
  20632. const listItem = scrollbar == null ? void 0 : scrollbar.$el.querySelector("li");
  20633. if (listItem) {
  20634. return Number.parseFloat(getStyle(listItem, "height")) || 0;
  20635. }
  20636. return 0;
  20637. };
  20638. const onIncrement = () => {
  20639. scrollDown(1);
  20640. };
  20641. const onDecrement = () => {
  20642. scrollDown(-1);
  20643. };
  20644. const scrollDown = (step) => {
  20645. if (!currentScrollbar.value) {
  20646. emitSelectRange("hours");
  20647. }
  20648. const label = currentScrollbar.value;
  20649. const now = vue.unref(timePartials)[label];
  20650. const total = currentScrollbar.value === "hours" ? 24 : 60;
  20651. const next = findNextUnDisabled(label, now, step, total);
  20652. modifyDateField(label, next);
  20653. adjustSpinner(label, next);
  20654. vue.nextTick(() => emitSelectRange(label));
  20655. };
  20656. const findNextUnDisabled = (type, now, step, total) => {
  20657. let next = (now + step + total) % total;
  20658. const list = vue.unref(timeList)[type];
  20659. while (list[next] && next !== now) {
  20660. next = (next + step + total) % total;
  20661. }
  20662. return next;
  20663. };
  20664. const modifyDateField = (type, value) => {
  20665. const list = vue.unref(timeList)[type];
  20666. const isDisabled = list[value];
  20667. if (isDisabled)
  20668. return;
  20669. const { hours, minutes, seconds } = vue.unref(timePartials);
  20670. let changeTo;
  20671. switch (type) {
  20672. case "hours":
  20673. changeTo = props.spinnerDate.hour(value).minute(minutes).second(seconds);
  20674. break;
  20675. case "minutes":
  20676. changeTo = props.spinnerDate.hour(hours).minute(value).second(seconds);
  20677. break;
  20678. case "seconds":
  20679. changeTo = props.spinnerDate.hour(hours).minute(minutes).second(value);
  20680. break;
  20681. }
  20682. emit(CHANGE_EVENT, changeTo);
  20683. };
  20684. const handleClick = (type, { value, disabled }) => {
  20685. if (!disabled) {
  20686. modifyDateField(type, value);
  20687. emitSelectRange(type);
  20688. adjustSpinner(type, value);
  20689. }
  20690. };
  20691. const handleScroll = (type) => {
  20692. const scrollbar = vue.unref(listRefsMap[type]);
  20693. if (!scrollbar)
  20694. return;
  20695. isScrolling = true;
  20696. debouncedResetScroll(type);
  20697. const value = Math.min(Math.round((getScrollbarElement(scrollbar.$el).scrollTop - (scrollBarHeight(type) * 0.5 - 10) / typeItemHeight(type) + 3) / typeItemHeight(type)), type === "hours" ? 23 : 59);
  20698. modifyDateField(type, value);
  20699. };
  20700. const scrollBarHeight = (type) => {
  20701. return vue.unref(listRefsMap[type]).$el.offsetHeight;
  20702. };
  20703. const bindScrollEvent = () => {
  20704. const bindFunction = (type) => {
  20705. const scrollbar = vue.unref(listRefsMap[type]);
  20706. if (scrollbar && scrollbar.$el) {
  20707. getScrollbarElement(scrollbar.$el).onscroll = () => {
  20708. handleScroll(type);
  20709. };
  20710. }
  20711. };
  20712. bindFunction("hours");
  20713. bindFunction("minutes");
  20714. bindFunction("seconds");
  20715. };
  20716. vue.onMounted(() => {
  20717. vue.nextTick(() => {
  20718. !props.arrowControl && bindScrollEvent();
  20719. adjustSpinners();
  20720. if (props.role === "start")
  20721. emitSelectRange("hours");
  20722. });
  20723. });
  20724. const setRef = (scrollbar, type) => {
  20725. listRefsMap[type].value = scrollbar != null ? scrollbar : void 0;
  20726. };
  20727. emit("set-option", [`${props.role}_scrollDown`, scrollDown]);
  20728. emit("set-option", [`${props.role}_emitSelectRange`, emitSelectRange]);
  20729. vue.watch(() => props.spinnerDate, () => {
  20730. if (isScrolling)
  20731. return;
  20732. adjustSpinners();
  20733. });
  20734. return (_ctx, _cache) => {
  20735. return vue.openBlock(), vue.createElementBlock("div", {
  20736. class: vue.normalizeClass([vue.unref(ns).b("spinner"), { "has-seconds": _ctx.showSeconds }])
  20737. }, [
  20738. !_ctx.arrowControl ? (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 0 }, vue.renderList(vue.unref(spinnerItems), (item) => {
  20739. return vue.openBlock(), vue.createBlock(vue.unref(ElScrollbar), {
  20740. key: item,
  20741. ref_for: true,
  20742. ref: (scrollbar) => setRef(scrollbar, item),
  20743. class: vue.normalizeClass(vue.unref(ns).be("spinner", "wrapper")),
  20744. "wrap-style": "max-height: inherit;",
  20745. "view-class": vue.unref(ns).be("spinner", "list"),
  20746. noresize: "",
  20747. tag: "ul",
  20748. onMouseenter: ($event) => emitSelectRange(item),
  20749. onMousemove: ($event) => adjustCurrentSpinner(item)
  20750. }, {
  20751. default: vue.withCtx(() => [
  20752. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(timeList)[item], (disabled, key) => {
  20753. return vue.openBlock(), vue.createElementBlock("li", {
  20754. key,
  20755. class: vue.normalizeClass([
  20756. vue.unref(ns).be("spinner", "item"),
  20757. vue.unref(ns).is("active", key === vue.unref(timePartials)[item]),
  20758. vue.unref(ns).is("disabled", disabled)
  20759. ]),
  20760. onClick: ($event) => handleClick(item, { value: key, disabled })
  20761. }, [
  20762. item === "hours" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  20763. vue.createTextVNode(vue.toDisplayString(("0" + (_ctx.amPmMode ? key % 12 || 12 : key)).slice(-2)) + vue.toDisplayString(getAmPmFlag(key)), 1)
  20764. ], 64)) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  20765. vue.createTextVNode(vue.toDisplayString(("0" + key).slice(-2)), 1)
  20766. ], 64))
  20767. ], 10, ["onClick"]);
  20768. }), 128))
  20769. ]),
  20770. _: 2
  20771. }, 1032, ["class", "view-class", "onMouseenter", "onMousemove"]);
  20772. }), 128)) : vue.createCommentVNode("v-if", true),
  20773. _ctx.arrowControl ? (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 1 }, vue.renderList(vue.unref(spinnerItems), (item) => {
  20774. return vue.openBlock(), vue.createElementBlock("div", {
  20775. key: item,
  20776. class: vue.normalizeClass([vue.unref(ns).be("spinner", "wrapper"), vue.unref(ns).is("arrow")]),
  20777. onMouseenter: ($event) => emitSelectRange(item)
  20778. }, [
  20779. vue.withDirectives((vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  20780. class: vue.normalizeClass(["arrow-up", vue.unref(ns).be("spinner", "arrow")])
  20781. }, {
  20782. default: vue.withCtx(() => [
  20783. vue.createVNode(vue.unref(arrow_up_default))
  20784. ]),
  20785. _: 1
  20786. }, 8, ["class"])), [
  20787. [vue.unref(vRepeatClick), onDecrement]
  20788. ]),
  20789. vue.withDirectives((vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  20790. class: vue.normalizeClass(["arrow-down", vue.unref(ns).be("spinner", "arrow")])
  20791. }, {
  20792. default: vue.withCtx(() => [
  20793. vue.createVNode(vue.unref(arrow_down_default))
  20794. ]),
  20795. _: 1
  20796. }, 8, ["class"])), [
  20797. [vue.unref(vRepeatClick), onIncrement]
  20798. ]),
  20799. vue.createElementVNode("ul", {
  20800. class: vue.normalizeClass(vue.unref(ns).be("spinner", "list"))
  20801. }, [
  20802. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(arrowControlTimeList)[item], (time, key) => {
  20803. return vue.openBlock(), vue.createElementBlock("li", {
  20804. key,
  20805. class: vue.normalizeClass([
  20806. vue.unref(ns).be("spinner", "item"),
  20807. vue.unref(ns).is("active", time === vue.unref(timePartials)[item]),
  20808. vue.unref(ns).is("disabled", vue.unref(timeList)[item][time])
  20809. ])
  20810. }, [
  20811. vue.unref(isNumber)(time) ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  20812. item === "hours" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  20813. vue.createTextVNode(vue.toDisplayString(("0" + (_ctx.amPmMode ? time % 12 || 12 : time)).slice(-2)) + vue.toDisplayString(getAmPmFlag(time)), 1)
  20814. ], 64)) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  20815. vue.createTextVNode(vue.toDisplayString(("0" + time).slice(-2)), 1)
  20816. ], 64))
  20817. ], 64)) : vue.createCommentVNode("v-if", true)
  20818. ], 2);
  20819. }), 128))
  20820. ], 2)
  20821. ], 42, ["onMouseenter"]);
  20822. }), 128)) : vue.createCommentVNode("v-if", true)
  20823. ], 2);
  20824. };
  20825. }
  20826. });
  20827. var TimeSpinner = /* @__PURE__ */ _export_sfc(_sfc_main$23, [["__file", "basic-time-spinner.vue"]]);
  20828. const _sfc_main$22 = /* @__PURE__ */ vue.defineComponent({
  20829. __name: "panel-time-pick",
  20830. props: panelTimePickerProps,
  20831. emits: ["pick", "select-range", "set-picker-option"],
  20832. setup(__props, { emit }) {
  20833. const props = __props;
  20834. const pickerBase = vue.inject(PICKER_BASE_INJECTION_KEY);
  20835. const {
  20836. arrowControl,
  20837. disabledHours,
  20838. disabledMinutes,
  20839. disabledSeconds,
  20840. defaultValue
  20841. } = pickerBase.props;
  20842. const { getAvailableHours, getAvailableMinutes, getAvailableSeconds } = buildAvailableTimeSlotGetter(disabledHours, disabledMinutes, disabledSeconds);
  20843. const ns = useNamespace("time");
  20844. const { t, lang } = useLocale();
  20845. const selectionRange = vue.ref([0, 2]);
  20846. const oldValue = useOldValue(props);
  20847. const transitionName = vue.computed(() => {
  20848. return isUndefined(props.actualVisible) ? `${ns.namespace.value}-zoom-in-top` : "";
  20849. });
  20850. const showSeconds = vue.computed(() => {
  20851. return props.format.includes("ss");
  20852. });
  20853. const amPmMode = vue.computed(() => {
  20854. if (props.format.includes("A"))
  20855. return "A";
  20856. if (props.format.includes("a"))
  20857. return "a";
  20858. return "";
  20859. });
  20860. const isValidValue = (_date) => {
  20861. const parsedDate = dayjs(_date).locale(lang.value);
  20862. const result = getRangeAvailableTime(parsedDate);
  20863. return parsedDate.isSame(result);
  20864. };
  20865. const handleCancel = () => {
  20866. const old = oldValue.value;
  20867. emit("pick", old, false);
  20868. vue.nextTick(() => {
  20869. oldValue.value = old;
  20870. });
  20871. };
  20872. const handleConfirm = (visible = false, first = false) => {
  20873. if (first)
  20874. return;
  20875. emit("pick", props.parsedValue, visible);
  20876. };
  20877. const handleChange = (_date) => {
  20878. if (!props.visible) {
  20879. return;
  20880. }
  20881. const result = getRangeAvailableTime(_date).millisecond(0);
  20882. emit("pick", result, true);
  20883. };
  20884. const setSelectionRange = (start, end) => {
  20885. emit("select-range", start, end);
  20886. selectionRange.value = [start, end];
  20887. };
  20888. const changeSelectionRange = (step) => {
  20889. const actualFormat = props.format;
  20890. const hourIndex = actualFormat.indexOf("HH");
  20891. const minuteIndex = actualFormat.indexOf("mm");
  20892. const secondIndex = actualFormat.indexOf("ss");
  20893. const list = [];
  20894. const mapping = [];
  20895. if (hourIndex !== -1) {
  20896. list.push(hourIndex);
  20897. mapping.push("hours");
  20898. }
  20899. if (minuteIndex !== -1) {
  20900. list.push(minuteIndex);
  20901. mapping.push("minutes");
  20902. }
  20903. if (secondIndex !== -1 && showSeconds.value) {
  20904. list.push(secondIndex);
  20905. mapping.push("seconds");
  20906. }
  20907. const index = list.indexOf(selectionRange.value[0]);
  20908. const next = (index + step + list.length) % list.length;
  20909. timePickerOptions["start_emitSelectRange"](mapping[next]);
  20910. };
  20911. const handleKeydown = (event) => {
  20912. const code = getEventCode(event);
  20913. const { left, right, up, down } = EVENT_CODE;
  20914. if ([left, right].includes(code)) {
  20915. const step = code === left ? -1 : 1;
  20916. changeSelectionRange(step);
  20917. event.preventDefault();
  20918. return;
  20919. }
  20920. if ([up, down].includes(code)) {
  20921. const step = code === up ? -1 : 1;
  20922. timePickerOptions["start_scrollDown"](step);
  20923. event.preventDefault();
  20924. return;
  20925. }
  20926. };
  20927. const { timePickerOptions, onSetOption, getAvailableTime } = useTimePanel({
  20928. getAvailableHours,
  20929. getAvailableMinutes,
  20930. getAvailableSeconds
  20931. });
  20932. const getRangeAvailableTime = (date) => {
  20933. return getAvailableTime(date, props.datetimeRole || "", true);
  20934. };
  20935. const parseUserInput = (value) => {
  20936. if (!value)
  20937. return null;
  20938. return dayjs(value, props.format).locale(lang.value);
  20939. };
  20940. const getDefaultValue = () => {
  20941. return dayjs(defaultValue).locale(lang.value);
  20942. };
  20943. emit("set-picker-option", ["isValidValue", isValidValue]);
  20944. emit("set-picker-option", ["parseUserInput", parseUserInput]);
  20945. emit("set-picker-option", ["handleKeydownInput", handleKeydown]);
  20946. emit("set-picker-option", ["getRangeAvailableTime", getRangeAvailableTime]);
  20947. emit("set-picker-option", ["getDefaultValue", getDefaultValue]);
  20948. return (_ctx, _cache) => {
  20949. return vue.openBlock(), vue.createBlock(vue.Transition, { name: vue.unref(transitionName) }, {
  20950. default: vue.withCtx(() => [
  20951. _ctx.actualVisible || _ctx.visible ? (vue.openBlock(), vue.createElementBlock("div", {
  20952. key: 0,
  20953. class: vue.normalizeClass(vue.unref(ns).b("panel"))
  20954. }, [
  20955. vue.createElementVNode("div", {
  20956. class: vue.normalizeClass([vue.unref(ns).be("panel", "content"), { "has-seconds": vue.unref(showSeconds) }])
  20957. }, [
  20958. vue.createVNode(TimeSpinner, {
  20959. ref: "spinner",
  20960. role: _ctx.datetimeRole || "start",
  20961. "arrow-control": vue.unref(arrowControl),
  20962. "show-seconds": vue.unref(showSeconds),
  20963. "am-pm-mode": vue.unref(amPmMode),
  20964. "spinner-date": _ctx.parsedValue,
  20965. "disabled-hours": vue.unref(disabledHours),
  20966. "disabled-minutes": vue.unref(disabledMinutes),
  20967. "disabled-seconds": vue.unref(disabledSeconds),
  20968. onChange: handleChange,
  20969. onSetOption: vue.unref(onSetOption),
  20970. onSelectRange: setSelectionRange
  20971. }, null, 8, ["role", "arrow-control", "show-seconds", "am-pm-mode", "spinner-date", "disabled-hours", "disabled-minutes", "disabled-seconds", "onSetOption"])
  20972. ], 2),
  20973. vue.createElementVNode("div", {
  20974. class: vue.normalizeClass(vue.unref(ns).be("panel", "footer"))
  20975. }, [
  20976. vue.createElementVNode("button", {
  20977. type: "button",
  20978. class: vue.normalizeClass([vue.unref(ns).be("panel", "btn"), "cancel"]),
  20979. onClick: handleCancel
  20980. }, vue.toDisplayString(vue.unref(t)("el.datepicker.cancel")), 3),
  20981. vue.createElementVNode("button", {
  20982. type: "button",
  20983. class: vue.normalizeClass([vue.unref(ns).be("panel", "btn"), "confirm"]),
  20984. onClick: ($event) => handleConfirm()
  20985. }, vue.toDisplayString(vue.unref(t)("el.datepicker.confirm")), 11, ["onClick"])
  20986. ], 2)
  20987. ], 2)) : vue.createCommentVNode("v-if", true)
  20988. ]),
  20989. _: 1
  20990. }, 8, ["name"]);
  20991. };
  20992. }
  20993. });
  20994. var TimePickPanel = /* @__PURE__ */ _export_sfc(_sfc_main$22, [["__file", "panel-time-pick.vue"]]);
  20995. const panelTimeRangeProps = buildProps({
  20996. ...timePanelSharedProps,
  20997. parsedValue: {
  20998. type: definePropType(Array)
  20999. }
  21000. });
  21001. const _sfc_main$21 = /* @__PURE__ */ vue.defineComponent({
  21002. __name: "panel-time-range",
  21003. props: panelTimeRangeProps,
  21004. emits: ["pick", "select-range", "set-picker-option"],
  21005. setup(__props, { emit }) {
  21006. const props = __props;
  21007. const makeSelectRange = (start, end) => {
  21008. const result = [];
  21009. for (let i = start; i <= end; i++) {
  21010. result.push(i);
  21011. }
  21012. return result;
  21013. };
  21014. const { t, lang } = useLocale();
  21015. const nsTime = useNamespace("time");
  21016. const nsPicker = useNamespace("picker");
  21017. const pickerBase = vue.inject(PICKER_BASE_INJECTION_KEY);
  21018. const {
  21019. arrowControl,
  21020. disabledHours,
  21021. disabledMinutes,
  21022. disabledSeconds,
  21023. defaultValue
  21024. } = pickerBase.props;
  21025. const startContainerKls = vue.computed(() => [
  21026. nsTime.be("range-picker", "body"),
  21027. nsTime.be("panel", "content"),
  21028. nsTime.is("arrow", arrowControl),
  21029. showSeconds.value ? "has-seconds" : ""
  21030. ]);
  21031. const endContainerKls = vue.computed(() => [
  21032. nsTime.be("range-picker", "body"),
  21033. nsTime.be("panel", "content"),
  21034. nsTime.is("arrow", arrowControl),
  21035. showSeconds.value ? "has-seconds" : ""
  21036. ]);
  21037. const startTime = vue.computed(() => props.parsedValue[0]);
  21038. const endTime = vue.computed(() => props.parsedValue[1]);
  21039. const oldValue = useOldValue(props);
  21040. const handleCancel = () => {
  21041. const old = oldValue.value;
  21042. emit("pick", old, false);
  21043. vue.nextTick(() => {
  21044. oldValue.value = old;
  21045. });
  21046. };
  21047. const showSeconds = vue.computed(() => {
  21048. return props.format.includes("ss");
  21049. });
  21050. const amPmMode = vue.computed(() => {
  21051. if (props.format.includes("A"))
  21052. return "A";
  21053. if (props.format.includes("a"))
  21054. return "a";
  21055. return "";
  21056. });
  21057. const handleConfirm = (visible = false) => {
  21058. emit("pick", [startTime.value, endTime.value], visible);
  21059. };
  21060. const handleMinChange = (date) => {
  21061. handleChange(date.millisecond(0), endTime.value);
  21062. };
  21063. const handleMaxChange = (date) => {
  21064. handleChange(startTime.value, date.millisecond(0));
  21065. };
  21066. const isValidValue = (_date) => {
  21067. const parsedDate = _date.map((_) => dayjs(_).locale(lang.value));
  21068. const result = getRangeAvailableTime(parsedDate);
  21069. return parsedDate[0].isSame(result[0]) && parsedDate[1].isSame(result[1]);
  21070. };
  21071. const handleChange = (start, end) => {
  21072. if (!props.visible) {
  21073. return;
  21074. }
  21075. emit("pick", [start, end], true);
  21076. };
  21077. const btnConfirmDisabled = vue.computed(() => {
  21078. return startTime.value > endTime.value;
  21079. });
  21080. const selectionRange = vue.ref([0, 2]);
  21081. const setMinSelectionRange = (start, end) => {
  21082. emit("select-range", start, end, "min");
  21083. selectionRange.value = [start, end];
  21084. };
  21085. const offset = vue.computed(() => showSeconds.value ? 11 : 8);
  21086. const setMaxSelectionRange = (start, end) => {
  21087. emit("select-range", start, end, "max");
  21088. const _offset = vue.unref(offset);
  21089. selectionRange.value = [start + _offset, end + _offset];
  21090. };
  21091. const changeSelectionRange = (step) => {
  21092. const list = showSeconds.value ? [0, 3, 6, 11, 14, 17] : [0, 3, 8, 11];
  21093. const mapping = ["hours", "minutes"].concat(showSeconds.value ? ["seconds"] : []);
  21094. const index = list.indexOf(selectionRange.value[0]);
  21095. const next = (index + step + list.length) % list.length;
  21096. const half = list.length / 2;
  21097. if (next < half) {
  21098. timePickerOptions["start_emitSelectRange"](mapping[next]);
  21099. } else {
  21100. timePickerOptions["end_emitSelectRange"](mapping[next - half]);
  21101. }
  21102. };
  21103. const handleKeydown = (event) => {
  21104. const code = getEventCode(event);
  21105. const { left, right, up, down } = EVENT_CODE;
  21106. if ([left, right].includes(code)) {
  21107. const step = code === left ? -1 : 1;
  21108. changeSelectionRange(step);
  21109. event.preventDefault();
  21110. return;
  21111. }
  21112. if ([up, down].includes(code)) {
  21113. const step = code === up ? -1 : 1;
  21114. const role = selectionRange.value[0] < offset.value ? "start" : "end";
  21115. timePickerOptions[`${role}_scrollDown`](step);
  21116. event.preventDefault();
  21117. return;
  21118. }
  21119. };
  21120. const disabledHours_ = (role, compare) => {
  21121. const defaultDisable = disabledHours ? disabledHours(role) : [];
  21122. const isStart = role === "start";
  21123. const compareDate = compare || (isStart ? endTime.value : startTime.value);
  21124. const compareHour = compareDate.hour();
  21125. const nextDisable = isStart ? makeSelectRange(compareHour + 1, 23) : makeSelectRange(0, compareHour - 1);
  21126. return union(defaultDisable, nextDisable);
  21127. };
  21128. const disabledMinutes_ = (hour, role, compare) => {
  21129. const defaultDisable = disabledMinutes ? disabledMinutes(hour, role) : [];
  21130. const isStart = role === "start";
  21131. const compareDate = compare || (isStart ? endTime.value : startTime.value);
  21132. const compareHour = compareDate.hour();
  21133. if (hour !== compareHour) {
  21134. return defaultDisable;
  21135. }
  21136. const compareMinute = compareDate.minute();
  21137. const nextDisable = isStart ? makeSelectRange(compareMinute + 1, 59) : makeSelectRange(0, compareMinute - 1);
  21138. return union(defaultDisable, nextDisable);
  21139. };
  21140. const disabledSeconds_ = (hour, minute, role, compare) => {
  21141. const defaultDisable = disabledSeconds ? disabledSeconds(hour, minute, role) : [];
  21142. const isStart = role === "start";
  21143. const compareDate = compare || (isStart ? endTime.value : startTime.value);
  21144. const compareHour = compareDate.hour();
  21145. const compareMinute = compareDate.minute();
  21146. if (hour !== compareHour || minute !== compareMinute) {
  21147. return defaultDisable;
  21148. }
  21149. const compareSecond = compareDate.second();
  21150. const nextDisable = isStart ? makeSelectRange(compareSecond + 1, 59) : makeSelectRange(0, compareSecond - 1);
  21151. return union(defaultDisable, nextDisable);
  21152. };
  21153. const getRangeAvailableTime = ([start, end]) => {
  21154. return [
  21155. getAvailableTime(start, "start", true, end),
  21156. getAvailableTime(end, "end", false, start)
  21157. ];
  21158. };
  21159. const { getAvailableHours, getAvailableMinutes, getAvailableSeconds } = buildAvailableTimeSlotGetter(disabledHours_, disabledMinutes_, disabledSeconds_);
  21160. const {
  21161. timePickerOptions,
  21162. getAvailableTime,
  21163. onSetOption
  21164. } = useTimePanel({
  21165. getAvailableHours,
  21166. getAvailableMinutes,
  21167. getAvailableSeconds
  21168. });
  21169. const parseUserInput = (days) => {
  21170. if (!days)
  21171. return null;
  21172. if (isArray$1(days)) {
  21173. return days.map((d) => dayjs(d, props.format).locale(lang.value));
  21174. }
  21175. return dayjs(days, props.format).locale(lang.value);
  21176. };
  21177. const getDefaultValue = () => {
  21178. if (isArray$1(defaultValue)) {
  21179. return defaultValue.map((d) => dayjs(d).locale(lang.value));
  21180. }
  21181. const defaultDay = dayjs(defaultValue).locale(lang.value);
  21182. return [defaultDay, defaultDay.add(60, "m")];
  21183. };
  21184. emit("set-picker-option", ["parseUserInput", parseUserInput]);
  21185. emit("set-picker-option", ["isValidValue", isValidValue]);
  21186. emit("set-picker-option", ["handleKeydownInput", handleKeydown]);
  21187. emit("set-picker-option", ["getDefaultValue", getDefaultValue]);
  21188. emit("set-picker-option", ["getRangeAvailableTime", getRangeAvailableTime]);
  21189. return (_ctx, _cache) => {
  21190. return _ctx.actualVisible ? (vue.openBlock(), vue.createElementBlock("div", {
  21191. key: 0,
  21192. class: vue.normalizeClass([vue.unref(nsTime).b("range-picker"), vue.unref(nsPicker).b("panel")])
  21193. }, [
  21194. vue.createElementVNode("div", {
  21195. class: vue.normalizeClass(vue.unref(nsTime).be("range-picker", "content"))
  21196. }, [
  21197. vue.createElementVNode("div", {
  21198. class: vue.normalizeClass(vue.unref(nsTime).be("range-picker", "cell"))
  21199. }, [
  21200. vue.createElementVNode("div", {
  21201. class: vue.normalizeClass(vue.unref(nsTime).be("range-picker", "header"))
  21202. }, vue.toDisplayString(vue.unref(t)("el.datepicker.startTime")), 3),
  21203. vue.createElementVNode("div", {
  21204. class: vue.normalizeClass(vue.unref(startContainerKls))
  21205. }, [
  21206. vue.createVNode(TimeSpinner, {
  21207. ref: "minSpinner",
  21208. role: "start",
  21209. "show-seconds": vue.unref(showSeconds),
  21210. "am-pm-mode": vue.unref(amPmMode),
  21211. "arrow-control": vue.unref(arrowControl),
  21212. "spinner-date": vue.unref(startTime),
  21213. "disabled-hours": disabledHours_,
  21214. "disabled-minutes": disabledMinutes_,
  21215. "disabled-seconds": disabledSeconds_,
  21216. onChange: handleMinChange,
  21217. onSetOption: vue.unref(onSetOption),
  21218. onSelectRange: setMinSelectionRange
  21219. }, null, 8, ["show-seconds", "am-pm-mode", "arrow-control", "spinner-date", "onSetOption"])
  21220. ], 2)
  21221. ], 2),
  21222. vue.createElementVNode("div", {
  21223. class: vue.normalizeClass(vue.unref(nsTime).be("range-picker", "cell"))
  21224. }, [
  21225. vue.createElementVNode("div", {
  21226. class: vue.normalizeClass(vue.unref(nsTime).be("range-picker", "header"))
  21227. }, vue.toDisplayString(vue.unref(t)("el.datepicker.endTime")), 3),
  21228. vue.createElementVNode("div", {
  21229. class: vue.normalizeClass(vue.unref(endContainerKls))
  21230. }, [
  21231. vue.createVNode(TimeSpinner, {
  21232. ref: "maxSpinner",
  21233. role: "end",
  21234. "show-seconds": vue.unref(showSeconds),
  21235. "am-pm-mode": vue.unref(amPmMode),
  21236. "arrow-control": vue.unref(arrowControl),
  21237. "spinner-date": vue.unref(endTime),
  21238. "disabled-hours": disabledHours_,
  21239. "disabled-minutes": disabledMinutes_,
  21240. "disabled-seconds": disabledSeconds_,
  21241. onChange: handleMaxChange,
  21242. onSetOption: vue.unref(onSetOption),
  21243. onSelectRange: setMaxSelectionRange
  21244. }, null, 8, ["show-seconds", "am-pm-mode", "arrow-control", "spinner-date", "onSetOption"])
  21245. ], 2)
  21246. ], 2)
  21247. ], 2),
  21248. vue.createElementVNode("div", {
  21249. class: vue.normalizeClass(vue.unref(nsTime).be("panel", "footer"))
  21250. }, [
  21251. vue.createElementVNode("button", {
  21252. type: "button",
  21253. class: vue.normalizeClass([vue.unref(nsTime).be("panel", "btn"), "cancel"]),
  21254. onClick: ($event) => handleCancel()
  21255. }, vue.toDisplayString(vue.unref(t)("el.datepicker.cancel")), 11, ["onClick"]),
  21256. vue.createElementVNode("button", {
  21257. type: "button",
  21258. class: vue.normalizeClass([vue.unref(nsTime).be("panel", "btn"), "confirm"]),
  21259. disabled: vue.unref(btnConfirmDisabled),
  21260. onClick: ($event) => handleConfirm()
  21261. }, vue.toDisplayString(vue.unref(t)("el.datepicker.confirm")), 11, ["disabled", "onClick"])
  21262. ], 2)
  21263. ], 2)) : vue.createCommentVNode("v-if", true);
  21264. };
  21265. }
  21266. });
  21267. var TimeRangePanel = /* @__PURE__ */ _export_sfc(_sfc_main$21, [["__file", "panel-time-range.vue"]]);
  21268. dayjs.extend(customParseFormat);
  21269. var TimePicker = vue.defineComponent({
  21270. name: "ElTimePicker",
  21271. install: null,
  21272. props: {
  21273. ...timePickerDefaultProps,
  21274. isRange: Boolean
  21275. },
  21276. emits: [UPDATE_MODEL_EVENT],
  21277. setup(props, ctx) {
  21278. const commonPicker = vue.ref();
  21279. const [type, Panel] = props.isRange ? ["timerange", TimeRangePanel] : ["time", TimePickPanel];
  21280. const modelUpdater = (value) => ctx.emit(UPDATE_MODEL_EVENT, value);
  21281. vue.provide(PICKER_POPPER_OPTIONS_INJECTION_KEY, props.popperOptions);
  21282. ctx.expose({
  21283. focus: () => {
  21284. var _a;
  21285. (_a = commonPicker.value) == null ? void 0 : _a.focus();
  21286. },
  21287. blur: () => {
  21288. var _a;
  21289. (_a = commonPicker.value) == null ? void 0 : _a.blur();
  21290. },
  21291. handleOpen: () => {
  21292. var _a;
  21293. (_a = commonPicker.value) == null ? void 0 : _a.handleOpen();
  21294. },
  21295. handleClose: () => {
  21296. var _a;
  21297. (_a = commonPicker.value) == null ? void 0 : _a.handleClose();
  21298. }
  21299. });
  21300. return () => {
  21301. var _a;
  21302. const format = (_a = props.format) != null ? _a : DEFAULT_FORMATS_TIME;
  21303. return vue.createVNode(CommonPicker, vue.mergeProps(props, {
  21304. "ref": commonPicker,
  21305. "type": type,
  21306. "format": format,
  21307. "onUpdate:modelValue": modelUpdater
  21308. }), {
  21309. default: (props2) => vue.createVNode(Panel, props2, null)
  21310. });
  21311. };
  21312. }
  21313. });
  21314. const ElTimePicker = withInstall(TimePicker);
  21315. const getPrevMonthLastDays = (date, count) => {
  21316. const lastDay = date.subtract(1, "month").endOf("month").date();
  21317. return rangeArr(count).map((_, index) => lastDay - (count - index - 1));
  21318. };
  21319. const getMonthDays = (date) => {
  21320. const days = date.daysInMonth();
  21321. return rangeArr(days).map((_, index) => index + 1);
  21322. };
  21323. const toNestedArr = (days) => rangeArr(days.length / 7).map((index) => {
  21324. const start = index * 7;
  21325. return days.slice(start, start + 7);
  21326. });
  21327. const dateTableProps = buildProps({
  21328. selectedDay: {
  21329. type: definePropType(Object)
  21330. },
  21331. range: {
  21332. type: definePropType(Array)
  21333. },
  21334. date: {
  21335. type: definePropType(Object),
  21336. required: true
  21337. },
  21338. hideHeader: {
  21339. type: Boolean
  21340. }
  21341. });
  21342. const dateTableEmits = {
  21343. pick: (value) => isObject$1(value)
  21344. };
  21345. var localeData$1 = {exports: {}};
  21346. (function(module, exports) {
  21347. !function(n, e) {
  21348. module.exports = e() ;
  21349. }(commonjsGlobal, function() {
  21350. return function(n, e, t) {
  21351. var r = e.prototype, o = function(n2) {
  21352. return n2 && (n2.indexOf ? n2 : n2.s);
  21353. }, u = function(n2, e2, t2, r2, u2) {
  21354. var i2 = n2.name ? n2 : n2.$locale(), a2 = o(i2[e2]), s2 = o(i2[t2]), f = a2 || s2.map(function(n3) {
  21355. return n3.slice(0, r2);
  21356. });
  21357. if (!u2)
  21358. return f;
  21359. var d = i2.weekStart;
  21360. return f.map(function(n3, e3) {
  21361. return f[(e3 + (d || 0)) % 7];
  21362. });
  21363. }, i = function() {
  21364. return t.Ls[t.locale()];
  21365. }, a = function(n2, e2) {
  21366. return n2.formats[e2] || function(n3) {
  21367. return n3.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, function(n4, e3, t2) {
  21368. return e3 || t2.slice(1);
  21369. });
  21370. }(n2.formats[e2.toUpperCase()]);
  21371. }, s = function() {
  21372. var n2 = this;
  21373. return { months: function(e2) {
  21374. return e2 ? e2.format("MMMM") : u(n2, "months");
  21375. }, monthsShort: function(e2) {
  21376. return e2 ? e2.format("MMM") : u(n2, "monthsShort", "months", 3);
  21377. }, firstDayOfWeek: function() {
  21378. return n2.$locale().weekStart || 0;
  21379. }, weekdays: function(e2) {
  21380. return e2 ? e2.format("dddd") : u(n2, "weekdays");
  21381. }, weekdaysMin: function(e2) {
  21382. return e2 ? e2.format("dd") : u(n2, "weekdaysMin", "weekdays", 2);
  21383. }, weekdaysShort: function(e2) {
  21384. return e2 ? e2.format("ddd") : u(n2, "weekdaysShort", "weekdays", 3);
  21385. }, longDateFormat: function(e2) {
  21386. return a(n2.$locale(), e2);
  21387. }, meridiem: this.$locale().meridiem, ordinal: this.$locale().ordinal };
  21388. };
  21389. r.localeData = function() {
  21390. return s.bind(this)();
  21391. }, t.localeData = function() {
  21392. var n2 = i();
  21393. return { firstDayOfWeek: function() {
  21394. return n2.weekStart || 0;
  21395. }, weekdays: function() {
  21396. return t.weekdays();
  21397. }, weekdaysShort: function() {
  21398. return t.weekdaysShort();
  21399. }, weekdaysMin: function() {
  21400. return t.weekdaysMin();
  21401. }, months: function() {
  21402. return t.months();
  21403. }, monthsShort: function() {
  21404. return t.monthsShort();
  21405. }, longDateFormat: function(e2) {
  21406. return a(n2, e2);
  21407. }, meridiem: n2.meridiem, ordinal: n2.ordinal };
  21408. }, t.months = function() {
  21409. return u(i(), "months");
  21410. }, t.monthsShort = function() {
  21411. return u(i(), "monthsShort", "months", 3);
  21412. }, t.weekdays = function(n2) {
  21413. return u(i(), "weekdays", null, null, n2);
  21414. }, t.weekdaysShort = function(n2) {
  21415. return u(i(), "weekdaysShort", "weekdays", 3, n2);
  21416. }, t.weekdaysMin = function(n2) {
  21417. return u(i(), "weekdaysMin", "weekdays", 2, n2);
  21418. };
  21419. };
  21420. });
  21421. })(localeData$1);
  21422. var localeData = localeData$1.exports;
  21423. const useDateTable = (props, emit) => {
  21424. dayjs.extend(localeData);
  21425. const firstDayOfWeek = dayjs.localeData().firstDayOfWeek();
  21426. const { t, lang } = useLocale();
  21427. const now = dayjs().locale(lang.value);
  21428. const isInRange = vue.computed(() => !!props.range && !!props.range.length);
  21429. const rows = vue.computed(() => {
  21430. let days = [];
  21431. if (isInRange.value) {
  21432. const [start, end] = props.range;
  21433. const currentMonthRange = rangeArr(end.date() - start.date() + 1).map((index) => ({
  21434. text: start.date() + index,
  21435. type: "current"
  21436. }));
  21437. let remaining = currentMonthRange.length % 7;
  21438. remaining = remaining === 0 ? 0 : 7 - remaining;
  21439. const nextMonthRange = rangeArr(remaining).map((_, index) => ({
  21440. text: index + 1,
  21441. type: "next"
  21442. }));
  21443. days = currentMonthRange.concat(nextMonthRange);
  21444. } else {
  21445. const firstDay = props.date.startOf("month").day();
  21446. const prevMonthDays = getPrevMonthLastDays(props.date, (firstDay - firstDayOfWeek + 7) % 7).map((day) => ({
  21447. text: day,
  21448. type: "prev"
  21449. }));
  21450. const currentMonthDays = getMonthDays(props.date).map((day) => ({
  21451. text: day,
  21452. type: "current"
  21453. }));
  21454. days = [...prevMonthDays, ...currentMonthDays];
  21455. const remaining = 7 - (days.length % 7 || 7);
  21456. const nextMonthDays = rangeArr(remaining).map((_, index) => ({
  21457. text: index + 1,
  21458. type: "next"
  21459. }));
  21460. days = days.concat(nextMonthDays);
  21461. }
  21462. return toNestedArr(days);
  21463. });
  21464. const weekDays = vue.computed(() => {
  21465. const start = firstDayOfWeek;
  21466. if (start === 0) {
  21467. return WEEK_DAYS.map((_) => t(`el.datepicker.weeks.${_}`));
  21468. } else {
  21469. return WEEK_DAYS.slice(start).concat(WEEK_DAYS.slice(0, start)).map((_) => t(`el.datepicker.weeks.${_}`));
  21470. }
  21471. });
  21472. const getFormattedDate = (day, type) => {
  21473. switch (type) {
  21474. case "prev":
  21475. return props.date.startOf("month").subtract(1, "month").date(day);
  21476. case "next":
  21477. return props.date.startOf("month").add(1, "month").date(day);
  21478. case "current":
  21479. return props.date.date(day);
  21480. }
  21481. };
  21482. const handlePickDay = ({ text, type }) => {
  21483. const date = getFormattedDate(text, type);
  21484. emit("pick", date);
  21485. };
  21486. const getSlotData = ({ text, type }) => {
  21487. const day = getFormattedDate(text, type);
  21488. return {
  21489. isSelected: day.isSame(props.selectedDay),
  21490. type: `${type}-month`,
  21491. day: day.format("YYYY-MM-DD"),
  21492. date: day.toDate()
  21493. };
  21494. };
  21495. return {
  21496. now,
  21497. isInRange,
  21498. rows,
  21499. weekDays,
  21500. getFormattedDate,
  21501. handlePickDay,
  21502. getSlotData
  21503. };
  21504. };
  21505. const __default__$1A = vue.defineComponent({
  21506. name: "DateTable"
  21507. });
  21508. const _sfc_main$20 = /* @__PURE__ */ vue.defineComponent({
  21509. ...__default__$1A,
  21510. props: dateTableProps,
  21511. emits: dateTableEmits,
  21512. setup(__props, { expose, emit }) {
  21513. const props = __props;
  21514. const {
  21515. isInRange,
  21516. now,
  21517. rows,
  21518. weekDays,
  21519. getFormattedDate,
  21520. handlePickDay,
  21521. getSlotData
  21522. } = useDateTable(props, emit);
  21523. const nsTable = useNamespace("calendar-table");
  21524. const nsDay = useNamespace("calendar-day");
  21525. const getCellClass = ({ text, type }) => {
  21526. const classes = [type];
  21527. if (type === "current") {
  21528. const date = getFormattedDate(text, type);
  21529. if (date.isSame(props.selectedDay, "day")) {
  21530. classes.push(nsDay.is("selected"));
  21531. }
  21532. if (date.isSame(now, "day")) {
  21533. classes.push(nsDay.is("today"));
  21534. }
  21535. }
  21536. return classes;
  21537. };
  21538. expose({
  21539. getFormattedDate
  21540. });
  21541. return (_ctx, _cache) => {
  21542. return vue.openBlock(), vue.createElementBlock("table", {
  21543. class: vue.normalizeClass([vue.unref(nsTable).b(), vue.unref(nsTable).is("range", vue.unref(isInRange))]),
  21544. cellspacing: "0",
  21545. cellpadding: "0"
  21546. }, [
  21547. !_ctx.hideHeader ? (vue.openBlock(), vue.createElementBlock("thead", { key: 0 }, [
  21548. vue.createElementVNode("tr", null, [
  21549. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(weekDays), (day) => {
  21550. return vue.openBlock(), vue.createElementBlock("th", {
  21551. key: day,
  21552. scope: "col"
  21553. }, vue.toDisplayString(day), 1);
  21554. }), 128))
  21555. ])
  21556. ])) : vue.createCommentVNode("v-if", true),
  21557. vue.createElementVNode("tbody", null, [
  21558. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(rows), (row, index) => {
  21559. return vue.openBlock(), vue.createElementBlock("tr", {
  21560. key: index,
  21561. class: vue.normalizeClass({
  21562. [vue.unref(nsTable).e("row")]: true,
  21563. [vue.unref(nsTable).em("row", "hide-border")]: index === 0 && _ctx.hideHeader
  21564. })
  21565. }, [
  21566. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(row, (cell, key) => {
  21567. return vue.openBlock(), vue.createElementBlock("td", {
  21568. key,
  21569. class: vue.normalizeClass(getCellClass(cell)),
  21570. onClick: ($event) => vue.unref(handlePickDay)(cell)
  21571. }, [
  21572. vue.createElementVNode("div", {
  21573. class: vue.normalizeClass(vue.unref(nsDay).b())
  21574. }, [
  21575. vue.renderSlot(_ctx.$slots, "date-cell", {
  21576. data: vue.unref(getSlotData)(cell)
  21577. }, () => [
  21578. vue.createElementVNode("span", null, vue.toDisplayString(cell.text), 1)
  21579. ])
  21580. ], 2)
  21581. ], 10, ["onClick"]);
  21582. }), 128))
  21583. ], 2);
  21584. }), 128))
  21585. ])
  21586. ], 2);
  21587. };
  21588. }
  21589. });
  21590. var DateTable$1 = /* @__PURE__ */ _export_sfc(_sfc_main$20, [["__file", "date-table.vue"]]);
  21591. const adjacentMonth = (start, end) => {
  21592. const firstMonthLastDay = start.endOf("month");
  21593. const lastMonthFirstDay = end.startOf("month");
  21594. const isSameWeek = firstMonthLastDay.isSame(lastMonthFirstDay, "week");
  21595. const lastMonthStartDay = isSameWeek ? lastMonthFirstDay.add(1, "week") : lastMonthFirstDay;
  21596. return [
  21597. [start, firstMonthLastDay],
  21598. [lastMonthStartDay.startOf("week"), end]
  21599. ];
  21600. };
  21601. const threeConsecutiveMonth = (start, end) => {
  21602. const firstMonthLastDay = start.endOf("month");
  21603. const secondMonthFirstDay = start.add(1, "month").startOf("month");
  21604. const secondMonthStartDay = firstMonthLastDay.isSame(secondMonthFirstDay, "week") ? secondMonthFirstDay.add(1, "week") : secondMonthFirstDay;
  21605. const secondMonthLastDay = secondMonthStartDay.endOf("month");
  21606. const lastMonthFirstDay = end.startOf("month");
  21607. const lastMonthStartDay = secondMonthLastDay.isSame(lastMonthFirstDay, "week") ? lastMonthFirstDay.add(1, "week") : lastMonthFirstDay;
  21608. return [
  21609. [start, firstMonthLastDay],
  21610. [secondMonthStartDay.startOf("week"), secondMonthLastDay],
  21611. [lastMonthStartDay.startOf("week"), end]
  21612. ];
  21613. };
  21614. const useCalendar = (props, emit, componentName) => {
  21615. const { lang } = useLocale();
  21616. const selectedDay = vue.ref();
  21617. const now = dayjs().locale(lang.value);
  21618. const realSelectedDay = vue.computed({
  21619. get() {
  21620. if (!props.modelValue)
  21621. return selectedDay.value;
  21622. return date.value;
  21623. },
  21624. set(val) {
  21625. if (!val)
  21626. return;
  21627. selectedDay.value = val;
  21628. const result = val.toDate();
  21629. emit(INPUT_EVENT, result);
  21630. emit(UPDATE_MODEL_EVENT, result);
  21631. }
  21632. });
  21633. const validatedRange = vue.computed(() => {
  21634. if (!props.range || !isArray$1(props.range) || props.range.length !== 2 || props.range.some((item) => !isDate$1(item)))
  21635. return [];
  21636. const rangeArrDayjs = props.range.map((_) => dayjs(_).locale(lang.value));
  21637. const [startDayjs, endDayjs] = rangeArrDayjs;
  21638. if (startDayjs.isAfter(endDayjs)) {
  21639. debugWarn(componentName, "end time should be greater than start time");
  21640. return [];
  21641. }
  21642. if (startDayjs.isSame(endDayjs, "month")) {
  21643. return calculateValidatedDateRange(startDayjs, endDayjs);
  21644. } else {
  21645. if (startDayjs.add(1, "month").month() !== endDayjs.month()) {
  21646. debugWarn(componentName, "start time and end time interval must not exceed two months");
  21647. return [];
  21648. }
  21649. return calculateValidatedDateRange(startDayjs, endDayjs);
  21650. }
  21651. });
  21652. const date = vue.computed(() => {
  21653. if (!props.modelValue) {
  21654. return realSelectedDay.value || (validatedRange.value.length ? validatedRange.value[0][0] : now);
  21655. } else {
  21656. return dayjs(props.modelValue).locale(lang.value);
  21657. }
  21658. });
  21659. const prevMonthDayjs = vue.computed(() => date.value.subtract(1, "month").date(1));
  21660. const nextMonthDayjs = vue.computed(() => date.value.add(1, "month").date(1));
  21661. const prevYearDayjs = vue.computed(() => date.value.subtract(1, "year").date(1));
  21662. const nextYearDayjs = vue.computed(() => date.value.add(1, "year").date(1));
  21663. const calculateValidatedDateRange = (startDayjs, endDayjs) => {
  21664. const firstDay = startDayjs.startOf("week");
  21665. const lastDay = endDayjs.endOf("week");
  21666. const firstMonth = firstDay.get("month");
  21667. const lastMonth = lastDay.get("month");
  21668. if (firstMonth === lastMonth) {
  21669. return [[firstDay, lastDay]];
  21670. } else if ((firstMonth + 1) % 12 === lastMonth) {
  21671. return adjacentMonth(firstDay, lastDay);
  21672. } else if (firstMonth + 2 === lastMonth || (firstMonth + 1) % 11 === lastMonth) {
  21673. return threeConsecutiveMonth(firstDay, lastDay);
  21674. } else {
  21675. debugWarn(componentName, "start time and end time interval must not exceed two months");
  21676. return [];
  21677. }
  21678. };
  21679. const pickDay = (day) => {
  21680. realSelectedDay.value = day;
  21681. };
  21682. const selectDate = (type) => {
  21683. const dateMap = {
  21684. "prev-month": prevMonthDayjs.value,
  21685. "next-month": nextMonthDayjs.value,
  21686. "prev-year": prevYearDayjs.value,
  21687. "next-year": nextYearDayjs.value,
  21688. today: now
  21689. };
  21690. const day = dateMap[type];
  21691. if (!day.isSame(date.value, "day")) {
  21692. pickDay(day);
  21693. }
  21694. };
  21695. return {
  21696. calculateValidatedDateRange,
  21697. date,
  21698. realSelectedDay,
  21699. pickDay,
  21700. selectDate,
  21701. validatedRange
  21702. };
  21703. };
  21704. const isValidRange$1 = (range) => isArray$1(range) && range.length === 2 && range.every((item) => isDate$1(item));
  21705. const calendarProps = buildProps({
  21706. modelValue: {
  21707. type: Date
  21708. },
  21709. range: {
  21710. type: definePropType(Array),
  21711. validator: isValidRange$1
  21712. }
  21713. });
  21714. const calendarEmits = {
  21715. [UPDATE_MODEL_EVENT]: (value) => isDate$1(value),
  21716. [INPUT_EVENT]: (value) => isDate$1(value)
  21717. };
  21718. const COMPONENT_NAME$h = "ElCalendar";
  21719. const __default__$1z = vue.defineComponent({
  21720. name: COMPONENT_NAME$h
  21721. });
  21722. const _sfc_main$1$ = /* @__PURE__ */ vue.defineComponent({
  21723. ...__default__$1z,
  21724. props: calendarProps,
  21725. emits: calendarEmits,
  21726. setup(__props, { expose, emit }) {
  21727. const props = __props;
  21728. const ns = useNamespace("calendar");
  21729. const {
  21730. calculateValidatedDateRange,
  21731. date,
  21732. pickDay,
  21733. realSelectedDay,
  21734. selectDate,
  21735. validatedRange
  21736. } = useCalendar(props, emit, COMPONENT_NAME$h);
  21737. const { t } = useLocale();
  21738. const i18nDate = vue.computed(() => {
  21739. const pickedMonth = `el.datepicker.month${date.value.format("M")}`;
  21740. return `${date.value.year()} ${t("el.datepicker.year")} ${t(pickedMonth)}`;
  21741. });
  21742. expose({
  21743. selectedDay: realSelectedDay,
  21744. pickDay,
  21745. selectDate,
  21746. calculateValidatedDateRange
  21747. });
  21748. return (_ctx, _cache) => {
  21749. return vue.openBlock(), vue.createElementBlock("div", {
  21750. class: vue.normalizeClass(vue.unref(ns).b())
  21751. }, [
  21752. vue.createElementVNode("div", {
  21753. class: vue.normalizeClass(vue.unref(ns).e("header"))
  21754. }, [
  21755. vue.renderSlot(_ctx.$slots, "header", { date: vue.unref(i18nDate) }, () => [
  21756. vue.createElementVNode("div", {
  21757. class: vue.normalizeClass(vue.unref(ns).e("title"))
  21758. }, vue.toDisplayString(vue.unref(i18nDate)), 3),
  21759. vue.unref(validatedRange).length === 0 ? (vue.openBlock(), vue.createElementBlock("div", {
  21760. key: 0,
  21761. class: vue.normalizeClass(vue.unref(ns).e("button-group"))
  21762. }, [
  21763. vue.createVNode(vue.unref(ElButtonGroup$1), null, {
  21764. default: vue.withCtx(() => [
  21765. vue.createVNode(vue.unref(ElButton), {
  21766. size: "small",
  21767. onClick: ($event) => vue.unref(selectDate)("prev-month")
  21768. }, {
  21769. default: vue.withCtx(() => [
  21770. vue.createTextVNode(vue.toDisplayString(vue.unref(t)("el.datepicker.prevMonth")), 1)
  21771. ]),
  21772. _: 1
  21773. }, 8, ["onClick"]),
  21774. vue.createVNode(vue.unref(ElButton), {
  21775. size: "small",
  21776. onClick: ($event) => vue.unref(selectDate)("today")
  21777. }, {
  21778. default: vue.withCtx(() => [
  21779. vue.createTextVNode(vue.toDisplayString(vue.unref(t)("el.datepicker.today")), 1)
  21780. ]),
  21781. _: 1
  21782. }, 8, ["onClick"]),
  21783. vue.createVNode(vue.unref(ElButton), {
  21784. size: "small",
  21785. onClick: ($event) => vue.unref(selectDate)("next-month")
  21786. }, {
  21787. default: vue.withCtx(() => [
  21788. vue.createTextVNode(vue.toDisplayString(vue.unref(t)("el.datepicker.nextMonth")), 1)
  21789. ]),
  21790. _: 1
  21791. }, 8, ["onClick"])
  21792. ]),
  21793. _: 1
  21794. })
  21795. ], 2)) : vue.createCommentVNode("v-if", true)
  21796. ])
  21797. ], 2),
  21798. vue.unref(validatedRange).length === 0 ? (vue.openBlock(), vue.createElementBlock("div", {
  21799. key: 0,
  21800. class: vue.normalizeClass(vue.unref(ns).e("body"))
  21801. }, [
  21802. vue.createVNode(DateTable$1, {
  21803. date: vue.unref(date),
  21804. "selected-day": vue.unref(realSelectedDay),
  21805. onPick: vue.unref(pickDay)
  21806. }, vue.createSlots({
  21807. _: 2
  21808. }, [
  21809. _ctx.$slots["date-cell"] ? {
  21810. name: "date-cell",
  21811. fn: vue.withCtx((data) => [
  21812. vue.renderSlot(_ctx.$slots, "date-cell", vue.normalizeProps(vue.guardReactiveProps(data)))
  21813. ])
  21814. } : void 0
  21815. ]), 1032, ["date", "selected-day", "onPick"])
  21816. ], 2)) : (vue.openBlock(), vue.createElementBlock("div", {
  21817. key: 1,
  21818. class: vue.normalizeClass(vue.unref(ns).e("body"))
  21819. }, [
  21820. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(validatedRange), (range_, index) => {
  21821. return vue.openBlock(), vue.createBlock(DateTable$1, {
  21822. key: index,
  21823. date: range_[0],
  21824. "selected-day": vue.unref(realSelectedDay),
  21825. range: range_,
  21826. "hide-header": index !== 0,
  21827. onPick: vue.unref(pickDay)
  21828. }, vue.createSlots({
  21829. _: 2
  21830. }, [
  21831. _ctx.$slots["date-cell"] ? {
  21832. name: "date-cell",
  21833. fn: vue.withCtx((data) => [
  21834. vue.renderSlot(_ctx.$slots, "date-cell", vue.normalizeProps(vue.guardReactiveProps(data)))
  21835. ])
  21836. } : void 0
  21837. ]), 1032, ["date", "selected-day", "range", "hide-header", "onPick"]);
  21838. }), 128))
  21839. ], 2))
  21840. ], 2);
  21841. };
  21842. }
  21843. });
  21844. var Calendar = /* @__PURE__ */ _export_sfc(_sfc_main$1$, [["__file", "calendar.vue"]]);
  21845. const ElCalendar = withInstall(Calendar);
  21846. const cardProps = buildProps({
  21847. header: {
  21848. type: String,
  21849. default: ""
  21850. },
  21851. footer: {
  21852. type: String,
  21853. default: ""
  21854. },
  21855. bodyStyle: {
  21856. type: definePropType([String, Object, Array]),
  21857. default: ""
  21858. },
  21859. headerClass: String,
  21860. bodyClass: String,
  21861. footerClass: String,
  21862. shadow: {
  21863. type: String,
  21864. values: ["always", "hover", "never"],
  21865. default: void 0
  21866. }
  21867. });
  21868. const cardContextKey = Symbol("cardContextKey");
  21869. const __default__$1y = vue.defineComponent({
  21870. name: "ElCard"
  21871. });
  21872. const _sfc_main$1_ = /* @__PURE__ */ vue.defineComponent({
  21873. ...__default__$1y,
  21874. props: cardProps,
  21875. setup(__props) {
  21876. const globalConfig = useGlobalConfig("card");
  21877. const ns = useNamespace("card");
  21878. return (_ctx, _cache) => {
  21879. var _a;
  21880. return vue.openBlock(), vue.createElementBlock("div", {
  21881. class: vue.normalizeClass([
  21882. vue.unref(ns).b(),
  21883. vue.unref(ns).is(`${_ctx.shadow || ((_a = vue.unref(globalConfig)) == null ? void 0 : _a.shadow) || "always"}-shadow`)
  21884. ])
  21885. }, [
  21886. _ctx.$slots.header || _ctx.header ? (vue.openBlock(), vue.createElementBlock("div", {
  21887. key: 0,
  21888. class: vue.normalizeClass([vue.unref(ns).e("header"), _ctx.headerClass])
  21889. }, [
  21890. vue.renderSlot(_ctx.$slots, "header", {}, () => [
  21891. vue.createTextVNode(vue.toDisplayString(_ctx.header), 1)
  21892. ])
  21893. ], 2)) : vue.createCommentVNode("v-if", true),
  21894. vue.createElementVNode("div", {
  21895. class: vue.normalizeClass([vue.unref(ns).e("body"), _ctx.bodyClass]),
  21896. style: vue.normalizeStyle(_ctx.bodyStyle)
  21897. }, [
  21898. vue.renderSlot(_ctx.$slots, "default")
  21899. ], 6),
  21900. _ctx.$slots.footer || _ctx.footer ? (vue.openBlock(), vue.createElementBlock("div", {
  21901. key: 1,
  21902. class: vue.normalizeClass([vue.unref(ns).e("footer"), _ctx.footerClass])
  21903. }, [
  21904. vue.renderSlot(_ctx.$slots, "footer", {}, () => [
  21905. vue.createTextVNode(vue.toDisplayString(_ctx.footer), 1)
  21906. ])
  21907. ], 2)) : vue.createCommentVNode("v-if", true)
  21908. ], 2);
  21909. };
  21910. }
  21911. });
  21912. var Card = /* @__PURE__ */ _export_sfc(_sfc_main$1_, [["__file", "card.vue"]]);
  21913. const ElCard = withInstall(Card);
  21914. const carouselProps = buildProps({
  21915. initialIndex: {
  21916. type: Number,
  21917. default: 0
  21918. },
  21919. height: {
  21920. type: String,
  21921. default: ""
  21922. },
  21923. trigger: {
  21924. type: String,
  21925. values: ["hover", "click"],
  21926. default: "hover"
  21927. },
  21928. autoplay: {
  21929. type: Boolean,
  21930. default: true
  21931. },
  21932. interval: {
  21933. type: Number,
  21934. default: 3e3
  21935. },
  21936. indicatorPosition: {
  21937. type: String,
  21938. values: ["", "none", "outside"],
  21939. default: ""
  21940. },
  21941. arrow: {
  21942. type: String,
  21943. values: ["always", "hover", "never"],
  21944. default: "hover"
  21945. },
  21946. type: {
  21947. type: String,
  21948. values: ["", "card"],
  21949. default: ""
  21950. },
  21951. cardScale: {
  21952. type: Number,
  21953. default: 0.83
  21954. },
  21955. loop: {
  21956. type: Boolean,
  21957. default: true
  21958. },
  21959. direction: {
  21960. type: String,
  21961. values: ["horizontal", "vertical"],
  21962. default: "horizontal"
  21963. },
  21964. pauseOnHover: {
  21965. type: Boolean,
  21966. default: true
  21967. },
  21968. motionBlur: Boolean
  21969. });
  21970. const carouselEmits = {
  21971. change: (current, prev) => [current, prev].every(isNumber)
  21972. };
  21973. const carouselContextKey = Symbol("carouselContextKey");
  21974. const CAROUSEL_ITEM_NAME = "ElCarouselItem";
  21975. const THROTTLE_TIME = 300;
  21976. const useCarousel = (props, emit, componentName) => {
  21977. const {
  21978. children: items,
  21979. addChild: addItem,
  21980. removeChild: removeItem,
  21981. ChildrenSorter: ItemsSorter
  21982. } = useOrderedChildren(vue.getCurrentInstance(), CAROUSEL_ITEM_NAME);
  21983. const slots = vue.useSlots();
  21984. const activeIndex = vue.ref(-1);
  21985. const timer = vue.ref(null);
  21986. const hover = vue.ref(false);
  21987. const root = vue.ref();
  21988. const containerHeight = vue.ref(0);
  21989. const isItemsTwoLength = vue.ref(true);
  21990. const arrowDisplay = vue.computed(() => props.arrow !== "never" && !vue.unref(isVertical));
  21991. const hasLabel = vue.computed(() => {
  21992. return items.value.some((item) => item.props.label.toString().length > 0);
  21993. });
  21994. const isCardType = vue.computed(() => props.type === "card");
  21995. const isVertical = vue.computed(() => props.direction === "vertical");
  21996. const containerStyle = vue.computed(() => {
  21997. if (props.height !== "auto") {
  21998. return {
  21999. height: props.height
  22000. };
  22001. }
  22002. return {
  22003. height: `${containerHeight.value}px`,
  22004. overflow: "hidden"
  22005. };
  22006. });
  22007. const throttledArrowClick = throttle((index) => {
  22008. setActiveItem(index);
  22009. }, THROTTLE_TIME, { trailing: true });
  22010. const throttledIndicatorHover = throttle((index) => {
  22011. handleIndicatorHover(index);
  22012. }, THROTTLE_TIME);
  22013. const isTwoLengthShow = (index) => {
  22014. if (!isItemsTwoLength.value)
  22015. return true;
  22016. return activeIndex.value <= 1 ? index <= 1 : index > 1;
  22017. };
  22018. function pauseTimer() {
  22019. if (timer.value) {
  22020. clearInterval(timer.value);
  22021. timer.value = null;
  22022. }
  22023. }
  22024. function startTimer() {
  22025. if (props.interval <= 0 || !props.autoplay || timer.value)
  22026. return;
  22027. timer.value = setInterval(() => playSlides(), props.interval);
  22028. }
  22029. const playSlides = () => {
  22030. if (activeIndex.value < items.value.length - 1) {
  22031. activeIndex.value = activeIndex.value + 1;
  22032. } else if (props.loop) {
  22033. activeIndex.value = 0;
  22034. }
  22035. };
  22036. function setActiveItem(index) {
  22037. if (isString$1(index)) {
  22038. const filteredItems = items.value.filter((item) => item.props.name === index);
  22039. if (filteredItems.length > 0) {
  22040. index = items.value.indexOf(filteredItems[0]);
  22041. }
  22042. }
  22043. index = Number(index);
  22044. if (Number.isNaN(index) || index !== Math.floor(index)) {
  22045. debugWarn(componentName, "index must be integer.");
  22046. return;
  22047. }
  22048. const itemCount = items.value.length;
  22049. const oldIndex = activeIndex.value;
  22050. if (index < 0) {
  22051. activeIndex.value = props.loop ? itemCount - 1 : 0;
  22052. } else if (index >= itemCount) {
  22053. activeIndex.value = props.loop ? 0 : itemCount - 1;
  22054. } else {
  22055. activeIndex.value = index;
  22056. }
  22057. if (oldIndex === activeIndex.value) {
  22058. resetItemPosition(oldIndex);
  22059. }
  22060. resetTimer();
  22061. }
  22062. function resetItemPosition(oldIndex) {
  22063. items.value.forEach((item, index) => {
  22064. item.translateItem(index, activeIndex.value, oldIndex);
  22065. });
  22066. }
  22067. function itemInStage(item, index) {
  22068. var _a, _b, _c, _d;
  22069. const _items = vue.unref(items);
  22070. const itemCount = _items.length;
  22071. if (itemCount === 0 || !item.states.inStage)
  22072. return false;
  22073. const nextItemIndex = index + 1;
  22074. const prevItemIndex = index - 1;
  22075. const lastItemIndex = itemCount - 1;
  22076. const isLastItemActive = _items[lastItemIndex].states.active;
  22077. const isFirstItemActive = _items[0].states.active;
  22078. const isNextItemActive = (_b = (_a = _items[nextItemIndex]) == null ? void 0 : _a.states) == null ? void 0 : _b.active;
  22079. const isPrevItemActive = (_d = (_c = _items[prevItemIndex]) == null ? void 0 : _c.states) == null ? void 0 : _d.active;
  22080. if (index === lastItemIndex && isFirstItemActive || isNextItemActive) {
  22081. return "left";
  22082. } else if (index === 0 && isLastItemActive || isPrevItemActive) {
  22083. return "right";
  22084. }
  22085. return false;
  22086. }
  22087. function handleMouseEnter() {
  22088. hover.value = true;
  22089. if (props.pauseOnHover) {
  22090. pauseTimer();
  22091. }
  22092. }
  22093. function handleMouseLeave() {
  22094. hover.value = false;
  22095. startTimer();
  22096. }
  22097. function handleButtonEnter(arrow) {
  22098. if (vue.unref(isVertical))
  22099. return;
  22100. items.value.forEach((item, index) => {
  22101. if (arrow === itemInStage(item, index)) {
  22102. item.states.hover = true;
  22103. }
  22104. });
  22105. }
  22106. function handleButtonLeave() {
  22107. if (vue.unref(isVertical))
  22108. return;
  22109. items.value.forEach((item) => {
  22110. item.states.hover = false;
  22111. });
  22112. }
  22113. function handleIndicatorClick(index) {
  22114. activeIndex.value = index;
  22115. }
  22116. function handleIndicatorHover(index) {
  22117. if (props.trigger === "hover" && index !== activeIndex.value) {
  22118. activeIndex.value = index;
  22119. }
  22120. }
  22121. function prev() {
  22122. setActiveItem(activeIndex.value - 1);
  22123. }
  22124. function next() {
  22125. setActiveItem(activeIndex.value + 1);
  22126. }
  22127. function resetTimer() {
  22128. pauseTimer();
  22129. if (!props.pauseOnHover)
  22130. startTimer();
  22131. }
  22132. function setContainerHeight(height) {
  22133. if (props.height !== "auto")
  22134. return;
  22135. containerHeight.value = height;
  22136. }
  22137. function PlaceholderItem() {
  22138. var _a;
  22139. const defaultSlots = (_a = slots.default) == null ? void 0 : _a.call(slots);
  22140. if (!defaultSlots)
  22141. return null;
  22142. const flatSlots = flattedChildren(defaultSlots);
  22143. const normalizeSlots = flatSlots.filter((slot) => {
  22144. return vue.isVNode(slot) && slot.type.name === CAROUSEL_ITEM_NAME;
  22145. });
  22146. if ((normalizeSlots == null ? void 0 : normalizeSlots.length) === 2 && props.loop && !isCardType.value) {
  22147. isItemsTwoLength.value = true;
  22148. return normalizeSlots;
  22149. }
  22150. isItemsTwoLength.value = false;
  22151. return null;
  22152. }
  22153. vue.watch(() => activeIndex.value, (current, prev2) => {
  22154. resetItemPosition(prev2);
  22155. if (isItemsTwoLength.value) {
  22156. current = current % 2;
  22157. prev2 = prev2 % 2;
  22158. }
  22159. if (prev2 > -1) {
  22160. emit(CHANGE_EVENT, current, prev2);
  22161. }
  22162. });
  22163. const exposeActiveIndex = vue.computed({
  22164. get: () => {
  22165. return isItemsTwoLength.value ? activeIndex.value % 2 : activeIndex.value;
  22166. },
  22167. set: (value) => activeIndex.value = value
  22168. });
  22169. vue.watch(() => props.autoplay, (autoplay) => {
  22170. autoplay ? startTimer() : pauseTimer();
  22171. });
  22172. vue.watch(() => props.loop, () => {
  22173. setActiveItem(activeIndex.value);
  22174. });
  22175. vue.watch(() => props.interval, () => {
  22176. resetTimer();
  22177. });
  22178. const resizeObserver = vue.shallowRef();
  22179. vue.onMounted(() => {
  22180. vue.watch(() => items.value, () => {
  22181. if (items.value.length > 0)
  22182. setActiveItem(props.initialIndex);
  22183. }, {
  22184. immediate: true
  22185. });
  22186. resizeObserver.value = useResizeObserver(root.value, () => {
  22187. resetItemPosition();
  22188. });
  22189. startTimer();
  22190. });
  22191. vue.onBeforeUnmount(() => {
  22192. pauseTimer();
  22193. if (root.value && resizeObserver.value)
  22194. resizeObserver.value.stop();
  22195. });
  22196. vue.provide(carouselContextKey, {
  22197. root,
  22198. isCardType,
  22199. isVertical,
  22200. items,
  22201. loop: props.loop,
  22202. cardScale: props.cardScale,
  22203. addItem,
  22204. removeItem,
  22205. setActiveItem,
  22206. setContainerHeight
  22207. });
  22208. return {
  22209. root,
  22210. activeIndex,
  22211. exposeActiveIndex,
  22212. arrowDisplay,
  22213. hasLabel,
  22214. hover,
  22215. isCardType,
  22216. items,
  22217. isVertical,
  22218. containerStyle,
  22219. isItemsTwoLength,
  22220. handleButtonEnter,
  22221. handleButtonLeave,
  22222. handleIndicatorClick,
  22223. handleMouseEnter,
  22224. handleMouseLeave,
  22225. setActiveItem,
  22226. prev,
  22227. next,
  22228. PlaceholderItem,
  22229. isTwoLengthShow,
  22230. ItemsSorter,
  22231. throttledArrowClick,
  22232. throttledIndicatorHover
  22233. };
  22234. };
  22235. const COMPONENT_NAME$g = "ElCarousel";
  22236. const __default__$1x = vue.defineComponent({
  22237. name: COMPONENT_NAME$g
  22238. });
  22239. const _sfc_main$1Z = /* @__PURE__ */ vue.defineComponent({
  22240. ...__default__$1x,
  22241. props: carouselProps,
  22242. emits: carouselEmits,
  22243. setup(__props, { expose, emit }) {
  22244. const props = __props;
  22245. const {
  22246. root,
  22247. activeIndex,
  22248. exposeActiveIndex,
  22249. arrowDisplay,
  22250. hasLabel,
  22251. hover,
  22252. isCardType,
  22253. items,
  22254. isVertical,
  22255. containerStyle,
  22256. handleButtonEnter,
  22257. handleButtonLeave,
  22258. handleIndicatorClick,
  22259. handleMouseEnter,
  22260. handleMouseLeave,
  22261. setActiveItem,
  22262. prev,
  22263. next,
  22264. PlaceholderItem,
  22265. isTwoLengthShow,
  22266. ItemsSorter,
  22267. throttledArrowClick,
  22268. throttledIndicatorHover
  22269. } = useCarousel(props, emit, COMPONENT_NAME$g);
  22270. const ns = useNamespace("carousel");
  22271. const { t } = useLocale();
  22272. const carouselClasses = vue.computed(() => {
  22273. const classes = [ns.b(), ns.m(props.direction)];
  22274. if (vue.unref(isCardType)) {
  22275. classes.push(ns.m("card"));
  22276. }
  22277. return classes;
  22278. });
  22279. const indicatorsClasses = vue.computed(() => {
  22280. const classes = [ns.e("indicators"), ns.em("indicators", props.direction)];
  22281. if (vue.unref(hasLabel)) {
  22282. classes.push(ns.em("indicators", "labels"));
  22283. }
  22284. if (props.indicatorPosition === "outside") {
  22285. classes.push(ns.em("indicators", "outside"));
  22286. }
  22287. if (vue.unref(isVertical)) {
  22288. classes.push(ns.em("indicators", "right"));
  22289. }
  22290. return classes;
  22291. });
  22292. function handleTransitionStart(e) {
  22293. if (!props.motionBlur)
  22294. return;
  22295. const kls = vue.unref(isVertical) ? `${ns.namespace.value}-transitioning-vertical` : `${ns.namespace.value}-transitioning`;
  22296. e.currentTarget.classList.add(kls);
  22297. }
  22298. function handleTransitionEnd(e) {
  22299. if (!props.motionBlur)
  22300. return;
  22301. const kls = vue.unref(isVertical) ? `${ns.namespace.value}-transitioning-vertical` : `${ns.namespace.value}-transitioning`;
  22302. e.currentTarget.classList.remove(kls);
  22303. }
  22304. expose({
  22305. activeIndex: exposeActiveIndex,
  22306. setActiveItem,
  22307. prev,
  22308. next
  22309. });
  22310. return (_ctx, _cache) => {
  22311. return vue.openBlock(), vue.createElementBlock("div", {
  22312. ref_key: "root",
  22313. ref: root,
  22314. class: vue.normalizeClass(vue.unref(carouselClasses)),
  22315. onMouseenter: vue.withModifiers(vue.unref(handleMouseEnter), ["stop"]),
  22316. onMouseleave: vue.withModifiers(vue.unref(handleMouseLeave), ["stop"])
  22317. }, [
  22318. vue.unref(arrowDisplay) ? (vue.openBlock(), vue.createBlock(vue.Transition, {
  22319. key: 0,
  22320. name: "carousel-arrow-left",
  22321. persisted: ""
  22322. }, {
  22323. default: vue.withCtx(() => [
  22324. vue.withDirectives(vue.createElementVNode("button", {
  22325. type: "button",
  22326. class: vue.normalizeClass([vue.unref(ns).e("arrow"), vue.unref(ns).em("arrow", "left")]),
  22327. "aria-label": vue.unref(t)("el.carousel.leftArrow"),
  22328. onMouseenter: ($event) => vue.unref(handleButtonEnter)("left"),
  22329. onMouseleave: vue.unref(handleButtonLeave),
  22330. onClick: vue.withModifiers(($event) => vue.unref(throttledArrowClick)(vue.unref(activeIndex) - 1), ["stop"])
  22331. }, [
  22332. vue.createVNode(vue.unref(ElIcon), null, {
  22333. default: vue.withCtx(() => [
  22334. vue.createVNode(vue.unref(arrow_left_default))
  22335. ]),
  22336. _: 1
  22337. })
  22338. ], 42, ["aria-label", "onMouseenter", "onMouseleave", "onClick"]), [
  22339. [vue.vShow, (_ctx.arrow === "always" || vue.unref(hover)) && (_ctx.loop || vue.unref(activeIndex) > 0)]
  22340. ])
  22341. ]),
  22342. _: 1
  22343. })) : vue.createCommentVNode("v-if", true),
  22344. vue.unref(arrowDisplay) ? (vue.openBlock(), vue.createBlock(vue.Transition, {
  22345. key: 1,
  22346. name: "carousel-arrow-right",
  22347. persisted: ""
  22348. }, {
  22349. default: vue.withCtx(() => [
  22350. vue.withDirectives(vue.createElementVNode("button", {
  22351. type: "button",
  22352. class: vue.normalizeClass([vue.unref(ns).e("arrow"), vue.unref(ns).em("arrow", "right")]),
  22353. "aria-label": vue.unref(t)("el.carousel.rightArrow"),
  22354. onMouseenter: ($event) => vue.unref(handleButtonEnter)("right"),
  22355. onMouseleave: vue.unref(handleButtonLeave),
  22356. onClick: vue.withModifiers(($event) => vue.unref(throttledArrowClick)(vue.unref(activeIndex) + 1), ["stop"])
  22357. }, [
  22358. vue.createVNode(vue.unref(ElIcon), null, {
  22359. default: vue.withCtx(() => [
  22360. vue.createVNode(vue.unref(arrow_right_default))
  22361. ]),
  22362. _: 1
  22363. })
  22364. ], 42, ["aria-label", "onMouseenter", "onMouseleave", "onClick"]), [
  22365. [
  22366. vue.vShow,
  22367. (_ctx.arrow === "always" || vue.unref(hover)) && (_ctx.loop || vue.unref(activeIndex) < vue.unref(items).length - 1)
  22368. ]
  22369. ])
  22370. ]),
  22371. _: 1
  22372. })) : vue.createCommentVNode("v-if", true),
  22373. vue.createElementVNode("div", {
  22374. class: vue.normalizeClass(vue.unref(ns).e("container")),
  22375. style: vue.normalizeStyle(vue.unref(containerStyle)),
  22376. onTransitionstart: handleTransitionStart,
  22377. onTransitionend: handleTransitionEnd
  22378. }, [
  22379. vue.createVNode(vue.unref(PlaceholderItem)),
  22380. vue.renderSlot(_ctx.$slots, "default")
  22381. ], 38),
  22382. vue.createVNode(vue.unref(ItemsSorter), null, {
  22383. default: vue.withCtx(() => [
  22384. _ctx.indicatorPosition !== "none" ? (vue.openBlock(), vue.createElementBlock("ul", {
  22385. key: 0,
  22386. class: vue.normalizeClass(vue.unref(indicatorsClasses))
  22387. }, [
  22388. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(items), (item, index) => {
  22389. return vue.withDirectives((vue.openBlock(), vue.createElementBlock("li", {
  22390. key: index,
  22391. class: vue.normalizeClass([
  22392. vue.unref(ns).e("indicator"),
  22393. vue.unref(ns).em("indicator", _ctx.direction),
  22394. vue.unref(ns).is("active", index === vue.unref(activeIndex))
  22395. ]),
  22396. onMouseenter: ($event) => vue.unref(throttledIndicatorHover)(index),
  22397. onClick: vue.withModifiers(($event) => vue.unref(handleIndicatorClick)(index), ["stop"])
  22398. }, [
  22399. vue.createElementVNode("button", {
  22400. class: vue.normalizeClass(vue.unref(ns).e("button")),
  22401. "aria-label": vue.unref(t)("el.carousel.indicator", { index: index + 1 })
  22402. }, [
  22403. vue.unref(hasLabel) ? (vue.openBlock(), vue.createElementBlock("span", { key: 0 }, vue.toDisplayString(item.props.label), 1)) : vue.createCommentVNode("v-if", true)
  22404. ], 10, ["aria-label"])
  22405. ], 42, ["onMouseenter", "onClick"])), [
  22406. [vue.vShow, vue.unref(isTwoLengthShow)(index)]
  22407. ]);
  22408. }), 128))
  22409. ], 2)) : vue.createCommentVNode("v-if", true)
  22410. ]),
  22411. _: 1
  22412. }),
  22413. _ctx.motionBlur ? (vue.openBlock(), vue.createElementBlock("svg", {
  22414. key: 2,
  22415. xmlns: "http://www.w3.org/2000/svg",
  22416. version: "1.1",
  22417. style: { "display": "none" }
  22418. }, [
  22419. vue.createElementVNode("defs", null, [
  22420. vue.createElementVNode("filter", { id: "elCarouselHorizontal" }, [
  22421. vue.createElementVNode("feGaussianBlur", {
  22422. in: "SourceGraphic",
  22423. stdDeviation: "12,0"
  22424. })
  22425. ]),
  22426. vue.createElementVNode("filter", { id: "elCarouselVertical" }, [
  22427. vue.createElementVNode("feGaussianBlur", {
  22428. in: "SourceGraphic",
  22429. stdDeviation: "0,10"
  22430. })
  22431. ])
  22432. ])
  22433. ])) : vue.createCommentVNode("v-if", true)
  22434. ], 42, ["onMouseenter", "onMouseleave"]);
  22435. };
  22436. }
  22437. });
  22438. var Carousel = /* @__PURE__ */ _export_sfc(_sfc_main$1Z, [["__file", "carousel.vue"]]);
  22439. const carouselItemProps = buildProps({
  22440. name: { type: String, default: "" },
  22441. label: {
  22442. type: [String, Number],
  22443. default: ""
  22444. }
  22445. });
  22446. const useCarouselItem = (props) => {
  22447. const carouselContext = vue.inject(carouselContextKey);
  22448. const instance = vue.getCurrentInstance();
  22449. if (!carouselContext) {
  22450. debugWarn(CAROUSEL_ITEM_NAME, "usage: <el-carousel></el-carousel-item></el-carousel>");
  22451. }
  22452. if (!instance) {
  22453. debugWarn(CAROUSEL_ITEM_NAME, "compositional hook can only be invoked inside setups");
  22454. }
  22455. const carouselItemRef = vue.ref();
  22456. const hover = vue.ref(false);
  22457. const translate = vue.ref(0);
  22458. const scale = vue.ref(1);
  22459. const active = vue.ref(false);
  22460. const ready = vue.ref(false);
  22461. const inStage = vue.ref(false);
  22462. const animating = vue.ref(false);
  22463. const { isCardType, isVertical, cardScale } = carouselContext;
  22464. function processIndex(index, activeIndex, length) {
  22465. const lastItemIndex = length - 1;
  22466. const prevItemIndex = activeIndex - 1;
  22467. const nextItemIndex = activeIndex + 1;
  22468. const halfItemIndex = length / 2;
  22469. if (activeIndex === 0 && index === lastItemIndex) {
  22470. return -1;
  22471. } else if (activeIndex === lastItemIndex && index === 0) {
  22472. return length;
  22473. } else if (index < prevItemIndex && activeIndex - index >= halfItemIndex) {
  22474. return length + 1;
  22475. } else if (index > nextItemIndex && index - activeIndex >= halfItemIndex) {
  22476. return -2;
  22477. }
  22478. return index;
  22479. }
  22480. function calcCardTranslate(index, activeIndex) {
  22481. var _a, _b;
  22482. 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;
  22483. if (inStage.value) {
  22484. return parentWidth * ((2 - cardScale) * (index - activeIndex) + 1) / 4;
  22485. } else if (index < activeIndex) {
  22486. return -(1 + cardScale) * parentWidth / 4;
  22487. } else {
  22488. return (3 + cardScale) * parentWidth / 4;
  22489. }
  22490. }
  22491. function calcTranslate(index, activeIndex, isVertical2) {
  22492. const rootEl = carouselContext.root.value;
  22493. if (!rootEl)
  22494. return 0;
  22495. const distance = (isVertical2 ? rootEl.offsetHeight : rootEl.offsetWidth) || 0;
  22496. return distance * (index - activeIndex);
  22497. }
  22498. const translateItem = (index, activeIndex, oldIndex) => {
  22499. var _a;
  22500. const _isCardType = vue.unref(isCardType);
  22501. const carouselItemLength = (_a = carouselContext.items.value.length) != null ? _a : Number.NaN;
  22502. const isActive = index === activeIndex;
  22503. if (!_isCardType && !isUndefined(oldIndex)) {
  22504. animating.value = isActive || index === oldIndex;
  22505. }
  22506. if (!isActive && carouselItemLength > 2 && carouselContext.loop) {
  22507. index = processIndex(index, activeIndex, carouselItemLength);
  22508. }
  22509. const _isVertical = vue.unref(isVertical);
  22510. active.value = isActive;
  22511. if (_isCardType) {
  22512. inStage.value = Math.round(Math.abs(index - activeIndex)) <= 1;
  22513. translate.value = calcCardTranslate(index, activeIndex);
  22514. scale.value = vue.unref(active) ? 1 : cardScale;
  22515. } else {
  22516. translate.value = calcTranslate(index, activeIndex, _isVertical);
  22517. }
  22518. ready.value = true;
  22519. if (isActive && carouselItemRef.value) {
  22520. carouselContext.setContainerHeight(carouselItemRef.value.offsetHeight);
  22521. }
  22522. };
  22523. function handleItemClick() {
  22524. if (carouselContext && vue.unref(isCardType)) {
  22525. const index = carouselContext.items.value.findIndex(({ uid }) => uid === instance.uid);
  22526. carouselContext.setActiveItem(index);
  22527. }
  22528. }
  22529. const carouselItemContext = {
  22530. props,
  22531. states: vue.reactive({
  22532. hover,
  22533. translate,
  22534. scale,
  22535. active,
  22536. ready,
  22537. inStage,
  22538. animating
  22539. }),
  22540. uid: instance.uid,
  22541. getVnode: () => instance.vnode,
  22542. translateItem
  22543. };
  22544. carouselContext.addItem(carouselItemContext);
  22545. vue.onBeforeUnmount(() => {
  22546. carouselContext.removeItem(carouselItemContext);
  22547. });
  22548. return {
  22549. carouselItemRef,
  22550. active,
  22551. animating,
  22552. hover,
  22553. inStage,
  22554. isVertical,
  22555. translate,
  22556. isCardType,
  22557. scale,
  22558. ready,
  22559. handleItemClick
  22560. };
  22561. };
  22562. const __default__$1w = vue.defineComponent({
  22563. name: CAROUSEL_ITEM_NAME
  22564. });
  22565. const _sfc_main$1Y = /* @__PURE__ */ vue.defineComponent({
  22566. ...__default__$1w,
  22567. props: carouselItemProps,
  22568. setup(__props) {
  22569. const props = __props;
  22570. const ns = useNamespace("carousel");
  22571. const {
  22572. carouselItemRef,
  22573. active,
  22574. animating,
  22575. hover,
  22576. inStage,
  22577. isVertical,
  22578. translate,
  22579. isCardType,
  22580. scale,
  22581. ready,
  22582. handleItemClick
  22583. } = useCarouselItem(props);
  22584. const itemKls = vue.computed(() => [
  22585. ns.e("item"),
  22586. ns.is("active", active.value),
  22587. ns.is("in-stage", inStage.value),
  22588. ns.is("hover", hover.value),
  22589. ns.is("animating", animating.value),
  22590. {
  22591. [ns.em("item", "card")]: isCardType.value,
  22592. [ns.em("item", "card-vertical")]: isCardType.value && isVertical.value
  22593. }
  22594. ]);
  22595. const itemStyle = vue.computed(() => {
  22596. const translateType = `translate${vue.unref(isVertical) ? "Y" : "X"}`;
  22597. const _translate = `${translateType}(${vue.unref(translate)}px)`;
  22598. const _scale = `scale(${vue.unref(scale)})`;
  22599. const transform = [_translate, _scale].join(" ");
  22600. return {
  22601. transform
  22602. };
  22603. });
  22604. return (_ctx, _cache) => {
  22605. return vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  22606. ref_key: "carouselItemRef",
  22607. ref: carouselItemRef,
  22608. class: vue.normalizeClass(vue.unref(itemKls)),
  22609. style: vue.normalizeStyle(vue.unref(itemStyle)),
  22610. onClick: vue.unref(handleItemClick)
  22611. }, [
  22612. vue.unref(isCardType) ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  22613. key: 0,
  22614. class: vue.normalizeClass(vue.unref(ns).e("mask"))
  22615. }, null, 2)), [
  22616. [vue.vShow, !vue.unref(active)]
  22617. ]) : vue.createCommentVNode("v-if", true),
  22618. vue.renderSlot(_ctx.$slots, "default")
  22619. ], 14, ["onClick"])), [
  22620. [vue.vShow, vue.unref(ready)]
  22621. ]);
  22622. };
  22623. }
  22624. });
  22625. var CarouselItem = /* @__PURE__ */ _export_sfc(_sfc_main$1Y, [["__file", "carousel-item.vue"]]);
  22626. const ElCarousel = withInstall(Carousel, {
  22627. CarouselItem
  22628. });
  22629. const ElCarouselItem = withNoopInstall(CarouselItem);
  22630. const checkboxProps = {
  22631. modelValue: {
  22632. type: [Number, String, Boolean],
  22633. default: void 0
  22634. },
  22635. label: {
  22636. type: [String, Boolean, Number, Object],
  22637. default: void 0
  22638. },
  22639. value: {
  22640. type: [String, Boolean, Number, Object],
  22641. default: void 0
  22642. },
  22643. indeterminate: Boolean,
  22644. disabled: Boolean,
  22645. checked: Boolean,
  22646. name: {
  22647. type: String,
  22648. default: void 0
  22649. },
  22650. trueValue: {
  22651. type: [String, Number],
  22652. default: void 0
  22653. },
  22654. falseValue: {
  22655. type: [String, Number],
  22656. default: void 0
  22657. },
  22658. trueLabel: {
  22659. type: [String, Number],
  22660. default: void 0
  22661. },
  22662. falseLabel: {
  22663. type: [String, Number],
  22664. default: void 0
  22665. },
  22666. id: {
  22667. type: String,
  22668. default: void 0
  22669. },
  22670. border: Boolean,
  22671. size: useSizeProp,
  22672. tabindex: [String, Number],
  22673. validateEvent: {
  22674. type: Boolean,
  22675. default: true
  22676. },
  22677. ...useAriaProps(["ariaControls"])
  22678. };
  22679. const checkboxEmits = {
  22680. [UPDATE_MODEL_EVENT]: (val) => isString$1(val) || isNumber(val) || isBoolean(val),
  22681. change: (val) => isString$1(val) || isNumber(val) || isBoolean(val)
  22682. };
  22683. const checkboxGroupContextKey = Symbol("checkboxGroupContextKey");
  22684. const useCheckboxDisabled = ({
  22685. model,
  22686. isChecked
  22687. }) => {
  22688. const checkboxGroup = vue.inject(checkboxGroupContextKey, void 0);
  22689. const isLimitDisabled = vue.computed(() => {
  22690. var _a, _b;
  22691. const max = (_a = checkboxGroup == null ? void 0 : checkboxGroup.max) == null ? void 0 : _a.value;
  22692. const min = (_b = checkboxGroup == null ? void 0 : checkboxGroup.min) == null ? void 0 : _b.value;
  22693. return !isUndefined(max) && model.value.length >= max && !isChecked.value || !isUndefined(min) && model.value.length <= min && isChecked.value;
  22694. });
  22695. const isDisabled = useFormDisabled(vue.computed(() => (checkboxGroup == null ? void 0 : checkboxGroup.disabled.value) || isLimitDisabled.value));
  22696. return {
  22697. isDisabled,
  22698. isLimitDisabled
  22699. };
  22700. };
  22701. const useCheckboxEvent = (props, {
  22702. model,
  22703. isLimitExceeded,
  22704. hasOwnLabel,
  22705. isDisabled,
  22706. isLabeledByFormItem
  22707. }) => {
  22708. const checkboxGroup = vue.inject(checkboxGroupContextKey, void 0);
  22709. const { formItem } = useFormItem();
  22710. const { emit } = vue.getCurrentInstance();
  22711. function getLabeledValue(value) {
  22712. var _a, _b, _c, _d;
  22713. 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;
  22714. }
  22715. function emitChangeEvent(checked, e) {
  22716. emit(CHANGE_EVENT, getLabeledValue(checked), e);
  22717. }
  22718. function handleChange(e) {
  22719. if (isLimitExceeded.value)
  22720. return;
  22721. const target = e.target;
  22722. emit(CHANGE_EVENT, getLabeledValue(target.checked), e);
  22723. }
  22724. async function onClickRoot(e) {
  22725. if (isLimitExceeded.value)
  22726. return;
  22727. if (!hasOwnLabel.value && !isDisabled.value && isLabeledByFormItem.value) {
  22728. const eventTargets = e.composedPath();
  22729. const hasLabel = eventTargets.some((item) => item.tagName === "LABEL");
  22730. if (!hasLabel) {
  22731. model.value = getLabeledValue([false, props.falseValue, props.falseLabel].includes(model.value));
  22732. await vue.nextTick();
  22733. emitChangeEvent(model.value, e);
  22734. }
  22735. }
  22736. }
  22737. const validateEvent = vue.computed(() => (checkboxGroup == null ? void 0 : checkboxGroup.validateEvent) || props.validateEvent);
  22738. vue.watch(() => props.modelValue, () => {
  22739. if (validateEvent.value) {
  22740. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn(err));
  22741. }
  22742. });
  22743. return {
  22744. handleChange,
  22745. onClickRoot
  22746. };
  22747. };
  22748. const useCheckboxModel = (props) => {
  22749. const selfModel = vue.ref(false);
  22750. const { emit } = vue.getCurrentInstance();
  22751. const checkboxGroup = vue.inject(checkboxGroupContextKey, void 0);
  22752. const isGroup = vue.computed(() => isUndefined(checkboxGroup) === false);
  22753. const isLimitExceeded = vue.ref(false);
  22754. const model = vue.computed({
  22755. get() {
  22756. var _a, _b;
  22757. return isGroup.value ? (_a = checkboxGroup == null ? void 0 : checkboxGroup.modelValue) == null ? void 0 : _a.value : (_b = props.modelValue) != null ? _b : selfModel.value;
  22758. },
  22759. set(val) {
  22760. var _a, _b;
  22761. if (isGroup.value && isArray$1(val)) {
  22762. 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;
  22763. isLimitExceeded.value === false && ((_b = checkboxGroup == null ? void 0 : checkboxGroup.changeEvent) == null ? void 0 : _b.call(checkboxGroup, val));
  22764. } else {
  22765. emit(UPDATE_MODEL_EVENT, val);
  22766. selfModel.value = val;
  22767. }
  22768. }
  22769. });
  22770. return {
  22771. model,
  22772. isGroup,
  22773. isLimitExceeded
  22774. };
  22775. };
  22776. const useCheckboxStatus = (props, slots, { model }) => {
  22777. const checkboxGroup = vue.inject(checkboxGroupContextKey, void 0);
  22778. const isFocused = vue.ref(false);
  22779. const actualValue = vue.computed(() => {
  22780. if (!isPropAbsent(props.value)) {
  22781. return props.value;
  22782. }
  22783. return props.label;
  22784. });
  22785. const isChecked = vue.computed(() => {
  22786. const value = model.value;
  22787. if (isBoolean(value)) {
  22788. return value;
  22789. } else if (isArray$1(value)) {
  22790. if (isObject$1(actualValue.value)) {
  22791. return value.map(vue.toRaw).some((o) => isEqual$1(o, actualValue.value));
  22792. } else {
  22793. return value.map(vue.toRaw).includes(actualValue.value);
  22794. }
  22795. } else if (value !== null && value !== void 0) {
  22796. return value === props.trueValue || value === props.trueLabel;
  22797. } else {
  22798. return !!value;
  22799. }
  22800. });
  22801. const checkboxButtonSize = useFormSize(vue.computed(() => {
  22802. var _a;
  22803. return (_a = checkboxGroup == null ? void 0 : checkboxGroup.size) == null ? void 0 : _a.value;
  22804. }), {
  22805. prop: true
  22806. });
  22807. const checkboxSize = useFormSize(vue.computed(() => {
  22808. var _a;
  22809. return (_a = checkboxGroup == null ? void 0 : checkboxGroup.size) == null ? void 0 : _a.value;
  22810. }));
  22811. const hasOwnLabel = vue.computed(() => {
  22812. return !!slots.default || !isPropAbsent(actualValue.value);
  22813. });
  22814. return {
  22815. checkboxButtonSize,
  22816. isChecked,
  22817. isFocused,
  22818. checkboxSize,
  22819. hasOwnLabel,
  22820. actualValue
  22821. };
  22822. };
  22823. const useCheckbox = (props, slots) => {
  22824. const { formItem: elFormItem } = useFormItem();
  22825. const { model, isGroup, isLimitExceeded } = useCheckboxModel(props);
  22826. const {
  22827. isFocused,
  22828. isChecked,
  22829. checkboxButtonSize,
  22830. checkboxSize,
  22831. hasOwnLabel,
  22832. actualValue
  22833. } = useCheckboxStatus(props, slots, { model });
  22834. const { isDisabled } = useCheckboxDisabled({ model, isChecked });
  22835. const { inputId, isLabeledByFormItem } = useFormItemInputId(props, {
  22836. formItemContext: elFormItem,
  22837. disableIdGeneration: hasOwnLabel,
  22838. disableIdManagement: isGroup
  22839. });
  22840. const { handleChange, onClickRoot } = useCheckboxEvent(props, {
  22841. model,
  22842. isLimitExceeded,
  22843. hasOwnLabel,
  22844. isDisabled,
  22845. isLabeledByFormItem
  22846. });
  22847. const setStoreValue = () => {
  22848. function addToStore() {
  22849. var _a, _b;
  22850. if (isArray$1(model.value) && !model.value.includes(actualValue.value)) {
  22851. model.value.push(actualValue.value);
  22852. } else {
  22853. model.value = (_b = (_a = props.trueValue) != null ? _a : props.trueLabel) != null ? _b : true;
  22854. }
  22855. }
  22856. props.checked && addToStore();
  22857. };
  22858. setStoreValue();
  22859. useDeprecated({
  22860. from: "label act as value",
  22861. replacement: "value",
  22862. version: "3.0.0",
  22863. scope: "el-checkbox",
  22864. ref: "https://element-plus.org/en-US/component/checkbox.html"
  22865. }, vue.computed(() => isGroup.value && isPropAbsent(props.value)));
  22866. useDeprecated({
  22867. from: "true-label",
  22868. replacement: "true-value",
  22869. version: "3.0.0",
  22870. scope: "el-checkbox",
  22871. ref: "https://element-plus.org/en-US/component/checkbox.html"
  22872. }, vue.computed(() => !!props.trueLabel));
  22873. useDeprecated({
  22874. from: "false-label",
  22875. replacement: "false-value",
  22876. version: "3.0.0",
  22877. scope: "el-checkbox",
  22878. ref: "https://element-plus.org/en-US/component/checkbox.html"
  22879. }, vue.computed(() => !!props.falseLabel));
  22880. return {
  22881. inputId,
  22882. isLabeledByFormItem,
  22883. isChecked,
  22884. isDisabled,
  22885. isFocused,
  22886. checkboxButtonSize,
  22887. checkboxSize,
  22888. hasOwnLabel,
  22889. model,
  22890. actualValue,
  22891. handleChange,
  22892. onClickRoot
  22893. };
  22894. };
  22895. const __default__$1v = vue.defineComponent({
  22896. name: "ElCheckbox"
  22897. });
  22898. const _sfc_main$1X = /* @__PURE__ */ vue.defineComponent({
  22899. ...__default__$1v,
  22900. props: checkboxProps,
  22901. emits: checkboxEmits,
  22902. setup(__props) {
  22903. const props = __props;
  22904. const slots = vue.useSlots();
  22905. const {
  22906. inputId,
  22907. isLabeledByFormItem,
  22908. isChecked,
  22909. isDisabled,
  22910. isFocused,
  22911. checkboxSize,
  22912. hasOwnLabel,
  22913. model,
  22914. actualValue,
  22915. handleChange,
  22916. onClickRoot
  22917. } = useCheckbox(props, slots);
  22918. const inputBindings = vue.computed(() => {
  22919. var _a, _b, _c, _d;
  22920. if (props.trueValue || props.falseValue || props.trueLabel || props.falseLabel) {
  22921. return {
  22922. "true-value": (_b = (_a = props.trueValue) != null ? _a : props.trueLabel) != null ? _b : true,
  22923. "false-value": (_d = (_c = props.falseValue) != null ? _c : props.falseLabel) != null ? _d : false
  22924. };
  22925. }
  22926. return {
  22927. value: actualValue.value
  22928. };
  22929. });
  22930. const ns = useNamespace("checkbox");
  22931. const compKls = vue.computed(() => {
  22932. return [
  22933. ns.b(),
  22934. ns.m(checkboxSize.value),
  22935. ns.is("disabled", isDisabled.value),
  22936. ns.is("bordered", props.border),
  22937. ns.is("checked", isChecked.value)
  22938. ];
  22939. });
  22940. const spanKls = vue.computed(() => {
  22941. return [
  22942. ns.e("input"),
  22943. ns.is("disabled", isDisabled.value),
  22944. ns.is("checked", isChecked.value),
  22945. ns.is("indeterminate", props.indeterminate),
  22946. ns.is("focus", isFocused.value)
  22947. ];
  22948. });
  22949. return (_ctx, _cache) => {
  22950. return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(!vue.unref(hasOwnLabel) && vue.unref(isLabeledByFormItem) ? "span" : "label"), {
  22951. class: vue.normalizeClass(vue.unref(compKls)),
  22952. "aria-controls": _ctx.indeterminate ? _ctx.ariaControls : null,
  22953. onClick: vue.unref(onClickRoot)
  22954. }, {
  22955. default: vue.withCtx(() => [
  22956. vue.createElementVNode("span", {
  22957. class: vue.normalizeClass(vue.unref(spanKls))
  22958. }, [
  22959. vue.withDirectives(vue.createElementVNode("input", vue.mergeProps({
  22960. id: vue.unref(inputId),
  22961. "onUpdate:modelValue": ($event) => vue.isRef(model) ? model.value = $event : null,
  22962. class: vue.unref(ns).e("original"),
  22963. type: "checkbox",
  22964. indeterminate: _ctx.indeterminate,
  22965. name: _ctx.name,
  22966. tabindex: _ctx.tabindex,
  22967. disabled: vue.unref(isDisabled)
  22968. }, vue.unref(inputBindings), {
  22969. onChange: vue.unref(handleChange),
  22970. onFocus: ($event) => isFocused.value = true,
  22971. onBlur: ($event) => isFocused.value = false,
  22972. onClick: vue.withModifiers(() => {
  22973. }, ["stop"])
  22974. }), null, 16, ["id", "onUpdate:modelValue", "indeterminate", "name", "tabindex", "disabled", "onChange", "onFocus", "onBlur", "onClick"]), [
  22975. [vue.vModelCheckbox, vue.unref(model)]
  22976. ]),
  22977. vue.createElementVNode("span", {
  22978. class: vue.normalizeClass(vue.unref(ns).e("inner"))
  22979. }, null, 2)
  22980. ], 2),
  22981. vue.unref(hasOwnLabel) ? (vue.openBlock(), vue.createElementBlock("span", {
  22982. key: 0,
  22983. class: vue.normalizeClass(vue.unref(ns).e("label"))
  22984. }, [
  22985. vue.renderSlot(_ctx.$slots, "default"),
  22986. !_ctx.$slots.default ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  22987. vue.createTextVNode(vue.toDisplayString(_ctx.label), 1)
  22988. ], 64)) : vue.createCommentVNode("v-if", true)
  22989. ], 2)) : vue.createCommentVNode("v-if", true)
  22990. ]),
  22991. _: 3
  22992. }, 8, ["class", "aria-controls", "onClick"]);
  22993. };
  22994. }
  22995. });
  22996. var Checkbox = /* @__PURE__ */ _export_sfc(_sfc_main$1X, [["__file", "checkbox.vue"]]);
  22997. const __default__$1u = vue.defineComponent({
  22998. name: "ElCheckboxButton"
  22999. });
  23000. const _sfc_main$1W = /* @__PURE__ */ vue.defineComponent({
  23001. ...__default__$1u,
  23002. props: checkboxProps,
  23003. emits: checkboxEmits,
  23004. setup(__props) {
  23005. const props = __props;
  23006. const slots = vue.useSlots();
  23007. const {
  23008. isFocused,
  23009. isChecked,
  23010. isDisabled,
  23011. checkboxButtonSize,
  23012. model,
  23013. actualValue,
  23014. handleChange
  23015. } = useCheckbox(props, slots);
  23016. const inputBindings = vue.computed(() => {
  23017. var _a, _b, _c, _d;
  23018. if (props.trueValue || props.falseValue || props.trueLabel || props.falseLabel) {
  23019. return {
  23020. "true-value": (_b = (_a = props.trueValue) != null ? _a : props.trueLabel) != null ? _b : true,
  23021. "false-value": (_d = (_c = props.falseValue) != null ? _c : props.falseLabel) != null ? _d : false
  23022. };
  23023. }
  23024. return {
  23025. value: actualValue.value
  23026. };
  23027. });
  23028. const checkboxGroup = vue.inject(checkboxGroupContextKey, void 0);
  23029. const ns = useNamespace("checkbox");
  23030. const activeStyle = vue.computed(() => {
  23031. var _a, _b, _c, _d;
  23032. const fillValue = (_b = (_a = checkboxGroup == null ? void 0 : checkboxGroup.fill) == null ? void 0 : _a.value) != null ? _b : "";
  23033. return {
  23034. backgroundColor: fillValue,
  23035. borderColor: fillValue,
  23036. color: (_d = (_c = checkboxGroup == null ? void 0 : checkboxGroup.textColor) == null ? void 0 : _c.value) != null ? _d : "",
  23037. boxShadow: fillValue ? `-1px 0 0 0 ${fillValue}` : void 0
  23038. };
  23039. });
  23040. const labelKls = vue.computed(() => {
  23041. return [
  23042. ns.b("button"),
  23043. ns.bm("button", checkboxButtonSize.value),
  23044. ns.is("disabled", isDisabled.value),
  23045. ns.is("checked", isChecked.value),
  23046. ns.is("focus", isFocused.value)
  23047. ];
  23048. });
  23049. return (_ctx, _cache) => {
  23050. return vue.openBlock(), vue.createElementBlock("label", {
  23051. class: vue.normalizeClass(vue.unref(labelKls))
  23052. }, [
  23053. vue.withDirectives(vue.createElementVNode("input", vue.mergeProps({
  23054. "onUpdate:modelValue": ($event) => vue.isRef(model) ? model.value = $event : null,
  23055. class: vue.unref(ns).be("button", "original"),
  23056. type: "checkbox",
  23057. name: _ctx.name,
  23058. tabindex: _ctx.tabindex,
  23059. disabled: vue.unref(isDisabled)
  23060. }, vue.unref(inputBindings), {
  23061. onChange: vue.unref(handleChange),
  23062. onFocus: ($event) => isFocused.value = true,
  23063. onBlur: ($event) => isFocused.value = false,
  23064. onClick: vue.withModifiers(() => {
  23065. }, ["stop"])
  23066. }), null, 16, ["onUpdate:modelValue", "name", "tabindex", "disabled", "onChange", "onFocus", "onBlur", "onClick"]), [
  23067. [vue.vModelCheckbox, vue.unref(model)]
  23068. ]),
  23069. _ctx.$slots.default || _ctx.label ? (vue.openBlock(), vue.createElementBlock("span", {
  23070. key: 0,
  23071. class: vue.normalizeClass(vue.unref(ns).be("button", "inner")),
  23072. style: vue.normalizeStyle(vue.unref(isChecked) ? vue.unref(activeStyle) : void 0)
  23073. }, [
  23074. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  23075. vue.createTextVNode(vue.toDisplayString(_ctx.label), 1)
  23076. ])
  23077. ], 6)) : vue.createCommentVNode("v-if", true)
  23078. ], 2);
  23079. };
  23080. }
  23081. });
  23082. var CheckboxButton = /* @__PURE__ */ _export_sfc(_sfc_main$1W, [["__file", "checkbox-button.vue"]]);
  23083. const checkboxGroupProps = buildProps({
  23084. modelValue: {
  23085. type: definePropType(Array),
  23086. default: () => []
  23087. },
  23088. disabled: Boolean,
  23089. min: Number,
  23090. max: Number,
  23091. size: useSizeProp,
  23092. fill: String,
  23093. textColor: String,
  23094. tag: {
  23095. type: String,
  23096. default: "div"
  23097. },
  23098. validateEvent: {
  23099. type: Boolean,
  23100. default: true
  23101. },
  23102. options: {
  23103. type: definePropType(Array)
  23104. },
  23105. props: {
  23106. type: definePropType(Object),
  23107. default: () => checkboxDefaultProps
  23108. },
  23109. type: {
  23110. type: String,
  23111. values: ["checkbox", "button"],
  23112. default: "checkbox"
  23113. },
  23114. ...useAriaProps(["ariaLabel"])
  23115. });
  23116. const checkboxGroupEmits = {
  23117. [UPDATE_MODEL_EVENT]: (val) => isArray$1(val),
  23118. change: (val) => isArray$1(val)
  23119. };
  23120. const checkboxDefaultProps = {
  23121. label: "label",
  23122. value: "value",
  23123. disabled: "disabled"
  23124. };
  23125. const __default__$1t = vue.defineComponent({
  23126. name: "ElCheckboxGroup"
  23127. });
  23128. const _sfc_main$1V = /* @__PURE__ */ vue.defineComponent({
  23129. ...__default__$1t,
  23130. props: checkboxGroupProps,
  23131. emits: checkboxGroupEmits,
  23132. setup(__props, { emit }) {
  23133. const props = __props;
  23134. const ns = useNamespace("checkbox");
  23135. const { formItem } = useFormItem();
  23136. const { inputId: groupId, isLabeledByFormItem } = useFormItemInputId(props, {
  23137. formItemContext: formItem
  23138. });
  23139. const changeEvent = async (value) => {
  23140. emit(UPDATE_MODEL_EVENT, value);
  23141. await vue.nextTick();
  23142. emit(CHANGE_EVENT, value);
  23143. };
  23144. const modelValue = vue.computed({
  23145. get() {
  23146. return props.modelValue;
  23147. },
  23148. set(val) {
  23149. changeEvent(val);
  23150. }
  23151. });
  23152. const aliasProps = vue.computed(() => ({
  23153. ...checkboxDefaultProps,
  23154. ...props.props
  23155. }));
  23156. const getOptionProps = (option) => {
  23157. const { label, value, disabled } = aliasProps.value;
  23158. const base = {
  23159. label: option[label],
  23160. value: option[value],
  23161. disabled: option[disabled]
  23162. };
  23163. return { ...omit(option, [label, value, disabled]), ...base };
  23164. };
  23165. const optionComponent = vue.computed(() => props.type === "button" ? CheckboxButton : Checkbox);
  23166. vue.provide(checkboxGroupContextKey, {
  23167. ...pick(vue.toRefs(props), [
  23168. "size",
  23169. "min",
  23170. "max",
  23171. "disabled",
  23172. "validateEvent",
  23173. "fill",
  23174. "textColor"
  23175. ]),
  23176. modelValue,
  23177. changeEvent
  23178. });
  23179. vue.watch(() => props.modelValue, (newVal, oldValue) => {
  23180. if (props.validateEvent && !isEqual$1(newVal, oldValue)) {
  23181. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn(err));
  23182. }
  23183. });
  23184. return (_ctx, _cache) => {
  23185. var _a;
  23186. return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.tag), {
  23187. id: vue.unref(groupId),
  23188. class: vue.normalizeClass(vue.unref(ns).b("group")),
  23189. role: "group",
  23190. "aria-label": !vue.unref(isLabeledByFormItem) ? _ctx.ariaLabel || "checkbox-group" : void 0,
  23191. "aria-labelledby": vue.unref(isLabeledByFormItem) ? (_a = vue.unref(formItem)) == null ? void 0 : _a.labelId : void 0
  23192. }, {
  23193. default: vue.withCtx(() => [
  23194. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  23195. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.options, (item, index) => {
  23196. return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(optionComponent)), vue.mergeProps({ key: index }, getOptionProps(item)), null, 16);
  23197. }), 128))
  23198. ])
  23199. ]),
  23200. _: 3
  23201. }, 8, ["id", "class", "aria-label", "aria-labelledby"]);
  23202. };
  23203. }
  23204. });
  23205. var CheckboxGroup = /* @__PURE__ */ _export_sfc(_sfc_main$1V, [["__file", "checkbox-group.vue"]]);
  23206. const ElCheckbox = withInstall(Checkbox, {
  23207. CheckboxButton,
  23208. CheckboxGroup
  23209. });
  23210. const ElCheckboxButton = withNoopInstall(CheckboxButton);
  23211. const ElCheckboxGroup$1 = withNoopInstall(CheckboxGroup);
  23212. const radioPropsBase = buildProps({
  23213. modelValue: {
  23214. type: [String, Number, Boolean],
  23215. default: void 0
  23216. },
  23217. size: useSizeProp,
  23218. disabled: Boolean,
  23219. label: {
  23220. type: [String, Number, Boolean],
  23221. default: void 0
  23222. },
  23223. value: {
  23224. type: [String, Number, Boolean],
  23225. default: void 0
  23226. },
  23227. name: {
  23228. type: String,
  23229. default: void 0
  23230. }
  23231. });
  23232. const radioProps = buildProps({
  23233. ...radioPropsBase,
  23234. border: Boolean
  23235. });
  23236. const radioEmits = {
  23237. [UPDATE_MODEL_EVENT]: (val) => isString$1(val) || isNumber(val) || isBoolean(val),
  23238. [CHANGE_EVENT]: (val) => isString$1(val) || isNumber(val) || isBoolean(val)
  23239. };
  23240. const radioGroupKey = Symbol("radioGroupKey");
  23241. const useRadio = (props, emit) => {
  23242. const radioRef = vue.ref();
  23243. const radioGroup = vue.inject(radioGroupKey, void 0);
  23244. const isGroup = vue.computed(() => !!radioGroup);
  23245. const actualValue = vue.computed(() => {
  23246. if (!isPropAbsent(props.value)) {
  23247. return props.value;
  23248. }
  23249. return props.label;
  23250. });
  23251. const modelValue = vue.computed({
  23252. get() {
  23253. return isGroup.value ? radioGroup.modelValue : props.modelValue;
  23254. },
  23255. set(val) {
  23256. if (isGroup.value) {
  23257. radioGroup.changeEvent(val);
  23258. } else {
  23259. emit && emit(UPDATE_MODEL_EVENT, val);
  23260. }
  23261. radioRef.value.checked = props.modelValue === actualValue.value;
  23262. }
  23263. });
  23264. const size = useFormSize(vue.computed(() => radioGroup == null ? void 0 : radioGroup.size));
  23265. const disabled = useFormDisabled(vue.computed(() => radioGroup == null ? void 0 : radioGroup.disabled));
  23266. const focus = vue.ref(false);
  23267. const tabIndex = vue.computed(() => {
  23268. return disabled.value || isGroup.value && modelValue.value !== actualValue.value ? -1 : 0;
  23269. });
  23270. useDeprecated({
  23271. from: "label act as value",
  23272. replacement: "value",
  23273. version: "3.0.0",
  23274. scope: "el-radio",
  23275. ref: "https://element-plus.org/en-US/component/radio.html"
  23276. }, vue.computed(() => isGroup.value && isPropAbsent(props.value)));
  23277. return {
  23278. radioRef,
  23279. isGroup,
  23280. radioGroup,
  23281. focus,
  23282. size,
  23283. disabled,
  23284. tabIndex,
  23285. modelValue,
  23286. actualValue
  23287. };
  23288. };
  23289. const __default__$1s = vue.defineComponent({
  23290. name: "ElRadio"
  23291. });
  23292. const _sfc_main$1U = /* @__PURE__ */ vue.defineComponent({
  23293. ...__default__$1s,
  23294. props: radioProps,
  23295. emits: radioEmits,
  23296. setup(__props, { emit }) {
  23297. const props = __props;
  23298. const ns = useNamespace("radio");
  23299. const { radioRef, radioGroup, focus, size, disabled, modelValue, actualValue } = useRadio(props, emit);
  23300. function handleChange() {
  23301. vue.nextTick(() => emit(CHANGE_EVENT, modelValue.value));
  23302. }
  23303. return (_ctx, _cache) => {
  23304. var _a;
  23305. return vue.openBlock(), vue.createElementBlock("label", {
  23306. class: vue.normalizeClass([
  23307. vue.unref(ns).b(),
  23308. vue.unref(ns).is("disabled", vue.unref(disabled)),
  23309. vue.unref(ns).is("focus", vue.unref(focus)),
  23310. vue.unref(ns).is("bordered", _ctx.border),
  23311. vue.unref(ns).is("checked", vue.unref(modelValue) === vue.unref(actualValue)),
  23312. vue.unref(ns).m(vue.unref(size))
  23313. ])
  23314. }, [
  23315. vue.createElementVNode("span", {
  23316. class: vue.normalizeClass([
  23317. vue.unref(ns).e("input"),
  23318. vue.unref(ns).is("disabled", vue.unref(disabled)),
  23319. vue.unref(ns).is("checked", vue.unref(modelValue) === vue.unref(actualValue))
  23320. ])
  23321. }, [
  23322. vue.withDirectives(vue.createElementVNode("input", {
  23323. ref_key: "radioRef",
  23324. ref: radioRef,
  23325. "onUpdate:modelValue": ($event) => vue.isRef(modelValue) ? modelValue.value = $event : null,
  23326. class: vue.normalizeClass(vue.unref(ns).e("original")),
  23327. value: vue.unref(actualValue),
  23328. name: _ctx.name || ((_a = vue.unref(radioGroup)) == null ? void 0 : _a.name),
  23329. disabled: vue.unref(disabled),
  23330. checked: vue.unref(modelValue) === vue.unref(actualValue),
  23331. type: "radio",
  23332. onFocus: ($event) => focus.value = true,
  23333. onBlur: ($event) => focus.value = false,
  23334. onChange: handleChange,
  23335. onClick: vue.withModifiers(() => {
  23336. }, ["stop"])
  23337. }, null, 42, ["onUpdate:modelValue", "value", "name", "disabled", "checked", "onFocus", "onBlur", "onClick"]), [
  23338. [vue.vModelRadio, vue.unref(modelValue)]
  23339. ]),
  23340. vue.createElementVNode("span", {
  23341. class: vue.normalizeClass(vue.unref(ns).e("inner"))
  23342. }, null, 2)
  23343. ], 2),
  23344. vue.createElementVNode("span", {
  23345. class: vue.normalizeClass(vue.unref(ns).e("label")),
  23346. onKeydown: vue.withModifiers(() => {
  23347. }, ["stop"])
  23348. }, [
  23349. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  23350. vue.createTextVNode(vue.toDisplayString(_ctx.label), 1)
  23351. ])
  23352. ], 42, ["onKeydown"])
  23353. ], 2);
  23354. };
  23355. }
  23356. });
  23357. var Radio = /* @__PURE__ */ _export_sfc(_sfc_main$1U, [["__file", "radio.vue"]]);
  23358. const radioButtonProps = buildProps({
  23359. ...radioPropsBase
  23360. });
  23361. const __default__$1r = vue.defineComponent({
  23362. name: "ElRadioButton"
  23363. });
  23364. const _sfc_main$1T = /* @__PURE__ */ vue.defineComponent({
  23365. ...__default__$1r,
  23366. props: radioButtonProps,
  23367. setup(__props) {
  23368. const props = __props;
  23369. const ns = useNamespace("radio");
  23370. const { radioRef, focus, size, disabled, modelValue, radioGroup, actualValue } = useRadio(props);
  23371. const activeStyle = vue.computed(() => {
  23372. return {
  23373. backgroundColor: (radioGroup == null ? void 0 : radioGroup.fill) || "",
  23374. borderColor: (radioGroup == null ? void 0 : radioGroup.fill) || "",
  23375. boxShadow: (radioGroup == null ? void 0 : radioGroup.fill) ? `-1px 0 0 0 ${radioGroup.fill}` : "",
  23376. color: (radioGroup == null ? void 0 : radioGroup.textColor) || ""
  23377. };
  23378. });
  23379. return (_ctx, _cache) => {
  23380. var _a;
  23381. return vue.openBlock(), vue.createElementBlock("label", {
  23382. class: vue.normalizeClass([
  23383. vue.unref(ns).b("button"),
  23384. vue.unref(ns).is("active", vue.unref(modelValue) === vue.unref(actualValue)),
  23385. vue.unref(ns).is("disabled", vue.unref(disabled)),
  23386. vue.unref(ns).is("focus", vue.unref(focus)),
  23387. vue.unref(ns).bm("button", vue.unref(size))
  23388. ])
  23389. }, [
  23390. vue.withDirectives(vue.createElementVNode("input", {
  23391. ref_key: "radioRef",
  23392. ref: radioRef,
  23393. "onUpdate:modelValue": ($event) => vue.isRef(modelValue) ? modelValue.value = $event : null,
  23394. class: vue.normalizeClass(vue.unref(ns).be("button", "original-radio")),
  23395. value: vue.unref(actualValue),
  23396. type: "radio",
  23397. name: _ctx.name || ((_a = vue.unref(radioGroup)) == null ? void 0 : _a.name),
  23398. disabled: vue.unref(disabled),
  23399. onFocus: ($event) => focus.value = true,
  23400. onBlur: ($event) => focus.value = false,
  23401. onClick: vue.withModifiers(() => {
  23402. }, ["stop"])
  23403. }, null, 42, ["onUpdate:modelValue", "value", "name", "disabled", "onFocus", "onBlur", "onClick"]), [
  23404. [vue.vModelRadio, vue.unref(modelValue)]
  23405. ]),
  23406. vue.createElementVNode("span", {
  23407. class: vue.normalizeClass(vue.unref(ns).be("button", "inner")),
  23408. style: vue.normalizeStyle(vue.unref(modelValue) === vue.unref(actualValue) ? vue.unref(activeStyle) : {}),
  23409. onKeydown: vue.withModifiers(() => {
  23410. }, ["stop"])
  23411. }, [
  23412. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  23413. vue.createTextVNode(vue.toDisplayString(_ctx.label), 1)
  23414. ])
  23415. ], 46, ["onKeydown"])
  23416. ], 2);
  23417. };
  23418. }
  23419. });
  23420. var RadioButton = /* @__PURE__ */ _export_sfc(_sfc_main$1T, [["__file", "radio-button.vue"]]);
  23421. const radioGroupProps = buildProps({
  23422. id: {
  23423. type: String,
  23424. default: void 0
  23425. },
  23426. size: useSizeProp,
  23427. disabled: Boolean,
  23428. modelValue: {
  23429. type: [String, Number, Boolean],
  23430. default: void 0
  23431. },
  23432. fill: {
  23433. type: String,
  23434. default: ""
  23435. },
  23436. textColor: {
  23437. type: String,
  23438. default: ""
  23439. },
  23440. name: {
  23441. type: String,
  23442. default: void 0
  23443. },
  23444. validateEvent: {
  23445. type: Boolean,
  23446. default: true
  23447. },
  23448. options: {
  23449. type: definePropType(Array)
  23450. },
  23451. props: {
  23452. type: definePropType(Object),
  23453. default: () => radioDefaultProps
  23454. },
  23455. type: {
  23456. type: String,
  23457. values: ["radio", "button"],
  23458. default: "radio"
  23459. },
  23460. ...useAriaProps(["ariaLabel"])
  23461. });
  23462. const radioGroupEmits = radioEmits;
  23463. const radioDefaultProps = {
  23464. label: "label",
  23465. value: "value",
  23466. disabled: "disabled"
  23467. };
  23468. const __default__$1q = vue.defineComponent({
  23469. name: "ElRadioGroup"
  23470. });
  23471. const _sfc_main$1S = /* @__PURE__ */ vue.defineComponent({
  23472. ...__default__$1q,
  23473. props: radioGroupProps,
  23474. emits: radioGroupEmits,
  23475. setup(__props, { emit }) {
  23476. const props = __props;
  23477. const ns = useNamespace("radio");
  23478. const radioId = useId();
  23479. const radioGroupRef = vue.ref();
  23480. const { formItem } = useFormItem();
  23481. const { inputId: groupId, isLabeledByFormItem } = useFormItemInputId(props, {
  23482. formItemContext: formItem
  23483. });
  23484. const changeEvent = (value) => {
  23485. emit(UPDATE_MODEL_EVENT, value);
  23486. vue.nextTick(() => emit(CHANGE_EVENT, value));
  23487. };
  23488. vue.onMounted(() => {
  23489. const radios = radioGroupRef.value.querySelectorAll("[type=radio]");
  23490. const firstLabel = radios[0];
  23491. if (!Array.from(radios).some((radio) => radio.checked) && firstLabel) {
  23492. firstLabel.tabIndex = 0;
  23493. }
  23494. });
  23495. const name = vue.computed(() => {
  23496. return props.name || radioId.value;
  23497. });
  23498. const aliasProps = vue.computed(() => ({
  23499. ...radioDefaultProps,
  23500. ...props.props
  23501. }));
  23502. const getOptionProps = (option) => {
  23503. const { label, value, disabled } = aliasProps.value;
  23504. const base = {
  23505. label: option[label],
  23506. value: option[value],
  23507. disabled: option[disabled]
  23508. };
  23509. return { ...omit(option, [label, value, disabled]), ...base };
  23510. };
  23511. const optionComponent = vue.computed(() => props.type === "button" ? RadioButton : Radio);
  23512. vue.provide(radioGroupKey, vue.reactive({
  23513. ...vue.toRefs(props),
  23514. changeEvent,
  23515. name
  23516. }));
  23517. vue.watch(() => props.modelValue, (newVal, oldValue) => {
  23518. if (props.validateEvent && !isEqual$1(newVal, oldValue)) {
  23519. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn(err));
  23520. }
  23521. });
  23522. return (_ctx, _cache) => {
  23523. return vue.openBlock(), vue.createElementBlock("div", {
  23524. id: vue.unref(groupId),
  23525. ref_key: "radioGroupRef",
  23526. ref: radioGroupRef,
  23527. class: vue.normalizeClass(vue.unref(ns).b("group")),
  23528. role: "radiogroup",
  23529. "aria-label": !vue.unref(isLabeledByFormItem) ? _ctx.ariaLabel || "radio-group" : void 0,
  23530. "aria-labelledby": vue.unref(isLabeledByFormItem) ? vue.unref(formItem).labelId : void 0
  23531. }, [
  23532. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  23533. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.options, (item, index) => {
  23534. return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(optionComponent)), vue.mergeProps({ key: index }, getOptionProps(item)), null, 16);
  23535. }), 128))
  23536. ])
  23537. ], 10, ["id", "aria-label", "aria-labelledby"]);
  23538. };
  23539. }
  23540. });
  23541. var RadioGroup = /* @__PURE__ */ _export_sfc(_sfc_main$1S, [["__file", "radio-group.vue"]]);
  23542. const ElRadio = withInstall(Radio, {
  23543. RadioButton,
  23544. RadioGroup
  23545. });
  23546. const ElRadioGroup = withNoopInstall(RadioGroup);
  23547. const ElRadioButton = withNoopInstall(RadioButton);
  23548. const CASCADER_PANEL_INJECTION_KEY = Symbol();
  23549. function isVNodeEmpty(vnodes) {
  23550. return !!(isArray$1(vnodes) ? vnodes.every(({
  23551. type
  23552. }) => type === vue.Comment) : (vnodes == null ? void 0 : vnodes.type) === vue.Comment);
  23553. }
  23554. var NodeContent$1 = vue.defineComponent({
  23555. name: "NodeContent",
  23556. props: {
  23557. node: {
  23558. type: Object,
  23559. required: true
  23560. }
  23561. },
  23562. setup(props) {
  23563. const ns = useNamespace("cascader-node");
  23564. const {
  23565. renderLabelFn
  23566. } = vue.inject(CASCADER_PANEL_INJECTION_KEY);
  23567. const {
  23568. node
  23569. } = props;
  23570. const {
  23571. data,
  23572. label: nodeLabel
  23573. } = node;
  23574. const label = () => {
  23575. const renderLabel = renderLabelFn == null ? void 0 : renderLabelFn({
  23576. node,
  23577. data
  23578. });
  23579. return isVNodeEmpty(renderLabel) ? nodeLabel : renderLabel != null ? renderLabel : nodeLabel;
  23580. };
  23581. return () => vue.createVNode("span", {
  23582. "class": ns.e("label")
  23583. }, [label()]);
  23584. }
  23585. });
  23586. const __default__$1p = vue.defineComponent({
  23587. name: "ElCascaderNode"
  23588. });
  23589. const _sfc_main$1R = /* @__PURE__ */ vue.defineComponent({
  23590. ...__default__$1p,
  23591. props: {
  23592. node: {
  23593. type: Object,
  23594. required: true
  23595. },
  23596. menuId: String
  23597. },
  23598. emits: ["expand"],
  23599. setup(__props, { emit }) {
  23600. const props = __props;
  23601. const panel = vue.inject(CASCADER_PANEL_INJECTION_KEY);
  23602. const ns = useNamespace("cascader-node");
  23603. const isHoverMenu = vue.computed(() => panel.isHoverMenu);
  23604. const multiple = vue.computed(() => panel.config.multiple);
  23605. const checkStrictly = vue.computed(() => panel.config.checkStrictly);
  23606. const showPrefix = vue.computed(() => panel.config.showPrefix);
  23607. const checkedNodeId = vue.computed(() => {
  23608. var _a;
  23609. return (_a = panel.checkedNodes[0]) == null ? void 0 : _a.uid;
  23610. });
  23611. const isDisabled = vue.computed(() => props.node.isDisabled);
  23612. const isLeaf = vue.computed(() => props.node.isLeaf);
  23613. const expandable = vue.computed(() => checkStrictly.value && !isLeaf.value || !isDisabled.value);
  23614. const inExpandingPath = vue.computed(() => isInPath(panel.expandingNode));
  23615. const inCheckedPath = vue.computed(() => checkStrictly.value && panel.checkedNodes.some(isInPath));
  23616. const isInPath = (node) => {
  23617. var _a;
  23618. const { level, uid } = props.node;
  23619. return ((_a = node == null ? void 0 : node.pathNodes[level - 1]) == null ? void 0 : _a.uid) === uid;
  23620. };
  23621. const doExpand = () => {
  23622. if (inExpandingPath.value)
  23623. return;
  23624. panel.expandNode(props.node);
  23625. };
  23626. const doCheck = (checked) => {
  23627. const { node } = props;
  23628. if (checked === node.checked)
  23629. return;
  23630. panel.handleCheckChange(node, checked);
  23631. };
  23632. const doLoad = () => {
  23633. panel.lazyLoad(props.node, () => {
  23634. if (!isLeaf.value)
  23635. doExpand();
  23636. });
  23637. };
  23638. const handleHoverExpand = (e) => {
  23639. if (!isHoverMenu.value)
  23640. return;
  23641. handleExpand();
  23642. !isLeaf.value && emit("expand", e);
  23643. };
  23644. const handleExpand = () => {
  23645. const { node } = props;
  23646. if (!expandable.value || node.loading)
  23647. return;
  23648. node.loaded ? doExpand() : doLoad();
  23649. };
  23650. const handleClick = () => {
  23651. if (isLeaf.value && !isDisabled.value && !checkStrictly.value && !multiple.value) {
  23652. handleCheck(true);
  23653. } else if ((panel.config.checkOnClickNode && (multiple.value || checkStrictly.value) || isLeaf.value && panel.config.checkOnClickLeaf) && !isDisabled.value) {
  23654. handleSelectCheck(!props.node.checked);
  23655. } else if (!isHoverMenu.value) {
  23656. handleExpand();
  23657. }
  23658. };
  23659. const handleSelectCheck = (checked) => {
  23660. if (checkStrictly.value) {
  23661. doCheck(checked);
  23662. if (props.node.loaded) {
  23663. doExpand();
  23664. }
  23665. } else {
  23666. handleCheck(checked);
  23667. }
  23668. };
  23669. const handleCheck = (checked) => {
  23670. if (!props.node.loaded) {
  23671. doLoad();
  23672. } else {
  23673. doCheck(checked);
  23674. !checkStrictly.value && doExpand();
  23675. }
  23676. };
  23677. return (_ctx, _cache) => {
  23678. return vue.openBlock(), vue.createElementBlock("li", {
  23679. id: `${__props.menuId}-${__props.node.uid}`,
  23680. role: "menuitem",
  23681. "aria-haspopup": !vue.unref(isLeaf),
  23682. "aria-owns": vue.unref(isLeaf) ? void 0 : __props.menuId,
  23683. "aria-expanded": vue.unref(inExpandingPath),
  23684. tabindex: vue.unref(expandable) ? -1 : void 0,
  23685. class: vue.normalizeClass([
  23686. vue.unref(ns).b(),
  23687. vue.unref(ns).is("selectable", vue.unref(checkStrictly)),
  23688. vue.unref(ns).is("active", __props.node.checked),
  23689. vue.unref(ns).is("disabled", !vue.unref(expandable)),
  23690. vue.unref(inExpandingPath) && "in-active-path",
  23691. vue.unref(inCheckedPath) && "in-checked-path"
  23692. ]),
  23693. onMouseenter: handleHoverExpand,
  23694. onFocus: handleHoverExpand,
  23695. onClick: handleClick
  23696. }, [
  23697. vue.createCommentVNode(" prefix "),
  23698. vue.unref(multiple) && vue.unref(showPrefix) ? (vue.openBlock(), vue.createBlock(vue.unref(ElCheckbox), {
  23699. key: 0,
  23700. "model-value": __props.node.checked,
  23701. indeterminate: __props.node.indeterminate,
  23702. disabled: vue.unref(isDisabled),
  23703. onClick: vue.withModifiers(() => {
  23704. }, ["stop"]),
  23705. "onUpdate:modelValue": handleSelectCheck
  23706. }, null, 8, ["model-value", "indeterminate", "disabled", "onClick"])) : vue.unref(checkStrictly) && vue.unref(showPrefix) ? (vue.openBlock(), vue.createBlock(vue.unref(ElRadio), {
  23707. key: 1,
  23708. "model-value": vue.unref(checkedNodeId),
  23709. label: __props.node.uid,
  23710. disabled: vue.unref(isDisabled),
  23711. "onUpdate:modelValue": handleSelectCheck,
  23712. onClick: vue.withModifiers(() => {
  23713. }, ["stop"])
  23714. }, {
  23715. default: vue.withCtx(() => [
  23716. 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 "),
  23717. vue.createElementVNode("span")
  23718. ]),
  23719. _: 1
  23720. }, 8, ["model-value", "label", "disabled", "onClick"])) : vue.unref(isLeaf) && __props.node.checked ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  23721. key: 2,
  23722. class: vue.normalizeClass(vue.unref(ns).e("prefix"))
  23723. }, {
  23724. default: vue.withCtx(() => [
  23725. vue.createVNode(vue.unref(check_default))
  23726. ]),
  23727. _: 1
  23728. }, 8, ["class"])) : vue.createCommentVNode("v-if", true),
  23729. vue.createCommentVNode(" content "),
  23730. vue.createVNode(vue.unref(NodeContent$1), { node: __props.node }, null, 8, ["node"]),
  23731. vue.createCommentVNode(" postfix "),
  23732. !vue.unref(isLeaf) ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 3 }, [
  23733. __props.node.loading ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  23734. key: 0,
  23735. class: vue.normalizeClass([vue.unref(ns).is("loading"), vue.unref(ns).e("postfix")])
  23736. }, {
  23737. default: vue.withCtx(() => [
  23738. vue.createVNode(vue.unref(loading_default))
  23739. ]),
  23740. _: 1
  23741. }, 8, ["class"])) : (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  23742. key: 1,
  23743. class: vue.normalizeClass(["arrow-right", vue.unref(ns).e("postfix")])
  23744. }, {
  23745. default: vue.withCtx(() => [
  23746. vue.createVNode(vue.unref(arrow_right_default))
  23747. ]),
  23748. _: 1
  23749. }, 8, ["class"]))
  23750. ], 64)) : vue.createCommentVNode("v-if", true)
  23751. ], 42, ["id", "aria-haspopup", "aria-owns", "aria-expanded", "tabindex"]);
  23752. };
  23753. }
  23754. });
  23755. var ElCascaderNode = /* @__PURE__ */ _export_sfc(_sfc_main$1R, [["__file", "node.vue"]]);
  23756. const __default__$1o = vue.defineComponent({
  23757. name: "ElCascaderMenu"
  23758. });
  23759. const _sfc_main$1Q = /* @__PURE__ */ vue.defineComponent({
  23760. ...__default__$1o,
  23761. props: {
  23762. nodes: {
  23763. type: Array,
  23764. required: true
  23765. },
  23766. index: {
  23767. type: Number,
  23768. required: true
  23769. }
  23770. },
  23771. setup(__props) {
  23772. const props = __props;
  23773. const instance = vue.getCurrentInstance();
  23774. const ns = useNamespace("cascader-menu");
  23775. const { t } = useLocale();
  23776. const id = useId();
  23777. let activeNode;
  23778. let hoverTimer;
  23779. const panel = vue.inject(CASCADER_PANEL_INJECTION_KEY);
  23780. const hoverZone = vue.ref();
  23781. const isEmpty = vue.computed(() => !props.nodes.length);
  23782. const isLoading = vue.computed(() => !panel.initialLoaded);
  23783. const menuId = vue.computed(() => `${id.value}-${props.index}`);
  23784. const handleExpand = (e) => {
  23785. activeNode = e.target;
  23786. };
  23787. const handleMouseMove = (e) => {
  23788. if (!panel.isHoverMenu || !activeNode || !hoverZone.value)
  23789. return;
  23790. if (activeNode.contains(e.target)) {
  23791. clearHoverTimer();
  23792. const el = instance.vnode.el;
  23793. const { left } = el.getBoundingClientRect();
  23794. const { offsetWidth, offsetHeight } = el;
  23795. const startX = e.clientX - left;
  23796. const top = activeNode.offsetTop;
  23797. const bottom = top + activeNode.offsetHeight;
  23798. hoverZone.value.innerHTML = `
  23799. <path style="pointer-events: auto;" fill="transparent" d="M${startX} ${top} L${offsetWidth} 0 V${top} Z" />
  23800. <path style="pointer-events: auto;" fill="transparent" d="M${startX} ${bottom} L${offsetWidth} ${offsetHeight} V${bottom} Z" />
  23801. `;
  23802. } else if (!hoverTimer) {
  23803. hoverTimer = window.setTimeout(clearHoverZone, panel.config.hoverThreshold);
  23804. }
  23805. };
  23806. const clearHoverTimer = () => {
  23807. if (!hoverTimer)
  23808. return;
  23809. clearTimeout(hoverTimer);
  23810. hoverTimer = void 0;
  23811. };
  23812. const clearHoverZone = () => {
  23813. if (!hoverZone.value)
  23814. return;
  23815. hoverZone.value.innerHTML = "";
  23816. clearHoverTimer();
  23817. };
  23818. return (_ctx, _cache) => {
  23819. return vue.openBlock(), vue.createBlock(vue.unref(ElScrollbar), {
  23820. key: vue.unref(menuId),
  23821. tag: "ul",
  23822. role: "menu",
  23823. class: vue.normalizeClass(vue.unref(ns).b()),
  23824. "wrap-class": vue.unref(ns).e("wrap"),
  23825. "view-class": [vue.unref(ns).e("list"), vue.unref(ns).is("empty", vue.unref(isEmpty))],
  23826. onMousemove: handleMouseMove,
  23827. onMouseleave: clearHoverZone
  23828. }, {
  23829. default: vue.withCtx(() => {
  23830. var _a;
  23831. return [
  23832. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(__props.nodes, (node) => {
  23833. return vue.openBlock(), vue.createBlock(ElCascaderNode, {
  23834. key: node.uid,
  23835. node,
  23836. "menu-id": vue.unref(menuId),
  23837. onExpand: handleExpand
  23838. }, null, 8, ["node", "menu-id"]);
  23839. }), 128)),
  23840. vue.unref(isLoading) ? (vue.openBlock(), vue.createElementBlock("div", {
  23841. key: 0,
  23842. class: vue.normalizeClass(vue.unref(ns).e("empty-text"))
  23843. }, [
  23844. vue.createVNode(vue.unref(ElIcon), {
  23845. size: "14",
  23846. class: vue.normalizeClass(vue.unref(ns).is("loading"))
  23847. }, {
  23848. default: vue.withCtx(() => [
  23849. vue.createVNode(vue.unref(loading_default))
  23850. ]),
  23851. _: 1
  23852. }, 8, ["class"]),
  23853. vue.createTextVNode(" " + vue.toDisplayString(vue.unref(t)("el.cascader.loading")), 1)
  23854. ], 2)) : vue.unref(isEmpty) ? (vue.openBlock(), vue.createElementBlock("div", {
  23855. key: 1,
  23856. class: vue.normalizeClass(vue.unref(ns).e("empty-text"))
  23857. }, [
  23858. vue.renderSlot(_ctx.$slots, "empty", {}, () => [
  23859. vue.createTextVNode(vue.toDisplayString(vue.unref(t)("el.cascader.noData")), 1)
  23860. ])
  23861. ], 2)) : ((_a = vue.unref(panel)) == null ? void 0 : _a.isHoverMenu) ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 2 }, [
  23862. vue.createCommentVNode(" eslint-disable-next-line vue/html-self-closing "),
  23863. (vue.openBlock(), vue.createElementBlock("svg", {
  23864. ref_key: "hoverZone",
  23865. ref: hoverZone,
  23866. class: vue.normalizeClass(vue.unref(ns).e("hover-zone"))
  23867. }, null, 2))
  23868. ], 2112)) : vue.createCommentVNode("v-if", true)
  23869. ];
  23870. }),
  23871. _: 3
  23872. }, 8, ["class", "wrap-class", "view-class"]);
  23873. };
  23874. }
  23875. });
  23876. var ElCascaderMenu = /* @__PURE__ */ _export_sfc(_sfc_main$1Q, [["__file", "menu.vue"]]);
  23877. let uid = 0;
  23878. const calculatePathNodes = (node) => {
  23879. const nodes = [node];
  23880. let { parent } = node;
  23881. while (parent) {
  23882. nodes.unshift(parent);
  23883. parent = parent.parent;
  23884. }
  23885. return nodes;
  23886. };
  23887. class Node$3 {
  23888. constructor(data, config, parent, root = false) {
  23889. this.data = data;
  23890. this.config = config;
  23891. this.parent = parent;
  23892. this.root = root;
  23893. this.uid = uid++;
  23894. this.checked = false;
  23895. this.indeterminate = false;
  23896. this.loading = false;
  23897. const { value: valueKey, label: labelKey, children: childrenKey } = config;
  23898. const childrenData = data[childrenKey];
  23899. const pathNodes = calculatePathNodes(this);
  23900. this.level = root ? 0 : parent ? parent.level + 1 : 1;
  23901. this.value = data[valueKey];
  23902. this.label = data[labelKey];
  23903. this.pathNodes = pathNodes;
  23904. this.pathValues = pathNodes.map((node) => node.value);
  23905. this.pathLabels = pathNodes.map((node) => node.label);
  23906. this.childrenData = childrenData;
  23907. this.children = (childrenData || []).map((child) => new Node$3(child, config, this));
  23908. this.loaded = !config.lazy || this.isLeaf || !isEmpty(childrenData);
  23909. this.text = "";
  23910. }
  23911. get isDisabled() {
  23912. const { data, parent, config } = this;
  23913. const { disabled, checkStrictly } = config;
  23914. const isDisabled = isFunction$1(disabled) ? disabled(data, this) : !!data[disabled];
  23915. return isDisabled || !checkStrictly && !!(parent == null ? void 0 : parent.isDisabled);
  23916. }
  23917. get isLeaf() {
  23918. const { data, config, childrenData, loaded } = this;
  23919. const { lazy, leaf } = config;
  23920. const isLeaf = isFunction$1(leaf) ? leaf(data, this) : data[leaf];
  23921. return isUndefined(isLeaf) ? lazy && !loaded ? false : !(isArray$1(childrenData) && childrenData.length) : !!isLeaf;
  23922. }
  23923. get valueByOption() {
  23924. return this.config.emitPath ? this.pathValues : this.value;
  23925. }
  23926. appendChild(childData) {
  23927. const { childrenData, children } = this;
  23928. const node = new Node$3(childData, this.config, this);
  23929. if (isArray$1(childrenData)) {
  23930. childrenData.push(childData);
  23931. } else {
  23932. this.childrenData = [childData];
  23933. }
  23934. children.push(node);
  23935. return node;
  23936. }
  23937. calcText(allLevels, separator) {
  23938. const text = allLevels ? this.pathLabels.join(separator) : this.label;
  23939. this.text = text;
  23940. return text;
  23941. }
  23942. broadcast(checked) {
  23943. this.children.forEach((child) => {
  23944. var _a;
  23945. if (child) {
  23946. child.broadcast(checked);
  23947. (_a = child.onParentCheck) == null ? void 0 : _a.call(child, checked);
  23948. }
  23949. });
  23950. }
  23951. emit() {
  23952. var _a;
  23953. const { parent } = this;
  23954. if (parent) {
  23955. (_a = parent.onChildCheck) == null ? void 0 : _a.call(parent);
  23956. parent.emit();
  23957. }
  23958. }
  23959. onParentCheck(checked) {
  23960. if (!this.isDisabled) {
  23961. this.setCheckState(checked);
  23962. }
  23963. }
  23964. onChildCheck() {
  23965. const { children } = this;
  23966. const validChildren = children.filter((child) => !child.isDisabled);
  23967. const checked = validChildren.length ? validChildren.every((child) => child.checked) : false;
  23968. this.setCheckState(checked);
  23969. }
  23970. setCheckState(checked) {
  23971. const totalNum = this.children.length;
  23972. const checkedNum = this.children.reduce((c, p) => {
  23973. const num = p.checked ? 1 : p.indeterminate ? 0.5 : 0;
  23974. return c + num;
  23975. }, 0);
  23976. this.checked = this.loaded && this.children.filter((child) => !child.isDisabled).every((child) => child.loaded && child.checked) && checked;
  23977. this.indeterminate = this.loaded && checkedNum !== totalNum && checkedNum > 0;
  23978. }
  23979. doCheck(checked) {
  23980. if (this.checked === checked)
  23981. return;
  23982. const { checkStrictly, multiple } = this.config;
  23983. if (checkStrictly || !multiple) {
  23984. this.checked = checked;
  23985. } else {
  23986. this.broadcast(checked);
  23987. this.setCheckState(checked);
  23988. this.emit();
  23989. }
  23990. }
  23991. }
  23992. var Node$4 = Node$3;
  23993. const flatNodes = (nodes, leafOnly) => {
  23994. return nodes.reduce((res, node) => {
  23995. if (node.isLeaf) {
  23996. res.push(node);
  23997. } else {
  23998. !leafOnly && res.push(node);
  23999. res = res.concat(flatNodes(node.children, leafOnly));
  24000. }
  24001. return res;
  24002. }, []);
  24003. };
  24004. class Store {
  24005. constructor(data, config) {
  24006. this.config = config;
  24007. const nodes = (data || []).map((nodeData) => new Node$4(nodeData, this.config));
  24008. this.nodes = nodes;
  24009. this.allNodes = flatNodes(nodes, false);
  24010. this.leafNodes = flatNodes(nodes, true);
  24011. }
  24012. getNodes() {
  24013. return this.nodes;
  24014. }
  24015. getFlattedNodes(leafOnly) {
  24016. return leafOnly ? this.leafNodes : this.allNodes;
  24017. }
  24018. appendNode(nodeData, parentNode) {
  24019. const node = parentNode ? parentNode.appendChild(nodeData) : new Node$4(nodeData, this.config);
  24020. if (!parentNode)
  24021. this.nodes.push(node);
  24022. this.appendAllNodesAndLeafNodes(node);
  24023. }
  24024. appendNodes(nodeDataList, parentNode) {
  24025. if (nodeDataList.length > 0) {
  24026. nodeDataList.forEach((nodeData) => this.appendNode(nodeData, parentNode));
  24027. } else {
  24028. parentNode && parentNode.isLeaf && this.leafNodes.push(parentNode);
  24029. }
  24030. }
  24031. appendAllNodesAndLeafNodes(node) {
  24032. this.allNodes.push(node);
  24033. node.isLeaf && this.leafNodes.push(node);
  24034. if (node.children) {
  24035. node.children.forEach((subNode) => {
  24036. this.appendAllNodesAndLeafNodes(subNode);
  24037. });
  24038. }
  24039. }
  24040. getNodeByValue(value, leafOnly = false) {
  24041. if (isPropAbsent(value))
  24042. return null;
  24043. const node = this.getFlattedNodes(leafOnly).find((node2) => isEqual$1(node2.value, value) || isEqual$1(node2.pathValues, value));
  24044. return node || null;
  24045. }
  24046. getSameNode(node) {
  24047. if (!node)
  24048. return null;
  24049. const node_ = this.getFlattedNodes(false).find(({ value, level }) => isEqual$1(node.value, value) && node.level === level);
  24050. return node_ || null;
  24051. }
  24052. }
  24053. const CommonProps = buildProps({
  24054. modelValue: {
  24055. type: definePropType([Number, String, Array, Object])
  24056. },
  24057. options: {
  24058. type: definePropType(Array),
  24059. default: () => []
  24060. },
  24061. props: {
  24062. type: definePropType(Object),
  24063. default: () => ({})
  24064. }
  24065. });
  24066. const DefaultProps = {
  24067. expandTrigger: "click",
  24068. multiple: false,
  24069. checkStrictly: false,
  24070. emitPath: true,
  24071. lazy: false,
  24072. lazyLoad: NOOP,
  24073. value: "value",
  24074. label: "label",
  24075. children: "children",
  24076. leaf: "leaf",
  24077. disabled: "disabled",
  24078. hoverThreshold: 500,
  24079. checkOnClickNode: false,
  24080. checkOnClickLeaf: true,
  24081. showPrefix: true
  24082. };
  24083. const cascaderPanelProps = buildProps({
  24084. ...CommonProps,
  24085. border: {
  24086. type: Boolean,
  24087. default: true
  24088. },
  24089. renderLabel: {
  24090. type: Function
  24091. }
  24092. });
  24093. const emitChangeFn$2 = (value) => true;
  24094. const cascaderPanelEmits = {
  24095. [UPDATE_MODEL_EVENT]: emitChangeFn$2,
  24096. [CHANGE_EVENT]: emitChangeFn$2,
  24097. close: () => true,
  24098. "expand-change": (value) => value
  24099. };
  24100. const useCascaderConfig = (props) => {
  24101. return vue.computed(() => ({
  24102. ...DefaultProps,
  24103. ...props.props
  24104. }));
  24105. };
  24106. const getMenuIndex = (el) => {
  24107. if (!el)
  24108. return 0;
  24109. const pieces = el.id.split("-");
  24110. return Number(pieces[pieces.length - 2]);
  24111. };
  24112. const checkNode = (el) => {
  24113. if (!el)
  24114. return;
  24115. const input = el.querySelector("input");
  24116. if (input) {
  24117. input.click();
  24118. } else if (isLeaf(el)) {
  24119. el.click();
  24120. }
  24121. };
  24122. const sortByOriginalOrder = (oldNodes, newNodes) => {
  24123. const newNodesCopy = newNodes.slice(0);
  24124. const newIds = newNodesCopy.map((node) => node.uid);
  24125. const res = oldNodes.reduce((acc, item) => {
  24126. const index = newIds.indexOf(item.uid);
  24127. if (index > -1) {
  24128. acc.push(item);
  24129. newNodesCopy.splice(index, 1);
  24130. newIds.splice(index, 1);
  24131. }
  24132. return acc;
  24133. }, []);
  24134. res.push(...newNodesCopy);
  24135. return res;
  24136. };
  24137. const __default__$1n = vue.defineComponent({
  24138. name: "ElCascaderPanel",
  24139. inheritAttrs: false
  24140. });
  24141. const _sfc_main$1P = /* @__PURE__ */ vue.defineComponent({
  24142. ...__default__$1n,
  24143. props: cascaderPanelProps,
  24144. emits: cascaderPanelEmits,
  24145. setup(__props, { expose, emit }) {
  24146. const props = __props;
  24147. let manualChecked = false;
  24148. const ns = useNamespace("cascader");
  24149. const config = useCascaderConfig(props);
  24150. const slots = vue.useSlots();
  24151. let store;
  24152. const initialLoaded = vue.ref(true);
  24153. const initialLoadedOnce = vue.ref(false);
  24154. const menuList = vue.ref([]);
  24155. const checkedValue = vue.ref();
  24156. const menus = vue.ref([]);
  24157. const expandingNode = vue.ref();
  24158. const checkedNodes = vue.ref([]);
  24159. const isHoverMenu = vue.computed(() => config.value.expandTrigger === "hover");
  24160. const renderLabelFn = vue.computed(() => props.renderLabel || slots.default);
  24161. const initStore = () => {
  24162. const { options } = props;
  24163. const cfg = config.value;
  24164. manualChecked = false;
  24165. store = new Store(options, cfg);
  24166. menus.value = [store.getNodes()];
  24167. if (cfg.lazy && isEmpty(props.options)) {
  24168. initialLoaded.value = false;
  24169. lazyLoad(void 0, (list) => {
  24170. if (list) {
  24171. store = new Store(list, cfg);
  24172. menus.value = [store.getNodes()];
  24173. }
  24174. initialLoaded.value = true;
  24175. syncCheckedValue(false, true);
  24176. });
  24177. } else {
  24178. syncCheckedValue(false, true);
  24179. }
  24180. };
  24181. const lazyLoad = (node, cb) => {
  24182. const cfg = config.value;
  24183. node = node || new Node$4({}, cfg, void 0, true);
  24184. node.loading = true;
  24185. const resolve = (dataList) => {
  24186. const _node = node;
  24187. const parent = _node.root ? null : _node;
  24188. _node.loading = false;
  24189. _node.loaded = true;
  24190. _node.childrenData = _node.childrenData || [];
  24191. dataList && (store == null ? void 0 : store.appendNodes(dataList, parent));
  24192. dataList && (cb == null ? void 0 : cb(dataList));
  24193. if (node.level === 0) {
  24194. initialLoadedOnce.value = true;
  24195. }
  24196. };
  24197. const reject = () => {
  24198. node.loading = false;
  24199. node.loaded = false;
  24200. if (node.level === 0) {
  24201. initialLoaded.value = true;
  24202. }
  24203. };
  24204. cfg.lazyLoad(node, resolve, reject);
  24205. };
  24206. const expandNode = (node, silent) => {
  24207. var _a;
  24208. const { level } = node;
  24209. const newMenus = menus.value.slice(0, level);
  24210. let newExpandingNode;
  24211. if (node.isLeaf) {
  24212. newExpandingNode = node.pathNodes[level - 2];
  24213. } else {
  24214. newExpandingNode = node;
  24215. newMenus.push(node.children);
  24216. }
  24217. if (((_a = expandingNode.value) == null ? void 0 : _a.uid) !== (newExpandingNode == null ? void 0 : newExpandingNode.uid)) {
  24218. expandingNode.value = node;
  24219. menus.value = newMenus;
  24220. !silent && emit("expand-change", (node == null ? void 0 : node.pathValues) || []);
  24221. }
  24222. };
  24223. const handleCheckChange = (node, checked, emitClose = true) => {
  24224. const { checkStrictly, multiple } = config.value;
  24225. const oldNode = checkedNodes.value[0];
  24226. manualChecked = true;
  24227. !multiple && (oldNode == null ? void 0 : oldNode.doCheck(false));
  24228. node.doCheck(checked);
  24229. calculateCheckedValue();
  24230. emitClose && !multiple && !checkStrictly && emit("close");
  24231. !emitClose && !multiple && expandParentNode(node);
  24232. };
  24233. const expandParentNode = (node) => {
  24234. if (!node)
  24235. return;
  24236. node = node.parent;
  24237. expandParentNode(node);
  24238. node && expandNode(node);
  24239. };
  24240. const getFlattedNodes = (leafOnly) => store == null ? void 0 : store.getFlattedNodes(leafOnly);
  24241. const getCheckedNodes = (leafOnly) => {
  24242. var _a;
  24243. return (_a = getFlattedNodes(leafOnly)) == null ? void 0 : _a.filter(({ checked }) => checked !== false);
  24244. };
  24245. const clearCheckedNodes = () => {
  24246. checkedNodes.value.forEach((node) => node.doCheck(false));
  24247. calculateCheckedValue();
  24248. menus.value = menus.value.slice(0, 1);
  24249. expandingNode.value = void 0;
  24250. emit("expand-change", []);
  24251. };
  24252. const calculateCheckedValue = () => {
  24253. var _a;
  24254. const { checkStrictly, multiple } = config.value;
  24255. const oldNodes = checkedNodes.value;
  24256. const newNodes = getCheckedNodes(!checkStrictly);
  24257. const nodes = sortByOriginalOrder(oldNodes, newNodes);
  24258. const values = nodes.map((node) => node.valueByOption);
  24259. checkedNodes.value = nodes;
  24260. checkedValue.value = multiple ? values : (_a = values[0]) != null ? _a : null;
  24261. };
  24262. const syncCheckedValue = (loaded = false, forced = false) => {
  24263. const { modelValue } = props;
  24264. const { lazy, multiple, checkStrictly } = config.value;
  24265. const leafOnly = !checkStrictly;
  24266. if (!initialLoaded.value || manualChecked || !forced && isEqual$1(modelValue, checkedValue.value))
  24267. return;
  24268. if (lazy && !loaded) {
  24269. const values = unique(flattenDeep(castArray(modelValue)));
  24270. const nodes = values.map((val) => store == null ? void 0 : store.getNodeByValue(val)).filter((node) => !!node && !node.loaded && !node.loading);
  24271. if (nodes.length) {
  24272. nodes.forEach((node) => {
  24273. lazyLoad(node, () => syncCheckedValue(false, forced));
  24274. });
  24275. } else {
  24276. syncCheckedValue(true, forced);
  24277. }
  24278. } else {
  24279. const values = multiple ? castArray(modelValue) : [modelValue];
  24280. const nodes = unique(values.map((val) => store == null ? void 0 : store.getNodeByValue(val, leafOnly)));
  24281. syncMenuState(nodes, forced);
  24282. checkedValue.value = cloneDeep(modelValue != null ? modelValue : void 0);
  24283. }
  24284. };
  24285. const syncMenuState = (newCheckedNodes, reserveExpandingState = true) => {
  24286. const { checkStrictly } = config.value;
  24287. const oldNodes = checkedNodes.value;
  24288. const newNodes = newCheckedNodes.filter((node) => !!node && (checkStrictly || node.isLeaf));
  24289. const oldExpandingNode = store == null ? void 0 : store.getSameNode(expandingNode.value);
  24290. const newExpandingNode = reserveExpandingState && oldExpandingNode || newNodes[0];
  24291. if (newExpandingNode) {
  24292. newExpandingNode.pathNodes.forEach((node) => expandNode(node, true));
  24293. } else {
  24294. expandingNode.value = void 0;
  24295. }
  24296. oldNodes.forEach((node) => node.doCheck(false));
  24297. vue.reactive(newNodes).forEach((node) => node.doCheck(true));
  24298. checkedNodes.value = newNodes;
  24299. vue.nextTick(scrollToExpandingNode);
  24300. };
  24301. const scrollToExpandingNode = () => {
  24302. if (!isClient)
  24303. return;
  24304. menuList.value.forEach((menu) => {
  24305. const menuElement = menu == null ? void 0 : menu.$el;
  24306. if (menuElement) {
  24307. const container = menuElement.querySelector(`.${ns.namespace.value}-scrollbar__wrap`);
  24308. const activeNode = menuElement.querySelector(`.${ns.b("node")}.${ns.is("active")}:last-child`) || menuElement.querySelector(`.${ns.b("node")}.in-active-path`);
  24309. scrollIntoView(container, activeNode);
  24310. }
  24311. });
  24312. };
  24313. const handleKeyDown = (e) => {
  24314. const target = e.target;
  24315. const code = getEventCode(e);
  24316. switch (code) {
  24317. case EVENT_CODE.up:
  24318. case EVENT_CODE.down: {
  24319. e.preventDefault();
  24320. const distance = code === EVENT_CODE.up ? -1 : 1;
  24321. focusNode(getSibling(target, distance, `.${ns.b("node")}[tabindex="-1"]`));
  24322. break;
  24323. }
  24324. case EVENT_CODE.left: {
  24325. e.preventDefault();
  24326. const preMenu = menuList.value[getMenuIndex(target) - 1];
  24327. const expandedNode = preMenu == null ? void 0 : preMenu.$el.querySelector(`.${ns.b("node")}[aria-expanded="true"]`);
  24328. focusNode(expandedNode);
  24329. break;
  24330. }
  24331. case EVENT_CODE.right: {
  24332. e.preventDefault();
  24333. const nextMenu = menuList.value[getMenuIndex(target) + 1];
  24334. const firstNode = nextMenu == null ? void 0 : nextMenu.$el.querySelector(`.${ns.b("node")}[tabindex="-1"]`);
  24335. focusNode(firstNode);
  24336. break;
  24337. }
  24338. case EVENT_CODE.enter:
  24339. case EVENT_CODE.numpadEnter:
  24340. checkNode(target);
  24341. break;
  24342. }
  24343. };
  24344. vue.provide(CASCADER_PANEL_INJECTION_KEY, vue.reactive({
  24345. config,
  24346. expandingNode,
  24347. checkedNodes,
  24348. isHoverMenu,
  24349. initialLoaded,
  24350. renderLabelFn,
  24351. lazyLoad,
  24352. expandNode,
  24353. handleCheckChange
  24354. }));
  24355. vue.watch(config, (newVal, oldVal) => {
  24356. if (isEqual$1(newVal, oldVal))
  24357. return;
  24358. initStore();
  24359. }, {
  24360. immediate: true
  24361. });
  24362. vue.watch(() => props.options, initStore, {
  24363. deep: true
  24364. });
  24365. vue.watch(() => props.modelValue, () => {
  24366. manualChecked = false;
  24367. syncCheckedValue();
  24368. }, {
  24369. deep: true
  24370. });
  24371. vue.watch(() => checkedValue.value, (val) => {
  24372. if (!isEqual$1(val, props.modelValue)) {
  24373. emit(UPDATE_MODEL_EVENT, val);
  24374. emit(CHANGE_EVENT, val);
  24375. }
  24376. });
  24377. const loadLazyRootNodes = () => {
  24378. if (initialLoadedOnce.value)
  24379. return;
  24380. initStore();
  24381. };
  24382. vue.onBeforeUpdate(() => menuList.value = []);
  24383. vue.onMounted(() => !isEmpty(props.modelValue) && syncCheckedValue());
  24384. expose({
  24385. menuList,
  24386. menus,
  24387. checkedNodes,
  24388. handleKeyDown,
  24389. handleCheckChange,
  24390. getFlattedNodes,
  24391. getCheckedNodes,
  24392. clearCheckedNodes,
  24393. calculateCheckedValue,
  24394. scrollToExpandingNode,
  24395. loadLazyRootNodes
  24396. });
  24397. return (_ctx, _cache) => {
  24398. return vue.openBlock(), vue.createElementBlock("div", {
  24399. class: vue.normalizeClass([vue.unref(ns).b("panel"), vue.unref(ns).is("bordered", _ctx.border)]),
  24400. onKeydown: handleKeyDown
  24401. }, [
  24402. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(menus.value, (menu, index) => {
  24403. return vue.openBlock(), vue.createBlock(ElCascaderMenu, {
  24404. key: index,
  24405. ref_for: true,
  24406. ref: (item) => menuList.value[index] = item,
  24407. index,
  24408. nodes: [...menu]
  24409. }, {
  24410. empty: vue.withCtx(() => [
  24411. vue.renderSlot(_ctx.$slots, "empty")
  24412. ]),
  24413. _: 2
  24414. }, 1032, ["index", "nodes"]);
  24415. }), 128))
  24416. ], 34);
  24417. };
  24418. }
  24419. });
  24420. var CascaderPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1P, [["__file", "index.vue"]]);
  24421. const ElCascaderPanel = withInstall(CascaderPanel);
  24422. const tagProps = buildProps({
  24423. type: {
  24424. type: String,
  24425. values: ["primary", "success", "info", "warning", "danger"],
  24426. default: "primary"
  24427. },
  24428. closable: Boolean,
  24429. disableTransitions: Boolean,
  24430. hit: Boolean,
  24431. color: String,
  24432. size: {
  24433. type: String,
  24434. values: componentSizes
  24435. },
  24436. effect: {
  24437. type: String,
  24438. values: ["dark", "light", "plain"],
  24439. default: "light"
  24440. },
  24441. round: Boolean
  24442. });
  24443. const tagEmits = {
  24444. close: (evt) => evt instanceof MouseEvent,
  24445. click: (evt) => evt instanceof MouseEvent
  24446. };
  24447. const __default__$1m = vue.defineComponent({
  24448. name: "ElTag"
  24449. });
  24450. const _sfc_main$1O = /* @__PURE__ */ vue.defineComponent({
  24451. ...__default__$1m,
  24452. props: tagProps,
  24453. emits: tagEmits,
  24454. setup(__props, { emit }) {
  24455. const props = __props;
  24456. const tagSize = useFormSize();
  24457. const ns = useNamespace("tag");
  24458. const containerKls = vue.computed(() => {
  24459. const { type, hit, effect, closable, round } = props;
  24460. return [
  24461. ns.b(),
  24462. ns.is("closable", closable),
  24463. ns.m(type || "primary"),
  24464. ns.m(tagSize.value),
  24465. ns.m(effect),
  24466. ns.is("hit", hit),
  24467. ns.is("round", round)
  24468. ];
  24469. });
  24470. const handleClose = (event) => {
  24471. emit("close", event);
  24472. };
  24473. const handleClick = (event) => {
  24474. emit("click", event);
  24475. };
  24476. const handleVNodeMounted = (vnode) => {
  24477. var _a, _b, _c;
  24478. 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) {
  24479. vnode.component.subTree.component.bum = null;
  24480. }
  24481. };
  24482. return (_ctx, _cache) => {
  24483. return _ctx.disableTransitions ? (vue.openBlock(), vue.createElementBlock("span", {
  24484. key: 0,
  24485. class: vue.normalizeClass(vue.unref(containerKls)),
  24486. style: vue.normalizeStyle({ backgroundColor: _ctx.color }),
  24487. onClick: handleClick
  24488. }, [
  24489. vue.createElementVNode("span", {
  24490. class: vue.normalizeClass(vue.unref(ns).e("content"))
  24491. }, [
  24492. vue.renderSlot(_ctx.$slots, "default")
  24493. ], 2),
  24494. _ctx.closable ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  24495. key: 0,
  24496. class: vue.normalizeClass(vue.unref(ns).e("close")),
  24497. onClick: vue.withModifiers(handleClose, ["stop"])
  24498. }, {
  24499. default: vue.withCtx(() => [
  24500. vue.createVNode(vue.unref(close_default))
  24501. ]),
  24502. _: 1
  24503. }, 8, ["class", "onClick"])) : vue.createCommentVNode("v-if", true)
  24504. ], 6)) : (vue.openBlock(), vue.createBlock(vue.Transition, {
  24505. key: 1,
  24506. name: `${vue.unref(ns).namespace.value}-zoom-in-center`,
  24507. appear: "",
  24508. onVnodeMounted: handleVNodeMounted
  24509. }, {
  24510. default: vue.withCtx(() => [
  24511. vue.createElementVNode("span", {
  24512. class: vue.normalizeClass(vue.unref(containerKls)),
  24513. style: vue.normalizeStyle({ backgroundColor: _ctx.color }),
  24514. onClick: handleClick
  24515. }, [
  24516. vue.createElementVNode("span", {
  24517. class: vue.normalizeClass(vue.unref(ns).e("content"))
  24518. }, [
  24519. vue.renderSlot(_ctx.$slots, "default")
  24520. ], 2),
  24521. _ctx.closable ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  24522. key: 0,
  24523. class: vue.normalizeClass(vue.unref(ns).e("close")),
  24524. onClick: vue.withModifiers(handleClose, ["stop"])
  24525. }, {
  24526. default: vue.withCtx(() => [
  24527. vue.createVNode(vue.unref(close_default))
  24528. ]),
  24529. _: 1
  24530. }, 8, ["class", "onClick"])) : vue.createCommentVNode("v-if", true)
  24531. ], 6)
  24532. ]),
  24533. _: 3
  24534. }, 8, ["name"]));
  24535. };
  24536. }
  24537. });
  24538. var Tag = /* @__PURE__ */ _export_sfc(_sfc_main$1O, [["__file", "tag.vue"]]);
  24539. const ElTag = withInstall(Tag);
  24540. const cascaderProps = buildProps({
  24541. ...CommonProps,
  24542. size: useSizeProp,
  24543. placeholder: String,
  24544. disabled: Boolean,
  24545. clearable: Boolean,
  24546. clearIcon: {
  24547. type: iconPropType,
  24548. default: circle_close_default
  24549. },
  24550. filterable: Boolean,
  24551. filterMethod: {
  24552. type: definePropType(Function),
  24553. default: (node, keyword) => node.text.includes(keyword)
  24554. },
  24555. separator: {
  24556. type: String,
  24557. default: " / "
  24558. },
  24559. showAllLevels: {
  24560. type: Boolean,
  24561. default: true
  24562. },
  24563. collapseTags: Boolean,
  24564. maxCollapseTags: {
  24565. type: Number,
  24566. default: 1
  24567. },
  24568. collapseTagsTooltip: Boolean,
  24569. maxCollapseTagsTooltipHeight: {
  24570. type: [String, Number]
  24571. },
  24572. debounce: {
  24573. type: Number,
  24574. default: 300
  24575. },
  24576. beforeFilter: {
  24577. type: definePropType(Function),
  24578. default: () => true
  24579. },
  24580. placement: {
  24581. type: definePropType(String),
  24582. values: Ee,
  24583. default: "bottom-start"
  24584. },
  24585. fallbackPlacements: {
  24586. type: definePropType(Array),
  24587. default: ["bottom-start", "bottom", "top-start", "top", "right", "left"]
  24588. },
  24589. popperClass: useTooltipContentProps.popperClass,
  24590. popperStyle: useTooltipContentProps.popperStyle,
  24591. teleported: useTooltipContentProps.teleported,
  24592. effect: {
  24593. type: definePropType(String),
  24594. default: "light"
  24595. },
  24596. tagType: { ...tagProps.type, default: "info" },
  24597. tagEffect: { ...tagProps.effect, default: "light" },
  24598. validateEvent: {
  24599. type: Boolean,
  24600. default: true
  24601. },
  24602. persistent: {
  24603. type: Boolean,
  24604. default: true
  24605. },
  24606. showCheckedStrategy: {
  24607. type: String,
  24608. values: ["parent", "child"],
  24609. default: "child"
  24610. },
  24611. checkOnClickNode: Boolean,
  24612. showPrefix: {
  24613. type: Boolean,
  24614. default: true
  24615. },
  24616. ...useEmptyValuesProps
  24617. });
  24618. const emitChangeFn$1 = (value) => true;
  24619. const cascaderEmits = {
  24620. [UPDATE_MODEL_EVENT]: emitChangeFn$1,
  24621. [CHANGE_EVENT]: emitChangeFn$1,
  24622. focus: (evt) => evt instanceof FocusEvent,
  24623. blur: (evt) => evt instanceof FocusEvent,
  24624. clear: () => true,
  24625. visibleChange: (val) => isBoolean(val),
  24626. expandChange: (val) => !!val,
  24627. removeTag: (val) => !!val
  24628. };
  24629. const __default__$1l = vue.defineComponent({
  24630. name: "ElCascader"
  24631. });
  24632. const _sfc_main$1N = /* @__PURE__ */ vue.defineComponent({
  24633. ...__default__$1l,
  24634. props: cascaderProps,
  24635. emits: cascaderEmits,
  24636. setup(__props, { expose, emit }) {
  24637. const props = __props;
  24638. const popperOptions = {
  24639. modifiers: [
  24640. {
  24641. name: "arrowPosition",
  24642. enabled: true,
  24643. phase: "main",
  24644. fn: ({ state }) => {
  24645. const { modifiersData, placement } = state;
  24646. if (["right", "left", "bottom", "top"].includes(placement))
  24647. return;
  24648. if (modifiersData.arrow) {
  24649. modifiersData.arrow.x = 35;
  24650. }
  24651. },
  24652. requires: ["arrow"]
  24653. }
  24654. ]
  24655. };
  24656. const attrs = vue.useAttrs();
  24657. let inputInitialHeight = 0;
  24658. let pressDeleteCount = 0;
  24659. const nsCascader = useNamespace("cascader");
  24660. const nsInput = useNamespace("input");
  24661. const { t } = useLocale();
  24662. const { formItem } = useFormItem();
  24663. const isDisabled = useFormDisabled();
  24664. const { valueOnClear } = useEmptyValues(props);
  24665. const { isComposing, handleComposition } = useComposition({
  24666. afterComposition(event) {
  24667. var _a;
  24668. const text = (_a = event.target) == null ? void 0 : _a.value;
  24669. handleInput(text);
  24670. }
  24671. });
  24672. const tooltipRef = vue.ref();
  24673. const tagTooltipRef = vue.ref();
  24674. const inputRef = vue.ref();
  24675. const tagWrapper = vue.ref();
  24676. const cascaderPanelRef = vue.ref();
  24677. const suggestionPanel = vue.ref();
  24678. const popperVisible = vue.ref(false);
  24679. const inputHover = vue.ref(false);
  24680. const filtering = vue.ref(false);
  24681. const inputValue = vue.ref("");
  24682. const searchInputValue = vue.ref("");
  24683. const tags = vue.ref([]);
  24684. const suggestions = vue.ref([]);
  24685. const showTagList = vue.computed(() => {
  24686. if (!props.props.multiple) {
  24687. return [];
  24688. }
  24689. return props.collapseTags ? tags.value.slice(0, props.maxCollapseTags) : tags.value;
  24690. });
  24691. const collapseTagList = vue.computed(() => {
  24692. if (!props.props.multiple) {
  24693. return [];
  24694. }
  24695. return props.collapseTags ? tags.value.slice(props.maxCollapseTags) : [];
  24696. });
  24697. const cascaderStyle = vue.computed(() => {
  24698. return attrs.style;
  24699. });
  24700. const inputPlaceholder = vue.computed(() => {
  24701. var _a;
  24702. return (_a = props.placeholder) != null ? _a : t("el.cascader.placeholder");
  24703. });
  24704. const currentPlaceholder = vue.computed(() => searchInputValue.value || tags.value.length > 0 || isComposing.value ? "" : inputPlaceholder.value);
  24705. const realSize = useFormSize();
  24706. const tagSize = vue.computed(() => realSize.value === "small" ? "small" : "default");
  24707. const multiple = vue.computed(() => !!props.props.multiple);
  24708. const readonly = vue.computed(() => !props.filterable || multiple.value);
  24709. const searchKeyword = vue.computed(() => multiple.value ? searchInputValue.value : inputValue.value);
  24710. const checkedNodes = vue.computed(() => {
  24711. var _a;
  24712. return ((_a = cascaderPanelRef.value) == null ? void 0 : _a.checkedNodes) || [];
  24713. });
  24714. const { wrapperRef, isFocused, handleBlur } = useFocusController(inputRef, {
  24715. disabled: isDisabled,
  24716. beforeBlur(event) {
  24717. var _a, _b;
  24718. return ((_a = tooltipRef.value) == null ? void 0 : _a.isFocusInsideContent(event)) || ((_b = tagTooltipRef.value) == null ? void 0 : _b.isFocusInsideContent(event));
  24719. },
  24720. afterBlur() {
  24721. var _a;
  24722. if (props.validateEvent) {
  24723. (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "blur").catch((err) => debugWarn(err));
  24724. }
  24725. }
  24726. });
  24727. const clearBtnVisible = vue.computed(() => {
  24728. if (!props.clearable || isDisabled.value || filtering.value || !inputHover.value && !isFocused.value)
  24729. return false;
  24730. return !!checkedNodes.value.length;
  24731. });
  24732. const presentText = vue.computed(() => {
  24733. const { showAllLevels, separator } = props;
  24734. const nodes = checkedNodes.value;
  24735. return nodes.length ? multiple.value ? "" : nodes[0].calcText(showAllLevels, separator) : "";
  24736. });
  24737. const validateState = vue.computed(() => (formItem == null ? void 0 : formItem.validateState) || "");
  24738. const checkedValue = vue.computed({
  24739. get() {
  24740. return cloneDeep(props.modelValue);
  24741. },
  24742. set(val) {
  24743. const value = val != null ? val : valueOnClear.value;
  24744. emit(UPDATE_MODEL_EVENT, value);
  24745. emit(CHANGE_EVENT, value);
  24746. if (props.validateEvent) {
  24747. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn(err));
  24748. }
  24749. }
  24750. });
  24751. const cascaderKls = vue.computed(() => {
  24752. return [
  24753. nsCascader.b(),
  24754. nsCascader.m(realSize.value),
  24755. nsCascader.is("disabled", isDisabled.value),
  24756. attrs.class
  24757. ];
  24758. });
  24759. const cascaderIconKls = vue.computed(() => {
  24760. return [
  24761. nsInput.e("icon"),
  24762. "icon-arrow-down",
  24763. nsCascader.is("reverse", popperVisible.value)
  24764. ];
  24765. });
  24766. const inputClass = vue.computed(() => nsCascader.is("focus", isFocused.value));
  24767. const contentRef = vue.computed(() => {
  24768. var _a, _b;
  24769. return (_b = (_a = tooltipRef.value) == null ? void 0 : _a.popperRef) == null ? void 0 : _b.contentRef;
  24770. });
  24771. const handleClickOutside = (event) => {
  24772. if (isFocused.value) {
  24773. const _event = new FocusEvent("blur", event);
  24774. handleBlur(_event);
  24775. }
  24776. togglePopperVisible(false);
  24777. };
  24778. const togglePopperVisible = (visible) => {
  24779. var _a, _b, _c;
  24780. if (isDisabled.value)
  24781. return;
  24782. visible = visible != null ? visible : !popperVisible.value;
  24783. if (visible !== popperVisible.value) {
  24784. popperVisible.value = visible;
  24785. (_b = (_a = inputRef.value) == null ? void 0 : _a.input) == null ? void 0 : _b.setAttribute("aria-expanded", `${visible}`);
  24786. if (visible) {
  24787. updatePopperPosition();
  24788. vue.nextTick((_c = cascaderPanelRef.value) == null ? void 0 : _c.scrollToExpandingNode);
  24789. } else if (props.filterable) {
  24790. syncPresentTextValue();
  24791. }
  24792. emit("visibleChange", visible);
  24793. }
  24794. };
  24795. const updatePopperPosition = () => {
  24796. vue.nextTick(() => {
  24797. var _a;
  24798. (_a = tooltipRef.value) == null ? void 0 : _a.updatePopper();
  24799. });
  24800. };
  24801. const hideSuggestionPanel = () => {
  24802. filtering.value = false;
  24803. };
  24804. const genTag = (node) => {
  24805. const { showAllLevels, separator } = props;
  24806. return {
  24807. node,
  24808. key: node.uid,
  24809. text: node.calcText(showAllLevels, separator),
  24810. hitState: false,
  24811. closable: !isDisabled.value && !node.isDisabled
  24812. };
  24813. };
  24814. const deleteTag = (tag) => {
  24815. var _a;
  24816. const node = tag.node;
  24817. node.doCheck(false);
  24818. (_a = cascaderPanelRef.value) == null ? void 0 : _a.calculateCheckedValue();
  24819. emit("removeTag", node.valueByOption);
  24820. };
  24821. const getStrategyCheckedNodes = () => {
  24822. switch (props.showCheckedStrategy) {
  24823. case "child":
  24824. return checkedNodes.value;
  24825. case "parent": {
  24826. const clickedNodes = getCheckedNodes(false);
  24827. const clickedNodesValue = clickedNodes.map((o) => o.value);
  24828. const parentNodes = clickedNodes.filter((o) => !o.parent || !clickedNodesValue.includes(o.parent.value));
  24829. return parentNodes;
  24830. }
  24831. default:
  24832. return [];
  24833. }
  24834. };
  24835. const calculatePresentTags = () => {
  24836. if (!multiple.value)
  24837. return;
  24838. const nodes = getStrategyCheckedNodes();
  24839. const allTags = [];
  24840. nodes.forEach((node) => allTags.push(genTag(node)));
  24841. tags.value = allTags;
  24842. };
  24843. const calculateSuggestions = () => {
  24844. var _a, _b;
  24845. const { filterMethod, showAllLevels, separator } = props;
  24846. const res = (_b = (_a = cascaderPanelRef.value) == null ? void 0 : _a.getFlattedNodes(!props.props.checkStrictly)) == null ? void 0 : _b.filter((node) => {
  24847. if (node.isDisabled)
  24848. return false;
  24849. node.calcText(showAllLevels, separator);
  24850. return filterMethod(node, searchKeyword.value);
  24851. });
  24852. if (multiple.value) {
  24853. tags.value.forEach((tag) => {
  24854. tag.hitState = false;
  24855. });
  24856. }
  24857. filtering.value = true;
  24858. suggestions.value = res;
  24859. updatePopperPosition();
  24860. };
  24861. const focusFirstNode = () => {
  24862. var _a;
  24863. let firstNode;
  24864. if (filtering.value && suggestionPanel.value) {
  24865. firstNode = suggestionPanel.value.$el.querySelector(`.${nsCascader.e("suggestion-item")}`);
  24866. } else {
  24867. firstNode = (_a = cascaderPanelRef.value) == null ? void 0 : _a.$el.querySelector(`.${nsCascader.b("node")}[tabindex="-1"]`);
  24868. }
  24869. if (firstNode) {
  24870. firstNode.focus();
  24871. !filtering.value && firstNode.click();
  24872. }
  24873. };
  24874. const updateStyle = () => {
  24875. var _a, _b;
  24876. const inputInner = (_a = inputRef.value) == null ? void 0 : _a.input;
  24877. const tagWrapperEl = tagWrapper.value;
  24878. const suggestionPanelEl = (_b = suggestionPanel.value) == null ? void 0 : _b.$el;
  24879. if (!isClient || !inputInner)
  24880. return;
  24881. if (suggestionPanelEl) {
  24882. const suggestionList = suggestionPanelEl.querySelector(`.${nsCascader.e("suggestion-list")}`);
  24883. suggestionList.style.minWidth = `${inputInner.offsetWidth}px`;
  24884. }
  24885. if (tagWrapperEl) {
  24886. const { offsetHeight } = tagWrapperEl;
  24887. const height = tags.value.length > 0 ? `${Math.max(offsetHeight, inputInitialHeight) - 2}px` : `${inputInitialHeight}px`;
  24888. inputInner.style.height = height;
  24889. updatePopperPosition();
  24890. }
  24891. };
  24892. const getCheckedNodes = (leafOnly) => {
  24893. var _a;
  24894. return (_a = cascaderPanelRef.value) == null ? void 0 : _a.getCheckedNodes(leafOnly);
  24895. };
  24896. const handleExpandChange = (value) => {
  24897. updatePopperPosition();
  24898. emit("expandChange", value);
  24899. };
  24900. const handleKeyDown = (e) => {
  24901. if (isComposing.value)
  24902. return;
  24903. const code = getEventCode(e);
  24904. switch (code) {
  24905. case EVENT_CODE.enter:
  24906. case EVENT_CODE.numpadEnter:
  24907. togglePopperVisible();
  24908. break;
  24909. case EVENT_CODE.down:
  24910. togglePopperVisible(true);
  24911. vue.nextTick(focusFirstNode);
  24912. e.preventDefault();
  24913. break;
  24914. case EVENT_CODE.esc:
  24915. if (popperVisible.value === true) {
  24916. e.preventDefault();
  24917. e.stopPropagation();
  24918. togglePopperVisible(false);
  24919. }
  24920. break;
  24921. case EVENT_CODE.tab:
  24922. togglePopperVisible(false);
  24923. break;
  24924. }
  24925. };
  24926. const handleClear = () => {
  24927. var _a;
  24928. (_a = cascaderPanelRef.value) == null ? void 0 : _a.clearCheckedNodes();
  24929. if (!popperVisible.value && props.filterable) {
  24930. syncPresentTextValue();
  24931. }
  24932. togglePopperVisible(false);
  24933. emit("clear");
  24934. };
  24935. const syncPresentTextValue = () => {
  24936. const { value } = presentText;
  24937. inputValue.value = value;
  24938. searchInputValue.value = value;
  24939. };
  24940. const handleSuggestionClick = (node) => {
  24941. var _a, _b;
  24942. const { checked } = node;
  24943. if (multiple.value) {
  24944. (_a = cascaderPanelRef.value) == null ? void 0 : _a.handleCheckChange(node, !checked, false);
  24945. } else {
  24946. !checked && ((_b = cascaderPanelRef.value) == null ? void 0 : _b.handleCheckChange(node, true, false));
  24947. togglePopperVisible(false);
  24948. }
  24949. };
  24950. const handleSuggestionKeyDown = (e) => {
  24951. const target = e.target;
  24952. const code = getEventCode(e);
  24953. switch (code) {
  24954. case EVENT_CODE.up:
  24955. case EVENT_CODE.down: {
  24956. e.preventDefault();
  24957. const distance = code === EVENT_CODE.up ? -1 : 1;
  24958. focusNode(getSibling(target, distance, `.${nsCascader.e("suggestion-item")}[tabindex="-1"]`));
  24959. break;
  24960. }
  24961. case EVENT_CODE.enter:
  24962. case EVENT_CODE.numpadEnter:
  24963. target.click();
  24964. break;
  24965. }
  24966. };
  24967. const handleDelete = () => {
  24968. const lastTag = tags.value[tags.value.length - 1];
  24969. pressDeleteCount = searchInputValue.value ? 0 : pressDeleteCount + 1;
  24970. if (!lastTag || !pressDeleteCount || props.collapseTags && tags.value.length > 1)
  24971. return;
  24972. if (lastTag.hitState) {
  24973. deleteTag(lastTag);
  24974. } else {
  24975. lastTag.hitState = true;
  24976. }
  24977. };
  24978. const debounce = vue.computed(() => props.debounce);
  24979. const handleFilter = useDebounceFn(() => {
  24980. const { value } = searchKeyword;
  24981. if (!value)
  24982. return;
  24983. const passed = props.beforeFilter(value);
  24984. if (isPromise(passed)) {
  24985. passed.then(calculateSuggestions).catch(() => {
  24986. });
  24987. } else if (passed !== false) {
  24988. calculateSuggestions();
  24989. } else {
  24990. hideSuggestionPanel();
  24991. }
  24992. }, debounce);
  24993. const handleInput = (val, e) => {
  24994. !popperVisible.value && togglePopperVisible(true);
  24995. if (e == null ? void 0 : e.isComposing)
  24996. return;
  24997. val ? handleFilter() : hideSuggestionPanel();
  24998. };
  24999. const getInputInnerHeight = (inputInner) => Number.parseFloat(useCssVar(nsInput.cssVarName("input-height"), inputInner).value) - 2;
  25000. vue.watch(filtering, updatePopperPosition);
  25001. vue.watch([
  25002. checkedNodes,
  25003. isDisabled,
  25004. () => props.collapseTags,
  25005. () => props.maxCollapseTags
  25006. ], calculatePresentTags);
  25007. vue.watch(tags, () => {
  25008. vue.nextTick(() => updateStyle());
  25009. });
  25010. vue.watch(realSize, async () => {
  25011. await vue.nextTick();
  25012. const inputInner = inputRef.value.input;
  25013. inputInitialHeight = getInputInnerHeight(inputInner) || inputInitialHeight;
  25014. updateStyle();
  25015. });
  25016. vue.watch(presentText, syncPresentTextValue, { immediate: true });
  25017. vue.watch(() => popperVisible.value, (val) => {
  25018. var _a;
  25019. if (val && props.props.lazy && props.props.lazyLoad) {
  25020. (_a = cascaderPanelRef.value) == null ? void 0 : _a.loadLazyRootNodes();
  25021. }
  25022. });
  25023. vue.onMounted(() => {
  25024. const inputInner = inputRef.value.input;
  25025. const inputInnerHeight = getInputInnerHeight(inputInner);
  25026. inputInitialHeight = inputInner.offsetHeight || inputInnerHeight;
  25027. useResizeObserver(inputInner, updateStyle);
  25028. });
  25029. expose({
  25030. getCheckedNodes,
  25031. cascaderPanelRef,
  25032. togglePopperVisible,
  25033. contentRef,
  25034. presentText
  25035. });
  25036. return (_ctx, _cache) => {
  25037. return vue.openBlock(), vue.createBlock(vue.unref(ElTooltip), {
  25038. ref_key: "tooltipRef",
  25039. ref: tooltipRef,
  25040. visible: popperVisible.value,
  25041. teleported: _ctx.teleported,
  25042. "popper-class": [vue.unref(nsCascader).e("dropdown"), _ctx.popperClass],
  25043. "popper-style": _ctx.popperStyle,
  25044. "popper-options": popperOptions,
  25045. "fallback-placements": _ctx.fallbackPlacements,
  25046. "stop-popper-mouse-event": false,
  25047. "gpu-acceleration": false,
  25048. placement: _ctx.placement,
  25049. transition: `${vue.unref(nsCascader).namespace.value}-zoom-in-top`,
  25050. effect: _ctx.effect,
  25051. pure: "",
  25052. persistent: _ctx.persistent,
  25053. onHide: hideSuggestionPanel
  25054. }, {
  25055. default: vue.withCtx(() => [
  25056. vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  25057. ref_key: "wrapperRef",
  25058. ref: wrapperRef,
  25059. class: vue.normalizeClass(vue.unref(cascaderKls)),
  25060. style: vue.normalizeStyle(vue.unref(cascaderStyle)),
  25061. onClick: () => togglePopperVisible(vue.unref(readonly) ? void 0 : true),
  25062. onKeydown: handleKeyDown,
  25063. onMouseenter: ($event) => inputHover.value = true,
  25064. onMouseleave: ($event) => inputHover.value = false
  25065. }, [
  25066. vue.createVNode(vue.unref(ElInput), {
  25067. ref_key: "inputRef",
  25068. ref: inputRef,
  25069. modelValue: inputValue.value,
  25070. "onUpdate:modelValue": ($event) => inputValue.value = $event,
  25071. placeholder: vue.unref(currentPlaceholder),
  25072. readonly: vue.unref(readonly),
  25073. disabled: vue.unref(isDisabled),
  25074. "validate-event": false,
  25075. size: vue.unref(realSize),
  25076. class: vue.normalizeClass(vue.unref(inputClass)),
  25077. tabindex: vue.unref(multiple) && _ctx.filterable && !vue.unref(isDisabled) ? -1 : void 0,
  25078. onCompositionstart: vue.unref(handleComposition),
  25079. onCompositionupdate: vue.unref(handleComposition),
  25080. onCompositionend: vue.unref(handleComposition),
  25081. onInput: handleInput
  25082. }, vue.createSlots({
  25083. suffix: vue.withCtx(() => [
  25084. vue.unref(clearBtnVisible) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  25085. key: "clear",
  25086. class: vue.normalizeClass([vue.unref(nsInput).e("icon"), "icon-circle-close"]),
  25087. onClick: vue.withModifiers(handleClear, ["stop"])
  25088. }, {
  25089. default: vue.withCtx(() => [
  25090. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.clearIcon)))
  25091. ]),
  25092. _: 1
  25093. }, 8, ["class", "onClick"])) : (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  25094. key: "arrow-down",
  25095. class: vue.normalizeClass(vue.unref(cascaderIconKls)),
  25096. onClick: vue.withModifiers(($event) => togglePopperVisible(), ["stop"])
  25097. }, {
  25098. default: vue.withCtx(() => [
  25099. vue.createVNode(vue.unref(arrow_down_default))
  25100. ]),
  25101. _: 1
  25102. }, 8, ["class", "onClick"]))
  25103. ]),
  25104. _: 2
  25105. }, [
  25106. _ctx.$slots.prefix ? {
  25107. name: "prefix",
  25108. fn: vue.withCtx(() => [
  25109. vue.renderSlot(_ctx.$slots, "prefix")
  25110. ])
  25111. } : void 0
  25112. ]), 1032, ["modelValue", "onUpdate:modelValue", "placeholder", "readonly", "disabled", "size", "class", "tabindex", "onCompositionstart", "onCompositionupdate", "onCompositionend"]),
  25113. vue.unref(multiple) ? (vue.openBlock(), vue.createElementBlock("div", {
  25114. key: 0,
  25115. ref_key: "tagWrapper",
  25116. ref: tagWrapper,
  25117. class: vue.normalizeClass([
  25118. vue.unref(nsCascader).e("tags"),
  25119. vue.unref(nsCascader).is("validate", Boolean(vue.unref(validateState)))
  25120. ])
  25121. }, [
  25122. vue.renderSlot(_ctx.$slots, "tag", {
  25123. data: tags.value,
  25124. deleteTag
  25125. }, () => [
  25126. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(showTagList), (tag) => {
  25127. return vue.openBlock(), vue.createBlock(vue.unref(ElTag), {
  25128. key: tag.key,
  25129. type: _ctx.tagType,
  25130. size: vue.unref(tagSize),
  25131. effect: _ctx.tagEffect,
  25132. hit: tag.hitState,
  25133. closable: tag.closable,
  25134. "disable-transitions": "",
  25135. onClose: ($event) => deleteTag(tag)
  25136. }, {
  25137. default: vue.withCtx(() => [
  25138. vue.createElementVNode("span", null, vue.toDisplayString(tag.text), 1)
  25139. ]),
  25140. _: 2
  25141. }, 1032, ["type", "size", "effect", "hit", "closable", "onClose"]);
  25142. }), 128))
  25143. ]),
  25144. _ctx.collapseTags && tags.value.length > _ctx.maxCollapseTags ? (vue.openBlock(), vue.createBlock(vue.unref(ElTooltip), {
  25145. key: 0,
  25146. ref_key: "tagTooltipRef",
  25147. ref: tagTooltipRef,
  25148. disabled: popperVisible.value || !_ctx.collapseTagsTooltip,
  25149. "fallback-placements": ["bottom", "top", "right", "left"],
  25150. placement: "bottom",
  25151. "popper-class": _ctx.popperClass,
  25152. "popper-style": _ctx.popperStyle,
  25153. effect: _ctx.effect,
  25154. persistent: _ctx.persistent
  25155. }, {
  25156. default: vue.withCtx(() => [
  25157. vue.createVNode(vue.unref(ElTag), {
  25158. closable: false,
  25159. size: vue.unref(tagSize),
  25160. type: _ctx.tagType,
  25161. effect: _ctx.tagEffect,
  25162. "disable-transitions": ""
  25163. }, {
  25164. default: vue.withCtx(() => [
  25165. vue.createElementVNode("span", {
  25166. class: vue.normalizeClass(vue.unref(nsCascader).e("tags-text"))
  25167. }, " + " + vue.toDisplayString(tags.value.length - _ctx.maxCollapseTags), 3)
  25168. ]),
  25169. _: 1
  25170. }, 8, ["size", "type", "effect"])
  25171. ]),
  25172. content: vue.withCtx(() => [
  25173. vue.createVNode(vue.unref(ElScrollbar), { "max-height": _ctx.maxCollapseTagsTooltipHeight }, {
  25174. default: vue.withCtx(() => [
  25175. vue.createElementVNode("div", {
  25176. class: vue.normalizeClass(vue.unref(nsCascader).e("collapse-tags"))
  25177. }, [
  25178. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(collapseTagList), (tag, idx) => {
  25179. return vue.openBlock(), vue.createElementBlock("div", {
  25180. key: idx,
  25181. class: vue.normalizeClass(vue.unref(nsCascader).e("collapse-tag"))
  25182. }, [
  25183. (vue.openBlock(), vue.createBlock(vue.unref(ElTag), {
  25184. key: tag.key,
  25185. class: "in-tooltip",
  25186. type: _ctx.tagType,
  25187. size: vue.unref(tagSize),
  25188. effect: _ctx.tagEffect,
  25189. hit: tag.hitState,
  25190. closable: tag.closable,
  25191. "disable-transitions": "",
  25192. onClose: ($event) => deleteTag(tag)
  25193. }, {
  25194. default: vue.withCtx(() => [
  25195. vue.createElementVNode("span", null, vue.toDisplayString(tag.text), 1)
  25196. ]),
  25197. _: 2
  25198. }, 1032, ["type", "size", "effect", "hit", "closable", "onClose"]))
  25199. ], 2);
  25200. }), 128))
  25201. ], 2)
  25202. ]),
  25203. _: 1
  25204. }, 8, ["max-height"])
  25205. ]),
  25206. _: 1
  25207. }, 8, ["disabled", "popper-class", "popper-style", "effect", "persistent"])) : vue.createCommentVNode("v-if", true),
  25208. _ctx.filterable && !vue.unref(isDisabled) ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("input", {
  25209. key: 1,
  25210. "onUpdate:modelValue": ($event) => searchInputValue.value = $event,
  25211. type: "text",
  25212. class: vue.normalizeClass(vue.unref(nsCascader).e("search-input")),
  25213. placeholder: vue.unref(presentText) ? "" : vue.unref(inputPlaceholder),
  25214. onInput: (e) => handleInput(searchInputValue.value, e),
  25215. onClick: vue.withModifiers(($event) => togglePopperVisible(true), ["stop"]),
  25216. onKeydown: vue.withKeys(handleDelete, ["delete"]),
  25217. onCompositionstart: vue.unref(handleComposition),
  25218. onCompositionupdate: vue.unref(handleComposition),
  25219. onCompositionend: vue.unref(handleComposition)
  25220. }, null, 42, ["onUpdate:modelValue", "placeholder", "onInput", "onClick", "onKeydown", "onCompositionstart", "onCompositionupdate", "onCompositionend"])), [
  25221. [vue.vModelText, searchInputValue.value]
  25222. ]) : vue.createCommentVNode("v-if", true)
  25223. ], 2)) : vue.createCommentVNode("v-if", true)
  25224. ], 46, ["onClick", "onMouseenter", "onMouseleave"])), [
  25225. [vue.unref(ClickOutside), handleClickOutside, vue.unref(contentRef)]
  25226. ])
  25227. ]),
  25228. content: vue.withCtx(() => [
  25229. _ctx.$slots.header ? (vue.openBlock(), vue.createElementBlock("div", {
  25230. key: 0,
  25231. class: vue.normalizeClass(vue.unref(nsCascader).e("header")),
  25232. onClick: vue.withModifiers(() => {
  25233. }, ["stop"])
  25234. }, [
  25235. vue.renderSlot(_ctx.$slots, "header")
  25236. ], 10, ["onClick"])) : vue.createCommentVNode("v-if", true),
  25237. vue.withDirectives(vue.createVNode(vue.unref(ElCascaderPanel), {
  25238. ref_key: "cascaderPanelRef",
  25239. ref: cascaderPanelRef,
  25240. modelValue: vue.unref(checkedValue),
  25241. "onUpdate:modelValue": ($event) => vue.isRef(checkedValue) ? checkedValue.value = $event : null,
  25242. options: _ctx.options,
  25243. props: props.props,
  25244. border: false,
  25245. "render-label": _ctx.$slots.default,
  25246. onExpandChange: handleExpandChange,
  25247. onClose: ($event) => _ctx.$nextTick(() => togglePopperVisible(false))
  25248. }, {
  25249. empty: vue.withCtx(() => [
  25250. vue.renderSlot(_ctx.$slots, "empty")
  25251. ]),
  25252. _: 3
  25253. }, 8, ["modelValue", "onUpdate:modelValue", "options", "props", "render-label", "onClose"]), [
  25254. [vue.vShow, !filtering.value]
  25255. ]),
  25256. _ctx.filterable ? vue.withDirectives((vue.openBlock(), vue.createBlock(vue.unref(ElScrollbar), {
  25257. key: 1,
  25258. ref_key: "suggestionPanel",
  25259. ref: suggestionPanel,
  25260. tag: "ul",
  25261. class: vue.normalizeClass(vue.unref(nsCascader).e("suggestion-panel")),
  25262. "view-class": vue.unref(nsCascader).e("suggestion-list"),
  25263. onKeydown: handleSuggestionKeyDown
  25264. }, {
  25265. default: vue.withCtx(() => [
  25266. suggestions.value.length ? (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 0 }, vue.renderList(suggestions.value, (item) => {
  25267. return vue.openBlock(), vue.createElementBlock("li", {
  25268. key: item.uid,
  25269. class: vue.normalizeClass([
  25270. vue.unref(nsCascader).e("suggestion-item"),
  25271. vue.unref(nsCascader).is("checked", item.checked)
  25272. ]),
  25273. tabindex: -1,
  25274. onClick: ($event) => handleSuggestionClick(item)
  25275. }, [
  25276. vue.renderSlot(_ctx.$slots, "suggestion-item", { item }, () => [
  25277. vue.createElementVNode("span", null, vue.toDisplayString(item.text), 1),
  25278. item.checked ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 0 }, {
  25279. default: vue.withCtx(() => [
  25280. vue.createVNode(vue.unref(check_default))
  25281. ]),
  25282. _: 1
  25283. })) : vue.createCommentVNode("v-if", true)
  25284. ])
  25285. ], 10, ["onClick"]);
  25286. }), 128)) : vue.renderSlot(_ctx.$slots, "empty", { key: 1 }, () => [
  25287. vue.createElementVNode("li", {
  25288. class: vue.normalizeClass(vue.unref(nsCascader).e("empty-text"))
  25289. }, vue.toDisplayString(vue.unref(t)("el.cascader.noMatch")), 3)
  25290. ])
  25291. ]),
  25292. _: 3
  25293. }, 8, ["class", "view-class"])), [
  25294. [vue.vShow, filtering.value]
  25295. ]) : vue.createCommentVNode("v-if", true),
  25296. _ctx.$slots.footer ? (vue.openBlock(), vue.createElementBlock("div", {
  25297. key: 2,
  25298. class: vue.normalizeClass(vue.unref(nsCascader).e("footer")),
  25299. onClick: vue.withModifiers(() => {
  25300. }, ["stop"])
  25301. }, [
  25302. vue.renderSlot(_ctx.$slots, "footer")
  25303. ], 10, ["onClick"])) : vue.createCommentVNode("v-if", true)
  25304. ]),
  25305. _: 3
  25306. }, 8, ["visible", "teleported", "popper-class", "popper-style", "fallback-placements", "placement", "transition", "effect", "persistent"]);
  25307. };
  25308. }
  25309. });
  25310. var Cascader = /* @__PURE__ */ _export_sfc(_sfc_main$1N, [["__file", "cascader.vue"]]);
  25311. const ElCascader = withInstall(Cascader);
  25312. const checkTagProps = buildProps({
  25313. checked: Boolean,
  25314. disabled: Boolean,
  25315. type: {
  25316. type: String,
  25317. values: ["primary", "success", "info", "warning", "danger"],
  25318. default: "primary"
  25319. }
  25320. });
  25321. const checkTagEmits = {
  25322. "update:checked": (value) => isBoolean(value),
  25323. [CHANGE_EVENT]: (value) => isBoolean(value)
  25324. };
  25325. const __default__$1k = vue.defineComponent({
  25326. name: "ElCheckTag"
  25327. });
  25328. const _sfc_main$1M = /* @__PURE__ */ vue.defineComponent({
  25329. ...__default__$1k,
  25330. props: checkTagProps,
  25331. emits: checkTagEmits,
  25332. setup(__props, { emit }) {
  25333. const props = __props;
  25334. const ns = useNamespace("check-tag");
  25335. const containerKls = vue.computed(() => [
  25336. ns.b(),
  25337. ns.is("checked", props.checked),
  25338. ns.is("disabled", props.disabled),
  25339. ns.m(props.type || "primary")
  25340. ]);
  25341. const handleChange = () => {
  25342. if (props.disabled)
  25343. return;
  25344. const checked = !props.checked;
  25345. emit(CHANGE_EVENT, checked);
  25346. emit("update:checked", checked);
  25347. };
  25348. return (_ctx, _cache) => {
  25349. return vue.openBlock(), vue.createElementBlock("span", {
  25350. class: vue.normalizeClass(vue.unref(containerKls)),
  25351. onClick: handleChange
  25352. }, [
  25353. vue.renderSlot(_ctx.$slots, "default")
  25354. ], 2);
  25355. };
  25356. }
  25357. });
  25358. var CheckTag = /* @__PURE__ */ _export_sfc(_sfc_main$1M, [["__file", "check-tag.vue"]]);
  25359. const ElCheckTag = withInstall(CheckTag);
  25360. const rowContextKey = Symbol("rowContextKey");
  25361. const RowJustify = [
  25362. "start",
  25363. "center",
  25364. "end",
  25365. "space-around",
  25366. "space-between",
  25367. "space-evenly"
  25368. ];
  25369. const RowAlign = ["top", "middle", "bottom"];
  25370. const rowProps = buildProps({
  25371. tag: {
  25372. type: String,
  25373. default: "div"
  25374. },
  25375. gutter: {
  25376. type: Number,
  25377. default: 0
  25378. },
  25379. justify: {
  25380. type: String,
  25381. values: RowJustify,
  25382. default: "start"
  25383. },
  25384. align: {
  25385. type: String,
  25386. values: RowAlign
  25387. }
  25388. });
  25389. const __default__$1j = vue.defineComponent({
  25390. name: "ElRow"
  25391. });
  25392. const _sfc_main$1L = /* @__PURE__ */ vue.defineComponent({
  25393. ...__default__$1j,
  25394. props: rowProps,
  25395. setup(__props) {
  25396. const props = __props;
  25397. const ns = useNamespace("row");
  25398. const gutter = vue.computed(() => props.gutter);
  25399. vue.provide(rowContextKey, {
  25400. gutter
  25401. });
  25402. const style = vue.computed(() => {
  25403. const styles = {};
  25404. if (!props.gutter) {
  25405. return styles;
  25406. }
  25407. styles.marginRight = styles.marginLeft = `-${props.gutter / 2}px`;
  25408. return styles;
  25409. });
  25410. const rowKls = vue.computed(() => [
  25411. ns.b(),
  25412. ns.is(`justify-${props.justify}`, props.justify !== "start"),
  25413. ns.is(`align-${props.align}`, !!props.align)
  25414. ]);
  25415. return (_ctx, _cache) => {
  25416. return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.tag), {
  25417. class: vue.normalizeClass(vue.unref(rowKls)),
  25418. style: vue.normalizeStyle(vue.unref(style))
  25419. }, {
  25420. default: vue.withCtx(() => [
  25421. vue.renderSlot(_ctx.$slots, "default")
  25422. ]),
  25423. _: 3
  25424. }, 8, ["class", "style"]);
  25425. };
  25426. }
  25427. });
  25428. var Row$1 = /* @__PURE__ */ _export_sfc(_sfc_main$1L, [["__file", "row.vue"]]);
  25429. const ElRow = withInstall(Row$1);
  25430. const colProps = buildProps({
  25431. tag: {
  25432. type: String,
  25433. default: "div"
  25434. },
  25435. span: {
  25436. type: Number,
  25437. default: 24
  25438. },
  25439. offset: {
  25440. type: Number,
  25441. default: 0
  25442. },
  25443. pull: {
  25444. type: Number,
  25445. default: 0
  25446. },
  25447. push: {
  25448. type: Number,
  25449. default: 0
  25450. },
  25451. xs: {
  25452. type: definePropType([Number, Object]),
  25453. default: () => mutable({})
  25454. },
  25455. sm: {
  25456. type: definePropType([Number, Object]),
  25457. default: () => mutable({})
  25458. },
  25459. md: {
  25460. type: definePropType([Number, Object]),
  25461. default: () => mutable({})
  25462. },
  25463. lg: {
  25464. type: definePropType([Number, Object]),
  25465. default: () => mutable({})
  25466. },
  25467. xl: {
  25468. type: definePropType([Number, Object]),
  25469. default: () => mutable({})
  25470. }
  25471. });
  25472. const __default__$1i = vue.defineComponent({
  25473. name: "ElCol"
  25474. });
  25475. const _sfc_main$1K = /* @__PURE__ */ vue.defineComponent({
  25476. ...__default__$1i,
  25477. props: colProps,
  25478. setup(__props) {
  25479. const props = __props;
  25480. const { gutter } = vue.inject(rowContextKey, { gutter: vue.computed(() => 0) });
  25481. const ns = useNamespace("col");
  25482. const style = vue.computed(() => {
  25483. const styles = {};
  25484. if (gutter.value) {
  25485. styles.paddingLeft = styles.paddingRight = `${gutter.value / 2}px`;
  25486. }
  25487. return styles;
  25488. });
  25489. const colKls = vue.computed(() => {
  25490. const classes = [];
  25491. const pos = ["span", "offset", "pull", "push"];
  25492. pos.forEach((prop) => {
  25493. const size = props[prop];
  25494. if (isNumber(size)) {
  25495. if (prop === "span")
  25496. classes.push(ns.b(`${props[prop]}`));
  25497. else if (size > 0)
  25498. classes.push(ns.b(`${prop}-${props[prop]}`));
  25499. }
  25500. });
  25501. const sizes = ["xs", "sm", "md", "lg", "xl"];
  25502. sizes.forEach((size) => {
  25503. if (isNumber(props[size])) {
  25504. classes.push(ns.b(`${size}-${props[size]}`));
  25505. } else if (isObject$1(props[size])) {
  25506. Object.entries(props[size]).forEach(([prop, sizeProp]) => {
  25507. classes.push(prop !== "span" ? ns.b(`${size}-${prop}-${sizeProp}`) : ns.b(`${size}-${sizeProp}`));
  25508. });
  25509. }
  25510. });
  25511. if (gutter.value) {
  25512. classes.push(ns.is("guttered"));
  25513. }
  25514. return [ns.b(), classes];
  25515. });
  25516. return (_ctx, _cache) => {
  25517. return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.tag), {
  25518. class: vue.normalizeClass(vue.unref(colKls)),
  25519. style: vue.normalizeStyle(vue.unref(style))
  25520. }, {
  25521. default: vue.withCtx(() => [
  25522. vue.renderSlot(_ctx.$slots, "default")
  25523. ]),
  25524. _: 3
  25525. }, 8, ["class", "style"]);
  25526. };
  25527. }
  25528. });
  25529. var Col = /* @__PURE__ */ _export_sfc(_sfc_main$1K, [["__file", "col.vue"]]);
  25530. const ElCol = withInstall(Col);
  25531. const emitChangeFn = (value) => isNumber(value) || isString$1(value) || isArray$1(value);
  25532. const collapseProps = buildProps({
  25533. accordion: Boolean,
  25534. modelValue: {
  25535. type: definePropType([Array, String, Number]),
  25536. default: () => mutable([])
  25537. },
  25538. expandIconPosition: {
  25539. type: definePropType([String]),
  25540. default: "right"
  25541. },
  25542. beforeCollapse: {
  25543. type: definePropType(Function)
  25544. }
  25545. });
  25546. const collapseEmits = {
  25547. [UPDATE_MODEL_EVENT]: emitChangeFn,
  25548. [CHANGE_EVENT]: emitChangeFn
  25549. };
  25550. const collapseContextKey = Symbol("collapseContextKey");
  25551. const SCOPE$3 = "ElCollapse";
  25552. const useCollapse = (props, emit) => {
  25553. const activeNames = vue.ref(castArray$1(props.modelValue));
  25554. const setActiveNames = (_activeNames) => {
  25555. activeNames.value = _activeNames;
  25556. const value = props.accordion ? activeNames.value[0] : activeNames.value;
  25557. emit(UPDATE_MODEL_EVENT, value);
  25558. emit(CHANGE_EVENT, value);
  25559. };
  25560. const handleChange = (name) => {
  25561. if (props.accordion) {
  25562. setActiveNames([activeNames.value[0] === name ? "" : name]);
  25563. } else {
  25564. const _activeNames = [...activeNames.value];
  25565. const index = _activeNames.indexOf(name);
  25566. if (index > -1) {
  25567. _activeNames.splice(index, 1);
  25568. } else {
  25569. _activeNames.push(name);
  25570. }
  25571. setActiveNames(_activeNames);
  25572. }
  25573. };
  25574. const handleItemClick = async (name) => {
  25575. const { beforeCollapse } = props;
  25576. if (!beforeCollapse) {
  25577. handleChange(name);
  25578. return;
  25579. }
  25580. const shouldChange = beforeCollapse(name);
  25581. const isPromiseOrBool = [
  25582. isPromise(shouldChange),
  25583. isBoolean(shouldChange)
  25584. ].includes(true);
  25585. if (!isPromiseOrBool) {
  25586. throwError(SCOPE$3, "beforeCollapse must return type `Promise<boolean>` or `boolean`");
  25587. }
  25588. if (isPromise(shouldChange)) {
  25589. shouldChange.then((result) => {
  25590. if (result !== false) {
  25591. handleChange(name);
  25592. }
  25593. }).catch((e) => {
  25594. debugWarn(SCOPE$3, `some error occurred: ${e}`);
  25595. });
  25596. } else if (shouldChange) {
  25597. handleChange(name);
  25598. }
  25599. };
  25600. vue.watch(() => props.modelValue, () => activeNames.value = castArray$1(props.modelValue), { deep: true });
  25601. vue.provide(collapseContextKey, {
  25602. activeNames,
  25603. handleItemClick
  25604. });
  25605. return {
  25606. activeNames,
  25607. setActiveNames
  25608. };
  25609. };
  25610. const useCollapseDOM = (props) => {
  25611. const ns = useNamespace("collapse");
  25612. const rootKls = vue.computed(() => [
  25613. ns.b(),
  25614. ns.b(`icon-position-${props.expandIconPosition}`)
  25615. ]);
  25616. return {
  25617. rootKls
  25618. };
  25619. };
  25620. const __default__$1h = vue.defineComponent({
  25621. name: "ElCollapse"
  25622. });
  25623. const _sfc_main$1J = /* @__PURE__ */ vue.defineComponent({
  25624. ...__default__$1h,
  25625. props: collapseProps,
  25626. emits: collapseEmits,
  25627. setup(__props, { expose, emit }) {
  25628. const props = __props;
  25629. const { activeNames, setActiveNames } = useCollapse(props, emit);
  25630. const { rootKls } = useCollapseDOM(props);
  25631. expose({
  25632. activeNames,
  25633. setActiveNames
  25634. });
  25635. return (_ctx, _cache) => {
  25636. return vue.openBlock(), vue.createElementBlock("div", {
  25637. class: vue.normalizeClass(vue.unref(rootKls))
  25638. }, [
  25639. vue.renderSlot(_ctx.$slots, "default")
  25640. ], 2);
  25641. };
  25642. }
  25643. });
  25644. var Collapse = /* @__PURE__ */ _export_sfc(_sfc_main$1J, [["__file", "collapse.vue"]]);
  25645. const __default__$1g = vue.defineComponent({
  25646. name: "ElCollapseTransition"
  25647. });
  25648. const _sfc_main$1I = /* @__PURE__ */ vue.defineComponent({
  25649. ...__default__$1g,
  25650. setup(__props) {
  25651. const ns = useNamespace("collapse-transition");
  25652. const reset = (el) => {
  25653. el.style.maxHeight = "";
  25654. el.style.overflow = el.dataset.oldOverflow;
  25655. el.style.paddingTop = el.dataset.oldPaddingTop;
  25656. el.style.paddingBottom = el.dataset.oldPaddingBottom;
  25657. };
  25658. const on = {
  25659. beforeEnter(el) {
  25660. if (!el.dataset)
  25661. el.dataset = {};
  25662. el.dataset.oldPaddingTop = el.style.paddingTop;
  25663. el.dataset.oldPaddingBottom = el.style.paddingBottom;
  25664. if (el.style.height)
  25665. el.dataset.elExistsHeight = el.style.height;
  25666. el.style.maxHeight = 0;
  25667. el.style.paddingTop = 0;
  25668. el.style.paddingBottom = 0;
  25669. },
  25670. enter(el) {
  25671. requestAnimationFrame(() => {
  25672. el.dataset.oldOverflow = el.style.overflow;
  25673. if (el.dataset.elExistsHeight) {
  25674. el.style.maxHeight = el.dataset.elExistsHeight;
  25675. } else if (el.scrollHeight !== 0) {
  25676. el.style.maxHeight = `${el.scrollHeight}px`;
  25677. } else {
  25678. el.style.maxHeight = 0;
  25679. }
  25680. el.style.paddingTop = el.dataset.oldPaddingTop;
  25681. el.style.paddingBottom = el.dataset.oldPaddingBottom;
  25682. el.style.overflow = "hidden";
  25683. });
  25684. },
  25685. afterEnter(el) {
  25686. el.style.maxHeight = "";
  25687. el.style.overflow = el.dataset.oldOverflow;
  25688. },
  25689. enterCancelled(el) {
  25690. reset(el);
  25691. },
  25692. beforeLeave(el) {
  25693. if (!el.dataset)
  25694. el.dataset = {};
  25695. el.dataset.oldPaddingTop = el.style.paddingTop;
  25696. el.dataset.oldPaddingBottom = el.style.paddingBottom;
  25697. el.dataset.oldOverflow = el.style.overflow;
  25698. el.style.maxHeight = `${el.scrollHeight}px`;
  25699. el.style.overflow = "hidden";
  25700. },
  25701. leave(el) {
  25702. if (el.scrollHeight !== 0) {
  25703. el.style.maxHeight = 0;
  25704. el.style.paddingTop = 0;
  25705. el.style.paddingBottom = 0;
  25706. }
  25707. },
  25708. afterLeave(el) {
  25709. reset(el);
  25710. },
  25711. leaveCancelled(el) {
  25712. reset(el);
  25713. }
  25714. };
  25715. return (_ctx, _cache) => {
  25716. return vue.openBlock(), vue.createBlock(vue.Transition, vue.mergeProps({
  25717. name: vue.unref(ns).b()
  25718. }, vue.toHandlers(on)), {
  25719. default: vue.withCtx(() => [
  25720. vue.renderSlot(_ctx.$slots, "default")
  25721. ]),
  25722. _: 3
  25723. }, 16, ["name"]);
  25724. };
  25725. }
  25726. });
  25727. var CollapseTransition = /* @__PURE__ */ _export_sfc(_sfc_main$1I, [["__file", "collapse-transition.vue"]]);
  25728. const ElCollapseTransition = withInstall(CollapseTransition);
  25729. const collapseItemProps = buildProps({
  25730. title: {
  25731. type: String,
  25732. default: ""
  25733. },
  25734. name: {
  25735. type: definePropType([String, Number]),
  25736. default: void 0
  25737. },
  25738. icon: {
  25739. type: iconPropType,
  25740. default: arrow_right_default
  25741. },
  25742. disabled: Boolean
  25743. });
  25744. const useCollapseItem = (props) => {
  25745. const collapse = vue.inject(collapseContextKey);
  25746. const { namespace } = useNamespace("collapse");
  25747. const focusing = vue.ref(false);
  25748. const isClick = vue.ref(false);
  25749. const idInjection = useIdInjection();
  25750. const id = vue.computed(() => idInjection.current++);
  25751. const name = vue.computed(() => {
  25752. var _a;
  25753. return (_a = props.name) != null ? _a : `${namespace.value}-id-${idInjection.prefix}-${vue.unref(id)}`;
  25754. });
  25755. const isActive = vue.computed(() => collapse == null ? void 0 : collapse.activeNames.value.includes(vue.unref(name)));
  25756. const handleFocus = () => {
  25757. setTimeout(() => {
  25758. if (!isClick.value) {
  25759. focusing.value = true;
  25760. } else {
  25761. isClick.value = false;
  25762. }
  25763. }, 50);
  25764. };
  25765. const handleHeaderClick = (e) => {
  25766. if (props.disabled)
  25767. return;
  25768. const target = e.target;
  25769. if (target == null ? void 0 : target.closest("input, textarea, select"))
  25770. return;
  25771. collapse == null ? void 0 : collapse.handleItemClick(vue.unref(name));
  25772. focusing.value = false;
  25773. isClick.value = true;
  25774. };
  25775. const handleEnterClick = (e) => {
  25776. const target = e.target;
  25777. if (target == null ? void 0 : target.closest("input, textarea, select"))
  25778. return;
  25779. e.preventDefault();
  25780. collapse == null ? void 0 : collapse.handleItemClick(vue.unref(name));
  25781. };
  25782. return {
  25783. focusing,
  25784. id,
  25785. isActive,
  25786. handleFocus,
  25787. handleHeaderClick,
  25788. handleEnterClick
  25789. };
  25790. };
  25791. const useCollapseItemDOM = (props, { focusing, isActive, id }) => {
  25792. const ns = useNamespace("collapse");
  25793. const rootKls = vue.computed(() => [
  25794. ns.b("item"),
  25795. ns.is("active", vue.unref(isActive)),
  25796. ns.is("disabled", props.disabled)
  25797. ]);
  25798. const headKls = vue.computed(() => [
  25799. ns.be("item", "header"),
  25800. ns.is("active", vue.unref(isActive)),
  25801. { focusing: vue.unref(focusing) && !props.disabled }
  25802. ]);
  25803. const arrowKls = vue.computed(() => [
  25804. ns.be("item", "arrow"),
  25805. ns.is("active", vue.unref(isActive))
  25806. ]);
  25807. const itemTitleKls = vue.computed(() => [ns.be("item", "title")]);
  25808. const itemWrapperKls = vue.computed(() => ns.be("item", "wrap"));
  25809. const itemContentKls = vue.computed(() => ns.be("item", "content"));
  25810. const scopedContentId = vue.computed(() => ns.b(`content-${vue.unref(id)}`));
  25811. const scopedHeadId = vue.computed(() => ns.b(`head-${vue.unref(id)}`));
  25812. return {
  25813. itemTitleKls,
  25814. arrowKls,
  25815. headKls,
  25816. rootKls,
  25817. itemWrapperKls,
  25818. itemContentKls,
  25819. scopedContentId,
  25820. scopedHeadId
  25821. };
  25822. };
  25823. const __default__$1f = vue.defineComponent({
  25824. name: "ElCollapseItem"
  25825. });
  25826. const _sfc_main$1H = /* @__PURE__ */ vue.defineComponent({
  25827. ...__default__$1f,
  25828. props: collapseItemProps,
  25829. setup(__props, { expose }) {
  25830. const props = __props;
  25831. const {
  25832. focusing,
  25833. id,
  25834. isActive,
  25835. handleFocus,
  25836. handleHeaderClick,
  25837. handleEnterClick
  25838. } = useCollapseItem(props);
  25839. const {
  25840. arrowKls,
  25841. headKls,
  25842. rootKls,
  25843. itemTitleKls,
  25844. itemWrapperKls,
  25845. itemContentKls,
  25846. scopedContentId,
  25847. scopedHeadId
  25848. } = useCollapseItemDOM(props, { focusing, isActive, id });
  25849. expose({
  25850. isActive
  25851. });
  25852. return (_ctx, _cache) => {
  25853. return vue.openBlock(), vue.createElementBlock("div", {
  25854. class: vue.normalizeClass(vue.unref(rootKls))
  25855. }, [
  25856. vue.createElementVNode("div", {
  25857. id: vue.unref(scopedHeadId),
  25858. class: vue.normalizeClass(vue.unref(headKls)),
  25859. "aria-expanded": vue.unref(isActive),
  25860. "aria-controls": vue.unref(scopedContentId),
  25861. "aria-describedby": vue.unref(scopedContentId),
  25862. tabindex: _ctx.disabled ? void 0 : 0,
  25863. "aria-disabled": _ctx.disabled,
  25864. role: "button",
  25865. onClick: vue.unref(handleHeaderClick),
  25866. onKeydown: vue.withKeys(vue.withModifiers(vue.unref(handleEnterClick), ["stop"]), ["space", "enter"]),
  25867. onFocus: vue.unref(handleFocus),
  25868. onBlur: ($event) => focusing.value = false
  25869. }, [
  25870. vue.createElementVNode("span", {
  25871. class: vue.normalizeClass(vue.unref(itemTitleKls))
  25872. }, [
  25873. vue.renderSlot(_ctx.$slots, "title", { isActive: vue.unref(isActive) }, () => [
  25874. vue.createTextVNode(vue.toDisplayString(_ctx.title), 1)
  25875. ])
  25876. ], 2),
  25877. vue.renderSlot(_ctx.$slots, "icon", { isActive: vue.unref(isActive) }, () => [
  25878. vue.createVNode(vue.unref(ElIcon), {
  25879. class: vue.normalizeClass(vue.unref(arrowKls))
  25880. }, {
  25881. default: vue.withCtx(() => [
  25882. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.icon)))
  25883. ]),
  25884. _: 1
  25885. }, 8, ["class"])
  25886. ])
  25887. ], 42, ["id", "aria-expanded", "aria-controls", "aria-describedby", "tabindex", "aria-disabled", "onClick", "onKeydown", "onFocus", "onBlur"]),
  25888. vue.createVNode(vue.unref(ElCollapseTransition), null, {
  25889. default: vue.withCtx(() => [
  25890. vue.withDirectives(vue.createElementVNode("div", {
  25891. id: vue.unref(scopedContentId),
  25892. role: "region",
  25893. class: vue.normalizeClass(vue.unref(itemWrapperKls)),
  25894. "aria-hidden": !vue.unref(isActive),
  25895. "aria-labelledby": vue.unref(scopedHeadId)
  25896. }, [
  25897. vue.createElementVNode("div", {
  25898. class: vue.normalizeClass(vue.unref(itemContentKls))
  25899. }, [
  25900. vue.renderSlot(_ctx.$slots, "default")
  25901. ], 2)
  25902. ], 10, ["id", "aria-hidden", "aria-labelledby"]), [
  25903. [vue.vShow, vue.unref(isActive)]
  25904. ])
  25905. ]),
  25906. _: 3
  25907. })
  25908. ], 2);
  25909. };
  25910. }
  25911. });
  25912. var CollapseItem = /* @__PURE__ */ _export_sfc(_sfc_main$1H, [["__file", "collapse-item.vue"]]);
  25913. const ElCollapse = withInstall(Collapse, {
  25914. CollapseItem
  25915. });
  25916. const ElCollapseItem = withNoopInstall(CollapseItem);
  25917. const alphaSliderProps = buildProps({
  25918. color: {
  25919. type: definePropType(Object),
  25920. required: true
  25921. },
  25922. vertical: Boolean,
  25923. disabled: Boolean
  25924. });
  25925. const hueSliderProps = alphaSliderProps;
  25926. let isDragging = false;
  25927. function draggable(element, options) {
  25928. if (!isClient)
  25929. return;
  25930. const moveFn = function(event) {
  25931. var _a;
  25932. (_a = options.drag) == null ? void 0 : _a.call(options, event);
  25933. };
  25934. const upFn = function(event) {
  25935. var _a;
  25936. document.removeEventListener("mousemove", moveFn);
  25937. document.removeEventListener("mouseup", upFn);
  25938. document.removeEventListener("touchmove", moveFn);
  25939. document.removeEventListener("touchend", upFn);
  25940. document.onselectstart = null;
  25941. document.ondragstart = null;
  25942. isDragging = false;
  25943. (_a = options.end) == null ? void 0 : _a.call(options, event);
  25944. };
  25945. const downFn = function(event) {
  25946. var _a;
  25947. if (isDragging)
  25948. return;
  25949. document.onselectstart = () => false;
  25950. document.ondragstart = () => false;
  25951. document.addEventListener("mousemove", moveFn);
  25952. document.addEventListener("mouseup", upFn);
  25953. document.addEventListener("touchmove", moveFn);
  25954. document.addEventListener("touchend", upFn);
  25955. isDragging = true;
  25956. (_a = options.start) == null ? void 0 : _a.call(options, event);
  25957. };
  25958. element.addEventListener("mousedown", downFn);
  25959. element.addEventListener("touchstart", downFn, { passive: false });
  25960. }
  25961. const useSlider = (props, { key, minValue, maxValue }) => {
  25962. const instance = vue.getCurrentInstance();
  25963. const thumb = vue.shallowRef();
  25964. const bar = vue.shallowRef();
  25965. const currentValue = vue.computed(() => props.color.get(key));
  25966. function handleClick(event) {
  25967. var _a;
  25968. if (props.disabled)
  25969. return;
  25970. const target = event.target;
  25971. if (target !== thumb.value) {
  25972. handleDrag(event);
  25973. }
  25974. (_a = thumb.value) == null ? void 0 : _a.focus();
  25975. }
  25976. function handleDrag(event) {
  25977. if (!bar.value || !thumb.value || props.disabled)
  25978. return;
  25979. const el = instance.vnode.el;
  25980. const rect = el.getBoundingClientRect();
  25981. const { clientX, clientY } = getClientXY(event);
  25982. let value;
  25983. if (!props.vertical) {
  25984. let left = clientX - rect.left;
  25985. left = Math.max(thumb.value.offsetWidth / 2, left);
  25986. left = Math.min(left, rect.width - thumb.value.offsetWidth / 2);
  25987. value = Math.round((left - thumb.value.offsetWidth / 2) / (rect.width - thumb.value.offsetWidth) * maxValue);
  25988. } else {
  25989. let top = clientY - rect.top;
  25990. top = Math.max(thumb.value.offsetHeight / 2, top);
  25991. top = Math.min(top, rect.height - thumb.value.offsetHeight / 2);
  25992. value = Math.round((top - thumb.value.offsetHeight / 2) / (rect.height - thumb.value.offsetHeight) * maxValue);
  25993. }
  25994. props.color.set(key, value);
  25995. }
  25996. function handleKeydown(event) {
  25997. if (props.disabled)
  25998. return;
  25999. const { shiftKey } = event;
  26000. const code = getEventCode(event);
  26001. const step = shiftKey ? 10 : 1;
  26002. const reverse = key === "hue" ? -1 : 1;
  26003. let isPreventDefault = true;
  26004. switch (code) {
  26005. case EVENT_CODE.left:
  26006. case EVENT_CODE.down:
  26007. incrementPosition(-step * reverse);
  26008. break;
  26009. case EVENT_CODE.right:
  26010. case EVENT_CODE.up:
  26011. incrementPosition(step * reverse);
  26012. break;
  26013. case EVENT_CODE.home:
  26014. props.color.set(key, key === "hue" ? maxValue : minValue);
  26015. break;
  26016. case EVENT_CODE.end:
  26017. props.color.set(key, key === "hue" ? minValue : maxValue);
  26018. break;
  26019. case EVENT_CODE.pageDown:
  26020. incrementPosition(-4 * reverse);
  26021. break;
  26022. case EVENT_CODE.pageUp:
  26023. incrementPosition(4 * reverse);
  26024. break;
  26025. default:
  26026. isPreventDefault = false;
  26027. break;
  26028. }
  26029. isPreventDefault && event.preventDefault();
  26030. }
  26031. function incrementPosition(step) {
  26032. let next = currentValue.value + step;
  26033. next = next < minValue ? minValue : next > maxValue ? maxValue : next;
  26034. props.color.set(key, next);
  26035. }
  26036. return {
  26037. thumb,
  26038. bar,
  26039. currentValue,
  26040. handleDrag,
  26041. handleClick,
  26042. handleKeydown
  26043. };
  26044. };
  26045. const useSliderDOM = (props, {
  26046. namespace,
  26047. maxValue,
  26048. bar,
  26049. thumb,
  26050. currentValue,
  26051. handleDrag,
  26052. getBackground
  26053. }) => {
  26054. const instance = vue.getCurrentInstance();
  26055. const ns = useNamespace(namespace);
  26056. const thumbLeft = vue.ref(0);
  26057. const thumbTop = vue.ref(0);
  26058. const background = vue.ref();
  26059. function getThumbLeft() {
  26060. if (!thumb.value)
  26061. return 0;
  26062. if (props.vertical)
  26063. return 0;
  26064. const el = instance.vnode.el;
  26065. const value = currentValue.value;
  26066. if (!el)
  26067. return 0;
  26068. return Math.round(value * (el.offsetWidth - thumb.value.offsetWidth / 2) / maxValue);
  26069. }
  26070. function getThumbTop() {
  26071. if (!thumb.value)
  26072. return 0;
  26073. const el = instance.vnode.el;
  26074. if (!props.vertical)
  26075. return 0;
  26076. const value = currentValue.value;
  26077. if (!el)
  26078. return 0;
  26079. return Math.round(value * (el.offsetHeight - thumb.value.offsetHeight / 2) / maxValue);
  26080. }
  26081. function update() {
  26082. thumbLeft.value = getThumbLeft();
  26083. thumbTop.value = getThumbTop();
  26084. background.value = getBackground == null ? void 0 : getBackground();
  26085. }
  26086. vue.onMounted(() => {
  26087. if (!bar.value || !thumb.value)
  26088. return;
  26089. const dragConfig = {
  26090. drag: (event) => {
  26091. handleDrag(event);
  26092. },
  26093. end: (event) => {
  26094. handleDrag(event);
  26095. }
  26096. };
  26097. draggable(bar.value, dragConfig);
  26098. draggable(thumb.value, dragConfig);
  26099. update();
  26100. });
  26101. vue.watch(currentValue, () => update());
  26102. vue.watch(() => props.color.value, () => update());
  26103. const rootKls = vue.computed(() => [
  26104. ns.b(),
  26105. ns.is("vertical", props.vertical),
  26106. ns.is("disabled", props.disabled)
  26107. ]);
  26108. const barKls = vue.computed(() => ns.e("bar"));
  26109. const thumbKls = vue.computed(() => ns.e("thumb"));
  26110. const barStyle = vue.computed(() => ({ background: background.value }));
  26111. const thumbStyle = vue.computed(() => ({
  26112. left: addUnit(thumbLeft.value),
  26113. top: addUnit(thumbTop.value)
  26114. }));
  26115. return {
  26116. rootKls,
  26117. barKls,
  26118. barStyle,
  26119. thumbKls,
  26120. thumbStyle,
  26121. thumbLeft,
  26122. thumbTop,
  26123. update
  26124. };
  26125. };
  26126. const minValue$1 = 0;
  26127. const maxValue$1 = 100;
  26128. const __default__$1e = vue.defineComponent({
  26129. name: "ElColorAlphaSlider"
  26130. });
  26131. const _sfc_main$1G = /* @__PURE__ */ vue.defineComponent({
  26132. ...__default__$1e,
  26133. props: alphaSliderProps,
  26134. setup(__props, { expose }) {
  26135. const props = __props;
  26136. const { currentValue, bar, thumb, handleDrag, handleClick, handleKeydown } = useSlider(props, { key: "alpha", minValue: minValue$1, maxValue: maxValue$1 });
  26137. const { rootKls, barKls, barStyle, thumbKls, thumbStyle, update } = useSliderDOM(props, {
  26138. namespace: "color-alpha-slider",
  26139. maxValue: maxValue$1,
  26140. currentValue,
  26141. bar,
  26142. thumb,
  26143. handleDrag,
  26144. getBackground
  26145. });
  26146. const { t } = useLocale();
  26147. const ariaLabel = vue.computed(() => t("el.colorpicker.alphaLabel"));
  26148. const ariaValuetext = vue.computed(() => {
  26149. return t("el.colorpicker.alphaDescription", {
  26150. alpha: currentValue.value,
  26151. color: props.color.value
  26152. });
  26153. });
  26154. function getBackground() {
  26155. if (props.color && props.color.value) {
  26156. const { r, g, b } = props.color.toRgb();
  26157. return `linear-gradient(to right, rgba(${r}, ${g}, ${b}, 0) 0%, rgba(${r}, ${g}, ${b}, 1) 100%)`;
  26158. }
  26159. return "";
  26160. }
  26161. expose({
  26162. update,
  26163. bar,
  26164. thumb
  26165. });
  26166. return (_ctx, _cache) => {
  26167. return vue.openBlock(), vue.createElementBlock("div", {
  26168. class: vue.normalizeClass(vue.unref(rootKls))
  26169. }, [
  26170. vue.createElementVNode("div", {
  26171. ref_key: "bar",
  26172. ref: bar,
  26173. class: vue.normalizeClass(vue.unref(barKls)),
  26174. style: vue.normalizeStyle(vue.unref(barStyle)),
  26175. onClick: vue.unref(handleClick)
  26176. }, null, 14, ["onClick"]),
  26177. vue.createElementVNode("div", {
  26178. ref_key: "thumb",
  26179. ref: thumb,
  26180. class: vue.normalizeClass(vue.unref(thumbKls)),
  26181. style: vue.normalizeStyle(vue.unref(thumbStyle)),
  26182. "aria-label": vue.unref(ariaLabel),
  26183. "aria-valuenow": vue.unref(currentValue),
  26184. "aria-valuetext": vue.unref(ariaValuetext),
  26185. "aria-orientation": _ctx.vertical ? "vertical" : "horizontal",
  26186. "aria-valuemin": minValue$1,
  26187. "aria-valuemax": maxValue$1,
  26188. role: "slider",
  26189. tabindex: "0",
  26190. onKeydown: vue.unref(handleKeydown)
  26191. }, null, 46, ["aria-label", "aria-valuenow", "aria-valuetext", "aria-orientation", "onKeydown"])
  26192. ], 2);
  26193. };
  26194. }
  26195. });
  26196. var AlphaSlider = /* @__PURE__ */ _export_sfc(_sfc_main$1G, [["__file", "alpha-slider.vue"]]);
  26197. const minValue = 0;
  26198. const maxValue = 360;
  26199. const __default__$1d = vue.defineComponent({
  26200. name: "ElColorHueSlider"
  26201. });
  26202. const _sfc_main$1F = /* @__PURE__ */ vue.defineComponent({
  26203. ...__default__$1d,
  26204. props: hueSliderProps,
  26205. setup(__props, { expose }) {
  26206. const props = __props;
  26207. const { currentValue, bar, thumb, handleDrag, handleClick, handleKeydown } = useSlider(props, { key: "hue", minValue, maxValue });
  26208. const { rootKls, barKls, thumbKls, thumbStyle, thumbTop, update } = useSliderDOM(props, {
  26209. namespace: "color-hue-slider",
  26210. maxValue,
  26211. currentValue,
  26212. bar,
  26213. thumb,
  26214. handleDrag
  26215. });
  26216. const { t } = useLocale();
  26217. const ariaLabel = vue.computed(() => t("el.colorpicker.hueLabel"));
  26218. const ariaValuetext = vue.computed(() => {
  26219. return t("el.colorpicker.hueDescription", {
  26220. hue: currentValue.value,
  26221. color: props.color.value
  26222. });
  26223. });
  26224. expose({
  26225. bar,
  26226. thumb,
  26227. thumbTop,
  26228. update
  26229. });
  26230. return (_ctx, _cache) => {
  26231. return vue.openBlock(), vue.createElementBlock("div", {
  26232. class: vue.normalizeClass(vue.unref(rootKls))
  26233. }, [
  26234. vue.createElementVNode("div", {
  26235. ref_key: "bar",
  26236. ref: bar,
  26237. class: vue.normalizeClass(vue.unref(barKls)),
  26238. onClick: vue.unref(handleClick)
  26239. }, null, 10, ["onClick"]),
  26240. vue.createElementVNode("div", {
  26241. ref_key: "thumb",
  26242. ref: thumb,
  26243. class: vue.normalizeClass(vue.unref(thumbKls)),
  26244. style: vue.normalizeStyle(vue.unref(thumbStyle)),
  26245. "aria-label": vue.unref(ariaLabel),
  26246. "aria-valuenow": vue.unref(currentValue),
  26247. "aria-valuetext": vue.unref(ariaValuetext),
  26248. "aria-orientation": _ctx.vertical ? "vertical" : "horizontal",
  26249. "aria-valuemin": minValue,
  26250. "aria-valuemax": maxValue,
  26251. role: "slider",
  26252. tabindex: "0",
  26253. onKeydown: vue.unref(handleKeydown)
  26254. }, null, 46, ["aria-label", "aria-valuenow", "aria-valuetext", "aria-orientation", "onKeydown"])
  26255. ], 2);
  26256. };
  26257. }
  26258. });
  26259. var HueSlider = /* @__PURE__ */ _export_sfc(_sfc_main$1F, [["__file", "hue-slider.vue"]]);
  26260. const predefineProps = buildProps({
  26261. colors: {
  26262. type: definePropType(Array),
  26263. required: true
  26264. },
  26265. color: {
  26266. type: definePropType(Object),
  26267. required: true
  26268. },
  26269. enableAlpha: {
  26270. type: Boolean,
  26271. required: true
  26272. },
  26273. disabled: Boolean
  26274. });
  26275. const colorPickerPanelProps = buildProps({
  26276. modelValue: {
  26277. type: definePropType(String),
  26278. default: void 0
  26279. },
  26280. border: {
  26281. type: Boolean,
  26282. default: true
  26283. },
  26284. showAlpha: Boolean,
  26285. colorFormat: String,
  26286. disabled: Boolean,
  26287. predefine: {
  26288. type: definePropType(Array)
  26289. },
  26290. validateEvent: {
  26291. type: Boolean,
  26292. default: true
  26293. }
  26294. });
  26295. const colorPickerPanelEmits = {
  26296. [UPDATE_MODEL_EVENT]: (val) => isString$1(val) || isNil(val)
  26297. };
  26298. const ROOT_COMMON_COLOR_INJECTION_KEY = Symbol("colorCommonPickerKey");
  26299. const colorPickerPanelContextKey = Symbol("colorPickerPanelContextKey");
  26300. class Color {
  26301. constructor(options = {}) {
  26302. this._hue = 0;
  26303. this._saturation = 100;
  26304. this._value = 100;
  26305. this._alpha = 100;
  26306. this._tiny = new TinyColor();
  26307. this._isValid = false;
  26308. this.enableAlpha = false;
  26309. this.format = "";
  26310. this.value = "";
  26311. for (const option in options) {
  26312. if (hasOwn(options, option)) {
  26313. this[option] = options[option];
  26314. }
  26315. }
  26316. if (options.value) {
  26317. this.fromString(options.value);
  26318. } else {
  26319. this.doOnChange();
  26320. }
  26321. }
  26322. set(prop, value) {
  26323. if (arguments.length === 1 && typeof prop === "object") {
  26324. for (const p in prop) {
  26325. if (hasOwn(prop, p)) {
  26326. this.set(p, prop[p]);
  26327. }
  26328. }
  26329. return;
  26330. }
  26331. this[`_${prop}`] = value;
  26332. this._isValid = true;
  26333. this.doOnChange();
  26334. }
  26335. get(prop) {
  26336. if (["hue", "saturation", "value", "alpha"].includes(prop)) {
  26337. return Math.round(this[`_${prop}`]);
  26338. }
  26339. return this[`_${prop}`];
  26340. }
  26341. toRgb() {
  26342. return this._isValid ? this._tiny.toRgb() : { r: 255, g: 255, b: 255, a: 0 };
  26343. }
  26344. fromString(value) {
  26345. const color = new TinyColor(value);
  26346. this._isValid = color.isValid;
  26347. if (color.isValid) {
  26348. const { h, s, v, a } = color.toHsv();
  26349. this._hue = h;
  26350. this._saturation = s * 100;
  26351. this._value = v * 100;
  26352. this._alpha = a * 100;
  26353. } else {
  26354. this._hue = 0;
  26355. this._saturation = 100;
  26356. this._value = 100;
  26357. this._alpha = 100;
  26358. }
  26359. this.doOnChange();
  26360. }
  26361. clear() {
  26362. this._isValid = false;
  26363. this.value = "";
  26364. this._hue = 0;
  26365. this._saturation = 100;
  26366. this._value = 100;
  26367. this._alpha = 100;
  26368. }
  26369. compare(color) {
  26370. const compareColor = new TinyColor({
  26371. h: color._hue,
  26372. s: color._saturation / 100,
  26373. v: color._value / 100,
  26374. a: color._alpha / 100
  26375. });
  26376. return this._tiny.equals(compareColor);
  26377. }
  26378. doOnChange() {
  26379. const { _hue, _saturation, _value, _alpha, format, enableAlpha } = this;
  26380. let _format = format || (enableAlpha ? "rgb" : "hex");
  26381. if (format === "hex" && enableAlpha) {
  26382. _format = "hex8";
  26383. }
  26384. this._tiny = new TinyColor({
  26385. h: _hue,
  26386. s: _saturation / 100,
  26387. v: _value / 100,
  26388. a: _alpha / 100
  26389. });
  26390. this.value = this._isValid ? this._tiny.toString(_format) : "";
  26391. }
  26392. }
  26393. const usePredefine = (props) => {
  26394. const { currentColor } = vue.inject(colorPickerPanelContextKey);
  26395. const rgbaColors = vue.ref(parseColors(props.colors, props.color));
  26396. vue.watch(() => currentColor.value, (val) => {
  26397. const color = new Color({
  26398. value: val,
  26399. enableAlpha: props.enableAlpha
  26400. });
  26401. rgbaColors.value.forEach((item) => {
  26402. item.selected = color.compare(item);
  26403. });
  26404. });
  26405. vue.watchEffect(() => {
  26406. rgbaColors.value = parseColors(props.colors, props.color);
  26407. });
  26408. function handleSelect(index) {
  26409. props.color.fromString(props.colors[index]);
  26410. }
  26411. function parseColors(colors, color) {
  26412. return colors.map((value) => {
  26413. const c = new Color({
  26414. value,
  26415. enableAlpha: props.enableAlpha
  26416. });
  26417. c.selected = c.compare(color);
  26418. return c;
  26419. });
  26420. }
  26421. return {
  26422. rgbaColors,
  26423. handleSelect
  26424. };
  26425. };
  26426. const usePredefineDOM = (props) => {
  26427. const ns = useNamespace("color-predefine");
  26428. const rootKls = vue.computed(() => [ns.b(), ns.is("disabled", props.disabled)]);
  26429. const colorsKls = vue.computed(() => ns.e("colors"));
  26430. function colorSelectorKls(item) {
  26431. return [
  26432. ns.e("color-selector"),
  26433. ns.is("alpha", item.get("alpha") < 100),
  26434. { selected: item.selected }
  26435. ];
  26436. }
  26437. return {
  26438. rootKls,
  26439. colorsKls,
  26440. colorSelectorKls
  26441. };
  26442. };
  26443. const __default__$1c = vue.defineComponent({
  26444. name: "ElColorPredefine"
  26445. });
  26446. const _sfc_main$1E = /* @__PURE__ */ vue.defineComponent({
  26447. ...__default__$1c,
  26448. props: predefineProps,
  26449. setup(__props) {
  26450. const props = __props;
  26451. const { rgbaColors, handleSelect } = usePredefine(props);
  26452. const { rootKls, colorsKls, colorSelectorKls } = usePredefineDOM(props);
  26453. const { t } = useLocale();
  26454. const ariaLabel = (value) => {
  26455. return t("el.colorpicker.predefineDescription", { value });
  26456. };
  26457. return (_ctx, _cache) => {
  26458. return vue.openBlock(), vue.createElementBlock("div", {
  26459. class: vue.normalizeClass(vue.unref(rootKls))
  26460. }, [
  26461. vue.createElementVNode("div", {
  26462. class: vue.normalizeClass(vue.unref(colorsKls))
  26463. }, [
  26464. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(rgbaColors), (item, index) => {
  26465. return vue.openBlock(), vue.createElementBlock("button", {
  26466. key: _ctx.colors[index],
  26467. type: "button",
  26468. disabled: _ctx.disabled,
  26469. "aria-label": ariaLabel(item.value),
  26470. class: vue.normalizeClass(vue.unref(colorSelectorKls)(item)),
  26471. onClick: ($event) => vue.unref(handleSelect)(index)
  26472. }, [
  26473. vue.createElementVNode("div", {
  26474. style: vue.normalizeStyle({ backgroundColor: item.value })
  26475. }, null, 4)
  26476. ], 10, ["disabled", "aria-label", "onClick"]);
  26477. }), 128))
  26478. ], 2)
  26479. ], 2);
  26480. };
  26481. }
  26482. });
  26483. var Predefine = /* @__PURE__ */ _export_sfc(_sfc_main$1E, [["__file", "predefine.vue"]]);
  26484. const svPanelProps = buildProps({
  26485. color: {
  26486. type: definePropType(Object),
  26487. required: true
  26488. },
  26489. disabled: Boolean
  26490. });
  26491. const useSvPanel = (props) => {
  26492. const instance = vue.getCurrentInstance();
  26493. const cursorRef = vue.ref();
  26494. const cursorTop = vue.ref(0);
  26495. const cursorLeft = vue.ref(0);
  26496. const background = vue.ref("hsl(0, 100%, 50%)");
  26497. const saturation = vue.computed(() => props.color.get("saturation"));
  26498. const brightness = vue.computed(() => props.color.get("value"));
  26499. const hue = vue.computed(() => props.color.get("hue"));
  26500. function handleClick(event) {
  26501. var _a;
  26502. if (props.disabled)
  26503. return;
  26504. const target = event.target;
  26505. if (target !== cursorRef.value) {
  26506. handleDrag(event);
  26507. }
  26508. (_a = cursorRef.value) == null ? void 0 : _a.focus({ preventScroll: true });
  26509. }
  26510. function handleDrag(event) {
  26511. if (props.disabled)
  26512. return;
  26513. const el = instance.vnode.el;
  26514. const rect = el.getBoundingClientRect();
  26515. const { clientX, clientY } = getClientXY(event);
  26516. let left = clientX - rect.left;
  26517. let top = clientY - rect.top;
  26518. left = Math.max(0, left);
  26519. left = Math.min(left, rect.width);
  26520. top = Math.max(0, top);
  26521. top = Math.min(top, rect.height);
  26522. cursorLeft.value = left;
  26523. cursorTop.value = top;
  26524. props.color.set({
  26525. saturation: left / rect.width * 100,
  26526. value: 100 - top / rect.height * 100
  26527. });
  26528. }
  26529. function handleKeydown(event) {
  26530. if (props.disabled)
  26531. return;
  26532. const { shiftKey } = event;
  26533. const code = getEventCode(event);
  26534. const step = shiftKey ? 10 : 1;
  26535. let isPreventDefault = true;
  26536. switch (code) {
  26537. case EVENT_CODE.left:
  26538. incrementSaturation(-step);
  26539. break;
  26540. case EVENT_CODE.right:
  26541. incrementSaturation(step);
  26542. break;
  26543. case EVENT_CODE.up:
  26544. incrementBrightness(step);
  26545. break;
  26546. case EVENT_CODE.down:
  26547. incrementBrightness(-step);
  26548. break;
  26549. default:
  26550. isPreventDefault = false;
  26551. break;
  26552. }
  26553. isPreventDefault && event.preventDefault();
  26554. }
  26555. function incrementSaturation(step) {
  26556. let next = saturation.value + step;
  26557. next = next < 0 ? 0 : next > 100 ? 100 : next;
  26558. props.color.set("saturation", next);
  26559. }
  26560. function incrementBrightness(step) {
  26561. let next = brightness.value + step;
  26562. next = next < 0 ? 0 : next > 100 ? 100 : next;
  26563. props.color.set("value", next);
  26564. }
  26565. return {
  26566. cursorRef,
  26567. cursorTop,
  26568. cursorLeft,
  26569. background,
  26570. saturation,
  26571. brightness,
  26572. hue,
  26573. handleClick,
  26574. handleDrag,
  26575. handleKeydown
  26576. };
  26577. };
  26578. const useSvPanelDOM = (props, {
  26579. cursorTop,
  26580. cursorLeft,
  26581. background,
  26582. handleDrag
  26583. }) => {
  26584. const instance = vue.getCurrentInstance();
  26585. const ns = useNamespace("color-svpanel");
  26586. function update() {
  26587. const saturation = props.color.get("saturation");
  26588. const brightness = props.color.get("value");
  26589. const el = instance.vnode.el;
  26590. const { clientWidth: width, clientHeight: height } = el;
  26591. cursorLeft.value = saturation * width / 100;
  26592. cursorTop.value = (100 - brightness) * height / 100;
  26593. background.value = `hsl(${props.color.get("hue")}, 100%, 50%)`;
  26594. }
  26595. vue.onMounted(() => {
  26596. draggable(instance.vnode.el, {
  26597. drag: (event) => {
  26598. handleDrag(event);
  26599. },
  26600. end: (event) => {
  26601. handleDrag(event);
  26602. }
  26603. });
  26604. update();
  26605. });
  26606. vue.watch([
  26607. () => props.color.get("hue"),
  26608. () => props.color.get("value"),
  26609. () => props.color.value
  26610. ], () => update());
  26611. const rootKls = vue.computed(() => ns.b());
  26612. const cursorKls = vue.computed(() => ns.e("cursor"));
  26613. const rootStyle = vue.computed(() => ({
  26614. backgroundColor: background.value
  26615. }));
  26616. const cursorStyle = vue.computed(() => ({
  26617. top: addUnit(cursorTop.value),
  26618. left: addUnit(cursorLeft.value)
  26619. }));
  26620. return {
  26621. rootKls,
  26622. cursorKls,
  26623. rootStyle,
  26624. cursorStyle,
  26625. update
  26626. };
  26627. };
  26628. const __default__$1b = vue.defineComponent({
  26629. name: "ElSvPanel"
  26630. });
  26631. const _sfc_main$1D = /* @__PURE__ */ vue.defineComponent({
  26632. ...__default__$1b,
  26633. props: svPanelProps,
  26634. setup(__props, { expose }) {
  26635. const props = __props;
  26636. const {
  26637. cursorRef,
  26638. cursorTop,
  26639. cursorLeft,
  26640. background,
  26641. saturation,
  26642. brightness,
  26643. handleClick,
  26644. handleDrag,
  26645. handleKeydown
  26646. } = useSvPanel(props);
  26647. const { rootKls, cursorKls, rootStyle, cursorStyle, update } = useSvPanelDOM(props, {
  26648. cursorTop,
  26649. cursorLeft,
  26650. background,
  26651. handleDrag
  26652. });
  26653. const { t } = useLocale();
  26654. const ariaLabel = vue.computed(() => t("el.colorpicker.svLabel"));
  26655. const ariaValuetext = vue.computed(() => {
  26656. return t("el.colorpicker.svDescription", {
  26657. saturation: saturation.value,
  26658. brightness: brightness.value,
  26659. color: props.color.value
  26660. });
  26661. });
  26662. expose({
  26663. update
  26664. });
  26665. return (_ctx, _cache) => {
  26666. return vue.openBlock(), vue.createElementBlock("div", {
  26667. class: vue.normalizeClass(vue.unref(rootKls)),
  26668. style: vue.normalizeStyle(vue.unref(rootStyle)),
  26669. onClick: vue.unref(handleClick)
  26670. }, [
  26671. vue.createElementVNode("div", {
  26672. ref_key: "cursorRef",
  26673. ref: cursorRef,
  26674. class: vue.normalizeClass(vue.unref(cursorKls)),
  26675. style: vue.normalizeStyle(vue.unref(cursorStyle)),
  26676. tabindex: "0",
  26677. role: "slider",
  26678. "aria-valuemin": "0,0",
  26679. "aria-valuemax": "100,100",
  26680. "aria-label": vue.unref(ariaLabel),
  26681. "aria-valuenow": `${vue.unref(saturation)},${vue.unref(brightness)}`,
  26682. "aria-valuetext": vue.unref(ariaValuetext),
  26683. onKeydown: vue.unref(handleKeydown)
  26684. }, null, 46, ["aria-label", "aria-valuenow", "aria-valuetext", "onKeydown"])
  26685. ], 14, ["onClick"]);
  26686. };
  26687. }
  26688. });
  26689. var SvPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1D, [["__file", "sv-panel.vue"]]);
  26690. const useCommonColor = (props, emit) => {
  26691. const color = vue.reactive(new Color({
  26692. enableAlpha: props.showAlpha,
  26693. format: props.colorFormat || "",
  26694. value: props.modelValue
  26695. }));
  26696. vue.watch(() => [props.colorFormat, props.showAlpha], () => {
  26697. color.enableAlpha = props.showAlpha;
  26698. color.format = props.colorFormat || color.format;
  26699. color.doOnChange();
  26700. emit(UPDATE_MODEL_EVENT, color.value);
  26701. });
  26702. return {
  26703. color
  26704. };
  26705. };
  26706. const __default__$1a = vue.defineComponent({
  26707. name: "ElColorPickerPanel"
  26708. });
  26709. const _sfc_main$1C = /* @__PURE__ */ vue.defineComponent({
  26710. ...__default__$1a,
  26711. props: colorPickerPanelProps,
  26712. emits: colorPickerPanelEmits,
  26713. setup(__props, { expose, emit }) {
  26714. const props = __props;
  26715. const ns = useNamespace("color-picker-panel");
  26716. const { formItem } = useFormItem();
  26717. const disabled = useFormDisabled();
  26718. const hueRef = vue.ref();
  26719. const svRef = vue.ref();
  26720. const alphaRef = vue.ref();
  26721. const inputRef = vue.ref();
  26722. const customInput = vue.ref("");
  26723. const { color } = vue.inject(ROOT_COMMON_COLOR_INJECTION_KEY, () => useCommonColor(props, emit), true);
  26724. function handleConfirm() {
  26725. color.fromString(customInput.value);
  26726. if (color.value !== customInput.value) {
  26727. customInput.value = color.value;
  26728. }
  26729. }
  26730. function handleFocusout() {
  26731. var _a;
  26732. if (props.validateEvent) {
  26733. (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "blur").catch((err) => debugWarn(err));
  26734. }
  26735. }
  26736. function update() {
  26737. var _a, _b, _c;
  26738. (_a = hueRef.value) == null ? void 0 : _a.update();
  26739. (_b = svRef.value) == null ? void 0 : _b.update();
  26740. (_c = alphaRef.value) == null ? void 0 : _c.update();
  26741. }
  26742. vue.onMounted(() => {
  26743. if (props.modelValue) {
  26744. customInput.value = color.value;
  26745. }
  26746. vue.nextTick(update);
  26747. });
  26748. vue.watch(() => props.modelValue, (newVal) => {
  26749. if (newVal !== color.value) {
  26750. newVal ? color.fromString(newVal) : color.clear();
  26751. }
  26752. });
  26753. vue.watch(() => color.value, (val) => {
  26754. emit(UPDATE_MODEL_EVENT, val);
  26755. customInput.value = val;
  26756. if (props.validateEvent) {
  26757. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn(err));
  26758. }
  26759. });
  26760. vue.provide(colorPickerPanelContextKey, {
  26761. currentColor: vue.computed(() => color.value)
  26762. });
  26763. expose({
  26764. color,
  26765. inputRef,
  26766. update
  26767. });
  26768. return (_ctx, _cache) => {
  26769. return vue.openBlock(), vue.createElementBlock("div", {
  26770. class: vue.normalizeClass([vue.unref(ns).b(), vue.unref(ns).is("disabled", vue.unref(disabled)), vue.unref(ns).is("border", _ctx.border)]),
  26771. onFocusout: handleFocusout
  26772. }, [
  26773. vue.createElementVNode("div", {
  26774. class: vue.normalizeClass(vue.unref(ns).e("wrapper"))
  26775. }, [
  26776. vue.createVNode(HueSlider, {
  26777. ref_key: "hueRef",
  26778. ref: hueRef,
  26779. class: "hue-slider",
  26780. color: vue.unref(color),
  26781. vertical: "",
  26782. disabled: vue.unref(disabled)
  26783. }, null, 8, ["color", "disabled"]),
  26784. vue.createVNode(SvPanel, {
  26785. ref_key: "svRef",
  26786. ref: svRef,
  26787. color: vue.unref(color),
  26788. disabled: vue.unref(disabled)
  26789. }, null, 8, ["color", "disabled"])
  26790. ], 2),
  26791. _ctx.showAlpha ? (vue.openBlock(), vue.createBlock(AlphaSlider, {
  26792. key: 0,
  26793. ref_key: "alphaRef",
  26794. ref: alphaRef,
  26795. color: vue.unref(color),
  26796. disabled: vue.unref(disabled)
  26797. }, null, 8, ["color", "disabled"])) : vue.createCommentVNode("v-if", true),
  26798. _ctx.predefine ? (vue.openBlock(), vue.createBlock(Predefine, {
  26799. key: 1,
  26800. ref: "predefine",
  26801. "enable-alpha": _ctx.showAlpha,
  26802. color: vue.unref(color),
  26803. colors: _ctx.predefine,
  26804. disabled: vue.unref(disabled)
  26805. }, null, 8, ["enable-alpha", "color", "colors", "disabled"])) : vue.createCommentVNode("v-if", true),
  26806. vue.createElementVNode("div", {
  26807. class: vue.normalizeClass(vue.unref(ns).e("footer"))
  26808. }, [
  26809. vue.createVNode(vue.unref(ElInput), {
  26810. ref_key: "inputRef",
  26811. ref: inputRef,
  26812. modelValue: customInput.value,
  26813. "onUpdate:modelValue": ($event) => customInput.value = $event,
  26814. "validate-event": false,
  26815. size: "small",
  26816. disabled: vue.unref(disabled),
  26817. onChange: handleConfirm
  26818. }, null, 8, ["modelValue", "onUpdate:modelValue", "disabled"]),
  26819. vue.renderSlot(_ctx.$slots, "footer")
  26820. ], 2)
  26821. ], 34);
  26822. };
  26823. }
  26824. });
  26825. var ColorPickerPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1C, [["__file", "color-picker-panel.vue"]]);
  26826. const ElColorPickerPanel = withInstall(ColorPickerPanel);
  26827. const colorPickerProps = buildProps({
  26828. persistent: {
  26829. type: Boolean,
  26830. default: true
  26831. },
  26832. modelValue: {
  26833. type: definePropType(String),
  26834. default: void 0
  26835. },
  26836. id: String,
  26837. showAlpha: Boolean,
  26838. colorFormat: String,
  26839. disabled: Boolean,
  26840. size: useSizeProp,
  26841. popperClass: useTooltipContentProps.popperClass,
  26842. popperStyle: useTooltipContentProps.popperStyle,
  26843. tabindex: {
  26844. type: [String, Number],
  26845. default: 0
  26846. },
  26847. teleported: useTooltipContentProps.teleported,
  26848. appendTo: useTooltipContentProps.appendTo,
  26849. predefine: {
  26850. type: definePropType(Array)
  26851. },
  26852. validateEvent: {
  26853. type: Boolean,
  26854. default: true
  26855. },
  26856. ...useEmptyValuesProps,
  26857. ...useAriaProps(["ariaLabel"])
  26858. });
  26859. const colorPickerEmits = {
  26860. [UPDATE_MODEL_EVENT]: (val) => isString$1(val) || isNil(val),
  26861. [CHANGE_EVENT]: (val) => isString$1(val) || isNil(val),
  26862. activeChange: (val) => isString$1(val) || isNil(val),
  26863. focus: (evt) => evt instanceof FocusEvent,
  26864. blur: (evt) => evt instanceof FocusEvent
  26865. };
  26866. const __default__$19 = vue.defineComponent({
  26867. name: "ElColorPicker"
  26868. });
  26869. const _sfc_main$1B = /* @__PURE__ */ vue.defineComponent({
  26870. ...__default__$19,
  26871. props: colorPickerProps,
  26872. emits: colorPickerEmits,
  26873. setup(__props, { expose, emit }) {
  26874. const props = __props;
  26875. const { t } = useLocale();
  26876. const ns = useNamespace("color");
  26877. const { formItem } = useFormItem();
  26878. const colorSize = useFormSize();
  26879. const colorDisabled = useFormDisabled();
  26880. const { valueOnClear, isEmptyValue } = useEmptyValues(props, null);
  26881. const commonColor = useCommonColor(props, emit);
  26882. const { inputId: buttonId, isLabeledByFormItem } = useFormItemInputId(props, {
  26883. formItemContext: formItem
  26884. });
  26885. const popper = vue.ref();
  26886. const triggerRef = vue.ref();
  26887. const pickerPanelRef = vue.ref();
  26888. const showPicker = vue.ref(false);
  26889. const showPanelColor = vue.ref(false);
  26890. let shouldActiveChange = true;
  26891. const { isFocused, handleFocus, handleBlur } = useFocusController(triggerRef, {
  26892. disabled: colorDisabled,
  26893. beforeBlur(event) {
  26894. var _a;
  26895. return (_a = popper.value) == null ? void 0 : _a.isFocusInsideContent(event);
  26896. },
  26897. afterBlur() {
  26898. var _a;
  26899. setShowPicker(false);
  26900. resetColor();
  26901. if (props.validateEvent) {
  26902. (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "blur").catch((err) => debugWarn(err));
  26903. }
  26904. }
  26905. });
  26906. const color = reactiveComputed(() => {
  26907. var _a, _b;
  26908. return (_b = (_a = pickerPanelRef.value) == null ? void 0 : _a.color) != null ? _b : commonColor.color;
  26909. });
  26910. const panelProps = vue.computed(() => pick(props, Object.keys(colorPickerPanelProps)));
  26911. const displayedColor = vue.computed(() => {
  26912. if (!props.modelValue && !showPanelColor.value) {
  26913. return "transparent";
  26914. }
  26915. return displayedRgb(color, props.showAlpha);
  26916. });
  26917. const currentColor = vue.computed(() => {
  26918. return !props.modelValue && !showPanelColor.value ? "" : color.value;
  26919. });
  26920. const buttonAriaLabel = vue.computed(() => {
  26921. return !isLabeledByFormItem.value ? props.ariaLabel || t("el.colorpicker.defaultLabel") : void 0;
  26922. });
  26923. const buttonAriaLabelledby = vue.computed(() => {
  26924. return isLabeledByFormItem.value ? formItem == null ? void 0 : formItem.labelId : void 0;
  26925. });
  26926. const btnKls = vue.computed(() => {
  26927. return [
  26928. ns.b("picker"),
  26929. ns.is("disabled", colorDisabled.value),
  26930. ns.bm("picker", colorSize.value),
  26931. ns.is("focused", isFocused.value)
  26932. ];
  26933. });
  26934. function displayedRgb(color2, showAlpha) {
  26935. const { r, g, b, a } = color2.toRgb();
  26936. return showAlpha ? `rgba(${r}, ${g}, ${b}, ${a})` : `rgb(${r}, ${g}, ${b})`;
  26937. }
  26938. function setShowPicker(value) {
  26939. showPicker.value = value;
  26940. }
  26941. const debounceSetShowPicker = debounce(setShowPicker, 100, { leading: true });
  26942. function show() {
  26943. if (colorDisabled.value)
  26944. return;
  26945. setShowPicker(true);
  26946. }
  26947. function hide() {
  26948. debounceSetShowPicker(false);
  26949. resetColor();
  26950. }
  26951. function resetColor() {
  26952. vue.nextTick(() => {
  26953. if (props.modelValue) {
  26954. color.fromString(props.modelValue);
  26955. } else {
  26956. color.value = "";
  26957. vue.nextTick(() => {
  26958. showPanelColor.value = false;
  26959. });
  26960. }
  26961. });
  26962. }
  26963. function handleTrigger() {
  26964. if (colorDisabled.value)
  26965. return;
  26966. if (showPicker.value) {
  26967. resetColor();
  26968. }
  26969. debounceSetShowPicker(!showPicker.value);
  26970. }
  26971. function confirmValue() {
  26972. const value = isEmptyValue(color.value) ? valueOnClear.value : color.value;
  26973. emit(UPDATE_MODEL_EVENT, value);
  26974. emit(CHANGE_EVENT, value);
  26975. if (props.validateEvent) {
  26976. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn(err));
  26977. }
  26978. debounceSetShowPicker(false);
  26979. vue.nextTick(() => {
  26980. const newColor = new Color({
  26981. enableAlpha: props.showAlpha,
  26982. format: props.colorFormat || "",
  26983. value: props.modelValue
  26984. });
  26985. if (!color.compare(newColor)) {
  26986. resetColor();
  26987. }
  26988. });
  26989. }
  26990. function clear() {
  26991. debounceSetShowPicker(false);
  26992. emit(UPDATE_MODEL_EVENT, valueOnClear.value);
  26993. emit(CHANGE_EVENT, valueOnClear.value);
  26994. if (props.modelValue !== valueOnClear.value && props.validateEvent) {
  26995. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn(err));
  26996. }
  26997. resetColor();
  26998. }
  26999. function handleShowTooltip() {
  27000. var _a, _b;
  27001. (_b = (_a = pickerPanelRef == null ? void 0 : pickerPanelRef.value) == null ? void 0 : _a.inputRef) == null ? void 0 : _b.focus();
  27002. }
  27003. function handleClickOutside() {
  27004. if (!showPicker.value)
  27005. return;
  27006. hide();
  27007. isFocused.value && focus();
  27008. }
  27009. function handleEsc(event) {
  27010. event.preventDefault();
  27011. event.stopPropagation();
  27012. setShowPicker(false);
  27013. resetColor();
  27014. }
  27015. function handleKeyDown(event) {
  27016. const code = getEventCode(event);
  27017. switch (code) {
  27018. case EVENT_CODE.enter:
  27019. case EVENT_CODE.numpadEnter:
  27020. case EVENT_CODE.space:
  27021. event.preventDefault();
  27022. event.stopPropagation();
  27023. show();
  27024. break;
  27025. case EVENT_CODE.esc:
  27026. handleEsc(event);
  27027. break;
  27028. }
  27029. }
  27030. function focus() {
  27031. triggerRef.value.focus();
  27032. }
  27033. function blur() {
  27034. triggerRef.value.blur();
  27035. }
  27036. vue.watch(() => currentColor.value, (val) => {
  27037. shouldActiveChange && emit("activeChange", val);
  27038. shouldActiveChange = true;
  27039. });
  27040. vue.watch(() => color.value, () => {
  27041. if (!props.modelValue && !showPanelColor.value) {
  27042. showPanelColor.value = true;
  27043. }
  27044. });
  27045. vue.watch(() => props.modelValue, (newVal) => {
  27046. if (!newVal) {
  27047. showPanelColor.value = false;
  27048. } else if (newVal && newVal !== color.value) {
  27049. shouldActiveChange = false;
  27050. color.fromString(newVal);
  27051. }
  27052. });
  27053. vue.watch(() => showPicker.value, () => {
  27054. var _a;
  27055. vue.nextTick((_a = pickerPanelRef.value) == null ? void 0 : _a.update);
  27056. });
  27057. vue.provide(ROOT_COMMON_COLOR_INJECTION_KEY, commonColor);
  27058. expose({
  27059. color,
  27060. show,
  27061. hide,
  27062. focus,
  27063. blur
  27064. });
  27065. return (_ctx, _cache) => {
  27066. return vue.openBlock(), vue.createBlock(vue.unref(ElTooltip), {
  27067. ref_key: "popper",
  27068. ref: popper,
  27069. visible: showPicker.value,
  27070. "show-arrow": false,
  27071. "fallback-placements": ["bottom", "top", "right", "left"],
  27072. offset: 0,
  27073. "gpu-acceleration": false,
  27074. "popper-class": [vue.unref(ns).be("picker", "panel"), _ctx.popperClass],
  27075. "popper-style": _ctx.popperStyle,
  27076. "stop-popper-mouse-event": false,
  27077. pure: "",
  27078. loop: "",
  27079. role: "dialog",
  27080. effect: "light",
  27081. trigger: "click",
  27082. teleported: _ctx.teleported,
  27083. transition: `${vue.unref(ns).namespace.value}-zoom-in-top`,
  27084. persistent: _ctx.persistent,
  27085. "append-to": _ctx.appendTo,
  27086. onShow: handleShowTooltip,
  27087. onHide: ($event) => setShowPicker(false)
  27088. }, {
  27089. content: vue.withCtx(() => [
  27090. vue.withDirectives((vue.openBlock(), vue.createBlock(vue.unref(ElColorPickerPanel), vue.mergeProps({
  27091. ref_key: "pickerPanelRef",
  27092. ref: pickerPanelRef
  27093. }, vue.unref(panelProps), {
  27094. border: false,
  27095. "validate-event": false,
  27096. onKeydown: vue.withKeys(handleEsc, ["esc"])
  27097. }), {
  27098. footer: vue.withCtx(() => [
  27099. vue.createElementVNode("div", null, [
  27100. vue.createVNode(vue.unref(ElButton), {
  27101. class: vue.normalizeClass(vue.unref(ns).be("footer", "link-btn")),
  27102. text: "",
  27103. size: "small",
  27104. onClick: clear
  27105. }, {
  27106. default: vue.withCtx(() => [
  27107. vue.createTextVNode(vue.toDisplayString(vue.unref(t)("el.colorpicker.clear")), 1)
  27108. ]),
  27109. _: 1
  27110. }, 8, ["class"]),
  27111. vue.createVNode(vue.unref(ElButton), {
  27112. plain: "",
  27113. size: "small",
  27114. class: vue.normalizeClass(vue.unref(ns).be("footer", "btn")),
  27115. onClick: confirmValue
  27116. }, {
  27117. default: vue.withCtx(() => [
  27118. vue.createTextVNode(vue.toDisplayString(vue.unref(t)("el.colorpicker.confirm")), 1)
  27119. ]),
  27120. _: 1
  27121. }, 8, ["class"])
  27122. ])
  27123. ]),
  27124. _: 1
  27125. }, 16, ["onKeydown"])), [
  27126. [vue.unref(ClickOutside), handleClickOutside, triggerRef.value]
  27127. ])
  27128. ]),
  27129. default: vue.withCtx(() => [
  27130. vue.createElementVNode("div", vue.mergeProps({
  27131. id: vue.unref(buttonId),
  27132. ref_key: "triggerRef",
  27133. ref: triggerRef
  27134. }, _ctx.$attrs, {
  27135. class: vue.unref(btnKls),
  27136. role: "button",
  27137. "aria-label": vue.unref(buttonAriaLabel),
  27138. "aria-labelledby": vue.unref(buttonAriaLabelledby),
  27139. "aria-description": vue.unref(t)("el.colorpicker.description", { color: _ctx.modelValue || "" }),
  27140. "aria-disabled": vue.unref(colorDisabled),
  27141. tabindex: vue.unref(colorDisabled) ? void 0 : _ctx.tabindex,
  27142. onKeydown: handleKeyDown,
  27143. onFocus: vue.unref(handleFocus),
  27144. onBlur: vue.unref(handleBlur)
  27145. }), [
  27146. vue.createElementVNode("div", {
  27147. class: vue.normalizeClass(vue.unref(ns).be("picker", "trigger")),
  27148. onClick: handleTrigger
  27149. }, [
  27150. vue.createElementVNode("span", {
  27151. class: vue.normalizeClass([vue.unref(ns).be("picker", "color"), vue.unref(ns).is("alpha", _ctx.showAlpha)])
  27152. }, [
  27153. vue.createElementVNode("span", {
  27154. class: vue.normalizeClass(vue.unref(ns).be("picker", "color-inner")),
  27155. style: vue.normalizeStyle({
  27156. backgroundColor: vue.unref(displayedColor)
  27157. })
  27158. }, [
  27159. vue.withDirectives(vue.createVNode(vue.unref(ElIcon), {
  27160. class: vue.normalizeClass([vue.unref(ns).be("picker", "icon"), vue.unref(ns).is("icon-arrow-down")])
  27161. }, {
  27162. default: vue.withCtx(() => [
  27163. vue.createVNode(vue.unref(arrow_down_default))
  27164. ]),
  27165. _: 1
  27166. }, 8, ["class"]), [
  27167. [vue.vShow, _ctx.modelValue || showPanelColor.value]
  27168. ]),
  27169. vue.withDirectives(vue.createVNode(vue.unref(ElIcon), {
  27170. class: vue.normalizeClass([vue.unref(ns).be("picker", "empty"), vue.unref(ns).is("icon-close")])
  27171. }, {
  27172. default: vue.withCtx(() => [
  27173. vue.createVNode(vue.unref(close_default))
  27174. ]),
  27175. _: 1
  27176. }, 8, ["class"]), [
  27177. [vue.vShow, !_ctx.modelValue && !showPanelColor.value]
  27178. ])
  27179. ], 6)
  27180. ], 2)
  27181. ], 2)
  27182. ], 16, ["id", "aria-label", "aria-labelledby", "aria-description", "aria-disabled", "tabindex", "onFocus", "onBlur"])
  27183. ]),
  27184. _: 1
  27185. }, 8, ["visible", "popper-class", "popper-style", "teleported", "transition", "persistent", "append-to", "onHide"]);
  27186. };
  27187. }
  27188. });
  27189. var ColorPicker = /* @__PURE__ */ _export_sfc(_sfc_main$1B, [["__file", "color-picker.vue"]]);
  27190. const ElColorPicker = withInstall(ColorPicker);
  27191. const __default__$18 = vue.defineComponent({
  27192. name: "ElContainer"
  27193. });
  27194. const _sfc_main$1A = /* @__PURE__ */ vue.defineComponent({
  27195. ...__default__$18,
  27196. props: buildProps({
  27197. direction: {
  27198. type: String,
  27199. values: ["horizontal", "vertical"]
  27200. }
  27201. }),
  27202. setup(__props) {
  27203. const props = __props;
  27204. const slots = vue.useSlots();
  27205. const ns = useNamespace("container");
  27206. const isVertical = vue.computed(() => {
  27207. if (props.direction === "vertical") {
  27208. return true;
  27209. } else if (props.direction === "horizontal") {
  27210. return false;
  27211. }
  27212. if (slots && slots.default) {
  27213. const vNodes = slots.default();
  27214. return vNodes.some((vNode) => {
  27215. const tag = vNode.type.name;
  27216. return tag === "ElHeader" || tag === "ElFooter";
  27217. });
  27218. } else {
  27219. return false;
  27220. }
  27221. });
  27222. return (_ctx, _cache) => {
  27223. return vue.openBlock(), vue.createElementBlock("section", {
  27224. class: vue.normalizeClass([vue.unref(ns).b(), vue.unref(ns).is("vertical", vue.unref(isVertical))])
  27225. }, [
  27226. vue.renderSlot(_ctx.$slots, "default")
  27227. ], 2);
  27228. };
  27229. }
  27230. });
  27231. var Container = /* @__PURE__ */ _export_sfc(_sfc_main$1A, [["__file", "container.vue"]]);
  27232. const __default__$17 = vue.defineComponent({
  27233. name: "ElAside"
  27234. });
  27235. const _sfc_main$1z = /* @__PURE__ */ vue.defineComponent({
  27236. ...__default__$17,
  27237. props: {
  27238. width: {
  27239. type: String,
  27240. default: null
  27241. }
  27242. },
  27243. setup(__props) {
  27244. const props = __props;
  27245. const ns = useNamespace("aside");
  27246. const style = vue.computed(() => props.width ? ns.cssVarBlock({ width: props.width }) : {});
  27247. return (_ctx, _cache) => {
  27248. return vue.openBlock(), vue.createElementBlock("aside", {
  27249. class: vue.normalizeClass(vue.unref(ns).b()),
  27250. style: vue.normalizeStyle(vue.unref(style))
  27251. }, [
  27252. vue.renderSlot(_ctx.$slots, "default")
  27253. ], 6);
  27254. };
  27255. }
  27256. });
  27257. var Aside = /* @__PURE__ */ _export_sfc(_sfc_main$1z, [["__file", "aside.vue"]]);
  27258. const __default__$16 = vue.defineComponent({
  27259. name: "ElFooter"
  27260. });
  27261. const _sfc_main$1y = /* @__PURE__ */ vue.defineComponent({
  27262. ...__default__$16,
  27263. props: {
  27264. height: {
  27265. type: String,
  27266. default: null
  27267. }
  27268. },
  27269. setup(__props) {
  27270. const props = __props;
  27271. const ns = useNamespace("footer");
  27272. const style = vue.computed(() => props.height ? ns.cssVarBlock({ height: props.height }) : {});
  27273. return (_ctx, _cache) => {
  27274. return vue.openBlock(), vue.createElementBlock("footer", {
  27275. class: vue.normalizeClass(vue.unref(ns).b()),
  27276. style: vue.normalizeStyle(vue.unref(style))
  27277. }, [
  27278. vue.renderSlot(_ctx.$slots, "default")
  27279. ], 6);
  27280. };
  27281. }
  27282. });
  27283. var Footer$2 = /* @__PURE__ */ _export_sfc(_sfc_main$1y, [["__file", "footer.vue"]]);
  27284. const __default__$15 = vue.defineComponent({
  27285. name: "ElHeader"
  27286. });
  27287. const _sfc_main$1x = /* @__PURE__ */ vue.defineComponent({
  27288. ...__default__$15,
  27289. props: {
  27290. height: {
  27291. type: String,
  27292. default: null
  27293. }
  27294. },
  27295. setup(__props) {
  27296. const props = __props;
  27297. const ns = useNamespace("header");
  27298. const style = vue.computed(() => {
  27299. return props.height ? ns.cssVarBlock({
  27300. height: props.height
  27301. }) : {};
  27302. });
  27303. return (_ctx, _cache) => {
  27304. return vue.openBlock(), vue.createElementBlock("header", {
  27305. class: vue.normalizeClass(vue.unref(ns).b()),
  27306. style: vue.normalizeStyle(vue.unref(style))
  27307. }, [
  27308. vue.renderSlot(_ctx.$slots, "default")
  27309. ], 6);
  27310. };
  27311. }
  27312. });
  27313. var Header$1 = /* @__PURE__ */ _export_sfc(_sfc_main$1x, [["__file", "header.vue"]]);
  27314. const __default__$14 = vue.defineComponent({
  27315. name: "ElMain"
  27316. });
  27317. const _sfc_main$1w = /* @__PURE__ */ vue.defineComponent({
  27318. ...__default__$14,
  27319. setup(__props) {
  27320. const ns = useNamespace("main");
  27321. return (_ctx, _cache) => {
  27322. return vue.openBlock(), vue.createElementBlock("main", {
  27323. class: vue.normalizeClass(vue.unref(ns).b())
  27324. }, [
  27325. vue.renderSlot(_ctx.$slots, "default")
  27326. ], 2);
  27327. };
  27328. }
  27329. });
  27330. var Main = /* @__PURE__ */ _export_sfc(_sfc_main$1w, [["__file", "main.vue"]]);
  27331. const ElContainer = withInstall(Container, {
  27332. Aside,
  27333. Footer: Footer$2,
  27334. Header: Header$1,
  27335. Main
  27336. });
  27337. const ElAside = withNoopInstall(Aside);
  27338. const ElFooter = withNoopInstall(Footer$2);
  27339. const ElHeader = withNoopInstall(Header$1);
  27340. const ElMain = withNoopInstall(Main);
  27341. var advancedFormat$1 = {exports: {}};
  27342. (function(module, exports) {
  27343. !function(e, t) {
  27344. module.exports = t() ;
  27345. }(commonjsGlobal, function() {
  27346. return function(e, t) {
  27347. var r = t.prototype, n = r.format;
  27348. r.format = function(e2) {
  27349. var t2 = this, r2 = this.$locale();
  27350. if (!this.isValid())
  27351. return n.bind(this)(e2);
  27352. 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) {
  27353. switch (e3) {
  27354. case "Q":
  27355. return Math.ceil((t2.$M + 1) / 3);
  27356. case "Do":
  27357. return r2.ordinal(t2.$D);
  27358. case "gggg":
  27359. return t2.weekYear();
  27360. case "GGGG":
  27361. return t2.isoWeekYear();
  27362. case "wo":
  27363. return r2.ordinal(t2.week(), "W");
  27364. case "w":
  27365. case "ww":
  27366. return s.s(t2.week(), e3 === "w" ? 1 : 2, "0");
  27367. case "W":
  27368. case "WW":
  27369. return s.s(t2.isoWeek(), e3 === "W" ? 1 : 2, "0");
  27370. case "k":
  27371. case "kk":
  27372. return s.s(String(t2.$H === 0 ? 24 : t2.$H), e3 === "k" ? 1 : 2, "0");
  27373. case "X":
  27374. return Math.floor(t2.$d.getTime() / 1e3);
  27375. case "x":
  27376. return t2.$d.getTime();
  27377. case "z":
  27378. return "[" + t2.offsetName() + "]";
  27379. case "zzz":
  27380. return "[" + t2.offsetName("long") + "]";
  27381. default:
  27382. return e3;
  27383. }
  27384. });
  27385. return n.bind(this)(a);
  27386. };
  27387. };
  27388. });
  27389. })(advancedFormat$1);
  27390. var advancedFormat = advancedFormat$1.exports;
  27391. var weekOfYear$1 = {exports: {}};
  27392. (function(module, exports) {
  27393. !function(e, t) {
  27394. module.exports = t() ;
  27395. }(commonjsGlobal, function() {
  27396. var e = "week", t = "year";
  27397. return function(i, n, r) {
  27398. var f = n.prototype;
  27399. f.week = function(i2) {
  27400. if (i2 === void 0 && (i2 = null), i2 !== null)
  27401. return this.add(7 * (i2 - this.week()), "day");
  27402. var n2 = this.$locale().yearStart || 1;
  27403. if (this.month() === 11 && this.date() > 25) {
  27404. var f2 = r(this).startOf(t).add(1, t).date(n2), s = r(this).endOf(e);
  27405. if (f2.isBefore(s))
  27406. return 1;
  27407. }
  27408. var a = r(this).startOf(t).date(n2).startOf(e).subtract(1, "millisecond"), o = this.diff(a, e, true);
  27409. return o < 0 ? r(this).startOf("week").week() : Math.ceil(o);
  27410. }, f.weeks = function(e2) {
  27411. return e2 === void 0 && (e2 = null), this.week(e2);
  27412. };
  27413. };
  27414. });
  27415. })(weekOfYear$1);
  27416. var weekOfYear = weekOfYear$1.exports;
  27417. var weekYear$1 = {exports: {}};
  27418. (function(module, exports) {
  27419. !function(e, t) {
  27420. module.exports = t() ;
  27421. }(commonjsGlobal, function() {
  27422. return function(e, t) {
  27423. t.prototype.weekYear = function() {
  27424. var e2 = this.month(), t2 = this.week(), n = this.year();
  27425. return t2 === 1 && e2 === 11 ? n + 1 : e2 === 0 && t2 >= 52 ? n - 1 : n;
  27426. };
  27427. };
  27428. });
  27429. })(weekYear$1);
  27430. var weekYear = weekYear$1.exports;
  27431. var dayOfYear$1 = {exports: {}};
  27432. (function(module, exports) {
  27433. !function(e, t) {
  27434. module.exports = t() ;
  27435. }(commonjsGlobal, function() {
  27436. return function(e, t, n) {
  27437. t.prototype.dayOfYear = function(e2) {
  27438. var t2 = Math.round((n(this).startOf("day") - n(this).startOf("year")) / 864e5) + 1;
  27439. return e2 == null ? t2 : this.add(e2 - t2, "day");
  27440. };
  27441. };
  27442. });
  27443. })(dayOfYear$1);
  27444. var dayOfYear = dayOfYear$1.exports;
  27445. var isSameOrAfter$1 = {exports: {}};
  27446. (function(module, exports) {
  27447. !function(e, t) {
  27448. module.exports = t() ;
  27449. }(commonjsGlobal, function() {
  27450. return function(e, t) {
  27451. t.prototype.isSameOrAfter = function(e2, t2) {
  27452. return this.isSame(e2, t2) || this.isAfter(e2, t2);
  27453. };
  27454. };
  27455. });
  27456. })(isSameOrAfter$1);
  27457. var isSameOrAfter = isSameOrAfter$1.exports;
  27458. var isSameOrBefore$1 = {exports: {}};
  27459. (function(module, exports) {
  27460. !function(e, i) {
  27461. module.exports = i() ;
  27462. }(commonjsGlobal, function() {
  27463. return function(e, i) {
  27464. i.prototype.isSameOrBefore = function(e2, i2) {
  27465. return this.isSame(e2, i2) || this.isBefore(e2, i2);
  27466. };
  27467. };
  27468. });
  27469. })(isSameOrBefore$1);
  27470. var isSameOrBefore = isSameOrBefore$1.exports;
  27471. const datePickerPanelProps = buildProps({
  27472. valueFormat: String,
  27473. dateFormat: String,
  27474. timeFormat: String,
  27475. disabled: Boolean,
  27476. modelValue: {
  27477. type: definePropType([Date, Array, String, Number]),
  27478. default: ""
  27479. },
  27480. defaultValue: {
  27481. type: definePropType([Date, Array])
  27482. },
  27483. defaultTime: {
  27484. type: definePropType([Date, Array])
  27485. },
  27486. isRange: Boolean,
  27487. ...disabledTimeListsProps,
  27488. disabledDate: {
  27489. type: Function
  27490. },
  27491. cellClassName: {
  27492. type: Function
  27493. },
  27494. shortcuts: {
  27495. type: Array,
  27496. default: () => []
  27497. },
  27498. arrowControl: Boolean,
  27499. unlinkPanels: Boolean,
  27500. showNow: {
  27501. type: Boolean,
  27502. default: true
  27503. },
  27504. showConfirm: Boolean,
  27505. showFooter: Boolean,
  27506. showWeekNumber: Boolean,
  27507. type: {
  27508. type: definePropType(String),
  27509. default: "date"
  27510. },
  27511. clearable: {
  27512. type: Boolean,
  27513. default: true
  27514. },
  27515. border: {
  27516. type: Boolean,
  27517. default: true
  27518. }
  27519. });
  27520. const ROOT_PICKER_INJECTION_KEY = Symbol("rootPickerContextKey");
  27521. const ROOT_PICKER_IS_DEFAULT_FORMAT_INJECTION_KEY = "ElIsDefaultFormat";
  27522. const selectionModes = [
  27523. "date",
  27524. "dates",
  27525. "year",
  27526. "years",
  27527. "month",
  27528. "months",
  27529. "week",
  27530. "range"
  27531. ];
  27532. const datePickerSharedProps = buildProps({
  27533. cellClassName: {
  27534. type: definePropType(Function)
  27535. },
  27536. disabledDate: {
  27537. type: definePropType(Function)
  27538. },
  27539. date: {
  27540. type: definePropType(Object),
  27541. required: true
  27542. },
  27543. minDate: {
  27544. type: definePropType(Object)
  27545. },
  27546. maxDate: {
  27547. type: definePropType(Object)
  27548. },
  27549. parsedValue: {
  27550. type: definePropType([Object, Array])
  27551. },
  27552. rangeState: {
  27553. type: definePropType(Object),
  27554. default: () => ({
  27555. endDate: null,
  27556. selecting: false
  27557. })
  27558. },
  27559. disabled: Boolean
  27560. });
  27561. const panelSharedProps = buildProps({
  27562. type: {
  27563. type: definePropType(String),
  27564. required: true,
  27565. values: datePickTypes
  27566. },
  27567. dateFormat: String,
  27568. timeFormat: String,
  27569. showNow: {
  27570. type: Boolean,
  27571. default: true
  27572. },
  27573. showConfirm: Boolean,
  27574. showFooter: {
  27575. type: Boolean,
  27576. default: true
  27577. },
  27578. showWeekNumber: Boolean,
  27579. border: Boolean,
  27580. disabled: Boolean
  27581. });
  27582. const panelRangeSharedProps = buildProps({
  27583. unlinkPanels: Boolean,
  27584. visible: {
  27585. type: Boolean,
  27586. default: true
  27587. },
  27588. showConfirm: Boolean,
  27589. showFooter: {
  27590. type: Boolean,
  27591. default: true
  27592. },
  27593. border: Boolean,
  27594. disabled: Boolean,
  27595. parsedValue: {
  27596. type: definePropType(Array)
  27597. }
  27598. });
  27599. const selectionModeWithDefault = (mode) => {
  27600. return {
  27601. type: String,
  27602. values: selectionModes,
  27603. default: mode
  27604. };
  27605. };
  27606. const panelDatePickProps = buildProps({
  27607. ...panelSharedProps,
  27608. parsedValue: {
  27609. type: definePropType([Object, Array])
  27610. },
  27611. visible: {
  27612. type: Boolean,
  27613. default: true
  27614. },
  27615. format: {
  27616. type: String,
  27617. default: ""
  27618. }
  27619. });
  27620. const isValidRange = (range) => {
  27621. if (!isArray$1(range))
  27622. return false;
  27623. const [left, right] = range;
  27624. return dayjs.isDayjs(left) && dayjs.isDayjs(right) && dayjs(left).isValid() && dayjs(right).isValid() && left.isSameOrBefore(right);
  27625. };
  27626. const getDefaultValue = (defaultValue, { lang, step = 1, unit, unlinkPanels }) => {
  27627. let start;
  27628. if (isArray$1(defaultValue)) {
  27629. let [left, right] = defaultValue.map((d) => dayjs(d).locale(lang));
  27630. if (!unlinkPanels) {
  27631. right = left.add(step, unit);
  27632. }
  27633. return [left, right];
  27634. } else if (defaultValue) {
  27635. start = dayjs(defaultValue);
  27636. } else {
  27637. start = dayjs();
  27638. }
  27639. start = start.locale(lang);
  27640. return [start, start.add(step, unit)];
  27641. };
  27642. const buildPickerTable = (dimension, rows, {
  27643. columnIndexOffset,
  27644. startDate,
  27645. nextEndDate,
  27646. now,
  27647. unit,
  27648. relativeDateGetter,
  27649. setCellMetadata,
  27650. setRowMetadata
  27651. }) => {
  27652. for (let rowIndex = 0; rowIndex < dimension.row; rowIndex++) {
  27653. const row = rows[rowIndex];
  27654. for (let columnIndex = 0; columnIndex < dimension.column; columnIndex++) {
  27655. let cell = row[columnIndex + columnIndexOffset];
  27656. if (!cell) {
  27657. cell = {
  27658. row: rowIndex,
  27659. column: columnIndex,
  27660. type: "normal",
  27661. inRange: false,
  27662. start: false,
  27663. end: false
  27664. };
  27665. }
  27666. const index = rowIndex * dimension.column + columnIndex;
  27667. const nextStartDate = relativeDateGetter(index);
  27668. cell.dayjs = nextStartDate;
  27669. cell.date = nextStartDate.toDate();
  27670. cell.timestamp = nextStartDate.valueOf();
  27671. cell.type = "normal";
  27672. cell.inRange = !!(startDate && nextStartDate.isSameOrAfter(startDate, unit) && nextEndDate && nextStartDate.isSameOrBefore(nextEndDate, unit)) || !!(startDate && nextStartDate.isSameOrBefore(startDate, unit) && nextEndDate && nextStartDate.isSameOrAfter(nextEndDate, unit));
  27673. if (startDate == null ? void 0 : startDate.isSameOrAfter(nextEndDate)) {
  27674. cell.start = !!nextEndDate && nextStartDate.isSame(nextEndDate, unit);
  27675. cell.end = startDate && nextStartDate.isSame(startDate, unit);
  27676. } else {
  27677. cell.start = !!startDate && nextStartDate.isSame(startDate, unit);
  27678. cell.end = !!nextEndDate && nextStartDate.isSame(nextEndDate, unit);
  27679. }
  27680. const isToday = nextStartDate.isSame(now, unit);
  27681. if (isToday) {
  27682. cell.type = "today";
  27683. }
  27684. setCellMetadata == null ? void 0 : setCellMetadata(cell, { rowIndex, columnIndex });
  27685. row[columnIndex + columnIndexOffset] = cell;
  27686. }
  27687. setRowMetadata == null ? void 0 : setRowMetadata(row);
  27688. }
  27689. };
  27690. const datesInMonth = (date, year, month, lang) => {
  27691. const firstDay = dayjs().locale(lang).startOf("month").month(month).year(year).hour(date.hour()).minute(date.minute()).second(date.second());
  27692. const numOfDays = firstDay.daysInMonth();
  27693. return rangeArr(numOfDays).map((n) => firstDay.add(n, "day").toDate());
  27694. };
  27695. const getValidDateOfMonth = (date, year, month, lang, disabledDate) => {
  27696. const _value = dayjs().year(year).month(month).startOf("month").hour(date.hour()).minute(date.minute()).second(date.second());
  27697. const _date = datesInMonth(date, year, month, lang).find((date2) => {
  27698. return !(disabledDate == null ? void 0 : disabledDate(date2));
  27699. });
  27700. if (_date) {
  27701. return dayjs(_date).locale(lang);
  27702. }
  27703. return _value.locale(lang);
  27704. };
  27705. const getValidDateOfYear = (value, lang, disabledDate) => {
  27706. const year = value.year();
  27707. if (!(disabledDate == null ? void 0 : disabledDate(value.toDate()))) {
  27708. return value.locale(lang);
  27709. }
  27710. const month = value.month();
  27711. if (!datesInMonth(value, year, month, lang).every(disabledDate)) {
  27712. return getValidDateOfMonth(value, year, month, lang, disabledDate);
  27713. }
  27714. for (let i = 0; i < 12; i++) {
  27715. if (!datesInMonth(value, year, i, lang).every(disabledDate)) {
  27716. return getValidDateOfMonth(value, year, i, lang, disabledDate);
  27717. }
  27718. }
  27719. return value;
  27720. };
  27721. const correctlyParseUserInput = (value, format, lang, defaultFormat) => {
  27722. if (isArray$1(value)) {
  27723. return value.map((v) => correctlyParseUserInput(v, format, lang, defaultFormat));
  27724. }
  27725. if (isString$1(value)) {
  27726. const dayjsValue = (defaultFormat == null ? void 0 : defaultFormat.value) ? dayjs(value) : dayjs(value, format);
  27727. if (!dayjsValue.isValid()) {
  27728. return dayjsValue;
  27729. }
  27730. }
  27731. return dayjs(value, format).locale(lang);
  27732. };
  27733. const basicDateTableProps = buildProps({
  27734. ...datePickerSharedProps,
  27735. showWeekNumber: Boolean,
  27736. selectionMode: selectionModeWithDefault("date")
  27737. });
  27738. const basicDateTableEmits = ["changerange", "pick", "select"];
  27739. const isNormalDay = (type = "") => {
  27740. return ["normal", "today"].includes(type);
  27741. };
  27742. const useBasicDateTable = (props, emit) => {
  27743. const { lang } = useLocale();
  27744. const tbodyRef = vue.ref();
  27745. const currentCellRef = vue.ref();
  27746. const lastRow = vue.ref();
  27747. const lastColumn = vue.ref();
  27748. const tableRows = vue.ref([[], [], [], [], [], []]);
  27749. let focusWithClick = false;
  27750. const firstDayOfWeek = props.date.$locale().weekStart || 7;
  27751. const WEEKS_CONSTANT = props.date.locale("en").localeData().weekdaysShort().map((_) => _.toLowerCase());
  27752. const offsetDay = vue.computed(() => {
  27753. return firstDayOfWeek > 3 ? 7 - firstDayOfWeek : -firstDayOfWeek;
  27754. });
  27755. const startDate = vue.computed(() => {
  27756. const startDayOfMonth = props.date.startOf("month");
  27757. return startDayOfMonth.subtract(startDayOfMonth.day() || 7, "day");
  27758. });
  27759. const WEEKS = vue.computed(() => {
  27760. return WEEKS_CONSTANT.concat(WEEKS_CONSTANT).slice(firstDayOfWeek, firstDayOfWeek + 7);
  27761. });
  27762. const hasCurrent = vue.computed(() => {
  27763. return flatten(vue.unref(rows)).some((row) => {
  27764. return row.isCurrent;
  27765. });
  27766. });
  27767. const days = vue.computed(() => {
  27768. const startOfMonth = props.date.startOf("month");
  27769. const startOfMonthDay = startOfMonth.day() || 7;
  27770. const dateCountOfMonth = startOfMonth.daysInMonth();
  27771. const dateCountOfLastMonth = startOfMonth.subtract(1, "month").daysInMonth();
  27772. return {
  27773. startOfMonthDay,
  27774. dateCountOfMonth,
  27775. dateCountOfLastMonth
  27776. };
  27777. });
  27778. const selectedDate = vue.computed(() => {
  27779. return props.selectionMode === "dates" ? castArray(props.parsedValue) : [];
  27780. });
  27781. const setDateText = (cell, { count, rowIndex, columnIndex }) => {
  27782. const { startOfMonthDay, dateCountOfMonth, dateCountOfLastMonth } = vue.unref(days);
  27783. const offset = vue.unref(offsetDay);
  27784. if (rowIndex >= 0 && rowIndex <= 1) {
  27785. const numberOfDaysFromPreviousMonth = startOfMonthDay + offset < 0 ? 7 + startOfMonthDay + offset : startOfMonthDay + offset;
  27786. if (columnIndex + rowIndex * 7 >= numberOfDaysFromPreviousMonth) {
  27787. cell.text = count;
  27788. return true;
  27789. } else {
  27790. cell.text = dateCountOfLastMonth - (numberOfDaysFromPreviousMonth - columnIndex % 7) + 1 + rowIndex * 7;
  27791. cell.type = "prev-month";
  27792. }
  27793. } else {
  27794. if (count <= dateCountOfMonth) {
  27795. cell.text = count;
  27796. } else {
  27797. cell.text = count - dateCountOfMonth;
  27798. cell.type = "next-month";
  27799. }
  27800. return true;
  27801. }
  27802. return false;
  27803. };
  27804. const setCellMetadata = (cell, { columnIndex, rowIndex }, count) => {
  27805. const { disabledDate, cellClassName } = props;
  27806. const _selectedDate = vue.unref(selectedDate);
  27807. const shouldIncrement = setDateText(cell, { count, rowIndex, columnIndex });
  27808. const cellDate = cell.dayjs.toDate();
  27809. cell.selected = _selectedDate.find((d) => d.isSame(cell.dayjs, "day"));
  27810. cell.isSelected = !!cell.selected;
  27811. cell.isCurrent = isCurrent(cell);
  27812. cell.disabled = disabledDate == null ? void 0 : disabledDate(cellDate);
  27813. cell.customClass = cellClassName == null ? void 0 : cellClassName(cellDate);
  27814. return shouldIncrement;
  27815. };
  27816. const setRowMetadata = (row) => {
  27817. if (props.selectionMode === "week") {
  27818. const [start, end] = props.showWeekNumber ? [1, 7] : [0, 6];
  27819. const isActive = isWeekActive(row[start + 1]);
  27820. row[start].inRange = isActive;
  27821. row[start].start = isActive;
  27822. row[end].inRange = isActive;
  27823. row[end].end = isActive;
  27824. }
  27825. };
  27826. const rows = vue.computed(() => {
  27827. const { minDate, maxDate, rangeState, showWeekNumber } = props;
  27828. const offset = vue.unref(offsetDay);
  27829. const rows_ = vue.unref(tableRows);
  27830. const dateUnit = "day";
  27831. let count = 1;
  27832. buildPickerTable({ row: 6, column: 7 }, rows_, {
  27833. startDate: minDate,
  27834. columnIndexOffset: showWeekNumber ? 1 : 0,
  27835. nextEndDate: rangeState.endDate || maxDate || rangeState.selecting && minDate || null,
  27836. now: dayjs().locale(vue.unref(lang)).startOf(dateUnit),
  27837. unit: dateUnit,
  27838. relativeDateGetter: (idx) => vue.unref(startDate).add(idx - offset, dateUnit),
  27839. setCellMetadata: (...args) => {
  27840. if (setCellMetadata(...args, count)) {
  27841. count += 1;
  27842. }
  27843. },
  27844. setRowMetadata
  27845. });
  27846. if (showWeekNumber) {
  27847. for (let rowIndex = 0; rowIndex < 6; rowIndex++) {
  27848. if (rows_[rowIndex][1].dayjs) {
  27849. rows_[rowIndex][0] = {
  27850. type: "week",
  27851. text: rows_[rowIndex][1].dayjs.week()
  27852. };
  27853. }
  27854. }
  27855. }
  27856. return rows_;
  27857. });
  27858. vue.watch(() => props.date, async () => {
  27859. var _a;
  27860. if ((_a = vue.unref(tbodyRef)) == null ? void 0 : _a.contains(document.activeElement)) {
  27861. await vue.nextTick();
  27862. await focus();
  27863. }
  27864. });
  27865. const focus = async () => {
  27866. var _a;
  27867. return (_a = vue.unref(currentCellRef)) == null ? void 0 : _a.focus();
  27868. };
  27869. const isCurrent = (cell) => {
  27870. return props.selectionMode === "date" && isNormalDay(cell.type) && cellMatchesDate(cell, props.parsedValue);
  27871. };
  27872. const cellMatchesDate = (cell, date) => {
  27873. if (!date)
  27874. return false;
  27875. return dayjs(date).locale(vue.unref(lang)).isSame(props.date.date(Number(cell.text)), "day");
  27876. };
  27877. const getDateOfCell = (row, column) => {
  27878. const offsetFromStart = row * 7 + (column - (props.showWeekNumber ? 1 : 0)) - vue.unref(offsetDay);
  27879. return vue.unref(startDate).add(offsetFromStart, "day");
  27880. };
  27881. const handleMouseMove = (event) => {
  27882. var _a;
  27883. if (!props.rangeState.selecting)
  27884. return;
  27885. let target = event.target;
  27886. if (target.tagName === "SPAN") {
  27887. target = (_a = target.parentNode) == null ? void 0 : _a.parentNode;
  27888. }
  27889. if (target.tagName === "DIV") {
  27890. target = target.parentNode;
  27891. }
  27892. if (target.tagName !== "TD")
  27893. return;
  27894. const row = target.parentNode.rowIndex - 1;
  27895. const column = target.cellIndex;
  27896. if (vue.unref(rows)[row][column].disabled)
  27897. return;
  27898. if (row !== vue.unref(lastRow) || column !== vue.unref(lastColumn)) {
  27899. lastRow.value = row;
  27900. lastColumn.value = column;
  27901. emit("changerange", {
  27902. selecting: true,
  27903. endDate: getDateOfCell(row, column)
  27904. });
  27905. }
  27906. };
  27907. const isSelectedCell = (cell) => {
  27908. return !vue.unref(hasCurrent) && (cell == null ? void 0 : cell.text) === 1 && cell.type === "normal" || cell.isCurrent;
  27909. };
  27910. const handleFocus = (event) => {
  27911. if (focusWithClick || vue.unref(hasCurrent) || props.selectionMode !== "date")
  27912. return;
  27913. handlePickDate(event, true);
  27914. };
  27915. const handleMouseDown = (event) => {
  27916. const target = event.target.closest("td");
  27917. if (!target)
  27918. return;
  27919. focusWithClick = true;
  27920. };
  27921. const handleMouseUp = (event) => {
  27922. const target = event.target.closest("td");
  27923. if (!target)
  27924. return;
  27925. focusWithClick = false;
  27926. };
  27927. const handleRangePick = (newDate) => {
  27928. if (!props.rangeState.selecting || !props.minDate) {
  27929. emit("pick", { minDate: newDate, maxDate: null });
  27930. emit("select", true);
  27931. } else {
  27932. if (newDate >= props.minDate) {
  27933. emit("pick", { minDate: props.minDate, maxDate: newDate });
  27934. } else {
  27935. emit("pick", { minDate: newDate, maxDate: props.minDate });
  27936. }
  27937. emit("select", false);
  27938. }
  27939. };
  27940. const handleWeekPick = (newDate) => {
  27941. const weekNumber = newDate.week();
  27942. const value = `${newDate.year()}w${weekNumber}`;
  27943. emit("pick", {
  27944. year: newDate.year(),
  27945. week: weekNumber,
  27946. value,
  27947. date: newDate.startOf("week")
  27948. });
  27949. };
  27950. const handleDatesPick = (newDate, selected) => {
  27951. const newValue = selected ? castArray(props.parsedValue).filter((d) => (d == null ? void 0 : d.valueOf()) !== newDate.valueOf()) : castArray(props.parsedValue).concat([newDate]);
  27952. emit("pick", newValue);
  27953. };
  27954. const handlePickDate = (event, isKeyboardMovement = false) => {
  27955. if (props.disabled)
  27956. return;
  27957. const target = event.target.closest("td");
  27958. if (!target)
  27959. return;
  27960. const row = target.parentNode.rowIndex - 1;
  27961. const column = target.cellIndex;
  27962. const cell = vue.unref(rows)[row][column];
  27963. if (cell.disabled || cell.type === "week")
  27964. return;
  27965. const newDate = getDateOfCell(row, column);
  27966. switch (props.selectionMode) {
  27967. case "range": {
  27968. handleRangePick(newDate);
  27969. break;
  27970. }
  27971. case "date": {
  27972. emit("pick", newDate, isKeyboardMovement);
  27973. break;
  27974. }
  27975. case "week": {
  27976. handleWeekPick(newDate);
  27977. break;
  27978. }
  27979. case "dates": {
  27980. handleDatesPick(newDate, !!cell.selected);
  27981. break;
  27982. }
  27983. }
  27984. };
  27985. const isWeekActive = (cell) => {
  27986. if (props.selectionMode !== "week")
  27987. return false;
  27988. let newDate = props.date.startOf("day");
  27989. if (cell.type === "prev-month") {
  27990. newDate = newDate.subtract(1, "month");
  27991. }
  27992. if (cell.type === "next-month") {
  27993. newDate = newDate.add(1, "month");
  27994. }
  27995. newDate = newDate.date(Number.parseInt(cell.text, 10));
  27996. if (props.parsedValue && !isArray$1(props.parsedValue)) {
  27997. const dayOffset = (props.parsedValue.day() - firstDayOfWeek + 7) % 7 - 1;
  27998. const weekDate = props.parsedValue.subtract(dayOffset, "day");
  27999. return weekDate.isSame(newDate, "day");
  28000. }
  28001. return false;
  28002. };
  28003. return {
  28004. WEEKS,
  28005. rows,
  28006. tbodyRef,
  28007. currentCellRef,
  28008. focus,
  28009. isCurrent,
  28010. isWeekActive,
  28011. isSelectedCell,
  28012. handlePickDate,
  28013. handleMouseUp,
  28014. handleMouseDown,
  28015. handleMouseMove,
  28016. handleFocus
  28017. };
  28018. };
  28019. const useBasicDateTableDOM = (props, {
  28020. isCurrent,
  28021. isWeekActive
  28022. }) => {
  28023. const ns = useNamespace("date-table");
  28024. const { t } = useLocale();
  28025. const tableKls = vue.computed(() => [
  28026. ns.b(),
  28027. ns.is("week-mode", props.selectionMode === "week" && !props.disabled)
  28028. ]);
  28029. const tableLabel = vue.computed(() => t("el.datepicker.dateTablePrompt"));
  28030. const getCellClasses = (cell) => {
  28031. const classes = [];
  28032. if (isNormalDay(cell.type) && !cell.disabled) {
  28033. classes.push("available");
  28034. if (cell.type === "today") {
  28035. classes.push("today");
  28036. }
  28037. } else {
  28038. classes.push(cell.type);
  28039. }
  28040. if (isCurrent(cell)) {
  28041. classes.push("current");
  28042. }
  28043. if (cell.inRange && (isNormalDay(cell.type) || props.selectionMode === "week")) {
  28044. classes.push("in-range");
  28045. if (cell.start) {
  28046. classes.push("start-date");
  28047. }
  28048. if (cell.end) {
  28049. classes.push("end-date");
  28050. }
  28051. }
  28052. if (cell.disabled || props.disabled) {
  28053. classes.push("disabled");
  28054. }
  28055. if (cell.selected) {
  28056. classes.push("selected");
  28057. }
  28058. if (cell.customClass) {
  28059. classes.push(cell.customClass);
  28060. }
  28061. return classes.join(" ");
  28062. };
  28063. const getRowKls = (cell) => [
  28064. ns.e("row"),
  28065. { current: isWeekActive(cell) }
  28066. ];
  28067. return {
  28068. tableKls,
  28069. tableLabel,
  28070. weekHeaderClass: ns.e("week-header"),
  28071. getCellClasses,
  28072. getRowKls,
  28073. t
  28074. };
  28075. };
  28076. const basicCellProps = buildProps({
  28077. cell: {
  28078. type: definePropType(Object)
  28079. }
  28080. });
  28081. var ElDatePickerCell = vue.defineComponent({
  28082. name: "ElDatePickerCell",
  28083. props: basicCellProps,
  28084. setup(props) {
  28085. const ns = useNamespace("date-table-cell");
  28086. const {
  28087. slots
  28088. } = vue.inject(ROOT_PICKER_INJECTION_KEY);
  28089. return () => {
  28090. const {
  28091. cell
  28092. } = props;
  28093. return vue.renderSlot(slots, "default", {
  28094. ...cell
  28095. }, () => {
  28096. var _a;
  28097. return [vue.createVNode("div", {
  28098. "class": ns.b()
  28099. }, [vue.createVNode("span", {
  28100. "class": ns.e("text")
  28101. }, [(_a = cell == null ? void 0 : cell.renderText) != null ? _a : cell == null ? void 0 : cell.text])])];
  28102. });
  28103. };
  28104. }
  28105. });
  28106. const _sfc_main$1v = /* @__PURE__ */ vue.defineComponent({
  28107. __name: "basic-date-table",
  28108. props: basicDateTableProps,
  28109. emits: basicDateTableEmits,
  28110. setup(__props, { expose, emit }) {
  28111. const props = __props;
  28112. const {
  28113. WEEKS,
  28114. rows,
  28115. tbodyRef,
  28116. currentCellRef,
  28117. focus,
  28118. isCurrent,
  28119. isWeekActive,
  28120. isSelectedCell,
  28121. handlePickDate,
  28122. handleMouseUp,
  28123. handleMouseDown,
  28124. handleMouseMove,
  28125. handleFocus
  28126. } = useBasicDateTable(props, emit);
  28127. const { tableLabel, tableKls, getCellClasses, getRowKls, weekHeaderClass, t } = useBasicDateTableDOM(props, {
  28128. isCurrent,
  28129. isWeekActive
  28130. });
  28131. let isUnmounting = false;
  28132. vue.onBeforeUnmount(() => {
  28133. isUnmounting = true;
  28134. });
  28135. expose({
  28136. focus
  28137. });
  28138. return (_ctx, _cache) => {
  28139. return vue.openBlock(), vue.createElementBlock("table", {
  28140. "aria-label": vue.unref(tableLabel),
  28141. class: vue.normalizeClass(vue.unref(tableKls)),
  28142. cellspacing: "0",
  28143. cellpadding: "0",
  28144. role: "grid",
  28145. onClick: vue.unref(handlePickDate),
  28146. onMousemove: vue.unref(handleMouseMove),
  28147. onMousedown: vue.unref(handleMouseDown),
  28148. onMouseup: vue.unref(handleMouseUp)
  28149. }, [
  28150. vue.createElementVNode("tbody", {
  28151. ref_key: "tbodyRef",
  28152. ref: tbodyRef
  28153. }, [
  28154. vue.createElementVNode("tr", null, [
  28155. _ctx.showWeekNumber ? (vue.openBlock(), vue.createElementBlock("th", {
  28156. key: 0,
  28157. scope: "col",
  28158. class: vue.normalizeClass(vue.unref(weekHeaderClass))
  28159. }, null, 2)) : vue.createCommentVNode("v-if", true),
  28160. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(WEEKS), (week, key) => {
  28161. return vue.openBlock(), vue.createElementBlock("th", {
  28162. key,
  28163. "aria-label": vue.unref(t)("el.datepicker.weeksFull." + week),
  28164. scope: "col"
  28165. }, vue.toDisplayString(vue.unref(t)("el.datepicker.weeks." + week)), 9, ["aria-label"]);
  28166. }), 128))
  28167. ]),
  28168. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(rows), (row, rowKey) => {
  28169. return vue.openBlock(), vue.createElementBlock("tr", {
  28170. key: rowKey,
  28171. class: vue.normalizeClass(vue.unref(getRowKls)(_ctx.showWeekNumber ? row[2] : row[1]))
  28172. }, [
  28173. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(row, (cell, columnKey) => {
  28174. return vue.openBlock(), vue.createElementBlock("td", {
  28175. key: `${rowKey}.${columnKey}`,
  28176. ref_for: true,
  28177. ref: (el) => !vue.unref(isUnmounting) && vue.unref(isSelectedCell)(cell) && (currentCellRef.value = el),
  28178. class: vue.normalizeClass(vue.unref(getCellClasses)(cell)),
  28179. "aria-current": cell.isCurrent ? "date" : void 0,
  28180. "aria-selected": cell.isCurrent,
  28181. tabindex: vue.unref(isSelectedCell)(cell) ? 0 : -1,
  28182. onFocus: vue.unref(handleFocus)
  28183. }, [
  28184. vue.createVNode(vue.unref(ElDatePickerCell), { cell }, null, 8, ["cell"])
  28185. ], 42, ["aria-current", "aria-selected", "tabindex", "onFocus"]);
  28186. }), 128))
  28187. ], 2);
  28188. }), 128))
  28189. ], 512)
  28190. ], 42, ["aria-label", "onClick", "onMousemove", "onMousedown", "onMouseup"]);
  28191. };
  28192. }
  28193. });
  28194. var DateTable = /* @__PURE__ */ _export_sfc(_sfc_main$1v, [["__file", "basic-date-table.vue"]]);
  28195. const basicMonthTableProps = buildProps({
  28196. ...datePickerSharedProps,
  28197. selectionMode: selectionModeWithDefault("month")
  28198. });
  28199. const _sfc_main$1u = /* @__PURE__ */ vue.defineComponent({
  28200. __name: "basic-month-table",
  28201. props: basicMonthTableProps,
  28202. emits: ["changerange", "pick", "select"],
  28203. setup(__props, { expose, emit }) {
  28204. const props = __props;
  28205. const ns = useNamespace("month-table");
  28206. const { t, lang } = useLocale();
  28207. const tbodyRef = vue.ref();
  28208. const currentCellRef = vue.ref();
  28209. const months = vue.ref(props.date.locale("en").localeData().monthsShort().map((_) => _.toLowerCase()));
  28210. const tableRows = vue.ref([[], [], []]);
  28211. const lastRow = vue.ref();
  28212. const lastColumn = vue.ref();
  28213. const rows = vue.computed(() => {
  28214. var _a, _b, _c;
  28215. const rows2 = tableRows.value;
  28216. const now = dayjs().locale(lang.value).startOf("month");
  28217. for (let i = 0; i < 3; i++) {
  28218. const row = rows2[i];
  28219. for (let j = 0; j < 4; j++) {
  28220. const cell = row[j] || (row[j] = {
  28221. row: i,
  28222. column: j,
  28223. type: "normal",
  28224. inRange: false,
  28225. start: false,
  28226. end: false,
  28227. text: -1,
  28228. disabled: false,
  28229. isSelected: false,
  28230. customClass: void 0,
  28231. date: void 0,
  28232. dayjs: void 0,
  28233. isCurrent: void 0,
  28234. selected: void 0,
  28235. renderText: void 0,
  28236. timestamp: void 0
  28237. });
  28238. cell.type = "normal";
  28239. const index = i * 4 + j;
  28240. const calTime = props.date.startOf("year").month(index);
  28241. const calEndDate = props.rangeState.endDate || props.maxDate || props.rangeState.selecting && props.minDate || null;
  28242. 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"));
  28243. if ((_a = props.minDate) == null ? void 0 : _a.isSameOrAfter(calEndDate)) {
  28244. cell.start = !!(calEndDate && calTime.isSame(calEndDate, "month"));
  28245. cell.end = props.minDate && calTime.isSame(props.minDate, "month");
  28246. } else {
  28247. cell.start = !!(props.minDate && calTime.isSame(props.minDate, "month"));
  28248. cell.end = !!(calEndDate && calTime.isSame(calEndDate, "month"));
  28249. }
  28250. const isToday = now.isSame(calTime);
  28251. if (isToday) {
  28252. cell.type = "today";
  28253. }
  28254. const cellDate = calTime.toDate();
  28255. cell.text = index;
  28256. cell.disabled = ((_b = props.disabledDate) == null ? void 0 : _b.call(props, cellDate)) || false;
  28257. cell.date = cellDate;
  28258. cell.customClass = (_c = props.cellClassName) == null ? void 0 : _c.call(props, cellDate);
  28259. cell.dayjs = calTime;
  28260. cell.timestamp = calTime.valueOf();
  28261. cell.isSelected = isSelectedCell(cell);
  28262. }
  28263. }
  28264. return rows2;
  28265. });
  28266. const focus = () => {
  28267. var _a;
  28268. (_a = currentCellRef.value) == null ? void 0 : _a.focus();
  28269. };
  28270. const getCellStyle = (cell) => {
  28271. const style = {};
  28272. const year = props.date.year();
  28273. const today = /* @__PURE__ */ new Date();
  28274. const month = cell.text;
  28275. style.disabled = props.disabled || (props.disabledDate ? datesInMonth(props.date, year, month, lang.value).every(props.disabledDate) : false);
  28276. style.current = castArray(props.parsedValue).some((date) => dayjs.isDayjs(date) && date.year() === year && date.month() === month);
  28277. style.today = today.getFullYear() === year && today.getMonth() === month;
  28278. if (cell.customClass) {
  28279. style[cell.customClass] = true;
  28280. }
  28281. if (cell.inRange) {
  28282. style["in-range"] = true;
  28283. if (cell.start) {
  28284. style["start-date"] = true;
  28285. }
  28286. if (cell.end) {
  28287. style["end-date"] = true;
  28288. }
  28289. }
  28290. return style;
  28291. };
  28292. const isSelectedCell = (cell) => {
  28293. const year = props.date.year();
  28294. const month = cell.text;
  28295. return castArray(props.date).some((date) => date.year() === year && date.month() === month);
  28296. };
  28297. const handleMouseMove = (event) => {
  28298. var _a;
  28299. if (!props.rangeState.selecting)
  28300. return;
  28301. let target = event.target;
  28302. if (target.tagName === "SPAN") {
  28303. target = (_a = target.parentNode) == null ? void 0 : _a.parentNode;
  28304. }
  28305. if (target.tagName === "DIV") {
  28306. target = target.parentNode;
  28307. }
  28308. if (target.tagName !== "TD")
  28309. return;
  28310. const row = target.parentNode.rowIndex;
  28311. const column = target.cellIndex;
  28312. if (rows.value[row][column].disabled)
  28313. return;
  28314. if (row !== lastRow.value || column !== lastColumn.value) {
  28315. lastRow.value = row;
  28316. lastColumn.value = column;
  28317. emit("changerange", {
  28318. selecting: true,
  28319. endDate: props.date.startOf("year").month(row * 4 + column)
  28320. });
  28321. }
  28322. };
  28323. const handleMonthTableClick = (event) => {
  28324. var _a;
  28325. if (props.disabled)
  28326. return;
  28327. const target = (_a = event.target) == null ? void 0 : _a.closest("td");
  28328. if ((target == null ? void 0 : target.tagName) !== "TD")
  28329. return;
  28330. if (hasClass(target, "disabled"))
  28331. return;
  28332. const column = target.cellIndex;
  28333. const row = target.parentNode.rowIndex;
  28334. const month = row * 4 + column;
  28335. const newDate = props.date.startOf("year").month(month);
  28336. if (props.selectionMode === "months") {
  28337. if (event.type === "keydown") {
  28338. emit("pick", castArray(props.parsedValue), false);
  28339. return;
  28340. }
  28341. const newMonth = getValidDateOfMonth(props.date, props.date.year(), month, lang.value, props.disabledDate);
  28342. const newValue = hasClass(target, "current") ? castArray(props.parsedValue).filter((d) => (d == null ? void 0 : d.year()) !== newMonth.year() || (d == null ? void 0 : d.month()) !== newMonth.month()) : castArray(props.parsedValue).concat([dayjs(newMonth)]);
  28343. emit("pick", newValue);
  28344. } else if (props.selectionMode === "range") {
  28345. if (!props.rangeState.selecting) {
  28346. emit("pick", { minDate: newDate, maxDate: null });
  28347. emit("select", true);
  28348. } else {
  28349. if (props.minDate && newDate >= props.minDate) {
  28350. emit("pick", { minDate: props.minDate, maxDate: newDate });
  28351. } else {
  28352. emit("pick", { minDate: newDate, maxDate: props.minDate });
  28353. }
  28354. emit("select", false);
  28355. }
  28356. } else {
  28357. emit("pick", month);
  28358. }
  28359. };
  28360. vue.watch(() => props.date, async () => {
  28361. var _a, _b;
  28362. if ((_a = tbodyRef.value) == null ? void 0 : _a.contains(document.activeElement)) {
  28363. await vue.nextTick();
  28364. (_b = currentCellRef.value) == null ? void 0 : _b.focus();
  28365. }
  28366. });
  28367. expose({
  28368. focus
  28369. });
  28370. return (_ctx, _cache) => {
  28371. return vue.openBlock(), vue.createElementBlock("table", {
  28372. role: "grid",
  28373. "aria-label": vue.unref(t)("el.datepicker.monthTablePrompt"),
  28374. class: vue.normalizeClass(vue.unref(ns).b()),
  28375. onClick: handleMonthTableClick,
  28376. onMousemove: handleMouseMove
  28377. }, [
  28378. vue.createElementVNode("tbody", {
  28379. ref_key: "tbodyRef",
  28380. ref: tbodyRef
  28381. }, [
  28382. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(rows), (row, key) => {
  28383. return vue.openBlock(), vue.createElementBlock("tr", { key }, [
  28384. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(row, (cell, key_) => {
  28385. return vue.openBlock(), vue.createElementBlock("td", {
  28386. key: key_,
  28387. ref_for: true,
  28388. ref: (el) => cell.isSelected && (currentCellRef.value = el),
  28389. class: vue.normalizeClass(getCellStyle(cell)),
  28390. "aria-selected": !!cell.isSelected,
  28391. "aria-label": vue.unref(t)(`el.datepicker.month${+cell.text + 1}`),
  28392. tabindex: cell.isSelected ? 0 : -1,
  28393. onKeydown: [
  28394. vue.withKeys(vue.withModifiers(handleMonthTableClick, ["prevent", "stop"]), ["space"]),
  28395. vue.withKeys(vue.withModifiers(handleMonthTableClick, ["prevent", "stop"]), ["enter"])
  28396. ]
  28397. }, [
  28398. vue.createVNode(vue.unref(ElDatePickerCell), {
  28399. cell: {
  28400. ...cell,
  28401. renderText: vue.unref(t)("el.datepicker.months." + months.value[cell.text])
  28402. }
  28403. }, null, 8, ["cell"])
  28404. ], 42, ["aria-selected", "aria-label", "tabindex", "onKeydown"]);
  28405. }), 128))
  28406. ]);
  28407. }), 128))
  28408. ], 512)
  28409. ], 42, ["aria-label"]);
  28410. };
  28411. }
  28412. });
  28413. var MonthTable = /* @__PURE__ */ _export_sfc(_sfc_main$1u, [["__file", "basic-month-table.vue"]]);
  28414. const basicYearTableProps = buildProps({
  28415. ...datePickerSharedProps,
  28416. selectionMode: selectionModeWithDefault("year")
  28417. });
  28418. const _sfc_main$1t = /* @__PURE__ */ vue.defineComponent({
  28419. __name: "basic-year-table",
  28420. props: basicYearTableProps,
  28421. emits: ["changerange", "pick", "select"],
  28422. setup(__props, { expose, emit }) {
  28423. const props = __props;
  28424. const datesInYear = (year, lang2) => {
  28425. const firstDay = dayjs(String(year)).locale(lang2).startOf("year");
  28426. const lastDay = firstDay.endOf("year");
  28427. const numOfDays = lastDay.dayOfYear();
  28428. return rangeArr(numOfDays).map((n) => firstDay.add(n, "day").toDate());
  28429. };
  28430. const ns = useNamespace("year-table");
  28431. const { t, lang } = useLocale();
  28432. const tbodyRef = vue.ref();
  28433. const currentCellRef = vue.ref();
  28434. const startYear = vue.computed(() => {
  28435. return Math.floor(props.date.year() / 10) * 10;
  28436. });
  28437. const tableRows = vue.ref([[], [], []]);
  28438. const lastRow = vue.ref();
  28439. const lastColumn = vue.ref();
  28440. const rows = vue.computed(() => {
  28441. var _a, _b, _c;
  28442. const rows2 = tableRows.value;
  28443. const now = dayjs().locale(lang.value).startOf("year");
  28444. for (let i = 0; i < 3; i++) {
  28445. const row = rows2[i];
  28446. for (let j = 0; j < 4; j++) {
  28447. if (i * 4 + j >= 10) {
  28448. break;
  28449. }
  28450. let cell = row[j];
  28451. if (!cell) {
  28452. cell = {
  28453. row: i,
  28454. column: j,
  28455. type: "normal",
  28456. inRange: false,
  28457. start: false,
  28458. end: false,
  28459. text: -1,
  28460. disabled: false,
  28461. isSelected: false,
  28462. customClass: void 0,
  28463. date: void 0,
  28464. dayjs: void 0,
  28465. isCurrent: void 0,
  28466. selected: void 0,
  28467. renderText: void 0,
  28468. timestamp: void 0
  28469. };
  28470. }
  28471. cell.type = "normal";
  28472. const index = i * 4 + j + startYear.value;
  28473. const calTime = dayjs().year(index);
  28474. const calEndDate = props.rangeState.endDate || props.maxDate || props.rangeState.selecting && props.minDate || null;
  28475. 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"));
  28476. if ((_a = props.minDate) == null ? void 0 : _a.isSameOrAfter(calEndDate)) {
  28477. cell.start = !!(calEndDate && calTime.isSame(calEndDate, "year"));
  28478. cell.end = !!(props.minDate && calTime.isSame(props.minDate, "year"));
  28479. } else {
  28480. cell.start = !!(props.minDate && calTime.isSame(props.minDate, "year"));
  28481. cell.end = !!(calEndDate && calTime.isSame(calEndDate, "year"));
  28482. }
  28483. const isToday = now.isSame(calTime);
  28484. if (isToday) {
  28485. cell.type = "today";
  28486. }
  28487. cell.text = index;
  28488. const cellDate = calTime.toDate();
  28489. cell.disabled = ((_b = props.disabledDate) == null ? void 0 : _b.call(props, cellDate)) || false;
  28490. cell.date = cellDate;
  28491. cell.customClass = (_c = props.cellClassName) == null ? void 0 : _c.call(props, cellDate);
  28492. cell.dayjs = calTime;
  28493. cell.timestamp = calTime.valueOf();
  28494. cell.isSelected = isSelectedCell(cell);
  28495. row[j] = cell;
  28496. }
  28497. }
  28498. return rows2;
  28499. });
  28500. const focus = () => {
  28501. var _a;
  28502. (_a = currentCellRef.value) == null ? void 0 : _a.focus();
  28503. };
  28504. const getCellKls = (cell) => {
  28505. const kls = {};
  28506. const today = dayjs().locale(lang.value);
  28507. const year = cell.text;
  28508. kls.disabled = props.disabled || (props.disabledDate ? datesInYear(year, lang.value).every(props.disabledDate) : false);
  28509. kls.today = today.year() === year;
  28510. kls.current = castArray(props.parsedValue).some((d) => d.year() === year);
  28511. if (cell.customClass) {
  28512. kls[cell.customClass] = true;
  28513. }
  28514. if (cell.inRange) {
  28515. kls["in-range"] = true;
  28516. if (cell.start) {
  28517. kls["start-date"] = true;
  28518. }
  28519. if (cell.end) {
  28520. kls["end-date"] = true;
  28521. }
  28522. }
  28523. return kls;
  28524. };
  28525. const isSelectedCell = (cell) => {
  28526. const year = cell.text;
  28527. return castArray(props.date).some((date) => date.year() === year);
  28528. };
  28529. const handleYearTableClick = (event) => {
  28530. var _a;
  28531. if (props.disabled)
  28532. return;
  28533. const target = (_a = event.target) == null ? void 0 : _a.closest("td");
  28534. if (!target || !target.textContent || hasClass(target, "disabled"))
  28535. return;
  28536. const column = target.cellIndex;
  28537. const row = target.parentNode.rowIndex;
  28538. const selectedYear = row * 4 + column + startYear.value;
  28539. const newDate = dayjs().year(selectedYear);
  28540. if (props.selectionMode === "range") {
  28541. if (!props.rangeState.selecting) {
  28542. emit("pick", { minDate: newDate, maxDate: null });
  28543. emit("select", true);
  28544. } else {
  28545. if (props.minDate && newDate >= props.minDate) {
  28546. emit("pick", { minDate: props.minDate, maxDate: newDate });
  28547. } else {
  28548. emit("pick", { minDate: newDate, maxDate: props.minDate });
  28549. }
  28550. emit("select", false);
  28551. }
  28552. } else if (props.selectionMode === "years") {
  28553. if (event.type === "keydown") {
  28554. emit("pick", castArray(props.parsedValue), false);
  28555. return;
  28556. }
  28557. const vaildYear = getValidDateOfYear(newDate.startOf("year"), lang.value, props.disabledDate);
  28558. const newValue = hasClass(target, "current") ? castArray(props.parsedValue).filter((d) => (d == null ? void 0 : d.year()) !== selectedYear) : castArray(props.parsedValue).concat([vaildYear]);
  28559. emit("pick", newValue);
  28560. } else {
  28561. emit("pick", selectedYear);
  28562. }
  28563. };
  28564. const handleMouseMove = (event) => {
  28565. var _a;
  28566. if (!props.rangeState.selecting)
  28567. return;
  28568. const target = (_a = event.target) == null ? void 0 : _a.closest("td");
  28569. if (!target)
  28570. return;
  28571. const row = target.parentNode.rowIndex;
  28572. const column = target.cellIndex;
  28573. if (rows.value[row][column].disabled)
  28574. return;
  28575. if (row !== lastRow.value || column !== lastColumn.value) {
  28576. lastRow.value = row;
  28577. lastColumn.value = column;
  28578. emit("changerange", {
  28579. selecting: true,
  28580. endDate: dayjs().year(startYear.value).add(row * 4 + column, "year")
  28581. });
  28582. }
  28583. };
  28584. vue.watch(() => props.date, async () => {
  28585. var _a, _b;
  28586. if ((_a = tbodyRef.value) == null ? void 0 : _a.contains(document.activeElement)) {
  28587. await vue.nextTick();
  28588. (_b = currentCellRef.value) == null ? void 0 : _b.focus();
  28589. }
  28590. });
  28591. expose({
  28592. focus
  28593. });
  28594. return (_ctx, _cache) => {
  28595. return vue.openBlock(), vue.createElementBlock("table", {
  28596. role: "grid",
  28597. "aria-label": vue.unref(t)("el.datepicker.yearTablePrompt"),
  28598. class: vue.normalizeClass(vue.unref(ns).b()),
  28599. onClick: handleYearTableClick,
  28600. onMousemove: handleMouseMove
  28601. }, [
  28602. vue.createElementVNode("tbody", {
  28603. ref_key: "tbodyRef",
  28604. ref: tbodyRef
  28605. }, [
  28606. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(rows), (row, rowKey) => {
  28607. return vue.openBlock(), vue.createElementBlock("tr", { key: rowKey }, [
  28608. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(row, (cell, cellKey) => {
  28609. return vue.openBlock(), vue.createElementBlock("td", {
  28610. key: `${rowKey}_${cellKey}`,
  28611. ref_for: true,
  28612. ref: (el) => cell.isSelected && (currentCellRef.value = el),
  28613. class: vue.normalizeClass(["available", getCellKls(cell)]),
  28614. "aria-selected": cell.isSelected,
  28615. "aria-label": String(cell.text),
  28616. tabindex: cell.isSelected ? 0 : -1,
  28617. onKeydown: [
  28618. vue.withKeys(vue.withModifiers(handleYearTableClick, ["prevent", "stop"]), ["space"]),
  28619. vue.withKeys(vue.withModifiers(handleYearTableClick, ["prevent", "stop"]), ["enter"])
  28620. ]
  28621. }, [
  28622. vue.createVNode(vue.unref(ElDatePickerCell), { cell }, null, 8, ["cell"])
  28623. ], 42, ["aria-selected", "aria-label", "tabindex", "onKeydown"]);
  28624. }), 128))
  28625. ]);
  28626. }), 128))
  28627. ], 512)
  28628. ], 42, ["aria-label"]);
  28629. };
  28630. }
  28631. });
  28632. var YearTable = /* @__PURE__ */ _export_sfc(_sfc_main$1t, [["__file", "basic-year-table.vue"]]);
  28633. const _sfc_main$1s = /* @__PURE__ */ vue.defineComponent({
  28634. __name: "panel-date-pick",
  28635. props: panelDatePickProps,
  28636. emits: ["pick", "set-picker-option", "panel-change"],
  28637. setup(__props, { emit: contextEmit }) {
  28638. const props = __props;
  28639. const timeWithinRange = (_, __, ___) => true;
  28640. const ppNs = useNamespace("picker-panel");
  28641. const dpNs = useNamespace("date-picker");
  28642. const attrs = vue.useAttrs();
  28643. const slots = vue.useSlots();
  28644. const { t, lang } = useLocale();
  28645. const pickerBase = vue.inject(PICKER_BASE_INJECTION_KEY);
  28646. const isDefaultFormat = vue.inject(ROOT_PICKER_IS_DEFAULT_FORMAT_INJECTION_KEY, void 0);
  28647. const { shortcuts, disabledDate, cellClassName, defaultTime } = pickerBase.props;
  28648. const defaultValue = vue.toRef(pickerBase.props, "defaultValue");
  28649. const currentViewRef = vue.ref();
  28650. const innerDate = vue.ref(dayjs().locale(lang.value));
  28651. const isChangeToNow = vue.ref(false);
  28652. let isShortcut = false;
  28653. const defaultTimeD = vue.computed(() => {
  28654. return dayjs(defaultTime).locale(lang.value);
  28655. });
  28656. const month = vue.computed(() => {
  28657. return innerDate.value.month();
  28658. });
  28659. const year = vue.computed(() => {
  28660. return innerDate.value.year();
  28661. });
  28662. const selectableRange = vue.ref([]);
  28663. const userInputDate = vue.ref(null);
  28664. const userInputTime = vue.ref(null);
  28665. const checkDateWithinRange = (date) => {
  28666. return selectableRange.value.length > 0 ? timeWithinRange(date, selectableRange.value, props.format || "HH:mm:ss") : true;
  28667. };
  28668. const formatEmit = (emitDayjs) => {
  28669. if (defaultTime && !visibleTime.value && !isChangeToNow.value && !isShortcut) {
  28670. return defaultTimeD.value.year(emitDayjs.year()).month(emitDayjs.month()).date(emitDayjs.date());
  28671. }
  28672. if (showTime.value)
  28673. return emitDayjs.millisecond(0);
  28674. return emitDayjs.startOf("day");
  28675. };
  28676. const emit = (value, ...args) => {
  28677. if (!value) {
  28678. contextEmit("pick", value, ...args);
  28679. } else if (isArray$1(value)) {
  28680. const dates = value.map(formatEmit);
  28681. contextEmit("pick", dates, ...args);
  28682. } else {
  28683. contextEmit("pick", formatEmit(value), ...args);
  28684. }
  28685. userInputDate.value = null;
  28686. userInputTime.value = null;
  28687. isChangeToNow.value = false;
  28688. isShortcut = false;
  28689. };
  28690. const handleDatePick = async (value, keepOpen) => {
  28691. if (selectionMode.value === "date" && dayjs.isDayjs(value)) {
  28692. const parsedDateValue = extractFirst(props.parsedValue);
  28693. let newDate = parsedDateValue ? parsedDateValue.year(value.year()).month(value.month()).date(value.date()) : value;
  28694. if (!checkDateWithinRange(newDate)) {
  28695. newDate = selectableRange.value[0][0].year(value.year()).month(value.month()).date(value.date());
  28696. }
  28697. innerDate.value = newDate;
  28698. emit(newDate, showTime.value || keepOpen);
  28699. } else if (selectionMode.value === "week") {
  28700. emit(value.date);
  28701. } else if (selectionMode.value === "dates") {
  28702. emit(value, true);
  28703. }
  28704. };
  28705. const moveByMonth = (forward) => {
  28706. const action = forward ? "add" : "subtract";
  28707. innerDate.value = innerDate.value[action](1, "month");
  28708. handlePanelChange("month");
  28709. };
  28710. const moveByYear = (forward) => {
  28711. const currentDate = innerDate.value;
  28712. const action = forward ? "add" : "subtract";
  28713. innerDate.value = currentView.value === "year" ? currentDate[action](10, "year") : currentDate[action](1, "year");
  28714. handlePanelChange("year");
  28715. };
  28716. const currentView = vue.ref("date");
  28717. const yearLabel = vue.computed(() => {
  28718. const yearTranslation = t("el.datepicker.year");
  28719. if (currentView.value === "year") {
  28720. const startYear = Math.floor(year.value / 10) * 10;
  28721. if (yearTranslation) {
  28722. return `${startYear} ${yearTranslation} - ${startYear + 9} ${yearTranslation}`;
  28723. }
  28724. return `${startYear} - ${startYear + 9}`;
  28725. }
  28726. return `${year.value} ${yearTranslation}`;
  28727. });
  28728. const handleShortcutClick = (shortcut) => {
  28729. const shortcutValue = isFunction$1(shortcut.value) ? shortcut.value() : shortcut.value;
  28730. if (shortcutValue) {
  28731. isShortcut = true;
  28732. emit(dayjs(shortcutValue).locale(lang.value));
  28733. return;
  28734. }
  28735. if (shortcut.onClick) {
  28736. shortcut.onClick({
  28737. attrs,
  28738. slots,
  28739. emit: contextEmit
  28740. });
  28741. }
  28742. };
  28743. const selectionMode = vue.computed(() => {
  28744. const { type } = props;
  28745. if (["week", "month", "months", "year", "years", "dates"].includes(type))
  28746. return type;
  28747. return "date";
  28748. });
  28749. const isMultipleType = vue.computed(() => {
  28750. return selectionMode.value === "dates" || selectionMode.value === "months" || selectionMode.value === "years";
  28751. });
  28752. const keyboardMode = vue.computed(() => {
  28753. return selectionMode.value === "date" ? currentView.value : selectionMode.value;
  28754. });
  28755. const hasShortcuts = vue.computed(() => !!shortcuts.length);
  28756. const handleMonthPick = async (month2, keepOpen) => {
  28757. if (selectionMode.value === "month") {
  28758. innerDate.value = getValidDateOfMonth(innerDate.value, innerDate.value.year(), month2, lang.value, disabledDate);
  28759. emit(innerDate.value, false);
  28760. } else if (selectionMode.value === "months") {
  28761. emit(month2, keepOpen != null ? keepOpen : true);
  28762. } else {
  28763. innerDate.value = getValidDateOfMonth(innerDate.value, innerDate.value.year(), month2, lang.value, disabledDate);
  28764. currentView.value = "date";
  28765. if (["month", "year", "date", "week"].includes(selectionMode.value)) {
  28766. emit(innerDate.value, true);
  28767. await vue.nextTick();
  28768. handleFocusPicker();
  28769. }
  28770. }
  28771. handlePanelChange("month");
  28772. };
  28773. const handleYearPick = async (year2, keepOpen) => {
  28774. if (selectionMode.value === "year") {
  28775. const data = innerDate.value.startOf("year").year(year2);
  28776. innerDate.value = getValidDateOfYear(data, lang.value, disabledDate);
  28777. emit(innerDate.value, false);
  28778. } else if (selectionMode.value === "years") {
  28779. emit(year2, keepOpen != null ? keepOpen : true);
  28780. } else {
  28781. const data = innerDate.value.year(year2);
  28782. innerDate.value = getValidDateOfYear(data, lang.value, disabledDate);
  28783. currentView.value = "month";
  28784. if (["month", "year", "date", "week"].includes(selectionMode.value)) {
  28785. emit(innerDate.value, true);
  28786. await vue.nextTick();
  28787. handleFocusPicker();
  28788. }
  28789. }
  28790. handlePanelChange("year");
  28791. };
  28792. const showPicker = async (view) => {
  28793. if (props.disabled)
  28794. return;
  28795. currentView.value = view;
  28796. await vue.nextTick();
  28797. handleFocusPicker();
  28798. };
  28799. const showTime = vue.computed(() => props.type === "datetime" || props.type === "datetimerange");
  28800. const footerVisible = vue.computed(() => {
  28801. const showDateFooter = showTime.value || selectionMode.value === "dates";
  28802. const showYearFooter = selectionMode.value === "years";
  28803. const showMonthFooter = selectionMode.value === "months";
  28804. const isDateView = currentView.value === "date";
  28805. const isYearView = currentView.value === "year";
  28806. const isMonthView = currentView.value === "month";
  28807. return showDateFooter && isDateView || showYearFooter && isYearView || showMonthFooter && isMonthView;
  28808. });
  28809. const footerFilled = vue.computed(() => !isMultipleType.value && props.showNow || props.showConfirm);
  28810. const disabledConfirm = vue.computed(() => {
  28811. if (!disabledDate)
  28812. return false;
  28813. if (!props.parsedValue)
  28814. return true;
  28815. if (isArray$1(props.parsedValue)) {
  28816. return disabledDate(props.parsedValue[0].toDate());
  28817. }
  28818. return disabledDate(props.parsedValue.toDate());
  28819. });
  28820. const onConfirm = () => {
  28821. if (isMultipleType.value) {
  28822. emit(props.parsedValue);
  28823. } else {
  28824. let result = extractFirst(props.parsedValue);
  28825. if (!result) {
  28826. const defaultTimeD2 = dayjs(defaultTime).locale(lang.value);
  28827. const defaultValueD = getDefaultValue();
  28828. result = defaultTimeD2.year(defaultValueD.year()).month(defaultValueD.month()).date(defaultValueD.date());
  28829. }
  28830. innerDate.value = result;
  28831. emit(result);
  28832. }
  28833. };
  28834. const disabledNow = vue.computed(() => {
  28835. if (!disabledDate)
  28836. return false;
  28837. return disabledDate(dayjs().locale(lang.value).toDate());
  28838. });
  28839. const changeToNow = () => {
  28840. const now = dayjs().locale(lang.value);
  28841. const nowDate = now.toDate();
  28842. isChangeToNow.value = true;
  28843. if ((!disabledDate || !disabledDate(nowDate)) && checkDateWithinRange(nowDate)) {
  28844. innerDate.value = dayjs().locale(lang.value);
  28845. emit(innerDate.value);
  28846. }
  28847. };
  28848. const timeFormat = vue.computed(() => {
  28849. return props.timeFormat || extractTimeFormat(props.format) || DEFAULT_FORMATS_TIME;
  28850. });
  28851. const dateFormat = vue.computed(() => {
  28852. return props.dateFormat || extractDateFormat(props.format) || DEFAULT_FORMATS_DATE;
  28853. });
  28854. const visibleTime = vue.computed(() => {
  28855. if (userInputTime.value)
  28856. return userInputTime.value;
  28857. if (!props.parsedValue && !defaultValue.value)
  28858. return;
  28859. const dateValue = extractFirst(props.parsedValue) || innerDate.value;
  28860. return dateValue.format(timeFormat.value);
  28861. });
  28862. const visibleDate = vue.computed(() => {
  28863. if (userInputDate.value)
  28864. return userInputDate.value;
  28865. if (!props.parsedValue && !defaultValue.value)
  28866. return;
  28867. const dateValue = extractFirst(props.parsedValue) || innerDate.value;
  28868. return dateValue.format(dateFormat.value);
  28869. });
  28870. const timePickerVisible = vue.ref(false);
  28871. const onTimePickerInputFocus = () => {
  28872. timePickerVisible.value = true;
  28873. };
  28874. const handleTimePickClose = () => {
  28875. timePickerVisible.value = false;
  28876. };
  28877. const getUnits = (date) => {
  28878. return {
  28879. hour: date.hour(),
  28880. minute: date.minute(),
  28881. second: date.second(),
  28882. year: date.year(),
  28883. month: date.month(),
  28884. date: date.date()
  28885. };
  28886. };
  28887. const handleTimePick = (value, visible, first) => {
  28888. const { hour, minute, second } = getUnits(value);
  28889. const parsedDateValue = extractFirst(props.parsedValue);
  28890. const newDate = parsedDateValue ? parsedDateValue.hour(hour).minute(minute).second(second) : value;
  28891. innerDate.value = newDate;
  28892. emit(innerDate.value, true);
  28893. if (!first) {
  28894. timePickerVisible.value = visible;
  28895. }
  28896. };
  28897. const handleVisibleTimeChange = (value) => {
  28898. const newDate = dayjs(value, timeFormat.value).locale(lang.value);
  28899. if (newDate.isValid() && checkDateWithinRange(newDate)) {
  28900. const { year: year2, month: month2, date } = getUnits(innerDate.value);
  28901. innerDate.value = newDate.year(year2).month(month2).date(date);
  28902. userInputTime.value = null;
  28903. timePickerVisible.value = false;
  28904. emit(innerDate.value, true);
  28905. }
  28906. };
  28907. const handleVisibleDateChange = (value) => {
  28908. const newDate = correctlyParseUserInput(value, dateFormat.value, lang.value, isDefaultFormat);
  28909. if (newDate.isValid()) {
  28910. if (disabledDate && disabledDate(newDate.toDate())) {
  28911. return;
  28912. }
  28913. const { hour, minute, second } = getUnits(innerDate.value);
  28914. innerDate.value = newDate.hour(hour).minute(minute).second(second);
  28915. userInputDate.value = null;
  28916. emit(innerDate.value, true);
  28917. }
  28918. };
  28919. const isValidValue = (date) => {
  28920. return dayjs.isDayjs(date) && date.isValid() && (disabledDate ? !disabledDate(date.toDate()) : true);
  28921. };
  28922. const parseUserInput = (value) => {
  28923. return correctlyParseUserInput(value, props.format, lang.value, isDefaultFormat);
  28924. };
  28925. const getDefaultValue = () => {
  28926. const parseDate = dayjs(defaultValue.value).locale(lang.value);
  28927. if (!defaultValue.value) {
  28928. const defaultTimeDValue = defaultTimeD.value;
  28929. return dayjs().hour(defaultTimeDValue.hour()).minute(defaultTimeDValue.minute()).second(defaultTimeDValue.second()).locale(lang.value);
  28930. }
  28931. return parseDate;
  28932. };
  28933. const handleFocusPicker = () => {
  28934. var _a;
  28935. if (["week", "month", "year", "date"].includes(selectionMode.value)) {
  28936. (_a = currentViewRef.value) == null ? void 0 : _a.focus();
  28937. }
  28938. };
  28939. const _handleFocusPicker = () => {
  28940. handleFocusPicker();
  28941. if (selectionMode.value === "week") {
  28942. handleKeyControl(EVENT_CODE.down);
  28943. }
  28944. };
  28945. const handleKeydownTable = (event) => {
  28946. const code = getEventCode(event);
  28947. const validCode = [
  28948. EVENT_CODE.up,
  28949. EVENT_CODE.down,
  28950. EVENT_CODE.left,
  28951. EVENT_CODE.right,
  28952. EVENT_CODE.home,
  28953. EVENT_CODE.end,
  28954. EVENT_CODE.pageUp,
  28955. EVENT_CODE.pageDown
  28956. ];
  28957. if (validCode.includes(code)) {
  28958. handleKeyControl(code);
  28959. event.stopPropagation();
  28960. event.preventDefault();
  28961. }
  28962. if ([EVENT_CODE.enter, EVENT_CODE.space, EVENT_CODE.numpadEnter].includes(code) && userInputDate.value === null && userInputTime.value === null) {
  28963. event.preventDefault();
  28964. emit(innerDate.value, false);
  28965. }
  28966. };
  28967. const handleKeyControl = (code) => {
  28968. var _a;
  28969. const { up, down, left, right, home, end, pageUp, pageDown } = EVENT_CODE;
  28970. const mapping = {
  28971. year: {
  28972. [up]: -4,
  28973. [down]: 4,
  28974. [left]: -1,
  28975. [right]: 1,
  28976. offset: (date, step) => date.setFullYear(date.getFullYear() + step)
  28977. },
  28978. month: {
  28979. [up]: -4,
  28980. [down]: 4,
  28981. [left]: -1,
  28982. [right]: 1,
  28983. offset: (date, step) => date.setMonth(date.getMonth() + step)
  28984. },
  28985. week: {
  28986. [up]: -1,
  28987. [down]: 1,
  28988. [left]: -1,
  28989. [right]: 1,
  28990. offset: (date, step) => date.setDate(date.getDate() + step * 7)
  28991. },
  28992. date: {
  28993. [up]: -7,
  28994. [down]: 7,
  28995. [left]: -1,
  28996. [right]: 1,
  28997. [home]: (date) => -date.getDay(),
  28998. [end]: (date) => -date.getDay() + 6,
  28999. [pageUp]: (date) => -new Date(date.getFullYear(), date.getMonth(), 0).getDate(),
  29000. [pageDown]: (date) => new Date(date.getFullYear(), date.getMonth() + 1, 0).getDate(),
  29001. offset: (date, step) => date.setDate(date.getDate() + step)
  29002. }
  29003. };
  29004. const newDate = innerDate.value.toDate();
  29005. while (Math.abs(innerDate.value.diff(newDate, "year", true)) < 1) {
  29006. const map = mapping[keyboardMode.value];
  29007. if (!map)
  29008. return;
  29009. map.offset(newDate, isFunction$1(map[code]) ? map[code](newDate) : (_a = map[code]) != null ? _a : 0);
  29010. if (disabledDate && disabledDate(newDate)) {
  29011. break;
  29012. }
  29013. const result = dayjs(newDate).locale(lang.value);
  29014. innerDate.value = result;
  29015. contextEmit("pick", result, true);
  29016. break;
  29017. }
  29018. };
  29019. const handlePanelChange = (mode) => {
  29020. contextEmit("panel-change", innerDate.value.toDate(), mode, currentView.value);
  29021. };
  29022. vue.watch(() => selectionMode.value, (val) => {
  29023. if (["month", "year"].includes(val)) {
  29024. currentView.value = val;
  29025. return;
  29026. } else if (val === "years") {
  29027. currentView.value = "year";
  29028. return;
  29029. } else if (val === "months") {
  29030. currentView.value = "month";
  29031. return;
  29032. }
  29033. currentView.value = "date";
  29034. }, { immediate: true });
  29035. vue.watch(() => defaultValue.value, (val) => {
  29036. if (val) {
  29037. innerDate.value = getDefaultValue();
  29038. }
  29039. }, { immediate: true });
  29040. vue.watch(() => props.parsedValue, (val) => {
  29041. if (val) {
  29042. if (isMultipleType.value)
  29043. return;
  29044. if (isArray$1(val))
  29045. return;
  29046. innerDate.value = val;
  29047. } else {
  29048. innerDate.value = getDefaultValue();
  29049. }
  29050. }, { immediate: true });
  29051. contextEmit("set-picker-option", ["isValidValue", isValidValue]);
  29052. contextEmit("set-picker-option", ["parseUserInput", parseUserInput]);
  29053. contextEmit("set-picker-option", ["handleFocusPicker", _handleFocusPicker]);
  29054. return (_ctx, _cache) => {
  29055. return vue.openBlock(), vue.createElementBlock("div", {
  29056. class: vue.normalizeClass([
  29057. vue.unref(ppNs).b(),
  29058. vue.unref(dpNs).b(),
  29059. vue.unref(ppNs).is("border", _ctx.border),
  29060. vue.unref(ppNs).is("disabled", _ctx.disabled),
  29061. {
  29062. "has-sidebar": _ctx.$slots.sidebar || vue.unref(hasShortcuts),
  29063. "has-time": vue.unref(showTime)
  29064. }
  29065. ])
  29066. }, [
  29067. vue.createElementVNode("div", {
  29068. class: vue.normalizeClass(vue.unref(ppNs).e("body-wrapper"))
  29069. }, [
  29070. vue.renderSlot(_ctx.$slots, "sidebar", {
  29071. class: vue.normalizeClass(vue.unref(ppNs).e("sidebar"))
  29072. }),
  29073. vue.unref(hasShortcuts) ? (vue.openBlock(), vue.createElementBlock("div", {
  29074. key: 0,
  29075. class: vue.normalizeClass(vue.unref(ppNs).e("sidebar"))
  29076. }, [
  29077. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(shortcuts), (shortcut, key) => {
  29078. return vue.openBlock(), vue.createElementBlock("button", {
  29079. key,
  29080. type: "button",
  29081. disabled: _ctx.disabled,
  29082. class: vue.normalizeClass(vue.unref(ppNs).e("shortcut")),
  29083. onClick: ($event) => handleShortcutClick(shortcut)
  29084. }, vue.toDisplayString(shortcut.text), 11, ["disabled", "onClick"]);
  29085. }), 128))
  29086. ], 2)) : vue.createCommentVNode("v-if", true),
  29087. vue.createElementVNode("div", {
  29088. class: vue.normalizeClass(vue.unref(ppNs).e("body"))
  29089. }, [
  29090. vue.unref(showTime) ? (vue.openBlock(), vue.createElementBlock("div", {
  29091. key: 0,
  29092. class: vue.normalizeClass(vue.unref(dpNs).e("time-header"))
  29093. }, [
  29094. vue.createElementVNode("span", {
  29095. class: vue.normalizeClass(vue.unref(dpNs).e("editor-wrap"))
  29096. }, [
  29097. vue.createVNode(vue.unref(ElInput), {
  29098. placeholder: vue.unref(t)("el.datepicker.selectDate"),
  29099. "model-value": vue.unref(visibleDate),
  29100. size: "small",
  29101. "validate-event": false,
  29102. disabled: _ctx.disabled,
  29103. onInput: (val) => userInputDate.value = val,
  29104. onChange: handleVisibleDateChange
  29105. }, null, 8, ["placeholder", "model-value", "disabled", "onInput"])
  29106. ], 2),
  29107. vue.withDirectives((vue.openBlock(), vue.createElementBlock("span", {
  29108. class: vue.normalizeClass(vue.unref(dpNs).e("editor-wrap"))
  29109. }, [
  29110. vue.createVNode(vue.unref(ElInput), {
  29111. placeholder: vue.unref(t)("el.datepicker.selectTime"),
  29112. "model-value": vue.unref(visibleTime),
  29113. size: "small",
  29114. "validate-event": false,
  29115. disabled: _ctx.disabled,
  29116. onFocus: onTimePickerInputFocus,
  29117. onInput: (val) => userInputTime.value = val,
  29118. onChange: handleVisibleTimeChange
  29119. }, null, 8, ["placeholder", "model-value", "disabled", "onInput"]),
  29120. vue.createVNode(vue.unref(TimePickPanel), {
  29121. visible: timePickerVisible.value,
  29122. format: vue.unref(timeFormat),
  29123. "parsed-value": innerDate.value,
  29124. onPick: handleTimePick
  29125. }, null, 8, ["visible", "format", "parsed-value"])
  29126. ], 2)), [
  29127. [vue.unref(ClickOutside), handleTimePickClose]
  29128. ])
  29129. ], 2)) : vue.createCommentVNode("v-if", true),
  29130. vue.withDirectives(vue.createElementVNode("div", {
  29131. class: vue.normalizeClass([
  29132. vue.unref(dpNs).e("header"),
  29133. (currentView.value === "year" || currentView.value === "month") && vue.unref(dpNs).em("header", "bordered")
  29134. ])
  29135. }, [
  29136. vue.createElementVNode("span", {
  29137. class: vue.normalizeClass(vue.unref(dpNs).e("prev-btn"))
  29138. }, [
  29139. vue.createElementVNode("button", {
  29140. type: "button",
  29141. "aria-label": vue.unref(t)(`el.datepicker.prevYear`),
  29142. class: vue.normalizeClass(["d-arrow-left", vue.unref(ppNs).e("icon-btn")]),
  29143. disabled: _ctx.disabled,
  29144. onClick: ($event) => moveByYear(false)
  29145. }, [
  29146. vue.renderSlot(_ctx.$slots, "prev-year", {}, () => [
  29147. vue.createVNode(vue.unref(ElIcon), null, {
  29148. default: vue.withCtx(() => [
  29149. vue.createVNode(vue.unref(d_arrow_left_default))
  29150. ]),
  29151. _: 1
  29152. })
  29153. ])
  29154. ], 10, ["aria-label", "disabled", "onClick"]),
  29155. vue.withDirectives(vue.createElementVNode("button", {
  29156. type: "button",
  29157. "aria-label": vue.unref(t)(`el.datepicker.prevMonth`),
  29158. class: vue.normalizeClass([vue.unref(ppNs).e("icon-btn"), "arrow-left"]),
  29159. disabled: _ctx.disabled,
  29160. onClick: ($event) => moveByMonth(false)
  29161. }, [
  29162. vue.renderSlot(_ctx.$slots, "prev-month", {}, () => [
  29163. vue.createVNode(vue.unref(ElIcon), null, {
  29164. default: vue.withCtx(() => [
  29165. vue.createVNode(vue.unref(arrow_left_default))
  29166. ]),
  29167. _: 1
  29168. })
  29169. ])
  29170. ], 10, ["aria-label", "disabled", "onClick"]), [
  29171. [vue.vShow, currentView.value === "date"]
  29172. ])
  29173. ], 2),
  29174. vue.createElementVNode("span", {
  29175. role: "button",
  29176. class: vue.normalizeClass(vue.unref(dpNs).e("header-label")),
  29177. "aria-live": "polite",
  29178. tabindex: "0",
  29179. onKeydown: vue.withKeys(($event) => showPicker("year"), ["enter"]),
  29180. onClick: ($event) => showPicker("year")
  29181. }, vue.toDisplayString(vue.unref(yearLabel)), 43, ["onKeydown", "onClick"]),
  29182. vue.withDirectives(vue.createElementVNode("span", {
  29183. role: "button",
  29184. "aria-live": "polite",
  29185. tabindex: "0",
  29186. class: vue.normalizeClass([
  29187. vue.unref(dpNs).e("header-label"),
  29188. { active: currentView.value === "month" }
  29189. ]),
  29190. onKeydown: vue.withKeys(($event) => showPicker("month"), ["enter"]),
  29191. onClick: ($event) => showPicker("month")
  29192. }, vue.toDisplayString(vue.unref(t)(`el.datepicker.month${vue.unref(month) + 1}`)), 43, ["onKeydown", "onClick"]), [
  29193. [vue.vShow, currentView.value === "date"]
  29194. ]),
  29195. vue.createElementVNode("span", {
  29196. class: vue.normalizeClass(vue.unref(dpNs).e("next-btn"))
  29197. }, [
  29198. vue.withDirectives(vue.createElementVNode("button", {
  29199. type: "button",
  29200. "aria-label": vue.unref(t)(`el.datepicker.nextMonth`),
  29201. class: vue.normalizeClass([vue.unref(ppNs).e("icon-btn"), "arrow-right"]),
  29202. disabled: _ctx.disabled,
  29203. onClick: ($event) => moveByMonth(true)
  29204. }, [
  29205. vue.renderSlot(_ctx.$slots, "next-month", {}, () => [
  29206. vue.createVNode(vue.unref(ElIcon), null, {
  29207. default: vue.withCtx(() => [
  29208. vue.createVNode(vue.unref(arrow_right_default))
  29209. ]),
  29210. _: 1
  29211. })
  29212. ])
  29213. ], 10, ["aria-label", "disabled", "onClick"]), [
  29214. [vue.vShow, currentView.value === "date"]
  29215. ]),
  29216. vue.createElementVNode("button", {
  29217. type: "button",
  29218. "aria-label": vue.unref(t)(`el.datepicker.nextYear`),
  29219. class: vue.normalizeClass([vue.unref(ppNs).e("icon-btn"), "d-arrow-right"]),
  29220. disabled: _ctx.disabled,
  29221. onClick: ($event) => moveByYear(true)
  29222. }, [
  29223. vue.renderSlot(_ctx.$slots, "next-year", {}, () => [
  29224. vue.createVNode(vue.unref(ElIcon), null, {
  29225. default: vue.withCtx(() => [
  29226. vue.createVNode(vue.unref(d_arrow_right_default))
  29227. ]),
  29228. _: 1
  29229. })
  29230. ])
  29231. ], 10, ["aria-label", "disabled", "onClick"])
  29232. ], 2)
  29233. ], 2), [
  29234. [vue.vShow, currentView.value !== "time"]
  29235. ]),
  29236. vue.createElementVNode("div", {
  29237. class: vue.normalizeClass(vue.unref(ppNs).e("content")),
  29238. onKeydown: handleKeydownTable
  29239. }, [
  29240. currentView.value === "date" ? (vue.openBlock(), vue.createBlock(DateTable, {
  29241. key: 0,
  29242. ref_key: "currentViewRef",
  29243. ref: currentViewRef,
  29244. "selection-mode": vue.unref(selectionMode),
  29245. date: innerDate.value,
  29246. "parsed-value": _ctx.parsedValue,
  29247. "disabled-date": vue.unref(disabledDate),
  29248. disabled: _ctx.disabled,
  29249. "cell-class-name": vue.unref(cellClassName),
  29250. "show-week-number": _ctx.showWeekNumber,
  29251. onPick: handleDatePick
  29252. }, null, 8, ["selection-mode", "date", "parsed-value", "disabled-date", "disabled", "cell-class-name", "show-week-number"])) : vue.createCommentVNode("v-if", true),
  29253. currentView.value === "year" ? (vue.openBlock(), vue.createBlock(YearTable, {
  29254. key: 1,
  29255. ref_key: "currentViewRef",
  29256. ref: currentViewRef,
  29257. "selection-mode": vue.unref(selectionMode),
  29258. date: innerDate.value,
  29259. "disabled-date": vue.unref(disabledDate),
  29260. disabled: _ctx.disabled,
  29261. "parsed-value": _ctx.parsedValue,
  29262. "cell-class-name": vue.unref(cellClassName),
  29263. onPick: handleYearPick
  29264. }, null, 8, ["selection-mode", "date", "disabled-date", "disabled", "parsed-value", "cell-class-name"])) : vue.createCommentVNode("v-if", true),
  29265. currentView.value === "month" ? (vue.openBlock(), vue.createBlock(MonthTable, {
  29266. key: 2,
  29267. ref_key: "currentViewRef",
  29268. ref: currentViewRef,
  29269. "selection-mode": vue.unref(selectionMode),
  29270. date: innerDate.value,
  29271. "parsed-value": _ctx.parsedValue,
  29272. "disabled-date": vue.unref(disabledDate),
  29273. disabled: _ctx.disabled,
  29274. "cell-class-name": vue.unref(cellClassName),
  29275. onPick: handleMonthPick
  29276. }, null, 8, ["selection-mode", "date", "parsed-value", "disabled-date", "disabled", "cell-class-name"])) : vue.createCommentVNode("v-if", true)
  29277. ], 34)
  29278. ], 2)
  29279. ], 2),
  29280. _ctx.showFooter && vue.unref(footerVisible) && vue.unref(footerFilled) ? (vue.openBlock(), vue.createElementBlock("div", {
  29281. key: 0,
  29282. class: vue.normalizeClass(vue.unref(ppNs).e("footer"))
  29283. }, [
  29284. vue.withDirectives(vue.createVNode(vue.unref(ElButton), {
  29285. text: "",
  29286. size: "small",
  29287. class: vue.normalizeClass(vue.unref(ppNs).e("link-btn")),
  29288. disabled: vue.unref(disabledNow),
  29289. onClick: changeToNow
  29290. }, {
  29291. default: vue.withCtx(() => [
  29292. vue.createTextVNode(vue.toDisplayString(vue.unref(t)("el.datepicker.now")), 1)
  29293. ]),
  29294. _: 1
  29295. }, 8, ["class", "disabled"]), [
  29296. [vue.vShow, !vue.unref(isMultipleType) && _ctx.showNow]
  29297. ]),
  29298. _ctx.showConfirm ? (vue.openBlock(), vue.createBlock(vue.unref(ElButton), {
  29299. key: 0,
  29300. plain: "",
  29301. size: "small",
  29302. class: vue.normalizeClass(vue.unref(ppNs).e("link-btn")),
  29303. disabled: vue.unref(disabledConfirm),
  29304. onClick: onConfirm
  29305. }, {
  29306. default: vue.withCtx(() => [
  29307. vue.createTextVNode(vue.toDisplayString(vue.unref(t)("el.datepicker.confirm")), 1)
  29308. ]),
  29309. _: 1
  29310. }, 8, ["class", "disabled"])) : vue.createCommentVNode("v-if", true)
  29311. ], 2)) : vue.createCommentVNode("v-if", true)
  29312. ], 2);
  29313. };
  29314. }
  29315. });
  29316. var DatePickPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1s, [["__file", "panel-date-pick.vue"]]);
  29317. const panelDateRangeProps = buildProps({
  29318. ...panelSharedProps,
  29319. ...panelRangeSharedProps
  29320. });
  29321. const useShortcut = (lang) => {
  29322. const { emit } = vue.getCurrentInstance();
  29323. const attrs = vue.useAttrs();
  29324. const slots = vue.useSlots();
  29325. const handleShortcutClick = (shortcut) => {
  29326. const shortcutValues = isFunction$1(shortcut.value) ? shortcut.value() : shortcut.value;
  29327. if (shortcutValues) {
  29328. emit("pick", [
  29329. dayjs(shortcutValues[0]).locale(lang.value),
  29330. dayjs(shortcutValues[1]).locale(lang.value)
  29331. ]);
  29332. return;
  29333. }
  29334. if (shortcut.onClick) {
  29335. shortcut.onClick({
  29336. attrs,
  29337. slots,
  29338. emit
  29339. });
  29340. }
  29341. };
  29342. return handleShortcutClick;
  29343. };
  29344. const useRangePicker = (props, {
  29345. defaultValue,
  29346. defaultTime,
  29347. leftDate,
  29348. rightDate,
  29349. step,
  29350. unit,
  29351. sortDates
  29352. }) => {
  29353. const { emit } = vue.getCurrentInstance();
  29354. const { pickerNs } = vue.inject(ROOT_PICKER_INJECTION_KEY);
  29355. const drpNs = useNamespace("date-range-picker");
  29356. const { t, lang } = useLocale();
  29357. const handleShortcutClick = useShortcut(lang);
  29358. const minDate = vue.ref();
  29359. const maxDate = vue.ref();
  29360. const rangeState = vue.ref({
  29361. endDate: null,
  29362. selecting: false
  29363. });
  29364. const handleChangeRange = (val) => {
  29365. rangeState.value = val;
  29366. };
  29367. const handleRangeConfirm = (visible = false) => {
  29368. const _minDate = vue.unref(minDate);
  29369. const _maxDate = vue.unref(maxDate);
  29370. if (isValidRange([_minDate, _maxDate])) {
  29371. emit("pick", [_minDate, _maxDate], visible);
  29372. }
  29373. };
  29374. const onSelect = (selecting) => {
  29375. rangeState.value.selecting = selecting;
  29376. if (!selecting) {
  29377. rangeState.value.endDate = null;
  29378. }
  29379. };
  29380. const parseValue = (parsedValue) => {
  29381. if (isArray$1(parsedValue) && parsedValue.length === 2) {
  29382. const [start, end] = parsedValue;
  29383. minDate.value = start;
  29384. leftDate.value = start;
  29385. maxDate.value = end;
  29386. sortDates(vue.unref(minDate), vue.unref(maxDate));
  29387. } else {
  29388. restoreDefault();
  29389. }
  29390. };
  29391. const restoreDefault = () => {
  29392. let [start, end] = getDefaultValue(vue.unref(defaultValue), {
  29393. lang: vue.unref(lang),
  29394. step,
  29395. unit,
  29396. unlinkPanels: props.unlinkPanels
  29397. });
  29398. const getShift = (day) => {
  29399. return day.diff(day.startOf("d"), "ms");
  29400. };
  29401. const maybeTimes = vue.unref(defaultTime);
  29402. if (maybeTimes) {
  29403. let leftShift = 0;
  29404. let rightShift = 0;
  29405. if (isArray$1(maybeTimes)) {
  29406. const [timeStart, timeEnd] = maybeTimes.map(dayjs);
  29407. leftShift = getShift(timeStart);
  29408. rightShift = getShift(timeEnd);
  29409. } else {
  29410. const shift = getShift(dayjs(maybeTimes));
  29411. leftShift = shift;
  29412. rightShift = shift;
  29413. }
  29414. start = start.startOf("d").add(leftShift, "ms");
  29415. end = end.startOf("d").add(rightShift, "ms");
  29416. }
  29417. minDate.value = void 0;
  29418. maxDate.value = void 0;
  29419. leftDate.value = start;
  29420. rightDate.value = end;
  29421. };
  29422. vue.watch(defaultValue, (val) => {
  29423. if (val) {
  29424. restoreDefault();
  29425. }
  29426. }, { immediate: true });
  29427. vue.watch(() => props.parsedValue, (parsedValue) => {
  29428. if (!(parsedValue == null ? void 0 : parsedValue.length) || !isEqual$1(parsedValue, [minDate.value, maxDate.value])) {
  29429. parseValue(parsedValue);
  29430. }
  29431. }, {
  29432. immediate: true
  29433. });
  29434. vue.watch(() => props.visible, () => {
  29435. if (props.visible) {
  29436. parseValue(props.parsedValue);
  29437. }
  29438. }, { immediate: true });
  29439. return {
  29440. minDate,
  29441. maxDate,
  29442. rangeState,
  29443. lang,
  29444. ppNs: pickerNs,
  29445. drpNs,
  29446. handleChangeRange,
  29447. handleRangeConfirm,
  29448. handleShortcutClick,
  29449. onSelect,
  29450. parseValue,
  29451. t
  29452. };
  29453. };
  29454. const usePanelDateRange = (props, emit, leftDate, rightDate) => {
  29455. const leftCurrentView = vue.ref("date");
  29456. const leftCurrentViewRef = vue.ref();
  29457. const rightCurrentView = vue.ref("date");
  29458. const rightCurrentViewRef = vue.ref();
  29459. const pickerBase = vue.inject(PICKER_BASE_INJECTION_KEY);
  29460. const { disabledDate } = pickerBase.props;
  29461. const { t, lang } = useLocale();
  29462. const leftYear = vue.computed(() => {
  29463. return leftDate.value.year();
  29464. });
  29465. const leftMonth = vue.computed(() => {
  29466. return leftDate.value.month();
  29467. });
  29468. const rightYear = vue.computed(() => {
  29469. return rightDate.value.year();
  29470. });
  29471. const rightMonth = vue.computed(() => {
  29472. return rightDate.value.month();
  29473. });
  29474. function computedYearLabel(currentView, yearValue) {
  29475. const yearTranslation = t("el.datepicker.year");
  29476. if (currentView.value === "year") {
  29477. const startYear = Math.floor(yearValue.value / 10) * 10;
  29478. return yearTranslation ? `${startYear} ${yearTranslation} - ${startYear + 9} ${yearTranslation}` : `${startYear} - ${startYear + 9}`;
  29479. }
  29480. return `${yearValue.value} ${yearTranslation}`;
  29481. }
  29482. function focusPicker(currentViewRef) {
  29483. currentViewRef == null ? void 0 : currentViewRef.focus();
  29484. }
  29485. async function showPicker(pickerType, view) {
  29486. if (props.disabled)
  29487. return;
  29488. const currentView = pickerType === "left" ? leftCurrentView : rightCurrentView;
  29489. const currentViewRef = pickerType === "left" ? leftCurrentViewRef : rightCurrentViewRef;
  29490. currentView.value = view;
  29491. await vue.nextTick();
  29492. focusPicker(currentViewRef.value);
  29493. }
  29494. async function handlePick(mode, pickerType, value) {
  29495. if (props.disabled)
  29496. return;
  29497. const isLeftPicker = pickerType === "left";
  29498. const startDate = isLeftPicker ? leftDate : rightDate;
  29499. const endDate = isLeftPicker ? rightDate : leftDate;
  29500. const currentView = isLeftPicker ? leftCurrentView : rightCurrentView;
  29501. const currentViewRef = isLeftPicker ? leftCurrentViewRef : rightCurrentViewRef;
  29502. if (mode === "year") {
  29503. const data = startDate.value.year(value);
  29504. startDate.value = getValidDateOfYear(data, lang.value, disabledDate);
  29505. }
  29506. if (mode === "month") {
  29507. startDate.value = getValidDateOfMonth(startDate.value, startDate.value.year(), value, lang.value, disabledDate);
  29508. }
  29509. if (!props.unlinkPanels) {
  29510. endDate.value = pickerType === "left" ? startDate.value.add(1, "month") : startDate.value.subtract(1, "month");
  29511. }
  29512. currentView.value = mode === "year" ? "month" : "date";
  29513. await vue.nextTick();
  29514. focusPicker(currentViewRef.value);
  29515. handlePanelChange(mode);
  29516. }
  29517. function handlePanelChange(mode) {
  29518. emit("panel-change", [leftDate.value.toDate(), rightDate.value.toDate()], mode);
  29519. }
  29520. function adjustDateByView(currentView, date, forward) {
  29521. const action = forward ? "add" : "subtract";
  29522. return currentView === "year" ? date[action](10, "year") : date[action](1, "year");
  29523. }
  29524. return {
  29525. leftCurrentView,
  29526. rightCurrentView,
  29527. leftCurrentViewRef,
  29528. rightCurrentViewRef,
  29529. leftYear,
  29530. rightYear,
  29531. leftMonth,
  29532. rightMonth,
  29533. leftYearLabel: vue.computed(() => computedYearLabel(leftCurrentView, leftYear)),
  29534. rightYearLabel: vue.computed(() => computedYearLabel(rightCurrentView, rightYear)),
  29535. showLeftPicker: (view) => showPicker("left", view),
  29536. showRightPicker: (view) => showPicker("right", view),
  29537. handleLeftYearPick: (year) => handlePick("year", "left", year),
  29538. handleRightYearPick: (year) => handlePick("year", "right", year),
  29539. handleLeftMonthPick: (month) => handlePick("month", "left", month),
  29540. handleRightMonthPick: (month) => handlePick("month", "right", month),
  29541. handlePanelChange,
  29542. adjustDateByView
  29543. };
  29544. };
  29545. const unit$2 = "month";
  29546. const _sfc_main$1r = /* @__PURE__ */ vue.defineComponent({
  29547. __name: "panel-date-range",
  29548. props: panelDateRangeProps,
  29549. emits: [
  29550. "pick",
  29551. "set-picker-option",
  29552. "calendar-change",
  29553. "panel-change"
  29554. ],
  29555. setup(__props, { emit }) {
  29556. const props = __props;
  29557. const pickerBase = vue.inject(PICKER_BASE_INJECTION_KEY);
  29558. const isDefaultFormat = vue.inject(ROOT_PICKER_IS_DEFAULT_FORMAT_INJECTION_KEY, void 0);
  29559. const { disabledDate, cellClassName, defaultTime, clearable } = pickerBase.props;
  29560. const format = vue.toRef(pickerBase.props, "format");
  29561. const shortcuts = vue.toRef(pickerBase.props, "shortcuts");
  29562. const defaultValue = vue.toRef(pickerBase.props, "defaultValue");
  29563. const { lang } = useLocale();
  29564. const leftDate = vue.ref(dayjs().locale(lang.value));
  29565. const rightDate = vue.ref(dayjs().locale(lang.value).add(1, unit$2));
  29566. const {
  29567. minDate,
  29568. maxDate,
  29569. rangeState,
  29570. ppNs,
  29571. drpNs,
  29572. handleChangeRange,
  29573. handleRangeConfirm,
  29574. handleShortcutClick,
  29575. onSelect,
  29576. parseValue,
  29577. t
  29578. } = useRangePicker(props, {
  29579. defaultValue,
  29580. defaultTime,
  29581. leftDate,
  29582. rightDate,
  29583. unit: unit$2,
  29584. sortDates
  29585. });
  29586. vue.watch(() => props.visible, (visible) => {
  29587. if (!visible && rangeState.value.selecting) {
  29588. parseValue(props.parsedValue);
  29589. onSelect(false);
  29590. }
  29591. });
  29592. const dateUserInput = vue.ref({
  29593. min: null,
  29594. max: null
  29595. });
  29596. const timeUserInput = vue.ref({
  29597. min: null,
  29598. max: null
  29599. });
  29600. const {
  29601. leftCurrentView,
  29602. rightCurrentView,
  29603. leftCurrentViewRef,
  29604. rightCurrentViewRef,
  29605. leftYear,
  29606. rightYear,
  29607. leftMonth,
  29608. rightMonth,
  29609. leftYearLabel,
  29610. rightYearLabel,
  29611. showLeftPicker,
  29612. showRightPicker,
  29613. handleLeftYearPick,
  29614. handleRightYearPick,
  29615. handleLeftMonthPick,
  29616. handleRightMonthPick,
  29617. handlePanelChange,
  29618. adjustDateByView
  29619. } = usePanelDateRange(props, emit, leftDate, rightDate);
  29620. const hasShortcuts = vue.computed(() => !!shortcuts.value.length);
  29621. const minVisibleDate = vue.computed(() => {
  29622. if (dateUserInput.value.min !== null)
  29623. return dateUserInput.value.min;
  29624. if (minDate.value)
  29625. return minDate.value.format(dateFormat.value);
  29626. return "";
  29627. });
  29628. const maxVisibleDate = vue.computed(() => {
  29629. if (dateUserInput.value.max !== null)
  29630. return dateUserInput.value.max;
  29631. if (maxDate.value || minDate.value)
  29632. return (maxDate.value || minDate.value).format(dateFormat.value);
  29633. return "";
  29634. });
  29635. const minVisibleTime = vue.computed(() => {
  29636. if (timeUserInput.value.min !== null)
  29637. return timeUserInput.value.min;
  29638. if (minDate.value)
  29639. return minDate.value.format(timeFormat.value);
  29640. return "";
  29641. });
  29642. const maxVisibleTime = vue.computed(() => {
  29643. if (timeUserInput.value.max !== null)
  29644. return timeUserInput.value.max;
  29645. if (maxDate.value || minDate.value)
  29646. return (maxDate.value || minDate.value).format(timeFormat.value);
  29647. return "";
  29648. });
  29649. const timeFormat = vue.computed(() => {
  29650. return props.timeFormat || extractTimeFormat(format.value || "") || DEFAULT_FORMATS_TIME;
  29651. });
  29652. const dateFormat = vue.computed(() => {
  29653. return props.dateFormat || extractDateFormat(format.value || "") || DEFAULT_FORMATS_DATE;
  29654. });
  29655. const isValidValue = (date) => {
  29656. return isValidRange(date) && (disabledDate ? !disabledDate(date[0].toDate()) && !disabledDate(date[1].toDate()) : true);
  29657. };
  29658. const leftPrevYear = () => {
  29659. leftDate.value = adjustDateByView(leftCurrentView.value, leftDate.value, false);
  29660. if (!props.unlinkPanels) {
  29661. rightDate.value = leftDate.value.add(1, "month");
  29662. }
  29663. handlePanelChange("year");
  29664. };
  29665. const leftPrevMonth = () => {
  29666. leftDate.value = leftDate.value.subtract(1, "month");
  29667. if (!props.unlinkPanels) {
  29668. rightDate.value = leftDate.value.add(1, "month");
  29669. }
  29670. handlePanelChange("month");
  29671. };
  29672. const rightNextYear = () => {
  29673. if (!props.unlinkPanels) {
  29674. leftDate.value = adjustDateByView(rightCurrentView.value, leftDate.value, true);
  29675. rightDate.value = leftDate.value.add(1, "month");
  29676. } else {
  29677. rightDate.value = adjustDateByView(rightCurrentView.value, rightDate.value, true);
  29678. }
  29679. handlePanelChange("year");
  29680. };
  29681. const rightNextMonth = () => {
  29682. if (!props.unlinkPanels) {
  29683. leftDate.value = leftDate.value.add(1, "month");
  29684. rightDate.value = leftDate.value.add(1, "month");
  29685. } else {
  29686. rightDate.value = rightDate.value.add(1, "month");
  29687. }
  29688. handlePanelChange("month");
  29689. };
  29690. const leftNextYear = () => {
  29691. leftDate.value = adjustDateByView(leftCurrentView.value, leftDate.value, true);
  29692. handlePanelChange("year");
  29693. };
  29694. const leftNextMonth = () => {
  29695. leftDate.value = leftDate.value.add(1, "month");
  29696. handlePanelChange("month");
  29697. };
  29698. const rightPrevYear = () => {
  29699. rightDate.value = adjustDateByView(rightCurrentView.value, rightDate.value, false);
  29700. handlePanelChange("year");
  29701. };
  29702. const rightPrevMonth = () => {
  29703. rightDate.value = rightDate.value.subtract(1, "month");
  29704. handlePanelChange("month");
  29705. };
  29706. const enableMonthArrow = vue.computed(() => {
  29707. const nextMonth = (leftMonth.value + 1) % 12;
  29708. const yearOffset = leftMonth.value + 1 >= 12 ? 1 : 0;
  29709. return props.unlinkPanels && new Date(leftYear.value + yearOffset, nextMonth) < new Date(rightYear.value, rightMonth.value);
  29710. });
  29711. const enableYearArrow = vue.computed(() => {
  29712. return props.unlinkPanels && rightYear.value * 12 + rightMonth.value - (leftYear.value * 12 + leftMonth.value + 1) >= 12;
  29713. });
  29714. const btnDisabled = vue.computed(() => {
  29715. return !(minDate.value && maxDate.value && !rangeState.value.selecting && isValidRange([minDate.value, maxDate.value]));
  29716. });
  29717. const showTime = vue.computed(() => props.type === "datetime" || props.type === "datetimerange");
  29718. const formatEmit = (emitDayjs, index) => {
  29719. if (!emitDayjs)
  29720. return;
  29721. if (defaultTime) {
  29722. const defaultTimeD = dayjs(defaultTime[index] || defaultTime).locale(lang.value);
  29723. return defaultTimeD.year(emitDayjs.year()).month(emitDayjs.month()).date(emitDayjs.date());
  29724. }
  29725. return emitDayjs;
  29726. };
  29727. const handleRangePick = (val, close = true) => {
  29728. const min_ = val.minDate;
  29729. const max_ = val.maxDate;
  29730. const minDate_ = formatEmit(min_, 0);
  29731. const maxDate_ = formatEmit(max_, 1);
  29732. if (maxDate.value === maxDate_ && minDate.value === minDate_) {
  29733. return;
  29734. }
  29735. emit("calendar-change", [min_.toDate(), max_ && max_.toDate()]);
  29736. maxDate.value = maxDate_;
  29737. minDate.value = minDate_;
  29738. if (!showTime.value && close) {
  29739. close = !minDate_ || !maxDate_;
  29740. }
  29741. handleRangeConfirm(close);
  29742. };
  29743. const minTimePickerVisible = vue.ref(false);
  29744. const maxTimePickerVisible = vue.ref(false);
  29745. const handleMinTimeClose = () => {
  29746. minTimePickerVisible.value = false;
  29747. };
  29748. const handleMaxTimeClose = () => {
  29749. maxTimePickerVisible.value = false;
  29750. };
  29751. const handleDateInput = (value, type) => {
  29752. dateUserInput.value[type] = value;
  29753. const parsedValueD = dayjs(value, dateFormat.value).locale(lang.value);
  29754. if (parsedValueD.isValid()) {
  29755. if (disabledDate && disabledDate(parsedValueD.toDate())) {
  29756. return;
  29757. }
  29758. if (type === "min") {
  29759. leftDate.value = parsedValueD;
  29760. minDate.value = (minDate.value || leftDate.value).year(parsedValueD.year()).month(parsedValueD.month()).date(parsedValueD.date());
  29761. if (!props.unlinkPanels && (!maxDate.value || maxDate.value.isBefore(minDate.value))) {
  29762. rightDate.value = parsedValueD.add(1, "month");
  29763. maxDate.value = minDate.value.add(1, "month");
  29764. }
  29765. } else {
  29766. rightDate.value = parsedValueD;
  29767. maxDate.value = (maxDate.value || rightDate.value).year(parsedValueD.year()).month(parsedValueD.month()).date(parsedValueD.date());
  29768. if (!props.unlinkPanels && (!minDate.value || minDate.value.isAfter(maxDate.value))) {
  29769. leftDate.value = parsedValueD.subtract(1, "month");
  29770. minDate.value = maxDate.value.subtract(1, "month");
  29771. }
  29772. }
  29773. sortDates(minDate.value, maxDate.value);
  29774. handleRangeConfirm(true);
  29775. }
  29776. };
  29777. const handleDateChange = (_, type) => {
  29778. dateUserInput.value[type] = null;
  29779. };
  29780. const handleTimeInput = (value, type) => {
  29781. timeUserInput.value[type] = value;
  29782. const parsedValueD = dayjs(value, timeFormat.value).locale(lang.value);
  29783. if (parsedValueD.isValid()) {
  29784. if (type === "min") {
  29785. minTimePickerVisible.value = true;
  29786. minDate.value = (minDate.value || leftDate.value).hour(parsedValueD.hour()).minute(parsedValueD.minute()).second(parsedValueD.second());
  29787. leftDate.value = minDate.value;
  29788. } else {
  29789. maxTimePickerVisible.value = true;
  29790. maxDate.value = (maxDate.value || rightDate.value).hour(parsedValueD.hour()).minute(parsedValueD.minute()).second(parsedValueD.second());
  29791. rightDate.value = maxDate.value;
  29792. }
  29793. }
  29794. };
  29795. const handleTimeChange = (_value, type) => {
  29796. timeUserInput.value[type] = null;
  29797. if (type === "min") {
  29798. leftDate.value = minDate.value;
  29799. minTimePickerVisible.value = false;
  29800. if (!maxDate.value || maxDate.value.isBefore(minDate.value)) {
  29801. maxDate.value = minDate.value;
  29802. }
  29803. } else {
  29804. rightDate.value = maxDate.value;
  29805. maxTimePickerVisible.value = false;
  29806. if (maxDate.value && maxDate.value.isBefore(minDate.value)) {
  29807. minDate.value = maxDate.value;
  29808. }
  29809. }
  29810. handleRangeConfirm(true);
  29811. };
  29812. const handleMinTimePick = (value, visible, first) => {
  29813. if (timeUserInput.value.min)
  29814. return;
  29815. if (value) {
  29816. leftDate.value = value;
  29817. minDate.value = (minDate.value || leftDate.value).hour(value.hour()).minute(value.minute()).second(value.second());
  29818. }
  29819. if (!first) {
  29820. minTimePickerVisible.value = visible;
  29821. }
  29822. if (!maxDate.value || maxDate.value.isBefore(minDate.value)) {
  29823. maxDate.value = minDate.value;
  29824. rightDate.value = value;
  29825. vue.nextTick(() => {
  29826. parseValue(props.parsedValue);
  29827. });
  29828. }
  29829. handleRangeConfirm(true);
  29830. };
  29831. const handleMaxTimePick = (value, visible, first) => {
  29832. if (timeUserInput.value.max)
  29833. return;
  29834. if (value) {
  29835. rightDate.value = value;
  29836. maxDate.value = (maxDate.value || rightDate.value).hour(value.hour()).minute(value.minute()).second(value.second());
  29837. }
  29838. if (!first) {
  29839. maxTimePickerVisible.value = visible;
  29840. }
  29841. if (maxDate.value && maxDate.value.isBefore(minDate.value)) {
  29842. minDate.value = maxDate.value;
  29843. }
  29844. handleRangeConfirm(true);
  29845. };
  29846. const handleClear = () => {
  29847. let valueOnClear = null;
  29848. if (pickerBase == null ? void 0 : pickerBase.emptyValues) {
  29849. valueOnClear = pickerBase.emptyValues.valueOnClear.value;
  29850. }
  29851. leftDate.value = getDefaultValue(vue.unref(defaultValue), {
  29852. lang: vue.unref(lang),
  29853. unit: "month",
  29854. unlinkPanels: props.unlinkPanels
  29855. })[0];
  29856. rightDate.value = leftDate.value.add(1, "month");
  29857. maxDate.value = void 0;
  29858. minDate.value = void 0;
  29859. handleRangeConfirm(true);
  29860. emit("pick", valueOnClear);
  29861. };
  29862. const parseUserInput = (value) => {
  29863. return correctlyParseUserInput(value, format.value || "", lang.value, isDefaultFormat);
  29864. };
  29865. function sortDates(minDate2, maxDate2) {
  29866. if (props.unlinkPanels && maxDate2) {
  29867. const minDateYear = (minDate2 == null ? void 0 : minDate2.year()) || 0;
  29868. const minDateMonth = (minDate2 == null ? void 0 : minDate2.month()) || 0;
  29869. const maxDateYear = maxDate2.year();
  29870. const maxDateMonth = maxDate2.month();
  29871. rightDate.value = minDateYear === maxDateYear && minDateMonth === maxDateMonth ? maxDate2.add(1, unit$2) : maxDate2;
  29872. } else {
  29873. rightDate.value = leftDate.value.add(1, unit$2);
  29874. if (maxDate2) {
  29875. rightDate.value = rightDate.value.hour(maxDate2.hour()).minute(maxDate2.minute()).second(maxDate2.second());
  29876. }
  29877. }
  29878. }
  29879. emit("set-picker-option", ["isValidValue", isValidValue]);
  29880. emit("set-picker-option", ["parseUserInput", parseUserInput]);
  29881. emit("set-picker-option", ["handleClear", handleClear]);
  29882. return (_ctx, _cache) => {
  29883. return vue.openBlock(), vue.createElementBlock("div", {
  29884. class: vue.normalizeClass([
  29885. vue.unref(ppNs).b(),
  29886. vue.unref(drpNs).b(),
  29887. vue.unref(ppNs).is("border", _ctx.border),
  29888. vue.unref(ppNs).is("disabled", _ctx.disabled),
  29889. {
  29890. "has-sidebar": _ctx.$slots.sidebar || vue.unref(hasShortcuts),
  29891. "has-time": vue.unref(showTime)
  29892. }
  29893. ])
  29894. }, [
  29895. vue.createElementVNode("div", {
  29896. class: vue.normalizeClass(vue.unref(ppNs).e("body-wrapper"))
  29897. }, [
  29898. vue.renderSlot(_ctx.$slots, "sidebar", {
  29899. class: vue.normalizeClass(vue.unref(ppNs).e("sidebar"))
  29900. }),
  29901. vue.unref(hasShortcuts) ? (vue.openBlock(), vue.createElementBlock("div", {
  29902. key: 0,
  29903. class: vue.normalizeClass(vue.unref(ppNs).e("sidebar"))
  29904. }, [
  29905. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(shortcuts), (shortcut, key) => {
  29906. return vue.openBlock(), vue.createElementBlock("button", {
  29907. key,
  29908. type: "button",
  29909. disabled: _ctx.disabled,
  29910. class: vue.normalizeClass(vue.unref(ppNs).e("shortcut")),
  29911. onClick: ($event) => vue.unref(handleShortcutClick)(shortcut)
  29912. }, vue.toDisplayString(shortcut.text), 11, ["disabled", "onClick"]);
  29913. }), 128))
  29914. ], 2)) : vue.createCommentVNode("v-if", true),
  29915. vue.createElementVNode("div", {
  29916. class: vue.normalizeClass(vue.unref(ppNs).e("body"))
  29917. }, [
  29918. vue.unref(showTime) ? (vue.openBlock(), vue.createElementBlock("div", {
  29919. key: 0,
  29920. class: vue.normalizeClass(vue.unref(drpNs).e("time-header"))
  29921. }, [
  29922. vue.createElementVNode("span", {
  29923. class: vue.normalizeClass(vue.unref(drpNs).e("editors-wrap"))
  29924. }, [
  29925. vue.createElementVNode("span", {
  29926. class: vue.normalizeClass(vue.unref(drpNs).e("time-picker-wrap"))
  29927. }, [
  29928. vue.createVNode(vue.unref(ElInput), {
  29929. size: "small",
  29930. disabled: vue.unref(rangeState).selecting || _ctx.disabled,
  29931. placeholder: vue.unref(t)("el.datepicker.startDate"),
  29932. class: vue.normalizeClass(vue.unref(drpNs).e("editor")),
  29933. "model-value": vue.unref(minVisibleDate),
  29934. "validate-event": false,
  29935. onInput: (val) => handleDateInput(val, "min"),
  29936. onChange: (val) => handleDateChange(val, "min")
  29937. }, null, 8, ["disabled", "placeholder", "class", "model-value", "onInput", "onChange"])
  29938. ], 2),
  29939. vue.withDirectives((vue.openBlock(), vue.createElementBlock("span", {
  29940. class: vue.normalizeClass(vue.unref(drpNs).e("time-picker-wrap"))
  29941. }, [
  29942. vue.createVNode(vue.unref(ElInput), {
  29943. size: "small",
  29944. class: vue.normalizeClass(vue.unref(drpNs).e("editor")),
  29945. disabled: vue.unref(rangeState).selecting || _ctx.disabled,
  29946. placeholder: vue.unref(t)("el.datepicker.startTime"),
  29947. "model-value": vue.unref(minVisibleTime),
  29948. "validate-event": false,
  29949. onFocus: ($event) => minTimePickerVisible.value = true,
  29950. onInput: (val) => handleTimeInput(val, "min"),
  29951. onChange: (val) => handleTimeChange(val, "min")
  29952. }, null, 8, ["class", "disabled", "placeholder", "model-value", "onFocus", "onInput", "onChange"]),
  29953. vue.createVNode(vue.unref(TimePickPanel), {
  29954. visible: minTimePickerVisible.value,
  29955. format: vue.unref(timeFormat),
  29956. "datetime-role": "start",
  29957. "parsed-value": leftDate.value,
  29958. onPick: handleMinTimePick
  29959. }, null, 8, ["visible", "format", "parsed-value"])
  29960. ], 2)), [
  29961. [vue.unref(ClickOutside), handleMinTimeClose]
  29962. ])
  29963. ], 2),
  29964. vue.createElementVNode("span", null, [
  29965. vue.createVNode(vue.unref(ElIcon), null, {
  29966. default: vue.withCtx(() => [
  29967. vue.createVNode(vue.unref(arrow_right_default))
  29968. ]),
  29969. _: 1
  29970. })
  29971. ]),
  29972. vue.createElementVNode("span", {
  29973. class: vue.normalizeClass([vue.unref(drpNs).e("editors-wrap"), "is-right"])
  29974. }, [
  29975. vue.createElementVNode("span", {
  29976. class: vue.normalizeClass(vue.unref(drpNs).e("time-picker-wrap"))
  29977. }, [
  29978. vue.createVNode(vue.unref(ElInput), {
  29979. size: "small",
  29980. class: vue.normalizeClass(vue.unref(drpNs).e("editor")),
  29981. disabled: vue.unref(rangeState).selecting || _ctx.disabled,
  29982. placeholder: vue.unref(t)("el.datepicker.endDate"),
  29983. "model-value": vue.unref(maxVisibleDate),
  29984. readonly: !vue.unref(minDate),
  29985. "validate-event": false,
  29986. onInput: (val) => handleDateInput(val, "max"),
  29987. onChange: (val) => handleDateChange(val, "max")
  29988. }, null, 8, ["class", "disabled", "placeholder", "model-value", "readonly", "onInput", "onChange"])
  29989. ], 2),
  29990. vue.withDirectives((vue.openBlock(), vue.createElementBlock("span", {
  29991. class: vue.normalizeClass(vue.unref(drpNs).e("time-picker-wrap"))
  29992. }, [
  29993. vue.createVNode(vue.unref(ElInput), {
  29994. size: "small",
  29995. class: vue.normalizeClass(vue.unref(drpNs).e("editor")),
  29996. disabled: vue.unref(rangeState).selecting || _ctx.disabled,
  29997. placeholder: vue.unref(t)("el.datepicker.endTime"),
  29998. "model-value": vue.unref(maxVisibleTime),
  29999. readonly: !vue.unref(minDate),
  30000. "validate-event": false,
  30001. onFocus: ($event) => vue.unref(minDate) && (maxTimePickerVisible.value = true),
  30002. onInput: (val) => handleTimeInput(val, "max"),
  30003. onChange: (val) => handleTimeChange(val, "max")
  30004. }, null, 8, ["class", "disabled", "placeholder", "model-value", "readonly", "onFocus", "onInput", "onChange"]),
  30005. vue.createVNode(vue.unref(TimePickPanel), {
  30006. "datetime-role": "end",
  30007. visible: maxTimePickerVisible.value,
  30008. format: vue.unref(timeFormat),
  30009. "parsed-value": rightDate.value,
  30010. onPick: handleMaxTimePick
  30011. }, null, 8, ["visible", "format", "parsed-value"])
  30012. ], 2)), [
  30013. [vue.unref(ClickOutside), handleMaxTimeClose]
  30014. ])
  30015. ], 2)
  30016. ], 2)) : vue.createCommentVNode("v-if", true),
  30017. vue.createElementVNode("div", {
  30018. class: vue.normalizeClass([[vue.unref(ppNs).e("content"), vue.unref(drpNs).e("content")], "is-left"])
  30019. }, [
  30020. vue.createElementVNode("div", {
  30021. class: vue.normalizeClass(vue.unref(drpNs).e("header"))
  30022. }, [
  30023. vue.createElementVNode("button", {
  30024. type: "button",
  30025. class: vue.normalizeClass([vue.unref(ppNs).e("icon-btn"), "d-arrow-left"]),
  30026. "aria-label": vue.unref(t)(`el.datepicker.prevYear`),
  30027. disabled: _ctx.disabled,
  30028. onClick: leftPrevYear
  30029. }, [
  30030. vue.renderSlot(_ctx.$slots, "prev-year", {}, () => [
  30031. vue.createVNode(vue.unref(ElIcon), null, {
  30032. default: vue.withCtx(() => [
  30033. vue.createVNode(vue.unref(d_arrow_left_default))
  30034. ]),
  30035. _: 1
  30036. })
  30037. ])
  30038. ], 10, ["aria-label", "disabled"]),
  30039. vue.withDirectives(vue.createElementVNode("button", {
  30040. type: "button",
  30041. class: vue.normalizeClass([vue.unref(ppNs).e("icon-btn"), "arrow-left"]),
  30042. "aria-label": vue.unref(t)(`el.datepicker.prevMonth`),
  30043. disabled: _ctx.disabled,
  30044. onClick: leftPrevMonth
  30045. }, [
  30046. vue.renderSlot(_ctx.$slots, "prev-month", {}, () => [
  30047. vue.createVNode(vue.unref(ElIcon), null, {
  30048. default: vue.withCtx(() => [
  30049. vue.createVNode(vue.unref(arrow_left_default))
  30050. ]),
  30051. _: 1
  30052. })
  30053. ])
  30054. ], 10, ["aria-label", "disabled"]), [
  30055. [vue.vShow, vue.unref(leftCurrentView) === "date"]
  30056. ]),
  30057. _ctx.unlinkPanels ? (vue.openBlock(), vue.createElementBlock("button", {
  30058. key: 0,
  30059. type: "button",
  30060. disabled: !vue.unref(enableYearArrow) || _ctx.disabled,
  30061. class: vue.normalizeClass([[
  30062. vue.unref(ppNs).e("icon-btn"),
  30063. vue.unref(ppNs).is("disabled", !vue.unref(enableYearArrow) || _ctx.disabled)
  30064. ], "d-arrow-right"]),
  30065. "aria-label": vue.unref(t)(`el.datepicker.nextYear`),
  30066. onClick: leftNextYear
  30067. }, [
  30068. vue.renderSlot(_ctx.$slots, "next-year", {}, () => [
  30069. vue.createVNode(vue.unref(ElIcon), null, {
  30070. default: vue.withCtx(() => [
  30071. vue.createVNode(vue.unref(d_arrow_right_default))
  30072. ]),
  30073. _: 1
  30074. })
  30075. ])
  30076. ], 10, ["disabled", "aria-label"])) : vue.createCommentVNode("v-if", true),
  30077. _ctx.unlinkPanels && vue.unref(leftCurrentView) === "date" ? (vue.openBlock(), vue.createElementBlock("button", {
  30078. key: 1,
  30079. type: "button",
  30080. disabled: !vue.unref(enableMonthArrow) || _ctx.disabled,
  30081. class: vue.normalizeClass([[
  30082. vue.unref(ppNs).e("icon-btn"),
  30083. vue.unref(ppNs).is("disabled", !vue.unref(enableMonthArrow) || _ctx.disabled)
  30084. ], "arrow-right"]),
  30085. "aria-label": vue.unref(t)(`el.datepicker.nextMonth`),
  30086. onClick: leftNextMonth
  30087. }, [
  30088. vue.renderSlot(_ctx.$slots, "next-month", {}, () => [
  30089. vue.createVNode(vue.unref(ElIcon), null, {
  30090. default: vue.withCtx(() => [
  30091. vue.createVNode(vue.unref(arrow_right_default))
  30092. ]),
  30093. _: 1
  30094. })
  30095. ])
  30096. ], 10, ["disabled", "aria-label"])) : vue.createCommentVNode("v-if", true),
  30097. vue.createElementVNode("div", null, [
  30098. vue.createElementVNode("span", {
  30099. role: "button",
  30100. class: vue.normalizeClass(vue.unref(drpNs).e("header-label")),
  30101. "aria-live": "polite",
  30102. tabindex: "0",
  30103. onKeydown: vue.withKeys(($event) => vue.unref(showLeftPicker)("year"), ["enter"]),
  30104. onClick: ($event) => vue.unref(showLeftPicker)("year")
  30105. }, vue.toDisplayString(vue.unref(leftYearLabel)), 43, ["onKeydown", "onClick"]),
  30106. vue.withDirectives(vue.createElementVNode("span", {
  30107. role: "button",
  30108. "aria-live": "polite",
  30109. tabindex: "0",
  30110. class: vue.normalizeClass([
  30111. vue.unref(drpNs).e("header-label"),
  30112. { active: vue.unref(leftCurrentView) === "month" }
  30113. ]),
  30114. onKeydown: vue.withKeys(($event) => vue.unref(showLeftPicker)("month"), ["enter"]),
  30115. onClick: ($event) => vue.unref(showLeftPicker)("month")
  30116. }, vue.toDisplayString(vue.unref(t)(`el.datepicker.month${leftDate.value.month() + 1}`)), 43, ["onKeydown", "onClick"]), [
  30117. [vue.vShow, vue.unref(leftCurrentView) === "date"]
  30118. ])
  30119. ])
  30120. ], 2),
  30121. vue.unref(leftCurrentView) === "date" ? (vue.openBlock(), vue.createBlock(DateTable, {
  30122. key: 0,
  30123. ref_key: "leftCurrentViewRef",
  30124. ref: leftCurrentViewRef,
  30125. "selection-mode": "range",
  30126. date: leftDate.value,
  30127. "min-date": vue.unref(minDate),
  30128. "max-date": vue.unref(maxDate),
  30129. "range-state": vue.unref(rangeState),
  30130. "disabled-date": vue.unref(disabledDate),
  30131. "cell-class-name": vue.unref(cellClassName),
  30132. "show-week-number": _ctx.showWeekNumber,
  30133. disabled: _ctx.disabled,
  30134. onChangerange: vue.unref(handleChangeRange),
  30135. onPick: handleRangePick,
  30136. onSelect: vue.unref(onSelect)
  30137. }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "cell-class-name", "show-week-number", "disabled", "onChangerange", "onSelect"])) : vue.createCommentVNode("v-if", true),
  30138. vue.unref(leftCurrentView) === "year" ? (vue.openBlock(), vue.createBlock(YearTable, {
  30139. key: 1,
  30140. ref_key: "leftCurrentViewRef",
  30141. ref: leftCurrentViewRef,
  30142. "selection-mode": "year",
  30143. date: leftDate.value,
  30144. "disabled-date": vue.unref(disabledDate),
  30145. "parsed-value": _ctx.parsedValue,
  30146. disabled: _ctx.disabled,
  30147. onPick: vue.unref(handleLeftYearPick)
  30148. }, null, 8, ["date", "disabled-date", "parsed-value", "disabled", "onPick"])) : vue.createCommentVNode("v-if", true),
  30149. vue.unref(leftCurrentView) === "month" ? (vue.openBlock(), vue.createBlock(MonthTable, {
  30150. key: 2,
  30151. ref_key: "leftCurrentViewRef",
  30152. ref: leftCurrentViewRef,
  30153. "selection-mode": "month",
  30154. date: leftDate.value,
  30155. "parsed-value": _ctx.parsedValue,
  30156. "disabled-date": vue.unref(disabledDate),
  30157. disabled: _ctx.disabled,
  30158. onPick: vue.unref(handleLeftMonthPick)
  30159. }, null, 8, ["date", "parsed-value", "disabled-date", "disabled", "onPick"])) : vue.createCommentVNode("v-if", true)
  30160. ], 2),
  30161. vue.createElementVNode("div", {
  30162. class: vue.normalizeClass([[vue.unref(ppNs).e("content"), vue.unref(drpNs).e("content")], "is-right"])
  30163. }, [
  30164. vue.createElementVNode("div", {
  30165. class: vue.normalizeClass([
  30166. vue.unref(drpNs).e("header"),
  30167. vue.unref(ppNs).is("disabled", !vue.unref(enableYearArrow) || _ctx.disabled)
  30168. ])
  30169. }, [
  30170. _ctx.unlinkPanels ? (vue.openBlock(), vue.createElementBlock("button", {
  30171. key: 0,
  30172. type: "button",
  30173. disabled: !vue.unref(enableYearArrow) || _ctx.disabled,
  30174. class: vue.normalizeClass([vue.unref(ppNs).e("icon-btn"), "d-arrow-left"]),
  30175. "aria-label": vue.unref(t)(`el.datepicker.prevYear`),
  30176. onClick: rightPrevYear
  30177. }, [
  30178. vue.renderSlot(_ctx.$slots, "prev-year", {}, () => [
  30179. vue.createVNode(vue.unref(ElIcon), null, {
  30180. default: vue.withCtx(() => [
  30181. vue.createVNode(vue.unref(d_arrow_left_default))
  30182. ]),
  30183. _: 1
  30184. })
  30185. ])
  30186. ], 10, ["disabled", "aria-label"])) : vue.createCommentVNode("v-if", true),
  30187. _ctx.unlinkPanels && vue.unref(rightCurrentView) === "date" ? (vue.openBlock(), vue.createElementBlock("button", {
  30188. key: 1,
  30189. type: "button",
  30190. disabled: !vue.unref(enableMonthArrow) || _ctx.disabled,
  30191. class: vue.normalizeClass([vue.unref(ppNs).e("icon-btn"), "arrow-left"]),
  30192. "aria-label": vue.unref(t)(`el.datepicker.prevMonth`),
  30193. onClick: rightPrevMonth
  30194. }, [
  30195. vue.renderSlot(_ctx.$slots, "prev-month", {}, () => [
  30196. vue.createVNode(vue.unref(ElIcon), null, {
  30197. default: vue.withCtx(() => [
  30198. vue.createVNode(vue.unref(arrow_left_default))
  30199. ]),
  30200. _: 1
  30201. })
  30202. ])
  30203. ], 10, ["disabled", "aria-label"])) : vue.createCommentVNode("v-if", true),
  30204. vue.createElementVNode("button", {
  30205. type: "button",
  30206. "aria-label": vue.unref(t)(`el.datepicker.nextYear`),
  30207. class: vue.normalizeClass([vue.unref(ppNs).e("icon-btn"), "d-arrow-right"]),
  30208. disabled: _ctx.disabled,
  30209. onClick: rightNextYear
  30210. }, [
  30211. vue.renderSlot(_ctx.$slots, "next-year", {}, () => [
  30212. vue.createVNode(vue.unref(ElIcon), null, {
  30213. default: vue.withCtx(() => [
  30214. vue.createVNode(vue.unref(d_arrow_right_default))
  30215. ]),
  30216. _: 1
  30217. })
  30218. ])
  30219. ], 10, ["aria-label", "disabled"]),
  30220. vue.withDirectives(vue.createElementVNode("button", {
  30221. type: "button",
  30222. class: vue.normalizeClass([vue.unref(ppNs).e("icon-btn"), "arrow-right"]),
  30223. disabled: _ctx.disabled,
  30224. "aria-label": vue.unref(t)(`el.datepicker.nextMonth`),
  30225. onClick: rightNextMonth
  30226. }, [
  30227. vue.renderSlot(_ctx.$slots, "next-month", {}, () => [
  30228. vue.createVNode(vue.unref(ElIcon), null, {
  30229. default: vue.withCtx(() => [
  30230. vue.createVNode(vue.unref(arrow_right_default))
  30231. ]),
  30232. _: 1
  30233. })
  30234. ])
  30235. ], 10, ["disabled", "aria-label"]), [
  30236. [vue.vShow, vue.unref(rightCurrentView) === "date"]
  30237. ]),
  30238. vue.createElementVNode("div", null, [
  30239. vue.createElementVNode("span", {
  30240. role: "button",
  30241. class: vue.normalizeClass(vue.unref(drpNs).e("header-label")),
  30242. "aria-live": "polite",
  30243. tabindex: "0",
  30244. onKeydown: vue.withKeys(($event) => vue.unref(showRightPicker)("year"), ["enter"]),
  30245. onClick: ($event) => vue.unref(showRightPicker)("year")
  30246. }, vue.toDisplayString(vue.unref(rightYearLabel)), 43, ["onKeydown", "onClick"]),
  30247. vue.withDirectives(vue.createElementVNode("span", {
  30248. role: "button",
  30249. "aria-live": "polite",
  30250. tabindex: "0",
  30251. class: vue.normalizeClass([
  30252. vue.unref(drpNs).e("header-label"),
  30253. { active: vue.unref(rightCurrentView) === "month" }
  30254. ]),
  30255. onKeydown: vue.withKeys(($event) => vue.unref(showRightPicker)("month"), ["enter"]),
  30256. onClick: ($event) => vue.unref(showRightPicker)("month")
  30257. }, vue.toDisplayString(vue.unref(t)(`el.datepicker.month${rightDate.value.month() + 1}`)), 43, ["onKeydown", "onClick"]), [
  30258. [vue.vShow, vue.unref(rightCurrentView) === "date"]
  30259. ])
  30260. ])
  30261. ], 2),
  30262. vue.unref(rightCurrentView) === "date" ? (vue.openBlock(), vue.createBlock(DateTable, {
  30263. key: 0,
  30264. ref_key: "rightCurrentViewRef",
  30265. ref: rightCurrentViewRef,
  30266. "selection-mode": "range",
  30267. date: rightDate.value,
  30268. "min-date": vue.unref(minDate),
  30269. "max-date": vue.unref(maxDate),
  30270. "range-state": vue.unref(rangeState),
  30271. "disabled-date": vue.unref(disabledDate),
  30272. "cell-class-name": vue.unref(cellClassName),
  30273. "show-week-number": _ctx.showWeekNumber,
  30274. disabled: _ctx.disabled,
  30275. onChangerange: vue.unref(handleChangeRange),
  30276. onPick: handleRangePick,
  30277. onSelect: vue.unref(onSelect)
  30278. }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "cell-class-name", "show-week-number", "disabled", "onChangerange", "onSelect"])) : vue.createCommentVNode("v-if", true),
  30279. vue.unref(rightCurrentView) === "year" ? (vue.openBlock(), vue.createBlock(YearTable, {
  30280. key: 1,
  30281. ref_key: "rightCurrentViewRef",
  30282. ref: rightCurrentViewRef,
  30283. "selection-mode": "year",
  30284. date: rightDate.value,
  30285. "disabled-date": vue.unref(disabledDate),
  30286. "parsed-value": _ctx.parsedValue,
  30287. disabled: _ctx.disabled,
  30288. onPick: vue.unref(handleRightYearPick)
  30289. }, null, 8, ["date", "disabled-date", "parsed-value", "disabled", "onPick"])) : vue.createCommentVNode("v-if", true),
  30290. vue.unref(rightCurrentView) === "month" ? (vue.openBlock(), vue.createBlock(MonthTable, {
  30291. key: 2,
  30292. ref_key: "rightCurrentViewRef",
  30293. ref: rightCurrentViewRef,
  30294. "selection-mode": "month",
  30295. date: rightDate.value,
  30296. "parsed-value": _ctx.parsedValue,
  30297. "disabled-date": vue.unref(disabledDate),
  30298. disabled: _ctx.disabled,
  30299. onPick: vue.unref(handleRightMonthPick)
  30300. }, null, 8, ["date", "parsed-value", "disabled-date", "disabled", "onPick"])) : vue.createCommentVNode("v-if", true)
  30301. ], 2)
  30302. ], 2)
  30303. ], 2),
  30304. _ctx.showFooter && vue.unref(showTime) && (_ctx.showConfirm || vue.unref(clearable)) ? (vue.openBlock(), vue.createElementBlock("div", {
  30305. key: 0,
  30306. class: vue.normalizeClass(vue.unref(ppNs).e("footer"))
  30307. }, [
  30308. vue.unref(clearable) ? (vue.openBlock(), vue.createBlock(vue.unref(ElButton), {
  30309. key: 0,
  30310. text: "",
  30311. size: "small",
  30312. class: vue.normalizeClass(vue.unref(ppNs).e("link-btn")),
  30313. onClick: handleClear
  30314. }, {
  30315. default: vue.withCtx(() => [
  30316. vue.createTextVNode(vue.toDisplayString(vue.unref(t)("el.datepicker.clear")), 1)
  30317. ]),
  30318. _: 1
  30319. }, 8, ["class"])) : vue.createCommentVNode("v-if", true),
  30320. _ctx.showConfirm ? (vue.openBlock(), vue.createBlock(vue.unref(ElButton), {
  30321. key: 1,
  30322. plain: "",
  30323. size: "small",
  30324. class: vue.normalizeClass(vue.unref(ppNs).e("link-btn")),
  30325. disabled: vue.unref(btnDisabled),
  30326. onClick: ($event) => vue.unref(handleRangeConfirm)(false)
  30327. }, {
  30328. default: vue.withCtx(() => [
  30329. vue.createTextVNode(vue.toDisplayString(vue.unref(t)("el.datepicker.confirm")), 1)
  30330. ]),
  30331. _: 1
  30332. }, 8, ["class", "disabled", "onClick"])) : vue.createCommentVNode("v-if", true)
  30333. ], 2)) : vue.createCommentVNode("v-if", true)
  30334. ], 2);
  30335. };
  30336. }
  30337. });
  30338. var DateRangePickPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1r, [["__file", "panel-date-range.vue"]]);
  30339. const panelMonthRangeProps = buildProps({
  30340. ...panelRangeSharedProps
  30341. });
  30342. const panelMonthRangeEmits = [
  30343. "pick",
  30344. "set-picker-option",
  30345. "calendar-change"
  30346. ];
  30347. const useMonthRangeHeader = ({
  30348. unlinkPanels,
  30349. leftDate,
  30350. rightDate
  30351. }) => {
  30352. const { t } = useLocale();
  30353. const leftPrevYear = () => {
  30354. leftDate.value = leftDate.value.subtract(1, "year");
  30355. if (!unlinkPanels.value) {
  30356. rightDate.value = rightDate.value.subtract(1, "year");
  30357. }
  30358. };
  30359. const rightNextYear = () => {
  30360. if (!unlinkPanels.value) {
  30361. leftDate.value = leftDate.value.add(1, "year");
  30362. }
  30363. rightDate.value = rightDate.value.add(1, "year");
  30364. };
  30365. const leftNextYear = () => {
  30366. leftDate.value = leftDate.value.add(1, "year");
  30367. };
  30368. const rightPrevYear = () => {
  30369. rightDate.value = rightDate.value.subtract(1, "year");
  30370. };
  30371. const leftLabel = vue.computed(() => {
  30372. return `${leftDate.value.year()} ${t("el.datepicker.year")}`;
  30373. });
  30374. const rightLabel = vue.computed(() => {
  30375. return `${rightDate.value.year()} ${t("el.datepicker.year")}`;
  30376. });
  30377. const leftYear = vue.computed(() => {
  30378. return leftDate.value.year();
  30379. });
  30380. const rightYear = vue.computed(() => {
  30381. return rightDate.value.year() === leftDate.value.year() ? leftDate.value.year() + 1 : rightDate.value.year();
  30382. });
  30383. return {
  30384. leftPrevYear,
  30385. rightNextYear,
  30386. leftNextYear,
  30387. rightPrevYear,
  30388. leftLabel,
  30389. rightLabel,
  30390. leftYear,
  30391. rightYear
  30392. };
  30393. };
  30394. const unit$1 = "year";
  30395. const __default__$13 = vue.defineComponent({
  30396. name: "DatePickerMonthRange"
  30397. });
  30398. const _sfc_main$1q = /* @__PURE__ */ vue.defineComponent({
  30399. ...__default__$13,
  30400. props: panelMonthRangeProps,
  30401. emits: panelMonthRangeEmits,
  30402. setup(__props, { emit }) {
  30403. const props = __props;
  30404. const { lang } = useLocale();
  30405. const pickerBase = vue.inject(PICKER_BASE_INJECTION_KEY);
  30406. const isDefaultFormat = vue.inject(ROOT_PICKER_IS_DEFAULT_FORMAT_INJECTION_KEY, void 0);
  30407. const { shortcuts, disabledDate, cellClassName } = pickerBase.props;
  30408. const format = vue.toRef(pickerBase.props, "format");
  30409. const defaultValue = vue.toRef(pickerBase.props, "defaultValue");
  30410. const leftDate = vue.ref(dayjs().locale(lang.value));
  30411. const rightDate = vue.ref(dayjs().locale(lang.value).add(1, unit$1));
  30412. const {
  30413. minDate,
  30414. maxDate,
  30415. rangeState,
  30416. ppNs,
  30417. drpNs,
  30418. handleChangeRange,
  30419. handleRangeConfirm,
  30420. handleShortcutClick,
  30421. onSelect,
  30422. parseValue
  30423. } = useRangePicker(props, {
  30424. defaultValue,
  30425. leftDate,
  30426. rightDate,
  30427. unit: unit$1,
  30428. sortDates
  30429. });
  30430. const hasShortcuts = vue.computed(() => !!shortcuts.length);
  30431. const {
  30432. leftPrevYear,
  30433. rightNextYear,
  30434. leftNextYear,
  30435. rightPrevYear,
  30436. leftLabel,
  30437. rightLabel,
  30438. leftYear,
  30439. rightYear
  30440. } = useMonthRangeHeader({
  30441. unlinkPanels: vue.toRef(props, "unlinkPanels"),
  30442. leftDate,
  30443. rightDate
  30444. });
  30445. const enableYearArrow = vue.computed(() => {
  30446. return props.unlinkPanels && rightYear.value > leftYear.value + 1;
  30447. });
  30448. const handleRangePick = (val, close = true) => {
  30449. const minDate_ = val.minDate;
  30450. const maxDate_ = val.maxDate;
  30451. if (maxDate.value === maxDate_ && minDate.value === minDate_) {
  30452. return;
  30453. }
  30454. emit("calendar-change", [minDate_.toDate(), maxDate_ && maxDate_.toDate()]);
  30455. maxDate.value = maxDate_;
  30456. minDate.value = minDate_;
  30457. if (!close)
  30458. return;
  30459. handleRangeConfirm();
  30460. };
  30461. const handleClear = () => {
  30462. let valueOnClear = null;
  30463. if (pickerBase == null ? void 0 : pickerBase.emptyValues) {
  30464. valueOnClear = pickerBase.emptyValues.valueOnClear.value;
  30465. }
  30466. leftDate.value = getDefaultValue(vue.unref(defaultValue), {
  30467. lang: vue.unref(lang),
  30468. unit: "year",
  30469. unlinkPanels: props.unlinkPanels
  30470. })[0];
  30471. rightDate.value = leftDate.value.add(1, "year");
  30472. emit("pick", valueOnClear);
  30473. };
  30474. const parseUserInput = (value) => {
  30475. return correctlyParseUserInput(value, format.value, lang.value, isDefaultFormat);
  30476. };
  30477. function sortDates(minDate2, maxDate2) {
  30478. if (props.unlinkPanels && maxDate2) {
  30479. const minDateYear = (minDate2 == null ? void 0 : minDate2.year()) || 0;
  30480. const maxDateYear = maxDate2.year();
  30481. rightDate.value = minDateYear === maxDateYear ? maxDate2.add(1, unit$1) : maxDate2;
  30482. } else {
  30483. rightDate.value = leftDate.value.add(1, unit$1);
  30484. }
  30485. }
  30486. vue.watch(() => props.visible, (visible) => {
  30487. if (!visible && rangeState.value.selecting) {
  30488. parseValue(props.parsedValue);
  30489. onSelect(false);
  30490. }
  30491. });
  30492. emit("set-picker-option", ["isValidValue", isValidRange]);
  30493. emit("set-picker-option", ["parseUserInput", parseUserInput]);
  30494. emit("set-picker-option", ["handleClear", handleClear]);
  30495. return (_ctx, _cache) => {
  30496. return vue.openBlock(), vue.createElementBlock("div", {
  30497. class: vue.normalizeClass([
  30498. vue.unref(ppNs).b(),
  30499. vue.unref(drpNs).b(),
  30500. vue.unref(ppNs).is("border", _ctx.border),
  30501. vue.unref(ppNs).is("disabled", _ctx.disabled),
  30502. {
  30503. "has-sidebar": Boolean(_ctx.$slots.sidebar) || vue.unref(hasShortcuts)
  30504. }
  30505. ])
  30506. }, [
  30507. vue.createElementVNode("div", {
  30508. class: vue.normalizeClass(vue.unref(ppNs).e("body-wrapper"))
  30509. }, [
  30510. vue.renderSlot(_ctx.$slots, "sidebar", {
  30511. class: vue.normalizeClass(vue.unref(ppNs).e("sidebar"))
  30512. }),
  30513. vue.unref(hasShortcuts) ? (vue.openBlock(), vue.createElementBlock("div", {
  30514. key: 0,
  30515. class: vue.normalizeClass(vue.unref(ppNs).e("sidebar"))
  30516. }, [
  30517. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(shortcuts), (shortcut, key) => {
  30518. return vue.openBlock(), vue.createElementBlock("button", {
  30519. key,
  30520. type: "button",
  30521. class: vue.normalizeClass(vue.unref(ppNs).e("shortcut")),
  30522. disabled: _ctx.disabled,
  30523. onClick: ($event) => vue.unref(handleShortcutClick)(shortcut)
  30524. }, vue.toDisplayString(shortcut.text), 11, ["disabled", "onClick"]);
  30525. }), 128))
  30526. ], 2)) : vue.createCommentVNode("v-if", true),
  30527. vue.createElementVNode("div", {
  30528. class: vue.normalizeClass(vue.unref(ppNs).e("body"))
  30529. }, [
  30530. vue.createElementVNode("div", {
  30531. class: vue.normalizeClass([[vue.unref(ppNs).e("content"), vue.unref(drpNs).e("content")], "is-left"])
  30532. }, [
  30533. vue.createElementVNode("div", {
  30534. class: vue.normalizeClass(vue.unref(drpNs).e("header"))
  30535. }, [
  30536. vue.createElementVNode("button", {
  30537. type: "button",
  30538. class: vue.normalizeClass([vue.unref(ppNs).e("icon-btn"), "d-arrow-left"]),
  30539. disabled: _ctx.disabled,
  30540. onClick: vue.unref(leftPrevYear)
  30541. }, [
  30542. vue.renderSlot(_ctx.$slots, "prev-year", {}, () => [
  30543. vue.createVNode(vue.unref(ElIcon), null, {
  30544. default: vue.withCtx(() => [
  30545. vue.createVNode(vue.unref(d_arrow_left_default))
  30546. ]),
  30547. _: 1
  30548. })
  30549. ])
  30550. ], 10, ["disabled", "onClick"]),
  30551. _ctx.unlinkPanels ? (vue.openBlock(), vue.createElementBlock("button", {
  30552. key: 0,
  30553. type: "button",
  30554. disabled: !vue.unref(enableYearArrow) || _ctx.disabled,
  30555. class: vue.normalizeClass([[
  30556. vue.unref(ppNs).e("icon-btn"),
  30557. vue.unref(ppNs).is("disabled", !vue.unref(enableYearArrow))
  30558. ], "d-arrow-right"]),
  30559. onClick: vue.unref(leftNextYear)
  30560. }, [
  30561. vue.renderSlot(_ctx.$slots, "next-year", {}, () => [
  30562. vue.createVNode(vue.unref(ElIcon), null, {
  30563. default: vue.withCtx(() => [
  30564. vue.createVNode(vue.unref(d_arrow_right_default))
  30565. ]),
  30566. _: 1
  30567. })
  30568. ])
  30569. ], 10, ["disabled", "onClick"])) : vue.createCommentVNode("v-if", true),
  30570. vue.createElementVNode("div", null, vue.toDisplayString(vue.unref(leftLabel)), 1)
  30571. ], 2),
  30572. vue.createVNode(MonthTable, {
  30573. "selection-mode": "range",
  30574. date: leftDate.value,
  30575. "min-date": vue.unref(minDate),
  30576. "max-date": vue.unref(maxDate),
  30577. "range-state": vue.unref(rangeState),
  30578. "disabled-date": vue.unref(disabledDate),
  30579. disabled: _ctx.disabled,
  30580. "cell-class-name": vue.unref(cellClassName),
  30581. onChangerange: vue.unref(handleChangeRange),
  30582. onPick: handleRangePick,
  30583. onSelect: vue.unref(onSelect)
  30584. }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "disabled", "cell-class-name", "onChangerange", "onSelect"])
  30585. ], 2),
  30586. vue.createElementVNode("div", {
  30587. class: vue.normalizeClass([[vue.unref(ppNs).e("content"), vue.unref(drpNs).e("content")], "is-right"])
  30588. }, [
  30589. vue.createElementVNode("div", {
  30590. class: vue.normalizeClass(vue.unref(drpNs).e("header"))
  30591. }, [
  30592. _ctx.unlinkPanels ? (vue.openBlock(), vue.createElementBlock("button", {
  30593. key: 0,
  30594. type: "button",
  30595. disabled: !vue.unref(enableYearArrow) || _ctx.disabled,
  30596. class: vue.normalizeClass([[
  30597. vue.unref(ppNs).e("icon-btn"),
  30598. vue.unref(ppNs).is("disabled", !vue.unref(enableYearArrow))
  30599. ], "d-arrow-left"]),
  30600. onClick: vue.unref(rightPrevYear)
  30601. }, [
  30602. vue.renderSlot(_ctx.$slots, "prev-year", {}, () => [
  30603. vue.createVNode(vue.unref(ElIcon), null, {
  30604. default: vue.withCtx(() => [
  30605. vue.createVNode(vue.unref(d_arrow_left_default))
  30606. ]),
  30607. _: 1
  30608. })
  30609. ])
  30610. ], 10, ["disabled", "onClick"])) : vue.createCommentVNode("v-if", true),
  30611. vue.createElementVNode("button", {
  30612. type: "button",
  30613. class: vue.normalizeClass([vue.unref(ppNs).e("icon-btn"), "d-arrow-right"]),
  30614. disabled: _ctx.disabled,
  30615. onClick: vue.unref(rightNextYear)
  30616. }, [
  30617. vue.renderSlot(_ctx.$slots, "next-year", {}, () => [
  30618. vue.createVNode(vue.unref(ElIcon), null, {
  30619. default: vue.withCtx(() => [
  30620. vue.createVNode(vue.unref(d_arrow_right_default))
  30621. ]),
  30622. _: 1
  30623. })
  30624. ])
  30625. ], 10, ["disabled", "onClick"]),
  30626. vue.createElementVNode("div", null, vue.toDisplayString(vue.unref(rightLabel)), 1)
  30627. ], 2),
  30628. vue.createVNode(MonthTable, {
  30629. "selection-mode": "range",
  30630. date: rightDate.value,
  30631. "min-date": vue.unref(minDate),
  30632. "max-date": vue.unref(maxDate),
  30633. "range-state": vue.unref(rangeState),
  30634. "disabled-date": vue.unref(disabledDate),
  30635. disabled: _ctx.disabled,
  30636. "cell-class-name": vue.unref(cellClassName),
  30637. onChangerange: vue.unref(handleChangeRange),
  30638. onPick: handleRangePick,
  30639. onSelect: vue.unref(onSelect)
  30640. }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "disabled", "cell-class-name", "onChangerange", "onSelect"])
  30641. ], 2)
  30642. ], 2)
  30643. ], 2)
  30644. ], 2);
  30645. };
  30646. }
  30647. });
  30648. var MonthRangePickPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1q, [["__file", "panel-month-range.vue"]]);
  30649. const panelYearRangeProps = buildProps({
  30650. ...panelRangeSharedProps
  30651. });
  30652. const panelYearRangeEmits = [
  30653. "pick",
  30654. "set-picker-option",
  30655. "calendar-change"
  30656. ];
  30657. const useYearRangeHeader = ({
  30658. unlinkPanels,
  30659. leftDate,
  30660. rightDate
  30661. }) => {
  30662. const leftPrevYear = () => {
  30663. leftDate.value = leftDate.value.subtract(10, "year");
  30664. if (!unlinkPanels.value) {
  30665. rightDate.value = rightDate.value.subtract(10, "year");
  30666. }
  30667. };
  30668. const rightNextYear = () => {
  30669. if (!unlinkPanels.value) {
  30670. leftDate.value = leftDate.value.add(10, "year");
  30671. }
  30672. rightDate.value = rightDate.value.add(10, "year");
  30673. };
  30674. const leftNextYear = () => {
  30675. leftDate.value = leftDate.value.add(10, "year");
  30676. };
  30677. const rightPrevYear = () => {
  30678. rightDate.value = rightDate.value.subtract(10, "year");
  30679. };
  30680. const leftLabel = vue.computed(() => {
  30681. const leftStartDate = Math.floor(leftDate.value.year() / 10) * 10;
  30682. return `${leftStartDate}-${leftStartDate + 9}`;
  30683. });
  30684. const rightLabel = vue.computed(() => {
  30685. const rightStartDate = Math.floor(rightDate.value.year() / 10) * 10;
  30686. return `${rightStartDate}-${rightStartDate + 9}`;
  30687. });
  30688. const leftYear = vue.computed(() => {
  30689. const leftEndDate = Math.floor(leftDate.value.year() / 10) * 10 + 9;
  30690. return leftEndDate;
  30691. });
  30692. const rightYear = vue.computed(() => {
  30693. const rightStartDate = Math.floor(rightDate.value.year() / 10) * 10;
  30694. return rightStartDate;
  30695. });
  30696. return {
  30697. leftPrevYear,
  30698. rightNextYear,
  30699. leftNextYear,
  30700. rightPrevYear,
  30701. leftLabel,
  30702. rightLabel,
  30703. leftYear,
  30704. rightYear
  30705. };
  30706. };
  30707. const step = 10;
  30708. const unit = "year";
  30709. const __default__$12 = vue.defineComponent({
  30710. name: "DatePickerYearRange"
  30711. });
  30712. const _sfc_main$1p = /* @__PURE__ */ vue.defineComponent({
  30713. ...__default__$12,
  30714. props: panelYearRangeProps,
  30715. emits: panelYearRangeEmits,
  30716. setup(__props, { emit }) {
  30717. const props = __props;
  30718. const { lang } = useLocale();
  30719. const leftDate = vue.ref(dayjs().locale(lang.value));
  30720. const rightDate = vue.ref(dayjs().locale(lang.value).add(step, unit));
  30721. const isDefaultFormat = vue.inject(ROOT_PICKER_IS_DEFAULT_FORMAT_INJECTION_KEY, void 0);
  30722. const pickerBase = vue.inject(PICKER_BASE_INJECTION_KEY);
  30723. const { shortcuts, disabledDate, cellClassName } = pickerBase.props;
  30724. const format = vue.toRef(pickerBase.props, "format");
  30725. const defaultValue = vue.toRef(pickerBase.props, "defaultValue");
  30726. const {
  30727. minDate,
  30728. maxDate,
  30729. rangeState,
  30730. ppNs,
  30731. drpNs,
  30732. handleChangeRange,
  30733. handleRangeConfirm,
  30734. handleShortcutClick,
  30735. onSelect,
  30736. parseValue
  30737. } = useRangePicker(props, {
  30738. defaultValue,
  30739. leftDate,
  30740. rightDate,
  30741. step,
  30742. unit,
  30743. sortDates
  30744. });
  30745. const {
  30746. leftPrevYear,
  30747. rightNextYear,
  30748. leftNextYear,
  30749. rightPrevYear,
  30750. leftLabel,
  30751. rightLabel,
  30752. leftYear,
  30753. rightYear
  30754. } = useYearRangeHeader({
  30755. unlinkPanels: vue.toRef(props, "unlinkPanels"),
  30756. leftDate,
  30757. rightDate
  30758. });
  30759. const hasShortcuts = vue.computed(() => !!shortcuts.length);
  30760. const panelKls = vue.computed(() => [
  30761. ppNs.b(),
  30762. drpNs.b(),
  30763. ppNs.is("border", props.border),
  30764. ppNs.is("disabled", props.disabled),
  30765. {
  30766. "has-sidebar": Boolean(vue.useSlots().sidebar) || hasShortcuts.value
  30767. }
  30768. ]);
  30769. const leftPanelKls = vue.computed(() => {
  30770. return {
  30771. content: [ppNs.e("content"), drpNs.e("content"), "is-left"],
  30772. arrowLeftBtn: [ppNs.e("icon-btn"), "d-arrow-left"],
  30773. arrowRightBtn: [
  30774. ppNs.e("icon-btn"),
  30775. ppNs.is("disabled", !enableYearArrow.value),
  30776. "d-arrow-right"
  30777. ]
  30778. };
  30779. });
  30780. const rightPanelKls = vue.computed(() => {
  30781. return {
  30782. content: [ppNs.e("content"), drpNs.e("content"), "is-right"],
  30783. arrowLeftBtn: [
  30784. ppNs.e("icon-btn"),
  30785. ppNs.is("disabled", !enableYearArrow.value),
  30786. "d-arrow-left"
  30787. ],
  30788. arrowRightBtn: [ppNs.e("icon-btn"), "d-arrow-right"]
  30789. };
  30790. });
  30791. const enableYearArrow = vue.computed(() => {
  30792. return props.unlinkPanels && rightYear.value > leftYear.value + 1;
  30793. });
  30794. const handleRangePick = (val, close = true) => {
  30795. const minDate_ = val.minDate;
  30796. const maxDate_ = val.maxDate;
  30797. if (maxDate.value === maxDate_ && minDate.value === minDate_) {
  30798. return;
  30799. }
  30800. emit("calendar-change", [minDate_.toDate(), maxDate_ && maxDate_.toDate()]);
  30801. maxDate.value = maxDate_;
  30802. minDate.value = minDate_;
  30803. if (!close)
  30804. return;
  30805. handleRangeConfirm();
  30806. };
  30807. const parseUserInput = (value) => {
  30808. return correctlyParseUserInput(value, format.value, lang.value, isDefaultFormat);
  30809. };
  30810. const isValidValue = (date) => {
  30811. return isValidRange(date) && (disabledDate ? !disabledDate(date[0].toDate()) && !disabledDate(date[1].toDate()) : true);
  30812. };
  30813. const handleClear = () => {
  30814. let valueOnClear = null;
  30815. if (pickerBase == null ? void 0 : pickerBase.emptyValues) {
  30816. valueOnClear = pickerBase.emptyValues.valueOnClear.value;
  30817. }
  30818. const defaultArr = getDefaultValue(vue.unref(defaultValue), {
  30819. lang: vue.unref(lang),
  30820. step,
  30821. unit,
  30822. unlinkPanels: props.unlinkPanels
  30823. });
  30824. leftDate.value = defaultArr[0];
  30825. rightDate.value = defaultArr[1];
  30826. emit("pick", valueOnClear);
  30827. };
  30828. function sortDates(minDate2, maxDate2) {
  30829. if (props.unlinkPanels && maxDate2) {
  30830. const minDateYear = (minDate2 == null ? void 0 : minDate2.year()) || 0;
  30831. const maxDateYear = maxDate2.year();
  30832. rightDate.value = minDateYear + step > maxDateYear ? maxDate2.add(step, unit) : maxDate2;
  30833. } else {
  30834. rightDate.value = leftDate.value.add(step, unit);
  30835. }
  30836. }
  30837. vue.watch(() => props.visible, (visible) => {
  30838. if (!visible && rangeState.value.selecting) {
  30839. parseValue(props.parsedValue);
  30840. onSelect(false);
  30841. }
  30842. });
  30843. emit("set-picker-option", ["isValidValue", isValidValue]);
  30844. emit("set-picker-option", ["parseUserInput", parseUserInput]);
  30845. emit("set-picker-option", ["handleClear", handleClear]);
  30846. return (_ctx, _cache) => {
  30847. return vue.openBlock(), vue.createElementBlock("div", {
  30848. class: vue.normalizeClass(vue.unref(panelKls))
  30849. }, [
  30850. vue.createElementVNode("div", {
  30851. class: vue.normalizeClass(vue.unref(ppNs).e("body-wrapper"))
  30852. }, [
  30853. vue.renderSlot(_ctx.$slots, "sidebar", {
  30854. class: vue.normalizeClass(vue.unref(ppNs).e("sidebar"))
  30855. }),
  30856. vue.unref(hasShortcuts) ? (vue.openBlock(), vue.createElementBlock("div", {
  30857. key: 0,
  30858. class: vue.normalizeClass(vue.unref(ppNs).e("sidebar"))
  30859. }, [
  30860. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(shortcuts), (shortcut, key) => {
  30861. return vue.openBlock(), vue.createElementBlock("button", {
  30862. key,
  30863. type: "button",
  30864. class: vue.normalizeClass(vue.unref(ppNs).e("shortcut")),
  30865. disabled: _ctx.disabled,
  30866. onClick: ($event) => vue.unref(handleShortcutClick)(shortcut)
  30867. }, vue.toDisplayString(shortcut.text), 11, ["disabled", "onClick"]);
  30868. }), 128))
  30869. ], 2)) : vue.createCommentVNode("v-if", true),
  30870. vue.createElementVNode("div", {
  30871. class: vue.normalizeClass(vue.unref(ppNs).e("body"))
  30872. }, [
  30873. vue.createElementVNode("div", {
  30874. class: vue.normalizeClass(vue.unref(leftPanelKls).content)
  30875. }, [
  30876. vue.createElementVNode("div", {
  30877. class: vue.normalizeClass(vue.unref(drpNs).e("header"))
  30878. }, [
  30879. vue.createElementVNode("button", {
  30880. type: "button",
  30881. class: vue.normalizeClass(vue.unref(leftPanelKls).arrowLeftBtn),
  30882. disabled: _ctx.disabled,
  30883. onClick: vue.unref(leftPrevYear)
  30884. }, [
  30885. vue.renderSlot(_ctx.$slots, "prev-year", {}, () => [
  30886. vue.createVNode(vue.unref(ElIcon), null, {
  30887. default: vue.withCtx(() => [
  30888. vue.createVNode(vue.unref(d_arrow_left_default))
  30889. ]),
  30890. _: 1
  30891. })
  30892. ])
  30893. ], 10, ["disabled", "onClick"]),
  30894. _ctx.unlinkPanels ? (vue.openBlock(), vue.createElementBlock("button", {
  30895. key: 0,
  30896. type: "button",
  30897. disabled: !vue.unref(enableYearArrow) || _ctx.disabled,
  30898. class: vue.normalizeClass(vue.unref(leftPanelKls).arrowRightBtn),
  30899. onClick: vue.unref(leftNextYear)
  30900. }, [
  30901. vue.renderSlot(_ctx.$slots, "next-year", {}, () => [
  30902. vue.createVNode(vue.unref(ElIcon), null, {
  30903. default: vue.withCtx(() => [
  30904. vue.createVNode(vue.unref(d_arrow_right_default))
  30905. ]),
  30906. _: 1
  30907. })
  30908. ])
  30909. ], 10, ["disabled", "onClick"])) : vue.createCommentVNode("v-if", true),
  30910. vue.createElementVNode("div", null, vue.toDisplayString(vue.unref(leftLabel)), 1)
  30911. ], 2),
  30912. vue.createVNode(YearTable, {
  30913. "selection-mode": "range",
  30914. date: leftDate.value,
  30915. "min-date": vue.unref(minDate),
  30916. "max-date": vue.unref(maxDate),
  30917. "range-state": vue.unref(rangeState),
  30918. "disabled-date": vue.unref(disabledDate),
  30919. disabled: _ctx.disabled,
  30920. "cell-class-name": vue.unref(cellClassName),
  30921. onChangerange: vue.unref(handleChangeRange),
  30922. onPick: handleRangePick,
  30923. onSelect: vue.unref(onSelect)
  30924. }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "disabled", "cell-class-name", "onChangerange", "onSelect"])
  30925. ], 2),
  30926. vue.createElementVNode("div", {
  30927. class: vue.normalizeClass(vue.unref(rightPanelKls).content)
  30928. }, [
  30929. vue.createElementVNode("div", {
  30930. class: vue.normalizeClass(vue.unref(drpNs).e("header"))
  30931. }, [
  30932. _ctx.unlinkPanels ? (vue.openBlock(), vue.createElementBlock("button", {
  30933. key: 0,
  30934. type: "button",
  30935. disabled: !vue.unref(enableYearArrow) || _ctx.disabled,
  30936. class: vue.normalizeClass(vue.unref(rightPanelKls).arrowLeftBtn),
  30937. onClick: vue.unref(rightPrevYear)
  30938. }, [
  30939. vue.renderSlot(_ctx.$slots, "prev-year", {}, () => [
  30940. vue.createVNode(vue.unref(ElIcon), null, {
  30941. default: vue.withCtx(() => [
  30942. vue.createVNode(vue.unref(d_arrow_left_default))
  30943. ]),
  30944. _: 1
  30945. })
  30946. ])
  30947. ], 10, ["disabled", "onClick"])) : vue.createCommentVNode("v-if", true),
  30948. vue.createElementVNode("button", {
  30949. type: "button",
  30950. class: vue.normalizeClass(vue.unref(rightPanelKls).arrowRightBtn),
  30951. disabled: _ctx.disabled,
  30952. onClick: vue.unref(rightNextYear)
  30953. }, [
  30954. vue.renderSlot(_ctx.$slots, "next-year", {}, () => [
  30955. vue.createVNode(vue.unref(ElIcon), null, {
  30956. default: vue.withCtx(() => [
  30957. vue.createVNode(vue.unref(d_arrow_right_default))
  30958. ]),
  30959. _: 1
  30960. })
  30961. ])
  30962. ], 10, ["disabled", "onClick"]),
  30963. vue.createElementVNode("div", null, vue.toDisplayString(vue.unref(rightLabel)), 1)
  30964. ], 2),
  30965. vue.createVNode(YearTable, {
  30966. "selection-mode": "range",
  30967. date: rightDate.value,
  30968. "min-date": vue.unref(minDate),
  30969. "max-date": vue.unref(maxDate),
  30970. "range-state": vue.unref(rangeState),
  30971. "disabled-date": vue.unref(disabledDate),
  30972. disabled: _ctx.disabled,
  30973. "cell-class-name": vue.unref(cellClassName),
  30974. onChangerange: vue.unref(handleChangeRange),
  30975. onPick: handleRangePick,
  30976. onSelect: vue.unref(onSelect)
  30977. }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "disabled", "cell-class-name", "onChangerange", "onSelect"])
  30978. ], 2)
  30979. ], 2)
  30980. ], 2)
  30981. ], 2);
  30982. };
  30983. }
  30984. });
  30985. var YearRangePickPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1p, [["__file", "panel-year-range.vue"]]);
  30986. const getPanel = function(type) {
  30987. switch (type) {
  30988. case "daterange":
  30989. case "datetimerange": {
  30990. return DateRangePickPanel;
  30991. }
  30992. case "monthrange": {
  30993. return MonthRangePickPanel;
  30994. }
  30995. case "yearrange": {
  30996. return YearRangePickPanel;
  30997. }
  30998. default: {
  30999. return DatePickPanel;
  31000. }
  31001. }
  31002. };
  31003. function _isSlot$7(s) {
  31004. return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !vue.isVNode(s);
  31005. }
  31006. dayjs.extend(localeData);
  31007. dayjs.extend(advancedFormat);
  31008. dayjs.extend(customParseFormat);
  31009. dayjs.extend(weekOfYear);
  31010. dayjs.extend(weekYear);
  31011. dayjs.extend(dayOfYear);
  31012. dayjs.extend(isSameOrAfter);
  31013. dayjs.extend(isSameOrBefore);
  31014. var DatePickerPanel = vue.defineComponent({
  31015. name: "ElDatePickerPanel",
  31016. install: null,
  31017. props: datePickerPanelProps,
  31018. emits: [UPDATE_MODEL_EVENT, "calendar-change", "panel-change", "visible-change", "pick"],
  31019. setup(props, {
  31020. slots,
  31021. emit
  31022. }) {
  31023. const ns = useNamespace("picker-panel");
  31024. const pickerInjection = vue.inject(PICKER_BASE_INJECTION_KEY, void 0);
  31025. if (isUndefined(pickerInjection)) {
  31026. const _props = vue.reactive({
  31027. ...vue.toRefs(props)
  31028. });
  31029. vue.provide(PICKER_BASE_INJECTION_KEY, {
  31030. props: _props
  31031. });
  31032. }
  31033. vue.provide(ROOT_PICKER_INJECTION_KEY, {
  31034. slots,
  31035. pickerNs: ns
  31036. });
  31037. const {
  31038. parsedValue,
  31039. onCalendarChange,
  31040. onPanelChange,
  31041. onSetPickerOption,
  31042. onPick
  31043. } = vue.inject(ROOT_COMMON_PICKER_INJECTION_KEY, () => useCommonPicker(props, emit), true);
  31044. return () => {
  31045. const Component = getPanel(props.type);
  31046. return vue.createVNode(Component, vue.mergeProps(props, {
  31047. "parsedValue": parsedValue.value,
  31048. "onSet-picker-option": onSetPickerOption,
  31049. "onCalendar-change": onCalendarChange,
  31050. "onPanel-change": onPanelChange,
  31051. "onPick": onPick
  31052. }), _isSlot$7(slots) ? slots : {
  31053. default: () => [slots]
  31054. });
  31055. };
  31056. }
  31057. });
  31058. const ElDatePickerPanel = withInstall(DatePickerPanel);
  31059. const datePickerProps = buildProps({
  31060. ...timePickerDefaultProps,
  31061. type: {
  31062. type: definePropType(String),
  31063. default: "date"
  31064. }
  31065. });
  31066. function _isSlot$6(s) {
  31067. return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !vue.isVNode(s);
  31068. }
  31069. var DatePicker = vue.defineComponent({
  31070. name: "ElDatePicker",
  31071. install: null,
  31072. props: datePickerProps,
  31073. emits: [UPDATE_MODEL_EVENT],
  31074. setup(props, {
  31075. expose,
  31076. emit,
  31077. slots
  31078. }) {
  31079. const isDefaultFormat = vue.computed(() => {
  31080. return !props.format;
  31081. });
  31082. vue.provide(ROOT_PICKER_IS_DEFAULT_FORMAT_INJECTION_KEY, isDefaultFormat);
  31083. vue.provide(PICKER_POPPER_OPTIONS_INJECTION_KEY, vue.reactive(vue.toRef(props, "popperOptions")));
  31084. const commonPicker = vue.ref();
  31085. const refProps = {
  31086. focus: () => {
  31087. var _a;
  31088. (_a = commonPicker.value) == null ? void 0 : _a.focus();
  31089. },
  31090. blur: () => {
  31091. var _a;
  31092. (_a = commonPicker.value) == null ? void 0 : _a.blur();
  31093. },
  31094. handleOpen: () => {
  31095. var _a;
  31096. (_a = commonPicker.value) == null ? void 0 : _a.handleOpen();
  31097. },
  31098. handleClose: () => {
  31099. var _a;
  31100. (_a = commonPicker.value) == null ? void 0 : _a.handleClose();
  31101. }
  31102. };
  31103. expose(refProps);
  31104. const onModelValueUpdated = (val) => {
  31105. emit(UPDATE_MODEL_EVENT, val);
  31106. };
  31107. return () => {
  31108. var _a;
  31109. const format = (_a = props.format) != null ? _a : DEFAULT_FORMATS_DATEPICKER[props.type] || DEFAULT_FORMATS_DATE;
  31110. return vue.createVNode(CommonPicker, vue.mergeProps(props, {
  31111. "format": format,
  31112. "type": props.type,
  31113. "ref": commonPicker,
  31114. "onUpdate:modelValue": onModelValueUpdated
  31115. }), {
  31116. default: (scopedProps) => vue.createVNode(ElDatePickerPanel, vue.mergeProps({
  31117. "border": false
  31118. }, scopedProps), _isSlot$6(slots) ? slots : {
  31119. default: () => [slots]
  31120. }),
  31121. "range-separator": slots["range-separator"]
  31122. });
  31123. };
  31124. }
  31125. });
  31126. const ElDatePicker = withInstall(DatePicker);
  31127. const descriptionsKey = Symbol("elDescriptions");
  31128. var ElDescriptionsCell = vue.defineComponent({
  31129. name: "ElDescriptionsCell",
  31130. props: {
  31131. cell: {
  31132. type: Object
  31133. },
  31134. tag: {
  31135. type: String,
  31136. default: "td"
  31137. },
  31138. type: {
  31139. type: String
  31140. }
  31141. },
  31142. setup() {
  31143. const descriptions = vue.inject(descriptionsKey, {});
  31144. return {
  31145. descriptions
  31146. };
  31147. },
  31148. render() {
  31149. var _a;
  31150. const item = getNormalizedProps(this.cell);
  31151. const directives = (((_a = this.cell) == null ? void 0 : _a.dirs) || []).map((dire) => {
  31152. const { dir, arg, modifiers, value } = dire;
  31153. return [dir, value, arg, modifiers];
  31154. });
  31155. const { border, direction } = this.descriptions;
  31156. const isVertical = direction === "vertical";
  31157. const renderLabel = () => {
  31158. var _a2, _b, _c;
  31159. return ((_c = (_b = (_a2 = this.cell) == null ? void 0 : _a2.children) == null ? void 0 : _b.label) == null ? void 0 : _c.call(_b)) || item.label;
  31160. };
  31161. const renderContent = () => {
  31162. var _a2, _b, _c;
  31163. return (_c = (_b = (_a2 = this.cell) == null ? void 0 : _a2.children) == null ? void 0 : _b.default) == null ? void 0 : _c.call(_b);
  31164. };
  31165. const span = item.span;
  31166. const rowspan = item.rowspan;
  31167. const align = item.align ? `is-${item.align}` : "";
  31168. const labelAlign = item.labelAlign ? `is-${item.labelAlign}` : align;
  31169. const className = item.className;
  31170. const labelClassName = item.labelClassName;
  31171. const width = this.type === "label" ? item.labelWidth || this.descriptions.labelWidth || item.width : item.width;
  31172. const style = {
  31173. width: addUnit(width),
  31174. minWidth: addUnit(item.minWidth)
  31175. };
  31176. const ns = useNamespace("descriptions");
  31177. switch (this.type) {
  31178. case "label":
  31179. return vue.withDirectives(vue.h(this.tag, {
  31180. style,
  31181. class: [
  31182. ns.e("cell"),
  31183. ns.e("label"),
  31184. ns.is("bordered-label", border),
  31185. ns.is("vertical-label", isVertical),
  31186. labelAlign,
  31187. labelClassName
  31188. ],
  31189. colSpan: isVertical ? span : 1,
  31190. rowspan: isVertical ? 1 : rowspan
  31191. }, renderLabel()), directives);
  31192. case "content":
  31193. return vue.withDirectives(vue.h(this.tag, {
  31194. style,
  31195. class: [
  31196. ns.e("cell"),
  31197. ns.e("content"),
  31198. ns.is("bordered-content", border),
  31199. ns.is("vertical-content", isVertical),
  31200. align,
  31201. className
  31202. ],
  31203. colSpan: isVertical ? span : span * 2 - 1,
  31204. rowspan: isVertical ? rowspan * 2 - 1 : rowspan
  31205. }, renderContent()), directives);
  31206. default: {
  31207. const label = renderLabel();
  31208. const labelStyle = {};
  31209. const width2 = addUnit(item.labelWidth || this.descriptions.labelWidth);
  31210. if (width2) {
  31211. labelStyle.width = width2;
  31212. labelStyle.display = "inline-block";
  31213. }
  31214. return vue.withDirectives(vue.h("td", {
  31215. style,
  31216. class: [ns.e("cell"), align],
  31217. colSpan: span,
  31218. rowspan
  31219. }, [
  31220. !isNil(label) ? vue.h("span", {
  31221. style: labelStyle,
  31222. class: [ns.e("label"), labelClassName]
  31223. }, label) : void 0,
  31224. vue.h("span", {
  31225. class: [ns.e("content"), className]
  31226. }, renderContent())
  31227. ]), directives);
  31228. }
  31229. }
  31230. }
  31231. });
  31232. const descriptionsRowProps = buildProps({
  31233. row: {
  31234. type: definePropType(Array),
  31235. default: () => []
  31236. }
  31237. });
  31238. const __default__$11 = vue.defineComponent({
  31239. name: "ElDescriptionsRow"
  31240. });
  31241. const _sfc_main$1o = /* @__PURE__ */ vue.defineComponent({
  31242. ...__default__$11,
  31243. props: descriptionsRowProps,
  31244. setup(__props) {
  31245. const descriptions = vue.inject(descriptionsKey, {});
  31246. return (_ctx, _cache) => {
  31247. return vue.unref(descriptions).direction === "vertical" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  31248. vue.createElementVNode("tr", null, [
  31249. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.row, (cell, _index) => {
  31250. return vue.openBlock(), vue.createBlock(vue.unref(ElDescriptionsCell), {
  31251. key: `tr1-${_index}`,
  31252. cell,
  31253. tag: "th",
  31254. type: "label"
  31255. }, null, 8, ["cell"]);
  31256. }), 128))
  31257. ]),
  31258. vue.createElementVNode("tr", null, [
  31259. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.row, (cell, _index) => {
  31260. return vue.openBlock(), vue.createBlock(vue.unref(ElDescriptionsCell), {
  31261. key: `tr2-${_index}`,
  31262. cell,
  31263. tag: "td",
  31264. type: "content"
  31265. }, null, 8, ["cell"]);
  31266. }), 128))
  31267. ])
  31268. ], 64)) : (vue.openBlock(), vue.createElementBlock("tr", { key: 1 }, [
  31269. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.row, (cell, _index) => {
  31270. return vue.openBlock(), vue.createElementBlock(vue.Fragment, {
  31271. key: `tr3-${_index}`
  31272. }, [
  31273. vue.unref(descriptions).border ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  31274. vue.createVNode(vue.unref(ElDescriptionsCell), {
  31275. cell,
  31276. tag: "td",
  31277. type: "label"
  31278. }, null, 8, ["cell"]),
  31279. vue.createVNode(vue.unref(ElDescriptionsCell), {
  31280. cell,
  31281. tag: "td",
  31282. type: "content"
  31283. }, null, 8, ["cell"])
  31284. ], 64)) : (vue.openBlock(), vue.createBlock(vue.unref(ElDescriptionsCell), {
  31285. key: 1,
  31286. cell,
  31287. tag: "td",
  31288. type: "both"
  31289. }, null, 8, ["cell"]))
  31290. ], 64);
  31291. }), 128))
  31292. ]));
  31293. };
  31294. }
  31295. });
  31296. var ElDescriptionsRow = /* @__PURE__ */ _export_sfc(_sfc_main$1o, [["__file", "descriptions-row.vue"]]);
  31297. const descriptionProps = buildProps({
  31298. border: Boolean,
  31299. column: {
  31300. type: Number,
  31301. default: 3
  31302. },
  31303. direction: {
  31304. type: String,
  31305. values: ["horizontal", "vertical"],
  31306. default: "horizontal"
  31307. },
  31308. size: useSizeProp,
  31309. title: {
  31310. type: String,
  31311. default: ""
  31312. },
  31313. extra: {
  31314. type: String,
  31315. default: ""
  31316. },
  31317. labelWidth: {
  31318. type: [String, Number],
  31319. default: ""
  31320. }
  31321. });
  31322. const COMPONENT_NAME$f = "ElDescriptionsItem";
  31323. const __default__$10 = vue.defineComponent({
  31324. name: "ElDescriptions"
  31325. });
  31326. const _sfc_main$1n = /* @__PURE__ */ vue.defineComponent({
  31327. ...__default__$10,
  31328. props: descriptionProps,
  31329. setup(__props) {
  31330. const props = __props;
  31331. const ns = useNamespace("descriptions");
  31332. const descriptionsSize = useFormSize();
  31333. const slots = vue.useSlots();
  31334. vue.provide(descriptionsKey, props);
  31335. const descriptionKls = vue.computed(() => [ns.b(), ns.m(descriptionsSize.value)]);
  31336. const filledNode = (node, span, count, isLast = false) => {
  31337. if (!node.props) {
  31338. node.props = {};
  31339. }
  31340. if (span > count) {
  31341. node.props.span = count;
  31342. }
  31343. if (isLast) {
  31344. node.props.span = span;
  31345. }
  31346. return node;
  31347. };
  31348. const getRows = () => {
  31349. if (!slots.default)
  31350. return [];
  31351. const children = flattedChildren(slots.default()).filter((node) => {
  31352. var _a;
  31353. return ((_a = node == null ? void 0 : node.type) == null ? void 0 : _a.name) === COMPONENT_NAME$f;
  31354. });
  31355. const rows = [];
  31356. let temp = [];
  31357. let count = props.column;
  31358. let totalSpan = 0;
  31359. const rowspanTemp = [];
  31360. children.forEach((node, index) => {
  31361. var _a, _b, _c;
  31362. const span = ((_a = node.props) == null ? void 0 : _a.span) || 1;
  31363. const rowspan = ((_b = node.props) == null ? void 0 : _b.rowspan) || 1;
  31364. const rowNo = rows.length;
  31365. rowspanTemp[rowNo] || (rowspanTemp[rowNo] = 0);
  31366. if (rowspan > 1) {
  31367. for (let i = 1; i < rowspan; i++) {
  31368. rowspanTemp[_c = rowNo + i] || (rowspanTemp[_c] = 0);
  31369. rowspanTemp[rowNo + i]++;
  31370. totalSpan++;
  31371. }
  31372. }
  31373. if (rowspanTemp[rowNo] > 0) {
  31374. count -= rowspanTemp[rowNo];
  31375. rowspanTemp[rowNo] = 0;
  31376. }
  31377. if (index < children.length - 1) {
  31378. totalSpan += span > count ? count : span;
  31379. }
  31380. if (index === children.length - 1) {
  31381. const lastSpan = props.column - totalSpan % props.column;
  31382. temp.push(filledNode(node, lastSpan, count, true));
  31383. rows.push(temp);
  31384. return;
  31385. }
  31386. if (span < count) {
  31387. count -= span;
  31388. temp.push(node);
  31389. } else {
  31390. temp.push(filledNode(node, span, count));
  31391. rows.push(temp);
  31392. count = props.column;
  31393. temp = [];
  31394. }
  31395. });
  31396. return rows;
  31397. };
  31398. return (_ctx, _cache) => {
  31399. return vue.openBlock(), vue.createElementBlock("div", {
  31400. class: vue.normalizeClass(vue.unref(descriptionKls))
  31401. }, [
  31402. _ctx.title || _ctx.extra || _ctx.$slots.title || _ctx.$slots.extra ? (vue.openBlock(), vue.createElementBlock("div", {
  31403. key: 0,
  31404. class: vue.normalizeClass(vue.unref(ns).e("header"))
  31405. }, [
  31406. vue.createElementVNode("div", {
  31407. class: vue.normalizeClass(vue.unref(ns).e("title"))
  31408. }, [
  31409. vue.renderSlot(_ctx.$slots, "title", {}, () => [
  31410. vue.createTextVNode(vue.toDisplayString(_ctx.title), 1)
  31411. ])
  31412. ], 2),
  31413. vue.createElementVNode("div", {
  31414. class: vue.normalizeClass(vue.unref(ns).e("extra"))
  31415. }, [
  31416. vue.renderSlot(_ctx.$slots, "extra", {}, () => [
  31417. vue.createTextVNode(vue.toDisplayString(_ctx.extra), 1)
  31418. ])
  31419. ], 2)
  31420. ], 2)) : vue.createCommentVNode("v-if", true),
  31421. vue.createElementVNode("div", {
  31422. class: vue.normalizeClass(vue.unref(ns).e("body"))
  31423. }, [
  31424. vue.createElementVNode("table", {
  31425. class: vue.normalizeClass([vue.unref(ns).e("table"), vue.unref(ns).is("bordered", _ctx.border)])
  31426. }, [
  31427. vue.createElementVNode("tbody", null, [
  31428. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(getRows(), (row, _index) => {
  31429. return vue.openBlock(), vue.createBlock(ElDescriptionsRow, {
  31430. key: _index,
  31431. row
  31432. }, null, 8, ["row"]);
  31433. }), 128))
  31434. ])
  31435. ], 2)
  31436. ], 2)
  31437. ], 2);
  31438. };
  31439. }
  31440. });
  31441. var Descriptions = /* @__PURE__ */ _export_sfc(_sfc_main$1n, [["__file", "description.vue"]]);
  31442. const descriptionItemProps = buildProps({
  31443. label: {
  31444. type: String,
  31445. default: ""
  31446. },
  31447. span: {
  31448. type: Number,
  31449. default: 1
  31450. },
  31451. rowspan: {
  31452. type: Number,
  31453. default: 1
  31454. },
  31455. width: {
  31456. type: [String, Number],
  31457. default: ""
  31458. },
  31459. minWidth: {
  31460. type: [String, Number],
  31461. default: ""
  31462. },
  31463. labelWidth: {
  31464. type: [String, Number],
  31465. default: ""
  31466. },
  31467. align: {
  31468. type: String,
  31469. values: columnAlignment,
  31470. default: "left"
  31471. },
  31472. labelAlign: {
  31473. type: String,
  31474. values: columnAlignment
  31475. },
  31476. className: {
  31477. type: String,
  31478. default: ""
  31479. },
  31480. labelClassName: {
  31481. type: String,
  31482. default: ""
  31483. }
  31484. });
  31485. const DescriptionItem = vue.defineComponent({
  31486. name: COMPONENT_NAME$f,
  31487. props: descriptionItemProps
  31488. });
  31489. const ElDescriptions = withInstall(Descriptions, {
  31490. DescriptionsItem: DescriptionItem
  31491. });
  31492. const ElDescriptionsItem = withNoopInstall(DescriptionItem);
  31493. const overlayProps = buildProps({
  31494. mask: {
  31495. type: Boolean,
  31496. default: true
  31497. },
  31498. customMaskEvent: Boolean,
  31499. overlayClass: {
  31500. type: definePropType([
  31501. String,
  31502. Array,
  31503. Object
  31504. ])
  31505. },
  31506. zIndex: {
  31507. type: definePropType([String, Number])
  31508. }
  31509. });
  31510. const overlayEmits = {
  31511. click: (evt) => evt instanceof MouseEvent
  31512. };
  31513. const BLOCK = "overlay";
  31514. var Overlay$1 = vue.defineComponent({
  31515. name: "ElOverlay",
  31516. props: overlayProps,
  31517. emits: overlayEmits,
  31518. setup(props, { slots, emit }) {
  31519. const ns = useNamespace(BLOCK);
  31520. const onMaskClick = (e) => {
  31521. emit("click", e);
  31522. };
  31523. const { onClick, onMousedown, onMouseup } = useSameTarget(props.customMaskEvent ? void 0 : onMaskClick);
  31524. return () => {
  31525. return props.mask ? vue.createVNode("div", {
  31526. class: [ns.b(), props.overlayClass],
  31527. style: {
  31528. zIndex: props.zIndex
  31529. },
  31530. onClick,
  31531. onMousedown,
  31532. onMouseup
  31533. }, [vue.renderSlot(slots, "default")], PatchFlags.STYLE | PatchFlags.CLASS | PatchFlags.PROPS, ["onClick", "onMouseup", "onMousedown"]) : vue.h("div", {
  31534. class: props.overlayClass,
  31535. style: {
  31536. zIndex: props.zIndex,
  31537. position: "fixed",
  31538. top: "0px",
  31539. right: "0px",
  31540. bottom: "0px",
  31541. left: "0px"
  31542. }
  31543. }, [vue.renderSlot(slots, "default")]);
  31544. };
  31545. }
  31546. });
  31547. const ElOverlay = Overlay$1;
  31548. const dialogInjectionKey = Symbol("dialogInjectionKey");
  31549. const DEFAULT_DIALOG_TRANSITION = "dialog-fade";
  31550. const dialogContentProps = buildProps({
  31551. center: Boolean,
  31552. alignCenter: {
  31553. type: Boolean,
  31554. default: void 0
  31555. },
  31556. closeIcon: {
  31557. type: iconPropType
  31558. },
  31559. draggable: {
  31560. type: Boolean,
  31561. default: void 0
  31562. },
  31563. overflow: {
  31564. type: Boolean,
  31565. default: void 0
  31566. },
  31567. fullscreen: Boolean,
  31568. headerClass: String,
  31569. bodyClass: String,
  31570. footerClass: String,
  31571. showClose: {
  31572. type: Boolean,
  31573. default: true
  31574. },
  31575. title: {
  31576. type: String,
  31577. default: ""
  31578. },
  31579. ariaLevel: {
  31580. type: String,
  31581. default: "2"
  31582. }
  31583. });
  31584. const dialogContentEmits = {
  31585. close: () => true
  31586. };
  31587. const __default__$$ = vue.defineComponent({ name: "ElDialogContent" });
  31588. const _sfc_main$1m = /* @__PURE__ */ vue.defineComponent({
  31589. ...__default__$$,
  31590. props: dialogContentProps,
  31591. emits: dialogContentEmits,
  31592. setup(__props, { expose }) {
  31593. const props = __props;
  31594. const { t } = useLocale();
  31595. const { Close } = CloseComponents;
  31596. const { dialogRef, headerRef, bodyId, ns, style } = vue.inject(dialogInjectionKey);
  31597. const { focusTrapRef } = vue.inject(FOCUS_TRAP_INJECTION_KEY);
  31598. const composedDialogRef = composeRefs(focusTrapRef, dialogRef);
  31599. const draggable = vue.computed(() => !!props.draggable);
  31600. const overflow = vue.computed(() => !!props.overflow);
  31601. const { resetPosition, updatePosition, isDragging } = useDraggable(dialogRef, headerRef, draggable, overflow);
  31602. const dialogKls = vue.computed(() => [
  31603. ns.b(),
  31604. ns.is("fullscreen", props.fullscreen),
  31605. ns.is("draggable", draggable.value),
  31606. ns.is("dragging", isDragging.value),
  31607. ns.is("align-center", !!props.alignCenter),
  31608. { [ns.m("center")]: props.center }
  31609. ]);
  31610. expose({
  31611. resetPosition,
  31612. updatePosition
  31613. });
  31614. return (_ctx, _cache) => {
  31615. return vue.openBlock(), vue.createElementBlock("div", {
  31616. ref: vue.unref(composedDialogRef),
  31617. class: vue.normalizeClass(vue.unref(dialogKls)),
  31618. style: vue.normalizeStyle(vue.unref(style)),
  31619. tabindex: "-1"
  31620. }, [
  31621. vue.createElementVNode("header", {
  31622. ref_key: "headerRef",
  31623. ref: headerRef,
  31624. class: vue.normalizeClass([vue.unref(ns).e("header"), _ctx.headerClass, { "show-close": _ctx.showClose }])
  31625. }, [
  31626. vue.renderSlot(_ctx.$slots, "header", {}, () => [
  31627. vue.createElementVNode("span", {
  31628. role: "heading",
  31629. "aria-level": _ctx.ariaLevel,
  31630. class: vue.normalizeClass(vue.unref(ns).e("title"))
  31631. }, vue.toDisplayString(_ctx.title), 11, ["aria-level"])
  31632. ]),
  31633. _ctx.showClose ? (vue.openBlock(), vue.createElementBlock("button", {
  31634. key: 0,
  31635. "aria-label": vue.unref(t)("el.dialog.close"),
  31636. class: vue.normalizeClass(vue.unref(ns).e("headerbtn")),
  31637. type: "button",
  31638. onClick: ($event) => _ctx.$emit("close")
  31639. }, [
  31640. vue.createVNode(vue.unref(ElIcon), {
  31641. class: vue.normalizeClass(vue.unref(ns).e("close"))
  31642. }, {
  31643. default: vue.withCtx(() => [
  31644. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.closeIcon || vue.unref(Close))))
  31645. ]),
  31646. _: 1
  31647. }, 8, ["class"])
  31648. ], 10, ["aria-label", "onClick"])) : vue.createCommentVNode("v-if", true)
  31649. ], 2),
  31650. vue.createElementVNode("div", {
  31651. id: vue.unref(bodyId),
  31652. class: vue.normalizeClass([vue.unref(ns).e("body"), _ctx.bodyClass])
  31653. }, [
  31654. vue.renderSlot(_ctx.$slots, "default")
  31655. ], 10, ["id"]),
  31656. _ctx.$slots.footer ? (vue.openBlock(), vue.createElementBlock("footer", {
  31657. key: 0,
  31658. class: vue.normalizeClass([vue.unref(ns).e("footer"), _ctx.footerClass])
  31659. }, [
  31660. vue.renderSlot(_ctx.$slots, "footer")
  31661. ], 2)) : vue.createCommentVNode("v-if", true)
  31662. ], 6);
  31663. };
  31664. }
  31665. });
  31666. var ElDialogContent = /* @__PURE__ */ _export_sfc(_sfc_main$1m, [["__file", "dialog-content.vue"]]);
  31667. const dialogProps = buildProps({
  31668. ...dialogContentProps,
  31669. appendToBody: Boolean,
  31670. appendTo: {
  31671. type: teleportProps.to.type,
  31672. default: "body"
  31673. },
  31674. beforeClose: {
  31675. type: definePropType(Function)
  31676. },
  31677. destroyOnClose: Boolean,
  31678. closeOnClickModal: {
  31679. type: Boolean,
  31680. default: true
  31681. },
  31682. closeOnPressEscape: {
  31683. type: Boolean,
  31684. default: true
  31685. },
  31686. lockScroll: {
  31687. type: Boolean,
  31688. default: true
  31689. },
  31690. modal: {
  31691. type: Boolean,
  31692. default: true
  31693. },
  31694. modalPenetrable: Boolean,
  31695. openDelay: {
  31696. type: Number,
  31697. default: 0
  31698. },
  31699. closeDelay: {
  31700. type: Number,
  31701. default: 0
  31702. },
  31703. top: {
  31704. type: String
  31705. },
  31706. modelValue: Boolean,
  31707. modalClass: String,
  31708. headerClass: String,
  31709. bodyClass: String,
  31710. footerClass: String,
  31711. width: {
  31712. type: [String, Number]
  31713. },
  31714. zIndex: {
  31715. type: Number
  31716. },
  31717. trapFocus: Boolean,
  31718. headerAriaLevel: {
  31719. type: String,
  31720. default: "2"
  31721. },
  31722. transition: {
  31723. type: definePropType([String, Object]),
  31724. default: void 0
  31725. }
  31726. });
  31727. const dialogEmits = {
  31728. open: () => true,
  31729. opened: () => true,
  31730. close: () => true,
  31731. closed: () => true,
  31732. [UPDATE_MODEL_EVENT]: (value) => isBoolean(value),
  31733. openAutoFocus: () => true,
  31734. closeAutoFocus: () => true
  31735. };
  31736. const dialogContextKey = Symbol("dialogContextKey");
  31737. const COMPONENT_NAME$e = "ElDialog";
  31738. const useDialog = (props, targetRef) => {
  31739. var _a;
  31740. const instance = vue.getCurrentInstance();
  31741. const emit = instance.emit;
  31742. const { nextZIndex } = useZIndex();
  31743. let lastPosition = "";
  31744. const titleId = useId();
  31745. const bodyId = useId();
  31746. const visible = vue.ref(false);
  31747. const closed = vue.ref(false);
  31748. const rendered = vue.ref(false);
  31749. const zIndex = vue.ref((_a = props.zIndex) != null ? _a : nextZIndex());
  31750. let openTimer = void 0;
  31751. let closeTimer = void 0;
  31752. const config = useGlobalConfig();
  31753. const namespace = vue.computed(() => {
  31754. var _a2, _b;
  31755. return (_b = (_a2 = config.value) == null ? void 0 : _a2.namespace) != null ? _b : defaultNamespace;
  31756. });
  31757. const globalConfig = vue.computed(() => {
  31758. var _a2;
  31759. return (_a2 = config.value) == null ? void 0 : _a2.dialog;
  31760. });
  31761. const style = vue.computed(() => {
  31762. const style2 = {};
  31763. const varPrefix = `--${namespace.value}-dialog`;
  31764. if (!props.fullscreen) {
  31765. if (props.top) {
  31766. style2[`${varPrefix}-margin-top`] = props.top;
  31767. }
  31768. if (props.width) {
  31769. style2[`${varPrefix}-width`] = addUnit(props.width);
  31770. }
  31771. }
  31772. return style2;
  31773. });
  31774. const _draggable = vue.computed(() => {
  31775. var _a2, _b, _c;
  31776. return ((_c = (_b = props.draggable) != null ? _b : (_a2 = globalConfig.value) == null ? void 0 : _a2.draggable) != null ? _c : false) && !props.fullscreen;
  31777. });
  31778. const _alignCenter = vue.computed(() => {
  31779. var _a2, _b, _c;
  31780. return (_c = (_b = props.alignCenter) != null ? _b : (_a2 = globalConfig.value) == null ? void 0 : _a2.alignCenter) != null ? _c : false;
  31781. });
  31782. const _overflow = vue.computed(() => {
  31783. var _a2, _b, _c;
  31784. return (_c = (_b = props.overflow) != null ? _b : (_a2 = globalConfig.value) == null ? void 0 : _a2.overflow) != null ? _c : false;
  31785. });
  31786. const overlayDialogStyle = vue.computed(() => {
  31787. if (_alignCenter.value) {
  31788. return { display: "flex" };
  31789. }
  31790. return {};
  31791. });
  31792. const transitionConfig = vue.computed(() => {
  31793. var _a2, _b, _c;
  31794. const transition = (_c = (_b = props.transition) != null ? _b : (_a2 = globalConfig.value) == null ? void 0 : _a2.transition) != null ? _c : DEFAULT_DIALOG_TRANSITION;
  31795. const baseConfig = {
  31796. name: transition,
  31797. onAfterEnter: afterEnter,
  31798. onBeforeLeave: beforeLeave,
  31799. onAfterLeave: afterLeave
  31800. };
  31801. if (isObject$1(transition)) {
  31802. const config2 = { ...transition };
  31803. const _mergeHook = (userHook, defaultHook) => {
  31804. return (el) => {
  31805. if (isArray$1(userHook)) {
  31806. userHook.forEach((fn) => {
  31807. if (isFunction$1(fn))
  31808. fn(el);
  31809. });
  31810. } else if (isFunction$1(userHook)) {
  31811. userHook(el);
  31812. }
  31813. defaultHook();
  31814. };
  31815. };
  31816. config2.onAfterEnter = _mergeHook(config2.onAfterEnter, afterEnter);
  31817. config2.onBeforeLeave = _mergeHook(config2.onBeforeLeave, beforeLeave);
  31818. config2.onAfterLeave = _mergeHook(config2.onAfterLeave, afterLeave);
  31819. if (!config2.name) {
  31820. config2.name = DEFAULT_DIALOG_TRANSITION;
  31821. debugWarn(COMPONENT_NAME$e, `transition.name is missing when using object syntax, fallback to '${DEFAULT_DIALOG_TRANSITION}'`);
  31822. }
  31823. return config2;
  31824. }
  31825. return baseConfig;
  31826. });
  31827. function afterEnter() {
  31828. emit("opened");
  31829. }
  31830. function afterLeave() {
  31831. emit("closed");
  31832. emit(UPDATE_MODEL_EVENT, false);
  31833. if (props.destroyOnClose) {
  31834. rendered.value = false;
  31835. }
  31836. }
  31837. function beforeLeave() {
  31838. emit("close");
  31839. }
  31840. function open() {
  31841. closeTimer == null ? void 0 : closeTimer();
  31842. openTimer == null ? void 0 : openTimer();
  31843. if (props.openDelay && props.openDelay > 0) {
  31844. ({ stop: openTimer } = useTimeoutFn(() => doOpen(), props.openDelay));
  31845. } else {
  31846. doOpen();
  31847. }
  31848. }
  31849. function close() {
  31850. openTimer == null ? void 0 : openTimer();
  31851. closeTimer == null ? void 0 : closeTimer();
  31852. if (props.closeDelay && props.closeDelay > 0) {
  31853. ({ stop: closeTimer } = useTimeoutFn(() => doClose(), props.closeDelay));
  31854. } else {
  31855. doClose();
  31856. }
  31857. }
  31858. function handleClose() {
  31859. function hide(shouldCancel) {
  31860. if (shouldCancel)
  31861. return;
  31862. closed.value = true;
  31863. visible.value = false;
  31864. }
  31865. if (props.beforeClose) {
  31866. props.beforeClose(hide);
  31867. } else {
  31868. close();
  31869. }
  31870. }
  31871. function onModalClick() {
  31872. if (props.closeOnClickModal) {
  31873. handleClose();
  31874. }
  31875. }
  31876. function doOpen() {
  31877. if (!isClient)
  31878. return;
  31879. visible.value = true;
  31880. }
  31881. function doClose() {
  31882. visible.value = false;
  31883. }
  31884. function onOpenAutoFocus() {
  31885. emit("openAutoFocus");
  31886. }
  31887. function onCloseAutoFocus() {
  31888. emit("closeAutoFocus");
  31889. }
  31890. function onFocusoutPrevented(event) {
  31891. var _a2;
  31892. if (((_a2 = event.detail) == null ? void 0 : _a2.focusReason) === "pointer") {
  31893. event.preventDefault();
  31894. }
  31895. }
  31896. if (props.lockScroll) {
  31897. useLockscreen(visible);
  31898. }
  31899. function onCloseRequested() {
  31900. if (props.closeOnPressEscape) {
  31901. handleClose();
  31902. }
  31903. }
  31904. vue.watch(() => props.zIndex, () => {
  31905. var _a2;
  31906. zIndex.value = (_a2 = props.zIndex) != null ? _a2 : nextZIndex();
  31907. });
  31908. vue.watch(() => props.modelValue, (val) => {
  31909. var _a2;
  31910. if (val) {
  31911. closed.value = false;
  31912. open();
  31913. rendered.value = true;
  31914. zIndex.value = (_a2 = props.zIndex) != null ? _a2 : nextZIndex();
  31915. vue.nextTick(() => {
  31916. emit("open");
  31917. if (targetRef.value) {
  31918. targetRef.value.parentElement.scrollTop = 0;
  31919. targetRef.value.parentElement.scrollLeft = 0;
  31920. targetRef.value.scrollTop = 0;
  31921. }
  31922. });
  31923. } else {
  31924. if (visible.value) {
  31925. close();
  31926. }
  31927. }
  31928. });
  31929. vue.watch(() => props.fullscreen, (val) => {
  31930. if (!targetRef.value)
  31931. return;
  31932. if (val) {
  31933. lastPosition = targetRef.value.style.transform;
  31934. targetRef.value.style.transform = "";
  31935. } else {
  31936. targetRef.value.style.transform = lastPosition;
  31937. }
  31938. });
  31939. vue.onMounted(() => {
  31940. if (props.modelValue) {
  31941. visible.value = true;
  31942. rendered.value = true;
  31943. open();
  31944. }
  31945. });
  31946. return {
  31947. afterEnter,
  31948. afterLeave,
  31949. beforeLeave,
  31950. handleClose,
  31951. onModalClick,
  31952. close,
  31953. doClose,
  31954. onOpenAutoFocus,
  31955. onCloseAutoFocus,
  31956. onCloseRequested,
  31957. onFocusoutPrevented,
  31958. titleId,
  31959. bodyId,
  31960. closed,
  31961. style,
  31962. overlayDialogStyle,
  31963. rendered,
  31964. visible,
  31965. zIndex,
  31966. transitionConfig,
  31967. _draggable,
  31968. _alignCenter,
  31969. _overflow
  31970. };
  31971. };
  31972. const __default__$_ = vue.defineComponent({
  31973. name: "ElDialog",
  31974. inheritAttrs: false
  31975. });
  31976. const _sfc_main$1l = /* @__PURE__ */ vue.defineComponent({
  31977. ...__default__$_,
  31978. props: dialogProps,
  31979. emits: dialogEmits,
  31980. setup(__props, { expose }) {
  31981. const props = __props;
  31982. const slots = vue.useSlots();
  31983. useDeprecated({
  31984. scope: "el-dialog",
  31985. from: "the title slot",
  31986. replacement: "the header slot",
  31987. version: "3.0.0",
  31988. ref: "https://element-plus.org/en-US/component/dialog.html#slots"
  31989. }, vue.computed(() => !!slots.title));
  31990. const ns = useNamespace("dialog");
  31991. const dialogRef = vue.ref();
  31992. const headerRef = vue.ref();
  31993. const dialogContentRef = vue.ref();
  31994. const {
  31995. visible,
  31996. titleId,
  31997. bodyId,
  31998. style,
  31999. overlayDialogStyle,
  32000. rendered,
  32001. transitionConfig,
  32002. zIndex,
  32003. _draggable,
  32004. _alignCenter,
  32005. _overflow,
  32006. handleClose,
  32007. onModalClick,
  32008. onOpenAutoFocus,
  32009. onCloseAutoFocus,
  32010. onCloseRequested,
  32011. onFocusoutPrevented
  32012. } = useDialog(props, dialogRef);
  32013. vue.provide(dialogInjectionKey, {
  32014. dialogRef,
  32015. headerRef,
  32016. bodyId,
  32017. ns,
  32018. rendered,
  32019. style
  32020. });
  32021. const overlayEvent = useSameTarget(onModalClick);
  32022. const penetrable = vue.computed(() => props.modalPenetrable && !props.modal && !props.fullscreen);
  32023. const resetPosition = () => {
  32024. var _a;
  32025. (_a = dialogContentRef.value) == null ? void 0 : _a.resetPosition();
  32026. };
  32027. expose({
  32028. visible,
  32029. dialogContentRef,
  32030. resetPosition,
  32031. handleClose
  32032. });
  32033. return (_ctx, _cache) => {
  32034. return vue.openBlock(), vue.createBlock(vue.unref(ElTeleport$1), {
  32035. to: _ctx.appendTo,
  32036. disabled: _ctx.appendTo !== "body" ? false : !_ctx.appendToBody
  32037. }, {
  32038. default: vue.withCtx(() => [
  32039. vue.createVNode(vue.Transition, vue.mergeProps(vue.unref(transitionConfig), { persisted: "" }), {
  32040. default: vue.withCtx(() => {
  32041. var _a;
  32042. return [
  32043. vue.withDirectives(vue.createVNode(vue.unref(ElOverlay), {
  32044. "custom-mask-event": "",
  32045. mask: _ctx.modal,
  32046. "overlay-class": [
  32047. (_a = _ctx.modalClass) != null ? _a : "",
  32048. `${vue.unref(ns).namespace.value}-modal-dialog`,
  32049. vue.unref(ns).is("penetrable", vue.unref(penetrable))
  32050. ],
  32051. "z-index": vue.unref(zIndex)
  32052. }, {
  32053. default: vue.withCtx(() => [
  32054. vue.createElementVNode("div", {
  32055. role: "dialog",
  32056. "aria-modal": "true",
  32057. "aria-label": _ctx.title || void 0,
  32058. "aria-labelledby": !_ctx.title ? vue.unref(titleId) : void 0,
  32059. "aria-describedby": vue.unref(bodyId),
  32060. class: vue.normalizeClass(`${vue.unref(ns).namespace.value}-overlay-dialog`),
  32061. style: vue.normalizeStyle(vue.unref(overlayDialogStyle)),
  32062. onClick: vue.unref(overlayEvent).onClick,
  32063. onMousedown: vue.unref(overlayEvent).onMousedown,
  32064. onMouseup: vue.unref(overlayEvent).onMouseup
  32065. }, [
  32066. vue.createVNode(vue.unref(ElFocusTrap), {
  32067. loop: "",
  32068. trapped: vue.unref(visible),
  32069. "focus-start-el": "container",
  32070. onFocusAfterTrapped: vue.unref(onOpenAutoFocus),
  32071. onFocusAfterReleased: vue.unref(onCloseAutoFocus),
  32072. onFocusoutPrevented: vue.unref(onFocusoutPrevented),
  32073. onReleaseRequested: vue.unref(onCloseRequested)
  32074. }, {
  32075. default: vue.withCtx(() => [
  32076. vue.unref(rendered) ? (vue.openBlock(), vue.createBlock(ElDialogContent, vue.mergeProps({
  32077. key: 0,
  32078. ref_key: "dialogContentRef",
  32079. ref: dialogContentRef
  32080. }, _ctx.$attrs, {
  32081. center: _ctx.center,
  32082. "align-center": vue.unref(_alignCenter),
  32083. "close-icon": _ctx.closeIcon,
  32084. draggable: vue.unref(_draggable),
  32085. overflow: vue.unref(_overflow),
  32086. fullscreen: _ctx.fullscreen,
  32087. "header-class": _ctx.headerClass,
  32088. "body-class": _ctx.bodyClass,
  32089. "footer-class": _ctx.footerClass,
  32090. "show-close": _ctx.showClose,
  32091. title: _ctx.title,
  32092. "aria-level": _ctx.headerAriaLevel,
  32093. onClose: vue.unref(handleClose)
  32094. }), vue.createSlots({
  32095. header: vue.withCtx(() => [
  32096. !_ctx.$slots.title ? vue.renderSlot(_ctx.$slots, "header", {
  32097. key: 0,
  32098. close: vue.unref(handleClose),
  32099. titleId: vue.unref(titleId),
  32100. titleClass: vue.unref(ns).e("title")
  32101. }) : vue.renderSlot(_ctx.$slots, "title", { key: 1 })
  32102. ]),
  32103. default: vue.withCtx(() => [
  32104. vue.renderSlot(_ctx.$slots, "default")
  32105. ]),
  32106. _: 2
  32107. }, [
  32108. _ctx.$slots.footer ? {
  32109. name: "footer",
  32110. fn: vue.withCtx(() => [
  32111. vue.renderSlot(_ctx.$slots, "footer")
  32112. ])
  32113. } : void 0
  32114. ]), 1040, ["center", "align-center", "close-icon", "draggable", "overflow", "fullscreen", "header-class", "body-class", "footer-class", "show-close", "title", "aria-level", "onClose"])) : vue.createCommentVNode("v-if", true)
  32115. ]),
  32116. _: 3
  32117. }, 8, ["trapped", "onFocusAfterTrapped", "onFocusAfterReleased", "onFocusoutPrevented", "onReleaseRequested"])
  32118. ], 46, ["aria-label", "aria-labelledby", "aria-describedby", "onClick", "onMousedown", "onMouseup"])
  32119. ]),
  32120. _: 3
  32121. }, 8, ["mask", "overlay-class", "z-index"]), [
  32122. [vue.vShow, vue.unref(visible)]
  32123. ])
  32124. ];
  32125. }),
  32126. _: 3
  32127. }, 16)
  32128. ]),
  32129. _: 3
  32130. }, 8, ["to", "disabled"]);
  32131. };
  32132. }
  32133. });
  32134. var Dialog = /* @__PURE__ */ _export_sfc(_sfc_main$1l, [["__file", "dialog.vue"]]);
  32135. const ElDialog = withInstall(Dialog);
  32136. const dividerProps = buildProps({
  32137. direction: {
  32138. type: String,
  32139. values: ["horizontal", "vertical"],
  32140. default: "horizontal"
  32141. },
  32142. contentPosition: {
  32143. type: String,
  32144. values: ["left", "center", "right"],
  32145. default: "center"
  32146. },
  32147. borderStyle: {
  32148. type: definePropType(String),
  32149. default: "solid"
  32150. }
  32151. });
  32152. const __default__$Z = vue.defineComponent({
  32153. name: "ElDivider"
  32154. });
  32155. const _sfc_main$1k = /* @__PURE__ */ vue.defineComponent({
  32156. ...__default__$Z,
  32157. props: dividerProps,
  32158. setup(__props) {
  32159. const props = __props;
  32160. const ns = useNamespace("divider");
  32161. const dividerStyle = vue.computed(() => {
  32162. return ns.cssVar({
  32163. "border-style": props.borderStyle
  32164. });
  32165. });
  32166. return (_ctx, _cache) => {
  32167. return vue.openBlock(), vue.createElementBlock("div", {
  32168. class: vue.normalizeClass([vue.unref(ns).b(), vue.unref(ns).m(_ctx.direction)]),
  32169. style: vue.normalizeStyle(vue.unref(dividerStyle)),
  32170. role: "separator"
  32171. }, [
  32172. _ctx.$slots.default && _ctx.direction !== "vertical" ? (vue.openBlock(), vue.createElementBlock("div", {
  32173. key: 0,
  32174. class: vue.normalizeClass([vue.unref(ns).e("text"), vue.unref(ns).is(_ctx.contentPosition)])
  32175. }, [
  32176. vue.renderSlot(_ctx.$slots, "default")
  32177. ], 2)) : vue.createCommentVNode("v-if", true)
  32178. ], 6);
  32179. };
  32180. }
  32181. });
  32182. var Divider = /* @__PURE__ */ _export_sfc(_sfc_main$1k, [["__file", "divider.vue"]]);
  32183. const ElDivider = withInstall(Divider);
  32184. const drawerProps = buildProps({
  32185. ...dialogProps,
  32186. direction: {
  32187. type: String,
  32188. default: "rtl",
  32189. values: ["ltr", "rtl", "ttb", "btt"]
  32190. },
  32191. resizable: Boolean,
  32192. size: {
  32193. type: [String, Number],
  32194. default: "30%"
  32195. },
  32196. withHeader: {
  32197. type: Boolean,
  32198. default: true
  32199. },
  32200. modalFade: {
  32201. type: Boolean,
  32202. default: true
  32203. },
  32204. headerAriaLevel: {
  32205. type: String,
  32206. default: "2"
  32207. }
  32208. });
  32209. const drawerEmits = dialogEmits;
  32210. function useResizable(props, target) {
  32211. const { width, height } = useWindowSize();
  32212. const isHorizontal = vue.computed(() => ["ltr", "rtl"].includes(props.direction));
  32213. const sign = vue.computed(() => ["ltr", "ttb"].includes(props.direction) ? 1 : -1);
  32214. const windowSize = vue.computed(() => isHorizontal.value ? width.value : height.value);
  32215. const getSize = vue.computed(() => {
  32216. return clamp$2(startSize.value + sign.value * offset.value, 4, windowSize.value);
  32217. });
  32218. const startSize = vue.ref(0);
  32219. const offset = vue.ref(0);
  32220. const isResizing = vue.ref(false);
  32221. const hasStartedDragging = vue.ref(false);
  32222. let startPos = [];
  32223. let cleanups = [];
  32224. const getActualSize = () => {
  32225. var _a;
  32226. const drawerEl = (_a = target.value) == null ? void 0 : _a.closest('[aria-modal="true"]');
  32227. if (drawerEl) {
  32228. return isHorizontal.value ? drawerEl.offsetWidth : drawerEl.offsetHeight;
  32229. }
  32230. return 100;
  32231. };
  32232. vue.watch(() => [props.size, props.resizable], () => {
  32233. hasStartedDragging.value = false;
  32234. startSize.value = 0;
  32235. offset.value = 0;
  32236. onMouseUp();
  32237. });
  32238. const onMousedown = (e) => {
  32239. if (!props.resizable)
  32240. return;
  32241. if (!hasStartedDragging.value) {
  32242. startSize.value = getActualSize();
  32243. hasStartedDragging.value = true;
  32244. }
  32245. startPos = [e.pageX, e.pageY];
  32246. isResizing.value = true;
  32247. cleanups.push(useEventListener(window, "mouseup", onMouseUp), useEventListener(window, "mousemove", onMouseMove));
  32248. };
  32249. const onMouseMove = (e) => {
  32250. const { pageX, pageY } = e;
  32251. const offsetX = pageX - startPos[0];
  32252. const offsetY = pageY - startPos[1];
  32253. offset.value = isHorizontal.value ? offsetX : offsetY;
  32254. };
  32255. const onMouseUp = () => {
  32256. startPos = [];
  32257. startSize.value = getSize.value;
  32258. offset.value = 0;
  32259. isResizing.value = false;
  32260. cleanups.forEach((cleanup2) => cleanup2 == null ? void 0 : cleanup2());
  32261. cleanups = [];
  32262. };
  32263. const cleanup = useEventListener(target, "mousedown", onMousedown);
  32264. vue.onBeforeUnmount(() => {
  32265. cleanup();
  32266. onMouseUp();
  32267. });
  32268. return {
  32269. size: vue.computed(() => {
  32270. return hasStartedDragging.value ? `${getSize.value}px` : addUnit(props.size);
  32271. }),
  32272. isResizing,
  32273. isHorizontal
  32274. };
  32275. }
  32276. const __default__$Y = vue.defineComponent({
  32277. name: "ElDrawer",
  32278. inheritAttrs: false
  32279. });
  32280. const _sfc_main$1j = /* @__PURE__ */ vue.defineComponent({
  32281. ...__default__$Y,
  32282. props: drawerProps,
  32283. emits: drawerEmits,
  32284. setup(__props, { expose }) {
  32285. const props = __props;
  32286. const slots = vue.useSlots();
  32287. useDeprecated({
  32288. scope: "el-drawer",
  32289. from: "the title slot",
  32290. replacement: "the header slot",
  32291. version: "3.0.0",
  32292. ref: "https://element-plus.org/en-US/component/drawer.html#slots"
  32293. }, vue.computed(() => !!slots.title));
  32294. const drawerRef = vue.ref();
  32295. const focusStartRef = vue.ref();
  32296. const draggerRef = vue.ref();
  32297. const ns = useNamespace("drawer");
  32298. const { t } = useLocale();
  32299. const {
  32300. afterEnter,
  32301. afterLeave,
  32302. beforeLeave,
  32303. visible,
  32304. rendered,
  32305. titleId,
  32306. bodyId,
  32307. zIndex,
  32308. onModalClick,
  32309. onOpenAutoFocus,
  32310. onCloseAutoFocus,
  32311. onFocusoutPrevented,
  32312. onCloseRequested,
  32313. handleClose
  32314. } = useDialog(props, drawerRef);
  32315. const { isHorizontal, size, isResizing } = useResizable(props, draggerRef);
  32316. const penetrable = vue.computed(() => props.modalPenetrable && !props.modal);
  32317. expose({
  32318. handleClose,
  32319. afterEnter,
  32320. afterLeave
  32321. });
  32322. return (_ctx, _cache) => {
  32323. return vue.openBlock(), vue.createBlock(vue.unref(ElTeleport$1), {
  32324. to: _ctx.appendTo,
  32325. disabled: _ctx.appendTo !== "body" ? false : !_ctx.appendToBody
  32326. }, {
  32327. default: vue.withCtx(() => [
  32328. vue.createVNode(vue.Transition, {
  32329. name: vue.unref(ns).b("fade"),
  32330. onAfterEnter: vue.unref(afterEnter),
  32331. onAfterLeave: vue.unref(afterLeave),
  32332. onBeforeLeave: vue.unref(beforeLeave),
  32333. persisted: ""
  32334. }, {
  32335. default: vue.withCtx(() => {
  32336. var _a;
  32337. return [
  32338. vue.withDirectives(vue.createVNode(vue.unref(ElOverlay), {
  32339. mask: _ctx.modal,
  32340. "overlay-class": [
  32341. vue.unref(ns).is("drawer"),
  32342. (_a = _ctx.modalClass) != null ? _a : "",
  32343. `${vue.unref(ns).namespace.value}-modal-drawer`,
  32344. vue.unref(ns).is("penetrable", vue.unref(penetrable))
  32345. ],
  32346. "z-index": vue.unref(zIndex),
  32347. onClick: vue.unref(onModalClick)
  32348. }, {
  32349. default: vue.withCtx(() => [
  32350. vue.createVNode(vue.unref(ElFocusTrap), {
  32351. loop: "",
  32352. trapped: vue.unref(visible),
  32353. "focus-trap-el": drawerRef.value,
  32354. "focus-start-el": focusStartRef.value,
  32355. onFocusAfterTrapped: vue.unref(onOpenAutoFocus),
  32356. onFocusAfterReleased: vue.unref(onCloseAutoFocus),
  32357. onFocusoutPrevented: vue.unref(onFocusoutPrevented),
  32358. onReleaseRequested: vue.unref(onCloseRequested)
  32359. }, {
  32360. default: vue.withCtx(() => [
  32361. vue.createElementVNode("div", vue.mergeProps({
  32362. ref_key: "drawerRef",
  32363. ref: drawerRef,
  32364. "aria-modal": "true",
  32365. "aria-label": _ctx.title || void 0,
  32366. "aria-labelledby": !_ctx.title ? vue.unref(titleId) : void 0,
  32367. "aria-describedby": vue.unref(bodyId)
  32368. }, _ctx.$attrs, {
  32369. class: [
  32370. vue.unref(ns).b(),
  32371. _ctx.direction,
  32372. vue.unref(visible) && "open",
  32373. vue.unref(ns).is("dragging", vue.unref(isResizing))
  32374. ],
  32375. style: { [vue.unref(isHorizontal) ? "width" : "height"]: vue.unref(size) },
  32376. role: "dialog",
  32377. onClick: vue.withModifiers(() => {
  32378. }, ["stop"])
  32379. }), [
  32380. vue.createElementVNode("span", {
  32381. ref_key: "focusStartRef",
  32382. ref: focusStartRef,
  32383. class: vue.normalizeClass(vue.unref(ns).e("sr-focus")),
  32384. tabindex: "-1"
  32385. }, null, 2),
  32386. _ctx.withHeader ? (vue.openBlock(), vue.createElementBlock("header", {
  32387. key: 0,
  32388. class: vue.normalizeClass([vue.unref(ns).e("header"), _ctx.headerClass])
  32389. }, [
  32390. !_ctx.$slots.title ? vue.renderSlot(_ctx.$slots, "header", {
  32391. key: 0,
  32392. close: vue.unref(handleClose),
  32393. titleId: vue.unref(titleId),
  32394. titleClass: vue.unref(ns).e("title")
  32395. }, () => [
  32396. vue.createElementVNode("span", {
  32397. id: vue.unref(titleId),
  32398. role: "heading",
  32399. "aria-level": _ctx.headerAriaLevel,
  32400. class: vue.normalizeClass(vue.unref(ns).e("title"))
  32401. }, vue.toDisplayString(_ctx.title), 11, ["id", "aria-level"])
  32402. ]) : vue.renderSlot(_ctx.$slots, "title", { key: 1 }, () => [
  32403. vue.createCommentVNode(" DEPRECATED SLOT ")
  32404. ]),
  32405. _ctx.showClose ? (vue.openBlock(), vue.createElementBlock("button", {
  32406. key: 2,
  32407. "aria-label": vue.unref(t)("el.drawer.close"),
  32408. class: vue.normalizeClass(vue.unref(ns).e("close-btn")),
  32409. type: "button",
  32410. onClick: vue.unref(handleClose)
  32411. }, [
  32412. vue.createVNode(vue.unref(ElIcon), {
  32413. class: vue.normalizeClass(vue.unref(ns).e("close"))
  32414. }, {
  32415. default: vue.withCtx(() => [
  32416. vue.createVNode(vue.unref(close_default))
  32417. ]),
  32418. _: 1
  32419. }, 8, ["class"])
  32420. ], 10, ["aria-label", "onClick"])) : vue.createCommentVNode("v-if", true)
  32421. ], 2)) : vue.createCommentVNode("v-if", true),
  32422. vue.unref(rendered) ? (vue.openBlock(), vue.createElementBlock("div", {
  32423. key: 1,
  32424. id: vue.unref(bodyId),
  32425. class: vue.normalizeClass([vue.unref(ns).e("body"), _ctx.bodyClass])
  32426. }, [
  32427. vue.renderSlot(_ctx.$slots, "default")
  32428. ], 10, ["id"])) : vue.createCommentVNode("v-if", true),
  32429. _ctx.$slots.footer ? (vue.openBlock(), vue.createElementBlock("div", {
  32430. key: 2,
  32431. class: vue.normalizeClass([vue.unref(ns).e("footer"), _ctx.footerClass])
  32432. }, [
  32433. vue.renderSlot(_ctx.$slots, "footer")
  32434. ], 2)) : vue.createCommentVNode("v-if", true),
  32435. _ctx.resizable ? (vue.openBlock(), vue.createElementBlock("div", {
  32436. key: 3,
  32437. ref_key: "draggerRef",
  32438. ref: draggerRef,
  32439. style: vue.normalizeStyle({ zIndex: vue.unref(zIndex) }),
  32440. class: vue.normalizeClass(vue.unref(ns).e("dragger"))
  32441. }, null, 6)) : vue.createCommentVNode("v-if", true)
  32442. ], 16, ["aria-label", "aria-labelledby", "aria-describedby", "onClick"])
  32443. ]),
  32444. _: 3
  32445. }, 8, ["trapped", "focus-trap-el", "focus-start-el", "onFocusAfterTrapped", "onFocusAfterReleased", "onFocusoutPrevented", "onReleaseRequested"])
  32446. ]),
  32447. _: 3
  32448. }, 8, ["mask", "overlay-class", "z-index", "onClick"]), [
  32449. [vue.vShow, vue.unref(visible)]
  32450. ])
  32451. ];
  32452. }),
  32453. _: 3
  32454. }, 8, ["name", "onAfterEnter", "onAfterLeave", "onBeforeLeave"])
  32455. ]),
  32456. _: 3
  32457. }, 8, ["to", "disabled"]);
  32458. };
  32459. }
  32460. });
  32461. var Drawer = /* @__PURE__ */ _export_sfc(_sfc_main$1j, [["__file", "drawer.vue"]]);
  32462. const ElDrawer = withInstall(Drawer);
  32463. const _sfc_main$1i = vue.defineComponent({
  32464. inheritAttrs: false
  32465. });
  32466. function _sfc_render$k(_ctx, _cache, $props, $setup, $data, $options) {
  32467. return vue.renderSlot(_ctx.$slots, "default");
  32468. }
  32469. var Collection = /* @__PURE__ */ _export_sfc(_sfc_main$1i, [["render", _sfc_render$k], ["__file", "collection.vue"]]);
  32470. const _sfc_main$1h = vue.defineComponent({
  32471. name: "ElCollectionItem",
  32472. inheritAttrs: false
  32473. });
  32474. function _sfc_render$j(_ctx, _cache, $props, $setup, $data, $options) {
  32475. return vue.renderSlot(_ctx.$slots, "default");
  32476. }
  32477. var CollectionItem = /* @__PURE__ */ _export_sfc(_sfc_main$1h, [["render", _sfc_render$j], ["__file", "collection-item.vue"]]);
  32478. const COLLECTION_ITEM_SIGN = `data-el-collection-item`;
  32479. const createCollectionWithScope = (name) => {
  32480. const COLLECTION_NAME = `El${name}Collection`;
  32481. const COLLECTION_ITEM_NAME = `${COLLECTION_NAME}Item`;
  32482. const COLLECTION_INJECTION_KEY = Symbol(COLLECTION_NAME);
  32483. const COLLECTION_ITEM_INJECTION_KEY = Symbol(COLLECTION_ITEM_NAME);
  32484. const ElCollection = {
  32485. ...Collection,
  32486. name: COLLECTION_NAME,
  32487. setup() {
  32488. const collectionRef = vue.ref();
  32489. const itemMap = /* @__PURE__ */ new Map();
  32490. const getItems = () => {
  32491. const collectionEl = vue.unref(collectionRef);
  32492. if (!collectionEl)
  32493. return [];
  32494. const orderedNodes = Array.from(collectionEl.querySelectorAll(`[${COLLECTION_ITEM_SIGN}]`));
  32495. const items = [...itemMap.values()];
  32496. return items.sort((a, b) => orderedNodes.indexOf(a.ref) - orderedNodes.indexOf(b.ref));
  32497. };
  32498. vue.provide(COLLECTION_INJECTION_KEY, {
  32499. itemMap,
  32500. getItems,
  32501. collectionRef
  32502. });
  32503. }
  32504. };
  32505. const ElCollectionItem = {
  32506. ...CollectionItem,
  32507. name: COLLECTION_ITEM_NAME,
  32508. setup(_, { attrs }) {
  32509. const collectionItemRef = vue.ref();
  32510. const collectionInjection = vue.inject(COLLECTION_INJECTION_KEY, void 0);
  32511. vue.provide(COLLECTION_ITEM_INJECTION_KEY, {
  32512. collectionItemRef
  32513. });
  32514. vue.onMounted(() => {
  32515. const collectionItemEl = vue.unref(collectionItemRef);
  32516. if (collectionItemEl) {
  32517. collectionInjection.itemMap.set(collectionItemEl, {
  32518. ref: collectionItemEl,
  32519. ...attrs
  32520. });
  32521. }
  32522. });
  32523. vue.onBeforeUnmount(() => {
  32524. const collectionItemEl = vue.unref(collectionItemRef);
  32525. collectionInjection.itemMap.delete(collectionItemEl);
  32526. });
  32527. }
  32528. };
  32529. return {
  32530. COLLECTION_INJECTION_KEY,
  32531. COLLECTION_ITEM_INJECTION_KEY,
  32532. ElCollection,
  32533. ElCollectionItem
  32534. };
  32535. };
  32536. const rovingFocusGroupProps = buildProps({
  32537. style: { type: definePropType([String, Array, Object]) },
  32538. currentTabId: {
  32539. type: definePropType(String)
  32540. },
  32541. defaultCurrentTabId: String,
  32542. loop: Boolean,
  32543. dir: {
  32544. type: String,
  32545. values: ["ltr", "rtl"],
  32546. default: "ltr"
  32547. },
  32548. orientation: {
  32549. type: definePropType(String)
  32550. },
  32551. onBlur: Function,
  32552. onFocus: Function,
  32553. onMousedown: Function
  32554. });
  32555. const {
  32556. ElCollection,
  32557. ElCollectionItem,
  32558. COLLECTION_INJECTION_KEY,
  32559. COLLECTION_ITEM_INJECTION_KEY
  32560. } = createCollectionWithScope("RovingFocusGroup");
  32561. const ROVING_FOCUS_GROUP_INJECTION_KEY = Symbol("elRovingFocusGroup");
  32562. const ROVING_FOCUS_GROUP_ITEM_INJECTION_KEY = Symbol("elRovingFocusGroupItem");
  32563. const MAP_KEY_TO_FOCUS_INTENT = {
  32564. ArrowLeft: "prev",
  32565. ArrowUp: "prev",
  32566. ArrowRight: "next",
  32567. ArrowDown: "next",
  32568. PageUp: "first",
  32569. Home: "first",
  32570. PageDown: "last",
  32571. End: "last"
  32572. };
  32573. const getDirectionAwareKey = (key, dir) => {
  32574. if (dir !== "rtl")
  32575. return key;
  32576. switch (key) {
  32577. case EVENT_CODE.right:
  32578. return EVENT_CODE.left;
  32579. case EVENT_CODE.left:
  32580. return EVENT_CODE.right;
  32581. default:
  32582. return key;
  32583. }
  32584. };
  32585. const getFocusIntent = (event, orientation, dir) => {
  32586. const code = getEventCode(event);
  32587. const key = getDirectionAwareKey(code, dir);
  32588. if (orientation === "vertical" && [EVENT_CODE.left, EVENT_CODE.right].includes(key))
  32589. return void 0;
  32590. if (orientation === "horizontal" && [EVENT_CODE.up, EVENT_CODE.down].includes(key))
  32591. return void 0;
  32592. return MAP_KEY_TO_FOCUS_INTENT[key];
  32593. };
  32594. const reorderArray = (array, atIdx) => {
  32595. return array.map((_, idx) => array[(idx + atIdx) % array.length]);
  32596. };
  32597. const focusFirst = (elements) => {
  32598. const { activeElement: prevActive } = document;
  32599. for (const element of elements) {
  32600. if (element === prevActive)
  32601. return;
  32602. element.focus();
  32603. if (prevActive !== document.activeElement)
  32604. return;
  32605. }
  32606. };
  32607. const CURRENT_TAB_ID_CHANGE_EVT = "currentTabIdChange";
  32608. const ENTRY_FOCUS_EVT = "rovingFocusGroup.entryFocus";
  32609. const EVT_OPTS = { bubbles: false, cancelable: true };
  32610. const _sfc_main$1g = vue.defineComponent({
  32611. name: "ElRovingFocusGroupImpl",
  32612. inheritAttrs: false,
  32613. props: rovingFocusGroupProps,
  32614. emits: [CURRENT_TAB_ID_CHANGE_EVT, "entryFocus"],
  32615. setup(props, { emit }) {
  32616. var _a;
  32617. const currentTabbedId = vue.ref((_a = props.currentTabId || props.defaultCurrentTabId) != null ? _a : null);
  32618. const isBackingOut = vue.ref(false);
  32619. const isClickFocus = vue.ref(false);
  32620. const rovingFocusGroupRef = vue.ref();
  32621. const { getItems } = vue.inject(COLLECTION_INJECTION_KEY, void 0);
  32622. const rovingFocusGroupRootStyle = vue.computed(() => {
  32623. return [
  32624. {
  32625. outline: "none"
  32626. },
  32627. props.style
  32628. ];
  32629. });
  32630. const onItemFocus = (tabbedId) => {
  32631. emit(CURRENT_TAB_ID_CHANGE_EVT, tabbedId);
  32632. };
  32633. const onItemShiftTab = () => {
  32634. isBackingOut.value = true;
  32635. };
  32636. const onMousedown = composeEventHandlers((e) => {
  32637. var _a2;
  32638. (_a2 = props.onMousedown) == null ? void 0 : _a2.call(props, e);
  32639. }, () => {
  32640. isClickFocus.value = true;
  32641. });
  32642. const onFocus = composeEventHandlers((e) => {
  32643. var _a2;
  32644. (_a2 = props.onFocus) == null ? void 0 : _a2.call(props, e);
  32645. }, (e) => {
  32646. const isKeyboardFocus = !vue.unref(isClickFocus);
  32647. const { target, currentTarget } = e;
  32648. if (target === currentTarget && isKeyboardFocus && !vue.unref(isBackingOut)) {
  32649. const entryFocusEvt = new Event(ENTRY_FOCUS_EVT, EVT_OPTS);
  32650. currentTarget == null ? void 0 : currentTarget.dispatchEvent(entryFocusEvt);
  32651. if (!entryFocusEvt.defaultPrevented) {
  32652. const items = getItems().filter((item) => item.focusable);
  32653. const activeItem = items.find((item) => item.active);
  32654. const currentItem = items.find((item) => item.id === vue.unref(currentTabbedId));
  32655. const candidates = [activeItem, currentItem, ...items].filter(Boolean);
  32656. const candidateNodes = candidates.map((item) => item.ref);
  32657. focusFirst(candidateNodes);
  32658. }
  32659. }
  32660. isClickFocus.value = false;
  32661. });
  32662. const onBlur = composeEventHandlers((e) => {
  32663. var _a2;
  32664. (_a2 = props.onBlur) == null ? void 0 : _a2.call(props, e);
  32665. }, () => {
  32666. isBackingOut.value = false;
  32667. });
  32668. const handleEntryFocus = (...args) => {
  32669. emit("entryFocus", ...args);
  32670. };
  32671. const onKeydown = (e) => {
  32672. const focusIntent = getFocusIntent(e);
  32673. if (focusIntent) {
  32674. e.preventDefault();
  32675. const items = getItems().filter((item) => item.focusable);
  32676. let elements = items.map((item) => item.ref);
  32677. switch (focusIntent) {
  32678. case "last": {
  32679. elements.reverse();
  32680. break;
  32681. }
  32682. case "prev":
  32683. case "next": {
  32684. if (focusIntent === "prev") {
  32685. elements.reverse();
  32686. }
  32687. const currentIdx = elements.indexOf(e.currentTarget);
  32688. elements = props.loop ? reorderArray(elements, currentIdx + 1) : elements.slice(currentIdx + 1);
  32689. break;
  32690. }
  32691. }
  32692. vue.nextTick(() => {
  32693. focusFirst(elements);
  32694. });
  32695. }
  32696. };
  32697. vue.provide(ROVING_FOCUS_GROUP_INJECTION_KEY, {
  32698. currentTabbedId: vue.readonly(currentTabbedId),
  32699. loop: vue.toRef(props, "loop"),
  32700. tabIndex: vue.computed(() => {
  32701. return vue.unref(isBackingOut) ? -1 : 0;
  32702. }),
  32703. rovingFocusGroupRef,
  32704. rovingFocusGroupRootStyle,
  32705. orientation: vue.toRef(props, "orientation"),
  32706. dir: vue.toRef(props, "dir"),
  32707. onItemFocus,
  32708. onItemShiftTab,
  32709. onBlur,
  32710. onFocus,
  32711. onMousedown,
  32712. onKeydown
  32713. });
  32714. vue.watch(() => props.currentTabId, (val) => {
  32715. currentTabbedId.value = val != null ? val : null;
  32716. });
  32717. useEventListener(rovingFocusGroupRef, ENTRY_FOCUS_EVT, handleEntryFocus);
  32718. }
  32719. });
  32720. function _sfc_render$i(_ctx, _cache, $props, $setup, $data, $options) {
  32721. return vue.renderSlot(_ctx.$slots, "default");
  32722. }
  32723. var ElRovingFocusGroupImpl = /* @__PURE__ */ _export_sfc(_sfc_main$1g, [["render", _sfc_render$i], ["__file", "roving-focus-group-impl.vue"]]);
  32724. const _sfc_main$1f = vue.defineComponent({
  32725. name: "ElRovingFocusGroup",
  32726. components: {
  32727. ElFocusGroupCollection: ElCollection,
  32728. ElRovingFocusGroupImpl
  32729. }
  32730. });
  32731. function _sfc_render$h(_ctx, _cache, $props, $setup, $data, $options) {
  32732. const _component_el_roving_focus_group_impl = vue.resolveComponent("el-roving-focus-group-impl");
  32733. const _component_el_focus_group_collection = vue.resolveComponent("el-focus-group-collection");
  32734. return vue.openBlock(), vue.createBlock(_component_el_focus_group_collection, null, {
  32735. default: vue.withCtx(() => [
  32736. vue.createVNode(_component_el_roving_focus_group_impl, vue.normalizeProps(vue.guardReactiveProps(_ctx.$attrs)), {
  32737. default: vue.withCtx(() => [
  32738. vue.renderSlot(_ctx.$slots, "default")
  32739. ]),
  32740. _: 3
  32741. }, 16)
  32742. ]),
  32743. _: 3
  32744. });
  32745. }
  32746. var ElRovingFocusGroup = /* @__PURE__ */ _export_sfc(_sfc_main$1f, [["render", _sfc_render$h], ["__file", "roving-focus-group.vue"]]);
  32747. const _sfc_main$1e = vue.defineComponent({
  32748. components: {
  32749. ElRovingFocusCollectionItem: ElCollectionItem
  32750. },
  32751. props: {
  32752. focusable: {
  32753. type: Boolean,
  32754. default: true
  32755. },
  32756. active: Boolean
  32757. },
  32758. emits: ["mousedown", "focus", "keydown"],
  32759. setup(props, { emit }) {
  32760. const { currentTabbedId, onItemFocus, onItemShiftTab, onKeydown } = vue.inject(ROVING_FOCUS_GROUP_INJECTION_KEY, void 0);
  32761. const id = useId();
  32762. const rovingFocusGroupItemRef = vue.ref();
  32763. const handleMousedown = composeEventHandlers((e) => {
  32764. emit("mousedown", e);
  32765. }, (e) => {
  32766. if (!props.focusable) {
  32767. e.preventDefault();
  32768. } else {
  32769. onItemFocus(vue.unref(id));
  32770. }
  32771. });
  32772. const handleFocus = composeEventHandlers((e) => {
  32773. emit("focus", e);
  32774. }, () => {
  32775. onItemFocus(vue.unref(id));
  32776. });
  32777. const handleKeydown = composeEventHandlers((e) => {
  32778. emit("keydown", e);
  32779. }, (e) => {
  32780. const { shiftKey, target, currentTarget } = e;
  32781. const code = getEventCode(e);
  32782. if (code === EVENT_CODE.tab && shiftKey) {
  32783. onItemShiftTab();
  32784. return;
  32785. }
  32786. if (target !== currentTarget)
  32787. return;
  32788. onKeydown(e);
  32789. });
  32790. const isCurrentTab = vue.computed(() => currentTabbedId.value === vue.unref(id));
  32791. vue.provide(ROVING_FOCUS_GROUP_ITEM_INJECTION_KEY, {
  32792. rovingFocusGroupItemRef,
  32793. tabIndex: vue.computed(() => vue.unref(isCurrentTab) ? 0 : -1),
  32794. handleMousedown,
  32795. handleFocus,
  32796. handleKeydown
  32797. });
  32798. return {
  32799. id,
  32800. handleKeydown,
  32801. handleFocus,
  32802. handleMousedown
  32803. };
  32804. }
  32805. });
  32806. function _sfc_render$g(_ctx, _cache, $props, $setup, $data, $options) {
  32807. const _component_el_roving_focus_collection_item = vue.resolveComponent("el-roving-focus-collection-item");
  32808. return vue.openBlock(), vue.createBlock(_component_el_roving_focus_collection_item, {
  32809. id: _ctx.id,
  32810. focusable: _ctx.focusable,
  32811. active: _ctx.active
  32812. }, {
  32813. default: vue.withCtx(() => [
  32814. vue.renderSlot(_ctx.$slots, "default")
  32815. ]),
  32816. _: 3
  32817. }, 8, ["id", "focusable", "active"]);
  32818. }
  32819. var ElRovingFocusItem = /* @__PURE__ */ _export_sfc(_sfc_main$1e, [["render", _sfc_render$g], ["__file", "roving-focus-item.vue"]]);
  32820. const dropdownProps = buildProps({
  32821. trigger: {
  32822. ...useTooltipTriggerProps.trigger,
  32823. type: definePropType([
  32824. String,
  32825. Array
  32826. ])
  32827. },
  32828. triggerKeys: {
  32829. type: definePropType(Array),
  32830. default: () => [
  32831. EVENT_CODE.enter,
  32832. EVENT_CODE.numpadEnter,
  32833. EVENT_CODE.space,
  32834. EVENT_CODE.down
  32835. ]
  32836. },
  32837. virtualTriggering: useTooltipTriggerProps.virtualTriggering,
  32838. virtualRef: useTooltipTriggerProps.virtualRef,
  32839. effect: {
  32840. ...useTooltipContentProps.effect,
  32841. default: "light"
  32842. },
  32843. type: {
  32844. type: definePropType(String)
  32845. },
  32846. placement: {
  32847. type: definePropType(String),
  32848. default: "bottom"
  32849. },
  32850. popperOptions: {
  32851. type: definePropType(Object),
  32852. default: () => ({})
  32853. },
  32854. id: String,
  32855. size: {
  32856. type: String,
  32857. default: ""
  32858. },
  32859. splitButton: Boolean,
  32860. hideOnClick: {
  32861. type: Boolean,
  32862. default: true
  32863. },
  32864. loop: {
  32865. type: Boolean,
  32866. default: true
  32867. },
  32868. showArrow: {
  32869. type: Boolean,
  32870. default: true
  32871. },
  32872. showTimeout: {
  32873. type: Number,
  32874. default: 150
  32875. },
  32876. hideTimeout: {
  32877. type: Number,
  32878. default: 150
  32879. },
  32880. tabindex: {
  32881. type: definePropType([Number, String]),
  32882. default: 0
  32883. },
  32884. maxHeight: {
  32885. type: definePropType([Number, String]),
  32886. default: ""
  32887. },
  32888. popperClass: useTooltipContentProps.popperClass,
  32889. popperStyle: useTooltipContentProps.popperStyle,
  32890. disabled: Boolean,
  32891. role: {
  32892. type: String,
  32893. values: roleTypes,
  32894. default: "menu"
  32895. },
  32896. buttonProps: {
  32897. type: definePropType(Object)
  32898. },
  32899. teleported: useTooltipContentProps.teleported,
  32900. persistent: {
  32901. type: Boolean,
  32902. default: true
  32903. }
  32904. });
  32905. const dropdownItemProps = buildProps({
  32906. command: {
  32907. type: [Object, String, Number],
  32908. default: () => ({})
  32909. },
  32910. disabled: Boolean,
  32911. divided: Boolean,
  32912. textValue: String,
  32913. icon: {
  32914. type: iconPropType
  32915. }
  32916. });
  32917. const dropdownMenuProps = buildProps({
  32918. onKeydown: { type: definePropType(Function) }
  32919. });
  32920. const FIRST_KEYS = [
  32921. EVENT_CODE.down,
  32922. EVENT_CODE.pageDown,
  32923. EVENT_CODE.home
  32924. ];
  32925. const LAST_KEYS = [EVENT_CODE.up, EVENT_CODE.pageUp, EVENT_CODE.end];
  32926. const FIRST_LAST_KEYS = [...FIRST_KEYS, ...LAST_KEYS];
  32927. const DROPDOWN_INJECTION_KEY = Symbol("elDropdown");
  32928. const DROPDOWN_INSTANCE_INJECTION_KEY = "elDropdown";
  32929. const { ButtonGroup: ElButtonGroup } = ElButton;
  32930. const _sfc_main$1d = vue.defineComponent({
  32931. name: "ElDropdown",
  32932. components: {
  32933. ElButton,
  32934. ElButtonGroup,
  32935. ElScrollbar,
  32936. ElTooltip,
  32937. ElRovingFocusGroup,
  32938. ElOnlyChild: OnlyChild,
  32939. ElIcon,
  32940. ArrowDown: arrow_down_default
  32941. },
  32942. props: dropdownProps,
  32943. emits: ["visible-change", "click", "command"],
  32944. setup(props, { emit }) {
  32945. const _instance = vue.getCurrentInstance();
  32946. const ns = useNamespace("dropdown");
  32947. const { t } = useLocale();
  32948. const triggeringElementRef = vue.ref();
  32949. const referenceElementRef = vue.ref();
  32950. const popperRef = vue.ref();
  32951. const contentRef = vue.ref();
  32952. const scrollbar = vue.ref(null);
  32953. const currentTabId = vue.ref(null);
  32954. const isUsingKeyboard = vue.ref(false);
  32955. const wrapStyle = vue.computed(() => ({
  32956. maxHeight: addUnit(props.maxHeight)
  32957. }));
  32958. const dropdownTriggerKls = vue.computed(() => [ns.m(dropdownSize.value)]);
  32959. const trigger = vue.computed(() => castArray$1(props.trigger));
  32960. const defaultTriggerId = useId().value;
  32961. const triggerId = vue.computed(() => props.id || defaultTriggerId);
  32962. function handleClick() {
  32963. var _a;
  32964. (_a = popperRef.value) == null ? void 0 : _a.onClose(void 0, 0);
  32965. }
  32966. function handleClose() {
  32967. var _a;
  32968. (_a = popperRef.value) == null ? void 0 : _a.onClose();
  32969. }
  32970. function handleOpen() {
  32971. var _a;
  32972. (_a = popperRef.value) == null ? void 0 : _a.onOpen();
  32973. }
  32974. const dropdownSize = useFormSize();
  32975. function commandHandler(...args) {
  32976. emit("command", ...args);
  32977. }
  32978. function onItemEnter() {
  32979. }
  32980. function onItemLeave() {
  32981. const contentEl = vue.unref(contentRef);
  32982. trigger.value.includes("hover") && (contentEl == null ? void 0 : contentEl.focus({
  32983. preventScroll: true
  32984. }));
  32985. currentTabId.value = null;
  32986. }
  32987. function handleCurrentTabIdChange(id) {
  32988. currentTabId.value = id;
  32989. }
  32990. function handleBeforeShowTooltip() {
  32991. emit("visible-change", true);
  32992. }
  32993. function handleShowTooltip(event) {
  32994. var _a;
  32995. isUsingKeyboard.value = (event == null ? void 0 : event.type) === "keydown";
  32996. (_a = contentRef.value) == null ? void 0 : _a.focus();
  32997. }
  32998. function handleBeforeHideTooltip() {
  32999. emit("visible-change", false);
  33000. }
  33001. vue.provide(DROPDOWN_INJECTION_KEY, {
  33002. contentRef,
  33003. role: vue.computed(() => props.role),
  33004. triggerId,
  33005. isUsingKeyboard,
  33006. onItemEnter,
  33007. onItemLeave,
  33008. handleClose
  33009. });
  33010. vue.provide(DROPDOWN_INSTANCE_INJECTION_KEY, {
  33011. instance: _instance,
  33012. dropdownSize,
  33013. handleClick,
  33014. commandHandler,
  33015. trigger: vue.toRef(props, "trigger"),
  33016. hideOnClick: vue.toRef(props, "hideOnClick")
  33017. });
  33018. const handlerMainButtonClick = (event) => {
  33019. emit("click", event);
  33020. };
  33021. return {
  33022. t,
  33023. ns,
  33024. scrollbar,
  33025. wrapStyle,
  33026. dropdownTriggerKls,
  33027. dropdownSize,
  33028. triggerId,
  33029. currentTabId,
  33030. handleCurrentTabIdChange,
  33031. handlerMainButtonClick,
  33032. handleClose,
  33033. handleOpen,
  33034. handleBeforeShowTooltip,
  33035. handleShowTooltip,
  33036. handleBeforeHideTooltip,
  33037. popperRef,
  33038. contentRef,
  33039. triggeringElementRef,
  33040. referenceElementRef
  33041. };
  33042. }
  33043. });
  33044. function _sfc_render$f(_ctx, _cache, $props, $setup, $data, $options) {
  33045. var _a;
  33046. const _component_el_roving_focus_group = vue.resolveComponent("el-roving-focus-group");
  33047. const _component_el_scrollbar = vue.resolveComponent("el-scrollbar");
  33048. const _component_el_only_child = vue.resolveComponent("el-only-child");
  33049. const _component_el_tooltip = vue.resolveComponent("el-tooltip");
  33050. const _component_el_button = vue.resolveComponent("el-button");
  33051. const _component_arrow_down = vue.resolveComponent("arrow-down");
  33052. const _component_el_icon = vue.resolveComponent("el-icon");
  33053. const _component_el_button_group = vue.resolveComponent("el-button-group");
  33054. return vue.openBlock(), vue.createElementBlock("div", {
  33055. class: vue.normalizeClass([_ctx.ns.b(), _ctx.ns.is("disabled", _ctx.disabled)])
  33056. }, [
  33057. vue.createVNode(_component_el_tooltip, {
  33058. ref: "popperRef",
  33059. role: _ctx.role,
  33060. effect: _ctx.effect,
  33061. "fallback-placements": ["bottom", "top"],
  33062. "popper-options": _ctx.popperOptions,
  33063. "gpu-acceleration": false,
  33064. placement: _ctx.placement,
  33065. "popper-class": [_ctx.ns.e("popper"), _ctx.popperClass],
  33066. "popper-style": _ctx.popperStyle,
  33067. trigger: _ctx.trigger,
  33068. "trigger-keys": _ctx.triggerKeys,
  33069. "trigger-target-el": _ctx.contentRef,
  33070. "show-arrow": _ctx.showArrow,
  33071. "show-after": _ctx.trigger === "hover" ? _ctx.showTimeout : 0,
  33072. "hide-after": _ctx.trigger === "hover" ? _ctx.hideTimeout : 0,
  33073. "virtual-ref": (_a = _ctx.virtualRef) != null ? _a : _ctx.triggeringElementRef,
  33074. "virtual-triggering": _ctx.virtualTriggering || _ctx.splitButton,
  33075. disabled: _ctx.disabled,
  33076. transition: `${_ctx.ns.namespace.value}-zoom-in-top`,
  33077. teleported: _ctx.teleported,
  33078. pure: "",
  33079. "focus-on-target": "",
  33080. persistent: _ctx.persistent,
  33081. onBeforeShow: _ctx.handleBeforeShowTooltip,
  33082. onShow: _ctx.handleShowTooltip,
  33083. onBeforeHide: _ctx.handleBeforeHideTooltip
  33084. }, vue.createSlots({
  33085. content: vue.withCtx(() => [
  33086. vue.createVNode(_component_el_scrollbar, {
  33087. ref: "scrollbar",
  33088. "wrap-style": _ctx.wrapStyle,
  33089. tag: "div",
  33090. "view-class": _ctx.ns.e("list")
  33091. }, {
  33092. default: vue.withCtx(() => [
  33093. vue.createVNode(_component_el_roving_focus_group, {
  33094. loop: _ctx.loop,
  33095. "current-tab-id": _ctx.currentTabId,
  33096. orientation: "horizontal",
  33097. onCurrentTabIdChange: _ctx.handleCurrentTabIdChange
  33098. }, {
  33099. default: vue.withCtx(() => [
  33100. vue.renderSlot(_ctx.$slots, "dropdown")
  33101. ]),
  33102. _: 3
  33103. }, 8, ["loop", "current-tab-id", "onCurrentTabIdChange"])
  33104. ]),
  33105. _: 3
  33106. }, 8, ["wrap-style", "view-class"])
  33107. ]),
  33108. _: 2
  33109. }, [
  33110. !_ctx.splitButton ? {
  33111. name: "default",
  33112. fn: vue.withCtx(() => [
  33113. vue.createVNode(_component_el_only_child, {
  33114. id: _ctx.triggerId,
  33115. ref: "triggeringElementRef",
  33116. role: "button",
  33117. tabindex: _ctx.tabindex
  33118. }, {
  33119. default: vue.withCtx(() => [
  33120. vue.renderSlot(_ctx.$slots, "default")
  33121. ]),
  33122. _: 3
  33123. }, 8, ["id", "tabindex"])
  33124. ])
  33125. } : void 0
  33126. ]), 1032, ["role", "effect", "popper-options", "placement", "popper-class", "popper-style", "trigger", "trigger-keys", "trigger-target-el", "show-arrow", "show-after", "hide-after", "virtual-ref", "virtual-triggering", "disabled", "transition", "teleported", "persistent", "onBeforeShow", "onShow", "onBeforeHide"]),
  33127. _ctx.splitButton ? (vue.openBlock(), vue.createBlock(_component_el_button_group, { key: 0 }, {
  33128. default: vue.withCtx(() => [
  33129. vue.createVNode(_component_el_button, vue.mergeProps({ ref: "referenceElementRef" }, _ctx.buttonProps, {
  33130. size: _ctx.dropdownSize,
  33131. type: _ctx.type,
  33132. disabled: _ctx.disabled,
  33133. tabindex: _ctx.tabindex,
  33134. onClick: _ctx.handlerMainButtonClick
  33135. }), {
  33136. default: vue.withCtx(() => [
  33137. vue.renderSlot(_ctx.$slots, "default")
  33138. ]),
  33139. _: 3
  33140. }, 16, ["size", "type", "disabled", "tabindex", "onClick"]),
  33141. vue.createVNode(_component_el_button, vue.mergeProps({
  33142. id: _ctx.triggerId,
  33143. ref: "triggeringElementRef"
  33144. }, _ctx.buttonProps, {
  33145. role: "button",
  33146. size: _ctx.dropdownSize,
  33147. type: _ctx.type,
  33148. class: _ctx.ns.e("caret-button"),
  33149. disabled: _ctx.disabled,
  33150. tabindex: _ctx.tabindex,
  33151. "aria-label": _ctx.t("el.dropdown.toggleDropdown")
  33152. }), {
  33153. default: vue.withCtx(() => [
  33154. vue.createVNode(_component_el_icon, {
  33155. class: vue.normalizeClass(_ctx.ns.e("icon"))
  33156. }, {
  33157. default: vue.withCtx(() => [
  33158. vue.createVNode(_component_arrow_down)
  33159. ]),
  33160. _: 1
  33161. }, 8, ["class"])
  33162. ]),
  33163. _: 1
  33164. }, 16, ["id", "size", "type", "class", "disabled", "tabindex", "aria-label"])
  33165. ]),
  33166. _: 3
  33167. })) : vue.createCommentVNode("v-if", true)
  33168. ], 2);
  33169. }
  33170. var Dropdown = /* @__PURE__ */ _export_sfc(_sfc_main$1d, [["render", _sfc_render$f], ["__file", "dropdown.vue"]]);
  33171. const _sfc_main$1c = vue.defineComponent({
  33172. name: "DropdownItemImpl",
  33173. components: {
  33174. ElIcon
  33175. },
  33176. props: dropdownItemProps,
  33177. emits: ["pointermove", "pointerleave", "click", "clickimpl"],
  33178. setup(_, { emit }) {
  33179. const ns = useNamespace("dropdown");
  33180. const { role: menuRole } = vue.inject(DROPDOWN_INJECTION_KEY, void 0);
  33181. const { collectionItemRef: rovingFocusCollectionItemRef } = vue.inject(COLLECTION_ITEM_INJECTION_KEY, void 0);
  33182. const {
  33183. rovingFocusGroupItemRef,
  33184. tabIndex,
  33185. handleFocus,
  33186. handleKeydown: handleItemKeydown,
  33187. handleMousedown
  33188. } = vue.inject(ROVING_FOCUS_GROUP_ITEM_INJECTION_KEY, void 0);
  33189. const itemRef = composeRefs(rovingFocusCollectionItemRef, rovingFocusGroupItemRef);
  33190. const role = vue.computed(() => {
  33191. if (menuRole.value === "menu") {
  33192. return "menuitem";
  33193. } else if (menuRole.value === "navigation") {
  33194. return "link";
  33195. }
  33196. return "button";
  33197. });
  33198. const handleKeydown = composeEventHandlers((e) => {
  33199. const code = getEventCode(e);
  33200. if ([EVENT_CODE.enter, EVENT_CODE.numpadEnter, EVENT_CODE.space].includes(code)) {
  33201. e.preventDefault();
  33202. e.stopImmediatePropagation();
  33203. emit("clickimpl", e);
  33204. return true;
  33205. }
  33206. }, handleItemKeydown);
  33207. return {
  33208. ns,
  33209. itemRef,
  33210. dataset: {
  33211. [COLLECTION_ITEM_SIGN]: ""
  33212. },
  33213. role,
  33214. tabIndex,
  33215. handleFocus,
  33216. handleKeydown,
  33217. handleMousedown
  33218. };
  33219. }
  33220. });
  33221. function _sfc_render$e(_ctx, _cache, $props, $setup, $data, $options) {
  33222. const _component_el_icon = vue.resolveComponent("el-icon");
  33223. return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
  33224. _ctx.divided ? (vue.openBlock(), vue.createElementBlock("li", {
  33225. key: 0,
  33226. role: "separator",
  33227. class: vue.normalizeClass(_ctx.ns.bem("menu", "item", "divided"))
  33228. }, null, 2)) : vue.createCommentVNode("v-if", true),
  33229. vue.createElementVNode("li", vue.mergeProps({ ref: _ctx.itemRef }, { ..._ctx.dataset, ..._ctx.$attrs }, {
  33230. "aria-disabled": _ctx.disabled,
  33231. class: [_ctx.ns.be("menu", "item"), _ctx.ns.is("disabled", _ctx.disabled)],
  33232. tabindex: _ctx.tabIndex,
  33233. role: _ctx.role,
  33234. onClick: (e) => _ctx.$emit("clickimpl", e),
  33235. onFocus: _ctx.handleFocus,
  33236. onKeydown: vue.withModifiers(_ctx.handleKeydown, ["self"]),
  33237. onMousedown: _ctx.handleMousedown,
  33238. onPointermove: (e) => _ctx.$emit("pointermove", e),
  33239. onPointerleave: (e) => _ctx.$emit("pointerleave", e)
  33240. }), [
  33241. _ctx.icon ? (vue.openBlock(), vue.createBlock(_component_el_icon, { key: 0 }, {
  33242. default: vue.withCtx(() => [
  33243. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.icon)))
  33244. ]),
  33245. _: 1
  33246. })) : vue.createCommentVNode("v-if", true),
  33247. vue.renderSlot(_ctx.$slots, "default")
  33248. ], 16, ["aria-disabled", "tabindex", "role", "onClick", "onFocus", "onKeydown", "onMousedown", "onPointermove", "onPointerleave"])
  33249. ], 64);
  33250. }
  33251. var ElDropdownItemImpl = /* @__PURE__ */ _export_sfc(_sfc_main$1c, [["render", _sfc_render$e], ["__file", "dropdown-item-impl.vue"]]);
  33252. const useDropdown = () => {
  33253. const elDropdown = vue.inject(DROPDOWN_INSTANCE_INJECTION_KEY, {});
  33254. const _elDropdownSize = vue.computed(() => elDropdown == null ? void 0 : elDropdown.dropdownSize);
  33255. return {
  33256. elDropdown,
  33257. _elDropdownSize
  33258. };
  33259. };
  33260. const _sfc_main$1b = vue.defineComponent({
  33261. name: "ElDropdownItem",
  33262. components: {
  33263. ElRovingFocusItem,
  33264. ElDropdownItemImpl
  33265. },
  33266. inheritAttrs: false,
  33267. props: dropdownItemProps,
  33268. emits: ["pointermove", "pointerleave", "click"],
  33269. setup(props, { emit, attrs }) {
  33270. const { elDropdown } = useDropdown();
  33271. const _instance = vue.getCurrentInstance();
  33272. const { onItemEnter, onItemLeave } = vue.inject(DROPDOWN_INJECTION_KEY, void 0);
  33273. const handlePointerMove = composeEventHandlers((e) => {
  33274. emit("pointermove", e);
  33275. return e.defaultPrevented;
  33276. }, whenMouse((e) => {
  33277. if (props.disabled) {
  33278. onItemLeave(e);
  33279. return;
  33280. }
  33281. const target = e.currentTarget;
  33282. if (target === document.activeElement || target.contains(document.activeElement)) {
  33283. return;
  33284. }
  33285. onItemEnter(e);
  33286. if (!e.defaultPrevented) {
  33287. target == null ? void 0 : target.focus({
  33288. preventScroll: true
  33289. });
  33290. }
  33291. }));
  33292. const handlePointerLeave = composeEventHandlers((e) => {
  33293. emit("pointerleave", e);
  33294. return e.defaultPrevented;
  33295. }, whenMouse(onItemLeave));
  33296. const handleClick = composeEventHandlers((e) => {
  33297. if (props.disabled) {
  33298. return;
  33299. }
  33300. emit("click", e);
  33301. return e.type !== "keydown" && e.defaultPrevented;
  33302. }, (e) => {
  33303. var _a, _b, _c;
  33304. if (props.disabled) {
  33305. e.stopImmediatePropagation();
  33306. return;
  33307. }
  33308. if ((_a = elDropdown == null ? void 0 : elDropdown.hideOnClick) == null ? void 0 : _a.value) {
  33309. (_b = elDropdown.handleClick) == null ? void 0 : _b.call(elDropdown);
  33310. }
  33311. (_c = elDropdown.commandHandler) == null ? void 0 : _c.call(elDropdown, props.command, _instance, e);
  33312. });
  33313. const propsAndAttrs = vue.computed(() => ({ ...props, ...attrs }));
  33314. return {
  33315. handleClick,
  33316. handlePointerMove,
  33317. handlePointerLeave,
  33318. propsAndAttrs
  33319. };
  33320. }
  33321. });
  33322. function _sfc_render$d(_ctx, _cache, $props, $setup, $data, $options) {
  33323. const _component_el_dropdown_item_impl = vue.resolveComponent("el-dropdown-item-impl");
  33324. const _component_el_roving_focus_item = vue.resolveComponent("el-roving-focus-item");
  33325. return vue.openBlock(), vue.createBlock(_component_el_roving_focus_item, {
  33326. focusable: !_ctx.disabled
  33327. }, {
  33328. default: vue.withCtx(() => [
  33329. vue.createVNode(_component_el_dropdown_item_impl, vue.mergeProps(_ctx.propsAndAttrs, {
  33330. onPointerleave: _ctx.handlePointerLeave,
  33331. onPointermove: _ctx.handlePointerMove,
  33332. onClickimpl: _ctx.handleClick
  33333. }), {
  33334. default: vue.withCtx(() => [
  33335. vue.renderSlot(_ctx.$slots, "default")
  33336. ]),
  33337. _: 3
  33338. }, 16, ["onPointerleave", "onPointermove", "onClickimpl"])
  33339. ]),
  33340. _: 3
  33341. }, 8, ["focusable"]);
  33342. }
  33343. var DropdownItem = /* @__PURE__ */ _export_sfc(_sfc_main$1b, [["render", _sfc_render$d], ["__file", "dropdown-item.vue"]]);
  33344. const _sfc_main$1a = vue.defineComponent({
  33345. name: "ElDropdownMenu",
  33346. props: dropdownMenuProps,
  33347. setup(props) {
  33348. const ns = useNamespace("dropdown");
  33349. const { _elDropdownSize } = useDropdown();
  33350. const size = _elDropdownSize.value;
  33351. const { contentRef, role, triggerId, isUsingKeyboard, handleClose } = vue.inject(DROPDOWN_INJECTION_KEY, void 0);
  33352. const {
  33353. rovingFocusGroupRef,
  33354. rovingFocusGroupRootStyle,
  33355. onBlur,
  33356. onFocus,
  33357. onKeydown,
  33358. onMousedown
  33359. } = vue.inject(ROVING_FOCUS_GROUP_INJECTION_KEY, void 0);
  33360. const { collectionRef: rovingFocusGroupCollectionRef } = vue.inject(COLLECTION_INJECTION_KEY, void 0);
  33361. const dropdownKls = vue.computed(() => {
  33362. return [ns.b("menu"), ns.bm("menu", size == null ? void 0 : size.value)];
  33363. });
  33364. const dropdownListWrapperRef = composeRefs(contentRef, rovingFocusGroupRef, rovingFocusGroupCollectionRef);
  33365. const handleKeydown = composeEventHandlers((e) => {
  33366. var _a;
  33367. (_a = props.onKeydown) == null ? void 0 : _a.call(props, e);
  33368. }, (e) => {
  33369. const { currentTarget, target } = e;
  33370. const code = getEventCode(e);
  33371. currentTarget.contains(target);
  33372. if (EVENT_CODE.tab === code) {
  33373. return handleClose();
  33374. }
  33375. onKeydown(e);
  33376. });
  33377. function handleFocus(e) {
  33378. isUsingKeyboard.value && onFocus(e);
  33379. }
  33380. return {
  33381. size,
  33382. rovingFocusGroupRootStyle,
  33383. dropdownKls,
  33384. role,
  33385. triggerId,
  33386. dropdownListWrapperRef,
  33387. handleKeydown,
  33388. onBlur,
  33389. handleFocus,
  33390. onMousedown
  33391. };
  33392. }
  33393. });
  33394. function _sfc_render$c(_ctx, _cache, $props, $setup, $data, $options) {
  33395. return vue.openBlock(), vue.createElementBlock("ul", {
  33396. ref: _ctx.dropdownListWrapperRef,
  33397. class: vue.normalizeClass(_ctx.dropdownKls),
  33398. style: vue.normalizeStyle(_ctx.rovingFocusGroupRootStyle),
  33399. tabindex: -1,
  33400. role: _ctx.role,
  33401. "aria-labelledby": _ctx.triggerId,
  33402. onFocusin: _ctx.handleFocus,
  33403. onFocusout: _ctx.onBlur,
  33404. onKeydown: vue.withModifiers(_ctx.handleKeydown, ["self"]),
  33405. onMousedown: vue.withModifiers(_ctx.onMousedown, ["self"])
  33406. }, [
  33407. vue.renderSlot(_ctx.$slots, "default")
  33408. ], 46, ["role", "aria-labelledby", "onFocusin", "onFocusout", "onKeydown", "onMousedown"]);
  33409. }
  33410. var DropdownMenu = /* @__PURE__ */ _export_sfc(_sfc_main$1a, [["render", _sfc_render$c], ["__file", "dropdown-menu.vue"]]);
  33411. const ElDropdown = withInstall(Dropdown, {
  33412. DropdownItem,
  33413. DropdownMenu
  33414. });
  33415. const ElDropdownItem = withNoopInstall(DropdownItem);
  33416. const ElDropdownMenu = withNoopInstall(DropdownMenu);
  33417. const __default__$X = vue.defineComponent({
  33418. name: "ImgEmpty"
  33419. });
  33420. const _sfc_main$19 = /* @__PURE__ */ vue.defineComponent({
  33421. ...__default__$X,
  33422. setup(__props) {
  33423. const ns = useNamespace("empty");
  33424. const id = useId();
  33425. return (_ctx, _cache) => {
  33426. return vue.openBlock(), vue.createElementBlock("svg", {
  33427. viewBox: "0 0 79 86",
  33428. version: "1.1",
  33429. xmlns: "http://www.w3.org/2000/svg",
  33430. "xmlns:xlink": "http://www.w3.org/1999/xlink"
  33431. }, [
  33432. vue.createElementVNode("defs", null, [
  33433. vue.createElementVNode("linearGradient", {
  33434. id: `linearGradient-1-${vue.unref(id)}`,
  33435. x1: "38.8503086%",
  33436. y1: "0%",
  33437. x2: "61.1496914%",
  33438. y2: "100%"
  33439. }, [
  33440. vue.createElementVNode("stop", {
  33441. "stop-color": `var(${vue.unref(ns).cssVarBlockName("fill-color-1")})`,
  33442. offset: "0%"
  33443. }, null, 8, ["stop-color"]),
  33444. vue.createElementVNode("stop", {
  33445. "stop-color": `var(${vue.unref(ns).cssVarBlockName("fill-color-4")})`,
  33446. offset: "100%"
  33447. }, null, 8, ["stop-color"])
  33448. ], 8, ["id"]),
  33449. vue.createElementVNode("linearGradient", {
  33450. id: `linearGradient-2-${vue.unref(id)}`,
  33451. x1: "0%",
  33452. y1: "9.5%",
  33453. x2: "100%",
  33454. y2: "90.5%"
  33455. }, [
  33456. vue.createElementVNode("stop", {
  33457. "stop-color": `var(${vue.unref(ns).cssVarBlockName("fill-color-1")})`,
  33458. offset: "0%"
  33459. }, null, 8, ["stop-color"]),
  33460. vue.createElementVNode("stop", {
  33461. "stop-color": `var(${vue.unref(ns).cssVarBlockName("fill-color-6")})`,
  33462. offset: "100%"
  33463. }, null, 8, ["stop-color"])
  33464. ], 8, ["id"]),
  33465. vue.createElementVNode("rect", {
  33466. id: `path-3-${vue.unref(id)}`,
  33467. x: "0",
  33468. y: "0",
  33469. width: "17",
  33470. height: "36"
  33471. }, null, 8, ["id"])
  33472. ]),
  33473. vue.createElementVNode("g", {
  33474. stroke: "none",
  33475. "stroke-width": "1",
  33476. fill: "none",
  33477. "fill-rule": "evenodd"
  33478. }, [
  33479. vue.createElementVNode("g", { transform: "translate(-1268.000000, -535.000000)" }, [
  33480. vue.createElementVNode("g", { transform: "translate(1268.000000, 535.000000)" }, [
  33481. vue.createElementVNode("path", {
  33482. 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",
  33483. fill: `var(${vue.unref(ns).cssVarBlockName("fill-color-3")})`
  33484. }, null, 8, ["fill"]),
  33485. vue.createElementVNode("polygon", {
  33486. fill: `var(${vue.unref(ns).cssVarBlockName("fill-color-7")})`,
  33487. transform: "translate(27.500000, 51.500000) scale(1, -1) translate(-27.500000, -51.500000) ",
  33488. points: "13 58 53 58 42 45 2 45"
  33489. }, null, 8, ["fill"]),
  33490. vue.createElementVNode("g", { transform: "translate(34.500000, 31.500000) scale(-1, 1) rotate(-25.000000) translate(-34.500000, -31.500000) translate(7.000000, 10.000000)" }, [
  33491. vue.createElementVNode("polygon", {
  33492. fill: `var(${vue.unref(ns).cssVarBlockName("fill-color-7")})`,
  33493. transform: "translate(11.500000, 5.000000) scale(1, -1) translate(-11.500000, -5.000000) ",
  33494. points: "2.84078316e-14 3 18 3 23 7 5 7"
  33495. }, null, 8, ["fill"]),
  33496. vue.createElementVNode("polygon", {
  33497. fill: `var(${vue.unref(ns).cssVarBlockName("fill-color-5")})`,
  33498. points: "-3.69149156e-15 7 38 7 38 43 -3.69149156e-15 43"
  33499. }, null, 8, ["fill"]),
  33500. vue.createElementVNode("rect", {
  33501. fill: `url(#linearGradient-1-${vue.unref(id)})`,
  33502. transform: "translate(46.500000, 25.000000) scale(-1, 1) translate(-46.500000, -25.000000) ",
  33503. x: "38",
  33504. y: "7",
  33505. width: "17",
  33506. height: "36"
  33507. }, null, 8, ["fill"]),
  33508. vue.createElementVNode("polygon", {
  33509. fill: `var(${vue.unref(ns).cssVarBlockName("fill-color-2")})`,
  33510. transform: "translate(39.500000, 3.500000) scale(-1, 1) translate(-39.500000, -3.500000) ",
  33511. points: "24 7 41 7 55 -3.63806207e-12 38 -3.63806207e-12"
  33512. }, null, 8, ["fill"])
  33513. ]),
  33514. vue.createElementVNode("rect", {
  33515. fill: `url(#linearGradient-2-${vue.unref(id)})`,
  33516. x: "13",
  33517. y: "45",
  33518. width: "40",
  33519. height: "36"
  33520. }, null, 8, ["fill"]),
  33521. vue.createElementVNode("g", { transform: "translate(53.000000, 45.000000)" }, [
  33522. vue.createElementVNode("use", {
  33523. fill: `var(${vue.unref(ns).cssVarBlockName("fill-color-8")})`,
  33524. transform: "translate(8.500000, 18.000000) scale(-1, 1) translate(-8.500000, -18.000000) ",
  33525. "xlink:href": `#path-3-${vue.unref(id)}`
  33526. }, null, 8, ["fill", "xlink:href"]),
  33527. vue.createElementVNode("polygon", {
  33528. fill: `var(${vue.unref(ns).cssVarBlockName("fill-color-9")})`,
  33529. mask: `url(#mask-4-${vue.unref(id)})`,
  33530. transform: "translate(12.000000, 9.000000) scale(-1, 1) translate(-12.000000, -9.000000) ",
  33531. points: "7 0 24 0 20 18 7 16.5"
  33532. }, null, 8, ["fill", "mask"])
  33533. ]),
  33534. vue.createElementVNode("polygon", {
  33535. fill: `var(${vue.unref(ns).cssVarBlockName("fill-color-2")})`,
  33536. transform: "translate(66.000000, 51.500000) scale(-1, 1) translate(-66.000000, -51.500000) ",
  33537. points: "62 45 79 45 70 58 53 58"
  33538. }, null, 8, ["fill"])
  33539. ])
  33540. ])
  33541. ])
  33542. ]);
  33543. };
  33544. }
  33545. });
  33546. var ImgEmpty = /* @__PURE__ */ _export_sfc(_sfc_main$19, [["__file", "img-empty.vue"]]);
  33547. const emptyProps = buildProps({
  33548. image: {
  33549. type: String,
  33550. default: ""
  33551. },
  33552. imageSize: Number,
  33553. description: {
  33554. type: String,
  33555. default: ""
  33556. }
  33557. });
  33558. const __default__$W = vue.defineComponent({
  33559. name: "ElEmpty"
  33560. });
  33561. const _sfc_main$18 = /* @__PURE__ */ vue.defineComponent({
  33562. ...__default__$W,
  33563. props: emptyProps,
  33564. setup(__props) {
  33565. const props = __props;
  33566. const { t } = useLocale();
  33567. const ns = useNamespace("empty");
  33568. const emptyDescription = vue.computed(() => props.description || t("el.table.emptyText"));
  33569. const imageStyle = vue.computed(() => ({
  33570. width: addUnit(props.imageSize)
  33571. }));
  33572. return (_ctx, _cache) => {
  33573. return vue.openBlock(), vue.createElementBlock("div", {
  33574. class: vue.normalizeClass(vue.unref(ns).b())
  33575. }, [
  33576. vue.createElementVNode("div", {
  33577. class: vue.normalizeClass(vue.unref(ns).e("image")),
  33578. style: vue.normalizeStyle(vue.unref(imageStyle))
  33579. }, [
  33580. _ctx.image ? (vue.openBlock(), vue.createElementBlock("img", {
  33581. key: 0,
  33582. src: _ctx.image,
  33583. ondragstart: "return false"
  33584. }, null, 8, ["src"])) : vue.renderSlot(_ctx.$slots, "image", { key: 1 }, () => [
  33585. vue.createVNode(ImgEmpty)
  33586. ])
  33587. ], 6),
  33588. vue.createElementVNode("div", {
  33589. class: vue.normalizeClass(vue.unref(ns).e("description"))
  33590. }, [
  33591. _ctx.$slots.description ? vue.renderSlot(_ctx.$slots, "description", { key: 0 }) : (vue.openBlock(), vue.createElementBlock("p", { key: 1 }, vue.toDisplayString(vue.unref(emptyDescription)), 1))
  33592. ], 2),
  33593. _ctx.$slots.default ? (vue.openBlock(), vue.createElementBlock("div", {
  33594. key: 0,
  33595. class: vue.normalizeClass(vue.unref(ns).e("bottom"))
  33596. }, [
  33597. vue.renderSlot(_ctx.$slots, "default")
  33598. ], 2)) : vue.createCommentVNode("v-if", true)
  33599. ], 2);
  33600. };
  33601. }
  33602. });
  33603. var Empty = /* @__PURE__ */ _export_sfc(_sfc_main$18, [["__file", "empty.vue"]]);
  33604. const ElEmpty = withInstall(Empty);
  33605. const imageViewerProps = buildProps({
  33606. urlList: {
  33607. type: definePropType(Array),
  33608. default: () => mutable([])
  33609. },
  33610. zIndex: {
  33611. type: Number
  33612. },
  33613. initialIndex: {
  33614. type: Number,
  33615. default: 0
  33616. },
  33617. infinite: {
  33618. type: Boolean,
  33619. default: true
  33620. },
  33621. hideOnClickModal: Boolean,
  33622. teleported: Boolean,
  33623. closeOnPressEscape: {
  33624. type: Boolean,
  33625. default: true
  33626. },
  33627. zoomRate: {
  33628. type: Number,
  33629. default: 1.2
  33630. },
  33631. scale: {
  33632. type: Number,
  33633. default: 1
  33634. },
  33635. minScale: {
  33636. type: Number,
  33637. default: 0.2
  33638. },
  33639. maxScale: {
  33640. type: Number,
  33641. default: 7
  33642. },
  33643. showProgress: Boolean,
  33644. crossorigin: {
  33645. type: definePropType(String)
  33646. }
  33647. });
  33648. const imageViewerEmits = {
  33649. close: () => true,
  33650. error: (evt) => evt instanceof Event,
  33651. switch: (index) => isNumber(index),
  33652. rotate: (deg) => isNumber(deg)
  33653. };
  33654. const __default__$V = vue.defineComponent({
  33655. name: "ElImageViewer"
  33656. });
  33657. const _sfc_main$17 = /* @__PURE__ */ vue.defineComponent({
  33658. ...__default__$V,
  33659. props: imageViewerProps,
  33660. emits: imageViewerEmits,
  33661. setup(__props, { expose, emit }) {
  33662. var _a;
  33663. const props = __props;
  33664. const modes = {
  33665. CONTAIN: {
  33666. name: "contain",
  33667. icon: vue.markRaw(full_screen_default)
  33668. },
  33669. ORIGINAL: {
  33670. name: "original",
  33671. icon: vue.markRaw(scale_to_original_default)
  33672. }
  33673. };
  33674. let stopWheelListener;
  33675. let prevOverflow = "";
  33676. const { t } = useLocale();
  33677. const ns = useNamespace("image-viewer");
  33678. const { nextZIndex } = useZIndex();
  33679. const wrapper = vue.ref();
  33680. const imgRef = vue.ref();
  33681. const scopeEventListener = vue.effectScope();
  33682. const scaleClamped = vue.computed(() => {
  33683. const { scale, minScale, maxScale } = props;
  33684. return clamp$2(scale, minScale, maxScale);
  33685. });
  33686. const loading = vue.ref(true);
  33687. const loadError = vue.ref(false);
  33688. const activeIndex = vue.ref(props.initialIndex);
  33689. const mode = vue.shallowRef(modes.CONTAIN);
  33690. const transform = vue.ref({
  33691. scale: scaleClamped.value,
  33692. deg: 0,
  33693. offsetX: 0,
  33694. offsetY: 0,
  33695. enableTransition: false
  33696. });
  33697. const zIndex = vue.ref((_a = props.zIndex) != null ? _a : nextZIndex());
  33698. const isSingle = vue.computed(() => {
  33699. const { urlList } = props;
  33700. return urlList.length <= 1;
  33701. });
  33702. const isFirst = vue.computed(() => activeIndex.value === 0);
  33703. const isLast = vue.computed(() => activeIndex.value === props.urlList.length - 1);
  33704. const currentImg = vue.computed(() => props.urlList[activeIndex.value]);
  33705. const arrowPrevKls = vue.computed(() => [
  33706. ns.e("btn"),
  33707. ns.e("prev"),
  33708. ns.is("disabled", !props.infinite && isFirst.value)
  33709. ]);
  33710. const arrowNextKls = vue.computed(() => [
  33711. ns.e("btn"),
  33712. ns.e("next"),
  33713. ns.is("disabled", !props.infinite && isLast.value)
  33714. ]);
  33715. const imgStyle = vue.computed(() => {
  33716. const { scale, deg, offsetX, offsetY, enableTransition } = transform.value;
  33717. let translateX = offsetX / scale;
  33718. let translateY = offsetY / scale;
  33719. const radian = deg * Math.PI / 180;
  33720. const cosRadian = Math.cos(radian);
  33721. const sinRadian = Math.sin(radian);
  33722. translateX = translateX * cosRadian + translateY * sinRadian;
  33723. translateY = translateY * cosRadian - offsetX / scale * sinRadian;
  33724. const style = {
  33725. transform: `scale(${scale}) rotate(${deg}deg) translate(${translateX}px, ${translateY}px)`,
  33726. transition: enableTransition ? "transform .3s" : ""
  33727. };
  33728. if (mode.value.name === modes.CONTAIN.name) {
  33729. style.maxWidth = style.maxHeight = "100%";
  33730. }
  33731. return style;
  33732. });
  33733. const progress = vue.computed(() => `${activeIndex.value + 1} / ${props.urlList.length}`);
  33734. function hide() {
  33735. unregisterEventListener();
  33736. stopWheelListener == null ? void 0 : stopWheelListener();
  33737. document.body.style.overflow = prevOverflow;
  33738. emit("close");
  33739. }
  33740. function registerEventListener() {
  33741. const keydownHandler = throttle((e) => {
  33742. const code = getEventCode(e);
  33743. switch (code) {
  33744. case EVENT_CODE.esc:
  33745. props.closeOnPressEscape && hide();
  33746. break;
  33747. case EVENT_CODE.space:
  33748. toggleMode();
  33749. break;
  33750. case EVENT_CODE.left:
  33751. prev();
  33752. break;
  33753. case EVENT_CODE.up:
  33754. handleActions("zoomIn");
  33755. break;
  33756. case EVENT_CODE.right:
  33757. next();
  33758. break;
  33759. case EVENT_CODE.down:
  33760. handleActions("zoomOut");
  33761. break;
  33762. }
  33763. });
  33764. const mousewheelHandler = throttle((e) => {
  33765. const delta = e.deltaY || e.deltaX;
  33766. handleActions(delta < 0 ? "zoomIn" : "zoomOut", {
  33767. zoomRate: props.zoomRate,
  33768. enableTransition: false
  33769. });
  33770. });
  33771. scopeEventListener.run(() => {
  33772. useEventListener(document, "keydown", keydownHandler);
  33773. useEventListener(document, "wheel", mousewheelHandler);
  33774. });
  33775. }
  33776. function unregisterEventListener() {
  33777. scopeEventListener.stop();
  33778. }
  33779. function handleImgLoad() {
  33780. loading.value = false;
  33781. }
  33782. function handleImgError(e) {
  33783. loadError.value = true;
  33784. loading.value = false;
  33785. emit("error", e);
  33786. e.target.alt = t("el.image.error");
  33787. }
  33788. function handleMouseDown(e) {
  33789. if (loading.value || e.button !== 0 || !wrapper.value)
  33790. return;
  33791. transform.value.enableTransition = false;
  33792. const { offsetX, offsetY } = transform.value;
  33793. const startX = e.pageX;
  33794. const startY = e.pageY;
  33795. const dragHandler = throttle((ev) => {
  33796. transform.value = {
  33797. ...transform.value,
  33798. offsetX: offsetX + ev.pageX - startX,
  33799. offsetY: offsetY + ev.pageY - startY
  33800. };
  33801. });
  33802. const removeMousemove = useEventListener(document, "mousemove", dragHandler);
  33803. useEventListener(document, "mouseup", () => {
  33804. removeMousemove();
  33805. });
  33806. e.preventDefault();
  33807. }
  33808. function reset() {
  33809. transform.value = {
  33810. scale: scaleClamped.value,
  33811. deg: 0,
  33812. offsetX: 0,
  33813. offsetY: 0,
  33814. enableTransition: false
  33815. };
  33816. }
  33817. function toggleMode() {
  33818. if (loading.value || loadError.value)
  33819. return;
  33820. const modeNames = keysOf(modes);
  33821. const modeValues = Object.values(modes);
  33822. const currentMode = mode.value.name;
  33823. const index = modeValues.findIndex((i) => i.name === currentMode);
  33824. const nextIndex = (index + 1) % modeNames.length;
  33825. mode.value = modes[modeNames[nextIndex]];
  33826. reset();
  33827. }
  33828. function setActiveItem(index) {
  33829. loadError.value = false;
  33830. const len = props.urlList.length;
  33831. activeIndex.value = (index + len) % len;
  33832. }
  33833. function prev() {
  33834. if (isFirst.value && !props.infinite)
  33835. return;
  33836. setActiveItem(activeIndex.value - 1);
  33837. }
  33838. function next() {
  33839. if (isLast.value && !props.infinite)
  33840. return;
  33841. setActiveItem(activeIndex.value + 1);
  33842. }
  33843. function handleActions(action, options = {}) {
  33844. if (loading.value || loadError.value)
  33845. return;
  33846. const { minScale, maxScale } = props;
  33847. const { zoomRate, rotateDeg, enableTransition } = {
  33848. zoomRate: props.zoomRate,
  33849. rotateDeg: 90,
  33850. enableTransition: true,
  33851. ...options
  33852. };
  33853. switch (action) {
  33854. case "zoomOut":
  33855. if (transform.value.scale > minScale) {
  33856. transform.value.scale = Number.parseFloat((transform.value.scale / zoomRate).toFixed(3));
  33857. }
  33858. break;
  33859. case "zoomIn":
  33860. if (transform.value.scale < maxScale) {
  33861. transform.value.scale = Number.parseFloat((transform.value.scale * zoomRate).toFixed(3));
  33862. }
  33863. break;
  33864. case "clockwise":
  33865. transform.value.deg += rotateDeg;
  33866. emit("rotate", transform.value.deg);
  33867. break;
  33868. case "anticlockwise":
  33869. transform.value.deg -= rotateDeg;
  33870. emit("rotate", transform.value.deg);
  33871. break;
  33872. }
  33873. transform.value.enableTransition = enableTransition;
  33874. }
  33875. function onFocusoutPrevented(event) {
  33876. var _a2;
  33877. if (((_a2 = event.detail) == null ? void 0 : _a2.focusReason) === "pointer") {
  33878. event.preventDefault();
  33879. }
  33880. }
  33881. function onCloseRequested() {
  33882. if (props.closeOnPressEscape) {
  33883. hide();
  33884. }
  33885. }
  33886. function wheelHandler(e) {
  33887. if (!e.ctrlKey)
  33888. return;
  33889. if (e.deltaY < 0) {
  33890. e.preventDefault();
  33891. return false;
  33892. } else if (e.deltaY > 0) {
  33893. e.preventDefault();
  33894. return false;
  33895. }
  33896. }
  33897. vue.watch(() => scaleClamped.value, (val) => {
  33898. transform.value.scale = val;
  33899. });
  33900. vue.watch(currentImg, () => {
  33901. vue.nextTick(() => {
  33902. const $img = imgRef.value;
  33903. if (!($img == null ? void 0 : $img.complete)) {
  33904. loading.value = true;
  33905. }
  33906. });
  33907. });
  33908. vue.watch(activeIndex, (val) => {
  33909. reset();
  33910. emit("switch", val);
  33911. });
  33912. vue.onMounted(() => {
  33913. registerEventListener();
  33914. stopWheelListener = useEventListener("wheel", wheelHandler, {
  33915. passive: false
  33916. });
  33917. prevOverflow = document.body.style.overflow;
  33918. document.body.style.overflow = "hidden";
  33919. });
  33920. expose({
  33921. setActiveItem
  33922. });
  33923. return (_ctx, _cache) => {
  33924. return vue.openBlock(), vue.createBlock(vue.unref(ElTeleport$1), {
  33925. to: "body",
  33926. disabled: !_ctx.teleported
  33927. }, {
  33928. default: vue.withCtx(() => [
  33929. vue.createVNode(vue.Transition, {
  33930. name: "viewer-fade",
  33931. appear: ""
  33932. }, {
  33933. default: vue.withCtx(() => [
  33934. vue.createElementVNode("div", {
  33935. ref_key: "wrapper",
  33936. ref: wrapper,
  33937. tabindex: -1,
  33938. class: vue.normalizeClass(vue.unref(ns).e("wrapper")),
  33939. style: vue.normalizeStyle({ zIndex: zIndex.value })
  33940. }, [
  33941. vue.createVNode(vue.unref(ElFocusTrap), {
  33942. loop: "",
  33943. trapped: "",
  33944. "focus-trap-el": wrapper.value,
  33945. "focus-start-el": "container",
  33946. onFocusoutPrevented,
  33947. onReleaseRequested: onCloseRequested
  33948. }, {
  33949. default: vue.withCtx(() => [
  33950. vue.createElementVNode("div", {
  33951. class: vue.normalizeClass(vue.unref(ns).e("mask")),
  33952. onClick: vue.withModifiers(($event) => _ctx.hideOnClickModal && hide(), ["self"])
  33953. }, null, 10, ["onClick"]),
  33954. vue.createCommentVNode(" CLOSE "),
  33955. vue.createElementVNode("span", {
  33956. class: vue.normalizeClass([vue.unref(ns).e("btn"), vue.unref(ns).e("close")]),
  33957. onClick: hide
  33958. }, [
  33959. vue.createVNode(vue.unref(ElIcon), null, {
  33960. default: vue.withCtx(() => [
  33961. vue.createVNode(vue.unref(close_default))
  33962. ]),
  33963. _: 1
  33964. })
  33965. ], 2),
  33966. vue.createCommentVNode(" ARROW "),
  33967. !vue.unref(isSingle) ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  33968. vue.createElementVNode("span", {
  33969. class: vue.normalizeClass(vue.unref(arrowPrevKls)),
  33970. onClick: prev
  33971. }, [
  33972. vue.createVNode(vue.unref(ElIcon), null, {
  33973. default: vue.withCtx(() => [
  33974. vue.createVNode(vue.unref(arrow_left_default))
  33975. ]),
  33976. _: 1
  33977. })
  33978. ], 2),
  33979. vue.createElementVNode("span", {
  33980. class: vue.normalizeClass(vue.unref(arrowNextKls)),
  33981. onClick: next
  33982. }, [
  33983. vue.createVNode(vue.unref(ElIcon), null, {
  33984. default: vue.withCtx(() => [
  33985. vue.createVNode(vue.unref(arrow_right_default))
  33986. ]),
  33987. _: 1
  33988. })
  33989. ], 2)
  33990. ], 64)) : vue.createCommentVNode("v-if", true),
  33991. _ctx.$slots.progress || _ctx.showProgress ? (vue.openBlock(), vue.createElementBlock("div", {
  33992. key: 1,
  33993. class: vue.normalizeClass([vue.unref(ns).e("btn"), vue.unref(ns).e("progress")])
  33994. }, [
  33995. vue.renderSlot(_ctx.$slots, "progress", {
  33996. activeIndex: activeIndex.value,
  33997. total: _ctx.urlList.length
  33998. }, () => [
  33999. vue.createTextVNode(vue.toDisplayString(vue.unref(progress)), 1)
  34000. ])
  34001. ], 2)) : vue.createCommentVNode("v-if", true),
  34002. vue.createCommentVNode(" ACTIONS "),
  34003. vue.createElementVNode("div", {
  34004. class: vue.normalizeClass([vue.unref(ns).e("btn"), vue.unref(ns).e("actions")])
  34005. }, [
  34006. vue.createElementVNode("div", {
  34007. class: vue.normalizeClass(vue.unref(ns).e("actions__inner"))
  34008. }, [
  34009. vue.renderSlot(_ctx.$slots, "toolbar", {
  34010. actions: handleActions,
  34011. prev,
  34012. next,
  34013. reset: toggleMode,
  34014. activeIndex: activeIndex.value,
  34015. setActiveItem
  34016. }, () => [
  34017. vue.createVNode(vue.unref(ElIcon), {
  34018. onClick: ($event) => handleActions("zoomOut")
  34019. }, {
  34020. default: vue.withCtx(() => [
  34021. vue.createVNode(vue.unref(zoom_out_default))
  34022. ]),
  34023. _: 1
  34024. }, 8, ["onClick"]),
  34025. vue.createVNode(vue.unref(ElIcon), {
  34026. onClick: ($event) => handleActions("zoomIn")
  34027. }, {
  34028. default: vue.withCtx(() => [
  34029. vue.createVNode(vue.unref(zoom_in_default))
  34030. ]),
  34031. _: 1
  34032. }, 8, ["onClick"]),
  34033. vue.createElementVNode("i", {
  34034. class: vue.normalizeClass(vue.unref(ns).e("actions__divider"))
  34035. }, null, 2),
  34036. vue.createVNode(vue.unref(ElIcon), { onClick: toggleMode }, {
  34037. default: vue.withCtx(() => [
  34038. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(mode).icon)))
  34039. ]),
  34040. _: 1
  34041. }),
  34042. vue.createElementVNode("i", {
  34043. class: vue.normalizeClass(vue.unref(ns).e("actions__divider"))
  34044. }, null, 2),
  34045. vue.createVNode(vue.unref(ElIcon), {
  34046. onClick: ($event) => handleActions("anticlockwise")
  34047. }, {
  34048. default: vue.withCtx(() => [
  34049. vue.createVNode(vue.unref(refresh_left_default))
  34050. ]),
  34051. _: 1
  34052. }, 8, ["onClick"]),
  34053. vue.createVNode(vue.unref(ElIcon), {
  34054. onClick: ($event) => handleActions("clockwise")
  34055. }, {
  34056. default: vue.withCtx(() => [
  34057. vue.createVNode(vue.unref(refresh_right_default))
  34058. ]),
  34059. _: 1
  34060. }, 8, ["onClick"])
  34061. ])
  34062. ], 2)
  34063. ], 2),
  34064. vue.createCommentVNode(" CANVAS "),
  34065. vue.createElementVNode("div", {
  34066. class: vue.normalizeClass(vue.unref(ns).e("canvas"))
  34067. }, [
  34068. loadError.value && _ctx.$slots["viewer-error"] ? vue.renderSlot(_ctx.$slots, "viewer-error", {
  34069. key: 0,
  34070. activeIndex: activeIndex.value,
  34071. src: vue.unref(currentImg)
  34072. }) : (vue.openBlock(), vue.createElementBlock("img", {
  34073. ref_key: "imgRef",
  34074. ref: imgRef,
  34075. key: vue.unref(currentImg),
  34076. src: vue.unref(currentImg),
  34077. style: vue.normalizeStyle(vue.unref(imgStyle)),
  34078. class: vue.normalizeClass(vue.unref(ns).e("img")),
  34079. crossorigin: _ctx.crossorigin,
  34080. onLoad: handleImgLoad,
  34081. onError: handleImgError,
  34082. onMousedown: handleMouseDown
  34083. }, null, 46, ["src", "crossorigin"]))
  34084. ], 2),
  34085. vue.renderSlot(_ctx.$slots, "default")
  34086. ]),
  34087. _: 3
  34088. }, 8, ["focus-trap-el"])
  34089. ], 6)
  34090. ]),
  34091. _: 3
  34092. })
  34093. ]),
  34094. _: 3
  34095. }, 8, ["disabled"]);
  34096. };
  34097. }
  34098. });
  34099. var ImageViewer = /* @__PURE__ */ _export_sfc(_sfc_main$17, [["__file", "image-viewer.vue"]]);
  34100. const ElImageViewer = withInstall(ImageViewer);
  34101. const imageProps = buildProps({
  34102. hideOnClickModal: Boolean,
  34103. src: {
  34104. type: String,
  34105. default: ""
  34106. },
  34107. fit: {
  34108. type: String,
  34109. values: ["", "contain", "cover", "fill", "none", "scale-down"],
  34110. default: ""
  34111. },
  34112. loading: {
  34113. type: String,
  34114. values: ["eager", "lazy"]
  34115. },
  34116. lazy: Boolean,
  34117. scrollContainer: {
  34118. type: definePropType([String, Object])
  34119. },
  34120. previewSrcList: {
  34121. type: definePropType(Array),
  34122. default: () => mutable([])
  34123. },
  34124. previewTeleported: Boolean,
  34125. zIndex: {
  34126. type: Number
  34127. },
  34128. initialIndex: {
  34129. type: Number,
  34130. default: 0
  34131. },
  34132. infinite: {
  34133. type: Boolean,
  34134. default: true
  34135. },
  34136. closeOnPressEscape: {
  34137. type: Boolean,
  34138. default: true
  34139. },
  34140. zoomRate: {
  34141. type: Number,
  34142. default: 1.2
  34143. },
  34144. scale: {
  34145. type: Number,
  34146. default: 1
  34147. },
  34148. minScale: {
  34149. type: Number,
  34150. default: 0.2
  34151. },
  34152. maxScale: {
  34153. type: Number,
  34154. default: 7
  34155. },
  34156. showProgress: Boolean,
  34157. crossorigin: {
  34158. type: definePropType(String)
  34159. }
  34160. });
  34161. const imageEmits = {
  34162. load: (evt) => evt instanceof Event,
  34163. error: (evt) => evt instanceof Event,
  34164. switch: (val) => isNumber(val),
  34165. close: () => true,
  34166. show: () => true
  34167. };
  34168. const __default__$U = vue.defineComponent({
  34169. name: "ElImage",
  34170. inheritAttrs: false
  34171. });
  34172. const _sfc_main$16 = /* @__PURE__ */ vue.defineComponent({
  34173. ...__default__$U,
  34174. props: imageProps,
  34175. emits: imageEmits,
  34176. setup(__props, { expose, emit }) {
  34177. const props = __props;
  34178. const { t } = useLocale();
  34179. const ns = useNamespace("image");
  34180. const rawAttrs = vue.useAttrs();
  34181. const containerAttrs = vue.computed(() => {
  34182. return fromPairs(Object.entries(rawAttrs).filter(([key]) => /^(data-|on[A-Z])/i.test(key) || ["id", "style"].includes(key)));
  34183. });
  34184. const imgAttrs = useAttrs({
  34185. excludeListeners: true,
  34186. excludeKeys: vue.computed(() => {
  34187. return Object.keys(containerAttrs.value);
  34188. })
  34189. });
  34190. const imageSrc = vue.ref();
  34191. const hasLoadError = vue.ref(false);
  34192. const isLoading = vue.ref(true);
  34193. const showViewer = vue.ref(false);
  34194. const container = vue.ref();
  34195. const _scrollContainer = vue.ref();
  34196. const supportLoading = isClient && "loading" in HTMLImageElement.prototype;
  34197. let stopScrollListener;
  34198. const imageKls = vue.computed(() => [
  34199. ns.e("inner"),
  34200. preview.value && ns.e("preview"),
  34201. isLoading.value && ns.is("loading")
  34202. ]);
  34203. const imageStyle = vue.computed(() => {
  34204. const { fit } = props;
  34205. if (isClient && fit) {
  34206. return { objectFit: fit };
  34207. }
  34208. return {};
  34209. });
  34210. const preview = vue.computed(() => {
  34211. const { previewSrcList } = props;
  34212. return isArray$1(previewSrcList) && previewSrcList.length > 0;
  34213. });
  34214. const imageIndex = vue.computed(() => {
  34215. const { previewSrcList, initialIndex } = props;
  34216. let previewIndex = initialIndex;
  34217. if (initialIndex > previewSrcList.length - 1) {
  34218. previewIndex = 0;
  34219. }
  34220. return previewIndex;
  34221. });
  34222. const isManual = vue.computed(() => {
  34223. if (props.loading === "eager")
  34224. return false;
  34225. return !supportLoading && props.loading === "lazy" || props.lazy;
  34226. });
  34227. const loadImage = () => {
  34228. if (!isClient)
  34229. return;
  34230. isLoading.value = true;
  34231. hasLoadError.value = false;
  34232. imageSrc.value = props.src;
  34233. };
  34234. function handleLoad(event) {
  34235. isLoading.value = false;
  34236. hasLoadError.value = false;
  34237. emit("load", event);
  34238. }
  34239. function handleError(event) {
  34240. isLoading.value = false;
  34241. hasLoadError.value = true;
  34242. emit("error", event);
  34243. }
  34244. function handleLazyLoad(isIntersecting) {
  34245. if (isIntersecting) {
  34246. loadImage();
  34247. removeLazyLoadListener();
  34248. }
  34249. }
  34250. const lazyLoadHandler = useThrottleFn(handleLazyLoad, 200, true);
  34251. async function addLazyLoadListener() {
  34252. var _a;
  34253. if (!isClient)
  34254. return;
  34255. await vue.nextTick();
  34256. const { scrollContainer } = props;
  34257. if (isElement$2(scrollContainer)) {
  34258. _scrollContainer.value = scrollContainer;
  34259. } else if (isString$1(scrollContainer) && scrollContainer !== "") {
  34260. _scrollContainer.value = (_a = document.querySelector(scrollContainer)) != null ? _a : void 0;
  34261. } else if (container.value) {
  34262. const scrollContainer2 = getScrollContainer(container.value);
  34263. _scrollContainer.value = isWindow$1(scrollContainer2) ? void 0 : scrollContainer2;
  34264. }
  34265. const { stop } = useIntersectionObserver(container, ([entry]) => {
  34266. lazyLoadHandler(entry.isIntersecting);
  34267. }, { root: _scrollContainer });
  34268. stopScrollListener = stop;
  34269. }
  34270. function removeLazyLoadListener() {
  34271. if (!isClient || !lazyLoadHandler)
  34272. return;
  34273. stopScrollListener == null ? void 0 : stopScrollListener();
  34274. _scrollContainer.value = void 0;
  34275. stopScrollListener = void 0;
  34276. }
  34277. function clickHandler() {
  34278. if (!preview.value)
  34279. return;
  34280. showViewer.value = true;
  34281. emit("show");
  34282. }
  34283. function closeViewer() {
  34284. showViewer.value = false;
  34285. emit("close");
  34286. }
  34287. function switchViewer(val) {
  34288. emit("switch", val);
  34289. }
  34290. vue.watch(() => props.src, () => {
  34291. if (isManual.value) {
  34292. isLoading.value = true;
  34293. hasLoadError.value = false;
  34294. removeLazyLoadListener();
  34295. addLazyLoadListener();
  34296. } else {
  34297. loadImage();
  34298. }
  34299. });
  34300. vue.onMounted(() => {
  34301. if (isManual.value) {
  34302. addLazyLoadListener();
  34303. } else {
  34304. loadImage();
  34305. }
  34306. });
  34307. expose({
  34308. showPreview: clickHandler
  34309. });
  34310. return (_ctx, _cache) => {
  34311. return vue.openBlock(), vue.createElementBlock("div", vue.mergeProps({
  34312. ref_key: "container",
  34313. ref: container
  34314. }, vue.unref(containerAttrs), {
  34315. class: [vue.unref(ns).b(), _ctx.$attrs.class]
  34316. }), [
  34317. hasLoadError.value ? vue.renderSlot(_ctx.$slots, "error", { key: 0 }, () => [
  34318. vue.createElementVNode("div", {
  34319. class: vue.normalizeClass(vue.unref(ns).e("error"))
  34320. }, vue.toDisplayString(vue.unref(t)("el.image.error")), 3)
  34321. ]) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  34322. imageSrc.value !== void 0 ? (vue.openBlock(), vue.createElementBlock("img", vue.mergeProps({ key: 0 }, vue.unref(imgAttrs), {
  34323. src: imageSrc.value,
  34324. loading: _ctx.loading,
  34325. style: vue.unref(imageStyle),
  34326. class: vue.unref(imageKls),
  34327. crossorigin: _ctx.crossorigin,
  34328. onClick: clickHandler,
  34329. onLoad: handleLoad,
  34330. onError: handleError
  34331. }), null, 16, ["src", "loading", "crossorigin"])) : vue.createCommentVNode("v-if", true),
  34332. isLoading.value ? (vue.openBlock(), vue.createElementBlock("div", {
  34333. key: 1,
  34334. class: vue.normalizeClass(vue.unref(ns).e("wrapper"))
  34335. }, [
  34336. vue.renderSlot(_ctx.$slots, "placeholder", {}, () => [
  34337. vue.createElementVNode("div", {
  34338. class: vue.normalizeClass(vue.unref(ns).e("placeholder"))
  34339. }, null, 2)
  34340. ])
  34341. ], 2)) : vue.createCommentVNode("v-if", true)
  34342. ], 64)),
  34343. vue.unref(preview) ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 2 }, [
  34344. showViewer.value ? (vue.openBlock(), vue.createBlock(vue.unref(ElImageViewer), {
  34345. key: 0,
  34346. "z-index": _ctx.zIndex,
  34347. "initial-index": vue.unref(imageIndex),
  34348. infinite: _ctx.infinite,
  34349. "zoom-rate": _ctx.zoomRate,
  34350. "min-scale": _ctx.minScale,
  34351. "max-scale": _ctx.maxScale,
  34352. "show-progress": _ctx.showProgress,
  34353. "url-list": _ctx.previewSrcList,
  34354. scale: _ctx.scale,
  34355. crossorigin: _ctx.crossorigin,
  34356. "hide-on-click-modal": _ctx.hideOnClickModal,
  34357. teleported: _ctx.previewTeleported,
  34358. "close-on-press-escape": _ctx.closeOnPressEscape,
  34359. onClose: closeViewer,
  34360. onSwitch: switchViewer
  34361. }, vue.createSlots({
  34362. toolbar: vue.withCtx((toolbar) => [
  34363. vue.renderSlot(_ctx.$slots, "toolbar", vue.normalizeProps(vue.guardReactiveProps(toolbar)))
  34364. ]),
  34365. default: vue.withCtx(() => [
  34366. _ctx.$slots.viewer ? (vue.openBlock(), vue.createElementBlock("div", { key: 0 }, [
  34367. vue.renderSlot(_ctx.$slots, "viewer")
  34368. ])) : vue.createCommentVNode("v-if", true)
  34369. ]),
  34370. _: 2
  34371. }, [
  34372. _ctx.$slots.progress ? {
  34373. name: "progress",
  34374. fn: vue.withCtx((progress) => [
  34375. vue.renderSlot(_ctx.$slots, "progress", vue.normalizeProps(vue.guardReactiveProps(progress)))
  34376. ])
  34377. } : void 0,
  34378. _ctx.$slots["viewer-error"] ? {
  34379. name: "viewer-error",
  34380. fn: vue.withCtx((viewerError) => [
  34381. vue.renderSlot(_ctx.$slots, "viewer-error", vue.normalizeProps(vue.guardReactiveProps(viewerError)))
  34382. ])
  34383. } : void 0
  34384. ]), 1032, ["z-index", "initial-index", "infinite", "zoom-rate", "min-scale", "max-scale", "show-progress", "url-list", "scale", "crossorigin", "hide-on-click-modal", "teleported", "close-on-press-escape"])) : vue.createCommentVNode("v-if", true)
  34385. ], 64)) : vue.createCommentVNode("v-if", true)
  34386. ], 16);
  34387. };
  34388. }
  34389. });
  34390. var Image$1 = /* @__PURE__ */ _export_sfc(_sfc_main$16, [["__file", "image.vue"]]);
  34391. const ElImage = withInstall(Image$1);
  34392. const inputNumberProps = buildProps({
  34393. id: {
  34394. type: String,
  34395. default: void 0
  34396. },
  34397. step: {
  34398. type: Number,
  34399. default: 1
  34400. },
  34401. stepStrictly: Boolean,
  34402. max: {
  34403. type: Number,
  34404. default: Number.MAX_SAFE_INTEGER
  34405. },
  34406. min: {
  34407. type: Number,
  34408. default: Number.MIN_SAFE_INTEGER
  34409. },
  34410. modelValue: {
  34411. type: [Number, null]
  34412. },
  34413. readonly: Boolean,
  34414. disabled: Boolean,
  34415. size: useSizeProp,
  34416. controls: {
  34417. type: Boolean,
  34418. default: true
  34419. },
  34420. controlsPosition: {
  34421. type: String,
  34422. default: "",
  34423. values: ["", "right"]
  34424. },
  34425. valueOnClear: {
  34426. type: [String, Number, null],
  34427. validator: (val) => val === null || isNumber(val) || ["min", "max"].includes(val),
  34428. default: null
  34429. },
  34430. name: String,
  34431. placeholder: String,
  34432. precision: {
  34433. type: Number,
  34434. validator: (val) => val >= 0 && val === Number.parseInt(`${val}`, 10)
  34435. },
  34436. validateEvent: {
  34437. type: Boolean,
  34438. default: true
  34439. },
  34440. ...useAriaProps(["ariaLabel"]),
  34441. inputmode: {
  34442. type: definePropType(String),
  34443. default: void 0
  34444. },
  34445. align: {
  34446. type: definePropType(String),
  34447. default: "center"
  34448. },
  34449. disabledScientific: Boolean
  34450. });
  34451. const inputNumberEmits = {
  34452. [CHANGE_EVENT]: (cur, prev) => prev !== cur,
  34453. blur: (e) => e instanceof FocusEvent,
  34454. focus: (e) => e instanceof FocusEvent,
  34455. [INPUT_EVENT]: (val) => isNumber(val) || isNil(val),
  34456. [UPDATE_MODEL_EVENT]: (val) => isNumber(val) || isNil(val)
  34457. };
  34458. const __default__$T = vue.defineComponent({
  34459. name: "ElInputNumber"
  34460. });
  34461. const _sfc_main$15 = /* @__PURE__ */ vue.defineComponent({
  34462. ...__default__$T,
  34463. props: inputNumberProps,
  34464. emits: inputNumberEmits,
  34465. setup(__props, { expose, emit }) {
  34466. const props = __props;
  34467. const { t } = useLocale();
  34468. const ns = useNamespace("input-number");
  34469. const input = vue.ref();
  34470. const data = vue.reactive({
  34471. currentValue: props.modelValue,
  34472. userInput: null
  34473. });
  34474. const { formItem } = useFormItem();
  34475. const minDisabled = vue.computed(() => isNumber(props.modelValue) && props.modelValue <= props.min);
  34476. const maxDisabled = vue.computed(() => isNumber(props.modelValue) && props.modelValue >= props.max);
  34477. const numPrecision = vue.computed(() => {
  34478. const stepPrecision = getPrecision(props.step);
  34479. if (!isUndefined(props.precision)) {
  34480. if (stepPrecision > props.precision) {
  34481. debugWarn("InputNumber", "precision should not be less than the decimal places of step");
  34482. }
  34483. return props.precision;
  34484. } else {
  34485. return Math.max(getPrecision(props.modelValue), stepPrecision);
  34486. }
  34487. });
  34488. const controlsAtRight = vue.computed(() => {
  34489. return props.controls && props.controlsPosition === "right";
  34490. });
  34491. const inputNumberSize = useFormSize();
  34492. const inputNumberDisabled = useFormDisabled();
  34493. const displayValue = vue.computed(() => {
  34494. if (data.userInput !== null) {
  34495. return data.userInput;
  34496. }
  34497. let currentValue = data.currentValue;
  34498. if (isNil(currentValue))
  34499. return "";
  34500. if (isNumber(currentValue)) {
  34501. if (Number.isNaN(currentValue))
  34502. return "";
  34503. if (!isUndefined(props.precision)) {
  34504. currentValue = currentValue.toFixed(props.precision);
  34505. }
  34506. }
  34507. return currentValue;
  34508. });
  34509. const toPrecision = (num, pre) => {
  34510. if (isUndefined(pre))
  34511. pre = numPrecision.value;
  34512. if (pre === 0)
  34513. return Math.round(num);
  34514. let snum = String(num);
  34515. const pointPos = snum.indexOf(".");
  34516. if (pointPos === -1)
  34517. return num;
  34518. const nums = snum.replace(".", "").split("");
  34519. const datum = nums[pointPos + pre];
  34520. if (!datum)
  34521. return num;
  34522. const length = snum.length;
  34523. if (snum.charAt(length - 1) === "5") {
  34524. snum = `${snum.slice(0, Math.max(0, length - 1))}6`;
  34525. }
  34526. return Number.parseFloat(Number(snum).toFixed(pre));
  34527. };
  34528. const getPrecision = (value) => {
  34529. if (isNil(value))
  34530. return 0;
  34531. const valueString = value.toString();
  34532. const dotPosition = valueString.indexOf(".");
  34533. let precision = 0;
  34534. if (dotPosition !== -1) {
  34535. precision = valueString.length - dotPosition - 1;
  34536. }
  34537. return precision;
  34538. };
  34539. const ensurePrecision = (val, coefficient = 1) => {
  34540. if (!isNumber(val))
  34541. return data.currentValue;
  34542. if (val >= Number.MAX_SAFE_INTEGER && coefficient === 1) {
  34543. debugWarn("InputNumber", "The value has reached the maximum safe integer limit.");
  34544. return val;
  34545. } else if (val <= Number.MIN_SAFE_INTEGER && coefficient === -1) {
  34546. debugWarn("InputNumber", "The value has reached the minimum safe integer limit.");
  34547. return val;
  34548. }
  34549. return toPrecision(val + props.step * coefficient);
  34550. };
  34551. const handleKeydown = (event) => {
  34552. const code = getEventCode(event);
  34553. const key = getEventKey(event);
  34554. if (props.disabledScientific && ["e", "E"].includes(key)) {
  34555. event.preventDefault();
  34556. return;
  34557. }
  34558. switch (code) {
  34559. case EVENT_CODE.up: {
  34560. event.preventDefault();
  34561. increase();
  34562. break;
  34563. }
  34564. case EVENT_CODE.down: {
  34565. event.preventDefault();
  34566. decrease();
  34567. break;
  34568. }
  34569. }
  34570. };
  34571. const increase = () => {
  34572. if (props.readonly || inputNumberDisabled.value || maxDisabled.value)
  34573. return;
  34574. const value = Number(displayValue.value) || 0;
  34575. const newVal = ensurePrecision(value);
  34576. setCurrentValue(newVal);
  34577. emit(INPUT_EVENT, data.currentValue);
  34578. setCurrentValueToModelValue();
  34579. };
  34580. const decrease = () => {
  34581. if (props.readonly || inputNumberDisabled.value || minDisabled.value)
  34582. return;
  34583. const value = Number(displayValue.value) || 0;
  34584. const newVal = ensurePrecision(value, -1);
  34585. setCurrentValue(newVal);
  34586. emit(INPUT_EVENT, data.currentValue);
  34587. setCurrentValueToModelValue();
  34588. };
  34589. const verifyValue = (value, update) => {
  34590. const { max, min, step, precision, stepStrictly, valueOnClear } = props;
  34591. if (max < min) {
  34592. throwError("InputNumber", "min should not be greater than max.");
  34593. }
  34594. let newVal = Number(value);
  34595. if (isNil(value) || Number.isNaN(newVal)) {
  34596. return null;
  34597. }
  34598. if (value === "") {
  34599. if (valueOnClear === null) {
  34600. return null;
  34601. }
  34602. newVal = isString$1(valueOnClear) ? { min, max }[valueOnClear] : valueOnClear;
  34603. }
  34604. if (stepStrictly) {
  34605. newVal = toPrecision(Math.round(toPrecision(newVal / step)) * step, precision);
  34606. if (newVal !== value) {
  34607. update && emit(UPDATE_MODEL_EVENT, newVal);
  34608. }
  34609. }
  34610. if (!isUndefined(precision)) {
  34611. newVal = toPrecision(newVal, precision);
  34612. }
  34613. if (newVal > max || newVal < min) {
  34614. newVal = newVal > max ? max : min;
  34615. update && emit(UPDATE_MODEL_EVENT, newVal);
  34616. }
  34617. return newVal;
  34618. };
  34619. const setCurrentValue = (value, emitChange = true) => {
  34620. var _a;
  34621. const oldVal = data.currentValue;
  34622. const newVal = verifyValue(value);
  34623. if (!emitChange) {
  34624. emit(UPDATE_MODEL_EVENT, newVal);
  34625. return;
  34626. }
  34627. if (oldVal === newVal && value)
  34628. return;
  34629. data.userInput = null;
  34630. emit(UPDATE_MODEL_EVENT, newVal);
  34631. if (oldVal !== newVal) {
  34632. emit(CHANGE_EVENT, newVal, oldVal);
  34633. }
  34634. if (props.validateEvent) {
  34635. (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "change").catch((err) => debugWarn(err));
  34636. }
  34637. data.currentValue = newVal;
  34638. };
  34639. const handleInput = (value) => {
  34640. data.userInput = value;
  34641. const newVal = value === "" ? null : Number(value);
  34642. emit(INPUT_EVENT, newVal);
  34643. setCurrentValue(newVal, false);
  34644. };
  34645. const handleInputChange = (value) => {
  34646. const newVal = value !== "" ? Number(value) : "";
  34647. if (isNumber(newVal) && !Number.isNaN(newVal) || value === "") {
  34648. setCurrentValue(newVal);
  34649. }
  34650. setCurrentValueToModelValue();
  34651. data.userInput = null;
  34652. };
  34653. const focus = () => {
  34654. var _a, _b;
  34655. (_b = (_a = input.value) == null ? void 0 : _a.focus) == null ? void 0 : _b.call(_a);
  34656. };
  34657. const blur = () => {
  34658. var _a, _b;
  34659. (_b = (_a = input.value) == null ? void 0 : _a.blur) == null ? void 0 : _b.call(_a);
  34660. };
  34661. const handleFocus = (event) => {
  34662. emit("focus", event);
  34663. };
  34664. const handleBlur = (event) => {
  34665. var _a, _b;
  34666. data.userInput = null;
  34667. if (data.currentValue === null && ((_a = input.value) == null ? void 0 : _a.input)) {
  34668. input.value.input.value = "";
  34669. }
  34670. emit("blur", event);
  34671. if (props.validateEvent) {
  34672. (_b = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _b.call(formItem, "blur").catch((err) => debugWarn(err));
  34673. }
  34674. };
  34675. const setCurrentValueToModelValue = () => {
  34676. if (data.currentValue !== props.modelValue) {
  34677. data.currentValue = props.modelValue;
  34678. }
  34679. };
  34680. const handleWheel = (e) => {
  34681. if (document.activeElement === e.target)
  34682. e.preventDefault();
  34683. };
  34684. vue.watch(() => props.modelValue, (value, oldValue) => {
  34685. const newValue = verifyValue(value, true);
  34686. if (data.userInput === null && newValue !== oldValue) {
  34687. data.currentValue = newValue;
  34688. }
  34689. }, { immediate: true });
  34690. vue.watch(() => props.precision, () => {
  34691. data.currentValue = verifyValue(props.modelValue);
  34692. });
  34693. vue.onMounted(() => {
  34694. var _a;
  34695. const { min, max, modelValue } = props;
  34696. const innerInput = (_a = input.value) == null ? void 0 : _a.input;
  34697. innerInput.setAttribute("role", "spinbutton");
  34698. if (Number.isFinite(max)) {
  34699. innerInput.setAttribute("aria-valuemax", String(max));
  34700. } else {
  34701. innerInput.removeAttribute("aria-valuemax");
  34702. }
  34703. if (Number.isFinite(min)) {
  34704. innerInput.setAttribute("aria-valuemin", String(min));
  34705. } else {
  34706. innerInput.removeAttribute("aria-valuemin");
  34707. }
  34708. innerInput.setAttribute("aria-valuenow", data.currentValue || data.currentValue === 0 ? String(data.currentValue) : "");
  34709. innerInput.setAttribute("aria-disabled", String(inputNumberDisabled.value));
  34710. if (!isNumber(modelValue) && modelValue != null) {
  34711. let val = Number(modelValue);
  34712. if (Number.isNaN(val)) {
  34713. val = null;
  34714. }
  34715. emit(UPDATE_MODEL_EVENT, val);
  34716. }
  34717. innerInput.addEventListener("wheel", handleWheel, { passive: false });
  34718. });
  34719. vue.onUpdated(() => {
  34720. var _a, _b;
  34721. const innerInput = (_a = input.value) == null ? void 0 : _a.input;
  34722. innerInput == null ? void 0 : innerInput.setAttribute("aria-valuenow", `${(_b = data.currentValue) != null ? _b : ""}`);
  34723. });
  34724. expose({
  34725. focus,
  34726. blur
  34727. });
  34728. return (_ctx, _cache) => {
  34729. return vue.openBlock(), vue.createElementBlock("div", {
  34730. class: vue.normalizeClass([
  34731. vue.unref(ns).b(),
  34732. vue.unref(ns).m(vue.unref(inputNumberSize)),
  34733. vue.unref(ns).is("disabled", vue.unref(inputNumberDisabled)),
  34734. vue.unref(ns).is("without-controls", !_ctx.controls),
  34735. vue.unref(ns).is("controls-right", vue.unref(controlsAtRight)),
  34736. vue.unref(ns).is(_ctx.align, !!_ctx.align)
  34737. ]),
  34738. onDragstart: vue.withModifiers(() => {
  34739. }, ["prevent"])
  34740. }, [
  34741. _ctx.controls ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("span", {
  34742. key: 0,
  34743. role: "button",
  34744. "aria-label": vue.unref(t)("el.inputNumber.decrease"),
  34745. class: vue.normalizeClass([vue.unref(ns).e("decrease"), vue.unref(ns).is("disabled", vue.unref(minDisabled))]),
  34746. onKeydown: vue.withKeys(decrease, ["enter"])
  34747. }, [
  34748. vue.renderSlot(_ctx.$slots, "decrease-icon", {}, () => [
  34749. vue.createVNode(vue.unref(ElIcon), null, {
  34750. default: vue.withCtx(() => [
  34751. vue.unref(controlsAtRight) ? (vue.openBlock(), vue.createBlock(vue.unref(arrow_down_default), { key: 0 })) : (vue.openBlock(), vue.createBlock(vue.unref(minus_default), { key: 1 }))
  34752. ]),
  34753. _: 1
  34754. })
  34755. ])
  34756. ], 42, ["aria-label", "onKeydown"])), [
  34757. [vue.unref(vRepeatClick), decrease]
  34758. ]) : vue.createCommentVNode("v-if", true),
  34759. _ctx.controls ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("span", {
  34760. key: 1,
  34761. role: "button",
  34762. "aria-label": vue.unref(t)("el.inputNumber.increase"),
  34763. class: vue.normalizeClass([vue.unref(ns).e("increase"), vue.unref(ns).is("disabled", vue.unref(maxDisabled))]),
  34764. onKeydown: vue.withKeys(increase, ["enter"])
  34765. }, [
  34766. vue.renderSlot(_ctx.$slots, "increase-icon", {}, () => [
  34767. vue.createVNode(vue.unref(ElIcon), null, {
  34768. default: vue.withCtx(() => [
  34769. vue.unref(controlsAtRight) ? (vue.openBlock(), vue.createBlock(vue.unref(arrow_up_default), { key: 0 })) : (vue.openBlock(), vue.createBlock(vue.unref(plus_default), { key: 1 }))
  34770. ]),
  34771. _: 1
  34772. })
  34773. ])
  34774. ], 42, ["aria-label", "onKeydown"])), [
  34775. [vue.unref(vRepeatClick), increase]
  34776. ]) : vue.createCommentVNode("v-if", true),
  34777. vue.createVNode(vue.unref(ElInput), {
  34778. id: _ctx.id,
  34779. ref_key: "input",
  34780. ref: input,
  34781. type: "number",
  34782. step: _ctx.step,
  34783. "model-value": vue.unref(displayValue),
  34784. placeholder: _ctx.placeholder,
  34785. readonly: _ctx.readonly,
  34786. disabled: vue.unref(inputNumberDisabled),
  34787. size: vue.unref(inputNumberSize),
  34788. max: _ctx.max,
  34789. min: _ctx.min,
  34790. name: _ctx.name,
  34791. "aria-label": _ctx.ariaLabel,
  34792. "validate-event": false,
  34793. inputmode: _ctx.inputmode,
  34794. onKeydown: handleKeydown,
  34795. onBlur: handleBlur,
  34796. onFocus: handleFocus,
  34797. onInput: handleInput,
  34798. onChange: handleInputChange
  34799. }, vue.createSlots({
  34800. _: 2
  34801. }, [
  34802. _ctx.$slots.prefix ? {
  34803. name: "prefix",
  34804. fn: vue.withCtx(() => [
  34805. vue.renderSlot(_ctx.$slots, "prefix")
  34806. ])
  34807. } : void 0,
  34808. _ctx.$slots.suffix ? {
  34809. name: "suffix",
  34810. fn: vue.withCtx(() => [
  34811. vue.renderSlot(_ctx.$slots, "suffix")
  34812. ])
  34813. } : void 0
  34814. ]), 1032, ["id", "step", "model-value", "placeholder", "readonly", "disabled", "size", "max", "min", "name", "aria-label", "inputmode"])
  34815. ], 42, ["onDragstart"]);
  34816. };
  34817. }
  34818. });
  34819. var InputNumber = /* @__PURE__ */ _export_sfc(_sfc_main$15, [["__file", "input-number.vue"]]);
  34820. const ElInputNumber = withInstall(InputNumber);
  34821. const inputTagProps = buildProps({
  34822. modelValue: {
  34823. type: definePropType(Array)
  34824. },
  34825. max: Number,
  34826. tagType: { ...tagProps.type, default: "info" },
  34827. tagEffect: tagProps.effect,
  34828. trigger: {
  34829. type: definePropType(String),
  34830. default: EVENT_CODE.enter
  34831. },
  34832. draggable: Boolean,
  34833. delimiter: {
  34834. type: [String, RegExp],
  34835. default: ""
  34836. },
  34837. size: useSizeProp,
  34838. clearable: Boolean,
  34839. clearIcon: {
  34840. type: iconPropType,
  34841. default: circle_close_default
  34842. },
  34843. disabled: {
  34844. type: Boolean,
  34845. default: void 0
  34846. },
  34847. validateEvent: {
  34848. type: Boolean,
  34849. default: true
  34850. },
  34851. readonly: Boolean,
  34852. autofocus: Boolean,
  34853. id: {
  34854. type: String,
  34855. default: void 0
  34856. },
  34857. tabindex: {
  34858. type: [String, Number],
  34859. default: 0
  34860. },
  34861. maxlength: {
  34862. type: [String, Number]
  34863. },
  34864. minlength: {
  34865. type: [String, Number]
  34866. },
  34867. placeholder: String,
  34868. autocomplete: {
  34869. type: definePropType(String),
  34870. default: "off"
  34871. },
  34872. saveOnBlur: {
  34873. type: Boolean,
  34874. default: true
  34875. },
  34876. collapseTags: Boolean,
  34877. collapseTagsTooltip: Boolean,
  34878. maxCollapseTags: {
  34879. type: Number,
  34880. default: 1
  34881. },
  34882. ariaLabel: String
  34883. });
  34884. const inputTagEmits = {
  34885. [UPDATE_MODEL_EVENT]: (value) => isArray$1(value) || isUndefined(value),
  34886. [CHANGE_EVENT]: (value) => isArray$1(value) || isUndefined(value),
  34887. [INPUT_EVENT]: (value) => isString$1(value),
  34888. "add-tag": (value) => isString$1(value) || isArray$1(value),
  34889. "remove-tag": (value, index) => isString$1(value) && isNumber(index),
  34890. "drag-tag": (oldIndex, newIndex, value) => isNumber(oldIndex) && isNumber(newIndex) && isString$1(value),
  34891. focus: (evt) => evt instanceof FocusEvent,
  34892. blur: (evt) => evt instanceof FocusEvent,
  34893. clear: () => true
  34894. };
  34895. function useDragTag({
  34896. wrapperRef,
  34897. handleDragged,
  34898. afterDragged
  34899. }) {
  34900. const ns = useNamespace("input-tag");
  34901. const dropIndicatorRef = vue.shallowRef();
  34902. const showDropIndicator = vue.ref(false);
  34903. let draggingIndex;
  34904. let draggingTag;
  34905. let dropIndex;
  34906. let dropType;
  34907. function getTagClassName(index) {
  34908. return `.${ns.e("inner")} .${ns.namespace.value}-tag:nth-child(${index + 1})`;
  34909. }
  34910. function handleDragStart(event, index) {
  34911. draggingIndex = index;
  34912. draggingTag = wrapperRef.value.querySelector(getTagClassName(index));
  34913. if (draggingTag) {
  34914. draggingTag.style.opacity = "0.5";
  34915. }
  34916. event.dataTransfer.effectAllowed = "move";
  34917. }
  34918. function handleDragOver(event, index) {
  34919. dropIndex = index;
  34920. event.preventDefault();
  34921. event.dataTransfer.dropEffect = "move";
  34922. if (isUndefined(draggingIndex) || draggingIndex === index) {
  34923. showDropIndicator.value = false;
  34924. return;
  34925. }
  34926. const dropPosition = wrapperRef.value.querySelector(getTagClassName(index)).getBoundingClientRect();
  34927. const dropPrev = !(draggingIndex + 1 === index);
  34928. const dropNext = !(draggingIndex - 1 === index);
  34929. const distance = event.clientX - dropPosition.left;
  34930. const prevPercent = dropPrev ? dropNext ? 0.5 : 1 : -1;
  34931. const nextPercent = dropNext ? dropPrev ? 0.5 : 0 : 1;
  34932. if (distance <= dropPosition.width * prevPercent) {
  34933. dropType = "before";
  34934. } else if (distance > dropPosition.width * nextPercent) {
  34935. dropType = "after";
  34936. } else {
  34937. dropType = void 0;
  34938. }
  34939. const innerEl = wrapperRef.value.querySelector(`.${ns.e("inner")}`);
  34940. const innerPosition = innerEl.getBoundingClientRect();
  34941. const gap = Number.parseFloat(getStyle(innerEl, "gap")) / 2;
  34942. const indicatorTop = dropPosition.top - innerPosition.top;
  34943. let indicatorLeft = -9999;
  34944. if (dropType === "before") {
  34945. indicatorLeft = Math.max(dropPosition.left - innerPosition.left - gap, Math.floor(-gap / 2));
  34946. } else if (dropType === "after") {
  34947. const left = dropPosition.right - innerPosition.left;
  34948. indicatorLeft = left + (innerPosition.width === left ? Math.floor(gap / 2) : gap);
  34949. }
  34950. setStyle(dropIndicatorRef.value, {
  34951. top: `${indicatorTop}px`,
  34952. left: `${indicatorLeft}px`
  34953. });
  34954. showDropIndicator.value = !!dropType;
  34955. }
  34956. function handleDragEnd(event) {
  34957. event.preventDefault();
  34958. if (draggingTag) {
  34959. draggingTag.style.opacity = "";
  34960. }
  34961. if (dropType && !isUndefined(draggingIndex) && !isUndefined(dropIndex) && draggingIndex !== dropIndex) {
  34962. handleDragged(draggingIndex, dropIndex, dropType);
  34963. }
  34964. showDropIndicator.value = false;
  34965. draggingIndex = void 0;
  34966. draggingTag = null;
  34967. dropIndex = void 0;
  34968. dropType = void 0;
  34969. afterDragged == null ? void 0 : afterDragged();
  34970. }
  34971. return {
  34972. dropIndicatorRef,
  34973. showDropIndicator,
  34974. handleDragStart,
  34975. handleDragOver,
  34976. handleDragEnd
  34977. };
  34978. }
  34979. function useHovering() {
  34980. const hovering = vue.ref(false);
  34981. const handleMouseEnter = () => {
  34982. hovering.value = true;
  34983. };
  34984. const handleMouseLeave = () => {
  34985. hovering.value = false;
  34986. };
  34987. return {
  34988. hovering,
  34989. handleMouseEnter,
  34990. handleMouseLeave
  34991. };
  34992. }
  34993. function useInputTag({ props, emit, formItem }) {
  34994. const disabled = useFormDisabled();
  34995. const size = useFormSize();
  34996. const inputRef = vue.shallowRef();
  34997. const inputValue = vue.ref();
  34998. const tagTooltipRef = vue.ref();
  34999. const tagSize = vue.computed(() => {
  35000. return ["small"].includes(size.value) ? "small" : "default";
  35001. });
  35002. const placeholder = vue.computed(() => {
  35003. var _a;
  35004. return ((_a = props.modelValue) == null ? void 0 : _a.length) ? void 0 : props.placeholder;
  35005. });
  35006. const closable = vue.computed(() => !(props.readonly || disabled.value));
  35007. const inputLimit = vue.computed(() => {
  35008. var _a, _b;
  35009. return isUndefined(props.max) ? false : ((_b = (_a = props.modelValue) == null ? void 0 : _a.length) != null ? _b : 0) >= props.max;
  35010. });
  35011. const showTagList = vue.computed(() => {
  35012. var _a;
  35013. return props.collapseTags ? (_a = props.modelValue) == null ? void 0 : _a.slice(0, props.maxCollapseTags) : props.modelValue;
  35014. });
  35015. const collapseTagList = vue.computed(() => {
  35016. var _a;
  35017. return props.collapseTags ? (_a = props.modelValue) == null ? void 0 : _a.slice(props.maxCollapseTags) : [];
  35018. });
  35019. const addTagsEmit = (value) => {
  35020. var _a;
  35021. const list = [...(_a = props.modelValue) != null ? _a : [], ...castArray$1(value)];
  35022. emit(UPDATE_MODEL_EVENT, list);
  35023. emit(CHANGE_EVENT, list);
  35024. emit("add-tag", value);
  35025. inputValue.value = void 0;
  35026. };
  35027. const getDelimitedTags = (input) => {
  35028. var _a, _b;
  35029. const tags = input.split(props.delimiter).filter((val) => val && val !== input);
  35030. if (props.max) {
  35031. const maxInsert = props.max - ((_b = (_a = props.modelValue) == null ? void 0 : _a.length) != null ? _b : 0);
  35032. tags.splice(maxInsert);
  35033. }
  35034. return tags.length === 1 ? tags[0] : tags;
  35035. };
  35036. const handleInput = (event) => {
  35037. if (inputLimit.value) {
  35038. inputValue.value = void 0;
  35039. return;
  35040. }
  35041. if (isComposing.value)
  35042. return;
  35043. if (props.delimiter && inputValue.value) {
  35044. const tags = getDelimitedTags(inputValue.value);
  35045. if (tags.length) {
  35046. addTagsEmit(tags);
  35047. }
  35048. }
  35049. emit(INPUT_EVENT, event.target.value);
  35050. };
  35051. const handleKeydown = (event) => {
  35052. var _a;
  35053. if (isComposing.value)
  35054. return;
  35055. const code = getEventCode(event);
  35056. switch (code) {
  35057. case props.trigger:
  35058. event.preventDefault();
  35059. event.stopPropagation();
  35060. handleAddTag();
  35061. break;
  35062. case EVENT_CODE.numpadEnter:
  35063. if (props.trigger === EVENT_CODE.enter) {
  35064. event.preventDefault();
  35065. event.stopPropagation();
  35066. handleAddTag();
  35067. }
  35068. break;
  35069. case EVENT_CODE.backspace:
  35070. if (!inputValue.value && ((_a = props.modelValue) == null ? void 0 : _a.length)) {
  35071. event.preventDefault();
  35072. event.stopPropagation();
  35073. handleRemoveTag(props.modelValue.length - 1);
  35074. }
  35075. break;
  35076. }
  35077. };
  35078. const handleKeyup = (event) => {
  35079. if (isComposing.value || !isAndroid())
  35080. return;
  35081. const code = getEventCode(event);
  35082. switch (code) {
  35083. case EVENT_CODE.space:
  35084. if (props.trigger === EVENT_CODE.space) {
  35085. event.preventDefault();
  35086. event.stopPropagation();
  35087. handleAddTag();
  35088. }
  35089. break;
  35090. }
  35091. };
  35092. const handleAddTag = () => {
  35093. var _a;
  35094. const value = (_a = inputValue.value) == null ? void 0 : _a.trim();
  35095. if (!value || inputLimit.value)
  35096. return;
  35097. addTagsEmit(value);
  35098. };
  35099. const handleRemoveTag = (index) => {
  35100. var _a;
  35101. const value = ((_a = props.modelValue) != null ? _a : []).slice();
  35102. const [item] = value.splice(index, 1);
  35103. emit(UPDATE_MODEL_EVENT, value);
  35104. emit(CHANGE_EVENT, value);
  35105. emit("remove-tag", item, index);
  35106. };
  35107. const handleClear = () => {
  35108. inputValue.value = void 0;
  35109. emit(UPDATE_MODEL_EVENT, void 0);
  35110. emit(CHANGE_EVENT, void 0);
  35111. emit("clear");
  35112. };
  35113. const handleDragged = (draggingIndex, dropIndex, type) => {
  35114. var _a;
  35115. const value = ((_a = props.modelValue) != null ? _a : []).slice();
  35116. const [draggedItem] = value.splice(draggingIndex, 1);
  35117. const step = dropIndex > draggingIndex && type === "before" ? -1 : dropIndex < draggingIndex && type === "after" ? 1 : 0;
  35118. value.splice(dropIndex + step, 0, draggedItem);
  35119. emit(UPDATE_MODEL_EVENT, value);
  35120. emit(CHANGE_EVENT, value);
  35121. emit("drag-tag", draggingIndex, dropIndex + step, draggedItem);
  35122. };
  35123. const focus = () => {
  35124. var _a;
  35125. (_a = inputRef.value) == null ? void 0 : _a.focus();
  35126. };
  35127. const blur = () => {
  35128. var _a;
  35129. (_a = inputRef.value) == null ? void 0 : _a.blur();
  35130. };
  35131. const { wrapperRef, isFocused } = useFocusController(inputRef, {
  35132. disabled,
  35133. beforeBlur(event) {
  35134. var _a;
  35135. return (_a = tagTooltipRef.value) == null ? void 0 : _a.isFocusInsideContent(event);
  35136. },
  35137. afterBlur() {
  35138. var _a;
  35139. if (props.saveOnBlur) {
  35140. handleAddTag();
  35141. } else {
  35142. inputValue.value = void 0;
  35143. }
  35144. if (props.validateEvent) {
  35145. (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "blur").catch((err) => debugWarn(err));
  35146. }
  35147. }
  35148. });
  35149. const {
  35150. isComposing,
  35151. handleCompositionStart,
  35152. handleCompositionUpdate,
  35153. handleCompositionEnd
  35154. } = useComposition({ afterComposition: handleInput });
  35155. vue.watch(() => props.modelValue, () => {
  35156. var _a;
  35157. if (props.validateEvent) {
  35158. (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, CHANGE_EVENT).catch((err) => debugWarn(err));
  35159. }
  35160. });
  35161. return {
  35162. inputRef,
  35163. wrapperRef,
  35164. tagTooltipRef,
  35165. isFocused,
  35166. isComposing,
  35167. inputValue,
  35168. size,
  35169. tagSize,
  35170. placeholder,
  35171. closable,
  35172. disabled,
  35173. inputLimit,
  35174. showTagList,
  35175. collapseTagList,
  35176. handleDragged,
  35177. handleInput,
  35178. handleKeydown,
  35179. handleKeyup,
  35180. handleAddTag,
  35181. handleRemoveTag,
  35182. handleClear,
  35183. handleCompositionStart,
  35184. handleCompositionUpdate,
  35185. handleCompositionEnd,
  35186. focus,
  35187. blur
  35188. };
  35189. }
  35190. function useInputTagDom({
  35191. props,
  35192. isFocused,
  35193. hovering,
  35194. disabled,
  35195. inputValue,
  35196. size,
  35197. validateState,
  35198. validateIcon,
  35199. needStatusIcon
  35200. }) {
  35201. const attrs = vue.useAttrs();
  35202. const slots = vue.useSlots();
  35203. const ns = useNamespace("input-tag");
  35204. const nsInput = useNamespace("input");
  35205. const containerKls = vue.computed(() => [
  35206. ns.b(),
  35207. ns.is("focused", isFocused.value),
  35208. ns.is("hovering", hovering.value),
  35209. ns.is("disabled", disabled.value),
  35210. ns.m(size.value),
  35211. ns.e("wrapper"),
  35212. attrs.class
  35213. ]);
  35214. const containerStyle = vue.computed(() => [attrs.style]);
  35215. const innerKls = vue.computed(() => {
  35216. var _a, _b;
  35217. return [
  35218. ns.e("inner"),
  35219. ns.is("draggable", props.draggable),
  35220. ns.is("left-space", !((_a = props.modelValue) == null ? void 0 : _a.length) && !slots.prefix),
  35221. ns.is("right-space", !((_b = props.modelValue) == null ? void 0 : _b.length) && !showSuffix.value)
  35222. ];
  35223. });
  35224. const showClear = vue.computed(() => {
  35225. var _a;
  35226. return props.clearable && !disabled.value && !props.readonly && (((_a = props.modelValue) == null ? void 0 : _a.length) || inputValue.value) && (isFocused.value || hovering.value);
  35227. });
  35228. const showSuffix = vue.computed(() => {
  35229. return slots.suffix || showClear.value || validateState.value && validateIcon.value && needStatusIcon.value;
  35230. });
  35231. return {
  35232. ns,
  35233. nsInput,
  35234. containerKls,
  35235. containerStyle,
  35236. innerKls,
  35237. showClear,
  35238. showSuffix
  35239. };
  35240. }
  35241. const __default__$S = vue.defineComponent({
  35242. name: "ElInputTag",
  35243. inheritAttrs: false
  35244. });
  35245. const _sfc_main$14 = /* @__PURE__ */ vue.defineComponent({
  35246. ...__default__$S,
  35247. props: inputTagProps,
  35248. emits: inputTagEmits,
  35249. setup(__props, { expose, emit }) {
  35250. const props = __props;
  35251. const attrs = useAttrs();
  35252. const slots = vue.useSlots();
  35253. const { form, formItem } = useFormItem();
  35254. const { inputId } = useFormItemInputId(props, { formItemContext: formItem });
  35255. const needStatusIcon = vue.computed(() => {
  35256. var _a;
  35257. return (_a = form == null ? void 0 : form.statusIcon) != null ? _a : false;
  35258. });
  35259. const validateState = vue.computed(() => (formItem == null ? void 0 : formItem.validateState) || "");
  35260. const validateIcon = vue.computed(() => {
  35261. return validateState.value && ValidateComponentsMap[validateState.value];
  35262. });
  35263. const {
  35264. inputRef,
  35265. wrapperRef,
  35266. tagTooltipRef,
  35267. isFocused,
  35268. inputValue,
  35269. size,
  35270. tagSize,
  35271. placeholder,
  35272. closable,
  35273. disabled,
  35274. showTagList,
  35275. collapseTagList,
  35276. handleDragged,
  35277. handleInput,
  35278. handleKeydown,
  35279. handleKeyup,
  35280. handleRemoveTag,
  35281. handleClear,
  35282. handleCompositionStart,
  35283. handleCompositionUpdate,
  35284. handleCompositionEnd,
  35285. focus,
  35286. blur
  35287. } = useInputTag({ props, emit, formItem });
  35288. const { hovering, handleMouseEnter, handleMouseLeave } = useHovering();
  35289. const { calculatorRef, inputStyle } = useCalcInputWidth();
  35290. const {
  35291. dropIndicatorRef,
  35292. showDropIndicator,
  35293. handleDragStart,
  35294. handleDragOver,
  35295. handleDragEnd
  35296. } = useDragTag({ wrapperRef, handleDragged, afterDragged: focus });
  35297. const {
  35298. ns,
  35299. nsInput,
  35300. containerKls,
  35301. containerStyle,
  35302. innerKls,
  35303. showClear,
  35304. showSuffix
  35305. } = useInputTagDom({
  35306. props,
  35307. hovering,
  35308. isFocused,
  35309. inputValue,
  35310. disabled,
  35311. size,
  35312. validateState,
  35313. validateIcon,
  35314. needStatusIcon
  35315. });
  35316. expose({
  35317. focus,
  35318. blur
  35319. });
  35320. return (_ctx, _cache) => {
  35321. return vue.openBlock(), vue.createElementBlock("div", {
  35322. ref_key: "wrapperRef",
  35323. ref: wrapperRef,
  35324. class: vue.normalizeClass(vue.unref(containerKls)),
  35325. style: vue.normalizeStyle(vue.unref(containerStyle)),
  35326. onMouseenter: vue.unref(handleMouseEnter),
  35327. onMouseleave: vue.unref(handleMouseLeave)
  35328. }, [
  35329. vue.unref(slots).prefix ? (vue.openBlock(), vue.createElementBlock("div", {
  35330. key: 0,
  35331. class: vue.normalizeClass(vue.unref(ns).e("prefix"))
  35332. }, [
  35333. vue.renderSlot(_ctx.$slots, "prefix")
  35334. ], 2)) : vue.createCommentVNode("v-if", true),
  35335. vue.createElementVNode("div", {
  35336. class: vue.normalizeClass(vue.unref(innerKls))
  35337. }, [
  35338. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(showTagList), (item, index) => {
  35339. return vue.openBlock(), vue.createBlock(vue.unref(ElTag), {
  35340. key: index,
  35341. size: vue.unref(tagSize),
  35342. closable: vue.unref(closable),
  35343. type: _ctx.tagType,
  35344. effect: _ctx.tagEffect,
  35345. draggable: vue.unref(closable) && _ctx.draggable,
  35346. "disable-transitions": "",
  35347. onClose: ($event) => vue.unref(handleRemoveTag)(index),
  35348. onDragstart: (event) => vue.unref(handleDragStart)(event, index),
  35349. onDragover: (event) => vue.unref(handleDragOver)(event, index),
  35350. onDragend: vue.unref(handleDragEnd),
  35351. onDrop: vue.withModifiers(() => {
  35352. }, ["stop"])
  35353. }, {
  35354. default: vue.withCtx(() => [
  35355. vue.renderSlot(_ctx.$slots, "tag", {
  35356. value: item,
  35357. index
  35358. }, () => [
  35359. vue.createTextVNode(vue.toDisplayString(item), 1)
  35360. ])
  35361. ]),
  35362. _: 2
  35363. }, 1032, ["size", "closable", "type", "effect", "draggable", "onClose", "onDragstart", "onDragover", "onDragend", "onDrop"]);
  35364. }), 128)),
  35365. _ctx.collapseTags && _ctx.modelValue && _ctx.modelValue.length > _ctx.maxCollapseTags ? (vue.openBlock(), vue.createBlock(vue.unref(ElTooltip), {
  35366. key: 0,
  35367. ref_key: "tagTooltipRef",
  35368. ref: tagTooltipRef,
  35369. disabled: !_ctx.collapseTagsTooltip,
  35370. "fallback-placements": ["bottom", "top", "right", "left"],
  35371. effect: _ctx.tagEffect,
  35372. placement: "bottom"
  35373. }, {
  35374. default: vue.withCtx(() => [
  35375. vue.createVNode(vue.unref(ElTag), {
  35376. closable: false,
  35377. size: vue.unref(tagSize),
  35378. type: _ctx.tagType,
  35379. effect: _ctx.tagEffect,
  35380. "disable-transitions": ""
  35381. }, {
  35382. default: vue.withCtx(() => [
  35383. vue.createTextVNode(" + " + vue.toDisplayString(_ctx.modelValue.length - _ctx.maxCollapseTags), 1)
  35384. ]),
  35385. _: 1
  35386. }, 8, ["size", "type", "effect"])
  35387. ]),
  35388. content: vue.withCtx(() => [
  35389. vue.createElementVNode("div", {
  35390. class: vue.normalizeClass(vue.unref(ns).e("input-tag-list"))
  35391. }, [
  35392. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(collapseTagList), (item, index) => {
  35393. return vue.openBlock(), vue.createBlock(vue.unref(ElTag), {
  35394. key: index,
  35395. size: vue.unref(tagSize),
  35396. closable: vue.unref(closable),
  35397. type: _ctx.tagType,
  35398. effect: _ctx.tagEffect,
  35399. "disable-transitions": "",
  35400. onClose: ($event) => vue.unref(handleRemoveTag)(index + _ctx.maxCollapseTags)
  35401. }, {
  35402. default: vue.withCtx(() => [
  35403. vue.renderSlot(_ctx.$slots, "tag", {
  35404. value: item,
  35405. index: index + _ctx.maxCollapseTags
  35406. }, () => [
  35407. vue.createTextVNode(vue.toDisplayString(item), 1)
  35408. ])
  35409. ]),
  35410. _: 2
  35411. }, 1032, ["size", "closable", "type", "effect", "onClose"]);
  35412. }), 128))
  35413. ], 2)
  35414. ]),
  35415. _: 3
  35416. }, 8, ["disabled", "effect"])) : vue.createCommentVNode("v-if", true),
  35417. vue.createElementVNode("div", {
  35418. class: vue.normalizeClass(vue.unref(ns).e("input-wrapper"))
  35419. }, [
  35420. vue.withDirectives(vue.createElementVNode("input", vue.mergeProps({
  35421. id: vue.unref(inputId),
  35422. ref_key: "inputRef",
  35423. ref: inputRef,
  35424. "onUpdate:modelValue": ($event) => vue.isRef(inputValue) ? inputValue.value = $event : null
  35425. }, vue.unref(attrs), {
  35426. type: "text",
  35427. minlength: _ctx.minlength,
  35428. maxlength: _ctx.maxlength,
  35429. disabled: vue.unref(disabled),
  35430. readonly: _ctx.readonly,
  35431. autocomplete: _ctx.autocomplete,
  35432. tabindex: _ctx.tabindex,
  35433. placeholder: vue.unref(placeholder),
  35434. autofocus: _ctx.autofocus,
  35435. ariaLabel: _ctx.ariaLabel,
  35436. class: vue.unref(ns).e("input"),
  35437. style: vue.unref(inputStyle),
  35438. onCompositionstart: vue.unref(handleCompositionStart),
  35439. onCompositionupdate: vue.unref(handleCompositionUpdate),
  35440. onCompositionend: vue.unref(handleCompositionEnd),
  35441. onInput: vue.unref(handleInput),
  35442. onKeydown: vue.unref(handleKeydown),
  35443. onKeyup: vue.unref(handleKeyup)
  35444. }), null, 16, ["id", "onUpdate:modelValue", "minlength", "maxlength", "disabled", "readonly", "autocomplete", "tabindex", "placeholder", "autofocus", "ariaLabel", "onCompositionstart", "onCompositionupdate", "onCompositionend", "onInput", "onKeydown", "onKeyup"]), [
  35445. [vue.vModelText, vue.unref(inputValue)]
  35446. ]),
  35447. vue.createElementVNode("span", {
  35448. ref_key: "calculatorRef",
  35449. ref: calculatorRef,
  35450. "aria-hidden": "true",
  35451. class: vue.normalizeClass(vue.unref(ns).e("input-calculator")),
  35452. textContent: vue.toDisplayString(vue.unref(inputValue))
  35453. }, null, 10, ["textContent"])
  35454. ], 2),
  35455. vue.withDirectives(vue.createElementVNode("div", {
  35456. ref_key: "dropIndicatorRef",
  35457. ref: dropIndicatorRef,
  35458. class: vue.normalizeClass(vue.unref(ns).e("drop-indicator"))
  35459. }, null, 2), [
  35460. [vue.vShow, vue.unref(showDropIndicator)]
  35461. ])
  35462. ], 2),
  35463. vue.unref(showSuffix) ? (vue.openBlock(), vue.createElementBlock("div", {
  35464. key: 1,
  35465. class: vue.normalizeClass(vue.unref(ns).e("suffix"))
  35466. }, [
  35467. vue.renderSlot(_ctx.$slots, "suffix"),
  35468. vue.unref(showClear) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  35469. key: 0,
  35470. class: vue.normalizeClass([vue.unref(ns).e("icon"), vue.unref(ns).e("clear")]),
  35471. onMousedown: vue.withModifiers(vue.unref(NOOP), ["prevent"]),
  35472. onClick: vue.unref(handleClear)
  35473. }, {
  35474. default: vue.withCtx(() => [
  35475. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.clearIcon)))
  35476. ]),
  35477. _: 1
  35478. }, 8, ["class", "onMousedown", "onClick"])) : vue.createCommentVNode("v-if", true),
  35479. vue.unref(validateState) && vue.unref(validateIcon) && vue.unref(needStatusIcon) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  35480. key: 1,
  35481. class: vue.normalizeClass([
  35482. vue.unref(nsInput).e("icon"),
  35483. vue.unref(nsInput).e("validateIcon"),
  35484. vue.unref(nsInput).is("loading", vue.unref(validateState) === "validating")
  35485. ])
  35486. }, {
  35487. default: vue.withCtx(() => [
  35488. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(validateIcon))))
  35489. ]),
  35490. _: 1
  35491. }, 8, ["class"])) : vue.createCommentVNode("v-if", true)
  35492. ], 2)) : vue.createCommentVNode("v-if", true)
  35493. ], 46, ["onMouseenter", "onMouseleave"]);
  35494. };
  35495. }
  35496. });
  35497. var InputTag = /* @__PURE__ */ _export_sfc(_sfc_main$14, [["__file", "input-tag.vue"]]);
  35498. const ElInputTag = withInstall(InputTag);
  35499. const linkProps = buildProps({
  35500. type: {
  35501. type: String,
  35502. values: ["primary", "success", "warning", "info", "danger", "default"],
  35503. default: void 0
  35504. },
  35505. underline: {
  35506. type: [Boolean, String],
  35507. values: [true, false, "always", "never", "hover"],
  35508. default: void 0
  35509. },
  35510. disabled: Boolean,
  35511. href: { type: String, default: "" },
  35512. target: {
  35513. type: String,
  35514. default: "_self"
  35515. },
  35516. icon: {
  35517. type: iconPropType
  35518. }
  35519. });
  35520. const linkEmits = {
  35521. click: (evt) => evt instanceof MouseEvent
  35522. };
  35523. const __default__$R = vue.defineComponent({
  35524. name: "ElLink"
  35525. });
  35526. const _sfc_main$13 = /* @__PURE__ */ vue.defineComponent({
  35527. ...__default__$R,
  35528. props: linkProps,
  35529. emits: linkEmits,
  35530. setup(__props, { emit }) {
  35531. const props = __props;
  35532. const globalConfig = useGlobalConfig("link");
  35533. useDeprecated({
  35534. scope: "el-link",
  35535. from: "The underline option (boolean)",
  35536. replacement: "'always' | 'hover' | 'never'",
  35537. version: "3.0.0",
  35538. ref: "https://element-plus.org/en-US/component/link.html#underline"
  35539. }, vue.computed(() => isBoolean(props.underline)));
  35540. const ns = useNamespace("link");
  35541. const linkKls = vue.computed(() => {
  35542. var _a, _b, _c;
  35543. return [
  35544. ns.b(),
  35545. ns.m((_c = (_b = props.type) != null ? _b : (_a = globalConfig.value) == null ? void 0 : _a.type) != null ? _c : "default"),
  35546. ns.is("disabled", props.disabled),
  35547. ns.is("underline", underline.value === "always"),
  35548. ns.is("hover-underline", underline.value === "hover" && !props.disabled)
  35549. ];
  35550. });
  35551. const underline = vue.computed(() => {
  35552. var _a, _b, _c;
  35553. if (isBoolean(props.underline)) {
  35554. return props.underline ? "hover" : "never";
  35555. } else
  35556. return (_c = (_b = props.underline) != null ? _b : (_a = globalConfig.value) == null ? void 0 : _a.underline) != null ? _c : "hover";
  35557. });
  35558. function handleClick(event) {
  35559. if (!props.disabled)
  35560. emit("click", event);
  35561. }
  35562. return (_ctx, _cache) => {
  35563. return vue.openBlock(), vue.createElementBlock("a", {
  35564. class: vue.normalizeClass(vue.unref(linkKls)),
  35565. href: _ctx.disabled || !_ctx.href ? void 0 : _ctx.href,
  35566. target: _ctx.disabled || !_ctx.href ? void 0 : _ctx.target,
  35567. onClick: handleClick
  35568. }, [
  35569. _ctx.icon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 0 }, {
  35570. default: vue.withCtx(() => [
  35571. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.icon)))
  35572. ]),
  35573. _: 1
  35574. })) : vue.createCommentVNode("v-if", true),
  35575. _ctx.$slots.default ? (vue.openBlock(), vue.createElementBlock("span", {
  35576. key: 1,
  35577. class: vue.normalizeClass(vue.unref(ns).e("inner"))
  35578. }, [
  35579. vue.renderSlot(_ctx.$slots, "default")
  35580. ], 2)) : vue.createCommentVNode("v-if", true),
  35581. _ctx.$slots.icon ? vue.renderSlot(_ctx.$slots, "icon", { key: 2 }) : vue.createCommentVNode("v-if", true)
  35582. ], 10, ["href", "target"]);
  35583. };
  35584. }
  35585. });
  35586. var Link = /* @__PURE__ */ _export_sfc(_sfc_main$13, [["__file", "link.vue"]]);
  35587. const ElLink = withInstall(Link);
  35588. class SubMenu$1 {
  35589. constructor(parent, domNode) {
  35590. this.parent = parent;
  35591. this.domNode = domNode;
  35592. this.subIndex = 0;
  35593. this.subIndex = 0;
  35594. this.init();
  35595. }
  35596. init() {
  35597. this.subMenuItems = this.domNode.querySelectorAll("li");
  35598. this.addListeners();
  35599. }
  35600. gotoSubIndex(idx) {
  35601. if (idx === this.subMenuItems.length) {
  35602. idx = 0;
  35603. } else if (idx < 0) {
  35604. idx = this.subMenuItems.length - 1;
  35605. }
  35606. this.subMenuItems[idx].focus();
  35607. this.subIndex = idx;
  35608. }
  35609. addListeners() {
  35610. const parentNode = this.parent.domNode;
  35611. Array.prototype.forEach.call(this.subMenuItems, (el) => {
  35612. el.addEventListener("keydown", (event) => {
  35613. const code = getEventCode(event);
  35614. let prevDef = false;
  35615. switch (code) {
  35616. case EVENT_CODE.down: {
  35617. this.gotoSubIndex(this.subIndex + 1);
  35618. prevDef = true;
  35619. break;
  35620. }
  35621. case EVENT_CODE.up: {
  35622. this.gotoSubIndex(this.subIndex - 1);
  35623. prevDef = true;
  35624. break;
  35625. }
  35626. case EVENT_CODE.tab: {
  35627. triggerEvent(parentNode, "mouseleave");
  35628. break;
  35629. }
  35630. case EVENT_CODE.enter:
  35631. case EVENT_CODE.numpadEnter:
  35632. case EVENT_CODE.space: {
  35633. prevDef = true;
  35634. event.currentTarget.click();
  35635. break;
  35636. }
  35637. }
  35638. if (prevDef) {
  35639. event.preventDefault();
  35640. event.stopPropagation();
  35641. }
  35642. return false;
  35643. });
  35644. });
  35645. }
  35646. }
  35647. var SubMenu$2 = SubMenu$1;
  35648. class MenuItem$1 {
  35649. constructor(domNode, namespace) {
  35650. this.domNode = domNode;
  35651. this.submenu = null;
  35652. this.submenu = null;
  35653. this.init(namespace);
  35654. }
  35655. init(namespace) {
  35656. this.domNode.setAttribute("tabindex", "0");
  35657. const menuChild = this.domNode.querySelector(`.${namespace}-menu`);
  35658. if (menuChild) {
  35659. this.submenu = new SubMenu$2(this, menuChild);
  35660. }
  35661. this.addListeners();
  35662. }
  35663. addListeners() {
  35664. this.domNode.addEventListener("keydown", (event) => {
  35665. const code = getEventCode(event);
  35666. let prevDef = false;
  35667. switch (code) {
  35668. case EVENT_CODE.down: {
  35669. triggerEvent(event.currentTarget, "mouseenter");
  35670. this.submenu && this.submenu.gotoSubIndex(0);
  35671. prevDef = true;
  35672. break;
  35673. }
  35674. case EVENT_CODE.up: {
  35675. triggerEvent(event.currentTarget, "mouseenter");
  35676. this.submenu && this.submenu.gotoSubIndex(this.submenu.subMenuItems.length - 1);
  35677. prevDef = true;
  35678. break;
  35679. }
  35680. case EVENT_CODE.tab: {
  35681. triggerEvent(event.currentTarget, "mouseleave");
  35682. break;
  35683. }
  35684. case EVENT_CODE.enter:
  35685. case EVENT_CODE.numpadEnter:
  35686. case EVENT_CODE.space: {
  35687. prevDef = true;
  35688. event.currentTarget.click();
  35689. break;
  35690. }
  35691. }
  35692. if (prevDef) {
  35693. event.preventDefault();
  35694. }
  35695. });
  35696. }
  35697. }
  35698. var MenuItem$2 = MenuItem$1;
  35699. class Menu$1 {
  35700. constructor(domNode, namespace) {
  35701. this.domNode = domNode;
  35702. this.init(namespace);
  35703. }
  35704. init(namespace) {
  35705. const menuChildren = this.domNode.childNodes;
  35706. Array.from(menuChildren).forEach((child) => {
  35707. if (child.nodeType === 1) {
  35708. new MenuItem$2(child, namespace);
  35709. }
  35710. });
  35711. }
  35712. }
  35713. var Menubar = Menu$1;
  35714. const __default__$Q = vue.defineComponent({
  35715. name: "ElMenuCollapseTransition"
  35716. });
  35717. const _sfc_main$12 = /* @__PURE__ */ vue.defineComponent({
  35718. ...__default__$Q,
  35719. setup(__props) {
  35720. const ns = useNamespace("menu");
  35721. const listeners = {
  35722. onBeforeEnter: (el) => el.style.opacity = "0.2",
  35723. onEnter(el, done) {
  35724. addClass(el, `${ns.namespace.value}-opacity-transition`);
  35725. el.style.opacity = "1";
  35726. done();
  35727. },
  35728. onAfterEnter(el) {
  35729. removeClass(el, `${ns.namespace.value}-opacity-transition`);
  35730. el.style.opacity = "";
  35731. },
  35732. onBeforeLeave(el) {
  35733. if (!el.dataset)
  35734. el.dataset = {};
  35735. if (hasClass(el, ns.m("collapse"))) {
  35736. removeClass(el, ns.m("collapse"));
  35737. el.dataset.oldOverflow = el.style.overflow;
  35738. el.dataset.scrollWidth = el.clientWidth.toString();
  35739. addClass(el, ns.m("collapse"));
  35740. } else {
  35741. addClass(el, ns.m("collapse"));
  35742. el.dataset.oldOverflow = el.style.overflow;
  35743. el.dataset.scrollWidth = el.clientWidth.toString();
  35744. removeClass(el, ns.m("collapse"));
  35745. }
  35746. el.style.width = `${el.scrollWidth}px`;
  35747. el.style.overflow = "hidden";
  35748. },
  35749. onLeave(el) {
  35750. addClass(el, "horizontal-collapse-transition");
  35751. el.style.width = `${el.dataset.scrollWidth}px`;
  35752. }
  35753. };
  35754. return (_ctx, _cache) => {
  35755. return vue.openBlock(), vue.createBlock(vue.Transition, vue.mergeProps({ mode: "out-in" }, vue.unref(listeners)), {
  35756. default: vue.withCtx(() => [
  35757. vue.renderSlot(_ctx.$slots, "default")
  35758. ]),
  35759. _: 3
  35760. }, 16);
  35761. };
  35762. }
  35763. });
  35764. var ElMenuCollapseTransition = /* @__PURE__ */ _export_sfc(_sfc_main$12, [["__file", "menu-collapse-transition.vue"]]);
  35765. function useMenu(instance, currentIndex) {
  35766. const indexPath = vue.computed(() => {
  35767. let parent = instance.parent;
  35768. const path = [currentIndex.value];
  35769. while (parent.type.name !== "ElMenu") {
  35770. if (parent.props.index) {
  35771. path.unshift(parent.props.index);
  35772. }
  35773. parent = parent.parent;
  35774. }
  35775. return path;
  35776. });
  35777. const parentMenu = vue.computed(() => {
  35778. let parent = instance.parent;
  35779. while (parent && !["ElMenu", "ElSubMenu"].includes(parent.type.name)) {
  35780. parent = parent.parent;
  35781. }
  35782. return parent;
  35783. });
  35784. return {
  35785. parentMenu,
  35786. indexPath
  35787. };
  35788. }
  35789. function useMenuColor(props) {
  35790. const menuBarColor = vue.computed(() => {
  35791. const color = props.backgroundColor;
  35792. return color ? new TinyColor(color).shade(20).toString() : "";
  35793. });
  35794. return menuBarColor;
  35795. }
  35796. const useMenuCssVar = (props, level) => {
  35797. const ns = useNamespace("menu");
  35798. return vue.computed(() => ns.cssVarBlock({
  35799. "text-color": props.textColor || "",
  35800. "hover-text-color": props.textColor || "",
  35801. "bg-color": props.backgroundColor || "",
  35802. "hover-bg-color": useMenuColor(props).value || "",
  35803. "active-color": props.activeTextColor || "",
  35804. level: `${level}`
  35805. }));
  35806. };
  35807. const MENU_INJECTION_KEY = "rootMenu";
  35808. const SUB_MENU_INJECTION_KEY = "subMenu:";
  35809. const subMenuProps = buildProps({
  35810. index: {
  35811. type: String,
  35812. required: true
  35813. },
  35814. showTimeout: Number,
  35815. hideTimeout: Number,
  35816. popperClass: String,
  35817. popperStyle: {
  35818. type: definePropType([String, Object])
  35819. },
  35820. disabled: Boolean,
  35821. teleported: {
  35822. type: Boolean,
  35823. default: void 0
  35824. },
  35825. popperOffset: Number,
  35826. expandCloseIcon: {
  35827. type: iconPropType
  35828. },
  35829. expandOpenIcon: {
  35830. type: iconPropType
  35831. },
  35832. collapseCloseIcon: {
  35833. type: iconPropType
  35834. },
  35835. collapseOpenIcon: {
  35836. type: iconPropType
  35837. }
  35838. });
  35839. const COMPONENT_NAME$d = "ElSubMenu";
  35840. var SubMenu = vue.defineComponent({
  35841. name: COMPONENT_NAME$d,
  35842. props: subMenuProps,
  35843. setup(props, { slots, expose }) {
  35844. const instance = vue.getCurrentInstance();
  35845. const { indexPath, parentMenu } = useMenu(instance, vue.computed(() => props.index));
  35846. const nsMenu = useNamespace("menu");
  35847. const nsSubMenu = useNamespace("sub-menu");
  35848. const rootMenu = vue.inject(MENU_INJECTION_KEY);
  35849. if (!rootMenu)
  35850. throwError(COMPONENT_NAME$d, "can not inject root menu");
  35851. const subMenu = vue.inject(`${SUB_MENU_INJECTION_KEY}${parentMenu.value.uid}`);
  35852. if (!subMenu)
  35853. throwError(COMPONENT_NAME$d, "can not inject sub menu");
  35854. const items = vue.ref({});
  35855. const subMenus = vue.ref({});
  35856. let timeout;
  35857. const mouseInChild = vue.ref(false);
  35858. const verticalTitleRef = vue.ref();
  35859. const vPopper = vue.ref();
  35860. const isFirstLevel = vue.computed(() => subMenu.level === 0);
  35861. const currentPlacement = vue.computed(() => mode.value === "horizontal" && isFirstLevel.value ? "bottom-start" : "right-start");
  35862. const subMenuTitleIcon = vue.computed(() => {
  35863. const isExpandedMode = mode.value === "horizontal" && isFirstLevel.value || mode.value === "vertical" && !rootMenu.props.collapse;
  35864. if (isExpandedMode) {
  35865. if (props.expandCloseIcon && props.expandOpenIcon) {
  35866. return opened.value ? props.expandOpenIcon : props.expandCloseIcon;
  35867. }
  35868. return arrow_down_default;
  35869. } else {
  35870. if (props.collapseCloseIcon && props.collapseOpenIcon) {
  35871. return opened.value ? props.collapseOpenIcon : props.collapseCloseIcon;
  35872. }
  35873. return arrow_right_default;
  35874. }
  35875. });
  35876. const appendToBody = vue.computed(() => {
  35877. const value = props.teleported;
  35878. return isUndefined(value) ? isFirstLevel.value : value;
  35879. });
  35880. const menuTransitionName = vue.computed(() => rootMenu.props.collapse ? `${nsMenu.namespace.value}-zoom-in-left` : `${nsMenu.namespace.value}-zoom-in-top`);
  35881. const fallbackPlacements = vue.computed(() => mode.value === "horizontal" && isFirstLevel.value ? [
  35882. "bottom-start",
  35883. "bottom-end",
  35884. "top-start",
  35885. "top-end",
  35886. "right-start",
  35887. "left-start"
  35888. ] : [
  35889. "right-start",
  35890. "right",
  35891. "right-end",
  35892. "left-start",
  35893. "bottom-start",
  35894. "bottom-end",
  35895. "top-start",
  35896. "top-end"
  35897. ]);
  35898. const opened = vue.computed(() => rootMenu.openedMenus.includes(props.index));
  35899. const active = vue.computed(() => [...Object.values(items.value), ...Object.values(subMenus.value)].some(({ active: active2 }) => active2));
  35900. const mode = vue.computed(() => rootMenu.props.mode);
  35901. const persistent = vue.computed(() => rootMenu.props.persistent);
  35902. const item = vue.reactive({
  35903. index: props.index,
  35904. indexPath,
  35905. active
  35906. });
  35907. const ulStyle = useMenuCssVar(rootMenu.props, subMenu.level + 1);
  35908. const subMenuPopperOffset = vue.computed(() => {
  35909. var _a;
  35910. return (_a = props.popperOffset) != null ? _a : rootMenu.props.popperOffset;
  35911. });
  35912. const subMenuPopperClass = vue.computed(() => {
  35913. var _a;
  35914. return (_a = props.popperClass) != null ? _a : rootMenu.props.popperClass;
  35915. });
  35916. const subMenuPopperStyle = vue.computed(() => {
  35917. var _a;
  35918. return (_a = props.popperStyle) != null ? _a : rootMenu.props.popperStyle;
  35919. });
  35920. const subMenuShowTimeout = vue.computed(() => {
  35921. var _a;
  35922. return (_a = props.showTimeout) != null ? _a : rootMenu.props.showTimeout;
  35923. });
  35924. const subMenuHideTimeout = vue.computed(() => {
  35925. var _a;
  35926. return (_a = props.hideTimeout) != null ? _a : rootMenu.props.hideTimeout;
  35927. });
  35928. const doDestroy = () => {
  35929. var _a, _b, _c;
  35930. return (_c = (_b = (_a = vPopper.value) == null ? void 0 : _a.popperRef) == null ? void 0 : _b.popperInstanceRef) == null ? void 0 : _c.destroy();
  35931. };
  35932. const handleCollapseToggle = (value) => {
  35933. if (!value) {
  35934. doDestroy();
  35935. }
  35936. };
  35937. const handleClick = () => {
  35938. if (rootMenu.props.menuTrigger === "hover" && rootMenu.props.mode === "horizontal" || rootMenu.props.collapse && rootMenu.props.mode === "vertical" || props.disabled)
  35939. return;
  35940. rootMenu.handleSubMenuClick({
  35941. index: props.index,
  35942. indexPath: indexPath.value,
  35943. active: active.value
  35944. });
  35945. };
  35946. const handleMouseenter = (event, showTimeout = subMenuShowTimeout.value) => {
  35947. var _a;
  35948. if (event.type === "focus")
  35949. return;
  35950. if (rootMenu.props.menuTrigger === "click" && rootMenu.props.mode === "horizontal" || !rootMenu.props.collapse && rootMenu.props.mode === "vertical" || props.disabled) {
  35951. subMenu.mouseInChild.value = true;
  35952. return;
  35953. }
  35954. subMenu.mouseInChild.value = true;
  35955. timeout == null ? void 0 : timeout();
  35956. ({ stop: timeout } = useTimeoutFn(() => {
  35957. rootMenu.openMenu(props.index, indexPath.value);
  35958. }, showTimeout));
  35959. if (appendToBody.value) {
  35960. (_a = parentMenu.value.vnode.el) == null ? void 0 : _a.dispatchEvent(new MouseEvent("mouseenter"));
  35961. }
  35962. if (event.type === "mouseenter" && event.target) {
  35963. vue.nextTick(() => {
  35964. focusElement(event.target, { preventScroll: true });
  35965. });
  35966. }
  35967. };
  35968. const handleMouseleave = (deepDispatch = false) => {
  35969. var _a;
  35970. if (rootMenu.props.menuTrigger === "click" && rootMenu.props.mode === "horizontal" || !rootMenu.props.collapse && rootMenu.props.mode === "vertical") {
  35971. subMenu.mouseInChild.value = false;
  35972. return;
  35973. }
  35974. timeout == null ? void 0 : timeout();
  35975. subMenu.mouseInChild.value = false;
  35976. ({ stop: timeout } = useTimeoutFn(() => !mouseInChild.value && rootMenu.closeMenu(props.index, indexPath.value), subMenuHideTimeout.value));
  35977. if (appendToBody.value && deepDispatch) {
  35978. (_a = subMenu.handleMouseleave) == null ? void 0 : _a.call(subMenu, true);
  35979. }
  35980. };
  35981. vue.watch(() => rootMenu.props.collapse, (value) => handleCollapseToggle(Boolean(value)));
  35982. {
  35983. const addSubMenu = (item2) => {
  35984. subMenus.value[item2.index] = item2;
  35985. };
  35986. const removeSubMenu = (item2) => {
  35987. delete subMenus.value[item2.index];
  35988. };
  35989. vue.provide(`${SUB_MENU_INJECTION_KEY}${instance.uid}`, {
  35990. addSubMenu,
  35991. removeSubMenu,
  35992. handleMouseleave,
  35993. mouseInChild,
  35994. level: subMenu.level + 1
  35995. });
  35996. }
  35997. expose({
  35998. opened
  35999. });
  36000. vue.onMounted(() => {
  36001. rootMenu.addSubMenu(item);
  36002. subMenu.addSubMenu(item);
  36003. });
  36004. vue.onBeforeUnmount(() => {
  36005. subMenu.removeSubMenu(item);
  36006. rootMenu.removeSubMenu(item);
  36007. });
  36008. return () => {
  36009. var _a;
  36010. const titleTag = [
  36011. (_a = slots.title) == null ? void 0 : _a.call(slots),
  36012. vue.h(ElIcon, {
  36013. class: nsSubMenu.e("icon-arrow"),
  36014. style: {
  36015. transform: opened.value ? props.expandCloseIcon && props.expandOpenIcon || props.collapseCloseIcon && props.collapseOpenIcon && rootMenu.props.collapse ? "none" : "rotateZ(180deg)" : "none"
  36016. }
  36017. }, {
  36018. default: () => isString$1(subMenuTitleIcon.value) ? vue.h(instance.appContext.components[subMenuTitleIcon.value]) : vue.h(subMenuTitleIcon.value)
  36019. })
  36020. ];
  36021. const child = rootMenu.isMenuPopup ? vue.h(ElTooltip, {
  36022. ref: vPopper,
  36023. visible: opened.value,
  36024. effect: "light",
  36025. pure: true,
  36026. offset: subMenuPopperOffset.value,
  36027. showArrow: false,
  36028. persistent: persistent.value,
  36029. popperClass: subMenuPopperClass.value,
  36030. popperStyle: subMenuPopperStyle.value,
  36031. placement: currentPlacement.value,
  36032. teleported: appendToBody.value,
  36033. fallbackPlacements: fallbackPlacements.value,
  36034. transition: menuTransitionName.value,
  36035. gpuAcceleration: false
  36036. }, {
  36037. content: () => {
  36038. var _a2;
  36039. return vue.h("div", {
  36040. class: [
  36041. nsMenu.m(mode.value),
  36042. nsMenu.m("popup-container"),
  36043. subMenuPopperClass.value
  36044. ],
  36045. onMouseenter: (evt) => handleMouseenter(evt, 100),
  36046. onMouseleave: () => handleMouseleave(true),
  36047. onFocus: (evt) => handleMouseenter(evt, 100)
  36048. }, [
  36049. vue.h("ul", {
  36050. class: [
  36051. nsMenu.b(),
  36052. nsMenu.m("popup"),
  36053. nsMenu.m(`popup-${currentPlacement.value}`)
  36054. ],
  36055. style: ulStyle.value
  36056. }, [(_a2 = slots.default) == null ? void 0 : _a2.call(slots)])
  36057. ]);
  36058. },
  36059. default: () => vue.h("div", {
  36060. class: nsSubMenu.e("title"),
  36061. onClick: handleClick
  36062. }, titleTag)
  36063. }) : vue.h(vue.Fragment, {}, [
  36064. vue.h("div", {
  36065. class: nsSubMenu.e("title"),
  36066. ref: verticalTitleRef,
  36067. onClick: handleClick
  36068. }, titleTag),
  36069. vue.h(ElCollapseTransition, {}, {
  36070. default: () => {
  36071. var _a2;
  36072. return vue.withDirectives(vue.h("ul", {
  36073. role: "menu",
  36074. class: [nsMenu.b(), nsMenu.m("inline")],
  36075. style: ulStyle.value
  36076. }, [(_a2 = slots.default) == null ? void 0 : _a2.call(slots)]), [[vue.vShow, opened.value]]);
  36077. }
  36078. })
  36079. ]);
  36080. return vue.h("li", {
  36081. class: [
  36082. nsSubMenu.b(),
  36083. nsSubMenu.is("active", active.value),
  36084. nsSubMenu.is("opened", opened.value),
  36085. nsSubMenu.is("disabled", props.disabled)
  36086. ],
  36087. role: "menuitem",
  36088. ariaHaspopup: true,
  36089. ariaExpanded: opened.value,
  36090. onMouseenter: handleMouseenter,
  36091. onMouseleave: () => handleMouseleave(),
  36092. onFocus: handleMouseenter
  36093. }, [child]);
  36094. };
  36095. }
  36096. });
  36097. const menuProps = buildProps({
  36098. mode: {
  36099. type: String,
  36100. values: ["horizontal", "vertical"],
  36101. default: "vertical"
  36102. },
  36103. defaultActive: {
  36104. type: String,
  36105. default: ""
  36106. },
  36107. defaultOpeneds: {
  36108. type: definePropType(Array),
  36109. default: () => mutable([])
  36110. },
  36111. uniqueOpened: Boolean,
  36112. router: Boolean,
  36113. menuTrigger: {
  36114. type: String,
  36115. values: ["hover", "click"],
  36116. default: "hover"
  36117. },
  36118. collapse: Boolean,
  36119. backgroundColor: String,
  36120. textColor: String,
  36121. activeTextColor: String,
  36122. closeOnClickOutside: Boolean,
  36123. collapseTransition: {
  36124. type: Boolean,
  36125. default: true
  36126. },
  36127. ellipsis: {
  36128. type: Boolean,
  36129. default: true
  36130. },
  36131. popperOffset: {
  36132. type: Number,
  36133. default: 6
  36134. },
  36135. ellipsisIcon: {
  36136. type: iconPropType,
  36137. default: () => more_default
  36138. },
  36139. popperEffect: {
  36140. type: definePropType(String),
  36141. default: "dark"
  36142. },
  36143. popperClass: String,
  36144. popperStyle: {
  36145. type: definePropType([String, Object])
  36146. },
  36147. showTimeout: {
  36148. type: Number,
  36149. default: 300
  36150. },
  36151. hideTimeout: {
  36152. type: Number,
  36153. default: 300
  36154. },
  36155. persistent: {
  36156. type: Boolean,
  36157. default: true
  36158. }
  36159. });
  36160. const checkIndexPath = (indexPath) => isArray$1(indexPath) && indexPath.every((path) => isString$1(path));
  36161. const menuEmits = {
  36162. close: (index, indexPath) => isString$1(index) && checkIndexPath(indexPath),
  36163. open: (index, indexPath) => isString$1(index) && checkIndexPath(indexPath),
  36164. select: (index, indexPath, item, routerResult) => isString$1(index) && checkIndexPath(indexPath) && isObject$1(item) && (isUndefined(routerResult) || routerResult instanceof Promise)
  36165. };
  36166. var Menu = vue.defineComponent({
  36167. name: "ElMenu",
  36168. props: menuProps,
  36169. emits: menuEmits,
  36170. setup(props, { emit, slots, expose }) {
  36171. const instance = vue.getCurrentInstance();
  36172. const router = instance.appContext.config.globalProperties.$router;
  36173. const menu = vue.ref();
  36174. const subMenu = vue.ref();
  36175. const nsMenu = useNamespace("menu");
  36176. const nsSubMenu = useNamespace("sub-menu");
  36177. let moreItemWidth = 64;
  36178. const sliceIndex = vue.ref(-1);
  36179. const openedMenus = vue.ref(props.defaultOpeneds && !props.collapse ? props.defaultOpeneds.slice(0) : []);
  36180. const activeIndex = vue.ref(props.defaultActive);
  36181. const items = vue.ref({});
  36182. const subMenus = vue.ref({});
  36183. const isMenuPopup = vue.computed(() => props.mode === "horizontal" || props.mode === "vertical" && props.collapse);
  36184. const initMenu = () => {
  36185. const activeItem = activeIndex.value && items.value[activeIndex.value];
  36186. if (!activeItem || props.mode === "horizontal" || props.collapse)
  36187. return;
  36188. const indexPath = activeItem.indexPath;
  36189. indexPath.forEach((index) => {
  36190. const subMenu2 = subMenus.value[index];
  36191. subMenu2 && openMenu(index, subMenu2.indexPath);
  36192. });
  36193. };
  36194. const openMenu = (index, indexPath) => {
  36195. if (openedMenus.value.includes(index))
  36196. return;
  36197. if (props.uniqueOpened) {
  36198. openedMenus.value = openedMenus.value.filter((index2) => indexPath.includes(index2));
  36199. }
  36200. openedMenus.value.push(index);
  36201. emit("open", index, indexPath);
  36202. };
  36203. const close = (index) => {
  36204. const i = openedMenus.value.indexOf(index);
  36205. if (i !== -1) {
  36206. openedMenus.value.splice(i, 1);
  36207. }
  36208. };
  36209. const closeMenu = (index, indexPath) => {
  36210. close(index);
  36211. emit("close", index, indexPath);
  36212. };
  36213. const handleSubMenuClick = ({
  36214. index,
  36215. indexPath
  36216. }) => {
  36217. const isOpened = openedMenus.value.includes(index);
  36218. isOpened ? closeMenu(index, indexPath) : openMenu(index, indexPath);
  36219. };
  36220. const handleMenuItemClick = (menuItem) => {
  36221. if (props.mode === "horizontal" || props.collapse) {
  36222. openedMenus.value = [];
  36223. }
  36224. const { index, indexPath } = menuItem;
  36225. if (isNil(index) || isNil(indexPath))
  36226. return;
  36227. if (props.router && router) {
  36228. const route = menuItem.route || index;
  36229. const routerResult = router.push(route).then((res) => {
  36230. if (!res)
  36231. activeIndex.value = index;
  36232. return res;
  36233. });
  36234. emit("select", index, indexPath, { index, indexPath, route }, routerResult);
  36235. } else {
  36236. activeIndex.value = index;
  36237. emit("select", index, indexPath, { index, indexPath });
  36238. }
  36239. };
  36240. const updateActiveIndex = (val) => {
  36241. var _a;
  36242. const itemsInData = items.value;
  36243. const item = itemsInData[val] || activeIndex.value && itemsInData[activeIndex.value] || itemsInData[props.defaultActive];
  36244. activeIndex.value = (_a = item == null ? void 0 : item.index) != null ? _a : val;
  36245. };
  36246. const calcMenuItemWidth = (menuItem) => {
  36247. const computedStyle = getComputedStyle(menuItem);
  36248. const marginLeft = Number.parseInt(computedStyle.marginLeft, 10);
  36249. const marginRight = Number.parseInt(computedStyle.marginRight, 10);
  36250. return menuItem.offsetWidth + marginLeft + marginRight || 0;
  36251. };
  36252. const calcSliceIndex = () => {
  36253. var _a, _b;
  36254. if (!menu.value)
  36255. return -1;
  36256. 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));
  36257. const computedMenuStyle = getComputedStyle(menu.value);
  36258. const paddingLeft = Number.parseInt(computedMenuStyle.paddingLeft, 10);
  36259. const paddingRight = Number.parseInt(computedMenuStyle.paddingRight, 10);
  36260. const menuWidth = menu.value.clientWidth - paddingLeft - paddingRight;
  36261. let calcWidth = 0;
  36262. let sliceIndex2 = 0;
  36263. items2.forEach((item, index) => {
  36264. calcWidth += calcMenuItemWidth(item);
  36265. if (calcWidth <= menuWidth - moreItemWidth) {
  36266. sliceIndex2 = index + 1;
  36267. }
  36268. });
  36269. return sliceIndex2 === items2.length ? -1 : sliceIndex2;
  36270. };
  36271. const getIndexPath = (index) => subMenus.value[index].indexPath;
  36272. const debounce = (fn, wait = 33.34) => {
  36273. let timer;
  36274. return () => {
  36275. timer && clearTimeout(timer);
  36276. timer = setTimeout(() => {
  36277. fn();
  36278. }, wait);
  36279. };
  36280. };
  36281. let isFirstTimeRender = true;
  36282. const handleResize = () => {
  36283. const el = unrefElement(subMenu);
  36284. if (el)
  36285. moreItemWidth = calcMenuItemWidth(el) || 64;
  36286. if (sliceIndex.value === calcSliceIndex())
  36287. return;
  36288. const callback = () => {
  36289. sliceIndex.value = -1;
  36290. vue.nextTick(() => {
  36291. sliceIndex.value = calcSliceIndex();
  36292. });
  36293. };
  36294. isFirstTimeRender ? callback() : debounce(callback)();
  36295. isFirstTimeRender = false;
  36296. };
  36297. vue.watch(() => props.defaultActive, (currentActive) => {
  36298. if (!items.value[currentActive]) {
  36299. activeIndex.value = "";
  36300. }
  36301. updateActiveIndex(currentActive);
  36302. });
  36303. vue.watch(() => props.collapse, (value) => {
  36304. if (value)
  36305. openedMenus.value = [];
  36306. });
  36307. vue.watch(items.value, initMenu);
  36308. let resizeStopper;
  36309. vue.watchEffect(() => {
  36310. if (props.mode === "horizontal" && props.ellipsis)
  36311. resizeStopper = useResizeObserver(menu, handleResize).stop;
  36312. else
  36313. resizeStopper == null ? void 0 : resizeStopper();
  36314. });
  36315. const mouseInChild = vue.ref(false);
  36316. {
  36317. const addSubMenu = (item) => {
  36318. subMenus.value[item.index] = item;
  36319. };
  36320. const removeSubMenu = (item) => {
  36321. delete subMenus.value[item.index];
  36322. };
  36323. const addMenuItem = (item) => {
  36324. items.value[item.index] = item;
  36325. };
  36326. const removeMenuItem = (item) => {
  36327. delete items.value[item.index];
  36328. };
  36329. vue.provide(MENU_INJECTION_KEY, vue.reactive({
  36330. props,
  36331. openedMenus,
  36332. items,
  36333. subMenus,
  36334. activeIndex,
  36335. isMenuPopup,
  36336. addMenuItem,
  36337. removeMenuItem,
  36338. addSubMenu,
  36339. removeSubMenu,
  36340. openMenu,
  36341. closeMenu,
  36342. handleMenuItemClick,
  36343. handleSubMenuClick
  36344. }));
  36345. vue.provide(`${SUB_MENU_INJECTION_KEY}${instance.uid}`, {
  36346. addSubMenu,
  36347. removeSubMenu,
  36348. mouseInChild,
  36349. level: 0
  36350. });
  36351. }
  36352. vue.onMounted(() => {
  36353. if (props.mode === "horizontal") {
  36354. new Menubar(instance.vnode.el, nsMenu.namespace.value);
  36355. }
  36356. });
  36357. {
  36358. const open = (index) => {
  36359. const { indexPath } = subMenus.value[index];
  36360. indexPath.forEach((i) => openMenu(i, indexPath));
  36361. };
  36362. expose({
  36363. open,
  36364. close,
  36365. updateActiveIndex,
  36366. handleResize
  36367. });
  36368. }
  36369. const ulStyle = useMenuCssVar(props, 0);
  36370. return () => {
  36371. var _a, _b;
  36372. let slot = (_b = (_a = slots.default) == null ? void 0 : _a.call(slots)) != null ? _b : [];
  36373. const vShowMore = [];
  36374. if (props.mode === "horizontal" && menu.value) {
  36375. const originalSlot = flattedChildren(slot).filter((vnode) => {
  36376. return (vnode == null ? void 0 : vnode.shapeFlag) !== 8;
  36377. });
  36378. const slotDefault = sliceIndex.value === -1 ? originalSlot : originalSlot.slice(0, sliceIndex.value);
  36379. const slotMore = sliceIndex.value === -1 ? [] : originalSlot.slice(sliceIndex.value);
  36380. if ((slotMore == null ? void 0 : slotMore.length) && props.ellipsis) {
  36381. slot = slotDefault;
  36382. vShowMore.push(vue.h(SubMenu, {
  36383. ref: subMenu,
  36384. index: "sub-menu-more",
  36385. class: nsSubMenu.e("hide-arrow"),
  36386. popperOffset: props.popperOffset
  36387. }, {
  36388. title: () => vue.h(ElIcon, {
  36389. class: nsSubMenu.e("icon-more")
  36390. }, {
  36391. default: () => vue.h(props.ellipsisIcon)
  36392. }),
  36393. default: () => slotMore
  36394. }));
  36395. }
  36396. }
  36397. const directives = props.closeOnClickOutside ? [
  36398. [
  36399. ClickOutside,
  36400. () => {
  36401. if (!openedMenus.value.length)
  36402. return;
  36403. if (!mouseInChild.value) {
  36404. openedMenus.value.forEach((openedMenu) => emit("close", openedMenu, getIndexPath(openedMenu)));
  36405. openedMenus.value = [];
  36406. }
  36407. }
  36408. ]
  36409. ] : [];
  36410. const vMenu = vue.withDirectives(vue.h("ul", {
  36411. key: String(props.collapse),
  36412. role: "menubar",
  36413. ref: menu,
  36414. style: ulStyle.value,
  36415. class: {
  36416. [nsMenu.b()]: true,
  36417. [nsMenu.m(props.mode)]: true,
  36418. [nsMenu.m("collapse")]: props.collapse
  36419. }
  36420. }, [...slot, ...vShowMore]), directives);
  36421. if (props.collapseTransition && props.mode === "vertical") {
  36422. return vue.h(ElMenuCollapseTransition, () => vMenu);
  36423. }
  36424. return vMenu;
  36425. };
  36426. }
  36427. });
  36428. const menuItemProps = buildProps({
  36429. index: {
  36430. type: definePropType([String, null]),
  36431. default: null
  36432. },
  36433. route: {
  36434. type: definePropType([String, Object])
  36435. },
  36436. disabled: Boolean
  36437. });
  36438. const menuItemEmits = {
  36439. click: (item) => isString$1(item.index) && isArray$1(item.indexPath)
  36440. };
  36441. const COMPONENT_NAME$c = "ElMenuItem";
  36442. const __default__$P = vue.defineComponent({
  36443. name: COMPONENT_NAME$c
  36444. });
  36445. const _sfc_main$11 = /* @__PURE__ */ vue.defineComponent({
  36446. ...__default__$P,
  36447. props: menuItemProps,
  36448. emits: menuItemEmits,
  36449. setup(__props, { expose, emit }) {
  36450. const props = __props;
  36451. isPropAbsent(props.index) && debugWarn(COMPONENT_NAME$c, 'Missing required prop: "index"');
  36452. const instance = vue.getCurrentInstance();
  36453. const rootMenu = vue.inject(MENU_INJECTION_KEY);
  36454. const nsMenu = useNamespace("menu");
  36455. const nsMenuItem = useNamespace("menu-item");
  36456. if (!rootMenu)
  36457. throwError(COMPONENT_NAME$c, "can not inject root menu");
  36458. const { parentMenu, indexPath } = useMenu(instance, vue.toRef(props, "index"));
  36459. const subMenu = vue.inject(`${SUB_MENU_INJECTION_KEY}${parentMenu.value.uid}`);
  36460. if (!subMenu)
  36461. throwError(COMPONENT_NAME$c, "can not inject sub menu");
  36462. const active = vue.computed(() => props.index === rootMenu.activeIndex);
  36463. const item = vue.reactive({
  36464. index: props.index,
  36465. indexPath,
  36466. active
  36467. });
  36468. const handleClick = () => {
  36469. if (!props.disabled) {
  36470. rootMenu.handleMenuItemClick({
  36471. index: props.index,
  36472. indexPath: indexPath.value,
  36473. route: props.route
  36474. });
  36475. emit("click", item);
  36476. }
  36477. };
  36478. vue.onMounted(() => {
  36479. subMenu.addSubMenu(item);
  36480. rootMenu.addMenuItem(item);
  36481. });
  36482. vue.onBeforeUnmount(() => {
  36483. subMenu.removeSubMenu(item);
  36484. rootMenu.removeMenuItem(item);
  36485. });
  36486. expose({
  36487. parentMenu,
  36488. rootMenu,
  36489. active,
  36490. nsMenu,
  36491. nsMenuItem,
  36492. handleClick
  36493. });
  36494. return (_ctx, _cache) => {
  36495. return vue.openBlock(), vue.createElementBlock("li", {
  36496. class: vue.normalizeClass([
  36497. vue.unref(nsMenuItem).b(),
  36498. vue.unref(nsMenuItem).is("active", vue.unref(active)),
  36499. vue.unref(nsMenuItem).is("disabled", _ctx.disabled)
  36500. ]),
  36501. role: "menuitem",
  36502. tabindex: "-1",
  36503. onClick: handleClick
  36504. }, [
  36505. vue.unref(parentMenu).type.name === "ElMenu" && vue.unref(rootMenu).props.collapse && _ctx.$slots.title ? (vue.openBlock(), vue.createBlock(vue.unref(ElTooltip), {
  36506. key: 0,
  36507. effect: vue.unref(rootMenu).props.popperEffect,
  36508. placement: "right",
  36509. "fallback-placements": ["left"],
  36510. persistent: vue.unref(rootMenu).props.persistent,
  36511. "focus-on-target": ""
  36512. }, {
  36513. content: vue.withCtx(() => [
  36514. vue.renderSlot(_ctx.$slots, "title")
  36515. ]),
  36516. default: vue.withCtx(() => [
  36517. vue.createElementVNode("div", {
  36518. class: vue.normalizeClass(vue.unref(nsMenu).be("tooltip", "trigger"))
  36519. }, [
  36520. vue.renderSlot(_ctx.$slots, "default")
  36521. ], 2)
  36522. ]),
  36523. _: 3
  36524. }, 8, ["effect", "persistent"])) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  36525. vue.renderSlot(_ctx.$slots, "default"),
  36526. vue.renderSlot(_ctx.$slots, "title")
  36527. ], 64))
  36528. ], 2);
  36529. };
  36530. }
  36531. });
  36532. var MenuItem = /* @__PURE__ */ _export_sfc(_sfc_main$11, [["__file", "menu-item.vue"]]);
  36533. const menuItemGroupProps = {
  36534. title: String
  36535. };
  36536. const __default__$O = vue.defineComponent({
  36537. name: "ElMenuItemGroup"
  36538. });
  36539. const _sfc_main$10 = /* @__PURE__ */ vue.defineComponent({
  36540. ...__default__$O,
  36541. props: menuItemGroupProps,
  36542. setup(__props) {
  36543. const ns = useNamespace("menu-item-group");
  36544. return (_ctx, _cache) => {
  36545. return vue.openBlock(), vue.createElementBlock("li", {
  36546. class: vue.normalizeClass(vue.unref(ns).b())
  36547. }, [
  36548. vue.createElementVNode("div", {
  36549. class: vue.normalizeClass(vue.unref(ns).e("title"))
  36550. }, [
  36551. !_ctx.$slots.title ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  36552. vue.createTextVNode(vue.toDisplayString(_ctx.title), 1)
  36553. ], 64)) : vue.renderSlot(_ctx.$slots, "title", { key: 1 })
  36554. ], 2),
  36555. vue.createElementVNode("ul", null, [
  36556. vue.renderSlot(_ctx.$slots, "default")
  36557. ])
  36558. ], 2);
  36559. };
  36560. }
  36561. });
  36562. var MenuItemGroup = /* @__PURE__ */ _export_sfc(_sfc_main$10, [["__file", "menu-item-group.vue"]]);
  36563. const ElMenu = withInstall(Menu, {
  36564. MenuItem,
  36565. MenuItemGroup,
  36566. SubMenu
  36567. });
  36568. const ElMenuItem = withNoopInstall(MenuItem);
  36569. const ElMenuItemGroup = withNoopInstall(MenuItemGroup);
  36570. const ElSubMenu = withNoopInstall(SubMenu);
  36571. const pageHeaderProps = buildProps({
  36572. icon: {
  36573. type: iconPropType,
  36574. default: () => back_default
  36575. },
  36576. title: String,
  36577. content: {
  36578. type: String,
  36579. default: ""
  36580. }
  36581. });
  36582. const pageHeaderEmits = {
  36583. back: () => true
  36584. };
  36585. const __default__$N = vue.defineComponent({
  36586. name: "ElPageHeader"
  36587. });
  36588. const _sfc_main$$ = /* @__PURE__ */ vue.defineComponent({
  36589. ...__default__$N,
  36590. props: pageHeaderProps,
  36591. emits: pageHeaderEmits,
  36592. setup(__props, { emit }) {
  36593. const { t } = useLocale();
  36594. const ns = useNamespace("page-header");
  36595. function handleClick() {
  36596. emit("back");
  36597. }
  36598. return (_ctx, _cache) => {
  36599. return vue.openBlock(), vue.createElementBlock("div", {
  36600. class: vue.normalizeClass([
  36601. vue.unref(ns).b(),
  36602. vue.unref(ns).is("contentful", !!_ctx.$slots.default),
  36603. {
  36604. [vue.unref(ns).m("has-breadcrumb")]: !!_ctx.$slots.breadcrumb,
  36605. [vue.unref(ns).m("has-extra")]: !!_ctx.$slots.extra
  36606. }
  36607. ])
  36608. }, [
  36609. _ctx.$slots.breadcrumb ? (vue.openBlock(), vue.createElementBlock("div", {
  36610. key: 0,
  36611. class: vue.normalizeClass(vue.unref(ns).e("breadcrumb"))
  36612. }, [
  36613. vue.renderSlot(_ctx.$slots, "breadcrumb")
  36614. ], 2)) : vue.createCommentVNode("v-if", true),
  36615. vue.createElementVNode("div", {
  36616. class: vue.normalizeClass(vue.unref(ns).e("header"))
  36617. }, [
  36618. vue.createElementVNode("div", {
  36619. class: vue.normalizeClass(vue.unref(ns).e("left"))
  36620. }, [
  36621. vue.createElementVNode("div", {
  36622. class: vue.normalizeClass(vue.unref(ns).e("back")),
  36623. role: "button",
  36624. tabindex: "0",
  36625. onClick: handleClick
  36626. }, [
  36627. _ctx.icon || _ctx.$slots.icon ? (vue.openBlock(), vue.createElementBlock("div", {
  36628. key: 0,
  36629. "aria-label": _ctx.title || vue.unref(t)("el.pageHeader.title"),
  36630. class: vue.normalizeClass(vue.unref(ns).e("icon"))
  36631. }, [
  36632. vue.renderSlot(_ctx.$slots, "icon", {}, () => [
  36633. _ctx.icon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 0 }, {
  36634. default: vue.withCtx(() => [
  36635. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.icon)))
  36636. ]),
  36637. _: 1
  36638. })) : vue.createCommentVNode("v-if", true)
  36639. ])
  36640. ], 10, ["aria-label"])) : vue.createCommentVNode("v-if", true),
  36641. vue.createElementVNode("div", {
  36642. class: vue.normalizeClass(vue.unref(ns).e("title"))
  36643. }, [
  36644. vue.renderSlot(_ctx.$slots, "title", {}, () => [
  36645. vue.createTextVNode(vue.toDisplayString(_ctx.title || vue.unref(t)("el.pageHeader.title")), 1)
  36646. ])
  36647. ], 2)
  36648. ], 2),
  36649. vue.createVNode(vue.unref(ElDivider), { direction: "vertical" }),
  36650. vue.createElementVNode("div", {
  36651. class: vue.normalizeClass(vue.unref(ns).e("content"))
  36652. }, [
  36653. vue.renderSlot(_ctx.$slots, "content", {}, () => [
  36654. vue.createTextVNode(vue.toDisplayString(_ctx.content), 1)
  36655. ])
  36656. ], 2)
  36657. ], 2),
  36658. _ctx.$slots.extra ? (vue.openBlock(), vue.createElementBlock("div", {
  36659. key: 0,
  36660. class: vue.normalizeClass(vue.unref(ns).e("extra"))
  36661. }, [
  36662. vue.renderSlot(_ctx.$slots, "extra")
  36663. ], 2)) : vue.createCommentVNode("v-if", true)
  36664. ], 2),
  36665. _ctx.$slots.default ? (vue.openBlock(), vue.createElementBlock("div", {
  36666. key: 1,
  36667. class: vue.normalizeClass(vue.unref(ns).e("main"))
  36668. }, [
  36669. vue.renderSlot(_ctx.$slots, "default")
  36670. ], 2)) : vue.createCommentVNode("v-if", true)
  36671. ], 2);
  36672. };
  36673. }
  36674. });
  36675. var PageHeader = /* @__PURE__ */ _export_sfc(_sfc_main$$, [["__file", "page-header.vue"]]);
  36676. const ElPageHeader = withInstall(PageHeader);
  36677. const elPaginationKey = Symbol("elPaginationKey");
  36678. const paginationPrevProps = buildProps({
  36679. disabled: Boolean,
  36680. currentPage: {
  36681. type: Number,
  36682. default: 1
  36683. },
  36684. prevText: {
  36685. type: String
  36686. },
  36687. prevIcon: {
  36688. type: iconPropType
  36689. }
  36690. });
  36691. const paginationPrevEmits = {
  36692. click: (evt) => evt instanceof MouseEvent
  36693. };
  36694. const __default__$M = vue.defineComponent({
  36695. name: "ElPaginationPrev"
  36696. });
  36697. const _sfc_main$_ = /* @__PURE__ */ vue.defineComponent({
  36698. ...__default__$M,
  36699. props: paginationPrevProps,
  36700. emits: paginationPrevEmits,
  36701. setup(__props) {
  36702. const props = __props;
  36703. const { t } = useLocale();
  36704. const internalDisabled = vue.computed(() => props.disabled || props.currentPage <= 1);
  36705. return (_ctx, _cache) => {
  36706. return vue.openBlock(), vue.createElementBlock("button", {
  36707. type: "button",
  36708. class: "btn-prev",
  36709. disabled: vue.unref(internalDisabled),
  36710. "aria-label": _ctx.prevText || vue.unref(t)("el.pagination.prev"),
  36711. "aria-disabled": vue.unref(internalDisabled),
  36712. onClick: ($event) => _ctx.$emit("click", $event)
  36713. }, [
  36714. _ctx.prevText ? (vue.openBlock(), vue.createElementBlock("span", { key: 0 }, vue.toDisplayString(_ctx.prevText), 1)) : (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 1 }, {
  36715. default: vue.withCtx(() => [
  36716. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.prevIcon)))
  36717. ]),
  36718. _: 1
  36719. }))
  36720. ], 8, ["disabled", "aria-label", "aria-disabled", "onClick"]);
  36721. };
  36722. }
  36723. });
  36724. var Prev = /* @__PURE__ */ _export_sfc(_sfc_main$_, [["__file", "prev.vue"]]);
  36725. const paginationNextProps = buildProps({
  36726. disabled: Boolean,
  36727. currentPage: {
  36728. type: Number,
  36729. default: 1
  36730. },
  36731. pageCount: {
  36732. type: Number,
  36733. default: 50
  36734. },
  36735. nextText: {
  36736. type: String
  36737. },
  36738. nextIcon: {
  36739. type: iconPropType
  36740. }
  36741. });
  36742. const __default__$L = vue.defineComponent({
  36743. name: "ElPaginationNext"
  36744. });
  36745. const _sfc_main$Z = /* @__PURE__ */ vue.defineComponent({
  36746. ...__default__$L,
  36747. props: paginationNextProps,
  36748. emits: ["click"],
  36749. setup(__props) {
  36750. const props = __props;
  36751. const { t } = useLocale();
  36752. const internalDisabled = vue.computed(() => props.disabled || props.currentPage === props.pageCount || props.pageCount === 0);
  36753. return (_ctx, _cache) => {
  36754. return vue.openBlock(), vue.createElementBlock("button", {
  36755. type: "button",
  36756. class: "btn-next",
  36757. disabled: vue.unref(internalDisabled),
  36758. "aria-label": _ctx.nextText || vue.unref(t)("el.pagination.next"),
  36759. "aria-disabled": vue.unref(internalDisabled),
  36760. onClick: ($event) => _ctx.$emit("click", $event)
  36761. }, [
  36762. _ctx.nextText ? (vue.openBlock(), vue.createElementBlock("span", { key: 0 }, vue.toDisplayString(_ctx.nextText), 1)) : (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 1 }, {
  36763. default: vue.withCtx(() => [
  36764. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.nextIcon)))
  36765. ]),
  36766. _: 1
  36767. }))
  36768. ], 8, ["disabled", "aria-label", "aria-disabled", "onClick"]);
  36769. };
  36770. }
  36771. });
  36772. var Next = /* @__PURE__ */ _export_sfc(_sfc_main$Z, [["__file", "next.vue"]]);
  36773. const defaultProps$5 = {
  36774. label: "label",
  36775. value: "value",
  36776. disabled: "disabled",
  36777. options: "options"
  36778. };
  36779. function useProps(props) {
  36780. const aliasProps = vue.computed(() => ({ ...defaultProps$5, ...props.props }));
  36781. const getLabel = (option) => get(option, aliasProps.value.label);
  36782. const getValue = (option) => get(option, aliasProps.value.value);
  36783. const getDisabled = (option) => get(option, aliasProps.value.disabled);
  36784. const getOptions = (option) => get(option, aliasProps.value.options);
  36785. return {
  36786. aliasProps,
  36787. getLabel,
  36788. getValue,
  36789. getDisabled,
  36790. getOptions
  36791. };
  36792. }
  36793. const selectGroupKey = Symbol("ElSelectGroup");
  36794. const selectKey = Symbol("ElSelect");
  36795. const COMPONENT_NAME$b = "ElOption";
  36796. const optionProps = buildProps({
  36797. value: {
  36798. type: [String, Number, Boolean, Object],
  36799. required: true
  36800. },
  36801. label: {
  36802. type: [String, Number]
  36803. },
  36804. created: Boolean,
  36805. disabled: Boolean
  36806. });
  36807. function useOption$1(props, states) {
  36808. const select = vue.inject(selectKey);
  36809. if (!select) {
  36810. throwError(COMPONENT_NAME$b, "usage: <el-select><el-option /></el-select/>");
  36811. }
  36812. const selectGroup = vue.inject(selectGroupKey, { disabled: false });
  36813. const itemSelected = vue.computed(() => {
  36814. return contains(castArray$1(select.props.modelValue), props.value);
  36815. });
  36816. const limitReached = vue.computed(() => {
  36817. var _a;
  36818. if (select.props.multiple) {
  36819. const modelValue = castArray$1((_a = select.props.modelValue) != null ? _a : []);
  36820. return !itemSelected.value && modelValue.length >= select.props.multipleLimit && select.props.multipleLimit > 0;
  36821. } else {
  36822. return false;
  36823. }
  36824. });
  36825. const currentLabel = vue.computed(() => {
  36826. var _a;
  36827. return (_a = props.label) != null ? _a : isObject$1(props.value) ? "" : props.value;
  36828. });
  36829. const currentValue = vue.computed(() => {
  36830. return props.value || props.label || "";
  36831. });
  36832. const isDisabled = vue.computed(() => {
  36833. return props.disabled || states.groupDisabled || limitReached.value;
  36834. });
  36835. const instance = vue.getCurrentInstance();
  36836. const contains = (arr = [], target) => {
  36837. if (!isObject$1(props.value)) {
  36838. return arr && arr.includes(target);
  36839. } else {
  36840. const valueKey = select.props.valueKey;
  36841. return arr && arr.some((item) => {
  36842. return vue.toRaw(get(item, valueKey)) === get(target, valueKey);
  36843. });
  36844. }
  36845. };
  36846. const hoverItem = () => {
  36847. if (!props.disabled && !selectGroup.disabled) {
  36848. select.states.hoveringIndex = select.optionsArray.indexOf(instance.proxy);
  36849. }
  36850. };
  36851. const updateOption = (query) => {
  36852. const regexp = new RegExp(escapeStringRegexp(query), "i");
  36853. states.visible = regexp.test(String(currentLabel.value)) || props.created;
  36854. };
  36855. vue.watch(() => currentLabel.value, () => {
  36856. if (!props.created && !select.props.remote)
  36857. select.setSelected();
  36858. });
  36859. vue.watch(() => props.value, (val, oldVal) => {
  36860. const { remote, valueKey } = select.props;
  36861. const shouldUpdate = remote ? val !== oldVal : !isEqual$1(val, oldVal);
  36862. if (shouldUpdate) {
  36863. select.onOptionDestroy(oldVal, instance.proxy);
  36864. select.onOptionCreate(instance.proxy);
  36865. }
  36866. if (!props.created && !remote) {
  36867. if (valueKey && isObject$1(val) && isObject$1(oldVal) && val[valueKey] === oldVal[valueKey]) {
  36868. return;
  36869. }
  36870. select.setSelected();
  36871. }
  36872. });
  36873. vue.watch(() => selectGroup.disabled, () => {
  36874. states.groupDisabled = selectGroup.disabled;
  36875. }, { immediate: true });
  36876. return {
  36877. select,
  36878. currentLabel,
  36879. currentValue,
  36880. itemSelected,
  36881. isDisabled,
  36882. hoverItem,
  36883. updateOption
  36884. };
  36885. }
  36886. const _sfc_main$Y = vue.defineComponent({
  36887. name: COMPONENT_NAME$b,
  36888. componentName: COMPONENT_NAME$b,
  36889. props: optionProps,
  36890. setup(props) {
  36891. const ns = useNamespace("select");
  36892. const id = useId();
  36893. const containerKls = vue.computed(() => [
  36894. ns.be("dropdown", "item"),
  36895. ns.is("disabled", vue.unref(isDisabled)),
  36896. ns.is("selected", vue.unref(itemSelected)),
  36897. ns.is("hovering", vue.unref(hover))
  36898. ]);
  36899. const states = vue.reactive({
  36900. index: -1,
  36901. groupDisabled: false,
  36902. visible: true,
  36903. hover: false
  36904. });
  36905. const {
  36906. currentLabel,
  36907. itemSelected,
  36908. isDisabled,
  36909. select,
  36910. hoverItem,
  36911. updateOption
  36912. } = useOption$1(props, states);
  36913. const { visible, hover } = vue.toRefs(states);
  36914. const vm = vue.getCurrentInstance().proxy;
  36915. select.onOptionCreate(vm);
  36916. vue.onBeforeUnmount(() => {
  36917. const key = vm.value;
  36918. vue.nextTick(() => {
  36919. const { selected: selectedOptions } = select.states;
  36920. const doesSelected = selectedOptions.some((item) => {
  36921. return item.value === vm.value;
  36922. });
  36923. if (select.states.cachedOptions.get(key) === vm && !doesSelected) {
  36924. select.states.cachedOptions.delete(key);
  36925. }
  36926. });
  36927. select.onOptionDestroy(key, vm);
  36928. });
  36929. function selectOptionClick() {
  36930. if (!isDisabled.value) {
  36931. select.handleOptionSelect(vm);
  36932. }
  36933. }
  36934. return {
  36935. ns,
  36936. id,
  36937. containerKls,
  36938. currentLabel,
  36939. itemSelected,
  36940. isDisabled,
  36941. select,
  36942. visible,
  36943. hover,
  36944. states,
  36945. hoverItem,
  36946. updateOption,
  36947. selectOptionClick
  36948. };
  36949. }
  36950. });
  36951. function _sfc_render$b(_ctx, _cache) {
  36952. return vue.withDirectives((vue.openBlock(), vue.createElementBlock("li", {
  36953. id: _ctx.id,
  36954. class: vue.normalizeClass(_ctx.containerKls),
  36955. role: "option",
  36956. "aria-disabled": _ctx.isDisabled || void 0,
  36957. "aria-selected": _ctx.itemSelected,
  36958. onMousemove: _ctx.hoverItem,
  36959. onClick: vue.withModifiers(_ctx.selectOptionClick, ["stop"])
  36960. }, [
  36961. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  36962. vue.createElementVNode("span", null, vue.toDisplayString(_ctx.currentLabel), 1)
  36963. ])
  36964. ], 42, ["id", "aria-disabled", "aria-selected", "onMousemove", "onClick"])), [
  36965. [vue.vShow, _ctx.visible]
  36966. ]);
  36967. }
  36968. var Option = /* @__PURE__ */ _export_sfc(_sfc_main$Y, [["render", _sfc_render$b], ["__file", "option.vue"]]);
  36969. const _sfc_main$X = vue.defineComponent({
  36970. name: "ElSelectDropdown",
  36971. componentName: "ElSelectDropdown",
  36972. setup() {
  36973. const select = vue.inject(selectKey);
  36974. const ns = useNamespace("select");
  36975. const popperClass = vue.computed(() => select.props.popperClass);
  36976. const isMultiple = vue.computed(() => select.props.multiple);
  36977. const isFitInputWidth = vue.computed(() => select.props.fitInputWidth);
  36978. const minWidth = vue.ref("");
  36979. function updateMinWidth() {
  36980. var _a;
  36981. const offsetWidth = (_a = select.selectRef) == null ? void 0 : _a.offsetWidth;
  36982. if (offsetWidth) {
  36983. minWidth.value = `${offsetWidth - BORDER_HORIZONTAL_WIDTH}px`;
  36984. } else {
  36985. minWidth.value = "";
  36986. }
  36987. }
  36988. vue.onMounted(() => {
  36989. updateMinWidth();
  36990. useResizeObserver(select.selectRef, updateMinWidth);
  36991. });
  36992. return {
  36993. ns,
  36994. minWidth,
  36995. popperClass,
  36996. isMultiple,
  36997. isFitInputWidth
  36998. };
  36999. }
  37000. });
  37001. function _sfc_render$a(_ctx, _cache, $props, $setup, $data, $options) {
  37002. return vue.openBlock(), vue.createElementBlock("div", {
  37003. class: vue.normalizeClass([_ctx.ns.b("dropdown"), _ctx.ns.is("multiple", _ctx.isMultiple), _ctx.popperClass]),
  37004. style: vue.normalizeStyle({ [_ctx.isFitInputWidth ? "width" : "minWidth"]: _ctx.minWidth })
  37005. }, [
  37006. _ctx.$slots.header ? (vue.openBlock(), vue.createElementBlock("div", {
  37007. key: 0,
  37008. class: vue.normalizeClass(_ctx.ns.be("dropdown", "header"))
  37009. }, [
  37010. vue.renderSlot(_ctx.$slots, "header")
  37011. ], 2)) : vue.createCommentVNode("v-if", true),
  37012. vue.renderSlot(_ctx.$slots, "default"),
  37013. _ctx.$slots.footer ? (vue.openBlock(), vue.createElementBlock("div", {
  37014. key: 1,
  37015. class: vue.normalizeClass(_ctx.ns.be("dropdown", "footer"))
  37016. }, [
  37017. vue.renderSlot(_ctx.$slots, "footer")
  37018. ], 2)) : vue.createCommentVNode("v-if", true)
  37019. ], 6);
  37020. }
  37021. var ElSelectMenu$1 = /* @__PURE__ */ _export_sfc(_sfc_main$X, [["render", _sfc_render$a], ["__file", "select-dropdown.vue"]]);
  37022. const useSelect$3 = (props, emit) => {
  37023. const { t } = useLocale();
  37024. const contentId = useId();
  37025. const nsSelect = useNamespace("select");
  37026. const nsInput = useNamespace("input");
  37027. const states = vue.reactive({
  37028. inputValue: "",
  37029. options: /* @__PURE__ */ new Map(),
  37030. cachedOptions: /* @__PURE__ */ new Map(),
  37031. optionValues: [],
  37032. selected: [],
  37033. selectionWidth: 0,
  37034. collapseItemWidth: 0,
  37035. selectedLabel: "",
  37036. hoveringIndex: -1,
  37037. previousQuery: null,
  37038. inputHovering: false,
  37039. menuVisibleOnFocus: false,
  37040. isBeforeHide: false
  37041. });
  37042. const selectRef = vue.ref();
  37043. const selectionRef = vue.ref();
  37044. const tooltipRef = vue.ref();
  37045. const tagTooltipRef = vue.ref();
  37046. const inputRef = vue.ref();
  37047. const prefixRef = vue.ref();
  37048. const suffixRef = vue.ref();
  37049. const menuRef = vue.ref();
  37050. const tagMenuRef = vue.ref();
  37051. const collapseItemRef = vue.ref();
  37052. const scrollbarRef = vue.ref();
  37053. const expanded = vue.ref(false);
  37054. const hoverOption = vue.ref();
  37055. const debouncing = vue.ref(false);
  37056. const { form, formItem } = useFormItem();
  37057. const { inputId } = useFormItemInputId(props, {
  37058. formItemContext: formItem
  37059. });
  37060. const { valueOnClear, isEmptyValue } = useEmptyValues(props);
  37061. const {
  37062. isComposing,
  37063. handleCompositionStart,
  37064. handleCompositionUpdate,
  37065. handleCompositionEnd
  37066. } = useComposition({
  37067. afterComposition: (e) => onInput(e)
  37068. });
  37069. const selectDisabled = vue.computed(() => props.disabled || !!(form == null ? void 0 : form.disabled));
  37070. const { wrapperRef, isFocused, handleBlur } = useFocusController(inputRef, {
  37071. disabled: selectDisabled,
  37072. afterFocus() {
  37073. if (props.automaticDropdown && !expanded.value) {
  37074. expanded.value = true;
  37075. states.menuVisibleOnFocus = true;
  37076. }
  37077. },
  37078. beforeBlur(event) {
  37079. var _a, _b;
  37080. return ((_a = tooltipRef.value) == null ? void 0 : _a.isFocusInsideContent(event)) || ((_b = tagTooltipRef.value) == null ? void 0 : _b.isFocusInsideContent(event));
  37081. },
  37082. afterBlur() {
  37083. var _a;
  37084. expanded.value = false;
  37085. states.menuVisibleOnFocus = false;
  37086. if (props.validateEvent) {
  37087. (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "blur").catch((err) => debugWarn(err));
  37088. }
  37089. }
  37090. });
  37091. const hasModelValue = vue.computed(() => {
  37092. return isArray$1(props.modelValue) ? props.modelValue.length > 0 : !isEmptyValue(props.modelValue);
  37093. });
  37094. const needStatusIcon = vue.computed(() => {
  37095. var _a;
  37096. return (_a = form == null ? void 0 : form.statusIcon) != null ? _a : false;
  37097. });
  37098. const showClearBtn = vue.computed(() => {
  37099. return props.clearable && !selectDisabled.value && hasModelValue.value && (isFocused.value || states.inputHovering);
  37100. });
  37101. const iconComponent = vue.computed(() => props.remote && props.filterable && !props.remoteShowSuffix ? "" : props.suffixIcon);
  37102. const iconReverse = vue.computed(() => nsSelect.is("reverse", !!(iconComponent.value && expanded.value)));
  37103. const validateState = vue.computed(() => (formItem == null ? void 0 : formItem.validateState) || "");
  37104. const validateIcon = vue.computed(() => validateState.value && ValidateComponentsMap[validateState.value]);
  37105. const debounce = vue.computed(() => props.remote ? props.debounce : 0);
  37106. const isRemoteSearchEmpty = vue.computed(() => props.remote && !states.inputValue && states.options.size === 0);
  37107. const emptyText = vue.computed(() => {
  37108. if (props.loading) {
  37109. return props.loadingText || t("el.select.loading");
  37110. } else {
  37111. if (props.filterable && states.inputValue && states.options.size > 0 && filteredOptionsCount.value === 0) {
  37112. return props.noMatchText || t("el.select.noMatch");
  37113. }
  37114. if (states.options.size === 0) {
  37115. return props.noDataText || t("el.select.noData");
  37116. }
  37117. }
  37118. return null;
  37119. });
  37120. const filteredOptionsCount = vue.computed(() => optionsArray.value.filter((option) => option.visible).length);
  37121. const optionsArray = vue.computed(() => {
  37122. const list = Array.from(states.options.values());
  37123. const newList = [];
  37124. states.optionValues.forEach((item) => {
  37125. const index = list.findIndex((i) => i.value === item);
  37126. if (index > -1) {
  37127. newList.push(list[index]);
  37128. }
  37129. });
  37130. return newList.length >= list.length ? newList : list;
  37131. });
  37132. const cachedOptionsArray = vue.computed(() => Array.from(states.cachedOptions.values()));
  37133. const showNewOption = vue.computed(() => {
  37134. const hasExistingOption = optionsArray.value.filter((option) => {
  37135. return !option.created;
  37136. }).some((option) => {
  37137. return option.currentLabel === states.inputValue;
  37138. });
  37139. return props.filterable && props.allowCreate && states.inputValue !== "" && !hasExistingOption;
  37140. });
  37141. const updateOptions = () => {
  37142. if (props.filterable && isFunction$1(props.filterMethod))
  37143. return;
  37144. if (props.filterable && props.remote && isFunction$1(props.remoteMethod))
  37145. return;
  37146. optionsArray.value.forEach((option) => {
  37147. var _a;
  37148. (_a = option.updateOption) == null ? void 0 : _a.call(option, states.inputValue);
  37149. });
  37150. };
  37151. const selectSize = useFormSize();
  37152. const collapseTagSize = vue.computed(() => ["small"].includes(selectSize.value) ? "small" : "default");
  37153. const dropdownMenuVisible = vue.computed({
  37154. get() {
  37155. return expanded.value && (props.loading || !isRemoteSearchEmpty.value) && (!debouncing.value || !isEmpty(states.previousQuery));
  37156. },
  37157. set(val) {
  37158. expanded.value = val;
  37159. }
  37160. });
  37161. const shouldShowPlaceholder = vue.computed(() => {
  37162. if (props.multiple && !isUndefined(props.modelValue)) {
  37163. return castArray$1(props.modelValue).length === 0 && !states.inputValue;
  37164. }
  37165. const value = isArray$1(props.modelValue) ? props.modelValue[0] : props.modelValue;
  37166. return props.filterable || isUndefined(value) ? !states.inputValue : true;
  37167. });
  37168. const currentPlaceholder = vue.computed(() => {
  37169. var _a;
  37170. const _placeholder = (_a = props.placeholder) != null ? _a : t("el.select.placeholder");
  37171. return props.multiple || !hasModelValue.value ? _placeholder : states.selectedLabel;
  37172. });
  37173. const mouseEnterEventName = vue.computed(() => isIOS ? null : "mouseenter");
  37174. vue.watch(() => props.modelValue, (val, oldVal) => {
  37175. if (props.multiple) {
  37176. if (props.filterable && !props.reserveKeyword) {
  37177. states.inputValue = "";
  37178. handleQueryChange("");
  37179. }
  37180. }
  37181. setSelected();
  37182. if (!isEqual$1(val, oldVal) && props.validateEvent) {
  37183. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn(err));
  37184. }
  37185. }, {
  37186. flush: "post",
  37187. deep: true
  37188. });
  37189. vue.watch(() => expanded.value, (val) => {
  37190. if (val) {
  37191. handleQueryChange(states.inputValue);
  37192. } else {
  37193. states.inputValue = "";
  37194. states.previousQuery = null;
  37195. states.isBeforeHide = true;
  37196. }
  37197. emit("visible-change", val);
  37198. });
  37199. vue.watch(() => states.options.entries(), () => {
  37200. if (!isClient)
  37201. return;
  37202. setSelected();
  37203. if (props.defaultFirstOption && (props.filterable || props.remote) && filteredOptionsCount.value) {
  37204. checkDefaultFirstOption();
  37205. }
  37206. }, {
  37207. flush: "post"
  37208. });
  37209. vue.watch([() => states.hoveringIndex, optionsArray], ([val]) => {
  37210. if (isNumber(val) && val > -1) {
  37211. hoverOption.value = optionsArray.value[val] || {};
  37212. } else {
  37213. hoverOption.value = {};
  37214. }
  37215. optionsArray.value.forEach((option) => {
  37216. option.hover = hoverOption.value === option;
  37217. });
  37218. });
  37219. vue.watchEffect(() => {
  37220. if (states.isBeforeHide)
  37221. return;
  37222. updateOptions();
  37223. });
  37224. const handleQueryChange = (val) => {
  37225. if (states.previousQuery === val || isComposing.value) {
  37226. return;
  37227. }
  37228. states.previousQuery = val;
  37229. if (props.filterable && isFunction$1(props.filterMethod)) {
  37230. props.filterMethod(val);
  37231. } else if (props.filterable && props.remote && isFunction$1(props.remoteMethod)) {
  37232. props.remoteMethod(val);
  37233. }
  37234. if (props.defaultFirstOption && (props.filterable || props.remote) && filteredOptionsCount.value) {
  37235. vue.nextTick(checkDefaultFirstOption);
  37236. } else {
  37237. vue.nextTick(updateHoveringIndex);
  37238. }
  37239. };
  37240. const checkDefaultFirstOption = () => {
  37241. const optionsInDropdown = optionsArray.value.filter((n) => n.visible && !n.disabled && !n.states.groupDisabled);
  37242. const userCreatedOption = optionsInDropdown.find((n) => n.created);
  37243. const firstOriginOption = optionsInDropdown[0];
  37244. const valueList = optionsArray.value.map((item) => item.value);
  37245. states.hoveringIndex = getValueIndex(valueList, userCreatedOption || firstOriginOption);
  37246. };
  37247. const setSelected = () => {
  37248. if (!props.multiple) {
  37249. const value = isArray$1(props.modelValue) ? props.modelValue[0] : props.modelValue;
  37250. const option = getOption(value);
  37251. states.selectedLabel = option.currentLabel;
  37252. states.selected = [option];
  37253. return;
  37254. } else {
  37255. states.selectedLabel = "";
  37256. }
  37257. const result = [];
  37258. if (!isUndefined(props.modelValue)) {
  37259. castArray$1(props.modelValue).forEach((value) => {
  37260. result.push(getOption(value));
  37261. });
  37262. }
  37263. states.selected = result;
  37264. };
  37265. const getOption = (value) => {
  37266. let option;
  37267. const isObjectValue = isPlainObject$1(value);
  37268. for (let i = states.cachedOptions.size - 1; i >= 0; i--) {
  37269. const cachedOption = cachedOptionsArray.value[i];
  37270. const isEqualValue = isObjectValue ? get(cachedOption.value, props.valueKey) === get(value, props.valueKey) : cachedOption.value === value;
  37271. if (isEqualValue) {
  37272. option = {
  37273. index: optionsArray.value.filter((opt) => !opt.created).indexOf(cachedOption),
  37274. value,
  37275. currentLabel: cachedOption.currentLabel,
  37276. get isDisabled() {
  37277. return cachedOption.isDisabled;
  37278. }
  37279. };
  37280. break;
  37281. }
  37282. }
  37283. if (option)
  37284. return option;
  37285. const label = isObjectValue ? value.label : value != null ? value : "";
  37286. const newOption = {
  37287. index: -1,
  37288. value,
  37289. currentLabel: label
  37290. };
  37291. return newOption;
  37292. };
  37293. const updateHoveringIndex = () => {
  37294. states.hoveringIndex = optionsArray.value.findIndex((item) => states.selected.some((selected) => getValueKey(selected) === getValueKey(item)));
  37295. };
  37296. const resetSelectionWidth = () => {
  37297. states.selectionWidth = Number.parseFloat(window.getComputedStyle(selectionRef.value).width);
  37298. };
  37299. const resetCollapseItemWidth = () => {
  37300. states.collapseItemWidth = collapseItemRef.value.getBoundingClientRect().width;
  37301. };
  37302. const updateTooltip = () => {
  37303. var _a, _b;
  37304. (_b = (_a = tooltipRef.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a);
  37305. };
  37306. const updateTagTooltip = () => {
  37307. var _a, _b;
  37308. (_b = (_a = tagTooltipRef.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a);
  37309. };
  37310. const onInputChange = () => {
  37311. if (states.inputValue.length > 0 && !expanded.value) {
  37312. expanded.value = true;
  37313. }
  37314. handleQueryChange(states.inputValue);
  37315. };
  37316. const onInput = (event) => {
  37317. states.inputValue = event.target.value;
  37318. if (props.remote) {
  37319. debouncing.value = true;
  37320. debouncedOnInputChange();
  37321. } else {
  37322. return onInputChange();
  37323. }
  37324. };
  37325. const debouncedOnInputChange = useDebounceFn(() => {
  37326. onInputChange();
  37327. debouncing.value = false;
  37328. }, debounce);
  37329. const emitChange = (val) => {
  37330. if (!isEqual$1(props.modelValue, val)) {
  37331. emit(CHANGE_EVENT, val);
  37332. }
  37333. };
  37334. const getLastNotDisabledIndex = (value) => findLastIndex(value, (it) => {
  37335. const option = states.cachedOptions.get(it);
  37336. return option && !option.disabled && !option.states.groupDisabled;
  37337. });
  37338. const deletePrevTag = (e) => {
  37339. const code = getEventCode(e);
  37340. if (!props.multiple)
  37341. return;
  37342. if (code === EVENT_CODE.delete)
  37343. return;
  37344. if (e.target.value.length <= 0) {
  37345. const value = castArray$1(props.modelValue).slice();
  37346. const lastNotDisabledIndex = getLastNotDisabledIndex(value);
  37347. if (lastNotDisabledIndex < 0)
  37348. return;
  37349. const removeTagValue = value[lastNotDisabledIndex];
  37350. value.splice(lastNotDisabledIndex, 1);
  37351. emit(UPDATE_MODEL_EVENT, value);
  37352. emitChange(value);
  37353. emit("remove-tag", removeTagValue);
  37354. }
  37355. };
  37356. const deleteTag = (event, tag) => {
  37357. const index = states.selected.indexOf(tag);
  37358. if (index > -1 && !selectDisabled.value) {
  37359. const value = castArray$1(props.modelValue).slice();
  37360. value.splice(index, 1);
  37361. emit(UPDATE_MODEL_EVENT, value);
  37362. emitChange(value);
  37363. emit("remove-tag", tag.value);
  37364. }
  37365. event.stopPropagation();
  37366. focus();
  37367. };
  37368. const deleteSelected = (event) => {
  37369. event.stopPropagation();
  37370. const value = props.multiple ? [] : valueOnClear.value;
  37371. if (props.multiple) {
  37372. for (const item of states.selected) {
  37373. if (item.isDisabled)
  37374. value.push(item.value);
  37375. }
  37376. }
  37377. emit(UPDATE_MODEL_EVENT, value);
  37378. emitChange(value);
  37379. states.hoveringIndex = -1;
  37380. expanded.value = false;
  37381. emit("clear");
  37382. focus();
  37383. };
  37384. const handleOptionSelect = (option) => {
  37385. var _a;
  37386. if (props.multiple) {
  37387. const value = castArray$1((_a = props.modelValue) != null ? _a : []).slice();
  37388. const optionIndex = getValueIndex(value, option);
  37389. if (optionIndex > -1) {
  37390. value.splice(optionIndex, 1);
  37391. } else if (props.multipleLimit <= 0 || value.length < props.multipleLimit) {
  37392. value.push(option.value);
  37393. }
  37394. emit(UPDATE_MODEL_EVENT, value);
  37395. emitChange(value);
  37396. if (option.created) {
  37397. handleQueryChange("");
  37398. }
  37399. if (props.filterable && !props.reserveKeyword) {
  37400. states.inputValue = "";
  37401. }
  37402. } else {
  37403. !isEqual$1(props.modelValue, option.value) && emit(UPDATE_MODEL_EVENT, option.value);
  37404. emitChange(option.value);
  37405. expanded.value = false;
  37406. }
  37407. focus();
  37408. if (expanded.value)
  37409. return;
  37410. vue.nextTick(() => {
  37411. scrollToOption(option);
  37412. });
  37413. };
  37414. const getValueIndex = (arr, option) => {
  37415. if (isUndefined(option))
  37416. return -1;
  37417. if (!isObject$1(option.value))
  37418. return arr.indexOf(option.value);
  37419. return arr.findIndex((item) => {
  37420. return isEqual$1(get(item, props.valueKey), getValueKey(option));
  37421. });
  37422. };
  37423. const scrollToOption = (option) => {
  37424. var _a, _b, _c, _d, _e;
  37425. const targetOption = isArray$1(option) ? option[0] : option;
  37426. let target = null;
  37427. if (!isNil(targetOption == null ? void 0 : targetOption.value)) {
  37428. const options = optionsArray.value.filter((item) => item.value === targetOption.value);
  37429. if (options.length > 0) {
  37430. target = options[0].$el;
  37431. }
  37432. }
  37433. if (tooltipRef.value && target) {
  37434. 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")}`);
  37435. if (menu) {
  37436. scrollIntoView(menu, target);
  37437. }
  37438. }
  37439. (_e = scrollbarRef.value) == null ? void 0 : _e.handleScroll();
  37440. };
  37441. const onOptionCreate = (vm) => {
  37442. states.options.set(vm.value, vm);
  37443. states.cachedOptions.set(vm.value, vm);
  37444. };
  37445. const onOptionDestroy = (key, vm) => {
  37446. if (states.options.get(key) === vm) {
  37447. states.options.delete(key);
  37448. }
  37449. };
  37450. const popperRef = vue.computed(() => {
  37451. var _a, _b;
  37452. return (_b = (_a = tooltipRef.value) == null ? void 0 : _a.popperRef) == null ? void 0 : _b.contentRef;
  37453. });
  37454. const handleMenuEnter = () => {
  37455. states.isBeforeHide = false;
  37456. vue.nextTick(() => {
  37457. var _a;
  37458. (_a = scrollbarRef.value) == null ? void 0 : _a.update();
  37459. scrollToOption(states.selected);
  37460. });
  37461. };
  37462. const focus = () => {
  37463. var _a;
  37464. (_a = inputRef.value) == null ? void 0 : _a.focus();
  37465. };
  37466. const blur = () => {
  37467. var _a;
  37468. if (expanded.value) {
  37469. expanded.value = false;
  37470. vue.nextTick(() => {
  37471. var _a2;
  37472. return (_a2 = inputRef.value) == null ? void 0 : _a2.blur();
  37473. });
  37474. return;
  37475. }
  37476. (_a = inputRef.value) == null ? void 0 : _a.blur();
  37477. };
  37478. const handleClearClick = (event) => {
  37479. deleteSelected(event);
  37480. };
  37481. const handleClickOutside = (event) => {
  37482. expanded.value = false;
  37483. if (isFocused.value) {
  37484. const _event = new FocusEvent("blur", event);
  37485. vue.nextTick(() => handleBlur(_event));
  37486. }
  37487. };
  37488. const handleEsc = () => {
  37489. if (states.inputValue.length > 0) {
  37490. states.inputValue = "";
  37491. } else {
  37492. expanded.value = false;
  37493. }
  37494. };
  37495. const toggleMenu = () => {
  37496. if (selectDisabled.value)
  37497. return;
  37498. if (isIOS)
  37499. states.inputHovering = true;
  37500. if (states.menuVisibleOnFocus) {
  37501. states.menuVisibleOnFocus = false;
  37502. } else {
  37503. expanded.value = !expanded.value;
  37504. }
  37505. };
  37506. const selectOption = () => {
  37507. if (!expanded.value) {
  37508. toggleMenu();
  37509. } else {
  37510. const option = optionsArray.value[states.hoveringIndex];
  37511. if (option && !option.isDisabled) {
  37512. handleOptionSelect(option);
  37513. }
  37514. }
  37515. };
  37516. const getValueKey = (item) => {
  37517. return isObject$1(item.value) ? get(item.value, props.valueKey) : item.value;
  37518. };
  37519. const optionsAllDisabled = vue.computed(() => optionsArray.value.filter((option) => option.visible).every((option) => option.isDisabled));
  37520. const showTagList = vue.computed(() => {
  37521. if (!props.multiple) {
  37522. return [];
  37523. }
  37524. return props.collapseTags ? states.selected.slice(0, props.maxCollapseTags) : states.selected;
  37525. });
  37526. const collapseTagList = vue.computed(() => {
  37527. if (!props.multiple) {
  37528. return [];
  37529. }
  37530. return props.collapseTags ? states.selected.slice(props.maxCollapseTags) : [];
  37531. });
  37532. const navigateOptions = (direction) => {
  37533. if (!expanded.value) {
  37534. expanded.value = true;
  37535. return;
  37536. }
  37537. if (states.options.size === 0 || filteredOptionsCount.value === 0 || isComposing.value)
  37538. return;
  37539. if (!optionsAllDisabled.value) {
  37540. if (direction === "next") {
  37541. states.hoveringIndex++;
  37542. if (states.hoveringIndex === states.options.size) {
  37543. states.hoveringIndex = 0;
  37544. }
  37545. } else if (direction === "prev") {
  37546. states.hoveringIndex--;
  37547. if (states.hoveringIndex < 0) {
  37548. states.hoveringIndex = states.options.size - 1;
  37549. }
  37550. }
  37551. const option = optionsArray.value[states.hoveringIndex];
  37552. if (option.isDisabled || !option.visible) {
  37553. navigateOptions(direction);
  37554. }
  37555. vue.nextTick(() => scrollToOption(hoverOption.value));
  37556. }
  37557. };
  37558. const findFocusableIndex = (arr, start, step, len) => {
  37559. for (let i = start; i >= 0 && i < len; i += step) {
  37560. const obj = arr[i];
  37561. if (!(obj == null ? void 0 : obj.isDisabled) && (obj == null ? void 0 : obj.visible)) {
  37562. return i;
  37563. }
  37564. }
  37565. return null;
  37566. };
  37567. const focusOption = (targetIndex, mode) => {
  37568. var _a;
  37569. const len = states.options.size;
  37570. if (len === 0)
  37571. return;
  37572. const start = clamp$1(targetIndex, 0, len - 1);
  37573. const options = optionsArray.value;
  37574. const direction = mode === "up" ? -1 : 1;
  37575. const newIndex = (_a = findFocusableIndex(options, start, direction, len)) != null ? _a : findFocusableIndex(options, start - direction, -direction, len);
  37576. if (newIndex != null) {
  37577. states.hoveringIndex = newIndex;
  37578. vue.nextTick(() => scrollToOption(hoverOption.value));
  37579. }
  37580. };
  37581. const handleKeydown = (e) => {
  37582. const code = getEventCode(e);
  37583. let isPreventDefault = true;
  37584. switch (code) {
  37585. case EVENT_CODE.up:
  37586. navigateOptions("prev");
  37587. break;
  37588. case EVENT_CODE.down:
  37589. navigateOptions("next");
  37590. break;
  37591. case EVENT_CODE.enter:
  37592. selectOption();
  37593. break;
  37594. case EVENT_CODE.esc:
  37595. handleEsc();
  37596. break;
  37597. case EVENT_CODE.backspace:
  37598. isPreventDefault = false;
  37599. deletePrevTag(e);
  37600. return;
  37601. case EVENT_CODE.home:
  37602. if (!expanded.value)
  37603. return;
  37604. focusOption(0, "down");
  37605. break;
  37606. case EVENT_CODE.end:
  37607. if (!expanded.value)
  37608. return;
  37609. focusOption(states.options.size - 1, "up");
  37610. break;
  37611. case EVENT_CODE.pageUp:
  37612. if (!expanded.value)
  37613. return;
  37614. focusOption(states.hoveringIndex - 10, "up");
  37615. break;
  37616. case EVENT_CODE.pageDown:
  37617. if (!expanded.value)
  37618. return;
  37619. focusOption(states.hoveringIndex + 10, "down");
  37620. break;
  37621. default:
  37622. isPreventDefault = false;
  37623. break;
  37624. }
  37625. if (isPreventDefault) {
  37626. e.preventDefault();
  37627. e.stopPropagation();
  37628. }
  37629. };
  37630. const getGapWidth = () => {
  37631. if (!selectionRef.value)
  37632. return 0;
  37633. const style = window.getComputedStyle(selectionRef.value);
  37634. return Number.parseFloat(style.gap || "6px");
  37635. };
  37636. const tagStyle = vue.computed(() => {
  37637. const gapWidth = getGapWidth();
  37638. const inputSlotWidth = props.filterable ? gapWidth + MINIMUM_INPUT_WIDTH : 0;
  37639. const maxWidth = collapseItemRef.value && props.maxCollapseTags === 1 ? states.selectionWidth - states.collapseItemWidth - gapWidth - inputSlotWidth : states.selectionWidth - inputSlotWidth;
  37640. return { maxWidth: `${maxWidth}px` };
  37641. });
  37642. const collapseTagStyle = vue.computed(() => {
  37643. return { maxWidth: `${states.selectionWidth}px` };
  37644. });
  37645. const popupScroll = (data) => {
  37646. emit("popup-scroll", data);
  37647. };
  37648. useResizeObserver(selectionRef, resetSelectionWidth);
  37649. useResizeObserver(wrapperRef, updateTooltip);
  37650. useResizeObserver(tagMenuRef, updateTagTooltip);
  37651. useResizeObserver(collapseItemRef, resetCollapseItemWidth);
  37652. let stop;
  37653. vue.watch(() => dropdownMenuVisible.value, (newVal) => {
  37654. if (newVal) {
  37655. stop = useResizeObserver(menuRef, updateTooltip).stop;
  37656. } else {
  37657. stop == null ? void 0 : stop();
  37658. stop = void 0;
  37659. }
  37660. });
  37661. vue.onMounted(() => {
  37662. setSelected();
  37663. });
  37664. return {
  37665. inputId,
  37666. contentId,
  37667. nsSelect,
  37668. nsInput,
  37669. states,
  37670. isFocused,
  37671. expanded,
  37672. optionsArray,
  37673. hoverOption,
  37674. selectSize,
  37675. filteredOptionsCount,
  37676. updateTooltip,
  37677. updateTagTooltip,
  37678. debouncedOnInputChange,
  37679. onInput,
  37680. deletePrevTag,
  37681. deleteTag,
  37682. deleteSelected,
  37683. handleOptionSelect,
  37684. scrollToOption,
  37685. hasModelValue,
  37686. shouldShowPlaceholder,
  37687. currentPlaceholder,
  37688. mouseEnterEventName,
  37689. needStatusIcon,
  37690. showClearBtn,
  37691. iconComponent,
  37692. iconReverse,
  37693. validateState,
  37694. validateIcon,
  37695. showNewOption,
  37696. updateOptions,
  37697. collapseTagSize,
  37698. setSelected,
  37699. selectDisabled,
  37700. emptyText,
  37701. handleCompositionStart,
  37702. handleCompositionUpdate,
  37703. handleCompositionEnd,
  37704. handleKeydown,
  37705. onOptionCreate,
  37706. onOptionDestroy,
  37707. handleMenuEnter,
  37708. focus,
  37709. blur,
  37710. handleClearClick,
  37711. handleClickOutside,
  37712. handleEsc,
  37713. toggleMenu,
  37714. selectOption,
  37715. getValueKey,
  37716. navigateOptions,
  37717. dropdownMenuVisible,
  37718. showTagList,
  37719. collapseTagList,
  37720. popupScroll,
  37721. getOption,
  37722. tagStyle,
  37723. collapseTagStyle,
  37724. popperRef,
  37725. inputRef,
  37726. tooltipRef,
  37727. tagTooltipRef,
  37728. prefixRef,
  37729. suffixRef,
  37730. selectRef,
  37731. wrapperRef,
  37732. selectionRef,
  37733. scrollbarRef,
  37734. menuRef,
  37735. tagMenuRef,
  37736. collapseItemRef
  37737. };
  37738. };
  37739. var ElOptions = vue.defineComponent({
  37740. name: "ElOptions",
  37741. setup(_, { slots }) {
  37742. const select = vue.inject(selectKey);
  37743. let cachedValueList = [];
  37744. return () => {
  37745. var _a, _b;
  37746. const children = (_a = slots.default) == null ? void 0 : _a.call(slots);
  37747. const valueList = [];
  37748. function filterOptions(children2) {
  37749. if (!isArray$1(children2))
  37750. return;
  37751. children2.forEach((item) => {
  37752. var _a2, _b2, _c, _d;
  37753. const name = (_a2 = (item == null ? void 0 : item.type) || {}) == null ? void 0 : _a2.name;
  37754. if (name === "ElOptionGroup") {
  37755. 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);
  37756. } else if (name === "ElOption") {
  37757. valueList.push((_d = item.props) == null ? void 0 : _d.value);
  37758. } else if (isArray$1(item.children)) {
  37759. filterOptions(item.children);
  37760. }
  37761. });
  37762. }
  37763. if (children.length) {
  37764. filterOptions((_b = children[0]) == null ? void 0 : _b.children);
  37765. }
  37766. if (!isEqual$1(valueList, cachedValueList)) {
  37767. cachedValueList = valueList;
  37768. if (select) {
  37769. select.states.optionValues = valueList;
  37770. }
  37771. }
  37772. return children;
  37773. };
  37774. }
  37775. });
  37776. const selectProps = buildProps({
  37777. name: String,
  37778. id: String,
  37779. modelValue: {
  37780. type: definePropType([
  37781. Array,
  37782. String,
  37783. Number,
  37784. Boolean,
  37785. Object
  37786. ]),
  37787. default: void 0
  37788. },
  37789. autocomplete: {
  37790. type: String,
  37791. default: "off"
  37792. },
  37793. automaticDropdown: Boolean,
  37794. size: useSizeProp,
  37795. effect: {
  37796. type: definePropType(String),
  37797. default: "light"
  37798. },
  37799. disabled: Boolean,
  37800. clearable: Boolean,
  37801. filterable: Boolean,
  37802. allowCreate: Boolean,
  37803. loading: Boolean,
  37804. popperClass: {
  37805. type: String,
  37806. default: ""
  37807. },
  37808. popperStyle: {
  37809. type: definePropType([String, Object])
  37810. },
  37811. popperOptions: {
  37812. type: definePropType(Object),
  37813. default: () => ({})
  37814. },
  37815. remote: Boolean,
  37816. debounce: {
  37817. type: Number,
  37818. default: 300
  37819. },
  37820. loadingText: String,
  37821. noMatchText: String,
  37822. noDataText: String,
  37823. remoteMethod: {
  37824. type: definePropType(Function)
  37825. },
  37826. filterMethod: {
  37827. type: definePropType(Function)
  37828. },
  37829. multiple: Boolean,
  37830. multipleLimit: {
  37831. type: Number,
  37832. default: 0
  37833. },
  37834. placeholder: {
  37835. type: String
  37836. },
  37837. defaultFirstOption: Boolean,
  37838. reserveKeyword: {
  37839. type: Boolean,
  37840. default: true
  37841. },
  37842. valueKey: {
  37843. type: String,
  37844. default: "value"
  37845. },
  37846. collapseTags: Boolean,
  37847. collapseTagsTooltip: Boolean,
  37848. maxCollapseTags: {
  37849. type: Number,
  37850. default: 1
  37851. },
  37852. teleported: useTooltipContentProps.teleported,
  37853. persistent: {
  37854. type: Boolean,
  37855. default: true
  37856. },
  37857. clearIcon: {
  37858. type: iconPropType,
  37859. default: circle_close_default
  37860. },
  37861. fitInputWidth: Boolean,
  37862. suffixIcon: {
  37863. type: iconPropType,
  37864. default: arrow_down_default
  37865. },
  37866. tagType: { ...tagProps.type, default: "info" },
  37867. tagEffect: { ...tagProps.effect, default: "light" },
  37868. validateEvent: {
  37869. type: Boolean,
  37870. default: true
  37871. },
  37872. remoteShowSuffix: Boolean,
  37873. showArrow: {
  37874. type: Boolean,
  37875. default: true
  37876. },
  37877. offset: {
  37878. type: Number,
  37879. default: 12
  37880. },
  37881. placement: {
  37882. type: definePropType(String),
  37883. values: Ee,
  37884. default: "bottom-start"
  37885. },
  37886. fallbackPlacements: {
  37887. type: definePropType(Array),
  37888. default: ["bottom-start", "top-start", "right", "left"]
  37889. },
  37890. tabindex: {
  37891. type: [String, Number],
  37892. default: 0
  37893. },
  37894. appendTo: useTooltipContentProps.appendTo,
  37895. options: {
  37896. type: definePropType(Array)
  37897. },
  37898. props: {
  37899. type: definePropType(Object),
  37900. default: () => defaultProps$5
  37901. },
  37902. ...useEmptyValuesProps,
  37903. ...useAriaProps(["ariaLabel"])
  37904. });
  37905. const selectEmits = {
  37906. [UPDATE_MODEL_EVENT]: (val) => true,
  37907. [CHANGE_EVENT]: (val) => true,
  37908. "popup-scroll": scrollbarEmits.scroll,
  37909. "remove-tag": (val) => true,
  37910. "visible-change": (visible) => true,
  37911. focus: (evt) => evt instanceof FocusEvent,
  37912. blur: (evt) => evt instanceof FocusEvent,
  37913. clear: () => true
  37914. };
  37915. const _sfc_main$W = vue.defineComponent({
  37916. name: "ElOptionGroup",
  37917. componentName: "ElOptionGroup",
  37918. props: {
  37919. label: String,
  37920. disabled: Boolean
  37921. },
  37922. setup(props) {
  37923. const ns = useNamespace("select");
  37924. const groupRef = vue.ref();
  37925. const instance = vue.getCurrentInstance();
  37926. const children = vue.ref([]);
  37927. vue.provide(selectGroupKey, vue.reactive({
  37928. ...vue.toRefs(props)
  37929. }));
  37930. const visible = vue.computed(() => children.value.some((option) => option.visible === true));
  37931. const isOption = (node) => {
  37932. var _a;
  37933. return node.type.name === "ElOption" && !!((_a = node.component) == null ? void 0 : _a.proxy);
  37934. };
  37935. const flattedChildren = (node) => {
  37936. const nodes = castArray$1(node);
  37937. const children2 = [];
  37938. nodes.forEach((child) => {
  37939. var _a;
  37940. if (!vue.isVNode(child))
  37941. return;
  37942. if (isOption(child)) {
  37943. children2.push(child.component.proxy);
  37944. } else if (isArray$1(child.children) && child.children.length) {
  37945. children2.push(...flattedChildren(child.children));
  37946. } else if ((_a = child.component) == null ? void 0 : _a.subTree) {
  37947. children2.push(...flattedChildren(child.component.subTree));
  37948. }
  37949. });
  37950. return children2;
  37951. };
  37952. const updateChildren = () => {
  37953. children.value = flattedChildren(instance.subTree);
  37954. };
  37955. vue.onMounted(() => {
  37956. updateChildren();
  37957. });
  37958. useMutationObserver(groupRef, updateChildren, {
  37959. attributes: true,
  37960. subtree: true,
  37961. childList: true
  37962. });
  37963. return {
  37964. groupRef,
  37965. visible,
  37966. ns
  37967. };
  37968. }
  37969. });
  37970. function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
  37971. return vue.withDirectives((vue.openBlock(), vue.createElementBlock("ul", {
  37972. ref: "groupRef",
  37973. class: vue.normalizeClass(_ctx.ns.be("group", "wrap"))
  37974. }, [
  37975. vue.createElementVNode("li", {
  37976. class: vue.normalizeClass(_ctx.ns.be("group", "title"))
  37977. }, vue.toDisplayString(_ctx.label), 3),
  37978. vue.createElementVNode("li", null, [
  37979. vue.createElementVNode("ul", {
  37980. class: vue.normalizeClass(_ctx.ns.b("group"))
  37981. }, [
  37982. vue.renderSlot(_ctx.$slots, "default")
  37983. ], 2)
  37984. ])
  37985. ], 2)), [
  37986. [vue.vShow, _ctx.visible]
  37987. ]);
  37988. }
  37989. var OptionGroup = /* @__PURE__ */ _export_sfc(_sfc_main$W, [["render", _sfc_render$9], ["__file", "option-group.vue"]]);
  37990. const COMPONENT_NAME$a = "ElSelect";
  37991. const _sfc_main$V = vue.defineComponent({
  37992. name: COMPONENT_NAME$a,
  37993. componentName: COMPONENT_NAME$a,
  37994. components: {
  37995. ElSelectMenu: ElSelectMenu$1,
  37996. ElOption: Option,
  37997. ElOptions,
  37998. ElOptionGroup: OptionGroup,
  37999. ElTag,
  38000. ElScrollbar,
  38001. ElTooltip,
  38002. ElIcon
  38003. },
  38004. directives: { ClickOutside },
  38005. props: selectProps,
  38006. emits: [
  38007. UPDATE_MODEL_EVENT,
  38008. CHANGE_EVENT,
  38009. "remove-tag",
  38010. "clear",
  38011. "visible-change",
  38012. "focus",
  38013. "blur",
  38014. "popup-scroll"
  38015. ],
  38016. setup(props, { emit, slots }) {
  38017. const instance = vue.getCurrentInstance();
  38018. const originalWarnHandler = instance.appContext.config.warnHandler;
  38019. instance.appContext.config.warnHandler = (...args) => {
  38020. if (!args[0] || args[0].includes('Slot "default" invoked outside of the render function')) {
  38021. return;
  38022. }
  38023. console.warn(...args);
  38024. };
  38025. const modelValue = vue.computed(() => {
  38026. const { modelValue: rawModelValue, multiple } = props;
  38027. const fallback = multiple ? [] : void 0;
  38028. if (isArray$1(rawModelValue)) {
  38029. return multiple ? rawModelValue : fallback;
  38030. }
  38031. return multiple ? fallback : rawModelValue;
  38032. });
  38033. const _props = vue.reactive({
  38034. ...vue.toRefs(props),
  38035. modelValue
  38036. });
  38037. const API = useSelect$3(_props, emit);
  38038. const { calculatorRef, inputStyle } = useCalcInputWidth();
  38039. const { getLabel, getValue, getOptions, getDisabled } = useProps(props);
  38040. const getOptionProps = (option) => ({
  38041. label: getLabel(option),
  38042. value: getValue(option),
  38043. disabled: getDisabled(option)
  38044. });
  38045. const flatTreeSelectData = (data) => {
  38046. return data.reduce((acc, item) => {
  38047. acc.push(item);
  38048. if (item.children && item.children.length > 0) {
  38049. acc.push(...flatTreeSelectData(item.children));
  38050. }
  38051. return acc;
  38052. }, []);
  38053. };
  38054. const manuallyRenderSlots = (vnodes) => {
  38055. const children = flattedChildren(vnodes || []);
  38056. children.forEach((item) => {
  38057. var _a;
  38058. if (isObject$1(item) && (item.type.name === "ElOption" || item.type.name === "ElTree")) {
  38059. const _name = item.type.name;
  38060. if (_name === "ElTree") {
  38061. const treeData = ((_a = item.props) == null ? void 0 : _a.data) || [];
  38062. const flatData = flatTreeSelectData(treeData);
  38063. flatData.forEach((treeItem) => {
  38064. treeItem.currentLabel = treeItem.label || (isObject$1(treeItem.value) ? "" : treeItem.value);
  38065. API.onOptionCreate(treeItem);
  38066. });
  38067. } else if (_name === "ElOption") {
  38068. const obj = { ...item.props };
  38069. obj.currentLabel = obj.label || (isObject$1(obj.value) ? "" : obj.value);
  38070. API.onOptionCreate(obj);
  38071. }
  38072. }
  38073. });
  38074. };
  38075. vue.watch(() => {
  38076. var _a;
  38077. return [(_a = slots.default) == null ? void 0 : _a.call(slots), modelValue.value];
  38078. }, () => {
  38079. var _a;
  38080. if (props.persistent || API.states.options.size > 0) {
  38081. return;
  38082. }
  38083. manuallyRenderSlots((_a = slots.default) == null ? void 0 : _a.call(slots));
  38084. }, {
  38085. immediate: true
  38086. });
  38087. vue.provide(selectKey, vue.reactive({
  38088. props: _props,
  38089. states: API.states,
  38090. selectRef: API.selectRef,
  38091. optionsArray: API.optionsArray,
  38092. setSelected: API.setSelected,
  38093. handleOptionSelect: API.handleOptionSelect,
  38094. onOptionCreate: API.onOptionCreate,
  38095. onOptionDestroy: API.onOptionDestroy
  38096. }));
  38097. const selectedLabel = vue.computed(() => {
  38098. if (!props.multiple) {
  38099. return API.states.selectedLabel;
  38100. }
  38101. return API.states.selected.map((i) => i.currentLabel);
  38102. });
  38103. vue.onBeforeUnmount(() => {
  38104. instance.appContext.config.warnHandler = originalWarnHandler;
  38105. });
  38106. return {
  38107. ...API,
  38108. modelValue,
  38109. selectedLabel,
  38110. calculatorRef,
  38111. inputStyle,
  38112. getLabel,
  38113. getValue,
  38114. getOptions,
  38115. getDisabled,
  38116. getOptionProps
  38117. };
  38118. }
  38119. });
  38120. function _sfc_render$8(_ctx, _cache) {
  38121. const _component_el_tag = vue.resolveComponent("el-tag");
  38122. const _component_el_tooltip = vue.resolveComponent("el-tooltip");
  38123. const _component_el_icon = vue.resolveComponent("el-icon");
  38124. const _component_el_option = vue.resolveComponent("el-option");
  38125. const _component_el_option_group = vue.resolveComponent("el-option-group");
  38126. const _component_el_options = vue.resolveComponent("el-options");
  38127. const _component_el_scrollbar = vue.resolveComponent("el-scrollbar");
  38128. const _component_el_select_menu = vue.resolveComponent("el-select-menu");
  38129. const _directive_click_outside = vue.resolveDirective("click-outside");
  38130. return vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  38131. ref: "selectRef",
  38132. class: vue.normalizeClass([_ctx.nsSelect.b(), _ctx.nsSelect.m(_ctx.selectSize)]),
  38133. [vue.toHandlerKey(_ctx.mouseEnterEventName)]: ($event) => _ctx.states.inputHovering = true,
  38134. onMouseleave: ($event) => _ctx.states.inputHovering = false
  38135. }, [
  38136. vue.createVNode(_component_el_tooltip, {
  38137. ref: "tooltipRef",
  38138. visible: _ctx.dropdownMenuVisible,
  38139. placement: _ctx.placement,
  38140. teleported: _ctx.teleported,
  38141. "popper-class": [_ctx.nsSelect.e("popper"), _ctx.popperClass],
  38142. "popper-style": _ctx.popperStyle,
  38143. "popper-options": _ctx.popperOptions,
  38144. "fallback-placements": _ctx.fallbackPlacements,
  38145. effect: _ctx.effect,
  38146. pure: "",
  38147. trigger: "click",
  38148. transition: `${_ctx.nsSelect.namespace.value}-zoom-in-top`,
  38149. "stop-popper-mouse-event": false,
  38150. "gpu-acceleration": false,
  38151. persistent: _ctx.persistent,
  38152. "append-to": _ctx.appendTo,
  38153. "show-arrow": _ctx.showArrow,
  38154. offset: _ctx.offset,
  38155. onBeforeShow: _ctx.handleMenuEnter,
  38156. onHide: ($event) => _ctx.states.isBeforeHide = false
  38157. }, {
  38158. default: vue.withCtx(() => {
  38159. var _a;
  38160. return [
  38161. vue.createElementVNode("div", {
  38162. ref: "wrapperRef",
  38163. class: vue.normalizeClass([
  38164. _ctx.nsSelect.e("wrapper"),
  38165. _ctx.nsSelect.is("focused", _ctx.isFocused),
  38166. _ctx.nsSelect.is("hovering", _ctx.states.inputHovering),
  38167. _ctx.nsSelect.is("filterable", _ctx.filterable),
  38168. _ctx.nsSelect.is("disabled", _ctx.selectDisabled)
  38169. ]),
  38170. onClick: vue.withModifiers(_ctx.toggleMenu, ["prevent"])
  38171. }, [
  38172. _ctx.$slots.prefix ? (vue.openBlock(), vue.createElementBlock("div", {
  38173. key: 0,
  38174. ref: "prefixRef",
  38175. class: vue.normalizeClass(_ctx.nsSelect.e("prefix"))
  38176. }, [
  38177. vue.renderSlot(_ctx.$slots, "prefix")
  38178. ], 2)) : vue.createCommentVNode("v-if", true),
  38179. vue.createElementVNode("div", {
  38180. ref: "selectionRef",
  38181. class: vue.normalizeClass([
  38182. _ctx.nsSelect.e("selection"),
  38183. _ctx.nsSelect.is("near", _ctx.multiple && !_ctx.$slots.prefix && !!_ctx.states.selected.length)
  38184. ])
  38185. }, [
  38186. _ctx.multiple ? vue.renderSlot(_ctx.$slots, "tag", {
  38187. key: 0,
  38188. data: _ctx.states.selected,
  38189. deleteTag: _ctx.deleteTag,
  38190. selectDisabled: _ctx.selectDisabled
  38191. }, () => [
  38192. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.showTagList, (item) => {
  38193. return vue.openBlock(), vue.createElementBlock("div", {
  38194. key: _ctx.getValueKey(item),
  38195. class: vue.normalizeClass(_ctx.nsSelect.e("selected-item"))
  38196. }, [
  38197. vue.createVNode(_component_el_tag, {
  38198. closable: !_ctx.selectDisabled && !item.isDisabled,
  38199. size: _ctx.collapseTagSize,
  38200. type: _ctx.tagType,
  38201. effect: _ctx.tagEffect,
  38202. "disable-transitions": "",
  38203. style: vue.normalizeStyle(_ctx.tagStyle),
  38204. onClose: ($event) => _ctx.deleteTag($event, item)
  38205. }, {
  38206. default: vue.withCtx(() => [
  38207. vue.createElementVNode("span", {
  38208. class: vue.normalizeClass(_ctx.nsSelect.e("tags-text"))
  38209. }, [
  38210. vue.renderSlot(_ctx.$slots, "label", {
  38211. index: item.index,
  38212. label: item.currentLabel,
  38213. value: item.value
  38214. }, () => [
  38215. vue.createTextVNode(vue.toDisplayString(item.currentLabel), 1)
  38216. ])
  38217. ], 2)
  38218. ]),
  38219. _: 2
  38220. }, 1032, ["closable", "size", "type", "effect", "style", "onClose"])
  38221. ], 2);
  38222. }), 128)),
  38223. _ctx.collapseTags && _ctx.states.selected.length > _ctx.maxCollapseTags ? (vue.openBlock(), vue.createBlock(_component_el_tooltip, {
  38224. key: 0,
  38225. ref: "tagTooltipRef",
  38226. disabled: _ctx.dropdownMenuVisible || !_ctx.collapseTagsTooltip,
  38227. "fallback-placements": ["bottom", "top", "right", "left"],
  38228. effect: _ctx.effect,
  38229. placement: "bottom",
  38230. "popper-class": _ctx.popperClass,
  38231. "popper-style": _ctx.popperStyle,
  38232. teleported: _ctx.teleported
  38233. }, {
  38234. default: vue.withCtx(() => [
  38235. vue.createElementVNode("div", {
  38236. ref: "collapseItemRef",
  38237. class: vue.normalizeClass(_ctx.nsSelect.e("selected-item"))
  38238. }, [
  38239. vue.createVNode(_component_el_tag, {
  38240. closable: false,
  38241. size: _ctx.collapseTagSize,
  38242. type: _ctx.tagType,
  38243. effect: _ctx.tagEffect,
  38244. "disable-transitions": "",
  38245. style: vue.normalizeStyle(_ctx.collapseTagStyle)
  38246. }, {
  38247. default: vue.withCtx(() => [
  38248. vue.createElementVNode("span", {
  38249. class: vue.normalizeClass(_ctx.nsSelect.e("tags-text"))
  38250. }, " + " + vue.toDisplayString(_ctx.states.selected.length - _ctx.maxCollapseTags), 3)
  38251. ]),
  38252. _: 1
  38253. }, 8, ["size", "type", "effect", "style"])
  38254. ], 2)
  38255. ]),
  38256. content: vue.withCtx(() => [
  38257. vue.createElementVNode("div", {
  38258. ref: "tagMenuRef",
  38259. class: vue.normalizeClass(_ctx.nsSelect.e("selection"))
  38260. }, [
  38261. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.collapseTagList, (item) => {
  38262. return vue.openBlock(), vue.createElementBlock("div", {
  38263. key: _ctx.getValueKey(item),
  38264. class: vue.normalizeClass(_ctx.nsSelect.e("selected-item"))
  38265. }, [
  38266. vue.createVNode(_component_el_tag, {
  38267. class: "in-tooltip",
  38268. closable: !_ctx.selectDisabled && !item.isDisabled,
  38269. size: _ctx.collapseTagSize,
  38270. type: _ctx.tagType,
  38271. effect: _ctx.tagEffect,
  38272. "disable-transitions": "",
  38273. onClose: ($event) => _ctx.deleteTag($event, item)
  38274. }, {
  38275. default: vue.withCtx(() => [
  38276. vue.createElementVNode("span", {
  38277. class: vue.normalizeClass(_ctx.nsSelect.e("tags-text"))
  38278. }, [
  38279. vue.renderSlot(_ctx.$slots, "label", {
  38280. index: item.index,
  38281. label: item.currentLabel,
  38282. value: item.value
  38283. }, () => [
  38284. vue.createTextVNode(vue.toDisplayString(item.currentLabel), 1)
  38285. ])
  38286. ], 2)
  38287. ]),
  38288. _: 2
  38289. }, 1032, ["closable", "size", "type", "effect", "onClose"])
  38290. ], 2);
  38291. }), 128))
  38292. ], 2)
  38293. ]),
  38294. _: 3
  38295. }, 8, ["disabled", "effect", "popper-class", "popper-style", "teleported"])) : vue.createCommentVNode("v-if", true)
  38296. ]) : vue.createCommentVNode("v-if", true),
  38297. vue.createElementVNode("div", {
  38298. class: vue.normalizeClass([
  38299. _ctx.nsSelect.e("selected-item"),
  38300. _ctx.nsSelect.e("input-wrapper"),
  38301. _ctx.nsSelect.is("hidden", !_ctx.filterable)
  38302. ])
  38303. }, [
  38304. vue.withDirectives(vue.createElementVNode("input", {
  38305. id: _ctx.inputId,
  38306. ref: "inputRef",
  38307. "onUpdate:modelValue": ($event) => _ctx.states.inputValue = $event,
  38308. type: "text",
  38309. name: _ctx.name,
  38310. class: vue.normalizeClass([_ctx.nsSelect.e("input"), _ctx.nsSelect.is(_ctx.selectSize)]),
  38311. disabled: _ctx.selectDisabled,
  38312. autocomplete: _ctx.autocomplete,
  38313. style: vue.normalizeStyle(_ctx.inputStyle),
  38314. tabindex: _ctx.tabindex,
  38315. role: "combobox",
  38316. readonly: !_ctx.filterable,
  38317. spellcheck: "false",
  38318. "aria-activedescendant": ((_a = _ctx.hoverOption) == null ? void 0 : _a.id) || "",
  38319. "aria-controls": _ctx.contentId,
  38320. "aria-expanded": _ctx.dropdownMenuVisible,
  38321. "aria-label": _ctx.ariaLabel,
  38322. "aria-autocomplete": "none",
  38323. "aria-haspopup": "listbox",
  38324. onKeydown: _ctx.handleKeydown,
  38325. onCompositionstart: _ctx.handleCompositionStart,
  38326. onCompositionupdate: _ctx.handleCompositionUpdate,
  38327. onCompositionend: _ctx.handleCompositionEnd,
  38328. onInput: _ctx.onInput,
  38329. onClick: vue.withModifiers(_ctx.toggleMenu, ["stop"])
  38330. }, null, 46, ["id", "onUpdate:modelValue", "name", "disabled", "autocomplete", "tabindex", "readonly", "aria-activedescendant", "aria-controls", "aria-expanded", "aria-label", "onKeydown", "onCompositionstart", "onCompositionupdate", "onCompositionend", "onInput", "onClick"]), [
  38331. [vue.vModelText, _ctx.states.inputValue]
  38332. ]),
  38333. _ctx.filterable ? (vue.openBlock(), vue.createElementBlock("span", {
  38334. key: 0,
  38335. ref: "calculatorRef",
  38336. "aria-hidden": "true",
  38337. class: vue.normalizeClass(_ctx.nsSelect.e("input-calculator")),
  38338. textContent: vue.toDisplayString(_ctx.states.inputValue)
  38339. }, null, 10, ["textContent"])) : vue.createCommentVNode("v-if", true)
  38340. ], 2),
  38341. _ctx.shouldShowPlaceholder ? (vue.openBlock(), vue.createElementBlock("div", {
  38342. key: 1,
  38343. class: vue.normalizeClass([
  38344. _ctx.nsSelect.e("selected-item"),
  38345. _ctx.nsSelect.e("placeholder"),
  38346. _ctx.nsSelect.is("transparent", !_ctx.hasModelValue || _ctx.expanded && !_ctx.states.inputValue)
  38347. ])
  38348. }, [
  38349. _ctx.hasModelValue ? vue.renderSlot(_ctx.$slots, "label", {
  38350. key: 0,
  38351. index: _ctx.getOption(_ctx.modelValue).index,
  38352. label: _ctx.currentPlaceholder,
  38353. value: _ctx.modelValue
  38354. }, () => [
  38355. vue.createElementVNode("span", null, vue.toDisplayString(_ctx.currentPlaceholder), 1)
  38356. ]) : (vue.openBlock(), vue.createElementBlock("span", { key: 1 }, vue.toDisplayString(_ctx.currentPlaceholder), 1))
  38357. ], 2)) : vue.createCommentVNode("v-if", true)
  38358. ], 2),
  38359. vue.createElementVNode("div", {
  38360. ref: "suffixRef",
  38361. class: vue.normalizeClass(_ctx.nsSelect.e("suffix"))
  38362. }, [
  38363. _ctx.iconComponent && !_ctx.showClearBtn ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
  38364. key: 0,
  38365. class: vue.normalizeClass([_ctx.nsSelect.e("caret"), _ctx.nsSelect.e("icon"), _ctx.iconReverse])
  38366. }, {
  38367. default: vue.withCtx(() => [
  38368. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.iconComponent)))
  38369. ]),
  38370. _: 1
  38371. }, 8, ["class"])) : vue.createCommentVNode("v-if", true),
  38372. _ctx.showClearBtn && _ctx.clearIcon ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
  38373. key: 1,
  38374. class: vue.normalizeClass([
  38375. _ctx.nsSelect.e("caret"),
  38376. _ctx.nsSelect.e("icon"),
  38377. _ctx.nsSelect.e("clear")
  38378. ]),
  38379. onClick: _ctx.handleClearClick
  38380. }, {
  38381. default: vue.withCtx(() => [
  38382. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.clearIcon)))
  38383. ]),
  38384. _: 1
  38385. }, 8, ["class", "onClick"])) : vue.createCommentVNode("v-if", true),
  38386. _ctx.validateState && _ctx.validateIcon && _ctx.needStatusIcon ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
  38387. key: 2,
  38388. class: vue.normalizeClass([
  38389. _ctx.nsInput.e("icon"),
  38390. _ctx.nsInput.e("validateIcon"),
  38391. _ctx.nsInput.is("loading", _ctx.validateState === "validating")
  38392. ])
  38393. }, {
  38394. default: vue.withCtx(() => [
  38395. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.validateIcon)))
  38396. ]),
  38397. _: 1
  38398. }, 8, ["class"])) : vue.createCommentVNode("v-if", true)
  38399. ], 2)
  38400. ], 10, ["onClick"])
  38401. ];
  38402. }),
  38403. content: vue.withCtx(() => [
  38404. vue.createVNode(_component_el_select_menu, { ref: "menuRef" }, {
  38405. default: vue.withCtx(() => [
  38406. _ctx.$slots.header ? (vue.openBlock(), vue.createElementBlock("div", {
  38407. key: 0,
  38408. class: vue.normalizeClass(_ctx.nsSelect.be("dropdown", "header")),
  38409. onClick: vue.withModifiers(() => {
  38410. }, ["stop"])
  38411. }, [
  38412. vue.renderSlot(_ctx.$slots, "header")
  38413. ], 10, ["onClick"])) : vue.createCommentVNode("v-if", true),
  38414. vue.withDirectives(vue.createVNode(_component_el_scrollbar, {
  38415. id: _ctx.contentId,
  38416. ref: "scrollbarRef",
  38417. tag: "ul",
  38418. "wrap-class": _ctx.nsSelect.be("dropdown", "wrap"),
  38419. "view-class": _ctx.nsSelect.be("dropdown", "list"),
  38420. class: vue.normalizeClass([_ctx.nsSelect.is("empty", _ctx.filteredOptionsCount === 0)]),
  38421. role: "listbox",
  38422. "aria-label": _ctx.ariaLabel,
  38423. "aria-orientation": "vertical",
  38424. onScroll: _ctx.popupScroll
  38425. }, {
  38426. default: vue.withCtx(() => [
  38427. _ctx.showNewOption ? (vue.openBlock(), vue.createBlock(_component_el_option, {
  38428. key: 0,
  38429. value: _ctx.states.inputValue,
  38430. created: true
  38431. }, null, 8, ["value"])) : vue.createCommentVNode("v-if", true),
  38432. vue.createVNode(_component_el_options, null, {
  38433. default: vue.withCtx(() => [
  38434. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  38435. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.options, (option, index) => {
  38436. var _a;
  38437. return vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: index }, [
  38438. ((_a = _ctx.getOptions(option)) == null ? void 0 : _a.length) ? (vue.openBlock(), vue.createBlock(_component_el_option_group, {
  38439. key: 0,
  38440. label: _ctx.getLabel(option),
  38441. disabled: _ctx.getDisabled(option)
  38442. }, {
  38443. default: vue.withCtx(() => [
  38444. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.getOptions(option), (item) => {
  38445. return vue.openBlock(), vue.createBlock(_component_el_option, vue.mergeProps({
  38446. key: _ctx.getValue(item)
  38447. }, _ctx.getOptionProps(item)), null, 16);
  38448. }), 128))
  38449. ]),
  38450. _: 2
  38451. }, 1032, ["label", "disabled"])) : (vue.openBlock(), vue.createBlock(_component_el_option, vue.normalizeProps(vue.mergeProps({ key: 1 }, _ctx.getOptionProps(option))), null, 16))
  38452. ], 64);
  38453. }), 128))
  38454. ])
  38455. ]),
  38456. _: 3
  38457. })
  38458. ]),
  38459. _: 3
  38460. }, 8, ["id", "wrap-class", "view-class", "class", "aria-label", "onScroll"]), [
  38461. [vue.vShow, _ctx.states.options.size > 0 && !_ctx.loading]
  38462. ]),
  38463. _ctx.$slots.loading && _ctx.loading ? (vue.openBlock(), vue.createElementBlock("div", {
  38464. key: 1,
  38465. class: vue.normalizeClass(_ctx.nsSelect.be("dropdown", "loading"))
  38466. }, [
  38467. vue.renderSlot(_ctx.$slots, "loading")
  38468. ], 2)) : _ctx.loading || _ctx.filteredOptionsCount === 0 ? (vue.openBlock(), vue.createElementBlock("div", {
  38469. key: 2,
  38470. class: vue.normalizeClass(_ctx.nsSelect.be("dropdown", "empty"))
  38471. }, [
  38472. vue.renderSlot(_ctx.$slots, "empty", {}, () => [
  38473. vue.createElementVNode("span", null, vue.toDisplayString(_ctx.emptyText), 1)
  38474. ])
  38475. ], 2)) : vue.createCommentVNode("v-if", true),
  38476. _ctx.$slots.footer ? (vue.openBlock(), vue.createElementBlock("div", {
  38477. key: 3,
  38478. class: vue.normalizeClass(_ctx.nsSelect.be("dropdown", "footer")),
  38479. onClick: vue.withModifiers(() => {
  38480. }, ["stop"])
  38481. }, [
  38482. vue.renderSlot(_ctx.$slots, "footer")
  38483. ], 10, ["onClick"])) : vue.createCommentVNode("v-if", true)
  38484. ]),
  38485. _: 3
  38486. }, 512)
  38487. ]),
  38488. _: 3
  38489. }, 8, ["visible", "placement", "teleported", "popper-class", "popper-style", "popper-options", "fallback-placements", "effect", "transition", "persistent", "append-to", "show-arrow", "offset", "onBeforeShow", "onHide"])
  38490. ], 16, ["onMouseleave"])), [
  38491. [_directive_click_outside, _ctx.handleClickOutside, _ctx.popperRef]
  38492. ]);
  38493. }
  38494. var Select$1 = /* @__PURE__ */ _export_sfc(_sfc_main$V, [["render", _sfc_render$8], ["__file", "select.vue"]]);
  38495. const ElSelect = withInstall(Select$1, {
  38496. Option,
  38497. OptionGroup
  38498. });
  38499. const ElOption = withNoopInstall(Option);
  38500. const ElOptionGroup = withNoopInstall(OptionGroup);
  38501. const usePagination = () => vue.inject(elPaginationKey, {});
  38502. const paginationSizesProps = buildProps({
  38503. pageSize: {
  38504. type: Number,
  38505. required: true
  38506. },
  38507. pageSizes: {
  38508. type: definePropType(Array),
  38509. default: () => mutable([10, 20, 30, 40, 50, 100])
  38510. },
  38511. popperClass: {
  38512. type: String
  38513. },
  38514. popperStyle: {
  38515. type: definePropType([String, Object])
  38516. },
  38517. disabled: Boolean,
  38518. teleported: Boolean,
  38519. size: {
  38520. type: String,
  38521. values: componentSizes
  38522. },
  38523. appendSizeTo: String
  38524. });
  38525. const __default__$K = vue.defineComponent({
  38526. name: "ElPaginationSizes"
  38527. });
  38528. const _sfc_main$U = /* @__PURE__ */ vue.defineComponent({
  38529. ...__default__$K,
  38530. props: paginationSizesProps,
  38531. emits: ["page-size-change"],
  38532. setup(__props, { emit }) {
  38533. const props = __props;
  38534. const { t } = useLocale();
  38535. const ns = useNamespace("pagination");
  38536. const pagination = usePagination();
  38537. const innerPageSize = vue.ref(props.pageSize);
  38538. vue.watch(() => props.pageSizes, (newVal, oldVal) => {
  38539. if (isEqual$1(newVal, oldVal))
  38540. return;
  38541. if (isArray$1(newVal)) {
  38542. const pageSize = newVal.includes(props.pageSize) ? props.pageSize : props.pageSizes[0];
  38543. emit("page-size-change", pageSize);
  38544. }
  38545. });
  38546. vue.watch(() => props.pageSize, (newVal) => {
  38547. innerPageSize.value = newVal;
  38548. });
  38549. const innerPageSizes = vue.computed(() => props.pageSizes);
  38550. function handleChange(val) {
  38551. var _a;
  38552. if (val !== innerPageSize.value) {
  38553. innerPageSize.value = val;
  38554. (_a = pagination.handleSizeChange) == null ? void 0 : _a.call(pagination, Number(val));
  38555. }
  38556. }
  38557. return (_ctx, _cache) => {
  38558. return vue.openBlock(), vue.createElementBlock("span", {
  38559. class: vue.normalizeClass(vue.unref(ns).e("sizes"))
  38560. }, [
  38561. vue.createVNode(vue.unref(ElSelect), {
  38562. "model-value": innerPageSize.value,
  38563. disabled: _ctx.disabled,
  38564. "popper-class": _ctx.popperClass,
  38565. "popper-style": _ctx.popperStyle,
  38566. size: _ctx.size,
  38567. teleported: _ctx.teleported,
  38568. "validate-event": false,
  38569. "append-to": _ctx.appendSizeTo,
  38570. onChange: handleChange
  38571. }, {
  38572. default: vue.withCtx(() => [
  38573. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(innerPageSizes), (item) => {
  38574. return vue.openBlock(), vue.createBlock(vue.unref(ElOption), {
  38575. key: item,
  38576. value: item,
  38577. label: item + vue.unref(t)("el.pagination.pagesize")
  38578. }, null, 8, ["value", "label"]);
  38579. }), 128))
  38580. ]),
  38581. _: 1
  38582. }, 8, ["model-value", "disabled", "popper-class", "popper-style", "size", "teleported", "append-to"])
  38583. ], 2);
  38584. };
  38585. }
  38586. });
  38587. var Sizes = /* @__PURE__ */ _export_sfc(_sfc_main$U, [["__file", "sizes.vue"]]);
  38588. const paginationJumperProps = buildProps({
  38589. size: {
  38590. type: String,
  38591. values: componentSizes
  38592. }
  38593. });
  38594. const __default__$J = vue.defineComponent({
  38595. name: "ElPaginationJumper"
  38596. });
  38597. const _sfc_main$T = /* @__PURE__ */ vue.defineComponent({
  38598. ...__default__$J,
  38599. props: paginationJumperProps,
  38600. setup(__props) {
  38601. const { t } = useLocale();
  38602. const ns = useNamespace("pagination");
  38603. const { pageCount, disabled, currentPage, changeEvent } = usePagination();
  38604. const userInput = vue.ref();
  38605. const innerValue = vue.computed(() => {
  38606. var _a;
  38607. return (_a = userInput.value) != null ? _a : currentPage == null ? void 0 : currentPage.value;
  38608. });
  38609. function handleInput(val) {
  38610. userInput.value = val ? +val : "";
  38611. }
  38612. function handleChange(val) {
  38613. val = Math.trunc(+val);
  38614. changeEvent == null ? void 0 : changeEvent(val);
  38615. userInput.value = void 0;
  38616. }
  38617. return (_ctx, _cache) => {
  38618. return vue.openBlock(), vue.createElementBlock("span", {
  38619. class: vue.normalizeClass(vue.unref(ns).e("jump")),
  38620. disabled: vue.unref(disabled)
  38621. }, [
  38622. vue.createElementVNode("span", {
  38623. class: vue.normalizeClass([vue.unref(ns).e("goto")])
  38624. }, vue.toDisplayString(vue.unref(t)("el.pagination.goto")), 3),
  38625. vue.createVNode(vue.unref(ElInput), {
  38626. size: _ctx.size,
  38627. class: vue.normalizeClass([vue.unref(ns).e("editor"), vue.unref(ns).is("in-pagination")]),
  38628. min: 1,
  38629. max: vue.unref(pageCount),
  38630. disabled: vue.unref(disabled),
  38631. "model-value": vue.unref(innerValue),
  38632. "validate-event": false,
  38633. "aria-label": vue.unref(t)("el.pagination.page"),
  38634. type: "number",
  38635. "onUpdate:modelValue": handleInput,
  38636. onChange: handleChange
  38637. }, null, 8, ["size", "class", "max", "disabled", "model-value", "aria-label"]),
  38638. vue.createElementVNode("span", {
  38639. class: vue.normalizeClass([vue.unref(ns).e("classifier")])
  38640. }, vue.toDisplayString(vue.unref(t)("el.pagination.pageClassifier")), 3)
  38641. ], 10, ["disabled"]);
  38642. };
  38643. }
  38644. });
  38645. var Jumper = /* @__PURE__ */ _export_sfc(_sfc_main$T, [["__file", "jumper.vue"]]);
  38646. const paginationTotalProps = buildProps({
  38647. total: {
  38648. type: Number,
  38649. default: 1e3
  38650. }
  38651. });
  38652. const __default__$I = vue.defineComponent({
  38653. name: "ElPaginationTotal"
  38654. });
  38655. const _sfc_main$S = /* @__PURE__ */ vue.defineComponent({
  38656. ...__default__$I,
  38657. props: paginationTotalProps,
  38658. setup(__props) {
  38659. const { t } = useLocale();
  38660. const ns = useNamespace("pagination");
  38661. const { disabled } = usePagination();
  38662. return (_ctx, _cache) => {
  38663. return vue.openBlock(), vue.createElementBlock("span", {
  38664. class: vue.normalizeClass(vue.unref(ns).e("total")),
  38665. disabled: vue.unref(disabled)
  38666. }, vue.toDisplayString(vue.unref(t)("el.pagination.total", {
  38667. total: _ctx.total
  38668. })), 11, ["disabled"]);
  38669. };
  38670. }
  38671. });
  38672. var Total = /* @__PURE__ */ _export_sfc(_sfc_main$S, [["__file", "total.vue"]]);
  38673. const paginationPagerProps = buildProps({
  38674. currentPage: {
  38675. type: Number,
  38676. default: 1
  38677. },
  38678. pageCount: {
  38679. type: Number,
  38680. required: true
  38681. },
  38682. pagerCount: {
  38683. type: Number,
  38684. default: 7
  38685. },
  38686. disabled: Boolean
  38687. });
  38688. const __default__$H = vue.defineComponent({
  38689. name: "ElPaginationPager"
  38690. });
  38691. const _sfc_main$R = /* @__PURE__ */ vue.defineComponent({
  38692. ...__default__$H,
  38693. props: paginationPagerProps,
  38694. emits: [CHANGE_EVENT],
  38695. setup(__props, { emit }) {
  38696. const props = __props;
  38697. const nsPager = useNamespace("pager");
  38698. const nsIcon = useNamespace("icon");
  38699. const { t } = useLocale();
  38700. const showPrevMore = vue.ref(false);
  38701. const showNextMore = vue.ref(false);
  38702. const quickPrevHover = vue.ref(false);
  38703. const quickNextHover = vue.ref(false);
  38704. const quickPrevFocus = vue.ref(false);
  38705. const quickNextFocus = vue.ref(false);
  38706. const pagers = vue.computed(() => {
  38707. const pagerCount = props.pagerCount;
  38708. const halfPagerCount = (pagerCount - 1) / 2;
  38709. const currentPage = Number(props.currentPage);
  38710. const pageCount = Number(props.pageCount);
  38711. let showPrevMore2 = false;
  38712. let showNextMore2 = false;
  38713. if (pageCount > pagerCount) {
  38714. if (currentPage > pagerCount - halfPagerCount) {
  38715. showPrevMore2 = true;
  38716. }
  38717. if (currentPage < pageCount - halfPagerCount) {
  38718. showNextMore2 = true;
  38719. }
  38720. }
  38721. const array = [];
  38722. if (showPrevMore2 && !showNextMore2) {
  38723. const startPage = pageCount - (pagerCount - 2);
  38724. for (let i = startPage; i < pageCount; i++) {
  38725. array.push(i);
  38726. }
  38727. } else if (!showPrevMore2 && showNextMore2) {
  38728. for (let i = 2; i < pagerCount; i++) {
  38729. array.push(i);
  38730. }
  38731. } else if (showPrevMore2 && showNextMore2) {
  38732. const offset = Math.floor(pagerCount / 2) - 1;
  38733. for (let i = currentPage - offset; i <= currentPage + offset; i++) {
  38734. array.push(i);
  38735. }
  38736. } else {
  38737. for (let i = 2; i < pageCount; i++) {
  38738. array.push(i);
  38739. }
  38740. }
  38741. return array;
  38742. });
  38743. const prevMoreKls = vue.computed(() => [
  38744. "more",
  38745. "btn-quickprev",
  38746. nsIcon.b(),
  38747. nsPager.is("disabled", props.disabled)
  38748. ]);
  38749. const nextMoreKls = vue.computed(() => [
  38750. "more",
  38751. "btn-quicknext",
  38752. nsIcon.b(),
  38753. nsPager.is("disabled", props.disabled)
  38754. ]);
  38755. const tabindex = vue.computed(() => props.disabled ? -1 : 0);
  38756. vue.watch(() => [props.pageCount, props.pagerCount, props.currentPage], ([pageCount, pagerCount, currentPage]) => {
  38757. const halfPagerCount = (pagerCount - 1) / 2;
  38758. let showPrev = false;
  38759. let showNext = false;
  38760. if (pageCount > pagerCount) {
  38761. showPrev = currentPage > pagerCount - halfPagerCount;
  38762. showNext = currentPage < pageCount - halfPagerCount;
  38763. }
  38764. quickPrevHover.value && (quickPrevHover.value = showPrev);
  38765. quickNextHover.value && (quickNextHover.value = showNext);
  38766. showPrevMore.value = showPrev;
  38767. showNextMore.value = showNext;
  38768. }, { immediate: true });
  38769. function onMouseEnter(forward = false) {
  38770. if (props.disabled)
  38771. return;
  38772. if (forward) {
  38773. quickPrevHover.value = true;
  38774. } else {
  38775. quickNextHover.value = true;
  38776. }
  38777. }
  38778. function onFocus(forward = false) {
  38779. if (forward) {
  38780. quickPrevFocus.value = true;
  38781. } else {
  38782. quickNextFocus.value = true;
  38783. }
  38784. }
  38785. function onEnter(e) {
  38786. const target = e.target;
  38787. if (target.tagName.toLowerCase() === "li" && Array.from(target.classList).includes("number")) {
  38788. const newPage = Number(target.textContent);
  38789. if (newPage !== props.currentPage) {
  38790. emit(CHANGE_EVENT, newPage);
  38791. }
  38792. } else if (target.tagName.toLowerCase() === "li" && Array.from(target.classList).includes("more")) {
  38793. onPagerClick(e);
  38794. }
  38795. }
  38796. function onPagerClick(event) {
  38797. const target = event.target;
  38798. if (target.tagName.toLowerCase() === "ul" || props.disabled) {
  38799. return;
  38800. }
  38801. let newPage = Number(target.textContent);
  38802. const pageCount = props.pageCount;
  38803. const currentPage = props.currentPage;
  38804. const pagerCountOffset = props.pagerCount - 2;
  38805. if (target.className.includes("more")) {
  38806. if (target.className.includes("quickprev")) {
  38807. newPage = currentPage - pagerCountOffset;
  38808. } else if (target.className.includes("quicknext")) {
  38809. newPage = currentPage + pagerCountOffset;
  38810. }
  38811. }
  38812. if (!Number.isNaN(+newPage)) {
  38813. if (newPage < 1) {
  38814. newPage = 1;
  38815. }
  38816. if (newPage > pageCount) {
  38817. newPage = pageCount;
  38818. }
  38819. }
  38820. if (newPage !== currentPage) {
  38821. emit(CHANGE_EVENT, newPage);
  38822. }
  38823. }
  38824. return (_ctx, _cache) => {
  38825. return vue.openBlock(), vue.createElementBlock("ul", {
  38826. class: vue.normalizeClass(vue.unref(nsPager).b()),
  38827. onClick: onPagerClick,
  38828. onKeyup: vue.withKeys(onEnter, ["enter"])
  38829. }, [
  38830. _ctx.pageCount > 0 ? (vue.openBlock(), vue.createElementBlock("li", {
  38831. key: 0,
  38832. class: vue.normalizeClass([[
  38833. vue.unref(nsPager).is("active", _ctx.currentPage === 1),
  38834. vue.unref(nsPager).is("disabled", _ctx.disabled)
  38835. ], "number"]),
  38836. "aria-current": _ctx.currentPage === 1,
  38837. "aria-label": vue.unref(t)("el.pagination.currentPage", { pager: 1 }),
  38838. tabindex: vue.unref(tabindex)
  38839. }, " 1 ", 10, ["aria-current", "aria-label", "tabindex"])) : vue.createCommentVNode("v-if", true),
  38840. showPrevMore.value ? (vue.openBlock(), vue.createElementBlock("li", {
  38841. key: 1,
  38842. class: vue.normalizeClass(vue.unref(prevMoreKls)),
  38843. tabindex: vue.unref(tabindex),
  38844. "aria-label": vue.unref(t)("el.pagination.prevPages", { pager: _ctx.pagerCount - 2 }),
  38845. onMouseenter: ($event) => onMouseEnter(true),
  38846. onMouseleave: ($event) => quickPrevHover.value = false,
  38847. onFocus: ($event) => onFocus(true),
  38848. onBlur: ($event) => quickPrevFocus.value = false
  38849. }, [
  38850. (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 }))
  38851. ], 42, ["tabindex", "aria-label", "onMouseenter", "onMouseleave", "onFocus", "onBlur"])) : vue.createCommentVNode("v-if", true),
  38852. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(pagers), (pager) => {
  38853. return vue.openBlock(), vue.createElementBlock("li", {
  38854. key: pager,
  38855. class: vue.normalizeClass([[
  38856. vue.unref(nsPager).is("active", _ctx.currentPage === pager),
  38857. vue.unref(nsPager).is("disabled", _ctx.disabled)
  38858. ], "number"]),
  38859. "aria-current": _ctx.currentPage === pager,
  38860. "aria-label": vue.unref(t)("el.pagination.currentPage", { pager }),
  38861. tabindex: vue.unref(tabindex)
  38862. }, vue.toDisplayString(pager), 11, ["aria-current", "aria-label", "tabindex"]);
  38863. }), 128)),
  38864. showNextMore.value ? (vue.openBlock(), vue.createElementBlock("li", {
  38865. key: 2,
  38866. class: vue.normalizeClass(vue.unref(nextMoreKls)),
  38867. tabindex: vue.unref(tabindex),
  38868. "aria-label": vue.unref(t)("el.pagination.nextPages", { pager: _ctx.pagerCount - 2 }),
  38869. onMouseenter: ($event) => onMouseEnter(),
  38870. onMouseleave: ($event) => quickNextHover.value = false,
  38871. onFocus: ($event) => onFocus(),
  38872. onBlur: ($event) => quickNextFocus.value = false
  38873. }, [
  38874. (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 }))
  38875. ], 42, ["tabindex", "aria-label", "onMouseenter", "onMouseleave", "onFocus", "onBlur"])) : vue.createCommentVNode("v-if", true),
  38876. _ctx.pageCount > 1 ? (vue.openBlock(), vue.createElementBlock("li", {
  38877. key: 3,
  38878. class: vue.normalizeClass([[
  38879. vue.unref(nsPager).is("active", _ctx.currentPage === _ctx.pageCount),
  38880. vue.unref(nsPager).is("disabled", _ctx.disabled)
  38881. ], "number"]),
  38882. "aria-current": _ctx.currentPage === _ctx.pageCount,
  38883. "aria-label": vue.unref(t)("el.pagination.currentPage", { pager: _ctx.pageCount }),
  38884. tabindex: vue.unref(tabindex)
  38885. }, vue.toDisplayString(_ctx.pageCount), 11, ["aria-current", "aria-label", "tabindex"])) : vue.createCommentVNode("v-if", true)
  38886. ], 42, ["onKeyup"]);
  38887. };
  38888. }
  38889. });
  38890. var Pager = /* @__PURE__ */ _export_sfc(_sfc_main$R, [["__file", "pager.vue"]]);
  38891. const isAbsent = (v) => typeof v !== "number";
  38892. const paginationProps = buildProps({
  38893. pageSize: Number,
  38894. defaultPageSize: Number,
  38895. total: Number,
  38896. pageCount: Number,
  38897. pagerCount: {
  38898. type: Number,
  38899. validator: (value) => {
  38900. return isNumber(value) && Math.trunc(value) === value && value > 4 && value < 22 && value % 2 === 1;
  38901. },
  38902. default: 7
  38903. },
  38904. currentPage: Number,
  38905. defaultCurrentPage: Number,
  38906. layout: {
  38907. type: String,
  38908. default: ["prev", "pager", "next", "jumper", "->", "total"].join(", ")
  38909. },
  38910. pageSizes: {
  38911. type: definePropType(Array),
  38912. default: () => mutable([10, 20, 30, 40, 50, 100])
  38913. },
  38914. popperClass: {
  38915. type: String,
  38916. default: ""
  38917. },
  38918. popperStyle: {
  38919. type: definePropType([String, Object])
  38920. },
  38921. prevText: {
  38922. type: String,
  38923. default: ""
  38924. },
  38925. prevIcon: {
  38926. type: iconPropType,
  38927. default: () => arrow_left_default
  38928. },
  38929. nextText: {
  38930. type: String,
  38931. default: ""
  38932. },
  38933. nextIcon: {
  38934. type: iconPropType,
  38935. default: () => arrow_right_default
  38936. },
  38937. teleported: {
  38938. type: Boolean,
  38939. default: true
  38940. },
  38941. small: Boolean,
  38942. size: useSizeProp,
  38943. background: Boolean,
  38944. disabled: Boolean,
  38945. hideOnSinglePage: Boolean,
  38946. appendSizeTo: String
  38947. });
  38948. const paginationEmits = {
  38949. "update:current-page": (val) => isNumber(val),
  38950. "update:page-size": (val) => isNumber(val),
  38951. "size-change": (val) => isNumber(val),
  38952. change: (currentPage, pageSize) => isNumber(currentPage) && isNumber(pageSize),
  38953. "current-change": (val) => isNumber(val),
  38954. "prev-click": (val) => isNumber(val),
  38955. "next-click": (val) => isNumber(val)
  38956. };
  38957. const componentName = "ElPagination";
  38958. var Pagination = vue.defineComponent({
  38959. name: componentName,
  38960. props: paginationProps,
  38961. emits: paginationEmits,
  38962. setup(props, { emit, slots }) {
  38963. const { t } = useLocale();
  38964. const ns = useNamespace("pagination");
  38965. const vnodeProps = vue.getCurrentInstance().vnode.props || {};
  38966. const _globalSize = useGlobalSize();
  38967. const _size = vue.computed(() => {
  38968. var _a;
  38969. return props.small ? "small" : (_a = props.size) != null ? _a : _globalSize.value;
  38970. });
  38971. useDeprecated({
  38972. from: "small",
  38973. replacement: "size",
  38974. version: "3.0.0",
  38975. scope: "el-pagination",
  38976. ref: "https://element-plus.org/zh-CN/component/pagination.html"
  38977. }, vue.computed(() => !!props.small));
  38978. const hasCurrentPageListener = "onUpdate:currentPage" in vnodeProps || "onUpdate:current-page" in vnodeProps || "onCurrentChange" in vnodeProps;
  38979. const hasPageSizeListener = "onUpdate:pageSize" in vnodeProps || "onUpdate:page-size" in vnodeProps || "onSizeChange" in vnodeProps;
  38980. const assertValidUsage = vue.computed(() => {
  38981. if (isAbsent(props.total) && isAbsent(props.pageCount))
  38982. return false;
  38983. if (!isAbsent(props.currentPage) && !hasCurrentPageListener)
  38984. return false;
  38985. if (props.layout.includes("sizes")) {
  38986. if (!isAbsent(props.pageCount)) {
  38987. if (!hasPageSizeListener)
  38988. return false;
  38989. } else if (!isAbsent(props.total)) {
  38990. if (!isAbsent(props.pageSize)) {
  38991. if (!hasPageSizeListener) {
  38992. return false;
  38993. }
  38994. }
  38995. }
  38996. }
  38997. return true;
  38998. });
  38999. const innerPageSize = vue.ref(isAbsent(props.defaultPageSize) ? 10 : props.defaultPageSize);
  39000. const innerCurrentPage = vue.ref(isAbsent(props.defaultCurrentPage) ? 1 : props.defaultCurrentPage);
  39001. const pageSizeBridge = vue.computed({
  39002. get() {
  39003. return isAbsent(props.pageSize) ? innerPageSize.value : props.pageSize;
  39004. },
  39005. set(v) {
  39006. if (isAbsent(props.pageSize)) {
  39007. innerPageSize.value = v;
  39008. }
  39009. if (hasPageSizeListener) {
  39010. emit("update:page-size", v);
  39011. emit("size-change", v);
  39012. }
  39013. }
  39014. });
  39015. const pageCountBridge = vue.computed(() => {
  39016. let pageCount = 0;
  39017. if (!isAbsent(props.pageCount)) {
  39018. pageCount = props.pageCount;
  39019. } else if (!isAbsent(props.total)) {
  39020. pageCount = Math.max(1, Math.ceil(props.total / pageSizeBridge.value));
  39021. }
  39022. return pageCount;
  39023. });
  39024. const currentPageBridge = vue.computed({
  39025. get() {
  39026. return isAbsent(props.currentPage) ? innerCurrentPage.value : props.currentPage;
  39027. },
  39028. set(v) {
  39029. let newCurrentPage = v;
  39030. if (v < 1) {
  39031. newCurrentPage = 1;
  39032. } else if (v > pageCountBridge.value) {
  39033. newCurrentPage = pageCountBridge.value;
  39034. }
  39035. if (isAbsent(props.currentPage)) {
  39036. innerCurrentPage.value = newCurrentPage;
  39037. }
  39038. if (hasCurrentPageListener) {
  39039. emit("update:current-page", newCurrentPage);
  39040. emit("current-change", newCurrentPage);
  39041. }
  39042. }
  39043. });
  39044. vue.watch(pageCountBridge, (val) => {
  39045. if (currentPageBridge.value > val)
  39046. currentPageBridge.value = val;
  39047. });
  39048. vue.watch([currentPageBridge, pageSizeBridge], (value) => {
  39049. emit(CHANGE_EVENT, ...value);
  39050. }, { flush: "post" });
  39051. function handleCurrentChange(val) {
  39052. currentPageBridge.value = val;
  39053. }
  39054. function handleSizeChange(val) {
  39055. pageSizeBridge.value = val;
  39056. const newPageCount = pageCountBridge.value;
  39057. if (currentPageBridge.value > newPageCount) {
  39058. currentPageBridge.value = newPageCount;
  39059. }
  39060. }
  39061. function prev() {
  39062. if (props.disabled)
  39063. return;
  39064. currentPageBridge.value -= 1;
  39065. emit("prev-click", currentPageBridge.value);
  39066. }
  39067. function next() {
  39068. if (props.disabled)
  39069. return;
  39070. currentPageBridge.value += 1;
  39071. emit("next-click", currentPageBridge.value);
  39072. }
  39073. function addClass(element, cls) {
  39074. if (element) {
  39075. if (!element.props) {
  39076. element.props = {};
  39077. }
  39078. element.props.class = [element.props.class, cls].join(" ");
  39079. }
  39080. }
  39081. vue.provide(elPaginationKey, {
  39082. pageCount: pageCountBridge,
  39083. disabled: vue.computed(() => props.disabled),
  39084. currentPage: currentPageBridge,
  39085. changeEvent: handleCurrentChange,
  39086. handleSizeChange
  39087. });
  39088. return () => {
  39089. var _a, _b;
  39090. if (!assertValidUsage.value) {
  39091. debugWarn(componentName, t("el.pagination.deprecationWarning"));
  39092. return null;
  39093. }
  39094. if (!props.layout)
  39095. return null;
  39096. if (props.hideOnSinglePage && pageCountBridge.value <= 1)
  39097. return null;
  39098. const rootChildren = [];
  39099. const rightWrapperChildren = [];
  39100. const rightWrapperRoot = vue.h("div", { class: ns.e("rightwrapper") }, rightWrapperChildren);
  39101. const TEMPLATE_MAP = {
  39102. prev: vue.h(Prev, {
  39103. disabled: props.disabled,
  39104. currentPage: currentPageBridge.value,
  39105. prevText: props.prevText,
  39106. prevIcon: props.prevIcon,
  39107. onClick: prev
  39108. }),
  39109. jumper: vue.h(Jumper, {
  39110. size: _size.value
  39111. }),
  39112. pager: vue.h(Pager, {
  39113. currentPage: currentPageBridge.value,
  39114. pageCount: pageCountBridge.value,
  39115. pagerCount: props.pagerCount,
  39116. onChange: handleCurrentChange,
  39117. disabled: props.disabled
  39118. }),
  39119. next: vue.h(Next, {
  39120. disabled: props.disabled,
  39121. currentPage: currentPageBridge.value,
  39122. pageCount: pageCountBridge.value,
  39123. nextText: props.nextText,
  39124. nextIcon: props.nextIcon,
  39125. onClick: next
  39126. }),
  39127. sizes: vue.h(Sizes, {
  39128. pageSize: pageSizeBridge.value,
  39129. pageSizes: props.pageSizes,
  39130. popperClass: props.popperClass,
  39131. popperStyle: props.popperStyle,
  39132. disabled: props.disabled,
  39133. teleported: props.teleported,
  39134. size: _size.value,
  39135. appendSizeTo: props.appendSizeTo
  39136. }),
  39137. slot: (_b = (_a = slots == null ? void 0 : slots.default) == null ? void 0 : _a.call(slots)) != null ? _b : null,
  39138. total: vue.h(Total, { total: isAbsent(props.total) ? 0 : props.total })
  39139. };
  39140. const components = props.layout.split(",").map((item) => item.trim());
  39141. let haveRightWrapper = false;
  39142. components.forEach((c) => {
  39143. if (c === "->") {
  39144. haveRightWrapper = true;
  39145. return;
  39146. }
  39147. if (!haveRightWrapper) {
  39148. rootChildren.push(TEMPLATE_MAP[c]);
  39149. } else {
  39150. rightWrapperChildren.push(TEMPLATE_MAP[c]);
  39151. }
  39152. });
  39153. addClass(rootChildren[0], ns.is("first"));
  39154. addClass(rootChildren[rootChildren.length - 1], ns.is("last"));
  39155. if (haveRightWrapper && rightWrapperChildren.length > 0) {
  39156. addClass(rightWrapperChildren[0], ns.is("first"));
  39157. addClass(rightWrapperChildren[rightWrapperChildren.length - 1], ns.is("last"));
  39158. rootChildren.push(rightWrapperRoot);
  39159. }
  39160. return vue.h("div", {
  39161. class: [
  39162. ns.b(),
  39163. ns.is("background", props.background),
  39164. ns.m(_size.value)
  39165. ]
  39166. }, rootChildren);
  39167. };
  39168. }
  39169. });
  39170. const ElPagination = withInstall(Pagination);
  39171. const popconfirmProps = buildProps({
  39172. title: String,
  39173. confirmButtonText: String,
  39174. cancelButtonText: String,
  39175. confirmButtonType: {
  39176. type: String,
  39177. values: buttonTypes,
  39178. default: "primary"
  39179. },
  39180. cancelButtonType: {
  39181. type: String,
  39182. values: buttonTypes,
  39183. default: "text"
  39184. },
  39185. icon: {
  39186. type: iconPropType,
  39187. default: () => question_filled_default
  39188. },
  39189. iconColor: {
  39190. type: String,
  39191. default: "#f90"
  39192. },
  39193. hideIcon: Boolean,
  39194. hideAfter: {
  39195. type: Number,
  39196. default: 200
  39197. },
  39198. effect: {
  39199. ...useTooltipContentProps.effect,
  39200. default: "light"
  39201. },
  39202. teleported: useTooltipContentProps.teleported,
  39203. persistent: useTooltipContentProps.persistent,
  39204. width: {
  39205. type: [String, Number],
  39206. default: 150
  39207. },
  39208. virtualTriggering: useTooltipTriggerProps.virtualTriggering,
  39209. virtualRef: useTooltipTriggerProps.virtualRef
  39210. });
  39211. const popconfirmEmits = {
  39212. confirm: (e) => e instanceof MouseEvent,
  39213. cancel: (e) => e instanceof MouseEvent
  39214. };
  39215. const __default__$G = vue.defineComponent({
  39216. name: "ElPopconfirm"
  39217. });
  39218. const _sfc_main$Q = /* @__PURE__ */ vue.defineComponent({
  39219. ...__default__$G,
  39220. props: popconfirmProps,
  39221. emits: popconfirmEmits,
  39222. setup(__props, { expose, emit }) {
  39223. const props = __props;
  39224. const { t } = useLocale();
  39225. const ns = useNamespace("popconfirm");
  39226. const tooltipRef = vue.ref();
  39227. const rootRef = vue.ref();
  39228. const popperRef = vue.computed(() => {
  39229. var _a;
  39230. return (_a = vue.unref(tooltipRef)) == null ? void 0 : _a.popperRef;
  39231. });
  39232. const showPopper = () => {
  39233. var _a, _b;
  39234. (_b = (_a = rootRef.value) == null ? void 0 : _a.focus) == null ? void 0 : _b.call(_a);
  39235. };
  39236. const hidePopper = () => {
  39237. var _a, _b;
  39238. (_b = (_a = tooltipRef.value) == null ? void 0 : _a.onClose) == null ? void 0 : _b.call(_a);
  39239. };
  39240. const style = vue.computed(() => {
  39241. return {
  39242. width: addUnit(props.width)
  39243. };
  39244. });
  39245. const confirm = (e) => {
  39246. emit("confirm", e);
  39247. hidePopper();
  39248. };
  39249. const cancel = (e) => {
  39250. emit("cancel", e);
  39251. hidePopper();
  39252. };
  39253. const finalConfirmButtonText = vue.computed(() => props.confirmButtonText || t("el.popconfirm.confirmButtonText"));
  39254. const finalCancelButtonText = vue.computed(() => props.cancelButtonText || t("el.popconfirm.cancelButtonText"));
  39255. expose({
  39256. popperRef,
  39257. hide: hidePopper
  39258. });
  39259. return (_ctx, _cache) => {
  39260. return vue.openBlock(), vue.createBlock(vue.unref(ElTooltip), vue.mergeProps({
  39261. ref_key: "tooltipRef",
  39262. ref: tooltipRef,
  39263. trigger: "click",
  39264. effect: _ctx.effect
  39265. }, _ctx.$attrs, {
  39266. "popper-class": `${vue.unref(ns).namespace.value}-popover`,
  39267. "popper-style": vue.unref(style),
  39268. teleported: _ctx.teleported,
  39269. "fallback-placements": ["bottom", "top", "right", "left"],
  39270. "hide-after": _ctx.hideAfter,
  39271. persistent: _ctx.persistent,
  39272. loop: "",
  39273. onShow: showPopper
  39274. }), {
  39275. content: vue.withCtx(() => [
  39276. vue.createElementVNode("div", {
  39277. ref_key: "rootRef",
  39278. ref: rootRef,
  39279. tabindex: "-1",
  39280. class: vue.normalizeClass(vue.unref(ns).b())
  39281. }, [
  39282. vue.createElementVNode("div", {
  39283. class: vue.normalizeClass(vue.unref(ns).e("main"))
  39284. }, [
  39285. !_ctx.hideIcon && _ctx.icon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  39286. key: 0,
  39287. class: vue.normalizeClass(vue.unref(ns).e("icon")),
  39288. style: vue.normalizeStyle({ color: _ctx.iconColor })
  39289. }, {
  39290. default: vue.withCtx(() => [
  39291. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.icon)))
  39292. ]),
  39293. _: 1
  39294. }, 8, ["class", "style"])) : vue.createCommentVNode("v-if", true),
  39295. vue.createTextVNode(" " + vue.toDisplayString(_ctx.title), 1)
  39296. ], 2),
  39297. vue.createElementVNode("div", {
  39298. class: vue.normalizeClass(vue.unref(ns).e("action"))
  39299. }, [
  39300. vue.renderSlot(_ctx.$slots, "actions", {
  39301. confirm,
  39302. cancel
  39303. }, () => [
  39304. vue.createVNode(vue.unref(ElButton), {
  39305. size: "small",
  39306. type: _ctx.cancelButtonType === "text" ? "" : _ctx.cancelButtonType,
  39307. text: _ctx.cancelButtonType === "text",
  39308. onClick: cancel
  39309. }, {
  39310. default: vue.withCtx(() => [
  39311. vue.createTextVNode(vue.toDisplayString(vue.unref(finalCancelButtonText)), 1)
  39312. ]),
  39313. _: 1
  39314. }, 8, ["type", "text"]),
  39315. vue.createVNode(vue.unref(ElButton), {
  39316. size: "small",
  39317. type: _ctx.confirmButtonType === "text" ? "" : _ctx.confirmButtonType,
  39318. text: _ctx.confirmButtonType === "text",
  39319. onClick: confirm
  39320. }, {
  39321. default: vue.withCtx(() => [
  39322. vue.createTextVNode(vue.toDisplayString(vue.unref(finalConfirmButtonText)), 1)
  39323. ]),
  39324. _: 1
  39325. }, 8, ["type", "text"])
  39326. ])
  39327. ], 2)
  39328. ], 2)
  39329. ]),
  39330. default: vue.withCtx(() => [
  39331. _ctx.$slots.reference ? vue.renderSlot(_ctx.$slots, "reference", { key: 0 }) : vue.createCommentVNode("v-if", true)
  39332. ]),
  39333. _: 3
  39334. }, 16, ["effect", "popper-class", "popper-style", "teleported", "hide-after", "persistent"]);
  39335. };
  39336. }
  39337. });
  39338. var Popconfirm = /* @__PURE__ */ _export_sfc(_sfc_main$Q, [["__file", "popconfirm.vue"]]);
  39339. const ElPopconfirm = withInstall(Popconfirm);
  39340. const popoverProps = buildProps({
  39341. trigger: useTooltipTriggerProps.trigger,
  39342. triggerKeys: useTooltipTriggerProps.triggerKeys,
  39343. placement: dropdownProps.placement,
  39344. disabled: useTooltipTriggerProps.disabled,
  39345. visible: useTooltipContentProps.visible,
  39346. transition: useTooltipContentProps.transition,
  39347. popperOptions: dropdownProps.popperOptions,
  39348. tabindex: dropdownProps.tabindex,
  39349. content: useTooltipContentProps.content,
  39350. popperStyle: useTooltipContentProps.popperStyle,
  39351. popperClass: useTooltipContentProps.popperClass,
  39352. enterable: {
  39353. ...useTooltipContentProps.enterable,
  39354. default: true
  39355. },
  39356. effect: {
  39357. ...useTooltipContentProps.effect,
  39358. default: "light"
  39359. },
  39360. teleported: useTooltipContentProps.teleported,
  39361. appendTo: useTooltipContentProps.appendTo,
  39362. title: String,
  39363. width: {
  39364. type: [String, Number],
  39365. default: 150
  39366. },
  39367. offset: {
  39368. type: Number,
  39369. default: void 0
  39370. },
  39371. showAfter: {
  39372. type: Number,
  39373. default: 0
  39374. },
  39375. hideAfter: {
  39376. type: Number,
  39377. default: 200
  39378. },
  39379. autoClose: {
  39380. type: Number,
  39381. default: 0
  39382. },
  39383. showArrow: {
  39384. type: Boolean,
  39385. default: true
  39386. },
  39387. persistent: {
  39388. type: Boolean,
  39389. default: true
  39390. },
  39391. "onUpdate:visible": {
  39392. type: Function
  39393. }
  39394. });
  39395. const popoverEmits = {
  39396. "update:visible": (value) => isBoolean(value),
  39397. "before-enter": () => true,
  39398. "before-leave": () => true,
  39399. "after-enter": () => true,
  39400. "after-leave": () => true
  39401. };
  39402. const updateEventKeyRaw = `onUpdate:visible`;
  39403. const __default__$F = vue.defineComponent({
  39404. name: "ElPopover"
  39405. });
  39406. const _sfc_main$P = /* @__PURE__ */ vue.defineComponent({
  39407. ...__default__$F,
  39408. props: popoverProps,
  39409. emits: popoverEmits,
  39410. setup(__props, { expose, emit }) {
  39411. const props = __props;
  39412. const onUpdateVisible = vue.computed(() => {
  39413. return props[updateEventKeyRaw];
  39414. });
  39415. const ns = useNamespace("popover");
  39416. const tooltipRef = vue.ref();
  39417. const popperRef = vue.computed(() => {
  39418. var _a;
  39419. return (_a = vue.unref(tooltipRef)) == null ? void 0 : _a.popperRef;
  39420. });
  39421. const style = vue.computed(() => {
  39422. return [
  39423. {
  39424. width: addUnit(props.width)
  39425. },
  39426. props.popperStyle
  39427. ];
  39428. });
  39429. const kls = vue.computed(() => {
  39430. return [ns.b(), props.popperClass, { [ns.m("plain")]: !!props.content }];
  39431. });
  39432. const gpuAcceleration = vue.computed(() => {
  39433. return props.transition === `${ns.namespace.value}-fade-in-linear`;
  39434. });
  39435. const hide = () => {
  39436. var _a;
  39437. (_a = tooltipRef.value) == null ? void 0 : _a.hide();
  39438. };
  39439. const beforeEnter = () => {
  39440. emit("before-enter");
  39441. };
  39442. const beforeLeave = () => {
  39443. emit("before-leave");
  39444. };
  39445. const afterEnter = () => {
  39446. emit("after-enter");
  39447. };
  39448. const afterLeave = () => {
  39449. emit("update:visible", false);
  39450. emit("after-leave");
  39451. };
  39452. expose({
  39453. popperRef,
  39454. hide
  39455. });
  39456. return (_ctx, _cache) => {
  39457. return vue.openBlock(), vue.createBlock(vue.unref(ElTooltip), vue.mergeProps({
  39458. ref_key: "tooltipRef",
  39459. ref: tooltipRef
  39460. }, _ctx.$attrs, {
  39461. trigger: _ctx.trigger,
  39462. "trigger-keys": _ctx.triggerKeys,
  39463. placement: _ctx.placement,
  39464. disabled: _ctx.disabled,
  39465. visible: _ctx.visible,
  39466. transition: _ctx.transition,
  39467. "popper-options": _ctx.popperOptions,
  39468. tabindex: _ctx.tabindex,
  39469. content: _ctx.content,
  39470. offset: _ctx.offset,
  39471. "show-after": _ctx.showAfter,
  39472. "hide-after": _ctx.hideAfter,
  39473. "auto-close": _ctx.autoClose,
  39474. "show-arrow": _ctx.showArrow,
  39475. "aria-label": _ctx.title,
  39476. effect: _ctx.effect,
  39477. enterable: _ctx.enterable,
  39478. "popper-class": vue.unref(kls),
  39479. "popper-style": vue.unref(style),
  39480. teleported: _ctx.teleported,
  39481. "append-to": _ctx.appendTo,
  39482. persistent: _ctx.persistent,
  39483. "gpu-acceleration": vue.unref(gpuAcceleration),
  39484. "onUpdate:visible": vue.unref(onUpdateVisible),
  39485. onBeforeShow: beforeEnter,
  39486. onBeforeHide: beforeLeave,
  39487. onShow: afterEnter,
  39488. onHide: afterLeave
  39489. }), {
  39490. content: vue.withCtx(() => [
  39491. _ctx.title ? (vue.openBlock(), vue.createElementBlock("div", {
  39492. key: 0,
  39493. class: vue.normalizeClass(vue.unref(ns).e("title")),
  39494. role: "title"
  39495. }, vue.toDisplayString(_ctx.title), 3)) : vue.createCommentVNode("v-if", true),
  39496. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  39497. vue.createTextVNode(vue.toDisplayString(_ctx.content), 1)
  39498. ])
  39499. ]),
  39500. default: vue.withCtx(() => [
  39501. _ctx.$slots.reference ? vue.renderSlot(_ctx.$slots, "reference", { key: 0 }) : vue.createCommentVNode("v-if", true)
  39502. ]),
  39503. _: 3
  39504. }, 16, ["trigger", "trigger-keys", "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", "append-to", "persistent", "gpu-acceleration", "onUpdate:visible"]);
  39505. };
  39506. }
  39507. });
  39508. var Popover = /* @__PURE__ */ _export_sfc(_sfc_main$P, [["__file", "popover.vue"]]);
  39509. const attachEvents = (el, binding) => {
  39510. const popperComponent = binding.arg || binding.value;
  39511. const popover = popperComponent == null ? void 0 : popperComponent.popperRef;
  39512. if (popover) {
  39513. popover.triggerRef = el;
  39514. }
  39515. };
  39516. var PopoverDirective = {
  39517. mounted(el, binding) {
  39518. attachEvents(el, binding);
  39519. },
  39520. updated(el, binding) {
  39521. attachEvents(el, binding);
  39522. }
  39523. };
  39524. const VPopover = "popover";
  39525. const ElPopoverDirective = withInstallDirective(PopoverDirective, VPopover);
  39526. const ElPopover = withInstall(Popover, {
  39527. directive: ElPopoverDirective
  39528. });
  39529. const progressProps = buildProps({
  39530. type: {
  39531. type: String,
  39532. default: "line",
  39533. values: ["line", "circle", "dashboard"]
  39534. },
  39535. percentage: {
  39536. type: Number,
  39537. default: 0,
  39538. validator: (val) => val >= 0 && val <= 100
  39539. },
  39540. status: {
  39541. type: String,
  39542. default: "",
  39543. values: ["", "success", "exception", "warning"]
  39544. },
  39545. indeterminate: Boolean,
  39546. duration: {
  39547. type: Number,
  39548. default: 3
  39549. },
  39550. strokeWidth: {
  39551. type: Number,
  39552. default: 6
  39553. },
  39554. strokeLinecap: {
  39555. type: definePropType(String),
  39556. default: "round"
  39557. },
  39558. textInside: Boolean,
  39559. width: {
  39560. type: Number,
  39561. default: 126
  39562. },
  39563. showText: {
  39564. type: Boolean,
  39565. default: true
  39566. },
  39567. color: {
  39568. type: definePropType([
  39569. String,
  39570. Array,
  39571. Function
  39572. ]),
  39573. default: ""
  39574. },
  39575. striped: Boolean,
  39576. stripedFlow: Boolean,
  39577. format: {
  39578. type: definePropType(Function),
  39579. default: (percentage) => `${percentage}%`
  39580. }
  39581. });
  39582. const __default__$E = vue.defineComponent({
  39583. name: "ElProgress"
  39584. });
  39585. const _sfc_main$O = /* @__PURE__ */ vue.defineComponent({
  39586. ...__default__$E,
  39587. props: progressProps,
  39588. setup(__props) {
  39589. const props = __props;
  39590. const STATUS_COLOR_MAP = {
  39591. success: "#13ce66",
  39592. exception: "#ff4949",
  39593. warning: "#e6a23c",
  39594. default: "#20a0ff"
  39595. };
  39596. const ns = useNamespace("progress");
  39597. const barStyle = vue.computed(() => {
  39598. const barStyle2 = {
  39599. width: `${props.percentage}%`,
  39600. animationDuration: `${props.duration}s`
  39601. };
  39602. const color = getCurrentColor(props.percentage);
  39603. if (color.includes("gradient")) {
  39604. barStyle2.background = color;
  39605. } else {
  39606. barStyle2.backgroundColor = color;
  39607. }
  39608. return barStyle2;
  39609. });
  39610. const relativeStrokeWidth = vue.computed(() => (props.strokeWidth / props.width * 100).toFixed(1));
  39611. const radius = vue.computed(() => {
  39612. if (["circle", "dashboard"].includes(props.type)) {
  39613. return Number.parseInt(`${50 - Number.parseFloat(relativeStrokeWidth.value) / 2}`, 10);
  39614. }
  39615. return 0;
  39616. });
  39617. const trackPath = vue.computed(() => {
  39618. const r = radius.value;
  39619. const isDashboard = props.type === "dashboard";
  39620. return `
  39621. M 50 50
  39622. m 0 ${isDashboard ? "" : "-"}${r}
  39623. a ${r} ${r} 0 1 1 0 ${isDashboard ? "-" : ""}${r * 2}
  39624. a ${r} ${r} 0 1 1 0 ${isDashboard ? "" : "-"}${r * 2}
  39625. `;
  39626. });
  39627. const perimeter = vue.computed(() => 2 * Math.PI * radius.value);
  39628. const rate = vue.computed(() => props.type === "dashboard" ? 0.75 : 1);
  39629. const strokeDashoffset = vue.computed(() => {
  39630. const offset = -1 * perimeter.value * (1 - rate.value) / 2;
  39631. return `${offset}px`;
  39632. });
  39633. const trailPathStyle = vue.computed(() => ({
  39634. strokeDasharray: `${perimeter.value * rate.value}px, ${perimeter.value}px`,
  39635. strokeDashoffset: strokeDashoffset.value
  39636. }));
  39637. const circlePathStyle = vue.computed(() => ({
  39638. strokeDasharray: `${perimeter.value * rate.value * (props.percentage / 100)}px, ${perimeter.value}px`,
  39639. strokeDashoffset: strokeDashoffset.value,
  39640. transition: "stroke-dasharray 0.6s ease 0s, stroke 0.6s ease, opacity ease 0.6s"
  39641. }));
  39642. const stroke = vue.computed(() => {
  39643. let ret;
  39644. if (props.color) {
  39645. ret = getCurrentColor(props.percentage);
  39646. } else {
  39647. ret = STATUS_COLOR_MAP[props.status] || STATUS_COLOR_MAP.default;
  39648. }
  39649. return ret;
  39650. });
  39651. const statusIcon = vue.computed(() => {
  39652. if (props.status === "warning") {
  39653. return warning_filled_default;
  39654. }
  39655. if (props.type === "line") {
  39656. return props.status === "success" ? circle_check_default : circle_close_default;
  39657. } else {
  39658. return props.status === "success" ? check_default : close_default;
  39659. }
  39660. });
  39661. const progressTextSize = vue.computed(() => {
  39662. return props.type === "line" ? 12 + props.strokeWidth * 0.4 : props.width * 0.111111 + 2;
  39663. });
  39664. const content = vue.computed(() => props.format(props.percentage));
  39665. function getColors(color) {
  39666. const span = 100 / color.length;
  39667. const seriesColors = color.map((seriesColor, index) => {
  39668. if (isString$1(seriesColor)) {
  39669. return {
  39670. color: seriesColor,
  39671. percentage: (index + 1) * span
  39672. };
  39673. }
  39674. return seriesColor;
  39675. });
  39676. return seriesColors.sort((a, b) => a.percentage - b.percentage);
  39677. }
  39678. const getCurrentColor = (percentage) => {
  39679. var _a;
  39680. const { color } = props;
  39681. if (isFunction$1(color)) {
  39682. return color(percentage);
  39683. } else if (isString$1(color)) {
  39684. return color;
  39685. } else {
  39686. const colors = getColors(color);
  39687. for (const color2 of colors) {
  39688. if (color2.percentage > percentage)
  39689. return color2.color;
  39690. }
  39691. return (_a = colors[colors.length - 1]) == null ? void 0 : _a.color;
  39692. }
  39693. };
  39694. return (_ctx, _cache) => {
  39695. return vue.openBlock(), vue.createElementBlock("div", {
  39696. class: vue.normalizeClass([
  39697. vue.unref(ns).b(),
  39698. vue.unref(ns).m(_ctx.type),
  39699. vue.unref(ns).is(_ctx.status),
  39700. {
  39701. [vue.unref(ns).m("without-text")]: !_ctx.showText,
  39702. [vue.unref(ns).m("text-inside")]: _ctx.textInside
  39703. }
  39704. ]),
  39705. role: "progressbar",
  39706. "aria-valuenow": _ctx.percentage,
  39707. "aria-valuemin": "0",
  39708. "aria-valuemax": "100"
  39709. }, [
  39710. _ctx.type === "line" ? (vue.openBlock(), vue.createElementBlock("div", {
  39711. key: 0,
  39712. class: vue.normalizeClass(vue.unref(ns).b("bar"))
  39713. }, [
  39714. vue.createElementVNode("div", {
  39715. class: vue.normalizeClass(vue.unref(ns).be("bar", "outer")),
  39716. style: vue.normalizeStyle({ height: `${_ctx.strokeWidth}px` })
  39717. }, [
  39718. vue.createElementVNode("div", {
  39719. class: vue.normalizeClass([
  39720. vue.unref(ns).be("bar", "inner"),
  39721. { [vue.unref(ns).bem("bar", "inner", "indeterminate")]: _ctx.indeterminate },
  39722. { [vue.unref(ns).bem("bar", "inner", "striped")]: _ctx.striped },
  39723. { [vue.unref(ns).bem("bar", "inner", "striped-flow")]: _ctx.stripedFlow }
  39724. ]),
  39725. style: vue.normalizeStyle(vue.unref(barStyle))
  39726. }, [
  39727. (_ctx.showText || _ctx.$slots.default) && _ctx.textInside ? (vue.openBlock(), vue.createElementBlock("div", {
  39728. key: 0,
  39729. class: vue.normalizeClass(vue.unref(ns).be("bar", "innerText"))
  39730. }, [
  39731. vue.renderSlot(_ctx.$slots, "default", { percentage: _ctx.percentage }, () => [
  39732. vue.createElementVNode("span", null, vue.toDisplayString(vue.unref(content)), 1)
  39733. ])
  39734. ], 2)) : vue.createCommentVNode("v-if", true)
  39735. ], 6)
  39736. ], 6)
  39737. ], 2)) : (vue.openBlock(), vue.createElementBlock("div", {
  39738. key: 1,
  39739. class: vue.normalizeClass(vue.unref(ns).b("circle")),
  39740. style: vue.normalizeStyle({ height: `${_ctx.width}px`, width: `${_ctx.width}px` })
  39741. }, [
  39742. (vue.openBlock(), vue.createElementBlock("svg", { viewBox: "0 0 100 100" }, [
  39743. vue.createElementVNode("path", {
  39744. class: vue.normalizeClass(vue.unref(ns).be("circle", "track")),
  39745. d: vue.unref(trackPath),
  39746. stroke: `var(${vue.unref(ns).cssVarName("fill-color-light")}, #e5e9f2)`,
  39747. "stroke-linecap": _ctx.strokeLinecap,
  39748. "stroke-width": vue.unref(relativeStrokeWidth),
  39749. fill: "none",
  39750. style: vue.normalizeStyle(vue.unref(trailPathStyle))
  39751. }, null, 14, ["d", "stroke", "stroke-linecap", "stroke-width"]),
  39752. vue.createElementVNode("path", {
  39753. class: vue.normalizeClass(vue.unref(ns).be("circle", "path")),
  39754. d: vue.unref(trackPath),
  39755. stroke: vue.unref(stroke),
  39756. fill: "none",
  39757. opacity: _ctx.percentage ? 1 : 0,
  39758. "stroke-linecap": _ctx.strokeLinecap,
  39759. "stroke-width": vue.unref(relativeStrokeWidth),
  39760. style: vue.normalizeStyle(vue.unref(circlePathStyle))
  39761. }, null, 14, ["d", "stroke", "opacity", "stroke-linecap", "stroke-width"])
  39762. ]))
  39763. ], 6)),
  39764. (_ctx.showText || _ctx.$slots.default) && !_ctx.textInside ? (vue.openBlock(), vue.createElementBlock("div", {
  39765. key: 2,
  39766. class: vue.normalizeClass(vue.unref(ns).e("text")),
  39767. style: vue.normalizeStyle({ fontSize: `${vue.unref(progressTextSize)}px` })
  39768. }, [
  39769. vue.renderSlot(_ctx.$slots, "default", { percentage: _ctx.percentage }, () => [
  39770. !_ctx.status ? (vue.openBlock(), vue.createElementBlock("span", { key: 0 }, vue.toDisplayString(vue.unref(content)), 1)) : (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 1 }, {
  39771. default: vue.withCtx(() => [
  39772. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(statusIcon))))
  39773. ]),
  39774. _: 1
  39775. }))
  39776. ])
  39777. ], 6)) : vue.createCommentVNode("v-if", true)
  39778. ], 10, ["aria-valuenow"]);
  39779. };
  39780. }
  39781. });
  39782. var Progress = /* @__PURE__ */ _export_sfc(_sfc_main$O, [["__file", "progress.vue"]]);
  39783. const ElProgress = withInstall(Progress);
  39784. const rateProps = buildProps({
  39785. modelValue: {
  39786. type: Number,
  39787. default: 0
  39788. },
  39789. id: {
  39790. type: String,
  39791. default: void 0
  39792. },
  39793. lowThreshold: {
  39794. type: Number,
  39795. default: 2
  39796. },
  39797. highThreshold: {
  39798. type: Number,
  39799. default: 4
  39800. },
  39801. max: {
  39802. type: Number,
  39803. default: 5
  39804. },
  39805. colors: {
  39806. type: definePropType([Array, Object]),
  39807. default: () => mutable(["", "", ""])
  39808. },
  39809. voidColor: {
  39810. type: String,
  39811. default: ""
  39812. },
  39813. disabledVoidColor: {
  39814. type: String,
  39815. default: ""
  39816. },
  39817. icons: {
  39818. type: definePropType([Array, Object]),
  39819. default: () => [star_filled_default, star_filled_default, star_filled_default]
  39820. },
  39821. voidIcon: {
  39822. type: iconPropType,
  39823. default: () => star_default
  39824. },
  39825. disabledVoidIcon: {
  39826. type: iconPropType,
  39827. default: () => star_filled_default
  39828. },
  39829. disabled: Boolean,
  39830. allowHalf: Boolean,
  39831. showText: Boolean,
  39832. showScore: Boolean,
  39833. textColor: {
  39834. type: String,
  39835. default: ""
  39836. },
  39837. texts: {
  39838. type: definePropType(Array),
  39839. default: () => mutable([
  39840. "Extremely bad",
  39841. "Disappointed",
  39842. "Fair",
  39843. "Satisfied",
  39844. "Surprise"
  39845. ])
  39846. },
  39847. scoreTemplate: {
  39848. type: String,
  39849. default: "{value}"
  39850. },
  39851. size: useSizeProp,
  39852. clearable: Boolean,
  39853. ...useAriaProps(["ariaLabel"])
  39854. });
  39855. const rateEmits = {
  39856. [CHANGE_EVENT]: (value) => isNumber(value),
  39857. [UPDATE_MODEL_EVENT]: (value) => isNumber(value)
  39858. };
  39859. const __default__$D = vue.defineComponent({
  39860. name: "ElRate"
  39861. });
  39862. const _sfc_main$N = /* @__PURE__ */ vue.defineComponent({
  39863. ...__default__$D,
  39864. props: rateProps,
  39865. emits: rateEmits,
  39866. setup(__props, { expose, emit }) {
  39867. const props = __props;
  39868. function getValueFromMap(value, map) {
  39869. const isExcludedObject = (val) => isObject$1(val);
  39870. const matchedKeys = Object.keys(map).map((key) => +key).filter((key) => {
  39871. const val = map[key];
  39872. const excluded = isExcludedObject(val) ? val.excluded : false;
  39873. return excluded ? value < key : value <= key;
  39874. }).sort((a, b) => a - b);
  39875. const matchedValue = map[matchedKeys[0]];
  39876. return isExcludedObject(matchedValue) && matchedValue.value || matchedValue;
  39877. }
  39878. const formContext = vue.inject(formContextKey, void 0);
  39879. const formItemContext = vue.inject(formItemContextKey, void 0);
  39880. const rateSize = useFormSize();
  39881. const ns = useNamespace("rate");
  39882. const { inputId, isLabeledByFormItem } = useFormItemInputId(props, {
  39883. formItemContext
  39884. });
  39885. const currentValue = vue.ref(props.modelValue);
  39886. const hoverIndex = vue.ref(-1);
  39887. const pointerAtLeftHalf = vue.ref(true);
  39888. const iconRefs = vue.ref([]);
  39889. const iconClientWidths = vue.computed(() => iconRefs.value.map((icon) => icon.$el.clientWidth));
  39890. const rateClasses = vue.computed(() => [ns.b(), ns.m(rateSize.value)]);
  39891. const rateDisabled = vue.computed(() => props.disabled || (formContext == null ? void 0 : formContext.disabled));
  39892. const rateStyles = vue.computed(() => {
  39893. return ns.cssVarBlock({
  39894. "void-color": props.voidColor,
  39895. "disabled-void-color": props.disabledVoidColor,
  39896. "fill-color": activeColor.value
  39897. });
  39898. });
  39899. const text = vue.computed(() => {
  39900. let result = "";
  39901. if (props.showScore) {
  39902. result = props.scoreTemplate.replace(/\{\s*value\s*\}/, rateDisabled.value ? `${props.modelValue}` : `${currentValue.value}`);
  39903. } else if (props.showText) {
  39904. result = props.texts[Math.ceil(currentValue.value) - 1];
  39905. }
  39906. return result;
  39907. });
  39908. const valueDecimal = vue.computed(() => props.modelValue * 100 - Math.floor(props.modelValue) * 100);
  39909. const colorMap = vue.computed(() => isArray$1(props.colors) ? {
  39910. [props.lowThreshold]: props.colors[0],
  39911. [props.highThreshold]: { value: props.colors[1], excluded: true },
  39912. [props.max]: props.colors[2]
  39913. } : props.colors);
  39914. const activeColor = vue.computed(() => {
  39915. const color = getValueFromMap(currentValue.value, colorMap.value);
  39916. return isObject$1(color) ? "" : color;
  39917. });
  39918. const decimalStyle = vue.computed(() => {
  39919. let width = "";
  39920. if (rateDisabled.value) {
  39921. width = `${valueDecimal.value}%`;
  39922. } else if (props.allowHalf) {
  39923. width = "50%";
  39924. }
  39925. return {
  39926. color: activeColor.value,
  39927. width
  39928. };
  39929. });
  39930. const componentMap = vue.computed(() => {
  39931. let icons = isArray$1(props.icons) ? [...props.icons] : { ...props.icons };
  39932. icons = vue.markRaw(icons);
  39933. return isArray$1(icons) ? {
  39934. [props.lowThreshold]: icons[0],
  39935. [props.highThreshold]: {
  39936. value: icons[1],
  39937. excluded: true
  39938. },
  39939. [props.max]: icons[2]
  39940. } : icons;
  39941. });
  39942. const decimalIconComponent = vue.computed(() => getValueFromMap(props.modelValue, componentMap.value));
  39943. 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));
  39944. const activeComponent = vue.computed(() => getValueFromMap(currentValue.value, componentMap.value));
  39945. function showDecimalIcon(item) {
  39946. const showWhenDisabled = rateDisabled.value && valueDecimal.value > 0 && item - 1 < props.modelValue && item > props.modelValue;
  39947. const showWhenAllowHalf = props.allowHalf && pointerAtLeftHalf.value && item - 0.5 <= currentValue.value && item > currentValue.value;
  39948. return showWhenDisabled || showWhenAllowHalf;
  39949. }
  39950. function emitValue(value) {
  39951. if (props.clearable && value === props.modelValue) {
  39952. value = 0;
  39953. }
  39954. emit(UPDATE_MODEL_EVENT, value);
  39955. if (props.modelValue !== value) {
  39956. emit(CHANGE_EVENT, value);
  39957. }
  39958. }
  39959. function selectValue(value) {
  39960. if (rateDisabled.value) {
  39961. return;
  39962. }
  39963. if (props.allowHalf && pointerAtLeftHalf.value) {
  39964. emitValue(currentValue.value);
  39965. } else {
  39966. emitValue(value);
  39967. }
  39968. }
  39969. function handleKey(e) {
  39970. if (rateDisabled.value) {
  39971. return;
  39972. }
  39973. const code = getEventCode(e);
  39974. const step = props.allowHalf ? 0.5 : 1;
  39975. let _currentValue = currentValue.value;
  39976. switch (code) {
  39977. case EVENT_CODE.up:
  39978. case EVENT_CODE.right:
  39979. _currentValue += step;
  39980. break;
  39981. case EVENT_CODE.left:
  39982. case EVENT_CODE.down:
  39983. _currentValue -= step;
  39984. break;
  39985. }
  39986. _currentValue = clamp$1(_currentValue, 0, props.max);
  39987. if (_currentValue === currentValue.value) {
  39988. return;
  39989. }
  39990. e.stopPropagation();
  39991. e.preventDefault();
  39992. emit(UPDATE_MODEL_EVENT, _currentValue);
  39993. emit(CHANGE_EVENT, _currentValue);
  39994. return _currentValue;
  39995. }
  39996. function setCurrentValue(value, event) {
  39997. if (rateDisabled.value) {
  39998. return;
  39999. }
  40000. if (props.allowHalf && event) {
  40001. pointerAtLeftHalf.value = event.offsetX * 2 <= iconClientWidths.value[value - 1];
  40002. currentValue.value = pointerAtLeftHalf.value ? value - 0.5 : value;
  40003. } else {
  40004. currentValue.value = value;
  40005. }
  40006. hoverIndex.value = value;
  40007. }
  40008. function resetCurrentValue() {
  40009. if (rateDisabled.value) {
  40010. return;
  40011. }
  40012. if (props.allowHalf) {
  40013. pointerAtLeftHalf.value = props.modelValue !== Math.floor(props.modelValue);
  40014. }
  40015. currentValue.value = props.modelValue;
  40016. hoverIndex.value = -1;
  40017. }
  40018. vue.watch(() => props.modelValue, (val) => {
  40019. currentValue.value = val;
  40020. pointerAtLeftHalf.value = props.modelValue !== Math.floor(props.modelValue);
  40021. });
  40022. if (!props.modelValue) {
  40023. emit(UPDATE_MODEL_EVENT, 0);
  40024. }
  40025. expose({
  40026. setCurrentValue,
  40027. resetCurrentValue
  40028. });
  40029. return (_ctx, _cache) => {
  40030. var _a;
  40031. return vue.openBlock(), vue.createElementBlock("div", {
  40032. id: vue.unref(inputId),
  40033. class: vue.normalizeClass([vue.unref(rateClasses), vue.unref(ns).is("disabled", vue.unref(rateDisabled))]),
  40034. role: "slider",
  40035. "aria-label": !vue.unref(isLabeledByFormItem) ? _ctx.ariaLabel || "rating" : void 0,
  40036. "aria-labelledby": vue.unref(isLabeledByFormItem) ? (_a = vue.unref(formItemContext)) == null ? void 0 : _a.labelId : void 0,
  40037. "aria-valuenow": currentValue.value,
  40038. "aria-valuetext": vue.unref(text) || void 0,
  40039. "aria-valuemin": "0",
  40040. "aria-valuemax": _ctx.max,
  40041. tabindex: "0",
  40042. style: vue.normalizeStyle(vue.unref(rateStyles)),
  40043. onKeydown: handleKey
  40044. }, [
  40045. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.max, (item, key) => {
  40046. return vue.openBlock(), vue.createElementBlock("span", {
  40047. key,
  40048. class: vue.normalizeClass(vue.unref(ns).e("item")),
  40049. onMousemove: ($event) => setCurrentValue(item, $event),
  40050. onMouseleave: resetCurrentValue,
  40051. onClick: ($event) => selectValue(item)
  40052. }, [
  40053. vue.createVNode(vue.unref(ElIcon), {
  40054. ref_for: true,
  40055. ref_key: "iconRefs",
  40056. ref: iconRefs,
  40057. class: vue.normalizeClass([
  40058. vue.unref(ns).e("icon"),
  40059. { hover: hoverIndex.value === item },
  40060. vue.unref(ns).is("active", item <= currentValue.value),
  40061. vue.unref(ns).is("focus-visible", item === Math.ceil(currentValue.value || 1))
  40062. ])
  40063. }, {
  40064. default: vue.withCtx(() => [
  40065. vue.withDirectives((vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(activeComponent)), null, null, 512)), [
  40066. [vue.vShow, !showDecimalIcon(item) && item <= currentValue.value]
  40067. ]),
  40068. vue.withDirectives((vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(voidComponent)), null, null, 512)), [
  40069. [vue.vShow, !showDecimalIcon(item) && item > currentValue.value]
  40070. ]),
  40071. vue.withDirectives((vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(voidComponent)), {
  40072. class: vue.normalizeClass([vue.unref(ns).em("decimal", "box")])
  40073. }, null, 8, ["class"])), [
  40074. [vue.vShow, showDecimalIcon(item)]
  40075. ]),
  40076. vue.withDirectives(vue.createVNode(vue.unref(ElIcon), {
  40077. style: vue.normalizeStyle(vue.unref(decimalStyle)),
  40078. class: vue.normalizeClass([vue.unref(ns).e("icon"), vue.unref(ns).e("decimal")])
  40079. }, {
  40080. default: vue.withCtx(() => [
  40081. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(decimalIconComponent))))
  40082. ]),
  40083. _: 2
  40084. }, 1032, ["style", "class"]), [
  40085. [vue.vShow, showDecimalIcon(item)]
  40086. ])
  40087. ]),
  40088. _: 2
  40089. }, 1032, ["class"])
  40090. ], 42, ["onMousemove", "onClick"]);
  40091. }), 128)),
  40092. _ctx.showText || _ctx.showScore ? (vue.openBlock(), vue.createElementBlock("span", {
  40093. key: 0,
  40094. class: vue.normalizeClass(vue.unref(ns).e("text")),
  40095. style: vue.normalizeStyle({ color: _ctx.textColor })
  40096. }, vue.toDisplayString(vue.unref(text)), 7)) : vue.createCommentVNode("v-if", true)
  40097. ], 46, ["id", "aria-label", "aria-labelledby", "aria-valuenow", "aria-valuetext", "aria-valuemax"]);
  40098. };
  40099. }
  40100. });
  40101. var Rate = /* @__PURE__ */ _export_sfc(_sfc_main$N, [["__file", "rate.vue"]]);
  40102. const ElRate = withInstall(Rate);
  40103. const IconMap = {
  40104. primary: "icon-primary",
  40105. success: "icon-success",
  40106. warning: "icon-warning",
  40107. error: "icon-error",
  40108. info: "icon-info"
  40109. };
  40110. const IconComponentMap = {
  40111. [IconMap.primary]: info_filled_default,
  40112. [IconMap.success]: circle_check_filled_default,
  40113. [IconMap.warning]: warning_filled_default,
  40114. [IconMap.error]: circle_close_filled_default,
  40115. [IconMap.info]: info_filled_default
  40116. };
  40117. const resultProps = buildProps({
  40118. title: {
  40119. type: String,
  40120. default: ""
  40121. },
  40122. subTitle: {
  40123. type: String,
  40124. default: ""
  40125. },
  40126. icon: {
  40127. type: String,
  40128. values: ["primary", "success", "warning", "info", "error"],
  40129. default: "info"
  40130. }
  40131. });
  40132. const __default__$C = vue.defineComponent({
  40133. name: "ElResult"
  40134. });
  40135. const _sfc_main$M = /* @__PURE__ */ vue.defineComponent({
  40136. ...__default__$C,
  40137. props: resultProps,
  40138. setup(__props) {
  40139. const props = __props;
  40140. const ns = useNamespace("result");
  40141. const resultIcon = vue.computed(() => {
  40142. const icon = props.icon;
  40143. const iconClass = icon && IconMap[icon] ? IconMap[icon] : "icon-info";
  40144. const iconComponent = IconComponentMap[iconClass] || IconComponentMap["icon-info"];
  40145. return {
  40146. class: iconClass,
  40147. component: iconComponent
  40148. };
  40149. });
  40150. return (_ctx, _cache) => {
  40151. return vue.openBlock(), vue.createElementBlock("div", {
  40152. class: vue.normalizeClass(vue.unref(ns).b())
  40153. }, [
  40154. vue.createElementVNode("div", {
  40155. class: vue.normalizeClass(vue.unref(ns).e("icon"))
  40156. }, [
  40157. vue.renderSlot(_ctx.$slots, "icon", {}, () => [
  40158. vue.unref(resultIcon).component ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(resultIcon).component), {
  40159. key: 0,
  40160. class: vue.normalizeClass(vue.unref(resultIcon).class)
  40161. }, null, 8, ["class"])) : vue.createCommentVNode("v-if", true)
  40162. ])
  40163. ], 2),
  40164. _ctx.title || _ctx.$slots.title ? (vue.openBlock(), vue.createElementBlock("div", {
  40165. key: 0,
  40166. class: vue.normalizeClass(vue.unref(ns).e("title"))
  40167. }, [
  40168. vue.renderSlot(_ctx.$slots, "title", {}, () => [
  40169. vue.createElementVNode("p", null, vue.toDisplayString(_ctx.title), 1)
  40170. ])
  40171. ], 2)) : vue.createCommentVNode("v-if", true),
  40172. _ctx.subTitle || _ctx.$slots["sub-title"] ? (vue.openBlock(), vue.createElementBlock("div", {
  40173. key: 1,
  40174. class: vue.normalizeClass(vue.unref(ns).e("subtitle"))
  40175. }, [
  40176. vue.renderSlot(_ctx.$slots, "sub-title", {}, () => [
  40177. vue.createElementVNode("p", null, vue.toDisplayString(_ctx.subTitle), 1)
  40178. ])
  40179. ], 2)) : vue.createCommentVNode("v-if", true),
  40180. _ctx.$slots.extra ? (vue.openBlock(), vue.createElementBlock("div", {
  40181. key: 2,
  40182. class: vue.normalizeClass(vue.unref(ns).e("extra"))
  40183. }, [
  40184. vue.renderSlot(_ctx.$slots, "extra")
  40185. ], 2)) : vue.createCommentVNode("v-if", true)
  40186. ], 2);
  40187. };
  40188. }
  40189. });
  40190. var Result = /* @__PURE__ */ _export_sfc(_sfc_main$M, [["__file", "result.vue"]]);
  40191. const ElResult = withInstall(Result);
  40192. var safeIsNaN = Number.isNaN || function ponyfill(value) {
  40193. return typeof value === "number" && value !== value;
  40194. };
  40195. function isEqual(first, second) {
  40196. if (first === second) {
  40197. return true;
  40198. }
  40199. if (safeIsNaN(first) && safeIsNaN(second)) {
  40200. return true;
  40201. }
  40202. return false;
  40203. }
  40204. function areInputsEqual(newInputs, lastInputs) {
  40205. if (newInputs.length !== lastInputs.length) {
  40206. return false;
  40207. }
  40208. for (var i = 0; i < newInputs.length; i++) {
  40209. if (!isEqual(newInputs[i], lastInputs[i])) {
  40210. return false;
  40211. }
  40212. }
  40213. return true;
  40214. }
  40215. function memoizeOne(resultFn, isEqual2) {
  40216. if (isEqual2 === void 0) {
  40217. isEqual2 = areInputsEqual;
  40218. }
  40219. var cache = null;
  40220. function memoized() {
  40221. var newArgs = [];
  40222. for (var _i = 0; _i < arguments.length; _i++) {
  40223. newArgs[_i] = arguments[_i];
  40224. }
  40225. if (cache && cache.lastThis === this && isEqual2(newArgs, cache.lastArgs)) {
  40226. return cache.lastResult;
  40227. }
  40228. var lastResult = resultFn.apply(this, newArgs);
  40229. cache = {
  40230. lastResult,
  40231. lastArgs: newArgs,
  40232. lastThis: this
  40233. };
  40234. return lastResult;
  40235. }
  40236. memoized.clear = function clear() {
  40237. cache = null;
  40238. };
  40239. return memoized;
  40240. }
  40241. const useCache = () => {
  40242. const vm = vue.getCurrentInstance();
  40243. const props = vm.proxy.$props;
  40244. return vue.computed(() => {
  40245. const _getItemStyleCache = (_, __, ___) => ({});
  40246. return props.perfMode ? memoize(_getItemStyleCache) : memoizeOne(_getItemStyleCache);
  40247. });
  40248. };
  40249. const DEFAULT_DYNAMIC_LIST_ITEM_SIZE = 50;
  40250. const ITEM_RENDER_EVT = "itemRendered";
  40251. const SCROLL_EVT = "scroll";
  40252. const FORWARD = "forward";
  40253. const BACKWARD = "backward";
  40254. const AUTO_ALIGNMENT = "auto";
  40255. const SMART_ALIGNMENT = "smart";
  40256. const START_ALIGNMENT = "start";
  40257. const CENTERED_ALIGNMENT = "center";
  40258. const END_ALIGNMENT = "end";
  40259. const HORIZONTAL = "horizontal";
  40260. const VERTICAL = "vertical";
  40261. const LTR = "ltr";
  40262. const RTL = "rtl";
  40263. const RTL_OFFSET_NAG = "negative";
  40264. const RTL_OFFSET_POS_ASC = "positive-ascending";
  40265. const RTL_OFFSET_POS_DESC = "positive-descending";
  40266. const ScrollbarDirKey = {
  40267. [HORIZONTAL]: "left",
  40268. [VERTICAL]: "top"
  40269. };
  40270. const SCROLLBAR_MIN_SIZE = 20;
  40271. const LayoutKeys = {
  40272. [HORIZONTAL]: "deltaX",
  40273. [VERTICAL]: "deltaY"
  40274. };
  40275. const useWheel = ({ atEndEdge, atStartEdge, layout }, onWheelDelta) => {
  40276. let frameHandle;
  40277. let offset = 0;
  40278. const hasReachedEdge = (offset2) => {
  40279. const edgeReached = offset2 < 0 && atStartEdge.value || offset2 > 0 && atEndEdge.value;
  40280. return edgeReached;
  40281. };
  40282. const onWheel = (e) => {
  40283. cAF(frameHandle);
  40284. const newOffset = e[LayoutKeys[layout.value]];
  40285. if (hasReachedEdge(offset) && hasReachedEdge(offset + newOffset))
  40286. return;
  40287. offset += newOffset;
  40288. if (!isFirefox()) {
  40289. e.preventDefault();
  40290. }
  40291. frameHandle = rAF(() => {
  40292. onWheelDelta(offset);
  40293. offset = 0;
  40294. });
  40295. };
  40296. return {
  40297. hasReachedEdge,
  40298. onWheel
  40299. };
  40300. };
  40301. var useWheel$1 = useWheel;
  40302. const itemSize$1 = buildProp({
  40303. type: definePropType([Number, Function]),
  40304. required: true
  40305. });
  40306. const estimatedItemSize = buildProp({
  40307. type: Number
  40308. });
  40309. const cache = buildProp({
  40310. type: Number,
  40311. default: 2
  40312. });
  40313. const direction = buildProp({
  40314. type: String,
  40315. values: ["ltr", "rtl"],
  40316. default: "ltr"
  40317. });
  40318. const initScrollOffset = buildProp({
  40319. type: Number,
  40320. default: 0
  40321. });
  40322. const total = buildProp({
  40323. type: Number,
  40324. required: true
  40325. });
  40326. const layout = buildProp({
  40327. type: String,
  40328. values: ["horizontal", "vertical"],
  40329. default: VERTICAL
  40330. });
  40331. const virtualizedProps = buildProps({
  40332. className: {
  40333. type: String,
  40334. default: ""
  40335. },
  40336. containerElement: {
  40337. type: definePropType([String, Object]),
  40338. default: "div"
  40339. },
  40340. data: {
  40341. type: definePropType(Array),
  40342. default: () => mutable([])
  40343. },
  40344. direction,
  40345. height: {
  40346. type: [String, Number],
  40347. required: true
  40348. },
  40349. innerElement: {
  40350. type: [String, Object],
  40351. default: "div"
  40352. },
  40353. innerProps: {
  40354. type: definePropType(Object),
  40355. default: () => ({})
  40356. },
  40357. style: {
  40358. type: definePropType([Object, String, Array])
  40359. },
  40360. useIsScrolling: Boolean,
  40361. width: {
  40362. type: [Number, String],
  40363. required: false
  40364. },
  40365. perfMode: {
  40366. type: Boolean,
  40367. default: true
  40368. },
  40369. scrollbarAlwaysOn: Boolean
  40370. });
  40371. const virtualizedListProps = buildProps({
  40372. cache,
  40373. estimatedItemSize,
  40374. layout,
  40375. initScrollOffset,
  40376. total,
  40377. itemSize: itemSize$1,
  40378. ...virtualizedProps
  40379. });
  40380. const scrollbarSize = {
  40381. type: Number,
  40382. default: 6
  40383. };
  40384. const startGap = { type: Number, default: 0 };
  40385. const endGap = { type: Number, default: 2 };
  40386. const virtualizedGridProps = buildProps({
  40387. columnCache: cache,
  40388. columnWidth: itemSize$1,
  40389. estimatedColumnWidth: estimatedItemSize,
  40390. estimatedRowHeight: estimatedItemSize,
  40391. initScrollLeft: initScrollOffset,
  40392. initScrollTop: initScrollOffset,
  40393. itemKey: {
  40394. type: definePropType(Function),
  40395. default: ({
  40396. columnIndex,
  40397. rowIndex
  40398. }) => `${rowIndex}:${columnIndex}`
  40399. },
  40400. rowCache: cache,
  40401. rowHeight: itemSize$1,
  40402. totalColumn: total,
  40403. totalRow: total,
  40404. hScrollbarSize: scrollbarSize,
  40405. vScrollbarSize: scrollbarSize,
  40406. scrollbarStartGap: startGap,
  40407. scrollbarEndGap: endGap,
  40408. role: String,
  40409. ...virtualizedProps
  40410. });
  40411. const virtualizedScrollbarProps = buildProps({
  40412. alwaysOn: Boolean,
  40413. class: String,
  40414. layout,
  40415. total,
  40416. ratio: {
  40417. type: Number,
  40418. required: true
  40419. },
  40420. clientSize: {
  40421. type: Number,
  40422. required: true
  40423. },
  40424. scrollFrom: {
  40425. type: Number,
  40426. required: true
  40427. },
  40428. scrollbarSize,
  40429. startGap,
  40430. endGap,
  40431. visible: Boolean
  40432. });
  40433. const getScrollDir = (prev, cur) => prev < cur ? FORWARD : BACKWARD;
  40434. const isHorizontal = (dir) => dir === LTR || dir === RTL || dir === HORIZONTAL;
  40435. const isRTL = (dir) => dir === RTL;
  40436. let cachedRTLResult = null;
  40437. function getRTLOffsetType(recalculate = false) {
  40438. if (cachedRTLResult === null || recalculate) {
  40439. const outerDiv = document.createElement("div");
  40440. const outerStyle = outerDiv.style;
  40441. outerStyle.width = "50px";
  40442. outerStyle.height = "50px";
  40443. outerStyle.overflow = "scroll";
  40444. outerStyle.direction = "rtl";
  40445. const innerDiv = document.createElement("div");
  40446. const innerStyle = innerDiv.style;
  40447. innerStyle.width = "100px";
  40448. innerStyle.height = "100px";
  40449. outerDiv.appendChild(innerDiv);
  40450. document.body.appendChild(outerDiv);
  40451. if (outerDiv.scrollLeft > 0) {
  40452. cachedRTLResult = RTL_OFFSET_POS_DESC;
  40453. } else {
  40454. outerDiv.scrollLeft = 1;
  40455. if (outerDiv.scrollLeft === 0) {
  40456. cachedRTLResult = RTL_OFFSET_NAG;
  40457. } else {
  40458. cachedRTLResult = RTL_OFFSET_POS_ASC;
  40459. }
  40460. }
  40461. document.body.removeChild(outerDiv);
  40462. return cachedRTLResult;
  40463. }
  40464. return cachedRTLResult;
  40465. }
  40466. function renderThumbStyle({ move, size, bar }, layout) {
  40467. const style = {};
  40468. const translate = `translate${bar.axis}(${move}px)`;
  40469. style[bar.size] = size;
  40470. style.transform = translate;
  40471. if (layout === "horizontal") {
  40472. style.height = "100%";
  40473. } else {
  40474. style.width = "100%";
  40475. }
  40476. return style;
  40477. }
  40478. const ScrollBar = vue.defineComponent({
  40479. name: "ElVirtualScrollBar",
  40480. props: virtualizedScrollbarProps,
  40481. emits: ["scroll", "start-move", "stop-move"],
  40482. setup(props, { emit }) {
  40483. const GAP = vue.computed(() => props.startGap + props.endGap);
  40484. const nsVirtualScrollbar = useNamespace("virtual-scrollbar");
  40485. const nsScrollbar = useNamespace("scrollbar");
  40486. const trackRef = vue.ref();
  40487. const thumbRef = vue.ref();
  40488. let frameHandle = null;
  40489. let onselectstartStore = null;
  40490. const state = vue.reactive({
  40491. isDragging: false,
  40492. traveled: 0
  40493. });
  40494. const bar = vue.computed(() => BAR_MAP[props.layout]);
  40495. const trackSize = vue.computed(() => props.clientSize - vue.unref(GAP));
  40496. const trackStyle = vue.computed(() => ({
  40497. position: "absolute",
  40498. width: `${HORIZONTAL === props.layout ? trackSize.value : props.scrollbarSize}px`,
  40499. height: `${HORIZONTAL === props.layout ? props.scrollbarSize : trackSize.value}px`,
  40500. [ScrollbarDirKey[props.layout]]: "2px",
  40501. right: "2px",
  40502. bottom: "2px",
  40503. borderRadius: "4px"
  40504. }));
  40505. const thumbSize = vue.computed(() => {
  40506. const ratio = props.ratio;
  40507. if (ratio >= 100) {
  40508. return Number.POSITIVE_INFINITY;
  40509. }
  40510. if (ratio >= 50) {
  40511. return ratio * trackSize.value / 100;
  40512. }
  40513. const SCROLLBAR_MAX_SIZE = trackSize.value / 3;
  40514. return Math.floor(Math.min(Math.max(ratio * trackSize.value / 100, SCROLLBAR_MIN_SIZE), SCROLLBAR_MAX_SIZE));
  40515. });
  40516. const thumbStyle = vue.computed(() => {
  40517. if (!Number.isFinite(thumbSize.value)) {
  40518. return {
  40519. display: "none"
  40520. };
  40521. }
  40522. const thumb = `${thumbSize.value}px`;
  40523. const style = renderThumbStyle({
  40524. bar: bar.value,
  40525. size: thumb,
  40526. move: state.traveled
  40527. }, props.layout);
  40528. return style;
  40529. });
  40530. const totalSteps = vue.computed(() => Math.ceil(props.clientSize - thumbSize.value - vue.unref(GAP)));
  40531. const attachEvents = () => {
  40532. window.addEventListener("mousemove", onMouseMove);
  40533. window.addEventListener("mouseup", onMouseUp);
  40534. const thumbEl = vue.unref(thumbRef);
  40535. if (!thumbEl)
  40536. return;
  40537. onselectstartStore = document.onselectstart;
  40538. document.onselectstart = () => false;
  40539. thumbEl.addEventListener("touchmove", onMouseMove, { passive: true });
  40540. thumbEl.addEventListener("touchend", onMouseUp);
  40541. };
  40542. const detachEvents = () => {
  40543. window.removeEventListener("mousemove", onMouseMove);
  40544. window.removeEventListener("mouseup", onMouseUp);
  40545. document.onselectstart = onselectstartStore;
  40546. onselectstartStore = null;
  40547. const thumbEl = vue.unref(thumbRef);
  40548. if (!thumbEl)
  40549. return;
  40550. thumbEl.removeEventListener("touchmove", onMouseMove);
  40551. thumbEl.removeEventListener("touchend", onMouseUp);
  40552. };
  40553. const onThumbMouseDown = (e) => {
  40554. e.stopImmediatePropagation();
  40555. if (e.ctrlKey || [1, 2].includes(e.button)) {
  40556. return;
  40557. }
  40558. state.isDragging = true;
  40559. state[bar.value.axis] = e.currentTarget[bar.value.offset] - (e[bar.value.client] - e.currentTarget.getBoundingClientRect()[bar.value.direction]);
  40560. emit("start-move");
  40561. attachEvents();
  40562. };
  40563. const onMouseUp = () => {
  40564. state.isDragging = false;
  40565. state[bar.value.axis] = 0;
  40566. emit("stop-move");
  40567. detachEvents();
  40568. };
  40569. const onMouseMove = (e) => {
  40570. const { isDragging } = state;
  40571. if (!isDragging)
  40572. return;
  40573. if (!thumbRef.value || !trackRef.value)
  40574. return;
  40575. const prevPage = state[bar.value.axis];
  40576. if (!prevPage)
  40577. return;
  40578. cAF(frameHandle);
  40579. const offset = (trackRef.value.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]) * -1;
  40580. const thumbClickPosition = thumbRef.value[bar.value.offset] - prevPage;
  40581. const distance = offset - thumbClickPosition;
  40582. frameHandle = rAF(() => {
  40583. state.traveled = Math.max(0, Math.min(distance, totalSteps.value));
  40584. emit("scroll", distance, totalSteps.value);
  40585. });
  40586. };
  40587. const clickTrackHandler = (e) => {
  40588. const offset = Math.abs(e.target.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]);
  40589. const thumbHalf = thumbRef.value[bar.value.offset] / 2;
  40590. const distance = offset - thumbHalf;
  40591. state.traveled = Math.max(0, Math.min(distance, totalSteps.value));
  40592. emit("scroll", distance, totalSteps.value);
  40593. };
  40594. vue.watch(() => props.scrollFrom, (v) => {
  40595. if (state.isDragging)
  40596. return;
  40597. state.traveled = Math.ceil(v * totalSteps.value);
  40598. });
  40599. vue.onBeforeUnmount(() => {
  40600. detachEvents();
  40601. });
  40602. return () => {
  40603. return vue.h("div", {
  40604. role: "presentation",
  40605. ref: trackRef,
  40606. class: [
  40607. nsVirtualScrollbar.b(),
  40608. props.class,
  40609. (props.alwaysOn || state.isDragging) && "always-on"
  40610. ],
  40611. style: trackStyle.value,
  40612. onMousedown: vue.withModifiers(clickTrackHandler, ["stop", "prevent"]),
  40613. onTouchstartPrevent: onThumbMouseDown
  40614. }, vue.h("div", {
  40615. ref: thumbRef,
  40616. class: nsScrollbar.e("thumb"),
  40617. style: thumbStyle.value,
  40618. onMousedown: onThumbMouseDown
  40619. }, []));
  40620. };
  40621. }
  40622. });
  40623. var Scrollbar = ScrollBar;
  40624. const createList = ({
  40625. name,
  40626. getOffset,
  40627. getItemSize,
  40628. getItemOffset,
  40629. getEstimatedTotalSize,
  40630. getStartIndexForOffset,
  40631. getStopIndexForStartIndex,
  40632. initCache,
  40633. clearCache,
  40634. validateProps
  40635. }) => {
  40636. return vue.defineComponent({
  40637. name: name != null ? name : "ElVirtualList",
  40638. props: virtualizedListProps,
  40639. emits: [ITEM_RENDER_EVT, SCROLL_EVT],
  40640. setup(props, { emit, expose }) {
  40641. validateProps(props);
  40642. const instance = vue.getCurrentInstance();
  40643. const ns = useNamespace("vl");
  40644. const dynamicSizeCache = vue.ref(initCache(props, instance));
  40645. const getItemStyleCache = useCache();
  40646. const windowRef = vue.ref();
  40647. const innerRef = vue.ref();
  40648. const scrollbarRef = vue.ref();
  40649. const states = vue.ref({
  40650. isScrolling: false,
  40651. scrollDir: "forward",
  40652. scrollOffset: isNumber(props.initScrollOffset) ? props.initScrollOffset : 0,
  40653. updateRequested: false,
  40654. isScrollbarDragging: false,
  40655. scrollbarAlwaysOn: props.scrollbarAlwaysOn
  40656. });
  40657. const itemsToRender = vue.computed(() => {
  40658. const { total, cache } = props;
  40659. const { isScrolling, scrollDir, scrollOffset } = vue.unref(states);
  40660. if (total === 0) {
  40661. return [0, 0, 0, 0];
  40662. }
  40663. const startIndex = getStartIndexForOffset(props, scrollOffset, vue.unref(dynamicSizeCache));
  40664. const stopIndex = getStopIndexForStartIndex(props, startIndex, scrollOffset, vue.unref(dynamicSizeCache));
  40665. const cacheBackward = !isScrolling || scrollDir === BACKWARD ? Math.max(1, cache) : 1;
  40666. const cacheForward = !isScrolling || scrollDir === FORWARD ? Math.max(1, cache) : 1;
  40667. return [
  40668. Math.max(0, startIndex - cacheBackward),
  40669. Math.max(0, Math.min(total - 1, stopIndex + cacheForward)),
  40670. startIndex,
  40671. stopIndex
  40672. ];
  40673. });
  40674. const estimatedTotalSize = vue.computed(() => getEstimatedTotalSize(props, vue.unref(dynamicSizeCache)));
  40675. const _isHorizontal = vue.computed(() => isHorizontal(props.layout));
  40676. const windowStyle = vue.computed(() => [
  40677. {
  40678. position: "relative",
  40679. [`overflow-${_isHorizontal.value ? "x" : "y"}`]: "scroll",
  40680. WebkitOverflowScrolling: "touch",
  40681. willChange: "transform"
  40682. },
  40683. {
  40684. direction: props.direction,
  40685. height: isNumber(props.height) ? `${props.height}px` : props.height,
  40686. width: isNumber(props.width) ? `${props.width}px` : props.width
  40687. },
  40688. props.style
  40689. ]);
  40690. const innerStyle = vue.computed(() => {
  40691. const size = vue.unref(estimatedTotalSize);
  40692. const horizontal = vue.unref(_isHorizontal);
  40693. return {
  40694. height: horizontal ? "100%" : `${size}px`,
  40695. pointerEvents: vue.unref(states).isScrolling ? "none" : void 0,
  40696. width: horizontal ? `${size}px` : "100%"
  40697. };
  40698. });
  40699. const clientSize = vue.computed(() => _isHorizontal.value ? props.width : props.height);
  40700. const { onWheel } = useWheel$1({
  40701. atStartEdge: vue.computed(() => states.value.scrollOffset <= 0),
  40702. atEndEdge: vue.computed(() => states.value.scrollOffset >= estimatedTotalSize.value),
  40703. layout: vue.computed(() => props.layout)
  40704. }, (offset) => {
  40705. var _a, _b;
  40706. (_b = (_a = scrollbarRef.value).onMouseUp) == null ? void 0 : _b.call(_a);
  40707. scrollTo(Math.min(states.value.scrollOffset + offset, estimatedTotalSize.value - clientSize.value));
  40708. });
  40709. useEventListener(windowRef, "wheel", onWheel, {
  40710. passive: false
  40711. });
  40712. const emitEvents = () => {
  40713. const { total } = props;
  40714. if (total > 0) {
  40715. const [cacheStart, cacheEnd, visibleStart, visibleEnd] = vue.unref(itemsToRender);
  40716. emit(ITEM_RENDER_EVT, cacheStart, cacheEnd, visibleStart, visibleEnd);
  40717. }
  40718. const { scrollDir, scrollOffset, updateRequested } = vue.unref(states);
  40719. emit(SCROLL_EVT, scrollDir, scrollOffset, updateRequested);
  40720. };
  40721. const scrollVertically = (e) => {
  40722. const { clientHeight, scrollHeight, scrollTop } = e.currentTarget;
  40723. const _states = vue.unref(states);
  40724. if (_states.scrollOffset === scrollTop) {
  40725. return;
  40726. }
  40727. const scrollOffset = Math.max(0, Math.min(scrollTop, scrollHeight - clientHeight));
  40728. states.value = {
  40729. ..._states,
  40730. isScrolling: true,
  40731. scrollDir: getScrollDir(_states.scrollOffset, scrollOffset),
  40732. scrollOffset,
  40733. updateRequested: false
  40734. };
  40735. vue.nextTick(resetIsScrolling);
  40736. };
  40737. const scrollHorizontally = (e) => {
  40738. const { clientWidth, scrollLeft, scrollWidth } = e.currentTarget;
  40739. const _states = vue.unref(states);
  40740. if (_states.scrollOffset === scrollLeft) {
  40741. return;
  40742. }
  40743. const { direction } = props;
  40744. let scrollOffset = scrollLeft;
  40745. if (direction === RTL) {
  40746. switch (getRTLOffsetType()) {
  40747. case RTL_OFFSET_NAG: {
  40748. scrollOffset = -scrollLeft;
  40749. break;
  40750. }
  40751. case RTL_OFFSET_POS_DESC: {
  40752. scrollOffset = scrollWidth - clientWidth - scrollLeft;
  40753. break;
  40754. }
  40755. }
  40756. }
  40757. scrollOffset = Math.max(0, Math.min(scrollOffset, scrollWidth - clientWidth));
  40758. states.value = {
  40759. ..._states,
  40760. isScrolling: true,
  40761. scrollDir: getScrollDir(_states.scrollOffset, scrollOffset),
  40762. scrollOffset,
  40763. updateRequested: false
  40764. };
  40765. vue.nextTick(resetIsScrolling);
  40766. };
  40767. const onScroll = (e) => {
  40768. vue.unref(_isHorizontal) ? scrollHorizontally(e) : scrollVertically(e);
  40769. emitEvents();
  40770. };
  40771. const onScrollbarScroll = (distanceToGo, totalSteps) => {
  40772. const offset = (estimatedTotalSize.value - clientSize.value) / totalSteps * distanceToGo;
  40773. scrollTo(Math.min(estimatedTotalSize.value - clientSize.value, offset));
  40774. };
  40775. const scrollTo = (offset) => {
  40776. offset = Math.max(offset, 0);
  40777. if (offset === vue.unref(states).scrollOffset) {
  40778. return;
  40779. }
  40780. states.value = {
  40781. ...vue.unref(states),
  40782. scrollOffset: offset,
  40783. scrollDir: getScrollDir(vue.unref(states).scrollOffset, offset),
  40784. updateRequested: true
  40785. };
  40786. vue.nextTick(resetIsScrolling);
  40787. };
  40788. const scrollToItem = (idx, alignment = AUTO_ALIGNMENT) => {
  40789. const { scrollOffset } = vue.unref(states);
  40790. idx = Math.max(0, Math.min(idx, props.total - 1));
  40791. scrollTo(getOffset(props, idx, alignment, scrollOffset, vue.unref(dynamicSizeCache)));
  40792. };
  40793. const getItemStyle = (idx) => {
  40794. const { direction, itemSize, layout } = props;
  40795. const itemStyleCache = getItemStyleCache.value(clearCache && itemSize, clearCache && layout, clearCache && direction);
  40796. let style;
  40797. if (hasOwn(itemStyleCache, String(idx))) {
  40798. style = itemStyleCache[idx];
  40799. } else {
  40800. const offset = getItemOffset(props, idx, vue.unref(dynamicSizeCache));
  40801. const size = getItemSize(props, idx, vue.unref(dynamicSizeCache));
  40802. const horizontal = vue.unref(_isHorizontal);
  40803. const isRtl = direction === RTL;
  40804. const offsetHorizontal = horizontal ? offset : 0;
  40805. itemStyleCache[idx] = style = {
  40806. position: "absolute",
  40807. left: isRtl ? void 0 : `${offsetHorizontal}px`,
  40808. right: isRtl ? `${offsetHorizontal}px` : void 0,
  40809. top: !horizontal ? `${offset}px` : 0,
  40810. height: !horizontal ? `${size}px` : "100%",
  40811. width: horizontal ? `${size}px` : "100%"
  40812. };
  40813. }
  40814. return style;
  40815. };
  40816. const resetIsScrolling = () => {
  40817. states.value.isScrolling = false;
  40818. vue.nextTick(() => {
  40819. getItemStyleCache.value(-1, null, null);
  40820. });
  40821. };
  40822. const resetScrollTop = () => {
  40823. const window = windowRef.value;
  40824. if (window) {
  40825. window.scrollTop = 0;
  40826. }
  40827. };
  40828. vue.onMounted(() => {
  40829. if (!isClient)
  40830. return;
  40831. const { initScrollOffset } = props;
  40832. const windowElement = vue.unref(windowRef);
  40833. if (isNumber(initScrollOffset) && windowElement) {
  40834. if (vue.unref(_isHorizontal)) {
  40835. windowElement.scrollLeft = initScrollOffset;
  40836. } else {
  40837. windowElement.scrollTop = initScrollOffset;
  40838. }
  40839. }
  40840. emitEvents();
  40841. });
  40842. vue.onUpdated(() => {
  40843. const { direction, layout } = props;
  40844. const { scrollOffset, updateRequested } = vue.unref(states);
  40845. const windowElement = vue.unref(windowRef);
  40846. if (updateRequested && windowElement) {
  40847. if (layout === HORIZONTAL) {
  40848. if (direction === RTL) {
  40849. switch (getRTLOffsetType()) {
  40850. case RTL_OFFSET_NAG: {
  40851. windowElement.scrollLeft = -scrollOffset;
  40852. break;
  40853. }
  40854. case RTL_OFFSET_POS_ASC: {
  40855. windowElement.scrollLeft = scrollOffset;
  40856. break;
  40857. }
  40858. default: {
  40859. const { clientWidth, scrollWidth } = windowElement;
  40860. windowElement.scrollLeft = scrollWidth - clientWidth - scrollOffset;
  40861. break;
  40862. }
  40863. }
  40864. } else {
  40865. windowElement.scrollLeft = scrollOffset;
  40866. }
  40867. } else {
  40868. windowElement.scrollTop = scrollOffset;
  40869. }
  40870. }
  40871. });
  40872. vue.onActivated(() => {
  40873. vue.unref(windowRef).scrollTop = vue.unref(states).scrollOffset;
  40874. });
  40875. const api = {
  40876. ns,
  40877. clientSize,
  40878. estimatedTotalSize,
  40879. windowStyle,
  40880. windowRef,
  40881. innerRef,
  40882. innerStyle,
  40883. itemsToRender,
  40884. scrollbarRef,
  40885. states,
  40886. getItemStyle,
  40887. onScroll,
  40888. onScrollbarScroll,
  40889. onWheel,
  40890. scrollTo,
  40891. scrollToItem,
  40892. resetScrollTop
  40893. };
  40894. expose({
  40895. windowRef,
  40896. innerRef,
  40897. getItemStyleCache,
  40898. scrollTo,
  40899. scrollToItem,
  40900. resetScrollTop,
  40901. states
  40902. });
  40903. return api;
  40904. },
  40905. render(ctx) {
  40906. var _a;
  40907. const {
  40908. $slots,
  40909. className,
  40910. clientSize,
  40911. containerElement,
  40912. data,
  40913. getItemStyle,
  40914. innerElement,
  40915. itemsToRender,
  40916. innerStyle,
  40917. layout,
  40918. total,
  40919. onScroll,
  40920. onScrollbarScroll,
  40921. states,
  40922. useIsScrolling,
  40923. windowStyle,
  40924. ns
  40925. } = ctx;
  40926. const [start, end] = itemsToRender;
  40927. const Container = vue.resolveDynamicComponent(containerElement);
  40928. const Inner = vue.resolveDynamicComponent(innerElement);
  40929. const children = [];
  40930. if (total > 0) {
  40931. for (let i = start; i <= end; i++) {
  40932. children.push(vue.h(vue.Fragment, { key: i }, (_a = $slots.default) == null ? void 0 : _a.call($slots, {
  40933. data,
  40934. index: i,
  40935. isScrolling: useIsScrolling ? states.isScrolling : void 0,
  40936. style: getItemStyle(i)
  40937. })));
  40938. }
  40939. }
  40940. const InnerNode = [
  40941. vue.h(Inner, vue.mergeProps(ctx.innerProps, {
  40942. style: innerStyle,
  40943. ref: "innerRef"
  40944. }), !isString$1(Inner) ? {
  40945. default: () => children
  40946. } : children)
  40947. ];
  40948. const scrollbar = vue.h(Scrollbar, {
  40949. ref: "scrollbarRef",
  40950. clientSize,
  40951. layout,
  40952. onScroll: onScrollbarScroll,
  40953. ratio: clientSize * 100 / this.estimatedTotalSize,
  40954. scrollFrom: states.scrollOffset / (this.estimatedTotalSize - clientSize),
  40955. total,
  40956. alwaysOn: states.scrollbarAlwaysOn
  40957. });
  40958. const listContainer = vue.h(Container, {
  40959. class: [ns.e("window"), className],
  40960. style: windowStyle,
  40961. onScroll,
  40962. ref: "windowRef",
  40963. key: 0
  40964. }, !isString$1(Container) ? { default: () => [InnerNode] } : [InnerNode]);
  40965. return vue.h("div", {
  40966. key: 0,
  40967. class: [ns.e("wrapper"), states.scrollbarAlwaysOn ? "always-on" : ""]
  40968. }, [listContainer, scrollbar]);
  40969. }
  40970. });
  40971. };
  40972. var createList$1 = createList;
  40973. const FixedSizeList = createList$1({
  40974. name: "ElFixedSizeList",
  40975. getItemOffset: ({ itemSize }, index) => index * itemSize,
  40976. getItemSize: ({ itemSize }) => itemSize,
  40977. getEstimatedTotalSize: ({ total, itemSize }) => itemSize * total,
  40978. getOffset: ({ height, total, itemSize, layout, width }, index, alignment, scrollOffset) => {
  40979. const size = isHorizontal(layout) ? width : height;
  40980. const lastItemOffset = Math.max(0, total * itemSize - size);
  40981. const maxOffset = Math.min(lastItemOffset, index * itemSize);
  40982. const minOffset = Math.max(0, (index + 1) * itemSize - size);
  40983. if (alignment === SMART_ALIGNMENT) {
  40984. if (scrollOffset >= minOffset - size && scrollOffset <= maxOffset + size) {
  40985. alignment = AUTO_ALIGNMENT;
  40986. } else {
  40987. alignment = CENTERED_ALIGNMENT;
  40988. }
  40989. }
  40990. switch (alignment) {
  40991. case START_ALIGNMENT: {
  40992. return maxOffset;
  40993. }
  40994. case END_ALIGNMENT: {
  40995. return minOffset;
  40996. }
  40997. case CENTERED_ALIGNMENT: {
  40998. const middleOffset = Math.round(minOffset + (maxOffset - minOffset) / 2);
  40999. if (middleOffset < Math.ceil(size / 2)) {
  41000. return 0;
  41001. } else if (middleOffset > lastItemOffset + Math.floor(size / 2)) {
  41002. return lastItemOffset;
  41003. } else {
  41004. return middleOffset;
  41005. }
  41006. }
  41007. case AUTO_ALIGNMENT:
  41008. default: {
  41009. if (scrollOffset >= minOffset && scrollOffset <= maxOffset) {
  41010. return scrollOffset;
  41011. } else if (scrollOffset < minOffset) {
  41012. return minOffset;
  41013. } else {
  41014. return maxOffset;
  41015. }
  41016. }
  41017. }
  41018. },
  41019. getStartIndexForOffset: ({ total, itemSize }, offset) => Math.max(0, Math.min(total - 1, Math.floor(offset / itemSize))),
  41020. getStopIndexForStartIndex: ({ height, total, itemSize, layout, width }, startIndex, scrollOffset) => {
  41021. const offset = startIndex * itemSize;
  41022. const size = isHorizontal(layout) ? width : height;
  41023. const numVisibleItems = Math.ceil((size + scrollOffset - offset) / itemSize);
  41024. return Math.max(0, Math.min(total - 1, startIndex + numVisibleItems - 1));
  41025. },
  41026. initCache() {
  41027. return void 0;
  41028. },
  41029. clearCache: true,
  41030. validateProps() {
  41031. }
  41032. });
  41033. var FixedSizeList$1 = FixedSizeList;
  41034. const getItemFromCache$1 = (props, index, listCache) => {
  41035. const { itemSize } = props;
  41036. const { items, lastVisitedIndex } = listCache;
  41037. if (index > lastVisitedIndex) {
  41038. let offset = 0;
  41039. if (lastVisitedIndex >= 0) {
  41040. const item = items[lastVisitedIndex];
  41041. offset = item.offset + item.size;
  41042. }
  41043. for (let i = lastVisitedIndex + 1; i <= index; i++) {
  41044. const size = itemSize(i);
  41045. items[i] = {
  41046. offset,
  41047. size
  41048. };
  41049. offset += size;
  41050. }
  41051. listCache.lastVisitedIndex = index;
  41052. }
  41053. return items[index];
  41054. };
  41055. const findItem$1 = (props, listCache, offset) => {
  41056. const { items, lastVisitedIndex } = listCache;
  41057. const lastVisitedOffset = lastVisitedIndex > 0 ? items[lastVisitedIndex].offset : 0;
  41058. if (lastVisitedOffset >= offset) {
  41059. return bs$1(props, listCache, 0, lastVisitedIndex, offset);
  41060. }
  41061. return es$1(props, listCache, Math.max(0, lastVisitedIndex), offset);
  41062. };
  41063. const bs$1 = (props, listCache, low, high, offset) => {
  41064. while (low <= high) {
  41065. const mid = low + Math.floor((high - low) / 2);
  41066. const currentOffset = getItemFromCache$1(props, mid, listCache).offset;
  41067. if (currentOffset === offset) {
  41068. return mid;
  41069. } else if (currentOffset < offset) {
  41070. low = mid + 1;
  41071. } else if (currentOffset > offset) {
  41072. high = mid - 1;
  41073. }
  41074. }
  41075. return Math.max(0, low - 1);
  41076. };
  41077. const es$1 = (props, listCache, index, offset) => {
  41078. const { total } = props;
  41079. let exponent = 1;
  41080. while (index < total && getItemFromCache$1(props, index, listCache).offset < offset) {
  41081. index += exponent;
  41082. exponent *= 2;
  41083. }
  41084. return bs$1(props, listCache, Math.floor(index / 2), Math.min(index, total - 1), offset);
  41085. };
  41086. const getEstimatedTotalSize = ({ total }, { items, estimatedItemSize, lastVisitedIndex }) => {
  41087. let totalSizeOfMeasuredItems = 0;
  41088. if (lastVisitedIndex >= total) {
  41089. lastVisitedIndex = total - 1;
  41090. }
  41091. if (lastVisitedIndex >= 0) {
  41092. const item = items[lastVisitedIndex];
  41093. totalSizeOfMeasuredItems = item.offset + item.size;
  41094. }
  41095. const numUnmeasuredItems = total - lastVisitedIndex - 1;
  41096. const totalSizeOfUnmeasuredItems = numUnmeasuredItems * estimatedItemSize;
  41097. return totalSizeOfMeasuredItems + totalSizeOfUnmeasuredItems;
  41098. };
  41099. const DynamicSizeList = createList$1({
  41100. name: "ElDynamicSizeList",
  41101. getItemOffset: (props, index, listCache) => getItemFromCache$1(props, index, listCache).offset,
  41102. getItemSize: (_, index, { items }) => items[index].size,
  41103. getEstimatedTotalSize,
  41104. getOffset: (props, index, alignment, scrollOffset, listCache) => {
  41105. const { height, layout, width } = props;
  41106. const size = isHorizontal(layout) ? width : height;
  41107. const item = getItemFromCache$1(props, index, listCache);
  41108. const estimatedTotalSize = getEstimatedTotalSize(props, listCache);
  41109. const maxOffset = Math.max(0, Math.min(estimatedTotalSize - size, item.offset));
  41110. const minOffset = Math.max(0, item.offset - size + item.size);
  41111. if (alignment === SMART_ALIGNMENT) {
  41112. if (scrollOffset >= minOffset - size && scrollOffset <= maxOffset + size) {
  41113. alignment = AUTO_ALIGNMENT;
  41114. } else {
  41115. alignment = CENTERED_ALIGNMENT;
  41116. }
  41117. }
  41118. switch (alignment) {
  41119. case START_ALIGNMENT: {
  41120. return maxOffset;
  41121. }
  41122. case END_ALIGNMENT: {
  41123. return minOffset;
  41124. }
  41125. case CENTERED_ALIGNMENT: {
  41126. return Math.round(minOffset + (maxOffset - minOffset) / 2);
  41127. }
  41128. case AUTO_ALIGNMENT:
  41129. default: {
  41130. if (scrollOffset >= minOffset && scrollOffset <= maxOffset) {
  41131. return scrollOffset;
  41132. } else if (scrollOffset < minOffset) {
  41133. return minOffset;
  41134. } else {
  41135. return maxOffset;
  41136. }
  41137. }
  41138. }
  41139. },
  41140. getStartIndexForOffset: (props, offset, listCache) => findItem$1(props, listCache, offset),
  41141. getStopIndexForStartIndex: (props, startIndex, scrollOffset, listCache) => {
  41142. const { height, total, layout, width } = props;
  41143. const size = isHorizontal(layout) ? width : height;
  41144. const item = getItemFromCache$1(props, startIndex, listCache);
  41145. const maxOffset = scrollOffset + size;
  41146. let offset = item.offset + item.size;
  41147. let stopIndex = startIndex;
  41148. while (stopIndex < total - 1 && offset < maxOffset) {
  41149. stopIndex++;
  41150. offset += getItemFromCache$1(props, stopIndex, listCache).size;
  41151. }
  41152. return stopIndex;
  41153. },
  41154. initCache({ estimatedItemSize = DEFAULT_DYNAMIC_LIST_ITEM_SIZE }, instance) {
  41155. const cache = {
  41156. items: {},
  41157. estimatedItemSize,
  41158. lastVisitedIndex: -1
  41159. };
  41160. cache.clearCacheAfterIndex = (index, forceUpdate = true) => {
  41161. var _a, _b;
  41162. cache.lastVisitedIndex = Math.min(cache.lastVisitedIndex, index - 1);
  41163. (_a = instance.exposed) == null ? void 0 : _a.getItemStyleCache(-1);
  41164. if (forceUpdate) {
  41165. (_b = instance.proxy) == null ? void 0 : _b.$forceUpdate();
  41166. }
  41167. };
  41168. return cache;
  41169. },
  41170. clearCache: false,
  41171. validateProps: ({ itemSize }) => {
  41172. }
  41173. });
  41174. var DynamicSizeList$1 = DynamicSizeList;
  41175. const useGridWheel = ({ atXEndEdge, atXStartEdge, atYEndEdge, atYStartEdge }, onWheelDelta) => {
  41176. let frameHandle = null;
  41177. let xOffset = 0;
  41178. let yOffset = 0;
  41179. const hasReachedEdge = (x, y) => {
  41180. const xEdgeReached = x <= 0 && atXStartEdge.value || x >= 0 && atXEndEdge.value;
  41181. const yEdgeReached = y <= 0 && atYStartEdge.value || y >= 0 && atYEndEdge.value;
  41182. return xEdgeReached && yEdgeReached;
  41183. };
  41184. const onWheel = (e) => {
  41185. cAF(frameHandle);
  41186. let x = e.deltaX;
  41187. let y = e.deltaY;
  41188. if (Math.abs(x) > Math.abs(y)) {
  41189. y = 0;
  41190. } else {
  41191. x = 0;
  41192. }
  41193. if (e.shiftKey && y !== 0) {
  41194. x = y;
  41195. y = 0;
  41196. }
  41197. if (hasReachedEdge(xOffset, yOffset) && hasReachedEdge(xOffset + x, yOffset + y))
  41198. return;
  41199. xOffset += x;
  41200. yOffset += y;
  41201. e.preventDefault();
  41202. frameHandle = rAF(() => {
  41203. onWheelDelta(xOffset, yOffset);
  41204. xOffset = 0;
  41205. yOffset = 0;
  41206. });
  41207. };
  41208. return {
  41209. hasReachedEdge,
  41210. onWheel
  41211. };
  41212. };
  41213. const createGrid = ({
  41214. name,
  41215. clearCache,
  41216. getColumnPosition,
  41217. getColumnStartIndexForOffset,
  41218. getColumnStopIndexForStartIndex,
  41219. getEstimatedTotalHeight,
  41220. getEstimatedTotalWidth,
  41221. getColumnOffset,
  41222. getRowOffset,
  41223. getRowPosition,
  41224. getRowStartIndexForOffset,
  41225. getRowStopIndexForStartIndex,
  41226. initCache,
  41227. injectToInstance,
  41228. validateProps
  41229. }) => {
  41230. return vue.defineComponent({
  41231. name: name != null ? name : "ElVirtualList",
  41232. props: virtualizedGridProps,
  41233. emits: [ITEM_RENDER_EVT, SCROLL_EVT],
  41234. setup(props, { emit, expose, slots }) {
  41235. const ns = useNamespace("vl");
  41236. validateProps(props);
  41237. const instance = vue.getCurrentInstance();
  41238. const cache = vue.ref(initCache(props, instance));
  41239. injectToInstance == null ? void 0 : injectToInstance(instance, cache);
  41240. const windowRef = vue.ref();
  41241. const hScrollbar = vue.ref();
  41242. const vScrollbar = vue.ref();
  41243. const innerRef = vue.ref(null);
  41244. const states = vue.ref({
  41245. isScrolling: false,
  41246. scrollLeft: isNumber(props.initScrollLeft) ? props.initScrollLeft : 0,
  41247. scrollTop: isNumber(props.initScrollTop) ? props.initScrollTop : 0,
  41248. updateRequested: false,
  41249. xAxisScrollDir: FORWARD,
  41250. yAxisScrollDir: FORWARD
  41251. });
  41252. const getItemStyleCache = useCache();
  41253. const parsedHeight = vue.computed(() => Number.parseInt(`${props.height}`, 10));
  41254. const parsedWidth = vue.computed(() => Number.parseInt(`${props.width}`, 10));
  41255. const columnsToRender = vue.computed(() => {
  41256. const { totalColumn, totalRow, columnCache } = props;
  41257. const { isScrolling, xAxisScrollDir, scrollLeft } = vue.unref(states);
  41258. if (totalColumn === 0 || totalRow === 0) {
  41259. return [0, 0, 0, 0];
  41260. }
  41261. const startIndex = getColumnStartIndexForOffset(props, scrollLeft, vue.unref(cache));
  41262. const stopIndex = getColumnStopIndexForStartIndex(props, startIndex, scrollLeft, vue.unref(cache));
  41263. const cacheBackward = !isScrolling || xAxisScrollDir === BACKWARD ? Math.max(1, columnCache) : 1;
  41264. const cacheForward = !isScrolling || xAxisScrollDir === FORWARD ? Math.max(1, columnCache) : 1;
  41265. return [
  41266. Math.max(0, startIndex - cacheBackward),
  41267. Math.max(0, Math.min(totalColumn - 1, stopIndex + cacheForward)),
  41268. startIndex,
  41269. stopIndex
  41270. ];
  41271. });
  41272. const rowsToRender = vue.computed(() => {
  41273. const { totalColumn, totalRow, rowCache } = props;
  41274. const { isScrolling, yAxisScrollDir, scrollTop } = vue.unref(states);
  41275. if (totalColumn === 0 || totalRow === 0) {
  41276. return [0, 0, 0, 0];
  41277. }
  41278. const startIndex = getRowStartIndexForOffset(props, scrollTop, vue.unref(cache));
  41279. const stopIndex = getRowStopIndexForStartIndex(props, startIndex, scrollTop, vue.unref(cache));
  41280. const cacheBackward = !isScrolling || yAxisScrollDir === BACKWARD ? Math.max(1, rowCache) : 1;
  41281. const cacheForward = !isScrolling || yAxisScrollDir === FORWARD ? Math.max(1, rowCache) : 1;
  41282. return [
  41283. Math.max(0, startIndex - cacheBackward),
  41284. Math.max(0, Math.min(totalRow - 1, stopIndex + cacheForward)),
  41285. startIndex,
  41286. stopIndex
  41287. ];
  41288. });
  41289. const estimatedTotalHeight = vue.computed(() => getEstimatedTotalHeight(props, vue.unref(cache)));
  41290. const estimatedTotalWidth = vue.computed(() => getEstimatedTotalWidth(props, vue.unref(cache)));
  41291. const windowStyle = vue.computed(() => {
  41292. var _a;
  41293. return [
  41294. {
  41295. position: "relative",
  41296. overflow: "hidden",
  41297. WebkitOverflowScrolling: "touch",
  41298. willChange: "transform"
  41299. },
  41300. {
  41301. direction: props.direction,
  41302. height: isNumber(props.height) ? `${props.height}px` : props.height,
  41303. width: isNumber(props.width) ? `${props.width}px` : props.width
  41304. },
  41305. (_a = props.style) != null ? _a : {}
  41306. ];
  41307. });
  41308. const innerStyle = vue.computed(() => {
  41309. const width = `${vue.unref(estimatedTotalWidth)}px`;
  41310. const height = `${vue.unref(estimatedTotalHeight)}px`;
  41311. return {
  41312. height,
  41313. pointerEvents: vue.unref(states).isScrolling ? "none" : void 0,
  41314. width
  41315. };
  41316. });
  41317. const emitEvents = () => {
  41318. const { totalColumn, totalRow } = props;
  41319. if (totalColumn > 0 && totalRow > 0) {
  41320. const [
  41321. columnCacheStart,
  41322. columnCacheEnd,
  41323. columnVisibleStart,
  41324. columnVisibleEnd
  41325. ] = vue.unref(columnsToRender);
  41326. const [rowCacheStart, rowCacheEnd, rowVisibleStart, rowVisibleEnd] = vue.unref(rowsToRender);
  41327. emit(ITEM_RENDER_EVT, {
  41328. columnCacheStart,
  41329. columnCacheEnd,
  41330. rowCacheStart,
  41331. rowCacheEnd,
  41332. columnVisibleStart,
  41333. columnVisibleEnd,
  41334. rowVisibleStart,
  41335. rowVisibleEnd
  41336. });
  41337. }
  41338. const {
  41339. scrollLeft,
  41340. scrollTop,
  41341. updateRequested,
  41342. xAxisScrollDir,
  41343. yAxisScrollDir
  41344. } = vue.unref(states);
  41345. emit(SCROLL_EVT, {
  41346. xAxisScrollDir,
  41347. scrollLeft,
  41348. yAxisScrollDir,
  41349. scrollTop,
  41350. updateRequested
  41351. });
  41352. };
  41353. const onScroll = (e) => {
  41354. const {
  41355. clientHeight,
  41356. clientWidth,
  41357. scrollHeight,
  41358. scrollLeft,
  41359. scrollTop,
  41360. scrollWidth
  41361. } = e.currentTarget;
  41362. const _states = vue.unref(states);
  41363. if (_states.scrollTop === scrollTop && _states.scrollLeft === scrollLeft) {
  41364. return;
  41365. }
  41366. let _scrollLeft = scrollLeft;
  41367. if (isRTL(props.direction)) {
  41368. switch (getRTLOffsetType()) {
  41369. case RTL_OFFSET_NAG:
  41370. _scrollLeft = -scrollLeft;
  41371. break;
  41372. case RTL_OFFSET_POS_DESC:
  41373. _scrollLeft = scrollWidth - clientWidth - scrollLeft;
  41374. break;
  41375. }
  41376. }
  41377. states.value = {
  41378. ..._states,
  41379. isScrolling: true,
  41380. scrollLeft: _scrollLeft,
  41381. scrollTop: Math.max(0, Math.min(scrollTop, scrollHeight - clientHeight)),
  41382. updateRequested: true,
  41383. xAxisScrollDir: getScrollDir(_states.scrollLeft, _scrollLeft),
  41384. yAxisScrollDir: getScrollDir(_states.scrollTop, scrollTop)
  41385. };
  41386. vue.nextTick(() => resetIsScrolling());
  41387. onUpdated();
  41388. emitEvents();
  41389. };
  41390. const onVerticalScroll = (distance, totalSteps) => {
  41391. const height = vue.unref(parsedHeight);
  41392. const offset = (estimatedTotalHeight.value - height) / totalSteps * distance;
  41393. scrollTo({
  41394. scrollTop: Math.min(estimatedTotalHeight.value - height, offset)
  41395. });
  41396. };
  41397. const onHorizontalScroll = (distance, totalSteps) => {
  41398. const width = vue.unref(parsedWidth);
  41399. const offset = (estimatedTotalWidth.value - width) / totalSteps * distance;
  41400. scrollTo({
  41401. scrollLeft: Math.min(estimatedTotalWidth.value - width, offset)
  41402. });
  41403. };
  41404. const { onWheel } = useGridWheel({
  41405. atXStartEdge: vue.computed(() => states.value.scrollLeft <= 0),
  41406. atXEndEdge: vue.computed(() => states.value.scrollLeft >= estimatedTotalWidth.value - vue.unref(parsedWidth)),
  41407. atYStartEdge: vue.computed(() => states.value.scrollTop <= 0),
  41408. atYEndEdge: vue.computed(() => states.value.scrollTop >= estimatedTotalHeight.value - vue.unref(parsedHeight))
  41409. }, (x, y) => {
  41410. var _a, _b, _c, _d;
  41411. (_b = (_a = hScrollbar.value) == null ? void 0 : _a.onMouseUp) == null ? void 0 : _b.call(_a);
  41412. (_d = (_c = vScrollbar.value) == null ? void 0 : _c.onMouseUp) == null ? void 0 : _d.call(_c);
  41413. const width = vue.unref(parsedWidth);
  41414. const height = vue.unref(parsedHeight);
  41415. scrollTo({
  41416. scrollLeft: Math.min(states.value.scrollLeft + x, estimatedTotalWidth.value - width),
  41417. scrollTop: Math.min(states.value.scrollTop + y, estimatedTotalHeight.value - height)
  41418. });
  41419. });
  41420. useEventListener(windowRef, "wheel", onWheel, {
  41421. passive: false
  41422. });
  41423. const scrollTo = ({
  41424. scrollLeft = states.value.scrollLeft,
  41425. scrollTop = states.value.scrollTop
  41426. }) => {
  41427. scrollLeft = Math.max(scrollLeft, 0);
  41428. scrollTop = Math.max(scrollTop, 0);
  41429. const _states = vue.unref(states);
  41430. if (scrollTop === _states.scrollTop && scrollLeft === _states.scrollLeft) {
  41431. return;
  41432. }
  41433. states.value = {
  41434. ..._states,
  41435. xAxisScrollDir: getScrollDir(_states.scrollLeft, scrollLeft),
  41436. yAxisScrollDir: getScrollDir(_states.scrollTop, scrollTop),
  41437. scrollLeft,
  41438. scrollTop,
  41439. updateRequested: true
  41440. };
  41441. vue.nextTick(() => resetIsScrolling());
  41442. onUpdated();
  41443. emitEvents();
  41444. };
  41445. const scrollToItem = (rowIndex = 0, columnIdx = 0, alignment = AUTO_ALIGNMENT) => {
  41446. const _states = vue.unref(states);
  41447. columnIdx = Math.max(0, Math.min(columnIdx, props.totalColumn - 1));
  41448. rowIndex = Math.max(0, Math.min(rowIndex, props.totalRow - 1));
  41449. const scrollBarWidth = getScrollBarWidth(ns.namespace.value);
  41450. const _cache = vue.unref(cache);
  41451. const estimatedHeight = getEstimatedTotalHeight(props, _cache);
  41452. const estimatedWidth = getEstimatedTotalWidth(props, _cache);
  41453. scrollTo({
  41454. scrollLeft: getColumnOffset(props, columnIdx, alignment, _states.scrollLeft, _cache, estimatedWidth > props.width ? scrollBarWidth : 0),
  41455. scrollTop: getRowOffset(props, rowIndex, alignment, _states.scrollTop, _cache, estimatedHeight > props.height ? scrollBarWidth : 0)
  41456. });
  41457. };
  41458. const getItemStyle = (rowIndex, columnIndex) => {
  41459. const { columnWidth, direction, rowHeight } = props;
  41460. const itemStyleCache = getItemStyleCache.value(clearCache && columnWidth, clearCache && rowHeight, clearCache && direction);
  41461. const key = `${rowIndex},${columnIndex}`;
  41462. if (hasOwn(itemStyleCache, key)) {
  41463. return itemStyleCache[key];
  41464. } else {
  41465. const [, left] = getColumnPosition(props, columnIndex, vue.unref(cache));
  41466. const _cache = vue.unref(cache);
  41467. const rtl = isRTL(direction);
  41468. const [height, top] = getRowPosition(props, rowIndex, _cache);
  41469. const [width] = getColumnPosition(props, columnIndex, _cache);
  41470. itemStyleCache[key] = {
  41471. position: "absolute",
  41472. left: rtl ? void 0 : `${left}px`,
  41473. right: rtl ? `${left}px` : void 0,
  41474. top: `${top}px`,
  41475. height: `${height}px`,
  41476. width: `${width}px`
  41477. };
  41478. return itemStyleCache[key];
  41479. }
  41480. };
  41481. const resetIsScrolling = () => {
  41482. states.value.isScrolling = false;
  41483. vue.nextTick(() => {
  41484. getItemStyleCache.value(-1, null, null);
  41485. });
  41486. };
  41487. vue.onMounted(() => {
  41488. if (!isClient)
  41489. return;
  41490. const { initScrollLeft, initScrollTop } = props;
  41491. const windowElement = vue.unref(windowRef);
  41492. if (windowElement) {
  41493. if (isNumber(initScrollLeft)) {
  41494. windowElement.scrollLeft = initScrollLeft;
  41495. }
  41496. if (isNumber(initScrollTop)) {
  41497. windowElement.scrollTop = initScrollTop;
  41498. }
  41499. }
  41500. emitEvents();
  41501. });
  41502. const onUpdated = () => {
  41503. const { direction } = props;
  41504. const { scrollLeft, scrollTop, updateRequested } = vue.unref(states);
  41505. const windowElement = vue.unref(windowRef);
  41506. if (updateRequested && windowElement) {
  41507. if (direction === RTL) {
  41508. switch (getRTLOffsetType()) {
  41509. case RTL_OFFSET_NAG: {
  41510. windowElement.scrollLeft = -scrollLeft;
  41511. break;
  41512. }
  41513. case RTL_OFFSET_POS_ASC: {
  41514. windowElement.scrollLeft = scrollLeft;
  41515. break;
  41516. }
  41517. default: {
  41518. const { clientWidth, scrollWidth } = windowElement;
  41519. windowElement.scrollLeft = scrollWidth - clientWidth - scrollLeft;
  41520. break;
  41521. }
  41522. }
  41523. } else {
  41524. windowElement.scrollLeft = Math.max(0, scrollLeft);
  41525. }
  41526. windowElement.scrollTop = Math.max(0, scrollTop);
  41527. }
  41528. };
  41529. const { resetAfterColumnIndex, resetAfterRowIndex, resetAfter } = instance.proxy;
  41530. expose({
  41531. windowRef,
  41532. innerRef,
  41533. getItemStyleCache,
  41534. scrollTo,
  41535. scrollToItem,
  41536. states,
  41537. resetAfterColumnIndex,
  41538. resetAfterRowIndex,
  41539. resetAfter
  41540. });
  41541. const renderScrollbars = () => {
  41542. const {
  41543. scrollbarAlwaysOn,
  41544. scrollbarStartGap,
  41545. scrollbarEndGap,
  41546. totalColumn,
  41547. totalRow
  41548. } = props;
  41549. const width = vue.unref(parsedWidth);
  41550. const height = vue.unref(parsedHeight);
  41551. const estimatedWidth = vue.unref(estimatedTotalWidth);
  41552. const estimatedHeight = vue.unref(estimatedTotalHeight);
  41553. const { scrollLeft, scrollTop } = vue.unref(states);
  41554. const horizontalScrollbar = vue.h(Scrollbar, {
  41555. ref: hScrollbar,
  41556. alwaysOn: scrollbarAlwaysOn,
  41557. startGap: scrollbarStartGap,
  41558. endGap: scrollbarEndGap,
  41559. class: ns.e("horizontal"),
  41560. clientSize: width,
  41561. layout: "horizontal",
  41562. onScroll: onHorizontalScroll,
  41563. ratio: width * 100 / estimatedWidth,
  41564. scrollFrom: scrollLeft / (estimatedWidth - width),
  41565. total: totalRow,
  41566. visible: true
  41567. });
  41568. const verticalScrollbar = vue.h(Scrollbar, {
  41569. ref: vScrollbar,
  41570. alwaysOn: scrollbarAlwaysOn,
  41571. startGap: scrollbarStartGap,
  41572. endGap: scrollbarEndGap,
  41573. class: ns.e("vertical"),
  41574. clientSize: height,
  41575. layout: "vertical",
  41576. onScroll: onVerticalScroll,
  41577. ratio: height * 100 / estimatedHeight,
  41578. scrollFrom: scrollTop / (estimatedHeight - height),
  41579. total: totalColumn,
  41580. visible: true
  41581. });
  41582. return {
  41583. horizontalScrollbar,
  41584. verticalScrollbar
  41585. };
  41586. };
  41587. const renderItems = () => {
  41588. var _a;
  41589. const [columnStart, columnEnd] = vue.unref(columnsToRender);
  41590. const [rowStart, rowEnd] = vue.unref(rowsToRender);
  41591. const { data, totalColumn, totalRow, useIsScrolling, itemKey } = props;
  41592. const children = [];
  41593. if (totalRow > 0 && totalColumn > 0) {
  41594. for (let row = rowStart; row <= rowEnd; row++) {
  41595. for (let column = columnStart; column <= columnEnd; column++) {
  41596. const key = itemKey({ columnIndex: column, data, rowIndex: row });
  41597. children.push(vue.h(vue.Fragment, { key }, (_a = slots.default) == null ? void 0 : _a.call(slots, {
  41598. columnIndex: column,
  41599. data,
  41600. isScrolling: useIsScrolling ? vue.unref(states).isScrolling : void 0,
  41601. style: getItemStyle(row, column),
  41602. rowIndex: row
  41603. })));
  41604. }
  41605. }
  41606. }
  41607. return children;
  41608. };
  41609. const renderInner = () => {
  41610. const Inner = vue.resolveDynamicComponent(props.innerElement);
  41611. const children = renderItems();
  41612. return [
  41613. vue.h(Inner, vue.mergeProps(props.innerProps, {
  41614. style: vue.unref(innerStyle),
  41615. ref: innerRef
  41616. }), !isString$1(Inner) ? {
  41617. default: () => children
  41618. } : children)
  41619. ];
  41620. };
  41621. const renderWindow = () => {
  41622. const Container = vue.resolveDynamicComponent(props.containerElement);
  41623. const { horizontalScrollbar, verticalScrollbar } = renderScrollbars();
  41624. const Inner = renderInner();
  41625. return vue.h("div", {
  41626. key: 0,
  41627. class: ns.e("wrapper"),
  41628. role: props.role
  41629. }, [
  41630. vue.h(Container, {
  41631. class: props.className,
  41632. style: vue.unref(windowStyle),
  41633. onScroll,
  41634. ref: windowRef
  41635. }, !isString$1(Container) ? { default: () => Inner } : Inner),
  41636. horizontalScrollbar,
  41637. verticalScrollbar
  41638. ]);
  41639. };
  41640. return renderWindow;
  41641. }
  41642. });
  41643. };
  41644. var createGrid$1 = createGrid;
  41645. const FixedSizeGrid = createGrid$1({
  41646. name: "ElFixedSizeGrid",
  41647. getColumnPosition: ({ columnWidth }, index) => [
  41648. columnWidth,
  41649. index * columnWidth
  41650. ],
  41651. getRowPosition: ({ rowHeight }, index) => [
  41652. rowHeight,
  41653. index * rowHeight
  41654. ],
  41655. getEstimatedTotalHeight: ({ totalRow, rowHeight }) => rowHeight * totalRow,
  41656. getEstimatedTotalWidth: ({ totalColumn, columnWidth }) => columnWidth * totalColumn,
  41657. getColumnOffset: ({ totalColumn, columnWidth, width }, columnIndex, alignment, scrollLeft, _, scrollBarWidth) => {
  41658. width = Number(width);
  41659. const lastColumnOffset = Math.max(0, totalColumn * columnWidth - width);
  41660. const maxOffset = Math.min(lastColumnOffset, columnIndex * columnWidth);
  41661. const minOffset = Math.max(0, columnIndex * columnWidth - width + scrollBarWidth + columnWidth);
  41662. if (alignment === "smart") {
  41663. if (scrollLeft >= minOffset - width && scrollLeft <= maxOffset + width) {
  41664. alignment = AUTO_ALIGNMENT;
  41665. } else {
  41666. alignment = CENTERED_ALIGNMENT;
  41667. }
  41668. }
  41669. switch (alignment) {
  41670. case START_ALIGNMENT:
  41671. return maxOffset;
  41672. case END_ALIGNMENT:
  41673. return minOffset;
  41674. case CENTERED_ALIGNMENT: {
  41675. const middleOffset = Math.round(minOffset + (maxOffset - minOffset) / 2);
  41676. if (middleOffset < Math.ceil(width / 2)) {
  41677. return 0;
  41678. } else if (middleOffset > lastColumnOffset + Math.floor(width / 2)) {
  41679. return lastColumnOffset;
  41680. } else {
  41681. return middleOffset;
  41682. }
  41683. }
  41684. case AUTO_ALIGNMENT:
  41685. default:
  41686. if (scrollLeft >= minOffset && scrollLeft <= maxOffset) {
  41687. return scrollLeft;
  41688. } else if (minOffset > maxOffset) {
  41689. return minOffset;
  41690. } else if (scrollLeft < minOffset) {
  41691. return minOffset;
  41692. } else {
  41693. return maxOffset;
  41694. }
  41695. }
  41696. },
  41697. getRowOffset: ({ rowHeight, height, totalRow }, rowIndex, align, scrollTop, _, scrollBarWidth) => {
  41698. height = Number(height);
  41699. const lastRowOffset = Math.max(0, totalRow * rowHeight - height);
  41700. const maxOffset = Math.min(lastRowOffset, rowIndex * rowHeight);
  41701. const minOffset = Math.max(0, rowIndex * rowHeight - height + scrollBarWidth + rowHeight);
  41702. if (align === SMART_ALIGNMENT) {
  41703. if (scrollTop >= minOffset - height && scrollTop <= maxOffset + height) {
  41704. align = AUTO_ALIGNMENT;
  41705. } else {
  41706. align = CENTERED_ALIGNMENT;
  41707. }
  41708. }
  41709. switch (align) {
  41710. case START_ALIGNMENT:
  41711. return maxOffset;
  41712. case END_ALIGNMENT:
  41713. return minOffset;
  41714. case CENTERED_ALIGNMENT: {
  41715. const middleOffset = Math.round(minOffset + (maxOffset - minOffset) / 2);
  41716. if (middleOffset < Math.ceil(height / 2)) {
  41717. return 0;
  41718. } else if (middleOffset > lastRowOffset + Math.floor(height / 2)) {
  41719. return lastRowOffset;
  41720. } else {
  41721. return middleOffset;
  41722. }
  41723. }
  41724. case AUTO_ALIGNMENT:
  41725. default:
  41726. if (scrollTop >= minOffset && scrollTop <= maxOffset) {
  41727. return scrollTop;
  41728. } else if (minOffset > maxOffset) {
  41729. return minOffset;
  41730. } else if (scrollTop < minOffset) {
  41731. return minOffset;
  41732. } else {
  41733. return maxOffset;
  41734. }
  41735. }
  41736. },
  41737. getColumnStartIndexForOffset: ({ columnWidth, totalColumn }, scrollLeft) => Math.max(0, Math.min(totalColumn - 1, Math.floor(scrollLeft / columnWidth))),
  41738. getColumnStopIndexForStartIndex: ({ columnWidth, totalColumn, width }, startIndex, scrollLeft) => {
  41739. const left = startIndex * columnWidth;
  41740. const visibleColumnsCount = Math.ceil((width + scrollLeft - left) / columnWidth);
  41741. return Math.max(0, Math.min(totalColumn - 1, startIndex + visibleColumnsCount - 1));
  41742. },
  41743. getRowStartIndexForOffset: ({ rowHeight, totalRow }, scrollTop) => Math.max(0, Math.min(totalRow - 1, Math.floor(scrollTop / rowHeight))),
  41744. getRowStopIndexForStartIndex: ({ rowHeight, totalRow, height }, startIndex, scrollTop) => {
  41745. const top = startIndex * rowHeight;
  41746. const numVisibleRows = Math.ceil((height + scrollTop - top) / rowHeight);
  41747. return Math.max(0, Math.min(totalRow - 1, startIndex + numVisibleRows - 1));
  41748. },
  41749. initCache: () => void 0,
  41750. clearCache: true,
  41751. validateProps: ({ columnWidth, rowHeight }) => {
  41752. }
  41753. });
  41754. var FixedSizeGrid$1 = FixedSizeGrid;
  41755. const { max: max$2, min: min$2, floor } = Math;
  41756. const ACCESS_SIZER_KEY_MAP = {
  41757. column: "columnWidth",
  41758. row: "rowHeight"
  41759. };
  41760. const ACCESS_LAST_VISITED_KEY_MAP = {
  41761. column: "lastVisitedColumnIndex",
  41762. row: "lastVisitedRowIndex"
  41763. };
  41764. const getItemFromCache = (props, index, gridCache, type) => {
  41765. const [cachedItems, sizer, lastVisited] = [
  41766. gridCache[type],
  41767. props[ACCESS_SIZER_KEY_MAP[type]],
  41768. gridCache[ACCESS_LAST_VISITED_KEY_MAP[type]]
  41769. ];
  41770. if (index > lastVisited) {
  41771. let offset = 0;
  41772. if (lastVisited >= 0) {
  41773. const item = cachedItems[lastVisited];
  41774. offset = item.offset + item.size;
  41775. }
  41776. for (let i = lastVisited + 1; i <= index; i++) {
  41777. const size = sizer(i);
  41778. cachedItems[i] = {
  41779. offset,
  41780. size
  41781. };
  41782. offset += size;
  41783. }
  41784. gridCache[ACCESS_LAST_VISITED_KEY_MAP[type]] = index;
  41785. }
  41786. return cachedItems[index];
  41787. };
  41788. const bs = (props, gridCache, low, high, offset, type) => {
  41789. while (low <= high) {
  41790. const mid = low + floor((high - low) / 2);
  41791. const currentOffset = getItemFromCache(props, mid, gridCache, type).offset;
  41792. if (currentOffset === offset) {
  41793. return mid;
  41794. } else if (currentOffset < offset) {
  41795. low = mid + 1;
  41796. } else {
  41797. high = mid - 1;
  41798. }
  41799. }
  41800. return max$2(0, low - 1);
  41801. };
  41802. const es = (props, gridCache, idx, offset, type) => {
  41803. const total = type === "column" ? props.totalColumn : props.totalRow;
  41804. let exponent = 1;
  41805. while (idx < total && getItemFromCache(props, idx, gridCache, type).offset < offset) {
  41806. idx += exponent;
  41807. exponent *= 2;
  41808. }
  41809. return bs(props, gridCache, floor(idx / 2), min$2(idx, total - 1), offset, type);
  41810. };
  41811. const findItem = (props, gridCache, offset, type) => {
  41812. const [cache, lastVisitedIndex] = [
  41813. gridCache[type],
  41814. gridCache[ACCESS_LAST_VISITED_KEY_MAP[type]]
  41815. ];
  41816. const lastVisitedItemOffset = lastVisitedIndex > 0 ? cache[lastVisitedIndex].offset : 0;
  41817. if (lastVisitedItemOffset >= offset) {
  41818. return bs(props, gridCache, 0, lastVisitedIndex, offset, type);
  41819. }
  41820. return es(props, gridCache, max$2(0, lastVisitedIndex), offset, type);
  41821. };
  41822. const getEstimatedTotalHeight = ({ totalRow }, { estimatedRowHeight, lastVisitedRowIndex, row }) => {
  41823. let sizeOfVisitedRows = 0;
  41824. if (lastVisitedRowIndex >= totalRow) {
  41825. lastVisitedRowIndex = totalRow - 1;
  41826. }
  41827. if (lastVisitedRowIndex >= 0) {
  41828. const item = row[lastVisitedRowIndex];
  41829. sizeOfVisitedRows = item.offset + item.size;
  41830. }
  41831. const unvisitedItems = totalRow - lastVisitedRowIndex - 1;
  41832. const sizeOfUnvisitedItems = unvisitedItems * estimatedRowHeight;
  41833. return sizeOfVisitedRows + sizeOfUnvisitedItems;
  41834. };
  41835. const getEstimatedTotalWidth = ({ totalColumn }, { column, estimatedColumnWidth, lastVisitedColumnIndex }) => {
  41836. let sizeOfVisitedColumns = 0;
  41837. if (lastVisitedColumnIndex > totalColumn) {
  41838. lastVisitedColumnIndex = totalColumn - 1;
  41839. }
  41840. if (lastVisitedColumnIndex >= 0) {
  41841. const item = column[lastVisitedColumnIndex];
  41842. sizeOfVisitedColumns = item.offset + item.size;
  41843. }
  41844. const unvisitedItems = totalColumn - lastVisitedColumnIndex - 1;
  41845. const sizeOfUnvisitedItems = unvisitedItems * estimatedColumnWidth;
  41846. return sizeOfVisitedColumns + sizeOfUnvisitedItems;
  41847. };
  41848. const ACCESS_ESTIMATED_SIZE_KEY_MAP = {
  41849. column: getEstimatedTotalWidth,
  41850. row: getEstimatedTotalHeight
  41851. };
  41852. const getOffset$1 = (props, index, alignment, scrollOffset, cache, type, scrollBarWidth) => {
  41853. const [size, estimatedSizeAssociates] = [
  41854. type === "row" ? props.height : props.width,
  41855. ACCESS_ESTIMATED_SIZE_KEY_MAP[type]
  41856. ];
  41857. const item = getItemFromCache(props, index, cache, type);
  41858. const estimatedSize = estimatedSizeAssociates(props, cache);
  41859. const maxOffset = max$2(0, min$2(estimatedSize - size, item.offset));
  41860. const minOffset = max$2(0, item.offset - size + scrollBarWidth + item.size);
  41861. if (alignment === SMART_ALIGNMENT) {
  41862. if (scrollOffset >= minOffset - size && scrollOffset <= maxOffset + size) {
  41863. alignment = AUTO_ALIGNMENT;
  41864. } else {
  41865. alignment = CENTERED_ALIGNMENT;
  41866. }
  41867. }
  41868. switch (alignment) {
  41869. case START_ALIGNMENT: {
  41870. return maxOffset;
  41871. }
  41872. case END_ALIGNMENT: {
  41873. return minOffset;
  41874. }
  41875. case CENTERED_ALIGNMENT: {
  41876. return Math.round(minOffset + (maxOffset - minOffset) / 2);
  41877. }
  41878. case AUTO_ALIGNMENT:
  41879. default: {
  41880. if (scrollOffset >= minOffset && scrollOffset <= maxOffset) {
  41881. return scrollOffset;
  41882. } else if (minOffset > maxOffset) {
  41883. return minOffset;
  41884. } else if (scrollOffset < minOffset) {
  41885. return minOffset;
  41886. } else {
  41887. return maxOffset;
  41888. }
  41889. }
  41890. }
  41891. };
  41892. const DynamicSizeGrid = createGrid$1({
  41893. name: "ElDynamicSizeGrid",
  41894. getColumnPosition: (props, idx, cache) => {
  41895. const item = getItemFromCache(props, idx, cache, "column");
  41896. return [item.size, item.offset];
  41897. },
  41898. getRowPosition: (props, idx, cache) => {
  41899. const item = getItemFromCache(props, idx, cache, "row");
  41900. return [item.size, item.offset];
  41901. },
  41902. getColumnOffset: (props, columnIndex, alignment, scrollLeft, cache, scrollBarWidth) => getOffset$1(props, columnIndex, alignment, scrollLeft, cache, "column", scrollBarWidth),
  41903. getRowOffset: (props, rowIndex, alignment, scrollTop, cache, scrollBarWidth) => getOffset$1(props, rowIndex, alignment, scrollTop, cache, "row", scrollBarWidth),
  41904. getColumnStartIndexForOffset: (props, scrollLeft, cache) => findItem(props, cache, scrollLeft, "column"),
  41905. getColumnStopIndexForStartIndex: (props, startIndex, scrollLeft, cache) => {
  41906. const item = getItemFromCache(props, startIndex, cache, "column");
  41907. const maxOffset = scrollLeft + props.width;
  41908. let offset = item.offset + item.size;
  41909. let stopIndex = startIndex;
  41910. while (stopIndex < props.totalColumn - 1 && offset < maxOffset) {
  41911. stopIndex++;
  41912. offset += getItemFromCache(props, startIndex, cache, "column").size;
  41913. }
  41914. return stopIndex;
  41915. },
  41916. getEstimatedTotalHeight,
  41917. getEstimatedTotalWidth,
  41918. getRowStartIndexForOffset: (props, scrollTop, cache) => findItem(props, cache, scrollTop, "row"),
  41919. getRowStopIndexForStartIndex: (props, startIndex, scrollTop, cache) => {
  41920. const { totalRow, height } = props;
  41921. const item = getItemFromCache(props, startIndex, cache, "row");
  41922. const maxOffset = scrollTop + height;
  41923. let offset = item.size + item.offset;
  41924. let stopIndex = startIndex;
  41925. while (stopIndex < totalRow - 1 && offset < maxOffset) {
  41926. stopIndex++;
  41927. offset += getItemFromCache(props, stopIndex, cache, "row").size;
  41928. }
  41929. return stopIndex;
  41930. },
  41931. injectToInstance: (instance, cache) => {
  41932. const resetAfter = ({ columnIndex, rowIndex }, forceUpdate) => {
  41933. var _a, _b;
  41934. forceUpdate = isUndefined(forceUpdate) ? true : forceUpdate;
  41935. if (isNumber(columnIndex)) {
  41936. cache.value.lastVisitedColumnIndex = Math.min(cache.value.lastVisitedColumnIndex, columnIndex - 1);
  41937. }
  41938. if (isNumber(rowIndex)) {
  41939. cache.value.lastVisitedRowIndex = Math.min(cache.value.lastVisitedRowIndex, rowIndex - 1);
  41940. }
  41941. (_a = instance.exposed) == null ? void 0 : _a.getItemStyleCache.value(-1, null, null);
  41942. if (forceUpdate)
  41943. (_b = instance.proxy) == null ? void 0 : _b.$forceUpdate();
  41944. };
  41945. const resetAfterColumnIndex = (columnIndex, forceUpdate) => {
  41946. resetAfter({
  41947. columnIndex
  41948. }, forceUpdate);
  41949. };
  41950. const resetAfterRowIndex = (rowIndex, forceUpdate) => {
  41951. resetAfter({
  41952. rowIndex
  41953. }, forceUpdate);
  41954. };
  41955. Object.assign(instance.proxy, {
  41956. resetAfterColumnIndex,
  41957. resetAfterRowIndex,
  41958. resetAfter
  41959. });
  41960. },
  41961. initCache: ({
  41962. estimatedColumnWidth = DEFAULT_DYNAMIC_LIST_ITEM_SIZE,
  41963. estimatedRowHeight = DEFAULT_DYNAMIC_LIST_ITEM_SIZE
  41964. }) => {
  41965. const cache = {
  41966. column: {},
  41967. estimatedColumnWidth,
  41968. estimatedRowHeight,
  41969. lastVisitedColumnIndex: -1,
  41970. lastVisitedRowIndex: -1,
  41971. row: {}
  41972. };
  41973. return cache;
  41974. },
  41975. clearCache: false,
  41976. validateProps: ({ columnWidth, rowHeight }) => {
  41977. }
  41978. });
  41979. var DynamicSizeGrid$1 = DynamicSizeGrid;
  41980. const _sfc_main$L = vue.defineComponent({
  41981. props: {
  41982. item: {
  41983. type: Object,
  41984. required: true
  41985. },
  41986. style: {
  41987. type: Object
  41988. },
  41989. height: Number
  41990. },
  41991. setup() {
  41992. const ns = useNamespace("select");
  41993. return {
  41994. ns
  41995. };
  41996. }
  41997. });
  41998. function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
  41999. return vue.openBlock(), vue.createElementBlock("div", {
  42000. class: vue.normalizeClass(_ctx.ns.be("group", "title")),
  42001. style: vue.normalizeStyle({ ..._ctx.style, lineHeight: `${_ctx.height}px` })
  42002. }, vue.toDisplayString(_ctx.item.label), 7);
  42003. }
  42004. var GroupItem = /* @__PURE__ */ _export_sfc(_sfc_main$L, [["render", _sfc_render$7], ["__file", "group-item.vue"]]);
  42005. function useOption(props, { emit }) {
  42006. return {
  42007. hoverItem: () => {
  42008. if (!props.disabled) {
  42009. emit("hover", props.index);
  42010. }
  42011. },
  42012. selectOptionClick: () => {
  42013. if (!props.disabled) {
  42014. emit("select", props.item, props.index);
  42015. }
  42016. }
  42017. };
  42018. }
  42019. const selectV2Props = buildProps({
  42020. allowCreate: Boolean,
  42021. autocomplete: {
  42022. type: definePropType(String),
  42023. default: "none"
  42024. },
  42025. automaticDropdown: Boolean,
  42026. clearable: Boolean,
  42027. clearIcon: {
  42028. type: iconPropType,
  42029. default: circle_close_default
  42030. },
  42031. effect: {
  42032. type: definePropType(String),
  42033. default: "light"
  42034. },
  42035. collapseTags: Boolean,
  42036. collapseTagsTooltip: Boolean,
  42037. maxCollapseTags: {
  42038. type: Number,
  42039. default: 1
  42040. },
  42041. defaultFirstOption: Boolean,
  42042. disabled: Boolean,
  42043. estimatedOptionHeight: {
  42044. type: Number,
  42045. default: void 0
  42046. },
  42047. filterable: Boolean,
  42048. filterMethod: {
  42049. type: definePropType(Function)
  42050. },
  42051. height: {
  42052. type: Number,
  42053. default: 274
  42054. },
  42055. itemHeight: {
  42056. type: Number,
  42057. default: 34
  42058. },
  42059. id: String,
  42060. loading: Boolean,
  42061. loadingText: String,
  42062. modelValue: {
  42063. type: definePropType([Array, String, Number, Boolean, Object]),
  42064. default: void 0
  42065. },
  42066. multiple: Boolean,
  42067. multipleLimit: {
  42068. type: Number,
  42069. default: 0
  42070. },
  42071. name: String,
  42072. noDataText: String,
  42073. noMatchText: String,
  42074. remoteMethod: {
  42075. type: definePropType(Function)
  42076. },
  42077. reserveKeyword: {
  42078. type: Boolean,
  42079. default: true
  42080. },
  42081. options: {
  42082. type: definePropType(Array),
  42083. required: true
  42084. },
  42085. placeholder: {
  42086. type: String
  42087. },
  42088. teleported: useTooltipContentProps.teleported,
  42089. persistent: {
  42090. type: Boolean,
  42091. default: true
  42092. },
  42093. popperClass: useTooltipContentProps.popperClass,
  42094. popperStyle: useTooltipContentProps.popperStyle,
  42095. popperOptions: {
  42096. type: definePropType(Object),
  42097. default: () => ({})
  42098. },
  42099. remote: Boolean,
  42100. debounce: {
  42101. type: Number,
  42102. default: 300
  42103. },
  42104. size: useSizeProp,
  42105. props: {
  42106. type: definePropType(Object),
  42107. default: () => defaultProps$5
  42108. },
  42109. valueKey: {
  42110. type: String,
  42111. default: "value"
  42112. },
  42113. scrollbarAlwaysOn: Boolean,
  42114. validateEvent: {
  42115. type: Boolean,
  42116. default: true
  42117. },
  42118. offset: {
  42119. type: Number,
  42120. default: 12
  42121. },
  42122. showArrow: {
  42123. type: Boolean,
  42124. default: true
  42125. },
  42126. placement: {
  42127. type: definePropType(String),
  42128. values: Ee,
  42129. default: "bottom-start"
  42130. },
  42131. fallbackPlacements: {
  42132. type: definePropType(Array),
  42133. default: ["bottom-start", "top-start", "right", "left"]
  42134. },
  42135. tagType: { ...tagProps.type, default: "info" },
  42136. tagEffect: { ...tagProps.effect, default: "light" },
  42137. tabindex: {
  42138. type: [String, Number],
  42139. default: 0
  42140. },
  42141. appendTo: useTooltipContentProps.appendTo,
  42142. fitInputWidth: {
  42143. type: [Boolean, Number],
  42144. default: true,
  42145. validator(val) {
  42146. return isBoolean(val) || isNumber(val);
  42147. }
  42148. },
  42149. suffixIcon: {
  42150. type: iconPropType,
  42151. default: arrow_down_default
  42152. },
  42153. ...useEmptyValuesProps,
  42154. ...useAriaProps(["ariaLabel"])
  42155. });
  42156. const optionV2Props = buildProps({
  42157. data: Array,
  42158. disabled: Boolean,
  42159. hovering: Boolean,
  42160. item: {
  42161. type: definePropType(Object),
  42162. required: true
  42163. },
  42164. index: Number,
  42165. style: Object,
  42166. selected: Boolean,
  42167. created: Boolean
  42168. });
  42169. const selectV2Emits = {
  42170. [UPDATE_MODEL_EVENT]: (val) => true,
  42171. [CHANGE_EVENT]: (val) => true,
  42172. "remove-tag": (val) => true,
  42173. "visible-change": (visible) => true,
  42174. focus: (evt) => evt instanceof FocusEvent,
  42175. blur: (evt) => evt instanceof FocusEvent,
  42176. clear: () => true
  42177. };
  42178. const optionV2Emits = {
  42179. hover: (index) => isNumber(index),
  42180. select: (val, index) => true
  42181. };
  42182. const selectV2InjectionKey = Symbol("ElSelectV2Injection");
  42183. const _sfc_main$K = vue.defineComponent({
  42184. props: optionV2Props,
  42185. emits: optionV2Emits,
  42186. setup(props, { emit }) {
  42187. const select = vue.inject(selectV2InjectionKey);
  42188. const ns = useNamespace("select");
  42189. const { hoverItem, selectOptionClick } = useOption(props, { emit });
  42190. const { getLabel } = useProps(select.props);
  42191. const contentId = select.contentId;
  42192. return {
  42193. ns,
  42194. contentId,
  42195. hoverItem,
  42196. selectOptionClick,
  42197. getLabel
  42198. };
  42199. }
  42200. });
  42201. function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
  42202. return vue.openBlock(), vue.createElementBlock("li", {
  42203. id: `${_ctx.contentId}-${_ctx.index}`,
  42204. role: "option",
  42205. "aria-selected": _ctx.selected,
  42206. "aria-disabled": _ctx.disabled || void 0,
  42207. style: vue.normalizeStyle(_ctx.style),
  42208. class: vue.normalizeClass([
  42209. _ctx.ns.be("dropdown", "item"),
  42210. _ctx.ns.is("selected", _ctx.selected),
  42211. _ctx.ns.is("disabled", _ctx.disabled),
  42212. _ctx.ns.is("created", _ctx.created),
  42213. _ctx.ns.is("hovering", _ctx.hovering)
  42214. ]),
  42215. onMousemove: _ctx.hoverItem,
  42216. onClick: vue.withModifiers(_ctx.selectOptionClick, ["stop"])
  42217. }, [
  42218. vue.renderSlot(_ctx.$slots, "default", {
  42219. item: _ctx.item,
  42220. index: _ctx.index,
  42221. disabled: _ctx.disabled
  42222. }, () => [
  42223. vue.createElementVNode("span", null, vue.toDisplayString(_ctx.getLabel(_ctx.item)), 1)
  42224. ])
  42225. ], 46, ["id", "aria-selected", "aria-disabled", "onMousemove", "onClick"]);
  42226. }
  42227. var OptionItem = /* @__PURE__ */ _export_sfc(_sfc_main$K, [["render", _sfc_render$6], ["__file", "option-item.vue"]]);
  42228. const props = {
  42229. loading: Boolean,
  42230. data: {
  42231. type: Array,
  42232. required: true
  42233. },
  42234. hoveringIndex: Number,
  42235. width: Number,
  42236. id: String,
  42237. ariaLabel: String
  42238. };
  42239. var ElSelectMenu = vue.defineComponent({
  42240. name: "ElSelectDropdown",
  42241. props,
  42242. setup(props2, {
  42243. slots,
  42244. expose
  42245. }) {
  42246. const select = vue.inject(selectV2InjectionKey);
  42247. const ns = useNamespace("select");
  42248. const {
  42249. getLabel,
  42250. getValue,
  42251. getDisabled
  42252. } = useProps(select.props);
  42253. const cachedHeights = vue.ref([]);
  42254. const listRef = vue.ref();
  42255. const size = vue.computed(() => props2.data.length);
  42256. vue.watch(() => size.value, () => {
  42257. var _a, _b;
  42258. (_b = (_a = select.tooltipRef.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a);
  42259. });
  42260. const isSized = vue.computed(() => isUndefined(select.props.estimatedOptionHeight));
  42261. const listProps = vue.computed(() => {
  42262. if (isSized.value) {
  42263. return {
  42264. itemSize: select.props.itemHeight
  42265. };
  42266. }
  42267. return {
  42268. estimatedSize: select.props.estimatedOptionHeight,
  42269. itemSize: (idx) => cachedHeights.value[idx]
  42270. };
  42271. });
  42272. const contains = (arr = [], target) => {
  42273. const {
  42274. props: {
  42275. valueKey
  42276. }
  42277. } = select;
  42278. if (!isObject$1(target)) {
  42279. return arr.includes(target);
  42280. }
  42281. return arr && arr.some((item) => {
  42282. return vue.toRaw(get(item, valueKey)) === get(target, valueKey);
  42283. });
  42284. };
  42285. const isEqual = (selected, target) => {
  42286. if (!isObject$1(target)) {
  42287. return selected === target;
  42288. } else {
  42289. const {
  42290. valueKey
  42291. } = select.props;
  42292. return get(selected, valueKey) === get(target, valueKey);
  42293. }
  42294. };
  42295. const isItemSelected = (modelValue, target) => {
  42296. if (select.props.multiple) {
  42297. return contains(modelValue, getValue(target));
  42298. }
  42299. return isEqual(modelValue, getValue(target));
  42300. };
  42301. const isItemDisabled = (modelValue, selected) => {
  42302. const {
  42303. disabled,
  42304. multiple,
  42305. multipleLimit
  42306. } = select.props;
  42307. return disabled || !selected && (multiple ? multipleLimit > 0 && modelValue.length >= multipleLimit : false);
  42308. };
  42309. const isItemHovering = (target) => props2.hoveringIndex === target;
  42310. const scrollToItem = (index) => {
  42311. const list = listRef.value;
  42312. if (list) {
  42313. list.scrollToItem(index);
  42314. }
  42315. };
  42316. const resetScrollTop = () => {
  42317. const list = listRef.value;
  42318. if (list) {
  42319. list.resetScrollTop();
  42320. }
  42321. };
  42322. const exposed = {
  42323. listRef,
  42324. isSized,
  42325. isItemDisabled,
  42326. isItemHovering,
  42327. isItemSelected,
  42328. scrollToItem,
  42329. resetScrollTop
  42330. };
  42331. expose(exposed);
  42332. const Item = (itemProps) => {
  42333. const {
  42334. index,
  42335. data,
  42336. style
  42337. } = itemProps;
  42338. const sized = vue.unref(isSized);
  42339. const {
  42340. itemSize,
  42341. estimatedSize
  42342. } = vue.unref(listProps);
  42343. const {
  42344. modelValue
  42345. } = select.props;
  42346. const {
  42347. onSelect,
  42348. onHover
  42349. } = select;
  42350. const item = data[index];
  42351. if (item.type === "Group") {
  42352. return vue.createVNode(GroupItem, {
  42353. "item": item,
  42354. "style": style,
  42355. "height": sized ? itemSize : estimatedSize
  42356. }, null);
  42357. }
  42358. const isSelected = isItemSelected(modelValue, item);
  42359. const isDisabled = isItemDisabled(modelValue, isSelected);
  42360. const isHovering = isItemHovering(index);
  42361. return vue.createVNode(OptionItem, vue.mergeProps(itemProps, {
  42362. "selected": isSelected,
  42363. "disabled": getDisabled(item) || isDisabled,
  42364. "created": !!item.created,
  42365. "hovering": isHovering,
  42366. "item": item,
  42367. "onSelect": onSelect,
  42368. "onHover": onHover
  42369. }), {
  42370. default: (props3) => {
  42371. var _a;
  42372. return ((_a = slots.default) == null ? void 0 : _a.call(slots, props3)) || vue.createVNode("span", null, [getLabel(item)]);
  42373. }
  42374. });
  42375. };
  42376. const {
  42377. onKeyboardNavigate,
  42378. onKeyboardSelect
  42379. } = select;
  42380. const onForward = () => {
  42381. onKeyboardNavigate("forward");
  42382. };
  42383. const onBackward = () => {
  42384. onKeyboardNavigate("backward");
  42385. };
  42386. const onKeydown = (e) => {
  42387. const code = getEventCode(e);
  42388. const {
  42389. tab,
  42390. esc,
  42391. down,
  42392. up,
  42393. enter,
  42394. numpadEnter
  42395. } = EVENT_CODE;
  42396. if ([esc, down, up, enter, numpadEnter].includes(code)) {
  42397. e.preventDefault();
  42398. e.stopPropagation();
  42399. }
  42400. switch (code) {
  42401. case tab:
  42402. case esc:
  42403. break;
  42404. case down:
  42405. onForward();
  42406. break;
  42407. case up:
  42408. onBackward();
  42409. break;
  42410. case enter:
  42411. case numpadEnter:
  42412. onKeyboardSelect();
  42413. break;
  42414. }
  42415. };
  42416. return () => {
  42417. var _a, _b, _c, _d;
  42418. const {
  42419. data,
  42420. width
  42421. } = props2;
  42422. const {
  42423. height,
  42424. multiple,
  42425. scrollbarAlwaysOn
  42426. } = select.props;
  42427. const isScrollbarAlwaysOn = vue.computed(() => {
  42428. return isIOS ? true : scrollbarAlwaysOn;
  42429. });
  42430. const List = vue.unref(isSized) ? FixedSizeList$1 : DynamicSizeList$1;
  42431. return vue.createVNode("div", {
  42432. "class": [ns.b("dropdown"), ns.is("multiple", multiple)],
  42433. "style": {
  42434. width: `${width}px`
  42435. }
  42436. }, [(_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({
  42437. "ref": listRef
  42438. }, vue.unref(listProps), {
  42439. "className": ns.be("dropdown", "list"),
  42440. "scrollbarAlwaysOn": isScrollbarAlwaysOn.value,
  42441. "data": data,
  42442. "height": height,
  42443. "width": width,
  42444. "total": data.length,
  42445. "innerElement": "ul",
  42446. "innerProps": {
  42447. id: props2.id,
  42448. role: "listbox",
  42449. "aria-label": props2.ariaLabel,
  42450. "aria-orientation": "vertical"
  42451. },
  42452. "onKeydown": onKeydown
  42453. }), {
  42454. default: (props3) => vue.createVNode(Item, props3, null)
  42455. }), (_d = slots.footer) == null ? void 0 : _d.call(slots)]);
  42456. };
  42457. }
  42458. });
  42459. function useAllowCreate(props, states) {
  42460. const { aliasProps, getLabel, getValue } = useProps(props);
  42461. const createOptionCount = vue.ref(0);
  42462. const cachedSelectedOption = vue.ref();
  42463. const enableAllowCreateMode = vue.computed(() => {
  42464. return props.allowCreate && props.filterable;
  42465. });
  42466. vue.watch(() => props.options, (options) => {
  42467. const optionLabelsSet = new Set(options.map((option) => getLabel(option)));
  42468. states.createdOptions = states.createdOptions.filter((createdOption) => !optionLabelsSet.has(getLabel(createdOption)));
  42469. });
  42470. function hasExistingOption(query) {
  42471. const hasOption = (option) => getLabel(option) === query;
  42472. return props.options && props.options.some(hasOption) || states.createdOptions.some(hasOption);
  42473. }
  42474. function selectNewOption(option) {
  42475. if (!enableAllowCreateMode.value) {
  42476. return;
  42477. }
  42478. if (props.multiple && option.created) {
  42479. createOptionCount.value++;
  42480. } else {
  42481. cachedSelectedOption.value = option;
  42482. }
  42483. }
  42484. function createNewOption(query) {
  42485. if (enableAllowCreateMode.value) {
  42486. if (query && query.length > 0) {
  42487. if (hasExistingOption(query)) {
  42488. states.createdOptions = states.createdOptions.filter((createdOption) => getLabel(createdOption) !== states.previousQuery);
  42489. return;
  42490. }
  42491. const newOption = {
  42492. [aliasProps.value.value]: query,
  42493. [aliasProps.value.label]: query,
  42494. created: true,
  42495. [aliasProps.value.disabled]: false
  42496. };
  42497. if (states.createdOptions.length >= createOptionCount.value) {
  42498. states.createdOptions[createOptionCount.value] = newOption;
  42499. } else {
  42500. states.createdOptions.push(newOption);
  42501. }
  42502. } else {
  42503. if (props.multiple) {
  42504. states.createdOptions.length = createOptionCount.value;
  42505. } else {
  42506. const selectedOption = cachedSelectedOption.value;
  42507. states.createdOptions.length = 0;
  42508. if (selectedOption && selectedOption.created) {
  42509. states.createdOptions.push(selectedOption);
  42510. }
  42511. }
  42512. }
  42513. }
  42514. }
  42515. function removeNewOption(option) {
  42516. if (!enableAllowCreateMode.value || !option || !option.created || option.created && props.reserveKeyword && states.inputValue === getLabel(option)) {
  42517. return;
  42518. }
  42519. const idx = states.createdOptions.findIndex((it) => getValue(it) === getValue(option));
  42520. if (~idx) {
  42521. states.createdOptions.splice(idx, 1);
  42522. createOptionCount.value--;
  42523. }
  42524. }
  42525. function clearAllNewOption() {
  42526. if (enableAllowCreateMode.value) {
  42527. states.createdOptions.length = 0;
  42528. createOptionCount.value = 0;
  42529. }
  42530. }
  42531. return {
  42532. createNewOption,
  42533. removeNewOption,
  42534. selectNewOption,
  42535. clearAllNewOption
  42536. };
  42537. }
  42538. const useSelect$1 = (props, emit) => {
  42539. const { t } = useLocale();
  42540. const nsSelect = useNamespace("select");
  42541. const nsInput = useNamespace("input");
  42542. const { form: elForm, formItem: elFormItem } = useFormItem();
  42543. const { inputId } = useFormItemInputId(props, {
  42544. formItemContext: elFormItem
  42545. });
  42546. const { aliasProps, getLabel, getValue, getDisabled, getOptions } = useProps(props);
  42547. const { valueOnClear, isEmptyValue } = useEmptyValues(props);
  42548. const states = vue.reactive({
  42549. inputValue: "",
  42550. cachedOptions: [],
  42551. createdOptions: [],
  42552. hoveringIndex: -1,
  42553. inputHovering: false,
  42554. selectionWidth: 0,
  42555. collapseItemWidth: 0,
  42556. previousQuery: null,
  42557. previousValue: void 0,
  42558. selectedLabel: "",
  42559. menuVisibleOnFocus: false,
  42560. isBeforeHide: false
  42561. });
  42562. const popperSize = vue.ref(-1);
  42563. const debouncing = vue.ref(false);
  42564. const selectRef = vue.ref();
  42565. const selectionRef = vue.ref();
  42566. const tooltipRef = vue.ref();
  42567. const tagTooltipRef = vue.ref();
  42568. const inputRef = vue.ref();
  42569. const prefixRef = vue.ref();
  42570. const suffixRef = vue.ref();
  42571. const menuRef = vue.ref();
  42572. const tagMenuRef = vue.ref();
  42573. const collapseItemRef = vue.ref();
  42574. const {
  42575. isComposing,
  42576. handleCompositionStart,
  42577. handleCompositionEnd,
  42578. handleCompositionUpdate
  42579. } = useComposition({
  42580. afterComposition: (e) => onInput(e)
  42581. });
  42582. const selectDisabled = vue.computed(() => props.disabled || !!(elForm == null ? void 0 : elForm.disabled));
  42583. const { wrapperRef, isFocused, handleBlur } = useFocusController(inputRef, {
  42584. disabled: selectDisabled,
  42585. afterFocus() {
  42586. if (props.automaticDropdown && !expanded.value) {
  42587. expanded.value = true;
  42588. states.menuVisibleOnFocus = true;
  42589. }
  42590. },
  42591. beforeBlur(event) {
  42592. var _a, _b;
  42593. return ((_a = tooltipRef.value) == null ? void 0 : _a.isFocusInsideContent(event)) || ((_b = tagTooltipRef.value) == null ? void 0 : _b.isFocusInsideContent(event));
  42594. },
  42595. afterBlur() {
  42596. var _a;
  42597. expanded.value = false;
  42598. states.menuVisibleOnFocus = false;
  42599. if (props.validateEvent) {
  42600. (_a = elFormItem == null ? void 0 : elFormItem.validate) == null ? void 0 : _a.call(elFormItem, "blur").catch((err) => debugWarn(err));
  42601. }
  42602. }
  42603. });
  42604. const allOptions = vue.computed(() => filterOptions(""));
  42605. const hasOptions = vue.computed(() => {
  42606. if (props.loading)
  42607. return false;
  42608. return props.options.length > 0 || states.createdOptions.length > 0;
  42609. });
  42610. const filteredOptions = vue.ref([]);
  42611. const expanded = vue.ref(false);
  42612. const needStatusIcon = vue.computed(() => {
  42613. var _a;
  42614. return (_a = elForm == null ? void 0 : elForm.statusIcon) != null ? _a : false;
  42615. });
  42616. const popupHeight = vue.computed(() => {
  42617. const totalHeight = filteredOptions.value.length * props.itemHeight;
  42618. return totalHeight > props.height ? props.height : totalHeight;
  42619. });
  42620. const hasModelValue = vue.computed(() => {
  42621. return props.multiple ? isArray$1(props.modelValue) && props.modelValue.length > 0 : !isEmptyValue(props.modelValue);
  42622. });
  42623. const showClearBtn = vue.computed(() => {
  42624. return props.clearable && !selectDisabled.value && hasModelValue.value && (isFocused.value || states.inputHovering);
  42625. });
  42626. const iconComponent = vue.computed(() => props.remote && props.filterable ? "" : props.suffixIcon);
  42627. const iconReverse = vue.computed(() => iconComponent.value && nsSelect.is("reverse", expanded.value));
  42628. const validateState = vue.computed(() => (elFormItem == null ? void 0 : elFormItem.validateState) || "");
  42629. const validateIcon = vue.computed(() => {
  42630. if (!validateState.value)
  42631. return;
  42632. return ValidateComponentsMap[validateState.value];
  42633. });
  42634. const debounce = vue.computed(() => props.remote ? props.debounce : 0);
  42635. const isRemoteSearchEmpty = vue.computed(() => props.remote && !states.inputValue && !hasOptions.value);
  42636. const emptyText = vue.computed(() => {
  42637. if (props.loading) {
  42638. return props.loadingText || t("el.select.loading");
  42639. } else {
  42640. if (props.filterable && states.inputValue && hasOptions.value && filteredOptions.value.length === 0) {
  42641. return props.noMatchText || t("el.select.noMatch");
  42642. }
  42643. if (!hasOptions.value) {
  42644. return props.noDataText || t("el.select.noData");
  42645. }
  42646. }
  42647. return null;
  42648. });
  42649. const isFilterMethodValid = vue.computed(() => props.filterable && isFunction$1(props.filterMethod));
  42650. const isRemoteMethodValid = vue.computed(() => props.filterable && props.remote && isFunction$1(props.remoteMethod));
  42651. const filterOptions = (query) => {
  42652. const regexp = new RegExp(escapeStringRegexp(query), "i");
  42653. const isValidOption = (o) => {
  42654. if (isFilterMethodValid.value || isRemoteMethodValid.value)
  42655. return true;
  42656. return query ? regexp.test(getLabel(o) || "") : true;
  42657. };
  42658. if (props.loading) {
  42659. return [];
  42660. }
  42661. return [...states.createdOptions, ...props.options].reduce((all, item) => {
  42662. const options = getOptions(item);
  42663. if (isArray$1(options)) {
  42664. const filtered = options.filter(isValidOption);
  42665. if (filtered.length > 0) {
  42666. all.push({
  42667. label: getLabel(item),
  42668. type: "Group"
  42669. }, ...filtered);
  42670. }
  42671. } else if (props.remote || isValidOption(item)) {
  42672. all.push(item);
  42673. }
  42674. return all;
  42675. }, []);
  42676. };
  42677. const updateOptions = () => {
  42678. filteredOptions.value = filterOptions(states.inputValue);
  42679. };
  42680. const allOptionsValueMap = vue.computed(() => {
  42681. const valueMap = /* @__PURE__ */ new Map();
  42682. allOptions.value.forEach((option, index) => {
  42683. valueMap.set(getValueKey(getValue(option)), { option, index });
  42684. });
  42685. return valueMap;
  42686. });
  42687. const filteredOptionsValueMap = vue.computed(() => {
  42688. const valueMap = /* @__PURE__ */ new Map();
  42689. filteredOptions.value.forEach((option, index) => {
  42690. valueMap.set(getValueKey(getValue(option)), { option, index });
  42691. });
  42692. return valueMap;
  42693. });
  42694. const optionsAllDisabled = vue.computed(() => filteredOptions.value.every((option) => getDisabled(option)));
  42695. const selectSize = useFormSize();
  42696. const collapseTagSize = vue.computed(() => selectSize.value === "small" ? "small" : "default");
  42697. const calculatePopperSize = () => {
  42698. var _a;
  42699. if (isNumber(props.fitInputWidth)) {
  42700. popperSize.value = props.fitInputWidth;
  42701. return;
  42702. }
  42703. const width = ((_a = selectRef.value) == null ? void 0 : _a.offsetWidth) || 200;
  42704. if (!props.fitInputWidth && hasOptions.value) {
  42705. vue.nextTick(() => {
  42706. popperSize.value = Math.max(width, calculateLabelMaxWidth());
  42707. });
  42708. } else {
  42709. popperSize.value = width;
  42710. }
  42711. };
  42712. const calculateLabelMaxWidth = () => {
  42713. var _a, _b;
  42714. const canvas = document.createElement("canvas");
  42715. const ctx = canvas.getContext("2d");
  42716. const selector = nsSelect.be("dropdown", "item");
  42717. const dom = ((_b = (_a = menuRef.value) == null ? void 0 : _a.listRef) == null ? void 0 : _b.innerRef) || document;
  42718. const dropdownItemEl = dom.querySelector(`.${selector}`);
  42719. if (dropdownItemEl === null || ctx === null)
  42720. return 0;
  42721. const style = getComputedStyle(dropdownItemEl);
  42722. const padding = Number.parseFloat(style.paddingLeft) + Number.parseFloat(style.paddingRight);
  42723. ctx.font = `bold ${style.font.replace(new RegExp(`\\b${style.fontWeight}\\b`), "")}`;
  42724. const maxWidth = filteredOptions.value.reduce((max, option) => {
  42725. const metrics = ctx.measureText(getLabel(option));
  42726. return Math.max(metrics.width, max);
  42727. }, 0);
  42728. return maxWidth + padding;
  42729. };
  42730. const getGapWidth = () => {
  42731. if (!selectionRef.value)
  42732. return 0;
  42733. const style = window.getComputedStyle(selectionRef.value);
  42734. return Number.parseFloat(style.gap || "6px");
  42735. };
  42736. const tagStyle = vue.computed(() => {
  42737. const gapWidth = getGapWidth();
  42738. const inputSlotWidth = props.filterable ? gapWidth + MINIMUM_INPUT_WIDTH : 0;
  42739. const maxWidth = collapseItemRef.value && props.maxCollapseTags === 1 ? states.selectionWidth - states.collapseItemWidth - gapWidth - inputSlotWidth : states.selectionWidth - inputSlotWidth;
  42740. return { maxWidth: `${maxWidth}px` };
  42741. });
  42742. const collapseTagStyle = vue.computed(() => {
  42743. return { maxWidth: `${states.selectionWidth}px` };
  42744. });
  42745. const shouldShowPlaceholder = vue.computed(() => {
  42746. if (isArray$1(props.modelValue)) {
  42747. return props.modelValue.length === 0 && !states.inputValue;
  42748. }
  42749. return props.filterable ? !states.inputValue : true;
  42750. });
  42751. const currentPlaceholder = vue.computed(() => {
  42752. var _a;
  42753. const _placeholder = (_a = props.placeholder) != null ? _a : t("el.select.placeholder");
  42754. return props.multiple || !hasModelValue.value ? _placeholder : states.selectedLabel;
  42755. });
  42756. const popperRef = vue.computed(() => {
  42757. var _a, _b;
  42758. return (_b = (_a = tooltipRef.value) == null ? void 0 : _a.popperRef) == null ? void 0 : _b.contentRef;
  42759. });
  42760. const indexRef = vue.computed(() => {
  42761. if (props.multiple) {
  42762. const len = props.modelValue.length;
  42763. if (props.modelValue.length > 0 && filteredOptionsValueMap.value.has(props.modelValue[len - 1])) {
  42764. const { index } = filteredOptionsValueMap.value.get(props.modelValue[len - 1]);
  42765. return index;
  42766. }
  42767. } else {
  42768. if (!isEmptyValue(props.modelValue) && filteredOptionsValueMap.value.has(props.modelValue)) {
  42769. const { index } = filteredOptionsValueMap.value.get(props.modelValue);
  42770. return index;
  42771. }
  42772. }
  42773. return -1;
  42774. });
  42775. const dropdownMenuVisible = vue.computed({
  42776. get() {
  42777. return expanded.value && (props.loading || !isRemoteSearchEmpty.value) && (!debouncing.value || !isEmpty(states.previousQuery));
  42778. },
  42779. set(val) {
  42780. expanded.value = val;
  42781. }
  42782. });
  42783. const showTagList = vue.computed(() => {
  42784. if (!props.multiple) {
  42785. return [];
  42786. }
  42787. return props.collapseTags ? states.cachedOptions.slice(0, props.maxCollapseTags) : states.cachedOptions;
  42788. });
  42789. const collapseTagList = vue.computed(() => {
  42790. if (!props.multiple) {
  42791. return [];
  42792. }
  42793. return props.collapseTags ? states.cachedOptions.slice(props.maxCollapseTags) : [];
  42794. });
  42795. const {
  42796. createNewOption,
  42797. removeNewOption,
  42798. selectNewOption,
  42799. clearAllNewOption
  42800. } = useAllowCreate(props, states);
  42801. const toggleMenu = () => {
  42802. if (selectDisabled.value)
  42803. return;
  42804. if (states.menuVisibleOnFocus) {
  42805. states.menuVisibleOnFocus = false;
  42806. } else {
  42807. expanded.value = !expanded.value;
  42808. }
  42809. };
  42810. const onInputChange = () => {
  42811. if (states.inputValue.length > 0 && !expanded.value) {
  42812. expanded.value = true;
  42813. }
  42814. createNewOption(states.inputValue);
  42815. vue.nextTick(() => {
  42816. handleQueryChange(states.inputValue);
  42817. });
  42818. };
  42819. const debouncedOnInputChange = useDebounceFn(() => {
  42820. onInputChange();
  42821. debouncing.value = false;
  42822. }, debounce);
  42823. const handleQueryChange = (val) => {
  42824. if (states.previousQuery === val || isComposing.value) {
  42825. return;
  42826. }
  42827. states.previousQuery = val;
  42828. if (props.filterable && isFunction$1(props.filterMethod)) {
  42829. props.filterMethod(val);
  42830. } else if (props.filterable && props.remote && isFunction$1(props.remoteMethod)) {
  42831. props.remoteMethod(val);
  42832. }
  42833. if (props.defaultFirstOption && (props.filterable || props.remote) && filteredOptions.value.length) {
  42834. vue.nextTick(checkDefaultFirstOption);
  42835. } else {
  42836. vue.nextTick(updateHoveringIndex);
  42837. }
  42838. };
  42839. const checkDefaultFirstOption = () => {
  42840. const optionsInDropdown = filteredOptions.value.filter((n) => !n.disabled && n.type !== "Group");
  42841. const userCreatedOption = optionsInDropdown.find((n) => n.created);
  42842. const firstOriginOption = optionsInDropdown[0];
  42843. states.hoveringIndex = getValueIndex(filteredOptions.value, userCreatedOption || firstOriginOption);
  42844. };
  42845. const emitChange = (val) => {
  42846. if (!isEqual$1(props.modelValue, val)) {
  42847. emit(CHANGE_EVENT, val);
  42848. }
  42849. };
  42850. const update = (val) => {
  42851. emit(UPDATE_MODEL_EVENT, val);
  42852. emitChange(val);
  42853. states.previousValue = props.multiple ? String(val) : val;
  42854. vue.nextTick(() => {
  42855. if (props.multiple && isArray$1(props.modelValue)) {
  42856. const cachedOptions = states.cachedOptions.slice();
  42857. const selectedOptions = props.modelValue.map((value) => getOption(value, cachedOptions));
  42858. if (!isEqual$1(states.cachedOptions, selectedOptions)) {
  42859. states.cachedOptions = selectedOptions;
  42860. }
  42861. } else {
  42862. initStates(true);
  42863. }
  42864. });
  42865. };
  42866. const getValueIndex = (arr = [], value) => {
  42867. if (!isObject$1(value)) {
  42868. return arr.indexOf(value);
  42869. }
  42870. const valueKey = props.valueKey;
  42871. let index = -1;
  42872. arr.some((item, i) => {
  42873. if (get(item, valueKey) === get(value, valueKey)) {
  42874. index = i;
  42875. return true;
  42876. }
  42877. return false;
  42878. });
  42879. return index;
  42880. };
  42881. const getValueKey = (item) => {
  42882. return isObject$1(item) ? get(item, props.valueKey) : item;
  42883. };
  42884. const handleResize = () => {
  42885. calculatePopperSize();
  42886. };
  42887. const resetSelectionWidth = () => {
  42888. states.selectionWidth = Number.parseFloat(window.getComputedStyle(selectionRef.value).width);
  42889. };
  42890. const resetCollapseItemWidth = () => {
  42891. states.collapseItemWidth = collapseItemRef.value.getBoundingClientRect().width;
  42892. };
  42893. const updateTooltip = () => {
  42894. var _a, _b;
  42895. (_b = (_a = tooltipRef.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a);
  42896. };
  42897. const updateTagTooltip = () => {
  42898. var _a, _b;
  42899. (_b = (_a = tagTooltipRef.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a);
  42900. };
  42901. const onSelect = (option) => {
  42902. const optionValue = getValue(option);
  42903. if (props.multiple) {
  42904. let selectedOptions = props.modelValue.slice();
  42905. const index = getValueIndex(selectedOptions, optionValue);
  42906. if (index > -1) {
  42907. selectedOptions = [
  42908. ...selectedOptions.slice(0, index),
  42909. ...selectedOptions.slice(index + 1)
  42910. ];
  42911. states.cachedOptions.splice(index, 1);
  42912. removeNewOption(option);
  42913. } else if (props.multipleLimit <= 0 || selectedOptions.length < props.multipleLimit) {
  42914. selectedOptions = [...selectedOptions, optionValue];
  42915. states.cachedOptions.push(option);
  42916. selectNewOption(option);
  42917. }
  42918. update(selectedOptions);
  42919. if (option.created) {
  42920. handleQueryChange("");
  42921. }
  42922. if (props.filterable && !props.reserveKeyword) {
  42923. states.inputValue = "";
  42924. }
  42925. } else {
  42926. states.selectedLabel = getLabel(option);
  42927. !isEqual$1(props.modelValue, optionValue) && update(optionValue);
  42928. expanded.value = false;
  42929. selectNewOption(option);
  42930. if (!option.created) {
  42931. clearAllNewOption();
  42932. }
  42933. }
  42934. focus();
  42935. };
  42936. const deleteTag = (event, option) => {
  42937. let selectedOptions = props.modelValue.slice();
  42938. const index = getValueIndex(selectedOptions, getValue(option));
  42939. if (index > -1 && !selectDisabled.value) {
  42940. selectedOptions = [
  42941. ...props.modelValue.slice(0, index),
  42942. ...props.modelValue.slice(index + 1)
  42943. ];
  42944. states.cachedOptions.splice(index, 1);
  42945. update(selectedOptions);
  42946. emit("remove-tag", getValue(option));
  42947. removeNewOption(option);
  42948. }
  42949. event.stopPropagation();
  42950. focus();
  42951. };
  42952. const focus = () => {
  42953. var _a;
  42954. (_a = inputRef.value) == null ? void 0 : _a.focus();
  42955. };
  42956. const blur = () => {
  42957. var _a;
  42958. if (expanded.value) {
  42959. expanded.value = false;
  42960. vue.nextTick(() => {
  42961. var _a2;
  42962. return (_a2 = inputRef.value) == null ? void 0 : _a2.blur();
  42963. });
  42964. return;
  42965. }
  42966. (_a = inputRef.value) == null ? void 0 : _a.blur();
  42967. };
  42968. const handleEsc = () => {
  42969. if (states.inputValue.length > 0) {
  42970. states.inputValue = "";
  42971. } else {
  42972. expanded.value = false;
  42973. }
  42974. };
  42975. const getLastNotDisabledIndex = (value) => findLastIndex(value, (it) => !states.cachedOptions.some((option) => getValue(option) === it && getDisabled(option)));
  42976. const handleDel = (e) => {
  42977. const code = getEventCode(e);
  42978. if (!props.multiple)
  42979. return;
  42980. if (code === EVENT_CODE.delete)
  42981. return;
  42982. if (states.inputValue.length === 0) {
  42983. e.preventDefault();
  42984. const selected = props.modelValue.slice();
  42985. const lastNotDisabledIndex = getLastNotDisabledIndex(selected);
  42986. if (lastNotDisabledIndex < 0)
  42987. return;
  42988. const removeTagValue = selected[lastNotDisabledIndex];
  42989. selected.splice(lastNotDisabledIndex, 1);
  42990. const option = states.cachedOptions[lastNotDisabledIndex];
  42991. states.cachedOptions.splice(lastNotDisabledIndex, 1);
  42992. removeNewOption(option);
  42993. update(selected);
  42994. emit("remove-tag", removeTagValue);
  42995. }
  42996. };
  42997. const handleClear = () => {
  42998. let emptyValue;
  42999. if (isArray$1(props.modelValue)) {
  43000. emptyValue = [];
  43001. } else {
  43002. emptyValue = valueOnClear.value;
  43003. }
  43004. states.selectedLabel = "";
  43005. expanded.value = false;
  43006. update(emptyValue);
  43007. emit("clear");
  43008. clearAllNewOption();
  43009. focus();
  43010. };
  43011. const onKeyboardNavigate = (direction, hoveringIndex = void 0) => {
  43012. const options = filteredOptions.value;
  43013. if (!["forward", "backward"].includes(direction) || selectDisabled.value || options.length <= 0 || optionsAllDisabled.value || isComposing.value) {
  43014. return;
  43015. }
  43016. if (!expanded.value) {
  43017. return toggleMenu();
  43018. }
  43019. if (isUndefined(hoveringIndex)) {
  43020. hoveringIndex = states.hoveringIndex;
  43021. }
  43022. let newIndex = -1;
  43023. if (direction === "forward") {
  43024. newIndex = hoveringIndex + 1;
  43025. if (newIndex >= options.length) {
  43026. newIndex = 0;
  43027. }
  43028. } else if (direction === "backward") {
  43029. newIndex = hoveringIndex - 1;
  43030. if (newIndex < 0 || newIndex >= options.length) {
  43031. newIndex = options.length - 1;
  43032. }
  43033. }
  43034. const option = options[newIndex];
  43035. if (getDisabled(option) || option.type === "Group") {
  43036. return onKeyboardNavigate(direction, newIndex);
  43037. } else {
  43038. states.hoveringIndex = newIndex;
  43039. scrollToItem(newIndex);
  43040. }
  43041. };
  43042. const onKeyboardSelect = () => {
  43043. if (!expanded.value) {
  43044. return toggleMenu();
  43045. } else if (~states.hoveringIndex && filteredOptions.value[states.hoveringIndex]) {
  43046. onSelect(filteredOptions.value[states.hoveringIndex]);
  43047. }
  43048. };
  43049. const onHoverOption = (idx) => {
  43050. states.hoveringIndex = idx != null ? idx : -1;
  43051. };
  43052. const updateHoveringIndex = () => {
  43053. if (!props.multiple) {
  43054. states.hoveringIndex = filteredOptions.value.findIndex((item) => {
  43055. return getValueKey(getValue(item)) === getValueKey(props.modelValue);
  43056. });
  43057. } else {
  43058. states.hoveringIndex = filteredOptions.value.findIndex((item) => props.modelValue.some((modelValue) => getValueKey(modelValue) === getValueKey(getValue(item))));
  43059. }
  43060. };
  43061. const onInput = (event) => {
  43062. states.inputValue = event.target.value;
  43063. if (props.remote) {
  43064. debouncing.value = true;
  43065. debouncedOnInputChange();
  43066. } else {
  43067. return onInputChange();
  43068. }
  43069. };
  43070. const handleClickOutside = (event) => {
  43071. expanded.value = false;
  43072. if (isFocused.value) {
  43073. const _event = new FocusEvent("blur", event);
  43074. handleBlur(_event);
  43075. }
  43076. };
  43077. const handleMenuEnter = () => {
  43078. states.isBeforeHide = false;
  43079. return vue.nextTick(() => {
  43080. if (~indexRef.value) {
  43081. scrollToItem(states.hoveringIndex);
  43082. }
  43083. });
  43084. };
  43085. const scrollToItem = (index) => {
  43086. menuRef.value.scrollToItem(index);
  43087. };
  43088. const getOption = (value, cachedOptions) => {
  43089. const selectValue = getValueKey(value);
  43090. if (allOptionsValueMap.value.has(selectValue)) {
  43091. const { option } = allOptionsValueMap.value.get(selectValue);
  43092. return option;
  43093. }
  43094. if (cachedOptions && cachedOptions.length) {
  43095. const option = cachedOptions.find((option2) => getValueKey(getValue(option2)) === selectValue);
  43096. if (option) {
  43097. return option;
  43098. }
  43099. }
  43100. return {
  43101. [aliasProps.value.value]: value,
  43102. [aliasProps.value.label]: value
  43103. };
  43104. };
  43105. const getIndex = (option) => {
  43106. var _a, _b;
  43107. return (_b = (_a = allOptionsValueMap.value.get(getValue(option))) == null ? void 0 : _a.index) != null ? _b : -1;
  43108. };
  43109. const initStates = (needUpdateSelectedLabel = false) => {
  43110. if (props.multiple) {
  43111. if (props.modelValue.length > 0) {
  43112. const cachedOptions = states.cachedOptions.slice();
  43113. states.cachedOptions.length = 0;
  43114. states.previousValue = props.modelValue.toString();
  43115. for (const value of props.modelValue) {
  43116. const option = getOption(value, cachedOptions);
  43117. states.cachedOptions.push(option);
  43118. }
  43119. } else {
  43120. states.cachedOptions = [];
  43121. states.previousValue = void 0;
  43122. }
  43123. } else {
  43124. if (hasModelValue.value) {
  43125. states.previousValue = props.modelValue;
  43126. const options = filteredOptions.value;
  43127. const selectedItemIndex = options.findIndex((option) => getValueKey(getValue(option)) === getValueKey(props.modelValue));
  43128. if (~selectedItemIndex) {
  43129. states.selectedLabel = getLabel(options[selectedItemIndex]);
  43130. } else {
  43131. if (!states.selectedLabel || needUpdateSelectedLabel) {
  43132. states.selectedLabel = getValueKey(props.modelValue);
  43133. }
  43134. }
  43135. } else {
  43136. states.selectedLabel = "";
  43137. states.previousValue = void 0;
  43138. }
  43139. }
  43140. clearAllNewOption();
  43141. calculatePopperSize();
  43142. };
  43143. vue.watch(() => props.fitInputWidth, () => {
  43144. calculatePopperSize();
  43145. });
  43146. vue.watch(expanded, (val) => {
  43147. if (val) {
  43148. if (!props.persistent) {
  43149. calculatePopperSize();
  43150. }
  43151. handleQueryChange("");
  43152. } else {
  43153. states.inputValue = "";
  43154. states.previousQuery = null;
  43155. states.isBeforeHide = true;
  43156. createNewOption("");
  43157. }
  43158. emit("visible-change", val);
  43159. });
  43160. vue.watch(() => props.modelValue, (val, oldVal) => {
  43161. var _a;
  43162. const isValEmpty = !val || isArray$1(val) && val.length === 0;
  43163. if (isValEmpty || props.multiple && !isEqual$1(val.toString(), states.previousValue) || !props.multiple && getValueKey(val) !== getValueKey(states.previousValue)) {
  43164. initStates(true);
  43165. }
  43166. if (!isEqual$1(val, oldVal) && props.validateEvent) {
  43167. (_a = elFormItem == null ? void 0 : elFormItem.validate) == null ? void 0 : _a.call(elFormItem, "change").catch((err) => debugWarn(err));
  43168. }
  43169. }, {
  43170. deep: true
  43171. });
  43172. vue.watch(() => props.options, () => {
  43173. const input = inputRef.value;
  43174. if (!input || input && document.activeElement !== input) {
  43175. initStates();
  43176. }
  43177. }, {
  43178. deep: true,
  43179. flush: "post"
  43180. });
  43181. vue.watch(() => filteredOptions.value, () => {
  43182. calculatePopperSize();
  43183. return menuRef.value && vue.nextTick(menuRef.value.resetScrollTop);
  43184. });
  43185. vue.watchEffect(() => {
  43186. if (states.isBeforeHide)
  43187. return;
  43188. updateOptions();
  43189. });
  43190. vue.watchEffect(() => {
  43191. const { valueKey, options } = props;
  43192. const duplicateValue = /* @__PURE__ */ new Map();
  43193. for (const item of options) {
  43194. const optionValue = getValue(item);
  43195. let v = optionValue;
  43196. if (isObject$1(v)) {
  43197. v = get(optionValue, valueKey);
  43198. }
  43199. if (duplicateValue.get(v)) {
  43200. debugWarn("ElSelectV2", `The option values you provided seem to be duplicated, which may cause some problems, please check.`);
  43201. break;
  43202. } else {
  43203. duplicateValue.set(v, true);
  43204. }
  43205. }
  43206. });
  43207. vue.onMounted(() => {
  43208. initStates();
  43209. });
  43210. useResizeObserver(selectRef, handleResize);
  43211. useResizeObserver(selectionRef, resetSelectionWidth);
  43212. useResizeObserver(menuRef, updateTooltip);
  43213. useResizeObserver(wrapperRef, updateTooltip);
  43214. useResizeObserver(tagMenuRef, updateTagTooltip);
  43215. useResizeObserver(collapseItemRef, resetCollapseItemWidth);
  43216. return {
  43217. inputId,
  43218. collapseTagSize,
  43219. currentPlaceholder,
  43220. expanded,
  43221. emptyText,
  43222. popupHeight,
  43223. debounce,
  43224. allOptions,
  43225. allOptionsValueMap,
  43226. filteredOptions,
  43227. iconComponent,
  43228. iconReverse,
  43229. tagStyle,
  43230. collapseTagStyle,
  43231. popperSize,
  43232. dropdownMenuVisible,
  43233. hasModelValue,
  43234. shouldShowPlaceholder,
  43235. selectDisabled,
  43236. selectSize,
  43237. needStatusIcon,
  43238. showClearBtn,
  43239. states,
  43240. isFocused,
  43241. nsSelect,
  43242. nsInput,
  43243. inputRef,
  43244. menuRef,
  43245. tagMenuRef,
  43246. tooltipRef,
  43247. tagTooltipRef,
  43248. selectRef,
  43249. wrapperRef,
  43250. selectionRef,
  43251. prefixRef,
  43252. suffixRef,
  43253. collapseItemRef,
  43254. popperRef,
  43255. validateState,
  43256. validateIcon,
  43257. showTagList,
  43258. collapseTagList,
  43259. debouncedOnInputChange,
  43260. deleteTag,
  43261. getLabel,
  43262. getValue,
  43263. getDisabled,
  43264. getValueKey,
  43265. getIndex,
  43266. handleClear,
  43267. handleClickOutside,
  43268. handleDel,
  43269. handleEsc,
  43270. focus,
  43271. blur,
  43272. handleMenuEnter,
  43273. handleResize,
  43274. resetSelectionWidth,
  43275. updateTooltip,
  43276. updateTagTooltip,
  43277. updateOptions,
  43278. toggleMenu,
  43279. scrollTo: scrollToItem,
  43280. onInput,
  43281. onKeyboardNavigate,
  43282. onKeyboardSelect,
  43283. onSelect,
  43284. onHover: onHoverOption,
  43285. handleCompositionStart,
  43286. handleCompositionEnd,
  43287. handleCompositionUpdate
  43288. };
  43289. };
  43290. var useSelect$2 = useSelect$1;
  43291. const _sfc_main$J = vue.defineComponent({
  43292. name: "ElSelectV2",
  43293. components: {
  43294. ElSelectMenu,
  43295. ElTag,
  43296. ElTooltip,
  43297. ElIcon
  43298. },
  43299. directives: { ClickOutside },
  43300. props: selectV2Props,
  43301. emits: selectV2Emits,
  43302. setup(props, { emit }) {
  43303. const modelValue = vue.computed(() => {
  43304. const { modelValue: rawModelValue, multiple } = props;
  43305. const fallback = multiple ? [] : void 0;
  43306. if (isArray$1(rawModelValue)) {
  43307. return multiple ? rawModelValue : fallback;
  43308. }
  43309. return multiple ? fallback : rawModelValue;
  43310. });
  43311. const API = useSelect$2(vue.reactive({
  43312. ...vue.toRefs(props),
  43313. modelValue
  43314. }), emit);
  43315. const { calculatorRef, inputStyle } = useCalcInputWidth();
  43316. const contentId = useId();
  43317. vue.provide(selectV2InjectionKey, {
  43318. props: vue.reactive({
  43319. ...vue.toRefs(props),
  43320. height: API.popupHeight,
  43321. modelValue
  43322. }),
  43323. expanded: API.expanded,
  43324. tooltipRef: API.tooltipRef,
  43325. contentId,
  43326. onSelect: API.onSelect,
  43327. onHover: API.onHover,
  43328. onKeyboardNavigate: API.onKeyboardNavigate,
  43329. onKeyboardSelect: API.onKeyboardSelect
  43330. });
  43331. const selectedLabel = vue.computed(() => {
  43332. if (!props.multiple) {
  43333. return API.states.selectedLabel;
  43334. }
  43335. return API.states.cachedOptions.map((i) => API.getLabel(i));
  43336. });
  43337. return {
  43338. ...API,
  43339. modelValue,
  43340. selectedLabel,
  43341. calculatorRef,
  43342. inputStyle,
  43343. contentId,
  43344. BORDER_HORIZONTAL_WIDTH
  43345. };
  43346. }
  43347. });
  43348. function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
  43349. const _component_el_tag = vue.resolveComponent("el-tag");
  43350. const _component_el_tooltip = vue.resolveComponent("el-tooltip");
  43351. const _component_el_icon = vue.resolveComponent("el-icon");
  43352. const _component_el_select_menu = vue.resolveComponent("el-select-menu");
  43353. const _directive_click_outside = vue.resolveDirective("click-outside");
  43354. return vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  43355. ref: "selectRef",
  43356. class: vue.normalizeClass([_ctx.nsSelect.b(), _ctx.nsSelect.m(_ctx.selectSize)]),
  43357. onMouseenter: ($event) => _ctx.states.inputHovering = true,
  43358. onMouseleave: ($event) => _ctx.states.inputHovering = false
  43359. }, [
  43360. vue.createVNode(_component_el_tooltip, {
  43361. ref: "tooltipRef",
  43362. visible: _ctx.dropdownMenuVisible,
  43363. teleported: _ctx.teleported,
  43364. "popper-class": [_ctx.nsSelect.e("popper"), _ctx.popperClass],
  43365. "popper-style": _ctx.popperStyle,
  43366. "gpu-acceleration": false,
  43367. "stop-popper-mouse-event": false,
  43368. "popper-options": _ctx.popperOptions,
  43369. "fallback-placements": _ctx.fallbackPlacements,
  43370. effect: _ctx.effect,
  43371. placement: _ctx.placement,
  43372. pure: "",
  43373. transition: `${_ctx.nsSelect.namespace.value}-zoom-in-top`,
  43374. trigger: "click",
  43375. persistent: _ctx.persistent,
  43376. "append-to": _ctx.appendTo,
  43377. "show-arrow": _ctx.showArrow,
  43378. offset: _ctx.offset,
  43379. onBeforeShow: _ctx.handleMenuEnter,
  43380. onHide: ($event) => _ctx.states.isBeforeHide = false
  43381. }, {
  43382. default: vue.withCtx(() => {
  43383. var _a, _b;
  43384. return [
  43385. vue.createElementVNode("div", {
  43386. ref: "wrapperRef",
  43387. class: vue.normalizeClass([
  43388. _ctx.nsSelect.e("wrapper"),
  43389. _ctx.nsSelect.is("focused", _ctx.isFocused),
  43390. _ctx.nsSelect.is("hovering", _ctx.states.inputHovering),
  43391. _ctx.nsSelect.is("filterable", _ctx.filterable),
  43392. _ctx.nsSelect.is("disabled", _ctx.selectDisabled)
  43393. ]),
  43394. onClick: vue.withModifiers(_ctx.toggleMenu, ["prevent"])
  43395. }, [
  43396. _ctx.$slots.prefix ? (vue.openBlock(), vue.createElementBlock("div", {
  43397. key: 0,
  43398. ref: "prefixRef",
  43399. class: vue.normalizeClass(_ctx.nsSelect.e("prefix"))
  43400. }, [
  43401. vue.renderSlot(_ctx.$slots, "prefix")
  43402. ], 2)) : vue.createCommentVNode("v-if", true),
  43403. vue.createElementVNode("div", {
  43404. ref: "selectionRef",
  43405. class: vue.normalizeClass([
  43406. _ctx.nsSelect.e("selection"),
  43407. _ctx.nsSelect.is("near", _ctx.multiple && !_ctx.$slots.prefix && !!_ctx.modelValue.length)
  43408. ])
  43409. }, [
  43410. _ctx.multiple ? vue.renderSlot(_ctx.$slots, "tag", {
  43411. key: 0,
  43412. data: _ctx.states.cachedOptions,
  43413. deleteTag: _ctx.deleteTag,
  43414. selectDisabled: _ctx.selectDisabled
  43415. }, () => [
  43416. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.showTagList, (item) => {
  43417. return vue.openBlock(), vue.createElementBlock("div", {
  43418. key: _ctx.getValueKey(_ctx.getValue(item)),
  43419. class: vue.normalizeClass(_ctx.nsSelect.e("selected-item"))
  43420. }, [
  43421. vue.createVNode(_component_el_tag, {
  43422. closable: !_ctx.selectDisabled && !_ctx.getDisabled(item),
  43423. size: _ctx.collapseTagSize,
  43424. type: _ctx.tagType,
  43425. effect: _ctx.tagEffect,
  43426. "disable-transitions": "",
  43427. style: vue.normalizeStyle(_ctx.tagStyle),
  43428. onClose: ($event) => _ctx.deleteTag($event, item)
  43429. }, {
  43430. default: vue.withCtx(() => [
  43431. vue.createElementVNode("span", {
  43432. class: vue.normalizeClass(_ctx.nsSelect.e("tags-text"))
  43433. }, [
  43434. vue.renderSlot(_ctx.$slots, "label", {
  43435. index: _ctx.getIndex(item),
  43436. label: _ctx.getLabel(item),
  43437. value: _ctx.getValue(item)
  43438. }, () => [
  43439. vue.createTextVNode(vue.toDisplayString(_ctx.getLabel(item)), 1)
  43440. ])
  43441. ], 2)
  43442. ]),
  43443. _: 2
  43444. }, 1032, ["closable", "size", "type", "effect", "style", "onClose"])
  43445. ], 2);
  43446. }), 128)),
  43447. _ctx.collapseTags && _ctx.modelValue.length > _ctx.maxCollapseTags ? (vue.openBlock(), vue.createBlock(_component_el_tooltip, {
  43448. key: 0,
  43449. ref: "tagTooltipRef",
  43450. disabled: _ctx.dropdownMenuVisible || !_ctx.collapseTagsTooltip,
  43451. "fallback-placements": ["bottom", "top", "right", "left"],
  43452. effect: _ctx.effect,
  43453. placement: "bottom",
  43454. "popper-class": _ctx.popperClass,
  43455. "popper-style": _ctx.popperStyle,
  43456. teleported: _ctx.teleported
  43457. }, {
  43458. default: vue.withCtx(() => [
  43459. vue.createElementVNode("div", {
  43460. ref: "collapseItemRef",
  43461. class: vue.normalizeClass(_ctx.nsSelect.e("selected-item"))
  43462. }, [
  43463. vue.createVNode(_component_el_tag, {
  43464. closable: false,
  43465. size: _ctx.collapseTagSize,
  43466. type: _ctx.tagType,
  43467. effect: _ctx.tagEffect,
  43468. style: vue.normalizeStyle(_ctx.collapseTagStyle),
  43469. "disable-transitions": ""
  43470. }, {
  43471. default: vue.withCtx(() => [
  43472. vue.createElementVNode("span", {
  43473. class: vue.normalizeClass(_ctx.nsSelect.e("tags-text"))
  43474. }, " + " + vue.toDisplayString(_ctx.modelValue.length - _ctx.maxCollapseTags), 3)
  43475. ]),
  43476. _: 1
  43477. }, 8, ["size", "type", "effect", "style"])
  43478. ], 2)
  43479. ]),
  43480. content: vue.withCtx(() => [
  43481. vue.createElementVNode("div", {
  43482. ref: "tagMenuRef",
  43483. class: vue.normalizeClass(_ctx.nsSelect.e("selection"))
  43484. }, [
  43485. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.collapseTagList, (selected) => {
  43486. return vue.openBlock(), vue.createElementBlock("div", {
  43487. key: _ctx.getValueKey(_ctx.getValue(selected)),
  43488. class: vue.normalizeClass(_ctx.nsSelect.e("selected-item"))
  43489. }, [
  43490. vue.createVNode(_component_el_tag, {
  43491. class: "in-tooltip",
  43492. closable: !_ctx.selectDisabled && !_ctx.getDisabled(selected),
  43493. size: _ctx.collapseTagSize,
  43494. type: _ctx.tagType,
  43495. effect: _ctx.tagEffect,
  43496. "disable-transitions": "",
  43497. onClose: ($event) => _ctx.deleteTag($event, selected)
  43498. }, {
  43499. default: vue.withCtx(() => [
  43500. vue.createElementVNode("span", {
  43501. class: vue.normalizeClass(_ctx.nsSelect.e("tags-text"))
  43502. }, [
  43503. vue.renderSlot(_ctx.$slots, "label", {
  43504. index: _ctx.getIndex(selected),
  43505. label: _ctx.getLabel(selected),
  43506. value: _ctx.getValue(selected)
  43507. }, () => [
  43508. vue.createTextVNode(vue.toDisplayString(_ctx.getLabel(selected)), 1)
  43509. ])
  43510. ], 2)
  43511. ]),
  43512. _: 2
  43513. }, 1032, ["closable", "size", "type", "effect", "onClose"])
  43514. ], 2);
  43515. }), 128))
  43516. ], 2)
  43517. ]),
  43518. _: 3
  43519. }, 8, ["disabled", "effect", "popper-class", "popper-style", "teleported"])) : vue.createCommentVNode("v-if", true)
  43520. ]) : vue.createCommentVNode("v-if", true),
  43521. vue.createElementVNode("div", {
  43522. class: vue.normalizeClass([
  43523. _ctx.nsSelect.e("selected-item"),
  43524. _ctx.nsSelect.e("input-wrapper"),
  43525. _ctx.nsSelect.is("hidden", !_ctx.filterable)
  43526. ])
  43527. }, [
  43528. vue.withDirectives(vue.createElementVNode("input", {
  43529. id: _ctx.inputId,
  43530. ref: "inputRef",
  43531. "onUpdate:modelValue": ($event) => _ctx.states.inputValue = $event,
  43532. style: vue.normalizeStyle(_ctx.inputStyle),
  43533. autocomplete: _ctx.autocomplete,
  43534. tabindex: _ctx.tabindex,
  43535. "aria-autocomplete": "none",
  43536. "aria-haspopup": "listbox",
  43537. autocapitalize: "off",
  43538. "aria-expanded": _ctx.expanded,
  43539. "aria-label": _ctx.ariaLabel,
  43540. class: vue.normalizeClass([_ctx.nsSelect.e("input"), _ctx.nsSelect.is(_ctx.selectSize)]),
  43541. disabled: _ctx.selectDisabled,
  43542. role: "combobox",
  43543. "aria-controls": _ctx.contentId,
  43544. "aria-activedescendant": _ctx.states.hoveringIndex >= 0 ? `${_ctx.contentId}-${_ctx.states.hoveringIndex}` : "",
  43545. readonly: !_ctx.filterable,
  43546. spellcheck: "false",
  43547. type: "text",
  43548. name: _ctx.name,
  43549. onInput: _ctx.onInput,
  43550. onCompositionstart: _ctx.handleCompositionStart,
  43551. onCompositionupdate: _ctx.handleCompositionUpdate,
  43552. onCompositionend: _ctx.handleCompositionEnd,
  43553. onKeydown: [
  43554. vue.withKeys(vue.withModifiers(($event) => _ctx.onKeyboardNavigate("backward"), ["stop", "prevent"]), ["up"]),
  43555. vue.withKeys(vue.withModifiers(($event) => _ctx.onKeyboardNavigate("forward"), ["stop", "prevent"]), ["down"]),
  43556. vue.withKeys(vue.withModifiers(_ctx.onKeyboardSelect, ["stop", "prevent"]), ["enter"]),
  43557. vue.withKeys(vue.withModifiers(_ctx.handleEsc, ["stop", "prevent"]), ["esc"]),
  43558. vue.withKeys(vue.withModifiers(_ctx.handleDel, ["stop"]), ["delete"])
  43559. ],
  43560. onClick: vue.withModifiers(_ctx.toggleMenu, ["stop"])
  43561. }, null, 46, ["id", "onUpdate:modelValue", "autocomplete", "tabindex", "aria-expanded", "aria-label", "disabled", "aria-controls", "aria-activedescendant", "readonly", "name", "onInput", "onCompositionstart", "onCompositionupdate", "onCompositionend", "onKeydown", "onClick"]), [
  43562. [vue.vModelText, _ctx.states.inputValue]
  43563. ]),
  43564. _ctx.filterable ? (vue.openBlock(), vue.createElementBlock("span", {
  43565. key: 0,
  43566. ref: "calculatorRef",
  43567. "aria-hidden": "true",
  43568. class: vue.normalizeClass(_ctx.nsSelect.e("input-calculator")),
  43569. textContent: vue.toDisplayString(_ctx.states.inputValue)
  43570. }, null, 10, ["textContent"])) : vue.createCommentVNode("v-if", true)
  43571. ], 2),
  43572. _ctx.shouldShowPlaceholder ? (vue.openBlock(), vue.createElementBlock("div", {
  43573. key: 1,
  43574. class: vue.normalizeClass([
  43575. _ctx.nsSelect.e("selected-item"),
  43576. _ctx.nsSelect.e("placeholder"),
  43577. _ctx.nsSelect.is("transparent", !_ctx.hasModelValue || _ctx.expanded && !_ctx.states.inputValue)
  43578. ])
  43579. }, [
  43580. _ctx.hasModelValue ? vue.renderSlot(_ctx.$slots, "label", {
  43581. key: 0,
  43582. index: (_b = (_a = _ctx.allOptionsValueMap.get(_ctx.modelValue)) == null ? void 0 : _a.index) != null ? _b : -1,
  43583. label: _ctx.currentPlaceholder,
  43584. value: _ctx.modelValue
  43585. }, () => [
  43586. vue.createElementVNode("span", null, vue.toDisplayString(_ctx.currentPlaceholder), 1)
  43587. ]) : (vue.openBlock(), vue.createElementBlock("span", { key: 1 }, vue.toDisplayString(_ctx.currentPlaceholder), 1))
  43588. ], 2)) : vue.createCommentVNode("v-if", true)
  43589. ], 2),
  43590. vue.createElementVNode("div", {
  43591. ref: "suffixRef",
  43592. class: vue.normalizeClass(_ctx.nsSelect.e("suffix"))
  43593. }, [
  43594. _ctx.iconComponent ? vue.withDirectives((vue.openBlock(), vue.createBlock(_component_el_icon, {
  43595. key: 0,
  43596. class: vue.normalizeClass([_ctx.nsSelect.e("caret"), _ctx.nsInput.e("icon"), _ctx.iconReverse])
  43597. }, {
  43598. default: vue.withCtx(() => [
  43599. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.iconComponent)))
  43600. ]),
  43601. _: 1
  43602. }, 8, ["class"])), [
  43603. [vue.vShow, !_ctx.showClearBtn]
  43604. ]) : vue.createCommentVNode("v-if", true),
  43605. _ctx.showClearBtn && _ctx.clearIcon ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
  43606. key: 1,
  43607. class: vue.normalizeClass([
  43608. _ctx.nsSelect.e("caret"),
  43609. _ctx.nsInput.e("icon"),
  43610. _ctx.nsSelect.e("clear")
  43611. ]),
  43612. onClick: vue.withModifiers(_ctx.handleClear, ["prevent", "stop"])
  43613. }, {
  43614. default: vue.withCtx(() => [
  43615. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.clearIcon)))
  43616. ]),
  43617. _: 1
  43618. }, 8, ["class", "onClick"])) : vue.createCommentVNode("v-if", true),
  43619. _ctx.validateState && _ctx.validateIcon && _ctx.needStatusIcon ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
  43620. key: 2,
  43621. class: vue.normalizeClass([
  43622. _ctx.nsInput.e("icon"),
  43623. _ctx.nsInput.e("validateIcon"),
  43624. _ctx.nsInput.is("loading", _ctx.validateState === "validating")
  43625. ])
  43626. }, {
  43627. default: vue.withCtx(() => [
  43628. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.validateIcon)))
  43629. ]),
  43630. _: 1
  43631. }, 8, ["class"])) : vue.createCommentVNode("v-if", true)
  43632. ], 2)
  43633. ], 10, ["onClick"])
  43634. ];
  43635. }),
  43636. content: vue.withCtx(() => [
  43637. vue.createVNode(_component_el_select_menu, {
  43638. id: _ctx.contentId,
  43639. ref: "menuRef",
  43640. data: _ctx.filteredOptions,
  43641. width: _ctx.popperSize - _ctx.BORDER_HORIZONTAL_WIDTH,
  43642. "hovering-index": _ctx.states.hoveringIndex,
  43643. "scrollbar-always-on": _ctx.scrollbarAlwaysOn,
  43644. "aria-label": _ctx.ariaLabel
  43645. }, vue.createSlots({
  43646. default: vue.withCtx((scope) => [
  43647. vue.renderSlot(_ctx.$slots, "default", vue.normalizeProps(vue.guardReactiveProps(scope)))
  43648. ]),
  43649. _: 2
  43650. }, [
  43651. _ctx.$slots.header ? {
  43652. name: "header",
  43653. fn: vue.withCtx(() => [
  43654. vue.createElementVNode("div", {
  43655. class: vue.normalizeClass(_ctx.nsSelect.be("dropdown", "header")),
  43656. onClick: vue.withModifiers(() => {
  43657. }, ["stop"])
  43658. }, [
  43659. vue.renderSlot(_ctx.$slots, "header")
  43660. ], 10, ["onClick"])
  43661. ])
  43662. } : void 0,
  43663. _ctx.$slots.loading && _ctx.loading ? {
  43664. name: "loading",
  43665. fn: vue.withCtx(() => [
  43666. vue.createElementVNode("div", {
  43667. class: vue.normalizeClass(_ctx.nsSelect.be("dropdown", "loading"))
  43668. }, [
  43669. vue.renderSlot(_ctx.$slots, "loading")
  43670. ], 2)
  43671. ])
  43672. } : _ctx.loading || _ctx.filteredOptions.length === 0 ? {
  43673. name: "empty",
  43674. fn: vue.withCtx(() => [
  43675. vue.createElementVNode("div", {
  43676. class: vue.normalizeClass(_ctx.nsSelect.be("dropdown", "empty"))
  43677. }, [
  43678. vue.renderSlot(_ctx.$slots, "empty", {}, () => [
  43679. vue.createElementVNode("span", null, vue.toDisplayString(_ctx.emptyText), 1)
  43680. ])
  43681. ], 2)
  43682. ])
  43683. } : void 0,
  43684. _ctx.$slots.footer ? {
  43685. name: "footer",
  43686. fn: vue.withCtx(() => [
  43687. vue.createElementVNode("div", {
  43688. class: vue.normalizeClass(_ctx.nsSelect.be("dropdown", "footer")),
  43689. onClick: vue.withModifiers(() => {
  43690. }, ["stop"])
  43691. }, [
  43692. vue.renderSlot(_ctx.$slots, "footer")
  43693. ], 10, ["onClick"])
  43694. ])
  43695. } : void 0
  43696. ]), 1032, ["id", "data", "width", "hovering-index", "scrollbar-always-on", "aria-label"])
  43697. ]),
  43698. _: 3
  43699. }, 8, ["visible", "teleported", "popper-class", "popper-style", "popper-options", "fallback-placements", "effect", "placement", "transition", "persistent", "append-to", "show-arrow", "offset", "onBeforeShow", "onHide"])
  43700. ], 42, ["onMouseenter", "onMouseleave"])), [
  43701. [_directive_click_outside, _ctx.handleClickOutside, _ctx.popperRef]
  43702. ]);
  43703. }
  43704. var Select = /* @__PURE__ */ _export_sfc(_sfc_main$J, [["render", _sfc_render$5], ["__file", "select.vue"]]);
  43705. const ElSelectV2 = withInstall(Select);
  43706. const skeletonProps = buildProps({
  43707. animated: Boolean,
  43708. count: {
  43709. type: Number,
  43710. default: 1
  43711. },
  43712. rows: {
  43713. type: Number,
  43714. default: 3
  43715. },
  43716. loading: {
  43717. type: Boolean,
  43718. default: true
  43719. },
  43720. throttle: {
  43721. type: definePropType([Number, Object])
  43722. }
  43723. });
  43724. const skeletonItemProps = buildProps({
  43725. variant: {
  43726. type: String,
  43727. values: [
  43728. "circle",
  43729. "rect",
  43730. "h1",
  43731. "h3",
  43732. "text",
  43733. "caption",
  43734. "p",
  43735. "image",
  43736. "button"
  43737. ],
  43738. default: "text"
  43739. }
  43740. });
  43741. const __default__$B = vue.defineComponent({
  43742. name: "ElSkeletonItem"
  43743. });
  43744. const _sfc_main$I = /* @__PURE__ */ vue.defineComponent({
  43745. ...__default__$B,
  43746. props: skeletonItemProps,
  43747. setup(__props) {
  43748. const ns = useNamespace("skeleton");
  43749. return (_ctx, _cache) => {
  43750. return vue.openBlock(), vue.createElementBlock("div", {
  43751. class: vue.normalizeClass([vue.unref(ns).e("item"), vue.unref(ns).e(_ctx.variant)])
  43752. }, [
  43753. _ctx.variant === "image" ? (vue.openBlock(), vue.createBlock(vue.unref(picture_filled_default), { key: 0 })) : vue.createCommentVNode("v-if", true)
  43754. ], 2);
  43755. };
  43756. }
  43757. });
  43758. var SkeletonItem = /* @__PURE__ */ _export_sfc(_sfc_main$I, [["__file", "skeleton-item.vue"]]);
  43759. const __default__$A = vue.defineComponent({
  43760. name: "ElSkeleton"
  43761. });
  43762. const _sfc_main$H = /* @__PURE__ */ vue.defineComponent({
  43763. ...__default__$A,
  43764. props: skeletonProps,
  43765. setup(__props, { expose }) {
  43766. const props = __props;
  43767. const ns = useNamespace("skeleton");
  43768. const uiLoading = useThrottleRender(vue.toRef(props, "loading"), props.throttle);
  43769. expose({
  43770. uiLoading
  43771. });
  43772. return (_ctx, _cache) => {
  43773. return vue.unref(uiLoading) ? (vue.openBlock(), vue.createElementBlock("div", vue.mergeProps({
  43774. key: 0,
  43775. class: [vue.unref(ns).b(), vue.unref(ns).is("animated", _ctx.animated)]
  43776. }, _ctx.$attrs), [
  43777. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.count, (i) => {
  43778. return vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: i }, [
  43779. vue.unref(uiLoading) ? vue.renderSlot(_ctx.$slots, "template", { key: i }, () => [
  43780. vue.createVNode(SkeletonItem, {
  43781. class: vue.normalizeClass(vue.unref(ns).is("first")),
  43782. variant: "p"
  43783. }, null, 8, ["class"]),
  43784. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.rows, (item) => {
  43785. return vue.openBlock(), vue.createBlock(SkeletonItem, {
  43786. key: item,
  43787. class: vue.normalizeClass([
  43788. vue.unref(ns).e("paragraph"),
  43789. vue.unref(ns).is("last", item === _ctx.rows && _ctx.rows > 1)
  43790. ]),
  43791. variant: "p"
  43792. }, null, 8, ["class"]);
  43793. }), 128))
  43794. ]) : vue.createCommentVNode("v-if", true)
  43795. ], 64);
  43796. }), 128))
  43797. ], 16)) : vue.renderSlot(_ctx.$slots, "default", vue.normalizeProps(vue.mergeProps({ key: 1 }, _ctx.$attrs)));
  43798. };
  43799. }
  43800. });
  43801. var Skeleton = /* @__PURE__ */ _export_sfc(_sfc_main$H, [["__file", "skeleton.vue"]]);
  43802. const ElSkeleton = withInstall(Skeleton, {
  43803. SkeletonItem
  43804. });
  43805. const ElSkeletonItem = withNoopInstall(SkeletonItem);
  43806. const sliderContextKey = Symbol("sliderContextKey");
  43807. const sliderProps = buildProps({
  43808. modelValue: {
  43809. type: definePropType([Number, Array]),
  43810. default: 0
  43811. },
  43812. id: {
  43813. type: String,
  43814. default: void 0
  43815. },
  43816. min: {
  43817. type: Number,
  43818. default: 0
  43819. },
  43820. max: {
  43821. type: Number,
  43822. default: 100
  43823. },
  43824. step: {
  43825. type: Number,
  43826. default: 1
  43827. },
  43828. showInput: Boolean,
  43829. showInputControls: {
  43830. type: Boolean,
  43831. default: true
  43832. },
  43833. size: useSizeProp,
  43834. inputSize: useSizeProp,
  43835. showStops: Boolean,
  43836. showTooltip: {
  43837. type: Boolean,
  43838. default: true
  43839. },
  43840. formatTooltip: {
  43841. type: definePropType(Function),
  43842. default: void 0
  43843. },
  43844. disabled: Boolean,
  43845. range: Boolean,
  43846. vertical: Boolean,
  43847. height: String,
  43848. rangeStartLabel: {
  43849. type: String,
  43850. default: void 0
  43851. },
  43852. rangeEndLabel: {
  43853. type: String,
  43854. default: void 0
  43855. },
  43856. formatValueText: {
  43857. type: definePropType(Function),
  43858. default: void 0
  43859. },
  43860. tooltipClass: {
  43861. type: String,
  43862. default: void 0
  43863. },
  43864. placement: {
  43865. type: String,
  43866. values: Ee,
  43867. default: "top"
  43868. },
  43869. marks: {
  43870. type: definePropType(Object)
  43871. },
  43872. validateEvent: {
  43873. type: Boolean,
  43874. default: true
  43875. },
  43876. persistent: {
  43877. type: Boolean,
  43878. default: true
  43879. },
  43880. ...useAriaProps(["ariaLabel"])
  43881. });
  43882. const isValidValue$1 = (value) => isNumber(value) || isArray$1(value) && value.every(isNumber);
  43883. const sliderEmits = {
  43884. [UPDATE_MODEL_EVENT]: isValidValue$1,
  43885. [INPUT_EVENT]: isValidValue$1,
  43886. [CHANGE_EVENT]: isValidValue$1
  43887. };
  43888. const useLifecycle = (props, initData, resetSize) => {
  43889. const sliderWrapper = vue.ref();
  43890. vue.onMounted(async () => {
  43891. if (props.range) {
  43892. if (isArray$1(props.modelValue)) {
  43893. initData.firstValue = Math.max(props.min, props.modelValue[0]);
  43894. initData.secondValue = Math.min(props.max, props.modelValue[1]);
  43895. } else {
  43896. initData.firstValue = props.min;
  43897. initData.secondValue = props.max;
  43898. }
  43899. initData.oldValue = [initData.firstValue, initData.secondValue];
  43900. } else {
  43901. if (!isNumber(props.modelValue) || Number.isNaN(props.modelValue)) {
  43902. initData.firstValue = props.min;
  43903. } else {
  43904. initData.firstValue = Math.min(props.max, Math.max(props.min, props.modelValue));
  43905. }
  43906. initData.oldValue = initData.firstValue;
  43907. }
  43908. useEventListener(window, "resize", resetSize);
  43909. await vue.nextTick();
  43910. resetSize();
  43911. });
  43912. return {
  43913. sliderWrapper
  43914. };
  43915. };
  43916. const useMarks = (props) => {
  43917. return vue.computed(() => {
  43918. if (!props.marks) {
  43919. return [];
  43920. }
  43921. const marksKeys = Object.keys(props.marks);
  43922. return marksKeys.map(Number.parseFloat).sort((a, b) => a - b).filter((point) => point <= props.max && point >= props.min).map((point) => ({
  43923. point,
  43924. position: (point - props.min) * 100 / (props.max - props.min),
  43925. mark: props.marks[point]
  43926. }));
  43927. });
  43928. };
  43929. const useSlide = (props, initData, emit) => {
  43930. const { form: elForm, formItem: elFormItem } = useFormItem();
  43931. const slider = vue.shallowRef();
  43932. const firstButton = vue.ref();
  43933. const secondButton = vue.ref();
  43934. const buttonRefs = {
  43935. firstButton,
  43936. secondButton
  43937. };
  43938. const sliderDisabled = vue.computed(() => {
  43939. return props.disabled || (elForm == null ? void 0 : elForm.disabled) || false;
  43940. });
  43941. const minValue = vue.computed(() => {
  43942. return Math.min(initData.firstValue, initData.secondValue);
  43943. });
  43944. const maxValue = vue.computed(() => {
  43945. return Math.max(initData.firstValue, initData.secondValue);
  43946. });
  43947. const barSize = vue.computed(() => {
  43948. return props.range ? `${100 * (maxValue.value - minValue.value) / (props.max - props.min)}%` : `${100 * (initData.firstValue - props.min) / (props.max - props.min)}%`;
  43949. });
  43950. const barStart = vue.computed(() => {
  43951. return props.range ? `${100 * (minValue.value - props.min) / (props.max - props.min)}%` : "0%";
  43952. });
  43953. const runwayStyle = vue.computed(() => {
  43954. return props.vertical ? { height: props.height } : {};
  43955. });
  43956. const barStyle = vue.computed(() => {
  43957. return props.vertical ? {
  43958. height: barSize.value,
  43959. bottom: barStart.value
  43960. } : {
  43961. width: barSize.value,
  43962. left: barStart.value
  43963. };
  43964. });
  43965. const resetSize = () => {
  43966. if (slider.value) {
  43967. const rect = slider.value.getBoundingClientRect();
  43968. initData.sliderSize = rect[props.vertical ? "height" : "width"];
  43969. }
  43970. };
  43971. const getButtonRefByPercent = (percent) => {
  43972. const targetValue = props.min + percent * (props.max - props.min) / 100;
  43973. if (!props.range) {
  43974. return firstButton;
  43975. }
  43976. let buttonRefName;
  43977. if (Math.abs(minValue.value - targetValue) < Math.abs(maxValue.value - targetValue)) {
  43978. buttonRefName = initData.firstValue < initData.secondValue ? "firstButton" : "secondButton";
  43979. } else {
  43980. buttonRefName = initData.firstValue > initData.secondValue ? "firstButton" : "secondButton";
  43981. }
  43982. return buttonRefs[buttonRefName];
  43983. };
  43984. const setPosition = (percent) => {
  43985. const buttonRef = getButtonRefByPercent(percent);
  43986. buttonRef.value.setPosition(percent);
  43987. return buttonRef;
  43988. };
  43989. const setFirstValue = (firstValue) => {
  43990. initData.firstValue = firstValue != null ? firstValue : props.min;
  43991. _emit(props.range ? [minValue.value, maxValue.value] : firstValue != null ? firstValue : props.min);
  43992. };
  43993. const setSecondValue = (secondValue) => {
  43994. initData.secondValue = secondValue;
  43995. if (props.range) {
  43996. _emit([minValue.value, maxValue.value]);
  43997. }
  43998. };
  43999. const _emit = (val) => {
  44000. emit(UPDATE_MODEL_EVENT, val);
  44001. emit(INPUT_EVENT, val);
  44002. };
  44003. const emitChange = async () => {
  44004. await vue.nextTick();
  44005. emit(CHANGE_EVENT, props.range ? [minValue.value, maxValue.value] : props.modelValue);
  44006. };
  44007. const handleSliderPointerEvent = (event) => {
  44008. var _a, _b, _c, _d, _e, _f;
  44009. if (sliderDisabled.value || initData.dragging)
  44010. return;
  44011. resetSize();
  44012. let newPercent = 0;
  44013. if (props.vertical) {
  44014. const clientY = (_c = (_b = (_a = event.touches) == null ? void 0 : _a.item(0)) == null ? void 0 : _b.clientY) != null ? _c : event.clientY;
  44015. const sliderOffsetBottom = slider.value.getBoundingClientRect().bottom;
  44016. newPercent = (sliderOffsetBottom - clientY) / initData.sliderSize * 100;
  44017. } else {
  44018. const clientX = (_f = (_e = (_d = event.touches) == null ? void 0 : _d.item(0)) == null ? void 0 : _e.clientX) != null ? _f : event.clientX;
  44019. const sliderOffsetLeft = slider.value.getBoundingClientRect().left;
  44020. newPercent = (clientX - sliderOffsetLeft) / initData.sliderSize * 100;
  44021. }
  44022. if (newPercent < 0 || newPercent > 100)
  44023. return;
  44024. return setPosition(newPercent);
  44025. };
  44026. const onSliderWrapperPrevent = (event) => {
  44027. var _a, _b;
  44028. if (((_a = buttonRefs["firstButton"].value) == null ? void 0 : _a.dragging) || ((_b = buttonRefs["secondButton"].value) == null ? void 0 : _b.dragging)) {
  44029. event.preventDefault();
  44030. }
  44031. };
  44032. const onSliderDown = async (event) => {
  44033. const buttonRef = handleSliderPointerEvent(event);
  44034. if (buttonRef) {
  44035. await vue.nextTick();
  44036. buttonRef.value.onButtonDown(event);
  44037. }
  44038. };
  44039. const onSliderClick = (event) => {
  44040. const buttonRef = handleSliderPointerEvent(event);
  44041. if (buttonRef) {
  44042. emitChange();
  44043. }
  44044. };
  44045. const onSliderMarkerDown = (position) => {
  44046. if (sliderDisabled.value || initData.dragging)
  44047. return;
  44048. const buttonRef = setPosition(position);
  44049. if (buttonRef) {
  44050. emitChange();
  44051. }
  44052. };
  44053. return {
  44054. elFormItem,
  44055. slider,
  44056. firstButton,
  44057. secondButton,
  44058. sliderDisabled,
  44059. minValue,
  44060. maxValue,
  44061. runwayStyle,
  44062. barStyle,
  44063. resetSize,
  44064. setPosition,
  44065. emitChange,
  44066. onSliderWrapperPrevent,
  44067. onSliderClick,
  44068. onSliderDown,
  44069. onSliderMarkerDown,
  44070. setFirstValue,
  44071. setSecondValue
  44072. };
  44073. };
  44074. const useTooltip = (props, formatTooltip, showTooltip) => {
  44075. const tooltip = vue.ref();
  44076. const tooltipVisible = vue.ref(false);
  44077. const enableFormat = vue.computed(() => {
  44078. return formatTooltip.value instanceof Function;
  44079. });
  44080. const formatValue = vue.computed(() => {
  44081. return enableFormat.value && formatTooltip.value(props.modelValue) || props.modelValue;
  44082. });
  44083. const displayTooltip = debounce(() => {
  44084. showTooltip.value && (tooltipVisible.value = true);
  44085. }, 50);
  44086. const hideTooltip = debounce(() => {
  44087. showTooltip.value && (tooltipVisible.value = false);
  44088. }, 50);
  44089. return {
  44090. tooltip,
  44091. tooltipVisible,
  44092. formatValue,
  44093. displayTooltip,
  44094. hideTooltip
  44095. };
  44096. };
  44097. const useSliderButton = (props, initData, emit) => {
  44098. const {
  44099. disabled,
  44100. min,
  44101. max,
  44102. step,
  44103. showTooltip,
  44104. persistent,
  44105. precision,
  44106. sliderSize,
  44107. formatTooltip,
  44108. emitChange,
  44109. resetSize,
  44110. updateDragging
  44111. } = vue.inject(sliderContextKey);
  44112. const { tooltip, tooltipVisible, formatValue, displayTooltip, hideTooltip } = useTooltip(props, formatTooltip, showTooltip);
  44113. const button = vue.ref();
  44114. const currentPosition = vue.computed(() => {
  44115. return `${(props.modelValue - min.value) / (max.value - min.value) * 100}%`;
  44116. });
  44117. const wrapperStyle = vue.computed(() => {
  44118. return props.vertical ? { bottom: currentPosition.value } : { left: currentPosition.value };
  44119. });
  44120. const handleMouseEnter = () => {
  44121. initData.hovering = true;
  44122. displayTooltip();
  44123. };
  44124. const handleMouseLeave = () => {
  44125. initData.hovering = false;
  44126. if (!initData.dragging) {
  44127. hideTooltip();
  44128. }
  44129. };
  44130. const onButtonDown = (event) => {
  44131. if (disabled.value)
  44132. return;
  44133. event.preventDefault();
  44134. onDragStart(event);
  44135. window.addEventListener("mousemove", onDragging);
  44136. window.addEventListener("touchmove", onDragging);
  44137. window.addEventListener("mouseup", onDragEnd);
  44138. window.addEventListener("touchend", onDragEnd);
  44139. window.addEventListener("contextmenu", onDragEnd);
  44140. button.value.focus();
  44141. };
  44142. const incrementPosition = (amount) => {
  44143. if (disabled.value)
  44144. return;
  44145. initData.newPosition = Number.parseFloat(currentPosition.value) + amount / (max.value - min.value) * 100;
  44146. setPosition(initData.newPosition);
  44147. emitChange();
  44148. };
  44149. const onLeftKeyDown = () => {
  44150. incrementPosition(-step.value);
  44151. };
  44152. const onRightKeyDown = () => {
  44153. incrementPosition(step.value);
  44154. };
  44155. const onPageDownKeyDown = () => {
  44156. incrementPosition(-step.value * 4);
  44157. };
  44158. const onPageUpKeyDown = () => {
  44159. incrementPosition(step.value * 4);
  44160. };
  44161. const onHomeKeyDown = () => {
  44162. if (disabled.value)
  44163. return;
  44164. setPosition(0);
  44165. emitChange();
  44166. };
  44167. const onEndKeyDown = () => {
  44168. if (disabled.value)
  44169. return;
  44170. setPosition(100);
  44171. emitChange();
  44172. };
  44173. const onKeyDown = (event) => {
  44174. const code = getEventCode(event);
  44175. let isPreventDefault = true;
  44176. switch (code) {
  44177. case EVENT_CODE.left:
  44178. case EVENT_CODE.down:
  44179. onLeftKeyDown();
  44180. break;
  44181. case EVENT_CODE.right:
  44182. case EVENT_CODE.up:
  44183. onRightKeyDown();
  44184. break;
  44185. case EVENT_CODE.home:
  44186. onHomeKeyDown();
  44187. break;
  44188. case EVENT_CODE.end:
  44189. onEndKeyDown();
  44190. break;
  44191. case EVENT_CODE.pageDown:
  44192. onPageDownKeyDown();
  44193. break;
  44194. case EVENT_CODE.pageUp:
  44195. onPageUpKeyDown();
  44196. break;
  44197. default:
  44198. isPreventDefault = false;
  44199. break;
  44200. }
  44201. isPreventDefault && event.preventDefault();
  44202. };
  44203. const getClientXY = (event) => {
  44204. let clientX;
  44205. let clientY;
  44206. if (event.type.startsWith("touch")) {
  44207. clientY = event.touches[0].clientY;
  44208. clientX = event.touches[0].clientX;
  44209. } else {
  44210. clientY = event.clientY;
  44211. clientX = event.clientX;
  44212. }
  44213. return {
  44214. clientX,
  44215. clientY
  44216. };
  44217. };
  44218. const onDragStart = (event) => {
  44219. initData.dragging = true;
  44220. initData.isClick = true;
  44221. const { clientX, clientY } = getClientXY(event);
  44222. if (props.vertical) {
  44223. initData.startY = clientY;
  44224. } else {
  44225. initData.startX = clientX;
  44226. }
  44227. initData.startPosition = Number.parseFloat(currentPosition.value);
  44228. initData.newPosition = initData.startPosition;
  44229. };
  44230. const onDragging = (event) => {
  44231. if (initData.dragging) {
  44232. initData.isClick = false;
  44233. displayTooltip();
  44234. resetSize();
  44235. let diff;
  44236. const { clientX, clientY } = getClientXY(event);
  44237. if (props.vertical) {
  44238. initData.currentY = clientY;
  44239. diff = (initData.startY - initData.currentY) / sliderSize.value * 100;
  44240. } else {
  44241. initData.currentX = clientX;
  44242. diff = (initData.currentX - initData.startX) / sliderSize.value * 100;
  44243. }
  44244. initData.newPosition = initData.startPosition + diff;
  44245. setPosition(initData.newPosition);
  44246. }
  44247. };
  44248. const onDragEnd = () => {
  44249. if (initData.dragging) {
  44250. setTimeout(() => {
  44251. initData.dragging = false;
  44252. if (!initData.hovering) {
  44253. hideTooltip();
  44254. }
  44255. if (!initData.isClick) {
  44256. setPosition(initData.newPosition);
  44257. }
  44258. emitChange();
  44259. }, 0);
  44260. window.removeEventListener("mousemove", onDragging);
  44261. window.removeEventListener("touchmove", onDragging);
  44262. window.removeEventListener("mouseup", onDragEnd);
  44263. window.removeEventListener("touchend", onDragEnd);
  44264. window.removeEventListener("contextmenu", onDragEnd);
  44265. }
  44266. };
  44267. const setPosition = async (newPosition) => {
  44268. if (newPosition === null || Number.isNaN(+newPosition))
  44269. return;
  44270. newPosition = clamp$1(newPosition, 0, 100);
  44271. const fullSteps = Math.floor((max.value - min.value) / step.value);
  44272. const fullRangePercentage = fullSteps * step.value / (max.value - min.value) * 100;
  44273. const threshold = fullRangePercentage + (100 - fullRangePercentage) / 2;
  44274. let value;
  44275. if (newPosition < fullRangePercentage) {
  44276. const valueBetween = fullRangePercentage / fullSteps;
  44277. const steps = Math.round(newPosition / valueBetween);
  44278. value = min.value + steps * step.value;
  44279. } else if (newPosition < threshold) {
  44280. value = min.value + fullSteps * step.value;
  44281. } else {
  44282. value = max.value;
  44283. }
  44284. value = Number.parseFloat(value.toFixed(precision.value));
  44285. if (value !== props.modelValue) {
  44286. emit(UPDATE_MODEL_EVENT, value);
  44287. }
  44288. if (!initData.dragging && props.modelValue !== initData.oldValue) {
  44289. initData.oldValue = props.modelValue;
  44290. }
  44291. await vue.nextTick();
  44292. initData.dragging && displayTooltip();
  44293. tooltip.value.updatePopper();
  44294. };
  44295. vue.watch(() => initData.dragging, (val) => {
  44296. updateDragging(val);
  44297. });
  44298. useEventListener(button, "touchstart", onButtonDown, { passive: false });
  44299. return {
  44300. disabled,
  44301. button,
  44302. tooltip,
  44303. tooltipVisible,
  44304. showTooltip,
  44305. persistent,
  44306. wrapperStyle,
  44307. formatValue,
  44308. handleMouseEnter,
  44309. handleMouseLeave,
  44310. onButtonDown,
  44311. onKeyDown,
  44312. setPosition
  44313. };
  44314. };
  44315. const useStops = (props, initData, minValue, maxValue) => {
  44316. const stops = vue.computed(() => {
  44317. if (!props.showStops || props.min > props.max)
  44318. return [];
  44319. if (props.step === 0) {
  44320. debugWarn("ElSlider", "step should not be 0.");
  44321. return [];
  44322. }
  44323. const stopCount = Math.ceil((props.max - props.min) / props.step);
  44324. const stepWidth = 100 * props.step / (props.max - props.min);
  44325. const result = Array.from({ length: stopCount - 1 }).map((_, index) => (index + 1) * stepWidth);
  44326. if (props.range) {
  44327. return result.filter((step) => {
  44328. return step < 100 * (minValue.value - props.min) / (props.max - props.min) || step > 100 * (maxValue.value - props.min) / (props.max - props.min);
  44329. });
  44330. } else {
  44331. return result.filter((step) => step > 100 * (initData.firstValue - props.min) / (props.max - props.min));
  44332. }
  44333. });
  44334. const getStopStyle = (position) => {
  44335. return props.vertical ? { bottom: `${position}%` } : { left: `${position}%` };
  44336. };
  44337. return {
  44338. stops,
  44339. getStopStyle
  44340. };
  44341. };
  44342. const useWatch = (props, initData, minValue, maxValue, emit, elFormItem) => {
  44343. const _emit = (val) => {
  44344. emit(UPDATE_MODEL_EVENT, val);
  44345. emit(INPUT_EVENT, val);
  44346. };
  44347. const valueChanged = () => {
  44348. if (props.range) {
  44349. return ![minValue.value, maxValue.value].every((item, index) => item === initData.oldValue[index]);
  44350. } else {
  44351. return props.modelValue !== initData.oldValue;
  44352. }
  44353. };
  44354. const setValues = () => {
  44355. var _a, _b;
  44356. if (props.min > props.max) {
  44357. throwError("Slider", "min should not be greater than max.");
  44358. }
  44359. const val = props.modelValue;
  44360. if (props.range && isArray$1(val)) {
  44361. if (val[1] < props.min) {
  44362. _emit([props.min, props.min]);
  44363. } else if (val[0] > props.max) {
  44364. _emit([props.max, props.max]);
  44365. } else if (val[0] < props.min) {
  44366. _emit([props.min, val[1]]);
  44367. } else if (val[1] > props.max) {
  44368. _emit([val[0], props.max]);
  44369. } else {
  44370. initData.firstValue = val[0];
  44371. initData.secondValue = val[1];
  44372. if (valueChanged()) {
  44373. if (props.validateEvent) {
  44374. (_a = elFormItem == null ? void 0 : elFormItem.validate) == null ? void 0 : _a.call(elFormItem, "change").catch((err) => debugWarn(err));
  44375. }
  44376. initData.oldValue = val.slice();
  44377. }
  44378. }
  44379. } else if (!props.range && isNumber(val) && !Number.isNaN(val)) {
  44380. if (val < props.min) {
  44381. _emit(props.min);
  44382. } else if (val > props.max) {
  44383. _emit(props.max);
  44384. } else {
  44385. initData.firstValue = val;
  44386. if (valueChanged()) {
  44387. if (props.validateEvent) {
  44388. (_b = elFormItem == null ? void 0 : elFormItem.validate) == null ? void 0 : _b.call(elFormItem, "change").catch((err) => debugWarn(err));
  44389. }
  44390. initData.oldValue = val;
  44391. }
  44392. }
  44393. }
  44394. };
  44395. setValues();
  44396. vue.watch(() => initData.dragging, (val) => {
  44397. if (!val) {
  44398. setValues();
  44399. }
  44400. });
  44401. vue.watch(() => props.modelValue, (val, oldVal) => {
  44402. if (initData.dragging || isArray$1(val) && isArray$1(oldVal) && val.every((item, index) => item === oldVal[index]) && initData.firstValue === val[0] && initData.secondValue === val[1]) {
  44403. return;
  44404. }
  44405. setValues();
  44406. }, {
  44407. deep: true
  44408. });
  44409. vue.watch(() => [props.min, props.max], () => {
  44410. setValues();
  44411. });
  44412. };
  44413. const sliderButtonProps = buildProps({
  44414. modelValue: {
  44415. type: Number,
  44416. default: 0
  44417. },
  44418. vertical: Boolean,
  44419. tooltipClass: String,
  44420. placement: {
  44421. type: String,
  44422. values: Ee,
  44423. default: "top"
  44424. }
  44425. });
  44426. const sliderButtonEmits = {
  44427. [UPDATE_MODEL_EVENT]: (value) => isNumber(value)
  44428. };
  44429. const __default__$z = vue.defineComponent({
  44430. name: "ElSliderButton"
  44431. });
  44432. const _sfc_main$G = /* @__PURE__ */ vue.defineComponent({
  44433. ...__default__$z,
  44434. props: sliderButtonProps,
  44435. emits: sliderButtonEmits,
  44436. setup(__props, { expose, emit }) {
  44437. const props = __props;
  44438. const ns = useNamespace("slider");
  44439. const initData = vue.reactive({
  44440. hovering: false,
  44441. dragging: false,
  44442. isClick: false,
  44443. startX: 0,
  44444. currentX: 0,
  44445. startY: 0,
  44446. currentY: 0,
  44447. startPosition: 0,
  44448. newPosition: 0,
  44449. oldValue: props.modelValue
  44450. });
  44451. const tooltipPersistent = vue.computed(() => !showTooltip.value ? false : persistent.value);
  44452. const {
  44453. disabled,
  44454. button,
  44455. tooltip,
  44456. showTooltip,
  44457. persistent,
  44458. tooltipVisible,
  44459. wrapperStyle,
  44460. formatValue,
  44461. handleMouseEnter,
  44462. handleMouseLeave,
  44463. onButtonDown,
  44464. onKeyDown,
  44465. setPosition
  44466. } = useSliderButton(props, initData, emit);
  44467. const { hovering, dragging } = vue.toRefs(initData);
  44468. expose({
  44469. onButtonDown,
  44470. onKeyDown,
  44471. setPosition,
  44472. hovering,
  44473. dragging
  44474. });
  44475. return (_ctx, _cache) => {
  44476. return vue.openBlock(), vue.createElementBlock("div", {
  44477. ref_key: "button",
  44478. ref: button,
  44479. class: vue.normalizeClass([vue.unref(ns).e("button-wrapper"), { hover: vue.unref(hovering), dragging: vue.unref(dragging) }]),
  44480. style: vue.normalizeStyle(vue.unref(wrapperStyle)),
  44481. tabindex: vue.unref(disabled) ? void 0 : 0,
  44482. onMouseenter: vue.unref(handleMouseEnter),
  44483. onMouseleave: vue.unref(handleMouseLeave),
  44484. onMousedown: vue.unref(onButtonDown),
  44485. onFocus: vue.unref(handleMouseEnter),
  44486. onBlur: vue.unref(handleMouseLeave),
  44487. onKeydown: vue.unref(onKeyDown)
  44488. }, [
  44489. vue.createVNode(vue.unref(ElTooltip), {
  44490. ref_key: "tooltip",
  44491. ref: tooltip,
  44492. visible: vue.unref(tooltipVisible),
  44493. placement: _ctx.placement,
  44494. "fallback-placements": ["top", "bottom", "right", "left"],
  44495. "stop-popper-mouse-event": false,
  44496. "popper-class": _ctx.tooltipClass,
  44497. disabled: !vue.unref(showTooltip),
  44498. persistent: vue.unref(tooltipPersistent)
  44499. }, {
  44500. content: vue.withCtx(() => [
  44501. vue.createElementVNode("span", null, vue.toDisplayString(vue.unref(formatValue)), 1)
  44502. ]),
  44503. default: vue.withCtx(() => [
  44504. vue.createElementVNode("div", {
  44505. class: vue.normalizeClass([vue.unref(ns).e("button"), { hover: vue.unref(hovering), dragging: vue.unref(dragging) }])
  44506. }, null, 2)
  44507. ]),
  44508. _: 1
  44509. }, 8, ["visible", "placement", "popper-class", "disabled", "persistent"])
  44510. ], 46, ["tabindex", "onMouseenter", "onMouseleave", "onMousedown", "onFocus", "onBlur", "onKeydown"]);
  44511. };
  44512. }
  44513. });
  44514. var SliderButton = /* @__PURE__ */ _export_sfc(_sfc_main$G, [["__file", "button.vue"]]);
  44515. const sliderMarkerProps = buildProps({
  44516. mark: {
  44517. type: definePropType([String, Object]),
  44518. default: void 0
  44519. }
  44520. });
  44521. var SliderMarker = vue.defineComponent({
  44522. name: "ElSliderMarker",
  44523. props: sliderMarkerProps,
  44524. setup(props) {
  44525. const ns = useNamespace("slider");
  44526. const label = vue.computed(() => {
  44527. return isString$1(props.mark) ? props.mark : props.mark.label;
  44528. });
  44529. const style = vue.computed(() => isString$1(props.mark) ? void 0 : props.mark.style);
  44530. return () => vue.h("div", {
  44531. class: ns.e("marks-text"),
  44532. style: style.value
  44533. }, label.value);
  44534. }
  44535. });
  44536. const __default__$y = vue.defineComponent({
  44537. name: "ElSlider"
  44538. });
  44539. const _sfc_main$F = /* @__PURE__ */ vue.defineComponent({
  44540. ...__default__$y,
  44541. props: sliderProps,
  44542. emits: sliderEmits,
  44543. setup(__props, { expose, emit }) {
  44544. const props = __props;
  44545. const ns = useNamespace("slider");
  44546. const { t } = useLocale();
  44547. const initData = vue.reactive({
  44548. firstValue: 0,
  44549. secondValue: 0,
  44550. oldValue: 0,
  44551. dragging: false,
  44552. sliderSize: 1
  44553. });
  44554. const {
  44555. elFormItem,
  44556. slider,
  44557. firstButton,
  44558. secondButton,
  44559. sliderDisabled,
  44560. minValue,
  44561. maxValue,
  44562. runwayStyle,
  44563. barStyle,
  44564. resetSize,
  44565. emitChange,
  44566. onSliderWrapperPrevent,
  44567. onSliderClick,
  44568. onSliderDown,
  44569. onSliderMarkerDown,
  44570. setFirstValue,
  44571. setSecondValue
  44572. } = useSlide(props, initData, emit);
  44573. const { stops, getStopStyle } = useStops(props, initData, minValue, maxValue);
  44574. const { inputId, isLabeledByFormItem } = useFormItemInputId(props, {
  44575. formItemContext: elFormItem
  44576. });
  44577. const sliderWrapperSize = useFormSize();
  44578. const sliderInputSize = vue.computed(() => props.inputSize || sliderWrapperSize.value);
  44579. const groupLabel = vue.computed(() => {
  44580. return props.ariaLabel || t("el.slider.defaultLabel", {
  44581. min: props.min,
  44582. max: props.max
  44583. });
  44584. });
  44585. const firstButtonLabel = vue.computed(() => {
  44586. if (props.range) {
  44587. return props.rangeStartLabel || t("el.slider.defaultRangeStartLabel");
  44588. } else {
  44589. return groupLabel.value;
  44590. }
  44591. });
  44592. const firstValueText = vue.computed(() => {
  44593. return props.formatValueText ? props.formatValueText(firstValue.value) : `${firstValue.value}`;
  44594. });
  44595. const secondButtonLabel = vue.computed(() => {
  44596. return props.rangeEndLabel || t("el.slider.defaultRangeEndLabel");
  44597. });
  44598. const secondValueText = vue.computed(() => {
  44599. return props.formatValueText ? props.formatValueText(secondValue.value) : `${secondValue.value}`;
  44600. });
  44601. const sliderKls = vue.computed(() => [
  44602. ns.b(),
  44603. ns.m(sliderWrapperSize.value),
  44604. ns.is("vertical", props.vertical),
  44605. { [ns.m("with-input")]: props.showInput }
  44606. ]);
  44607. const markList = useMarks(props);
  44608. useWatch(props, initData, minValue, maxValue, emit, elFormItem);
  44609. const precision = vue.computed(() => {
  44610. const precisions = [props.min, props.max, props.step].map((item) => {
  44611. const decimal = `${item}`.split(".")[1];
  44612. return decimal ? decimal.length : 0;
  44613. });
  44614. return Math.max.apply(null, precisions);
  44615. });
  44616. const { sliderWrapper } = useLifecycle(props, initData, resetSize);
  44617. const { firstValue, secondValue, sliderSize } = vue.toRefs(initData);
  44618. const updateDragging = (val) => {
  44619. initData.dragging = val;
  44620. };
  44621. useEventListener(sliderWrapper, "touchstart", onSliderWrapperPrevent, {
  44622. passive: false
  44623. });
  44624. useEventListener(sliderWrapper, "touchmove", onSliderWrapperPrevent, {
  44625. passive: false
  44626. });
  44627. vue.provide(sliderContextKey, {
  44628. ...vue.toRefs(props),
  44629. sliderSize,
  44630. disabled: sliderDisabled,
  44631. precision,
  44632. emitChange,
  44633. resetSize,
  44634. updateDragging
  44635. });
  44636. expose({
  44637. onSliderClick
  44638. });
  44639. return (_ctx, _cache) => {
  44640. var _a, _b;
  44641. return vue.openBlock(), vue.createElementBlock("div", {
  44642. id: _ctx.range ? vue.unref(inputId) : void 0,
  44643. ref_key: "sliderWrapper",
  44644. ref: sliderWrapper,
  44645. class: vue.normalizeClass(vue.unref(sliderKls)),
  44646. role: _ctx.range ? "group" : void 0,
  44647. "aria-label": _ctx.range && !vue.unref(isLabeledByFormItem) ? vue.unref(groupLabel) : void 0,
  44648. "aria-labelledby": _ctx.range && vue.unref(isLabeledByFormItem) ? (_a = vue.unref(elFormItem)) == null ? void 0 : _a.labelId : void 0
  44649. }, [
  44650. vue.createElementVNode("div", {
  44651. ref_key: "slider",
  44652. ref: slider,
  44653. class: vue.normalizeClass([
  44654. vue.unref(ns).e("runway"),
  44655. { "show-input": _ctx.showInput && !_ctx.range },
  44656. vue.unref(ns).is("disabled", vue.unref(sliderDisabled))
  44657. ]),
  44658. style: vue.normalizeStyle(vue.unref(runwayStyle)),
  44659. onMousedown: vue.unref(onSliderDown),
  44660. onTouchstartPassive: vue.unref(onSliderDown)
  44661. }, [
  44662. vue.createElementVNode("div", {
  44663. class: vue.normalizeClass(vue.unref(ns).e("bar")),
  44664. style: vue.normalizeStyle(vue.unref(barStyle))
  44665. }, null, 6),
  44666. vue.createVNode(SliderButton, {
  44667. id: !_ctx.range ? vue.unref(inputId) : void 0,
  44668. ref_key: "firstButton",
  44669. ref: firstButton,
  44670. "model-value": vue.unref(firstValue),
  44671. vertical: _ctx.vertical,
  44672. "tooltip-class": _ctx.tooltipClass,
  44673. placement: _ctx.placement,
  44674. role: "slider",
  44675. "aria-label": _ctx.range || !vue.unref(isLabeledByFormItem) ? vue.unref(firstButtonLabel) : void 0,
  44676. "aria-labelledby": !_ctx.range && vue.unref(isLabeledByFormItem) ? (_b = vue.unref(elFormItem)) == null ? void 0 : _b.labelId : void 0,
  44677. "aria-valuemin": _ctx.min,
  44678. "aria-valuemax": _ctx.range ? vue.unref(secondValue) : _ctx.max,
  44679. "aria-valuenow": vue.unref(firstValue),
  44680. "aria-valuetext": vue.unref(firstValueText),
  44681. "aria-orientation": _ctx.vertical ? "vertical" : "horizontal",
  44682. "aria-disabled": vue.unref(sliderDisabled),
  44683. "onUpdate:modelValue": vue.unref(setFirstValue)
  44684. }, 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"]),
  44685. _ctx.range ? (vue.openBlock(), vue.createBlock(SliderButton, {
  44686. key: 0,
  44687. ref_key: "secondButton",
  44688. ref: secondButton,
  44689. "model-value": vue.unref(secondValue),
  44690. vertical: _ctx.vertical,
  44691. "tooltip-class": _ctx.tooltipClass,
  44692. placement: _ctx.placement,
  44693. role: "slider",
  44694. "aria-label": vue.unref(secondButtonLabel),
  44695. "aria-valuemin": vue.unref(firstValue),
  44696. "aria-valuemax": _ctx.max,
  44697. "aria-valuenow": vue.unref(secondValue),
  44698. "aria-valuetext": vue.unref(secondValueText),
  44699. "aria-orientation": _ctx.vertical ? "vertical" : "horizontal",
  44700. "aria-disabled": vue.unref(sliderDisabled),
  44701. "onUpdate:modelValue": vue.unref(setSecondValue)
  44702. }, 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),
  44703. _ctx.showStops ? (vue.openBlock(), vue.createElementBlock("div", { key: 1 }, [
  44704. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(stops), (item, key) => {
  44705. return vue.openBlock(), vue.createElementBlock("div", {
  44706. key,
  44707. class: vue.normalizeClass(vue.unref(ns).e("stop")),
  44708. style: vue.normalizeStyle(vue.unref(getStopStyle)(item))
  44709. }, null, 6);
  44710. }), 128))
  44711. ])) : vue.createCommentVNode("v-if", true),
  44712. vue.unref(markList).length > 0 ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 2 }, [
  44713. vue.createElementVNode("div", null, [
  44714. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(markList), (item, key) => {
  44715. return vue.openBlock(), vue.createElementBlock("div", {
  44716. key,
  44717. style: vue.normalizeStyle(vue.unref(getStopStyle)(item.position)),
  44718. class: vue.normalizeClass([vue.unref(ns).e("stop"), vue.unref(ns).e("marks-stop")])
  44719. }, null, 6);
  44720. }), 128))
  44721. ]),
  44722. vue.createElementVNode("div", {
  44723. class: vue.normalizeClass(vue.unref(ns).e("marks"))
  44724. }, [
  44725. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(markList), (item, key) => {
  44726. return vue.openBlock(), vue.createBlock(vue.unref(SliderMarker), {
  44727. key,
  44728. mark: item.mark,
  44729. style: vue.normalizeStyle(vue.unref(getStopStyle)(item.position)),
  44730. onMousedown: vue.withModifiers(($event) => vue.unref(onSliderMarkerDown)(item.position), ["stop"])
  44731. }, null, 8, ["mark", "style", "onMousedown"]);
  44732. }), 128))
  44733. ], 2)
  44734. ], 64)) : vue.createCommentVNode("v-if", true)
  44735. ], 46, ["onMousedown", "onTouchstartPassive"]),
  44736. _ctx.showInput && !_ctx.range ? (vue.openBlock(), vue.createBlock(vue.unref(ElInputNumber), {
  44737. key: 0,
  44738. ref: "input",
  44739. "model-value": vue.unref(firstValue),
  44740. class: vue.normalizeClass(vue.unref(ns).e("input")),
  44741. step: _ctx.step,
  44742. disabled: vue.unref(sliderDisabled),
  44743. controls: _ctx.showInputControls,
  44744. min: _ctx.min,
  44745. max: _ctx.max,
  44746. precision: vue.unref(precision),
  44747. size: vue.unref(sliderInputSize),
  44748. "onUpdate:modelValue": vue.unref(setFirstValue),
  44749. onChange: vue.unref(emitChange)
  44750. }, null, 8, ["model-value", "class", "step", "disabled", "controls", "min", "max", "precision", "size", "onUpdate:modelValue", "onChange"])) : vue.createCommentVNode("v-if", true)
  44751. ], 10, ["id", "role", "aria-label", "aria-labelledby"]);
  44752. };
  44753. }
  44754. });
  44755. var Slider = /* @__PURE__ */ _export_sfc(_sfc_main$F, [["__file", "slider.vue"]]);
  44756. const ElSlider = withInstall(Slider);
  44757. const spaceItemProps = buildProps({
  44758. prefixCls: {
  44759. type: String
  44760. }
  44761. });
  44762. const SpaceItem = vue.defineComponent({
  44763. name: "ElSpaceItem",
  44764. props: spaceItemProps,
  44765. setup(props, { slots }) {
  44766. const ns = useNamespace("space");
  44767. const classes = vue.computed(() => `${props.prefixCls || ns.b()}__item`);
  44768. return () => vue.h("div", { class: classes.value }, vue.renderSlot(slots, "default"));
  44769. }
  44770. });
  44771. const SIZE_MAP = {
  44772. small: 8,
  44773. default: 12,
  44774. large: 16
  44775. };
  44776. function useSpace(props) {
  44777. const ns = useNamespace("space");
  44778. const classes = vue.computed(() => [ns.b(), ns.m(props.direction), props.class]);
  44779. const horizontalSize = vue.ref(0);
  44780. const verticalSize = vue.ref(0);
  44781. const containerStyle = vue.computed(() => {
  44782. const wrapKls = props.wrap || props.fill ? { flexWrap: "wrap" } : {};
  44783. const alignment = {
  44784. alignItems: props.alignment
  44785. };
  44786. const gap = {
  44787. rowGap: `${verticalSize.value}px`,
  44788. columnGap: `${horizontalSize.value}px`
  44789. };
  44790. return [wrapKls, alignment, gap, props.style];
  44791. });
  44792. const itemStyle = vue.computed(() => {
  44793. return props.fill ? { flexGrow: 1, minWidth: `${props.fillRatio}%` } : {};
  44794. });
  44795. vue.watchEffect(() => {
  44796. const { size = "small", wrap, direction: dir, fill } = props;
  44797. if (isArray$1(size)) {
  44798. const [h = 0, v = 0] = size;
  44799. horizontalSize.value = h;
  44800. verticalSize.value = v;
  44801. } else {
  44802. let val;
  44803. if (isNumber(size)) {
  44804. val = size;
  44805. } else {
  44806. val = SIZE_MAP[size || "small"] || SIZE_MAP.small;
  44807. }
  44808. if ((wrap || fill) && dir === "horizontal") {
  44809. horizontalSize.value = verticalSize.value = val;
  44810. } else {
  44811. if (dir === "horizontal") {
  44812. horizontalSize.value = val;
  44813. verticalSize.value = 0;
  44814. } else {
  44815. verticalSize.value = val;
  44816. horizontalSize.value = 0;
  44817. }
  44818. }
  44819. }
  44820. });
  44821. return {
  44822. classes,
  44823. containerStyle,
  44824. itemStyle
  44825. };
  44826. }
  44827. const spaceProps = buildProps({
  44828. direction: {
  44829. type: String,
  44830. values: ["horizontal", "vertical"],
  44831. default: "horizontal"
  44832. },
  44833. class: {
  44834. type: definePropType([
  44835. String,
  44836. Object,
  44837. Array
  44838. ]),
  44839. default: ""
  44840. },
  44841. style: {
  44842. type: definePropType([String, Array, Object]),
  44843. default: ""
  44844. },
  44845. alignment: {
  44846. type: definePropType(String),
  44847. default: "center"
  44848. },
  44849. prefixCls: {
  44850. type: String
  44851. },
  44852. spacer: {
  44853. type: definePropType([Object, String, Number, Array]),
  44854. default: null,
  44855. validator: (val) => vue.isVNode(val) || isNumber(val) || isString$1(val)
  44856. },
  44857. wrap: Boolean,
  44858. fill: Boolean,
  44859. fillRatio: {
  44860. type: Number,
  44861. default: 100
  44862. },
  44863. size: {
  44864. type: [String, Array, Number],
  44865. values: componentSizes,
  44866. validator: (val) => {
  44867. return isNumber(val) || isArray$1(val) && val.length === 2 && val.every(isNumber);
  44868. }
  44869. }
  44870. });
  44871. const Space = vue.defineComponent({
  44872. name: "ElSpace",
  44873. props: spaceProps,
  44874. setup(props, { slots }) {
  44875. const { classes, containerStyle, itemStyle } = useSpace(props);
  44876. function extractChildren(children, parentKey = "", extractedChildren = []) {
  44877. const { prefixCls } = props;
  44878. children.forEach((child, loopKey) => {
  44879. if (isFragment(child)) {
  44880. if (isArray$1(child.children)) {
  44881. child.children.forEach((nested, key) => {
  44882. if (isFragment(nested) && isArray$1(nested.children)) {
  44883. extractChildren(nested.children, `${parentKey + key}-`, extractedChildren);
  44884. } else {
  44885. if (vue.isVNode(nested) && (nested == null ? void 0 : nested.type) === vue.Comment) {
  44886. extractedChildren.push(nested);
  44887. } else {
  44888. extractedChildren.push(vue.createVNode(SpaceItem, {
  44889. style: itemStyle.value,
  44890. prefixCls,
  44891. key: `nested-${parentKey + key}`
  44892. }, {
  44893. default: () => [nested]
  44894. }, PatchFlags.PROPS | PatchFlags.STYLE, ["style", "prefixCls"]));
  44895. }
  44896. }
  44897. });
  44898. }
  44899. } else if (isValidElementNode(child)) {
  44900. extractedChildren.push(vue.createVNode(SpaceItem, {
  44901. style: itemStyle.value,
  44902. prefixCls,
  44903. key: `LoopKey${parentKey + loopKey}`
  44904. }, {
  44905. default: () => [child]
  44906. }, PatchFlags.PROPS | PatchFlags.STYLE, ["style", "prefixCls"]));
  44907. }
  44908. });
  44909. return extractedChildren;
  44910. }
  44911. return () => {
  44912. var _a;
  44913. const { spacer, direction } = props;
  44914. const children = vue.renderSlot(slots, "default", { key: 0 }, () => []);
  44915. if (((_a = children.children) != null ? _a : []).length === 0)
  44916. return null;
  44917. if (isArray$1(children.children)) {
  44918. let extractedChildren = extractChildren(children.children);
  44919. if (spacer) {
  44920. const len = extractedChildren.length - 1;
  44921. extractedChildren = extractedChildren.reduce((acc, child, idx) => {
  44922. const children2 = [...acc, child];
  44923. if (idx !== len) {
  44924. children2.push(vue.createVNode("span", {
  44925. style: [
  44926. itemStyle.value,
  44927. direction === "vertical" ? "width: 100%" : null
  44928. ],
  44929. key: idx
  44930. }, [
  44931. vue.isVNode(spacer) ? spacer : vue.createTextVNode(spacer, PatchFlags.TEXT)
  44932. ], PatchFlags.STYLE));
  44933. }
  44934. return children2;
  44935. }, []);
  44936. }
  44937. return vue.createVNode("div", {
  44938. class: classes.value,
  44939. style: containerStyle.value
  44940. }, extractedChildren, PatchFlags.STYLE | PatchFlags.CLASS);
  44941. }
  44942. return children.children;
  44943. };
  44944. }
  44945. });
  44946. const ElSpace = withInstall(Space);
  44947. const statisticProps = buildProps({
  44948. decimalSeparator: {
  44949. type: String,
  44950. default: "."
  44951. },
  44952. groupSeparator: {
  44953. type: String,
  44954. default: ","
  44955. },
  44956. precision: {
  44957. type: Number,
  44958. default: 0
  44959. },
  44960. formatter: Function,
  44961. value: {
  44962. type: definePropType([Number, Object]),
  44963. default: 0
  44964. },
  44965. prefix: String,
  44966. suffix: String,
  44967. title: String,
  44968. valueStyle: {
  44969. type: definePropType([String, Object, Array])
  44970. }
  44971. });
  44972. const __default__$x = vue.defineComponent({
  44973. name: "ElStatistic"
  44974. });
  44975. const _sfc_main$E = /* @__PURE__ */ vue.defineComponent({
  44976. ...__default__$x,
  44977. props: statisticProps,
  44978. setup(__props, { expose }) {
  44979. const props = __props;
  44980. const ns = useNamespace("statistic");
  44981. const displayValue = vue.computed(() => {
  44982. const { value, formatter, precision, decimalSeparator, groupSeparator } = props;
  44983. if (isFunction$1(formatter))
  44984. return formatter(value);
  44985. if (!isNumber(value) || Number.isNaN(value))
  44986. return value;
  44987. let [integer, decimal = ""] = String(value).split(".");
  44988. decimal = decimal.padEnd(precision, "0").slice(0, precision > 0 ? precision : 0);
  44989. integer = integer.replace(/\B(?=(\d{3})+(?!\d))/g, groupSeparator);
  44990. return [integer, decimal].join(decimal ? decimalSeparator : "");
  44991. });
  44992. expose({
  44993. displayValue
  44994. });
  44995. return (_ctx, _cache) => {
  44996. return vue.openBlock(), vue.createElementBlock("div", {
  44997. class: vue.normalizeClass(vue.unref(ns).b())
  44998. }, [
  44999. _ctx.$slots.title || _ctx.title ? (vue.openBlock(), vue.createElementBlock("div", {
  45000. key: 0,
  45001. class: vue.normalizeClass(vue.unref(ns).e("head"))
  45002. }, [
  45003. vue.renderSlot(_ctx.$slots, "title", {}, () => [
  45004. vue.createTextVNode(vue.toDisplayString(_ctx.title), 1)
  45005. ])
  45006. ], 2)) : vue.createCommentVNode("v-if", true),
  45007. vue.createElementVNode("div", {
  45008. class: vue.normalizeClass(vue.unref(ns).e("content"))
  45009. }, [
  45010. _ctx.$slots.prefix || _ctx.prefix ? (vue.openBlock(), vue.createElementBlock("div", {
  45011. key: 0,
  45012. class: vue.normalizeClass(vue.unref(ns).e("prefix"))
  45013. }, [
  45014. vue.renderSlot(_ctx.$slots, "prefix", {}, () => [
  45015. vue.createElementVNode("span", null, vue.toDisplayString(_ctx.prefix), 1)
  45016. ])
  45017. ], 2)) : vue.createCommentVNode("v-if", true),
  45018. vue.createElementVNode("span", {
  45019. class: vue.normalizeClass(vue.unref(ns).e("number")),
  45020. style: vue.normalizeStyle(_ctx.valueStyle)
  45021. }, vue.toDisplayString(vue.unref(displayValue)), 7),
  45022. _ctx.$slots.suffix || _ctx.suffix ? (vue.openBlock(), vue.createElementBlock("div", {
  45023. key: 1,
  45024. class: vue.normalizeClass(vue.unref(ns).e("suffix"))
  45025. }, [
  45026. vue.renderSlot(_ctx.$slots, "suffix", {}, () => [
  45027. vue.createElementVNode("span", null, vue.toDisplayString(_ctx.suffix), 1)
  45028. ])
  45029. ], 2)) : vue.createCommentVNode("v-if", true)
  45030. ], 2)
  45031. ], 2);
  45032. };
  45033. }
  45034. });
  45035. var Statistic = /* @__PURE__ */ _export_sfc(_sfc_main$E, [["__file", "statistic.vue"]]);
  45036. const ElStatistic = withInstall(Statistic);
  45037. const countdownProps = buildProps({
  45038. format: {
  45039. type: String,
  45040. default: "HH:mm:ss"
  45041. },
  45042. prefix: String,
  45043. suffix: String,
  45044. title: String,
  45045. value: {
  45046. type: definePropType([Number, Object]),
  45047. default: 0
  45048. },
  45049. valueStyle: {
  45050. type: definePropType([String, Object, Array])
  45051. }
  45052. });
  45053. const countdownEmits = {
  45054. finish: () => true,
  45055. [CHANGE_EVENT]: (value) => isNumber(value)
  45056. };
  45057. const timeUnits = [
  45058. ["Y", 1e3 * 60 * 60 * 24 * 365],
  45059. ["M", 1e3 * 60 * 60 * 24 * 30],
  45060. ["D", 1e3 * 60 * 60 * 24],
  45061. ["H", 1e3 * 60 * 60],
  45062. ["m", 1e3 * 60],
  45063. ["s", 1e3],
  45064. ["S", 1]
  45065. ];
  45066. const getTime = (value) => {
  45067. return isNumber(value) ? new Date(value).getTime() : value.valueOf();
  45068. };
  45069. const formatTime$1 = (timestamp, format) => {
  45070. let timeLeft = timestamp;
  45071. const escapeRegex = /\[([^\]]*)]/g;
  45072. const replacedText = timeUnits.reduce((current, [name, unit]) => {
  45073. const replaceRegex = new RegExp(`${name}+(?![^\\[\\]]*\\])`, "g");
  45074. if (replaceRegex.test(current)) {
  45075. const value = Math.floor(timeLeft / unit);
  45076. timeLeft -= value * unit;
  45077. return current.replace(replaceRegex, (match) => String(value).padStart(match.length, "0"));
  45078. }
  45079. return current;
  45080. }, format);
  45081. return replacedText.replace(escapeRegex, "$1");
  45082. };
  45083. const __default__$w = vue.defineComponent({
  45084. name: "ElCountdown"
  45085. });
  45086. const _sfc_main$D = /* @__PURE__ */ vue.defineComponent({
  45087. ...__default__$w,
  45088. props: countdownProps,
  45089. emits: countdownEmits,
  45090. setup(__props, { expose, emit }) {
  45091. const props = __props;
  45092. let timer;
  45093. const rawValue = vue.ref(0);
  45094. const displayValue = vue.computed(() => formatTime$1(rawValue.value, props.format));
  45095. const formatter = (val) => formatTime$1(val, props.format);
  45096. const stopTimer = () => {
  45097. if (timer) {
  45098. cAF(timer);
  45099. timer = void 0;
  45100. }
  45101. };
  45102. const startTimer = () => {
  45103. const timestamp = getTime(props.value);
  45104. const frameFunc = () => {
  45105. let diff = timestamp - Date.now();
  45106. emit(CHANGE_EVENT, diff);
  45107. if (diff <= 0) {
  45108. diff = 0;
  45109. stopTimer();
  45110. emit("finish");
  45111. } else {
  45112. timer = rAF(frameFunc);
  45113. }
  45114. rawValue.value = diff;
  45115. };
  45116. timer = rAF(frameFunc);
  45117. };
  45118. vue.onMounted(() => {
  45119. rawValue.value = getTime(props.value) - Date.now();
  45120. vue.watch(() => [props.value, props.format], () => {
  45121. stopTimer();
  45122. startTimer();
  45123. }, {
  45124. immediate: true
  45125. });
  45126. });
  45127. vue.onBeforeUnmount(() => {
  45128. stopTimer();
  45129. });
  45130. expose({
  45131. displayValue
  45132. });
  45133. return (_ctx, _cache) => {
  45134. return vue.openBlock(), vue.createBlock(vue.unref(ElStatistic), {
  45135. value: rawValue.value,
  45136. title: _ctx.title,
  45137. prefix: _ctx.prefix,
  45138. suffix: _ctx.suffix,
  45139. "value-style": _ctx.valueStyle,
  45140. formatter
  45141. }, vue.createSlots({
  45142. _: 2
  45143. }, [
  45144. vue.renderList(_ctx.$slots, (_, name) => {
  45145. return {
  45146. name,
  45147. fn: vue.withCtx(() => [
  45148. vue.renderSlot(_ctx.$slots, name)
  45149. ])
  45150. };
  45151. })
  45152. ]), 1032, ["value", "title", "prefix", "suffix", "value-style"]);
  45153. };
  45154. }
  45155. });
  45156. var Countdown = /* @__PURE__ */ _export_sfc(_sfc_main$D, [["__file", "countdown.vue"]]);
  45157. const ElCountdown = withInstall(Countdown);
  45158. const stepsProps = buildProps({
  45159. space: {
  45160. type: [Number, String],
  45161. default: ""
  45162. },
  45163. active: {
  45164. type: Number,
  45165. default: 0
  45166. },
  45167. direction: {
  45168. type: String,
  45169. default: "horizontal",
  45170. values: ["horizontal", "vertical"]
  45171. },
  45172. alignCenter: {
  45173. type: Boolean
  45174. },
  45175. simple: {
  45176. type: Boolean
  45177. },
  45178. finishStatus: {
  45179. type: String,
  45180. values: ["wait", "process", "finish", "error", "success"],
  45181. default: "finish"
  45182. },
  45183. processStatus: {
  45184. type: String,
  45185. values: ["wait", "process", "finish", "error", "success"],
  45186. default: "process"
  45187. }
  45188. });
  45189. const stepsEmits = {
  45190. [CHANGE_EVENT]: (newVal, oldVal) => [newVal, oldVal].every(isNumber)
  45191. };
  45192. const STEPS_INJECTION_KEY = "ElSteps";
  45193. const __default__$v = vue.defineComponent({
  45194. name: "ElSteps"
  45195. });
  45196. const _sfc_main$C = /* @__PURE__ */ vue.defineComponent({
  45197. ...__default__$v,
  45198. props: stepsProps,
  45199. emits: stepsEmits,
  45200. setup(__props, { emit }) {
  45201. const props = __props;
  45202. const ns = useNamespace("steps");
  45203. const {
  45204. children: steps,
  45205. addChild: addStep,
  45206. removeChild: removeStep,
  45207. ChildrenSorter: StepsSorter
  45208. } = useOrderedChildren(vue.getCurrentInstance(), "ElStep");
  45209. vue.watch(steps, () => {
  45210. steps.value.forEach((instance, index) => {
  45211. instance.setIndex(index);
  45212. });
  45213. });
  45214. vue.provide(STEPS_INJECTION_KEY, { props, steps, addStep, removeStep });
  45215. vue.watch(() => props.active, (newVal, oldVal) => {
  45216. emit(CHANGE_EVENT, newVal, oldVal);
  45217. });
  45218. return (_ctx, _cache) => {
  45219. return vue.openBlock(), vue.createElementBlock("div", {
  45220. class: vue.normalizeClass([vue.unref(ns).b(), vue.unref(ns).m(_ctx.simple ? "simple" : _ctx.direction)])
  45221. }, [
  45222. vue.renderSlot(_ctx.$slots, "default"),
  45223. vue.createVNode(vue.unref(StepsSorter))
  45224. ], 2);
  45225. };
  45226. }
  45227. });
  45228. var Steps = /* @__PURE__ */ _export_sfc(_sfc_main$C, [["__file", "steps.vue"]]);
  45229. const stepProps = buildProps({
  45230. title: {
  45231. type: String,
  45232. default: ""
  45233. },
  45234. icon: {
  45235. type: iconPropType
  45236. },
  45237. description: {
  45238. type: String,
  45239. default: ""
  45240. },
  45241. status: {
  45242. type: String,
  45243. values: ["", "wait", "process", "finish", "error", "success"],
  45244. default: ""
  45245. }
  45246. });
  45247. const __default__$u = vue.defineComponent({
  45248. name: "ElStep"
  45249. });
  45250. const _sfc_main$B = vue.defineComponent({
  45251. ...__default__$u,
  45252. props: stepProps,
  45253. setup(__props) {
  45254. const props = __props;
  45255. const ns = useNamespace("step");
  45256. const index = vue.ref(-1);
  45257. const lineStyle = vue.ref({});
  45258. const internalStatus = vue.ref("");
  45259. const parent = vue.inject(STEPS_INJECTION_KEY);
  45260. const currentInstance = vue.getCurrentInstance();
  45261. let stepDiff = 0;
  45262. let beforeActive = 0;
  45263. vue.onMounted(() => {
  45264. vue.watch([
  45265. () => parent.props.active,
  45266. () => parent.props.processStatus,
  45267. () => parent.props.finishStatus
  45268. ], ([active], [oldActive]) => {
  45269. beforeActive = oldActive || 0;
  45270. stepDiff = active - beforeActive;
  45271. updateStatus(active);
  45272. }, { immediate: true });
  45273. });
  45274. const currentStatus = vue.computed(() => {
  45275. return props.status || internalStatus.value;
  45276. });
  45277. const prevInternalStatus = vue.computed(() => {
  45278. const prevStep = parent.steps.value[index.value - 1];
  45279. return prevStep ? prevStep.internalStatus.value : "wait";
  45280. });
  45281. const isCenter = vue.computed(() => {
  45282. return parent.props.alignCenter;
  45283. });
  45284. const isVertical = vue.computed(() => {
  45285. return parent.props.direction === "vertical";
  45286. });
  45287. const isSimple = vue.computed(() => {
  45288. return parent.props.simple;
  45289. });
  45290. const stepsCount = vue.computed(() => {
  45291. return parent.steps.value.length;
  45292. });
  45293. const isLast = vue.computed(() => {
  45294. var _a;
  45295. return ((_a = parent.steps.value[stepsCount.value - 1]) == null ? void 0 : _a.uid) === currentInstance.uid;
  45296. });
  45297. const space = vue.computed(() => {
  45298. return isSimple.value ? "" : parent.props.space;
  45299. });
  45300. const containerKls = vue.computed(() => {
  45301. return [
  45302. ns.b(),
  45303. ns.is(isSimple.value ? "simple" : parent.props.direction),
  45304. ns.is("flex", isLast.value && !space.value && !isCenter.value),
  45305. ns.is("center", isCenter.value && !isVertical.value && !isSimple.value)
  45306. ];
  45307. });
  45308. const style = vue.computed(() => {
  45309. const style2 = {
  45310. flexBasis: isNumber(space.value) ? `${space.value}px` : space.value ? space.value : `${100 / (stepsCount.value - (isCenter.value ? 0 : 1))}%`
  45311. };
  45312. if (isVertical.value)
  45313. return style2;
  45314. if (isLast.value) {
  45315. style2.maxWidth = `${100 / stepsCount.value}%`;
  45316. }
  45317. return style2;
  45318. });
  45319. const setIndex = (val) => {
  45320. index.value = val;
  45321. };
  45322. const calcProgress = (status) => {
  45323. const isWait = status === "wait";
  45324. const delayTimer = Math.abs(stepDiff) === 1 ? 0 : stepDiff > 0 ? (index.value + 1 - beforeActive) * 150 : -(index.value + 1 - parent.props.active) * 150;
  45325. const style2 = {
  45326. transitionDelay: `${delayTimer}ms`
  45327. };
  45328. const step = status === parent.props.processStatus || isWait ? 0 : 100;
  45329. style2.borderWidth = step && !isSimple.value ? "1px" : 0;
  45330. style2[parent.props.direction === "vertical" ? "height" : "width"] = `${step}%`;
  45331. lineStyle.value = style2;
  45332. };
  45333. const updateStatus = (activeIndex) => {
  45334. if (activeIndex > index.value) {
  45335. internalStatus.value = parent.props.finishStatus;
  45336. } else if (activeIndex === index.value && prevInternalStatus.value !== "error") {
  45337. internalStatus.value = parent.props.processStatus;
  45338. } else {
  45339. internalStatus.value = "wait";
  45340. }
  45341. const prevChild = parent.steps.value[index.value - 1];
  45342. if (prevChild)
  45343. prevChild.calcProgress(internalStatus.value);
  45344. };
  45345. const stepItemState = {
  45346. uid: currentInstance.uid,
  45347. getVnode: () => currentInstance.vnode,
  45348. currentStatus,
  45349. internalStatus,
  45350. setIndex,
  45351. calcProgress
  45352. };
  45353. parent.addStep(stepItemState);
  45354. vue.onBeforeUnmount(() => {
  45355. parent.removeStep(stepItemState);
  45356. });
  45357. return (_ctx, _cache) => {
  45358. return vue.openBlock(), vue.createElementBlock("div", {
  45359. style: vue.normalizeStyle(vue.unref(style)),
  45360. class: vue.normalizeClass(vue.unref(containerKls))
  45361. }, [
  45362. vue.createCommentVNode(" icon & line "),
  45363. vue.createElementVNode("div", {
  45364. class: vue.normalizeClass([vue.unref(ns).e("head"), vue.unref(ns).is(vue.unref(currentStatus))])
  45365. }, [
  45366. !vue.unref(isSimple) ? (vue.openBlock(), vue.createElementBlock("div", {
  45367. key: 0,
  45368. class: vue.normalizeClass(vue.unref(ns).e("line"))
  45369. }, [
  45370. vue.createElementVNode("i", {
  45371. class: vue.normalizeClass(vue.unref(ns).e("line-inner")),
  45372. style: vue.normalizeStyle(lineStyle.value)
  45373. }, null, 6)
  45374. ], 2)) : vue.createCommentVNode("v-if", true),
  45375. vue.createElementVNode("div", {
  45376. class: vue.normalizeClass([vue.unref(ns).e("icon"), vue.unref(ns).is(_ctx.icon || _ctx.$slots.icon ? "icon" : "text")])
  45377. }, [
  45378. vue.renderSlot(_ctx.$slots, "icon", {}, () => [
  45379. _ctx.icon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  45380. key: 0,
  45381. class: vue.normalizeClass(vue.unref(ns).e("icon-inner"))
  45382. }, {
  45383. default: vue.withCtx(() => [
  45384. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.icon)))
  45385. ]),
  45386. _: 1
  45387. }, 8, ["class"])) : vue.unref(currentStatus) === "success" ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  45388. key: 1,
  45389. class: vue.normalizeClass([vue.unref(ns).e("icon-inner"), vue.unref(ns).is("status")])
  45390. }, {
  45391. default: vue.withCtx(() => [
  45392. vue.createVNode(vue.unref(check_default))
  45393. ]),
  45394. _: 1
  45395. }, 8, ["class"])) : vue.unref(currentStatus) === "error" ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  45396. key: 2,
  45397. class: vue.normalizeClass([vue.unref(ns).e("icon-inner"), vue.unref(ns).is("status")])
  45398. }, {
  45399. default: vue.withCtx(() => [
  45400. vue.createVNode(vue.unref(close_default))
  45401. ]),
  45402. _: 1
  45403. }, 8, ["class"])) : !vue.unref(isSimple) ? (vue.openBlock(), vue.createElementBlock("div", {
  45404. key: 3,
  45405. class: vue.normalizeClass(vue.unref(ns).e("icon-inner"))
  45406. }, vue.toDisplayString(index.value + 1), 3)) : vue.createCommentVNode("v-if", true)
  45407. ])
  45408. ], 2)
  45409. ], 2),
  45410. vue.createCommentVNode(" title & description "),
  45411. vue.createElementVNode("div", {
  45412. class: vue.normalizeClass(vue.unref(ns).e("main"))
  45413. }, [
  45414. vue.createElementVNode("div", {
  45415. class: vue.normalizeClass([vue.unref(ns).e("title"), vue.unref(ns).is(vue.unref(currentStatus))])
  45416. }, [
  45417. vue.renderSlot(_ctx.$slots, "title", {}, () => [
  45418. vue.createTextVNode(vue.toDisplayString(_ctx.title), 1)
  45419. ])
  45420. ], 2),
  45421. vue.unref(isSimple) ? (vue.openBlock(), vue.createElementBlock("div", {
  45422. key: 0,
  45423. class: vue.normalizeClass(vue.unref(ns).e("arrow"))
  45424. }, null, 2)) : (vue.openBlock(), vue.createElementBlock("div", {
  45425. key: 1,
  45426. class: vue.normalizeClass([vue.unref(ns).e("description"), vue.unref(ns).is(vue.unref(currentStatus))])
  45427. }, [
  45428. vue.renderSlot(_ctx.$slots, "description", {}, () => [
  45429. vue.createTextVNode(vue.toDisplayString(_ctx.description), 1)
  45430. ])
  45431. ], 2))
  45432. ], 2)
  45433. ], 6);
  45434. };
  45435. }
  45436. });
  45437. var Step = /* @__PURE__ */ _export_sfc(_sfc_main$B, [["__file", "item.vue"]]);
  45438. const ElSteps = withInstall(Steps, {
  45439. Step
  45440. });
  45441. const ElStep = withNoopInstall(Step);
  45442. const switchProps = buildProps({
  45443. modelValue: {
  45444. type: [Boolean, String, Number],
  45445. default: false
  45446. },
  45447. disabled: Boolean,
  45448. loading: Boolean,
  45449. size: {
  45450. type: String,
  45451. validator: isValidComponentSize
  45452. },
  45453. width: {
  45454. type: [String, Number],
  45455. default: ""
  45456. },
  45457. inlinePrompt: Boolean,
  45458. inactiveActionIcon: {
  45459. type: iconPropType
  45460. },
  45461. activeActionIcon: {
  45462. type: iconPropType
  45463. },
  45464. activeIcon: {
  45465. type: iconPropType
  45466. },
  45467. inactiveIcon: {
  45468. type: iconPropType
  45469. },
  45470. activeText: {
  45471. type: String,
  45472. default: ""
  45473. },
  45474. inactiveText: {
  45475. type: String,
  45476. default: ""
  45477. },
  45478. activeValue: {
  45479. type: [Boolean, String, Number],
  45480. default: true
  45481. },
  45482. inactiveValue: {
  45483. type: [Boolean, String, Number],
  45484. default: false
  45485. },
  45486. name: {
  45487. type: String,
  45488. default: ""
  45489. },
  45490. validateEvent: {
  45491. type: Boolean,
  45492. default: true
  45493. },
  45494. beforeChange: {
  45495. type: definePropType(Function)
  45496. },
  45497. id: String,
  45498. tabindex: {
  45499. type: [String, Number]
  45500. },
  45501. ...useAriaProps(["ariaLabel"])
  45502. });
  45503. const switchEmits = {
  45504. [UPDATE_MODEL_EVENT]: (val) => isBoolean(val) || isString$1(val) || isNumber(val),
  45505. [CHANGE_EVENT]: (val) => isBoolean(val) || isString$1(val) || isNumber(val),
  45506. [INPUT_EVENT]: (val) => isBoolean(val) || isString$1(val) || isNumber(val)
  45507. };
  45508. const COMPONENT_NAME$9 = "ElSwitch";
  45509. const __default__$t = vue.defineComponent({
  45510. name: COMPONENT_NAME$9
  45511. });
  45512. const _sfc_main$A = /* @__PURE__ */ vue.defineComponent({
  45513. ...__default__$t,
  45514. props: switchProps,
  45515. emits: switchEmits,
  45516. setup(__props, { expose, emit }) {
  45517. const props = __props;
  45518. const { formItem } = useFormItem();
  45519. const switchSize = useFormSize();
  45520. const ns = useNamespace("switch");
  45521. const { inputId } = useFormItemInputId(props, {
  45522. formItemContext: formItem
  45523. });
  45524. const switchDisabled = useFormDisabled(vue.computed(() => props.loading));
  45525. const isControlled = vue.ref(props.modelValue !== false);
  45526. const input = vue.shallowRef();
  45527. const switchKls = vue.computed(() => [
  45528. ns.b(),
  45529. ns.m(switchSize.value),
  45530. ns.is("disabled", switchDisabled.value),
  45531. ns.is("checked", checked.value)
  45532. ]);
  45533. const labelLeftKls = vue.computed(() => [
  45534. ns.e("label"),
  45535. ns.em("label", "left"),
  45536. ns.is("active", !checked.value)
  45537. ]);
  45538. const labelRightKls = vue.computed(() => [
  45539. ns.e("label"),
  45540. ns.em("label", "right"),
  45541. ns.is("active", checked.value)
  45542. ]);
  45543. const coreStyle = vue.computed(() => ({
  45544. width: addUnit(props.width)
  45545. }));
  45546. vue.watch(() => props.modelValue, () => {
  45547. isControlled.value = true;
  45548. });
  45549. const actualValue = vue.computed(() => {
  45550. return isControlled.value ? props.modelValue : false;
  45551. });
  45552. const checked = vue.computed(() => actualValue.value === props.activeValue);
  45553. if (![props.activeValue, props.inactiveValue].includes(actualValue.value)) {
  45554. emit(UPDATE_MODEL_EVENT, props.inactiveValue);
  45555. emit(CHANGE_EVENT, props.inactiveValue);
  45556. emit(INPUT_EVENT, props.inactiveValue);
  45557. }
  45558. vue.watch(checked, (val) => {
  45559. var _a;
  45560. input.value.checked = val;
  45561. if (props.validateEvent) {
  45562. (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "change").catch((err) => debugWarn(err));
  45563. }
  45564. });
  45565. const handleChange = () => {
  45566. const val = checked.value ? props.inactiveValue : props.activeValue;
  45567. emit(UPDATE_MODEL_EVENT, val);
  45568. emit(CHANGE_EVENT, val);
  45569. emit(INPUT_EVENT, val);
  45570. vue.nextTick(() => {
  45571. input.value.checked = checked.value;
  45572. });
  45573. };
  45574. const switchValue = () => {
  45575. if (switchDisabled.value)
  45576. return;
  45577. const { beforeChange } = props;
  45578. if (!beforeChange) {
  45579. handleChange();
  45580. return;
  45581. }
  45582. const shouldChange = beforeChange();
  45583. const isPromiseOrBool = [
  45584. isPromise(shouldChange),
  45585. isBoolean(shouldChange)
  45586. ].includes(true);
  45587. if (!isPromiseOrBool) {
  45588. throwError(COMPONENT_NAME$9, "beforeChange must return type `Promise<boolean>` or `boolean`");
  45589. }
  45590. if (isPromise(shouldChange)) {
  45591. shouldChange.then((result) => {
  45592. if (result) {
  45593. handleChange();
  45594. }
  45595. }).catch((e) => {
  45596. debugWarn(COMPONENT_NAME$9, `some error occurred: ${e}`);
  45597. });
  45598. } else if (shouldChange) {
  45599. handleChange();
  45600. }
  45601. };
  45602. const focus = () => {
  45603. var _a, _b;
  45604. (_b = (_a = input.value) == null ? void 0 : _a.focus) == null ? void 0 : _b.call(_a);
  45605. };
  45606. vue.onMounted(() => {
  45607. input.value.checked = checked.value;
  45608. });
  45609. expose({
  45610. focus,
  45611. checked
  45612. });
  45613. return (_ctx, _cache) => {
  45614. return vue.openBlock(), vue.createElementBlock("div", {
  45615. class: vue.normalizeClass(vue.unref(switchKls)),
  45616. onClick: vue.withModifiers(switchValue, ["prevent"])
  45617. }, [
  45618. vue.createElementVNode("input", {
  45619. id: vue.unref(inputId),
  45620. ref_key: "input",
  45621. ref: input,
  45622. class: vue.normalizeClass(vue.unref(ns).e("input")),
  45623. type: "checkbox",
  45624. role: "switch",
  45625. "aria-checked": vue.unref(checked),
  45626. "aria-disabled": vue.unref(switchDisabled),
  45627. "aria-label": _ctx.ariaLabel,
  45628. name: _ctx.name,
  45629. "true-value": _ctx.activeValue,
  45630. "false-value": _ctx.inactiveValue,
  45631. disabled: vue.unref(switchDisabled),
  45632. tabindex: _ctx.tabindex,
  45633. onChange: handleChange,
  45634. onKeydown: vue.withKeys(switchValue, ["enter"])
  45635. }, null, 42, ["id", "aria-checked", "aria-disabled", "aria-label", "name", "true-value", "false-value", "disabled", "tabindex", "onKeydown"]),
  45636. !_ctx.inlinePrompt && (_ctx.inactiveIcon || _ctx.inactiveText) ? (vue.openBlock(), vue.createElementBlock("span", {
  45637. key: 0,
  45638. class: vue.normalizeClass(vue.unref(labelLeftKls))
  45639. }, [
  45640. _ctx.inactiveIcon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 0 }, {
  45641. default: vue.withCtx(() => [
  45642. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.inactiveIcon)))
  45643. ]),
  45644. _: 1
  45645. })) : vue.createCommentVNode("v-if", true),
  45646. !_ctx.inactiveIcon && _ctx.inactiveText ? (vue.openBlock(), vue.createElementBlock("span", {
  45647. key: 1,
  45648. "aria-hidden": vue.unref(checked)
  45649. }, vue.toDisplayString(_ctx.inactiveText), 9, ["aria-hidden"])) : vue.createCommentVNode("v-if", true)
  45650. ], 2)) : vue.createCommentVNode("v-if", true),
  45651. vue.createElementVNode("span", {
  45652. class: vue.normalizeClass(vue.unref(ns).e("core")),
  45653. style: vue.normalizeStyle(vue.unref(coreStyle))
  45654. }, [
  45655. _ctx.inlinePrompt ? (vue.openBlock(), vue.createElementBlock("div", {
  45656. key: 0,
  45657. class: vue.normalizeClass(vue.unref(ns).e("inner"))
  45658. }, [
  45659. _ctx.activeIcon || _ctx.inactiveIcon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  45660. key: 0,
  45661. class: vue.normalizeClass(vue.unref(ns).is("icon"))
  45662. }, {
  45663. default: vue.withCtx(() => [
  45664. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(checked) ? _ctx.activeIcon : _ctx.inactiveIcon)))
  45665. ]),
  45666. _: 1
  45667. }, 8, ["class"])) : _ctx.activeText || _ctx.inactiveText ? (vue.openBlock(), vue.createElementBlock("span", {
  45668. key: 1,
  45669. class: vue.normalizeClass(vue.unref(ns).is("text")),
  45670. "aria-hidden": !vue.unref(checked)
  45671. }, vue.toDisplayString(vue.unref(checked) ? _ctx.activeText : _ctx.inactiveText), 11, ["aria-hidden"])) : vue.createCommentVNode("v-if", true)
  45672. ], 2)) : vue.createCommentVNode("v-if", true),
  45673. vue.createElementVNode("div", {
  45674. class: vue.normalizeClass(vue.unref(ns).e("action"))
  45675. }, [
  45676. _ctx.loading ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  45677. key: 0,
  45678. class: vue.normalizeClass(vue.unref(ns).is("loading"))
  45679. }, {
  45680. default: vue.withCtx(() => [
  45681. vue.createVNode(vue.unref(loading_default))
  45682. ]),
  45683. _: 1
  45684. }, 8, ["class"])) : vue.unref(checked) ? vue.renderSlot(_ctx.$slots, "active-action", { key: 1 }, () => [
  45685. _ctx.activeActionIcon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 0 }, {
  45686. default: vue.withCtx(() => [
  45687. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.activeActionIcon)))
  45688. ]),
  45689. _: 1
  45690. })) : vue.createCommentVNode("v-if", true)
  45691. ]) : !vue.unref(checked) ? vue.renderSlot(_ctx.$slots, "inactive-action", { key: 2 }, () => [
  45692. _ctx.inactiveActionIcon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 0 }, {
  45693. default: vue.withCtx(() => [
  45694. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.inactiveActionIcon)))
  45695. ]),
  45696. _: 1
  45697. })) : vue.createCommentVNode("v-if", true)
  45698. ]) : vue.createCommentVNode("v-if", true)
  45699. ], 2)
  45700. ], 6),
  45701. !_ctx.inlinePrompt && (_ctx.activeIcon || _ctx.activeText) ? (vue.openBlock(), vue.createElementBlock("span", {
  45702. key: 1,
  45703. class: vue.normalizeClass(vue.unref(labelRightKls))
  45704. }, [
  45705. _ctx.activeIcon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 0 }, {
  45706. default: vue.withCtx(() => [
  45707. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.activeIcon)))
  45708. ]),
  45709. _: 1
  45710. })) : vue.createCommentVNode("v-if", true),
  45711. !_ctx.activeIcon && _ctx.activeText ? (vue.openBlock(), vue.createElementBlock("span", {
  45712. key: 1,
  45713. "aria-hidden": !vue.unref(checked)
  45714. }, vue.toDisplayString(_ctx.activeText), 9, ["aria-hidden"])) : vue.createCommentVNode("v-if", true)
  45715. ], 2)) : vue.createCommentVNode("v-if", true)
  45716. ], 10, ["onClick"]);
  45717. };
  45718. }
  45719. });
  45720. var Switch = /* @__PURE__ */ _export_sfc(_sfc_main$A, [["__file", "switch.vue"]]);
  45721. const ElSwitch = withInstall(Switch);
  45722. const getCell = function(event) {
  45723. var _a;
  45724. return (_a = event.target) == null ? void 0 : _a.closest("td");
  45725. };
  45726. const orderBy = function(array, sortKey, reverse, sortMethod, sortBy) {
  45727. if (!sortKey && !sortMethod && (!sortBy || isArray$1(sortBy) && !sortBy.length)) {
  45728. return array;
  45729. }
  45730. if (isString$1(reverse)) {
  45731. reverse = reverse === "descending" ? -1 : 1;
  45732. } else {
  45733. reverse = reverse && reverse < 0 ? -1 : 1;
  45734. }
  45735. const getKey = sortMethod ? null : function(value, index) {
  45736. if (sortBy) {
  45737. return flatMap(castArray$1(sortBy), (by) => {
  45738. if (isString$1(by)) {
  45739. return get(value, by);
  45740. } else {
  45741. return by(value, index, array);
  45742. }
  45743. });
  45744. }
  45745. if (sortKey !== "$key") {
  45746. if (isObject$1(value) && "$value" in value)
  45747. value = value.$value;
  45748. }
  45749. return [
  45750. isObject$1(value) ? sortKey ? get(value, sortKey) : null : value
  45751. ];
  45752. };
  45753. const compare = function(a, b) {
  45754. var _a, _b, _c, _d, _e, _f;
  45755. if (sortMethod) {
  45756. return sortMethod(a.value, b.value);
  45757. }
  45758. for (let i = 0, len = (_b = (_a = a.key) == null ? void 0 : _a.length) != null ? _b : 0; i < len; i++) {
  45759. if (((_c = a.key) == null ? void 0 : _c[i]) < ((_d = b.key) == null ? void 0 : _d[i])) {
  45760. return -1;
  45761. }
  45762. if (((_e = a.key) == null ? void 0 : _e[i]) > ((_f = b.key) == null ? void 0 : _f[i])) {
  45763. return 1;
  45764. }
  45765. }
  45766. return 0;
  45767. };
  45768. return array.map((value, index) => {
  45769. return {
  45770. value,
  45771. index,
  45772. key: getKey ? getKey(value, index) : null
  45773. };
  45774. }).sort((a, b) => {
  45775. let order = compare(a, b);
  45776. if (!order) {
  45777. order = a.index - b.index;
  45778. }
  45779. return order * +reverse;
  45780. }).map((item) => item.value);
  45781. };
  45782. const getColumnById = function(table, columnId) {
  45783. let column = null;
  45784. table.columns.forEach((item) => {
  45785. if (item.id === columnId) {
  45786. column = item;
  45787. }
  45788. });
  45789. return column;
  45790. };
  45791. const getColumnByKey = function(table, columnKey) {
  45792. let column = null;
  45793. for (let i = 0; i < table.columns.length; i++) {
  45794. const item = table.columns[i];
  45795. if (item.columnKey === columnKey) {
  45796. column = item;
  45797. break;
  45798. }
  45799. }
  45800. if (!column)
  45801. throwError("ElTable", `No column matching with column-key: ${columnKey}`);
  45802. return column;
  45803. };
  45804. const getColumnByCell = function(table, cell, namespace) {
  45805. const matches = (cell.className || "").match(new RegExp(`${namespace}-table_[^\\s]+`, "gm"));
  45806. if (matches) {
  45807. return getColumnById(table, matches[0]);
  45808. }
  45809. return null;
  45810. };
  45811. const getRowIdentity = (row, rowKey) => {
  45812. if (!row)
  45813. throw new Error("Row is required when get row identity");
  45814. if (isString$1(rowKey)) {
  45815. if (!rowKey.includes(".")) {
  45816. return `${row[rowKey]}`;
  45817. }
  45818. const key = rowKey.split(".");
  45819. let current = row;
  45820. for (const element of key) {
  45821. current = current[element];
  45822. }
  45823. return `${current}`;
  45824. } else if (isFunction$1(rowKey)) {
  45825. return rowKey.call(null, row);
  45826. }
  45827. return "";
  45828. };
  45829. const getKeysMap = function(array, rowKey, flatten = false, childrenKey = "children") {
  45830. const data = array || [];
  45831. const arrayMap = {};
  45832. data.forEach((row, index) => {
  45833. arrayMap[getRowIdentity(row, rowKey)] = { row, index };
  45834. if (flatten) {
  45835. const children = row[childrenKey];
  45836. if (isArray$1(children)) {
  45837. Object.assign(arrayMap, getKeysMap(children, rowKey, true, childrenKey));
  45838. }
  45839. }
  45840. });
  45841. return arrayMap;
  45842. };
  45843. function mergeOptions(defaults, config) {
  45844. const options = {};
  45845. let key;
  45846. for (key in defaults) {
  45847. options[key] = defaults[key];
  45848. }
  45849. for (key in config) {
  45850. if (hasOwn(config, key)) {
  45851. const value = config[key];
  45852. if (!isUndefined(value)) {
  45853. options[key] = value;
  45854. }
  45855. }
  45856. }
  45857. return options;
  45858. }
  45859. function parseWidth(width) {
  45860. if (width === "")
  45861. return width;
  45862. if (!isUndefined(width)) {
  45863. width = Number.parseInt(width, 10);
  45864. if (Number.isNaN(width)) {
  45865. width = "";
  45866. }
  45867. }
  45868. return width;
  45869. }
  45870. function parseMinWidth(minWidth) {
  45871. if (minWidth === "")
  45872. return minWidth;
  45873. if (!isUndefined(minWidth)) {
  45874. minWidth = parseWidth(minWidth);
  45875. if (Number.isNaN(minWidth)) {
  45876. minWidth = 80;
  45877. }
  45878. }
  45879. return minWidth;
  45880. }
  45881. function parseHeight(height) {
  45882. if (isNumber(height)) {
  45883. return height;
  45884. }
  45885. if (isString$1(height)) {
  45886. if (/^\d+(?:px)?$/.test(height)) {
  45887. return Number.parseInt(height, 10);
  45888. } else {
  45889. return height;
  45890. }
  45891. }
  45892. return null;
  45893. }
  45894. function compose(...funcs) {
  45895. if (funcs.length === 0) {
  45896. return (arg) => arg;
  45897. }
  45898. if (funcs.length === 1) {
  45899. return funcs[0];
  45900. }
  45901. return funcs.reduce((a, b) => (...args) => a(b(...args)));
  45902. }
  45903. function toggleRowStatus(statusArr, row, newVal, tableTreeProps, selectable, rowIndex, rowKey) {
  45904. let _rowIndex = rowIndex != null ? rowIndex : 0;
  45905. let changed = false;
  45906. const getIndex = () => {
  45907. if (!rowKey) {
  45908. return statusArr.indexOf(row);
  45909. }
  45910. const id = getRowIdentity(row, rowKey);
  45911. return statusArr.findIndex((item) => getRowIdentity(item, rowKey) === id);
  45912. };
  45913. const index = getIndex();
  45914. const included = index !== -1;
  45915. const isRowSelectable = selectable == null ? void 0 : selectable.call(null, row, _rowIndex);
  45916. const toggleStatus = (type) => {
  45917. if (type === "add") {
  45918. statusArr.push(row);
  45919. } else {
  45920. statusArr.splice(index, 1);
  45921. }
  45922. changed = true;
  45923. };
  45924. const getChildrenCount = (row2) => {
  45925. let count = 0;
  45926. const children = (tableTreeProps == null ? void 0 : tableTreeProps.children) && row2[tableTreeProps.children];
  45927. if (children && isArray$1(children)) {
  45928. count += children.length;
  45929. children.forEach((item) => {
  45930. count += getChildrenCount(item);
  45931. });
  45932. }
  45933. return count;
  45934. };
  45935. if (!selectable || isRowSelectable) {
  45936. if (isBoolean(newVal)) {
  45937. if (newVal && !included) {
  45938. toggleStatus("add");
  45939. } else if (!newVal && included) {
  45940. toggleStatus("remove");
  45941. }
  45942. } else {
  45943. included ? toggleStatus("remove") : toggleStatus("add");
  45944. }
  45945. }
  45946. if (!(tableTreeProps == null ? void 0 : tableTreeProps.checkStrictly) && (tableTreeProps == null ? void 0 : tableTreeProps.children) && isArray$1(row[tableTreeProps.children])) {
  45947. row[tableTreeProps.children].forEach((item) => {
  45948. const childChanged = toggleRowStatus(statusArr, item, newVal != null ? newVal : !included, tableTreeProps, selectable, _rowIndex + 1, rowKey);
  45949. _rowIndex += getChildrenCount(item) + 1;
  45950. if (childChanged) {
  45951. changed = childChanged;
  45952. }
  45953. });
  45954. }
  45955. return changed;
  45956. }
  45957. function walkTreeNode(root, cb, childrenKey = "children", lazyKey = "hasChildren", lazy = false) {
  45958. const isNil = (array) => !(isArray$1(array) && array.length);
  45959. function _walker(parent, children, level) {
  45960. cb(parent, children, level);
  45961. children.forEach((item) => {
  45962. if (item[lazyKey] && lazy) {
  45963. cb(item, null, level + 1);
  45964. return;
  45965. }
  45966. const children2 = item[childrenKey];
  45967. if (!isNil(children2)) {
  45968. _walker(item, children2, level + 1);
  45969. }
  45970. });
  45971. }
  45972. root.forEach((item) => {
  45973. if (item[lazyKey] && lazy) {
  45974. cb(item, null, 0);
  45975. return;
  45976. }
  45977. const children = item[childrenKey];
  45978. if (!isNil(children)) {
  45979. _walker(item, children, 0);
  45980. }
  45981. });
  45982. }
  45983. const getTableOverflowTooltipProps = (props, innerText, row, column) => {
  45984. const popperOptions = {
  45985. strategy: "fixed",
  45986. ...props.popperOptions
  45987. };
  45988. const tooltipFormatterContent = isFunction$1(column == null ? void 0 : column.tooltipFormatter) ? column.tooltipFormatter({
  45989. row,
  45990. column,
  45991. cellValue: getProp(row, column.property).value
  45992. }) : void 0;
  45993. if (vue.isVNode(tooltipFormatterContent)) {
  45994. return {
  45995. slotContent: tooltipFormatterContent,
  45996. content: null,
  45997. ...props,
  45998. popperOptions
  45999. };
  46000. }
  46001. return {
  46002. slotContent: null,
  46003. content: tooltipFormatterContent != null ? tooltipFormatterContent : innerText,
  46004. ...props,
  46005. popperOptions
  46006. };
  46007. };
  46008. let removePopper = null;
  46009. function createTablePopper(props, popperContent, row, column, trigger, table) {
  46010. var _a;
  46011. const tableOverflowTooltipProps = getTableOverflowTooltipProps(props, popperContent, row, column);
  46012. const mergedProps = {
  46013. ...tableOverflowTooltipProps,
  46014. slotContent: void 0
  46015. };
  46016. if ((removePopper == null ? void 0 : removePopper.trigger) === trigger) {
  46017. const comp = (_a = removePopper.vm) == null ? void 0 : _a.component;
  46018. merge(comp == null ? void 0 : comp.props, mergedProps);
  46019. if (comp && tableOverflowTooltipProps.slotContent) {
  46020. comp.slots.content = () => [tableOverflowTooltipProps.slotContent];
  46021. }
  46022. return;
  46023. }
  46024. removePopper == null ? void 0 : removePopper();
  46025. const parentNode = table == null ? void 0 : table.refs.tableWrapper;
  46026. const ns = parentNode == null ? void 0 : parentNode.dataset.prefix;
  46027. const vm = vue.createVNode(ElTooltip, {
  46028. virtualTriggering: true,
  46029. virtualRef: trigger,
  46030. appendTo: parentNode,
  46031. placement: "top",
  46032. transition: "none",
  46033. offset: 0,
  46034. hideAfter: 0,
  46035. ...mergedProps
  46036. }, tableOverflowTooltipProps.slotContent ? {
  46037. content: () => tableOverflowTooltipProps.slotContent
  46038. } : void 0);
  46039. vm.appContext = { ...table.appContext, ...table };
  46040. const container = document.createElement("div");
  46041. vue.render(vm, container);
  46042. vm.component.exposed.onOpen();
  46043. const scrollContainer = parentNode == null ? void 0 : parentNode.querySelector(`.${ns}-scrollbar__wrap`);
  46044. removePopper = () => {
  46045. var _a2, _b;
  46046. if ((_b = (_a2 = vm.component) == null ? void 0 : _a2.exposed) == null ? void 0 : _b.onClose) {
  46047. vm.component.exposed.onClose();
  46048. }
  46049. vue.render(null, container);
  46050. const currentRemovePopper = removePopper;
  46051. scrollContainer == null ? void 0 : scrollContainer.removeEventListener("scroll", currentRemovePopper);
  46052. currentRemovePopper.trigger = void 0;
  46053. currentRemovePopper.vm = void 0;
  46054. removePopper = null;
  46055. };
  46056. removePopper.trigger = trigger != null ? trigger : void 0;
  46057. removePopper.vm = vm;
  46058. scrollContainer == null ? void 0 : scrollContainer.addEventListener("scroll", removePopper);
  46059. }
  46060. function getCurrentColumns(column) {
  46061. if (column.children) {
  46062. return flatMap(column.children, getCurrentColumns);
  46063. } else {
  46064. return [column];
  46065. }
  46066. }
  46067. function getColSpan(colSpan, column) {
  46068. return colSpan + column.colSpan;
  46069. }
  46070. const isFixedColumn = (index, fixed, store, realColumns) => {
  46071. let start = 0;
  46072. let after = index;
  46073. const columns = store.states.columns.value;
  46074. if (realColumns) {
  46075. const curColumns = getCurrentColumns(realColumns[index]);
  46076. const preColumns = columns.slice(0, columns.indexOf(curColumns[0]));
  46077. start = preColumns.reduce(getColSpan, 0);
  46078. after = start + curColumns.reduce(getColSpan, 0) - 1;
  46079. } else {
  46080. start = index;
  46081. }
  46082. let fixedLayout;
  46083. switch (fixed) {
  46084. case "left":
  46085. if (after < store.states.fixedLeafColumnsLength.value) {
  46086. fixedLayout = "left";
  46087. }
  46088. break;
  46089. case "right":
  46090. if (start >= columns.length - store.states.rightFixedLeafColumnsLength.value) {
  46091. fixedLayout = "right";
  46092. }
  46093. break;
  46094. default:
  46095. if (after < store.states.fixedLeafColumnsLength.value) {
  46096. fixedLayout = "left";
  46097. } else if (start >= columns.length - store.states.rightFixedLeafColumnsLength.value) {
  46098. fixedLayout = "right";
  46099. }
  46100. }
  46101. return fixedLayout ? {
  46102. direction: fixedLayout,
  46103. start,
  46104. after
  46105. } : {};
  46106. };
  46107. const getFixedColumnsClass = (namespace, index, fixed, store, realColumns, offset = 0) => {
  46108. const classes = [];
  46109. const { direction, start, after } = isFixedColumn(index, fixed, store, realColumns);
  46110. if (direction) {
  46111. const isLeft = direction === "left";
  46112. classes.push(`${namespace}-fixed-column--${direction}`);
  46113. if (isLeft && after + offset === store.states.fixedLeafColumnsLength.value - 1) {
  46114. classes.push("is-last-column");
  46115. } else if (!isLeft && start - offset === store.states.columns.value.length - store.states.rightFixedLeafColumnsLength.value) {
  46116. classes.push("is-first-column");
  46117. }
  46118. }
  46119. return classes;
  46120. };
  46121. function getOffset(offset, column) {
  46122. return offset + (isNull(column.realWidth) || Number.isNaN(column.realWidth) ? Number(column.width) : column.realWidth);
  46123. }
  46124. const getFixedColumnOffset = (index, fixed, store, realColumns) => {
  46125. const {
  46126. direction,
  46127. start = 0,
  46128. after = 0
  46129. } = isFixedColumn(index, fixed, store, realColumns);
  46130. if (!direction) {
  46131. return;
  46132. }
  46133. const styles = {};
  46134. const isLeft = direction === "left";
  46135. const columns = store.states.columns.value;
  46136. if (isLeft) {
  46137. styles.left = columns.slice(0, start).reduce(getOffset, 0);
  46138. } else {
  46139. styles.right = columns.slice(after + 1).reverse().reduce(getOffset, 0);
  46140. }
  46141. return styles;
  46142. };
  46143. const ensurePosition = (style, key) => {
  46144. if (!style)
  46145. return;
  46146. if (!Number.isNaN(style[key])) {
  46147. style[key] = `${style[key]}px`;
  46148. }
  46149. };
  46150. function useExpand(watcherData) {
  46151. const instance = vue.getCurrentInstance();
  46152. const defaultExpandAll = vue.ref(false);
  46153. const expandRows = vue.ref([]);
  46154. const updateExpandRows = () => {
  46155. const data = watcherData.data.value || [];
  46156. const rowKey = watcherData.rowKey.value;
  46157. if (defaultExpandAll.value) {
  46158. expandRows.value = data.slice();
  46159. } else if (rowKey) {
  46160. const expandRowsMap = getKeysMap(expandRows.value, rowKey);
  46161. expandRows.value = data.reduce((prev, row) => {
  46162. const rowId = getRowIdentity(row, rowKey);
  46163. const rowInfo = expandRowsMap[rowId];
  46164. if (rowInfo) {
  46165. prev.push(row);
  46166. }
  46167. return prev;
  46168. }, []);
  46169. } else {
  46170. expandRows.value = [];
  46171. }
  46172. };
  46173. const toggleRowExpansion = (row, expanded) => {
  46174. const changed = toggleRowStatus(expandRows.value, row, expanded, void 0, void 0, void 0, watcherData.rowKey.value);
  46175. if (changed) {
  46176. instance.emit("expand-change", row, expandRows.value.slice());
  46177. }
  46178. };
  46179. const setExpandRowKeys = (rowKeys) => {
  46180. instance.store.assertRowKey();
  46181. const data = watcherData.data.value || [];
  46182. const rowKey = watcherData.rowKey.value;
  46183. const keysMap = getKeysMap(data, rowKey);
  46184. expandRows.value = rowKeys.reduce((prev, cur) => {
  46185. const info = keysMap[cur];
  46186. if (info) {
  46187. prev.push(info.row);
  46188. }
  46189. return prev;
  46190. }, []);
  46191. };
  46192. const isRowExpanded = (row) => {
  46193. const rowKey = watcherData.rowKey.value;
  46194. if (rowKey) {
  46195. const expandMap = getKeysMap(expandRows.value, rowKey);
  46196. return !!expandMap[getRowIdentity(row, rowKey)];
  46197. }
  46198. return expandRows.value.includes(row);
  46199. };
  46200. return {
  46201. updateExpandRows,
  46202. toggleRowExpansion,
  46203. setExpandRowKeys,
  46204. isRowExpanded,
  46205. states: {
  46206. expandRows,
  46207. defaultExpandAll
  46208. }
  46209. };
  46210. }
  46211. function useCurrent(watcherData) {
  46212. const instance = vue.getCurrentInstance();
  46213. const _currentRowKey = vue.ref(null);
  46214. const currentRow = vue.ref(null);
  46215. const setCurrentRowKey = (key) => {
  46216. instance.store.assertRowKey();
  46217. _currentRowKey.value = key;
  46218. setCurrentRowByKey(key);
  46219. };
  46220. const restoreCurrentRowKey = () => {
  46221. _currentRowKey.value = null;
  46222. };
  46223. const setCurrentRowByKey = (key) => {
  46224. var _a;
  46225. const { data, rowKey } = watcherData;
  46226. let _currentRow = null;
  46227. if (rowKey.value) {
  46228. _currentRow = (_a = (vue.unref(data) || []).find((item) => getRowIdentity(item, rowKey.value) === key)) != null ? _a : null;
  46229. }
  46230. currentRow.value = _currentRow != null ? _currentRow : null;
  46231. instance.emit("current-change", currentRow.value, null);
  46232. };
  46233. const updateCurrentRow = (_currentRow) => {
  46234. const oldCurrentRow = currentRow.value;
  46235. if (_currentRow && _currentRow !== oldCurrentRow) {
  46236. currentRow.value = _currentRow;
  46237. instance.emit("current-change", currentRow.value, oldCurrentRow);
  46238. return;
  46239. }
  46240. if (!_currentRow && oldCurrentRow) {
  46241. currentRow.value = null;
  46242. instance.emit("current-change", null, oldCurrentRow);
  46243. }
  46244. };
  46245. const updateCurrentRowData = () => {
  46246. const rowKey = watcherData.rowKey.value;
  46247. const data = watcherData.data.value || [];
  46248. const oldCurrentRow = currentRow.value;
  46249. if (oldCurrentRow && !data.includes(oldCurrentRow)) {
  46250. if (rowKey) {
  46251. const currentRowKey = getRowIdentity(oldCurrentRow, rowKey);
  46252. setCurrentRowByKey(currentRowKey);
  46253. } else {
  46254. currentRow.value = null;
  46255. }
  46256. if (isNull(currentRow.value)) {
  46257. instance.emit("current-change", null, oldCurrentRow);
  46258. }
  46259. } else if (_currentRowKey.value) {
  46260. setCurrentRowByKey(_currentRowKey.value);
  46261. restoreCurrentRowKey();
  46262. }
  46263. };
  46264. return {
  46265. setCurrentRowKey,
  46266. restoreCurrentRowKey,
  46267. setCurrentRowByKey,
  46268. updateCurrentRow,
  46269. updateCurrentRowData,
  46270. states: {
  46271. _currentRowKey,
  46272. currentRow
  46273. }
  46274. };
  46275. }
  46276. function useTree$2(watcherData) {
  46277. const expandRowKeys = vue.ref([]);
  46278. const treeData = vue.ref({});
  46279. const indent = vue.ref(16);
  46280. const lazy = vue.ref(false);
  46281. const lazyTreeNodeMap = vue.ref({});
  46282. const lazyColumnIdentifier = vue.ref("hasChildren");
  46283. const childrenColumnName = vue.ref("children");
  46284. const checkStrictly = vue.ref(false);
  46285. const instance = vue.getCurrentInstance();
  46286. const normalizedData = vue.computed(() => {
  46287. if (!watcherData.rowKey.value)
  46288. return {};
  46289. const data = watcherData.data.value || [];
  46290. return normalize(data);
  46291. });
  46292. const normalizedLazyNode = vue.computed(() => {
  46293. const rowKey = watcherData.rowKey.value;
  46294. const keys = Object.keys(lazyTreeNodeMap.value);
  46295. const res = {};
  46296. if (!keys.length)
  46297. return res;
  46298. keys.forEach((key) => {
  46299. if (lazyTreeNodeMap.value[key].length) {
  46300. const item = { children: [] };
  46301. lazyTreeNodeMap.value[key].forEach((row) => {
  46302. const currentRowKey = getRowIdentity(row, rowKey);
  46303. item.children.push(currentRowKey);
  46304. if (row[lazyColumnIdentifier.value] && !res[currentRowKey]) {
  46305. res[currentRowKey] = { children: [] };
  46306. }
  46307. });
  46308. res[key] = item;
  46309. }
  46310. });
  46311. return res;
  46312. });
  46313. const normalize = (data) => {
  46314. const rowKey = watcherData.rowKey.value;
  46315. const res = {};
  46316. walkTreeNode(data, (parent, children, level) => {
  46317. const parentId = getRowIdentity(parent, rowKey);
  46318. if (isArray$1(children)) {
  46319. res[parentId] = {
  46320. children: children.map((row) => getRowIdentity(row, rowKey)),
  46321. level
  46322. };
  46323. } else if (lazy.value) {
  46324. res[parentId] = {
  46325. children: [],
  46326. lazy: true,
  46327. level
  46328. };
  46329. }
  46330. }, childrenColumnName.value, lazyColumnIdentifier.value, lazy.value);
  46331. return res;
  46332. };
  46333. const updateTreeData = (ifChangeExpandRowKeys = false, ifExpandAll) => {
  46334. var _a, _b;
  46335. ifExpandAll || (ifExpandAll = (_a = instance.store) == null ? void 0 : _a.states.defaultExpandAll.value);
  46336. const nested = normalizedData.value;
  46337. const normalizedLazyNode_ = normalizedLazyNode.value;
  46338. const keys = Object.keys(nested);
  46339. const newTreeData = {};
  46340. if (keys.length) {
  46341. const oldTreeData = vue.unref(treeData);
  46342. const rootLazyRowKeys = [];
  46343. const getExpanded = (oldValue, key) => {
  46344. if (ifChangeExpandRowKeys) {
  46345. if (expandRowKeys.value) {
  46346. return ifExpandAll || expandRowKeys.value.includes(key);
  46347. } else {
  46348. return !!(ifExpandAll || (oldValue == null ? void 0 : oldValue.expanded));
  46349. }
  46350. } else {
  46351. const included = ifExpandAll || expandRowKeys.value && expandRowKeys.value.includes(key);
  46352. return !!((oldValue == null ? void 0 : oldValue.expanded) || included);
  46353. }
  46354. };
  46355. keys.forEach((key) => {
  46356. const oldValue = oldTreeData[key];
  46357. const newValue = { ...nested[key] };
  46358. newValue.expanded = getExpanded(oldValue, key);
  46359. if (newValue.lazy) {
  46360. const { loaded = false, loading = false } = oldValue || {};
  46361. newValue.loaded = !!loaded;
  46362. newValue.loading = !!loading;
  46363. rootLazyRowKeys.push(key);
  46364. }
  46365. newTreeData[key] = newValue;
  46366. });
  46367. const lazyKeys = Object.keys(normalizedLazyNode_);
  46368. if (lazy.value && lazyKeys.length && rootLazyRowKeys.length) {
  46369. lazyKeys.forEach((key) => {
  46370. var _a2;
  46371. const oldValue = oldTreeData[key];
  46372. const lazyNodeChildren = normalizedLazyNode_[key].children;
  46373. if (rootLazyRowKeys.includes(key)) {
  46374. if (((_a2 = newTreeData[key].children) == null ? void 0 : _a2.length) !== 0) {
  46375. throw new Error("[ElTable]children must be an empty array.");
  46376. }
  46377. newTreeData[key].children = lazyNodeChildren;
  46378. } else {
  46379. const { loaded = false, loading = false } = oldValue || {};
  46380. newTreeData[key] = {
  46381. lazy: true,
  46382. loaded: !!loaded,
  46383. loading: !!loading,
  46384. expanded: getExpanded(oldValue, key),
  46385. children: lazyNodeChildren,
  46386. level: void 0
  46387. };
  46388. }
  46389. });
  46390. }
  46391. }
  46392. treeData.value = newTreeData;
  46393. (_b = instance.store) == null ? void 0 : _b.updateTableScrollY();
  46394. };
  46395. vue.watch(() => expandRowKeys.value, () => {
  46396. updateTreeData(true);
  46397. });
  46398. vue.watch(() => normalizedData.value, () => {
  46399. updateTreeData();
  46400. });
  46401. vue.watch(() => normalizedLazyNode.value, () => {
  46402. updateTreeData();
  46403. });
  46404. const updateTreeExpandKeys = (value) => {
  46405. expandRowKeys.value = value;
  46406. updateTreeData();
  46407. };
  46408. const isUseLazy = (data) => {
  46409. return lazy.value && data && "loaded" in data && !data.loaded;
  46410. };
  46411. const toggleTreeExpansion = (row, expanded) => {
  46412. instance.store.assertRowKey();
  46413. const rowKey = watcherData.rowKey.value;
  46414. const id = getRowIdentity(row, rowKey);
  46415. const data = id && treeData.value[id];
  46416. if (id && data && "expanded" in data) {
  46417. const oldExpanded = data.expanded;
  46418. expanded = isUndefined(expanded) ? !data.expanded : expanded;
  46419. treeData.value[id].expanded = expanded;
  46420. if (oldExpanded !== expanded) {
  46421. instance.emit("expand-change", row, expanded);
  46422. }
  46423. isUseLazy(data) && loadData(row, id, data);
  46424. instance.store.updateTableScrollY();
  46425. }
  46426. };
  46427. const loadOrToggle = (row) => {
  46428. instance.store.assertRowKey();
  46429. const rowKey = watcherData.rowKey.value;
  46430. const id = getRowIdentity(row, rowKey);
  46431. const data = treeData.value[id];
  46432. if (isUseLazy(data)) {
  46433. loadData(row, id, data);
  46434. } else {
  46435. toggleTreeExpansion(row, void 0);
  46436. }
  46437. };
  46438. const loadData = (row, key, treeNode) => {
  46439. const { load } = instance.props;
  46440. if (load && !treeData.value[key].loaded) {
  46441. treeData.value[key].loading = true;
  46442. load(row, treeNode, (data) => {
  46443. if (!isArray$1(data)) {
  46444. throw new TypeError("[ElTable] data must be an array");
  46445. }
  46446. treeData.value[key].loading = false;
  46447. treeData.value[key].loaded = true;
  46448. treeData.value[key].expanded = true;
  46449. if (data.length) {
  46450. lazyTreeNodeMap.value[key] = data;
  46451. }
  46452. instance.emit("expand-change", row, true);
  46453. });
  46454. }
  46455. };
  46456. const updateKeyChildren = (key, data) => {
  46457. const { lazy: lazy2, rowKey } = instance.props;
  46458. if (!lazy2)
  46459. return;
  46460. if (!rowKey)
  46461. throw new Error("[Table] rowKey is required in updateKeyChild");
  46462. if (lazyTreeNodeMap.value[key]) {
  46463. lazyTreeNodeMap.value[key] = data;
  46464. }
  46465. };
  46466. return {
  46467. loadData,
  46468. loadOrToggle,
  46469. toggleTreeExpansion,
  46470. updateTreeExpandKeys,
  46471. updateTreeData,
  46472. updateKeyChildren,
  46473. normalize,
  46474. states: {
  46475. expandRowKeys,
  46476. treeData,
  46477. indent,
  46478. lazy,
  46479. lazyTreeNodeMap,
  46480. lazyColumnIdentifier,
  46481. childrenColumnName,
  46482. checkStrictly
  46483. }
  46484. };
  46485. }
  46486. const sortData = (data, states) => {
  46487. const sortingColumn = states.sortingColumn;
  46488. if (!sortingColumn || isString$1(sortingColumn.sortable)) {
  46489. return data;
  46490. }
  46491. return orderBy(data, states.sortProp, states.sortOrder, sortingColumn.sortMethod, sortingColumn.sortBy);
  46492. };
  46493. const doFlattenColumns = (columns) => {
  46494. const result = [];
  46495. columns.forEach((column) => {
  46496. if (column.children && column.children.length > 0) {
  46497. result.push.apply(result, doFlattenColumns(column.children));
  46498. } else {
  46499. result.push(column);
  46500. }
  46501. });
  46502. return result;
  46503. };
  46504. function useWatcher$1() {
  46505. var _a;
  46506. const instance = vue.getCurrentInstance();
  46507. const { size: tableSize } = vue.toRefs((_a = instance.proxy) == null ? void 0 : _a.$props);
  46508. const rowKey = vue.ref(null);
  46509. const data = vue.ref([]);
  46510. const _data = vue.ref([]);
  46511. const isComplex = vue.ref(false);
  46512. const _columns = vue.ref([]);
  46513. const originColumns = vue.ref([]);
  46514. const columns = vue.ref([]);
  46515. const fixedColumns = vue.ref([]);
  46516. const rightFixedColumns = vue.ref([]);
  46517. const leafColumns = vue.ref([]);
  46518. const fixedLeafColumns = vue.ref([]);
  46519. const rightFixedLeafColumns = vue.ref([]);
  46520. const updateOrderFns = [];
  46521. const leafColumnsLength = vue.ref(0);
  46522. const fixedLeafColumnsLength = vue.ref(0);
  46523. const rightFixedLeafColumnsLength = vue.ref(0);
  46524. const isAllSelected = vue.ref(false);
  46525. const selection = vue.ref([]);
  46526. const reserveSelection = vue.ref(false);
  46527. const selectOnIndeterminate = vue.ref(false);
  46528. const selectable = vue.ref(null);
  46529. const filters = vue.ref({});
  46530. const filteredData = vue.ref(null);
  46531. const sortingColumn = vue.ref(null);
  46532. const sortProp = vue.ref(null);
  46533. const sortOrder = vue.ref(null);
  46534. const hoverRow = vue.ref(null);
  46535. const selectedMap = vue.computed(() => {
  46536. return rowKey.value ? getKeysMap(selection.value, rowKey.value) : void 0;
  46537. });
  46538. vue.watch(data, () => {
  46539. var _a2;
  46540. if (instance.state) {
  46541. scheduleLayout(false);
  46542. const needUpdateFixed = instance.props.tableLayout === "auto";
  46543. if (needUpdateFixed) {
  46544. (_a2 = instance.refs.tableHeaderRef) == null ? void 0 : _a2.updateFixedColumnStyle();
  46545. }
  46546. }
  46547. }, {
  46548. deep: true
  46549. });
  46550. const assertRowKey = () => {
  46551. if (!rowKey.value)
  46552. throw new Error("[ElTable] prop row-key is required");
  46553. };
  46554. const updateChildFixed = (column) => {
  46555. var _a2;
  46556. (_a2 = column.children) == null ? void 0 : _a2.forEach((childColumn) => {
  46557. childColumn.fixed = column.fixed;
  46558. updateChildFixed(childColumn);
  46559. });
  46560. };
  46561. const updateColumns = () => {
  46562. _columns.value.forEach((column) => {
  46563. updateChildFixed(column);
  46564. });
  46565. fixedColumns.value = _columns.value.filter((column) => [true, "left"].includes(column.fixed));
  46566. const selectColumn = _columns.value.find((column) => column.type === "selection");
  46567. let selectColFixLeft;
  46568. if (selectColumn && selectColumn.fixed !== "right" && !fixedColumns.value.includes(selectColumn)) {
  46569. const selectColumnIndex = _columns.value.indexOf(selectColumn);
  46570. if (selectColumnIndex === 0 && fixedColumns.value.length) {
  46571. fixedColumns.value.unshift(selectColumn);
  46572. selectColFixLeft = true;
  46573. }
  46574. }
  46575. rightFixedColumns.value = _columns.value.filter((column) => column.fixed === "right");
  46576. const notFixedColumns = _columns.value.filter((column) => (selectColFixLeft ? column.type !== "selection" : true) && !column.fixed);
  46577. originColumns.value = Array.from(fixedColumns.value).concat(notFixedColumns).concat(rightFixedColumns.value);
  46578. const leafColumns2 = doFlattenColumns(notFixedColumns);
  46579. const fixedLeafColumns2 = doFlattenColumns(fixedColumns.value);
  46580. const rightFixedLeafColumns2 = doFlattenColumns(rightFixedColumns.value);
  46581. leafColumnsLength.value = leafColumns2.length;
  46582. fixedLeafColumnsLength.value = fixedLeafColumns2.length;
  46583. rightFixedLeafColumnsLength.value = rightFixedLeafColumns2.length;
  46584. columns.value = Array.from(fixedLeafColumns2).concat(leafColumns2).concat(rightFixedLeafColumns2);
  46585. isComplex.value = fixedColumns.value.length > 0 || rightFixedColumns.value.length > 0;
  46586. };
  46587. const scheduleLayout = (needUpdateColumns, immediate = false) => {
  46588. if (needUpdateColumns) {
  46589. updateColumns();
  46590. }
  46591. if (immediate) {
  46592. instance.state.doLayout();
  46593. } else {
  46594. instance.state.debouncedUpdateLayout();
  46595. }
  46596. };
  46597. const isSelected = (row) => {
  46598. if (selectedMap.value) {
  46599. return !!selectedMap.value[getRowIdentity(row, rowKey.value)];
  46600. } else {
  46601. return selection.value.includes(row);
  46602. }
  46603. };
  46604. const clearSelection = () => {
  46605. isAllSelected.value = false;
  46606. const oldSelection = selection.value;
  46607. selection.value = [];
  46608. if (oldSelection.length) {
  46609. instance.emit("selection-change", []);
  46610. }
  46611. };
  46612. const cleanSelection = () => {
  46613. var _a2, _b;
  46614. let deleted;
  46615. if (rowKey.value) {
  46616. deleted = [];
  46617. const childrenKey = (_b = (_a2 = instance == null ? void 0 : instance.store) == null ? void 0 : _a2.states) == null ? void 0 : _b.childrenColumnName.value;
  46618. const dataMap = getKeysMap(data.value, rowKey.value, true, childrenKey);
  46619. for (const key in selectedMap.value) {
  46620. if (hasOwn(selectedMap.value, key) && !dataMap[key]) {
  46621. deleted.push(selectedMap.value[key].row);
  46622. }
  46623. }
  46624. } else {
  46625. deleted = selection.value.filter((item) => !data.value.includes(item));
  46626. }
  46627. if (deleted.length) {
  46628. const newSelection = selection.value.filter((item) => !deleted.includes(item));
  46629. selection.value = newSelection;
  46630. instance.emit("selection-change", newSelection.slice());
  46631. }
  46632. };
  46633. const getSelectionRows = () => {
  46634. return (selection.value || []).slice();
  46635. };
  46636. const toggleRowSelection = (row, selected, emitChange = true, ignoreSelectable = false) => {
  46637. var _a2, _b, _c, _d;
  46638. const treeProps = {
  46639. children: (_b = (_a2 = instance == null ? void 0 : instance.store) == null ? void 0 : _a2.states) == null ? void 0 : _b.childrenColumnName.value,
  46640. checkStrictly: (_d = (_c = instance == null ? void 0 : instance.store) == null ? void 0 : _c.states) == null ? void 0 : _d.checkStrictly.value
  46641. };
  46642. const changed = toggleRowStatus(selection.value, row, selected, treeProps, ignoreSelectable ? void 0 : selectable.value, data.value.indexOf(row), rowKey.value);
  46643. if (changed) {
  46644. const newSelection = (selection.value || []).slice();
  46645. if (emitChange) {
  46646. instance.emit("select", newSelection, row);
  46647. }
  46648. instance.emit("selection-change", newSelection);
  46649. }
  46650. };
  46651. const _toggleAllSelection = () => {
  46652. var _a2, _b;
  46653. const value = selectOnIndeterminate.value ? !isAllSelected.value : !(isAllSelected.value || selection.value.length);
  46654. isAllSelected.value = value;
  46655. let selectionChanged = false;
  46656. let childrenCount = 0;
  46657. const rowKey2 = (_b = (_a2 = instance == null ? void 0 : instance.store) == null ? void 0 : _a2.states) == null ? void 0 : _b.rowKey.value;
  46658. const { childrenColumnName } = instance.store.states;
  46659. const treeProps = {
  46660. children: childrenColumnName.value,
  46661. checkStrictly: false
  46662. };
  46663. data.value.forEach((row, index) => {
  46664. const rowIndex = index + childrenCount;
  46665. if (toggleRowStatus(selection.value, row, value, treeProps, selectable.value, rowIndex, rowKey2)) {
  46666. selectionChanged = true;
  46667. }
  46668. childrenCount += getChildrenCount(getRowIdentity(row, rowKey2));
  46669. });
  46670. if (selectionChanged) {
  46671. instance.emit("selection-change", selection.value ? selection.value.slice() : []);
  46672. }
  46673. instance.emit("select-all", (selection.value || []).slice());
  46674. };
  46675. const updateAllSelected = () => {
  46676. var _a2;
  46677. if (((_a2 = data.value) == null ? void 0 : _a2.length) === 0) {
  46678. isAllSelected.value = false;
  46679. return;
  46680. }
  46681. const { childrenColumnName } = instance.store.states;
  46682. let rowIndex = 0;
  46683. let selectedCount = 0;
  46684. const checkSelectedStatus = (data2) => {
  46685. var _a3;
  46686. for (const row of data2) {
  46687. const isRowSelectable = selectable.value && selectable.value.call(null, row, rowIndex);
  46688. if (!isSelected(row)) {
  46689. if (!selectable.value || isRowSelectable) {
  46690. return false;
  46691. }
  46692. } else {
  46693. selectedCount++;
  46694. }
  46695. rowIndex++;
  46696. if (((_a3 = row[childrenColumnName.value]) == null ? void 0 : _a3.length) && !checkSelectedStatus(row[childrenColumnName.value])) {
  46697. return false;
  46698. }
  46699. }
  46700. return true;
  46701. };
  46702. const isAllSelected_ = checkSelectedStatus(data.value || []);
  46703. isAllSelected.value = selectedCount === 0 ? false : isAllSelected_;
  46704. };
  46705. const getChildrenCount = (rowKey2) => {
  46706. var _a2;
  46707. if (!instance || !instance.store)
  46708. return 0;
  46709. const { treeData } = instance.store.states;
  46710. let count = 0;
  46711. const children = (_a2 = treeData.value[rowKey2]) == null ? void 0 : _a2.children;
  46712. if (children) {
  46713. count += children.length;
  46714. children.forEach((childKey) => {
  46715. count += getChildrenCount(childKey);
  46716. });
  46717. }
  46718. return count;
  46719. };
  46720. const updateFilters = (column, values) => {
  46721. const filters_ = {};
  46722. castArray$1(column).forEach((col) => {
  46723. filters.value[col.id] = values;
  46724. filters_[col.columnKey || col.id] = values;
  46725. });
  46726. return filters_;
  46727. };
  46728. const updateSort = (column, prop, order) => {
  46729. if (sortingColumn.value && sortingColumn.value !== column) {
  46730. sortingColumn.value.order = null;
  46731. }
  46732. sortingColumn.value = column;
  46733. sortProp.value = prop;
  46734. sortOrder.value = order;
  46735. };
  46736. const execFilter = () => {
  46737. let sourceData = vue.unref(_data);
  46738. Object.keys(filters.value).forEach((columnId) => {
  46739. const values = filters.value[columnId];
  46740. if (!values || values.length === 0)
  46741. return;
  46742. const column = getColumnById({
  46743. columns: columns.value
  46744. }, columnId);
  46745. if (column && column.filterMethod) {
  46746. sourceData = sourceData.filter((row) => {
  46747. return values.some((value) => column.filterMethod.call(null, value, row, column));
  46748. });
  46749. }
  46750. });
  46751. filteredData.value = sourceData;
  46752. };
  46753. const execSort = () => {
  46754. var _a2;
  46755. data.value = sortData((_a2 = filteredData.value) != null ? _a2 : [], {
  46756. sortingColumn: sortingColumn.value,
  46757. sortProp: sortProp.value,
  46758. sortOrder: sortOrder.value
  46759. });
  46760. };
  46761. const execQuery = (ignore = void 0) => {
  46762. if (!(ignore == null ? void 0 : ignore.filter)) {
  46763. execFilter();
  46764. }
  46765. execSort();
  46766. };
  46767. const clearFilter = (columnKeys) => {
  46768. const { tableHeaderRef } = instance.refs;
  46769. if (!tableHeaderRef)
  46770. return;
  46771. const panels = Object.assign({}, tableHeaderRef.filterPanels);
  46772. const keys = Object.keys(panels);
  46773. if (!keys.length)
  46774. return;
  46775. if (isString$1(columnKeys)) {
  46776. columnKeys = [columnKeys];
  46777. }
  46778. if (isArray$1(columnKeys)) {
  46779. const columns_ = columnKeys.map((key) => getColumnByKey({
  46780. columns: columns.value
  46781. }, key));
  46782. keys.forEach((key) => {
  46783. const column = columns_.find((col) => col.id === key);
  46784. if (column) {
  46785. column.filteredValue = [];
  46786. }
  46787. });
  46788. instance.store.commit("filterChange", {
  46789. column: columns_,
  46790. values: [],
  46791. silent: true,
  46792. multi: true
  46793. });
  46794. } else {
  46795. keys.forEach((key) => {
  46796. const column = columns.value.find((col) => col.id === key);
  46797. if (column) {
  46798. column.filteredValue = [];
  46799. }
  46800. });
  46801. filters.value = {};
  46802. instance.store.commit("filterChange", {
  46803. column: {},
  46804. values: [],
  46805. silent: true
  46806. });
  46807. }
  46808. };
  46809. const clearSort = () => {
  46810. if (!sortingColumn.value)
  46811. return;
  46812. updateSort(null, null, null);
  46813. instance.store.commit("changeSortCondition", {
  46814. silent: true
  46815. });
  46816. };
  46817. const {
  46818. setExpandRowKeys,
  46819. toggleRowExpansion,
  46820. updateExpandRows,
  46821. states: expandStates,
  46822. isRowExpanded
  46823. } = useExpand({
  46824. data,
  46825. rowKey
  46826. });
  46827. const {
  46828. updateTreeExpandKeys,
  46829. toggleTreeExpansion,
  46830. updateTreeData,
  46831. updateKeyChildren,
  46832. loadOrToggle,
  46833. states: treeStates
  46834. } = useTree$2({
  46835. data,
  46836. rowKey
  46837. });
  46838. const {
  46839. updateCurrentRowData,
  46840. updateCurrentRow,
  46841. setCurrentRowKey,
  46842. states: currentData
  46843. } = useCurrent({
  46844. data,
  46845. rowKey
  46846. });
  46847. const setExpandRowKeysAdapter = (val) => {
  46848. setExpandRowKeys(val);
  46849. updateTreeExpandKeys(val);
  46850. };
  46851. const toggleRowExpansionAdapter = (row, expanded) => {
  46852. const hasExpandColumn = columns.value.some(({ type }) => type === "expand");
  46853. if (hasExpandColumn) {
  46854. toggleRowExpansion(row, expanded);
  46855. } else {
  46856. toggleTreeExpansion(row, expanded);
  46857. }
  46858. };
  46859. return {
  46860. assertRowKey,
  46861. updateColumns,
  46862. scheduleLayout,
  46863. isSelected,
  46864. clearSelection,
  46865. cleanSelection,
  46866. getSelectionRows,
  46867. toggleRowSelection,
  46868. _toggleAllSelection,
  46869. toggleAllSelection: null,
  46870. updateAllSelected,
  46871. updateFilters,
  46872. updateCurrentRow,
  46873. updateSort,
  46874. execFilter,
  46875. execSort,
  46876. execQuery,
  46877. clearFilter,
  46878. clearSort,
  46879. toggleRowExpansion,
  46880. setExpandRowKeysAdapter,
  46881. setCurrentRowKey,
  46882. toggleRowExpansionAdapter,
  46883. isRowExpanded,
  46884. updateExpandRows,
  46885. updateCurrentRowData,
  46886. loadOrToggle,
  46887. updateTreeData,
  46888. updateKeyChildren,
  46889. states: {
  46890. tableSize,
  46891. rowKey,
  46892. data,
  46893. _data,
  46894. isComplex,
  46895. _columns,
  46896. originColumns,
  46897. columns,
  46898. fixedColumns,
  46899. rightFixedColumns,
  46900. leafColumns,
  46901. fixedLeafColumns,
  46902. rightFixedLeafColumns,
  46903. updateOrderFns,
  46904. leafColumnsLength,
  46905. fixedLeafColumnsLength,
  46906. rightFixedLeafColumnsLength,
  46907. isAllSelected,
  46908. selection,
  46909. reserveSelection,
  46910. selectOnIndeterminate,
  46911. selectable,
  46912. filters,
  46913. filteredData,
  46914. sortingColumn,
  46915. sortProp,
  46916. sortOrder,
  46917. hoverRow,
  46918. ...expandStates,
  46919. ...treeStates,
  46920. ...currentData
  46921. }
  46922. };
  46923. }
  46924. function replaceColumn(array, column) {
  46925. return array.map((item) => {
  46926. var _a;
  46927. if (item.id === column.id) {
  46928. return column;
  46929. } else if ((_a = item.children) == null ? void 0 : _a.length) {
  46930. item.children = replaceColumn(item.children, column);
  46931. }
  46932. return item;
  46933. });
  46934. }
  46935. function sortColumn(array) {
  46936. array.forEach((item) => {
  46937. var _a, _b;
  46938. item.no = (_a = item.getColumnIndex) == null ? void 0 : _a.call(item);
  46939. if ((_b = item.children) == null ? void 0 : _b.length) {
  46940. sortColumn(item.children);
  46941. }
  46942. });
  46943. array.sort((cur, pre) => cur.no - pre.no);
  46944. }
  46945. function useStore() {
  46946. const instance = vue.getCurrentInstance();
  46947. const watcher = useWatcher$1();
  46948. const ns = useNamespace("table");
  46949. const mutations = {
  46950. setData(states, data) {
  46951. const dataInstanceChanged = vue.unref(states._data) !== data;
  46952. states.data.value = data;
  46953. states._data.value = data;
  46954. instance.store.execQuery();
  46955. instance.store.updateCurrentRowData();
  46956. instance.store.updateExpandRows();
  46957. instance.store.updateTreeData(instance.store.states.defaultExpandAll.value);
  46958. if (vue.unref(states.reserveSelection)) {
  46959. instance.store.assertRowKey();
  46960. } else {
  46961. if (dataInstanceChanged) {
  46962. instance.store.clearSelection();
  46963. } else {
  46964. instance.store.cleanSelection();
  46965. }
  46966. }
  46967. instance.store.updateAllSelected();
  46968. if (instance.$ready) {
  46969. instance.store.scheduleLayout();
  46970. }
  46971. },
  46972. insertColumn(states, column, parent, updateColumnOrder) {
  46973. var _a;
  46974. const array = vue.unref(states._columns);
  46975. let newColumns = [];
  46976. if (!parent) {
  46977. array.push(column);
  46978. newColumns = array;
  46979. } else {
  46980. if (parent && !parent.children) {
  46981. parent.children = [];
  46982. }
  46983. (_a = parent.children) == null ? void 0 : _a.push(column);
  46984. newColumns = replaceColumn(array, parent);
  46985. }
  46986. sortColumn(newColumns);
  46987. states._columns.value = newColumns;
  46988. states.updateOrderFns.push(updateColumnOrder);
  46989. if (column.type === "selection") {
  46990. states.selectable.value = column.selectable;
  46991. states.reserveSelection.value = column.reserveSelection;
  46992. }
  46993. if (instance.$ready) {
  46994. instance.store.updateColumns();
  46995. instance.store.scheduleLayout();
  46996. }
  46997. },
  46998. updateColumnOrder(states, column) {
  46999. var _a;
  47000. const newColumnIndex = (_a = column.getColumnIndex) == null ? void 0 : _a.call(column);
  47001. if (newColumnIndex === column.no)
  47002. return;
  47003. sortColumn(states._columns.value);
  47004. if (instance.$ready) {
  47005. instance.store.updateColumns();
  47006. }
  47007. },
  47008. removeColumn(states, column, parent, updateColumnOrder) {
  47009. var _a;
  47010. const array = vue.unref(states._columns) || [];
  47011. if (parent) {
  47012. (_a = parent.children) == null ? void 0 : _a.splice(parent.children.findIndex((item) => item.id === column.id), 1);
  47013. vue.nextTick(() => {
  47014. var _a2;
  47015. if (((_a2 = parent.children) == null ? void 0 : _a2.length) === 0) {
  47016. delete parent.children;
  47017. }
  47018. });
  47019. states._columns.value = replaceColumn(array, parent);
  47020. } else {
  47021. const index = array.indexOf(column);
  47022. if (index > -1) {
  47023. array.splice(index, 1);
  47024. states._columns.value = array;
  47025. }
  47026. }
  47027. const updateFnIndex = states.updateOrderFns.indexOf(updateColumnOrder);
  47028. updateFnIndex > -1 && states.updateOrderFns.splice(updateFnIndex, 1);
  47029. if (instance.$ready) {
  47030. instance.store.updateColumns();
  47031. instance.store.scheduleLayout();
  47032. }
  47033. },
  47034. sort(states, options) {
  47035. const { prop, order, init } = options;
  47036. if (prop) {
  47037. const column = vue.unref(states.columns).find((column2) => column2.property === prop);
  47038. if (column) {
  47039. column.order = order;
  47040. instance.store.updateSort(column, prop, order);
  47041. instance.store.commit("changeSortCondition", { init });
  47042. }
  47043. }
  47044. },
  47045. changeSortCondition(states, options) {
  47046. const { sortingColumn, sortProp, sortOrder } = states;
  47047. const columnValue = vue.unref(sortingColumn), propValue = vue.unref(sortProp), orderValue = vue.unref(sortOrder);
  47048. if (isNull(orderValue)) {
  47049. states.sortingColumn.value = null;
  47050. states.sortProp.value = null;
  47051. }
  47052. const ignore = { filter: true };
  47053. instance.store.execQuery(ignore);
  47054. if (!options || !(options.silent || options.init)) {
  47055. instance.emit("sort-change", {
  47056. column: columnValue,
  47057. prop: propValue,
  47058. order: orderValue
  47059. });
  47060. }
  47061. instance.store.updateTableScrollY();
  47062. },
  47063. filterChange(_states, options) {
  47064. const { column, values, silent } = options;
  47065. const newFilters = instance.store.updateFilters(column, values);
  47066. instance.store.execQuery();
  47067. if (!silent) {
  47068. instance.emit("filter-change", newFilters);
  47069. }
  47070. instance.store.updateTableScrollY();
  47071. },
  47072. toggleAllSelection() {
  47073. var _a, _b;
  47074. (_b = (_a = instance.store).toggleAllSelection) == null ? void 0 : _b.call(_a);
  47075. },
  47076. rowSelectedChanged(_states, row) {
  47077. instance.store.toggleRowSelection(row);
  47078. instance.store.updateAllSelected();
  47079. },
  47080. setHoverRow(states, row) {
  47081. states.hoverRow.value = row;
  47082. },
  47083. setCurrentRow(_states, row) {
  47084. instance.store.updateCurrentRow(row);
  47085. }
  47086. };
  47087. const commit = function(name, ...args) {
  47088. const mutations2 = instance.store.mutations;
  47089. if (mutations2[name]) {
  47090. mutations2[name].apply(instance, [
  47091. instance.store.states,
  47092. ...args
  47093. ]);
  47094. } else {
  47095. throw new Error(`Action not found: ${name}`);
  47096. }
  47097. };
  47098. const updateTableScrollY = function() {
  47099. vue.nextTick(() => instance.layout.updateScrollY.apply(instance.layout));
  47100. };
  47101. return {
  47102. ns,
  47103. ...watcher,
  47104. mutations,
  47105. commit,
  47106. updateTableScrollY
  47107. };
  47108. }
  47109. const InitialStateMap = {
  47110. rowKey: "rowKey",
  47111. defaultExpandAll: "defaultExpandAll",
  47112. selectOnIndeterminate: "selectOnIndeterminate",
  47113. indent: "indent",
  47114. lazy: "lazy",
  47115. data: "data",
  47116. ["treeProps.hasChildren"]: {
  47117. key: "lazyColumnIdentifier",
  47118. default: "hasChildren"
  47119. },
  47120. ["treeProps.children"]: {
  47121. key: "childrenColumnName",
  47122. default: "children"
  47123. },
  47124. ["treeProps.checkStrictly"]: {
  47125. key: "checkStrictly",
  47126. default: false
  47127. }
  47128. };
  47129. function createStore(table, props) {
  47130. if (!table) {
  47131. throw new Error("Table is required.");
  47132. }
  47133. const store = useStore();
  47134. store.toggleAllSelection = debounce(store._toggleAllSelection, 10);
  47135. Object.keys(InitialStateMap).forEach((key) => {
  47136. handleValue(getArrKeysValue(props, key), key, store);
  47137. });
  47138. proxyTableProps(store, props);
  47139. return store;
  47140. }
  47141. function proxyTableProps(store, props) {
  47142. Object.keys(InitialStateMap).forEach((key) => {
  47143. vue.watch(() => getArrKeysValue(props, key), (value) => {
  47144. handleValue(value, key, store);
  47145. });
  47146. });
  47147. }
  47148. function handleValue(value, propsKey, store) {
  47149. let newVal = value;
  47150. let storeKey = InitialStateMap[propsKey];
  47151. if (isObject$1(storeKey)) {
  47152. newVal = newVal || storeKey.default;
  47153. storeKey = storeKey.key;
  47154. }
  47155. store.states[storeKey].value = newVal;
  47156. }
  47157. function getArrKeysValue(props, key) {
  47158. if (key.includes(".")) {
  47159. const keyList = key.split(".");
  47160. let value = props;
  47161. keyList.forEach((k) => {
  47162. value = value[k];
  47163. });
  47164. return value;
  47165. } else {
  47166. return props[key];
  47167. }
  47168. }
  47169. class TableLayout {
  47170. constructor(options) {
  47171. this.observers = [];
  47172. this.table = null;
  47173. this.store = null;
  47174. this.columns = [];
  47175. this.fit = true;
  47176. this.showHeader = true;
  47177. this.height = vue.ref(null);
  47178. this.scrollX = vue.ref(false);
  47179. this.scrollY = vue.ref(false);
  47180. this.bodyWidth = vue.ref(null);
  47181. this.fixedWidth = vue.ref(null);
  47182. this.rightFixedWidth = vue.ref(null);
  47183. this.gutterWidth = 0;
  47184. for (const name in options) {
  47185. if (hasOwn(options, name)) {
  47186. if (vue.isRef(this[name])) {
  47187. this[name].value = options[name];
  47188. } else {
  47189. this[name] = options[name];
  47190. }
  47191. }
  47192. }
  47193. if (!this.table) {
  47194. throw new Error("Table is required for Table Layout");
  47195. }
  47196. if (!this.store) {
  47197. throw new Error("Store is required for Table Layout");
  47198. }
  47199. }
  47200. updateScrollY() {
  47201. const height = this.height.value;
  47202. if (isNull(height))
  47203. return false;
  47204. const scrollBarRef = this.table.refs.scrollBarRef;
  47205. if (this.table.vnode.el && (scrollBarRef == null ? void 0 : scrollBarRef.wrapRef)) {
  47206. let scrollY = true;
  47207. const prevScrollY = this.scrollY.value;
  47208. scrollY = scrollBarRef.wrapRef.scrollHeight > scrollBarRef.wrapRef.clientHeight;
  47209. this.scrollY.value = scrollY;
  47210. return prevScrollY !== scrollY;
  47211. }
  47212. return false;
  47213. }
  47214. setHeight(value, prop = "height") {
  47215. if (!isClient)
  47216. return;
  47217. const el = this.table.vnode.el;
  47218. value = parseHeight(value);
  47219. this.height.value = Number(value);
  47220. if (!el && (value || value === 0)) {
  47221. vue.nextTick(() => this.setHeight(value, prop));
  47222. return;
  47223. }
  47224. if (el && isNumber(value)) {
  47225. el.style[prop] = `${value}px`;
  47226. this.updateElsHeight();
  47227. } else if (el && isString$1(value)) {
  47228. el.style[prop] = value;
  47229. this.updateElsHeight();
  47230. }
  47231. }
  47232. setMaxHeight(value) {
  47233. this.setHeight(value, "max-height");
  47234. }
  47235. getFlattenColumns() {
  47236. const flattenColumns = [];
  47237. const columns = this.table.store.states.columns.value;
  47238. columns.forEach((column) => {
  47239. if (column.isColumnGroup) {
  47240. flattenColumns.push.apply(flattenColumns, column.columns);
  47241. } else {
  47242. flattenColumns.push(column);
  47243. }
  47244. });
  47245. return flattenColumns;
  47246. }
  47247. updateElsHeight() {
  47248. this.updateScrollY();
  47249. this.notifyObservers("scrollable");
  47250. }
  47251. headerDisplayNone(elm) {
  47252. if (!elm)
  47253. return true;
  47254. let headerChild = elm;
  47255. while (headerChild.tagName !== "DIV") {
  47256. if (getComputedStyle(headerChild).display === "none") {
  47257. return true;
  47258. }
  47259. headerChild = headerChild.parentElement;
  47260. }
  47261. return false;
  47262. }
  47263. updateColumnsWidth() {
  47264. var _a;
  47265. if (!isClient)
  47266. return;
  47267. const fit = this.fit;
  47268. const bodyWidth = (_a = this.table.vnode.el) == null ? void 0 : _a.clientWidth;
  47269. let bodyMinWidth = 0;
  47270. const flattenColumns = this.getFlattenColumns();
  47271. const flexColumns = flattenColumns.filter((column) => !isNumber(column.width));
  47272. flattenColumns.forEach((column) => {
  47273. if (isNumber(column.width) && column.realWidth)
  47274. column.realWidth = null;
  47275. });
  47276. if (flexColumns.length > 0 && fit) {
  47277. flattenColumns.forEach((column) => {
  47278. bodyMinWidth += Number(column.width || column.minWidth || 80);
  47279. });
  47280. if (bodyMinWidth <= bodyWidth) {
  47281. this.scrollX.value = false;
  47282. const totalFlexWidth = bodyWidth - bodyMinWidth;
  47283. if (flexColumns.length === 1) {
  47284. flexColumns[0].realWidth = Number(flexColumns[0].minWidth || 80) + totalFlexWidth;
  47285. } else {
  47286. const allColumnsWidth = flexColumns.reduce((prev, column) => prev + Number(column.minWidth || 80), 0);
  47287. const flexWidthPerPixel = totalFlexWidth / allColumnsWidth;
  47288. let noneFirstWidth = 0;
  47289. flexColumns.forEach((column, index) => {
  47290. if (index === 0)
  47291. return;
  47292. const flexWidth = Math.floor(Number(column.minWidth || 80) * flexWidthPerPixel);
  47293. noneFirstWidth += flexWidth;
  47294. column.realWidth = Number(column.minWidth || 80) + flexWidth;
  47295. });
  47296. flexColumns[0].realWidth = Number(flexColumns[0].minWidth || 80) + totalFlexWidth - noneFirstWidth;
  47297. }
  47298. } else {
  47299. this.scrollX.value = true;
  47300. flexColumns.forEach((column) => {
  47301. column.realWidth = Number(column.minWidth);
  47302. });
  47303. }
  47304. this.bodyWidth.value = Math.max(bodyMinWidth, bodyWidth);
  47305. this.table.state.resizeState.value.width = this.bodyWidth.value;
  47306. } else {
  47307. flattenColumns.forEach((column) => {
  47308. if (!column.width && !column.minWidth) {
  47309. column.realWidth = 80;
  47310. } else {
  47311. column.realWidth = Number(column.width || column.minWidth);
  47312. }
  47313. bodyMinWidth += column.realWidth;
  47314. });
  47315. this.scrollX.value = bodyMinWidth > bodyWidth;
  47316. this.bodyWidth.value = bodyMinWidth;
  47317. }
  47318. const fixedColumns = this.store.states.fixedColumns.value;
  47319. if (fixedColumns.length > 0) {
  47320. let fixedWidth = 0;
  47321. fixedColumns.forEach((column) => {
  47322. fixedWidth += Number(column.realWidth || column.width);
  47323. });
  47324. this.fixedWidth.value = fixedWidth;
  47325. }
  47326. const rightFixedColumns = this.store.states.rightFixedColumns.value;
  47327. if (rightFixedColumns.length > 0) {
  47328. let rightFixedWidth = 0;
  47329. rightFixedColumns.forEach((column) => {
  47330. rightFixedWidth += Number(column.realWidth || column.width);
  47331. });
  47332. this.rightFixedWidth.value = rightFixedWidth;
  47333. }
  47334. this.notifyObservers("columns");
  47335. }
  47336. addObserver(observer) {
  47337. this.observers.push(observer);
  47338. }
  47339. removeObserver(observer) {
  47340. const index = this.observers.indexOf(observer);
  47341. if (index !== -1) {
  47342. this.observers.splice(index, 1);
  47343. }
  47344. }
  47345. notifyObservers(event) {
  47346. const observers = this.observers;
  47347. observers.forEach((observer) => {
  47348. var _a, _b;
  47349. switch (event) {
  47350. case "columns":
  47351. (_a = observer.state) == null ? void 0 : _a.onColumnsChange(this);
  47352. break;
  47353. case "scrollable":
  47354. (_b = observer.state) == null ? void 0 : _b.onScrollableChange(this);
  47355. break;
  47356. default:
  47357. throw new Error(`Table Layout don't have event ${event}.`);
  47358. }
  47359. });
  47360. }
  47361. }
  47362. var TableLayout$1 = TableLayout;
  47363. const { CheckboxGroup: ElCheckboxGroup } = ElCheckbox;
  47364. const _sfc_main$z = vue.defineComponent({
  47365. name: "ElTableFilterPanel",
  47366. components: {
  47367. ElCheckbox,
  47368. ElCheckboxGroup,
  47369. ElScrollbar,
  47370. ElTooltip,
  47371. ElIcon,
  47372. ArrowDown: arrow_down_default,
  47373. ArrowUp: arrow_up_default
  47374. },
  47375. directives: { ClickOutside },
  47376. props: {
  47377. placement: {
  47378. type: String,
  47379. default: "bottom-start"
  47380. },
  47381. store: {
  47382. type: Object
  47383. },
  47384. column: {
  47385. type: Object
  47386. },
  47387. upDataColumn: {
  47388. type: Function
  47389. },
  47390. appendTo: useTooltipContentProps.appendTo
  47391. },
  47392. setup(props) {
  47393. const instance = vue.getCurrentInstance();
  47394. const { t } = useLocale();
  47395. const ns = useNamespace("table-filter");
  47396. const parent = instance == null ? void 0 : instance.parent;
  47397. if (props.column && !parent.filterPanels.value[props.column.id]) {
  47398. parent.filterPanels.value[props.column.id] = instance;
  47399. }
  47400. const tooltipVisible = vue.ref(false);
  47401. const tooltip = vue.ref(null);
  47402. const filters = vue.computed(() => {
  47403. return props.column && props.column.filters;
  47404. });
  47405. const filterClassName = vue.computed(() => {
  47406. if (props.column && props.column.filterClassName) {
  47407. return `${ns.b()} ${props.column.filterClassName}`;
  47408. }
  47409. return ns.b();
  47410. });
  47411. const filterValue = vue.computed({
  47412. get: () => {
  47413. var _a;
  47414. return (((_a = props.column) == null ? void 0 : _a.filteredValue) || [])[0];
  47415. },
  47416. set: (value) => {
  47417. if (filteredValue.value) {
  47418. if (!isPropAbsent(value)) {
  47419. filteredValue.value.splice(0, 1, value);
  47420. } else {
  47421. filteredValue.value.splice(0, 1);
  47422. }
  47423. }
  47424. }
  47425. });
  47426. const filteredValue = vue.computed({
  47427. get() {
  47428. if (props.column) {
  47429. return props.column.filteredValue || [];
  47430. }
  47431. return [];
  47432. },
  47433. set(value) {
  47434. var _a;
  47435. if (props.column) {
  47436. (_a = props.upDataColumn) == null ? void 0 : _a.call(props, "filteredValue", value);
  47437. }
  47438. }
  47439. });
  47440. const multiple = vue.computed(() => {
  47441. if (props.column) {
  47442. return props.column.filterMultiple;
  47443. }
  47444. return true;
  47445. });
  47446. const isActive = (filter) => {
  47447. return filter.value === filterValue.value;
  47448. };
  47449. const hidden = () => {
  47450. tooltipVisible.value = false;
  47451. };
  47452. const showFilterPanel = (e) => {
  47453. e.stopPropagation();
  47454. tooltipVisible.value = !tooltipVisible.value;
  47455. };
  47456. const hideFilterPanel = () => {
  47457. tooltipVisible.value = false;
  47458. };
  47459. const handleConfirm = () => {
  47460. confirmFilter(filteredValue.value);
  47461. hidden();
  47462. };
  47463. const handleReset = () => {
  47464. filteredValue.value = [];
  47465. confirmFilter(filteredValue.value);
  47466. hidden();
  47467. };
  47468. const handleSelect = (_filterValue) => {
  47469. filterValue.value = _filterValue;
  47470. if (!isPropAbsent(_filterValue)) {
  47471. confirmFilter(filteredValue.value);
  47472. } else {
  47473. confirmFilter([]);
  47474. }
  47475. hidden();
  47476. };
  47477. const confirmFilter = (filteredValue2) => {
  47478. var _a, _b;
  47479. (_a = props.store) == null ? void 0 : _a.commit("filterChange", {
  47480. column: props.column,
  47481. values: filteredValue2
  47482. });
  47483. (_b = props.store) == null ? void 0 : _b.updateAllSelected();
  47484. };
  47485. vue.watch(tooltipVisible, (value) => {
  47486. var _a;
  47487. if (props.column) {
  47488. (_a = props.upDataColumn) == null ? void 0 : _a.call(props, "filterOpened", value);
  47489. }
  47490. }, {
  47491. immediate: true
  47492. });
  47493. const popperPaneRef = vue.computed(() => {
  47494. var _a, _b;
  47495. return (_b = (_a = tooltip.value) == null ? void 0 : _a.popperRef) == null ? void 0 : _b.contentRef;
  47496. });
  47497. return {
  47498. tooltipVisible,
  47499. multiple,
  47500. filterClassName,
  47501. filteredValue,
  47502. filterValue,
  47503. filters,
  47504. handleConfirm,
  47505. handleReset,
  47506. handleSelect,
  47507. isPropAbsent,
  47508. isActive,
  47509. t,
  47510. ns,
  47511. showFilterPanel,
  47512. hideFilterPanel,
  47513. popperPaneRef,
  47514. tooltip
  47515. };
  47516. }
  47517. });
  47518. function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
  47519. const _component_el_checkbox = vue.resolveComponent("el-checkbox");
  47520. const _component_el_checkbox_group = vue.resolveComponent("el-checkbox-group");
  47521. const _component_el_scrollbar = vue.resolveComponent("el-scrollbar");
  47522. const _component_arrow_up = vue.resolveComponent("arrow-up");
  47523. const _component_arrow_down = vue.resolveComponent("arrow-down");
  47524. const _component_el_icon = vue.resolveComponent("el-icon");
  47525. const _component_el_tooltip = vue.resolveComponent("el-tooltip");
  47526. const _directive_click_outside = vue.resolveDirective("click-outside");
  47527. return vue.openBlock(), vue.createBlock(_component_el_tooltip, {
  47528. ref: "tooltip",
  47529. visible: _ctx.tooltipVisible,
  47530. offset: 0,
  47531. placement: _ctx.placement,
  47532. "show-arrow": false,
  47533. "stop-popper-mouse-event": false,
  47534. teleported: "",
  47535. effect: "light",
  47536. pure: "",
  47537. "popper-class": _ctx.filterClassName,
  47538. persistent: "",
  47539. "append-to": _ctx.appendTo
  47540. }, {
  47541. content: vue.withCtx(() => [
  47542. _ctx.multiple ? (vue.openBlock(), vue.createElementBlock("div", { key: 0 }, [
  47543. vue.createElementVNode("div", {
  47544. class: vue.normalizeClass(_ctx.ns.e("content"))
  47545. }, [
  47546. vue.createVNode(_component_el_scrollbar, {
  47547. "wrap-class": _ctx.ns.e("wrap")
  47548. }, {
  47549. default: vue.withCtx(() => [
  47550. vue.createVNode(_component_el_checkbox_group, {
  47551. modelValue: _ctx.filteredValue,
  47552. "onUpdate:modelValue": ($event) => _ctx.filteredValue = $event,
  47553. class: vue.normalizeClass(_ctx.ns.e("checkbox-group"))
  47554. }, {
  47555. default: vue.withCtx(() => [
  47556. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.filters, (filter) => {
  47557. return vue.openBlock(), vue.createBlock(_component_el_checkbox, {
  47558. key: filter.value,
  47559. value: filter.value
  47560. }, {
  47561. default: vue.withCtx(() => [
  47562. vue.createTextVNode(vue.toDisplayString(filter.text), 1)
  47563. ]),
  47564. _: 2
  47565. }, 1032, ["value"]);
  47566. }), 128))
  47567. ]),
  47568. _: 1
  47569. }, 8, ["modelValue", "onUpdate:modelValue", "class"])
  47570. ]),
  47571. _: 1
  47572. }, 8, ["wrap-class"])
  47573. ], 2),
  47574. vue.createElementVNode("div", {
  47575. class: vue.normalizeClass(_ctx.ns.e("bottom"))
  47576. }, [
  47577. vue.createElementVNode("button", {
  47578. class: vue.normalizeClass(_ctx.ns.is("disabled", _ctx.filteredValue.length === 0)),
  47579. disabled: _ctx.filteredValue.length === 0,
  47580. type: "button",
  47581. onClick: _ctx.handleConfirm
  47582. }, vue.toDisplayString(_ctx.t("el.table.confirmFilter")), 11, ["disabled", "onClick"]),
  47583. vue.createElementVNode("button", {
  47584. type: "button",
  47585. onClick: _ctx.handleReset
  47586. }, vue.toDisplayString(_ctx.t("el.table.resetFilter")), 9, ["onClick"])
  47587. ], 2)
  47588. ])) : (vue.openBlock(), vue.createElementBlock("ul", {
  47589. key: 1,
  47590. class: vue.normalizeClass(_ctx.ns.e("list"))
  47591. }, [
  47592. vue.createElementVNode("li", {
  47593. class: vue.normalizeClass([
  47594. _ctx.ns.e("list-item"),
  47595. _ctx.ns.is("active", _ctx.isPropAbsent(_ctx.filterValue))
  47596. ]),
  47597. onClick: ($event) => _ctx.handleSelect(null)
  47598. }, vue.toDisplayString(_ctx.t("el.table.clearFilter")), 11, ["onClick"]),
  47599. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.filters, (filter) => {
  47600. return vue.openBlock(), vue.createElementBlock("li", {
  47601. key: filter.value,
  47602. class: vue.normalizeClass([_ctx.ns.e("list-item"), _ctx.ns.is("active", _ctx.isActive(filter))]),
  47603. label: filter.value,
  47604. onClick: ($event) => _ctx.handleSelect(filter.value)
  47605. }, vue.toDisplayString(filter.text), 11, ["label", "onClick"]);
  47606. }), 128))
  47607. ], 2))
  47608. ]),
  47609. default: vue.withCtx(() => [
  47610. vue.withDirectives((vue.openBlock(), vue.createElementBlock("span", {
  47611. class: vue.normalizeClass([
  47612. `${_ctx.ns.namespace.value}-table__column-filter-trigger`,
  47613. `${_ctx.ns.namespace.value}-none-outline`
  47614. ]),
  47615. onClick: _ctx.showFilterPanel
  47616. }, [
  47617. vue.createVNode(_component_el_icon, null, {
  47618. default: vue.withCtx(() => [
  47619. vue.renderSlot(_ctx.$slots, "filter-icon", {}, () => {
  47620. var _a;
  47621. return [
  47622. ((_a = _ctx.column) == null ? void 0 : _a.filterOpened) ? (vue.openBlock(), vue.createBlock(_component_arrow_up, { key: 0 })) : (vue.openBlock(), vue.createBlock(_component_arrow_down, { key: 1 }))
  47623. ];
  47624. })
  47625. ]),
  47626. _: 3
  47627. })
  47628. ], 10, ["onClick"])), [
  47629. [_directive_click_outside, _ctx.hideFilterPanel, _ctx.popperPaneRef]
  47630. ])
  47631. ]),
  47632. _: 3
  47633. }, 8, ["visible", "placement", "popper-class", "append-to"]);
  47634. }
  47635. var FilterPanel = /* @__PURE__ */ _export_sfc(_sfc_main$z, [["render", _sfc_render$4], ["__file", "filter-panel.vue"]]);
  47636. function useLayoutObserver(root) {
  47637. const instance = vue.getCurrentInstance();
  47638. vue.onBeforeMount(() => {
  47639. tableLayout.value.addObserver(instance);
  47640. });
  47641. vue.onMounted(() => {
  47642. onColumnsChange(tableLayout.value);
  47643. onScrollableChange(tableLayout.value);
  47644. });
  47645. vue.onUpdated(() => {
  47646. onColumnsChange(tableLayout.value);
  47647. onScrollableChange(tableLayout.value);
  47648. });
  47649. vue.onUnmounted(() => {
  47650. tableLayout.value.removeObserver(instance);
  47651. });
  47652. const tableLayout = vue.computed(() => {
  47653. const layout = root.layout;
  47654. if (!layout) {
  47655. throw new Error("Can not find table layout.");
  47656. }
  47657. return layout;
  47658. });
  47659. const onColumnsChange = (layout) => {
  47660. var _a;
  47661. const cols = ((_a = root.vnode.el) == null ? void 0 : _a.querySelectorAll("colgroup > col")) || [];
  47662. if (!cols.length)
  47663. return;
  47664. const flattenColumns = layout.getFlattenColumns();
  47665. const columnsMap = {};
  47666. flattenColumns.forEach((column) => {
  47667. columnsMap[column.id] = column;
  47668. });
  47669. for (let i = 0, j = cols.length; i < j; i++) {
  47670. const col = cols[i];
  47671. const name = col.getAttribute("name");
  47672. const column = columnsMap[name];
  47673. if (column) {
  47674. col.setAttribute("width", column.realWidth || column.width);
  47675. }
  47676. }
  47677. };
  47678. const onScrollableChange = (layout) => {
  47679. var _a, _b;
  47680. const cols = ((_a = root.vnode.el) == null ? void 0 : _a.querySelectorAll("colgroup > col[name=gutter]")) || [];
  47681. for (let i = 0, j = cols.length; i < j; i++) {
  47682. const col = cols[i];
  47683. col.setAttribute("width", layout.scrollY.value ? layout.gutterWidth : "0");
  47684. }
  47685. const ths = ((_b = root.vnode.el) == null ? void 0 : _b.querySelectorAll("th.gutter")) || [];
  47686. for (let i = 0, j = ths.length; i < j; i++) {
  47687. const th = ths[i];
  47688. th.style.width = layout.scrollY.value ? `${layout.gutterWidth}px` : "0";
  47689. th.style.display = layout.scrollY.value ? "" : "none";
  47690. }
  47691. };
  47692. return {
  47693. tableLayout: tableLayout.value,
  47694. onColumnsChange,
  47695. onScrollableChange
  47696. };
  47697. }
  47698. const TABLE_INJECTION_KEY = Symbol("ElTable");
  47699. function useEvent(props, emit) {
  47700. const instance = vue.getCurrentInstance();
  47701. const parent = vue.inject(TABLE_INJECTION_KEY);
  47702. const handleFilterClick = (event) => {
  47703. event.stopPropagation();
  47704. return;
  47705. };
  47706. const handleHeaderClick = (event, column) => {
  47707. if (!column.filters && column.sortable) {
  47708. handleSortClick(event, column, false);
  47709. } else if (column.filterable && !column.sortable) {
  47710. handleFilterClick(event);
  47711. }
  47712. parent == null ? void 0 : parent.emit("header-click", column, event);
  47713. };
  47714. const handleHeaderContextMenu = (event, column) => {
  47715. parent == null ? void 0 : parent.emit("header-contextmenu", column, event);
  47716. };
  47717. const draggingColumn = vue.ref(null);
  47718. const dragging = vue.ref(false);
  47719. const dragState = vue.ref();
  47720. const handleMouseDown = (event, column) => {
  47721. var _a, _b;
  47722. if (!isClient)
  47723. return;
  47724. if (column.children && column.children.length > 0)
  47725. return;
  47726. if (draggingColumn.value && props.border) {
  47727. dragging.value = true;
  47728. const table = parent;
  47729. emit("set-drag-visible", true);
  47730. const tableEl = table == null ? void 0 : table.vnode.el;
  47731. const tableLeft = tableEl == null ? void 0 : tableEl.getBoundingClientRect().left;
  47732. const columnEl = (_b = (_a = instance == null ? void 0 : instance.vnode) == null ? void 0 : _a.el) == null ? void 0 : _b.querySelector(`th.${column.id}`);
  47733. const columnRect = columnEl.getBoundingClientRect();
  47734. const minLeft = columnRect.left - tableLeft + 30;
  47735. addClass(columnEl, "noclick");
  47736. dragState.value = {
  47737. startMouseLeft: event.clientX,
  47738. startLeft: columnRect.right - tableLeft,
  47739. startColumnLeft: columnRect.left - tableLeft,
  47740. tableLeft
  47741. };
  47742. const resizeProxy = table == null ? void 0 : table.refs.resizeProxy;
  47743. resizeProxy.style.left = `${dragState.value.startLeft}px`;
  47744. document.onselectstart = function() {
  47745. return false;
  47746. };
  47747. document.ondragstart = function() {
  47748. return false;
  47749. };
  47750. const handleMouseMove2 = (event2) => {
  47751. const deltaLeft = event2.clientX - dragState.value.startMouseLeft;
  47752. const proxyLeft = dragState.value.startLeft + deltaLeft;
  47753. resizeProxy.style.left = `${Math.max(minLeft, proxyLeft)}px`;
  47754. };
  47755. const handleMouseUp = () => {
  47756. if (dragging.value) {
  47757. const { startColumnLeft, startLeft } = dragState.value;
  47758. const finalLeft = Number.parseInt(resizeProxy.style.left, 10);
  47759. const columnWidth = finalLeft - startColumnLeft;
  47760. column.width = column.realWidth = columnWidth;
  47761. table == null ? void 0 : table.emit("header-dragend", column.width, startLeft - startColumnLeft, column, event);
  47762. requestAnimationFrame(() => {
  47763. props.store.scheduleLayout(false, true);
  47764. });
  47765. document.body.style.cursor = "";
  47766. dragging.value = false;
  47767. draggingColumn.value = null;
  47768. dragState.value = void 0;
  47769. emit("set-drag-visible", false);
  47770. }
  47771. document.removeEventListener("mousemove", handleMouseMove2);
  47772. document.removeEventListener("mouseup", handleMouseUp);
  47773. document.onselectstart = null;
  47774. document.ondragstart = null;
  47775. setTimeout(() => {
  47776. removeClass(columnEl, "noclick");
  47777. }, 0);
  47778. };
  47779. document.addEventListener("mousemove", handleMouseMove2);
  47780. document.addEventListener("mouseup", handleMouseUp);
  47781. }
  47782. };
  47783. const handleMouseMove = (event, column) => {
  47784. var _a;
  47785. if (column.children && column.children.length > 0)
  47786. return;
  47787. const el = event.target;
  47788. if (!isElement$2(el)) {
  47789. return;
  47790. }
  47791. const target = el == null ? void 0 : el.closest("th");
  47792. if (!column || !column.resizable || !target)
  47793. return;
  47794. if (!dragging.value && props.border) {
  47795. const rect = target.getBoundingClientRect();
  47796. const bodyStyle = document.body.style;
  47797. const isLastTh = ((_a = target.parentNode) == null ? void 0 : _a.lastElementChild) === target;
  47798. const allowDarg = props.allowDragLastColumn || !isLastTh;
  47799. if (rect.width > 12 && rect.right - event.clientX < 8 && allowDarg) {
  47800. bodyStyle.cursor = "col-resize";
  47801. if (hasClass(target, "is-sortable")) {
  47802. target.style.cursor = "col-resize";
  47803. }
  47804. draggingColumn.value = column;
  47805. } else if (!dragging.value) {
  47806. bodyStyle.cursor = "";
  47807. if (hasClass(target, "is-sortable")) {
  47808. target.style.cursor = "pointer";
  47809. }
  47810. draggingColumn.value = null;
  47811. }
  47812. }
  47813. };
  47814. const handleMouseOut = () => {
  47815. if (!isClient)
  47816. return;
  47817. document.body.style.cursor = "";
  47818. };
  47819. const toggleOrder = ({ order, sortOrders }) => {
  47820. if (order === "")
  47821. return sortOrders[0];
  47822. const index = sortOrders.indexOf(order || null);
  47823. return sortOrders[index > sortOrders.length - 2 ? 0 : index + 1];
  47824. };
  47825. const handleSortClick = (event, column, givenOrder) => {
  47826. var _a;
  47827. event.stopPropagation();
  47828. const order = column.order === givenOrder ? null : givenOrder || toggleOrder(column);
  47829. const target = (_a = event.target) == null ? void 0 : _a.closest("th");
  47830. if (target) {
  47831. if (hasClass(target, "noclick")) {
  47832. removeClass(target, "noclick");
  47833. return;
  47834. }
  47835. }
  47836. if (!column.sortable)
  47837. return;
  47838. const clickTarget = event.currentTarget;
  47839. if (["ascending", "descending"].some((str) => hasClass(clickTarget, str) && !column.sortOrders.includes(str))) {
  47840. return;
  47841. }
  47842. const states = props.store.states;
  47843. let sortProp = states.sortProp.value;
  47844. let sortOrder;
  47845. const sortingColumn = states.sortingColumn.value;
  47846. if (sortingColumn !== column || sortingColumn === column && isNull(sortingColumn.order)) {
  47847. if (sortingColumn) {
  47848. sortingColumn.order = null;
  47849. }
  47850. states.sortingColumn.value = column;
  47851. sortProp = column.property;
  47852. }
  47853. if (!order) {
  47854. sortOrder = column.order = null;
  47855. } else {
  47856. sortOrder = column.order = order;
  47857. }
  47858. states.sortProp.value = sortProp;
  47859. states.sortOrder.value = sortOrder;
  47860. parent == null ? void 0 : parent.store.commit("changeSortCondition");
  47861. };
  47862. return {
  47863. handleHeaderClick,
  47864. handleHeaderContextMenu,
  47865. handleMouseDown,
  47866. handleMouseMove,
  47867. handleMouseOut,
  47868. handleSortClick,
  47869. handleFilterClick
  47870. };
  47871. }
  47872. function useStyle$2(props) {
  47873. const parent = vue.inject(TABLE_INJECTION_KEY);
  47874. const ns = useNamespace("table");
  47875. const getHeaderRowStyle = (rowIndex) => {
  47876. const headerRowStyle = parent == null ? void 0 : parent.props.headerRowStyle;
  47877. if (isFunction$1(headerRowStyle)) {
  47878. return headerRowStyle.call(null, { rowIndex });
  47879. }
  47880. return headerRowStyle;
  47881. };
  47882. const getHeaderRowClass = (rowIndex) => {
  47883. const classes = [];
  47884. const headerRowClassName = parent == null ? void 0 : parent.props.headerRowClassName;
  47885. if (isString$1(headerRowClassName)) {
  47886. classes.push(headerRowClassName);
  47887. } else if (isFunction$1(headerRowClassName)) {
  47888. classes.push(headerRowClassName.call(null, { rowIndex }));
  47889. }
  47890. return classes.join(" ");
  47891. };
  47892. const getHeaderCellStyle = (rowIndex, columnIndex, row, column) => {
  47893. var _a;
  47894. let headerCellStyles = (_a = parent == null ? void 0 : parent.props.headerCellStyle) != null ? _a : {};
  47895. if (isFunction$1(headerCellStyles)) {
  47896. headerCellStyles = headerCellStyles.call(null, {
  47897. rowIndex,
  47898. columnIndex,
  47899. row,
  47900. column
  47901. });
  47902. }
  47903. const fixedStyle = getFixedColumnOffset(columnIndex, column.fixed, props.store, row);
  47904. ensurePosition(fixedStyle, "left");
  47905. ensurePosition(fixedStyle, "right");
  47906. return Object.assign({}, headerCellStyles, fixedStyle);
  47907. };
  47908. const getHeaderCellClass = (rowIndex, columnIndex, row, column) => {
  47909. const fixedClasses = getFixedColumnsClass(ns.b(), columnIndex, column.fixed, props.store, row);
  47910. const classes = [
  47911. column.id,
  47912. column.order,
  47913. column.headerAlign,
  47914. column.className,
  47915. column.labelClassName,
  47916. ...fixedClasses
  47917. ];
  47918. if (!column.children) {
  47919. classes.push("is-leaf");
  47920. }
  47921. if (column.sortable) {
  47922. classes.push("is-sortable");
  47923. }
  47924. const headerCellClassName = parent == null ? void 0 : parent.props.headerCellClassName;
  47925. if (isString$1(headerCellClassName)) {
  47926. classes.push(headerCellClassName);
  47927. } else if (isFunction$1(headerCellClassName)) {
  47928. classes.push(headerCellClassName.call(null, {
  47929. rowIndex,
  47930. columnIndex,
  47931. row,
  47932. column
  47933. }));
  47934. }
  47935. classes.push(ns.e("cell"));
  47936. return classes.filter((className) => Boolean(className)).join(" ");
  47937. };
  47938. return {
  47939. getHeaderRowStyle,
  47940. getHeaderRowClass,
  47941. getHeaderCellStyle,
  47942. getHeaderCellClass
  47943. };
  47944. }
  47945. const getAllColumns = (columns) => {
  47946. const result = [];
  47947. columns.forEach((column) => {
  47948. if (column.children) {
  47949. result.push(column);
  47950. result.push.apply(result, getAllColumns(column.children));
  47951. } else {
  47952. result.push(column);
  47953. }
  47954. });
  47955. return result;
  47956. };
  47957. const convertToRows = (originColumns) => {
  47958. let maxLevel = 1;
  47959. const traverse = (column, parent) => {
  47960. if (parent) {
  47961. column.level = parent.level + 1;
  47962. if (maxLevel < column.level) {
  47963. maxLevel = column.level;
  47964. }
  47965. }
  47966. if (column.children) {
  47967. let colSpan = 0;
  47968. column.children.forEach((subColumn) => {
  47969. traverse(subColumn, column);
  47970. colSpan += subColumn.colSpan;
  47971. });
  47972. column.colSpan = colSpan;
  47973. } else {
  47974. column.colSpan = 1;
  47975. }
  47976. };
  47977. originColumns.forEach((column) => {
  47978. column.level = 1;
  47979. traverse(column, void 0);
  47980. });
  47981. const rows = [];
  47982. for (let i = 0; i < maxLevel; i++) {
  47983. rows.push([]);
  47984. }
  47985. const allColumns = getAllColumns(originColumns);
  47986. allColumns.forEach((column) => {
  47987. if (!column.children) {
  47988. column.rowSpan = maxLevel - column.level + 1;
  47989. } else {
  47990. column.rowSpan = 1;
  47991. column.children.forEach((col) => col.isSubColumn = true);
  47992. }
  47993. rows[column.level - 1].push(column);
  47994. });
  47995. return rows;
  47996. };
  47997. function useUtils$1(props) {
  47998. const parent = vue.inject(TABLE_INJECTION_KEY);
  47999. const columnRows = vue.computed(() => {
  48000. return convertToRows(props.store.states.originColumns.value);
  48001. });
  48002. const isGroup = vue.computed(() => {
  48003. const result = columnRows.value.length > 1;
  48004. if (result && parent) {
  48005. parent.state.isGroup.value = true;
  48006. }
  48007. return result;
  48008. });
  48009. const toggleAllSelection = (event) => {
  48010. event.stopPropagation();
  48011. parent == null ? void 0 : parent.store.commit("toggleAllSelection");
  48012. };
  48013. return {
  48014. isGroup,
  48015. toggleAllSelection,
  48016. columnRows
  48017. };
  48018. }
  48019. var TableHeader = vue.defineComponent({
  48020. name: "ElTableHeader",
  48021. components: {
  48022. ElCheckbox
  48023. },
  48024. props: {
  48025. fixed: {
  48026. type: String,
  48027. default: ""
  48028. },
  48029. store: {
  48030. required: true,
  48031. type: Object
  48032. },
  48033. border: Boolean,
  48034. defaultSort: {
  48035. type: Object,
  48036. default: () => {
  48037. return {
  48038. prop: "",
  48039. order: ""
  48040. };
  48041. }
  48042. },
  48043. appendFilterPanelTo: {
  48044. type: String
  48045. },
  48046. allowDragLastColumn: {
  48047. type: Boolean
  48048. }
  48049. },
  48050. setup(props, { emit }) {
  48051. const instance = vue.getCurrentInstance();
  48052. const parent = vue.inject(TABLE_INJECTION_KEY);
  48053. const ns = useNamespace("table");
  48054. const filterPanels = vue.ref({});
  48055. const { onColumnsChange, onScrollableChange } = useLayoutObserver(parent);
  48056. const isTableLayoutAuto = (parent == null ? void 0 : parent.props.tableLayout) === "auto";
  48057. const saveIndexSelection = vue.reactive(/* @__PURE__ */ new Map());
  48058. const theadRef = vue.ref();
  48059. let delayId;
  48060. const updateFixedColumnStyle = () => {
  48061. delayId = setTimeout(() => {
  48062. if (saveIndexSelection.size > 0) {
  48063. saveIndexSelection.forEach((column, key) => {
  48064. const el = theadRef.value.querySelector(`.${key.replace(/\s/g, ".")}`);
  48065. if (el) {
  48066. const width = el.getBoundingClientRect().width;
  48067. column.width = width || column.width;
  48068. }
  48069. });
  48070. saveIndexSelection.clear();
  48071. }
  48072. });
  48073. };
  48074. vue.watch(saveIndexSelection, updateFixedColumnStyle);
  48075. vue.onBeforeUnmount(() => {
  48076. if (delayId) {
  48077. clearTimeout(delayId);
  48078. delayId = void 0;
  48079. }
  48080. });
  48081. vue.onMounted(async () => {
  48082. await vue.nextTick();
  48083. await vue.nextTick();
  48084. const { prop, order } = props.defaultSort;
  48085. parent == null ? void 0 : parent.store.commit("sort", { prop, order, init: true });
  48086. updateFixedColumnStyle();
  48087. });
  48088. const {
  48089. handleHeaderClick,
  48090. handleHeaderContextMenu,
  48091. handleMouseDown,
  48092. handleMouseMove,
  48093. handleMouseOut,
  48094. handleSortClick,
  48095. handleFilterClick
  48096. } = useEvent(props, emit);
  48097. const {
  48098. getHeaderRowStyle,
  48099. getHeaderRowClass,
  48100. getHeaderCellStyle,
  48101. getHeaderCellClass
  48102. } = useStyle$2(props);
  48103. const { isGroup, toggleAllSelection, columnRows } = useUtils$1(props);
  48104. instance.state = {
  48105. onColumnsChange,
  48106. onScrollableChange
  48107. };
  48108. instance.filterPanels = filterPanels;
  48109. return {
  48110. ns,
  48111. filterPanels,
  48112. onColumnsChange,
  48113. onScrollableChange,
  48114. columnRows,
  48115. getHeaderRowClass,
  48116. getHeaderRowStyle,
  48117. getHeaderCellClass,
  48118. getHeaderCellStyle,
  48119. handleHeaderClick,
  48120. handleHeaderContextMenu,
  48121. handleMouseDown,
  48122. handleMouseMove,
  48123. handleMouseOut,
  48124. handleSortClick,
  48125. handleFilterClick,
  48126. isGroup,
  48127. toggleAllSelection,
  48128. saveIndexSelection,
  48129. isTableLayoutAuto,
  48130. theadRef,
  48131. updateFixedColumnStyle
  48132. };
  48133. },
  48134. render() {
  48135. const {
  48136. ns,
  48137. isGroup,
  48138. columnRows,
  48139. getHeaderCellStyle,
  48140. getHeaderCellClass,
  48141. getHeaderRowClass,
  48142. getHeaderRowStyle,
  48143. handleHeaderClick,
  48144. handleHeaderContextMenu,
  48145. handleMouseDown,
  48146. handleMouseMove,
  48147. handleSortClick,
  48148. handleMouseOut,
  48149. store,
  48150. $parent,
  48151. saveIndexSelection,
  48152. isTableLayoutAuto
  48153. } = this;
  48154. let rowSpan = 1;
  48155. return vue.h("thead", {
  48156. ref: "theadRef",
  48157. class: ns.is("group", isGroup)
  48158. }, columnRows.map((subColumns, rowIndex) => vue.h("tr", {
  48159. class: getHeaderRowClass(rowIndex),
  48160. key: rowIndex,
  48161. style: getHeaderRowStyle(rowIndex)
  48162. }, subColumns.map((column, cellIndex) => {
  48163. if (column.rowSpan > rowSpan) {
  48164. rowSpan = column.rowSpan;
  48165. }
  48166. const _class = getHeaderCellClass(rowIndex, cellIndex, subColumns, column);
  48167. if (isTableLayoutAuto && column.fixed) {
  48168. saveIndexSelection.set(_class, column);
  48169. }
  48170. return vue.h("th", {
  48171. class: _class,
  48172. colspan: column.colSpan,
  48173. key: `${column.id}-thead`,
  48174. rowspan: column.rowSpan,
  48175. style: getHeaderCellStyle(rowIndex, cellIndex, subColumns, column),
  48176. onClick: ($event) => {
  48177. var _a;
  48178. if ((_a = $event.currentTarget) == null ? void 0 : _a.classList.contains("noclick")) {
  48179. return;
  48180. }
  48181. handleHeaderClick($event, column);
  48182. },
  48183. onContextmenu: ($event) => handleHeaderContextMenu($event, column),
  48184. onMousedown: ($event) => handleMouseDown($event, column),
  48185. onMousemove: ($event) => handleMouseMove($event, column),
  48186. onMouseout: handleMouseOut
  48187. }, [
  48188. vue.h("div", {
  48189. class: [
  48190. "cell",
  48191. column.filteredValue && column.filteredValue.length > 0 ? "highlight" : ""
  48192. ]
  48193. }, [
  48194. column.renderHeader ? column.renderHeader({
  48195. column,
  48196. $index: cellIndex,
  48197. store,
  48198. _self: $parent
  48199. }) : column.label,
  48200. column.sortable && vue.h("span", {
  48201. onClick: ($event) => handleSortClick($event, column),
  48202. class: "caret-wrapper"
  48203. }, [
  48204. vue.h("i", {
  48205. onClick: ($event) => handleSortClick($event, column, "ascending"),
  48206. class: "sort-caret ascending"
  48207. }),
  48208. vue.h("i", {
  48209. onClick: ($event) => handleSortClick($event, column, "descending"),
  48210. class: "sort-caret descending"
  48211. })
  48212. ]),
  48213. column.filterable && vue.h(FilterPanel, {
  48214. store,
  48215. placement: column.filterPlacement || "bottom-start",
  48216. appendTo: $parent == null ? void 0 : $parent.appendFilterPanelTo,
  48217. column,
  48218. upDataColumn: (key, value) => {
  48219. column[key] = value;
  48220. }
  48221. }, {
  48222. "filter-icon": () => column.renderFilterIcon ? column.renderFilterIcon({
  48223. filterOpened: column.filterOpened
  48224. }) : null
  48225. })
  48226. ])
  48227. ]);
  48228. }))));
  48229. }
  48230. });
  48231. function isGreaterThan(a, b, epsilon = 0.03) {
  48232. return a - b > epsilon;
  48233. }
  48234. function useEvents(props) {
  48235. const parent = vue.inject(TABLE_INJECTION_KEY);
  48236. const tooltipContent = vue.ref("");
  48237. const tooltipTrigger = vue.ref(vue.h("div"));
  48238. const handleEvent = (event, row, name) => {
  48239. var _a, _b, _c;
  48240. const table = parent;
  48241. const cell = getCell(event);
  48242. let column = null;
  48243. const namespace = (_a = table == null ? void 0 : table.vnode.el) == null ? void 0 : _a.dataset.prefix;
  48244. if (cell) {
  48245. column = getColumnByCell({
  48246. columns: (_c = (_b = props.store) == null ? void 0 : _b.states.columns.value) != null ? _c : []
  48247. }, cell, namespace);
  48248. if (column) {
  48249. table == null ? void 0 : table.emit(`cell-${name}`, row, column, cell, event);
  48250. }
  48251. }
  48252. table == null ? void 0 : table.emit(`row-${name}`, row, column, event);
  48253. };
  48254. const handleDoubleClick = (event, row) => {
  48255. handleEvent(event, row, "dblclick");
  48256. };
  48257. const handleClick = (event, row) => {
  48258. var _a;
  48259. (_a = props.store) == null ? void 0 : _a.commit("setCurrentRow", row);
  48260. handleEvent(event, row, "click");
  48261. };
  48262. const handleContextMenu = (event, row) => {
  48263. handleEvent(event, row, "contextmenu");
  48264. };
  48265. const handleMouseEnter = debounce((index) => {
  48266. var _a;
  48267. (_a = props.store) == null ? void 0 : _a.commit("setHoverRow", index);
  48268. }, 30);
  48269. const handleMouseLeave = debounce(() => {
  48270. var _a;
  48271. (_a = props.store) == null ? void 0 : _a.commit("setHoverRow", null);
  48272. }, 30);
  48273. const getPadding = (el) => {
  48274. const style = window.getComputedStyle(el, null);
  48275. const paddingLeft = Number.parseInt(style.paddingLeft, 10) || 0;
  48276. const paddingRight = Number.parseInt(style.paddingRight, 10) || 0;
  48277. const paddingTop = Number.parseInt(style.paddingTop, 10) || 0;
  48278. const paddingBottom = Number.parseInt(style.paddingBottom, 10) || 0;
  48279. return {
  48280. left: paddingLeft,
  48281. right: paddingRight,
  48282. top: paddingTop,
  48283. bottom: paddingBottom
  48284. };
  48285. };
  48286. const toggleRowClassByCell = (rowSpan, event, toggle) => {
  48287. var _a;
  48288. let node = (_a = event == null ? void 0 : event.target) == null ? void 0 : _a.parentNode;
  48289. while (rowSpan > 1) {
  48290. node = node == null ? void 0 : node.nextSibling;
  48291. if (!node || node.nodeName !== "TR")
  48292. break;
  48293. toggle(node, "hover-row hover-fixed-row");
  48294. rowSpan--;
  48295. }
  48296. };
  48297. const handleCellMouseEnter = (event, row, tooltipOptions) => {
  48298. var _a, _b, _c, _d, _e, _f, _g, _h;
  48299. if (!parent)
  48300. return;
  48301. const table = parent;
  48302. const cell = getCell(event);
  48303. const namespace = (_a = table == null ? void 0 : table.vnode.el) == null ? void 0 : _a.dataset.prefix;
  48304. let column = null;
  48305. if (cell) {
  48306. column = getColumnByCell({
  48307. columns: (_c = (_b = props.store) == null ? void 0 : _b.states.columns.value) != null ? _c : []
  48308. }, cell, namespace);
  48309. if (!column) {
  48310. return;
  48311. }
  48312. if (cell.rowSpan > 1) {
  48313. toggleRowClassByCell(cell.rowSpan, event, addClass);
  48314. }
  48315. const hoverState = table.hoverState = {
  48316. cell,
  48317. column,
  48318. row
  48319. };
  48320. table == null ? void 0 : table.emit("cell-mouse-enter", hoverState.row, hoverState.column, hoverState.cell, event);
  48321. }
  48322. if (!tooltipOptions) {
  48323. if (((_d = removePopper) == null ? void 0 : _d.trigger) === cell) {
  48324. (_e = removePopper) == null ? void 0 : _e();
  48325. }
  48326. return;
  48327. }
  48328. const cellChild = event.target.querySelector(".cell");
  48329. if (!(hasClass(cellChild, `${namespace}-tooltip`) && cellChild.childNodes.length)) {
  48330. return;
  48331. }
  48332. const range = document.createRange();
  48333. range.setStart(cellChild, 0);
  48334. range.setEnd(cellChild, cellChild.childNodes.length);
  48335. const { width: rangeWidth, height: rangeHeight } = range.getBoundingClientRect();
  48336. const { width: cellChildWidth, height: cellChildHeight } = cellChild.getBoundingClientRect();
  48337. const { top, left, right, bottom } = getPadding(cellChild);
  48338. const horizontalPadding = left + right;
  48339. const verticalPadding = top + bottom;
  48340. if (isGreaterThan(rangeWidth + horizontalPadding, cellChildWidth) || isGreaterThan(rangeHeight + verticalPadding, cellChildHeight) || isGreaterThan(cellChild.scrollWidth, cellChildWidth)) {
  48341. createTablePopper(tooltipOptions, (_f = (cell == null ? void 0 : cell.innerText) || (cell == null ? void 0 : cell.textContent)) != null ? _f : "", row, column, cell, table);
  48342. } else if (((_g = removePopper) == null ? void 0 : _g.trigger) === cell) {
  48343. (_h = removePopper) == null ? void 0 : _h();
  48344. }
  48345. };
  48346. const handleCellMouseLeave = (event) => {
  48347. const cell = getCell(event);
  48348. if (!cell)
  48349. return;
  48350. if (cell.rowSpan > 1) {
  48351. toggleRowClassByCell(cell.rowSpan, event, removeClass);
  48352. }
  48353. const oldHoverState = parent == null ? void 0 : parent.hoverState;
  48354. 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);
  48355. };
  48356. return {
  48357. handleDoubleClick,
  48358. handleClick,
  48359. handleContextMenu,
  48360. handleMouseEnter,
  48361. handleMouseLeave,
  48362. handleCellMouseEnter,
  48363. handleCellMouseLeave,
  48364. tooltipContent,
  48365. tooltipTrigger
  48366. };
  48367. }
  48368. function useStyles$1(props) {
  48369. const parent = vue.inject(TABLE_INJECTION_KEY);
  48370. const ns = useNamespace("table");
  48371. const getRowStyle = (row, rowIndex) => {
  48372. const rowStyle = parent == null ? void 0 : parent.props.rowStyle;
  48373. if (isFunction$1(rowStyle)) {
  48374. return rowStyle.call(null, {
  48375. row,
  48376. rowIndex
  48377. });
  48378. }
  48379. return rowStyle || null;
  48380. };
  48381. const getRowClass = (row, rowIndex, displayIndex) => {
  48382. var _a;
  48383. const classes = [ns.e("row")];
  48384. if ((parent == null ? void 0 : parent.props.highlightCurrentRow) && row === ((_a = props.store) == null ? void 0 : _a.states.currentRow.value)) {
  48385. classes.push("current-row");
  48386. }
  48387. if (props.stripe && displayIndex % 2 === 1) {
  48388. classes.push(ns.em("row", "striped"));
  48389. }
  48390. const rowClassName = parent == null ? void 0 : parent.props.rowClassName;
  48391. if (isString$1(rowClassName)) {
  48392. classes.push(rowClassName);
  48393. } else if (isFunction$1(rowClassName)) {
  48394. classes.push(rowClassName.call(null, {
  48395. row,
  48396. rowIndex
  48397. }));
  48398. }
  48399. return classes;
  48400. };
  48401. const getCellStyle = (rowIndex, columnIndex, row, column) => {
  48402. const cellStyle = parent == null ? void 0 : parent.props.cellStyle;
  48403. let cellStyles = cellStyle != null ? cellStyle : {};
  48404. if (isFunction$1(cellStyle)) {
  48405. cellStyles = cellStyle.call(null, {
  48406. rowIndex,
  48407. columnIndex,
  48408. row,
  48409. column
  48410. });
  48411. }
  48412. const fixedStyle = getFixedColumnOffset(columnIndex, props == null ? void 0 : props.fixed, props.store);
  48413. ensurePosition(fixedStyle, "left");
  48414. ensurePosition(fixedStyle, "right");
  48415. return Object.assign({}, cellStyles, fixedStyle);
  48416. };
  48417. const getCellClass = (rowIndex, columnIndex, row, column, offset) => {
  48418. const fixedClasses = getFixedColumnsClass(ns.b(), columnIndex, props == null ? void 0 : props.fixed, props.store, void 0, offset);
  48419. const classes = [column.id, column.align, column.className, ...fixedClasses];
  48420. const cellClassName = parent == null ? void 0 : parent.props.cellClassName;
  48421. if (isString$1(cellClassName)) {
  48422. classes.push(cellClassName);
  48423. } else if (isFunction$1(cellClassName)) {
  48424. classes.push(cellClassName.call(null, {
  48425. rowIndex,
  48426. columnIndex,
  48427. row,
  48428. column
  48429. }));
  48430. }
  48431. classes.push(ns.e("cell"));
  48432. return classes.filter((className) => Boolean(className)).join(" ");
  48433. };
  48434. const getSpan = (row, column, rowIndex, columnIndex) => {
  48435. let rowspan = 1;
  48436. let colspan = 1;
  48437. const fn = parent == null ? void 0 : parent.props.spanMethod;
  48438. if (isFunction$1(fn)) {
  48439. const result = fn({
  48440. row,
  48441. column,
  48442. rowIndex,
  48443. columnIndex
  48444. });
  48445. if (isArray$1(result)) {
  48446. rowspan = result[0];
  48447. colspan = result[1];
  48448. } else if (isObject$1(result)) {
  48449. rowspan = result.rowspan;
  48450. colspan = result.colspan;
  48451. }
  48452. }
  48453. return { rowspan, colspan };
  48454. };
  48455. const getColspanRealWidth = (columns, colspan, index) => {
  48456. if (colspan < 1) {
  48457. return columns[index].realWidth;
  48458. }
  48459. const widthArr = columns.map(({ realWidth, width }) => realWidth || width).slice(index, index + colspan);
  48460. return Number(widthArr.reduce((acc, width) => Number(acc) + Number(width), -1));
  48461. };
  48462. return {
  48463. getRowStyle,
  48464. getRowClass,
  48465. getCellStyle,
  48466. getCellClass,
  48467. getSpan,
  48468. getColspanRealWidth
  48469. };
  48470. }
  48471. const __default__$s = vue.defineComponent({
  48472. name: "TableTdWrapper"
  48473. });
  48474. const _sfc_main$y = /* @__PURE__ */ vue.defineComponent({
  48475. ...__default__$s,
  48476. props: {
  48477. colspan: {
  48478. type: Number,
  48479. default: 1
  48480. },
  48481. rowspan: {
  48482. type: Number,
  48483. default: 1
  48484. }
  48485. },
  48486. setup(__props) {
  48487. return (_ctx, _cache) => {
  48488. return vue.openBlock(), vue.createElementBlock("td", {
  48489. colspan: __props.colspan,
  48490. rowspan: __props.rowspan
  48491. }, [
  48492. vue.renderSlot(_ctx.$slots, "default")
  48493. ], 8, ["colspan", "rowspan"]);
  48494. };
  48495. }
  48496. });
  48497. var TdWrapper = /* @__PURE__ */ _export_sfc(_sfc_main$y, [["__file", "td-wrapper.vue"]]);
  48498. function useRender$1(props) {
  48499. const parent = vue.inject(TABLE_INJECTION_KEY);
  48500. const ns = useNamespace("table");
  48501. const {
  48502. handleDoubleClick,
  48503. handleClick,
  48504. handleContextMenu,
  48505. handleMouseEnter,
  48506. handleMouseLeave,
  48507. handleCellMouseEnter,
  48508. handleCellMouseLeave,
  48509. tooltipContent,
  48510. tooltipTrigger
  48511. } = useEvents(props);
  48512. const {
  48513. getRowStyle,
  48514. getRowClass,
  48515. getCellStyle,
  48516. getCellClass,
  48517. getSpan,
  48518. getColspanRealWidth
  48519. } = useStyles$1(props);
  48520. let displayIndex = -1;
  48521. const firstDefaultColumnIndex = vue.computed(() => {
  48522. var _a;
  48523. return (_a = props.store) == null ? void 0 : _a.states.columns.value.findIndex(({ type }) => type === "default");
  48524. });
  48525. const getKeyOfRow = (row, index) => {
  48526. var _a;
  48527. const rowKey = (_a = parent == null ? void 0 : parent.props) == null ? void 0 : _a.rowKey;
  48528. if (rowKey) {
  48529. return getRowIdentity(row, rowKey);
  48530. }
  48531. return index;
  48532. };
  48533. const rowRender = (row, $index, treeRowData, expanded = false) => {
  48534. const { tooltipEffect, tooltipOptions, store } = props;
  48535. const { indent, columns } = store.states;
  48536. const rowClasses = [];
  48537. let display = true;
  48538. if (treeRowData) {
  48539. rowClasses.push(ns.em("row", `level-${treeRowData.level}`));
  48540. display = !!treeRowData.display;
  48541. }
  48542. if ($index === 0) {
  48543. displayIndex = -1;
  48544. }
  48545. if (props.stripe && display) {
  48546. displayIndex++;
  48547. }
  48548. rowClasses.push(...getRowClass(row, $index, displayIndex));
  48549. const displayStyle = display ? null : { display: "none" };
  48550. return vue.h("tr", {
  48551. style: [displayStyle, getRowStyle(row, $index)],
  48552. class: rowClasses,
  48553. key: getKeyOfRow(row, $index),
  48554. onDblclick: ($event) => handleDoubleClick($event, row),
  48555. onClick: ($event) => handleClick($event, row),
  48556. onContextmenu: ($event) => handleContextMenu($event, row),
  48557. onMouseenter: () => handleMouseEnter($index),
  48558. onMouseleave: handleMouseLeave
  48559. }, columns.value.map((column, cellIndex) => {
  48560. const { rowspan, colspan } = getSpan(row, column, $index, cellIndex);
  48561. if (!rowspan || !colspan) {
  48562. return null;
  48563. }
  48564. const columnData = Object.assign({}, column);
  48565. columnData.realWidth = getColspanRealWidth(columns.value, colspan, cellIndex);
  48566. const data = {
  48567. store,
  48568. _self: props.context || parent,
  48569. column: columnData,
  48570. row,
  48571. $index,
  48572. cellIndex,
  48573. expanded
  48574. };
  48575. if (cellIndex === firstDefaultColumnIndex.value && treeRowData) {
  48576. data.treeNode = {
  48577. indent: treeRowData.level && treeRowData.level * indent.value,
  48578. level: treeRowData.level
  48579. };
  48580. if (isBoolean(treeRowData.expanded)) {
  48581. data.treeNode.expanded = treeRowData.expanded;
  48582. if ("loading" in treeRowData) {
  48583. data.treeNode.loading = treeRowData.loading;
  48584. }
  48585. if ("noLazyChildren" in treeRowData) {
  48586. data.treeNode.noLazyChildren = treeRowData.noLazyChildren;
  48587. }
  48588. }
  48589. }
  48590. const baseKey = `${getKeyOfRow(row, $index)},${cellIndex}`;
  48591. const patchKey = columnData.columnKey || columnData.rawColumnKey || "";
  48592. const mergedTooltipOptions = column.showOverflowTooltip && merge({
  48593. effect: tooltipEffect
  48594. }, tooltipOptions, column.showOverflowTooltip);
  48595. return vue.h(TdWrapper, {
  48596. style: getCellStyle($index, cellIndex, row, column),
  48597. class: getCellClass($index, cellIndex, row, column, colspan - 1),
  48598. key: `${patchKey}${baseKey}`,
  48599. rowspan,
  48600. colspan,
  48601. onMouseenter: ($event) => handleCellMouseEnter($event, row, mergedTooltipOptions),
  48602. onMouseleave: handleCellMouseLeave
  48603. }, {
  48604. default: () => cellChildren(cellIndex, column, data)
  48605. });
  48606. }));
  48607. };
  48608. const cellChildren = (_cellIndex, column, data) => {
  48609. return column.renderCell(data);
  48610. };
  48611. const wrappedRowRender = (row, $index) => {
  48612. const store = props.store;
  48613. const { isRowExpanded, assertRowKey } = store;
  48614. const { treeData, lazyTreeNodeMap, childrenColumnName, rowKey } = store.states;
  48615. const columns = store.states.columns.value;
  48616. const hasExpandColumn = columns.some(({ type }) => type === "expand");
  48617. if (hasExpandColumn) {
  48618. const expanded = isRowExpanded(row);
  48619. const tr = rowRender(row, $index, void 0, expanded);
  48620. const renderExpanded = parent == null ? void 0 : parent.renderExpanded;
  48621. if (!renderExpanded) {
  48622. console.error("[Element Error]renderExpanded is required.");
  48623. return tr;
  48624. }
  48625. const rows = [[tr]];
  48626. if (parent.props.preserveExpandedContent || expanded) {
  48627. rows[0].push(vue.h("tr", {
  48628. key: `expanded-row__${tr.key}`,
  48629. style: { display: expanded ? "" : "none" }
  48630. }, [
  48631. vue.h("td", {
  48632. colspan: columns.length,
  48633. class: `${ns.e("cell")} ${ns.e("expanded-cell")}`
  48634. }, [renderExpanded({ row, $index, store, expanded })])
  48635. ]));
  48636. }
  48637. return rows;
  48638. } else if (Object.keys(treeData.value).length) {
  48639. assertRowKey();
  48640. const key = getRowIdentity(row, rowKey.value);
  48641. let cur = treeData.value[key];
  48642. let treeRowData = null;
  48643. if (cur) {
  48644. treeRowData = {
  48645. expanded: cur.expanded,
  48646. level: cur.level,
  48647. display: true,
  48648. noLazyChildren: void 0,
  48649. loading: void 0
  48650. };
  48651. if (isBoolean(cur.lazy)) {
  48652. if (treeRowData && isBoolean(cur.loaded) && cur.loaded) {
  48653. treeRowData.noLazyChildren = !(cur.children && cur.children.length);
  48654. }
  48655. treeRowData.loading = cur.loading;
  48656. }
  48657. }
  48658. const tmp = [rowRender(row, $index, treeRowData != null ? treeRowData : void 0)];
  48659. if (cur) {
  48660. let i = 0;
  48661. const traverse = (children, parent2) => {
  48662. if (!(children && children.length && parent2))
  48663. return;
  48664. children.forEach((node) => {
  48665. const innerTreeRowData = {
  48666. display: parent2.display && parent2.expanded,
  48667. level: parent2.level + 1,
  48668. expanded: false,
  48669. noLazyChildren: false,
  48670. loading: false
  48671. };
  48672. const childKey = getRowIdentity(node, rowKey.value);
  48673. if (isPropAbsent(childKey)) {
  48674. throw new Error("For nested data item, row-key is required.");
  48675. }
  48676. cur = { ...treeData.value[childKey] };
  48677. if (cur) {
  48678. innerTreeRowData.expanded = cur.expanded;
  48679. cur.level = cur.level || innerTreeRowData.level;
  48680. cur.display = !!(cur.expanded && innerTreeRowData.display);
  48681. if (isBoolean(cur.lazy)) {
  48682. if (isBoolean(cur.loaded) && cur.loaded) {
  48683. innerTreeRowData.noLazyChildren = !(cur.children && cur.children.length);
  48684. }
  48685. innerTreeRowData.loading = cur.loading;
  48686. }
  48687. }
  48688. i++;
  48689. tmp.push(rowRender(node, $index + i, innerTreeRowData));
  48690. if (cur) {
  48691. const nodes2 = lazyTreeNodeMap.value[childKey] || node[childrenColumnName.value];
  48692. traverse(nodes2, cur);
  48693. }
  48694. });
  48695. };
  48696. cur.display = true;
  48697. const nodes = lazyTreeNodeMap.value[key] || row[childrenColumnName.value];
  48698. traverse(nodes, cur);
  48699. }
  48700. return tmp;
  48701. } else {
  48702. return rowRender(row, $index, void 0);
  48703. }
  48704. };
  48705. return {
  48706. wrappedRowRender,
  48707. tooltipContent,
  48708. tooltipTrigger
  48709. };
  48710. }
  48711. const defaultProps$3 = {
  48712. store: {
  48713. required: true,
  48714. type: Object
  48715. },
  48716. stripe: Boolean,
  48717. tooltipEffect: String,
  48718. tooltipOptions: {
  48719. type: Object
  48720. },
  48721. context: {
  48722. default: () => ({}),
  48723. type: Object
  48724. },
  48725. rowClassName: [String, Function],
  48726. rowStyle: [Object, Function],
  48727. fixed: {
  48728. type: String,
  48729. default: ""
  48730. },
  48731. highlight: Boolean
  48732. };
  48733. var defaultProps$4 = defaultProps$3;
  48734. var TableBody = vue.defineComponent({
  48735. name: "ElTableBody",
  48736. props: defaultProps$4,
  48737. setup(props) {
  48738. var _a;
  48739. const instance = vue.getCurrentInstance();
  48740. const parent = vue.inject(TABLE_INJECTION_KEY);
  48741. const ns = useNamespace("table");
  48742. const { wrappedRowRender, tooltipContent, tooltipTrigger } = useRender$1(props);
  48743. const { onColumnsChange, onScrollableChange } = useLayoutObserver(parent);
  48744. const hoveredCellList = [];
  48745. vue.watch((_a = props.store) == null ? void 0 : _a.states.hoverRow, (newVal, oldVal) => {
  48746. var _a2, _b;
  48747. const el = instance == null ? void 0 : instance.vnode.el;
  48748. const rows = Array.from((el == null ? void 0 : el.children) || []).filter((e) => e == null ? void 0 : e.classList.contains(`${ns.e("row")}`));
  48749. let rowNum = newVal;
  48750. const childNodes = (_a2 = rows[rowNum]) == null ? void 0 : _a2.childNodes;
  48751. if (childNodes == null ? void 0 : childNodes.length) {
  48752. let control = 0;
  48753. const indexes = Array.from(childNodes).reduce((acc, item, index) => {
  48754. var _a3, _b2;
  48755. if (((_a3 = childNodes[index]) == null ? void 0 : _a3.colSpan) > 1) {
  48756. control = (_b2 = childNodes[index]) == null ? void 0 : _b2.colSpan;
  48757. }
  48758. if (item.nodeName !== "TD" && control === 0) {
  48759. acc.push(index);
  48760. }
  48761. control > 0 && control--;
  48762. return acc;
  48763. }, []);
  48764. indexes.forEach((rowIndex) => {
  48765. var _a3;
  48766. rowNum = newVal;
  48767. while (rowNum > 0) {
  48768. const preChildNodes = (_a3 = rows[rowNum - 1]) == null ? void 0 : _a3.childNodes;
  48769. if (preChildNodes[rowIndex] && preChildNodes[rowIndex].nodeName === "TD" && preChildNodes[rowIndex].rowSpan > 1) {
  48770. addClass(preChildNodes[rowIndex], "hover-cell");
  48771. hoveredCellList.push(preChildNodes[rowIndex]);
  48772. break;
  48773. }
  48774. rowNum--;
  48775. }
  48776. });
  48777. } else {
  48778. hoveredCellList.forEach((item) => removeClass(item, "hover-cell"));
  48779. hoveredCellList.length = 0;
  48780. }
  48781. if (!((_b = props.store) == null ? void 0 : _b.states.isComplex.value) || !isClient)
  48782. return;
  48783. rAF(() => {
  48784. const oldRow = rows[oldVal];
  48785. const newRow = rows[newVal];
  48786. if (oldRow && !oldRow.classList.contains("hover-fixed-row")) {
  48787. removeClass(oldRow, "hover-row");
  48788. }
  48789. if (newRow) {
  48790. addClass(newRow, "hover-row");
  48791. }
  48792. });
  48793. });
  48794. vue.onUnmounted(() => {
  48795. var _a2;
  48796. (_a2 = removePopper) == null ? void 0 : _a2();
  48797. });
  48798. return {
  48799. ns,
  48800. onColumnsChange,
  48801. onScrollableChange,
  48802. wrappedRowRender,
  48803. tooltipContent,
  48804. tooltipTrigger
  48805. };
  48806. },
  48807. render() {
  48808. const { wrappedRowRender, store } = this;
  48809. const data = (store == null ? void 0 : store.states.data.value) || [];
  48810. return vue.h("tbody", { tabIndex: -1 }, [
  48811. data.reduce((acc, row) => {
  48812. return acc.concat(wrappedRowRender(row, acc.length));
  48813. }, [])
  48814. ]);
  48815. }
  48816. });
  48817. function useMapState() {
  48818. const table = vue.inject(TABLE_INJECTION_KEY);
  48819. const store = table == null ? void 0 : table.store;
  48820. const leftFixedLeafCount = vue.computed(() => {
  48821. var _a;
  48822. return (_a = store == null ? void 0 : store.states.fixedLeafColumnsLength.value) != null ? _a : 0;
  48823. });
  48824. const rightFixedLeafCount = vue.computed(() => {
  48825. var _a;
  48826. return (_a = store == null ? void 0 : store.states.rightFixedColumns.value.length) != null ? _a : 0;
  48827. });
  48828. const columnsCount = vue.computed(() => {
  48829. var _a;
  48830. return (_a = store == null ? void 0 : store.states.columns.value.length) != null ? _a : 0;
  48831. });
  48832. const leftFixedCount = vue.computed(() => {
  48833. var _a;
  48834. return (_a = store == null ? void 0 : store.states.fixedColumns.value.length) != null ? _a : 0;
  48835. });
  48836. const rightFixedCount = vue.computed(() => {
  48837. var _a;
  48838. return (_a = store == null ? void 0 : store.states.rightFixedColumns.value.length) != null ? _a : 0;
  48839. });
  48840. return {
  48841. leftFixedLeafCount,
  48842. rightFixedLeafCount,
  48843. columnsCount,
  48844. leftFixedCount,
  48845. rightFixedCount,
  48846. columns: vue.computed(() => {
  48847. var _a;
  48848. return (_a = store == null ? void 0 : store.states.columns.value) != null ? _a : [];
  48849. })
  48850. };
  48851. }
  48852. function useStyle$1(props) {
  48853. const { columns } = useMapState();
  48854. const ns = useNamespace("table");
  48855. const getCellClasses = (columns2, cellIndex) => {
  48856. const column = columns2[cellIndex];
  48857. const classes = [
  48858. ns.e("cell"),
  48859. column.id,
  48860. column.align,
  48861. column.labelClassName,
  48862. ...getFixedColumnsClass(ns.b(), cellIndex, column.fixed, props.store)
  48863. ];
  48864. if (column.className) {
  48865. classes.push(column.className);
  48866. }
  48867. if (!column.children) {
  48868. classes.push(ns.is("leaf"));
  48869. }
  48870. return classes;
  48871. };
  48872. const getCellStyles = (column, cellIndex) => {
  48873. const fixedStyle = getFixedColumnOffset(cellIndex, column.fixed, props.store);
  48874. ensurePosition(fixedStyle, "left");
  48875. ensurePosition(fixedStyle, "right");
  48876. return fixedStyle;
  48877. };
  48878. return {
  48879. getCellClasses,
  48880. getCellStyles,
  48881. columns
  48882. };
  48883. }
  48884. var TableFooter = vue.defineComponent({
  48885. name: "ElTableFooter",
  48886. props: {
  48887. fixed: {
  48888. type: String,
  48889. default: ""
  48890. },
  48891. store: {
  48892. required: true,
  48893. type: Object
  48894. },
  48895. summaryMethod: Function,
  48896. sumText: String,
  48897. border: Boolean,
  48898. defaultSort: {
  48899. type: Object,
  48900. default: () => {
  48901. return {
  48902. prop: "",
  48903. order: ""
  48904. };
  48905. }
  48906. }
  48907. },
  48908. setup(props) {
  48909. const parent = vue.inject(TABLE_INJECTION_KEY);
  48910. const ns = useNamespace("table");
  48911. const { getCellClasses, getCellStyles, columns } = useStyle$1(props);
  48912. const { onScrollableChange, onColumnsChange } = useLayoutObserver(parent);
  48913. return {
  48914. ns,
  48915. onScrollableChange,
  48916. onColumnsChange,
  48917. getCellClasses,
  48918. getCellStyles,
  48919. columns
  48920. };
  48921. },
  48922. render() {
  48923. const { columns, getCellStyles, getCellClasses, summaryMethod, sumText } = this;
  48924. const data = this.store.states.data.value;
  48925. let sums = [];
  48926. if (summaryMethod) {
  48927. sums = summaryMethod({
  48928. columns,
  48929. data
  48930. });
  48931. } else {
  48932. columns.forEach((column, index) => {
  48933. if (index === 0) {
  48934. sums[index] = sumText;
  48935. return;
  48936. }
  48937. const values = data.map((item) => Number(item[column.property]));
  48938. const precisions = [];
  48939. let notNumber = true;
  48940. values.forEach((value) => {
  48941. if (!Number.isNaN(+value)) {
  48942. notNumber = false;
  48943. const decimal = `${value}`.split(".")[1];
  48944. precisions.push(decimal ? decimal.length : 0);
  48945. }
  48946. });
  48947. const precision = Math.max.apply(null, precisions);
  48948. if (!notNumber) {
  48949. sums[index] = values.reduce((prev, curr) => {
  48950. const value = Number(curr);
  48951. if (!Number.isNaN(+value)) {
  48952. return Number.parseFloat((prev + curr).toFixed(Math.min(precision, 20)));
  48953. } else {
  48954. return prev;
  48955. }
  48956. }, 0);
  48957. } else {
  48958. sums[index] = "";
  48959. }
  48960. });
  48961. }
  48962. return vue.h(vue.h("tfoot", [
  48963. vue.h("tr", {}, [
  48964. ...columns.map((column, cellIndex) => vue.h("td", {
  48965. key: cellIndex,
  48966. colspan: column.colSpan,
  48967. rowspan: column.rowSpan,
  48968. class: getCellClasses(columns, cellIndex),
  48969. style: getCellStyles(column, cellIndex)
  48970. }, [
  48971. vue.h("div", {
  48972. class: ["cell", column.labelClassName]
  48973. }, [sums[cellIndex]])
  48974. ]))
  48975. ])
  48976. ]));
  48977. }
  48978. });
  48979. function useUtils(store) {
  48980. const setCurrentRow = (row) => {
  48981. store.commit("setCurrentRow", row);
  48982. };
  48983. const getSelectionRows = () => {
  48984. return store.getSelectionRows();
  48985. };
  48986. const toggleRowSelection = (row, selected, ignoreSelectable = true) => {
  48987. store.toggleRowSelection(row, selected, false, ignoreSelectable);
  48988. store.updateAllSelected();
  48989. };
  48990. const clearSelection = () => {
  48991. store.clearSelection();
  48992. };
  48993. const clearFilter = (columnKeys) => {
  48994. store.clearFilter(columnKeys);
  48995. };
  48996. const toggleAllSelection = () => {
  48997. store.commit("toggleAllSelection");
  48998. };
  48999. const toggleRowExpansion = (row, expanded) => {
  49000. store.toggleRowExpansionAdapter(row, expanded);
  49001. };
  49002. const clearSort = () => {
  49003. store.clearSort();
  49004. };
  49005. const sort = (prop, order) => {
  49006. store.commit("sort", { prop, order });
  49007. };
  49008. const updateKeyChildren = (key, data) => {
  49009. store.updateKeyChildren(key, data);
  49010. };
  49011. return {
  49012. setCurrentRow,
  49013. getSelectionRows,
  49014. toggleRowSelection,
  49015. clearSelection,
  49016. clearFilter,
  49017. toggleAllSelection,
  49018. toggleRowExpansion,
  49019. clearSort,
  49020. sort,
  49021. updateKeyChildren
  49022. };
  49023. }
  49024. function useStyle(props, layout, store, table) {
  49025. const isHidden = vue.ref(false);
  49026. const renderExpanded = vue.ref(null);
  49027. const resizeProxyVisible = vue.ref(false);
  49028. const setDragVisible = (visible) => {
  49029. resizeProxyVisible.value = visible;
  49030. };
  49031. const resizeState = vue.ref({
  49032. width: null,
  49033. height: null,
  49034. headerHeight: null
  49035. });
  49036. const isGroup = vue.ref(false);
  49037. const scrollbarViewStyle = {
  49038. display: "inline-block",
  49039. verticalAlign: "middle"
  49040. };
  49041. const tableWidth = vue.ref();
  49042. const tableScrollHeight = vue.ref(0);
  49043. const bodyScrollHeight = vue.ref(0);
  49044. const headerScrollHeight = vue.ref(0);
  49045. const footerScrollHeight = vue.ref(0);
  49046. const appendScrollHeight = vue.ref(0);
  49047. vue.watchEffect(() => {
  49048. var _a;
  49049. layout.setHeight((_a = props.height) != null ? _a : null);
  49050. });
  49051. vue.watchEffect(() => {
  49052. var _a;
  49053. layout.setMaxHeight((_a = props.maxHeight) != null ? _a : null);
  49054. });
  49055. vue.watch(() => [props.currentRowKey, store.states.rowKey], ([currentRowKey, rowKey]) => {
  49056. if (!vue.unref(rowKey) || !vue.unref(currentRowKey))
  49057. return;
  49058. store.setCurrentRowKey(`${currentRowKey}`);
  49059. }, {
  49060. immediate: true
  49061. });
  49062. vue.watch(() => props.data, (data) => {
  49063. table.store.commit("setData", data);
  49064. }, {
  49065. immediate: true,
  49066. deep: true
  49067. });
  49068. vue.watchEffect(() => {
  49069. if (props.expandRowKeys) {
  49070. store.setExpandRowKeysAdapter(props.expandRowKeys);
  49071. }
  49072. });
  49073. const handleMouseLeave = () => {
  49074. table.store.commit("setHoverRow", null);
  49075. if (table.hoverState)
  49076. table.hoverState = null;
  49077. };
  49078. const handleHeaderFooterMousewheel = (_event, data) => {
  49079. const { pixelX, pixelY } = data;
  49080. if (Math.abs(pixelX) >= Math.abs(pixelY)) {
  49081. table.refs.bodyWrapper.scrollLeft += data.pixelX / 5;
  49082. }
  49083. };
  49084. const shouldUpdateHeight = vue.computed(() => {
  49085. return props.height || props.maxHeight || store.states.fixedColumns.value.length > 0 || store.states.rightFixedColumns.value.length > 0;
  49086. });
  49087. const tableBodyStyles = vue.computed(() => {
  49088. return {
  49089. width: layout.bodyWidth.value ? `${layout.bodyWidth.value}px` : ""
  49090. };
  49091. });
  49092. const doLayout = () => {
  49093. if (shouldUpdateHeight.value) {
  49094. layout.updateElsHeight();
  49095. }
  49096. layout.updateColumnsWidth();
  49097. if (typeof window === "undefined")
  49098. return;
  49099. requestAnimationFrame(syncPosition);
  49100. };
  49101. vue.onMounted(async () => {
  49102. await vue.nextTick();
  49103. store.updateColumns();
  49104. bindEvents();
  49105. requestAnimationFrame(doLayout);
  49106. const el = table.vnode.el;
  49107. const tableHeader = table.refs.headerWrapper;
  49108. if (props.flexible && el && el.parentElement) {
  49109. el.parentElement.style.minWidth = "0";
  49110. }
  49111. resizeState.value = {
  49112. width: tableWidth.value = el.offsetWidth,
  49113. height: el.offsetHeight,
  49114. headerHeight: props.showHeader && tableHeader ? tableHeader.offsetHeight : null
  49115. };
  49116. store.states.columns.value.forEach((column) => {
  49117. if (column.filteredValue && column.filteredValue.length) {
  49118. table.store.commit("filterChange", {
  49119. column,
  49120. values: column.filteredValue,
  49121. silent: true
  49122. });
  49123. }
  49124. });
  49125. table.$ready = true;
  49126. });
  49127. const setScrollClassByEl = (el, className) => {
  49128. if (!el)
  49129. return;
  49130. const classList = Array.from(el.classList).filter((item) => !item.startsWith("is-scrolling-"));
  49131. classList.push(layout.scrollX.value ? className : "is-scrolling-none");
  49132. el.className = classList.join(" ");
  49133. };
  49134. const setScrollClass = (className) => {
  49135. const { tableWrapper } = table.refs;
  49136. setScrollClassByEl(tableWrapper, className);
  49137. };
  49138. const hasScrollClass = (className) => {
  49139. const { tableWrapper } = table.refs;
  49140. return !!(tableWrapper && tableWrapper.classList.contains(className));
  49141. };
  49142. const syncPosition = function() {
  49143. if (!table.refs.scrollBarRef)
  49144. return;
  49145. if (!layout.scrollX.value) {
  49146. const scrollingNoneClass = "is-scrolling-none";
  49147. if (!hasScrollClass(scrollingNoneClass)) {
  49148. setScrollClass(scrollingNoneClass);
  49149. }
  49150. return;
  49151. }
  49152. const scrollContainer = table.refs.scrollBarRef.wrapRef;
  49153. if (!scrollContainer)
  49154. return;
  49155. const { scrollLeft, offsetWidth, scrollWidth } = scrollContainer;
  49156. const { headerWrapper, footerWrapper } = table.refs;
  49157. if (headerWrapper)
  49158. headerWrapper.scrollLeft = scrollLeft;
  49159. if (footerWrapper)
  49160. footerWrapper.scrollLeft = scrollLeft;
  49161. const maxScrollLeftPosition = scrollWidth - offsetWidth - 1;
  49162. if (scrollLeft >= maxScrollLeftPosition) {
  49163. setScrollClass("is-scrolling-right");
  49164. } else if (scrollLeft === 0) {
  49165. setScrollClass("is-scrolling-left");
  49166. } else {
  49167. setScrollClass("is-scrolling-middle");
  49168. }
  49169. };
  49170. const bindEvents = () => {
  49171. if (!table.refs.scrollBarRef)
  49172. return;
  49173. if (table.refs.scrollBarRef.wrapRef) {
  49174. useEventListener(table.refs.scrollBarRef.wrapRef, "scroll", syncPosition, {
  49175. passive: true
  49176. });
  49177. }
  49178. if (props.fit) {
  49179. useResizeObserver(table.vnode.el, resizeListener);
  49180. } else {
  49181. useEventListener(window, "resize", resizeListener);
  49182. }
  49183. useResizeObserver(table.refs.bodyWrapper, () => {
  49184. var _a, _b;
  49185. resizeListener();
  49186. (_b = (_a = table.refs) == null ? void 0 : _a.scrollBarRef) == null ? void 0 : _b.update();
  49187. });
  49188. };
  49189. const resizeListener = () => {
  49190. var _a, _b, _c, _d;
  49191. const el = table.vnode.el;
  49192. if (!table.$ready || !el)
  49193. return;
  49194. let shouldUpdateLayout = false;
  49195. const {
  49196. width: oldWidth,
  49197. height: oldHeight,
  49198. headerHeight: oldHeaderHeight
  49199. } = resizeState.value;
  49200. const width = tableWidth.value = el.offsetWidth;
  49201. if (oldWidth !== width) {
  49202. shouldUpdateLayout = true;
  49203. }
  49204. const height = el.offsetHeight;
  49205. if ((props.height || shouldUpdateHeight.value) && oldHeight !== height) {
  49206. shouldUpdateLayout = true;
  49207. }
  49208. const tableHeader = props.tableLayout === "fixed" ? table.refs.headerWrapper : (_a = table.refs.tableHeaderRef) == null ? void 0 : _a.$el;
  49209. if (props.showHeader && (tableHeader == null ? void 0 : tableHeader.offsetHeight) !== oldHeaderHeight) {
  49210. shouldUpdateLayout = true;
  49211. }
  49212. tableScrollHeight.value = ((_b = table.refs.tableWrapper) == null ? void 0 : _b.scrollHeight) || 0;
  49213. headerScrollHeight.value = (tableHeader == null ? void 0 : tableHeader.scrollHeight) || 0;
  49214. footerScrollHeight.value = ((_c = table.refs.footerWrapper) == null ? void 0 : _c.offsetHeight) || 0;
  49215. appendScrollHeight.value = ((_d = table.refs.appendWrapper) == null ? void 0 : _d.offsetHeight) || 0;
  49216. bodyScrollHeight.value = tableScrollHeight.value - headerScrollHeight.value - footerScrollHeight.value - appendScrollHeight.value;
  49217. if (shouldUpdateLayout) {
  49218. resizeState.value = {
  49219. width,
  49220. height,
  49221. headerHeight: props.showHeader && (tableHeader == null ? void 0 : tableHeader.offsetHeight) || 0
  49222. };
  49223. doLayout();
  49224. }
  49225. };
  49226. const tableSize = useFormSize();
  49227. const bodyWidth = vue.computed(() => {
  49228. const { bodyWidth: bodyWidth_, scrollY, gutterWidth } = layout;
  49229. return bodyWidth_.value ? `${bodyWidth_.value - (scrollY.value ? gutterWidth : 0)}px` : "";
  49230. });
  49231. const tableLayout = vue.computed(() => {
  49232. if (props.maxHeight)
  49233. return "fixed";
  49234. return props.tableLayout;
  49235. });
  49236. const emptyBlockStyle = vue.computed(() => {
  49237. if (props.data && props.data.length)
  49238. return;
  49239. let height = "100%";
  49240. if (props.height && bodyScrollHeight.value) {
  49241. height = `${bodyScrollHeight.value}px`;
  49242. }
  49243. const width = tableWidth.value;
  49244. return {
  49245. width: width ? `${width}px` : "",
  49246. height
  49247. };
  49248. });
  49249. const scrollbarStyle = vue.computed(() => {
  49250. if (props.height) {
  49251. return {
  49252. height: "100%"
  49253. };
  49254. }
  49255. if (props.maxHeight) {
  49256. if (!Number.isNaN(Number(props.maxHeight))) {
  49257. return {
  49258. maxHeight: `${+props.maxHeight - headerScrollHeight.value - footerScrollHeight.value}px`
  49259. };
  49260. } else {
  49261. return {
  49262. maxHeight: `calc(${props.maxHeight} - ${headerScrollHeight.value + footerScrollHeight.value}px)`
  49263. };
  49264. }
  49265. }
  49266. return {};
  49267. });
  49268. return {
  49269. isHidden,
  49270. renderExpanded,
  49271. setDragVisible,
  49272. isGroup,
  49273. handleMouseLeave,
  49274. handleHeaderFooterMousewheel,
  49275. tableSize,
  49276. emptyBlockStyle,
  49277. resizeProxyVisible,
  49278. bodyWidth,
  49279. resizeState,
  49280. doLayout,
  49281. tableBodyStyles,
  49282. tableLayout,
  49283. scrollbarViewStyle,
  49284. scrollbarStyle
  49285. };
  49286. }
  49287. function useKeyRender(table) {
  49288. const observer = vue.ref();
  49289. const initWatchDom = () => {
  49290. const el = table.vnode.el;
  49291. const columnsWrapper = el.querySelector(".hidden-columns");
  49292. const config = { childList: true, subtree: true };
  49293. const updateOrderFns = table.store.states.updateOrderFns;
  49294. observer.value = new MutationObserver(() => {
  49295. updateOrderFns.forEach((fn) => fn());
  49296. });
  49297. observer.value.observe(columnsWrapper, config);
  49298. };
  49299. vue.onMounted(() => {
  49300. initWatchDom();
  49301. });
  49302. vue.onUnmounted(() => {
  49303. var _a;
  49304. (_a = observer.value) == null ? void 0 : _a.disconnect();
  49305. });
  49306. }
  49307. var defaultProps$2 = {
  49308. data: {
  49309. type: Array,
  49310. default: () => []
  49311. },
  49312. size: useSizeProp,
  49313. width: [String, Number],
  49314. height: [String, Number],
  49315. maxHeight: [String, Number],
  49316. fit: {
  49317. type: Boolean,
  49318. default: true
  49319. },
  49320. stripe: Boolean,
  49321. border: Boolean,
  49322. rowKey: [String, Function],
  49323. showHeader: {
  49324. type: Boolean,
  49325. default: true
  49326. },
  49327. showSummary: Boolean,
  49328. sumText: String,
  49329. summaryMethod: Function,
  49330. rowClassName: [String, Function],
  49331. rowStyle: [Object, Function],
  49332. cellClassName: [String, Function],
  49333. cellStyle: [Object, Function],
  49334. headerRowClassName: [String, Function],
  49335. headerRowStyle: [Object, Function],
  49336. headerCellClassName: [String, Function],
  49337. headerCellStyle: [Object, Function],
  49338. highlightCurrentRow: Boolean,
  49339. currentRowKey: [String, Number],
  49340. emptyText: String,
  49341. expandRowKeys: Array,
  49342. defaultExpandAll: Boolean,
  49343. defaultSort: Object,
  49344. tooltipEffect: String,
  49345. tooltipOptions: Object,
  49346. spanMethod: Function,
  49347. selectOnIndeterminate: {
  49348. type: Boolean,
  49349. default: true
  49350. },
  49351. indent: {
  49352. type: Number,
  49353. default: 16
  49354. },
  49355. treeProps: {
  49356. type: Object,
  49357. default: () => {
  49358. return {
  49359. hasChildren: "hasChildren",
  49360. children: "children",
  49361. checkStrictly: false
  49362. };
  49363. }
  49364. },
  49365. lazy: Boolean,
  49366. load: Function,
  49367. style: {
  49368. type: Object,
  49369. default: () => ({})
  49370. },
  49371. className: {
  49372. type: String,
  49373. default: ""
  49374. },
  49375. tableLayout: {
  49376. type: String,
  49377. default: "fixed"
  49378. },
  49379. scrollbarAlwaysOn: Boolean,
  49380. flexible: Boolean,
  49381. showOverflowTooltip: [Boolean, Object],
  49382. tooltipFormatter: Function,
  49383. appendFilterPanelTo: String,
  49384. scrollbarTabindex: {
  49385. type: [Number, String],
  49386. default: void 0
  49387. },
  49388. allowDragLastColumn: {
  49389. type: Boolean,
  49390. default: true
  49391. },
  49392. preserveExpandedContent: Boolean,
  49393. nativeScrollbar: Boolean
  49394. };
  49395. function hColgroup(props) {
  49396. const isAuto = props.tableLayout === "auto";
  49397. let columns = props.columns || [];
  49398. if (isAuto) {
  49399. if (columns.every(({ width }) => isUndefined(width))) {
  49400. columns = [];
  49401. }
  49402. }
  49403. const getPropsData = (column) => {
  49404. const propsData = {
  49405. key: `${props.tableLayout}_${column.id}`,
  49406. style: {},
  49407. name: void 0
  49408. };
  49409. if (isAuto) {
  49410. propsData.style = {
  49411. width: `${column.width}px`
  49412. };
  49413. } else {
  49414. propsData.name = column.id;
  49415. }
  49416. return propsData;
  49417. };
  49418. return vue.h("colgroup", {}, columns.map((column) => vue.h("col", getPropsData(column))));
  49419. }
  49420. hColgroup.props = ["columns", "tableLayout"];
  49421. const useScrollbar$1 = () => {
  49422. const scrollBarRef = vue.ref();
  49423. const scrollTo = (options, yCoord) => {
  49424. const scrollbar = scrollBarRef.value;
  49425. if (scrollbar) {
  49426. scrollbar.scrollTo(options, yCoord);
  49427. }
  49428. };
  49429. const setScrollPosition = (position, offset) => {
  49430. const scrollbar = scrollBarRef.value;
  49431. if (scrollbar && isNumber(offset) && ["Top", "Left"].includes(position)) {
  49432. scrollbar[`setScroll${position}`](offset);
  49433. }
  49434. };
  49435. const setScrollTop = (top) => setScrollPosition("Top", top);
  49436. const setScrollLeft = (left) => setScrollPosition("Left", left);
  49437. return {
  49438. scrollBarRef,
  49439. scrollTo,
  49440. setScrollTop,
  49441. setScrollLeft
  49442. };
  49443. };
  49444. let tableIdSeed = 1;
  49445. const _sfc_main$x = vue.defineComponent({
  49446. name: "ElTable",
  49447. directives: {
  49448. Mousewheel
  49449. },
  49450. components: {
  49451. TableHeader,
  49452. TableBody,
  49453. TableFooter,
  49454. ElScrollbar,
  49455. hColgroup
  49456. },
  49457. props: defaultProps$2,
  49458. emits: [
  49459. "select",
  49460. "select-all",
  49461. "selection-change",
  49462. "cell-mouse-enter",
  49463. "cell-mouse-leave",
  49464. "cell-contextmenu",
  49465. "cell-click",
  49466. "cell-dblclick",
  49467. "row-click",
  49468. "row-contextmenu",
  49469. "row-dblclick",
  49470. "header-click",
  49471. "header-contextmenu",
  49472. "sort-change",
  49473. "filter-change",
  49474. "current-change",
  49475. "header-dragend",
  49476. "expand-change",
  49477. "scroll"
  49478. ],
  49479. setup(props) {
  49480. const { t } = useLocale();
  49481. const ns = useNamespace("table");
  49482. const table = vue.getCurrentInstance();
  49483. vue.provide(TABLE_INJECTION_KEY, table);
  49484. const store = createStore(table, props);
  49485. table.store = store;
  49486. const layout = new TableLayout$1({
  49487. store: table.store,
  49488. table,
  49489. fit: props.fit,
  49490. showHeader: props.showHeader
  49491. });
  49492. table.layout = layout;
  49493. const isEmpty = vue.computed(() => (store.states.data.value || []).length === 0);
  49494. const {
  49495. setCurrentRow,
  49496. getSelectionRows,
  49497. toggleRowSelection,
  49498. clearSelection,
  49499. clearFilter,
  49500. toggleAllSelection,
  49501. toggleRowExpansion,
  49502. clearSort,
  49503. sort,
  49504. updateKeyChildren
  49505. } = useUtils(store);
  49506. const {
  49507. isHidden,
  49508. renderExpanded,
  49509. setDragVisible,
  49510. isGroup,
  49511. handleMouseLeave,
  49512. handleHeaderFooterMousewheel,
  49513. tableSize,
  49514. emptyBlockStyle,
  49515. resizeProxyVisible,
  49516. bodyWidth,
  49517. resizeState,
  49518. doLayout,
  49519. tableBodyStyles,
  49520. tableLayout,
  49521. scrollbarViewStyle,
  49522. scrollbarStyle
  49523. } = useStyle(props, layout, store, table);
  49524. const { scrollBarRef, scrollTo, setScrollLeft, setScrollTop } = useScrollbar$1();
  49525. const debouncedUpdateLayout = debounce(doLayout, 50);
  49526. const tableId = `${ns.namespace.value}-table_${tableIdSeed++}`;
  49527. table.tableId = tableId;
  49528. table.state = {
  49529. isGroup,
  49530. resizeState,
  49531. doLayout,
  49532. debouncedUpdateLayout
  49533. };
  49534. const computedSumText = vue.computed(() => {
  49535. var _a;
  49536. return (_a = props.sumText) != null ? _a : t("el.table.sumText");
  49537. });
  49538. const computedEmptyText = vue.computed(() => {
  49539. var _a;
  49540. return (_a = props.emptyText) != null ? _a : t("el.table.emptyText");
  49541. });
  49542. const columns = vue.computed(() => {
  49543. return convertToRows(store.states.originColumns.value)[0];
  49544. });
  49545. useKeyRender(table);
  49546. vue.onBeforeUnmount(() => {
  49547. debouncedUpdateLayout.cancel();
  49548. });
  49549. return {
  49550. ns,
  49551. layout,
  49552. store,
  49553. columns,
  49554. handleHeaderFooterMousewheel,
  49555. handleMouseLeave,
  49556. tableId,
  49557. tableSize,
  49558. isHidden,
  49559. isEmpty,
  49560. renderExpanded,
  49561. resizeProxyVisible,
  49562. resizeState,
  49563. isGroup,
  49564. bodyWidth,
  49565. tableBodyStyles,
  49566. emptyBlockStyle,
  49567. debouncedUpdateLayout,
  49568. setCurrentRow,
  49569. getSelectionRows,
  49570. toggleRowSelection,
  49571. clearSelection,
  49572. clearFilter,
  49573. toggleAllSelection,
  49574. toggleRowExpansion,
  49575. clearSort,
  49576. doLayout,
  49577. sort,
  49578. updateKeyChildren,
  49579. t,
  49580. setDragVisible,
  49581. context: table,
  49582. computedSumText,
  49583. computedEmptyText,
  49584. tableLayout,
  49585. scrollbarViewStyle,
  49586. scrollbarStyle,
  49587. scrollBarRef,
  49588. scrollTo,
  49589. setScrollLeft,
  49590. setScrollTop,
  49591. allowDragLastColumn: props.allowDragLastColumn
  49592. };
  49593. }
  49594. });
  49595. function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
  49596. const _component_hColgroup = vue.resolveComponent("hColgroup");
  49597. const _component_table_header = vue.resolveComponent("table-header");
  49598. const _component_table_body = vue.resolveComponent("table-body");
  49599. const _component_table_footer = vue.resolveComponent("table-footer");
  49600. const _component_el_scrollbar = vue.resolveComponent("el-scrollbar");
  49601. const _directive_mousewheel = vue.resolveDirective("mousewheel");
  49602. return vue.openBlock(), vue.createElementBlock("div", {
  49603. ref: "tableWrapper",
  49604. class: vue.normalizeClass([
  49605. {
  49606. [_ctx.ns.m("fit")]: _ctx.fit,
  49607. [_ctx.ns.m("striped")]: _ctx.stripe,
  49608. [_ctx.ns.m("border")]: _ctx.border || _ctx.isGroup,
  49609. [_ctx.ns.m("hidden")]: _ctx.isHidden,
  49610. [_ctx.ns.m("group")]: _ctx.isGroup,
  49611. [_ctx.ns.m("fluid-height")]: _ctx.maxHeight,
  49612. [_ctx.ns.m("scrollable-x")]: _ctx.layout.scrollX.value,
  49613. [_ctx.ns.m("scrollable-y")]: _ctx.layout.scrollY.value,
  49614. [_ctx.ns.m("enable-row-hover")]: !_ctx.store.states.isComplex.value,
  49615. [_ctx.ns.m("enable-row-transition")]: (_ctx.store.states.data.value || []).length !== 0 && (_ctx.store.states.data.value || []).length < 100,
  49616. "has-footer": _ctx.showSummary
  49617. },
  49618. _ctx.ns.m(_ctx.tableSize),
  49619. _ctx.className,
  49620. _ctx.ns.b(),
  49621. _ctx.ns.m(`layout-${_ctx.tableLayout}`)
  49622. ]),
  49623. style: vue.normalizeStyle(_ctx.style),
  49624. "data-prefix": _ctx.ns.namespace.value,
  49625. onMouseleave: _ctx.handleMouseLeave
  49626. }, [
  49627. vue.createElementVNode("div", {
  49628. class: vue.normalizeClass(_ctx.ns.e("inner-wrapper"))
  49629. }, [
  49630. vue.createElementVNode("div", {
  49631. ref: "hiddenColumns",
  49632. class: "hidden-columns"
  49633. }, [
  49634. vue.renderSlot(_ctx.$slots, "default")
  49635. ], 512),
  49636. _ctx.showHeader && _ctx.tableLayout === "fixed" ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  49637. key: 0,
  49638. ref: "headerWrapper",
  49639. class: vue.normalizeClass(_ctx.ns.e("header-wrapper"))
  49640. }, [
  49641. vue.createElementVNode("table", {
  49642. ref: "tableHeader",
  49643. class: vue.normalizeClass(_ctx.ns.e("header")),
  49644. style: vue.normalizeStyle(_ctx.tableBodyStyles),
  49645. border: "0",
  49646. cellpadding: "0",
  49647. cellspacing: "0"
  49648. }, [
  49649. vue.createVNode(_component_hColgroup, {
  49650. columns: _ctx.store.states.columns.value,
  49651. "table-layout": _ctx.tableLayout
  49652. }, null, 8, ["columns", "table-layout"]),
  49653. vue.createVNode(_component_table_header, {
  49654. ref: "tableHeaderRef",
  49655. border: _ctx.border,
  49656. "default-sort": _ctx.defaultSort,
  49657. store: _ctx.store,
  49658. "append-filter-panel-to": _ctx.appendFilterPanelTo,
  49659. "allow-drag-last-column": _ctx.allowDragLastColumn,
  49660. onSetDragVisible: _ctx.setDragVisible
  49661. }, null, 8, ["border", "default-sort", "store", "append-filter-panel-to", "allow-drag-last-column", "onSetDragVisible"])
  49662. ], 6)
  49663. ], 2)), [
  49664. [_directive_mousewheel, _ctx.handleHeaderFooterMousewheel]
  49665. ]) : vue.createCommentVNode("v-if", true),
  49666. vue.createElementVNode("div", {
  49667. ref: "bodyWrapper",
  49668. class: vue.normalizeClass(_ctx.ns.e("body-wrapper"))
  49669. }, [
  49670. vue.createVNode(_component_el_scrollbar, {
  49671. ref: "scrollBarRef",
  49672. "view-style": _ctx.scrollbarViewStyle,
  49673. "wrap-style": _ctx.scrollbarStyle,
  49674. always: _ctx.scrollbarAlwaysOn,
  49675. tabindex: _ctx.scrollbarTabindex,
  49676. native: _ctx.nativeScrollbar,
  49677. onScroll: ($event) => _ctx.$emit("scroll", $event)
  49678. }, {
  49679. default: vue.withCtx(() => [
  49680. vue.createElementVNode("table", {
  49681. ref: "tableBody",
  49682. class: vue.normalizeClass(_ctx.ns.e("body")),
  49683. cellspacing: "0",
  49684. cellpadding: "0",
  49685. border: "0",
  49686. style: vue.normalizeStyle({
  49687. width: _ctx.bodyWidth,
  49688. tableLayout: _ctx.tableLayout
  49689. })
  49690. }, [
  49691. vue.createVNode(_component_hColgroup, {
  49692. columns: _ctx.store.states.columns.value,
  49693. "table-layout": _ctx.tableLayout
  49694. }, null, 8, ["columns", "table-layout"]),
  49695. _ctx.showHeader && _ctx.tableLayout === "auto" ? (vue.openBlock(), vue.createBlock(_component_table_header, {
  49696. key: 0,
  49697. ref: "tableHeaderRef",
  49698. class: vue.normalizeClass(_ctx.ns.e("body-header")),
  49699. border: _ctx.border,
  49700. "default-sort": _ctx.defaultSort,
  49701. store: _ctx.store,
  49702. "append-filter-panel-to": _ctx.appendFilterPanelTo,
  49703. onSetDragVisible: _ctx.setDragVisible
  49704. }, null, 8, ["class", "border", "default-sort", "store", "append-filter-panel-to", "onSetDragVisible"])) : vue.createCommentVNode("v-if", true),
  49705. vue.createVNode(_component_table_body, {
  49706. context: _ctx.context,
  49707. highlight: _ctx.highlightCurrentRow,
  49708. "row-class-name": _ctx.rowClassName,
  49709. "tooltip-effect": _ctx.tooltipEffect,
  49710. "tooltip-options": _ctx.tooltipOptions,
  49711. "row-style": _ctx.rowStyle,
  49712. store: _ctx.store,
  49713. stripe: _ctx.stripe
  49714. }, null, 8, ["context", "highlight", "row-class-name", "tooltip-effect", "tooltip-options", "row-style", "store", "stripe"]),
  49715. _ctx.showSummary && _ctx.tableLayout === "auto" ? (vue.openBlock(), vue.createBlock(_component_table_footer, {
  49716. key: 1,
  49717. class: vue.normalizeClass(_ctx.ns.e("body-footer")),
  49718. border: _ctx.border,
  49719. "default-sort": _ctx.defaultSort,
  49720. store: _ctx.store,
  49721. "sum-text": _ctx.computedSumText,
  49722. "summary-method": _ctx.summaryMethod
  49723. }, null, 8, ["class", "border", "default-sort", "store", "sum-text", "summary-method"])) : vue.createCommentVNode("v-if", true)
  49724. ], 6),
  49725. _ctx.isEmpty ? (vue.openBlock(), vue.createElementBlock("div", {
  49726. key: 0,
  49727. ref: "emptyBlock",
  49728. style: vue.normalizeStyle(_ctx.emptyBlockStyle),
  49729. class: vue.normalizeClass(_ctx.ns.e("empty-block"))
  49730. }, [
  49731. vue.createElementVNode("span", {
  49732. class: vue.normalizeClass(_ctx.ns.e("empty-text"))
  49733. }, [
  49734. vue.renderSlot(_ctx.$slots, "empty", {}, () => [
  49735. vue.createTextVNode(vue.toDisplayString(_ctx.computedEmptyText), 1)
  49736. ])
  49737. ], 2)
  49738. ], 6)) : vue.createCommentVNode("v-if", true),
  49739. _ctx.$slots.append ? (vue.openBlock(), vue.createElementBlock("div", {
  49740. key: 1,
  49741. ref: "appendWrapper",
  49742. class: vue.normalizeClass(_ctx.ns.e("append-wrapper"))
  49743. }, [
  49744. vue.renderSlot(_ctx.$slots, "append")
  49745. ], 2)) : vue.createCommentVNode("v-if", true)
  49746. ]),
  49747. _: 3
  49748. }, 8, ["view-style", "wrap-style", "always", "tabindex", "native", "onScroll"])
  49749. ], 2),
  49750. _ctx.showSummary && _ctx.tableLayout === "fixed" ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  49751. key: 1,
  49752. ref: "footerWrapper",
  49753. class: vue.normalizeClass(_ctx.ns.e("footer-wrapper"))
  49754. }, [
  49755. vue.createElementVNode("table", {
  49756. class: vue.normalizeClass(_ctx.ns.e("footer")),
  49757. cellspacing: "0",
  49758. cellpadding: "0",
  49759. border: "0",
  49760. style: vue.normalizeStyle(_ctx.tableBodyStyles)
  49761. }, [
  49762. vue.createVNode(_component_hColgroup, {
  49763. columns: _ctx.store.states.columns.value,
  49764. "table-layout": _ctx.tableLayout
  49765. }, null, 8, ["columns", "table-layout"]),
  49766. vue.createVNode(_component_table_footer, {
  49767. border: _ctx.border,
  49768. "default-sort": _ctx.defaultSort,
  49769. store: _ctx.store,
  49770. "sum-text": _ctx.computedSumText,
  49771. "summary-method": _ctx.summaryMethod
  49772. }, null, 8, ["border", "default-sort", "store", "sum-text", "summary-method"])
  49773. ], 6)
  49774. ], 2)), [
  49775. [vue.vShow, !_ctx.isEmpty],
  49776. [_directive_mousewheel, _ctx.handleHeaderFooterMousewheel]
  49777. ]) : vue.createCommentVNode("v-if", true),
  49778. _ctx.border || _ctx.isGroup ? (vue.openBlock(), vue.createElementBlock("div", {
  49779. key: 2,
  49780. class: vue.normalizeClass(_ctx.ns.e("border-left-patch"))
  49781. }, null, 2)) : vue.createCommentVNode("v-if", true)
  49782. ], 2),
  49783. vue.withDirectives(vue.createElementVNode("div", {
  49784. ref: "resizeProxy",
  49785. class: vue.normalizeClass(_ctx.ns.e("column-resize-proxy"))
  49786. }, null, 2), [
  49787. [vue.vShow, _ctx.resizeProxyVisible]
  49788. ])
  49789. ], 46, ["data-prefix", "onMouseleave"]);
  49790. }
  49791. var Table = /* @__PURE__ */ _export_sfc(_sfc_main$x, [["render", _sfc_render$3], ["__file", "table.vue"]]);
  49792. const defaultClassNames = {
  49793. selection: "table-column--selection",
  49794. expand: "table__expand-column"
  49795. };
  49796. const cellStarts = {
  49797. default: {
  49798. order: ""
  49799. },
  49800. selection: {
  49801. width: 48,
  49802. minWidth: 48,
  49803. realWidth: 48,
  49804. order: ""
  49805. },
  49806. expand: {
  49807. width: 48,
  49808. minWidth: 48,
  49809. realWidth: 48,
  49810. order: ""
  49811. },
  49812. index: {
  49813. width: 48,
  49814. minWidth: 48,
  49815. realWidth: 48,
  49816. order: ""
  49817. }
  49818. };
  49819. const getDefaultClassName = (type) => {
  49820. return defaultClassNames[type] || "";
  49821. };
  49822. const cellForced = {
  49823. selection: {
  49824. renderHeader({
  49825. store,
  49826. column
  49827. }) {
  49828. var _a;
  49829. function isDisabled() {
  49830. return store.states.data.value && store.states.data.value.length === 0;
  49831. }
  49832. return vue.h(ElCheckbox, {
  49833. disabled: isDisabled(),
  49834. size: store.states.tableSize.value,
  49835. indeterminate: store.states.selection.value.length > 0 && !store.states.isAllSelected.value,
  49836. "onUpdate:modelValue": (_a = store.toggleAllSelection) != null ? _a : void 0,
  49837. modelValue: store.states.isAllSelected.value,
  49838. ariaLabel: column.label
  49839. });
  49840. },
  49841. renderCell({
  49842. row,
  49843. column,
  49844. store,
  49845. $index
  49846. }) {
  49847. return vue.h(ElCheckbox, {
  49848. disabled: column.selectable ? !column.selectable.call(null, row, $index) : false,
  49849. size: store.states.tableSize.value,
  49850. onChange: () => {
  49851. store.commit("rowSelectedChanged", row);
  49852. },
  49853. onClick: (event) => event.stopPropagation(),
  49854. modelValue: store.isSelected(row),
  49855. ariaLabel: column.label
  49856. });
  49857. },
  49858. sortable: false,
  49859. resizable: false
  49860. },
  49861. index: {
  49862. renderHeader({
  49863. column
  49864. }) {
  49865. return column.label || "#";
  49866. },
  49867. renderCell({
  49868. column,
  49869. $index
  49870. }) {
  49871. let i = $index + 1;
  49872. const index = column.index;
  49873. if (isNumber(index)) {
  49874. i = $index + index;
  49875. } else if (isFunction$1(index)) {
  49876. i = index($index);
  49877. }
  49878. return vue.h("div", {}, [i]);
  49879. },
  49880. sortable: false
  49881. },
  49882. expand: {
  49883. renderHeader({
  49884. column
  49885. }) {
  49886. return column.label || "";
  49887. },
  49888. renderCell({
  49889. column,
  49890. row,
  49891. store,
  49892. expanded
  49893. }) {
  49894. const { ns } = store;
  49895. const classes = [ns.e("expand-icon")];
  49896. if (!column.renderExpand && expanded) {
  49897. classes.push(ns.em("expand-icon", "expanded"));
  49898. }
  49899. const callback = function(e) {
  49900. e.stopPropagation();
  49901. store.toggleRowExpansion(row);
  49902. };
  49903. return vue.h("div", {
  49904. class: classes,
  49905. onClick: callback
  49906. }, {
  49907. default: () => {
  49908. if (column.renderExpand) {
  49909. return [
  49910. column.renderExpand({
  49911. expanded
  49912. })
  49913. ];
  49914. }
  49915. return [
  49916. vue.h(ElIcon, null, {
  49917. default: () => {
  49918. return [vue.h(arrow_right_default)];
  49919. }
  49920. })
  49921. ];
  49922. }
  49923. });
  49924. },
  49925. sortable: false,
  49926. resizable: false
  49927. }
  49928. };
  49929. function defaultRenderCell({
  49930. row,
  49931. column,
  49932. $index
  49933. }) {
  49934. var _a;
  49935. const property = column.property;
  49936. const value = property && getProp(row, property).value;
  49937. if (column && column.formatter) {
  49938. return column.formatter(row, column, value, $index);
  49939. }
  49940. return ((_a = value == null ? void 0 : value.toString) == null ? void 0 : _a.call(value)) || "";
  49941. }
  49942. function treeCellPrefix({
  49943. row,
  49944. treeNode,
  49945. store
  49946. }, createPlaceholder = false) {
  49947. const { ns } = store;
  49948. if (!treeNode) {
  49949. if (createPlaceholder) {
  49950. return [
  49951. vue.h("span", {
  49952. class: ns.e("placeholder")
  49953. })
  49954. ];
  49955. }
  49956. return null;
  49957. }
  49958. const ele = [];
  49959. const callback = function(e) {
  49960. e.stopPropagation();
  49961. if (treeNode.loading) {
  49962. return;
  49963. }
  49964. store.loadOrToggle(row);
  49965. };
  49966. if (treeNode.indent) {
  49967. ele.push(vue.h("span", {
  49968. class: ns.e("indent"),
  49969. style: { "padding-left": `${treeNode.indent}px` }
  49970. }));
  49971. }
  49972. if (isBoolean(treeNode.expanded) && !treeNode.noLazyChildren) {
  49973. const expandClasses = [
  49974. ns.e("expand-icon"),
  49975. treeNode.expanded ? ns.em("expand-icon", "expanded") : ""
  49976. ];
  49977. let icon = arrow_right_default;
  49978. if (treeNode.loading) {
  49979. icon = loading_default;
  49980. }
  49981. ele.push(vue.h("div", {
  49982. class: expandClasses,
  49983. onClick: callback
  49984. }, {
  49985. default: () => {
  49986. return [
  49987. vue.h(ElIcon, { class: ns.is("loading", treeNode.loading) }, {
  49988. default: () => [vue.h(icon)]
  49989. })
  49990. ];
  49991. }
  49992. }));
  49993. } else {
  49994. ele.push(vue.h("span", {
  49995. class: ns.e("placeholder")
  49996. }));
  49997. }
  49998. return ele;
  49999. }
  50000. function getAllAliases(props, aliases) {
  50001. return props.reduce((prev, cur) => {
  50002. prev[cur] = cur;
  50003. return prev;
  50004. }, aliases);
  50005. }
  50006. function useWatcher(owner, props_) {
  50007. const instance = vue.getCurrentInstance();
  50008. const registerComplexWatchers = () => {
  50009. const props = ["fixed"];
  50010. const aliases = {
  50011. realWidth: "width",
  50012. realMinWidth: "minWidth"
  50013. };
  50014. const allAliases = getAllAliases(props, aliases);
  50015. Object.keys(allAliases).forEach((key) => {
  50016. const columnKey = aliases[key];
  50017. if (hasOwn(props_, columnKey)) {
  50018. vue.watch(() => props_[columnKey], (newVal) => {
  50019. let value = newVal;
  50020. if (columnKey === "width" && key === "realWidth") {
  50021. value = parseWidth(newVal);
  50022. }
  50023. if (columnKey === "minWidth" && key === "realMinWidth") {
  50024. value = parseMinWidth(newVal);
  50025. }
  50026. instance.columnConfig.value[columnKey] = value;
  50027. instance.columnConfig.value[key] = value;
  50028. const updateColumns = columnKey === "fixed";
  50029. owner.value.store.scheduleLayout(updateColumns);
  50030. });
  50031. }
  50032. });
  50033. };
  50034. const registerNormalWatchers = () => {
  50035. const props = [
  50036. "label",
  50037. "filters",
  50038. "filterMultiple",
  50039. "filteredValue",
  50040. "sortable",
  50041. "index",
  50042. "formatter",
  50043. "className",
  50044. "labelClassName",
  50045. "filterClassName",
  50046. "showOverflowTooltip",
  50047. "tooltipFormatter",
  50048. "resizable"
  50049. ];
  50050. const parentProps = ["showOverflowTooltip"];
  50051. const aliases = {
  50052. property: "prop",
  50053. align: "realAlign",
  50054. headerAlign: "realHeaderAlign"
  50055. };
  50056. const allAliases = getAllAliases(props, aliases);
  50057. Object.keys(allAliases).forEach((key) => {
  50058. const columnKey = aliases[key];
  50059. if (hasOwn(props_, columnKey)) {
  50060. vue.watch(() => props_[columnKey], (newVal) => {
  50061. instance.columnConfig.value[key] = newVal;
  50062. });
  50063. }
  50064. });
  50065. parentProps.forEach((key) => {
  50066. if (hasOwn(owner.value.props, key)) {
  50067. vue.watch(() => owner.value.props[key], (newVal) => {
  50068. instance.columnConfig.value[key] = newVal;
  50069. });
  50070. }
  50071. });
  50072. };
  50073. return {
  50074. registerComplexWatchers,
  50075. registerNormalWatchers
  50076. };
  50077. }
  50078. function useRender(props, slots, owner) {
  50079. const instance = vue.getCurrentInstance();
  50080. const columnId = vue.ref("");
  50081. const isSubColumn = vue.ref(false);
  50082. const realAlign = vue.ref();
  50083. const realHeaderAlign = vue.ref();
  50084. const ns = useNamespace("table");
  50085. vue.watchEffect(() => {
  50086. realAlign.value = props.align ? `is-${props.align}` : null;
  50087. realAlign.value;
  50088. });
  50089. vue.watchEffect(() => {
  50090. realHeaderAlign.value = props.headerAlign ? `is-${props.headerAlign}` : realAlign.value;
  50091. realHeaderAlign.value;
  50092. });
  50093. const columnOrTableParent = vue.computed(() => {
  50094. let parent = instance.vnode.vParent || instance.parent;
  50095. while (parent && !parent.tableId && !parent.columnId) {
  50096. parent = parent.vnode.vParent || parent.parent;
  50097. }
  50098. return parent;
  50099. });
  50100. const hasTreeColumn = vue.computed(() => {
  50101. const { store } = instance.parent;
  50102. if (!store)
  50103. return false;
  50104. const { treeData } = store.states;
  50105. const treeDataValue = treeData.value;
  50106. return treeDataValue && Object.keys(treeDataValue).length > 0;
  50107. });
  50108. const realWidth = vue.ref(parseWidth(props.width));
  50109. const realMinWidth = vue.ref(parseMinWidth(props.minWidth));
  50110. const setColumnWidth = (column) => {
  50111. if (realWidth.value)
  50112. column.width = realWidth.value;
  50113. if (realMinWidth.value) {
  50114. column.minWidth = realMinWidth.value;
  50115. }
  50116. if (!realWidth.value && realMinWidth.value) {
  50117. column.width = void 0;
  50118. }
  50119. if (!column.minWidth) {
  50120. column.minWidth = 80;
  50121. }
  50122. column.realWidth = Number(isUndefined(column.width) ? column.minWidth : column.width);
  50123. return column;
  50124. };
  50125. const setColumnForcedProps = (column) => {
  50126. const type = column.type;
  50127. const source = cellForced[type] || {};
  50128. Object.keys(source).forEach((prop) => {
  50129. const value = source[prop];
  50130. if (prop !== "className" && !isUndefined(value)) {
  50131. column[prop] = value;
  50132. }
  50133. });
  50134. const className = getDefaultClassName(type);
  50135. if (className) {
  50136. const forceClass = `${vue.unref(ns.namespace)}-${className}`;
  50137. column.className = column.className ? `${column.className} ${forceClass}` : forceClass;
  50138. }
  50139. return column;
  50140. };
  50141. const checkSubColumn = (children) => {
  50142. if (isArray$1(children)) {
  50143. children.forEach((child) => check(child));
  50144. } else {
  50145. check(children);
  50146. }
  50147. function check(item) {
  50148. var _a;
  50149. if (((_a = item == null ? void 0 : item.type) == null ? void 0 : _a.name) === "ElTableColumn") {
  50150. item.vParent = instance;
  50151. }
  50152. }
  50153. };
  50154. const setColumnRenders = (column) => {
  50155. if (props.renderHeader) {
  50156. debugWarn("TableColumn", "Comparing to render-header, scoped-slot header is easier to use. We recommend users to use scoped-slot header.");
  50157. } else if (column.type !== "selection") {
  50158. column.renderHeader = (scope) => {
  50159. instance.columnConfig.value["label"];
  50160. return vue.renderSlot(slots, "header", scope, () => [column.label]);
  50161. };
  50162. }
  50163. if (slots["filter-icon"]) {
  50164. column.renderFilterIcon = (scope) => {
  50165. return vue.renderSlot(slots, "filter-icon", scope);
  50166. };
  50167. }
  50168. if (slots.expand) {
  50169. column.renderExpand = (scope) => {
  50170. return vue.renderSlot(slots, "expand", scope);
  50171. };
  50172. }
  50173. let originRenderCell = column.renderCell;
  50174. if (column.type === "expand") {
  50175. column.renderCell = (data) => vue.h("div", {
  50176. class: "cell"
  50177. }, [originRenderCell(data)]);
  50178. owner.value.renderExpanded = (row) => {
  50179. return slots.default ? slots.default(row) : slots.default;
  50180. };
  50181. } else {
  50182. originRenderCell = originRenderCell || defaultRenderCell;
  50183. column.renderCell = (data) => {
  50184. let children = null;
  50185. if (slots.default) {
  50186. const vnodes = slots.default(data);
  50187. children = vnodes.some((v) => v.type !== vue.Comment) ? vnodes : originRenderCell(data);
  50188. } else {
  50189. children = originRenderCell(data);
  50190. }
  50191. const { columns } = owner.value.store.states;
  50192. const firstUserColumnIndex = columns.value.findIndex((item) => item.type === "default");
  50193. const shouldCreatePlaceholder = hasTreeColumn.value && data.cellIndex === firstUserColumnIndex;
  50194. const prefix = treeCellPrefix(data, shouldCreatePlaceholder);
  50195. const props2 = {
  50196. class: "cell",
  50197. style: {}
  50198. };
  50199. if (column.showOverflowTooltip) {
  50200. props2.class = `${props2.class} ${vue.unref(ns.namespace)}-tooltip`;
  50201. props2.style = {
  50202. width: `${(data.column.realWidth || Number(data.column.width)) - 1}px`
  50203. };
  50204. }
  50205. checkSubColumn(children);
  50206. return vue.h("div", props2, [prefix, children]);
  50207. };
  50208. }
  50209. return column;
  50210. };
  50211. const getPropsData = (...propsKey) => {
  50212. return propsKey.reduce((prev, cur) => {
  50213. if (isArray$1(cur)) {
  50214. cur.forEach((key) => {
  50215. prev[key] = props[key];
  50216. });
  50217. }
  50218. return prev;
  50219. }, {});
  50220. };
  50221. const getColumnElIndex = (children, child) => {
  50222. return Array.prototype.indexOf.call(children, child);
  50223. };
  50224. const updateColumnOrder = () => {
  50225. owner.value.store.commit("updateColumnOrder", instance.columnConfig.value);
  50226. };
  50227. return {
  50228. columnId,
  50229. realAlign,
  50230. isSubColumn,
  50231. realHeaderAlign,
  50232. columnOrTableParent,
  50233. setColumnWidth,
  50234. setColumnForcedProps,
  50235. setColumnRenders,
  50236. getPropsData,
  50237. getColumnElIndex,
  50238. updateColumnOrder
  50239. };
  50240. }
  50241. var defaultProps$1 = {
  50242. type: {
  50243. type: String,
  50244. default: "default"
  50245. },
  50246. label: String,
  50247. className: String,
  50248. labelClassName: String,
  50249. property: String,
  50250. prop: String,
  50251. width: {
  50252. type: [String, Number],
  50253. default: ""
  50254. },
  50255. minWidth: {
  50256. type: [String, Number],
  50257. default: ""
  50258. },
  50259. renderHeader: Function,
  50260. sortable: {
  50261. type: [Boolean, String],
  50262. default: false
  50263. },
  50264. sortMethod: Function,
  50265. sortBy: [String, Function, Array],
  50266. resizable: {
  50267. type: Boolean,
  50268. default: true
  50269. },
  50270. columnKey: String,
  50271. align: String,
  50272. headerAlign: String,
  50273. showOverflowTooltip: {
  50274. type: [Boolean, Object],
  50275. default: void 0
  50276. },
  50277. tooltipFormatter: Function,
  50278. fixed: [Boolean, String],
  50279. formatter: Function,
  50280. selectable: Function,
  50281. reserveSelection: Boolean,
  50282. filterMethod: Function,
  50283. filteredValue: Array,
  50284. filters: Array,
  50285. filterPlacement: String,
  50286. filterMultiple: {
  50287. type: Boolean,
  50288. default: true
  50289. },
  50290. filterClassName: String,
  50291. index: [Number, Function],
  50292. sortOrders: {
  50293. type: Array,
  50294. default: () => {
  50295. return ["ascending", "descending", null];
  50296. },
  50297. validator: (val) => {
  50298. return val.every((order) => ["ascending", "descending", null].includes(order));
  50299. }
  50300. }
  50301. };
  50302. let columnIdSeed = 1;
  50303. var ElTableColumn$1 = vue.defineComponent({
  50304. name: "ElTableColumn",
  50305. components: {
  50306. ElCheckbox
  50307. },
  50308. props: defaultProps$1,
  50309. setup(props, { slots }) {
  50310. const instance = vue.getCurrentInstance();
  50311. const columnConfig = vue.ref({});
  50312. const owner = vue.computed(() => {
  50313. let parent2 = instance.parent;
  50314. while (parent2 && !parent2.tableId) {
  50315. parent2 = parent2.parent;
  50316. }
  50317. return parent2;
  50318. });
  50319. const { registerNormalWatchers, registerComplexWatchers } = useWatcher(owner, props);
  50320. const {
  50321. columnId,
  50322. isSubColumn,
  50323. realHeaderAlign,
  50324. columnOrTableParent,
  50325. setColumnWidth,
  50326. setColumnForcedProps,
  50327. setColumnRenders,
  50328. getPropsData,
  50329. getColumnElIndex,
  50330. realAlign,
  50331. updateColumnOrder
  50332. } = useRender(props, slots, owner);
  50333. const parent = columnOrTableParent.value;
  50334. columnId.value = `${"tableId" in parent && parent.tableId || "columnId" in parent && parent.columnId}_column_${columnIdSeed++}`;
  50335. vue.onBeforeMount(() => {
  50336. isSubColumn.value = owner.value !== parent;
  50337. const type = props.type || "default";
  50338. const sortable = props.sortable === "" ? true : props.sortable;
  50339. const showOverflowTooltip = type === "selection" ? false : isUndefined(props.showOverflowTooltip) ? parent.props.showOverflowTooltip : props.showOverflowTooltip;
  50340. const tooltipFormatter = isUndefined(props.tooltipFormatter) ? parent.props.tooltipFormatter : props.tooltipFormatter;
  50341. const defaults = {
  50342. ...cellStarts[type],
  50343. id: columnId.value,
  50344. type,
  50345. property: props.prop || props.property,
  50346. align: realAlign,
  50347. headerAlign: realHeaderAlign,
  50348. showOverflowTooltip,
  50349. tooltipFormatter,
  50350. filterable: props.filters || props.filterMethod,
  50351. filteredValue: [],
  50352. filterPlacement: "",
  50353. filterClassName: "",
  50354. isColumnGroup: false,
  50355. isSubColumn: false,
  50356. filterOpened: false,
  50357. sortable,
  50358. index: props.index,
  50359. rawColumnKey: instance.vnode.key
  50360. };
  50361. const basicProps = [
  50362. "columnKey",
  50363. "label",
  50364. "className",
  50365. "labelClassName",
  50366. "type",
  50367. "renderHeader",
  50368. "formatter",
  50369. "fixed",
  50370. "resizable"
  50371. ];
  50372. const sortProps = ["sortMethod", "sortBy", "sortOrders"];
  50373. const selectProps = ["selectable", "reserveSelection"];
  50374. const filterProps = [
  50375. "filterMethod",
  50376. "filters",
  50377. "filterMultiple",
  50378. "filterOpened",
  50379. "filteredValue",
  50380. "filterPlacement",
  50381. "filterClassName"
  50382. ];
  50383. let column = getPropsData(basicProps, sortProps, selectProps, filterProps);
  50384. column = mergeOptions(defaults, column);
  50385. const chains = compose(setColumnRenders, setColumnWidth, setColumnForcedProps);
  50386. column = chains(column);
  50387. columnConfig.value = column;
  50388. registerNormalWatchers();
  50389. registerComplexWatchers();
  50390. });
  50391. vue.onMounted(() => {
  50392. var _a, _b;
  50393. const parent2 = columnOrTableParent.value;
  50394. const children = isSubColumn.value ? (_a = parent2.vnode.el) == null ? void 0 : _a.children : (_b = parent2.refs.hiddenColumns) == null ? void 0 : _b.children;
  50395. const getColumnIndex = () => getColumnElIndex(children || [], instance.vnode.el);
  50396. columnConfig.value.getColumnIndex = getColumnIndex;
  50397. const columnIndex = getColumnIndex();
  50398. columnIndex > -1 && owner.value.store.commit("insertColumn", columnConfig.value, isSubColumn.value ? "columnConfig" in parent2 && parent2.columnConfig.value : null, updateColumnOrder);
  50399. });
  50400. vue.onBeforeUnmount(() => {
  50401. const getColumnIndex = columnConfig.value.getColumnIndex;
  50402. const columnIndex = getColumnIndex ? getColumnIndex() : -1;
  50403. columnIndex > -1 && owner.value.store.commit("removeColumn", columnConfig.value, isSubColumn.value ? "columnConfig" in parent && parent.columnConfig.value : null, updateColumnOrder);
  50404. });
  50405. instance.columnId = columnId.value;
  50406. instance.columnConfig = columnConfig;
  50407. return;
  50408. },
  50409. render() {
  50410. var _a, _b, _c;
  50411. try {
  50412. const renderDefault = (_b = (_a = this.$slots).default) == null ? void 0 : _b.call(_a, {
  50413. row: {},
  50414. column: {},
  50415. $index: -1
  50416. });
  50417. const children = [];
  50418. if (isArray$1(renderDefault)) {
  50419. for (const childNode of renderDefault) {
  50420. if (((_c = childNode.type) == null ? void 0 : _c.name) === "ElTableColumn" || childNode.shapeFlag & 2) {
  50421. children.push(childNode);
  50422. } else if (childNode.type === vue.Fragment && isArray$1(childNode.children)) {
  50423. childNode.children.forEach((vnode2) => {
  50424. if ((vnode2 == null ? void 0 : vnode2.patchFlag) !== 1024 && !isString$1(vnode2 == null ? void 0 : vnode2.children)) {
  50425. children.push(vnode2);
  50426. }
  50427. });
  50428. }
  50429. }
  50430. }
  50431. const vnode = vue.h("div", children);
  50432. return vnode;
  50433. } catch (e) {
  50434. return vue.h("div", []);
  50435. }
  50436. }
  50437. });
  50438. const ElTable = withInstall(Table, {
  50439. TableColumn: ElTableColumn$1
  50440. });
  50441. const ElTableColumn = withNoopInstall(ElTableColumn$1);
  50442. var SortOrder = /* @__PURE__ */ ((SortOrder2) => {
  50443. SortOrder2["ASC"] = "asc";
  50444. SortOrder2["DESC"] = "desc";
  50445. return SortOrder2;
  50446. })(SortOrder || {});
  50447. var Alignment = /* @__PURE__ */ ((Alignment2) => {
  50448. Alignment2["LEFT"] = "left";
  50449. Alignment2["CENTER"] = "center";
  50450. Alignment2["RIGHT"] = "right";
  50451. return Alignment2;
  50452. })(Alignment || {});
  50453. var FixedDir = /* @__PURE__ */ ((FixedDir2) => {
  50454. FixedDir2["LEFT"] = "left";
  50455. FixedDir2["RIGHT"] = "right";
  50456. return FixedDir2;
  50457. })(FixedDir || {});
  50458. const oppositeOrderMap = {
  50459. ["asc" /* ASC */]: "desc" /* DESC */,
  50460. ["desc" /* DESC */]: "asc" /* ASC */
  50461. };
  50462. const placeholderSign = Symbol("placeholder");
  50463. const calcColumnStyle = (column, fixedColumn, fixed) => {
  50464. var _a;
  50465. const flex = {
  50466. flexGrow: 0,
  50467. flexShrink: 0,
  50468. ...fixed ? {} : {
  50469. flexGrow: column.flexGrow || 0,
  50470. flexShrink: column.flexShrink || 1
  50471. }
  50472. };
  50473. if (!fixed) {
  50474. flex.flexShrink = 1;
  50475. }
  50476. const style = {
  50477. ...(_a = column.style) != null ? _a : {},
  50478. ...flex,
  50479. flexBasis: "auto",
  50480. width: column.width
  50481. };
  50482. if (!fixedColumn) {
  50483. if (column.maxWidth)
  50484. style.maxWidth = column.maxWidth;
  50485. if (column.minWidth)
  50486. style.minWidth = column.minWidth;
  50487. }
  50488. return style;
  50489. };
  50490. function useColumns(props, columns, fixed) {
  50491. const _columns = vue.computed(() => vue.unref(columns).map((column, index) => {
  50492. var _a, _b;
  50493. return {
  50494. ...column,
  50495. key: (_b = (_a = column.key) != null ? _a : column.dataKey) != null ? _b : index
  50496. };
  50497. }));
  50498. const visibleColumns = vue.computed(() => {
  50499. return vue.unref(_columns).filter((column) => !column.hidden);
  50500. });
  50501. const fixedColumnsOnLeft = vue.computed(() => vue.unref(visibleColumns).filter((column) => column.fixed === "left" || column.fixed === true));
  50502. const fixedColumnsOnRight = vue.computed(() => vue.unref(visibleColumns).filter((column) => column.fixed === "right"));
  50503. const normalColumns = vue.computed(() => vue.unref(visibleColumns).filter((column) => !column.fixed));
  50504. const mainColumns = vue.computed(() => {
  50505. const ret = [];
  50506. vue.unref(fixedColumnsOnLeft).forEach((column) => {
  50507. ret.push({
  50508. ...column,
  50509. placeholderSign
  50510. });
  50511. });
  50512. vue.unref(normalColumns).forEach((column) => {
  50513. ret.push(column);
  50514. });
  50515. vue.unref(fixedColumnsOnRight).forEach((column) => {
  50516. ret.push({
  50517. ...column,
  50518. placeholderSign
  50519. });
  50520. });
  50521. return ret;
  50522. });
  50523. const hasFixedColumns = vue.computed(() => {
  50524. return vue.unref(fixedColumnsOnLeft).length || vue.unref(fixedColumnsOnRight).length;
  50525. });
  50526. const columnsStyles = vue.computed(() => {
  50527. return vue.unref(_columns).reduce((style, column) => {
  50528. style[column.key] = calcColumnStyle(column, vue.unref(fixed), props.fixed);
  50529. return style;
  50530. }, {});
  50531. });
  50532. const columnsTotalWidth = vue.computed(() => {
  50533. return vue.unref(visibleColumns).reduce((width, column) => width + column.width, 0);
  50534. });
  50535. const getColumn = (key) => {
  50536. return vue.unref(_columns).find((column) => column.key === key);
  50537. };
  50538. const getColumnStyle = (key) => {
  50539. return vue.unref(columnsStyles)[key];
  50540. };
  50541. const updateColumnWidth = (column, width) => {
  50542. column.width = width;
  50543. };
  50544. function onColumnSorted(e) {
  50545. var _a;
  50546. const { key } = e.currentTarget.dataset;
  50547. if (!key)
  50548. return;
  50549. const { sortState, sortBy } = props;
  50550. let order = SortOrder.ASC;
  50551. if (isObject$1(sortState)) {
  50552. order = oppositeOrderMap[sortState[key]];
  50553. } else {
  50554. order = oppositeOrderMap[sortBy.order];
  50555. }
  50556. (_a = props.onColumnSort) == null ? void 0 : _a.call(props, { column: getColumn(key), key, order });
  50557. }
  50558. return {
  50559. columns: _columns,
  50560. columnsStyles,
  50561. columnsTotalWidth,
  50562. fixedColumnsOnLeft,
  50563. fixedColumnsOnRight,
  50564. hasFixedColumns,
  50565. mainColumns,
  50566. normalColumns,
  50567. visibleColumns,
  50568. getColumn,
  50569. getColumnStyle,
  50570. updateColumnWidth,
  50571. onColumnSorted
  50572. };
  50573. }
  50574. const useScrollbar = (props, {
  50575. mainTableRef,
  50576. leftTableRef,
  50577. rightTableRef,
  50578. onMaybeEndReached
  50579. }) => {
  50580. const scrollPos = vue.ref({ scrollLeft: 0, scrollTop: 0 });
  50581. function doScroll(params) {
  50582. var _a, _b, _c;
  50583. const { scrollTop } = params;
  50584. (_a = mainTableRef.value) == null ? void 0 : _a.scrollTo(params);
  50585. (_b = leftTableRef.value) == null ? void 0 : _b.scrollToTop(scrollTop);
  50586. (_c = rightTableRef.value) == null ? void 0 : _c.scrollToTop(scrollTop);
  50587. }
  50588. function scrollTo(params) {
  50589. scrollPos.value = params;
  50590. doScroll(params);
  50591. }
  50592. function scrollToTop(scrollTop) {
  50593. scrollPos.value.scrollTop = scrollTop;
  50594. doScroll(vue.unref(scrollPos));
  50595. }
  50596. function scrollToLeft(scrollLeft) {
  50597. var _a, _b;
  50598. scrollPos.value.scrollLeft = scrollLeft;
  50599. (_b = (_a = mainTableRef.value) == null ? void 0 : _a.scrollTo) == null ? void 0 : _b.call(_a, vue.unref(scrollPos));
  50600. }
  50601. function onScroll(params) {
  50602. var _a;
  50603. scrollTo(params);
  50604. (_a = props.onScroll) == null ? void 0 : _a.call(props, params);
  50605. }
  50606. function onVerticalScroll({ scrollTop }) {
  50607. const { scrollTop: currentScrollTop } = vue.unref(scrollPos);
  50608. if (scrollTop !== currentScrollTop)
  50609. scrollToTop(scrollTop);
  50610. }
  50611. function scrollToRow(row, strategy = "auto") {
  50612. var _a;
  50613. (_a = mainTableRef.value) == null ? void 0 : _a.scrollToRow(row, strategy);
  50614. }
  50615. vue.watch(() => vue.unref(scrollPos).scrollTop, (cur, prev) => {
  50616. if (cur > prev)
  50617. onMaybeEndReached();
  50618. });
  50619. return {
  50620. scrollPos,
  50621. scrollTo,
  50622. scrollToLeft,
  50623. scrollToTop,
  50624. scrollToRow,
  50625. onScroll,
  50626. onVerticalScroll
  50627. };
  50628. };
  50629. const useRow = (props, {
  50630. mainTableRef,
  50631. leftTableRef,
  50632. rightTableRef,
  50633. tableInstance,
  50634. ns,
  50635. isScrolling
  50636. }) => {
  50637. const vm = vue.getCurrentInstance();
  50638. const { emit } = vm;
  50639. const isResetting = vue.shallowRef(false);
  50640. const expandedRowKeys = vue.ref(props.defaultExpandedRowKeys || []);
  50641. const lastRenderedRowIndex = vue.ref(-1);
  50642. const resetIndex = vue.shallowRef(null);
  50643. const rowHeights = vue.ref({});
  50644. const pendingRowHeights = vue.ref({});
  50645. const leftTableHeights = vue.shallowRef({});
  50646. const mainTableHeights = vue.shallowRef({});
  50647. const rightTableHeights = vue.shallowRef({});
  50648. const isDynamic = vue.computed(() => isNumber(props.estimatedRowHeight));
  50649. function onRowsRendered(params) {
  50650. var _a;
  50651. (_a = props.onRowsRendered) == null ? void 0 : _a.call(props, params);
  50652. if (params.rowCacheEnd > vue.unref(lastRenderedRowIndex)) {
  50653. lastRenderedRowIndex.value = params.rowCacheEnd;
  50654. }
  50655. }
  50656. function onRowHovered({ hovered, rowKey }) {
  50657. if (isScrolling.value) {
  50658. return;
  50659. }
  50660. const tableRoot = tableInstance.vnode.el;
  50661. const rows = tableRoot.querySelectorAll(`[rowkey="${String(rowKey)}"]`);
  50662. rows.forEach((row) => {
  50663. if (hovered) {
  50664. row.classList.add(ns.is("hovered"));
  50665. } else {
  50666. row.classList.remove(ns.is("hovered"));
  50667. }
  50668. });
  50669. }
  50670. function onRowExpanded({
  50671. expanded,
  50672. rowData,
  50673. rowIndex,
  50674. rowKey
  50675. }) {
  50676. var _a, _b;
  50677. const _expandedRowKeys = [...vue.unref(expandedRowKeys)];
  50678. const currentKeyIndex = _expandedRowKeys.indexOf(rowKey);
  50679. if (expanded) {
  50680. if (currentKeyIndex === -1)
  50681. _expandedRowKeys.push(rowKey);
  50682. } else {
  50683. if (currentKeyIndex > -1)
  50684. _expandedRowKeys.splice(currentKeyIndex, 1);
  50685. }
  50686. expandedRowKeys.value = _expandedRowKeys;
  50687. emit("update:expandedRowKeys", _expandedRowKeys);
  50688. (_a = props.onRowExpand) == null ? void 0 : _a.call(props, {
  50689. expanded,
  50690. rowData,
  50691. rowIndex,
  50692. rowKey
  50693. });
  50694. (_b = props.onExpandedRowsChange) == null ? void 0 : _b.call(props, _expandedRowKeys);
  50695. const tableRoot = tableInstance.vnode.el;
  50696. const hoverRow = tableRoot.querySelector(`.${ns.is("hovered")}[rowkey="${String(rowKey)}"]`);
  50697. if (hoverRow) {
  50698. vue.nextTick(() => onRowHovered({ hovered: true, rowKey }));
  50699. }
  50700. }
  50701. const flushingRowHeights = debounce(() => {
  50702. var _a, _b, _c, _d;
  50703. isResetting.value = true;
  50704. rowHeights.value = { ...vue.unref(rowHeights), ...vue.unref(pendingRowHeights) };
  50705. resetAfterIndex(vue.unref(resetIndex), false);
  50706. pendingRowHeights.value = {};
  50707. resetIndex.value = null;
  50708. (_a = mainTableRef.value) == null ? void 0 : _a.forceUpdate();
  50709. (_b = leftTableRef.value) == null ? void 0 : _b.forceUpdate();
  50710. (_c = rightTableRef.value) == null ? void 0 : _c.forceUpdate();
  50711. (_d = vm.proxy) == null ? void 0 : _d.$forceUpdate();
  50712. isResetting.value = false;
  50713. }, 0);
  50714. function resetAfterIndex(index, forceUpdate = false) {
  50715. if (!vue.unref(isDynamic))
  50716. return;
  50717. [mainTableRef, leftTableRef, rightTableRef].forEach((tableRef) => {
  50718. const table = vue.unref(tableRef);
  50719. if (table)
  50720. table.resetAfterRowIndex(index, forceUpdate);
  50721. });
  50722. }
  50723. function resetHeights(rowKey, height, rowIdx) {
  50724. const resetIdx = vue.unref(resetIndex);
  50725. if (resetIdx === null) {
  50726. resetIndex.value = rowIdx;
  50727. } else {
  50728. if (resetIdx > rowIdx) {
  50729. resetIndex.value = rowIdx;
  50730. }
  50731. }
  50732. pendingRowHeights.value[rowKey] = height;
  50733. }
  50734. function onRowHeightChange({ rowKey, height, rowIndex }, fixedDir) {
  50735. if (!fixedDir) {
  50736. mainTableHeights.value[rowKey] = height;
  50737. } else {
  50738. if (fixedDir === FixedDir.RIGHT) {
  50739. rightTableHeights.value[rowKey] = height;
  50740. } else {
  50741. leftTableHeights.value[rowKey] = height;
  50742. }
  50743. }
  50744. const maximumHeight = Math.max(...[leftTableHeights, rightTableHeights, mainTableHeights].map((records) => records.value[rowKey] || 0));
  50745. if (vue.unref(rowHeights)[rowKey] !== maximumHeight) {
  50746. resetHeights(rowKey, maximumHeight, rowIndex);
  50747. flushingRowHeights();
  50748. }
  50749. }
  50750. return {
  50751. expandedRowKeys,
  50752. lastRenderedRowIndex,
  50753. isDynamic,
  50754. isResetting,
  50755. rowHeights,
  50756. resetAfterIndex,
  50757. onRowExpanded,
  50758. onRowHovered,
  50759. onRowsRendered,
  50760. onRowHeightChange
  50761. };
  50762. };
  50763. const useData = (props, { expandedRowKeys, lastRenderedRowIndex, resetAfterIndex }) => {
  50764. const depthMap = vue.ref({});
  50765. const flattenedData = vue.computed(() => {
  50766. const depths = {};
  50767. const { data: data2, rowKey } = props;
  50768. const _expandedRowKeys = vue.unref(expandedRowKeys);
  50769. if (!_expandedRowKeys || !_expandedRowKeys.length)
  50770. return data2;
  50771. const array = [];
  50772. const keysSet = /* @__PURE__ */ new Set();
  50773. _expandedRowKeys.forEach((x) => keysSet.add(x));
  50774. let copy = data2.slice();
  50775. copy.forEach((x) => depths[x[rowKey]] = 0);
  50776. while (copy.length > 0) {
  50777. const item = copy.shift();
  50778. array.push(item);
  50779. if (keysSet.has(item[rowKey]) && isArray$1(item.children) && item.children.length > 0) {
  50780. copy = [...item.children, ...copy];
  50781. item.children.forEach((child) => depths[child[rowKey]] = depths[item[rowKey]] + 1);
  50782. }
  50783. }
  50784. depthMap.value = depths;
  50785. return array;
  50786. });
  50787. const data = vue.computed(() => {
  50788. const { data: data2, expandColumnKey } = props;
  50789. return expandColumnKey ? vue.unref(flattenedData) : data2;
  50790. });
  50791. vue.watch(data, (val, prev) => {
  50792. if (val !== prev) {
  50793. lastRenderedRowIndex.value = -1;
  50794. resetAfterIndex(0, true);
  50795. }
  50796. });
  50797. return {
  50798. data,
  50799. depthMap
  50800. };
  50801. };
  50802. const sumReducer = (sum2, num) => sum2 + num;
  50803. const sum = (listLike) => {
  50804. return isArray$1(listLike) ? listLike.reduce(sumReducer, 0) : listLike;
  50805. };
  50806. const tryCall = (fLike, params, defaultRet = {}) => {
  50807. return isFunction$1(fLike) ? fLike(params) : fLike != null ? fLike : defaultRet;
  50808. };
  50809. const enforceUnit = (style) => {
  50810. ["width", "maxWidth", "minWidth", "height"].forEach((key) => {
  50811. style[key] = addUnit(style[key]);
  50812. });
  50813. return style;
  50814. };
  50815. const componentToSlot = (ComponentLike) => vue.isVNode(ComponentLike) ? (props) => vue.h(ComponentLike, props) : ComponentLike;
  50816. const useStyles = (props, {
  50817. columnsTotalWidth,
  50818. rowsHeight,
  50819. fixedColumnsOnLeft,
  50820. fixedColumnsOnRight
  50821. }) => {
  50822. const bodyWidth = vue.computed(() => {
  50823. const { fixed, width, vScrollbarSize } = props;
  50824. const ret = width - vScrollbarSize;
  50825. return fixed ? Math.max(Math.round(vue.unref(columnsTotalWidth)), ret) : ret;
  50826. });
  50827. const mainTableHeight = vue.computed(() => {
  50828. const { height = 0, maxHeight = 0, footerHeight: footerHeight2, hScrollbarSize } = props;
  50829. if (maxHeight > 0) {
  50830. const _fixedRowsHeight = vue.unref(fixedRowsHeight);
  50831. const _rowsHeight = vue.unref(rowsHeight);
  50832. const _headerHeight = vue.unref(headerHeight);
  50833. const total = _headerHeight + _fixedRowsHeight + _rowsHeight + hScrollbarSize;
  50834. return Math.min(total, maxHeight - footerHeight2);
  50835. }
  50836. return height - footerHeight2;
  50837. });
  50838. const fixedTableHeight = vue.computed(() => {
  50839. const { maxHeight } = props;
  50840. const tableHeight = vue.unref(mainTableHeight);
  50841. if (isNumber(maxHeight) && maxHeight > 0)
  50842. return tableHeight;
  50843. const totalHeight = vue.unref(rowsHeight) + vue.unref(headerHeight) + vue.unref(fixedRowsHeight);
  50844. return Math.min(tableHeight, totalHeight);
  50845. });
  50846. const mapColumn = (column) => column.width;
  50847. const leftTableWidth = vue.computed(() => sum(vue.unref(fixedColumnsOnLeft).map(mapColumn)));
  50848. const rightTableWidth = vue.computed(() => sum(vue.unref(fixedColumnsOnRight).map(mapColumn)));
  50849. const headerHeight = vue.computed(() => sum(props.headerHeight));
  50850. const fixedRowsHeight = vue.computed(() => {
  50851. var _a;
  50852. return (((_a = props.fixedData) == null ? void 0 : _a.length) || 0) * props.rowHeight;
  50853. });
  50854. const windowHeight = vue.computed(() => {
  50855. return vue.unref(mainTableHeight) - vue.unref(headerHeight) - vue.unref(fixedRowsHeight);
  50856. });
  50857. const rootStyle = vue.computed(() => {
  50858. const { style = {}, height, width } = props;
  50859. return enforceUnit({
  50860. ...style,
  50861. height,
  50862. width
  50863. });
  50864. });
  50865. const footerHeight = vue.computed(() => enforceUnit({ height: props.footerHeight }));
  50866. const emptyStyle = vue.computed(() => ({
  50867. top: addUnit(vue.unref(headerHeight)),
  50868. bottom: addUnit(props.footerHeight),
  50869. width: addUnit(props.width)
  50870. }));
  50871. return {
  50872. bodyWidth,
  50873. fixedTableHeight,
  50874. mainTableHeight,
  50875. leftTableWidth,
  50876. rightTableWidth,
  50877. windowHeight,
  50878. footerHeight,
  50879. emptyStyle,
  50880. rootStyle,
  50881. headerHeight
  50882. };
  50883. };
  50884. const useAutoResize = (props) => {
  50885. const sizer = vue.ref();
  50886. const width$ = vue.ref(0);
  50887. const height$ = vue.ref(0);
  50888. let resizerStopper;
  50889. vue.onMounted(() => {
  50890. resizerStopper = useResizeObserver(sizer, ([entry]) => {
  50891. const { width, height } = entry.contentRect;
  50892. const { paddingLeft, paddingRight, paddingTop, paddingBottom } = getComputedStyle(entry.target);
  50893. const left = Number.parseInt(paddingLeft) || 0;
  50894. const right = Number.parseInt(paddingRight) || 0;
  50895. const top = Number.parseInt(paddingTop) || 0;
  50896. const bottom = Number.parseInt(paddingBottom) || 0;
  50897. width$.value = width - left - right;
  50898. height$.value = height - top - bottom;
  50899. }).stop;
  50900. });
  50901. vue.onBeforeUnmount(() => {
  50902. resizerStopper == null ? void 0 : resizerStopper();
  50903. });
  50904. vue.watch([width$, height$], ([width, height]) => {
  50905. var _a;
  50906. (_a = props.onResize) == null ? void 0 : _a.call(props, {
  50907. width,
  50908. height
  50909. });
  50910. });
  50911. return {
  50912. sizer,
  50913. width: width$,
  50914. height: height$
  50915. };
  50916. };
  50917. function useTable(props) {
  50918. const mainTableRef = vue.ref();
  50919. const leftTableRef = vue.ref();
  50920. const rightTableRef = vue.ref();
  50921. const {
  50922. columns,
  50923. columnsStyles,
  50924. columnsTotalWidth,
  50925. fixedColumnsOnLeft,
  50926. fixedColumnsOnRight,
  50927. hasFixedColumns,
  50928. mainColumns,
  50929. onColumnSorted
  50930. } = useColumns(props, vue.toRef(props, "columns"), vue.toRef(props, "fixed"));
  50931. const {
  50932. scrollTo,
  50933. scrollToLeft,
  50934. scrollToTop,
  50935. scrollToRow,
  50936. onScroll,
  50937. onVerticalScroll,
  50938. scrollPos
  50939. } = useScrollbar(props, {
  50940. mainTableRef,
  50941. leftTableRef,
  50942. rightTableRef,
  50943. onMaybeEndReached
  50944. });
  50945. const ns = useNamespace("table-v2");
  50946. const instance = vue.getCurrentInstance();
  50947. const isScrolling = vue.shallowRef(false);
  50948. const {
  50949. expandedRowKeys,
  50950. lastRenderedRowIndex,
  50951. isDynamic,
  50952. isResetting,
  50953. rowHeights,
  50954. resetAfterIndex,
  50955. onRowExpanded,
  50956. onRowHeightChange,
  50957. onRowHovered,
  50958. onRowsRendered
  50959. } = useRow(props, {
  50960. mainTableRef,
  50961. leftTableRef,
  50962. rightTableRef,
  50963. tableInstance: instance,
  50964. ns,
  50965. isScrolling
  50966. });
  50967. const { data, depthMap } = useData(props, {
  50968. expandedRowKeys,
  50969. lastRenderedRowIndex,
  50970. resetAfterIndex
  50971. });
  50972. const rowsHeight = vue.computed(() => {
  50973. const { estimatedRowHeight, rowHeight } = props;
  50974. const _data = vue.unref(data);
  50975. if (isNumber(estimatedRowHeight)) {
  50976. return Object.values(vue.unref(rowHeights)).reduce((acc, curr) => acc + curr, 0);
  50977. }
  50978. return _data.length * rowHeight;
  50979. });
  50980. const {
  50981. bodyWidth,
  50982. fixedTableHeight,
  50983. mainTableHeight,
  50984. leftTableWidth,
  50985. rightTableWidth,
  50986. windowHeight,
  50987. footerHeight,
  50988. emptyStyle,
  50989. rootStyle,
  50990. headerHeight
  50991. } = useStyles(props, {
  50992. columnsTotalWidth,
  50993. fixedColumnsOnLeft,
  50994. fixedColumnsOnRight,
  50995. rowsHeight
  50996. });
  50997. const containerRef = vue.ref();
  50998. const showEmpty = vue.computed(() => {
  50999. const noData = vue.unref(data).length === 0;
  51000. return isArray$1(props.fixedData) ? props.fixedData.length === 0 && noData : noData;
  51001. });
  51002. function getRowHeight(rowIndex) {
  51003. const { estimatedRowHeight, rowHeight, rowKey } = props;
  51004. if (!estimatedRowHeight)
  51005. return rowHeight;
  51006. return vue.unref(rowHeights)[vue.unref(data)[rowIndex][rowKey]] || estimatedRowHeight;
  51007. }
  51008. const isEndReached = vue.ref(false);
  51009. function onMaybeEndReached() {
  51010. const { onEndReached } = props;
  51011. if (!onEndReached)
  51012. return;
  51013. const { scrollTop } = vue.unref(scrollPos);
  51014. const _totalHeight = vue.unref(rowsHeight);
  51015. const clientHeight = vue.unref(windowHeight);
  51016. const remainDistance = _totalHeight - (scrollTop + clientHeight) + props.hScrollbarSize;
  51017. if (!isEndReached.value && vue.unref(lastRenderedRowIndex) >= 0 && _totalHeight <= scrollTop + vue.unref(mainTableHeight) - vue.unref(headerHeight)) {
  51018. isEndReached.value = true;
  51019. onEndReached(remainDistance);
  51020. } else {
  51021. isEndReached.value = false;
  51022. }
  51023. }
  51024. vue.watch(() => vue.unref(rowsHeight), () => isEndReached.value = false);
  51025. vue.watch(() => props.expandedRowKeys, (val) => expandedRowKeys.value = val, {
  51026. deep: true
  51027. });
  51028. return {
  51029. columns,
  51030. containerRef,
  51031. mainTableRef,
  51032. leftTableRef,
  51033. rightTableRef,
  51034. isDynamic,
  51035. isResetting,
  51036. isScrolling,
  51037. hasFixedColumns,
  51038. columnsStyles,
  51039. columnsTotalWidth,
  51040. data,
  51041. expandedRowKeys,
  51042. depthMap,
  51043. fixedColumnsOnLeft,
  51044. fixedColumnsOnRight,
  51045. mainColumns,
  51046. bodyWidth,
  51047. emptyStyle,
  51048. rootStyle,
  51049. footerHeight,
  51050. mainTableHeight,
  51051. fixedTableHeight,
  51052. leftTableWidth,
  51053. rightTableWidth,
  51054. showEmpty,
  51055. getRowHeight,
  51056. onColumnSorted,
  51057. onRowHovered,
  51058. onRowExpanded,
  51059. onRowsRendered,
  51060. onRowHeightChange,
  51061. scrollTo,
  51062. scrollToLeft,
  51063. scrollToTop,
  51064. scrollToRow,
  51065. onScroll,
  51066. onVerticalScroll
  51067. };
  51068. }
  51069. const TableV2InjectionKey = Symbol("tableV2");
  51070. const TABLE_V2_GRID_INJECTION_KEY = "tableV2GridScrollLeft";
  51071. const classType = String;
  51072. const columns = {
  51073. type: definePropType(Array),
  51074. required: true
  51075. };
  51076. const fixedDataType = {
  51077. type: definePropType(Array)
  51078. };
  51079. const dataType = {
  51080. ...fixedDataType,
  51081. required: true
  51082. };
  51083. const expandColumnKey = String;
  51084. const expandKeys = {
  51085. type: definePropType(Array),
  51086. default: () => mutable([])
  51087. };
  51088. const requiredNumber = {
  51089. type: Number,
  51090. required: true
  51091. };
  51092. const rowKey = {
  51093. type: definePropType([String, Number, Symbol]),
  51094. default: "id"
  51095. };
  51096. const styleType = {
  51097. type: definePropType(Object)
  51098. };
  51099. const tableV2RowProps = buildProps({
  51100. class: String,
  51101. columns,
  51102. columnsStyles: {
  51103. type: definePropType(Object),
  51104. required: true
  51105. },
  51106. depth: Number,
  51107. expandColumnKey,
  51108. estimatedRowHeight: {
  51109. ...virtualizedGridProps.estimatedRowHeight,
  51110. default: void 0
  51111. },
  51112. isScrolling: Boolean,
  51113. onRowExpand: {
  51114. type: definePropType(Function)
  51115. },
  51116. onRowHover: {
  51117. type: definePropType(Function)
  51118. },
  51119. onRowHeightChange: {
  51120. type: definePropType(Function)
  51121. },
  51122. rowData: {
  51123. type: definePropType(Object),
  51124. required: true
  51125. },
  51126. rowEventHandlers: {
  51127. type: definePropType(Object)
  51128. },
  51129. rowIndex: {
  51130. type: Number,
  51131. required: true
  51132. },
  51133. rowKey,
  51134. style: {
  51135. type: definePropType(Object)
  51136. }
  51137. });
  51138. const requiredNumberType = {
  51139. type: Number,
  51140. required: true
  51141. };
  51142. const tableV2HeaderProps = buildProps({
  51143. class: String,
  51144. columns,
  51145. fixedHeaderData: {
  51146. type: definePropType(Array)
  51147. },
  51148. headerData: {
  51149. type: definePropType(Array),
  51150. required: true
  51151. },
  51152. headerHeight: {
  51153. type: definePropType([Number, Array]),
  51154. default: 50
  51155. },
  51156. rowWidth: requiredNumberType,
  51157. rowHeight: {
  51158. type: Number,
  51159. default: 50
  51160. },
  51161. height: requiredNumberType,
  51162. width: requiredNumberType
  51163. });
  51164. const tableV2GridProps = buildProps({
  51165. columns,
  51166. data: dataType,
  51167. fixedData: fixedDataType,
  51168. estimatedRowHeight: tableV2RowProps.estimatedRowHeight,
  51169. width: requiredNumber,
  51170. height: requiredNumber,
  51171. headerWidth: requiredNumber,
  51172. headerHeight: tableV2HeaderProps.headerHeight,
  51173. bodyWidth: requiredNumber,
  51174. rowHeight: requiredNumber,
  51175. cache: virtualizedListProps.cache,
  51176. useIsScrolling: Boolean,
  51177. scrollbarAlwaysOn: virtualizedGridProps.scrollbarAlwaysOn,
  51178. scrollbarStartGap: virtualizedGridProps.scrollbarStartGap,
  51179. scrollbarEndGap: virtualizedGridProps.scrollbarEndGap,
  51180. class: classType,
  51181. style: styleType,
  51182. containerStyle: styleType,
  51183. getRowHeight: {
  51184. type: definePropType(Function),
  51185. required: true
  51186. },
  51187. rowKey: tableV2RowProps.rowKey,
  51188. onRowsRendered: {
  51189. type: definePropType(Function)
  51190. },
  51191. onScroll: {
  51192. type: definePropType(Function)
  51193. }
  51194. });
  51195. const tableV2Props = buildProps({
  51196. cache: tableV2GridProps.cache,
  51197. estimatedRowHeight: tableV2RowProps.estimatedRowHeight,
  51198. rowKey,
  51199. headerClass: {
  51200. type: definePropType([
  51201. String,
  51202. Function
  51203. ])
  51204. },
  51205. headerProps: {
  51206. type: definePropType([
  51207. Object,
  51208. Function
  51209. ])
  51210. },
  51211. headerCellProps: {
  51212. type: definePropType([
  51213. Object,
  51214. Function
  51215. ])
  51216. },
  51217. headerHeight: tableV2HeaderProps.headerHeight,
  51218. footerHeight: {
  51219. type: Number,
  51220. default: 0
  51221. },
  51222. rowClass: {
  51223. type: definePropType([String, Function])
  51224. },
  51225. rowProps: {
  51226. type: definePropType([Object, Function])
  51227. },
  51228. rowHeight: {
  51229. type: Number,
  51230. default: 50
  51231. },
  51232. cellProps: {
  51233. type: definePropType([
  51234. Object,
  51235. Function
  51236. ])
  51237. },
  51238. columns,
  51239. data: dataType,
  51240. dataGetter: {
  51241. type: definePropType(Function)
  51242. },
  51243. fixedData: fixedDataType,
  51244. expandColumnKey: tableV2RowProps.expandColumnKey,
  51245. expandedRowKeys: expandKeys,
  51246. defaultExpandedRowKeys: expandKeys,
  51247. class: classType,
  51248. fixed: Boolean,
  51249. style: {
  51250. type: definePropType(Object)
  51251. },
  51252. width: requiredNumber,
  51253. height: requiredNumber,
  51254. maxHeight: Number,
  51255. useIsScrolling: Boolean,
  51256. indentSize: {
  51257. type: Number,
  51258. default: 12
  51259. },
  51260. iconSize: {
  51261. type: Number,
  51262. default: 12
  51263. },
  51264. hScrollbarSize: virtualizedGridProps.hScrollbarSize,
  51265. vScrollbarSize: virtualizedGridProps.vScrollbarSize,
  51266. scrollbarAlwaysOn: virtualizedScrollbarProps.alwaysOn,
  51267. sortBy: {
  51268. type: definePropType(Object),
  51269. default: () => ({})
  51270. },
  51271. sortState: {
  51272. type: definePropType(Object),
  51273. default: void 0
  51274. },
  51275. onColumnSort: {
  51276. type: definePropType(Function)
  51277. },
  51278. onExpandedRowsChange: {
  51279. type: definePropType(Function)
  51280. },
  51281. onEndReached: {
  51282. type: definePropType(Function)
  51283. },
  51284. onRowExpand: tableV2RowProps.onRowExpand,
  51285. onScroll: tableV2GridProps.onScroll,
  51286. onRowsRendered: tableV2GridProps.onRowsRendered,
  51287. rowEventHandlers: tableV2RowProps.rowEventHandlers
  51288. });
  51289. const TableV2Cell = (props, {
  51290. slots
  51291. }) => {
  51292. var _a;
  51293. const {
  51294. cellData,
  51295. style
  51296. } = props;
  51297. const displayText = ((_a = cellData == null ? void 0 : cellData.toString) == null ? void 0 : _a.call(cellData)) || "";
  51298. const defaultSlot = vue.renderSlot(slots, "default", props, () => [displayText]);
  51299. return vue.createVNode("div", {
  51300. "class": props.class,
  51301. "title": displayText,
  51302. "style": style
  51303. }, [defaultSlot]);
  51304. };
  51305. TableV2Cell.displayName = "ElTableV2Cell";
  51306. TableV2Cell.inheritAttrs = false;
  51307. var TableCell = TableV2Cell;
  51308. const HeaderCell = (props, {
  51309. slots
  51310. }) => vue.renderSlot(slots, "default", props, () => {
  51311. var _a, _b;
  51312. return [vue.createVNode("div", {
  51313. "class": props.class,
  51314. "title": (_a = props.column) == null ? void 0 : _a.title
  51315. }, [(_b = props.column) == null ? void 0 : _b.title])];
  51316. });
  51317. HeaderCell.displayName = "ElTableV2HeaderCell";
  51318. HeaderCell.inheritAttrs = false;
  51319. var HeaderCell$1 = HeaderCell;
  51320. const tableV2HeaderRowProps = buildProps({
  51321. class: String,
  51322. columns,
  51323. columnsStyles: {
  51324. type: definePropType(Object),
  51325. required: true
  51326. },
  51327. headerIndex: Number,
  51328. style: { type: definePropType(Object) }
  51329. });
  51330. const TableV2HeaderRow = vue.defineComponent({
  51331. name: "ElTableV2HeaderRow",
  51332. props: tableV2HeaderRowProps,
  51333. setup(props, {
  51334. slots
  51335. }) {
  51336. return () => {
  51337. const {
  51338. columns,
  51339. columnsStyles,
  51340. headerIndex,
  51341. style
  51342. } = props;
  51343. let Cells = columns.map((column, columnIndex) => {
  51344. return slots.cell({
  51345. columns,
  51346. column,
  51347. columnIndex,
  51348. headerIndex,
  51349. style: columnsStyles[column.key]
  51350. });
  51351. });
  51352. if (slots.header) {
  51353. Cells = slots.header({
  51354. cells: Cells.map((node) => {
  51355. if (isArray$1(node) && node.length === 1) {
  51356. return node[0];
  51357. }
  51358. return node;
  51359. }),
  51360. columns,
  51361. headerIndex
  51362. });
  51363. }
  51364. return vue.createVNode("div", {
  51365. "class": props.class,
  51366. "style": style,
  51367. "role": "row"
  51368. }, [Cells]);
  51369. };
  51370. }
  51371. });
  51372. var HeaderRow = TableV2HeaderRow;
  51373. const COMPONENT_NAME$8 = "ElTableV2Header";
  51374. const TableV2Header = vue.defineComponent({
  51375. name: COMPONENT_NAME$8,
  51376. props: tableV2HeaderProps,
  51377. setup(props, {
  51378. slots,
  51379. expose
  51380. }) {
  51381. const ns = useNamespace("table-v2");
  51382. const scrollLeftInfo = vue.inject(TABLE_V2_GRID_INJECTION_KEY);
  51383. const headerRef = vue.ref();
  51384. const headerStyle = vue.computed(() => enforceUnit({
  51385. width: props.width,
  51386. height: props.height
  51387. }));
  51388. const rowStyle = vue.computed(() => enforceUnit({
  51389. width: props.rowWidth,
  51390. height: props.height
  51391. }));
  51392. const headerHeights = vue.computed(() => castArray$1(vue.unref(props.headerHeight)));
  51393. const scrollToLeft = (left) => {
  51394. const headerEl = vue.unref(headerRef);
  51395. vue.nextTick(() => {
  51396. (headerEl == null ? void 0 : headerEl.scroll) && headerEl.scroll({
  51397. left
  51398. });
  51399. });
  51400. };
  51401. const renderFixedRows = () => {
  51402. const fixedRowClassName = ns.e("fixed-header-row");
  51403. const {
  51404. columns,
  51405. fixedHeaderData,
  51406. rowHeight
  51407. } = props;
  51408. return fixedHeaderData == null ? void 0 : fixedHeaderData.map((fixedRowData, fixedRowIndex) => {
  51409. var _a;
  51410. const style = enforceUnit({
  51411. height: rowHeight,
  51412. width: "100%"
  51413. });
  51414. return (_a = slots.fixed) == null ? void 0 : _a.call(slots, {
  51415. class: fixedRowClassName,
  51416. columns,
  51417. rowData: fixedRowData,
  51418. rowIndex: -(fixedRowIndex + 1),
  51419. style
  51420. });
  51421. });
  51422. };
  51423. const renderDynamicRows = () => {
  51424. const dynamicRowClassName = ns.e("dynamic-header-row");
  51425. const {
  51426. columns
  51427. } = props;
  51428. return vue.unref(headerHeights).map((rowHeight, rowIndex) => {
  51429. var _a;
  51430. const style = enforceUnit({
  51431. width: "100%",
  51432. height: rowHeight
  51433. });
  51434. return (_a = slots.dynamic) == null ? void 0 : _a.call(slots, {
  51435. class: dynamicRowClassName,
  51436. columns,
  51437. headerIndex: rowIndex,
  51438. style
  51439. });
  51440. });
  51441. };
  51442. vue.onUpdated(() => {
  51443. if (scrollLeftInfo == null ? void 0 : scrollLeftInfo.value) {
  51444. scrollToLeft(scrollLeftInfo.value);
  51445. }
  51446. });
  51447. expose({
  51448. scrollToLeft
  51449. });
  51450. return () => {
  51451. if (props.height <= 0)
  51452. return;
  51453. return vue.createVNode("div", {
  51454. "ref": headerRef,
  51455. "class": props.class,
  51456. "style": vue.unref(headerStyle),
  51457. "role": "rowgroup"
  51458. }, [vue.createVNode("div", {
  51459. "style": vue.unref(rowStyle),
  51460. "class": ns.e("header")
  51461. }, [renderDynamicRows(), renderFixedRows()])]);
  51462. };
  51463. }
  51464. });
  51465. var Header = TableV2Header;
  51466. const useTableRow = (props) => {
  51467. const {
  51468. isScrolling
  51469. } = vue.inject(TableV2InjectionKey);
  51470. const measured = vue.ref(false);
  51471. const rowRef = vue.ref();
  51472. const measurable = vue.computed(() => {
  51473. return isNumber(props.estimatedRowHeight) && props.rowIndex >= 0;
  51474. });
  51475. const doMeasure = (isInit = false) => {
  51476. const $rowRef = vue.unref(rowRef);
  51477. if (!$rowRef)
  51478. return;
  51479. const {
  51480. columns,
  51481. onRowHeightChange,
  51482. rowKey,
  51483. rowIndex,
  51484. style
  51485. } = props;
  51486. const {
  51487. height
  51488. } = $rowRef.getBoundingClientRect();
  51489. measured.value = true;
  51490. vue.nextTick(() => {
  51491. if (isInit || height !== Number.parseInt(style.height)) {
  51492. const firstColumn = columns[0];
  51493. const isPlaceholder = (firstColumn == null ? void 0 : firstColumn.placeholderSign) === placeholderSign;
  51494. onRowHeightChange == null ? void 0 : onRowHeightChange({
  51495. rowKey,
  51496. height,
  51497. rowIndex
  51498. }, firstColumn && !isPlaceholder && firstColumn.fixed);
  51499. }
  51500. });
  51501. };
  51502. const eventHandlers = vue.computed(() => {
  51503. const {
  51504. rowData,
  51505. rowIndex,
  51506. rowKey,
  51507. onRowHover
  51508. } = props;
  51509. const handlers = props.rowEventHandlers || {};
  51510. const eventHandlers2 = {};
  51511. Object.entries(handlers).forEach(([eventName, handler]) => {
  51512. if (isFunction$1(handler)) {
  51513. eventHandlers2[eventName] = (event) => {
  51514. handler({
  51515. event,
  51516. rowData,
  51517. rowIndex,
  51518. rowKey
  51519. });
  51520. };
  51521. }
  51522. });
  51523. if (onRowHover) {
  51524. [{
  51525. name: "onMouseleave",
  51526. hovered: false
  51527. }, {
  51528. name: "onMouseenter",
  51529. hovered: true
  51530. }].forEach(({
  51531. name,
  51532. hovered
  51533. }) => {
  51534. const existedHandler = eventHandlers2[name];
  51535. eventHandlers2[name] = (event) => {
  51536. onRowHover({
  51537. event,
  51538. hovered,
  51539. rowData,
  51540. rowIndex,
  51541. rowKey
  51542. });
  51543. existedHandler == null ? void 0 : existedHandler(event);
  51544. };
  51545. });
  51546. }
  51547. return eventHandlers2;
  51548. });
  51549. const onExpand = (expanded) => {
  51550. const {
  51551. onRowExpand,
  51552. rowData,
  51553. rowIndex,
  51554. rowKey
  51555. } = props;
  51556. onRowExpand == null ? void 0 : onRowExpand({
  51557. expanded,
  51558. rowData,
  51559. rowIndex,
  51560. rowKey
  51561. });
  51562. };
  51563. vue.onMounted(() => {
  51564. if (vue.unref(measurable)) {
  51565. doMeasure(true);
  51566. }
  51567. });
  51568. return {
  51569. isScrolling,
  51570. measurable,
  51571. measured,
  51572. rowRef,
  51573. eventHandlers,
  51574. onExpand
  51575. };
  51576. };
  51577. const COMPONENT_NAME$7 = "ElTableV2TableRow";
  51578. const TableV2Row = vue.defineComponent({
  51579. name: COMPONENT_NAME$7,
  51580. props: tableV2RowProps,
  51581. setup(props, {
  51582. expose,
  51583. slots,
  51584. attrs
  51585. }) {
  51586. const {
  51587. eventHandlers,
  51588. isScrolling,
  51589. measurable,
  51590. measured,
  51591. rowRef,
  51592. onExpand
  51593. } = useTableRow(props);
  51594. expose({
  51595. onExpand
  51596. });
  51597. return () => {
  51598. const {
  51599. columns,
  51600. columnsStyles,
  51601. expandColumnKey,
  51602. depth,
  51603. rowData,
  51604. rowIndex,
  51605. style
  51606. } = props;
  51607. let ColumnCells = columns.map((column, columnIndex) => {
  51608. const expandable = isArray$1(rowData.children) && rowData.children.length > 0 && column.key === expandColumnKey;
  51609. return slots.cell({
  51610. column,
  51611. columns,
  51612. columnIndex,
  51613. depth,
  51614. style: columnsStyles[column.key],
  51615. rowData,
  51616. rowIndex,
  51617. isScrolling: vue.unref(isScrolling),
  51618. expandIconProps: expandable ? {
  51619. rowData,
  51620. rowIndex,
  51621. onExpand
  51622. } : void 0
  51623. });
  51624. });
  51625. if (slots.row) {
  51626. ColumnCells = slots.row({
  51627. cells: ColumnCells.map((node) => {
  51628. if (isArray$1(node) && node.length === 1) {
  51629. return node[0];
  51630. }
  51631. return node;
  51632. }),
  51633. style,
  51634. columns,
  51635. depth,
  51636. rowData,
  51637. rowIndex,
  51638. isScrolling: vue.unref(isScrolling)
  51639. });
  51640. }
  51641. if (vue.unref(measurable)) {
  51642. const {
  51643. height,
  51644. ...exceptHeightStyle
  51645. } = style || {};
  51646. const _measured = vue.unref(measured);
  51647. return vue.createVNode("div", vue.mergeProps({
  51648. "ref": rowRef,
  51649. "class": props.class,
  51650. "style": _measured ? style : exceptHeightStyle,
  51651. "role": "row"
  51652. }, attrs, vue.unref(eventHandlers)), [ColumnCells]);
  51653. }
  51654. return vue.createVNode("div", vue.mergeProps(attrs, {
  51655. "ref": rowRef,
  51656. "class": props.class,
  51657. "style": style,
  51658. "role": "row"
  51659. }, vue.unref(eventHandlers)), [ColumnCells]);
  51660. };
  51661. }
  51662. });
  51663. var Row = TableV2Row;
  51664. const SortIcon = (props) => {
  51665. const {
  51666. sortOrder
  51667. } = props;
  51668. return vue.createVNode(ElIcon, {
  51669. "size": 14,
  51670. "class": props.class
  51671. }, {
  51672. default: () => [sortOrder === SortOrder.ASC ? vue.createVNode(sort_up_default, null, null) : vue.createVNode(sort_down_default, null, null)]
  51673. });
  51674. };
  51675. var SortIcon$1 = SortIcon;
  51676. const ExpandIcon = (props) => {
  51677. const {
  51678. expanded,
  51679. expandable,
  51680. onExpand,
  51681. style,
  51682. size
  51683. } = props;
  51684. const expandIconProps = {
  51685. onClick: expandable ? () => onExpand(!expanded) : void 0,
  51686. class: props.class
  51687. };
  51688. return vue.createVNode(ElIcon, vue.mergeProps(expandIconProps, {
  51689. "size": size,
  51690. "style": style
  51691. }), {
  51692. default: () => [vue.createVNode(arrow_right_default, null, null)]
  51693. });
  51694. };
  51695. var ExpandIcon$1 = ExpandIcon;
  51696. const COMPONENT_NAME$6 = "ElTableV2Grid";
  51697. const useTableGrid = (props) => {
  51698. const headerRef = vue.ref();
  51699. const bodyRef = vue.ref();
  51700. const scrollLeft = vue.ref(0);
  51701. const totalHeight = vue.computed(() => {
  51702. const {
  51703. data,
  51704. rowHeight,
  51705. estimatedRowHeight
  51706. } = props;
  51707. if (estimatedRowHeight) {
  51708. return;
  51709. }
  51710. return data.length * rowHeight;
  51711. });
  51712. const fixedRowHeight = vue.computed(() => {
  51713. const {
  51714. fixedData,
  51715. rowHeight
  51716. } = props;
  51717. return ((fixedData == null ? void 0 : fixedData.length) || 0) * rowHeight;
  51718. });
  51719. const headerHeight = vue.computed(() => sum(props.headerHeight));
  51720. const gridHeight = vue.computed(() => {
  51721. const {
  51722. height
  51723. } = props;
  51724. return Math.max(0, height - vue.unref(headerHeight) - vue.unref(fixedRowHeight));
  51725. });
  51726. const hasHeader = vue.computed(() => {
  51727. return vue.unref(headerHeight) + vue.unref(fixedRowHeight) > 0;
  51728. });
  51729. const itemKey = ({
  51730. data,
  51731. rowIndex
  51732. }) => data[rowIndex][props.rowKey];
  51733. function onItemRendered({
  51734. rowCacheStart,
  51735. rowCacheEnd,
  51736. rowVisibleStart,
  51737. rowVisibleEnd
  51738. }) {
  51739. var _a;
  51740. (_a = props.onRowsRendered) == null ? void 0 : _a.call(props, {
  51741. rowCacheStart,
  51742. rowCacheEnd,
  51743. rowVisibleStart,
  51744. rowVisibleEnd
  51745. });
  51746. }
  51747. function resetAfterRowIndex(index, forceUpdate2) {
  51748. var _a;
  51749. (_a = bodyRef.value) == null ? void 0 : _a.resetAfterRowIndex(index, forceUpdate2);
  51750. }
  51751. function scrollTo(leftOrOptions, top) {
  51752. const header$ = vue.unref(headerRef);
  51753. const body$ = vue.unref(bodyRef);
  51754. if (isObject$1(leftOrOptions)) {
  51755. header$ == null ? void 0 : header$.scrollToLeft(leftOrOptions.scrollLeft);
  51756. scrollLeft.value = leftOrOptions.scrollLeft;
  51757. body$ == null ? void 0 : body$.scrollTo(leftOrOptions);
  51758. } else {
  51759. header$ == null ? void 0 : header$.scrollToLeft(leftOrOptions);
  51760. scrollLeft.value = leftOrOptions;
  51761. body$ == null ? void 0 : body$.scrollTo({
  51762. scrollLeft: leftOrOptions,
  51763. scrollTop: top
  51764. });
  51765. }
  51766. }
  51767. function scrollToTop(scrollTop) {
  51768. var _a;
  51769. (_a = vue.unref(bodyRef)) == null ? void 0 : _a.scrollTo({
  51770. scrollTop
  51771. });
  51772. }
  51773. function scrollToRow(row, strategy) {
  51774. var _a;
  51775. (_a = vue.unref(bodyRef)) == null ? void 0 : _a.scrollToItem(row, 1, strategy);
  51776. }
  51777. function forceUpdate() {
  51778. var _a, _b;
  51779. (_a = vue.unref(bodyRef)) == null ? void 0 : _a.$forceUpdate();
  51780. (_b = vue.unref(headerRef)) == null ? void 0 : _b.$forceUpdate();
  51781. }
  51782. vue.watch(() => props.bodyWidth, () => {
  51783. var _a;
  51784. if (isNumber(props.estimatedRowHeight))
  51785. (_a = bodyRef.value) == null ? void 0 : _a.resetAfter({
  51786. columnIndex: 0
  51787. }, false);
  51788. });
  51789. return {
  51790. bodyRef,
  51791. forceUpdate,
  51792. fixedRowHeight,
  51793. gridHeight,
  51794. hasHeader,
  51795. headerHeight,
  51796. headerRef,
  51797. totalHeight,
  51798. itemKey,
  51799. onItemRendered,
  51800. resetAfterRowIndex,
  51801. scrollTo,
  51802. scrollToTop,
  51803. scrollToRow,
  51804. scrollLeft
  51805. };
  51806. };
  51807. const TableGrid = vue.defineComponent({
  51808. name: COMPONENT_NAME$6,
  51809. props: tableV2GridProps,
  51810. setup(props, {
  51811. slots,
  51812. expose
  51813. }) {
  51814. const {
  51815. ns
  51816. } = vue.inject(TableV2InjectionKey);
  51817. const {
  51818. bodyRef,
  51819. fixedRowHeight,
  51820. gridHeight,
  51821. hasHeader,
  51822. headerRef,
  51823. headerHeight,
  51824. totalHeight,
  51825. forceUpdate,
  51826. itemKey,
  51827. onItemRendered,
  51828. resetAfterRowIndex,
  51829. scrollTo,
  51830. scrollToTop,
  51831. scrollToRow,
  51832. scrollLeft
  51833. } = useTableGrid(props);
  51834. vue.provide(TABLE_V2_GRID_INJECTION_KEY, scrollLeft);
  51835. vue.onActivated(async () => {
  51836. var _a;
  51837. await vue.nextTick();
  51838. const scrollTop = (_a = bodyRef.value) == null ? void 0 : _a.states.scrollTop;
  51839. scrollTop && scrollToTop(Math.round(scrollTop) + 1);
  51840. });
  51841. expose({
  51842. forceUpdate,
  51843. totalHeight,
  51844. scrollTo,
  51845. scrollToTop,
  51846. scrollToRow,
  51847. resetAfterRowIndex
  51848. });
  51849. const getColumnWidth = () => props.bodyWidth;
  51850. return () => {
  51851. const {
  51852. cache,
  51853. columns,
  51854. data,
  51855. fixedData,
  51856. useIsScrolling,
  51857. scrollbarAlwaysOn,
  51858. scrollbarEndGap,
  51859. scrollbarStartGap,
  51860. style,
  51861. rowHeight,
  51862. bodyWidth,
  51863. estimatedRowHeight,
  51864. headerWidth,
  51865. height,
  51866. width,
  51867. getRowHeight,
  51868. onScroll
  51869. } = props;
  51870. const isDynamicRowEnabled = isNumber(estimatedRowHeight);
  51871. const Grid = isDynamicRowEnabled ? DynamicSizeGrid$1 : FixedSizeGrid$1;
  51872. const _headerHeight = vue.unref(headerHeight);
  51873. return vue.createVNode("div", {
  51874. "role": "table",
  51875. "class": [ns.e("table"), props.class],
  51876. "style": style
  51877. }, [vue.createVNode(Grid, {
  51878. "ref": bodyRef,
  51879. "data": data,
  51880. "useIsScrolling": useIsScrolling,
  51881. "itemKey": itemKey,
  51882. "columnCache": 0,
  51883. "columnWidth": isDynamicRowEnabled ? getColumnWidth : bodyWidth,
  51884. "totalColumn": 1,
  51885. "totalRow": data.length,
  51886. "rowCache": cache,
  51887. "rowHeight": isDynamicRowEnabled ? getRowHeight : rowHeight,
  51888. "width": width,
  51889. "height": vue.unref(gridHeight),
  51890. "class": ns.e("body"),
  51891. "role": "rowgroup",
  51892. "scrollbarStartGap": scrollbarStartGap,
  51893. "scrollbarEndGap": scrollbarEndGap,
  51894. "scrollbarAlwaysOn": scrollbarAlwaysOn,
  51895. "onScroll": onScroll,
  51896. "onItemRendered": onItemRendered,
  51897. "perfMode": false
  51898. }, {
  51899. default: (params) => {
  51900. var _a;
  51901. const rowData = data[params.rowIndex];
  51902. return (_a = slots.row) == null ? void 0 : _a.call(slots, {
  51903. ...params,
  51904. columns,
  51905. rowData
  51906. });
  51907. }
  51908. }), vue.unref(hasHeader) && vue.createVNode(Header, {
  51909. "ref": headerRef,
  51910. "class": ns.e("header-wrapper"),
  51911. "columns": columns,
  51912. "headerData": data,
  51913. "headerHeight": props.headerHeight,
  51914. "fixedHeaderData": fixedData,
  51915. "rowWidth": headerWidth,
  51916. "rowHeight": rowHeight,
  51917. "width": width,
  51918. "height": Math.min(_headerHeight + vue.unref(fixedRowHeight), height)
  51919. }, {
  51920. dynamic: slots.header,
  51921. fixed: slots.row
  51922. })]);
  51923. };
  51924. }
  51925. });
  51926. function _isSlot$5(s) {
  51927. return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !vue.isVNode(s);
  51928. }
  51929. const MainTable = (props, {
  51930. slots
  51931. }) => {
  51932. const {
  51933. mainTableRef,
  51934. ...rest
  51935. } = props;
  51936. return vue.createVNode(TableGrid, vue.mergeProps({
  51937. "ref": mainTableRef
  51938. }, rest), _isSlot$5(slots) ? slots : {
  51939. default: () => [slots]
  51940. });
  51941. };
  51942. function _isSlot$4(s) {
  51943. return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !vue.isVNode(s);
  51944. }
  51945. const LeftTable = (props, {
  51946. slots
  51947. }) => {
  51948. if (!props.columns.length)
  51949. return;
  51950. const {
  51951. leftTableRef,
  51952. ...rest
  51953. } = props;
  51954. return vue.createVNode(TableGrid, vue.mergeProps({
  51955. "ref": leftTableRef
  51956. }, rest), _isSlot$4(slots) ? slots : {
  51957. default: () => [slots]
  51958. });
  51959. };
  51960. function _isSlot$3(s) {
  51961. return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !vue.isVNode(s);
  51962. }
  51963. const RightTable = (props, {
  51964. slots
  51965. }) => {
  51966. if (!props.columns.length)
  51967. return;
  51968. const {
  51969. rightTableRef,
  51970. ...rest
  51971. } = props;
  51972. return vue.createVNode(TableGrid, vue.mergeProps({
  51973. "ref": rightTableRef
  51974. }, rest), _isSlot$3(slots) ? slots : {
  51975. default: () => [slots]
  51976. });
  51977. };
  51978. function _isSlot$2(s) {
  51979. return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !vue.isVNode(s);
  51980. }
  51981. const RowRenderer = (props, {
  51982. slots
  51983. }) => {
  51984. const {
  51985. columns,
  51986. columnsStyles,
  51987. depthMap,
  51988. expandColumnKey,
  51989. expandedRowKeys,
  51990. estimatedRowHeight,
  51991. hasFixedColumns,
  51992. rowData,
  51993. rowIndex,
  51994. style,
  51995. isScrolling,
  51996. rowProps,
  51997. rowClass,
  51998. rowKey,
  51999. rowEventHandlers,
  52000. ns,
  52001. onRowHovered,
  52002. onRowExpanded
  52003. } = props;
  52004. const rowKls = tryCall(rowClass, {
  52005. columns,
  52006. rowData,
  52007. rowIndex
  52008. }, "");
  52009. const additionalProps = tryCall(rowProps, {
  52010. columns,
  52011. rowData,
  52012. rowIndex
  52013. });
  52014. const _rowKey = rowData[rowKey];
  52015. const depth = depthMap[_rowKey] || 0;
  52016. const canExpand = Boolean(expandColumnKey);
  52017. const isFixedRow = rowIndex < 0;
  52018. const kls = [ns.e("row"), rowKls, ns.is("expanded", canExpand && expandedRowKeys.includes(_rowKey)), ns.is("fixed", !depth && isFixedRow), ns.is("customized", Boolean(slots.row)), {
  52019. [ns.e(`row-depth-${depth}`)]: canExpand && rowIndex >= 0
  52020. }];
  52021. const onRowHover = hasFixedColumns ? onRowHovered : void 0;
  52022. const _rowProps = {
  52023. ...additionalProps,
  52024. columns,
  52025. columnsStyles,
  52026. class: kls,
  52027. depth,
  52028. expandColumnKey,
  52029. estimatedRowHeight: isFixedRow ? void 0 : estimatedRowHeight,
  52030. isScrolling,
  52031. rowIndex,
  52032. rowData,
  52033. rowKey: _rowKey,
  52034. rowEventHandlers,
  52035. style
  52036. };
  52037. const handlerMouseEnter = (e) => {
  52038. onRowHover == null ? void 0 : onRowHover({
  52039. hovered: true,
  52040. rowKey: _rowKey,
  52041. event: e,
  52042. rowData,
  52043. rowIndex
  52044. });
  52045. };
  52046. const handlerMouseLeave = (e) => {
  52047. onRowHover == null ? void 0 : onRowHover({
  52048. hovered: false,
  52049. rowKey: _rowKey,
  52050. event: e,
  52051. rowData,
  52052. rowIndex
  52053. });
  52054. };
  52055. return vue.createVNode(Row, vue.mergeProps(_rowProps, {
  52056. "onRowExpand": onRowExpanded,
  52057. "onMouseenter": handlerMouseEnter,
  52058. "onMouseleave": handlerMouseLeave,
  52059. "rowkey": _rowKey
  52060. }), _isSlot$2(slots) ? slots : {
  52061. default: () => [slots]
  52062. });
  52063. };
  52064. const CellRenderer = ({
  52065. columns,
  52066. column,
  52067. columnIndex,
  52068. depth,
  52069. expandIconProps,
  52070. isScrolling,
  52071. rowData,
  52072. rowIndex,
  52073. style,
  52074. expandedRowKeys,
  52075. ns,
  52076. cellProps: _cellProps,
  52077. expandColumnKey,
  52078. indentSize,
  52079. iconSize,
  52080. rowKey
  52081. }, {
  52082. slots
  52083. }) => {
  52084. const cellStyle = enforceUnit(style);
  52085. if (column.placeholderSign === placeholderSign) {
  52086. return vue.createVNode("div", {
  52087. "class": ns.em("row-cell", "placeholder"),
  52088. "style": cellStyle
  52089. }, null);
  52090. }
  52091. const {
  52092. cellRenderer,
  52093. dataKey,
  52094. dataGetter
  52095. } = column;
  52096. const cellData = isFunction$1(dataGetter) ? dataGetter({
  52097. columns,
  52098. column,
  52099. columnIndex,
  52100. rowData,
  52101. rowIndex
  52102. }) : get(rowData, dataKey != null ? dataKey : "");
  52103. const extraCellProps = tryCall(_cellProps, {
  52104. cellData,
  52105. columns,
  52106. column,
  52107. columnIndex,
  52108. rowIndex,
  52109. rowData
  52110. });
  52111. const cellProps = {
  52112. class: ns.e("cell-text"),
  52113. columns,
  52114. column,
  52115. columnIndex,
  52116. cellData,
  52117. isScrolling,
  52118. rowData,
  52119. rowIndex
  52120. };
  52121. const columnCellRenderer = componentToSlot(cellRenderer);
  52122. const Cell = columnCellRenderer ? columnCellRenderer(cellProps) : vue.renderSlot(slots, "default", cellProps, () => [vue.createVNode(TableCell, cellProps, null)]);
  52123. const kls = [ns.e("row-cell"), column.class, column.align === Alignment.CENTER && ns.is("align-center"), column.align === Alignment.RIGHT && ns.is("align-right")];
  52124. const expandable = rowIndex >= 0 && expandColumnKey && column.key === expandColumnKey;
  52125. const expanded = rowIndex >= 0 && expandedRowKeys.includes(rowData[rowKey]);
  52126. let IconOrPlaceholder;
  52127. const iconStyle = `margin-inline-start: ${depth * indentSize}px;`;
  52128. if (expandable) {
  52129. if (isObject$1(expandIconProps)) {
  52130. IconOrPlaceholder = vue.createVNode(ExpandIcon$1, vue.mergeProps(expandIconProps, {
  52131. "class": [ns.e("expand-icon"), ns.is("expanded", expanded)],
  52132. "size": iconSize,
  52133. "expanded": expanded,
  52134. "style": iconStyle,
  52135. "expandable": true
  52136. }), null);
  52137. } else {
  52138. IconOrPlaceholder = vue.createVNode("div", {
  52139. "style": [iconStyle, `width: ${iconSize}px; height: ${iconSize}px;`].join(" ")
  52140. }, null);
  52141. }
  52142. }
  52143. return vue.createVNode("div", vue.mergeProps({
  52144. "class": kls,
  52145. "style": cellStyle
  52146. }, extraCellProps, {
  52147. "role": "cell"
  52148. }), [IconOrPlaceholder, Cell]);
  52149. };
  52150. CellRenderer.inheritAttrs = false;
  52151. function _isSlot$1(s) {
  52152. return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !vue.isVNode(s);
  52153. }
  52154. const HeaderRenderer = ({
  52155. columns,
  52156. columnsStyles,
  52157. headerIndex,
  52158. style,
  52159. headerClass,
  52160. headerProps,
  52161. ns
  52162. }, {
  52163. slots
  52164. }) => {
  52165. const param = {
  52166. columns,
  52167. headerIndex
  52168. };
  52169. const kls = [ns.e("header-row"), tryCall(headerClass, param, ""), ns.is("customized", Boolean(slots.header))];
  52170. const extraProps = {
  52171. ...tryCall(headerProps, param),
  52172. columnsStyles,
  52173. class: kls,
  52174. columns,
  52175. headerIndex,
  52176. style
  52177. };
  52178. return vue.createVNode(HeaderRow, extraProps, _isSlot$1(slots) ? slots : {
  52179. default: () => [slots]
  52180. });
  52181. };
  52182. const HeaderCellRenderer = (props, {
  52183. slots
  52184. }) => {
  52185. const {
  52186. column,
  52187. ns,
  52188. style,
  52189. onColumnSorted
  52190. } = props;
  52191. const cellStyle = enforceUnit(style);
  52192. if (column.placeholderSign === placeholderSign) {
  52193. return vue.createVNode("div", {
  52194. "class": ns.em("header-row-cell", "placeholder"),
  52195. "style": cellStyle
  52196. }, null);
  52197. }
  52198. const {
  52199. headerCellRenderer,
  52200. headerClass,
  52201. sortable
  52202. } = column;
  52203. const cellProps = {
  52204. ...props,
  52205. class: ns.e("header-cell-text")
  52206. };
  52207. const columnCellRenderer = componentToSlot(headerCellRenderer);
  52208. const Cell = columnCellRenderer ? columnCellRenderer(cellProps) : vue.renderSlot(slots, "default", cellProps, () => [vue.createVNode(HeaderCell$1, cellProps, null)]);
  52209. const {
  52210. sortBy,
  52211. sortState,
  52212. headerCellProps
  52213. } = props;
  52214. let sorting, sortOrder;
  52215. if (sortState) {
  52216. const order = sortState[column.key];
  52217. sorting = Boolean(oppositeOrderMap[order]);
  52218. sortOrder = sorting ? order : SortOrder.ASC;
  52219. } else {
  52220. sorting = column.key === sortBy.key;
  52221. sortOrder = sorting ? sortBy.order : SortOrder.ASC;
  52222. }
  52223. 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")];
  52224. const cellWrapperProps = {
  52225. ...tryCall(headerCellProps, props),
  52226. onClick: column.sortable ? onColumnSorted : void 0,
  52227. class: cellKls,
  52228. style: cellStyle,
  52229. ["data-key"]: column.key
  52230. };
  52231. return vue.createVNode("div", vue.mergeProps(cellWrapperProps, {
  52232. "role": "columnheader"
  52233. }), [Cell, sortable && vue.createVNode(SortIcon$1, {
  52234. "class": [ns.e("sort-icon"), sorting && ns.is("sorting")],
  52235. "sortOrder": sortOrder
  52236. }, null)]);
  52237. };
  52238. const Footer$1 = (props, {
  52239. slots
  52240. }) => {
  52241. var _a;
  52242. return vue.createVNode("div", {
  52243. "class": props.class,
  52244. "style": props.style
  52245. }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
  52246. };
  52247. Footer$1.displayName = "ElTableV2Footer";
  52248. const Footer = (props, {
  52249. slots
  52250. }) => {
  52251. const defaultSlot = vue.renderSlot(slots, "default", {}, () => [vue.createVNode(ElEmpty, null, null)]);
  52252. return vue.createVNode("div", {
  52253. "class": props.class,
  52254. "style": props.style
  52255. }, [defaultSlot]);
  52256. };
  52257. Footer.displayName = "ElTableV2Empty";
  52258. const Overlay = (props, {
  52259. slots
  52260. }) => {
  52261. var _a;
  52262. return vue.createVNode("div", {
  52263. "class": props.class,
  52264. "style": props.style
  52265. }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
  52266. };
  52267. Overlay.displayName = "ElTableV2Overlay";
  52268. function _isSlot(s) {
  52269. return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !vue.isVNode(s);
  52270. }
  52271. const COMPONENT_NAME$5 = "ElTableV2";
  52272. const TableV2 = vue.defineComponent({
  52273. name: COMPONENT_NAME$5,
  52274. props: tableV2Props,
  52275. setup(props, {
  52276. slots,
  52277. expose
  52278. }) {
  52279. const ns = useNamespace("table-v2");
  52280. const {
  52281. columnsStyles,
  52282. fixedColumnsOnLeft,
  52283. fixedColumnsOnRight,
  52284. mainColumns,
  52285. mainTableHeight,
  52286. fixedTableHeight,
  52287. leftTableWidth,
  52288. rightTableWidth,
  52289. data,
  52290. depthMap,
  52291. expandedRowKeys,
  52292. hasFixedColumns,
  52293. mainTableRef,
  52294. leftTableRef,
  52295. rightTableRef,
  52296. isDynamic,
  52297. isResetting,
  52298. isScrolling,
  52299. bodyWidth,
  52300. emptyStyle,
  52301. rootStyle,
  52302. footerHeight,
  52303. showEmpty,
  52304. scrollTo,
  52305. scrollToLeft,
  52306. scrollToTop,
  52307. scrollToRow,
  52308. getRowHeight,
  52309. onColumnSorted,
  52310. onRowHeightChange,
  52311. onRowHovered,
  52312. onRowExpanded,
  52313. onRowsRendered,
  52314. onScroll,
  52315. onVerticalScroll
  52316. } = useTable(props);
  52317. expose({
  52318. scrollTo,
  52319. scrollToLeft,
  52320. scrollToTop,
  52321. scrollToRow
  52322. });
  52323. vue.provide(TableV2InjectionKey, {
  52324. ns,
  52325. isResetting,
  52326. isScrolling
  52327. });
  52328. return () => {
  52329. const {
  52330. cache,
  52331. cellProps,
  52332. estimatedRowHeight,
  52333. expandColumnKey,
  52334. fixedData,
  52335. headerHeight,
  52336. headerClass,
  52337. headerProps,
  52338. headerCellProps,
  52339. sortBy,
  52340. sortState,
  52341. rowHeight,
  52342. rowClass,
  52343. rowEventHandlers,
  52344. rowKey,
  52345. rowProps,
  52346. scrollbarAlwaysOn,
  52347. indentSize,
  52348. iconSize,
  52349. useIsScrolling,
  52350. vScrollbarSize,
  52351. width
  52352. } = props;
  52353. const _data = vue.unref(data);
  52354. const mainTableProps = {
  52355. cache,
  52356. class: ns.e("main"),
  52357. columns: vue.unref(mainColumns),
  52358. data: _data,
  52359. fixedData,
  52360. estimatedRowHeight,
  52361. bodyWidth: vue.unref(bodyWidth),
  52362. headerHeight,
  52363. headerWidth: vue.unref(bodyWidth),
  52364. height: vue.unref(mainTableHeight),
  52365. mainTableRef,
  52366. rowKey,
  52367. rowHeight,
  52368. scrollbarAlwaysOn,
  52369. scrollbarStartGap: 2,
  52370. scrollbarEndGap: vScrollbarSize,
  52371. useIsScrolling,
  52372. width,
  52373. getRowHeight,
  52374. onRowsRendered,
  52375. onScroll
  52376. };
  52377. const leftColumnsWidth = vue.unref(leftTableWidth);
  52378. const _fixedTableHeight = vue.unref(fixedTableHeight);
  52379. const leftTableProps = {
  52380. cache,
  52381. class: ns.e("left"),
  52382. columns: vue.unref(fixedColumnsOnLeft),
  52383. data: _data,
  52384. fixedData,
  52385. estimatedRowHeight,
  52386. leftTableRef,
  52387. rowHeight,
  52388. bodyWidth: leftColumnsWidth,
  52389. headerWidth: leftColumnsWidth,
  52390. headerHeight,
  52391. height: _fixedTableHeight,
  52392. rowKey,
  52393. scrollbarAlwaysOn,
  52394. scrollbarStartGap: 2,
  52395. scrollbarEndGap: vScrollbarSize,
  52396. useIsScrolling,
  52397. width: leftColumnsWidth,
  52398. getRowHeight,
  52399. onScroll: onVerticalScroll
  52400. };
  52401. const rightColumnsWidth = vue.unref(rightTableWidth);
  52402. const rightTableProps = {
  52403. cache,
  52404. class: ns.e("right"),
  52405. columns: vue.unref(fixedColumnsOnRight),
  52406. data: _data,
  52407. fixedData,
  52408. estimatedRowHeight,
  52409. rightTableRef,
  52410. rowHeight,
  52411. bodyWidth: rightColumnsWidth,
  52412. headerWidth: rightColumnsWidth,
  52413. headerHeight,
  52414. height: _fixedTableHeight,
  52415. rowKey,
  52416. scrollbarAlwaysOn,
  52417. scrollbarStartGap: 2,
  52418. scrollbarEndGap: vScrollbarSize,
  52419. width: rightColumnsWidth,
  52420. style: `${ns.cssVarName("table-scrollbar-size")}: ${vScrollbarSize}px`,
  52421. useIsScrolling,
  52422. getRowHeight,
  52423. onScroll: onVerticalScroll
  52424. };
  52425. const _columnsStyles = vue.unref(columnsStyles);
  52426. const tableRowProps = {
  52427. ns,
  52428. depthMap: vue.unref(depthMap),
  52429. columnsStyles: _columnsStyles,
  52430. expandColumnKey,
  52431. expandedRowKeys: vue.unref(expandedRowKeys),
  52432. estimatedRowHeight,
  52433. hasFixedColumns: vue.unref(hasFixedColumns),
  52434. rowProps,
  52435. rowClass,
  52436. rowKey,
  52437. rowEventHandlers,
  52438. onRowHovered,
  52439. onRowExpanded,
  52440. onRowHeightChange
  52441. };
  52442. const tableCellProps = {
  52443. cellProps,
  52444. expandColumnKey,
  52445. indentSize,
  52446. iconSize,
  52447. rowKey,
  52448. expandedRowKeys: vue.unref(expandedRowKeys),
  52449. ns
  52450. };
  52451. const tableHeaderProps = {
  52452. ns,
  52453. headerClass,
  52454. headerProps,
  52455. columnsStyles: _columnsStyles
  52456. };
  52457. const tableHeaderCellProps = {
  52458. ns,
  52459. sortBy,
  52460. sortState,
  52461. headerCellProps,
  52462. onColumnSorted
  52463. };
  52464. const tableSlots = {
  52465. row: (props2) => vue.createVNode(RowRenderer, vue.mergeProps(props2, tableRowProps), {
  52466. row: slots.row,
  52467. cell: (props3) => {
  52468. let _slot;
  52469. return slots.cell ? vue.createVNode(CellRenderer, vue.mergeProps(props3, tableCellProps, {
  52470. "style": _columnsStyles[props3.column.key]
  52471. }), _isSlot(_slot = slots.cell(props3)) ? _slot : {
  52472. default: () => [_slot]
  52473. }) : vue.createVNode(CellRenderer, vue.mergeProps(props3, tableCellProps, {
  52474. "style": _columnsStyles[props3.column.key]
  52475. }), null);
  52476. }
  52477. }),
  52478. header: (props2) => vue.createVNode(HeaderRenderer, vue.mergeProps(props2, tableHeaderProps), {
  52479. header: slots.header,
  52480. cell: (props3) => {
  52481. let _slot2;
  52482. return slots["header-cell"] ? vue.createVNode(HeaderCellRenderer, vue.mergeProps(props3, tableHeaderCellProps, {
  52483. "style": _columnsStyles[props3.column.key]
  52484. }), _isSlot(_slot2 = slots["header-cell"](props3)) ? _slot2 : {
  52485. default: () => [_slot2]
  52486. }) : vue.createVNode(HeaderCellRenderer, vue.mergeProps(props3, tableHeaderCellProps, {
  52487. "style": _columnsStyles[props3.column.key]
  52488. }), null);
  52489. }
  52490. })
  52491. };
  52492. const rootKls = [props.class, ns.b(), ns.e("root"), ns.is("dynamic", vue.unref(isDynamic))];
  52493. const footerProps = {
  52494. class: ns.e("footer"),
  52495. style: vue.unref(footerHeight)
  52496. };
  52497. return vue.createVNode("div", {
  52498. "class": rootKls,
  52499. "style": vue.unref(rootStyle)
  52500. }, [vue.createVNode(MainTable, mainTableProps, _isSlot(tableSlots) ? tableSlots : {
  52501. default: () => [tableSlots]
  52502. }), vue.createVNode(LeftTable, leftTableProps, _isSlot(tableSlots) ? tableSlots : {
  52503. default: () => [tableSlots]
  52504. }), vue.createVNode(RightTable, rightTableProps, _isSlot(tableSlots) ? tableSlots : {
  52505. default: () => [tableSlots]
  52506. }), slots.footer && vue.createVNode(Footer$1, footerProps, {
  52507. default: slots.footer
  52508. }), vue.unref(showEmpty) && vue.createVNode(Footer, {
  52509. "class": ns.e("empty"),
  52510. "style": vue.unref(emptyStyle)
  52511. }, {
  52512. default: slots.empty
  52513. }), slots.overlay && vue.createVNode(Overlay, {
  52514. "class": ns.e("overlay")
  52515. }, {
  52516. default: slots.overlay
  52517. })]);
  52518. };
  52519. }
  52520. });
  52521. var TableV2$1 = TableV2;
  52522. const autoResizerProps = buildProps({
  52523. disableWidth: Boolean,
  52524. disableHeight: Boolean,
  52525. onResize: {
  52526. type: definePropType(Function)
  52527. }
  52528. });
  52529. const AutoResizer = vue.defineComponent({
  52530. name: "ElAutoResizer",
  52531. props: autoResizerProps,
  52532. setup(props, {
  52533. slots
  52534. }) {
  52535. const ns = useNamespace("auto-resizer");
  52536. const {
  52537. height,
  52538. width,
  52539. sizer
  52540. } = useAutoResize(props);
  52541. const style = {
  52542. width: "100%",
  52543. height: "100%"
  52544. };
  52545. return () => {
  52546. var _a;
  52547. return vue.createVNode("div", {
  52548. "ref": sizer,
  52549. "class": ns.b(),
  52550. "style": style
  52551. }, [(_a = slots.default) == null ? void 0 : _a.call(slots, {
  52552. height: height.value,
  52553. width: width.value
  52554. })]);
  52555. };
  52556. }
  52557. });
  52558. const ElTableV2 = withInstall(TableV2$1);
  52559. const ElAutoResizer = withInstall(AutoResizer);
  52560. const tabsRootContextKey = Symbol("tabsRootContextKey");
  52561. const tabBarProps = buildProps({
  52562. tabs: {
  52563. type: definePropType(Array),
  52564. default: () => mutable([])
  52565. },
  52566. tabRefs: {
  52567. type: definePropType(Object),
  52568. default: () => mutable({})
  52569. }
  52570. });
  52571. const COMPONENT_NAME$4 = "ElTabBar";
  52572. const __default__$r = vue.defineComponent({
  52573. name: COMPONENT_NAME$4
  52574. });
  52575. const _sfc_main$w = /* @__PURE__ */ vue.defineComponent({
  52576. ...__default__$r,
  52577. props: tabBarProps,
  52578. setup(__props, { expose }) {
  52579. const props = __props;
  52580. const rootTabs = vue.inject(tabsRootContextKey);
  52581. if (!rootTabs)
  52582. throwError(COMPONENT_NAME$4, "<el-tabs><el-tab-bar /></el-tabs>");
  52583. const ns = useNamespace("tabs");
  52584. const barRef = vue.ref();
  52585. const barStyle = vue.ref();
  52586. const getBarStyle = () => {
  52587. let offset = 0;
  52588. let tabSize = 0;
  52589. const sizeName = ["top", "bottom"].includes(rootTabs.props.tabPosition) ? "width" : "height";
  52590. const sizeDir = sizeName === "width" ? "x" : "y";
  52591. const position = sizeDir === "x" ? "left" : "top";
  52592. props.tabs.every((tab) => {
  52593. if (isUndefined(tab.paneName))
  52594. return false;
  52595. const $el = props.tabRefs[tab.paneName];
  52596. if (!$el)
  52597. return false;
  52598. if (!tab.active) {
  52599. return true;
  52600. }
  52601. offset = $el[`offset${capitalize(position)}`];
  52602. tabSize = $el[`client${capitalize(sizeName)}`];
  52603. const tabStyles = window.getComputedStyle($el);
  52604. if (sizeName === "width") {
  52605. tabSize -= Number.parseFloat(tabStyles.paddingLeft) + Number.parseFloat(tabStyles.paddingRight);
  52606. offset += Number.parseFloat(tabStyles.paddingLeft);
  52607. }
  52608. return false;
  52609. });
  52610. return {
  52611. [sizeName]: `${tabSize}px`,
  52612. transform: `translate${capitalize(sizeDir)}(${offset}px)`
  52613. };
  52614. };
  52615. const update = () => barStyle.value = getBarStyle();
  52616. const tabObservers = [];
  52617. const observerTabs = () => {
  52618. tabObservers.forEach((observer) => observer.stop());
  52619. tabObservers.length = 0;
  52620. Object.values(props.tabRefs).forEach((tab) => {
  52621. tabObservers.push(useResizeObserver(tab, update));
  52622. });
  52623. };
  52624. vue.watch(() => props.tabs, async () => {
  52625. await vue.nextTick();
  52626. update();
  52627. observerTabs();
  52628. }, { immediate: true });
  52629. const barObserver = useResizeObserver(barRef, () => update());
  52630. vue.onBeforeUnmount(() => {
  52631. tabObservers.forEach((observer) => observer.stop());
  52632. tabObservers.length = 0;
  52633. barObserver.stop();
  52634. });
  52635. expose({
  52636. ref: barRef,
  52637. update
  52638. });
  52639. return (_ctx, _cache) => {
  52640. return vue.openBlock(), vue.createElementBlock("div", {
  52641. ref_key: "barRef",
  52642. ref: barRef,
  52643. class: vue.normalizeClass([vue.unref(ns).e("active-bar"), vue.unref(ns).is(vue.unref(rootTabs).props.tabPosition)]),
  52644. style: vue.normalizeStyle(barStyle.value)
  52645. }, null, 6);
  52646. };
  52647. }
  52648. });
  52649. var TabBar = /* @__PURE__ */ _export_sfc(_sfc_main$w, [["__file", "tab-bar.vue"]]);
  52650. const tabNavProps = buildProps({
  52651. panes: {
  52652. type: definePropType(Array),
  52653. default: () => mutable([])
  52654. },
  52655. currentName: {
  52656. type: [String, Number],
  52657. default: ""
  52658. },
  52659. editable: Boolean,
  52660. type: {
  52661. type: String,
  52662. values: ["card", "border-card", ""],
  52663. default: ""
  52664. },
  52665. stretch: Boolean,
  52666. tabindex: {
  52667. type: [String, Number],
  52668. default: void 0
  52669. }
  52670. });
  52671. const tabNavEmits = {
  52672. tabClick: (tab, tabName, ev) => ev instanceof Event,
  52673. tabRemove: (tab, ev) => ev instanceof Event
  52674. };
  52675. const COMPONENT_NAME$3 = "ElTabNav";
  52676. const TabNav = vue.defineComponent({
  52677. name: COMPONENT_NAME$3,
  52678. props: tabNavProps,
  52679. emits: tabNavEmits,
  52680. setup(props, {
  52681. expose,
  52682. emit
  52683. }) {
  52684. const rootTabs = vue.inject(tabsRootContextKey);
  52685. if (!rootTabs)
  52686. throwError(COMPONENT_NAME$3, `<el-tabs><tab-nav /></el-tabs>`);
  52687. const ns = useNamespace("tabs");
  52688. const visibility = useDocumentVisibility();
  52689. const focused = useWindowFocus();
  52690. const navScroll$ = vue.ref();
  52691. const nav$ = vue.ref();
  52692. const el$ = vue.ref();
  52693. const tabRefsMap = vue.ref({});
  52694. const tabBarRef = vue.ref();
  52695. const scrollable = vue.ref(false);
  52696. const navOffset = vue.ref(0);
  52697. const isFocus = vue.ref(false);
  52698. const focusable = vue.ref(true);
  52699. const tracker = vue.shallowRef();
  52700. const isHorizontal = vue.computed(() => ["top", "bottom"].includes(rootTabs.props.tabPosition));
  52701. const sizeName = vue.computed(() => isHorizontal.value ? "width" : "height");
  52702. const navStyle = vue.computed(() => {
  52703. const dir = sizeName.value === "width" ? "X" : "Y";
  52704. return {
  52705. transform: `translate${dir}(-${navOffset.value}px)`
  52706. };
  52707. });
  52708. const {
  52709. width: navContainerWidth,
  52710. height: navContainerHeight
  52711. } = useElementSize(navScroll$);
  52712. const {
  52713. width: navWidth,
  52714. height: navHeight
  52715. } = useElementSize(nav$, {
  52716. width: 0,
  52717. height: 0
  52718. }, {
  52719. box: "border-box"
  52720. });
  52721. const navContainerSize = vue.computed(() => isHorizontal.value ? navContainerWidth.value : navContainerHeight.value);
  52722. const navSize = vue.computed(() => isHorizontal.value ? navWidth.value : navHeight.value);
  52723. const {
  52724. onWheel
  52725. } = useWheel$1({
  52726. atStartEdge: vue.computed(() => navOffset.value <= 0),
  52727. atEndEdge: vue.computed(() => navSize.value - navOffset.value <= navContainerSize.value),
  52728. layout: vue.computed(() => isHorizontal.value ? "horizontal" : "vertical")
  52729. }, (offset) => {
  52730. navOffset.value = clamp$1(navOffset.value + offset, 0, navSize.value - navContainerSize.value);
  52731. });
  52732. const scrollPrev = () => {
  52733. if (!navScroll$.value)
  52734. return;
  52735. const containerSize = navScroll$.value[`offset${capitalize(sizeName.value)}`];
  52736. const currentOffset = navOffset.value;
  52737. if (!currentOffset)
  52738. return;
  52739. const newOffset = currentOffset > containerSize ? currentOffset - containerSize : 0;
  52740. navOffset.value = newOffset;
  52741. };
  52742. const scrollNext = () => {
  52743. if (!navScroll$.value || !nav$.value)
  52744. return;
  52745. const navSize2 = nav$.value[`offset${capitalize(sizeName.value)}`];
  52746. const containerSize = navScroll$.value[`offset${capitalize(sizeName.value)}`];
  52747. const currentOffset = navOffset.value;
  52748. if (navSize2 - currentOffset <= containerSize)
  52749. return;
  52750. const newOffset = navSize2 - currentOffset > containerSize * 2 ? currentOffset + containerSize : navSize2 - containerSize;
  52751. navOffset.value = newOffset;
  52752. };
  52753. const scrollToActiveTab = async () => {
  52754. const nav = nav$.value;
  52755. if (!scrollable.value || !el$.value || !navScroll$.value || !nav)
  52756. return;
  52757. await vue.nextTick();
  52758. const activeTab = tabRefsMap.value[props.currentName];
  52759. if (!activeTab)
  52760. return;
  52761. const navScroll = navScroll$.value;
  52762. const activeTabBounding = activeTab.getBoundingClientRect();
  52763. const navScrollBounding = navScroll.getBoundingClientRect();
  52764. const maxOffset = isHorizontal.value ? nav.offsetWidth - navScrollBounding.width : nav.offsetHeight - navScrollBounding.height;
  52765. const currentOffset = navOffset.value;
  52766. let newOffset = currentOffset;
  52767. if (isHorizontal.value) {
  52768. if (activeTabBounding.left < navScrollBounding.left) {
  52769. newOffset = currentOffset - (navScrollBounding.left - activeTabBounding.left);
  52770. }
  52771. if (activeTabBounding.right > navScrollBounding.right) {
  52772. newOffset = currentOffset + activeTabBounding.right - navScrollBounding.right;
  52773. }
  52774. } else {
  52775. if (activeTabBounding.top < navScrollBounding.top) {
  52776. newOffset = currentOffset - (navScrollBounding.top - activeTabBounding.top);
  52777. }
  52778. if (activeTabBounding.bottom > navScrollBounding.bottom) {
  52779. newOffset = currentOffset + (activeTabBounding.bottom - navScrollBounding.bottom);
  52780. }
  52781. }
  52782. newOffset = Math.max(newOffset, 0);
  52783. navOffset.value = Math.min(newOffset, maxOffset);
  52784. };
  52785. const update = () => {
  52786. var _a;
  52787. if (!nav$.value || !navScroll$.value)
  52788. return;
  52789. props.stretch && ((_a = tabBarRef.value) == null ? void 0 : _a.update());
  52790. const navSize2 = nav$.value[`offset${capitalize(sizeName.value)}`];
  52791. const containerSize = navScroll$.value[`offset${capitalize(sizeName.value)}`];
  52792. const currentOffset = navOffset.value;
  52793. if (containerSize < navSize2) {
  52794. scrollable.value = scrollable.value || {};
  52795. scrollable.value.prev = currentOffset;
  52796. scrollable.value.next = currentOffset + containerSize < navSize2;
  52797. if (navSize2 - currentOffset < containerSize) {
  52798. navOffset.value = navSize2 - containerSize;
  52799. }
  52800. } else {
  52801. scrollable.value = false;
  52802. if (currentOffset > 0) {
  52803. navOffset.value = 0;
  52804. }
  52805. }
  52806. };
  52807. const changeTab = (event) => {
  52808. const code = getEventCode(event);
  52809. let step = 0;
  52810. switch (code) {
  52811. case EVENT_CODE.left:
  52812. case EVENT_CODE.up:
  52813. step = -1;
  52814. break;
  52815. case EVENT_CODE.right:
  52816. case EVENT_CODE.down:
  52817. step = 1;
  52818. break;
  52819. default:
  52820. return;
  52821. }
  52822. const tabList = Array.from(event.currentTarget.querySelectorAll("[role=tab]:not(.is-disabled)"));
  52823. const currentIndex = tabList.indexOf(event.target);
  52824. let nextIndex = currentIndex + step;
  52825. if (nextIndex < 0) {
  52826. nextIndex = tabList.length - 1;
  52827. } else if (nextIndex >= tabList.length) {
  52828. nextIndex = 0;
  52829. }
  52830. tabList[nextIndex].focus({
  52831. preventScroll: true
  52832. });
  52833. tabList[nextIndex].click();
  52834. setFocus();
  52835. };
  52836. const setFocus = () => {
  52837. if (focusable.value)
  52838. isFocus.value = true;
  52839. };
  52840. const removeFocus = () => isFocus.value = false;
  52841. const setRefs = (el, key) => {
  52842. tabRefsMap.value[key] = el;
  52843. };
  52844. const focusActiveTab = async () => {
  52845. await vue.nextTick();
  52846. const activeTab = tabRefsMap.value[props.currentName];
  52847. activeTab == null ? void 0 : activeTab.focus({
  52848. preventScroll: true
  52849. });
  52850. };
  52851. vue.watch(visibility, (visibility2) => {
  52852. if (visibility2 === "hidden") {
  52853. focusable.value = false;
  52854. } else if (visibility2 === "visible") {
  52855. setTimeout(() => focusable.value = true, 50);
  52856. }
  52857. });
  52858. vue.watch(focused, (focused2) => {
  52859. if (focused2) {
  52860. setTimeout(() => focusable.value = true, 50);
  52861. } else {
  52862. focusable.value = false;
  52863. }
  52864. });
  52865. useResizeObserver(el$, update);
  52866. vue.onMounted(() => setTimeout(() => scrollToActiveTab(), 0));
  52867. vue.onUpdated(() => update());
  52868. expose({
  52869. scrollToActiveTab,
  52870. removeFocus,
  52871. focusActiveTab,
  52872. tabListRef: nav$,
  52873. tabBarRef,
  52874. scheduleRender: () => vue.triggerRef(tracker)
  52875. });
  52876. return () => {
  52877. const scrollBtn = scrollable.value ? [vue.createVNode("span", {
  52878. "class": [ns.e("nav-prev"), ns.is("disabled", !scrollable.value.prev)],
  52879. "onClick": scrollPrev
  52880. }, [vue.createVNode(ElIcon, null, {
  52881. default: () => [vue.createVNode(arrow_left_default, null, null)]
  52882. })]), vue.createVNode("span", {
  52883. "class": [ns.e("nav-next"), ns.is("disabled", !scrollable.value.next)],
  52884. "onClick": scrollNext
  52885. }, [vue.createVNode(ElIcon, null, {
  52886. default: () => [vue.createVNode(arrow_right_default, null, null)]
  52887. })])] : null;
  52888. const tabs = props.panes.map((pane, index) => {
  52889. var _a, _b, _c, _d, _e;
  52890. const uid = pane.uid;
  52891. const disabled = pane.props.disabled;
  52892. const tabName = (_b = (_a = pane.props.name) != null ? _a : pane.index) != null ? _b : `${index}`;
  52893. const closable = !disabled && (pane.isClosable || pane.props.closable !== false && props.editable);
  52894. pane.index = `${index}`;
  52895. const btnClose = closable ? vue.createVNode(ElIcon, {
  52896. "class": "is-icon-close",
  52897. "onClick": (ev) => emit("tabRemove", pane, ev)
  52898. }, {
  52899. default: () => [vue.createVNode(close_default, null, null)]
  52900. }) : null;
  52901. const tabLabelContent = ((_d = (_c = pane.slots).label) == null ? void 0 : _d.call(_c)) || pane.props.label;
  52902. const tabindex = !disabled && pane.active ? (_e = props.tabindex) != null ? _e : rootTabs.props.tabindex : -1;
  52903. return vue.createVNode("div", {
  52904. "ref": (el) => setRefs(el, tabName),
  52905. "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)],
  52906. "id": `tab-${tabName}`,
  52907. "key": `tab-${uid}`,
  52908. "aria-controls": `pane-${tabName}`,
  52909. "role": "tab",
  52910. "aria-selected": pane.active,
  52911. "tabindex": tabindex,
  52912. "onFocus": () => setFocus(),
  52913. "onBlur": () => removeFocus(),
  52914. "onClick": (ev) => {
  52915. removeFocus();
  52916. emit("tabClick", pane, tabName, ev);
  52917. },
  52918. "onKeydown": (ev) => {
  52919. const code = getEventCode(ev);
  52920. if (closable && (code === EVENT_CODE.delete || code === EVENT_CODE.backspace)) {
  52921. emit("tabRemove", pane, ev);
  52922. }
  52923. }
  52924. }, [...[tabLabelContent, btnClose]]);
  52925. });
  52926. tracker.value;
  52927. return vue.createVNode("div", {
  52928. "ref": el$,
  52929. "class": [ns.e("nav-wrap"), ns.is("scrollable", !!scrollable.value), ns.is(rootTabs.props.tabPosition)]
  52930. }, [scrollBtn, vue.createVNode("div", {
  52931. "class": ns.e("nav-scroll"),
  52932. "ref": navScroll$
  52933. }, [props.panes.length > 0 ? vue.createVNode("div", {
  52934. "class": [ns.e("nav"), ns.is(rootTabs.props.tabPosition), ns.is("stretch", props.stretch && ["top", "bottom"].includes(rootTabs.props.tabPosition))],
  52935. "ref": nav$,
  52936. "style": navStyle.value,
  52937. "role": "tablist",
  52938. "onKeydown": changeTab,
  52939. "onWheel": onWheel
  52940. }, [...[!props.type ? vue.createVNode(TabBar, {
  52941. "ref": tabBarRef,
  52942. "tabs": [...props.panes],
  52943. "tabRefs": tabRefsMap.value
  52944. }, null) : null, tabs]]) : null])]);
  52945. };
  52946. }
  52947. });
  52948. const tabsProps = buildProps({
  52949. type: {
  52950. type: String,
  52951. values: ["card", "border-card", ""],
  52952. default: ""
  52953. },
  52954. closable: Boolean,
  52955. addable: Boolean,
  52956. modelValue: {
  52957. type: [String, Number]
  52958. },
  52959. editable: Boolean,
  52960. tabPosition: {
  52961. type: String,
  52962. values: ["top", "right", "bottom", "left"],
  52963. default: "top"
  52964. },
  52965. beforeLeave: {
  52966. type: definePropType(Function),
  52967. default: () => true
  52968. },
  52969. stretch: Boolean,
  52970. tabindex: {
  52971. type: [String, Number],
  52972. default: 0
  52973. }
  52974. });
  52975. const isPaneName = (value) => isString$1(value) || isNumber(value);
  52976. const tabsEmits = {
  52977. [UPDATE_MODEL_EVENT]: (name) => isPaneName(name),
  52978. tabClick: (pane, ev) => ev instanceof Event,
  52979. tabChange: (name) => isPaneName(name),
  52980. edit: (paneName, action) => ["remove", "add"].includes(action),
  52981. tabRemove: (name) => isPaneName(name),
  52982. tabAdd: () => true
  52983. };
  52984. const Tabs = vue.defineComponent({
  52985. name: "ElTabs",
  52986. props: tabsProps,
  52987. emits: tabsEmits,
  52988. setup(props, {
  52989. emit,
  52990. slots,
  52991. expose
  52992. }) {
  52993. var _a;
  52994. const ns = useNamespace("tabs");
  52995. const isVertical = vue.computed(() => ["left", "right"].includes(props.tabPosition));
  52996. const {
  52997. children: panes,
  52998. addChild: registerPane,
  52999. removeChild: unregisterPane,
  53000. ChildrenSorter: PanesSorter
  53001. } = useOrderedChildren(vue.getCurrentInstance(), "ElTabPane");
  53002. const nav$ = vue.ref();
  53003. const currentName = vue.ref((_a = props.modelValue) != null ? _a : "0");
  53004. const setCurrentName = async (value, trigger = false) => {
  53005. var _a2, _b, _c, _d;
  53006. if (currentName.value === value || isUndefined(value))
  53007. return;
  53008. try {
  53009. let canLeave;
  53010. if (props.beforeLeave) {
  53011. const result = props.beforeLeave(value, currentName.value);
  53012. canLeave = result instanceof Promise ? await result : result;
  53013. } else {
  53014. canLeave = true;
  53015. }
  53016. if (canLeave !== false) {
  53017. const isFocusInsidePane = (_a2 = panes.value.find((item) => item.paneName === currentName.value)) == null ? void 0 : _a2.isFocusInsidePane();
  53018. currentName.value = value;
  53019. if (trigger) {
  53020. emit(UPDATE_MODEL_EVENT, value);
  53021. emit("tabChange", value);
  53022. }
  53023. (_c = (_b = nav$.value) == null ? void 0 : _b.removeFocus) == null ? void 0 : _c.call(_b);
  53024. if (isFocusInsidePane) {
  53025. (_d = nav$.value) == null ? void 0 : _d.focusActiveTab();
  53026. }
  53027. }
  53028. } catch (e) {
  53029. }
  53030. };
  53031. const handleTabClick = (tab, tabName, event) => {
  53032. if (tab.props.disabled)
  53033. return;
  53034. emit("tabClick", tab, event);
  53035. setCurrentName(tabName, true);
  53036. };
  53037. const handleTabRemove = (pane, ev) => {
  53038. if (pane.props.disabled || isUndefined(pane.props.name))
  53039. return;
  53040. ev.stopPropagation();
  53041. emit("edit", pane.props.name, "remove");
  53042. emit("tabRemove", pane.props.name);
  53043. };
  53044. const handleTabAdd = () => {
  53045. emit("edit", void 0, "add");
  53046. emit("tabAdd");
  53047. };
  53048. const handleKeydown = (event) => {
  53049. const code = getEventCode(event);
  53050. if ([EVENT_CODE.enter, EVENT_CODE.numpadEnter].includes(code))
  53051. handleTabAdd();
  53052. };
  53053. const swapChildren = (vnode) => {
  53054. const actualFirstChild = vnode.el.firstChild;
  53055. const firstChild = ["bottom", "right"].includes(props.tabPosition) ? vnode.children[0].el : vnode.children[1].el;
  53056. if (actualFirstChild !== firstChild) {
  53057. actualFirstChild.before(firstChild);
  53058. }
  53059. };
  53060. vue.watch(() => props.modelValue, (modelValue) => setCurrentName(modelValue));
  53061. vue.watch(currentName, async () => {
  53062. var _a2;
  53063. await vue.nextTick();
  53064. (_a2 = nav$.value) == null ? void 0 : _a2.scrollToActiveTab();
  53065. });
  53066. vue.provide(tabsRootContextKey, {
  53067. props,
  53068. currentName,
  53069. registerPane,
  53070. unregisterPane,
  53071. nav$
  53072. });
  53073. expose({
  53074. currentName,
  53075. get tabNavRef() {
  53076. return omit(nav$.value, ["scheduleRender"]);
  53077. }
  53078. });
  53079. return () => {
  53080. const addSlot = slots["add-icon"];
  53081. const newButton = props.editable || props.addable ? vue.createVNode("div", {
  53082. "class": [ns.e("new-tab"), isVertical.value && ns.e("new-tab-vertical")],
  53083. "tabindex": props.tabindex,
  53084. "onClick": handleTabAdd,
  53085. "onKeydown": handleKeydown
  53086. }, [addSlot ? vue.renderSlot(slots, "add-icon") : vue.createVNode(ElIcon, {
  53087. "class": ns.is("icon-plus")
  53088. }, {
  53089. default: () => [vue.createVNode(plus_default, null, null)]
  53090. })]) : null;
  53091. const tabNav = () => vue.createVNode(TabNav, {
  53092. "ref": nav$,
  53093. "currentName": currentName.value,
  53094. "editable": props.editable,
  53095. "type": props.type,
  53096. "panes": panes.value,
  53097. "stretch": props.stretch,
  53098. "onTabClick": handleTabClick,
  53099. "onTabRemove": handleTabRemove
  53100. }, null);
  53101. const header = vue.createVNode("div", {
  53102. "class": [ns.e("header"), isVertical.value && ns.e("header-vertical"), ns.is(props.tabPosition)]
  53103. }, [vue.createVNode(PanesSorter, null, {
  53104. default: tabNav,
  53105. $stable: true
  53106. }), newButton]);
  53107. const panels = vue.createVNode("div", {
  53108. "class": ns.e("content")
  53109. }, [vue.renderSlot(slots, "default")]);
  53110. return vue.createVNode("div", {
  53111. "class": [ns.b(), ns.m(props.tabPosition), {
  53112. [ns.m("card")]: props.type === "card",
  53113. [ns.m("border-card")]: props.type === "border-card"
  53114. }],
  53115. "onVnodeMounted": swapChildren,
  53116. "onVnodeUpdated": swapChildren
  53117. }, [panels, header]);
  53118. };
  53119. }
  53120. });
  53121. const tabPaneProps = buildProps({
  53122. label: {
  53123. type: String,
  53124. default: ""
  53125. },
  53126. name: {
  53127. type: [String, Number]
  53128. },
  53129. closable: {
  53130. type: Boolean,
  53131. default: void 0
  53132. },
  53133. disabled: Boolean,
  53134. lazy: Boolean
  53135. });
  53136. const COMPONENT_NAME$2 = "ElTabPane";
  53137. const __default__$q = vue.defineComponent({
  53138. name: COMPONENT_NAME$2
  53139. });
  53140. const _sfc_main$v = /* @__PURE__ */ vue.defineComponent({
  53141. ...__default__$q,
  53142. props: tabPaneProps,
  53143. setup(__props) {
  53144. const props = __props;
  53145. const instance = vue.getCurrentInstance();
  53146. const slots = vue.useSlots();
  53147. const tabsRoot = vue.inject(tabsRootContextKey);
  53148. if (!tabsRoot)
  53149. throwError(COMPONENT_NAME$2, "usage: <el-tabs><el-tab-pane /></el-tabs/>");
  53150. const ns = useNamespace("tab-pane");
  53151. const paneRef = vue.ref();
  53152. const index = vue.ref();
  53153. const isClosable = vue.computed(() => {
  53154. var _a;
  53155. return (_a = props.closable) != null ? _a : tabsRoot.props.closable;
  53156. });
  53157. const active = computedEager(() => {
  53158. var _a;
  53159. return tabsRoot.currentName.value === ((_a = props.name) != null ? _a : index.value);
  53160. });
  53161. const loaded = vue.ref(active.value);
  53162. const paneName = vue.computed(() => {
  53163. var _a;
  53164. return (_a = props.name) != null ? _a : index.value;
  53165. });
  53166. const shouldBeRender = computedEager(() => !props.lazy || loaded.value || active.value);
  53167. const isFocusInsidePane = () => {
  53168. var _a;
  53169. return (_a = paneRef.value) == null ? void 0 : _a.contains(document.activeElement);
  53170. };
  53171. vue.watch(active, (val) => {
  53172. if (val)
  53173. loaded.value = true;
  53174. });
  53175. const pane = vue.reactive({
  53176. uid: instance.uid,
  53177. getVnode: () => instance.vnode,
  53178. slots,
  53179. props,
  53180. paneName,
  53181. active,
  53182. index,
  53183. isClosable,
  53184. isFocusInsidePane
  53185. });
  53186. tabsRoot.registerPane(pane);
  53187. vue.onBeforeUnmount(() => {
  53188. tabsRoot.unregisterPane(pane);
  53189. });
  53190. vue.onBeforeUpdate(() => {
  53191. var _a;
  53192. if (slots.label)
  53193. (_a = tabsRoot.nav$.value) == null ? void 0 : _a.scheduleRender();
  53194. });
  53195. return (_ctx, _cache) => {
  53196. return vue.unref(shouldBeRender) ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  53197. key: 0,
  53198. id: `pane-${vue.unref(paneName)}`,
  53199. ref_key: "paneRef",
  53200. ref: paneRef,
  53201. class: vue.normalizeClass(vue.unref(ns).b()),
  53202. role: "tabpanel",
  53203. "aria-hidden": !vue.unref(active),
  53204. "aria-labelledby": `tab-${vue.unref(paneName)}`
  53205. }, [
  53206. vue.renderSlot(_ctx.$slots, "default")
  53207. ], 10, ["id", "aria-hidden", "aria-labelledby"])), [
  53208. [vue.vShow, vue.unref(active)]
  53209. ]) : vue.createCommentVNode("v-if", true);
  53210. };
  53211. }
  53212. });
  53213. var TabPane = /* @__PURE__ */ _export_sfc(_sfc_main$v, [["__file", "tab-pane.vue"]]);
  53214. const ElTabs = withInstall(Tabs, {
  53215. TabPane
  53216. });
  53217. const ElTabPane = withNoopInstall(TabPane);
  53218. const textProps = buildProps({
  53219. type: {
  53220. type: String,
  53221. values: ["primary", "success", "info", "warning", "danger", ""],
  53222. default: ""
  53223. },
  53224. size: {
  53225. type: String,
  53226. values: componentSizes,
  53227. default: ""
  53228. },
  53229. truncated: Boolean,
  53230. lineClamp: {
  53231. type: [String, Number]
  53232. },
  53233. tag: {
  53234. type: String,
  53235. default: "span"
  53236. }
  53237. });
  53238. const __default__$p = vue.defineComponent({
  53239. name: "ElText"
  53240. });
  53241. const _sfc_main$u = /* @__PURE__ */ vue.defineComponent({
  53242. ...__default__$p,
  53243. props: textProps,
  53244. setup(__props) {
  53245. const props = __props;
  53246. const textRef = vue.ref();
  53247. const textSize = useFormSize();
  53248. const ns = useNamespace("text");
  53249. const textKls = vue.computed(() => [
  53250. ns.b(),
  53251. ns.m(props.type),
  53252. ns.m(textSize.value),
  53253. ns.is("truncated", props.truncated),
  53254. ns.is("line-clamp", !isUndefined(props.lineClamp))
  53255. ]);
  53256. const bindTitle = () => {
  53257. var _a, _b, _c, _d, _e, _f, _g;
  53258. const inheritTitle = vue.useAttrs().title;
  53259. if (inheritTitle)
  53260. return;
  53261. let shouldAddTitle = false;
  53262. const text = ((_a = textRef.value) == null ? void 0 : _a.textContent) || "";
  53263. if (props.truncated) {
  53264. const width = (_b = textRef.value) == null ? void 0 : _b.offsetWidth;
  53265. const scrollWidth = (_c = textRef.value) == null ? void 0 : _c.scrollWidth;
  53266. if (width && scrollWidth && scrollWidth > width) {
  53267. shouldAddTitle = true;
  53268. }
  53269. } else if (!isUndefined(props.lineClamp)) {
  53270. const height = (_d = textRef.value) == null ? void 0 : _d.offsetHeight;
  53271. const scrollHeight = (_e = textRef.value) == null ? void 0 : _e.scrollHeight;
  53272. if (height && scrollHeight && scrollHeight > height) {
  53273. shouldAddTitle = true;
  53274. }
  53275. }
  53276. if (shouldAddTitle) {
  53277. (_f = textRef.value) == null ? void 0 : _f.setAttribute("title", text);
  53278. } else {
  53279. (_g = textRef.value) == null ? void 0 : _g.removeAttribute("title");
  53280. }
  53281. };
  53282. vue.onMounted(bindTitle);
  53283. vue.onUpdated(bindTitle);
  53284. return (_ctx, _cache) => {
  53285. return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.tag), {
  53286. ref_key: "textRef",
  53287. ref: textRef,
  53288. class: vue.normalizeClass(vue.unref(textKls)),
  53289. style: vue.normalizeStyle({ "-webkit-line-clamp": _ctx.lineClamp })
  53290. }, {
  53291. default: vue.withCtx(() => [
  53292. vue.renderSlot(_ctx.$slots, "default")
  53293. ]),
  53294. _: 3
  53295. }, 8, ["class", "style"]);
  53296. };
  53297. }
  53298. });
  53299. var Text = /* @__PURE__ */ _export_sfc(_sfc_main$u, [["__file", "text.vue"]]);
  53300. const ElText = withInstall(Text);
  53301. const timeSelectProps = buildProps({
  53302. format: {
  53303. type: String,
  53304. default: "HH:mm"
  53305. },
  53306. modelValue: {
  53307. type: definePropType(String)
  53308. },
  53309. disabled: Boolean,
  53310. editable: {
  53311. type: Boolean,
  53312. default: true
  53313. },
  53314. effect: {
  53315. type: definePropType(String),
  53316. default: "light"
  53317. },
  53318. clearable: {
  53319. type: Boolean,
  53320. default: true
  53321. },
  53322. size: useSizeProp,
  53323. placeholder: String,
  53324. start: {
  53325. type: String,
  53326. default: "09:00"
  53327. },
  53328. end: {
  53329. type: String,
  53330. default: "18:00"
  53331. },
  53332. step: {
  53333. type: String,
  53334. default: "00:30"
  53335. },
  53336. minTime: {
  53337. type: definePropType(String)
  53338. },
  53339. maxTime: {
  53340. type: definePropType(String)
  53341. },
  53342. includeEndTime: Boolean,
  53343. name: String,
  53344. prefixIcon: {
  53345. type: definePropType([String, Object]),
  53346. default: () => clock_default
  53347. },
  53348. clearIcon: {
  53349. type: definePropType([String, Object]),
  53350. default: () => circle_close_default
  53351. },
  53352. popperClass: {
  53353. type: String,
  53354. default: ""
  53355. },
  53356. popperStyle: {
  53357. type: definePropType([String, Object])
  53358. },
  53359. ...useEmptyValuesProps
  53360. });
  53361. const parseTime = (time) => {
  53362. const values = (time || "").split(":");
  53363. if (values.length >= 2) {
  53364. let hours = Number.parseInt(values[0], 10);
  53365. const minutes = Number.parseInt(values[1], 10);
  53366. const timeUpper = time.toUpperCase();
  53367. if (timeUpper.includes("AM") && hours === 12) {
  53368. hours = 0;
  53369. } else if (timeUpper.includes("PM") && hours !== 12) {
  53370. hours += 12;
  53371. }
  53372. return {
  53373. hours,
  53374. minutes
  53375. };
  53376. }
  53377. return null;
  53378. };
  53379. const compareTime = (time1, time2) => {
  53380. const value1 = parseTime(time1);
  53381. if (!value1)
  53382. return -1;
  53383. const value2 = parseTime(time2);
  53384. if (!value2)
  53385. return -1;
  53386. const minutes1 = value1.minutes + value1.hours * 60;
  53387. const minutes2 = value2.minutes + value2.hours * 60;
  53388. if (minutes1 === minutes2) {
  53389. return 0;
  53390. }
  53391. return minutes1 > minutes2 ? 1 : -1;
  53392. };
  53393. const padTime = (time) => {
  53394. return `${time}`.padStart(2, "0");
  53395. };
  53396. const formatTime = (time) => {
  53397. return `${padTime(time.hours)}:${padTime(time.minutes)}`;
  53398. };
  53399. const nextTime = (time, step) => {
  53400. const timeValue = parseTime(time);
  53401. if (!timeValue)
  53402. return "";
  53403. const stepValue = parseTime(step);
  53404. if (!stepValue)
  53405. return "";
  53406. const next = {
  53407. hours: timeValue.hours,
  53408. minutes: timeValue.minutes
  53409. };
  53410. next.minutes += stepValue.minutes;
  53411. next.hours += stepValue.hours;
  53412. next.hours += Math.floor(next.minutes / 60);
  53413. next.minutes = next.minutes % 60;
  53414. return formatTime(next);
  53415. };
  53416. const __default__$o = vue.defineComponent({
  53417. name: "ElTimeSelect"
  53418. });
  53419. const _sfc_main$t = /* @__PURE__ */ vue.defineComponent({
  53420. ...__default__$o,
  53421. props: timeSelectProps,
  53422. emits: [CHANGE_EVENT, "blur", "focus", "clear", UPDATE_MODEL_EVENT],
  53423. setup(__props, { expose }) {
  53424. const props = __props;
  53425. dayjs.extend(customParseFormat);
  53426. const { Option: ElOption } = ElSelect;
  53427. const nsInput = useNamespace("input");
  53428. const select = vue.ref();
  53429. const _disabled = useFormDisabled();
  53430. const { lang } = useLocale();
  53431. const value = vue.computed(() => props.modelValue);
  53432. const start = vue.computed(() => {
  53433. const time = parseTime(props.start);
  53434. return time ? formatTime(time) : null;
  53435. });
  53436. const end = vue.computed(() => {
  53437. const time = parseTime(props.end);
  53438. return time ? formatTime(time) : null;
  53439. });
  53440. const step = vue.computed(() => {
  53441. const time = parseTime(props.step);
  53442. return time ? formatTime(time) : null;
  53443. });
  53444. const minTime = vue.computed(() => {
  53445. const time = parseTime(props.minTime || "");
  53446. return time ? formatTime(time) : null;
  53447. });
  53448. const maxTime = vue.computed(() => {
  53449. const time = parseTime(props.maxTime || "");
  53450. return time ? formatTime(time) : null;
  53451. });
  53452. const items = vue.computed(() => {
  53453. var _a;
  53454. const result = [];
  53455. const push = (formattedValue, rawValue) => {
  53456. result.push({
  53457. value: formattedValue,
  53458. disabled: compareTime(rawValue, minTime.value || "-1:-1") <= 0 || compareTime(rawValue, maxTime.value || "100:100") >= 0
  53459. });
  53460. };
  53461. if (props.start && props.end && props.step) {
  53462. let current = start.value;
  53463. let currentTime;
  53464. while (current && end.value && compareTime(current, end.value) <= 0) {
  53465. currentTime = dayjs(current, "HH:mm").locale(lang.value).format(props.format);
  53466. push(currentTime, current);
  53467. current = nextTime(current, step.value);
  53468. }
  53469. if (props.includeEndTime && end.value && ((_a = result[result.length - 1]) == null ? void 0 : _a.value) !== end.value) {
  53470. const formattedValue = dayjs(end.value, "HH:mm").locale(lang.value).format(props.format);
  53471. push(formattedValue, end.value);
  53472. }
  53473. }
  53474. return result;
  53475. });
  53476. const blur = () => {
  53477. var _a, _b;
  53478. (_b = (_a = select.value) == null ? void 0 : _a.blur) == null ? void 0 : _b.call(_a);
  53479. };
  53480. const focus = () => {
  53481. var _a, _b;
  53482. (_b = (_a = select.value) == null ? void 0 : _a.focus) == null ? void 0 : _b.call(_a);
  53483. };
  53484. expose({
  53485. blur,
  53486. focus
  53487. });
  53488. return (_ctx, _cache) => {
  53489. return vue.openBlock(), vue.createBlock(vue.unref(ElSelect), {
  53490. ref_key: "select",
  53491. ref: select,
  53492. "model-value": vue.unref(value),
  53493. disabled: vue.unref(_disabled),
  53494. clearable: _ctx.clearable,
  53495. "clear-icon": _ctx.clearIcon,
  53496. size: _ctx.size,
  53497. effect: _ctx.effect,
  53498. placeholder: _ctx.placeholder,
  53499. "default-first-option": "",
  53500. filterable: _ctx.editable,
  53501. "empty-values": _ctx.emptyValues,
  53502. "value-on-clear": _ctx.valueOnClear,
  53503. "popper-class": _ctx.popperClass,
  53504. "popper-style": _ctx.popperStyle,
  53505. "onUpdate:modelValue": (event) => _ctx.$emit(vue.unref(UPDATE_MODEL_EVENT), event),
  53506. onChange: (event) => _ctx.$emit(vue.unref(CHANGE_EVENT), event),
  53507. onBlur: (event) => _ctx.$emit("blur", event),
  53508. onFocus: (event) => _ctx.$emit("focus", event),
  53509. onClear: () => _ctx.$emit("clear")
  53510. }, {
  53511. prefix: vue.withCtx(() => [
  53512. _ctx.prefixIcon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  53513. key: 0,
  53514. class: vue.normalizeClass(vue.unref(nsInput).e("prefix-icon"))
  53515. }, {
  53516. default: vue.withCtx(() => [
  53517. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.prefixIcon)))
  53518. ]),
  53519. _: 1
  53520. }, 8, ["class"])) : vue.createCommentVNode("v-if", true)
  53521. ]),
  53522. default: vue.withCtx(() => [
  53523. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(items), (item) => {
  53524. return vue.openBlock(), vue.createBlock(vue.unref(ElOption), {
  53525. key: item.value,
  53526. label: item.value,
  53527. value: item.value,
  53528. disabled: item.disabled
  53529. }, null, 8, ["label", "value", "disabled"]);
  53530. }), 128))
  53531. ]),
  53532. _: 1
  53533. }, 8, ["model-value", "disabled", "clearable", "clear-icon", "size", "effect", "placeholder", "filterable", "empty-values", "value-on-clear", "popper-class", "popper-style", "onUpdate:modelValue", "onChange", "onBlur", "onFocus", "onClear"]);
  53534. };
  53535. }
  53536. });
  53537. var TimeSelect = /* @__PURE__ */ _export_sfc(_sfc_main$t, [["__file", "time-select.vue"]]);
  53538. const ElTimeSelect = withInstall(TimeSelect);
  53539. const TIMELINE_INJECTION_KEY = "timeline";
  53540. const Timeline = vue.defineComponent({
  53541. name: "ElTimeline",
  53542. setup(_, { slots }) {
  53543. const ns = useNamespace("timeline");
  53544. vue.provide(TIMELINE_INJECTION_KEY, slots);
  53545. return () => {
  53546. return vue.h("ul", { class: [ns.b()] }, [vue.renderSlot(slots, "default")]);
  53547. };
  53548. }
  53549. });
  53550. var Timeline$1 = Timeline;
  53551. const timelineItemProps = buildProps({
  53552. timestamp: {
  53553. type: String,
  53554. default: ""
  53555. },
  53556. hideTimestamp: Boolean,
  53557. center: Boolean,
  53558. placement: {
  53559. type: String,
  53560. values: ["top", "bottom"],
  53561. default: "bottom"
  53562. },
  53563. type: {
  53564. type: String,
  53565. values: ["primary", "success", "warning", "danger", "info"],
  53566. default: ""
  53567. },
  53568. color: {
  53569. type: String,
  53570. default: ""
  53571. },
  53572. size: {
  53573. type: String,
  53574. values: ["normal", "large"],
  53575. default: "normal"
  53576. },
  53577. icon: {
  53578. type: iconPropType
  53579. },
  53580. hollow: Boolean
  53581. });
  53582. const __default__$n = vue.defineComponent({
  53583. name: "ElTimelineItem"
  53584. });
  53585. const _sfc_main$s = /* @__PURE__ */ vue.defineComponent({
  53586. ...__default__$n,
  53587. props: timelineItemProps,
  53588. setup(__props) {
  53589. const props = __props;
  53590. const ns = useNamespace("timeline-item");
  53591. const defaultNodeKls = vue.computed(() => [
  53592. ns.e("node"),
  53593. ns.em("node", props.size || ""),
  53594. ns.em("node", props.type || ""),
  53595. ns.is("hollow", props.hollow)
  53596. ]);
  53597. return (_ctx, _cache) => {
  53598. return vue.openBlock(), vue.createElementBlock("li", {
  53599. class: vue.normalizeClass([vue.unref(ns).b(), { [vue.unref(ns).e("center")]: _ctx.center }])
  53600. }, [
  53601. vue.createElementVNode("div", {
  53602. class: vue.normalizeClass(vue.unref(ns).e("tail"))
  53603. }, null, 2),
  53604. !_ctx.$slots.dot ? (vue.openBlock(), vue.createElementBlock("div", {
  53605. key: 0,
  53606. class: vue.normalizeClass(vue.unref(defaultNodeKls)),
  53607. style: vue.normalizeStyle({
  53608. backgroundColor: _ctx.color
  53609. })
  53610. }, [
  53611. _ctx.icon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  53612. key: 0,
  53613. class: vue.normalizeClass(vue.unref(ns).e("icon"))
  53614. }, {
  53615. default: vue.withCtx(() => [
  53616. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.icon)))
  53617. ]),
  53618. _: 1
  53619. }, 8, ["class"])) : vue.createCommentVNode("v-if", true)
  53620. ], 6)) : vue.createCommentVNode("v-if", true),
  53621. _ctx.$slots.dot ? (vue.openBlock(), vue.createElementBlock("div", {
  53622. key: 1,
  53623. class: vue.normalizeClass(vue.unref(ns).e("dot"))
  53624. }, [
  53625. vue.renderSlot(_ctx.$slots, "dot")
  53626. ], 2)) : vue.createCommentVNode("v-if", true),
  53627. vue.createElementVNode("div", {
  53628. class: vue.normalizeClass(vue.unref(ns).e("wrapper"))
  53629. }, [
  53630. !_ctx.hideTimestamp && _ctx.placement === "top" ? (vue.openBlock(), vue.createElementBlock("div", {
  53631. key: 0,
  53632. class: vue.normalizeClass([vue.unref(ns).e("timestamp"), vue.unref(ns).is("top")])
  53633. }, vue.toDisplayString(_ctx.timestamp), 3)) : vue.createCommentVNode("v-if", true),
  53634. vue.createElementVNode("div", {
  53635. class: vue.normalizeClass(vue.unref(ns).e("content"))
  53636. }, [
  53637. vue.renderSlot(_ctx.$slots, "default")
  53638. ], 2),
  53639. !_ctx.hideTimestamp && _ctx.placement === "bottom" ? (vue.openBlock(), vue.createElementBlock("div", {
  53640. key: 1,
  53641. class: vue.normalizeClass([vue.unref(ns).e("timestamp"), vue.unref(ns).is("bottom")])
  53642. }, vue.toDisplayString(_ctx.timestamp), 3)) : vue.createCommentVNode("v-if", true)
  53643. ], 2)
  53644. ], 2);
  53645. };
  53646. }
  53647. });
  53648. var TimelineItem = /* @__PURE__ */ _export_sfc(_sfc_main$s, [["__file", "timeline-item.vue"]]);
  53649. const ElTimeline = withInstall(Timeline$1, {
  53650. TimelineItem
  53651. });
  53652. const ElTimelineItem = withNoopInstall(TimelineItem);
  53653. const LEFT_CHECK_CHANGE_EVENT = "left-check-change";
  53654. const RIGHT_CHECK_CHANGE_EVENT = "right-check-change";
  53655. const transferProps = buildProps({
  53656. data: {
  53657. type: definePropType(Array),
  53658. default: () => []
  53659. },
  53660. titles: {
  53661. type: definePropType(Array),
  53662. default: () => []
  53663. },
  53664. buttonTexts: {
  53665. type: definePropType(Array),
  53666. default: () => []
  53667. },
  53668. filterPlaceholder: String,
  53669. filterMethod: {
  53670. type: definePropType(Function)
  53671. },
  53672. leftDefaultChecked: {
  53673. type: definePropType(Array),
  53674. default: () => []
  53675. },
  53676. rightDefaultChecked: {
  53677. type: definePropType(Array),
  53678. default: () => []
  53679. },
  53680. renderContent: {
  53681. type: definePropType(Function)
  53682. },
  53683. modelValue: {
  53684. type: definePropType(Array),
  53685. default: () => []
  53686. },
  53687. format: {
  53688. type: definePropType(Object),
  53689. default: () => ({})
  53690. },
  53691. filterable: Boolean,
  53692. props: {
  53693. type: definePropType(Object),
  53694. default: () => mutable({
  53695. label: "label",
  53696. key: "key",
  53697. disabled: "disabled"
  53698. })
  53699. },
  53700. targetOrder: {
  53701. type: String,
  53702. values: ["original", "push", "unshift"],
  53703. default: "original"
  53704. },
  53705. validateEvent: {
  53706. type: Boolean,
  53707. default: true
  53708. }
  53709. });
  53710. const transferCheckedChangeFn = (value, movedKeys) => [value, movedKeys].every(isArray$1) || isArray$1(value) && isNil(movedKeys);
  53711. const transferEmits = {
  53712. [CHANGE_EVENT]: (value, direction, movedKeys) => [value, movedKeys].every(isArray$1) && ["left", "right"].includes(direction),
  53713. [UPDATE_MODEL_EVENT]: (value) => isArray$1(value),
  53714. [LEFT_CHECK_CHANGE_EVENT]: transferCheckedChangeFn,
  53715. [RIGHT_CHECK_CHANGE_EVENT]: transferCheckedChangeFn
  53716. };
  53717. const CHECKED_CHANGE_EVENT = "checked-change";
  53718. const transferPanelProps = buildProps({
  53719. data: transferProps.data,
  53720. optionRender: {
  53721. type: definePropType(Function)
  53722. },
  53723. placeholder: String,
  53724. title: String,
  53725. filterable: Boolean,
  53726. format: transferProps.format,
  53727. filterMethod: transferProps.filterMethod,
  53728. defaultChecked: transferProps.leftDefaultChecked,
  53729. props: transferProps.props
  53730. });
  53731. const transferPanelEmits = {
  53732. [CHECKED_CHANGE_EVENT]: transferCheckedChangeFn
  53733. };
  53734. const usePropsAlias = (props) => {
  53735. const initProps = {
  53736. label: "label",
  53737. key: "key",
  53738. disabled: "disabled"
  53739. };
  53740. return vue.computed(() => ({
  53741. ...initProps,
  53742. ...props.props
  53743. }));
  53744. };
  53745. const useCheck$1 = (props, panelState, emit) => {
  53746. const propsAlias = usePropsAlias(props);
  53747. const filteredData = vue.computed(() => {
  53748. return props.data.filter((item) => {
  53749. if (isFunction$1(props.filterMethod)) {
  53750. return props.filterMethod(panelState.query, item);
  53751. } else {
  53752. const label = String(item[propsAlias.value.label] || item[propsAlias.value.key]);
  53753. return label.toLowerCase().includes(panelState.query.toLowerCase());
  53754. }
  53755. });
  53756. });
  53757. const checkableData = vue.computed(() => filteredData.value.filter((item) => !item[propsAlias.value.disabled]));
  53758. const checkedSummary = vue.computed(() => {
  53759. const checkedLength = panelState.checked.length;
  53760. const dataLength = props.data.length;
  53761. const { noChecked, hasChecked } = props.format;
  53762. if (noChecked && hasChecked) {
  53763. return checkedLength > 0 ? hasChecked.replace(/\${checked}/g, checkedLength.toString()).replace(/\${total}/g, dataLength.toString()) : noChecked.replace(/\${total}/g, dataLength.toString());
  53764. } else {
  53765. return `${checkedLength}/${dataLength}`;
  53766. }
  53767. });
  53768. const isIndeterminate = vue.computed(() => {
  53769. const checkedLength = panelState.checked.length;
  53770. return checkedLength > 0 && checkedLength < checkableData.value.length;
  53771. });
  53772. const updateAllChecked = () => {
  53773. const checkableDataKeys = checkableData.value.map((item) => item[propsAlias.value.key]);
  53774. panelState.allChecked = checkableDataKeys.length > 0 && checkableDataKeys.every((item) => panelState.checked.includes(item));
  53775. };
  53776. const handleAllCheckedChange = (value) => {
  53777. panelState.checked = value ? checkableData.value.map((item) => item[propsAlias.value.key]) : [];
  53778. };
  53779. vue.watch(() => panelState.checked, (val, oldVal) => {
  53780. updateAllChecked();
  53781. if (panelState.checkChangeByUser) {
  53782. const movedKeys = val.concat(oldVal).filter((v) => !val.includes(v) || !oldVal.includes(v));
  53783. emit(CHECKED_CHANGE_EVENT, val, movedKeys);
  53784. } else {
  53785. emit(CHECKED_CHANGE_EVENT, val);
  53786. panelState.checkChangeByUser = true;
  53787. }
  53788. });
  53789. vue.watch(checkableData, () => {
  53790. updateAllChecked();
  53791. });
  53792. vue.watch(() => props.data, () => {
  53793. const checked = [];
  53794. const filteredDataKeys = filteredData.value.map((item) => item[propsAlias.value.key]);
  53795. panelState.checked.forEach((item) => {
  53796. if (filteredDataKeys.includes(item)) {
  53797. checked.push(item);
  53798. }
  53799. });
  53800. panelState.checkChangeByUser = false;
  53801. panelState.checked = checked;
  53802. });
  53803. vue.watch(() => props.defaultChecked, (val, oldVal) => {
  53804. if (oldVal && val.length === oldVal.length && val.every((item) => oldVal.includes(item)))
  53805. return;
  53806. const checked = [];
  53807. const checkableDataKeys = checkableData.value.map((item) => item[propsAlias.value.key]);
  53808. val.forEach((item) => {
  53809. if (checkableDataKeys.includes(item)) {
  53810. checked.push(item);
  53811. }
  53812. });
  53813. panelState.checkChangeByUser = false;
  53814. panelState.checked = checked;
  53815. }, {
  53816. immediate: true
  53817. });
  53818. return {
  53819. filteredData,
  53820. checkableData,
  53821. checkedSummary,
  53822. isIndeterminate,
  53823. updateAllChecked,
  53824. handleAllCheckedChange
  53825. };
  53826. };
  53827. const useCheckedChange = (checkedState, emit) => {
  53828. const onSourceCheckedChange = (val, movedKeys) => {
  53829. checkedState.leftChecked = val;
  53830. if (!movedKeys)
  53831. return;
  53832. emit(LEFT_CHECK_CHANGE_EVENT, val, movedKeys);
  53833. };
  53834. const onTargetCheckedChange = (val, movedKeys) => {
  53835. checkedState.rightChecked = val;
  53836. if (!movedKeys)
  53837. return;
  53838. emit(RIGHT_CHECK_CHANGE_EVENT, val, movedKeys);
  53839. };
  53840. return {
  53841. onSourceCheckedChange,
  53842. onTargetCheckedChange
  53843. };
  53844. };
  53845. const useComputedData = (props) => {
  53846. const propsAlias = usePropsAlias(props);
  53847. const dataObj = vue.computed(() => props.data.reduce((o, cur) => (o[cur[propsAlias.value.key]] = cur) && o, {}));
  53848. const sourceData = vue.computed(() => props.data.filter((item) => !props.modelValue.includes(item[propsAlias.value.key])));
  53849. const targetData = vue.computed(() => {
  53850. if (props.targetOrder === "original") {
  53851. return props.data.filter((item) => props.modelValue.includes(item[propsAlias.value.key]));
  53852. } else {
  53853. return props.modelValue.reduce((arr, cur) => {
  53854. const val = dataObj.value[cur];
  53855. if (val) {
  53856. arr.push(val);
  53857. }
  53858. return arr;
  53859. }, []);
  53860. }
  53861. });
  53862. return {
  53863. sourceData,
  53864. targetData
  53865. };
  53866. };
  53867. const useMove = (props, checkedState, emit) => {
  53868. const propsAlias = usePropsAlias(props);
  53869. const _emit = (value, direction, movedKeys) => {
  53870. emit(UPDATE_MODEL_EVENT, value);
  53871. emit(CHANGE_EVENT, value, direction, movedKeys);
  53872. };
  53873. const addToLeft = () => {
  53874. const currentValue = props.modelValue.slice();
  53875. checkedState.rightChecked.forEach((item) => {
  53876. const index = currentValue.indexOf(item);
  53877. if (index > -1) {
  53878. currentValue.splice(index, 1);
  53879. }
  53880. });
  53881. _emit(currentValue, "left", checkedState.rightChecked);
  53882. };
  53883. const addToRight = () => {
  53884. let currentValue = props.modelValue.slice();
  53885. const itemsToBeMoved = props.data.filter((item) => {
  53886. const itemKey = item[propsAlias.value.key];
  53887. return checkedState.leftChecked.includes(itemKey) && !props.modelValue.includes(itemKey);
  53888. }).map((item) => item[propsAlias.value.key]);
  53889. currentValue = props.targetOrder === "unshift" ? itemsToBeMoved.concat(currentValue) : currentValue.concat(itemsToBeMoved);
  53890. if (props.targetOrder === "original") {
  53891. currentValue = props.data.filter((item) => currentValue.includes(item[propsAlias.value.key])).map((item) => item[propsAlias.value.key]);
  53892. }
  53893. _emit(currentValue, "right", checkedState.leftChecked);
  53894. };
  53895. return {
  53896. addToLeft,
  53897. addToRight
  53898. };
  53899. };
  53900. const __default__$m = vue.defineComponent({
  53901. name: "ElTransferPanel"
  53902. });
  53903. const _sfc_main$r = /* @__PURE__ */ vue.defineComponent({
  53904. ...__default__$m,
  53905. props: transferPanelProps,
  53906. emits: transferPanelEmits,
  53907. setup(__props, { expose, emit }) {
  53908. const props = __props;
  53909. const slots = vue.useSlots();
  53910. const OptionContent = ({ option }) => option;
  53911. const { t } = useLocale();
  53912. const ns = useNamespace("transfer");
  53913. const panelState = vue.reactive({
  53914. checked: [],
  53915. allChecked: false,
  53916. query: "",
  53917. checkChangeByUser: true
  53918. });
  53919. const propsAlias = usePropsAlias(props);
  53920. const {
  53921. filteredData,
  53922. checkedSummary,
  53923. isIndeterminate,
  53924. handleAllCheckedChange
  53925. } = useCheck$1(props, panelState, emit);
  53926. const hasNoMatch = vue.computed(() => !isEmpty(panelState.query) && isEmpty(filteredData.value));
  53927. const hasFooter = vue.computed(() => !isEmpty(slots.default()[0].children));
  53928. const { checked, allChecked, query } = vue.toRefs(panelState);
  53929. expose({
  53930. query
  53931. });
  53932. return (_ctx, _cache) => {
  53933. return vue.openBlock(), vue.createElementBlock("div", {
  53934. class: vue.normalizeClass(vue.unref(ns).b("panel"))
  53935. }, [
  53936. vue.createElementVNode("p", {
  53937. class: vue.normalizeClass(vue.unref(ns).be("panel", "header"))
  53938. }, [
  53939. vue.createVNode(vue.unref(ElCheckbox), {
  53940. modelValue: vue.unref(allChecked),
  53941. "onUpdate:modelValue": ($event) => vue.isRef(allChecked) ? allChecked.value = $event : null,
  53942. indeterminate: vue.unref(isIndeterminate),
  53943. "validate-event": false,
  53944. onChange: vue.unref(handleAllCheckedChange)
  53945. }, {
  53946. default: vue.withCtx(() => [
  53947. vue.createTextVNode(vue.toDisplayString(_ctx.title) + " ", 1),
  53948. vue.createElementVNode("span", null, vue.toDisplayString(vue.unref(checkedSummary)), 1)
  53949. ]),
  53950. _: 1
  53951. }, 8, ["modelValue", "onUpdate:modelValue", "indeterminate", "onChange"])
  53952. ], 2),
  53953. vue.createElementVNode("div", {
  53954. class: vue.normalizeClass([vue.unref(ns).be("panel", "body"), vue.unref(ns).is("with-footer", vue.unref(hasFooter))])
  53955. }, [
  53956. _ctx.filterable ? (vue.openBlock(), vue.createBlock(vue.unref(ElInput), {
  53957. key: 0,
  53958. modelValue: vue.unref(query),
  53959. "onUpdate:modelValue": ($event) => vue.isRef(query) ? query.value = $event : null,
  53960. class: vue.normalizeClass(vue.unref(ns).be("panel", "filter")),
  53961. size: "default",
  53962. placeholder: _ctx.placeholder,
  53963. "prefix-icon": vue.unref(search_default),
  53964. clearable: "",
  53965. "validate-event": false
  53966. }, null, 8, ["modelValue", "onUpdate:modelValue", "class", "placeholder", "prefix-icon"])) : vue.createCommentVNode("v-if", true),
  53967. vue.withDirectives(vue.createVNode(vue.unref(ElCheckboxGroup$1), {
  53968. modelValue: vue.unref(checked),
  53969. "onUpdate:modelValue": ($event) => vue.isRef(checked) ? checked.value = $event : null,
  53970. "validate-event": false,
  53971. class: vue.normalizeClass([vue.unref(ns).is("filterable", _ctx.filterable), vue.unref(ns).be("panel", "list")])
  53972. }, {
  53973. default: vue.withCtx(() => [
  53974. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(filteredData), (item) => {
  53975. return vue.openBlock(), vue.createBlock(vue.unref(ElCheckbox), {
  53976. key: item[vue.unref(propsAlias).key],
  53977. class: vue.normalizeClass(vue.unref(ns).be("panel", "item")),
  53978. value: item[vue.unref(propsAlias).key],
  53979. disabled: item[vue.unref(propsAlias).disabled],
  53980. "validate-event": false
  53981. }, {
  53982. default: vue.withCtx(() => {
  53983. var _a;
  53984. return [
  53985. vue.createVNode(OptionContent, {
  53986. option: (_a = _ctx.optionRender) == null ? void 0 : _a.call(_ctx, item)
  53987. }, null, 8, ["option"])
  53988. ];
  53989. }),
  53990. _: 2
  53991. }, 1032, ["class", "value", "disabled"]);
  53992. }), 128))
  53993. ]),
  53994. _: 1
  53995. }, 8, ["modelValue", "onUpdate:modelValue", "class"]), [
  53996. [vue.vShow, !vue.unref(hasNoMatch) && !vue.unref(isEmpty)(_ctx.data)]
  53997. ]),
  53998. vue.withDirectives(vue.createElementVNode("div", {
  53999. class: vue.normalizeClass(vue.unref(ns).be("panel", "empty"))
  54000. }, [
  54001. vue.renderSlot(_ctx.$slots, "empty", {}, () => [
  54002. vue.createTextVNode(vue.toDisplayString(vue.unref(hasNoMatch) ? vue.unref(t)("el.transfer.noMatch") : vue.unref(t)("el.transfer.noData")), 1)
  54003. ])
  54004. ], 2), [
  54005. [vue.vShow, vue.unref(hasNoMatch) || vue.unref(isEmpty)(_ctx.data)]
  54006. ])
  54007. ], 2),
  54008. vue.unref(hasFooter) ? (vue.openBlock(), vue.createElementBlock("p", {
  54009. key: 0,
  54010. class: vue.normalizeClass(vue.unref(ns).be("panel", "footer"))
  54011. }, [
  54012. vue.renderSlot(_ctx.$slots, "default")
  54013. ], 2)) : vue.createCommentVNode("v-if", true)
  54014. ], 2);
  54015. };
  54016. }
  54017. });
  54018. var TransferPanel = /* @__PURE__ */ _export_sfc(_sfc_main$r, [["__file", "transfer-panel.vue"]]);
  54019. const __default__$l = vue.defineComponent({
  54020. name: "ElTransfer"
  54021. });
  54022. const _sfc_main$q = /* @__PURE__ */ vue.defineComponent({
  54023. ...__default__$l,
  54024. props: transferProps,
  54025. emits: transferEmits,
  54026. setup(__props, { expose, emit }) {
  54027. const props = __props;
  54028. const slots = vue.useSlots();
  54029. const { t } = useLocale();
  54030. const ns = useNamespace("transfer");
  54031. const { formItem } = useFormItem();
  54032. const checkedState = vue.reactive({
  54033. leftChecked: [],
  54034. rightChecked: []
  54035. });
  54036. const propsAlias = usePropsAlias(props);
  54037. const { sourceData, targetData } = useComputedData(props);
  54038. const { onSourceCheckedChange, onTargetCheckedChange } = useCheckedChange(checkedState, emit);
  54039. const { addToLeft, addToRight } = useMove(props, checkedState, emit);
  54040. const leftPanel = vue.ref();
  54041. const rightPanel = vue.ref();
  54042. const clearQuery = (which) => {
  54043. switch (which) {
  54044. case "left":
  54045. leftPanel.value.query = "";
  54046. break;
  54047. case "right":
  54048. rightPanel.value.query = "";
  54049. break;
  54050. }
  54051. };
  54052. const hasButtonTexts = vue.computed(() => props.buttonTexts.length === 2);
  54053. const leftPanelTitle = vue.computed(() => props.titles[0] || t("el.transfer.titles.0"));
  54054. const rightPanelTitle = vue.computed(() => props.titles[1] || t("el.transfer.titles.1"));
  54055. const panelFilterPlaceholder = vue.computed(() => props.filterPlaceholder || t("el.transfer.filterPlaceholder"));
  54056. vue.watch(() => props.modelValue, () => {
  54057. var _a;
  54058. if (props.validateEvent) {
  54059. (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "change").catch((err) => debugWarn(err));
  54060. }
  54061. });
  54062. const optionRender = vue.computed(() => (option) => {
  54063. var _a;
  54064. if (props.renderContent)
  54065. return props.renderContent(vue.h, option);
  54066. const defaultSlotVNodes = (((_a = slots.default) == null ? void 0 : _a.call(slots, { option })) || []).filter((node) => node.type !== vue.Comment);
  54067. if (defaultSlotVNodes.length) {
  54068. return defaultSlotVNodes;
  54069. }
  54070. return vue.h("span", option[propsAlias.value.label] || option[propsAlias.value.key]);
  54071. });
  54072. expose({
  54073. clearQuery,
  54074. leftPanel,
  54075. rightPanel
  54076. });
  54077. return (_ctx, _cache) => {
  54078. return vue.openBlock(), vue.createElementBlock("div", {
  54079. class: vue.normalizeClass(vue.unref(ns).b())
  54080. }, [
  54081. vue.createVNode(TransferPanel, {
  54082. ref_key: "leftPanel",
  54083. ref: leftPanel,
  54084. data: vue.unref(sourceData),
  54085. "option-render": vue.unref(optionRender),
  54086. placeholder: vue.unref(panelFilterPlaceholder),
  54087. title: vue.unref(leftPanelTitle),
  54088. filterable: _ctx.filterable,
  54089. format: _ctx.format,
  54090. "filter-method": _ctx.filterMethod,
  54091. "default-checked": _ctx.leftDefaultChecked,
  54092. props: props.props,
  54093. onCheckedChange: vue.unref(onSourceCheckedChange)
  54094. }, {
  54095. empty: vue.withCtx(() => [
  54096. vue.renderSlot(_ctx.$slots, "left-empty")
  54097. ]),
  54098. default: vue.withCtx(() => [
  54099. vue.renderSlot(_ctx.$slots, "left-footer")
  54100. ]),
  54101. _: 3
  54102. }, 8, ["data", "option-render", "placeholder", "title", "filterable", "format", "filter-method", "default-checked", "props", "onCheckedChange"]),
  54103. vue.createElementVNode("div", {
  54104. class: vue.normalizeClass(vue.unref(ns).e("buttons"))
  54105. }, [
  54106. vue.createVNode(vue.unref(ElButton), {
  54107. type: "primary",
  54108. class: vue.normalizeClass([vue.unref(ns).e("button"), vue.unref(ns).is("with-texts", vue.unref(hasButtonTexts))]),
  54109. disabled: vue.unref(isEmpty)(checkedState.rightChecked),
  54110. onClick: vue.unref(addToLeft)
  54111. }, {
  54112. default: vue.withCtx(() => [
  54113. vue.createVNode(vue.unref(ElIcon), null, {
  54114. default: vue.withCtx(() => [
  54115. vue.createVNode(vue.unref(arrow_left_default))
  54116. ]),
  54117. _: 1
  54118. }),
  54119. !vue.unref(isUndefined)(_ctx.buttonTexts[0]) ? (vue.openBlock(), vue.createElementBlock("span", { key: 0 }, vue.toDisplayString(_ctx.buttonTexts[0]), 1)) : vue.createCommentVNode("v-if", true)
  54120. ]),
  54121. _: 1
  54122. }, 8, ["class", "disabled", "onClick"]),
  54123. vue.createVNode(vue.unref(ElButton), {
  54124. type: "primary",
  54125. class: vue.normalizeClass([vue.unref(ns).e("button"), vue.unref(ns).is("with-texts", vue.unref(hasButtonTexts))]),
  54126. disabled: vue.unref(isEmpty)(checkedState.leftChecked),
  54127. onClick: vue.unref(addToRight)
  54128. }, {
  54129. default: vue.withCtx(() => [
  54130. !vue.unref(isUndefined)(_ctx.buttonTexts[1]) ? (vue.openBlock(), vue.createElementBlock("span", { key: 0 }, vue.toDisplayString(_ctx.buttonTexts[1]), 1)) : vue.createCommentVNode("v-if", true),
  54131. vue.createVNode(vue.unref(ElIcon), null, {
  54132. default: vue.withCtx(() => [
  54133. vue.createVNode(vue.unref(arrow_right_default))
  54134. ]),
  54135. _: 1
  54136. })
  54137. ]),
  54138. _: 1
  54139. }, 8, ["class", "disabled", "onClick"])
  54140. ], 2),
  54141. vue.createVNode(TransferPanel, {
  54142. ref_key: "rightPanel",
  54143. ref: rightPanel,
  54144. data: vue.unref(targetData),
  54145. "option-render": vue.unref(optionRender),
  54146. placeholder: vue.unref(panelFilterPlaceholder),
  54147. filterable: _ctx.filterable,
  54148. format: _ctx.format,
  54149. "filter-method": _ctx.filterMethod,
  54150. title: vue.unref(rightPanelTitle),
  54151. "default-checked": _ctx.rightDefaultChecked,
  54152. props: props.props,
  54153. onCheckedChange: vue.unref(onTargetCheckedChange)
  54154. }, {
  54155. empty: vue.withCtx(() => [
  54156. vue.renderSlot(_ctx.$slots, "right-empty")
  54157. ]),
  54158. default: vue.withCtx(() => [
  54159. vue.renderSlot(_ctx.$slots, "right-footer")
  54160. ]),
  54161. _: 3
  54162. }, 8, ["data", "option-render", "placeholder", "filterable", "format", "filter-method", "title", "default-checked", "props", "onCheckedChange"])
  54163. ], 2);
  54164. };
  54165. }
  54166. });
  54167. var Transfer = /* @__PURE__ */ _export_sfc(_sfc_main$q, [["__file", "transfer.vue"]]);
  54168. const ElTransfer = withInstall(Transfer);
  54169. const NODE_KEY = "$treeNodeId";
  54170. const markNodeData = function(node, data) {
  54171. if (!data || data[NODE_KEY])
  54172. return;
  54173. Object.defineProperty(data, NODE_KEY, {
  54174. value: node.id,
  54175. enumerable: false,
  54176. configurable: false,
  54177. writable: false
  54178. });
  54179. };
  54180. const getNodeKey = (key, data) => data == null ? void 0 : data[key || NODE_KEY];
  54181. const handleCurrentChange = (store, emit, setCurrent) => {
  54182. const preCurrentNode = store.value.currentNode;
  54183. setCurrent();
  54184. const currentNode = store.value.currentNode;
  54185. if (preCurrentNode === currentNode)
  54186. return;
  54187. emit("current-change", currentNode ? currentNode.data : null, currentNode);
  54188. };
  54189. const getChildState = (node) => {
  54190. let all = true;
  54191. let none = true;
  54192. let allWithoutDisable = true;
  54193. for (let i = 0, j = node.length; i < j; i++) {
  54194. const n = node[i];
  54195. if (n.checked !== true || n.indeterminate) {
  54196. all = false;
  54197. if (!n.disabled) {
  54198. allWithoutDisable = false;
  54199. }
  54200. }
  54201. if (n.checked !== false || n.indeterminate) {
  54202. none = false;
  54203. }
  54204. }
  54205. return { all, none, allWithoutDisable, half: !all && !none };
  54206. };
  54207. const reInitChecked = function(node) {
  54208. if (node.childNodes.length === 0 || node.loading)
  54209. return;
  54210. const { all, none, half } = getChildState(node.childNodes);
  54211. if (all) {
  54212. node.checked = true;
  54213. node.indeterminate = false;
  54214. } else if (half) {
  54215. node.checked = false;
  54216. node.indeterminate = true;
  54217. } else if (none) {
  54218. node.checked = false;
  54219. node.indeterminate = false;
  54220. }
  54221. const parent = node.parent;
  54222. if (!parent || parent.level === 0)
  54223. return;
  54224. if (!node.store.checkStrictly) {
  54225. reInitChecked(parent);
  54226. }
  54227. };
  54228. const getPropertyFromData = function(node, prop) {
  54229. const props = node.store.props;
  54230. const data = node.data || {};
  54231. const config = props[prop];
  54232. if (isFunction$1(config)) {
  54233. return config(data, node);
  54234. } else if (isString$1(config)) {
  54235. return data[config];
  54236. } else if (isUndefined(config)) {
  54237. const dataProp = data[prop];
  54238. return isUndefined(dataProp) ? "" : dataProp;
  54239. }
  54240. };
  54241. const setCanFocus = function(childNodes, focus) {
  54242. childNodes.forEach((item) => {
  54243. item.canFocus = focus;
  54244. setCanFocus(item.childNodes, focus);
  54245. });
  54246. };
  54247. let nodeIdSeed = 0;
  54248. class Node$1 {
  54249. constructor(options) {
  54250. this.isLeafByUser = void 0;
  54251. this.isLeaf = void 0;
  54252. this.id = nodeIdSeed++;
  54253. this.text = null;
  54254. this.checked = false;
  54255. this.indeterminate = false;
  54256. this.data = null;
  54257. this.expanded = false;
  54258. this.parent = null;
  54259. this.visible = true;
  54260. this.isCurrent = false;
  54261. this.canFocus = false;
  54262. for (const name in options) {
  54263. if (hasOwn(options, name)) {
  54264. this[name] = options[name];
  54265. }
  54266. }
  54267. this.level = 0;
  54268. this.loaded = false;
  54269. this.childNodes = [];
  54270. this.loading = false;
  54271. if (this.parent) {
  54272. this.level = this.parent.level + 1;
  54273. }
  54274. }
  54275. initialize() {
  54276. var _a;
  54277. const store = this.store;
  54278. if (!store) {
  54279. throw new Error("[Node]store is required!");
  54280. }
  54281. store.registerNode(this);
  54282. const props = store.props;
  54283. if (props && typeof props.isLeaf !== "undefined") {
  54284. const isLeaf = getPropertyFromData(this, "isLeaf");
  54285. if (isBoolean(isLeaf)) {
  54286. this.isLeafByUser = isLeaf;
  54287. }
  54288. }
  54289. if (store.lazy !== true && this.data) {
  54290. this.setData(this.data);
  54291. if (store.defaultExpandAll) {
  54292. this.expanded = true;
  54293. this.canFocus = true;
  54294. }
  54295. } else if (this.level > 0 && store.lazy && store.defaultExpandAll && !this.isLeafByUser) {
  54296. this.expand();
  54297. }
  54298. if (!isArray$1(this.data)) {
  54299. markNodeData(this, this.data);
  54300. }
  54301. if (!this.data)
  54302. return;
  54303. const defaultExpandedKeys = store.defaultExpandedKeys;
  54304. const key = store.key;
  54305. if (key && !isNil(this.key) && defaultExpandedKeys && defaultExpandedKeys.includes(this.key)) {
  54306. this.expand(null, store.autoExpandParent);
  54307. }
  54308. if (key && store.currentNodeKey !== void 0 && this.key === store.currentNodeKey) {
  54309. store.currentNode = this;
  54310. store.currentNode.isCurrent = true;
  54311. }
  54312. if (store.lazy) {
  54313. store._initDefaultCheckedNode(this);
  54314. }
  54315. this.updateLeafState();
  54316. if (this.level === 1 || ((_a = this.parent) == null ? void 0 : _a.expanded) === true)
  54317. this.canFocus = true;
  54318. }
  54319. setData(data) {
  54320. if (!isArray$1(data)) {
  54321. markNodeData(this, data);
  54322. }
  54323. this.data = data;
  54324. this.childNodes = [];
  54325. let children;
  54326. if (this.level === 0 && isArray$1(this.data)) {
  54327. children = this.data;
  54328. } else {
  54329. children = getPropertyFromData(this, "children") || [];
  54330. }
  54331. for (let i = 0, j = children.length; i < j; i++) {
  54332. this.insertChild({ data: children[i] });
  54333. }
  54334. }
  54335. get label() {
  54336. return getPropertyFromData(this, "label");
  54337. }
  54338. get key() {
  54339. const nodeKey = this.store.key;
  54340. if (this.data)
  54341. return this.data[nodeKey];
  54342. return null;
  54343. }
  54344. get disabled() {
  54345. return getPropertyFromData(this, "disabled");
  54346. }
  54347. get nextSibling() {
  54348. const parent = this.parent;
  54349. if (parent) {
  54350. const index = parent.childNodes.indexOf(this);
  54351. if (index > -1) {
  54352. return parent.childNodes[index + 1];
  54353. }
  54354. }
  54355. return null;
  54356. }
  54357. get previousSibling() {
  54358. const parent = this.parent;
  54359. if (parent) {
  54360. const index = parent.childNodes.indexOf(this);
  54361. if (index > -1) {
  54362. return index > 0 ? parent.childNodes[index - 1] : null;
  54363. }
  54364. }
  54365. return null;
  54366. }
  54367. contains(target, deep = true) {
  54368. return (this.childNodes || []).some((child) => child === target || deep && child.contains(target));
  54369. }
  54370. remove() {
  54371. const parent = this.parent;
  54372. if (parent) {
  54373. parent.removeChild(this);
  54374. }
  54375. }
  54376. insertChild(child, index, batch) {
  54377. if (!child)
  54378. throw new Error("InsertChild error: child is required.");
  54379. if (!(child instanceof Node$1)) {
  54380. if (!batch) {
  54381. const children = this.getChildren(true);
  54382. if (!(children == null ? void 0 : children.includes(child.data))) {
  54383. if (isUndefined(index) || index < 0) {
  54384. children == null ? void 0 : children.push(child.data);
  54385. } else {
  54386. children == null ? void 0 : children.splice(index, 0, child.data);
  54387. }
  54388. }
  54389. }
  54390. Object.assign(child, {
  54391. parent: this,
  54392. store: this.store
  54393. });
  54394. child = vue.reactive(new Node$1(child));
  54395. if (child instanceof Node$1) {
  54396. child.initialize();
  54397. }
  54398. }
  54399. child.level = this.level + 1;
  54400. if (isUndefined(index) || index < 0) {
  54401. this.childNodes.push(child);
  54402. } else {
  54403. this.childNodes.splice(index, 0, child);
  54404. }
  54405. this.updateLeafState();
  54406. }
  54407. insertBefore(child, ref) {
  54408. let index;
  54409. if (ref) {
  54410. index = this.childNodes.indexOf(ref);
  54411. }
  54412. this.insertChild(child, index);
  54413. }
  54414. insertAfter(child, ref) {
  54415. let index;
  54416. if (ref) {
  54417. index = this.childNodes.indexOf(ref);
  54418. if (index !== -1)
  54419. index += 1;
  54420. }
  54421. this.insertChild(child, index);
  54422. }
  54423. removeChild(child) {
  54424. const children = this.getChildren() || [];
  54425. const dataIndex = children.indexOf(child.data);
  54426. if (dataIndex > -1) {
  54427. children.splice(dataIndex, 1);
  54428. }
  54429. const index = this.childNodes.indexOf(child);
  54430. if (index > -1) {
  54431. this.store && this.store.deregisterNode(child);
  54432. child.parent = null;
  54433. this.childNodes.splice(index, 1);
  54434. }
  54435. this.updateLeafState();
  54436. }
  54437. removeChildByData(data) {
  54438. let targetNode = null;
  54439. for (let i = 0; i < this.childNodes.length; i++) {
  54440. if (this.childNodes[i].data === data) {
  54441. targetNode = this.childNodes[i];
  54442. break;
  54443. }
  54444. }
  54445. if (targetNode) {
  54446. this.removeChild(targetNode);
  54447. }
  54448. }
  54449. expand(callback, expandParent) {
  54450. const done = () => {
  54451. if (expandParent) {
  54452. let parent = this.parent;
  54453. while (parent && parent.level > 0) {
  54454. parent.expanded = true;
  54455. parent = parent.parent;
  54456. }
  54457. }
  54458. this.expanded = true;
  54459. if (callback)
  54460. callback();
  54461. setCanFocus(this.childNodes, true);
  54462. };
  54463. if (this.shouldLoadData()) {
  54464. this.loadData((data) => {
  54465. if (isArray$1(data)) {
  54466. if (this.checked) {
  54467. this.setChecked(true, true);
  54468. } else if (!this.store.checkStrictly) {
  54469. reInitChecked(this);
  54470. }
  54471. done();
  54472. }
  54473. });
  54474. } else {
  54475. done();
  54476. }
  54477. }
  54478. doCreateChildren(array, defaultProps = {}) {
  54479. array.forEach((item) => {
  54480. this.insertChild(Object.assign({ data: item }, defaultProps), void 0, true);
  54481. });
  54482. }
  54483. collapse() {
  54484. this.expanded = false;
  54485. setCanFocus(this.childNodes, false);
  54486. }
  54487. shouldLoadData() {
  54488. return Boolean(this.store.lazy === true && this.store.load && !this.loaded);
  54489. }
  54490. updateLeafState() {
  54491. if (this.store.lazy === true && this.loaded !== true && typeof this.isLeafByUser !== "undefined") {
  54492. this.isLeaf = this.isLeafByUser;
  54493. return;
  54494. }
  54495. const childNodes = this.childNodes;
  54496. if (!this.store.lazy || this.store.lazy === true && this.loaded === true) {
  54497. this.isLeaf = !childNodes || childNodes.length === 0;
  54498. return;
  54499. }
  54500. this.isLeaf = false;
  54501. }
  54502. setChecked(value, deep, recursion, passValue) {
  54503. this.indeterminate = value === "half";
  54504. this.checked = value === true;
  54505. if (this.store.checkStrictly)
  54506. return;
  54507. if (!(this.shouldLoadData() && !this.store.checkDescendants)) {
  54508. const { all, allWithoutDisable } = getChildState(this.childNodes);
  54509. if (!this.isLeaf && !all && allWithoutDisable) {
  54510. this.checked = false;
  54511. value = false;
  54512. }
  54513. const handleDescendants = () => {
  54514. if (deep) {
  54515. const childNodes = this.childNodes;
  54516. for (let i = 0, j = childNodes.length; i < j; i++) {
  54517. const child = childNodes[i];
  54518. passValue = passValue || value !== false;
  54519. const isCheck = child.disabled ? child.checked : passValue;
  54520. child.setChecked(isCheck, deep, true, passValue);
  54521. }
  54522. const { half, all: all2 } = getChildState(childNodes);
  54523. if (!all2) {
  54524. this.checked = all2;
  54525. this.indeterminate = half;
  54526. }
  54527. }
  54528. };
  54529. if (this.shouldLoadData()) {
  54530. this.loadData(() => {
  54531. handleDescendants();
  54532. reInitChecked(this);
  54533. }, {
  54534. checked: value !== false
  54535. });
  54536. return;
  54537. } else {
  54538. handleDescendants();
  54539. }
  54540. }
  54541. const parent = this.parent;
  54542. if (!parent || parent.level === 0)
  54543. return;
  54544. if (!recursion) {
  54545. reInitChecked(parent);
  54546. }
  54547. }
  54548. getChildren(forceInit = false) {
  54549. if (this.level === 0)
  54550. return this.data;
  54551. const data = this.data;
  54552. if (!data)
  54553. return null;
  54554. const props = this.store.props;
  54555. let children = "children";
  54556. if (props) {
  54557. children = props.children || "children";
  54558. }
  54559. if (isUndefined(data[children])) {
  54560. data[children] = null;
  54561. }
  54562. if (forceInit && !data[children]) {
  54563. data[children] = [];
  54564. }
  54565. return data[children];
  54566. }
  54567. updateChildren() {
  54568. const newData = this.getChildren() || [];
  54569. const oldData = this.childNodes.map((node) => node.data);
  54570. const newDataMap = {};
  54571. const newNodes = [];
  54572. newData.forEach((item, index) => {
  54573. const key = item[NODE_KEY];
  54574. const isNodeExists = !!key && oldData.some((data) => (data == null ? void 0 : data[NODE_KEY]) === key);
  54575. if (isNodeExists) {
  54576. newDataMap[key] = { index, data: item };
  54577. } else {
  54578. newNodes.push({ index, data: item });
  54579. }
  54580. });
  54581. if (!this.store.lazy) {
  54582. oldData.forEach((item) => {
  54583. if (!newDataMap[item == null ? void 0 : item[NODE_KEY]])
  54584. this.removeChildByData(item);
  54585. });
  54586. }
  54587. newNodes.forEach(({ index, data }) => {
  54588. this.insertChild({ data }, index);
  54589. });
  54590. this.updateLeafState();
  54591. }
  54592. loadData(callback, defaultProps = {}) {
  54593. if (this.store.lazy === true && this.store.load && !this.loaded && (!this.loading || Object.keys(defaultProps).length)) {
  54594. this.loading = true;
  54595. const resolve = (children) => {
  54596. this.childNodes = [];
  54597. this.doCreateChildren(children, defaultProps);
  54598. this.loaded = true;
  54599. this.loading = false;
  54600. this.updateLeafState();
  54601. if (callback) {
  54602. callback.call(this, children);
  54603. }
  54604. };
  54605. const reject = () => {
  54606. this.loading = false;
  54607. };
  54608. this.store.load(this, resolve, reject);
  54609. } else {
  54610. if (callback) {
  54611. callback.call(this);
  54612. }
  54613. }
  54614. }
  54615. eachNode(callback) {
  54616. const arr = [this];
  54617. while (arr.length) {
  54618. const node = arr.shift();
  54619. arr.unshift(...node.childNodes);
  54620. callback(node);
  54621. }
  54622. }
  54623. reInitChecked() {
  54624. if (this.store.checkStrictly)
  54625. return;
  54626. reInitChecked(this);
  54627. }
  54628. }
  54629. var Node$2 = Node$1;
  54630. class TreeStore {
  54631. constructor(options) {
  54632. this.lazy = false;
  54633. this.checkStrictly = false;
  54634. this.autoExpandParent = false;
  54635. this.defaultExpandAll = false;
  54636. this.checkDescendants = false;
  54637. this.currentNode = null;
  54638. this.currentNodeKey = null;
  54639. for (const option in options) {
  54640. if (hasOwn(options, option)) {
  54641. this[option] = options[option];
  54642. }
  54643. }
  54644. this.nodesMap = {};
  54645. }
  54646. initialize() {
  54647. this.root = new Node$2({
  54648. data: this.data,
  54649. store: this
  54650. });
  54651. this.root.initialize();
  54652. if (this.lazy && this.load) {
  54653. const loadFn = this.load;
  54654. loadFn(this.root, (data) => {
  54655. this.root.doCreateChildren(data);
  54656. this._initDefaultCheckedNodes();
  54657. }, NOOP);
  54658. } else {
  54659. this._initDefaultCheckedNodes();
  54660. }
  54661. }
  54662. filter(value) {
  54663. const filterNodeMethod = this.filterNodeMethod;
  54664. const lazy = this.lazy;
  54665. const traverse = async function(node) {
  54666. const childNodes = node.root ? node.root.childNodes : node.childNodes;
  54667. for (const [index, child] of childNodes.entries()) {
  54668. child.visible = !!(filterNodeMethod == null ? void 0 : filterNodeMethod.call(child, value, child.data, child));
  54669. if (index % 80 === 0 && index > 0) {
  54670. await vue.nextTick();
  54671. }
  54672. await traverse(child);
  54673. }
  54674. if (!node.visible && childNodes.length) {
  54675. let allHidden = true;
  54676. allHidden = !childNodes.some((child) => child.visible);
  54677. if (node.root) {
  54678. node.root.visible = allHidden === false;
  54679. } else {
  54680. node.visible = allHidden === false;
  54681. }
  54682. }
  54683. if (!value)
  54684. return;
  54685. if (node.visible && !node.isLeaf) {
  54686. if (!lazy || node.loaded) {
  54687. node.expand();
  54688. }
  54689. }
  54690. };
  54691. traverse(this);
  54692. }
  54693. setData(newVal) {
  54694. const instanceChanged = newVal !== this.root.data;
  54695. if (instanceChanged) {
  54696. this.nodesMap = {};
  54697. this.root.setData(newVal);
  54698. this._initDefaultCheckedNodes();
  54699. this.setCurrentNodeKey(this.currentNodeKey);
  54700. } else {
  54701. this.root.updateChildren();
  54702. }
  54703. }
  54704. getNode(data) {
  54705. if (data instanceof Node$2)
  54706. return data;
  54707. const key = isObject$1(data) ? getNodeKey(this.key, data) : data;
  54708. return this.nodesMap[key] || null;
  54709. }
  54710. insertBefore(data, refData) {
  54711. var _a;
  54712. const refNode = this.getNode(refData);
  54713. (_a = refNode.parent) == null ? void 0 : _a.insertBefore({ data }, refNode);
  54714. }
  54715. insertAfter(data, refData) {
  54716. var _a;
  54717. const refNode = this.getNode(refData);
  54718. (_a = refNode.parent) == null ? void 0 : _a.insertAfter({ data }, refNode);
  54719. }
  54720. remove(data) {
  54721. const node = this.getNode(data);
  54722. if (node && node.parent) {
  54723. if (node === this.currentNode) {
  54724. this.currentNode = null;
  54725. }
  54726. node.parent.removeChild(node);
  54727. }
  54728. }
  54729. append(data, parentData) {
  54730. const parentNode = !isPropAbsent(parentData) ? this.getNode(parentData) : this.root;
  54731. if (parentNode) {
  54732. parentNode.insertChild({ data });
  54733. }
  54734. }
  54735. _initDefaultCheckedNodes() {
  54736. const defaultCheckedKeys = this.defaultCheckedKeys || [];
  54737. const nodesMap = this.nodesMap;
  54738. defaultCheckedKeys.forEach((checkedKey) => {
  54739. const node = nodesMap[checkedKey];
  54740. if (node) {
  54741. node.setChecked(true, !this.checkStrictly);
  54742. }
  54743. });
  54744. }
  54745. _initDefaultCheckedNode(node) {
  54746. const defaultCheckedKeys = this.defaultCheckedKeys || [];
  54747. if (!isNil(node.key) && defaultCheckedKeys.includes(node.key)) {
  54748. node.setChecked(true, !this.checkStrictly);
  54749. }
  54750. }
  54751. setDefaultCheckedKey(newVal) {
  54752. if (newVal !== this.defaultCheckedKeys) {
  54753. this.defaultCheckedKeys = newVal;
  54754. this._initDefaultCheckedNodes();
  54755. }
  54756. }
  54757. registerNode(node) {
  54758. const key = this.key;
  54759. if (!node || !node.data)
  54760. return;
  54761. if (!key) {
  54762. this.nodesMap[node.id] = node;
  54763. } else {
  54764. const nodeKey = node.key;
  54765. if (!isNil(nodeKey))
  54766. this.nodesMap[nodeKey] = node;
  54767. }
  54768. }
  54769. deregisterNode(node) {
  54770. const key = this.key;
  54771. if (!key || !node || !node.data)
  54772. return;
  54773. node.childNodes.forEach((child) => {
  54774. this.deregisterNode(child);
  54775. });
  54776. delete this.nodesMap[node.key];
  54777. }
  54778. getCheckedNodes(leafOnly = false, includeHalfChecked = false) {
  54779. const checkedNodes = [];
  54780. const traverse = function(node) {
  54781. const childNodes = node.root ? node.root.childNodes : node.childNodes;
  54782. childNodes.forEach((child) => {
  54783. if ((child.checked || includeHalfChecked && child.indeterminate) && (!leafOnly || leafOnly && child.isLeaf)) {
  54784. checkedNodes.push(child.data);
  54785. }
  54786. traverse(child);
  54787. });
  54788. };
  54789. traverse(this);
  54790. return checkedNodes;
  54791. }
  54792. getCheckedKeys(leafOnly = false) {
  54793. return this.getCheckedNodes(leafOnly).map((data) => (data || {})[this.key]);
  54794. }
  54795. getHalfCheckedNodes() {
  54796. const nodes = [];
  54797. const traverse = function(node) {
  54798. const childNodes = node.root ? node.root.childNodes : node.childNodes;
  54799. childNodes.forEach((child) => {
  54800. if (child.indeterminate) {
  54801. nodes.push(child.data);
  54802. }
  54803. traverse(child);
  54804. });
  54805. };
  54806. traverse(this);
  54807. return nodes;
  54808. }
  54809. getHalfCheckedKeys() {
  54810. return this.getHalfCheckedNodes().map((data) => (data || {})[this.key]);
  54811. }
  54812. _getAllNodes() {
  54813. const allNodes = [];
  54814. const nodesMap = this.nodesMap;
  54815. for (const nodeKey in nodesMap) {
  54816. if (hasOwn(nodesMap, nodeKey)) {
  54817. allNodes.push(nodesMap[nodeKey]);
  54818. }
  54819. }
  54820. return allNodes;
  54821. }
  54822. updateChildren(key, data) {
  54823. const node = this.nodesMap[key];
  54824. if (!node)
  54825. return;
  54826. const childNodes = node.childNodes;
  54827. for (let i = childNodes.length - 1; i >= 0; i--) {
  54828. const child = childNodes[i];
  54829. this.remove(child.data);
  54830. }
  54831. for (let i = 0, j = data.length; i < j; i++) {
  54832. const child = data[i];
  54833. this.append(child, node.data);
  54834. }
  54835. }
  54836. _setCheckedKeys(key, leafOnly = false, checkedKeys) {
  54837. const allNodes = this._getAllNodes().sort((a, b) => a.level - b.level);
  54838. const cache = /* @__PURE__ */ Object.create(null);
  54839. const keys = Object.keys(checkedKeys);
  54840. allNodes.forEach((node) => node.setChecked(false, false));
  54841. const cacheCheckedChild = (node) => {
  54842. node.childNodes.forEach((child) => {
  54843. var _a;
  54844. cache[child.data[key]] = true;
  54845. if ((_a = child.childNodes) == null ? void 0 : _a.length) {
  54846. cacheCheckedChild(child);
  54847. }
  54848. });
  54849. };
  54850. for (let i = 0, j = allNodes.length; i < j; i++) {
  54851. const node = allNodes[i];
  54852. const nodeKey = node.data[key].toString();
  54853. const checked = keys.includes(nodeKey);
  54854. if (!checked) {
  54855. if (node.checked && !cache[nodeKey]) {
  54856. node.setChecked(false, false);
  54857. }
  54858. continue;
  54859. }
  54860. if (node.childNodes.length) {
  54861. cacheCheckedChild(node);
  54862. }
  54863. if (node.isLeaf || this.checkStrictly) {
  54864. node.setChecked(true, false);
  54865. continue;
  54866. }
  54867. node.setChecked(true, true);
  54868. if (leafOnly) {
  54869. node.setChecked(false, false);
  54870. const traverse = function(node2) {
  54871. const childNodes = node2.childNodes;
  54872. childNodes.forEach((child) => {
  54873. if (!child.isLeaf) {
  54874. child.setChecked(false, false);
  54875. }
  54876. traverse(child);
  54877. });
  54878. };
  54879. traverse(node);
  54880. }
  54881. }
  54882. }
  54883. setCheckedNodes(array, leafOnly = false) {
  54884. const key = this.key;
  54885. const checkedKeys = {};
  54886. array.forEach((item) => {
  54887. checkedKeys[(item || {})[key]] = true;
  54888. });
  54889. this._setCheckedKeys(key, leafOnly, checkedKeys);
  54890. }
  54891. setCheckedKeys(keys, leafOnly = false) {
  54892. this.defaultCheckedKeys = keys;
  54893. const key = this.key;
  54894. const checkedKeys = {};
  54895. keys.forEach((key2) => {
  54896. checkedKeys[key2] = true;
  54897. });
  54898. this._setCheckedKeys(key, leafOnly, checkedKeys);
  54899. }
  54900. setDefaultExpandedKeys(keys) {
  54901. keys = keys || [];
  54902. this.defaultExpandedKeys = keys;
  54903. keys.forEach((key) => {
  54904. const node = this.getNode(key);
  54905. if (node)
  54906. node.expand(null, this.autoExpandParent);
  54907. });
  54908. }
  54909. setChecked(data, checked, deep) {
  54910. const node = this.getNode(data);
  54911. if (node) {
  54912. node.setChecked(!!checked, deep);
  54913. }
  54914. }
  54915. getCurrentNode() {
  54916. return this.currentNode;
  54917. }
  54918. setCurrentNode(currentNode) {
  54919. const prevCurrentNode = this.currentNode;
  54920. if (prevCurrentNode) {
  54921. prevCurrentNode.isCurrent = false;
  54922. }
  54923. this.currentNode = currentNode;
  54924. this.currentNode.isCurrent = true;
  54925. }
  54926. setUserCurrentNode(node, shouldAutoExpandParent = true) {
  54927. var _a;
  54928. const key = node[this.key];
  54929. const currNode = this.nodesMap[key];
  54930. this.setCurrentNode(currNode);
  54931. if (shouldAutoExpandParent && this.currentNode && this.currentNode.level > 1) {
  54932. (_a = this.currentNode.parent) == null ? void 0 : _a.expand(null, true);
  54933. }
  54934. }
  54935. setCurrentNodeKey(key, shouldAutoExpandParent = true) {
  54936. var _a;
  54937. this.currentNodeKey = key;
  54938. if (isPropAbsent(key)) {
  54939. this.currentNode && (this.currentNode.isCurrent = false);
  54940. this.currentNode = null;
  54941. return;
  54942. }
  54943. const node = this.getNode(key);
  54944. if (node) {
  54945. this.setCurrentNode(node);
  54946. if (shouldAutoExpandParent && this.currentNode && this.currentNode.level > 1) {
  54947. (_a = this.currentNode.parent) == null ? void 0 : _a.expand(null, true);
  54948. }
  54949. }
  54950. }
  54951. }
  54952. const ROOT_TREE_INJECTION_KEY$1 = "RootTree";
  54953. const NODE_INSTANCE_INJECTION_KEY = "NodeInstance";
  54954. const TREE_NODE_MAP_INJECTION_KEY = "TreeNodeMap";
  54955. const _sfc_main$p = vue.defineComponent({
  54956. name: "ElTreeNodeContent",
  54957. props: {
  54958. node: {
  54959. type: Object,
  54960. required: true
  54961. },
  54962. renderContent: Function
  54963. },
  54964. setup(props) {
  54965. const ns = useNamespace("tree");
  54966. const nodeInstance = vue.inject(NODE_INSTANCE_INJECTION_KEY);
  54967. const tree = vue.inject(ROOT_TREE_INJECTION_KEY$1);
  54968. return () => {
  54969. const node = props.node;
  54970. const { data, store } = node;
  54971. return props.renderContent ? props.renderContent(vue.h, { _self: nodeInstance, node, data, store }) : vue.renderSlot(tree.ctx.slots, "default", { node, data }, () => [
  54972. vue.h(ElText, { tag: "span", truncated: true, class: ns.be("node", "label") }, () => [node.label])
  54973. ]);
  54974. };
  54975. }
  54976. });
  54977. var NodeContent = /* @__PURE__ */ _export_sfc(_sfc_main$p, [["__file", "tree-node-content.vue"]]);
  54978. function useNodeExpandEventBroadcast(props) {
  54979. const parentNodeMap = vue.inject(TREE_NODE_MAP_INJECTION_KEY, null);
  54980. const currentNodeMap = {
  54981. treeNodeExpand: (node) => {
  54982. var _a;
  54983. if (props.node !== node) {
  54984. (_a = props.node) == null ? void 0 : _a.collapse();
  54985. }
  54986. },
  54987. children: []
  54988. };
  54989. if (parentNodeMap) {
  54990. parentNodeMap.children.push(currentNodeMap);
  54991. }
  54992. vue.provide(TREE_NODE_MAP_INJECTION_KEY, currentNodeMap);
  54993. return {
  54994. broadcastExpanded: (node) => {
  54995. if (!props.accordion)
  54996. return;
  54997. for (const childNode of currentNodeMap.children) {
  54998. childNode.treeNodeExpand(node);
  54999. }
  55000. }
  55001. };
  55002. }
  55003. const dragEventsKey = Symbol("dragEvents");
  55004. function useDragNodeHandler({
  55005. props,
  55006. ctx,
  55007. el$,
  55008. dropIndicator$,
  55009. store
  55010. }) {
  55011. const ns = useNamespace("tree");
  55012. const dragState = vue.ref({
  55013. showDropIndicator: false,
  55014. draggingNode: null,
  55015. dropNode: null,
  55016. allowDrop: true,
  55017. dropType: null
  55018. });
  55019. const treeNodeDragStart = ({ event, treeNode }) => {
  55020. if (!event.dataTransfer)
  55021. return;
  55022. if (isFunction$1(props.allowDrag) && !props.allowDrag(treeNode.node)) {
  55023. event.preventDefault();
  55024. return false;
  55025. }
  55026. event.dataTransfer.effectAllowed = "move";
  55027. try {
  55028. event.dataTransfer.setData("text/plain", "");
  55029. } catch (e) {
  55030. }
  55031. dragState.value.draggingNode = treeNode;
  55032. ctx.emit("node-drag-start", treeNode.node, event);
  55033. };
  55034. const treeNodeDragOver = ({ event, treeNode }) => {
  55035. if (!event.dataTransfer)
  55036. return;
  55037. const dropNode = treeNode;
  55038. const oldDropNode = dragState.value.dropNode;
  55039. if (oldDropNode && oldDropNode.node.id !== dropNode.node.id) {
  55040. removeClass(oldDropNode.$el, ns.is("drop-inner"));
  55041. }
  55042. const draggingNode = dragState.value.draggingNode;
  55043. if (!draggingNode || !dropNode)
  55044. return;
  55045. let dropPrev = true;
  55046. let dropInner = true;
  55047. let dropNext = true;
  55048. let userAllowDropInner = true;
  55049. if (isFunction$1(props.allowDrop)) {
  55050. dropPrev = props.allowDrop(draggingNode.node, dropNode.node, "prev");
  55051. userAllowDropInner = dropInner = props.allowDrop(draggingNode.node, dropNode.node, "inner");
  55052. dropNext = props.allowDrop(draggingNode.node, dropNode.node, "next");
  55053. }
  55054. event.dataTransfer.dropEffect = dropInner || dropPrev || dropNext ? "move" : "none";
  55055. if ((dropPrev || dropInner || dropNext) && (oldDropNode == null ? void 0 : oldDropNode.node.id) !== dropNode.node.id) {
  55056. if (oldDropNode) {
  55057. ctx.emit("node-drag-leave", draggingNode.node, oldDropNode.node, event);
  55058. }
  55059. ctx.emit("node-drag-enter", draggingNode.node, dropNode.node, event);
  55060. }
  55061. if (dropPrev || dropInner || dropNext) {
  55062. dragState.value.dropNode = dropNode;
  55063. } else {
  55064. dragState.value.dropNode = null;
  55065. }
  55066. if (dropNode.node.nextSibling === draggingNode.node) {
  55067. dropNext = false;
  55068. }
  55069. if (dropNode.node.previousSibling === draggingNode.node) {
  55070. dropPrev = false;
  55071. }
  55072. if (dropNode.node.contains(draggingNode.node, false)) {
  55073. dropInner = false;
  55074. }
  55075. if (draggingNode.node === dropNode.node || draggingNode.node.contains(dropNode.node)) {
  55076. dropPrev = false;
  55077. dropInner = false;
  55078. dropNext = false;
  55079. }
  55080. const dropEl = dropNode.$el;
  55081. const targetPosition = dropEl.querySelector(`.${ns.be("node", "content")}`).getBoundingClientRect();
  55082. const treePosition = el$.value.getBoundingClientRect();
  55083. const treeScrollTop = el$.value.scrollTop;
  55084. let dropType;
  55085. const prevPercent = dropPrev ? dropInner ? 0.25 : dropNext ? 0.45 : 1 : Number.NEGATIVE_INFINITY;
  55086. const nextPercent = dropNext ? dropInner ? 0.75 : dropPrev ? 0.55 : 0 : Number.POSITIVE_INFINITY;
  55087. let indicatorTop = -9999;
  55088. const distance = event.clientY - targetPosition.top;
  55089. if (distance < targetPosition.height * prevPercent) {
  55090. dropType = "before";
  55091. } else if (distance > targetPosition.height * nextPercent) {
  55092. dropType = "after";
  55093. } else if (dropInner) {
  55094. dropType = "inner";
  55095. } else {
  55096. dropType = "none";
  55097. }
  55098. const iconPosition = dropEl.querySelector(`.${ns.be("node", "expand-icon")}`).getBoundingClientRect();
  55099. const dropIndicator = dropIndicator$.value;
  55100. if (dropType === "before") {
  55101. indicatorTop = iconPosition.top - treePosition.top + treeScrollTop;
  55102. } else if (dropType === "after") {
  55103. indicatorTop = iconPosition.bottom - treePosition.top + treeScrollTop;
  55104. }
  55105. dropIndicator.style.top = `${indicatorTop}px`;
  55106. dropIndicator.style.left = `${iconPosition.right - treePosition.left}px`;
  55107. if (dropType === "inner") {
  55108. addClass(dropEl, ns.is("drop-inner"));
  55109. } else {
  55110. removeClass(dropEl, ns.is("drop-inner"));
  55111. }
  55112. dragState.value.showDropIndicator = dropType === "before" || dropType === "after";
  55113. dragState.value.allowDrop = dragState.value.showDropIndicator || userAllowDropInner;
  55114. dragState.value.dropType = dropType;
  55115. ctx.emit("node-drag-over", draggingNode.node, dropNode.node, event);
  55116. };
  55117. const treeNodeDragEnd = (event) => {
  55118. var _a, _b;
  55119. const { draggingNode, dropType, dropNode } = dragState.value;
  55120. event.preventDefault();
  55121. if (event.dataTransfer) {
  55122. event.dataTransfer.dropEffect = "move";
  55123. }
  55124. if ((draggingNode == null ? void 0 : draggingNode.node.data) && dropNode) {
  55125. const draggingNodeCopy = { data: draggingNode.node.data };
  55126. if (dropType !== "none") {
  55127. draggingNode.node.remove();
  55128. }
  55129. if (dropType === "before") {
  55130. (_a = dropNode.node.parent) == null ? void 0 : _a.insertBefore(draggingNodeCopy, dropNode.node);
  55131. } else if (dropType === "after") {
  55132. (_b = dropNode.node.parent) == null ? void 0 : _b.insertAfter(draggingNodeCopy, dropNode.node);
  55133. } else if (dropType === "inner") {
  55134. dropNode.node.insertChild(draggingNodeCopy);
  55135. }
  55136. if (dropType !== "none") {
  55137. store.value.registerNode(draggingNodeCopy);
  55138. if (store.value.key) {
  55139. draggingNode.node.eachNode((node) => {
  55140. var _a2;
  55141. (_a2 = store.value.nodesMap[node.data[store.value.key]]) == null ? void 0 : _a2.setChecked(node.checked, !store.value.checkStrictly);
  55142. });
  55143. }
  55144. }
  55145. removeClass(dropNode.$el, ns.is("drop-inner"));
  55146. ctx.emit("node-drag-end", draggingNode.node, dropNode.node, dropType, event);
  55147. if (dropType !== "none") {
  55148. ctx.emit("node-drop", draggingNode.node, dropNode.node, dropType, event);
  55149. }
  55150. }
  55151. if (draggingNode && !dropNode) {
  55152. ctx.emit("node-drag-end", draggingNode.node, null, dropType, event);
  55153. }
  55154. dragState.value.showDropIndicator = false;
  55155. dragState.value.draggingNode = null;
  55156. dragState.value.dropNode = null;
  55157. dragState.value.allowDrop = true;
  55158. };
  55159. vue.provide(dragEventsKey, {
  55160. treeNodeDragStart,
  55161. treeNodeDragOver,
  55162. treeNodeDragEnd
  55163. });
  55164. return {
  55165. dragState
  55166. };
  55167. }
  55168. const _sfc_main$o = vue.defineComponent({
  55169. name: "ElTreeNode",
  55170. components: {
  55171. ElCollapseTransition,
  55172. ElCheckbox,
  55173. NodeContent,
  55174. ElIcon,
  55175. Loading: loading_default
  55176. },
  55177. props: {
  55178. node: {
  55179. type: Node$2,
  55180. default: () => ({})
  55181. },
  55182. props: {
  55183. type: Object,
  55184. default: () => ({})
  55185. },
  55186. accordion: Boolean,
  55187. renderContent: Function,
  55188. renderAfterExpand: Boolean,
  55189. showCheckbox: Boolean
  55190. },
  55191. emits: ["node-expand"],
  55192. setup(props, ctx) {
  55193. const ns = useNamespace("tree");
  55194. const { broadcastExpanded } = useNodeExpandEventBroadcast(props);
  55195. const tree = vue.inject(ROOT_TREE_INJECTION_KEY$1);
  55196. const expanded = vue.ref(false);
  55197. const childNodeRendered = vue.ref(false);
  55198. const oldChecked = vue.ref();
  55199. const oldIndeterminate = vue.ref();
  55200. const node$ = vue.ref();
  55201. const dragEvents = vue.inject(dragEventsKey);
  55202. const instance = vue.getCurrentInstance();
  55203. vue.provide(NODE_INSTANCE_INJECTION_KEY, instance);
  55204. if (!tree) {
  55205. debugWarn("Tree", "Can not find node's tree.");
  55206. }
  55207. if (props.node.expanded) {
  55208. expanded.value = true;
  55209. childNodeRendered.value = true;
  55210. }
  55211. const childrenKey = tree.props.props["children"] || "children";
  55212. vue.watch(() => {
  55213. var _a;
  55214. const children = (_a = props.node.data) == null ? void 0 : _a[childrenKey];
  55215. return children && [...children];
  55216. }, () => {
  55217. props.node.updateChildren();
  55218. });
  55219. vue.watch(() => props.node.indeterminate, (val) => {
  55220. handleSelectChange(props.node.checked, val);
  55221. });
  55222. vue.watch(() => props.node.checked, (val) => {
  55223. handleSelectChange(val, props.node.indeterminate);
  55224. });
  55225. vue.watch(() => props.node.childNodes.length, () => props.node.reInitChecked());
  55226. vue.watch(() => props.node.expanded, (val) => {
  55227. vue.nextTick(() => expanded.value = val);
  55228. if (val) {
  55229. childNodeRendered.value = true;
  55230. }
  55231. });
  55232. const getNodeKey$1 = (node) => {
  55233. return getNodeKey(tree.props.nodeKey, node.data);
  55234. };
  55235. const getNodeClass = (node) => {
  55236. const nodeClassFunc = props.props.class;
  55237. if (!nodeClassFunc) {
  55238. return {};
  55239. }
  55240. let className;
  55241. if (isFunction$1(nodeClassFunc)) {
  55242. const { data } = node;
  55243. className = nodeClassFunc(data, node);
  55244. } else {
  55245. className = nodeClassFunc;
  55246. }
  55247. if (isString$1(className)) {
  55248. return { [className]: true };
  55249. } else {
  55250. return className;
  55251. }
  55252. };
  55253. const handleSelectChange = (checked, indeterminate) => {
  55254. if (oldChecked.value !== checked || oldIndeterminate.value !== indeterminate) {
  55255. tree.ctx.emit("check-change", props.node.data, checked, indeterminate);
  55256. }
  55257. oldChecked.value = checked;
  55258. oldIndeterminate.value = indeterminate;
  55259. };
  55260. const handleClick = (e) => {
  55261. handleCurrentChange(tree.store, tree.ctx.emit, () => {
  55262. var _a;
  55263. const nodeKeyProp = (_a = tree == null ? void 0 : tree.props) == null ? void 0 : _a.nodeKey;
  55264. if (nodeKeyProp) {
  55265. const curNodeKey = getNodeKey$1(props.node);
  55266. tree.store.value.setCurrentNodeKey(curNodeKey);
  55267. } else {
  55268. tree.store.value.setCurrentNode(props.node);
  55269. }
  55270. });
  55271. tree.currentNode.value = props.node;
  55272. if (tree.props.expandOnClickNode) {
  55273. handleExpandIconClick();
  55274. }
  55275. if ((tree.props.checkOnClickNode || props.node.isLeaf && tree.props.checkOnClickLeaf && props.showCheckbox) && !props.node.disabled) {
  55276. handleCheckChange(!props.node.checked);
  55277. }
  55278. tree.ctx.emit("node-click", props.node.data, props.node, instance, e);
  55279. };
  55280. const handleContextMenu = (event) => {
  55281. var _a;
  55282. if ((_a = tree.instance.vnode.props) == null ? void 0 : _a["onNodeContextmenu"]) {
  55283. event.stopPropagation();
  55284. event.preventDefault();
  55285. }
  55286. tree.ctx.emit("node-contextmenu", event, props.node.data, props.node, instance);
  55287. };
  55288. const handleExpandIconClick = () => {
  55289. if (props.node.isLeaf)
  55290. return;
  55291. if (expanded.value) {
  55292. tree.ctx.emit("node-collapse", props.node.data, props.node, instance);
  55293. props.node.collapse();
  55294. } else {
  55295. props.node.expand(() => {
  55296. ctx.emit("node-expand", props.node.data, props.node, instance);
  55297. });
  55298. }
  55299. };
  55300. const handleCheckChange = (value) => {
  55301. props.node.setChecked(value, !(tree == null ? void 0 : tree.props.checkStrictly));
  55302. vue.nextTick(() => {
  55303. const store = tree.store.value;
  55304. tree.ctx.emit("check", props.node.data, {
  55305. checkedNodes: store.getCheckedNodes(),
  55306. checkedKeys: store.getCheckedKeys(),
  55307. halfCheckedNodes: store.getHalfCheckedNodes(),
  55308. halfCheckedKeys: store.getHalfCheckedKeys()
  55309. });
  55310. });
  55311. };
  55312. const handleChildNodeExpand = (nodeData, node, instance2) => {
  55313. broadcastExpanded(node);
  55314. tree.ctx.emit("node-expand", nodeData, node, instance2);
  55315. };
  55316. const handleDragStart = (event) => {
  55317. if (!tree.props.draggable)
  55318. return;
  55319. dragEvents.treeNodeDragStart({ event, treeNode: props });
  55320. };
  55321. const handleDragOver = (event) => {
  55322. event.preventDefault();
  55323. if (!tree.props.draggable)
  55324. return;
  55325. dragEvents.treeNodeDragOver({
  55326. event,
  55327. treeNode: { $el: node$.value, node: props.node }
  55328. });
  55329. };
  55330. const handleDrop = (event) => {
  55331. event.preventDefault();
  55332. };
  55333. const handleDragEnd = (event) => {
  55334. if (!tree.props.draggable)
  55335. return;
  55336. dragEvents.treeNodeDragEnd(event);
  55337. };
  55338. return {
  55339. ns,
  55340. node$,
  55341. tree,
  55342. expanded,
  55343. childNodeRendered,
  55344. oldChecked,
  55345. oldIndeterminate,
  55346. getNodeKey: getNodeKey$1,
  55347. getNodeClass,
  55348. handleSelectChange,
  55349. handleClick,
  55350. handleContextMenu,
  55351. handleExpandIconClick,
  55352. handleCheckChange,
  55353. handleChildNodeExpand,
  55354. handleDragStart,
  55355. handleDragOver,
  55356. handleDrop,
  55357. handleDragEnd,
  55358. CaretRight: caret_right_default
  55359. };
  55360. }
  55361. });
  55362. function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
  55363. const _component_el_icon = vue.resolveComponent("el-icon");
  55364. const _component_el_checkbox = vue.resolveComponent("el-checkbox");
  55365. const _component_loading = vue.resolveComponent("loading");
  55366. const _component_node_content = vue.resolveComponent("node-content");
  55367. const _component_el_tree_node = vue.resolveComponent("el-tree-node");
  55368. const _component_el_collapse_transition = vue.resolveComponent("el-collapse-transition");
  55369. return vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  55370. ref: "node$",
  55371. class: vue.normalizeClass([
  55372. _ctx.ns.b("node"),
  55373. _ctx.ns.is("expanded", _ctx.expanded),
  55374. _ctx.ns.is("current", _ctx.node.isCurrent),
  55375. _ctx.ns.is("hidden", !_ctx.node.visible),
  55376. _ctx.ns.is("focusable", !_ctx.node.disabled),
  55377. _ctx.ns.is("checked", !_ctx.node.disabled && _ctx.node.checked),
  55378. _ctx.getNodeClass(_ctx.node)
  55379. ]),
  55380. role: "treeitem",
  55381. tabindex: "-1",
  55382. "aria-expanded": _ctx.expanded,
  55383. "aria-disabled": _ctx.node.disabled,
  55384. "aria-checked": _ctx.node.checked,
  55385. draggable: _ctx.tree.props.draggable,
  55386. "data-key": _ctx.getNodeKey(_ctx.node),
  55387. onClick: vue.withModifiers(_ctx.handleClick, ["stop"]),
  55388. onContextmenu: _ctx.handleContextMenu,
  55389. onDragstart: vue.withModifiers(_ctx.handleDragStart, ["stop"]),
  55390. onDragover: vue.withModifiers(_ctx.handleDragOver, ["stop"]),
  55391. onDragend: vue.withModifiers(_ctx.handleDragEnd, ["stop"]),
  55392. onDrop: vue.withModifiers(_ctx.handleDrop, ["stop"])
  55393. }, [
  55394. vue.createElementVNode("div", {
  55395. class: vue.normalizeClass(_ctx.ns.be("node", "content")),
  55396. style: vue.normalizeStyle({ paddingLeft: (_ctx.node.level - 1) * _ctx.tree.props.indent + "px" })
  55397. }, [
  55398. _ctx.tree.props.icon || _ctx.CaretRight ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
  55399. key: 0,
  55400. class: vue.normalizeClass([
  55401. _ctx.ns.be("node", "expand-icon"),
  55402. _ctx.ns.is("leaf", _ctx.node.isLeaf),
  55403. {
  55404. expanded: !_ctx.node.isLeaf && _ctx.expanded
  55405. }
  55406. ]),
  55407. onClick: vue.withModifiers(_ctx.handleExpandIconClick, ["stop"])
  55408. }, {
  55409. default: vue.withCtx(() => [
  55410. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.tree.props.icon || _ctx.CaretRight)))
  55411. ]),
  55412. _: 1
  55413. }, 8, ["class", "onClick"])) : vue.createCommentVNode("v-if", true),
  55414. _ctx.showCheckbox ? (vue.openBlock(), vue.createBlock(_component_el_checkbox, {
  55415. key: 1,
  55416. "model-value": _ctx.node.checked,
  55417. indeterminate: _ctx.node.indeterminate,
  55418. disabled: !!_ctx.node.disabled,
  55419. onClick: vue.withModifiers(() => {
  55420. }, ["stop"]),
  55421. onChange: _ctx.handleCheckChange
  55422. }, null, 8, ["model-value", "indeterminate", "disabled", "onClick", "onChange"])) : vue.createCommentVNode("v-if", true),
  55423. _ctx.node.loading ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
  55424. key: 2,
  55425. class: vue.normalizeClass([_ctx.ns.be("node", "loading-icon"), _ctx.ns.is("loading")])
  55426. }, {
  55427. default: vue.withCtx(() => [
  55428. vue.createVNode(_component_loading)
  55429. ]),
  55430. _: 1
  55431. }, 8, ["class"])) : vue.createCommentVNode("v-if", true),
  55432. vue.createVNode(_component_node_content, {
  55433. node: _ctx.node,
  55434. "render-content": _ctx.renderContent
  55435. }, null, 8, ["node", "render-content"])
  55436. ], 6),
  55437. vue.createVNode(_component_el_collapse_transition, null, {
  55438. default: vue.withCtx(() => [
  55439. !_ctx.renderAfterExpand || _ctx.childNodeRendered ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  55440. key: 0,
  55441. class: vue.normalizeClass(_ctx.ns.be("node", "children")),
  55442. role: "group",
  55443. "aria-expanded": _ctx.expanded,
  55444. onClick: vue.withModifiers(() => {
  55445. }, ["stop"])
  55446. }, [
  55447. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.node.childNodes, (child) => {
  55448. return vue.openBlock(), vue.createBlock(_component_el_tree_node, {
  55449. key: _ctx.getNodeKey(child),
  55450. "render-content": _ctx.renderContent,
  55451. "render-after-expand": _ctx.renderAfterExpand,
  55452. "show-checkbox": _ctx.showCheckbox,
  55453. node: child,
  55454. accordion: _ctx.accordion,
  55455. props: _ctx.props,
  55456. onNodeExpand: _ctx.handleChildNodeExpand
  55457. }, null, 8, ["render-content", "render-after-expand", "show-checkbox", "node", "accordion", "props", "onNodeExpand"]);
  55458. }), 128))
  55459. ], 10, ["aria-expanded", "onClick"])), [
  55460. [vue.vShow, _ctx.expanded]
  55461. ]) : vue.createCommentVNode("v-if", true)
  55462. ]),
  55463. _: 1
  55464. })
  55465. ], 42, ["aria-expanded", "aria-disabled", "aria-checked", "draggable", "data-key", "onClick", "onContextmenu", "onDragstart", "onDragover", "onDragend", "onDrop"])), [
  55466. [vue.vShow, _ctx.node.visible]
  55467. ]);
  55468. }
  55469. var ElTreeNode$1 = /* @__PURE__ */ _export_sfc(_sfc_main$o, [["render", _sfc_render$2], ["__file", "tree-node.vue"]]);
  55470. function useKeydown({ el$ }, store) {
  55471. const ns = useNamespace("tree");
  55472. vue.onMounted(() => {
  55473. initTabIndex();
  55474. });
  55475. vue.onUpdated(() => {
  55476. const checkboxItems = Array.from(el$.value.querySelectorAll("input[type=checkbox]"));
  55477. checkboxItems.forEach((checkbox) => {
  55478. checkbox.setAttribute("tabindex", "-1");
  55479. });
  55480. });
  55481. function canNodeFocus(treeItems, nextIndex) {
  55482. var _a, _b;
  55483. const currentNode = store.value.getNode(treeItems[nextIndex].dataset.key);
  55484. return currentNode.canFocus && currentNode.visible && (((_a = currentNode.parent) == null ? void 0 : _a.expanded) || ((_b = currentNode.parent) == null ? void 0 : _b.level) === 0);
  55485. }
  55486. const handleKeydown = (ev) => {
  55487. const currentItem = ev.target;
  55488. if (!currentItem.className.includes(ns.b("node")))
  55489. return;
  55490. const code = getEventCode(ev);
  55491. const treeItems = Array.from(el$.value.querySelectorAll(`.${ns.is("focusable")}[role=treeitem]`));
  55492. const currentIndex = treeItems.indexOf(currentItem);
  55493. let nextIndex;
  55494. if ([EVENT_CODE.up, EVENT_CODE.down].includes(code)) {
  55495. ev.preventDefault();
  55496. if (code === EVENT_CODE.up) {
  55497. nextIndex = currentIndex === -1 ? 0 : currentIndex !== 0 ? currentIndex - 1 : treeItems.length - 1;
  55498. const startIndex = nextIndex;
  55499. while (true) {
  55500. if (canNodeFocus(treeItems, nextIndex)) {
  55501. break;
  55502. }
  55503. nextIndex--;
  55504. if (nextIndex === startIndex) {
  55505. nextIndex = -1;
  55506. break;
  55507. }
  55508. if (nextIndex < 0) {
  55509. nextIndex = treeItems.length - 1;
  55510. }
  55511. }
  55512. } else {
  55513. nextIndex = currentIndex === -1 ? 0 : currentIndex < treeItems.length - 1 ? currentIndex + 1 : 0;
  55514. const startIndex = nextIndex;
  55515. while (true) {
  55516. if (canNodeFocus(treeItems, nextIndex)) {
  55517. break;
  55518. }
  55519. nextIndex++;
  55520. if (nextIndex === startIndex) {
  55521. nextIndex = -1;
  55522. break;
  55523. }
  55524. if (nextIndex >= treeItems.length) {
  55525. nextIndex = 0;
  55526. }
  55527. }
  55528. }
  55529. nextIndex !== -1 && treeItems[nextIndex].focus();
  55530. }
  55531. if ([EVENT_CODE.left, EVENT_CODE.right].includes(code)) {
  55532. ev.preventDefault();
  55533. currentItem.click();
  55534. }
  55535. const hasInput = currentItem.querySelector('[type="checkbox"]');
  55536. if ([EVENT_CODE.enter, EVENT_CODE.numpadEnter, EVENT_CODE.space].includes(code) && hasInput) {
  55537. ev.preventDefault();
  55538. hasInput.click();
  55539. }
  55540. };
  55541. useEventListener(el$, "keydown", handleKeydown);
  55542. const initTabIndex = () => {
  55543. var _a;
  55544. if (!el$.value)
  55545. return;
  55546. const treeItems = Array.from(el$.value.querySelectorAll(`.${ns.is("focusable")}[role=treeitem]`));
  55547. const checkboxItems = Array.from(el$.value.querySelectorAll("input[type=checkbox]"));
  55548. checkboxItems.forEach((checkbox) => {
  55549. checkbox.setAttribute("tabindex", "-1");
  55550. });
  55551. const checkedItem = el$.value.querySelectorAll(`.${ns.is("checked")}[role=treeitem]`);
  55552. if (checkedItem.length) {
  55553. checkedItem[0].setAttribute("tabindex", "0");
  55554. return;
  55555. }
  55556. (_a = treeItems[0]) == null ? void 0 : _a.setAttribute("tabindex", "0");
  55557. };
  55558. }
  55559. const treeEmits$1 = {
  55560. "check-change": (data, checked, indeterminate) => data && isBoolean(checked) && isBoolean(indeterminate),
  55561. "current-change": (data, node) => true,
  55562. "node-click": (data, node, nodeInstance, evt) => data && node && evt instanceof Event,
  55563. "node-contextmenu": (evt, data, node, nodeInstance) => evt instanceof Event && data && node,
  55564. "node-collapse": (data, node, nodeInstance) => data && node,
  55565. "node-expand": (data, node, nodeInstance) => data && node,
  55566. check: (data, checkedInfo) => data && checkedInfo,
  55567. "node-drag-start": (node, evt) => node && evt,
  55568. "node-drag-end": (draggingNode, dropNode, dropType, evt) => draggingNode && evt,
  55569. "node-drop": (draggingNode, dropNode, dropType, evt) => draggingNode && dropNode && evt,
  55570. "node-drag-leave": (draggingNode, oldDropNode, evt) => draggingNode && oldDropNode && evt,
  55571. "node-drag-enter": (draggingNode, dropNode, evt) => draggingNode && dropNode && evt,
  55572. "node-drag-over": (draggingNode, dropNode, evt) => draggingNode && dropNode && evt
  55573. };
  55574. const _sfc_main$n = vue.defineComponent({
  55575. name: "ElTree",
  55576. components: { ElTreeNode: ElTreeNode$1 },
  55577. props: {
  55578. data: {
  55579. type: definePropType(Array),
  55580. default: () => []
  55581. },
  55582. emptyText: {
  55583. type: String
  55584. },
  55585. renderAfterExpand: {
  55586. type: Boolean,
  55587. default: true
  55588. },
  55589. nodeKey: String,
  55590. checkStrictly: Boolean,
  55591. defaultExpandAll: Boolean,
  55592. expandOnClickNode: {
  55593. type: Boolean,
  55594. default: true
  55595. },
  55596. checkOnClickNode: Boolean,
  55597. checkOnClickLeaf: {
  55598. type: Boolean,
  55599. default: true
  55600. },
  55601. checkDescendants: Boolean,
  55602. autoExpandParent: {
  55603. type: Boolean,
  55604. default: true
  55605. },
  55606. defaultCheckedKeys: Array,
  55607. defaultExpandedKeys: Array,
  55608. currentNodeKey: [String, Number],
  55609. renderContent: {
  55610. type: definePropType(Function)
  55611. },
  55612. showCheckbox: Boolean,
  55613. draggable: Boolean,
  55614. allowDrag: {
  55615. type: definePropType(Function)
  55616. },
  55617. allowDrop: {
  55618. type: definePropType(Function)
  55619. },
  55620. props: {
  55621. type: Object,
  55622. default: () => ({
  55623. children: "children",
  55624. label: "label",
  55625. disabled: "disabled"
  55626. })
  55627. },
  55628. lazy: Boolean,
  55629. highlightCurrent: Boolean,
  55630. load: Function,
  55631. filterNodeMethod: Function,
  55632. accordion: Boolean,
  55633. indent: {
  55634. type: Number,
  55635. default: 18
  55636. },
  55637. icon: {
  55638. type: iconPropType
  55639. }
  55640. },
  55641. emits: treeEmits$1,
  55642. setup(props, ctx) {
  55643. const { t } = useLocale();
  55644. const ns = useNamespace("tree");
  55645. const store = vue.ref(new TreeStore({
  55646. key: props.nodeKey,
  55647. data: props.data,
  55648. lazy: props.lazy,
  55649. props: props.props,
  55650. load: props.load,
  55651. currentNodeKey: props.currentNodeKey,
  55652. checkStrictly: props.checkStrictly,
  55653. checkDescendants: props.checkDescendants,
  55654. defaultCheckedKeys: props.defaultCheckedKeys,
  55655. defaultExpandedKeys: props.defaultExpandedKeys,
  55656. autoExpandParent: props.autoExpandParent,
  55657. defaultExpandAll: props.defaultExpandAll,
  55658. filterNodeMethod: props.filterNodeMethod
  55659. }));
  55660. store.value.initialize();
  55661. const root = vue.ref(store.value.root);
  55662. const currentNode = vue.ref(null);
  55663. const el$ = vue.ref(null);
  55664. const dropIndicator$ = vue.ref(null);
  55665. const { broadcastExpanded } = useNodeExpandEventBroadcast(props);
  55666. const { dragState } = useDragNodeHandler({
  55667. props,
  55668. ctx,
  55669. el$,
  55670. dropIndicator$,
  55671. store
  55672. });
  55673. useKeydown({ el$ }, store);
  55674. const instance = vue.getCurrentInstance();
  55675. const isSelectTree = vue.computed(() => {
  55676. let parent = instance == null ? void 0 : instance.parent;
  55677. while (parent) {
  55678. if (parent.type.name === "ElTreeSelect") {
  55679. return true;
  55680. }
  55681. parent = parent.parent;
  55682. }
  55683. return false;
  55684. });
  55685. const isEmpty = vue.computed(() => {
  55686. const { childNodes } = root.value;
  55687. return (!childNodes || childNodes.length === 0 || childNodes.every(({ visible }) => !visible)) && !isSelectTree.value;
  55688. });
  55689. vue.watch(() => props.currentNodeKey, (newVal) => {
  55690. store.value.setCurrentNodeKey(newVal != null ? newVal : null);
  55691. });
  55692. vue.watch(() => props.defaultCheckedKeys, (newVal, oldVal) => {
  55693. if (isEqual$1(newVal, oldVal))
  55694. return;
  55695. store.value.setDefaultCheckedKey(newVal != null ? newVal : []);
  55696. });
  55697. vue.watch(() => props.defaultExpandedKeys, (newVal) => {
  55698. store.value.setDefaultExpandedKeys(newVal != null ? newVal : []);
  55699. });
  55700. vue.watch(() => props.data, (newVal) => {
  55701. store.value.setData(newVal);
  55702. }, { deep: true });
  55703. vue.watch(() => props.checkStrictly, (newVal) => {
  55704. store.value.checkStrictly = newVal;
  55705. });
  55706. const filter = (value) => {
  55707. if (!props.filterNodeMethod)
  55708. throw new Error("[Tree] filterNodeMethod is required when filter");
  55709. store.value.filter(value);
  55710. };
  55711. const getNodeKey$1 = (node) => {
  55712. return getNodeKey(props.nodeKey, node.data);
  55713. };
  55714. const getNodePath = (data) => {
  55715. if (!props.nodeKey)
  55716. throw new Error("[Tree] nodeKey is required in getNodePath");
  55717. const node = store.value.getNode(data);
  55718. if (!node)
  55719. return [];
  55720. const path = [node.data];
  55721. let parent = node.parent;
  55722. while (parent && parent !== root.value) {
  55723. path.push(parent.data);
  55724. parent = parent.parent;
  55725. }
  55726. return path.reverse();
  55727. };
  55728. const getCheckedNodes = (leafOnly, includeHalfChecked) => {
  55729. return store.value.getCheckedNodes(leafOnly, includeHalfChecked);
  55730. };
  55731. const getCheckedKeys = (leafOnly) => {
  55732. return store.value.getCheckedKeys(leafOnly);
  55733. };
  55734. const getCurrentNode = () => {
  55735. const currentNode2 = store.value.getCurrentNode();
  55736. return currentNode2 ? currentNode2.data : null;
  55737. };
  55738. const getCurrentKey = () => {
  55739. if (!props.nodeKey)
  55740. throw new Error("[Tree] nodeKey is required in getCurrentKey");
  55741. const currentNode2 = getCurrentNode();
  55742. return currentNode2 ? currentNode2[props.nodeKey] : null;
  55743. };
  55744. const setCheckedNodes = (nodes, leafOnly) => {
  55745. if (!props.nodeKey)
  55746. throw new Error("[Tree] nodeKey is required in setCheckedNodes");
  55747. store.value.setCheckedNodes(nodes, leafOnly);
  55748. };
  55749. const setCheckedKeys = (keys, leafOnly) => {
  55750. if (!props.nodeKey)
  55751. throw new Error("[Tree] nodeKey is required in setCheckedKeys");
  55752. store.value.setCheckedKeys(keys, leafOnly);
  55753. };
  55754. const setChecked = (data, checked, deep) => {
  55755. store.value.setChecked(data, checked, deep);
  55756. };
  55757. const getHalfCheckedNodes = () => {
  55758. return store.value.getHalfCheckedNodes();
  55759. };
  55760. const getHalfCheckedKeys = () => {
  55761. return store.value.getHalfCheckedKeys();
  55762. };
  55763. const setCurrentNode = (node, shouldAutoExpandParent = true) => {
  55764. if (!props.nodeKey)
  55765. throw new Error("[Tree] nodeKey is required in setCurrentNode");
  55766. handleCurrentChange(store, ctx.emit, () => {
  55767. broadcastExpanded(node);
  55768. store.value.setUserCurrentNode(node, shouldAutoExpandParent);
  55769. });
  55770. };
  55771. const setCurrentKey = (key = null, shouldAutoExpandParent = true) => {
  55772. if (!props.nodeKey)
  55773. throw new Error("[Tree] nodeKey is required in setCurrentKey");
  55774. handleCurrentChange(store, ctx.emit, () => {
  55775. broadcastExpanded();
  55776. store.value.setCurrentNodeKey(key, shouldAutoExpandParent);
  55777. });
  55778. };
  55779. const getNode = (data) => {
  55780. return store.value.getNode(data);
  55781. };
  55782. const remove = (data) => {
  55783. store.value.remove(data);
  55784. };
  55785. const append = (data, parentNode) => {
  55786. store.value.append(data, parentNode);
  55787. };
  55788. const insertBefore = (data, refNode) => {
  55789. store.value.insertBefore(data, refNode);
  55790. };
  55791. const insertAfter = (data, refNode) => {
  55792. store.value.insertAfter(data, refNode);
  55793. };
  55794. const handleNodeExpand = (nodeData, node, instance2) => {
  55795. broadcastExpanded(node);
  55796. ctx.emit("node-expand", nodeData, node, instance2);
  55797. };
  55798. const updateKeyChildren = (key, data) => {
  55799. if (!props.nodeKey)
  55800. throw new Error("[Tree] nodeKey is required in updateKeyChild");
  55801. store.value.updateChildren(key, data);
  55802. };
  55803. vue.provide(ROOT_TREE_INJECTION_KEY$1, {
  55804. ctx,
  55805. props,
  55806. store,
  55807. root,
  55808. currentNode,
  55809. instance
  55810. });
  55811. vue.provide(formItemContextKey, void 0);
  55812. return {
  55813. ns,
  55814. store,
  55815. root,
  55816. currentNode,
  55817. dragState,
  55818. el$,
  55819. dropIndicator$,
  55820. isEmpty,
  55821. filter,
  55822. getNodeKey: getNodeKey$1,
  55823. getNodePath,
  55824. getCheckedNodes,
  55825. getCheckedKeys,
  55826. getCurrentNode,
  55827. getCurrentKey,
  55828. setCheckedNodes,
  55829. setCheckedKeys,
  55830. setChecked,
  55831. getHalfCheckedNodes,
  55832. getHalfCheckedKeys,
  55833. setCurrentNode,
  55834. setCurrentKey,
  55835. t,
  55836. getNode,
  55837. remove,
  55838. append,
  55839. insertBefore,
  55840. insertAfter,
  55841. handleNodeExpand,
  55842. updateKeyChildren
  55843. };
  55844. }
  55845. });
  55846. function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
  55847. const _component_el_tree_node = vue.resolveComponent("el-tree-node");
  55848. return vue.openBlock(), vue.createElementBlock("div", {
  55849. ref: "el$",
  55850. class: vue.normalizeClass([
  55851. _ctx.ns.b(),
  55852. _ctx.ns.is("dragging", !!_ctx.dragState.draggingNode),
  55853. _ctx.ns.is("drop-not-allow", !_ctx.dragState.allowDrop),
  55854. _ctx.ns.is("drop-inner", _ctx.dragState.dropType === "inner"),
  55855. { [_ctx.ns.m("highlight-current")]: _ctx.highlightCurrent }
  55856. ]),
  55857. role: "tree"
  55858. }, [
  55859. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.root.childNodes, (child) => {
  55860. return vue.openBlock(), vue.createBlock(_component_el_tree_node, {
  55861. key: _ctx.getNodeKey(child),
  55862. node: child,
  55863. props: _ctx.props,
  55864. accordion: _ctx.accordion,
  55865. "render-after-expand": _ctx.renderAfterExpand,
  55866. "show-checkbox": _ctx.showCheckbox,
  55867. "render-content": _ctx.renderContent,
  55868. onNodeExpand: _ctx.handleNodeExpand
  55869. }, null, 8, ["node", "props", "accordion", "render-after-expand", "show-checkbox", "render-content", "onNodeExpand"]);
  55870. }), 128)),
  55871. _ctx.isEmpty ? (vue.openBlock(), vue.createElementBlock("div", {
  55872. key: 0,
  55873. class: vue.normalizeClass(_ctx.ns.e("empty-block"))
  55874. }, [
  55875. vue.renderSlot(_ctx.$slots, "empty", {}, () => {
  55876. var _a;
  55877. return [
  55878. vue.createElementVNode("span", {
  55879. class: vue.normalizeClass(_ctx.ns.e("empty-text"))
  55880. }, vue.toDisplayString((_a = _ctx.emptyText) != null ? _a : _ctx.t("el.tree.emptyText")), 3)
  55881. ];
  55882. })
  55883. ], 2)) : vue.createCommentVNode("v-if", true),
  55884. vue.withDirectives(vue.createElementVNode("div", {
  55885. ref: "dropIndicator$",
  55886. class: vue.normalizeClass(_ctx.ns.e("drop-indicator"))
  55887. }, null, 2), [
  55888. [vue.vShow, _ctx.dragState.showDropIndicator]
  55889. ])
  55890. ], 2);
  55891. }
  55892. var Tree = /* @__PURE__ */ _export_sfc(_sfc_main$n, [["render", _sfc_render$1], ["__file", "tree.vue"]]);
  55893. const ElTree = withInstall(Tree);
  55894. const useSelect = (props, { attrs, emit }, {
  55895. select,
  55896. tree,
  55897. key
  55898. }) => {
  55899. const ns = useNamespace("tree-select");
  55900. vue.watch(() => props.data, () => {
  55901. if (props.filterable) {
  55902. vue.nextTick(() => {
  55903. var _a, _b;
  55904. (_b = tree.value) == null ? void 0 : _b.filter((_a = select.value) == null ? void 0 : _a.states.inputValue);
  55905. });
  55906. }
  55907. }, { flush: "post" });
  55908. const result = {
  55909. ...pick(vue.toRefs(props), Object.keys(ElSelect.props)),
  55910. ...attrs,
  55911. class: vue.computed(() => attrs.class),
  55912. style: vue.computed(() => attrs.style),
  55913. "onUpdate:modelValue": (value) => emit(UPDATE_MODEL_EVENT, value),
  55914. valueKey: key,
  55915. popperClass: vue.computed(() => {
  55916. const classes = [ns.e("popper")];
  55917. if (props.popperClass)
  55918. classes.push(props.popperClass);
  55919. return classes.join(" ");
  55920. }),
  55921. filterMethod: (keyword = "") => {
  55922. var _a;
  55923. if (props.filterMethod) {
  55924. props.filterMethod(keyword);
  55925. } else if (props.remoteMethod) {
  55926. props.remoteMethod(keyword);
  55927. } else {
  55928. (_a = tree.value) == null ? void 0 : _a.filter(keyword);
  55929. }
  55930. }
  55931. };
  55932. return result;
  55933. };
  55934. const component = vue.defineComponent({
  55935. extends: ElOption,
  55936. setup(props, ctx) {
  55937. const result = ElOption.setup(props, ctx);
  55938. delete result.selectOptionClick;
  55939. const vm = vue.getCurrentInstance().proxy;
  55940. vue.nextTick(() => {
  55941. if (!result.select.states.cachedOptions.get(vm.value)) {
  55942. result.select.onOptionCreate(vm);
  55943. }
  55944. });
  55945. vue.watch(() => ctx.attrs.visible, (val) => {
  55946. vue.nextTick(() => {
  55947. result.states.visible = val;
  55948. });
  55949. }, {
  55950. immediate: true
  55951. });
  55952. return result;
  55953. },
  55954. methods: {
  55955. selectOptionClick() {
  55956. this.$el.parentElement.click();
  55957. }
  55958. }
  55959. });
  55960. var TreeSelectOption = component;
  55961. function isValidValue(val) {
  55962. return val || val === 0;
  55963. }
  55964. function isValidArray(val) {
  55965. return isArray$1(val) && val.length;
  55966. }
  55967. function toValidArray(val) {
  55968. return isArray$1(val) ? val : isValidValue(val) ? [val] : [];
  55969. }
  55970. function treeFind(treeData, findCallback, getChildren, resultCallback, parent) {
  55971. for (let i = 0; i < treeData.length; i++) {
  55972. const data = treeData[i];
  55973. if (findCallback(data, i, treeData, parent)) {
  55974. return resultCallback ? resultCallback(data, i, treeData, parent) : data;
  55975. } else {
  55976. const children = getChildren(data);
  55977. if (isValidArray(children)) {
  55978. const find = treeFind(children, findCallback, getChildren, resultCallback, data);
  55979. if (find)
  55980. return find;
  55981. }
  55982. }
  55983. }
  55984. }
  55985. function treeEach(treeData, callback, getChildren, parent) {
  55986. for (let i = 0; i < treeData.length; i++) {
  55987. const data = treeData[i];
  55988. callback(data, i, treeData, parent);
  55989. const children = getChildren(data);
  55990. if (isValidArray(children)) {
  55991. treeEach(children, callback, getChildren, data);
  55992. }
  55993. }
  55994. }
  55995. const useTree$1 = (props, { attrs, slots, emit }, {
  55996. select,
  55997. tree,
  55998. key
  55999. }) => {
  56000. vue.watch([() => props.modelValue, tree], () => {
  56001. if (props.showCheckbox) {
  56002. vue.nextTick(() => {
  56003. const treeInstance = tree.value;
  56004. if (treeInstance && !isEqual$1(treeInstance.getCheckedKeys(), toValidArray(props.modelValue))) {
  56005. treeInstance.setCheckedKeys(toValidArray(props.modelValue));
  56006. }
  56007. });
  56008. }
  56009. }, {
  56010. immediate: true,
  56011. deep: true
  56012. });
  56013. const propsMap = vue.computed(() => ({
  56014. value: key.value,
  56015. label: "label",
  56016. children: "children",
  56017. disabled: "disabled",
  56018. isLeaf: "isLeaf",
  56019. ...props.props
  56020. }));
  56021. const getNodeValByProp = (prop, data) => {
  56022. var _a;
  56023. const propVal = propsMap.value[prop];
  56024. if (isFunction$1(propVal)) {
  56025. return propVal(data, (_a = tree.value) == null ? void 0 : _a.getNode(getNodeValByProp("value", data)));
  56026. } else {
  56027. return data[propVal];
  56028. }
  56029. };
  56030. const defaultExpandedParentKeys = toValidArray(props.modelValue).map((value) => {
  56031. return treeFind(props.data || [], (data) => getNodeValByProp("value", data) === value, (data) => getNodeValByProp("children", data), (data, index, array, parent) => parent && getNodeValByProp("value", parent));
  56032. }).filter((item) => isValidValue(item));
  56033. const cacheOptions = vue.computed(() => {
  56034. if (!props.renderAfterExpand && !props.lazy)
  56035. return [];
  56036. const options = [];
  56037. treeEach(props.data.concat(props.cacheData), (node) => {
  56038. const value = getNodeValByProp("value", node);
  56039. options.push({
  56040. value,
  56041. currentLabel: getNodeValByProp("label", node),
  56042. isDisabled: getNodeValByProp("disabled", node)
  56043. });
  56044. }, (data) => getNodeValByProp("children", data));
  56045. return options;
  56046. });
  56047. const getChildCheckedKeys = () => {
  56048. var _a;
  56049. return (_a = tree.value) == null ? void 0 : _a.getCheckedKeys().filter((checkedKey) => {
  56050. var _a2;
  56051. const node = (_a2 = tree.value) == null ? void 0 : _a2.getNode(checkedKey);
  56052. return !isNil(node) && isEmpty(node.childNodes);
  56053. });
  56054. };
  56055. return {
  56056. ...pick(vue.toRefs(props), Object.keys(ElTree.props)),
  56057. ...attrs,
  56058. nodeKey: key,
  56059. expandOnClickNode: vue.computed(() => {
  56060. return !props.checkStrictly && props.expandOnClickNode;
  56061. }),
  56062. defaultExpandedKeys: vue.computed(() => {
  56063. return props.defaultExpandedKeys ? props.defaultExpandedKeys.concat(defaultExpandedParentKeys) : defaultExpandedParentKeys;
  56064. }),
  56065. renderContent: (h, { node, data, store }) => {
  56066. return h(TreeSelectOption, {
  56067. value: getNodeValByProp("value", data),
  56068. label: getNodeValByProp("label", data),
  56069. disabled: getNodeValByProp("disabled", data),
  56070. visible: node.visible
  56071. }, props.renderContent ? () => props.renderContent(h, { node, data, store }) : slots.default ? () => slots.default({ node, data, store }) : void 0);
  56072. },
  56073. filterNodeMethod: (value, data, node) => {
  56074. if (props.filterNodeMethod)
  56075. return props.filterNodeMethod(value, data, node);
  56076. if (!value)
  56077. return true;
  56078. const regexp = new RegExp(escapeStringRegexp(value), "i");
  56079. return regexp.test(getNodeValByProp("label", data) || "");
  56080. },
  56081. onNodeClick: (data, node, e) => {
  56082. var _a, _b, _c, _d;
  56083. (_a = attrs.onNodeClick) == null ? void 0 : _a.call(attrs, data, node, e);
  56084. if (props.showCheckbox && props.checkOnClickNode)
  56085. return;
  56086. if (!props.showCheckbox && (props.checkStrictly || node.isLeaf)) {
  56087. if (!getNodeValByProp("disabled", data)) {
  56088. const option = (_b = select.value) == null ? void 0 : _b.states.options.get(getNodeValByProp("value", data));
  56089. (_c = select.value) == null ? void 0 : _c.handleOptionSelect(option);
  56090. }
  56091. } else if (props.expandOnClickNode) {
  56092. e.proxy.handleExpandIconClick();
  56093. }
  56094. (_d = select.value) == null ? void 0 : _d.focus();
  56095. },
  56096. onCheck: (data, params) => {
  56097. var _a;
  56098. if (!props.showCheckbox)
  56099. return;
  56100. const dataValue = getNodeValByProp("value", data);
  56101. const dataMap = {};
  56102. treeEach([tree.value.store.root], (node) => dataMap[node.key] = node, (node) => node.childNodes);
  56103. const uncachedCheckedKeys = params.checkedKeys;
  56104. const cachedKeys = props.multiple ? toValidArray(props.modelValue).filter((item) => !(item in dataMap) && !uncachedCheckedKeys.includes(item)) : [];
  56105. const checkedKeys = cachedKeys.concat(uncachedCheckedKeys);
  56106. if (props.checkStrictly) {
  56107. emit(UPDATE_MODEL_EVENT, props.multiple ? checkedKeys : checkedKeys.includes(dataValue) ? dataValue : void 0);
  56108. } else {
  56109. if (props.multiple) {
  56110. const childKeys = getChildCheckedKeys();
  56111. emit(UPDATE_MODEL_EVENT, cachedKeys.concat(childKeys));
  56112. } else {
  56113. const firstLeaf = treeFind([data], (data2) => !isValidArray(getNodeValByProp("children", data2)) && !getNodeValByProp("disabled", data2), (data2) => getNodeValByProp("children", data2));
  56114. const firstLeafKey = firstLeaf ? getNodeValByProp("value", firstLeaf) : void 0;
  56115. const hasCheckedChild = isValidValue(props.modelValue) && !!treeFind([data], (data2) => getNodeValByProp("value", data2) === props.modelValue, (data2) => getNodeValByProp("children", data2));
  56116. emit(UPDATE_MODEL_EVENT, firstLeafKey === props.modelValue || hasCheckedChild ? void 0 : firstLeafKey);
  56117. }
  56118. }
  56119. vue.nextTick(() => {
  56120. var _a2;
  56121. const checkedKeys2 = toValidArray(props.modelValue);
  56122. tree.value.setCheckedKeys(checkedKeys2);
  56123. (_a2 = attrs.onCheck) == null ? void 0 : _a2.call(attrs, data, {
  56124. checkedKeys: tree.value.getCheckedKeys(),
  56125. checkedNodes: tree.value.getCheckedNodes(),
  56126. halfCheckedKeys: tree.value.getHalfCheckedKeys(),
  56127. halfCheckedNodes: tree.value.getHalfCheckedNodes()
  56128. });
  56129. });
  56130. (_a = select.value) == null ? void 0 : _a.focus();
  56131. },
  56132. onNodeExpand: (data, node, e) => {
  56133. var _a;
  56134. (_a = attrs.onNodeExpand) == null ? void 0 : _a.call(attrs, data, node, e);
  56135. vue.nextTick(() => {
  56136. if (!props.checkStrictly && props.lazy && props.multiple && node.checked) {
  56137. const dataMap = {};
  56138. const uncachedCheckedKeys = tree.value.getCheckedKeys();
  56139. treeEach([tree.value.store.root], (node2) => dataMap[node2.key] = node2, (node2) => node2.childNodes);
  56140. const cachedKeys = toValidArray(props.modelValue).filter((item) => !(item in dataMap) && !uncachedCheckedKeys.includes(item));
  56141. const childKeys = getChildCheckedKeys();
  56142. emit(UPDATE_MODEL_EVENT, cachedKeys.concat(childKeys));
  56143. }
  56144. });
  56145. },
  56146. cacheOptions
  56147. };
  56148. };
  56149. var CacheOptions = vue.defineComponent({
  56150. props: {
  56151. data: {
  56152. type: Array,
  56153. default: () => []
  56154. }
  56155. },
  56156. setup(props) {
  56157. const select = vue.inject(selectKey);
  56158. vue.watch(() => props.data, () => {
  56159. var _a;
  56160. props.data.forEach((item) => {
  56161. if (!select.states.cachedOptions.has(item.value)) {
  56162. select.states.cachedOptions.set(item.value, item);
  56163. }
  56164. });
  56165. const inputs = ((_a = select.selectRef) == null ? void 0 : _a.querySelectorAll("input")) || [];
  56166. if (isClient && !Array.from(inputs).includes(document.activeElement)) {
  56167. select.setSelected();
  56168. }
  56169. }, { flush: "post", immediate: true });
  56170. return () => void 0;
  56171. }
  56172. });
  56173. const _sfc_main$m = vue.defineComponent({
  56174. name: "ElTreeSelect",
  56175. inheritAttrs: false,
  56176. props: {
  56177. ...ElSelect.props,
  56178. ...ElTree.props,
  56179. cacheData: {
  56180. type: Array,
  56181. default: () => []
  56182. }
  56183. },
  56184. setup(props, context) {
  56185. const { slots, expose } = context;
  56186. const select = vue.ref();
  56187. const tree = vue.ref();
  56188. const key = vue.computed(() => props.nodeKey || props.valueKey || "value");
  56189. const selectProps = useSelect(props, context, { select, tree, key });
  56190. const { cacheOptions, ...treeProps } = useTree$1(props, context, {
  56191. select,
  56192. tree,
  56193. key
  56194. });
  56195. const methods = vue.reactive({});
  56196. expose(methods);
  56197. vue.onMounted(() => {
  56198. Object.assign(methods, {
  56199. ...pick(tree.value, [
  56200. "filter",
  56201. "updateKeyChildren",
  56202. "getCheckedNodes",
  56203. "setCheckedNodes",
  56204. "getCheckedKeys",
  56205. "setCheckedKeys",
  56206. "setChecked",
  56207. "getHalfCheckedNodes",
  56208. "getHalfCheckedKeys",
  56209. "getCurrentKey",
  56210. "getCurrentNode",
  56211. "setCurrentKey",
  56212. "setCurrentNode",
  56213. "getNode",
  56214. "remove",
  56215. "append",
  56216. "insertBefore",
  56217. "insertAfter"
  56218. ]),
  56219. ...pick(select.value, ["focus", "blur", "selectedLabel"]),
  56220. treeRef: tree.value,
  56221. selectRef: select.value
  56222. });
  56223. });
  56224. return () => vue.h(ElSelect, vue.reactive({
  56225. ...selectProps,
  56226. ref: (ref2) => select.value = ref2
  56227. }), {
  56228. ...slots,
  56229. default: () => [
  56230. vue.h(CacheOptions, { data: cacheOptions.value }),
  56231. vue.h(ElTree, vue.reactive({
  56232. ...treeProps,
  56233. ref: (ref2) => tree.value = ref2
  56234. }))
  56235. ]
  56236. });
  56237. }
  56238. });
  56239. var TreeSelect = /* @__PURE__ */ _export_sfc(_sfc_main$m, [["__file", "tree-select.vue"]]);
  56240. const ElTreeSelect = withInstall(TreeSelect);
  56241. const ROOT_TREE_INJECTION_KEY = Symbol();
  56242. const EMPTY_NODE = {
  56243. key: -1,
  56244. level: -1,
  56245. data: {}
  56246. };
  56247. var TreeOptionsEnum = /* @__PURE__ */ ((TreeOptionsEnum2) => {
  56248. TreeOptionsEnum2["KEY"] = "id";
  56249. TreeOptionsEnum2["LABEL"] = "label";
  56250. TreeOptionsEnum2["CHILDREN"] = "children";
  56251. TreeOptionsEnum2["DISABLED"] = "disabled";
  56252. TreeOptionsEnum2["CLASS"] = "";
  56253. return TreeOptionsEnum2;
  56254. })(TreeOptionsEnum || {});
  56255. var SetOperationEnum = /* @__PURE__ */ ((SetOperationEnum2) => {
  56256. SetOperationEnum2["ADD"] = "add";
  56257. SetOperationEnum2["DELETE"] = "delete";
  56258. return SetOperationEnum2;
  56259. })(SetOperationEnum || {});
  56260. const itemSize = {
  56261. type: Number,
  56262. default: 26
  56263. };
  56264. const treeProps = buildProps({
  56265. data: {
  56266. type: definePropType(Array),
  56267. default: () => mutable([])
  56268. },
  56269. emptyText: {
  56270. type: String
  56271. },
  56272. height: {
  56273. type: Number,
  56274. default: 200
  56275. },
  56276. props: {
  56277. type: definePropType(Object),
  56278. default: () => mutable({
  56279. children: "children" /* CHILDREN */,
  56280. label: "label" /* LABEL */,
  56281. disabled: "disabled" /* DISABLED */,
  56282. value: "id" /* KEY */,
  56283. class: "" /* CLASS */
  56284. })
  56285. },
  56286. highlightCurrent: Boolean,
  56287. showCheckbox: Boolean,
  56288. defaultCheckedKeys: {
  56289. type: definePropType(Array),
  56290. default: () => mutable([])
  56291. },
  56292. checkStrictly: Boolean,
  56293. defaultExpandedKeys: {
  56294. type: definePropType(Array),
  56295. default: () => mutable([])
  56296. },
  56297. indent: {
  56298. type: Number,
  56299. default: 16
  56300. },
  56301. itemSize,
  56302. icon: {
  56303. type: iconPropType
  56304. },
  56305. expandOnClickNode: {
  56306. type: Boolean,
  56307. default: true
  56308. },
  56309. checkOnClickNode: Boolean,
  56310. checkOnClickLeaf: {
  56311. type: Boolean,
  56312. default: true
  56313. },
  56314. currentNodeKey: {
  56315. type: definePropType([String, Number])
  56316. },
  56317. accordion: Boolean,
  56318. filterMethod: {
  56319. type: definePropType(Function)
  56320. },
  56321. perfMode: {
  56322. type: Boolean,
  56323. default: true
  56324. },
  56325. scrollbarAlwaysOn: Boolean
  56326. });
  56327. const treeNodeProps = buildProps({
  56328. node: {
  56329. type: definePropType(Object),
  56330. default: () => mutable(EMPTY_NODE)
  56331. },
  56332. expanded: Boolean,
  56333. checked: Boolean,
  56334. indeterminate: Boolean,
  56335. showCheckbox: Boolean,
  56336. disabled: Boolean,
  56337. current: Boolean,
  56338. hiddenExpandIcon: Boolean,
  56339. itemSize
  56340. });
  56341. const treeNodeContentProps = buildProps({
  56342. node: {
  56343. type: definePropType(Object),
  56344. required: true
  56345. }
  56346. });
  56347. const NODE_CLICK = "node-click";
  56348. const NODE_DROP = "node-drop";
  56349. const NODE_EXPAND = "node-expand";
  56350. const NODE_COLLAPSE = "node-collapse";
  56351. const CURRENT_CHANGE = "current-change";
  56352. const NODE_CHECK = "check";
  56353. const NODE_CHECK_CHANGE = "check-change";
  56354. const NODE_CONTEXTMENU = "node-contextmenu";
  56355. const treeEmits = {
  56356. [NODE_CLICK]: (data, node, e) => data && node && e,
  56357. [NODE_DROP]: (data, node, e) => data && node && e,
  56358. [NODE_EXPAND]: (data, node) => data && node,
  56359. [NODE_COLLAPSE]: (data, node) => data && node,
  56360. [CURRENT_CHANGE]: (data, node) => data && node,
  56361. [NODE_CHECK]: (data, checkedInfo) => data && checkedInfo,
  56362. [NODE_CHECK_CHANGE]: (data, checked) => data && isBoolean(checked),
  56363. [NODE_CONTEXTMENU]: (evt, data, node) => evt && data && node
  56364. };
  56365. const treeNodeEmits = {
  56366. click: (node, e) => !!(node && e),
  56367. drop: (node, e) => !!(node && e),
  56368. toggle: (node) => !!node,
  56369. check: (node, checked) => node && isBoolean(checked)
  56370. };
  56371. function useCheck(props, tree) {
  56372. const checkedKeys = vue.ref(/* @__PURE__ */ new Set());
  56373. const indeterminateKeys = vue.ref(/* @__PURE__ */ new Set());
  56374. const { emit } = vue.getCurrentInstance();
  56375. vue.watch([() => tree.value, () => props.defaultCheckedKeys], () => {
  56376. return vue.nextTick(() => {
  56377. _setCheckedKeys(props.defaultCheckedKeys);
  56378. });
  56379. }, {
  56380. immediate: true
  56381. });
  56382. const updateCheckedKeys = () => {
  56383. if (!tree.value || !props.showCheckbox || props.checkStrictly) {
  56384. return;
  56385. }
  56386. const { levelTreeNodeMap, maxLevel } = tree.value;
  56387. const checkedKeySet = checkedKeys.value;
  56388. const indeterminateKeySet = /* @__PURE__ */ new Set();
  56389. for (let level = maxLevel - 1; level >= 1; --level) {
  56390. const nodes = levelTreeNodeMap.get(level);
  56391. if (!nodes)
  56392. continue;
  56393. nodes.forEach((node) => {
  56394. const children = node.children;
  56395. if (children) {
  56396. let allChecked = true;
  56397. let hasChecked = false;
  56398. for (const childNode of children) {
  56399. const key = childNode.key;
  56400. if (checkedKeySet.has(key)) {
  56401. hasChecked = true;
  56402. } else if (indeterminateKeySet.has(key)) {
  56403. allChecked = false;
  56404. hasChecked = true;
  56405. break;
  56406. } else {
  56407. allChecked = false;
  56408. }
  56409. }
  56410. if (allChecked) {
  56411. checkedKeySet.add(node.key);
  56412. } else if (hasChecked) {
  56413. indeterminateKeySet.add(node.key);
  56414. checkedKeySet.delete(node.key);
  56415. } else {
  56416. checkedKeySet.delete(node.key);
  56417. indeterminateKeySet.delete(node.key);
  56418. }
  56419. }
  56420. });
  56421. }
  56422. indeterminateKeys.value = indeterminateKeySet;
  56423. };
  56424. const isChecked = (node) => checkedKeys.value.has(node.key);
  56425. const isIndeterminate = (node) => indeterminateKeys.value.has(node.key);
  56426. const toggleCheckbox = (node, isChecked2, nodeClick = true, immediateUpdate = true) => {
  56427. const checkedKeySet = checkedKeys.value;
  56428. const toggle = (node2, checked) => {
  56429. checkedKeySet[checked ? SetOperationEnum.ADD : SetOperationEnum.DELETE](node2.key);
  56430. const children = node2.children;
  56431. if (!props.checkStrictly && children) {
  56432. children.forEach((childNode) => {
  56433. if (!childNode.disabled) {
  56434. toggle(childNode, checked);
  56435. }
  56436. });
  56437. }
  56438. };
  56439. toggle(node, isChecked2);
  56440. if (immediateUpdate) {
  56441. updateCheckedKeys();
  56442. }
  56443. if (nodeClick) {
  56444. afterNodeCheck(node, isChecked2);
  56445. }
  56446. };
  56447. const afterNodeCheck = (node, checked) => {
  56448. const { checkedNodes, checkedKeys: checkedKeys2 } = getChecked();
  56449. const { halfCheckedNodes, halfCheckedKeys } = getHalfChecked();
  56450. emit(NODE_CHECK, node.data, {
  56451. checkedKeys: checkedKeys2,
  56452. checkedNodes,
  56453. halfCheckedKeys,
  56454. halfCheckedNodes
  56455. });
  56456. emit(NODE_CHECK_CHANGE, node.data, checked);
  56457. };
  56458. function getCheckedKeys(leafOnly = false) {
  56459. return getChecked(leafOnly).checkedKeys;
  56460. }
  56461. function getCheckedNodes(leafOnly = false) {
  56462. return getChecked(leafOnly).checkedNodes;
  56463. }
  56464. function getHalfCheckedKeys() {
  56465. return getHalfChecked().halfCheckedKeys;
  56466. }
  56467. function getHalfCheckedNodes() {
  56468. return getHalfChecked().halfCheckedNodes;
  56469. }
  56470. function getChecked(leafOnly = false) {
  56471. const checkedNodes = [];
  56472. const keys = [];
  56473. if ((tree == null ? void 0 : tree.value) && props.showCheckbox) {
  56474. const { treeNodeMap } = tree.value;
  56475. checkedKeys.value.forEach((key) => {
  56476. const node = treeNodeMap.get(key);
  56477. if (node && (!leafOnly || leafOnly && node.isLeaf)) {
  56478. keys.push(key);
  56479. checkedNodes.push(node.data);
  56480. }
  56481. });
  56482. }
  56483. return {
  56484. checkedKeys: keys,
  56485. checkedNodes
  56486. };
  56487. }
  56488. function getHalfChecked() {
  56489. const halfCheckedNodes = [];
  56490. const halfCheckedKeys = [];
  56491. if ((tree == null ? void 0 : tree.value) && props.showCheckbox) {
  56492. const { treeNodeMap } = tree.value;
  56493. indeterminateKeys.value.forEach((key) => {
  56494. const node = treeNodeMap.get(key);
  56495. if (node) {
  56496. halfCheckedKeys.push(key);
  56497. halfCheckedNodes.push(node.data);
  56498. }
  56499. });
  56500. }
  56501. return {
  56502. halfCheckedNodes,
  56503. halfCheckedKeys
  56504. };
  56505. }
  56506. function setCheckedKeys(keys) {
  56507. checkedKeys.value.clear();
  56508. indeterminateKeys.value.clear();
  56509. vue.nextTick(() => {
  56510. _setCheckedKeys(keys);
  56511. });
  56512. }
  56513. function setChecked(key, isChecked2) {
  56514. if ((tree == null ? void 0 : tree.value) && props.showCheckbox) {
  56515. const node = tree.value.treeNodeMap.get(key);
  56516. if (node) {
  56517. toggleCheckbox(node, isChecked2, false);
  56518. }
  56519. }
  56520. }
  56521. function _setCheckedKeys(keys) {
  56522. if (tree == null ? void 0 : tree.value) {
  56523. const { treeNodeMap } = tree.value;
  56524. if (props.showCheckbox && treeNodeMap && (keys == null ? void 0 : keys.length) > 0) {
  56525. for (const key of keys) {
  56526. const node = treeNodeMap.get(key);
  56527. if (node && !isChecked(node)) {
  56528. toggleCheckbox(node, true, false, false);
  56529. }
  56530. }
  56531. updateCheckedKeys();
  56532. }
  56533. }
  56534. }
  56535. return {
  56536. updateCheckedKeys,
  56537. toggleCheckbox,
  56538. isChecked,
  56539. isIndeterminate,
  56540. getCheckedKeys,
  56541. getCheckedNodes,
  56542. getHalfCheckedKeys,
  56543. getHalfCheckedNodes,
  56544. setChecked,
  56545. setCheckedKeys
  56546. };
  56547. }
  56548. function useFilter(props, tree) {
  56549. const hiddenNodeKeySet = vue.ref(/* @__PURE__ */ new Set([]));
  56550. const hiddenExpandIconKeySet = vue.ref(/* @__PURE__ */ new Set([]));
  56551. const filterable = vue.computed(() => {
  56552. return isFunction$1(props.filterMethod);
  56553. });
  56554. function doFilter(query) {
  56555. var _a;
  56556. if (!filterable.value) {
  56557. return;
  56558. }
  56559. const expandKeySet = /* @__PURE__ */ new Set();
  56560. const hiddenExpandIconKeys = hiddenExpandIconKeySet.value;
  56561. const hiddenKeys = hiddenNodeKeySet.value;
  56562. const family = [];
  56563. const nodes = ((_a = tree.value) == null ? void 0 : _a.treeNodes) || [];
  56564. const filter = props.filterMethod;
  56565. hiddenKeys.clear();
  56566. function traverse(nodes2) {
  56567. nodes2.forEach((node) => {
  56568. family.push(node);
  56569. if (filter == null ? void 0 : filter(query, node.data, node)) {
  56570. family.forEach((member) => {
  56571. expandKeySet.add(member.key);
  56572. member.expanded = true;
  56573. });
  56574. } else {
  56575. node.expanded = false;
  56576. if (node.isLeaf) {
  56577. hiddenKeys.add(node.key);
  56578. }
  56579. }
  56580. const children = node.children;
  56581. if (children) {
  56582. traverse(children);
  56583. }
  56584. if (!node.isLeaf) {
  56585. if (!expandKeySet.has(node.key)) {
  56586. hiddenKeys.add(node.key);
  56587. } else if (children) {
  56588. let allHidden = true;
  56589. for (const childNode of children) {
  56590. if (!hiddenKeys.has(childNode.key)) {
  56591. allHidden = false;
  56592. break;
  56593. }
  56594. }
  56595. if (allHidden) {
  56596. hiddenExpandIconKeys.add(node.key);
  56597. } else {
  56598. hiddenExpandIconKeys.delete(node.key);
  56599. }
  56600. }
  56601. }
  56602. family.pop();
  56603. });
  56604. }
  56605. traverse(nodes);
  56606. return expandKeySet;
  56607. }
  56608. function isForceHiddenExpandIcon(node) {
  56609. return hiddenExpandIconKeySet.value.has(node.key);
  56610. }
  56611. return {
  56612. hiddenExpandIconKeySet,
  56613. hiddenNodeKeySet,
  56614. doFilter,
  56615. isForceHiddenExpandIcon
  56616. };
  56617. }
  56618. function useTree(props, emit) {
  56619. const expandedKeySet = vue.ref(/* @__PURE__ */ new Set());
  56620. const currentKey = vue.ref();
  56621. const tree = vue.shallowRef();
  56622. const listRef = vue.ref();
  56623. const {
  56624. isIndeterminate,
  56625. isChecked,
  56626. toggleCheckbox,
  56627. getCheckedKeys,
  56628. getCheckedNodes,
  56629. getHalfCheckedKeys,
  56630. getHalfCheckedNodes,
  56631. setChecked,
  56632. setCheckedKeys
  56633. } = useCheck(props, tree);
  56634. const { doFilter, hiddenNodeKeySet, isForceHiddenExpandIcon } = useFilter(props, tree);
  56635. const valueKey = vue.computed(() => {
  56636. var _a;
  56637. return ((_a = props.props) == null ? void 0 : _a.value) || TreeOptionsEnum.KEY;
  56638. });
  56639. const childrenKey = vue.computed(() => {
  56640. var _a;
  56641. return ((_a = props.props) == null ? void 0 : _a.children) || TreeOptionsEnum.CHILDREN;
  56642. });
  56643. const disabledKey = vue.computed(() => {
  56644. var _a;
  56645. return ((_a = props.props) == null ? void 0 : _a.disabled) || TreeOptionsEnum.DISABLED;
  56646. });
  56647. const labelKey = vue.computed(() => {
  56648. var _a;
  56649. return ((_a = props.props) == null ? void 0 : _a.label) || TreeOptionsEnum.LABEL;
  56650. });
  56651. const flattenTree = vue.computed(() => {
  56652. var _a;
  56653. const expandedKeys = expandedKeySet.value;
  56654. const hiddenKeys = hiddenNodeKeySet.value;
  56655. const flattenNodes = [];
  56656. const nodes = ((_a = tree.value) == null ? void 0 : _a.treeNodes) || [];
  56657. const stack = [];
  56658. for (let i = nodes.length - 1; i >= 0; --i) {
  56659. stack.push(nodes[i]);
  56660. }
  56661. while (stack.length) {
  56662. const node = stack.pop();
  56663. if (hiddenKeys.has(node.key))
  56664. continue;
  56665. flattenNodes.push(node);
  56666. if (node.children && expandedKeys.has(node.key)) {
  56667. for (let i = node.children.length - 1; i >= 0; --i) {
  56668. stack.push(node.children[i]);
  56669. }
  56670. }
  56671. }
  56672. return flattenNodes;
  56673. });
  56674. const isNotEmpty = vue.computed(() => {
  56675. return flattenTree.value.length > 0;
  56676. });
  56677. function createTree(data) {
  56678. const treeNodeMap = /* @__PURE__ */ new Map();
  56679. const levelTreeNodeMap = /* @__PURE__ */ new Map();
  56680. let maxLevel = 1;
  56681. function traverse(nodes, level = 1, parent = void 0) {
  56682. var _a;
  56683. const siblings = [];
  56684. for (const rawNode of nodes) {
  56685. const value = getKey(rawNode);
  56686. const node = {
  56687. level,
  56688. key: value,
  56689. data: rawNode
  56690. };
  56691. node.label = getLabel(rawNode);
  56692. node.parent = parent;
  56693. const children = getChildren(rawNode);
  56694. node.disabled = getDisabled(rawNode);
  56695. node.isLeaf = !children || children.length === 0;
  56696. node.expanded = expandedKeySet.value.has(value);
  56697. if (children && children.length) {
  56698. node.children = traverse(children, level + 1, node);
  56699. }
  56700. siblings.push(node);
  56701. treeNodeMap.set(value, node);
  56702. if (!levelTreeNodeMap.has(level)) {
  56703. levelTreeNodeMap.set(level, []);
  56704. }
  56705. (_a = levelTreeNodeMap.get(level)) == null ? void 0 : _a.push(node);
  56706. }
  56707. if (level > maxLevel) {
  56708. maxLevel = level;
  56709. }
  56710. return siblings;
  56711. }
  56712. const treeNodes = traverse(data);
  56713. return {
  56714. treeNodeMap,
  56715. levelTreeNodeMap,
  56716. maxLevel,
  56717. treeNodes
  56718. };
  56719. }
  56720. function filter(query) {
  56721. const keys = doFilter(query);
  56722. if (keys) {
  56723. expandedKeySet.value = keys;
  56724. }
  56725. }
  56726. function getChildren(node) {
  56727. return node[childrenKey.value];
  56728. }
  56729. function getKey(node) {
  56730. if (!node) {
  56731. return "";
  56732. }
  56733. return node[valueKey.value];
  56734. }
  56735. function getDisabled(node) {
  56736. return node[disabledKey.value];
  56737. }
  56738. function getLabel(node) {
  56739. return node[labelKey.value];
  56740. }
  56741. function toggleExpand(node) {
  56742. const expandedKeys = expandedKeySet.value;
  56743. if (expandedKeys.has(node.key)) {
  56744. collapseNode(node);
  56745. } else {
  56746. expandNode(node);
  56747. }
  56748. }
  56749. function setExpandedKeys(keys) {
  56750. const expandedKeys = /* @__PURE__ */ new Set();
  56751. const nodeMap = tree.value.treeNodeMap;
  56752. expandedKeySet.value.forEach((key) => {
  56753. const node = nodeMap.get(key);
  56754. expandedKeySet.value.delete(node.key);
  56755. node.expanded = false;
  56756. });
  56757. keys.forEach((k) => {
  56758. let node = nodeMap.get(k);
  56759. while (node && !expandedKeys.has(node.key)) {
  56760. expandedKeys.add(node.key);
  56761. node.expanded = true;
  56762. node = node.parent;
  56763. }
  56764. });
  56765. expandedKeySet.value = expandedKeys;
  56766. }
  56767. function handleNodeClick(node, e) {
  56768. emit(NODE_CLICK, node.data, node, e);
  56769. handleCurrentChange(node);
  56770. if (props.expandOnClickNode) {
  56771. toggleExpand(node);
  56772. }
  56773. if (props.showCheckbox && (props.checkOnClickNode || node.isLeaf && props.checkOnClickLeaf) && !node.disabled) {
  56774. toggleCheckbox(node, !isChecked(node), true);
  56775. }
  56776. }
  56777. function handleNodeDrop(node, e) {
  56778. emit(NODE_DROP, node.data, node, e);
  56779. }
  56780. function handleCurrentChange(node) {
  56781. if (!isCurrent(node)) {
  56782. currentKey.value = node.key;
  56783. emit(CURRENT_CHANGE, node.data, node);
  56784. }
  56785. }
  56786. function handleNodeCheck(node, checked) {
  56787. toggleCheckbox(node, checked);
  56788. }
  56789. function expandNode(node) {
  56790. const keySet = expandedKeySet.value;
  56791. if (tree.value && props.accordion) {
  56792. const { treeNodeMap } = tree.value;
  56793. keySet.forEach((key) => {
  56794. const treeNode = treeNodeMap.get(key);
  56795. if (node && node.level === (treeNode == null ? void 0 : treeNode.level)) {
  56796. keySet.delete(key);
  56797. treeNode.expanded = false;
  56798. }
  56799. });
  56800. }
  56801. keySet.add(node.key);
  56802. const _node = getNode(node.key);
  56803. if (_node) {
  56804. _node.expanded = true;
  56805. emit(NODE_EXPAND, _node.data, _node);
  56806. }
  56807. }
  56808. function collapseNode(node) {
  56809. expandedKeySet.value.delete(node.key);
  56810. const _node = getNode(node.key);
  56811. if (_node) {
  56812. _node.expanded = false;
  56813. emit(NODE_COLLAPSE, _node.data, _node);
  56814. }
  56815. }
  56816. function isDisabled(node) {
  56817. return !!node.disabled;
  56818. }
  56819. function isCurrent(node) {
  56820. const current = currentKey.value;
  56821. return current !== void 0 && current === node.key;
  56822. }
  56823. function getCurrentNode() {
  56824. var _a, _b;
  56825. if (!currentKey.value)
  56826. return void 0;
  56827. return (_b = (_a = tree.value) == null ? void 0 : _a.treeNodeMap.get(currentKey.value)) == null ? void 0 : _b.data;
  56828. }
  56829. function getCurrentKey() {
  56830. return currentKey.value;
  56831. }
  56832. function setCurrentKey(key) {
  56833. currentKey.value = key;
  56834. }
  56835. function setData(data) {
  56836. tree.value = createTree(data);
  56837. }
  56838. function getNode(data) {
  56839. var _a;
  56840. const key = isObject$1(data) ? getKey(data) : data;
  56841. return (_a = tree.value) == null ? void 0 : _a.treeNodeMap.get(key);
  56842. }
  56843. function scrollToNode(key, strategy = "auto") {
  56844. const node = getNode(key);
  56845. if (node && listRef.value) {
  56846. listRef.value.scrollToItem(flattenTree.value.indexOf(node), strategy);
  56847. }
  56848. }
  56849. function scrollTo(offset) {
  56850. var _a;
  56851. (_a = listRef.value) == null ? void 0 : _a.scrollTo(offset);
  56852. }
  56853. vue.watch(() => props.currentNodeKey, (key) => {
  56854. currentKey.value = key;
  56855. }, {
  56856. immediate: true
  56857. });
  56858. vue.watch(() => props.defaultExpandedKeys, (key) => {
  56859. expandedKeySet.value = new Set(key);
  56860. }, {
  56861. immediate: true
  56862. });
  56863. vue.watch(() => props.data, (data) => {
  56864. setData(data);
  56865. }, {
  56866. immediate: true
  56867. });
  56868. return {
  56869. tree,
  56870. flattenTree,
  56871. isNotEmpty,
  56872. listRef,
  56873. getKey,
  56874. getChildren,
  56875. toggleExpand,
  56876. toggleCheckbox,
  56877. isChecked,
  56878. isIndeterminate,
  56879. isDisabled,
  56880. isCurrent,
  56881. isForceHiddenExpandIcon,
  56882. handleNodeClick,
  56883. handleNodeDrop,
  56884. handleNodeCheck,
  56885. getCurrentNode,
  56886. getCurrentKey,
  56887. setCurrentKey,
  56888. getCheckedKeys,
  56889. getCheckedNodes,
  56890. getHalfCheckedKeys,
  56891. getHalfCheckedNodes,
  56892. setChecked,
  56893. setCheckedKeys,
  56894. filter,
  56895. setData,
  56896. getNode,
  56897. expandNode,
  56898. collapseNode,
  56899. setExpandedKeys,
  56900. scrollToNode,
  56901. scrollTo
  56902. };
  56903. }
  56904. var ElNodeContent = vue.defineComponent({
  56905. name: "ElTreeNodeContent",
  56906. props: treeNodeContentProps,
  56907. setup(props) {
  56908. const tree = vue.inject(ROOT_TREE_INJECTION_KEY);
  56909. const ns = useNamespace("tree");
  56910. return () => {
  56911. const node = props.node;
  56912. const { data } = node;
  56913. return (tree == null ? void 0 : tree.ctx.slots.default) ? tree.ctx.slots.default({ node, data }) : vue.h(ElText, { tag: "span", truncated: true, class: ns.be("node", "label") }, () => [node == null ? void 0 : node.label]);
  56914. };
  56915. }
  56916. });
  56917. const __default__$k = vue.defineComponent({
  56918. name: "ElTreeNode"
  56919. });
  56920. const _sfc_main$l = /* @__PURE__ */ vue.defineComponent({
  56921. ...__default__$k,
  56922. props: treeNodeProps,
  56923. emits: treeNodeEmits,
  56924. setup(__props, { emit }) {
  56925. const props = __props;
  56926. const tree = vue.inject(ROOT_TREE_INJECTION_KEY);
  56927. const ns = useNamespace("tree");
  56928. const indent = vue.computed(() => {
  56929. var _a;
  56930. return (_a = tree == null ? void 0 : tree.props.indent) != null ? _a : 16;
  56931. });
  56932. const icon = vue.computed(() => {
  56933. var _a;
  56934. return (_a = tree == null ? void 0 : tree.props.icon) != null ? _a : caret_right_default;
  56935. });
  56936. const getNodeClass = (node) => {
  56937. const nodeClassFunc = tree == null ? void 0 : tree.props.props.class;
  56938. if (!nodeClassFunc)
  56939. return {};
  56940. let className;
  56941. if (isFunction$1(nodeClassFunc)) {
  56942. const { data } = node;
  56943. className = nodeClassFunc(data, node);
  56944. } else {
  56945. className = nodeClassFunc;
  56946. }
  56947. return isString$1(className) ? { [className]: true } : className;
  56948. };
  56949. const handleClick = (e) => {
  56950. emit("click", props.node, e);
  56951. };
  56952. const handleDrop = (e) => {
  56953. emit("drop", props.node, e);
  56954. };
  56955. const handleExpandIconClick = () => {
  56956. emit("toggle", props.node);
  56957. };
  56958. const handleCheckChange = (value) => {
  56959. emit("check", props.node, value);
  56960. };
  56961. const handleContextMenu = (event) => {
  56962. var _a, _b, _c, _d;
  56963. 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"]) {
  56964. event.stopPropagation();
  56965. event.preventDefault();
  56966. }
  56967. tree == null ? void 0 : tree.ctx.emit(NODE_CONTEXTMENU, event, (_d = props.node) == null ? void 0 : _d.data, props.node);
  56968. };
  56969. return (_ctx, _cache) => {
  56970. var _a, _b, _c;
  56971. return vue.openBlock(), vue.createElementBlock("div", {
  56972. ref: "node$",
  56973. class: vue.normalizeClass([
  56974. vue.unref(ns).b("node"),
  56975. vue.unref(ns).is("expanded", _ctx.expanded),
  56976. vue.unref(ns).is("current", _ctx.current),
  56977. vue.unref(ns).is("focusable", !_ctx.disabled),
  56978. vue.unref(ns).is("checked", !_ctx.disabled && _ctx.checked),
  56979. getNodeClass(_ctx.node)
  56980. ]),
  56981. role: "treeitem",
  56982. tabindex: "-1",
  56983. "aria-expanded": _ctx.expanded,
  56984. "aria-disabled": _ctx.disabled,
  56985. "aria-checked": _ctx.checked,
  56986. "data-key": (_a = _ctx.node) == null ? void 0 : _a.key,
  56987. onClick: vue.withModifiers(handleClick, ["stop"]),
  56988. onContextmenu: handleContextMenu,
  56989. onDragover: vue.withModifiers(() => {
  56990. }, ["prevent"]),
  56991. onDragenter: vue.withModifiers(() => {
  56992. }, ["prevent"]),
  56993. onDrop: vue.withModifiers(handleDrop, ["stop"])
  56994. }, [
  56995. vue.createElementVNode("div", {
  56996. class: vue.normalizeClass(vue.unref(ns).be("node", "content")),
  56997. style: vue.normalizeStyle({
  56998. paddingLeft: `${(_ctx.node.level - 1) * vue.unref(indent)}px`,
  56999. height: _ctx.itemSize + "px"
  57000. })
  57001. }, [
  57002. vue.unref(icon) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  57003. key: 0,
  57004. class: vue.normalizeClass([
  57005. vue.unref(ns).is("leaf", !!((_b = _ctx.node) == null ? void 0 : _b.isLeaf)),
  57006. vue.unref(ns).is("hidden", _ctx.hiddenExpandIcon),
  57007. {
  57008. expanded: !((_c = _ctx.node) == null ? void 0 : _c.isLeaf) && _ctx.expanded
  57009. },
  57010. vue.unref(ns).be("node", "expand-icon")
  57011. ]),
  57012. onClick: vue.withModifiers(handleExpandIconClick, ["stop"])
  57013. }, {
  57014. default: vue.withCtx(() => [
  57015. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(icon))))
  57016. ]),
  57017. _: 1
  57018. }, 8, ["class", "onClick"])) : vue.createCommentVNode("v-if", true),
  57019. _ctx.showCheckbox ? (vue.openBlock(), vue.createBlock(vue.unref(ElCheckbox), {
  57020. key: 1,
  57021. "model-value": _ctx.checked,
  57022. indeterminate: _ctx.indeterminate,
  57023. disabled: _ctx.disabled,
  57024. onChange: handleCheckChange,
  57025. onClick: vue.withModifiers(() => {
  57026. }, ["stop"])
  57027. }, null, 8, ["model-value", "indeterminate", "disabled", "onClick"])) : vue.createCommentVNode("v-if", true),
  57028. vue.createVNode(vue.unref(ElNodeContent), {
  57029. node: { ..._ctx.node, expanded: _ctx.expanded }
  57030. }, null, 8, ["node"])
  57031. ], 6)
  57032. ], 42, ["aria-expanded", "aria-disabled", "aria-checked", "data-key", "onClick", "onDragover", "onDragenter", "onDrop"]);
  57033. };
  57034. }
  57035. });
  57036. var ElTreeNode = /* @__PURE__ */ _export_sfc(_sfc_main$l, [["__file", "tree-node.vue"]]);
  57037. const __default__$j = vue.defineComponent({
  57038. name: "ElTreeV2"
  57039. });
  57040. const _sfc_main$k = /* @__PURE__ */ vue.defineComponent({
  57041. ...__default__$j,
  57042. props: treeProps,
  57043. emits: treeEmits,
  57044. setup(__props, { expose, emit }) {
  57045. const props = __props;
  57046. const slots = vue.useSlots();
  57047. const treeNodeSize = vue.computed(() => props.itemSize);
  57048. vue.provide(ROOT_TREE_INJECTION_KEY, {
  57049. ctx: {
  57050. emit,
  57051. slots
  57052. },
  57053. props,
  57054. instance: vue.getCurrentInstance()
  57055. });
  57056. vue.provide(formItemContextKey, void 0);
  57057. const { t } = useLocale();
  57058. const ns = useNamespace("tree");
  57059. const {
  57060. flattenTree,
  57061. isNotEmpty,
  57062. listRef,
  57063. toggleExpand,
  57064. isIndeterminate,
  57065. isChecked,
  57066. isDisabled,
  57067. isCurrent,
  57068. isForceHiddenExpandIcon,
  57069. handleNodeClick,
  57070. handleNodeDrop,
  57071. handleNodeCheck,
  57072. toggleCheckbox,
  57073. getCurrentNode,
  57074. getCurrentKey,
  57075. setCurrentKey,
  57076. getCheckedKeys,
  57077. getCheckedNodes,
  57078. getHalfCheckedKeys,
  57079. getHalfCheckedNodes,
  57080. setChecked,
  57081. setCheckedKeys,
  57082. filter,
  57083. setData,
  57084. getNode,
  57085. expandNode,
  57086. collapseNode,
  57087. setExpandedKeys,
  57088. scrollToNode,
  57089. scrollTo
  57090. } = useTree(props, emit);
  57091. expose({
  57092. toggleCheckbox,
  57093. getCurrentNode,
  57094. getCurrentKey,
  57095. setCurrentKey,
  57096. getCheckedKeys,
  57097. getCheckedNodes,
  57098. getHalfCheckedKeys,
  57099. getHalfCheckedNodes,
  57100. setChecked,
  57101. setCheckedKeys,
  57102. filter,
  57103. setData,
  57104. getNode,
  57105. expandNode,
  57106. collapseNode,
  57107. setExpandedKeys,
  57108. scrollToNode,
  57109. scrollTo
  57110. });
  57111. return (_ctx, _cache) => {
  57112. return vue.openBlock(), vue.createElementBlock("div", {
  57113. class: vue.normalizeClass([vue.unref(ns).b(), { [vue.unref(ns).m("highlight-current")]: _ctx.highlightCurrent }]),
  57114. role: "tree"
  57115. }, [
  57116. vue.unref(isNotEmpty) ? (vue.openBlock(), vue.createBlock(vue.unref(FixedSizeList$1), {
  57117. key: 0,
  57118. ref_key: "listRef",
  57119. ref: listRef,
  57120. "class-name": vue.unref(ns).b("virtual-list"),
  57121. data: vue.unref(flattenTree),
  57122. total: vue.unref(flattenTree).length,
  57123. height: _ctx.height,
  57124. "item-size": vue.unref(treeNodeSize),
  57125. "perf-mode": _ctx.perfMode,
  57126. "scrollbar-always-on": _ctx.scrollbarAlwaysOn
  57127. }, {
  57128. default: vue.withCtx(({ data, index, style }) => [
  57129. (vue.openBlock(), vue.createBlock(ElTreeNode, {
  57130. key: data[index].key,
  57131. style: vue.normalizeStyle(style),
  57132. node: data[index],
  57133. expanded: data[index].expanded,
  57134. "show-checkbox": _ctx.showCheckbox,
  57135. checked: vue.unref(isChecked)(data[index]),
  57136. indeterminate: vue.unref(isIndeterminate)(data[index]),
  57137. "item-size": vue.unref(treeNodeSize),
  57138. disabled: vue.unref(isDisabled)(data[index]),
  57139. current: vue.unref(isCurrent)(data[index]),
  57140. "hidden-expand-icon": vue.unref(isForceHiddenExpandIcon)(data[index]),
  57141. onClick: vue.unref(handleNodeClick),
  57142. onToggle: vue.unref(toggleExpand),
  57143. onCheck: vue.unref(handleNodeCheck),
  57144. onDrop: vue.unref(handleNodeDrop)
  57145. }, null, 8, ["style", "node", "expanded", "show-checkbox", "checked", "indeterminate", "item-size", "disabled", "current", "hidden-expand-icon", "onClick", "onToggle", "onCheck", "onDrop"]))
  57146. ]),
  57147. _: 1
  57148. }, 8, ["class-name", "data", "total", "height", "item-size", "perf-mode", "scrollbar-always-on"])) : (vue.openBlock(), vue.createElementBlock("div", {
  57149. key: 1,
  57150. class: vue.normalizeClass(vue.unref(ns).e("empty-block"))
  57151. }, [
  57152. vue.renderSlot(_ctx.$slots, "empty", {}, () => {
  57153. var _a;
  57154. return [
  57155. vue.createElementVNode("span", {
  57156. class: vue.normalizeClass(vue.unref(ns).e("empty-text"))
  57157. }, vue.toDisplayString((_a = _ctx.emptyText) != null ? _a : vue.unref(t)("el.tree.emptyText")), 3)
  57158. ];
  57159. })
  57160. ], 2))
  57161. ], 2);
  57162. };
  57163. }
  57164. });
  57165. var TreeV2 = /* @__PURE__ */ _export_sfc(_sfc_main$k, [["__file", "tree.vue"]]);
  57166. const ElTreeV2 = withInstall(TreeV2);
  57167. const uploadContextKey = Symbol("uploadContextKey");
  57168. const SCOPE$2 = "ElUpload";
  57169. class UploadAjaxError extends Error {
  57170. constructor(message, status, method, url) {
  57171. super(message);
  57172. this.name = "UploadAjaxError";
  57173. this.status = status;
  57174. this.method = method;
  57175. this.url = url;
  57176. }
  57177. }
  57178. function getError(action, option, xhr) {
  57179. let msg;
  57180. if (xhr.response) {
  57181. msg = `${xhr.response.error || xhr.response}`;
  57182. } else if (xhr.responseText) {
  57183. msg = `${xhr.responseText}`;
  57184. } else {
  57185. msg = `fail to ${option.method} ${action} ${xhr.status}`;
  57186. }
  57187. return new UploadAjaxError(msg, xhr.status, option.method, action);
  57188. }
  57189. function getBody(xhr) {
  57190. const text = xhr.responseText || xhr.response;
  57191. if (!text) {
  57192. return text;
  57193. }
  57194. try {
  57195. return JSON.parse(text);
  57196. } catch (e) {
  57197. return text;
  57198. }
  57199. }
  57200. const ajaxUpload = (option) => {
  57201. if (typeof XMLHttpRequest === "undefined")
  57202. throwError(SCOPE$2, "XMLHttpRequest is undefined");
  57203. const xhr = new XMLHttpRequest();
  57204. const action = option.action;
  57205. if (xhr.upload) {
  57206. xhr.upload.addEventListener("progress", (evt) => {
  57207. const progressEvt = evt;
  57208. progressEvt.percent = evt.total > 0 ? evt.loaded / evt.total * 100 : 0;
  57209. option.onProgress(progressEvt);
  57210. });
  57211. }
  57212. const formData = new FormData();
  57213. if (option.data) {
  57214. for (const [key, value] of Object.entries(option.data)) {
  57215. if (isArray$1(value) && value.length)
  57216. formData.append(key, ...value);
  57217. else
  57218. formData.append(key, value);
  57219. }
  57220. }
  57221. formData.append(option.filename, option.file, option.file.name);
  57222. xhr.addEventListener("error", () => {
  57223. option.onError(getError(action, option, xhr));
  57224. });
  57225. xhr.addEventListener("load", () => {
  57226. if (xhr.status < 200 || xhr.status >= 300) {
  57227. return option.onError(getError(action, option, xhr));
  57228. }
  57229. option.onSuccess(getBody(xhr));
  57230. });
  57231. xhr.open(option.method, action, true);
  57232. if (option.withCredentials && "withCredentials" in xhr) {
  57233. xhr.withCredentials = true;
  57234. }
  57235. const headers = option.headers || {};
  57236. if (headers instanceof Headers) {
  57237. headers.forEach((value, key) => xhr.setRequestHeader(key, value));
  57238. } else {
  57239. for (const [key, value] of Object.entries(headers)) {
  57240. if (isNil(value))
  57241. continue;
  57242. xhr.setRequestHeader(key, String(value));
  57243. }
  57244. }
  57245. xhr.send(formData);
  57246. return xhr;
  57247. };
  57248. const uploadListTypes = ["text", "picture", "picture-card"];
  57249. let fileId = 1;
  57250. const genFileId = () => Date.now() + fileId++;
  57251. const uploadBaseProps = buildProps({
  57252. action: {
  57253. type: String,
  57254. default: "#"
  57255. },
  57256. headers: {
  57257. type: definePropType(Object)
  57258. },
  57259. method: {
  57260. type: String,
  57261. default: "post"
  57262. },
  57263. data: {
  57264. type: definePropType([Object, Function, Promise]),
  57265. default: () => mutable({})
  57266. },
  57267. multiple: Boolean,
  57268. name: {
  57269. type: String,
  57270. default: "file"
  57271. },
  57272. drag: Boolean,
  57273. withCredentials: Boolean,
  57274. showFileList: {
  57275. type: Boolean,
  57276. default: true
  57277. },
  57278. accept: {
  57279. type: String,
  57280. default: ""
  57281. },
  57282. fileList: {
  57283. type: definePropType(Array),
  57284. default: () => mutable([])
  57285. },
  57286. autoUpload: {
  57287. type: Boolean,
  57288. default: true
  57289. },
  57290. listType: {
  57291. type: String,
  57292. values: uploadListTypes,
  57293. default: "text"
  57294. },
  57295. httpRequest: {
  57296. type: definePropType(Function),
  57297. default: ajaxUpload
  57298. },
  57299. disabled: Boolean,
  57300. limit: Number
  57301. });
  57302. const uploadProps = buildProps({
  57303. ...uploadBaseProps,
  57304. beforeUpload: {
  57305. type: definePropType(Function),
  57306. default: NOOP
  57307. },
  57308. beforeRemove: {
  57309. type: definePropType(Function)
  57310. },
  57311. onRemove: {
  57312. type: definePropType(Function),
  57313. default: NOOP
  57314. },
  57315. onChange: {
  57316. type: definePropType(Function),
  57317. default: NOOP
  57318. },
  57319. onPreview: {
  57320. type: definePropType(Function),
  57321. default: NOOP
  57322. },
  57323. onSuccess: {
  57324. type: definePropType(Function),
  57325. default: NOOP
  57326. },
  57327. onProgress: {
  57328. type: definePropType(Function),
  57329. default: NOOP
  57330. },
  57331. onError: {
  57332. type: definePropType(Function),
  57333. default: NOOP
  57334. },
  57335. onExceed: {
  57336. type: definePropType(Function),
  57337. default: NOOP
  57338. },
  57339. crossorigin: {
  57340. type: definePropType(String)
  57341. }
  57342. });
  57343. const uploadListProps = buildProps({
  57344. files: {
  57345. type: definePropType(Array),
  57346. default: () => mutable([])
  57347. },
  57348. disabled: Boolean,
  57349. handlePreview: {
  57350. type: definePropType(Function),
  57351. default: NOOP
  57352. },
  57353. listType: {
  57354. type: String,
  57355. values: uploadListTypes,
  57356. default: "text"
  57357. },
  57358. crossorigin: {
  57359. type: definePropType(String)
  57360. }
  57361. });
  57362. const uploadListEmits = {
  57363. remove: (file) => !!file
  57364. };
  57365. const __default__$i = vue.defineComponent({
  57366. name: "ElUploadList"
  57367. });
  57368. const _sfc_main$j = /* @__PURE__ */ vue.defineComponent({
  57369. ...__default__$i,
  57370. props: uploadListProps,
  57371. emits: uploadListEmits,
  57372. setup(__props, { emit }) {
  57373. const props = __props;
  57374. const { t } = useLocale();
  57375. const nsUpload = useNamespace("upload");
  57376. const nsIcon = useNamespace("icon");
  57377. const nsList = useNamespace("list");
  57378. const disabled = useFormDisabled();
  57379. const focusing = vue.ref(false);
  57380. const containerKls = vue.computed(() => [
  57381. nsUpload.b("list"),
  57382. nsUpload.bm("list", props.listType),
  57383. nsUpload.is("disabled", props.disabled)
  57384. ]);
  57385. const handleRemove = (file) => {
  57386. emit("remove", file);
  57387. };
  57388. return (_ctx, _cache) => {
  57389. return vue.openBlock(), vue.createBlock(vue.TransitionGroup, {
  57390. tag: "ul",
  57391. class: vue.normalizeClass(vue.unref(containerKls)),
  57392. name: vue.unref(nsList).b()
  57393. }, {
  57394. default: vue.withCtx(() => [
  57395. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.files, (file, index) => {
  57396. return vue.openBlock(), vue.createElementBlock("li", {
  57397. key: file.uid || file.name,
  57398. class: vue.normalizeClass([
  57399. vue.unref(nsUpload).be("list", "item"),
  57400. vue.unref(nsUpload).is(file.status),
  57401. { focusing: focusing.value }
  57402. ]),
  57403. tabindex: vue.unref(disabled) ? void 0 : 0,
  57404. "aria-disabled": vue.unref(disabled),
  57405. role: "button",
  57406. onKeydown: vue.withKeys(($event) => !vue.unref(disabled) && handleRemove(file), ["delete"]),
  57407. onFocus: ($event) => focusing.value = true,
  57408. onBlur: ($event) => focusing.value = false,
  57409. onClick: ($event) => focusing.value = false
  57410. }, [
  57411. vue.renderSlot(_ctx.$slots, "default", {
  57412. file,
  57413. index
  57414. }, () => [
  57415. _ctx.listType === "picture" || file.status !== "uploading" && _ctx.listType === "picture-card" ? (vue.openBlock(), vue.createElementBlock("img", {
  57416. key: 0,
  57417. class: vue.normalizeClass(vue.unref(nsUpload).be("list", "item-thumbnail")),
  57418. src: file.url,
  57419. crossorigin: _ctx.crossorigin,
  57420. alt: ""
  57421. }, null, 10, ["src", "crossorigin"])) : vue.createCommentVNode("v-if", true),
  57422. file.status === "uploading" || _ctx.listType !== "picture-card" ? (vue.openBlock(), vue.createElementBlock("div", {
  57423. key: 1,
  57424. class: vue.normalizeClass(vue.unref(nsUpload).be("list", "item-info"))
  57425. }, [
  57426. vue.createElementVNode("a", {
  57427. class: vue.normalizeClass(vue.unref(nsUpload).be("list", "item-name")),
  57428. onClick: vue.withModifiers(($event) => _ctx.handlePreview(file), ["prevent"])
  57429. }, [
  57430. vue.createVNode(vue.unref(ElIcon), {
  57431. class: vue.normalizeClass(vue.unref(nsIcon).m("document"))
  57432. }, {
  57433. default: vue.withCtx(() => [
  57434. vue.createVNode(vue.unref(document_default))
  57435. ]),
  57436. _: 1
  57437. }, 8, ["class"]),
  57438. vue.createElementVNode("span", {
  57439. class: vue.normalizeClass(vue.unref(nsUpload).be("list", "item-file-name")),
  57440. title: file.name
  57441. }, vue.toDisplayString(file.name), 11, ["title"])
  57442. ], 10, ["onClick"]),
  57443. file.status === "uploading" ? (vue.openBlock(), vue.createBlock(vue.unref(ElProgress), {
  57444. key: 0,
  57445. type: _ctx.listType === "picture-card" ? "circle" : "line",
  57446. "stroke-width": _ctx.listType === "picture-card" ? 6 : 2,
  57447. percentage: Number(file.percentage),
  57448. style: vue.normalizeStyle(_ctx.listType === "picture-card" ? "" : "margin-top: 0.5rem")
  57449. }, null, 8, ["type", "stroke-width", "percentage", "style"])) : vue.createCommentVNode("v-if", true)
  57450. ], 2)) : vue.createCommentVNode("v-if", true),
  57451. vue.createElementVNode("label", {
  57452. class: vue.normalizeClass(vue.unref(nsUpload).be("list", "item-status-label"))
  57453. }, [
  57454. _ctx.listType === "text" ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  57455. key: 0,
  57456. class: vue.normalizeClass([vue.unref(nsIcon).m("upload-success"), vue.unref(nsIcon).m("circle-check")])
  57457. }, {
  57458. default: vue.withCtx(() => [
  57459. vue.createVNode(vue.unref(circle_check_default))
  57460. ]),
  57461. _: 1
  57462. }, 8, ["class"])) : ["picture-card", "picture"].includes(_ctx.listType) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  57463. key: 1,
  57464. class: vue.normalizeClass([vue.unref(nsIcon).m("upload-success"), vue.unref(nsIcon).m("check")])
  57465. }, {
  57466. default: vue.withCtx(() => [
  57467. vue.createVNode(vue.unref(check_default))
  57468. ]),
  57469. _: 1
  57470. }, 8, ["class"])) : vue.createCommentVNode("v-if", true)
  57471. ], 2),
  57472. !vue.unref(disabled) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  57473. key: 2,
  57474. class: vue.normalizeClass(vue.unref(nsIcon).m("close")),
  57475. onClick: ($event) => handleRemove(file)
  57476. }, {
  57477. default: vue.withCtx(() => [
  57478. vue.createVNode(vue.unref(close_default))
  57479. ]),
  57480. _: 2
  57481. }, 1032, ["class", "onClick"])) : vue.createCommentVNode("v-if", true),
  57482. 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"),
  57483. vue.createCommentVNode(" This is a bug which needs to be fixed "),
  57484. vue.createCommentVNode(" TODO: Fix the incorrect navigation interaction "),
  57485. !vue.unref(disabled) ? (vue.openBlock(), vue.createElementBlock("i", {
  57486. key: 3,
  57487. class: vue.normalizeClass(vue.unref(nsIcon).m("close-tip"))
  57488. }, vue.toDisplayString(vue.unref(t)("el.upload.deleteTip")), 3)) : vue.createCommentVNode("v-if", true),
  57489. _ctx.listType === "picture-card" ? (vue.openBlock(), vue.createElementBlock("span", {
  57490. key: 4,
  57491. class: vue.normalizeClass(vue.unref(nsUpload).be("list", "item-actions"))
  57492. }, [
  57493. vue.createElementVNode("span", {
  57494. class: vue.normalizeClass(vue.unref(nsUpload).be("list", "item-preview")),
  57495. onClick: ($event) => _ctx.handlePreview(file)
  57496. }, [
  57497. vue.createVNode(vue.unref(ElIcon), {
  57498. class: vue.normalizeClass(vue.unref(nsIcon).m("zoom-in"))
  57499. }, {
  57500. default: vue.withCtx(() => [
  57501. vue.createVNode(vue.unref(zoom_in_default))
  57502. ]),
  57503. _: 1
  57504. }, 8, ["class"])
  57505. ], 10, ["onClick"]),
  57506. !vue.unref(disabled) ? (vue.openBlock(), vue.createElementBlock("span", {
  57507. key: 0,
  57508. class: vue.normalizeClass(vue.unref(nsUpload).be("list", "item-delete")),
  57509. onClick: ($event) => handleRemove(file)
  57510. }, [
  57511. vue.createVNode(vue.unref(ElIcon), {
  57512. class: vue.normalizeClass(vue.unref(nsIcon).m("delete"))
  57513. }, {
  57514. default: vue.withCtx(() => [
  57515. vue.createVNode(vue.unref(delete_default))
  57516. ]),
  57517. _: 1
  57518. }, 8, ["class"])
  57519. ], 10, ["onClick"])) : vue.createCommentVNode("v-if", true)
  57520. ], 2)) : vue.createCommentVNode("v-if", true)
  57521. ])
  57522. ], 42, ["tabindex", "aria-disabled", "onKeydown", "onFocus", "onBlur", "onClick"]);
  57523. }), 128)),
  57524. vue.renderSlot(_ctx.$slots, "append")
  57525. ]),
  57526. _: 3
  57527. }, 8, ["class", "name"]);
  57528. };
  57529. }
  57530. });
  57531. var UploadList = /* @__PURE__ */ _export_sfc(_sfc_main$j, [["__file", "upload-list.vue"]]);
  57532. const uploadDraggerProps = buildProps({
  57533. disabled: Boolean
  57534. });
  57535. const uploadDraggerEmits = {
  57536. file: (file) => isArray$1(file)
  57537. };
  57538. const COMPONENT_NAME$1 = "ElUploadDrag";
  57539. const __default__$h = vue.defineComponent({
  57540. name: COMPONENT_NAME$1
  57541. });
  57542. const _sfc_main$i = /* @__PURE__ */ vue.defineComponent({
  57543. ...__default__$h,
  57544. props: uploadDraggerProps,
  57545. emits: uploadDraggerEmits,
  57546. setup(__props, { emit }) {
  57547. const uploaderContext = vue.inject(uploadContextKey);
  57548. if (!uploaderContext) {
  57549. throwError(COMPONENT_NAME$1, "usage: <el-upload><el-upload-dragger /></el-upload>");
  57550. }
  57551. const ns = useNamespace("upload");
  57552. const dragover = vue.ref(false);
  57553. const disabled = useFormDisabled();
  57554. const onDrop = (e) => {
  57555. if (disabled.value)
  57556. return;
  57557. dragover.value = false;
  57558. e.stopPropagation();
  57559. const files = Array.from(e.dataTransfer.files);
  57560. const items = e.dataTransfer.items || [];
  57561. files.forEach((file, index) => {
  57562. var _a;
  57563. const item = items[index];
  57564. const entry = (_a = item == null ? void 0 : item.webkitGetAsEntry) == null ? void 0 : _a.call(item);
  57565. if (entry) {
  57566. file.isDirectory = entry.isDirectory;
  57567. }
  57568. });
  57569. emit("file", files);
  57570. };
  57571. const onDragover = () => {
  57572. if (!disabled.value)
  57573. dragover.value = true;
  57574. };
  57575. const onDragleave = (e) => {
  57576. if (!e.currentTarget.contains(e.relatedTarget))
  57577. dragover.value = false;
  57578. };
  57579. return (_ctx, _cache) => {
  57580. return vue.openBlock(), vue.createElementBlock("div", {
  57581. class: vue.normalizeClass([vue.unref(ns).b("dragger"), vue.unref(ns).is("dragover", dragover.value)]),
  57582. onDrop: vue.withModifiers(onDrop, ["prevent"]),
  57583. onDragover: vue.withModifiers(onDragover, ["prevent"]),
  57584. onDragleave: vue.withModifiers(onDragleave, ["prevent"])
  57585. }, [
  57586. vue.renderSlot(_ctx.$slots, "default")
  57587. ], 42, ["onDrop", "onDragover", "onDragleave"]);
  57588. };
  57589. }
  57590. });
  57591. var UploadDragger = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["__file", "upload-dragger.vue"]]);
  57592. const uploadContentProps = buildProps({
  57593. ...uploadBaseProps,
  57594. beforeUpload: {
  57595. type: definePropType(Function),
  57596. default: NOOP
  57597. },
  57598. onRemove: {
  57599. type: definePropType(Function),
  57600. default: NOOP
  57601. },
  57602. onStart: {
  57603. type: definePropType(Function),
  57604. default: NOOP
  57605. },
  57606. onSuccess: {
  57607. type: definePropType(Function),
  57608. default: NOOP
  57609. },
  57610. onProgress: {
  57611. type: definePropType(Function),
  57612. default: NOOP
  57613. },
  57614. onError: {
  57615. type: definePropType(Function),
  57616. default: NOOP
  57617. },
  57618. onExceed: {
  57619. type: definePropType(Function),
  57620. default: NOOP
  57621. }
  57622. });
  57623. const __default__$g = vue.defineComponent({
  57624. name: "ElUploadContent",
  57625. inheritAttrs: false
  57626. });
  57627. const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
  57628. ...__default__$g,
  57629. props: uploadContentProps,
  57630. setup(__props, { expose }) {
  57631. const props = __props;
  57632. const ns = useNamespace("upload");
  57633. const disabled = useFormDisabled();
  57634. const requests = vue.shallowRef({});
  57635. const inputRef = vue.shallowRef();
  57636. const uploadFiles = (files) => {
  57637. if (files.length === 0)
  57638. return;
  57639. const { autoUpload, limit, fileList, multiple, onStart, onExceed } = props;
  57640. if (limit && fileList.length + files.length > limit) {
  57641. onExceed(files, fileList);
  57642. return;
  57643. }
  57644. if (!multiple) {
  57645. files = files.slice(0, 1);
  57646. }
  57647. for (const file of files) {
  57648. const rawFile = file;
  57649. rawFile.uid = genFileId();
  57650. onStart(rawFile);
  57651. if (autoUpload)
  57652. upload(rawFile);
  57653. }
  57654. };
  57655. const upload = async (rawFile) => {
  57656. inputRef.value.value = "";
  57657. if (!props.beforeUpload) {
  57658. return doUpload(rawFile);
  57659. }
  57660. let hookResult;
  57661. let beforeData = {};
  57662. try {
  57663. const originData = props.data;
  57664. const beforeUploadPromise = props.beforeUpload(rawFile);
  57665. beforeData = isPlainObject$1(props.data) ? cloneDeep(props.data) : props.data;
  57666. hookResult = await beforeUploadPromise;
  57667. if (isPlainObject$1(props.data) && isEqual$1(originData, beforeData)) {
  57668. beforeData = cloneDeep(props.data);
  57669. }
  57670. } catch (e) {
  57671. hookResult = false;
  57672. }
  57673. if (hookResult === false) {
  57674. props.onRemove(rawFile);
  57675. return;
  57676. }
  57677. let file = rawFile;
  57678. if (hookResult instanceof Blob) {
  57679. if (hookResult instanceof File) {
  57680. file = hookResult;
  57681. } else {
  57682. file = new File([hookResult], rawFile.name, {
  57683. type: rawFile.type
  57684. });
  57685. }
  57686. }
  57687. doUpload(Object.assign(file, {
  57688. uid: rawFile.uid
  57689. }), beforeData);
  57690. };
  57691. const resolveData = async (data, rawFile) => {
  57692. if (isFunction$1(data)) {
  57693. return data(rawFile);
  57694. }
  57695. return data;
  57696. };
  57697. const doUpload = async (rawFile, beforeData) => {
  57698. const {
  57699. headers,
  57700. data,
  57701. method,
  57702. withCredentials,
  57703. name: filename,
  57704. action,
  57705. onProgress,
  57706. onSuccess,
  57707. onError,
  57708. httpRequest
  57709. } = props;
  57710. try {
  57711. beforeData = await resolveData(beforeData != null ? beforeData : data, rawFile);
  57712. } catch (e) {
  57713. props.onRemove(rawFile);
  57714. return;
  57715. }
  57716. const { uid } = rawFile;
  57717. const options = {
  57718. headers: headers || {},
  57719. withCredentials,
  57720. file: rawFile,
  57721. data: beforeData,
  57722. method,
  57723. filename,
  57724. action,
  57725. onProgress: (evt) => {
  57726. onProgress(evt, rawFile);
  57727. },
  57728. onSuccess: (res) => {
  57729. onSuccess(res, rawFile);
  57730. delete requests.value[uid];
  57731. },
  57732. onError: (err) => {
  57733. onError(err, rawFile);
  57734. delete requests.value[uid];
  57735. }
  57736. };
  57737. const request = httpRequest(options);
  57738. requests.value[uid] = request;
  57739. if (request instanceof Promise) {
  57740. request.then(options.onSuccess, options.onError);
  57741. }
  57742. };
  57743. const handleChange = (e) => {
  57744. const files = e.target.files;
  57745. if (!files)
  57746. return;
  57747. uploadFiles(Array.from(files));
  57748. };
  57749. const handleClick = () => {
  57750. if (!disabled.value) {
  57751. inputRef.value.value = "";
  57752. inputRef.value.click();
  57753. }
  57754. };
  57755. const handleKeydown = () => {
  57756. handleClick();
  57757. };
  57758. const abort = (file) => {
  57759. const _reqs = entriesOf(requests.value).filter(file ? ([uid]) => String(file.uid) === uid : () => true);
  57760. _reqs.forEach(([uid, req]) => {
  57761. if (req instanceof XMLHttpRequest)
  57762. req.abort();
  57763. delete requests.value[uid];
  57764. });
  57765. };
  57766. expose({
  57767. abort,
  57768. upload
  57769. });
  57770. return (_ctx, _cache) => {
  57771. return vue.openBlock(), vue.createElementBlock("div", {
  57772. class: vue.normalizeClass([
  57773. vue.unref(ns).b(),
  57774. vue.unref(ns).m(_ctx.listType),
  57775. vue.unref(ns).is("drag", _ctx.drag),
  57776. vue.unref(ns).is("disabled", vue.unref(disabled))
  57777. ]),
  57778. tabindex: vue.unref(disabled) ? void 0 : 0,
  57779. "aria-disabled": vue.unref(disabled),
  57780. role: "button",
  57781. onClick: handleClick,
  57782. onKeydown: vue.withKeys(vue.withModifiers(handleKeydown, ["self"]), ["enter", "space"])
  57783. }, [
  57784. _ctx.drag ? (vue.openBlock(), vue.createBlock(UploadDragger, {
  57785. key: 0,
  57786. disabled: vue.unref(disabled),
  57787. onFile: uploadFiles
  57788. }, {
  57789. default: vue.withCtx(() => [
  57790. vue.renderSlot(_ctx.$slots, "default")
  57791. ]),
  57792. _: 3
  57793. }, 8, ["disabled"])) : vue.renderSlot(_ctx.$slots, "default", { key: 1 }),
  57794. vue.createElementVNode("input", {
  57795. ref_key: "inputRef",
  57796. ref: inputRef,
  57797. class: vue.normalizeClass(vue.unref(ns).e("input")),
  57798. name: _ctx.name,
  57799. disabled: vue.unref(disabled),
  57800. multiple: _ctx.multiple,
  57801. accept: _ctx.accept,
  57802. type: "file",
  57803. onChange: handleChange,
  57804. onClick: vue.withModifiers(() => {
  57805. }, ["stop"])
  57806. }, null, 42, ["name", "disabled", "multiple", "accept", "onClick"])
  57807. ], 42, ["tabindex", "aria-disabled", "onKeydown"]);
  57808. };
  57809. }
  57810. });
  57811. var UploadContent = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["__file", "upload-content.vue"]]);
  57812. const SCOPE$1 = "ElUpload";
  57813. const revokeFileObjectURL = (file) => {
  57814. var _a;
  57815. if ((_a = file.url) == null ? void 0 : _a.startsWith("blob:")) {
  57816. URL.revokeObjectURL(file.url);
  57817. }
  57818. };
  57819. const useHandlers = (props, uploadRef) => {
  57820. const uploadFiles = useVModel(props, "fileList", void 0, { passive: true });
  57821. const getFile = (rawFile) => uploadFiles.value.find((file) => file.uid === rawFile.uid);
  57822. function abort(file) {
  57823. var _a;
  57824. (_a = uploadRef.value) == null ? void 0 : _a.abort(file);
  57825. }
  57826. function clearFiles(states = ["ready", "uploading", "success", "fail"]) {
  57827. uploadFiles.value = uploadFiles.value.filter((row) => !states.includes(row.status));
  57828. }
  57829. function removeFile(file) {
  57830. uploadFiles.value = uploadFiles.value.filter((uploadFile) => uploadFile.uid !== file.uid);
  57831. }
  57832. const handleError = (err, rawFile) => {
  57833. const file = getFile(rawFile);
  57834. if (!file)
  57835. return;
  57836. console.error(err);
  57837. file.status = "fail";
  57838. removeFile(file);
  57839. props.onError(err, file, uploadFiles.value);
  57840. props.onChange(file, uploadFiles.value);
  57841. };
  57842. const handleProgress = (evt, rawFile) => {
  57843. const file = getFile(rawFile);
  57844. if (!file)
  57845. return;
  57846. props.onProgress(evt, file, uploadFiles.value);
  57847. file.status = "uploading";
  57848. file.percentage = Math.round(evt.percent);
  57849. };
  57850. const handleSuccess = (response, rawFile) => {
  57851. const file = getFile(rawFile);
  57852. if (!file)
  57853. return;
  57854. file.status = "success";
  57855. file.response = response;
  57856. props.onSuccess(response, file, uploadFiles.value);
  57857. props.onChange(file, uploadFiles.value);
  57858. };
  57859. const handleStart = (file) => {
  57860. if (isNil(file.uid))
  57861. file.uid = genFileId();
  57862. const uploadFile = {
  57863. name: file.name,
  57864. percentage: 0,
  57865. status: "ready",
  57866. size: file.size,
  57867. raw: file,
  57868. uid: file.uid
  57869. };
  57870. if (props.listType === "picture-card" || props.listType === "picture") {
  57871. try {
  57872. uploadFile.url = URL.createObjectURL(file);
  57873. } catch (err) {
  57874. debugWarn(SCOPE$1, err.message);
  57875. props.onError(err, uploadFile, uploadFiles.value);
  57876. }
  57877. }
  57878. uploadFiles.value = [...uploadFiles.value, uploadFile];
  57879. props.onChange(uploadFile, uploadFiles.value);
  57880. };
  57881. const handleRemove = async (file) => {
  57882. const uploadFile = file instanceof File ? getFile(file) : file;
  57883. if (!uploadFile)
  57884. throwError(SCOPE$1, "file to be removed not found");
  57885. const doRemove = (file2) => {
  57886. abort(file2);
  57887. removeFile(file2);
  57888. props.onRemove(file2, uploadFiles.value);
  57889. revokeFileObjectURL(file2);
  57890. };
  57891. if (props.beforeRemove) {
  57892. const before = await props.beforeRemove(uploadFile, uploadFiles.value);
  57893. if (before !== false)
  57894. doRemove(uploadFile);
  57895. } else {
  57896. doRemove(uploadFile);
  57897. }
  57898. };
  57899. function submit() {
  57900. uploadFiles.value.filter(({ status }) => status === "ready").forEach(({ raw }) => {
  57901. var _a;
  57902. return raw && ((_a = uploadRef.value) == null ? void 0 : _a.upload(raw));
  57903. });
  57904. }
  57905. vue.watch(() => props.listType, (val) => {
  57906. if (val !== "picture-card" && val !== "picture") {
  57907. return;
  57908. }
  57909. uploadFiles.value = uploadFiles.value.map((file) => {
  57910. const { raw, url } = file;
  57911. if (!url && raw) {
  57912. try {
  57913. file.url = URL.createObjectURL(raw);
  57914. } catch (err) {
  57915. props.onError(err, file, uploadFiles.value);
  57916. }
  57917. }
  57918. return file;
  57919. });
  57920. });
  57921. vue.watch(uploadFiles, (files) => {
  57922. for (const file of files) {
  57923. file.uid || (file.uid = genFileId());
  57924. file.status || (file.status = "success");
  57925. }
  57926. }, { immediate: true, deep: true });
  57927. return {
  57928. uploadFiles,
  57929. abort,
  57930. clearFiles,
  57931. handleError,
  57932. handleProgress,
  57933. handleStart,
  57934. handleSuccess,
  57935. handleRemove,
  57936. submit,
  57937. revokeFileObjectURL
  57938. };
  57939. };
  57940. const __default__$f = vue.defineComponent({
  57941. name: "ElUpload"
  57942. });
  57943. const _sfc_main$g = /* @__PURE__ */ vue.defineComponent({
  57944. ...__default__$f,
  57945. props: uploadProps,
  57946. setup(__props, { expose }) {
  57947. const props = __props;
  57948. const disabled = useFormDisabled();
  57949. const uploadRef = vue.shallowRef();
  57950. const {
  57951. abort,
  57952. submit,
  57953. clearFiles,
  57954. uploadFiles,
  57955. handleStart,
  57956. handleError,
  57957. handleRemove,
  57958. handleSuccess,
  57959. handleProgress,
  57960. revokeFileObjectURL
  57961. } = useHandlers(props, uploadRef);
  57962. const isPictureCard = vue.computed(() => props.listType === "picture-card");
  57963. const uploadContentProps = vue.computed(() => ({
  57964. ...props,
  57965. fileList: uploadFiles.value,
  57966. onStart: handleStart,
  57967. onProgress: handleProgress,
  57968. onSuccess: handleSuccess,
  57969. onError: handleError,
  57970. onRemove: handleRemove
  57971. }));
  57972. vue.onBeforeUnmount(() => {
  57973. uploadFiles.value.forEach(revokeFileObjectURL);
  57974. });
  57975. vue.provide(uploadContextKey, {
  57976. accept: vue.toRef(props, "accept")
  57977. });
  57978. expose({
  57979. abort,
  57980. submit,
  57981. clearFiles,
  57982. handleStart,
  57983. handleRemove
  57984. });
  57985. return (_ctx, _cache) => {
  57986. return vue.openBlock(), vue.createElementBlock("div", null, [
  57987. vue.unref(isPictureCard) && _ctx.showFileList ? (vue.openBlock(), vue.createBlock(UploadList, {
  57988. key: 0,
  57989. disabled: vue.unref(disabled),
  57990. "list-type": _ctx.listType,
  57991. files: vue.unref(uploadFiles),
  57992. crossorigin: _ctx.crossorigin,
  57993. "handle-preview": _ctx.onPreview,
  57994. onRemove: vue.unref(handleRemove)
  57995. }, vue.createSlots({
  57996. append: vue.withCtx(() => [
  57997. vue.createVNode(UploadContent, vue.mergeProps({
  57998. ref_key: "uploadRef",
  57999. ref: uploadRef
  58000. }, vue.unref(uploadContentProps)), {
  58001. default: vue.withCtx(() => [
  58002. _ctx.$slots.trigger ? vue.renderSlot(_ctx.$slots, "trigger", { key: 0 }) : vue.createCommentVNode("v-if", true),
  58003. !_ctx.$slots.trigger && _ctx.$slots.default ? vue.renderSlot(_ctx.$slots, "default", { key: 1 }) : vue.createCommentVNode("v-if", true)
  58004. ]),
  58005. _: 3
  58006. }, 16)
  58007. ]),
  58008. _: 2
  58009. }, [
  58010. _ctx.$slots.file ? {
  58011. name: "default",
  58012. fn: vue.withCtx(({ file, index }) => [
  58013. vue.renderSlot(_ctx.$slots, "file", {
  58014. file,
  58015. index
  58016. })
  58017. ])
  58018. } : void 0
  58019. ]), 1032, ["disabled", "list-type", "files", "crossorigin", "handle-preview", "onRemove"])) : vue.createCommentVNode("v-if", true),
  58020. !vue.unref(isPictureCard) || vue.unref(isPictureCard) && !_ctx.showFileList ? (vue.openBlock(), vue.createBlock(UploadContent, vue.mergeProps({
  58021. key: 1,
  58022. ref_key: "uploadRef",
  58023. ref: uploadRef
  58024. }, vue.unref(uploadContentProps)), {
  58025. default: vue.withCtx(() => [
  58026. _ctx.$slots.trigger ? vue.renderSlot(_ctx.$slots, "trigger", { key: 0 }) : vue.createCommentVNode("v-if", true),
  58027. !_ctx.$slots.trigger && _ctx.$slots.default ? vue.renderSlot(_ctx.$slots, "default", { key: 1 }) : vue.createCommentVNode("v-if", true)
  58028. ]),
  58029. _: 3
  58030. }, 16)) : vue.createCommentVNode("v-if", true),
  58031. _ctx.$slots.trigger ? vue.renderSlot(_ctx.$slots, "default", { key: 2 }) : vue.createCommentVNode("v-if", true),
  58032. vue.renderSlot(_ctx.$slots, "tip"),
  58033. !vue.unref(isPictureCard) && _ctx.showFileList ? (vue.openBlock(), vue.createBlock(UploadList, {
  58034. key: 3,
  58035. disabled: vue.unref(disabled),
  58036. "list-type": _ctx.listType,
  58037. files: vue.unref(uploadFiles),
  58038. crossorigin: _ctx.crossorigin,
  58039. "handle-preview": _ctx.onPreview,
  58040. onRemove: vue.unref(handleRemove)
  58041. }, vue.createSlots({
  58042. _: 2
  58043. }, [
  58044. _ctx.$slots.file ? {
  58045. name: "default",
  58046. fn: vue.withCtx(({ file, index }) => [
  58047. vue.renderSlot(_ctx.$slots, "file", {
  58048. file,
  58049. index
  58050. })
  58051. ])
  58052. } : void 0
  58053. ]), 1032, ["disabled", "list-type", "files", "crossorigin", "handle-preview", "onRemove"])) : vue.createCommentVNode("v-if", true)
  58054. ]);
  58055. };
  58056. }
  58057. });
  58058. var Upload = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["__file", "upload.vue"]]);
  58059. const ElUpload = withInstall(Upload);
  58060. const watermarkProps = buildProps({
  58061. zIndex: {
  58062. type: Number,
  58063. default: 9
  58064. },
  58065. rotate: {
  58066. type: Number,
  58067. default: -22
  58068. },
  58069. width: Number,
  58070. height: Number,
  58071. image: String,
  58072. content: {
  58073. type: definePropType([String, Array]),
  58074. default: "Element Plus"
  58075. },
  58076. font: {
  58077. type: definePropType(Object)
  58078. },
  58079. gap: {
  58080. type: definePropType(Array),
  58081. default: () => [100, 100]
  58082. },
  58083. offset: {
  58084. type: definePropType(Array)
  58085. }
  58086. });
  58087. function toLowercaseSeparator(key) {
  58088. return key.replace(/([A-Z])/g, "-$1").toLowerCase();
  58089. }
  58090. function getStyleStr(style) {
  58091. return Object.keys(style).map((key) => `${toLowercaseSeparator(key)}: ${style[key]};`).join(" ");
  58092. }
  58093. function getPixelRatio() {
  58094. return window.devicePixelRatio || 1;
  58095. }
  58096. const reRendering = (mutation, watermarkElement) => {
  58097. let flag = false;
  58098. if (mutation.removedNodes.length && watermarkElement) {
  58099. flag = Array.from(mutation.removedNodes).includes(watermarkElement);
  58100. }
  58101. if (mutation.type === "attributes" && mutation.target === watermarkElement) {
  58102. flag = true;
  58103. }
  58104. return flag;
  58105. };
  58106. const TEXT_ALIGN_RATIO_MAP = {
  58107. left: [0, 0.5],
  58108. start: [0, 0.5],
  58109. center: [0.5, 0],
  58110. right: [1, -0.5],
  58111. end: [1, -0.5]
  58112. };
  58113. function prepareCanvas(width, height, ratio = 1) {
  58114. const canvas = document.createElement("canvas");
  58115. const ctx = canvas.getContext("2d");
  58116. const realWidth = width * ratio;
  58117. const realHeight = height * ratio;
  58118. canvas.setAttribute("width", `${realWidth}px`);
  58119. canvas.setAttribute("height", `${realHeight}px`);
  58120. ctx.save();
  58121. return [ctx, canvas, realWidth, realHeight];
  58122. }
  58123. function useClips() {
  58124. function getClips(content, rotate, ratio, width, height, font, gapX, gapY, space) {
  58125. const [ctx, canvas, contentWidth, contentHeight] = prepareCanvas(width, height, ratio);
  58126. if (content instanceof HTMLImageElement) {
  58127. ctx.drawImage(content, 0, 0, contentWidth, contentHeight);
  58128. } else {
  58129. const {
  58130. color,
  58131. fontSize,
  58132. fontStyle,
  58133. fontWeight,
  58134. fontFamily,
  58135. textAlign,
  58136. textBaseline
  58137. } = font;
  58138. const mergedFontSize = Number(fontSize) * ratio;
  58139. ctx.font = `${fontStyle} normal ${fontWeight} ${mergedFontSize}px/${height}px ${fontFamily}`;
  58140. ctx.fillStyle = color;
  58141. ctx.textAlign = textAlign;
  58142. ctx.textBaseline = textBaseline;
  58143. const contents = isArray$1(content) ? content : [content];
  58144. contents == null ? void 0 : contents.forEach((item, index) => {
  58145. const [alignRatio, spaceRatio] = TEXT_ALIGN_RATIO_MAP[textAlign];
  58146. ctx.fillText(item != null ? item : "", contentWidth * alignRatio + space * spaceRatio, index * (mergedFontSize + font.fontGap * ratio));
  58147. });
  58148. }
  58149. const angle = Math.PI / 180 * Number(rotate);
  58150. const maxSize = Math.max(width, height);
  58151. const [rCtx, rCanvas, realMaxSize] = prepareCanvas(maxSize, maxSize, ratio);
  58152. rCtx.translate(realMaxSize / 2, realMaxSize / 2);
  58153. rCtx.rotate(angle);
  58154. if (contentWidth > 0 && contentHeight > 0) {
  58155. rCtx.drawImage(canvas, -contentWidth / 2, -contentHeight / 2);
  58156. }
  58157. function getRotatePos(x, y) {
  58158. const targetX = x * Math.cos(angle) - y * Math.sin(angle);
  58159. const targetY = x * Math.sin(angle) + y * Math.cos(angle);
  58160. return [targetX, targetY];
  58161. }
  58162. let left = 0;
  58163. let right = 0;
  58164. let top = 0;
  58165. let bottom = 0;
  58166. const halfWidth = contentWidth / 2;
  58167. const halfHeight = contentHeight / 2;
  58168. const points = [
  58169. [0 - halfWidth, 0 - halfHeight],
  58170. [0 + halfWidth, 0 - halfHeight],
  58171. [0 + halfWidth, 0 + halfHeight],
  58172. [0 - halfWidth, 0 + halfHeight]
  58173. ];
  58174. points.forEach(([x, y]) => {
  58175. const [targetX, targetY] = getRotatePos(x, y);
  58176. left = Math.min(left, targetX);
  58177. right = Math.max(right, targetX);
  58178. top = Math.min(top, targetY);
  58179. bottom = Math.max(bottom, targetY);
  58180. });
  58181. const cutLeft = left + realMaxSize / 2;
  58182. const cutTop = top + realMaxSize / 2;
  58183. const cutWidth = right - left;
  58184. const cutHeight = bottom - top;
  58185. const realGapX = gapX * ratio;
  58186. const realGapY = gapY * ratio;
  58187. const filledWidth = (cutWidth + realGapX) * 2;
  58188. const filledHeight = cutHeight + realGapY;
  58189. const [fCtx, fCanvas] = prepareCanvas(filledWidth, filledHeight);
  58190. function drawImg(targetX = 0, targetY = 0) {
  58191. fCtx.drawImage(rCanvas, cutLeft, cutTop, cutWidth, cutHeight, targetX, targetY, cutWidth, cutHeight);
  58192. }
  58193. drawImg();
  58194. drawImg(cutWidth + realGapX, -cutHeight / 2 - realGapY / 2);
  58195. drawImg(cutWidth + realGapX, +cutHeight / 2 + realGapY / 2);
  58196. return [fCanvas.toDataURL(), filledWidth / ratio, filledHeight / ratio];
  58197. }
  58198. return getClips;
  58199. }
  58200. const __default__$e = vue.defineComponent({
  58201. name: "ElWatermark"
  58202. });
  58203. const _sfc_main$f = /* @__PURE__ */ vue.defineComponent({
  58204. ...__default__$e,
  58205. props: watermarkProps,
  58206. setup(__props) {
  58207. const props = __props;
  58208. const style = {
  58209. position: "relative"
  58210. };
  58211. const fontGap = vue.computed(() => {
  58212. var _a, _b;
  58213. return (_b = (_a = props.font) == null ? void 0 : _a.fontGap) != null ? _b : 3;
  58214. });
  58215. const color = vue.computed(() => {
  58216. var _a, _b;
  58217. return (_b = (_a = props.font) == null ? void 0 : _a.color) != null ? _b : "rgba(0,0,0,.15)";
  58218. });
  58219. const fontSize = vue.computed(() => {
  58220. var _a, _b;
  58221. return (_b = (_a = props.font) == null ? void 0 : _a.fontSize) != null ? _b : 16;
  58222. });
  58223. const fontWeight = vue.computed(() => {
  58224. var _a, _b;
  58225. return (_b = (_a = props.font) == null ? void 0 : _a.fontWeight) != null ? _b : "normal";
  58226. });
  58227. const fontStyle = vue.computed(() => {
  58228. var _a, _b;
  58229. return (_b = (_a = props.font) == null ? void 0 : _a.fontStyle) != null ? _b : "normal";
  58230. });
  58231. const fontFamily = vue.computed(() => {
  58232. var _a, _b;
  58233. return (_b = (_a = props.font) == null ? void 0 : _a.fontFamily) != null ? _b : "sans-serif";
  58234. });
  58235. const textAlign = vue.computed(() => {
  58236. var _a, _b;
  58237. return (_b = (_a = props.font) == null ? void 0 : _a.textAlign) != null ? _b : "center";
  58238. });
  58239. const textBaseline = vue.computed(() => {
  58240. var _a, _b;
  58241. return (_b = (_a = props.font) == null ? void 0 : _a.textBaseline) != null ? _b : "hanging";
  58242. });
  58243. const gapX = vue.computed(() => props.gap[0]);
  58244. const gapY = vue.computed(() => props.gap[1]);
  58245. const gapXCenter = vue.computed(() => gapX.value / 2);
  58246. const gapYCenter = vue.computed(() => gapY.value / 2);
  58247. const offsetLeft = vue.computed(() => {
  58248. var _a, _b;
  58249. return (_b = (_a = props.offset) == null ? void 0 : _a[0]) != null ? _b : gapXCenter.value;
  58250. });
  58251. const offsetTop = vue.computed(() => {
  58252. var _a, _b;
  58253. return (_b = (_a = props.offset) == null ? void 0 : _a[1]) != null ? _b : gapYCenter.value;
  58254. });
  58255. const getMarkStyle = () => {
  58256. const markStyle = {
  58257. zIndex: props.zIndex,
  58258. position: "absolute",
  58259. left: 0,
  58260. top: 0,
  58261. width: "100%",
  58262. height: "100%",
  58263. pointerEvents: "none",
  58264. backgroundRepeat: "repeat"
  58265. };
  58266. let positionLeft = offsetLeft.value - gapXCenter.value;
  58267. let positionTop = offsetTop.value - gapYCenter.value;
  58268. if (positionLeft > 0) {
  58269. markStyle.left = `${positionLeft}px`;
  58270. markStyle.width = `calc(100% - ${positionLeft}px)`;
  58271. positionLeft = 0;
  58272. }
  58273. if (positionTop > 0) {
  58274. markStyle.top = `${positionTop}px`;
  58275. markStyle.height = `calc(100% - ${positionTop}px)`;
  58276. positionTop = 0;
  58277. }
  58278. markStyle.backgroundPosition = `${positionLeft}px ${positionTop}px`;
  58279. return markStyle;
  58280. };
  58281. const containerRef = vue.shallowRef(null);
  58282. const watermarkRef = vue.shallowRef();
  58283. const stopObservation = vue.ref(false);
  58284. const destroyWatermark = () => {
  58285. if (watermarkRef.value) {
  58286. watermarkRef.value.remove();
  58287. watermarkRef.value = void 0;
  58288. }
  58289. };
  58290. const appendWatermark = (base64Url, markWidth) => {
  58291. var _a;
  58292. if (containerRef.value && watermarkRef.value) {
  58293. stopObservation.value = true;
  58294. watermarkRef.value.setAttribute("style", getStyleStr({
  58295. ...getMarkStyle(),
  58296. backgroundImage: `url('${base64Url}')`,
  58297. backgroundSize: `${Math.floor(markWidth)}px`
  58298. }));
  58299. (_a = containerRef.value) == null ? void 0 : _a.append(watermarkRef.value);
  58300. setTimeout(() => {
  58301. stopObservation.value = false;
  58302. });
  58303. }
  58304. };
  58305. const getMarkSize = (ctx) => {
  58306. let defaultWidth = 120;
  58307. let defaultHeight = 64;
  58308. let space = 0;
  58309. const { image, content, width, height, rotate } = props;
  58310. if (!image && ctx.measureText) {
  58311. ctx.font = `${Number(fontSize.value)}px ${fontFamily.value}`;
  58312. const contents = isArray$1(content) ? content : [content];
  58313. let maxWidth = 0;
  58314. let maxHeight = 0;
  58315. contents.forEach((item) => {
  58316. const {
  58317. width: width2,
  58318. fontBoundingBoxAscent,
  58319. fontBoundingBoxDescent,
  58320. actualBoundingBoxAscent,
  58321. actualBoundingBoxDescent
  58322. } = ctx.measureText(item);
  58323. const height2 = isUndefined(fontBoundingBoxAscent) ? actualBoundingBoxAscent + actualBoundingBoxDescent : fontBoundingBoxAscent + fontBoundingBoxDescent;
  58324. if (width2 > maxWidth)
  58325. maxWidth = Math.ceil(width2);
  58326. if (height2 > maxHeight)
  58327. maxHeight = Math.ceil(height2);
  58328. });
  58329. defaultWidth = maxWidth;
  58330. defaultHeight = maxHeight * contents.length + (contents.length - 1) * fontGap.value;
  58331. const angle = Math.PI / 180 * Number(rotate);
  58332. space = Math.ceil(Math.abs(Math.sin(angle) * defaultHeight) / 2);
  58333. defaultWidth += space;
  58334. }
  58335. return [width != null ? width : defaultWidth, height != null ? height : defaultHeight, space];
  58336. };
  58337. const getClips = useClips();
  58338. const renderWatermark = () => {
  58339. const canvas = document.createElement("canvas");
  58340. const ctx = canvas.getContext("2d");
  58341. const image = props.image;
  58342. const content = props.content;
  58343. const rotate = props.rotate;
  58344. if (ctx) {
  58345. if (!watermarkRef.value) {
  58346. watermarkRef.value = document.createElement("div");
  58347. }
  58348. const ratio = getPixelRatio();
  58349. const [markWidth, markHeight, space] = getMarkSize(ctx);
  58350. const drawCanvas = (drawContent) => {
  58351. const [textClips, clipWidth] = getClips(drawContent || "", rotate, ratio, markWidth, markHeight, {
  58352. color: color.value,
  58353. fontSize: fontSize.value,
  58354. fontStyle: fontStyle.value,
  58355. fontWeight: fontWeight.value,
  58356. fontFamily: fontFamily.value,
  58357. fontGap: fontGap.value,
  58358. textAlign: textAlign.value,
  58359. textBaseline: textBaseline.value
  58360. }, gapX.value, gapY.value, space);
  58361. appendWatermark(textClips, clipWidth);
  58362. };
  58363. if (image) {
  58364. const img = new Image();
  58365. img.onload = () => {
  58366. drawCanvas(img);
  58367. };
  58368. img.onerror = () => {
  58369. drawCanvas(content);
  58370. };
  58371. img.crossOrigin = "anonymous";
  58372. img.referrerPolicy = "no-referrer";
  58373. img.src = image;
  58374. } else {
  58375. drawCanvas(content);
  58376. }
  58377. }
  58378. };
  58379. vue.onMounted(() => {
  58380. renderWatermark();
  58381. });
  58382. vue.watch(() => props, () => {
  58383. renderWatermark();
  58384. }, {
  58385. deep: true,
  58386. flush: "post"
  58387. });
  58388. vue.onBeforeUnmount(() => {
  58389. destroyWatermark();
  58390. });
  58391. const onMutate = (mutations) => {
  58392. if (stopObservation.value) {
  58393. return;
  58394. }
  58395. mutations.forEach((mutation) => {
  58396. if (reRendering(mutation, watermarkRef.value)) {
  58397. destroyWatermark();
  58398. renderWatermark();
  58399. }
  58400. });
  58401. };
  58402. useMutationObserver(containerRef, onMutate, {
  58403. attributes: true,
  58404. subtree: true,
  58405. childList: true
  58406. });
  58407. return (_ctx, _cache) => {
  58408. return vue.openBlock(), vue.createElementBlock("div", {
  58409. ref_key: "containerRef",
  58410. ref: containerRef,
  58411. style: vue.normalizeStyle([style])
  58412. }, [
  58413. vue.renderSlot(_ctx.$slots, "default")
  58414. ], 4);
  58415. };
  58416. }
  58417. });
  58418. var Watermark = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__file", "watermark.vue"]]);
  58419. const ElWatermark = withInstall(Watermark);
  58420. const maskProps = buildProps({
  58421. zIndex: {
  58422. type: Number,
  58423. default: 1001
  58424. },
  58425. visible: Boolean,
  58426. fill: {
  58427. type: String,
  58428. default: "rgba(0,0,0,0.5)"
  58429. },
  58430. pos: {
  58431. type: definePropType(Object)
  58432. },
  58433. targetAreaClickable: {
  58434. type: Boolean,
  58435. default: true
  58436. }
  58437. });
  58438. function getSide(placement) {
  58439. return placement.split('-')[0];
  58440. }
  58441. function getAlignment(placement) {
  58442. return placement.split('-')[1];
  58443. }
  58444. function getMainAxisFromPlacement(placement) {
  58445. return ['top', 'bottom'].includes(getSide(placement)) ? 'x' : 'y';
  58446. }
  58447. function getLengthFromAxis(axis) {
  58448. return axis === 'y' ? 'height' : 'width';
  58449. }
  58450. function computeCoordsFromPlacement(_ref, placement, rtl) {
  58451. let {
  58452. reference,
  58453. floating
  58454. } = _ref;
  58455. const commonX = reference.x + reference.width / 2 - floating.width / 2;
  58456. const commonY = reference.y + reference.height / 2 - floating.height / 2;
  58457. const mainAxis = getMainAxisFromPlacement(placement);
  58458. const length = getLengthFromAxis(mainAxis);
  58459. const commonAlign = reference[length] / 2 - floating[length] / 2;
  58460. const side = getSide(placement);
  58461. const isVertical = mainAxis === 'x';
  58462. let coords;
  58463. switch (side) {
  58464. case 'top':
  58465. coords = {
  58466. x: commonX,
  58467. y: reference.y - floating.height
  58468. };
  58469. break;
  58470. case 'bottom':
  58471. coords = {
  58472. x: commonX,
  58473. y: reference.y + reference.height
  58474. };
  58475. break;
  58476. case 'right':
  58477. coords = {
  58478. x: reference.x + reference.width,
  58479. y: commonY
  58480. };
  58481. break;
  58482. case 'left':
  58483. coords = {
  58484. x: reference.x - floating.width,
  58485. y: commonY
  58486. };
  58487. break;
  58488. default:
  58489. coords = {
  58490. x: reference.x,
  58491. y: reference.y
  58492. };
  58493. }
  58494. switch (getAlignment(placement)) {
  58495. case 'start':
  58496. coords[mainAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
  58497. break;
  58498. case 'end':
  58499. coords[mainAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
  58500. break;
  58501. }
  58502. return coords;
  58503. }
  58504. /**
  58505. * Computes the `x` and `y` coordinates that will place the floating element
  58506. * next to a reference element when it is given a certain positioning strategy.
  58507. *
  58508. * This export does not have any `platform` interface logic. You will need to
  58509. * write one for the platform you are using Floating UI with.
  58510. */
  58511. const computePosition$1 = async (reference, floating, config) => {
  58512. const {
  58513. placement = 'bottom',
  58514. strategy = 'absolute',
  58515. middleware = [],
  58516. platform
  58517. } = config;
  58518. const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
  58519. let rects = await platform.getElementRects({
  58520. reference,
  58521. floating,
  58522. strategy
  58523. });
  58524. let {
  58525. x,
  58526. y
  58527. } = computeCoordsFromPlacement(rects, placement, rtl);
  58528. let statefulPlacement = placement;
  58529. let middlewareData = {};
  58530. let resetCount = 0;
  58531. for (let i = 0; i < middleware.length; i++) {
  58532. const {
  58533. name,
  58534. fn
  58535. } = middleware[i];
  58536. const {
  58537. x: nextX,
  58538. y: nextY,
  58539. data,
  58540. reset
  58541. } = await fn({
  58542. x,
  58543. y,
  58544. initialPlacement: placement,
  58545. placement: statefulPlacement,
  58546. strategy,
  58547. middlewareData,
  58548. rects,
  58549. platform,
  58550. elements: {
  58551. reference,
  58552. floating
  58553. }
  58554. });
  58555. x = nextX != null ? nextX : x;
  58556. y = nextY != null ? nextY : y;
  58557. middlewareData = { ...middlewareData,
  58558. [name]: { ...middlewareData[name],
  58559. ...data
  58560. }
  58561. };
  58562. if (reset && resetCount <= 50) {
  58563. resetCount++;
  58564. if (typeof reset === 'object') {
  58565. if (reset.placement) {
  58566. statefulPlacement = reset.placement;
  58567. }
  58568. if (reset.rects) {
  58569. rects = reset.rects === true ? await platform.getElementRects({
  58570. reference,
  58571. floating,
  58572. strategy
  58573. }) : reset.rects;
  58574. }
  58575. ({
  58576. x,
  58577. y
  58578. } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
  58579. }
  58580. i = -1;
  58581. continue;
  58582. }
  58583. }
  58584. return {
  58585. x,
  58586. y,
  58587. placement: statefulPlacement,
  58588. strategy,
  58589. middlewareData
  58590. };
  58591. };
  58592. function expandPaddingObject(padding) {
  58593. return {
  58594. top: 0,
  58595. right: 0,
  58596. bottom: 0,
  58597. left: 0,
  58598. ...padding
  58599. };
  58600. }
  58601. function getSideObjectFromPadding(padding) {
  58602. return typeof padding !== 'number' ? expandPaddingObject(padding) : {
  58603. top: padding,
  58604. right: padding,
  58605. bottom: padding,
  58606. left: padding
  58607. };
  58608. }
  58609. function rectToClientRect(rect) {
  58610. return { ...rect,
  58611. top: rect.y,
  58612. left: rect.x,
  58613. right: rect.x + rect.width,
  58614. bottom: rect.y + rect.height
  58615. };
  58616. }
  58617. /**
  58618. * Resolves with an object of overflow side offsets that determine how much the
  58619. * element is overflowing a given clipping boundary.
  58620. * - positive = overflowing the boundary by that number of pixels
  58621. * - negative = how many pixels left before it will overflow
  58622. * - 0 = lies flush with the boundary
  58623. * @see https://floating-ui.com/docs/detectOverflow
  58624. */
  58625. async function detectOverflow(middlewareArguments, options) {
  58626. var _await$platform$isEle;
  58627. if (options === void 0) {
  58628. options = {};
  58629. }
  58630. const {
  58631. x,
  58632. y,
  58633. platform,
  58634. rects,
  58635. elements,
  58636. strategy
  58637. } = middlewareArguments;
  58638. const {
  58639. boundary = 'clippingAncestors',
  58640. rootBoundary = 'viewport',
  58641. elementContext = 'floating',
  58642. altBoundary = false,
  58643. padding = 0
  58644. } = options;
  58645. const paddingObject = getSideObjectFromPadding(padding);
  58646. const altContext = elementContext === 'floating' ? 'reference' : 'floating';
  58647. const element = elements[altBoundary ? altContext : elementContext];
  58648. const clippingClientRect = rectToClientRect(await platform.getClippingRect({
  58649. 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))),
  58650. boundary,
  58651. rootBoundary,
  58652. strategy
  58653. }));
  58654. const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
  58655. rect: elementContext === 'floating' ? { ...rects.floating,
  58656. x,
  58657. y
  58658. } : rects.reference,
  58659. offsetParent: await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating)),
  58660. strategy
  58661. }) : rects[elementContext]);
  58662. return {
  58663. top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
  58664. bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
  58665. left: clippingClientRect.left - elementClientRect.left + paddingObject.left,
  58666. right: elementClientRect.right - clippingClientRect.right + paddingObject.right
  58667. };
  58668. }
  58669. const min$1 = Math.min;
  58670. const max$1 = Math.max;
  58671. function within(min$1$1, value, max$1$1) {
  58672. return max$1(min$1$1, min$1(value, max$1$1));
  58673. }
  58674. /**
  58675. * Positions an inner element of the floating element such that it is centered
  58676. * to the reference element.
  58677. * @see https://floating-ui.com/docs/arrow
  58678. */
  58679. const arrow = options => ({
  58680. name: 'arrow',
  58681. options,
  58682. async fn(middlewareArguments) {
  58683. // Since `element` is required, we don't Partial<> the type
  58684. const {
  58685. element,
  58686. padding = 0
  58687. } = options != null ? options : {};
  58688. const {
  58689. x,
  58690. y,
  58691. placement,
  58692. rects,
  58693. platform
  58694. } = middlewareArguments;
  58695. if (element == null) {
  58696. return {};
  58697. }
  58698. const paddingObject = getSideObjectFromPadding(padding);
  58699. const coords = {
  58700. x,
  58701. y
  58702. };
  58703. const axis = getMainAxisFromPlacement(placement);
  58704. const alignment = getAlignment(placement);
  58705. const length = getLengthFromAxis(axis);
  58706. const arrowDimensions = await platform.getDimensions(element);
  58707. const minProp = axis === 'y' ? 'top' : 'left';
  58708. const maxProp = axis === 'y' ? 'bottom' : 'right';
  58709. const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
  58710. const startDiff = coords[axis] - rects.reference[axis];
  58711. const arrowOffsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(element));
  58712. let clientSize = arrowOffsetParent ? axis === 'y' ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
  58713. if (clientSize === 0) {
  58714. clientSize = rects.floating[length];
  58715. }
  58716. const centerToReference = endDiff / 2 - startDiff / 2; // Make sure the arrow doesn't overflow the floating element if the center
  58717. // point is outside the floating element's bounds
  58718. const min = paddingObject[minProp];
  58719. const max = clientSize - arrowDimensions[length] - paddingObject[maxProp];
  58720. const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
  58721. const offset = within(min, center, max); // Make sure that arrow points at the reference
  58722. const alignmentPadding = alignment === 'start' ? paddingObject[minProp] : paddingObject[maxProp];
  58723. const shouldAddOffset = alignmentPadding > 0 && center !== offset && rects.reference[length] <= rects.floating[length];
  58724. const alignmentOffset = shouldAddOffset ? center < min ? min - center : max - center : 0;
  58725. return {
  58726. [axis]: coords[axis] - alignmentOffset,
  58727. data: {
  58728. [axis]: offset,
  58729. centerOffset: center - offset
  58730. }
  58731. };
  58732. }
  58733. });
  58734. const hash$1 = {
  58735. left: 'right',
  58736. right: 'left',
  58737. bottom: 'top',
  58738. top: 'bottom'
  58739. };
  58740. function getOppositePlacement(placement) {
  58741. return placement.replace(/left|right|bottom|top/g, matched => hash$1[matched]);
  58742. }
  58743. function getAlignmentSides(placement, rects, rtl) {
  58744. if (rtl === void 0) {
  58745. rtl = false;
  58746. }
  58747. const alignment = getAlignment(placement);
  58748. const mainAxis = getMainAxisFromPlacement(placement);
  58749. const length = getLengthFromAxis(mainAxis);
  58750. let mainAlignmentSide = mainAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';
  58751. if (rects.reference[length] > rects.floating[length]) {
  58752. mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
  58753. }
  58754. return {
  58755. main: mainAlignmentSide,
  58756. cross: getOppositePlacement(mainAlignmentSide)
  58757. };
  58758. }
  58759. const hash = {
  58760. start: 'end',
  58761. end: 'start'
  58762. };
  58763. function getOppositeAlignmentPlacement(placement) {
  58764. return placement.replace(/start|end/g, matched => hash[matched]);
  58765. }
  58766. function getExpandedPlacements(placement) {
  58767. const oppositePlacement = getOppositePlacement(placement);
  58768. return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
  58769. }
  58770. /**
  58771. * Changes the placement of the floating element to one that will fit if the
  58772. * initially specified `placement` does not.
  58773. * @see https://floating-ui.com/docs/flip
  58774. */
  58775. const flip = function (options) {
  58776. if (options === void 0) {
  58777. options = {};
  58778. }
  58779. return {
  58780. name: 'flip',
  58781. options,
  58782. async fn(middlewareArguments) {
  58783. var _middlewareData$flip;
  58784. const {
  58785. placement,
  58786. middlewareData,
  58787. rects,
  58788. initialPlacement,
  58789. platform,
  58790. elements
  58791. } = middlewareArguments;
  58792. const {
  58793. mainAxis: checkMainAxis = true,
  58794. crossAxis: checkCrossAxis = true,
  58795. fallbackPlacements: specifiedFallbackPlacements,
  58796. fallbackStrategy = 'bestFit',
  58797. flipAlignment = true,
  58798. ...detectOverflowOptions
  58799. } = options;
  58800. const side = getSide(placement);
  58801. const isBasePlacement = side === initialPlacement;
  58802. const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
  58803. const placements = [initialPlacement, ...fallbackPlacements];
  58804. const overflow = await detectOverflow(middlewareArguments, detectOverflowOptions);
  58805. const overflows = [];
  58806. let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
  58807. if (checkMainAxis) {
  58808. overflows.push(overflow[side]);
  58809. }
  58810. if (checkCrossAxis) {
  58811. const {
  58812. main,
  58813. cross
  58814. } = getAlignmentSides(placement, rects, await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)));
  58815. overflows.push(overflow[main], overflow[cross]);
  58816. }
  58817. overflowsData = [...overflowsData, {
  58818. placement,
  58819. overflows
  58820. }]; // One or more sides is overflowing
  58821. if (!overflows.every(side => side <= 0)) {
  58822. var _middlewareData$flip$, _middlewareData$flip2;
  58823. const nextIndex = ((_middlewareData$flip$ = (_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) != null ? _middlewareData$flip$ : 0) + 1;
  58824. const nextPlacement = placements[nextIndex];
  58825. if (nextPlacement) {
  58826. // Try next placement and re-run the lifecycle
  58827. return {
  58828. data: {
  58829. index: nextIndex,
  58830. overflows: overflowsData
  58831. },
  58832. reset: {
  58833. placement: nextPlacement
  58834. }
  58835. };
  58836. }
  58837. let resetPlacement = 'bottom';
  58838. switch (fallbackStrategy) {
  58839. case 'bestFit':
  58840. {
  58841. var _overflowsData$map$so;
  58842. 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;
  58843. if (placement) {
  58844. resetPlacement = placement;
  58845. }
  58846. break;
  58847. }
  58848. case 'initialPlacement':
  58849. resetPlacement = initialPlacement;
  58850. break;
  58851. }
  58852. if (placement !== resetPlacement) {
  58853. return {
  58854. reset: {
  58855. placement: resetPlacement
  58856. }
  58857. };
  58858. }
  58859. }
  58860. return {};
  58861. }
  58862. };
  58863. };
  58864. async function convertValueToCoords(middlewareArguments, value) {
  58865. const {
  58866. placement,
  58867. platform,
  58868. elements
  58869. } = middlewareArguments;
  58870. const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
  58871. const side = getSide(placement);
  58872. const alignment = getAlignment(placement);
  58873. const isVertical = getMainAxisFromPlacement(placement) === 'x';
  58874. const mainAxisMulti = ['left', 'top'].includes(side) ? -1 : 1;
  58875. const crossAxisMulti = rtl && isVertical ? -1 : 1;
  58876. const rawValue = typeof value === 'function' ? value(middlewareArguments) : value; // eslint-disable-next-line prefer-const
  58877. let {
  58878. mainAxis,
  58879. crossAxis,
  58880. alignmentAxis
  58881. } = typeof rawValue === 'number' ? {
  58882. mainAxis: rawValue,
  58883. crossAxis: 0,
  58884. alignmentAxis: null
  58885. } : {
  58886. mainAxis: 0,
  58887. crossAxis: 0,
  58888. alignmentAxis: null,
  58889. ...rawValue
  58890. };
  58891. if (alignment && typeof alignmentAxis === 'number') {
  58892. crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis;
  58893. }
  58894. return isVertical ? {
  58895. x: crossAxis * crossAxisMulti,
  58896. y: mainAxis * mainAxisMulti
  58897. } : {
  58898. x: mainAxis * mainAxisMulti,
  58899. y: crossAxis * crossAxisMulti
  58900. };
  58901. }
  58902. /**
  58903. * Displaces the floating element from its reference element.
  58904. * @see https://floating-ui.com/docs/offset
  58905. */
  58906. const offset = function (value) {
  58907. if (value === void 0) {
  58908. value = 0;
  58909. }
  58910. return {
  58911. name: 'offset',
  58912. options: value,
  58913. async fn(middlewareArguments) {
  58914. const {
  58915. x,
  58916. y
  58917. } = middlewareArguments;
  58918. const diffCoords = await convertValueToCoords(middlewareArguments, value);
  58919. return {
  58920. x: x + diffCoords.x,
  58921. y: y + diffCoords.y,
  58922. data: diffCoords
  58923. };
  58924. }
  58925. };
  58926. };
  58927. function getCrossAxis(axis) {
  58928. return axis === 'x' ? 'y' : 'x';
  58929. }
  58930. /**
  58931. * Shifts the floating element in order to keep it in view when it will overflow
  58932. * a clipping boundary.
  58933. * @see https://floating-ui.com/docs/shift
  58934. */
  58935. const shift = function (options) {
  58936. if (options === void 0) {
  58937. options = {};
  58938. }
  58939. return {
  58940. name: 'shift',
  58941. options,
  58942. async fn(middlewareArguments) {
  58943. const {
  58944. x,
  58945. y,
  58946. placement
  58947. } = middlewareArguments;
  58948. const {
  58949. mainAxis: checkMainAxis = true,
  58950. crossAxis: checkCrossAxis = false,
  58951. limiter = {
  58952. fn: _ref => {
  58953. let {
  58954. x,
  58955. y
  58956. } = _ref;
  58957. return {
  58958. x,
  58959. y
  58960. };
  58961. }
  58962. },
  58963. ...detectOverflowOptions
  58964. } = options;
  58965. const coords = {
  58966. x,
  58967. y
  58968. };
  58969. const overflow = await detectOverflow(middlewareArguments, detectOverflowOptions);
  58970. const mainAxis = getMainAxisFromPlacement(getSide(placement));
  58971. const crossAxis = getCrossAxis(mainAxis);
  58972. let mainAxisCoord = coords[mainAxis];
  58973. let crossAxisCoord = coords[crossAxis];
  58974. if (checkMainAxis) {
  58975. const minSide = mainAxis === 'y' ? 'top' : 'left';
  58976. const maxSide = mainAxis === 'y' ? 'bottom' : 'right';
  58977. const min = mainAxisCoord + overflow[minSide];
  58978. const max = mainAxisCoord - overflow[maxSide];
  58979. mainAxisCoord = within(min, mainAxisCoord, max);
  58980. }
  58981. if (checkCrossAxis) {
  58982. const minSide = crossAxis === 'y' ? 'top' : 'left';
  58983. const maxSide = crossAxis === 'y' ? 'bottom' : 'right';
  58984. const min = crossAxisCoord + overflow[minSide];
  58985. const max = crossAxisCoord - overflow[maxSide];
  58986. crossAxisCoord = within(min, crossAxisCoord, max);
  58987. }
  58988. const limitedCoords = limiter.fn({ ...middlewareArguments,
  58989. [mainAxis]: mainAxisCoord,
  58990. [crossAxis]: crossAxisCoord
  58991. });
  58992. return { ...limitedCoords,
  58993. data: {
  58994. x: limitedCoords.x - x,
  58995. y: limitedCoords.y - y
  58996. }
  58997. };
  58998. }
  58999. };
  59000. };
  59001. function isWindow(value) {
  59002. return value && value.document && value.location && value.alert && value.setInterval;
  59003. }
  59004. function getWindow(node) {
  59005. if (node == null) {
  59006. return window;
  59007. }
  59008. if (!isWindow(node)) {
  59009. const ownerDocument = node.ownerDocument;
  59010. return ownerDocument ? ownerDocument.defaultView || window : window;
  59011. }
  59012. return node;
  59013. }
  59014. function getComputedStyle$1(element) {
  59015. return getWindow(element).getComputedStyle(element);
  59016. }
  59017. function getNodeName(node) {
  59018. return isWindow(node) ? '' : node ? (node.nodeName || '').toLowerCase() : '';
  59019. }
  59020. function getUAString() {
  59021. const uaData = navigator.userAgentData;
  59022. if (uaData != null && uaData.brands) {
  59023. return uaData.brands.map(item => item.brand + "/" + item.version).join(' ');
  59024. }
  59025. return navigator.userAgent;
  59026. }
  59027. function isHTMLElement(value) {
  59028. return value instanceof getWindow(value).HTMLElement;
  59029. }
  59030. function isElement(value) {
  59031. return value instanceof getWindow(value).Element;
  59032. }
  59033. function isNode(value) {
  59034. return value instanceof getWindow(value).Node;
  59035. }
  59036. function isShadowRoot(node) {
  59037. // Browsers without `ShadowRoot` support
  59038. if (typeof ShadowRoot === 'undefined') {
  59039. return false;
  59040. }
  59041. const OwnElement = getWindow(node).ShadowRoot;
  59042. return node instanceof OwnElement || node instanceof ShadowRoot;
  59043. }
  59044. function isOverflowElement(element) {
  59045. // Firefox wants us to check `-x` and `-y` variations as well
  59046. const {
  59047. overflow,
  59048. overflowX,
  59049. overflowY
  59050. } = getComputedStyle$1(element);
  59051. return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
  59052. }
  59053. function isTableElement(element) {
  59054. return ['table', 'td', 'th'].includes(getNodeName(element));
  59055. }
  59056. function isContainingBlock(element) {
  59057. // TODO: Try and use feature detection here instead
  59058. const isFirefox = /firefox/i.test(getUAString());
  59059. const css = getComputedStyle$1(element); // This is non-exhaustive but covers the most common CSS properties that
  59060. // create a containing block.
  59061. // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
  59062. return css.transform !== 'none' || css.perspective !== 'none' || // @ts-ignore (TS 4.1 compat)
  59063. css.contain === 'paint' || ['transform', 'perspective'].includes(css.willChange) || isFirefox && css.willChange === 'filter' || isFirefox && (css.filter ? css.filter !== 'none' : false);
  59064. }
  59065. function isLayoutViewport() {
  59066. // Not Safari
  59067. return !/^((?!chrome|android).)*safari/i.test(getUAString()); // Feature detection for this fails in various ways
  59068. // • Always-visible scrollbar or not
  59069. // • Width of <html>, etc.
  59070. // const vV = win.visualViewport;
  59071. // return vV ? Math.abs(win.innerWidth / vV.scale - vV.width) < 0.5 : true;
  59072. }
  59073. const min = Math.min;
  59074. const max = Math.max;
  59075. const round = Math.round;
  59076. function getBoundingClientRect(element, includeScale, isFixedStrategy) {
  59077. var _win$visualViewport$o, _win$visualViewport, _win$visualViewport$o2, _win$visualViewport2;
  59078. if (includeScale === void 0) {
  59079. includeScale = false;
  59080. }
  59081. if (isFixedStrategy === void 0) {
  59082. isFixedStrategy = false;
  59083. }
  59084. const clientRect = element.getBoundingClientRect();
  59085. let scaleX = 1;
  59086. let scaleY = 1;
  59087. if (includeScale && isHTMLElement(element)) {
  59088. scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;
  59089. scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;
  59090. }
  59091. const win = isElement(element) ? getWindow(element) : window;
  59092. const addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
  59093. 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;
  59094. 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;
  59095. const width = clientRect.width / scaleX;
  59096. const height = clientRect.height / scaleY;
  59097. return {
  59098. width,
  59099. height,
  59100. top: y,
  59101. right: x + width,
  59102. bottom: y + height,
  59103. left: x,
  59104. x,
  59105. y
  59106. };
  59107. }
  59108. function getDocumentElement(node) {
  59109. return ((isNode(node) ? node.ownerDocument : node.document) || window.document).documentElement;
  59110. }
  59111. function getNodeScroll(element) {
  59112. if (isElement(element)) {
  59113. return {
  59114. scrollLeft: element.scrollLeft,
  59115. scrollTop: element.scrollTop
  59116. };
  59117. }
  59118. return {
  59119. scrollLeft: element.pageXOffset,
  59120. scrollTop: element.pageYOffset
  59121. };
  59122. }
  59123. function getWindowScrollBarX(element) {
  59124. // If <html> has a CSS width greater than the viewport, then this will be
  59125. // incorrect for RTL.
  59126. return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft;
  59127. }
  59128. function isScaled(element) {
  59129. const rect = getBoundingClientRect(element);
  59130. return round(rect.width) !== element.offsetWidth || round(rect.height) !== element.offsetHeight;
  59131. }
  59132. function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
  59133. const isOffsetParentAnElement = isHTMLElement(offsetParent);
  59134. const documentElement = getDocumentElement(offsetParent);
  59135. const rect = getBoundingClientRect(element, // @ts-ignore - checked above (TS 4.1 compat)
  59136. isOffsetParentAnElement && isScaled(offsetParent), strategy === 'fixed');
  59137. let scroll = {
  59138. scrollLeft: 0,
  59139. scrollTop: 0
  59140. };
  59141. const offsets = {
  59142. x: 0,
  59143. y: 0
  59144. };
  59145. if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== 'fixed') {
  59146. if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
  59147. scroll = getNodeScroll(offsetParent);
  59148. }
  59149. if (isHTMLElement(offsetParent)) {
  59150. const offsetRect = getBoundingClientRect(offsetParent, true);
  59151. offsets.x = offsetRect.x + offsetParent.clientLeft;
  59152. offsets.y = offsetRect.y + offsetParent.clientTop;
  59153. } else if (documentElement) {
  59154. offsets.x = getWindowScrollBarX(documentElement);
  59155. }
  59156. }
  59157. return {
  59158. x: rect.left + scroll.scrollLeft - offsets.x,
  59159. y: rect.top + scroll.scrollTop - offsets.y,
  59160. width: rect.width,
  59161. height: rect.height
  59162. };
  59163. }
  59164. function getParentNode(node) {
  59165. if (getNodeName(node) === 'html') {
  59166. return node;
  59167. }
  59168. return (// this is a quicker (but less type safe) way to save quite some bytes from the bundle
  59169. // @ts-ignore
  59170. node.assignedSlot || // step into the shadow DOM of the parent of a slotted node
  59171. node.parentNode || ( // DOM Element detected
  59172. isShadowRoot(node) ? node.host : null) || // ShadowRoot detected
  59173. getDocumentElement(node) // fallback
  59174. );
  59175. }
  59176. function getTrueOffsetParent(element) {
  59177. if (!isHTMLElement(element) || getComputedStyle$1(element).position === 'fixed') {
  59178. return null;
  59179. }
  59180. return composedOffsetParent(element);
  59181. }
  59182. /**
  59183. * Polyfills the old offsetParent behavior from before the spec was changed:
  59184. * https://github.com/w3c/csswg-drafts/issues/159
  59185. */
  59186. function composedOffsetParent(element) {
  59187. let {
  59188. offsetParent
  59189. } = element;
  59190. let ancestor = element;
  59191. let foundInsideSlot = false;
  59192. while (ancestor && ancestor !== offsetParent) {
  59193. const {
  59194. assignedSlot
  59195. } = ancestor;
  59196. if (assignedSlot) {
  59197. let newOffsetParent = assignedSlot.offsetParent;
  59198. if (getComputedStyle$1(assignedSlot).display === 'contents') {
  59199. const hadStyleAttribute = assignedSlot.hasAttribute('style');
  59200. const oldDisplay = assignedSlot.style.display;
  59201. assignedSlot.style.display = getComputedStyle$1(ancestor).display;
  59202. newOffsetParent = assignedSlot.offsetParent;
  59203. assignedSlot.style.display = oldDisplay;
  59204. if (!hadStyleAttribute) {
  59205. assignedSlot.removeAttribute('style');
  59206. }
  59207. }
  59208. ancestor = assignedSlot;
  59209. if (offsetParent !== newOffsetParent) {
  59210. offsetParent = newOffsetParent;
  59211. foundInsideSlot = true;
  59212. }
  59213. } else if (isShadowRoot(ancestor) && ancestor.host && foundInsideSlot) {
  59214. break;
  59215. }
  59216. ancestor = isShadowRoot(ancestor) && ancestor.host || ancestor.parentNode;
  59217. }
  59218. return offsetParent;
  59219. }
  59220. function getContainingBlock(element) {
  59221. let currentNode = getParentNode(element);
  59222. if (isShadowRoot(currentNode)) {
  59223. currentNode = currentNode.host;
  59224. }
  59225. while (isHTMLElement(currentNode) && !['html', 'body'].includes(getNodeName(currentNode))) {
  59226. if (isContainingBlock(currentNode)) {
  59227. return currentNode;
  59228. } else {
  59229. const parent = currentNode.parentNode;
  59230. currentNode = isShadowRoot(parent) ? parent.host : parent;
  59231. }
  59232. }
  59233. return null;
  59234. } // Gets the closest ancestor positioned element. Handles some edge cases,
  59235. // such as table ancestors and cross browser bugs.
  59236. function getOffsetParent(element) {
  59237. const window = getWindow(element);
  59238. let offsetParent = getTrueOffsetParent(element);
  59239. while (offsetParent && isTableElement(offsetParent) && getComputedStyle$1(offsetParent).position === 'static') {
  59240. offsetParent = getTrueOffsetParent(offsetParent);
  59241. }
  59242. if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle$1(offsetParent).position === 'static' && !isContainingBlock(offsetParent))) {
  59243. return window;
  59244. }
  59245. return offsetParent || getContainingBlock(element) || window;
  59246. }
  59247. function getDimensions(element) {
  59248. if (isHTMLElement(element)) {
  59249. return {
  59250. width: element.offsetWidth,
  59251. height: element.offsetHeight
  59252. };
  59253. }
  59254. const rect = getBoundingClientRect(element);
  59255. return {
  59256. width: rect.width,
  59257. height: rect.height
  59258. };
  59259. }
  59260. function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
  59261. let {
  59262. rect,
  59263. offsetParent,
  59264. strategy
  59265. } = _ref;
  59266. const isOffsetParentAnElement = isHTMLElement(offsetParent);
  59267. const documentElement = getDocumentElement(offsetParent);
  59268. if (offsetParent === documentElement) {
  59269. return rect;
  59270. }
  59271. let scroll = {
  59272. scrollLeft: 0,
  59273. scrollTop: 0
  59274. };
  59275. const offsets = {
  59276. x: 0,
  59277. y: 0
  59278. };
  59279. if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== 'fixed') {
  59280. if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
  59281. scroll = getNodeScroll(offsetParent);
  59282. }
  59283. if (isHTMLElement(offsetParent)) {
  59284. const offsetRect = getBoundingClientRect(offsetParent, true);
  59285. offsets.x = offsetRect.x + offsetParent.clientLeft;
  59286. offsets.y = offsetRect.y + offsetParent.clientTop;
  59287. } // This doesn't appear to be need to be negated.
  59288. // else if (documentElement) {
  59289. // offsets.x = getWindowScrollBarX(documentElement);
  59290. // }
  59291. }
  59292. return { ...rect,
  59293. x: rect.x - scroll.scrollLeft + offsets.x,
  59294. y: rect.y - scroll.scrollTop + offsets.y
  59295. };
  59296. }
  59297. function getViewportRect(element, strategy) {
  59298. const win = getWindow(element);
  59299. const html = getDocumentElement(element);
  59300. const visualViewport = win.visualViewport;
  59301. let width = html.clientWidth;
  59302. let height = html.clientHeight;
  59303. let x = 0;
  59304. let y = 0;
  59305. if (visualViewport) {
  59306. width = visualViewport.width;
  59307. height = visualViewport.height;
  59308. const layoutViewport = isLayoutViewport();
  59309. if (layoutViewport || !layoutViewport && strategy === 'fixed') {
  59310. x = visualViewport.offsetLeft;
  59311. y = visualViewport.offsetTop;
  59312. }
  59313. }
  59314. return {
  59315. width,
  59316. height,
  59317. x,
  59318. y
  59319. };
  59320. }
  59321. // of the `<html>` and `<body>` rect bounds if horizontally scrollable
  59322. function getDocumentRect(element) {
  59323. var _element$ownerDocumen;
  59324. const html = getDocumentElement(element);
  59325. const scroll = getNodeScroll(element);
  59326. const body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
  59327. const width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
  59328. const height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
  59329. let x = -scroll.scrollLeft + getWindowScrollBarX(element);
  59330. const y = -scroll.scrollTop;
  59331. if (getComputedStyle$1(body || html).direction === 'rtl') {
  59332. x += max(html.clientWidth, body ? body.clientWidth : 0) - width;
  59333. }
  59334. return {
  59335. width,
  59336. height,
  59337. x,
  59338. y
  59339. };
  59340. }
  59341. function getNearestOverflowAncestor(node) {
  59342. const parentNode = getParentNode(node);
  59343. if (['html', 'body', '#document'].includes(getNodeName(parentNode))) {
  59344. // @ts-ignore assume body is always available
  59345. return node.ownerDocument.body;
  59346. }
  59347. if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
  59348. return parentNode;
  59349. }
  59350. return getNearestOverflowAncestor(parentNode);
  59351. }
  59352. function getOverflowAncestors(node, list) {
  59353. var _node$ownerDocument;
  59354. if (list === void 0) {
  59355. list = [];
  59356. }
  59357. const scrollableAncestor = getNearestOverflowAncestor(node);
  59358. const isBody = scrollableAncestor === ((_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.body);
  59359. const win = getWindow(scrollableAncestor);
  59360. const target = isBody ? [win].concat(win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : []) : scrollableAncestor;
  59361. const updatedList = list.concat(target);
  59362. return isBody ? updatedList : // @ts-ignore: isBody tells us target will be an HTMLElement here
  59363. updatedList.concat(getOverflowAncestors(target));
  59364. }
  59365. function contains(parent, child) {
  59366. const rootNode = child.getRootNode == null ? void 0 : child.getRootNode(); // First, attempt with faster native method
  59367. if (parent.contains(child)) {
  59368. return true;
  59369. } // then fallback to custom implementation with Shadow DOM support
  59370. else if (rootNode && isShadowRoot(rootNode)) {
  59371. let next = child;
  59372. do {
  59373. // use `===` replace node.isSameNode()
  59374. if (next && parent === next) {
  59375. return true;
  59376. } // @ts-ignore: need a better way to handle this...
  59377. next = next.parentNode || next.host;
  59378. } while (next);
  59379. }
  59380. return false;
  59381. }
  59382. function getInnerBoundingClientRect(element, strategy) {
  59383. const clientRect = getBoundingClientRect(element, false, strategy === 'fixed');
  59384. const top = clientRect.top + element.clientTop;
  59385. const left = clientRect.left + element.clientLeft;
  59386. return {
  59387. top,
  59388. left,
  59389. x: left,
  59390. y: top,
  59391. right: left + element.clientWidth,
  59392. bottom: top + element.clientHeight,
  59393. width: element.clientWidth,
  59394. height: element.clientHeight
  59395. };
  59396. }
  59397. function getClientRectFromClippingAncestor(element, clippingParent, strategy) {
  59398. if (clippingParent === 'viewport') {
  59399. return rectToClientRect(getViewportRect(element, strategy));
  59400. }
  59401. if (isElement(clippingParent)) {
  59402. return getInnerBoundingClientRect(clippingParent, strategy);
  59403. }
  59404. return rectToClientRect(getDocumentRect(getDocumentElement(element)));
  59405. } // A "clipping ancestor" is an overflowable container with the characteristic of
  59406. // clipping (or hiding) overflowing elements with a position different from
  59407. // `initial`
  59408. function getClippingAncestors(element) {
  59409. const clippingAncestors = getOverflowAncestors(element);
  59410. const canEscapeClipping = ['absolute', 'fixed'].includes(getComputedStyle$1(element).position);
  59411. const clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;
  59412. if (!isElement(clipperElement)) {
  59413. return [];
  59414. } // @ts-ignore isElement check ensures we return Array<Element>
  59415. return clippingAncestors.filter(clippingAncestors => isElement(clippingAncestors) && contains(clippingAncestors, clipperElement) && getNodeName(clippingAncestors) !== 'body');
  59416. } // Gets the maximum area that the element is visible in due to any number of
  59417. // clipping ancestors
  59418. function getClippingRect(_ref) {
  59419. let {
  59420. element,
  59421. boundary,
  59422. rootBoundary,
  59423. strategy
  59424. } = _ref;
  59425. const mainClippingAncestors = boundary === 'clippingAncestors' ? getClippingAncestors(element) : [].concat(boundary);
  59426. const clippingAncestors = [...mainClippingAncestors, rootBoundary];
  59427. const firstClippingAncestor = clippingAncestors[0];
  59428. const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
  59429. const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
  59430. accRect.top = max(rect.top, accRect.top);
  59431. accRect.right = min(rect.right, accRect.right);
  59432. accRect.bottom = min(rect.bottom, accRect.bottom);
  59433. accRect.left = max(rect.left, accRect.left);
  59434. return accRect;
  59435. }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
  59436. return {
  59437. width: clippingRect.right - clippingRect.left,
  59438. height: clippingRect.bottom - clippingRect.top,
  59439. x: clippingRect.left,
  59440. y: clippingRect.top
  59441. };
  59442. }
  59443. const platform = {
  59444. getClippingRect,
  59445. convertOffsetParentRelativeRectToViewportRelativeRect,
  59446. isElement,
  59447. getDimensions,
  59448. getOffsetParent,
  59449. getDocumentElement,
  59450. getElementRects: _ref => {
  59451. let {
  59452. reference,
  59453. floating,
  59454. strategy
  59455. } = _ref;
  59456. return {
  59457. reference: getRectRelativeToOffsetParent(reference, getOffsetParent(floating), strategy),
  59458. floating: { ...getDimensions(floating),
  59459. x: 0,
  59460. y: 0
  59461. }
  59462. };
  59463. },
  59464. getClientRects: element => Array.from(element.getClientRects()),
  59465. isRTL: element => getComputedStyle$1(element).direction === 'rtl'
  59466. };
  59467. /**
  59468. * Automatically updates the position of the floating element when necessary.
  59469. * @see https://floating-ui.com/docs/autoUpdate
  59470. */
  59471. function autoUpdate(reference, floating, update, options) {
  59472. if (options === void 0) {
  59473. options = {};
  59474. }
  59475. const {
  59476. ancestorScroll: _ancestorScroll = true,
  59477. ancestorResize: _ancestorResize = true,
  59478. elementResize = true,
  59479. animationFrame = false
  59480. } = options;
  59481. const ancestorScroll = _ancestorScroll && !animationFrame;
  59482. const ancestorResize = _ancestorResize && !animationFrame;
  59483. const ancestors = ancestorScroll || ancestorResize ? [...(isElement(reference) ? getOverflowAncestors(reference) : []), ...getOverflowAncestors(floating)] : [];
  59484. ancestors.forEach(ancestor => {
  59485. ancestorScroll && ancestor.addEventListener('scroll', update, {
  59486. passive: true
  59487. });
  59488. ancestorResize && ancestor.addEventListener('resize', update);
  59489. });
  59490. let observer = null;
  59491. if (elementResize) {
  59492. let initialUpdate = true;
  59493. observer = new ResizeObserver(() => {
  59494. if (!initialUpdate) {
  59495. update();
  59496. }
  59497. initialUpdate = false;
  59498. });
  59499. isElement(reference) && !animationFrame && observer.observe(reference);
  59500. observer.observe(floating);
  59501. }
  59502. let frameId;
  59503. let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
  59504. if (animationFrame) {
  59505. frameLoop();
  59506. }
  59507. function frameLoop() {
  59508. const nextRefRect = getBoundingClientRect(reference);
  59509. if (prevRefRect && (nextRefRect.x !== prevRefRect.x || nextRefRect.y !== prevRefRect.y || nextRefRect.width !== prevRefRect.width || nextRefRect.height !== prevRefRect.height)) {
  59510. update();
  59511. }
  59512. prevRefRect = nextRefRect;
  59513. frameId = requestAnimationFrame(frameLoop);
  59514. }
  59515. update();
  59516. return () => {
  59517. var _observer;
  59518. ancestors.forEach(ancestor => {
  59519. ancestorScroll && ancestor.removeEventListener('scroll', update);
  59520. ancestorResize && ancestor.removeEventListener('resize', update);
  59521. });
  59522. (_observer = observer) == null ? void 0 : _observer.disconnect();
  59523. observer = null;
  59524. if (animationFrame) {
  59525. cancelAnimationFrame(frameId);
  59526. }
  59527. };
  59528. }
  59529. /**
  59530. * Computes the `x` and `y` coordinates that will place the floating element
  59531. * next to a reference element when it is given a certain CSS positioning
  59532. * strategy.
  59533. */
  59534. const computePosition = (reference, floating, options) => computePosition$1(reference, floating, {
  59535. platform,
  59536. ...options
  59537. });
  59538. const useTarget = (target, open, gap, mergedMask, scrollIntoViewOptions) => {
  59539. const posInfo = vue.ref(null);
  59540. const getTargetEl = () => {
  59541. let targetEl;
  59542. if (isString$1(target.value)) {
  59543. targetEl = document.querySelector(target.value);
  59544. } else if (isFunction$1(target.value)) {
  59545. targetEl = target.value();
  59546. } else {
  59547. targetEl = target.value;
  59548. }
  59549. return targetEl;
  59550. };
  59551. const updatePosInfo = () => {
  59552. const targetEl = getTargetEl();
  59553. if (!targetEl || !open.value) {
  59554. posInfo.value = null;
  59555. return;
  59556. }
  59557. if (!isInViewPort(targetEl)) {
  59558. targetEl.scrollIntoView(scrollIntoViewOptions.value);
  59559. }
  59560. const { left, top, width, height } = targetEl.getBoundingClientRect();
  59561. posInfo.value = {
  59562. left,
  59563. top,
  59564. width,
  59565. height,
  59566. radius: 0
  59567. };
  59568. };
  59569. vue.onMounted(() => {
  59570. vue.watch([open, target], () => {
  59571. updatePosInfo();
  59572. }, {
  59573. immediate: true
  59574. });
  59575. window.addEventListener("resize", updatePosInfo);
  59576. });
  59577. vue.onBeforeUnmount(() => {
  59578. window.removeEventListener("resize", updatePosInfo);
  59579. });
  59580. const getGapOffset = (index) => {
  59581. var _a;
  59582. return (_a = isArray$1(gap.value.offset) ? gap.value.offset[index] : gap.value.offset) != null ? _a : 6;
  59583. };
  59584. const mergedPosInfo = vue.computed(() => {
  59585. var _a;
  59586. if (!posInfo.value)
  59587. return posInfo.value;
  59588. const gapOffsetX = getGapOffset(0);
  59589. const gapOffsetY = getGapOffset(1);
  59590. const gapRadius = ((_a = gap.value) == null ? void 0 : _a.radius) || 2;
  59591. return {
  59592. left: posInfo.value.left - gapOffsetX,
  59593. top: posInfo.value.top - gapOffsetY,
  59594. width: posInfo.value.width + gapOffsetX * 2,
  59595. height: posInfo.value.height + gapOffsetY * 2,
  59596. radius: gapRadius
  59597. };
  59598. });
  59599. const triggerTarget = vue.computed(() => {
  59600. const targetEl = getTargetEl();
  59601. if (!mergedMask.value || !targetEl || !window.DOMRect) {
  59602. return targetEl || void 0;
  59603. }
  59604. return {
  59605. getBoundingClientRect() {
  59606. var _a, _b, _c, _d;
  59607. return window.DOMRect.fromRect({
  59608. width: ((_a = mergedPosInfo.value) == null ? void 0 : _a.width) || 0,
  59609. height: ((_b = mergedPosInfo.value) == null ? void 0 : _b.height) || 0,
  59610. x: ((_c = mergedPosInfo.value) == null ? void 0 : _c.left) || 0,
  59611. y: ((_d = mergedPosInfo.value) == null ? void 0 : _d.top) || 0
  59612. });
  59613. }
  59614. };
  59615. });
  59616. return {
  59617. mergedPosInfo,
  59618. triggerTarget
  59619. };
  59620. };
  59621. const tourKey = Symbol("ElTour");
  59622. function isInViewPort(element) {
  59623. const viewWidth = window.innerWidth || document.documentElement.clientWidth;
  59624. const viewHeight = window.innerHeight || document.documentElement.clientHeight;
  59625. const { top, right, bottom, left } = element.getBoundingClientRect();
  59626. return top >= 0 && left >= 0 && right <= viewWidth && bottom <= viewHeight;
  59627. }
  59628. const useFloating = (referenceRef, contentRef, arrowRef, placement, strategy, offset$1, zIndex, showArrow) => {
  59629. const x = vue.ref();
  59630. const y = vue.ref();
  59631. const middlewareData = vue.ref({});
  59632. const states = {
  59633. x,
  59634. y,
  59635. placement,
  59636. strategy,
  59637. middlewareData
  59638. };
  59639. const middleware = vue.computed(() => {
  59640. const _middleware = [
  59641. offset(vue.unref(offset$1)),
  59642. flip(),
  59643. shift(),
  59644. overflowMiddleware()
  59645. ];
  59646. if (vue.unref(showArrow) && vue.unref(arrowRef)) {
  59647. _middleware.push(arrow({
  59648. element: vue.unref(arrowRef)
  59649. }));
  59650. }
  59651. return _middleware;
  59652. });
  59653. const update = async () => {
  59654. if (!isClient)
  59655. return;
  59656. const referenceEl = vue.unref(referenceRef);
  59657. const contentEl = vue.unref(contentRef);
  59658. if (!referenceEl || !contentEl)
  59659. return;
  59660. const data = await computePosition(referenceEl, contentEl, {
  59661. placement: vue.unref(placement),
  59662. strategy: vue.unref(strategy),
  59663. middleware: vue.unref(middleware)
  59664. });
  59665. keysOf(states).forEach((key) => {
  59666. states[key].value = data[key];
  59667. });
  59668. };
  59669. const contentStyle = vue.computed(() => {
  59670. if (!vue.unref(referenceRef)) {
  59671. return {
  59672. position: "fixed",
  59673. top: "50%",
  59674. left: "50%",
  59675. transform: "translate3d(-50%, -50%, 0)",
  59676. maxWidth: "100vw",
  59677. zIndex: vue.unref(zIndex)
  59678. };
  59679. }
  59680. const { overflow } = vue.unref(middlewareData);
  59681. return {
  59682. position: vue.unref(strategy),
  59683. zIndex: vue.unref(zIndex),
  59684. top: vue.unref(y) != null ? `${vue.unref(y)}px` : "",
  59685. left: vue.unref(x) != null ? `${vue.unref(x)}px` : "",
  59686. maxWidth: (overflow == null ? void 0 : overflow.maxWidth) ? `${overflow == null ? void 0 : overflow.maxWidth}px` : ""
  59687. };
  59688. });
  59689. const arrowStyle = vue.computed(() => {
  59690. if (!vue.unref(showArrow))
  59691. return {};
  59692. const { arrow: arrow2 } = vue.unref(middlewareData);
  59693. return {
  59694. left: (arrow2 == null ? void 0 : arrow2.x) != null ? `${arrow2 == null ? void 0 : arrow2.x}px` : "",
  59695. top: (arrow2 == null ? void 0 : arrow2.y) != null ? `${arrow2 == null ? void 0 : arrow2.y}px` : ""
  59696. };
  59697. });
  59698. let cleanup;
  59699. vue.onMounted(() => {
  59700. const referenceEl = vue.unref(referenceRef);
  59701. const contentEl = vue.unref(contentRef);
  59702. if (referenceEl && contentEl) {
  59703. cleanup = autoUpdate(referenceEl, contentEl, update);
  59704. }
  59705. vue.watchEffect(() => {
  59706. update();
  59707. });
  59708. });
  59709. vue.onBeforeUnmount(() => {
  59710. cleanup && cleanup();
  59711. });
  59712. return {
  59713. update,
  59714. contentStyle,
  59715. arrowStyle
  59716. };
  59717. };
  59718. const overflowMiddleware = () => {
  59719. return {
  59720. name: "overflow",
  59721. async fn(state) {
  59722. const overflow = await detectOverflow(state);
  59723. let overWidth = 0;
  59724. if (overflow.left > 0)
  59725. overWidth = overflow.left;
  59726. if (overflow.right > 0)
  59727. overWidth = overflow.right;
  59728. const floatingWidth = state.rects.floating.width;
  59729. return {
  59730. data: {
  59731. maxWidth: floatingWidth - overWidth
  59732. }
  59733. };
  59734. }
  59735. };
  59736. };
  59737. const __default__$d = vue.defineComponent({
  59738. name: "ElTourMask",
  59739. inheritAttrs: false
  59740. });
  59741. const _sfc_main$e = /* @__PURE__ */ vue.defineComponent({
  59742. ...__default__$d,
  59743. props: maskProps,
  59744. setup(__props) {
  59745. const props = __props;
  59746. const { ns } = vue.inject(tourKey);
  59747. const radius = vue.computed(() => {
  59748. var _a, _b;
  59749. return (_b = (_a = props.pos) == null ? void 0 : _a.radius) != null ? _b : 2;
  59750. });
  59751. const roundInfo = vue.computed(() => {
  59752. const v = radius.value;
  59753. const baseInfo = `a${v},${v} 0 0 1`;
  59754. return {
  59755. topRight: `${baseInfo} ${v},${v}`,
  59756. bottomRight: `${baseInfo} ${-v},${v}`,
  59757. bottomLeft: `${baseInfo} ${-v},${-v}`,
  59758. topLeft: `${baseInfo} ${v},${-v}`
  59759. };
  59760. });
  59761. const { width: windowWidth, height: windowHeight } = useWindowSize();
  59762. const path = vue.computed(() => {
  59763. const width = windowWidth.value;
  59764. const height = windowHeight.value;
  59765. const info = roundInfo.value;
  59766. const _path = `M${width},0 L0,0 L0,${height} L${width},${height} L${width},0 Z`;
  59767. const _radius = radius.value;
  59768. 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;
  59769. });
  59770. const maskStyle = vue.computed(() => ({
  59771. position: "fixed",
  59772. left: 0,
  59773. right: 0,
  59774. top: 0,
  59775. bottom: 0,
  59776. zIndex: props.zIndex,
  59777. pointerEvents: props.pos && props.targetAreaClickable ? "none" : "auto"
  59778. }));
  59779. const pathStyle = vue.computed(() => ({
  59780. fill: props.fill,
  59781. pointerEvents: "auto",
  59782. cursor: "auto"
  59783. }));
  59784. useLockscreen(vue.toRef(props, "visible"), {
  59785. ns
  59786. });
  59787. return (_ctx, _cache) => {
  59788. return _ctx.visible ? (vue.openBlock(), vue.createElementBlock("div", vue.mergeProps({
  59789. key: 0,
  59790. class: vue.unref(ns).e("mask"),
  59791. style: vue.unref(maskStyle)
  59792. }, _ctx.$attrs), [
  59793. (vue.openBlock(), vue.createElementBlock("svg", { style: {
  59794. width: "100%",
  59795. height: "100%"
  59796. } }, [
  59797. vue.createElementVNode("path", {
  59798. class: vue.normalizeClass(vue.unref(ns).e("hollow")),
  59799. style: vue.normalizeStyle(vue.unref(pathStyle)),
  59800. d: vue.unref(path)
  59801. }, null, 14, ["d"])
  59802. ]))
  59803. ], 16)) : vue.createCommentVNode("v-if", true);
  59804. };
  59805. }
  59806. });
  59807. var ElTourMask = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["__file", "mask.vue"]]);
  59808. const tourStrategies = ["absolute", "fixed"];
  59809. const tourPlacements = [
  59810. "top-start",
  59811. "top-end",
  59812. "top",
  59813. "bottom-start",
  59814. "bottom-end",
  59815. "bottom",
  59816. "left-start",
  59817. "left-end",
  59818. "left",
  59819. "right-start",
  59820. "right-end",
  59821. "right"
  59822. ];
  59823. const tourContentProps = buildProps({
  59824. placement: {
  59825. type: definePropType(String),
  59826. values: tourPlacements,
  59827. default: "bottom"
  59828. },
  59829. reference: {
  59830. type: definePropType(Object),
  59831. default: null
  59832. },
  59833. strategy: {
  59834. type: definePropType(String),
  59835. values: tourStrategies,
  59836. default: "absolute"
  59837. },
  59838. offset: {
  59839. type: Number,
  59840. default: 10
  59841. },
  59842. showArrow: Boolean,
  59843. zIndex: {
  59844. type: Number,
  59845. default: 2001
  59846. }
  59847. });
  59848. const tourContentEmits = {
  59849. close: () => true
  59850. };
  59851. const __default__$c = vue.defineComponent({
  59852. name: "ElTourContent"
  59853. });
  59854. const _sfc_main$d = /* @__PURE__ */ vue.defineComponent({
  59855. ...__default__$c,
  59856. props: tourContentProps,
  59857. emits: tourContentEmits,
  59858. setup(__props, { emit }) {
  59859. const props = __props;
  59860. const placement = vue.ref(props.placement);
  59861. const strategy = vue.ref(props.strategy);
  59862. const contentRef = vue.ref(null);
  59863. const arrowRef = vue.ref(null);
  59864. vue.watch(() => props.placement, () => {
  59865. placement.value = props.placement;
  59866. });
  59867. const { contentStyle, arrowStyle } = useFloating(vue.toRef(props, "reference"), contentRef, arrowRef, placement, strategy, vue.toRef(props, "offset"), vue.toRef(props, "zIndex"), vue.toRef(props, "showArrow"));
  59868. const side = vue.computed(() => {
  59869. return placement.value.split("-")[0];
  59870. });
  59871. const { ns } = vue.inject(tourKey);
  59872. const onCloseRequested = () => {
  59873. emit("close");
  59874. };
  59875. const onFocusoutPrevented = (event) => {
  59876. if (event.detail.focusReason === "pointer") {
  59877. event.preventDefault();
  59878. }
  59879. };
  59880. return (_ctx, _cache) => {
  59881. return vue.openBlock(), vue.createElementBlock("div", {
  59882. ref_key: "contentRef",
  59883. ref: contentRef,
  59884. style: vue.normalizeStyle(vue.unref(contentStyle)),
  59885. class: vue.normalizeClass(vue.unref(ns).e("content")),
  59886. "data-side": vue.unref(side),
  59887. tabindex: "-1"
  59888. }, [
  59889. vue.createVNode(vue.unref(ElFocusTrap), {
  59890. loop: "",
  59891. trapped: "",
  59892. "focus-start-el": "container",
  59893. "focus-trap-el": contentRef.value || void 0,
  59894. onReleaseRequested: onCloseRequested,
  59895. onFocusoutPrevented
  59896. }, {
  59897. default: vue.withCtx(() => [
  59898. vue.renderSlot(_ctx.$slots, "default")
  59899. ]),
  59900. _: 3
  59901. }, 8, ["focus-trap-el"]),
  59902. _ctx.showArrow ? (vue.openBlock(), vue.createElementBlock("span", {
  59903. key: 0,
  59904. ref_key: "arrowRef",
  59905. ref: arrowRef,
  59906. style: vue.normalizeStyle(vue.unref(arrowStyle)),
  59907. class: vue.normalizeClass(vue.unref(ns).e("arrow"))
  59908. }, null, 6)) : vue.createCommentVNode("v-if", true)
  59909. ], 14, ["data-side"]);
  59910. };
  59911. }
  59912. });
  59913. var ElTourContent = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["__file", "content.vue"]]);
  59914. var ElTourSteps = vue.defineComponent({
  59915. name: "ElTourSteps",
  59916. props: {
  59917. current: {
  59918. type: Number,
  59919. default: 0
  59920. }
  59921. },
  59922. emits: ["update-total"],
  59923. setup(props, { slots, emit }) {
  59924. let cacheTotal = 0;
  59925. return () => {
  59926. var _a, _b;
  59927. const children = (_a = slots.default) == null ? void 0 : _a.call(slots);
  59928. const result = [];
  59929. let total = 0;
  59930. function filterSteps(children2) {
  59931. if (!isArray$1(children2))
  59932. return;
  59933. children2.forEach((item) => {
  59934. var _a2;
  59935. const name = (_a2 = (item == null ? void 0 : item.type) || {}) == null ? void 0 : _a2.name;
  59936. if (name === "ElTourStep") {
  59937. result.push(item);
  59938. total += 1;
  59939. }
  59940. });
  59941. }
  59942. if (children.length) {
  59943. filterSteps(flattedChildren((_b = children[0]) == null ? void 0 : _b.children));
  59944. }
  59945. if (cacheTotal !== total) {
  59946. cacheTotal = total;
  59947. emit("update-total", total);
  59948. }
  59949. if (result.length) {
  59950. return result[props.current];
  59951. }
  59952. return null;
  59953. };
  59954. }
  59955. });
  59956. const tourProps = buildProps({
  59957. modelValue: Boolean,
  59958. current: {
  59959. type: Number,
  59960. default: 0
  59961. },
  59962. showArrow: {
  59963. type: Boolean,
  59964. default: true
  59965. },
  59966. showClose: {
  59967. type: Boolean,
  59968. default: true
  59969. },
  59970. closeIcon: {
  59971. type: iconPropType
  59972. },
  59973. placement: tourContentProps.placement,
  59974. contentStyle: {
  59975. type: definePropType([Object])
  59976. },
  59977. mask: {
  59978. type: definePropType([Boolean, Object]),
  59979. default: true
  59980. },
  59981. gap: {
  59982. type: definePropType(Object),
  59983. default: () => ({
  59984. offset: 6,
  59985. radius: 2
  59986. })
  59987. },
  59988. zIndex: {
  59989. type: Number
  59990. },
  59991. scrollIntoViewOptions: {
  59992. type: definePropType([Boolean, Object]),
  59993. default: () => ({
  59994. block: "center"
  59995. })
  59996. },
  59997. type: {
  59998. type: definePropType(String)
  59999. },
  60000. appendTo: {
  60001. type: teleportProps.to.type,
  60002. default: "body"
  60003. },
  60004. closeOnPressEscape: {
  60005. type: Boolean,
  60006. default: true
  60007. },
  60008. targetAreaClickable: {
  60009. type: Boolean,
  60010. default: true
  60011. }
  60012. });
  60013. const tourEmits = {
  60014. [UPDATE_MODEL_EVENT]: (value) => isBoolean(value),
  60015. ["update:current"]: (current) => isNumber(current),
  60016. close: (current) => isNumber(current),
  60017. finish: () => true,
  60018. change: (current) => isNumber(current)
  60019. };
  60020. const __default__$b = vue.defineComponent({
  60021. name: "ElTour"
  60022. });
  60023. const _sfc_main$c = /* @__PURE__ */ vue.defineComponent({
  60024. ...__default__$b,
  60025. props: tourProps,
  60026. emits: tourEmits,
  60027. setup(__props, { emit }) {
  60028. const props = __props;
  60029. const ns = useNamespace("tour");
  60030. const total = vue.ref(0);
  60031. const currentStep = vue.ref();
  60032. const current = useVModel(props, "current", emit, {
  60033. passive: true
  60034. });
  60035. const currentTarget = vue.computed(() => {
  60036. var _a;
  60037. return (_a = currentStep.value) == null ? void 0 : _a.target;
  60038. });
  60039. const kls = vue.computed(() => [
  60040. ns.b(),
  60041. mergedType.value === "primary" ? ns.m("primary") : ""
  60042. ]);
  60043. const mergedPlacement = vue.computed(() => {
  60044. var _a;
  60045. return ((_a = currentStep.value) == null ? void 0 : _a.placement) || props.placement;
  60046. });
  60047. const mergedContentStyle = vue.computed(() => {
  60048. var _a, _b;
  60049. return (_b = (_a = currentStep.value) == null ? void 0 : _a.contentStyle) != null ? _b : props.contentStyle;
  60050. });
  60051. const mergedMask = vue.computed(() => {
  60052. var _a, _b;
  60053. return (_b = (_a = currentStep.value) == null ? void 0 : _a.mask) != null ? _b : props.mask;
  60054. });
  60055. const mergedShowMask = vue.computed(() => !!mergedMask.value && props.modelValue);
  60056. const mergedMaskStyle = vue.computed(() => isBoolean(mergedMask.value) ? void 0 : mergedMask.value);
  60057. const mergedShowArrow = vue.computed(() => {
  60058. var _a, _b;
  60059. return !!currentTarget.value && ((_b = (_a = currentStep.value) == null ? void 0 : _a.showArrow) != null ? _b : props.showArrow);
  60060. });
  60061. const mergedScrollIntoViewOptions = vue.computed(() => {
  60062. var _a, _b;
  60063. return (_b = (_a = currentStep.value) == null ? void 0 : _a.scrollIntoViewOptions) != null ? _b : props.scrollIntoViewOptions;
  60064. });
  60065. const mergedType = vue.computed(() => {
  60066. var _a, _b;
  60067. return (_b = (_a = currentStep.value) == null ? void 0 : _a.type) != null ? _b : props.type;
  60068. });
  60069. const { nextZIndex } = useZIndex();
  60070. const nowZIndex = nextZIndex();
  60071. const mergedZIndex = vue.computed(() => {
  60072. var _a;
  60073. return (_a = props.zIndex) != null ? _a : nowZIndex;
  60074. });
  60075. const { mergedPosInfo: pos, triggerTarget } = useTarget(currentTarget, vue.toRef(props, "modelValue"), vue.toRef(props, "gap"), mergedMask, mergedScrollIntoViewOptions);
  60076. vue.watch(() => props.modelValue, (val) => {
  60077. if (!val) {
  60078. current.value = 0;
  60079. }
  60080. });
  60081. const onEscClose = () => {
  60082. if (props.closeOnPressEscape) {
  60083. emit(UPDATE_MODEL_EVENT, false);
  60084. emit("close", current.value);
  60085. }
  60086. };
  60087. const onUpdateTotal = (val) => {
  60088. total.value = val;
  60089. };
  60090. const slots = vue.useSlots();
  60091. vue.provide(tourKey, {
  60092. currentStep,
  60093. current,
  60094. total,
  60095. showClose: vue.toRef(props, "showClose"),
  60096. closeIcon: vue.toRef(props, "closeIcon"),
  60097. mergedType,
  60098. ns,
  60099. slots,
  60100. updateModelValue(modelValue) {
  60101. emit(UPDATE_MODEL_EVENT, modelValue);
  60102. },
  60103. onClose() {
  60104. emit("close", current.value);
  60105. },
  60106. onFinish() {
  60107. emit("finish");
  60108. },
  60109. onChange() {
  60110. emit(CHANGE_EVENT, current.value);
  60111. }
  60112. });
  60113. return (_ctx, _cache) => {
  60114. return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
  60115. vue.createVNode(vue.unref(ElTeleport$1), { to: _ctx.appendTo }, {
  60116. default: vue.withCtx(() => {
  60117. var _a, _b;
  60118. return [
  60119. vue.createElementVNode("div", vue.mergeProps({ class: vue.unref(kls) }, _ctx.$attrs), [
  60120. vue.createVNode(ElTourMask, {
  60121. visible: vue.unref(mergedShowMask),
  60122. fill: (_a = vue.unref(mergedMaskStyle)) == null ? void 0 : _a.color,
  60123. style: vue.normalizeStyle((_b = vue.unref(mergedMaskStyle)) == null ? void 0 : _b.style),
  60124. pos: vue.unref(pos),
  60125. "z-index": vue.unref(mergedZIndex),
  60126. "target-area-clickable": _ctx.targetAreaClickable
  60127. }, null, 8, ["visible", "fill", "style", "pos", "z-index", "target-area-clickable"]),
  60128. _ctx.modelValue ? (vue.openBlock(), vue.createBlock(ElTourContent, {
  60129. key: vue.unref(current),
  60130. reference: vue.unref(triggerTarget),
  60131. placement: vue.unref(mergedPlacement),
  60132. "show-arrow": vue.unref(mergedShowArrow),
  60133. "z-index": vue.unref(mergedZIndex),
  60134. style: vue.normalizeStyle(vue.unref(mergedContentStyle)),
  60135. onClose: onEscClose
  60136. }, {
  60137. default: vue.withCtx(() => [
  60138. vue.createVNode(vue.unref(ElTourSteps), {
  60139. current: vue.unref(current),
  60140. onUpdateTotal
  60141. }, {
  60142. default: vue.withCtx(() => [
  60143. vue.renderSlot(_ctx.$slots, "default")
  60144. ]),
  60145. _: 3
  60146. }, 8, ["current"])
  60147. ]),
  60148. _: 3
  60149. }, 8, ["reference", "placement", "show-arrow", "z-index", "style"])) : vue.createCommentVNode("v-if", true)
  60150. ], 16)
  60151. ];
  60152. }),
  60153. _: 3
  60154. }, 8, ["to"]),
  60155. vue.createCommentVNode(" just for IDE "),
  60156. vue.createCommentVNode("v-if", true)
  60157. ], 64);
  60158. };
  60159. }
  60160. });
  60161. var Tour = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["__file", "tour.vue"]]);
  60162. const tourStepProps = buildProps({
  60163. target: {
  60164. type: definePropType([String, Object, Function])
  60165. },
  60166. title: String,
  60167. description: String,
  60168. showClose: {
  60169. type: Boolean,
  60170. default: void 0
  60171. },
  60172. closeIcon: {
  60173. type: iconPropType
  60174. },
  60175. showArrow: {
  60176. type: Boolean,
  60177. default: void 0
  60178. },
  60179. placement: tourContentProps.placement,
  60180. mask: {
  60181. type: definePropType([Boolean, Object]),
  60182. default: void 0
  60183. },
  60184. contentStyle: {
  60185. type: definePropType([Object])
  60186. },
  60187. prevButtonProps: {
  60188. type: definePropType(Object)
  60189. },
  60190. nextButtonProps: {
  60191. type: definePropType(Object)
  60192. },
  60193. scrollIntoViewOptions: {
  60194. type: definePropType([Boolean, Object]),
  60195. default: void 0
  60196. },
  60197. type: {
  60198. type: definePropType(String)
  60199. }
  60200. });
  60201. const tourStepEmits = {
  60202. close: () => true
  60203. };
  60204. const __default__$a = vue.defineComponent({
  60205. name: "ElTourStep"
  60206. });
  60207. const _sfc_main$b = /* @__PURE__ */ vue.defineComponent({
  60208. ...__default__$a,
  60209. props: tourStepProps,
  60210. emits: tourStepEmits,
  60211. setup(__props, { emit }) {
  60212. const props = __props;
  60213. const { Close } = CloseComponents;
  60214. const { t } = useLocale();
  60215. const {
  60216. currentStep,
  60217. current,
  60218. total,
  60219. showClose,
  60220. closeIcon,
  60221. mergedType,
  60222. ns,
  60223. slots: tourSlots,
  60224. updateModelValue,
  60225. onClose: tourOnClose,
  60226. onFinish: tourOnFinish,
  60227. onChange
  60228. } = vue.inject(tourKey);
  60229. vue.watch(props, (val) => {
  60230. currentStep.value = val;
  60231. }, {
  60232. immediate: true
  60233. });
  60234. const mergedShowClose = vue.computed(() => {
  60235. var _a;
  60236. return (_a = props.showClose) != null ? _a : showClose.value;
  60237. });
  60238. const mergedCloseIcon = vue.computed(() => {
  60239. var _a, _b;
  60240. return (_b = (_a = props.closeIcon) != null ? _a : closeIcon.value) != null ? _b : Close;
  60241. });
  60242. const filterButtonProps = (btnProps) => {
  60243. if (!btnProps)
  60244. return;
  60245. return omit(btnProps, ["children", "onClick"]);
  60246. };
  60247. const onPrev = () => {
  60248. var _a, _b;
  60249. current.value -= 1;
  60250. if ((_a = props.prevButtonProps) == null ? void 0 : _a.onClick) {
  60251. (_b = props.prevButtonProps) == null ? void 0 : _b.onClick();
  60252. }
  60253. onChange();
  60254. };
  60255. const onNext = () => {
  60256. var _a;
  60257. if (current.value >= total.value - 1) {
  60258. onFinish();
  60259. } else {
  60260. current.value += 1;
  60261. }
  60262. if ((_a = props.nextButtonProps) == null ? void 0 : _a.onClick) {
  60263. props.nextButtonProps.onClick();
  60264. }
  60265. onChange();
  60266. };
  60267. const onFinish = () => {
  60268. onClose();
  60269. tourOnFinish();
  60270. };
  60271. const onClose = () => {
  60272. updateModelValue(false);
  60273. tourOnClose();
  60274. emit("close");
  60275. };
  60276. const handleKeydown = (e) => {
  60277. const target = e.target;
  60278. if (target == null ? void 0 : target.isContentEditable)
  60279. return;
  60280. const code = getEventCode(e);
  60281. switch (code) {
  60282. case EVENT_CODE.left:
  60283. e.preventDefault();
  60284. current.value > 0 && onPrev();
  60285. break;
  60286. case EVENT_CODE.right:
  60287. e.preventDefault();
  60288. onNext();
  60289. break;
  60290. }
  60291. };
  60292. vue.onMounted(() => {
  60293. window.addEventListener("keydown", handleKeydown);
  60294. });
  60295. vue.onBeforeUnmount(() => {
  60296. window.removeEventListener("keydown", handleKeydown);
  60297. });
  60298. return (_ctx, _cache) => {
  60299. return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
  60300. vue.unref(mergedShowClose) ? (vue.openBlock(), vue.createElementBlock("button", {
  60301. key: 0,
  60302. "aria-label": vue.unref(t)("el.tour.close"),
  60303. class: vue.normalizeClass(vue.unref(ns).e("closebtn")),
  60304. type: "button",
  60305. onClick: onClose
  60306. }, [
  60307. vue.createVNode(vue.unref(ElIcon), {
  60308. class: vue.normalizeClass(vue.unref(ns).e("close"))
  60309. }, {
  60310. default: vue.withCtx(() => [
  60311. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(mergedCloseIcon))))
  60312. ]),
  60313. _: 1
  60314. }, 8, ["class"])
  60315. ], 10, ["aria-label"])) : vue.createCommentVNode("v-if", true),
  60316. vue.createElementVNode("header", {
  60317. class: vue.normalizeClass([vue.unref(ns).e("header"), { "show-close": vue.unref(showClose) }])
  60318. }, [
  60319. vue.renderSlot(_ctx.$slots, "header", {}, () => [
  60320. vue.createElementVNode("span", {
  60321. role: "heading",
  60322. class: vue.normalizeClass(vue.unref(ns).e("title"))
  60323. }, vue.toDisplayString(_ctx.title), 3)
  60324. ])
  60325. ], 2),
  60326. vue.createElementVNode("div", {
  60327. class: vue.normalizeClass(vue.unref(ns).e("body"))
  60328. }, [
  60329. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  60330. vue.createElementVNode("span", null, vue.toDisplayString(_ctx.description), 1)
  60331. ])
  60332. ], 2),
  60333. vue.createElementVNode("footer", {
  60334. class: vue.normalizeClass(vue.unref(ns).e("footer"))
  60335. }, [
  60336. vue.createElementVNode("div", {
  60337. class: vue.normalizeClass(vue.unref(ns).b("indicators"))
  60338. }, [
  60339. vue.unref(tourSlots).indicators ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(tourSlots).indicators), {
  60340. key: 0,
  60341. current: vue.unref(current),
  60342. total: vue.unref(total)
  60343. }, null, 8, ["current", "total"])) : (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 1 }, vue.renderList(vue.unref(total), (item, index) => {
  60344. return vue.openBlock(), vue.createElementBlock("span", {
  60345. key: item,
  60346. class: vue.normalizeClass([vue.unref(ns).b("indicator"), vue.unref(ns).is("active", index === vue.unref(current))])
  60347. }, null, 2);
  60348. }), 128))
  60349. ], 2),
  60350. vue.createElementVNode("div", {
  60351. class: vue.normalizeClass(vue.unref(ns).b("buttons"))
  60352. }, [
  60353. vue.unref(current) > 0 ? (vue.openBlock(), vue.createBlock(vue.unref(ElButton), vue.mergeProps({
  60354. key: 0,
  60355. size: "small",
  60356. type: vue.unref(mergedType)
  60357. }, filterButtonProps(_ctx.prevButtonProps), { onClick: onPrev }), {
  60358. default: vue.withCtx(() => {
  60359. var _a, _b;
  60360. return [
  60361. vue.createTextVNode(vue.toDisplayString((_b = (_a = _ctx.prevButtonProps) == null ? void 0 : _a.children) != null ? _b : vue.unref(t)("el.tour.previous")), 1)
  60362. ];
  60363. }),
  60364. _: 1
  60365. }, 16, ["type"])) : vue.createCommentVNode("v-if", true),
  60366. vue.unref(current) <= vue.unref(total) - 1 ? (vue.openBlock(), vue.createBlock(vue.unref(ElButton), vue.mergeProps({
  60367. key: 1,
  60368. size: "small",
  60369. type: vue.unref(mergedType) === "primary" ? "default" : "primary"
  60370. }, filterButtonProps(_ctx.nextButtonProps), { onClick: onNext }), {
  60371. default: vue.withCtx(() => {
  60372. var _a, _b;
  60373. return [
  60374. 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)
  60375. ];
  60376. }),
  60377. _: 1
  60378. }, 16, ["type"])) : vue.createCommentVNode("v-if", true)
  60379. ], 2)
  60380. ], 2)
  60381. ], 64);
  60382. };
  60383. }
  60384. });
  60385. var TourStep = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__file", "step.vue"]]);
  60386. const ElTour = withInstall(Tour, {
  60387. TourStep
  60388. });
  60389. const ElTourStep = withNoopInstall(TourStep);
  60390. const anchorProps = buildProps({
  60391. container: {
  60392. type: definePropType([
  60393. String,
  60394. Object
  60395. ])
  60396. },
  60397. offset: {
  60398. type: Number,
  60399. default: 0
  60400. },
  60401. bound: {
  60402. type: Number,
  60403. default: 15
  60404. },
  60405. duration: {
  60406. type: Number,
  60407. default: 300
  60408. },
  60409. marker: {
  60410. type: Boolean,
  60411. default: true
  60412. },
  60413. type: {
  60414. type: definePropType(String),
  60415. default: "default"
  60416. },
  60417. direction: {
  60418. type: definePropType(String),
  60419. default: "vertical"
  60420. },
  60421. selectScrollTop: Boolean
  60422. });
  60423. const anchorEmits = {
  60424. change: (href) => isString$1(href),
  60425. click: (e, href) => e instanceof MouseEvent && (isString$1(href) || isUndefined(href))
  60426. };
  60427. const anchorKey = Symbol("anchor");
  60428. const __default__$9 = vue.defineComponent({
  60429. name: "ElAnchor"
  60430. });
  60431. const _sfc_main$a = /* @__PURE__ */ vue.defineComponent({
  60432. ...__default__$9,
  60433. props: anchorProps,
  60434. emits: anchorEmits,
  60435. setup(__props, { expose, emit }) {
  60436. const props = __props;
  60437. const slots = vue.useSlots();
  60438. const currentAnchor = vue.ref("");
  60439. const markerStyle = vue.ref({});
  60440. const anchorRef = vue.ref(null);
  60441. const markerRef = vue.ref(null);
  60442. const containerEl = vue.ref();
  60443. const links = {};
  60444. let isScrolling = false;
  60445. let currentScrollTop = 0;
  60446. const ns = useNamespace("anchor");
  60447. const cls = vue.computed(() => [
  60448. ns.b(),
  60449. props.type === "underline" ? ns.m("underline") : "",
  60450. ns.m(props.direction)
  60451. ]);
  60452. const addLink = (state) => {
  60453. links[state.href] = state.el;
  60454. };
  60455. const removeLink = (href) => {
  60456. delete links[href];
  60457. };
  60458. const setCurrentAnchor = (href) => {
  60459. const activeHref = currentAnchor.value;
  60460. if (activeHref !== href) {
  60461. currentAnchor.value = href;
  60462. emit(CHANGE_EVENT, href);
  60463. }
  60464. };
  60465. let clearAnimate = null;
  60466. const scrollToAnchor = (href) => {
  60467. if (!containerEl.value)
  60468. return;
  60469. const target = getElement(href);
  60470. if (!target)
  60471. return;
  60472. if (clearAnimate)
  60473. clearAnimate();
  60474. isScrolling = true;
  60475. const scrollEle = getScrollElement(target, containerEl.value);
  60476. const distance = getOffsetTopDistance(target, scrollEle);
  60477. const max = scrollEle.scrollHeight - scrollEle.clientHeight;
  60478. const to = Math.min(distance - props.offset, max);
  60479. clearAnimate = animateScrollTo(containerEl.value, currentScrollTop, to, props.duration, () => {
  60480. setTimeout(() => {
  60481. isScrolling = false;
  60482. }, 20);
  60483. });
  60484. };
  60485. const scrollTo = (href) => {
  60486. if (href) {
  60487. setCurrentAnchor(href);
  60488. scrollToAnchor(href);
  60489. }
  60490. };
  60491. const handleClick = (e, href) => {
  60492. emit("click", e, href);
  60493. scrollTo(href);
  60494. };
  60495. const handleScroll = throttleByRaf(() => {
  60496. if (containerEl.value) {
  60497. currentScrollTop = getScrollTop(containerEl.value);
  60498. }
  60499. const currentHref = getCurrentHref();
  60500. if (isScrolling || isUndefined(currentHref))
  60501. return;
  60502. setCurrentAnchor(currentHref);
  60503. });
  60504. const getCurrentHref = () => {
  60505. if (!containerEl.value)
  60506. return;
  60507. const scrollTop = getScrollTop(containerEl.value);
  60508. const anchorTopList = [];
  60509. for (const href of Object.keys(links)) {
  60510. const target = getElement(href);
  60511. if (!target)
  60512. continue;
  60513. const scrollEle = getScrollElement(target, containerEl.value);
  60514. const distance = getOffsetTopDistance(target, scrollEle);
  60515. anchorTopList.push({
  60516. top: distance - props.offset - props.bound,
  60517. href
  60518. });
  60519. }
  60520. anchorTopList.sort((prev, next) => prev.top - next.top);
  60521. for (let i = 0; i < anchorTopList.length; i++) {
  60522. const item = anchorTopList[i];
  60523. const next = anchorTopList[i + 1];
  60524. if (i === 0 && scrollTop === 0) {
  60525. return props.selectScrollTop ? item.href : "";
  60526. }
  60527. if (item.top <= scrollTop && (!next || next.top > scrollTop)) {
  60528. return item.href;
  60529. }
  60530. }
  60531. };
  60532. const getContainer = () => {
  60533. const el = getElement(props.container);
  60534. if (!el || isWindow$1(el)) {
  60535. containerEl.value = window;
  60536. } else {
  60537. containerEl.value = el;
  60538. }
  60539. };
  60540. useEventListener(containerEl, "scroll", handleScroll);
  60541. const updateMarkerStyle = () => {
  60542. vue.nextTick(() => {
  60543. if (!anchorRef.value || !markerRef.value || !currentAnchor.value) {
  60544. markerStyle.value = {};
  60545. return;
  60546. }
  60547. const currentLinkEl = links[currentAnchor.value];
  60548. if (!currentLinkEl) {
  60549. markerStyle.value = {};
  60550. return;
  60551. }
  60552. const anchorRect = anchorRef.value.getBoundingClientRect();
  60553. const markerRect = markerRef.value.getBoundingClientRect();
  60554. const linkRect = currentLinkEl.getBoundingClientRect();
  60555. if (props.direction === "horizontal") {
  60556. const left = linkRect.left - anchorRect.left;
  60557. markerStyle.value = {
  60558. left: `${left}px`,
  60559. width: `${linkRect.width}px`,
  60560. opacity: 1
  60561. };
  60562. } else {
  60563. const top = linkRect.top - anchorRect.top + (linkRect.height - markerRect.height) / 2;
  60564. markerStyle.value = {
  60565. top: `${top}px`,
  60566. opacity: 1
  60567. };
  60568. }
  60569. });
  60570. };
  60571. vue.watch(currentAnchor, updateMarkerStyle);
  60572. vue.watch(() => {
  60573. var _a;
  60574. return (_a = slots.default) == null ? void 0 : _a.call(slots);
  60575. }, updateMarkerStyle);
  60576. vue.onMounted(() => {
  60577. getContainer();
  60578. const hash = decodeURIComponent(window.location.hash);
  60579. const target = getElement(hash);
  60580. if (target) {
  60581. scrollTo(hash);
  60582. } else {
  60583. handleScroll();
  60584. }
  60585. });
  60586. vue.watch(() => props.container, () => {
  60587. getContainer();
  60588. });
  60589. vue.provide(anchorKey, {
  60590. ns,
  60591. direction: props.direction,
  60592. currentAnchor,
  60593. addLink,
  60594. removeLink,
  60595. handleClick
  60596. });
  60597. expose({
  60598. scrollTo
  60599. });
  60600. return (_ctx, _cache) => {
  60601. return vue.openBlock(), vue.createElementBlock("div", {
  60602. ref_key: "anchorRef",
  60603. ref: anchorRef,
  60604. class: vue.normalizeClass(vue.unref(cls))
  60605. }, [
  60606. _ctx.marker ? (vue.openBlock(), vue.createElementBlock("div", {
  60607. key: 0,
  60608. ref_key: "markerRef",
  60609. ref: markerRef,
  60610. class: vue.normalizeClass(vue.unref(ns).e("marker")),
  60611. style: vue.normalizeStyle(markerStyle.value)
  60612. }, null, 6)) : vue.createCommentVNode("v-if", true),
  60613. vue.createElementVNode("div", {
  60614. class: vue.normalizeClass(vue.unref(ns).e("list"))
  60615. }, [
  60616. vue.renderSlot(_ctx.$slots, "default")
  60617. ], 2)
  60618. ], 2);
  60619. };
  60620. }
  60621. });
  60622. var Anchor = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["__file", "anchor.vue"]]);
  60623. const anchorLinkProps = buildProps({
  60624. title: String,
  60625. href: String
  60626. });
  60627. const __default__$8 = vue.defineComponent({
  60628. name: "ElAnchorLink"
  60629. });
  60630. const _sfc_main$9 = /* @__PURE__ */ vue.defineComponent({
  60631. ...__default__$8,
  60632. props: anchorLinkProps,
  60633. setup(__props) {
  60634. const props = __props;
  60635. const linkRef = vue.ref(null);
  60636. const {
  60637. ns,
  60638. direction,
  60639. currentAnchor,
  60640. addLink,
  60641. removeLink,
  60642. handleClick: contextHandleClick
  60643. } = vue.inject(anchorKey);
  60644. const cls = vue.computed(() => [
  60645. ns.e("link"),
  60646. ns.is("active", currentAnchor.value === props.href)
  60647. ]);
  60648. const handleClick = (e) => {
  60649. contextHandleClick(e, props.href);
  60650. };
  60651. vue.watch(() => props.href, (val, oldVal) => {
  60652. vue.nextTick(() => {
  60653. if (oldVal)
  60654. removeLink(oldVal);
  60655. if (val) {
  60656. addLink({
  60657. href: val,
  60658. el: linkRef.value
  60659. });
  60660. }
  60661. });
  60662. });
  60663. vue.onMounted(() => {
  60664. const { href } = props;
  60665. if (href) {
  60666. addLink({
  60667. href,
  60668. el: linkRef.value
  60669. });
  60670. }
  60671. });
  60672. vue.onBeforeUnmount(() => {
  60673. const { href } = props;
  60674. if (href) {
  60675. removeLink(href);
  60676. }
  60677. });
  60678. return (_ctx, _cache) => {
  60679. return vue.openBlock(), vue.createElementBlock("div", {
  60680. class: vue.normalizeClass(vue.unref(ns).e("item"))
  60681. }, [
  60682. vue.createElementVNode("a", {
  60683. ref_key: "linkRef",
  60684. ref: linkRef,
  60685. class: vue.normalizeClass(vue.unref(cls)),
  60686. href: _ctx.href,
  60687. onClick: handleClick
  60688. }, [
  60689. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  60690. vue.createTextVNode(vue.toDisplayString(_ctx.title), 1)
  60691. ])
  60692. ], 10, ["href"]),
  60693. _ctx.$slots["sub-link"] && vue.unref(direction) === "vertical" ? (vue.openBlock(), vue.createElementBlock("div", {
  60694. key: 0,
  60695. class: vue.normalizeClass(vue.unref(ns).e("list"))
  60696. }, [
  60697. vue.renderSlot(_ctx.$slots, "sub-link")
  60698. ], 2)) : vue.createCommentVNode("v-if", true)
  60699. ], 2);
  60700. };
  60701. }
  60702. });
  60703. var AnchorLink = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__file", "anchor-link.vue"]]);
  60704. const ElAnchor = withInstall(Anchor, {
  60705. AnchorLink
  60706. });
  60707. const ElAnchorLink = withNoopInstall(AnchorLink);
  60708. const defaultProps = {
  60709. label: "label",
  60710. value: "value",
  60711. disabled: "disabled"
  60712. };
  60713. const segmentedProps = buildProps({
  60714. direction: {
  60715. type: definePropType(String),
  60716. default: "horizontal"
  60717. },
  60718. options: {
  60719. type: definePropType(Array),
  60720. default: () => []
  60721. },
  60722. modelValue: {
  60723. type: [String, Number, Boolean],
  60724. default: void 0
  60725. },
  60726. props: {
  60727. type: definePropType(Object),
  60728. default: () => defaultProps
  60729. },
  60730. block: Boolean,
  60731. size: useSizeProp,
  60732. disabled: Boolean,
  60733. validateEvent: {
  60734. type: Boolean,
  60735. default: true
  60736. },
  60737. id: String,
  60738. name: String,
  60739. ...useAriaProps(["ariaLabel"])
  60740. });
  60741. const segmentedEmits = {
  60742. [UPDATE_MODEL_EVENT]: (val) => isString$1(val) || isNumber(val) || isBoolean(val),
  60743. [CHANGE_EVENT]: (val) => isString$1(val) || isNumber(val) || isBoolean(val)
  60744. };
  60745. const __default__$7 = vue.defineComponent({
  60746. name: "ElSegmented"
  60747. });
  60748. const _sfc_main$8 = /* @__PURE__ */ vue.defineComponent({
  60749. ...__default__$7,
  60750. props: segmentedProps,
  60751. emits: segmentedEmits,
  60752. setup(__props, { emit }) {
  60753. const props = __props;
  60754. const ns = useNamespace("segmented");
  60755. const segmentedId = useId();
  60756. const segmentedSize = useFormSize();
  60757. const _disabled = useFormDisabled();
  60758. const { formItem } = useFormItem();
  60759. const { inputId, isLabeledByFormItem } = useFormItemInputId(props, {
  60760. formItemContext: formItem
  60761. });
  60762. const segmentedRef = vue.ref(null);
  60763. const activeElement = useActiveElement();
  60764. const state = vue.reactive({
  60765. isInit: false,
  60766. width: 0,
  60767. height: 0,
  60768. translateX: 0,
  60769. translateY: 0,
  60770. focusVisible: false
  60771. });
  60772. const handleChange = (item) => {
  60773. const value = getValue(item);
  60774. emit(UPDATE_MODEL_EVENT, value);
  60775. emit(CHANGE_EVENT, value);
  60776. };
  60777. const aliasProps = vue.computed(() => ({ ...defaultProps, ...props.props }));
  60778. const intoAny = (item) => item;
  60779. const getValue = (item) => {
  60780. return isObject$1(item) ? item[aliasProps.value.value] : item;
  60781. };
  60782. const getLabel = (item) => {
  60783. return isObject$1(item) ? item[aliasProps.value.label] : item;
  60784. };
  60785. const getDisabled = (item) => {
  60786. return !!(_disabled.value || (isObject$1(item) ? item[aliasProps.value.disabled] : false));
  60787. };
  60788. const getSelected = (item) => {
  60789. return props.modelValue === getValue(item);
  60790. };
  60791. const getOption = (value) => {
  60792. return props.options.find((item) => getValue(item) === value);
  60793. };
  60794. const getItemCls = (item) => {
  60795. return [
  60796. ns.e("item"),
  60797. ns.is("selected", getSelected(item)),
  60798. ns.is("disabled", getDisabled(item))
  60799. ];
  60800. };
  60801. const updateSelect = () => {
  60802. if (!segmentedRef.value)
  60803. return;
  60804. const selectedItem = segmentedRef.value.querySelector(".is-selected");
  60805. const selectedItemInput = segmentedRef.value.querySelector(".is-selected input");
  60806. if (!selectedItem || !selectedItemInput) {
  60807. state.width = 0;
  60808. state.height = 0;
  60809. state.translateX = 0;
  60810. state.translateY = 0;
  60811. state.focusVisible = false;
  60812. return;
  60813. }
  60814. state.isInit = true;
  60815. if (props.direction === "vertical") {
  60816. state.height = selectedItem.offsetHeight;
  60817. state.translateY = selectedItem.offsetTop;
  60818. } else {
  60819. state.width = selectedItem.offsetWidth;
  60820. state.translateX = selectedItem.offsetLeft;
  60821. }
  60822. try {
  60823. state.focusVisible = selectedItemInput.matches(":focus-visible");
  60824. } catch (e) {
  60825. }
  60826. };
  60827. const segmentedCls = vue.computed(() => [
  60828. ns.b(),
  60829. ns.m(segmentedSize.value),
  60830. ns.is("block", props.block)
  60831. ]);
  60832. const selectedStyle = vue.computed(() => ({
  60833. width: props.direction === "vertical" ? "100%" : `${state.width}px`,
  60834. height: props.direction === "vertical" ? `${state.height}px` : "100%",
  60835. transform: props.direction === "vertical" ? `translateY(${state.translateY}px)` : `translateX(${state.translateX}px)`,
  60836. display: state.isInit ? "block" : "none"
  60837. }));
  60838. const selectedCls = vue.computed(() => [
  60839. ns.e("item-selected"),
  60840. ns.is("disabled", getDisabled(getOption(props.modelValue))),
  60841. ns.is("focus-visible", state.focusVisible)
  60842. ]);
  60843. const name = vue.computed(() => {
  60844. return props.name || segmentedId.value;
  60845. });
  60846. useResizeObserver(segmentedRef, updateSelect);
  60847. vue.watch(activeElement, updateSelect);
  60848. vue.watch(() => props.modelValue, () => {
  60849. var _a;
  60850. updateSelect();
  60851. if (props.validateEvent) {
  60852. (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "change").catch((err) => debugWarn(err));
  60853. }
  60854. }, {
  60855. flush: "post"
  60856. });
  60857. return (_ctx, _cache) => {
  60858. return _ctx.options.length ? (vue.openBlock(), vue.createElementBlock("div", {
  60859. key: 0,
  60860. id: vue.unref(inputId),
  60861. ref_key: "segmentedRef",
  60862. ref: segmentedRef,
  60863. class: vue.normalizeClass(vue.unref(segmentedCls)),
  60864. role: "radiogroup",
  60865. "aria-label": !vue.unref(isLabeledByFormItem) ? _ctx.ariaLabel || "segmented" : void 0,
  60866. "aria-labelledby": vue.unref(isLabeledByFormItem) ? vue.unref(formItem).labelId : void 0
  60867. }, [
  60868. vue.createElementVNode("div", {
  60869. class: vue.normalizeClass([vue.unref(ns).e("group"), vue.unref(ns).m(_ctx.direction)])
  60870. }, [
  60871. vue.createElementVNode("div", {
  60872. style: vue.normalizeStyle(vue.unref(selectedStyle)),
  60873. class: vue.normalizeClass(vue.unref(selectedCls))
  60874. }, null, 6),
  60875. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.options, (item, index) => {
  60876. return vue.openBlock(), vue.createElementBlock("label", {
  60877. key: index,
  60878. class: vue.normalizeClass(getItemCls(item))
  60879. }, [
  60880. vue.createElementVNode("input", {
  60881. class: vue.normalizeClass(vue.unref(ns).e("item-input")),
  60882. type: "radio",
  60883. name: vue.unref(name),
  60884. disabled: getDisabled(item),
  60885. checked: getSelected(item),
  60886. onChange: ($event) => handleChange(item)
  60887. }, null, 42, ["name", "disabled", "checked", "onChange"]),
  60888. vue.createElementVNode("div", {
  60889. class: vue.normalizeClass(vue.unref(ns).e("item-label"))
  60890. }, [
  60891. vue.renderSlot(_ctx.$slots, "default", {
  60892. item: intoAny(item)
  60893. }, () => [
  60894. vue.createTextVNode(vue.toDisplayString(getLabel(item)), 1)
  60895. ])
  60896. ], 2)
  60897. ], 2);
  60898. }), 128))
  60899. ], 2)
  60900. ], 10, ["id", "aria-label", "aria-labelledby"])) : vue.createCommentVNode("v-if", true);
  60901. };
  60902. }
  60903. });
  60904. var Segmented = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__file", "segmented.vue"]]);
  60905. const ElSegmented = withInstall(Segmented);
  60906. const filterOption = (pattern, option) => {
  60907. const lowerCase = pattern.toLowerCase();
  60908. const label = option.label || option.value || "";
  60909. return label.toLowerCase().includes(lowerCase);
  60910. };
  60911. const getMentionCtx = (inputEl, prefix, split) => {
  60912. const { selectionEnd } = inputEl;
  60913. if (selectionEnd === null)
  60914. return;
  60915. const inputValue = inputEl.value;
  60916. const prefixArray = castArray$1(prefix);
  60917. let splitIndex = -1;
  60918. let mentionCtx;
  60919. for (let i = selectionEnd - 1; i >= 0; --i) {
  60920. const char = inputValue[i];
  60921. if (char === split || char === "\n" || char === "\r") {
  60922. splitIndex = i;
  60923. continue;
  60924. }
  60925. if (prefixArray.includes(char)) {
  60926. const end = splitIndex === -1 ? selectionEnd : splitIndex;
  60927. const pattern = inputValue.slice(i + 1, end);
  60928. mentionCtx = {
  60929. pattern,
  60930. start: i + 1,
  60931. end,
  60932. prefix: char,
  60933. prefixIndex: i,
  60934. splitIndex,
  60935. selectionEnd
  60936. };
  60937. break;
  60938. }
  60939. }
  60940. return mentionCtx;
  60941. };
  60942. const getCursorPosition = (element, options = {
  60943. debug: false,
  60944. useSelectionEnd: false
  60945. }) => {
  60946. const selectionStart = element.selectionStart !== null ? element.selectionStart : 0;
  60947. const selectionEnd = element.selectionEnd !== null ? element.selectionEnd : 0;
  60948. const position = options.useSelectionEnd ? selectionEnd : selectionStart;
  60949. const properties = [
  60950. "direction",
  60951. "boxSizing",
  60952. "width",
  60953. "height",
  60954. "overflowX",
  60955. "overflowY",
  60956. "borderTopWidth",
  60957. "borderRightWidth",
  60958. "borderBottomWidth",
  60959. "borderLeftWidth",
  60960. "borderStyle",
  60961. "paddingTop",
  60962. "paddingRight",
  60963. "paddingBottom",
  60964. "paddingLeft",
  60965. "fontStyle",
  60966. "fontVariant",
  60967. "fontWeight",
  60968. "fontStretch",
  60969. "fontSize",
  60970. "fontSizeAdjust",
  60971. "lineHeight",
  60972. "fontFamily",
  60973. "textAlign",
  60974. "textTransform",
  60975. "textIndent",
  60976. "textDecoration",
  60977. "letterSpacing",
  60978. "wordSpacing",
  60979. "tabSize",
  60980. "MozTabSize"
  60981. ];
  60982. if (options.debug) {
  60983. const el = document.querySelector("#input-textarea-caret-position-mirror-div");
  60984. if (el == null ? void 0 : el.parentNode)
  60985. el.parentNode.removeChild(el);
  60986. }
  60987. const div = document.createElement("div");
  60988. div.id = "input-textarea-caret-position-mirror-div";
  60989. document.body.appendChild(div);
  60990. const style = div.style;
  60991. const computed = window.getComputedStyle(element);
  60992. const isInput = element.nodeName === "INPUT";
  60993. style.whiteSpace = isInput ? "nowrap" : "pre-wrap";
  60994. if (!isInput)
  60995. style.wordWrap = "break-word";
  60996. style.position = "absolute";
  60997. if (!options.debug)
  60998. style.visibility = "hidden";
  60999. properties.forEach((prop) => {
  61000. if (isInput && prop === "lineHeight") {
  61001. if (computed.boxSizing === "border-box") {
  61002. const height = Number.parseInt(computed.height);
  61003. const outerHeight = Number.parseInt(computed.paddingTop) + Number.parseInt(computed.paddingBottom) + Number.parseInt(computed.borderTopWidth) + Number.parseInt(computed.borderBottomWidth);
  61004. const targetHeight = outerHeight + Number.parseInt(computed.lineHeight);
  61005. if (height > targetHeight) {
  61006. style.lineHeight = `${height - outerHeight}px`;
  61007. } else if (height === targetHeight) {
  61008. style.lineHeight = computed.lineHeight;
  61009. } else {
  61010. style.lineHeight = "0";
  61011. }
  61012. } else {
  61013. style.lineHeight = computed.height;
  61014. }
  61015. } else {
  61016. style[prop] = computed[prop];
  61017. }
  61018. });
  61019. if (isFirefox()) {
  61020. if (element.scrollHeight > Number.parseInt(computed.height)) {
  61021. style.overflowY = "scroll";
  61022. }
  61023. } else {
  61024. style.overflow = "hidden";
  61025. }
  61026. div.textContent = element.value.slice(0, Math.max(0, position));
  61027. if (isInput && div.textContent) {
  61028. div.textContent = div.textContent.replace(/\s/g, "\xA0");
  61029. }
  61030. const span = document.createElement("span");
  61031. span.textContent = element.value.slice(Math.max(0, position)) || ".";
  61032. span.style.position = "relative";
  61033. span.style.left = `${-element.scrollLeft}px`;
  61034. span.style.top = `${-element.scrollTop}px`;
  61035. div.appendChild(span);
  61036. const relativePosition = {
  61037. top: span.offsetTop + Number.parseInt(computed.borderTopWidth),
  61038. left: span.offsetLeft + Number.parseInt(computed.borderLeftWidth),
  61039. height: Number.parseInt(computed.fontSize) * 1.5
  61040. };
  61041. if (options.debug) {
  61042. span.style.backgroundColor = "#aaa";
  61043. } else {
  61044. document.body.removeChild(div);
  61045. }
  61046. if (relativePosition.left >= element.clientWidth) {
  61047. relativePosition.left = element.clientWidth;
  61048. }
  61049. return relativePosition;
  61050. };
  61051. const mentionProps = buildProps({
  61052. ...inputProps,
  61053. options: {
  61054. type: definePropType(Array),
  61055. default: () => []
  61056. },
  61057. prefix: {
  61058. type: definePropType([String, Array]),
  61059. default: "@",
  61060. validator: (val) => {
  61061. if (isString$1(val))
  61062. return val.length === 1;
  61063. return val.every((v) => isString$1(v) && v.length === 1);
  61064. }
  61065. },
  61066. split: {
  61067. type: String,
  61068. default: " ",
  61069. validator: (val) => val.length === 1
  61070. },
  61071. filterOption: {
  61072. type: definePropType([Boolean, Function]),
  61073. default: () => filterOption,
  61074. validator: (val) => {
  61075. if (val === false)
  61076. return true;
  61077. return isFunction$1(val);
  61078. }
  61079. },
  61080. placement: {
  61081. type: definePropType(String),
  61082. default: "bottom"
  61083. },
  61084. showArrow: Boolean,
  61085. offset: {
  61086. type: Number,
  61087. default: 0
  61088. },
  61089. whole: Boolean,
  61090. checkIsWhole: {
  61091. type: definePropType(Function)
  61092. },
  61093. modelValue: String,
  61094. loading: Boolean,
  61095. popperClass: useTooltipContentProps.popperClass,
  61096. popperStyle: useTooltipContentProps.popperStyle,
  61097. popperOptions: {
  61098. type: definePropType(Object),
  61099. default: () => ({})
  61100. },
  61101. props: {
  61102. type: definePropType(Object),
  61103. default: () => mentionDefaultProps
  61104. }
  61105. });
  61106. const mentionEmits = {
  61107. [UPDATE_MODEL_EVENT]: (value) => isString$1(value),
  61108. "whole-remove": (pattern, prefix) => isString$1(pattern) && isString$1(prefix),
  61109. input: (value) => isString$1(value),
  61110. search: (pattern, prefix) => isString$1(pattern) && isString$1(prefix),
  61111. select: (option, prefix) => isObject$1(option) && isString$1(prefix),
  61112. focus: (evt) => evt instanceof FocusEvent,
  61113. blur: (evt) => evt instanceof FocusEvent
  61114. };
  61115. const mentionDefaultProps = {
  61116. value: "value",
  61117. label: "label",
  61118. disabled: "disabled"
  61119. };
  61120. const mentionDropdownProps = buildProps({
  61121. options: {
  61122. type: definePropType(Array),
  61123. default: () => []
  61124. },
  61125. loading: Boolean,
  61126. disabled: Boolean,
  61127. contentId: String,
  61128. ariaLabel: String
  61129. });
  61130. const mentionDropdownEmits = {
  61131. select: (option) => isString$1(option.value)
  61132. };
  61133. const __default__$6 = vue.defineComponent({
  61134. name: "ElMentionDropdown"
  61135. });
  61136. const _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({
  61137. ...__default__$6,
  61138. props: mentionDropdownProps,
  61139. emits: mentionDropdownEmits,
  61140. setup(__props, { expose, emit }) {
  61141. const props = __props;
  61142. const ns = useNamespace("mention");
  61143. const { t } = useLocale();
  61144. const hoveringIndex = vue.ref(-1);
  61145. const scrollbarRef = vue.ref();
  61146. const optionRefs = vue.ref();
  61147. const dropdownRef = vue.ref();
  61148. const optionkls = (item, index) => [
  61149. ns.be("dropdown", "item"),
  61150. ns.is("hovering", hoveringIndex.value === index),
  61151. ns.is("disabled", item.disabled || props.disabled)
  61152. ];
  61153. const handleSelect = (item) => {
  61154. if (item.disabled || props.disabled)
  61155. return;
  61156. emit("select", item);
  61157. };
  61158. const handleMouseEnter = (index) => {
  61159. hoveringIndex.value = index;
  61160. };
  61161. const filteredAllDisabled = vue.computed(() => props.disabled || props.options.every((item) => item.disabled));
  61162. const hoverOption = vue.computed(() => props.options[hoveringIndex.value]);
  61163. const selectHoverOption = () => {
  61164. if (!hoverOption.value)
  61165. return;
  61166. emit("select", hoverOption.value);
  61167. };
  61168. const navigateOptions = (direction) => {
  61169. const { options } = props;
  61170. if (options.length === 0 || filteredAllDisabled.value)
  61171. return;
  61172. if (direction === "next") {
  61173. hoveringIndex.value++;
  61174. if (hoveringIndex.value === options.length) {
  61175. hoveringIndex.value = 0;
  61176. }
  61177. } else if (direction === "prev") {
  61178. hoveringIndex.value--;
  61179. if (hoveringIndex.value < 0) {
  61180. hoveringIndex.value = options.length - 1;
  61181. }
  61182. }
  61183. const option = options[hoveringIndex.value];
  61184. if (option.disabled) {
  61185. navigateOptions(direction);
  61186. return;
  61187. }
  61188. vue.nextTick(() => scrollToOption(option));
  61189. };
  61190. const scrollToOption = (option) => {
  61191. var _a, _b, _c, _d;
  61192. const { options } = props;
  61193. const index = options.findIndex((item) => item.value === option.value);
  61194. const target = (_a = optionRefs.value) == null ? void 0 : _a[index];
  61195. if (target) {
  61196. const menu = (_c = (_b = dropdownRef.value) == null ? void 0 : _b.querySelector) == null ? void 0 : _c.call(_b, `.${ns.be("dropdown", "wrap")}`);
  61197. if (menu) {
  61198. scrollIntoView(menu, target);
  61199. }
  61200. }
  61201. (_d = scrollbarRef.value) == null ? void 0 : _d.handleScroll();
  61202. };
  61203. const resetHoveringIndex = () => {
  61204. if (filteredAllDisabled.value || props.options.length === 0) {
  61205. hoveringIndex.value = -1;
  61206. } else {
  61207. hoveringIndex.value = 0;
  61208. }
  61209. };
  61210. vue.watch(() => props.options, resetHoveringIndex, {
  61211. immediate: true
  61212. });
  61213. expose({
  61214. hoveringIndex,
  61215. navigateOptions,
  61216. selectHoverOption,
  61217. hoverOption
  61218. });
  61219. return (_ctx, _cache) => {
  61220. return vue.openBlock(), vue.createElementBlock("div", {
  61221. ref_key: "dropdownRef",
  61222. ref: dropdownRef,
  61223. class: vue.normalizeClass(vue.unref(ns).b("dropdown"))
  61224. }, [
  61225. _ctx.$slots.header ? (vue.openBlock(), vue.createElementBlock("div", {
  61226. key: 0,
  61227. class: vue.normalizeClass(vue.unref(ns).be("dropdown", "header"))
  61228. }, [
  61229. vue.renderSlot(_ctx.$slots, "header")
  61230. ], 2)) : vue.createCommentVNode("v-if", true),
  61231. vue.withDirectives(vue.createVNode(vue.unref(ElScrollbar), {
  61232. id: _ctx.contentId,
  61233. ref_key: "scrollbarRef",
  61234. ref: scrollbarRef,
  61235. tag: "ul",
  61236. "wrap-class": vue.unref(ns).be("dropdown", "wrap"),
  61237. "view-class": vue.unref(ns).be("dropdown", "list"),
  61238. role: "listbox",
  61239. "aria-label": _ctx.ariaLabel,
  61240. "aria-orientation": "vertical"
  61241. }, {
  61242. default: vue.withCtx(() => [
  61243. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.options, (item, index) => {
  61244. return vue.openBlock(), vue.createElementBlock("li", {
  61245. id: `${_ctx.contentId}-${index}`,
  61246. ref_for: true,
  61247. ref_key: "optionRefs",
  61248. ref: optionRefs,
  61249. key: index,
  61250. class: vue.normalizeClass(optionkls(item, index)),
  61251. role: "option",
  61252. "aria-disabled": item.disabled || _ctx.disabled || void 0,
  61253. "aria-selected": hoveringIndex.value === index,
  61254. onMousemove: ($event) => handleMouseEnter(index),
  61255. onClick: vue.withModifiers(($event) => handleSelect(item), ["stop"])
  61256. }, [
  61257. vue.renderSlot(_ctx.$slots, "label", {
  61258. item,
  61259. index
  61260. }, () => {
  61261. var _a;
  61262. return [
  61263. vue.createElementVNode("span", null, vue.toDisplayString((_a = item.label) != null ? _a : item.value), 1)
  61264. ];
  61265. })
  61266. ], 42, ["id", "aria-disabled", "aria-selected", "onMousemove", "onClick"]);
  61267. }), 128))
  61268. ]),
  61269. _: 3
  61270. }, 8, ["id", "wrap-class", "view-class", "aria-label"]), [
  61271. [vue.vShow, _ctx.options.length > 0 && !_ctx.loading]
  61272. ]),
  61273. _ctx.loading ? (vue.openBlock(), vue.createElementBlock("div", {
  61274. key: 1,
  61275. class: vue.normalizeClass(vue.unref(ns).be("dropdown", "loading"))
  61276. }, [
  61277. vue.renderSlot(_ctx.$slots, "loading", {}, () => [
  61278. vue.createTextVNode(vue.toDisplayString(vue.unref(t)("el.mention.loading")), 1)
  61279. ])
  61280. ], 2)) : vue.createCommentVNode("v-if", true),
  61281. _ctx.$slots.footer ? (vue.openBlock(), vue.createElementBlock("div", {
  61282. key: 2,
  61283. class: vue.normalizeClass(vue.unref(ns).be("dropdown", "footer"))
  61284. }, [
  61285. vue.renderSlot(_ctx.$slots, "footer")
  61286. ], 2)) : vue.createCommentVNode("v-if", true)
  61287. ], 2);
  61288. };
  61289. }
  61290. });
  61291. var ElMentionDropdown = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__file", "mention-dropdown.vue"]]);
  61292. const __default__$5 = vue.defineComponent({
  61293. name: "ElMention",
  61294. inheritAttrs: false
  61295. });
  61296. const _sfc_main$6 = /* @__PURE__ */ vue.defineComponent({
  61297. ...__default__$5,
  61298. props: mentionProps,
  61299. emits: mentionEmits,
  61300. setup(__props, { expose, emit }) {
  61301. const props = __props;
  61302. const passInputProps = vue.computed(() => pick(props, Object.keys(inputProps)));
  61303. const ns = useNamespace("mention");
  61304. const disabled = useFormDisabled();
  61305. const contentId = useId();
  61306. const elInputRef = vue.ref();
  61307. const tooltipRef = vue.ref();
  61308. const dropdownRef = vue.ref();
  61309. const visible = vue.ref(false);
  61310. const cursorStyle = vue.ref();
  61311. const mentionCtx = vue.ref();
  61312. const computedPlacement = vue.computed(() => props.showArrow ? props.placement : `${props.placement}-start`);
  61313. const computedFallbackPlacements = vue.computed(() => props.showArrow ? ["bottom", "top"] : ["bottom-start", "top-start"]);
  61314. const aliasProps = vue.computed(() => ({
  61315. ...mentionDefaultProps,
  61316. ...props.props
  61317. }));
  61318. const mapOption = (option) => {
  61319. const base = {
  61320. label: option[aliasProps.value.label],
  61321. value: option[aliasProps.value.value],
  61322. disabled: option[aliasProps.value.disabled]
  61323. };
  61324. return { ...option, ...base };
  61325. };
  61326. const options = vue.computed(() => props.options.map(mapOption));
  61327. const filteredOptions = vue.computed(() => {
  61328. const { filterOption } = props;
  61329. if (!mentionCtx.value || !filterOption)
  61330. return options.value;
  61331. return options.value.filter((option) => filterOption(mentionCtx.value.pattern, option));
  61332. });
  61333. const dropdownVisible = vue.computed(() => {
  61334. return visible.value && (!!filteredOptions.value.length || props.loading);
  61335. });
  61336. const hoveringId = vue.computed(() => {
  61337. var _a;
  61338. return `${contentId.value}-${(_a = dropdownRef.value) == null ? void 0 : _a.hoveringIndex}`;
  61339. });
  61340. const handleInputChange = (value) => {
  61341. emit(UPDATE_MODEL_EVENT, value);
  61342. emit(INPUT_EVENT, value);
  61343. syncAfterCursorMove();
  61344. };
  61345. const handleInputKeyDown = (event) => {
  61346. var _a, _b, _c, _d;
  61347. if ((_a = elInputRef.value) == null ? void 0 : _a.isComposing)
  61348. return;
  61349. const code = getEventCode(event);
  61350. switch (code) {
  61351. case EVENT_CODE.left:
  61352. case EVENT_CODE.right:
  61353. syncAfterCursorMove();
  61354. break;
  61355. case EVENT_CODE.up:
  61356. case EVENT_CODE.down:
  61357. if (!visible.value)
  61358. return;
  61359. event.preventDefault();
  61360. (_b = dropdownRef.value) == null ? void 0 : _b.navigateOptions(code === EVENT_CODE.up ? "prev" : "next");
  61361. break;
  61362. case EVENT_CODE.enter:
  61363. case EVENT_CODE.numpadEnter:
  61364. if (!visible.value) {
  61365. props.type !== "textarea" && syncAfterCursorMove();
  61366. return;
  61367. }
  61368. event.preventDefault();
  61369. if ((_c = dropdownRef.value) == null ? void 0 : _c.hoverOption) {
  61370. (_d = dropdownRef.value) == null ? void 0 : _d.selectHoverOption();
  61371. } else {
  61372. visible.value = false;
  61373. }
  61374. break;
  61375. case EVENT_CODE.esc:
  61376. if (!visible.value)
  61377. return;
  61378. event.preventDefault();
  61379. visible.value = false;
  61380. break;
  61381. case EVENT_CODE.backspace:
  61382. if (props.whole && mentionCtx.value) {
  61383. const { splitIndex, selectionEnd, pattern, prefixIndex, prefix } = mentionCtx.value;
  61384. const inputEl = getInputEl();
  61385. if (!inputEl)
  61386. return;
  61387. const inputValue = inputEl.value;
  61388. const matchOption = options.value.find((item) => item.value === pattern);
  61389. const isWhole = isFunction$1(props.checkIsWhole) ? props.checkIsWhole(pattern, prefix) : matchOption;
  61390. if (isWhole && splitIndex !== -1 && splitIndex + 1 === selectionEnd) {
  61391. event.preventDefault();
  61392. const newValue = inputValue.slice(0, prefixIndex) + inputValue.slice(splitIndex + 1);
  61393. emit(UPDATE_MODEL_EVENT, newValue);
  61394. emit(INPUT_EVENT, newValue);
  61395. emit("whole-remove", pattern, prefix);
  61396. const newSelectionEnd = prefixIndex;
  61397. vue.nextTick(() => {
  61398. inputEl.selectionStart = newSelectionEnd;
  61399. inputEl.selectionEnd = newSelectionEnd;
  61400. syncDropdownVisible();
  61401. });
  61402. }
  61403. }
  61404. }
  61405. };
  61406. const { wrapperRef } = useFocusController(elInputRef, {
  61407. disabled,
  61408. afterFocus() {
  61409. syncAfterCursorMove();
  61410. },
  61411. beforeBlur(event) {
  61412. var _a;
  61413. return (_a = tooltipRef.value) == null ? void 0 : _a.isFocusInsideContent(event);
  61414. },
  61415. afterBlur() {
  61416. visible.value = false;
  61417. }
  61418. });
  61419. const handleInputMouseDown = () => {
  61420. syncAfterCursorMove();
  61421. };
  61422. const getOriginalOption = (mentionOption) => {
  61423. return props.options.find((option) => {
  61424. return mentionOption.value === option[aliasProps.value.value];
  61425. });
  61426. };
  61427. const handleSelect = (item) => {
  61428. if (!mentionCtx.value)
  61429. return;
  61430. const inputEl = getInputEl();
  61431. if (!inputEl)
  61432. return;
  61433. const inputValue = inputEl.value;
  61434. const { split } = props;
  61435. const newEndPart = inputValue.slice(mentionCtx.value.end);
  61436. const alreadySeparated = newEndPart.startsWith(split);
  61437. const newMiddlePart = `${item.value}${alreadySeparated ? "" : split}`;
  61438. const newValue = inputValue.slice(0, mentionCtx.value.start) + newMiddlePart + newEndPart;
  61439. emit(UPDATE_MODEL_EVENT, newValue);
  61440. emit(INPUT_EVENT, newValue);
  61441. emit("select", getOriginalOption(item), mentionCtx.value.prefix);
  61442. const newSelectionEnd = mentionCtx.value.start + newMiddlePart.length + (alreadySeparated ? 1 : 0);
  61443. vue.nextTick(() => {
  61444. inputEl.selectionStart = newSelectionEnd;
  61445. inputEl.selectionEnd = newSelectionEnd;
  61446. inputEl.focus();
  61447. syncDropdownVisible();
  61448. });
  61449. };
  61450. const getInputEl = () => {
  61451. var _a, _b;
  61452. return props.type === "textarea" ? (_a = elInputRef.value) == null ? void 0 : _a.textarea : (_b = elInputRef.value) == null ? void 0 : _b.input;
  61453. };
  61454. const syncAfterCursorMove = () => {
  61455. setTimeout(() => {
  61456. syncCursor();
  61457. syncDropdownVisible();
  61458. vue.nextTick(() => {
  61459. var _a;
  61460. return (_a = tooltipRef.value) == null ? void 0 : _a.updatePopper();
  61461. });
  61462. }, 0);
  61463. };
  61464. const syncCursor = () => {
  61465. const inputEl = getInputEl();
  61466. if (!inputEl)
  61467. return;
  61468. const caretPosition = getCursorPosition(inputEl);
  61469. const inputRect = inputEl.getBoundingClientRect();
  61470. const wrapperRect = wrapperRef.value.getBoundingClientRect();
  61471. cursorStyle.value = {
  61472. position: "absolute",
  61473. width: 0,
  61474. height: `${caretPosition.height}px`,
  61475. left: `${caretPosition.left + inputRect.left - wrapperRect.left}px`,
  61476. top: `${caretPosition.top + inputRect.top - wrapperRect.top}px`
  61477. };
  61478. };
  61479. const syncDropdownVisible = () => {
  61480. const inputEl = getInputEl();
  61481. if (document.activeElement !== inputEl) {
  61482. visible.value = false;
  61483. return;
  61484. }
  61485. const { prefix, split } = props;
  61486. mentionCtx.value = getMentionCtx(inputEl, prefix, split);
  61487. if (mentionCtx.value && mentionCtx.value.splitIndex === -1) {
  61488. visible.value = true;
  61489. emit("search", mentionCtx.value.pattern, mentionCtx.value.prefix);
  61490. return;
  61491. }
  61492. visible.value = false;
  61493. };
  61494. expose({
  61495. input: elInputRef,
  61496. tooltip: tooltipRef,
  61497. dropdownVisible
  61498. });
  61499. return (_ctx, _cache) => {
  61500. return vue.openBlock(), vue.createElementBlock("div", {
  61501. ref_key: "wrapperRef",
  61502. ref: wrapperRef,
  61503. class: vue.normalizeClass(vue.unref(ns).b())
  61504. }, [
  61505. vue.createVNode(vue.unref(ElInput), vue.mergeProps(vue.mergeProps(vue.unref(passInputProps), _ctx.$attrs), {
  61506. ref_key: "elInputRef",
  61507. ref: elInputRef,
  61508. "model-value": _ctx.modelValue,
  61509. disabled: vue.unref(disabled),
  61510. role: vue.unref(dropdownVisible) ? "combobox" : void 0,
  61511. "aria-activedescendant": vue.unref(dropdownVisible) ? vue.unref(hoveringId) || "" : void 0,
  61512. "aria-controls": vue.unref(dropdownVisible) ? vue.unref(contentId) : void 0,
  61513. "aria-expanded": vue.unref(dropdownVisible) || void 0,
  61514. "aria-label": _ctx.ariaLabel,
  61515. "aria-autocomplete": vue.unref(dropdownVisible) ? "none" : void 0,
  61516. "aria-haspopup": vue.unref(dropdownVisible) ? "listbox" : void 0,
  61517. onInput: handleInputChange,
  61518. onKeydown: handleInputKeyDown,
  61519. onMousedown: handleInputMouseDown
  61520. }), vue.createSlots({
  61521. _: 2
  61522. }, [
  61523. vue.renderList(_ctx.$slots, (_, name) => {
  61524. return {
  61525. name,
  61526. fn: vue.withCtx((slotProps) => [
  61527. vue.renderSlot(_ctx.$slots, name, vue.normalizeProps(vue.guardReactiveProps(slotProps)))
  61528. ])
  61529. };
  61530. })
  61531. ]), 1040, ["model-value", "disabled", "role", "aria-activedescendant", "aria-controls", "aria-expanded", "aria-label", "aria-autocomplete", "aria-haspopup"]),
  61532. vue.createVNode(vue.unref(ElTooltip), {
  61533. ref_key: "tooltipRef",
  61534. ref: tooltipRef,
  61535. visible: vue.unref(dropdownVisible),
  61536. "popper-class": [vue.unref(ns).e("popper"), _ctx.popperClass],
  61537. "popper-style": _ctx.popperStyle,
  61538. "popper-options": _ctx.popperOptions,
  61539. placement: vue.unref(computedPlacement),
  61540. "fallback-placements": vue.unref(computedFallbackPlacements),
  61541. effect: "light",
  61542. pure: "",
  61543. offset: _ctx.offset,
  61544. "show-arrow": _ctx.showArrow
  61545. }, {
  61546. default: vue.withCtx(() => [
  61547. vue.createElementVNode("div", {
  61548. style: vue.normalizeStyle(cursorStyle.value)
  61549. }, null, 4)
  61550. ]),
  61551. content: vue.withCtx(() => {
  61552. var _a;
  61553. return [
  61554. vue.createVNode(ElMentionDropdown, {
  61555. ref_key: "dropdownRef",
  61556. ref: dropdownRef,
  61557. options: vue.unref(filteredOptions),
  61558. disabled: vue.unref(disabled),
  61559. loading: _ctx.loading,
  61560. "content-id": vue.unref(contentId),
  61561. "aria-label": _ctx.ariaLabel,
  61562. onSelect: handleSelect,
  61563. onClick: vue.withModifiers((_a = elInputRef.value) == null ? void 0 : _a.focus, ["stop"])
  61564. }, vue.createSlots({
  61565. _: 2
  61566. }, [
  61567. vue.renderList(_ctx.$slots, (_, name) => {
  61568. return {
  61569. name,
  61570. fn: vue.withCtx((slotProps) => [
  61571. vue.renderSlot(_ctx.$slots, name, vue.normalizeProps(vue.guardReactiveProps(slotProps)))
  61572. ])
  61573. };
  61574. })
  61575. ]), 1032, ["options", "disabled", "loading", "content-id", "aria-label", "onClick"])
  61576. ];
  61577. }),
  61578. _: 3
  61579. }, 8, ["visible", "popper-class", "popper-style", "popper-options", "placement", "fallback-placements", "offset", "show-arrow"])
  61580. ], 2);
  61581. };
  61582. }
  61583. });
  61584. var Mention = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__file", "mention.vue"]]);
  61585. const ElMention = withInstall(Mention);
  61586. function useContainer(layout) {
  61587. const containerEl = vue.ref();
  61588. const { width, height } = useElementSize(containerEl);
  61589. const containerSize = vue.computed(() => {
  61590. return layout.value === "horizontal" ? width.value : height.value;
  61591. });
  61592. return { containerEl, containerSize };
  61593. }
  61594. function getPct(str) {
  61595. return Number(str.slice(0, -1)) / 100;
  61596. }
  61597. function getPx(str) {
  61598. return Number(str.slice(0, -2));
  61599. }
  61600. function isPct(itemSize) {
  61601. return isString$1(itemSize) && itemSize.endsWith("%");
  61602. }
  61603. function isPx(itemSize) {
  61604. return isString$1(itemSize) && itemSize.endsWith("px");
  61605. }
  61606. function useSize(panels, containerSize) {
  61607. const propSizes = vue.computed(() => panels.value.map((i) => i.size));
  61608. const panelCounts = vue.computed(() => panels.value.length);
  61609. const percentSizes = vue.ref([]);
  61610. vue.watch([propSizes, panelCounts, containerSize], () => {
  61611. var _a;
  61612. let ptgList = [];
  61613. let emptyCount = 0;
  61614. for (let i = 0; i < panelCounts.value; i += 1) {
  61615. const itemSize = (_a = panels.value[i]) == null ? void 0 : _a.size;
  61616. if (isPct(itemSize)) {
  61617. ptgList[i] = getPct(itemSize);
  61618. } else if (isPx(itemSize)) {
  61619. ptgList[i] = getPx(itemSize) / containerSize.value;
  61620. } else if (itemSize || itemSize === 0) {
  61621. const num = Number(itemSize);
  61622. if (!Number.isNaN(num)) {
  61623. ptgList[i] = num / containerSize.value;
  61624. }
  61625. } else {
  61626. emptyCount += 1;
  61627. ptgList[i] = void 0;
  61628. }
  61629. }
  61630. const totalPtg = ptgList.reduce((acc, ptg) => acc + (ptg || 0), 0);
  61631. if (totalPtg > 1 || !emptyCount) {
  61632. const scale = 1 / totalPtg;
  61633. ptgList = ptgList.map((ptg) => ptg === void 0 ? 0 : ptg * scale);
  61634. } else {
  61635. const avgRest = (1 - totalPtg) / emptyCount;
  61636. ptgList = ptgList.map((ptg) => ptg === void 0 ? avgRest : ptg);
  61637. }
  61638. percentSizes.value = ptgList;
  61639. });
  61640. const ptg2px = (ptg) => ptg * containerSize.value;
  61641. const pxSizes = vue.computed(() => percentSizes.value.map(ptg2px));
  61642. return { percentSizes, pxSizes };
  61643. }
  61644. function useResize(panels, containerSize, pxSizes, lazy) {
  61645. const ptg2px = (ptg) => ptg * containerSize.value || 0;
  61646. function getLimitSize(str, defaultLimit) {
  61647. if (isPct(str)) {
  61648. return ptg2px(getPct(str));
  61649. } else if (isPx(str)) {
  61650. return getPx(str);
  61651. }
  61652. return str != null ? str : defaultLimit;
  61653. }
  61654. const lazyOffset = vue.ref(0);
  61655. const movingIndex = vue.ref(null);
  61656. let cachePxSizes = [];
  61657. let updatePanelSizes = NOOP;
  61658. const limitSizes = vue.computed(() => panels.value.map((item) => [item.min, item.max]));
  61659. vue.watch(lazy, () => {
  61660. if (lazyOffset.value) {
  61661. const mouseup = new MouseEvent("mouseup", { bubbles: true });
  61662. window.dispatchEvent(mouseup);
  61663. }
  61664. });
  61665. const onMoveStart = (index) => {
  61666. lazyOffset.value = 0;
  61667. movingIndex.value = { index, confirmed: false };
  61668. cachePxSizes = pxSizes.value;
  61669. };
  61670. const onMoving = (index, offset) => {
  61671. var _a, _b;
  61672. let confirmedIndex = null;
  61673. if ((!movingIndex.value || !movingIndex.value.confirmed) && offset !== 0) {
  61674. if (offset > 0) {
  61675. confirmedIndex = index;
  61676. movingIndex.value = { index, confirmed: true };
  61677. } else {
  61678. for (let i = index; i >= 0; i -= 1) {
  61679. if (cachePxSizes[i] > 0) {
  61680. confirmedIndex = i;
  61681. movingIndex.value = { index: i, confirmed: true };
  61682. break;
  61683. }
  61684. }
  61685. }
  61686. }
  61687. const mergedIndex = (_b = confirmedIndex != null ? confirmedIndex : (_a = movingIndex.value) == null ? void 0 : _a.index) != null ? _b : index;
  61688. const numSizes = [...cachePxSizes];
  61689. const nextIndex = mergedIndex + 1;
  61690. const startMinSize = getLimitSize(limitSizes.value[mergedIndex][0], 0);
  61691. const endMinSize = getLimitSize(limitSizes.value[nextIndex][0], 0);
  61692. const startMaxSize = getLimitSize(limitSizes.value[mergedIndex][1], containerSize.value || 0);
  61693. const endMaxSize = getLimitSize(limitSizes.value[nextIndex][1], containerSize.value || 0);
  61694. let mergedOffset = offset;
  61695. if (numSizes[mergedIndex] + mergedOffset < startMinSize) {
  61696. mergedOffset = startMinSize - numSizes[mergedIndex];
  61697. }
  61698. if (numSizes[nextIndex] - mergedOffset < endMinSize) {
  61699. mergedOffset = numSizes[nextIndex] - endMinSize;
  61700. }
  61701. if (numSizes[mergedIndex] + mergedOffset > startMaxSize) {
  61702. mergedOffset = startMaxSize - numSizes[mergedIndex];
  61703. }
  61704. if (numSizes[nextIndex] - mergedOffset > endMaxSize) {
  61705. mergedOffset = numSizes[nextIndex] - endMaxSize;
  61706. }
  61707. numSizes[mergedIndex] += mergedOffset;
  61708. numSizes[nextIndex] -= mergedOffset;
  61709. lazyOffset.value = mergedOffset;
  61710. updatePanelSizes = () => {
  61711. panels.value.forEach((panel, index2) => {
  61712. panel.size = numSizes[index2];
  61713. });
  61714. updatePanelSizes = NOOP;
  61715. };
  61716. if (!lazy.value) {
  61717. updatePanelSizes();
  61718. }
  61719. };
  61720. const onMoveEnd = () => {
  61721. if (lazy.value) {
  61722. updatePanelSizes();
  61723. }
  61724. lazyOffset.value = 0;
  61725. movingIndex.value = null;
  61726. cachePxSizes = [];
  61727. };
  61728. const cacheCollapsedSize = [];
  61729. const onCollapse = (index, type) => {
  61730. if (!cacheCollapsedSize.length) {
  61731. cacheCollapsedSize.push(...pxSizes.value);
  61732. }
  61733. const currentSizes = pxSizes.value;
  61734. const currentIndex = type === "start" ? index : index + 1;
  61735. const targetIndex = type === "start" ? index + 1 : index;
  61736. const currentSize = currentSizes[currentIndex];
  61737. const targetSize = currentSizes[targetIndex];
  61738. if (currentSize !== 0 && targetSize !== 0) {
  61739. currentSizes[currentIndex] = 0;
  61740. currentSizes[targetIndex] += currentSize;
  61741. cacheCollapsedSize[index] = currentSize;
  61742. } else {
  61743. const totalSize = currentSize + targetSize;
  61744. const targetCacheCollapsedSize = cacheCollapsedSize[index];
  61745. const currentCacheCollapsedSize = totalSize - targetCacheCollapsedSize;
  61746. currentSizes[targetIndex] = targetCacheCollapsedSize;
  61747. currentSizes[currentIndex] = currentCacheCollapsedSize;
  61748. }
  61749. panels.value.forEach((panel, index2) => {
  61750. panel.size = currentSizes[index2];
  61751. });
  61752. };
  61753. return {
  61754. lazyOffset,
  61755. onMoveStart,
  61756. onMoving,
  61757. onMoveEnd,
  61758. movingIndex,
  61759. onCollapse
  61760. };
  61761. }
  61762. const splitterProps = buildProps({
  61763. layout: {
  61764. type: String,
  61765. default: "horizontal",
  61766. values: ["horizontal", "vertical"]
  61767. },
  61768. lazy: Boolean
  61769. });
  61770. const splitterRootContextKey = Symbol("splitterRootContextKey");
  61771. const __default__$4 = vue.defineComponent({
  61772. name: "ElSplitter"
  61773. });
  61774. const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
  61775. ...__default__$4,
  61776. props: splitterProps,
  61777. emits: ["resizeStart", "resize", "resizeEnd", "collapse"],
  61778. setup(__props, { emit: emits }) {
  61779. const props = __props;
  61780. const ns = useNamespace("splitter");
  61781. const layout = vue.toRef(props, "layout");
  61782. const lazy = vue.toRef(props, "lazy");
  61783. const { containerEl, containerSize } = useContainer(layout);
  61784. const {
  61785. removeChild: unregisterPanel,
  61786. children: panels,
  61787. addChild: registerPanel,
  61788. ChildrenSorter: PanelsSorter
  61789. } = useOrderedChildren(vue.getCurrentInstance(), "ElSplitterPanel");
  61790. vue.watch(panels, () => {
  61791. panels.value.forEach((instance, index) => {
  61792. instance.setIndex(index);
  61793. });
  61794. });
  61795. const { percentSizes, pxSizes } = useSize(panels, containerSize);
  61796. const {
  61797. lazyOffset,
  61798. movingIndex,
  61799. onMoveStart,
  61800. onMoving,
  61801. onMoveEnd,
  61802. onCollapse
  61803. } = useResize(panels, containerSize, pxSizes, lazy);
  61804. const splitterStyles = vue.computed(() => {
  61805. return {
  61806. [ns.cssVarBlockName("bar-offset")]: lazy.value ? `${lazyOffset.value}px` : void 0
  61807. };
  61808. });
  61809. const onResizeStart = (index) => {
  61810. onMoveStart(index);
  61811. emits("resizeStart", index, pxSizes.value);
  61812. };
  61813. const onResize = (index, offset) => {
  61814. onMoving(index, offset);
  61815. if (!lazy.value) {
  61816. emits("resize", index, pxSizes.value);
  61817. }
  61818. };
  61819. const onResizeEnd = async (index) => {
  61820. onMoveEnd();
  61821. await vue.nextTick();
  61822. emits("resizeEnd", index, pxSizes.value);
  61823. };
  61824. const onCollapsible = (index, type) => {
  61825. onCollapse(index, type);
  61826. emits("collapse", index, type, pxSizes.value);
  61827. };
  61828. vue.provide(splitterRootContextKey, vue.reactive({
  61829. panels,
  61830. percentSizes,
  61831. pxSizes,
  61832. layout,
  61833. lazy,
  61834. movingIndex,
  61835. containerSize,
  61836. onMoveStart: onResizeStart,
  61837. onMoving: onResize,
  61838. onMoveEnd: onResizeEnd,
  61839. onCollapse: onCollapsible,
  61840. registerPanel,
  61841. unregisterPanel
  61842. }));
  61843. return (_ctx, _cache) => {
  61844. return vue.openBlock(), vue.createElementBlock("div", {
  61845. ref_key: "containerEl",
  61846. ref: containerEl,
  61847. class: vue.normalizeClass([vue.unref(ns).b(), vue.unref(ns).e(vue.unref(layout))]),
  61848. style: vue.normalizeStyle(vue.unref(splitterStyles))
  61849. }, [
  61850. vue.renderSlot(_ctx.$slots, "default"),
  61851. vue.createVNode(vue.unref(PanelsSorter)),
  61852. vue.createCommentVNode(" Prevent iframe touch events from breaking "),
  61853. vue.unref(movingIndex) ? (vue.openBlock(), vue.createElementBlock("div", {
  61854. key: 0,
  61855. class: vue.normalizeClass([vue.unref(ns).e("mask"), vue.unref(ns).e(`mask-${vue.unref(layout)}`)])
  61856. }, null, 2)) : vue.createCommentVNode("v-if", true)
  61857. ], 6);
  61858. };
  61859. }
  61860. });
  61861. var Splitter = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__file", "splitter.vue"]]);
  61862. function getCollapsible(collapsible) {
  61863. if (collapsible && isObject$1(collapsible)) {
  61864. return collapsible;
  61865. }
  61866. return {
  61867. start: !!collapsible,
  61868. end: !!collapsible
  61869. };
  61870. }
  61871. function isCollapsible(panel, size, nextPanel, nextSize) {
  61872. if ((panel == null ? void 0 : panel.collapsible.end) && size > 0) {
  61873. return true;
  61874. }
  61875. if ((nextPanel == null ? void 0 : nextPanel.collapsible.start) && nextSize === 0 && size > 0) {
  61876. return true;
  61877. }
  61878. return false;
  61879. }
  61880. const __default__$3 = vue.defineComponent({
  61881. name: "ElSplitterBar"
  61882. });
  61883. const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
  61884. ...__default__$3,
  61885. props: {
  61886. index: {
  61887. type: Number,
  61888. required: true
  61889. },
  61890. layout: {
  61891. type: String,
  61892. values: ["horizontal", "vertical"],
  61893. default: "horizontal"
  61894. },
  61895. resizable: {
  61896. type: Boolean,
  61897. default: true
  61898. },
  61899. lazy: Boolean,
  61900. startCollapsible: Boolean,
  61901. endCollapsible: Boolean
  61902. },
  61903. emits: ["moveStart", "moving", "moveEnd", "collapse"],
  61904. setup(__props, { emit }) {
  61905. const props = __props;
  61906. const ns = useNamespace("splitter-bar");
  61907. const isHorizontal = vue.computed(() => props.layout === "horizontal");
  61908. const barWrapStyles = vue.computed(() => {
  61909. if (isHorizontal.value) {
  61910. return { width: 0 };
  61911. }
  61912. return { height: 0 };
  61913. });
  61914. const draggerStyles = vue.computed(() => {
  61915. return {
  61916. width: isHorizontal.value ? "16px" : "100%",
  61917. height: isHorizontal.value ? "100%" : "16px",
  61918. cursor: !props.resizable ? "auto" : isHorizontal.value ? "ew-resize" : "ns-resize",
  61919. touchAction: "none"
  61920. };
  61921. });
  61922. const draggerPseudoClass = vue.computed(() => {
  61923. const prefix = ns.e("dragger");
  61924. return {
  61925. [`${prefix}-horizontal`]: isHorizontal.value,
  61926. [`${prefix}-vertical`]: !isHorizontal.value,
  61927. [`${prefix}-active`]: !!startPos.value
  61928. };
  61929. });
  61930. const startPos = vue.ref(null);
  61931. const onMousedown = (e) => {
  61932. if (!props.resizable)
  61933. return;
  61934. startPos.value = [e.pageX, e.pageY];
  61935. emit("moveStart", props.index);
  61936. window.addEventListener("mouseup", onMouseUp);
  61937. window.addEventListener("mousemove", onMouseMove);
  61938. };
  61939. const onTouchStart = (e) => {
  61940. if (props.resizable && e.touches.length === 1) {
  61941. e.preventDefault();
  61942. const touch = e.touches[0];
  61943. startPos.value = [touch.pageX, touch.pageY];
  61944. emit("moveStart", props.index);
  61945. window.addEventListener("touchend", onTouchEnd);
  61946. window.addEventListener("touchmove", onTouchMove);
  61947. }
  61948. };
  61949. const onMouseMove = (e) => {
  61950. const { pageX, pageY } = e;
  61951. const offsetX = pageX - startPos.value[0];
  61952. const offsetY = pageY - startPos.value[1];
  61953. const offset = isHorizontal.value ? offsetX : offsetY;
  61954. emit("moving", props.index, offset);
  61955. };
  61956. const onTouchMove = (e) => {
  61957. if (e.touches.length === 1) {
  61958. e.preventDefault();
  61959. const touch = e.touches[0];
  61960. const offsetX = touch.pageX - startPos.value[0];
  61961. const offsetY = touch.pageY - startPos.value[1];
  61962. const offset = isHorizontal.value ? offsetX : offsetY;
  61963. emit("moving", props.index, offset);
  61964. }
  61965. };
  61966. const onMouseUp = () => {
  61967. startPos.value = null;
  61968. window.removeEventListener("mouseup", onMouseUp);
  61969. window.removeEventListener("mousemove", onMouseMove);
  61970. emit("moveEnd", props.index);
  61971. };
  61972. const onTouchEnd = () => {
  61973. startPos.value = null;
  61974. window.removeEventListener("touchend", onTouchEnd);
  61975. window.removeEventListener("touchmove", onTouchMove);
  61976. emit("moveEnd", props.index);
  61977. };
  61978. const StartIcon = vue.computed(() => isHorizontal.value ? arrow_left_default : arrow_up_default);
  61979. const EndIcon = vue.computed(() => isHorizontal.value ? arrow_right_default : arrow_down_default);
  61980. return (_ctx, _cache) => {
  61981. return vue.openBlock(), vue.createElementBlock("div", {
  61982. class: vue.normalizeClass([vue.unref(ns).b()]),
  61983. style: vue.normalizeStyle(vue.unref(barWrapStyles))
  61984. }, [
  61985. __props.startCollapsible ? (vue.openBlock(), vue.createElementBlock("div", {
  61986. key: 0,
  61987. class: vue.normalizeClass([vue.unref(ns).e("collapse-icon"), vue.unref(ns).e(`${__props.layout}-collapse-icon-start`)]),
  61988. onClick: ($event) => emit("collapse", __props.index, "start")
  61989. }, [
  61990. vue.renderSlot(_ctx.$slots, "start-collapsible", {}, () => [
  61991. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(StartIcon)), { style: { "width": "12px", "height": "12px" } }))
  61992. ])
  61993. ], 10, ["onClick"])) : vue.createCommentVNode("v-if", true),
  61994. vue.createElementVNode("div", {
  61995. class: vue.normalizeClass([
  61996. vue.unref(ns).e("dragger"),
  61997. vue.unref(draggerPseudoClass),
  61998. vue.unref(ns).is("disabled", !__props.resizable),
  61999. vue.unref(ns).is("lazy", __props.resizable && __props.lazy)
  62000. ]),
  62001. style: vue.normalizeStyle(vue.unref(draggerStyles)),
  62002. onMousedown,
  62003. onTouchstart: onTouchStart
  62004. }, null, 38),
  62005. __props.endCollapsible ? (vue.openBlock(), vue.createElementBlock("div", {
  62006. key: 1,
  62007. class: vue.normalizeClass([vue.unref(ns).e("collapse-icon"), vue.unref(ns).e(`${__props.layout}-collapse-icon-end`)]),
  62008. onClick: ($event) => emit("collapse", __props.index, "end")
  62009. }, [
  62010. vue.renderSlot(_ctx.$slots, "end-collapsible", {}, () => [
  62011. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(EndIcon)), { style: { "width": "12px", "height": "12px" } }))
  62012. ])
  62013. ], 10, ["onClick"])) : vue.createCommentVNode("v-if", true)
  62014. ], 6);
  62015. };
  62016. }
  62017. });
  62018. var SplitBar = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__file", "split-bar.vue"]]);
  62019. const splitterPanelProps = buildProps({
  62020. min: {
  62021. type: [String, Number]
  62022. },
  62023. max: {
  62024. type: [String, Number]
  62025. },
  62026. size: {
  62027. type: [String, Number]
  62028. },
  62029. resizable: {
  62030. type: Boolean,
  62031. default: true
  62032. },
  62033. collapsible: Boolean
  62034. });
  62035. const COMPONENT_NAME = "ElSplitterPanel";
  62036. const __default__$2 = vue.defineComponent({
  62037. name: COMPONENT_NAME
  62038. });
  62039. const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
  62040. ...__default__$2,
  62041. props: splitterPanelProps,
  62042. emits: ["update:size"],
  62043. setup(__props, { emit: emits }) {
  62044. const props = __props;
  62045. const ns = useNamespace("splitter-panel");
  62046. const splitterContext = vue.inject(splitterRootContextKey);
  62047. if (!splitterContext)
  62048. throwError(COMPONENT_NAME, "usage: <el-splitter><el-splitter-panel /></el-splitter/>");
  62049. const { panels, layout, lazy, containerSize, pxSizes } = vue.toRefs(splitterContext);
  62050. const {
  62051. registerPanel,
  62052. unregisterPanel,
  62053. onCollapse,
  62054. onMoveEnd,
  62055. onMoveStart,
  62056. onMoving
  62057. } = splitterContext;
  62058. const panelEl = vue.ref();
  62059. const instance = vue.getCurrentInstance();
  62060. const uid = instance.uid;
  62061. const index = vue.ref(0);
  62062. const panel = vue.computed(() => panels.value[index.value]);
  62063. const setIndex = (val) => {
  62064. index.value = val;
  62065. };
  62066. const panelSize = vue.computed(() => {
  62067. var _a;
  62068. if (!panel.value)
  62069. return 0;
  62070. return (_a = pxSizes.value[index.value]) != null ? _a : 0;
  62071. });
  62072. const nextSize = vue.computed(() => {
  62073. var _a;
  62074. if (!panel.value)
  62075. return 0;
  62076. return (_a = pxSizes.value[index.value + 1]) != null ? _a : 0;
  62077. });
  62078. const nextPanel = vue.computed(() => {
  62079. if (panel.value) {
  62080. return panels.value[index.value + 1];
  62081. }
  62082. return null;
  62083. });
  62084. const isResizable = vue.computed(() => {
  62085. var _a;
  62086. if (!nextPanel.value)
  62087. return false;
  62088. return props.resizable && ((_a = nextPanel.value) == null ? void 0 : _a.resizable) && (panelSize.value !== 0 || !props.min) && (nextSize.value !== 0 || !nextPanel.value.min);
  62089. });
  62090. const isShowBar = vue.computed(() => {
  62091. if (!panel.value)
  62092. return false;
  62093. return index.value !== panels.value.length - 1;
  62094. });
  62095. const startCollapsible = vue.computed(() => isCollapsible(panel.value, panelSize.value, nextPanel.value, nextSize.value));
  62096. const endCollapsible = vue.computed(() => isCollapsible(nextPanel.value, nextSize.value, panel.value, panelSize.value));
  62097. function sizeToPx(str) {
  62098. if (isPct(str)) {
  62099. return getPct(str) * containerSize.value || 0;
  62100. } else if (isPx(str)) {
  62101. return getPx(str);
  62102. }
  62103. return str != null ? str : 0;
  62104. }
  62105. let isSizeUpdating = false;
  62106. vue.watch(() => props.size, () => {
  62107. if (!isSizeUpdating && panel.value) {
  62108. if (!containerSize.value) {
  62109. panel.value.size = props.size;
  62110. return;
  62111. }
  62112. const size = sizeToPx(props.size);
  62113. const maxSize = sizeToPx(props.max);
  62114. const minSize = sizeToPx(props.min);
  62115. const finalSize = Math.min(Math.max(size, minSize || 0), maxSize || size);
  62116. if (finalSize !== size) {
  62117. emits("update:size", finalSize);
  62118. }
  62119. panel.value.size = finalSize;
  62120. }
  62121. });
  62122. vue.watch(() => {
  62123. var _a;
  62124. return (_a = panel.value) == null ? void 0 : _a.size;
  62125. }, (val) => {
  62126. if (val !== props.size) {
  62127. isSizeUpdating = true;
  62128. emits("update:size", val);
  62129. vue.nextTick(() => isSizeUpdating = false);
  62130. }
  62131. });
  62132. vue.watch(() => props.resizable, (val) => {
  62133. if (panel.value) {
  62134. panel.value.resizable = val;
  62135. }
  62136. });
  62137. const _panel = vue.reactive({
  62138. el: panelEl.value,
  62139. uid,
  62140. getVnode: () => instance.vnode,
  62141. setIndex,
  62142. ...props,
  62143. collapsible: vue.computed(() => getCollapsible(props.collapsible))
  62144. });
  62145. registerPanel(_panel);
  62146. vue.onBeforeUnmount(() => unregisterPanel(_panel));
  62147. return (_ctx, _cache) => {
  62148. return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
  62149. vue.createElementVNode("div", vue.mergeProps({
  62150. ref_key: "panelEl",
  62151. ref: panelEl,
  62152. class: [vue.unref(ns).b()],
  62153. style: { flexBasis: `${vue.unref(panelSize)}px` }
  62154. }, _ctx.$attrs), [
  62155. vue.renderSlot(_ctx.$slots, "default")
  62156. ], 16),
  62157. vue.unref(isShowBar) ? (vue.openBlock(), vue.createBlock(SplitBar, {
  62158. key: 0,
  62159. index: index.value,
  62160. layout: vue.unref(layout),
  62161. lazy: vue.unref(lazy),
  62162. resizable: vue.unref(isResizable),
  62163. "start-collapsible": vue.unref(startCollapsible),
  62164. "end-collapsible": vue.unref(endCollapsible),
  62165. onMoveStart: vue.unref(onMoveStart),
  62166. onMoving: vue.unref(onMoving),
  62167. onMoveEnd: vue.unref(onMoveEnd),
  62168. onCollapse: vue.unref(onCollapse)
  62169. }, {
  62170. "start-collapsible": vue.withCtx(() => [
  62171. vue.renderSlot(_ctx.$slots, "start-collapsible")
  62172. ]),
  62173. "end-collapsible": vue.withCtx(() => [
  62174. vue.renderSlot(_ctx.$slots, "end-collapsible")
  62175. ]),
  62176. _: 3
  62177. }, 8, ["index", "layout", "lazy", "resizable", "start-collapsible", "end-collapsible", "onMoveStart", "onMoving", "onMoveEnd", "onCollapse"])) : vue.createCommentVNode("v-if", true)
  62178. ], 64);
  62179. };
  62180. }
  62181. });
  62182. var SplitPanel = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__file", "split-panel.vue"]]);
  62183. const ElSplitter = withInstall(Splitter, {
  62184. SplitPanel
  62185. });
  62186. const ElSplitterPanel = withNoopInstall(SplitPanel);
  62187. var Components = [
  62188. ElAffix,
  62189. ElAlert,
  62190. ElAutocomplete,
  62191. ElAutoResizer,
  62192. ElAvatar,
  62193. ElBacktop,
  62194. ElBadge,
  62195. ElBreadcrumb,
  62196. ElBreadcrumbItem,
  62197. ElButton,
  62198. ElButtonGroup$1,
  62199. ElCalendar,
  62200. ElCard,
  62201. ElCarousel,
  62202. ElCarouselItem,
  62203. ElCascader,
  62204. ElCascaderPanel,
  62205. ElCheckTag,
  62206. ElCheckbox,
  62207. ElCheckboxButton,
  62208. ElCheckboxGroup$1,
  62209. ElCol,
  62210. ElCollapse,
  62211. ElCollapseItem,
  62212. ElCollapseTransition,
  62213. ElColorPickerPanel,
  62214. ElColorPicker,
  62215. ElConfigProvider,
  62216. ElContainer,
  62217. ElAside,
  62218. ElFooter,
  62219. ElHeader,
  62220. ElMain,
  62221. ElDatePicker,
  62222. ElDatePickerPanel,
  62223. ElDescriptions,
  62224. ElDescriptionsItem,
  62225. ElDialog,
  62226. ElDivider,
  62227. ElDrawer,
  62228. ElDropdown,
  62229. ElDropdownItem,
  62230. ElDropdownMenu,
  62231. ElEmpty,
  62232. ElForm,
  62233. ElFormItem,
  62234. ElIcon,
  62235. ElImage,
  62236. ElImageViewer,
  62237. ElInput,
  62238. ElInputNumber,
  62239. ElInputTag,
  62240. ElLink,
  62241. ElMenu,
  62242. ElMenuItem,
  62243. ElMenuItemGroup,
  62244. ElSubMenu,
  62245. ElPageHeader,
  62246. ElPagination,
  62247. ElPopconfirm,
  62248. ElPopover,
  62249. ElPopper,
  62250. ElProgress,
  62251. ElRadio,
  62252. ElRadioButton,
  62253. ElRadioGroup,
  62254. ElRate,
  62255. ElResult,
  62256. ElRow,
  62257. ElScrollbar,
  62258. ElSelect,
  62259. ElOption,
  62260. ElOptionGroup,
  62261. ElSelectV2,
  62262. ElSkeleton,
  62263. ElSkeletonItem,
  62264. ElSlider,
  62265. ElSpace,
  62266. ElStatistic,
  62267. ElCountdown,
  62268. ElSteps,
  62269. ElStep,
  62270. ElSwitch,
  62271. ElTable,
  62272. ElTableColumn,
  62273. ElTableV2,
  62274. ElTabs,
  62275. ElTabPane,
  62276. ElTag,
  62277. ElText,
  62278. ElTimePicker,
  62279. ElTimeSelect,
  62280. ElTimeline,
  62281. ElTimelineItem,
  62282. ElTooltip,
  62283. ElTransfer,
  62284. ElTree,
  62285. ElTreeSelect,
  62286. ElTreeV2,
  62287. ElUpload,
  62288. ElWatermark,
  62289. ElTour,
  62290. ElTourStep,
  62291. ElAnchor,
  62292. ElAnchorLink,
  62293. ElSegmented,
  62294. ElMention,
  62295. ElSplitter,
  62296. ElSplitterPanel
  62297. ];
  62298. const SCOPE = "ElInfiniteScroll";
  62299. const CHECK_INTERVAL = 50;
  62300. const DEFAULT_DELAY = 200;
  62301. const DEFAULT_DISTANCE = 0;
  62302. const attributes = {
  62303. delay: {
  62304. type: Number,
  62305. default: DEFAULT_DELAY
  62306. },
  62307. distance: {
  62308. type: Number,
  62309. default: DEFAULT_DISTANCE
  62310. },
  62311. disabled: {
  62312. type: Boolean,
  62313. default: false
  62314. },
  62315. immediate: {
  62316. type: Boolean,
  62317. default: true
  62318. }
  62319. };
  62320. const getScrollOptions = (el, instance) => {
  62321. return Object.entries(attributes).reduce((acm, [name, option]) => {
  62322. var _a, _b;
  62323. const { type, default: defaultValue } = option;
  62324. const attrVal = el.getAttribute(`infinite-scroll-${name}`);
  62325. let value = (_b = (_a = instance[attrVal]) != null ? _a : attrVal) != null ? _b : defaultValue;
  62326. value = value === "false" ? false : value;
  62327. value = type(value);
  62328. acm[name] = Number.isNaN(value) ? defaultValue : value;
  62329. return acm;
  62330. }, {});
  62331. };
  62332. const destroyObserver = (el) => {
  62333. const { observer } = el[SCOPE];
  62334. if (observer) {
  62335. observer.disconnect();
  62336. delete el[SCOPE].observer;
  62337. }
  62338. };
  62339. const handleScroll = (el, cb) => {
  62340. const { container, containerEl, instance, observer, lastScrollTop } = el[SCOPE];
  62341. const { disabled, distance } = getScrollOptions(el, instance);
  62342. const { clientHeight, scrollHeight, scrollTop } = containerEl;
  62343. const delta = scrollTop - lastScrollTop;
  62344. el[SCOPE].lastScrollTop = scrollTop;
  62345. if (observer || disabled || delta < 0)
  62346. return;
  62347. let shouldTrigger = false;
  62348. if (container === el) {
  62349. shouldTrigger = scrollHeight - (clientHeight + scrollTop) <= distance;
  62350. } else {
  62351. const { clientTop, scrollHeight: height } = el;
  62352. const offsetTop = getOffsetTopDistance(el, containerEl);
  62353. shouldTrigger = scrollTop + clientHeight >= offsetTop + clientTop + height - distance;
  62354. }
  62355. if (shouldTrigger) {
  62356. cb.call(instance);
  62357. }
  62358. };
  62359. function checkFull(el, cb) {
  62360. const { containerEl, instance } = el[SCOPE];
  62361. const { disabled } = getScrollOptions(el, instance);
  62362. if (disabled || containerEl.clientHeight === 0)
  62363. return;
  62364. if (containerEl.scrollHeight <= containerEl.clientHeight) {
  62365. cb.call(instance);
  62366. } else {
  62367. destroyObserver(el);
  62368. }
  62369. }
  62370. const InfiniteScroll = {
  62371. async mounted(el, binding) {
  62372. const { instance, value: cb } = binding;
  62373. useDeprecated({
  62374. scope: SCOPE,
  62375. from: "the directive v-infinite-scroll",
  62376. replacement: "the el-scrollbar infinite scroll",
  62377. version: "3.0.0",
  62378. ref: "https://element-plus.org/en-US/component/scrollbar#infinite-scroll"
  62379. }, true);
  62380. if (!isFunction$1(cb)) {
  62381. throwError(SCOPE, "'v-infinite-scroll' binding value must be a function");
  62382. }
  62383. await vue.nextTick();
  62384. const { delay, immediate } = getScrollOptions(el, instance);
  62385. const container = getScrollContainer(el, true);
  62386. const containerEl = container === window ? document.documentElement : container;
  62387. const onScroll = throttle(handleScroll.bind(null, el, cb), delay);
  62388. if (!container)
  62389. return;
  62390. el[SCOPE] = {
  62391. instance,
  62392. container,
  62393. containerEl,
  62394. delay,
  62395. cb,
  62396. onScroll,
  62397. lastScrollTop: containerEl.scrollTop
  62398. };
  62399. if (immediate) {
  62400. const observer = new MutationObserver(throttle(checkFull.bind(null, el, cb), CHECK_INTERVAL));
  62401. el[SCOPE].observer = observer;
  62402. observer.observe(el, { childList: true, subtree: true });
  62403. checkFull(el, cb);
  62404. }
  62405. container.addEventListener("scroll", onScroll);
  62406. },
  62407. unmounted(el) {
  62408. if (!el[SCOPE])
  62409. return;
  62410. const { container, onScroll } = el[SCOPE];
  62411. container == null ? void 0 : container.removeEventListener("scroll", onScroll);
  62412. destroyObserver(el);
  62413. },
  62414. async updated(el) {
  62415. if (!el[SCOPE]) {
  62416. await vue.nextTick();
  62417. } else {
  62418. const { containerEl, cb, observer } = el[SCOPE];
  62419. if (containerEl.clientHeight && observer) {
  62420. checkFull(el, cb);
  62421. }
  62422. }
  62423. }
  62424. };
  62425. var InfiniteScroll$1 = InfiniteScroll;
  62426. const _InfiniteScroll = InfiniteScroll$1;
  62427. _InfiniteScroll.install = (app) => {
  62428. app.directive("InfiniteScroll", _InfiniteScroll);
  62429. };
  62430. const ElInfiniteScroll = _InfiniteScroll;
  62431. function createLoadingComponent(options, appContext) {
  62432. let afterLeaveTimer;
  62433. const afterLeaveFlag = vue.ref(false);
  62434. const data = vue.reactive({
  62435. ...options,
  62436. originalPosition: "",
  62437. originalOverflow: "",
  62438. visible: false
  62439. });
  62440. function setText(text) {
  62441. data.text = text;
  62442. }
  62443. function destroySelf() {
  62444. const target = data.parent;
  62445. const ns = vm.ns;
  62446. if (!target.vLoadingAddClassList) {
  62447. let loadingNumber = target.getAttribute("loading-number");
  62448. loadingNumber = Number.parseInt(loadingNumber) - 1;
  62449. if (!loadingNumber) {
  62450. removeClass(target, ns.bm("parent", "relative"));
  62451. target.removeAttribute("loading-number");
  62452. } else {
  62453. target.setAttribute("loading-number", loadingNumber.toString());
  62454. }
  62455. removeClass(target, ns.bm("parent", "hidden"));
  62456. }
  62457. removeElLoadingChild();
  62458. loadingInstance.unmount();
  62459. }
  62460. function removeElLoadingChild() {
  62461. var _a, _b;
  62462. (_b = (_a = vm.$el) == null ? void 0 : _a.parentNode) == null ? void 0 : _b.removeChild(vm.$el);
  62463. }
  62464. function close() {
  62465. var _a;
  62466. if (options.beforeClose && !options.beforeClose())
  62467. return;
  62468. afterLeaveFlag.value = true;
  62469. clearTimeout(afterLeaveTimer);
  62470. afterLeaveTimer = setTimeout(handleAfterLeave, 400);
  62471. data.visible = false;
  62472. (_a = options.closed) == null ? void 0 : _a.call(options);
  62473. }
  62474. function handleAfterLeave() {
  62475. if (!afterLeaveFlag.value)
  62476. return;
  62477. const target = data.parent;
  62478. afterLeaveFlag.value = false;
  62479. target.vLoadingAddClassList = void 0;
  62480. destroySelf();
  62481. }
  62482. const elLoadingComponent = vue.defineComponent({
  62483. name: "ElLoading",
  62484. setup(_, { expose }) {
  62485. const { ns, zIndex } = useGlobalComponentSettings("loading");
  62486. expose({
  62487. ns,
  62488. zIndex
  62489. });
  62490. return () => {
  62491. const svg = data.spinner || data.svg;
  62492. const spinner = vue.h("svg", {
  62493. class: "circular",
  62494. viewBox: data.svgViewBox ? data.svgViewBox : "0 0 50 50",
  62495. ...svg ? { innerHTML: svg } : {}
  62496. }, [
  62497. vue.h("circle", {
  62498. class: "path",
  62499. cx: "25",
  62500. cy: "25",
  62501. r: "20",
  62502. fill: "none"
  62503. })
  62504. ]);
  62505. const spinnerText = data.text ? vue.h("p", { class: ns.b("text") }, [data.text]) : void 0;
  62506. return vue.h(vue.Transition, {
  62507. name: ns.b("fade"),
  62508. onAfterLeave: handleAfterLeave
  62509. }, {
  62510. default: vue.withCtx(() => [
  62511. vue.withDirectives(vue.createVNode("div", {
  62512. style: {
  62513. backgroundColor: data.background || ""
  62514. },
  62515. class: [
  62516. ns.b("mask"),
  62517. data.customClass,
  62518. ns.is("fullscreen", data.fullscreen)
  62519. ]
  62520. }, [
  62521. vue.h("div", {
  62522. class: ns.b("spinner")
  62523. }, [spinner, spinnerText])
  62524. ]), [[vue.vShow, data.visible]])
  62525. ])
  62526. });
  62527. };
  62528. }
  62529. });
  62530. const loadingInstance = vue.createApp(elLoadingComponent);
  62531. Object.assign(loadingInstance._context, appContext != null ? appContext : {});
  62532. const vm = loadingInstance.mount(document.createElement("div"));
  62533. return {
  62534. ...vue.toRefs(data),
  62535. setText,
  62536. removeElLoadingChild,
  62537. close,
  62538. handleAfterLeave,
  62539. vm,
  62540. get $el() {
  62541. return vm.$el;
  62542. }
  62543. };
  62544. }
  62545. let fullscreenInstance = void 0;
  62546. const Loading = function(options = {}, context) {
  62547. if (!isClient)
  62548. return void 0;
  62549. const resolved = resolveOptions(options);
  62550. if (resolved.fullscreen && fullscreenInstance) {
  62551. return fullscreenInstance;
  62552. }
  62553. const instance = createLoadingComponent({
  62554. ...resolved,
  62555. closed: () => {
  62556. var _a;
  62557. (_a = resolved.closed) == null ? void 0 : _a.call(resolved);
  62558. if (resolved.fullscreen)
  62559. fullscreenInstance = void 0;
  62560. }
  62561. }, context != null ? context : Loading._context);
  62562. addStyle(resolved, resolved.parent, instance);
  62563. addClassList(resolved, resolved.parent, instance);
  62564. resolved.parent.vLoadingAddClassList = () => addClassList(resolved, resolved.parent, instance);
  62565. let loadingNumber = resolved.parent.getAttribute("loading-number");
  62566. if (!loadingNumber) {
  62567. loadingNumber = "1";
  62568. } else {
  62569. loadingNumber = `${Number.parseInt(loadingNumber) + 1}`;
  62570. }
  62571. resolved.parent.setAttribute("loading-number", loadingNumber);
  62572. resolved.parent.appendChild(instance.$el);
  62573. vue.nextTick(() => instance.visible.value = resolved.visible);
  62574. if (resolved.fullscreen) {
  62575. fullscreenInstance = instance;
  62576. }
  62577. return instance;
  62578. };
  62579. const resolveOptions = (options) => {
  62580. var _a, _b, _c, _d;
  62581. let target;
  62582. if (isString$1(options.target)) {
  62583. target = (_a = document.querySelector(options.target)) != null ? _a : document.body;
  62584. } else {
  62585. target = options.target || document.body;
  62586. }
  62587. return {
  62588. parent: target === document.body || options.body ? document.body : target,
  62589. background: options.background || "",
  62590. svg: options.svg || "",
  62591. svgViewBox: options.svgViewBox || "",
  62592. spinner: options.spinner || false,
  62593. text: options.text || "",
  62594. fullscreen: target === document.body && ((_b = options.fullscreen) != null ? _b : true),
  62595. lock: (_c = options.lock) != null ? _c : false,
  62596. customClass: options.customClass || "",
  62597. visible: (_d = options.visible) != null ? _d : true,
  62598. beforeClose: options.beforeClose,
  62599. closed: options.closed,
  62600. target
  62601. };
  62602. };
  62603. const addStyle = async (options, parent, instance) => {
  62604. const { nextZIndex } = instance.vm.zIndex || instance.vm._.exposed.zIndex;
  62605. const maskStyle = {};
  62606. if (options.fullscreen) {
  62607. instance.originalPosition.value = getStyle(document.body, "position");
  62608. instance.originalOverflow.value = getStyle(document.body, "overflow");
  62609. maskStyle.zIndex = nextZIndex();
  62610. } else if (options.parent === document.body) {
  62611. instance.originalPosition.value = getStyle(document.body, "position");
  62612. await vue.nextTick();
  62613. for (const property of ["top", "left"]) {
  62614. const scroll = property === "top" ? "scrollTop" : "scrollLeft";
  62615. maskStyle[property] = `${options.target.getBoundingClientRect()[property] + document.body[scroll] + document.documentElement[scroll] - Number.parseInt(getStyle(document.body, `margin-${property}`), 10)}px`;
  62616. }
  62617. for (const property of ["height", "width"]) {
  62618. maskStyle[property] = `${options.target.getBoundingClientRect()[property]}px`;
  62619. }
  62620. } else {
  62621. instance.originalPosition.value = getStyle(parent, "position");
  62622. }
  62623. for (const [key, value] of Object.entries(maskStyle)) {
  62624. instance.$el.style[key] = value;
  62625. }
  62626. };
  62627. const addClassList = (options, parent, instance) => {
  62628. const ns = instance.vm.ns || instance.vm._.exposed.ns;
  62629. if (!["absolute", "fixed", "sticky"].includes(instance.originalPosition.value)) {
  62630. addClass(parent, ns.bm("parent", "relative"));
  62631. } else {
  62632. removeClass(parent, ns.bm("parent", "relative"));
  62633. }
  62634. if (options.fullscreen && options.lock) {
  62635. addClass(parent, ns.bm("parent", "hidden"));
  62636. } else {
  62637. removeClass(parent, ns.bm("parent", "hidden"));
  62638. }
  62639. };
  62640. Loading._context = null;
  62641. var Loading$1 = Loading;
  62642. const INSTANCE_KEY = Symbol("ElLoading");
  62643. const getAttributeName = (name) => {
  62644. return `element-loading-${hyphenate(name)}`;
  62645. };
  62646. const createInstance = (el, binding) => {
  62647. var _a, _b, _c, _d;
  62648. const vm = binding.instance;
  62649. const getBindingProp = (key) => isObject$1(binding.value) ? binding.value[key] : void 0;
  62650. const resolveExpression = (key) => {
  62651. const data = isString$1(key) && (vm == null ? void 0 : vm[key]) || key;
  62652. return vue.ref(data);
  62653. };
  62654. const getProp = (name) => resolveExpression(getBindingProp(name) || el.getAttribute(getAttributeName(name)));
  62655. const fullscreen = (_a = getBindingProp("fullscreen")) != null ? _a : binding.modifiers.fullscreen;
  62656. const options = {
  62657. text: getProp("text"),
  62658. svg: getProp("svg"),
  62659. svgViewBox: getProp("svgViewBox"),
  62660. spinner: getProp("spinner"),
  62661. background: getProp("background"),
  62662. customClass: getProp("customClass"),
  62663. fullscreen,
  62664. target: (_b = getBindingProp("target")) != null ? _b : fullscreen ? void 0 : el,
  62665. body: (_c = getBindingProp("body")) != null ? _c : binding.modifiers.body,
  62666. lock: (_d = getBindingProp("lock")) != null ? _d : binding.modifiers.lock
  62667. };
  62668. const instance = Loading$1(options);
  62669. instance._context = vLoading._context;
  62670. el[INSTANCE_KEY] = {
  62671. options,
  62672. instance
  62673. };
  62674. };
  62675. const updateOptions = (originalOptions, newOptions) => {
  62676. for (const key of Object.keys(originalOptions)) {
  62677. if (vue.isRef(originalOptions[key]))
  62678. originalOptions[key].value = newOptions[key];
  62679. }
  62680. };
  62681. const vLoading = {
  62682. mounted(el, binding) {
  62683. if (binding.value) {
  62684. createInstance(el, binding);
  62685. }
  62686. },
  62687. updated(el, binding) {
  62688. const instance = el[INSTANCE_KEY];
  62689. if (!binding.value) {
  62690. instance == null ? void 0 : instance.instance.close();
  62691. el[INSTANCE_KEY] = null;
  62692. return;
  62693. }
  62694. if (!instance)
  62695. createInstance(el, binding);
  62696. else {
  62697. updateOptions(instance.options, isObject$1(binding.value) ? binding.value : {
  62698. text: el.getAttribute(getAttributeName("text")),
  62699. svg: el.getAttribute(getAttributeName("svg")),
  62700. svgViewBox: el.getAttribute(getAttributeName("svgViewBox")),
  62701. spinner: el.getAttribute(getAttributeName("spinner")),
  62702. background: el.getAttribute(getAttributeName("background")),
  62703. customClass: el.getAttribute(getAttributeName("customClass"))
  62704. });
  62705. }
  62706. },
  62707. unmounted(el) {
  62708. var _a;
  62709. (_a = el[INSTANCE_KEY]) == null ? void 0 : _a.instance.close();
  62710. el[INSTANCE_KEY] = null;
  62711. }
  62712. };
  62713. vLoading._context = null;
  62714. var vLoading$1 = vLoading;
  62715. const ElLoading = {
  62716. install(app) {
  62717. Loading$1._context = app._context;
  62718. vLoading$1._context = app._context;
  62719. app.directive("loading", vLoading$1);
  62720. app.config.globalProperties.$loading = Loading$1;
  62721. },
  62722. directive: vLoading$1,
  62723. service: Loading$1
  62724. };
  62725. const messageTypes = [
  62726. "primary",
  62727. "success",
  62728. "info",
  62729. "warning",
  62730. "error"
  62731. ];
  62732. const messagePlacement = [
  62733. "top",
  62734. "top-left",
  62735. "top-right",
  62736. "bottom",
  62737. "bottom-left",
  62738. "bottom-right"
  62739. ];
  62740. const MESSAGE_DEFAULT_PLACEMENT = "top";
  62741. const messageDefaults = mutable({
  62742. customClass: "",
  62743. dangerouslyUseHTMLString: false,
  62744. duration: 3e3,
  62745. icon: void 0,
  62746. id: "",
  62747. message: "",
  62748. onClose: void 0,
  62749. showClose: false,
  62750. type: "info",
  62751. plain: false,
  62752. offset: 16,
  62753. placement: void 0,
  62754. zIndex: 0,
  62755. grouping: false,
  62756. repeatNum: 1,
  62757. appendTo: isClient ? document.body : void 0
  62758. });
  62759. const messageProps = buildProps({
  62760. customClass: {
  62761. type: String,
  62762. default: messageDefaults.customClass
  62763. },
  62764. dangerouslyUseHTMLString: {
  62765. type: Boolean,
  62766. default: messageDefaults.dangerouslyUseHTMLString
  62767. },
  62768. duration: {
  62769. type: Number,
  62770. default: messageDefaults.duration
  62771. },
  62772. icon: {
  62773. type: iconPropType,
  62774. default: messageDefaults.icon
  62775. },
  62776. id: {
  62777. type: String,
  62778. default: messageDefaults.id
  62779. },
  62780. message: {
  62781. type: definePropType([
  62782. String,
  62783. Object,
  62784. Function
  62785. ]),
  62786. default: messageDefaults.message
  62787. },
  62788. onClose: {
  62789. type: definePropType(Function),
  62790. default: messageDefaults.onClose
  62791. },
  62792. showClose: {
  62793. type: Boolean,
  62794. default: messageDefaults.showClose
  62795. },
  62796. type: {
  62797. type: String,
  62798. values: messageTypes,
  62799. default: messageDefaults.type
  62800. },
  62801. plain: {
  62802. type: Boolean,
  62803. default: messageDefaults.plain
  62804. },
  62805. offset: {
  62806. type: Number,
  62807. default: messageDefaults.offset
  62808. },
  62809. placement: {
  62810. type: String,
  62811. values: messagePlacement,
  62812. default: messageDefaults.placement
  62813. },
  62814. zIndex: {
  62815. type: Number,
  62816. default: messageDefaults.zIndex
  62817. },
  62818. grouping: {
  62819. type: Boolean,
  62820. default: messageDefaults.grouping
  62821. },
  62822. repeatNum: {
  62823. type: Number,
  62824. default: messageDefaults.repeatNum
  62825. }
  62826. });
  62827. const messageEmits = {
  62828. destroy: () => true
  62829. };
  62830. const placementInstances = vue.shallowReactive({});
  62831. const getOrCreatePlacementInstances = (placement) => {
  62832. if (!placementInstances[placement]) {
  62833. placementInstances[placement] = vue.shallowReactive([]);
  62834. }
  62835. return placementInstances[placement];
  62836. };
  62837. const getInstance = (id, placement) => {
  62838. const instances = placementInstances[placement] || [];
  62839. const idx = instances.findIndex((instance) => instance.id === id);
  62840. const current = instances[idx];
  62841. let prev;
  62842. if (idx > 0) {
  62843. prev = instances[idx - 1];
  62844. }
  62845. return { current, prev };
  62846. };
  62847. const getLastOffset = (id, placement) => {
  62848. const { prev } = getInstance(id, placement);
  62849. if (!prev)
  62850. return 0;
  62851. return prev.vm.exposed.bottom.value;
  62852. };
  62853. const getOffsetOrSpace = (id, offset, placement) => {
  62854. const instances = placementInstances[placement] || [];
  62855. const idx = instances.findIndex((instance) => instance.id === id);
  62856. return idx > 0 ? 16 : offset;
  62857. };
  62858. const __default__$1 = vue.defineComponent({
  62859. name: "ElMessage"
  62860. });
  62861. const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
  62862. ...__default__$1,
  62863. props: messageProps,
  62864. emits: messageEmits,
  62865. setup(__props, { expose, emit }) {
  62866. const props = __props;
  62867. const { Close } = TypeComponents;
  62868. const isStartTransition = vue.ref(false);
  62869. const { ns, zIndex } = useGlobalComponentSettings("message");
  62870. const { currentZIndex, nextZIndex } = zIndex;
  62871. const messageRef = vue.ref();
  62872. const visible = vue.ref(false);
  62873. const height = vue.ref(0);
  62874. let stopTimer = void 0;
  62875. const badgeType = vue.computed(() => props.type ? props.type === "error" ? "danger" : props.type : "info");
  62876. const typeClass = vue.computed(() => {
  62877. const type = props.type;
  62878. return { [ns.bm("icon", type)]: type && TypeComponentsMap[type] };
  62879. });
  62880. const iconComponent = vue.computed(() => props.icon || TypeComponentsMap[props.type] || "");
  62881. const placement = vue.computed(() => props.placement || MESSAGE_DEFAULT_PLACEMENT);
  62882. const lastOffset = vue.computed(() => getLastOffset(props.id, placement.value));
  62883. const offset = vue.computed(() => {
  62884. return getOffsetOrSpace(props.id, props.offset, placement.value) + lastOffset.value;
  62885. });
  62886. const bottom = vue.computed(() => height.value + offset.value);
  62887. const horizontalClass = vue.computed(() => {
  62888. if (placement.value.includes("left"))
  62889. return ns.is("left");
  62890. if (placement.value.includes("right"))
  62891. return ns.is("right");
  62892. return ns.is("center");
  62893. });
  62894. const verticalProperty = vue.computed(() => placement.value.startsWith("top") ? "top" : "bottom");
  62895. const customStyle = vue.computed(() => ({
  62896. [verticalProperty.value]: `${offset.value}px`,
  62897. zIndex: currentZIndex.value
  62898. }));
  62899. function startTimer() {
  62900. if (props.duration === 0)
  62901. return;
  62902. ({ stop: stopTimer } = useTimeoutFn(() => {
  62903. close();
  62904. }, props.duration));
  62905. }
  62906. function clearTimer() {
  62907. stopTimer == null ? void 0 : stopTimer();
  62908. }
  62909. function close() {
  62910. visible.value = false;
  62911. vue.nextTick(() => {
  62912. var _a;
  62913. if (!isStartTransition.value) {
  62914. (_a = props.onClose) == null ? void 0 : _a.call(props);
  62915. emit("destroy");
  62916. }
  62917. });
  62918. }
  62919. function keydown(event) {
  62920. const code = getEventCode(event);
  62921. if (code === EVENT_CODE.esc) {
  62922. close();
  62923. }
  62924. }
  62925. vue.onMounted(() => {
  62926. startTimer();
  62927. nextZIndex();
  62928. visible.value = true;
  62929. });
  62930. vue.watch(() => props.repeatNum, () => {
  62931. clearTimer();
  62932. startTimer();
  62933. });
  62934. useEventListener(document, "keydown", keydown);
  62935. useResizeObserver(messageRef, () => {
  62936. height.value = messageRef.value.getBoundingClientRect().height;
  62937. });
  62938. expose({
  62939. visible,
  62940. bottom,
  62941. close
  62942. });
  62943. return (_ctx, _cache) => {
  62944. return vue.openBlock(), vue.createBlock(vue.Transition, {
  62945. name: vue.unref(ns).b("fade"),
  62946. onBeforeEnter: ($event) => isStartTransition.value = true,
  62947. onBeforeLeave: _ctx.onClose,
  62948. onAfterLeave: ($event) => _ctx.$emit("destroy"),
  62949. persisted: ""
  62950. }, {
  62951. default: vue.withCtx(() => [
  62952. vue.withDirectives(vue.createElementVNode("div", {
  62953. id: _ctx.id,
  62954. ref_key: "messageRef",
  62955. ref: messageRef,
  62956. class: vue.normalizeClass([
  62957. vue.unref(ns).b(),
  62958. { [vue.unref(ns).m(_ctx.type)]: _ctx.type },
  62959. vue.unref(ns).is("closable", _ctx.showClose),
  62960. vue.unref(ns).is("plain", _ctx.plain),
  62961. vue.unref(ns).is("bottom", vue.unref(verticalProperty) === "bottom"),
  62962. vue.unref(horizontalClass),
  62963. _ctx.customClass
  62964. ]),
  62965. style: vue.normalizeStyle(vue.unref(customStyle)),
  62966. role: "alert",
  62967. onMouseenter: clearTimer,
  62968. onMouseleave: startTimer
  62969. }, [
  62970. _ctx.repeatNum > 1 ? (vue.openBlock(), vue.createBlock(vue.unref(ElBadge), {
  62971. key: 0,
  62972. value: _ctx.repeatNum,
  62973. type: vue.unref(badgeType),
  62974. class: vue.normalizeClass(vue.unref(ns).e("badge"))
  62975. }, null, 8, ["value", "type", "class"])) : vue.createCommentVNode("v-if", true),
  62976. vue.unref(iconComponent) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  62977. key: 1,
  62978. class: vue.normalizeClass([vue.unref(ns).e("icon"), vue.unref(typeClass)])
  62979. }, {
  62980. default: vue.withCtx(() => [
  62981. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(iconComponent))))
  62982. ]),
  62983. _: 1
  62984. }, 8, ["class"])) : vue.createCommentVNode("v-if", true),
  62985. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  62986. !_ctx.dangerouslyUseHTMLString ? (vue.openBlock(), vue.createElementBlock("p", {
  62987. key: 0,
  62988. class: vue.normalizeClass(vue.unref(ns).e("content"))
  62989. }, vue.toDisplayString(_ctx.message), 3)) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  62990. vue.createCommentVNode(" Caution here, message could've been compromised, never use user's input as message "),
  62991. vue.createElementVNode("p", {
  62992. class: vue.normalizeClass(vue.unref(ns).e("content")),
  62993. innerHTML: _ctx.message
  62994. }, null, 10, ["innerHTML"])
  62995. ], 2112))
  62996. ]),
  62997. _ctx.showClose ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  62998. key: 2,
  62999. class: vue.normalizeClass(vue.unref(ns).e("closeBtn")),
  63000. onClick: vue.withModifiers(close, ["stop"])
  63001. }, {
  63002. default: vue.withCtx(() => [
  63003. vue.createVNode(vue.unref(Close))
  63004. ]),
  63005. _: 1
  63006. }, 8, ["class", "onClick"])) : vue.createCommentVNode("v-if", true)
  63007. ], 46, ["id"]), [
  63008. [vue.vShow, visible.value]
  63009. ])
  63010. ]),
  63011. _: 3
  63012. }, 8, ["name", "onBeforeEnter", "onBeforeLeave", "onAfterLeave"]);
  63013. };
  63014. }
  63015. });
  63016. var MessageConstructor = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__file", "message.vue"]]);
  63017. let seed$1 = 1;
  63018. const normalizeAppendTo = (normalized) => {
  63019. const appendTo = normalized.appendTo;
  63020. if (!appendTo) {
  63021. normalized.appendTo = document.body;
  63022. } else if (isString$1(normalized.appendTo)) {
  63023. let appendTo2 = document.querySelector(normalized.appendTo);
  63024. if (!isElement$2(appendTo2)) {
  63025. debugWarn("ElMessage", "the appendTo option is not an HTMLElement. Falling back to document.body.");
  63026. appendTo2 = document.body;
  63027. }
  63028. normalized.appendTo = appendTo2;
  63029. }
  63030. };
  63031. const normalizePlacement = (normalized) => {
  63032. if (!normalized.placement && isString$1(messageConfig.placement) && messageConfig.placement) {
  63033. normalized.placement = messageConfig.placement;
  63034. }
  63035. if (!normalized.placement) {
  63036. normalized.placement = MESSAGE_DEFAULT_PLACEMENT;
  63037. }
  63038. if (!messagePlacement.includes(normalized.placement)) {
  63039. debugWarn("ElMessage", `Invalid placement: ${normalized.placement}. Falling back to '${MESSAGE_DEFAULT_PLACEMENT}'.`);
  63040. normalized.placement = MESSAGE_DEFAULT_PLACEMENT;
  63041. }
  63042. };
  63043. const normalizeOptions = (params) => {
  63044. const options = !params || isString$1(params) || vue.isVNode(params) || isFunction$1(params) ? { message: params } : params;
  63045. const normalized = {
  63046. ...messageDefaults,
  63047. ...options
  63048. };
  63049. normalizeAppendTo(normalized);
  63050. normalizePlacement(normalized);
  63051. if (isBoolean(messageConfig.grouping) && !normalized.grouping) {
  63052. normalized.grouping = messageConfig.grouping;
  63053. }
  63054. if (isNumber(messageConfig.duration) && normalized.duration === 3e3) {
  63055. normalized.duration = messageConfig.duration;
  63056. }
  63057. if (isNumber(messageConfig.offset) && normalized.offset === 16) {
  63058. normalized.offset = messageConfig.offset;
  63059. }
  63060. if (isBoolean(messageConfig.showClose) && !normalized.showClose) {
  63061. normalized.showClose = messageConfig.showClose;
  63062. }
  63063. if (isBoolean(messageConfig.plain) && !normalized.plain) {
  63064. normalized.plain = messageConfig.plain;
  63065. }
  63066. return normalized;
  63067. };
  63068. const closeMessage = (instance) => {
  63069. const placement = instance.props.placement || MESSAGE_DEFAULT_PLACEMENT;
  63070. const instances = placementInstances[placement];
  63071. const idx = instances.indexOf(instance);
  63072. if (idx === -1)
  63073. return;
  63074. instances.splice(idx, 1);
  63075. const { handler } = instance;
  63076. handler.close();
  63077. };
  63078. const createMessage = ({ appendTo, ...options }, context) => {
  63079. const id = `message_${seed$1++}`;
  63080. const userOnClose = options.onClose;
  63081. const container = document.createElement("div");
  63082. const props = {
  63083. ...options,
  63084. id,
  63085. onClose: () => {
  63086. userOnClose == null ? void 0 : userOnClose();
  63087. closeMessage(instance);
  63088. },
  63089. onDestroy: () => {
  63090. vue.render(null, container);
  63091. }
  63092. };
  63093. const vnode = vue.createVNode(MessageConstructor, props, isFunction$1(props.message) || vue.isVNode(props.message) ? {
  63094. default: isFunction$1(props.message) ? props.message : () => props.message
  63095. } : null);
  63096. vnode.appContext = context || message._context;
  63097. vue.render(vnode, container);
  63098. appendTo.appendChild(container.firstElementChild);
  63099. const vm = vnode.component;
  63100. const handler = {
  63101. close: () => {
  63102. vm.exposed.close();
  63103. }
  63104. };
  63105. const instance = {
  63106. id,
  63107. vnode,
  63108. vm,
  63109. handler,
  63110. props: vnode.component.props
  63111. };
  63112. return instance;
  63113. };
  63114. const message = (options = {}, context) => {
  63115. if (!isClient)
  63116. return { close: () => void 0 };
  63117. const normalized = normalizeOptions(options);
  63118. const instances = getOrCreatePlacementInstances(normalized.placement || MESSAGE_DEFAULT_PLACEMENT);
  63119. if (normalized.grouping && instances.length) {
  63120. const instance2 = instances.find(({ vnode: vm }) => {
  63121. var _a;
  63122. return ((_a = vm.props) == null ? void 0 : _a.message) === normalized.message;
  63123. });
  63124. if (instance2) {
  63125. instance2.props.repeatNum += 1;
  63126. instance2.props.type = normalized.type;
  63127. return instance2.handler;
  63128. }
  63129. }
  63130. if (isNumber(messageConfig.max) && instances.length >= messageConfig.max) {
  63131. return { close: () => void 0 };
  63132. }
  63133. const instance = createMessage(normalized, context);
  63134. instances.push(instance);
  63135. return instance.handler;
  63136. };
  63137. messageTypes.forEach((type) => {
  63138. message[type] = (options = {}, appContext) => {
  63139. const normalized = normalizeOptions(options);
  63140. return message({ ...normalized, type }, appContext);
  63141. };
  63142. });
  63143. function closeAll$1(type) {
  63144. for (const placement in placementInstances) {
  63145. if (hasOwn(placementInstances, placement)) {
  63146. const instances = [...placementInstances[placement]];
  63147. for (const instance of instances) {
  63148. if (!type || type === instance.props.type) {
  63149. instance.handler.close();
  63150. }
  63151. }
  63152. }
  63153. }
  63154. }
  63155. function closeAllByPlacement(placement) {
  63156. if (!placementInstances[placement])
  63157. return;
  63158. const instances = [...placementInstances[placement]];
  63159. instances.forEach((instance) => instance.handler.close());
  63160. }
  63161. message.closeAll = closeAll$1;
  63162. message.closeAllByPlacement = closeAllByPlacement;
  63163. message._context = null;
  63164. var Message = message;
  63165. const ElMessage = withInstallFunction(Message, "$message");
  63166. const _sfc_main$1 = vue.defineComponent({
  63167. name: "ElMessageBox",
  63168. directives: {
  63169. TrapFocus
  63170. },
  63171. components: {
  63172. ElButton,
  63173. ElFocusTrap,
  63174. ElInput,
  63175. ElOverlay,
  63176. ElIcon,
  63177. ...TypeComponents
  63178. },
  63179. inheritAttrs: false,
  63180. props: {
  63181. buttonSize: {
  63182. type: String,
  63183. validator: isValidComponentSize
  63184. },
  63185. modal: {
  63186. type: Boolean,
  63187. default: true
  63188. },
  63189. lockScroll: {
  63190. type: Boolean,
  63191. default: true
  63192. },
  63193. showClose: {
  63194. type: Boolean,
  63195. default: true
  63196. },
  63197. closeOnClickModal: {
  63198. type: Boolean,
  63199. default: true
  63200. },
  63201. closeOnPressEscape: {
  63202. type: Boolean,
  63203. default: true
  63204. },
  63205. closeOnHashChange: {
  63206. type: Boolean,
  63207. default: true
  63208. },
  63209. center: Boolean,
  63210. draggable: Boolean,
  63211. overflow: Boolean,
  63212. roundButton: Boolean,
  63213. container: {
  63214. type: String,
  63215. default: "body"
  63216. },
  63217. boxType: {
  63218. type: String,
  63219. default: ""
  63220. }
  63221. },
  63222. emits: ["vanish", "action"],
  63223. setup(props, { emit }) {
  63224. const {
  63225. locale,
  63226. zIndex,
  63227. ns,
  63228. size: btnSize
  63229. } = useGlobalComponentSettings("message-box", vue.computed(() => props.buttonSize));
  63230. const { t } = locale;
  63231. const { nextZIndex } = zIndex;
  63232. const visible = vue.ref(false);
  63233. const state = vue.reactive({
  63234. autofocus: true,
  63235. beforeClose: null,
  63236. callback: null,
  63237. cancelButtonText: "",
  63238. cancelButtonClass: "",
  63239. confirmButtonText: "",
  63240. confirmButtonClass: "",
  63241. customClass: "",
  63242. customStyle: {},
  63243. dangerouslyUseHTMLString: false,
  63244. distinguishCancelAndClose: false,
  63245. icon: "",
  63246. closeIcon: "",
  63247. inputPattern: null,
  63248. inputPlaceholder: "",
  63249. inputType: "text",
  63250. inputValue: "",
  63251. inputValidator: void 0,
  63252. inputErrorMessage: "",
  63253. message: "",
  63254. modalFade: true,
  63255. modalClass: "",
  63256. showCancelButton: false,
  63257. showConfirmButton: true,
  63258. type: "",
  63259. title: void 0,
  63260. showInput: false,
  63261. action: "",
  63262. confirmButtonLoading: false,
  63263. cancelButtonLoading: false,
  63264. confirmButtonLoadingIcon: vue.markRaw(loading_default),
  63265. cancelButtonLoadingIcon: vue.markRaw(loading_default),
  63266. confirmButtonDisabled: false,
  63267. editorErrorMessage: "",
  63268. validateError: false,
  63269. zIndex: nextZIndex()
  63270. });
  63271. const typeClass = vue.computed(() => {
  63272. const type = state.type;
  63273. return { [ns.bm("icon", type)]: type && TypeComponentsMap[type] };
  63274. });
  63275. const contentId = useId();
  63276. const inputId = useId();
  63277. const iconComponent = vue.computed(() => {
  63278. const type = state.type;
  63279. return state.icon || type && TypeComponentsMap[type] || "";
  63280. });
  63281. const hasMessage = vue.computed(() => !!state.message);
  63282. const rootRef = vue.ref();
  63283. const headerRef = vue.ref();
  63284. const focusStartRef = vue.ref();
  63285. const inputRef = vue.ref();
  63286. const confirmRef = vue.ref();
  63287. const confirmButtonClasses = vue.computed(() => state.confirmButtonClass);
  63288. vue.watch(() => state.inputValue, async (val) => {
  63289. await vue.nextTick();
  63290. if (props.boxType === "prompt" && val) {
  63291. validate();
  63292. }
  63293. }, { immediate: true });
  63294. vue.watch(() => visible.value, (val) => {
  63295. var _a, _b;
  63296. if (val) {
  63297. if (props.boxType !== "prompt") {
  63298. if (state.autofocus) {
  63299. focusStartRef.value = (_b = (_a = confirmRef.value) == null ? void 0 : _a.$el) != null ? _b : rootRef.value;
  63300. } else {
  63301. focusStartRef.value = rootRef.value;
  63302. }
  63303. }
  63304. state.zIndex = nextZIndex();
  63305. }
  63306. if (props.boxType !== "prompt")
  63307. return;
  63308. if (val) {
  63309. vue.nextTick().then(() => {
  63310. var _a2;
  63311. if (inputRef.value && inputRef.value.$el) {
  63312. if (state.autofocus) {
  63313. focusStartRef.value = (_a2 = getInputElement()) != null ? _a2 : rootRef.value;
  63314. } else {
  63315. focusStartRef.value = rootRef.value;
  63316. }
  63317. }
  63318. });
  63319. } else {
  63320. state.editorErrorMessage = "";
  63321. state.validateError = false;
  63322. }
  63323. });
  63324. const draggable = vue.computed(() => props.draggable);
  63325. const overflow = vue.computed(() => props.overflow);
  63326. const { isDragging } = useDraggable(rootRef, headerRef, draggable, overflow);
  63327. vue.onMounted(async () => {
  63328. await vue.nextTick();
  63329. if (props.closeOnHashChange) {
  63330. window.addEventListener("hashchange", doClose);
  63331. }
  63332. });
  63333. vue.onBeforeUnmount(() => {
  63334. if (props.closeOnHashChange) {
  63335. window.removeEventListener("hashchange", doClose);
  63336. }
  63337. });
  63338. function doClose() {
  63339. if (!visible.value)
  63340. return;
  63341. visible.value = false;
  63342. vue.nextTick(() => {
  63343. if (state.action)
  63344. emit("action", state.action);
  63345. });
  63346. }
  63347. const handleWrapperClick = () => {
  63348. if (props.closeOnClickModal) {
  63349. handleAction(state.distinguishCancelAndClose ? "close" : "cancel");
  63350. }
  63351. };
  63352. const overlayEvent = useSameTarget(handleWrapperClick);
  63353. const handleInputEnter = (e) => {
  63354. if (state.inputType !== "textarea") {
  63355. e.preventDefault();
  63356. return handleAction("confirm");
  63357. }
  63358. };
  63359. const handleAction = (action) => {
  63360. var _a;
  63361. if (props.boxType === "prompt" && action === "confirm" && !validate()) {
  63362. return;
  63363. }
  63364. state.action = action;
  63365. if (state.beforeClose) {
  63366. (_a = state.beforeClose) == null ? void 0 : _a.call(state, action, state, doClose);
  63367. } else {
  63368. doClose();
  63369. }
  63370. };
  63371. const validate = () => {
  63372. if (props.boxType === "prompt") {
  63373. const inputPattern = state.inputPattern;
  63374. if (inputPattern && !inputPattern.test(state.inputValue || "")) {
  63375. state.editorErrorMessage = state.inputErrorMessage || t("el.messagebox.error");
  63376. state.validateError = true;
  63377. return false;
  63378. }
  63379. const inputValidator = state.inputValidator;
  63380. if (isFunction$1(inputValidator)) {
  63381. const validateResult = inputValidator(state.inputValue);
  63382. if (validateResult === false) {
  63383. state.editorErrorMessage = state.inputErrorMessage || t("el.messagebox.error");
  63384. state.validateError = true;
  63385. return false;
  63386. }
  63387. if (isString$1(validateResult)) {
  63388. state.editorErrorMessage = validateResult;
  63389. state.validateError = true;
  63390. return false;
  63391. }
  63392. }
  63393. }
  63394. state.editorErrorMessage = "";
  63395. state.validateError = false;
  63396. return true;
  63397. };
  63398. const getInputElement = () => {
  63399. var _a, _b;
  63400. const inputRefs = (_a = inputRef.value) == null ? void 0 : _a.$refs;
  63401. return (_b = inputRefs == null ? void 0 : inputRefs.input) != null ? _b : inputRefs == null ? void 0 : inputRefs.textarea;
  63402. };
  63403. const handleClose = () => {
  63404. handleAction("close");
  63405. };
  63406. const onCloseRequested = () => {
  63407. if (props.closeOnPressEscape) {
  63408. handleClose();
  63409. }
  63410. };
  63411. if (props.lockScroll) {
  63412. useLockscreen(visible, { ns });
  63413. }
  63414. return {
  63415. ...vue.toRefs(state),
  63416. ns,
  63417. overlayEvent,
  63418. visible,
  63419. hasMessage,
  63420. typeClass,
  63421. contentId,
  63422. inputId,
  63423. btnSize,
  63424. iconComponent,
  63425. confirmButtonClasses,
  63426. rootRef,
  63427. focusStartRef,
  63428. headerRef,
  63429. inputRef,
  63430. isDragging,
  63431. confirmRef,
  63432. doClose,
  63433. handleClose,
  63434. onCloseRequested,
  63435. handleWrapperClick,
  63436. handleInputEnter,
  63437. handleAction,
  63438. t
  63439. };
  63440. }
  63441. });
  63442. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  63443. const _component_el_icon = vue.resolveComponent("el-icon");
  63444. const _component_el_input = vue.resolveComponent("el-input");
  63445. const _component_el_button = vue.resolveComponent("el-button");
  63446. const _component_el_focus_trap = vue.resolveComponent("el-focus-trap");
  63447. const _component_el_overlay = vue.resolveComponent("el-overlay");
  63448. return vue.openBlock(), vue.createBlock(vue.Transition, {
  63449. name: "fade-in-linear",
  63450. onAfterLeave: ($event) => _ctx.$emit("vanish"),
  63451. persisted: ""
  63452. }, {
  63453. default: vue.withCtx(() => [
  63454. vue.withDirectives(vue.createVNode(_component_el_overlay, {
  63455. "z-index": _ctx.zIndex,
  63456. "overlay-class": [_ctx.ns.is("message-box"), _ctx.modalClass],
  63457. mask: _ctx.modal
  63458. }, {
  63459. default: vue.withCtx(() => [
  63460. vue.createElementVNode("div", {
  63461. role: "dialog",
  63462. "aria-label": _ctx.title,
  63463. "aria-modal": "true",
  63464. "aria-describedby": !_ctx.showInput ? _ctx.contentId : void 0,
  63465. class: vue.normalizeClass(`${_ctx.ns.namespace.value}-overlay-message-box`),
  63466. onClick: _ctx.overlayEvent.onClick,
  63467. onMousedown: _ctx.overlayEvent.onMousedown,
  63468. onMouseup: _ctx.overlayEvent.onMouseup
  63469. }, [
  63470. vue.createVNode(_component_el_focus_trap, {
  63471. loop: "",
  63472. trapped: _ctx.visible,
  63473. "focus-trap-el": _ctx.rootRef,
  63474. "focus-start-el": _ctx.focusStartRef,
  63475. onReleaseRequested: _ctx.onCloseRequested
  63476. }, {
  63477. default: vue.withCtx(() => [
  63478. vue.createElementVNode("div", {
  63479. ref: "rootRef",
  63480. class: vue.normalizeClass([
  63481. _ctx.ns.b(),
  63482. _ctx.customClass,
  63483. _ctx.ns.is("draggable", _ctx.draggable),
  63484. _ctx.ns.is("dragging", _ctx.isDragging),
  63485. { [_ctx.ns.m("center")]: _ctx.center }
  63486. ]),
  63487. style: vue.normalizeStyle(_ctx.customStyle),
  63488. tabindex: "-1",
  63489. onClick: vue.withModifiers(() => {
  63490. }, ["stop"])
  63491. }, [
  63492. _ctx.title !== null && _ctx.title !== void 0 ? (vue.openBlock(), vue.createElementBlock("div", {
  63493. key: 0,
  63494. ref: "headerRef",
  63495. class: vue.normalizeClass([_ctx.ns.e("header"), { "show-close": _ctx.showClose }])
  63496. }, [
  63497. vue.createElementVNode("div", {
  63498. class: vue.normalizeClass(_ctx.ns.e("title"))
  63499. }, [
  63500. _ctx.iconComponent && _ctx.center ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
  63501. key: 0,
  63502. class: vue.normalizeClass([_ctx.ns.e("status"), _ctx.typeClass])
  63503. }, {
  63504. default: vue.withCtx(() => [
  63505. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.iconComponent)))
  63506. ]),
  63507. _: 1
  63508. }, 8, ["class"])) : vue.createCommentVNode("v-if", true),
  63509. vue.createElementVNode("span", null, vue.toDisplayString(_ctx.title), 1)
  63510. ], 2),
  63511. _ctx.showClose ? (vue.openBlock(), vue.createElementBlock("button", {
  63512. key: 0,
  63513. type: "button",
  63514. class: vue.normalizeClass(_ctx.ns.e("headerbtn")),
  63515. "aria-label": _ctx.t("el.messagebox.close"),
  63516. onClick: ($event) => _ctx.handleAction(_ctx.distinguishCancelAndClose ? "close" : "cancel"),
  63517. onKeydown: vue.withKeys(vue.withModifiers(($event) => _ctx.handleAction(_ctx.distinguishCancelAndClose ? "close" : "cancel"), ["prevent"]), ["enter"])
  63518. }, [
  63519. vue.createVNode(_component_el_icon, {
  63520. class: vue.normalizeClass(_ctx.ns.e("close"))
  63521. }, {
  63522. default: vue.withCtx(() => [
  63523. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.closeIcon || "close")))
  63524. ]),
  63525. _: 1
  63526. }, 8, ["class"])
  63527. ], 42, ["aria-label", "onClick", "onKeydown"])) : vue.createCommentVNode("v-if", true)
  63528. ], 2)) : vue.createCommentVNode("v-if", true),
  63529. vue.createElementVNode("div", {
  63530. id: _ctx.contentId,
  63531. class: vue.normalizeClass(_ctx.ns.e("content"))
  63532. }, [
  63533. vue.createElementVNode("div", {
  63534. class: vue.normalizeClass(_ctx.ns.e("container"))
  63535. }, [
  63536. _ctx.iconComponent && !_ctx.center && _ctx.hasMessage ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
  63537. key: 0,
  63538. class: vue.normalizeClass([_ctx.ns.e("status"), _ctx.typeClass])
  63539. }, {
  63540. default: vue.withCtx(() => [
  63541. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.iconComponent)))
  63542. ]),
  63543. _: 1
  63544. }, 8, ["class"])) : vue.createCommentVNode("v-if", true),
  63545. _ctx.hasMessage ? (vue.openBlock(), vue.createElementBlock("div", {
  63546. key: 1,
  63547. class: vue.normalizeClass(_ctx.ns.e("message"))
  63548. }, [
  63549. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  63550. !_ctx.dangerouslyUseHTMLString ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.showInput ? "label" : "p"), {
  63551. key: 0,
  63552. for: _ctx.showInput ? _ctx.inputId : void 0,
  63553. textContent: vue.toDisplayString(_ctx.message)
  63554. }, null, 8, ["for", "textContent"])) : (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.showInput ? "label" : "p"), {
  63555. key: 1,
  63556. for: _ctx.showInput ? _ctx.inputId : void 0,
  63557. innerHTML: _ctx.message
  63558. }, null, 8, ["for", "innerHTML"]))
  63559. ])
  63560. ], 2)) : vue.createCommentVNode("v-if", true)
  63561. ], 2),
  63562. vue.withDirectives(vue.createElementVNode("div", {
  63563. class: vue.normalizeClass(_ctx.ns.e("input"))
  63564. }, [
  63565. vue.createVNode(_component_el_input, {
  63566. id: _ctx.inputId,
  63567. ref: "inputRef",
  63568. modelValue: _ctx.inputValue,
  63569. "onUpdate:modelValue": ($event) => _ctx.inputValue = $event,
  63570. type: _ctx.inputType,
  63571. placeholder: _ctx.inputPlaceholder,
  63572. "aria-invalid": _ctx.validateError,
  63573. class: vue.normalizeClass({ invalid: _ctx.validateError }),
  63574. onKeydown: vue.withKeys(_ctx.handleInputEnter, ["enter"])
  63575. }, null, 8, ["id", "modelValue", "onUpdate:modelValue", "type", "placeholder", "aria-invalid", "class", "onKeydown"]),
  63576. vue.createElementVNode("div", {
  63577. class: vue.normalizeClass(_ctx.ns.e("errormsg")),
  63578. style: vue.normalizeStyle({
  63579. visibility: !!_ctx.editorErrorMessage ? "visible" : "hidden"
  63580. })
  63581. }, vue.toDisplayString(_ctx.editorErrorMessage), 7)
  63582. ], 2), [
  63583. [vue.vShow, _ctx.showInput]
  63584. ])
  63585. ], 10, ["id"]),
  63586. vue.createElementVNode("div", {
  63587. class: vue.normalizeClass(_ctx.ns.e("btns"))
  63588. }, [
  63589. _ctx.showCancelButton ? (vue.openBlock(), vue.createBlock(_component_el_button, {
  63590. key: 0,
  63591. loading: _ctx.cancelButtonLoading,
  63592. "loading-icon": _ctx.cancelButtonLoadingIcon,
  63593. class: vue.normalizeClass([_ctx.cancelButtonClass]),
  63594. round: _ctx.roundButton,
  63595. size: _ctx.btnSize,
  63596. onClick: ($event) => _ctx.handleAction("cancel"),
  63597. onKeydown: vue.withKeys(vue.withModifiers(($event) => _ctx.handleAction("cancel"), ["prevent"]), ["enter"])
  63598. }, {
  63599. default: vue.withCtx(() => [
  63600. vue.createTextVNode(vue.toDisplayString(_ctx.cancelButtonText || _ctx.t("el.messagebox.cancel")), 1)
  63601. ]),
  63602. _: 1
  63603. }, 8, ["loading", "loading-icon", "class", "round", "size", "onClick", "onKeydown"])) : vue.createCommentVNode("v-if", true),
  63604. vue.withDirectives(vue.createVNode(_component_el_button, {
  63605. ref: "confirmRef",
  63606. type: "primary",
  63607. loading: _ctx.confirmButtonLoading,
  63608. "loading-icon": _ctx.confirmButtonLoadingIcon,
  63609. class: vue.normalizeClass([_ctx.confirmButtonClasses]),
  63610. round: _ctx.roundButton,
  63611. disabled: _ctx.confirmButtonDisabled,
  63612. size: _ctx.btnSize,
  63613. onClick: ($event) => _ctx.handleAction("confirm"),
  63614. onKeydown: vue.withKeys(vue.withModifiers(($event) => _ctx.handleAction("confirm"), ["prevent"]), ["enter"])
  63615. }, {
  63616. default: vue.withCtx(() => [
  63617. vue.createTextVNode(vue.toDisplayString(_ctx.confirmButtonText || _ctx.t("el.messagebox.confirm")), 1)
  63618. ]),
  63619. _: 1
  63620. }, 8, ["loading", "loading-icon", "class", "round", "disabled", "size", "onClick", "onKeydown"]), [
  63621. [vue.vShow, _ctx.showConfirmButton]
  63622. ])
  63623. ], 2)
  63624. ], 14, ["onClick"])
  63625. ]),
  63626. _: 3
  63627. }, 8, ["trapped", "focus-trap-el", "focus-start-el", "onReleaseRequested"])
  63628. ], 42, ["aria-label", "aria-describedby", "onClick", "onMousedown", "onMouseup"])
  63629. ]),
  63630. _: 3
  63631. }, 8, ["z-index", "overlay-class", "mask"]), [
  63632. [vue.vShow, _ctx.visible]
  63633. ])
  63634. ]),
  63635. _: 3
  63636. }, 8, ["onAfterLeave"]);
  63637. }
  63638. var MessageBoxConstructor = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render], ["__file", "index.vue"]]);
  63639. const messageInstance = /* @__PURE__ */ new Map();
  63640. const getAppendToElement = (props) => {
  63641. let appendTo = document.body;
  63642. if (props.appendTo) {
  63643. if (isString$1(props.appendTo)) {
  63644. appendTo = document.querySelector(props.appendTo);
  63645. }
  63646. if (isElement$2(props.appendTo)) {
  63647. appendTo = props.appendTo;
  63648. }
  63649. if (!isElement$2(appendTo)) {
  63650. debugWarn("ElMessageBox", "the appendTo option is not an HTMLElement. Falling back to document.body.");
  63651. appendTo = document.body;
  63652. }
  63653. }
  63654. return appendTo;
  63655. };
  63656. const initInstance = (props, container, appContext = null) => {
  63657. const vnode = vue.createVNode(MessageBoxConstructor, props, isFunction$1(props.message) || vue.isVNode(props.message) ? {
  63658. default: isFunction$1(props.message) ? props.message : () => props.message
  63659. } : null);
  63660. vnode.appContext = appContext;
  63661. vue.render(vnode, container);
  63662. getAppendToElement(props).appendChild(container.firstElementChild);
  63663. return vnode.component;
  63664. };
  63665. const genContainer = () => {
  63666. return document.createElement("div");
  63667. };
  63668. const showMessage = (options, appContext) => {
  63669. const container = genContainer();
  63670. options.onVanish = () => {
  63671. vue.render(null, container);
  63672. messageInstance.delete(vm);
  63673. };
  63674. options.onAction = (action) => {
  63675. const currentMsg = messageInstance.get(vm);
  63676. let resolve;
  63677. if (options.showInput) {
  63678. resolve = { value: vm.inputValue, action };
  63679. } else {
  63680. resolve = action;
  63681. }
  63682. if (options.callback) {
  63683. options.callback(resolve, instance.proxy);
  63684. } else {
  63685. if (action === "cancel" || action === "close") {
  63686. if (options.distinguishCancelAndClose && action !== "cancel") {
  63687. currentMsg.reject("close");
  63688. } else {
  63689. currentMsg.reject("cancel");
  63690. }
  63691. } else {
  63692. currentMsg.resolve(resolve);
  63693. }
  63694. }
  63695. };
  63696. const instance = initInstance(options, container, appContext);
  63697. const vm = instance.proxy;
  63698. for (const prop in options) {
  63699. if (hasOwn(options, prop) && !hasOwn(vm.$props, prop)) {
  63700. if (prop === "closeIcon" && isObject$1(options[prop])) {
  63701. vm[prop] = vue.markRaw(options[prop]);
  63702. } else {
  63703. vm[prop] = options[prop];
  63704. }
  63705. }
  63706. }
  63707. vm.visible = true;
  63708. return vm;
  63709. };
  63710. function MessageBox(options, appContext = null) {
  63711. if (!isClient)
  63712. return Promise.reject();
  63713. let callback;
  63714. if (isString$1(options) || vue.isVNode(options)) {
  63715. options = {
  63716. message: options
  63717. };
  63718. } else {
  63719. callback = options.callback;
  63720. }
  63721. return new Promise((resolve, reject) => {
  63722. const vm = showMessage(options, appContext != null ? appContext : MessageBox._context);
  63723. messageInstance.set(vm, {
  63724. options,
  63725. callback,
  63726. resolve,
  63727. reject
  63728. });
  63729. });
  63730. }
  63731. const MESSAGE_BOX_VARIANTS = ["alert", "confirm", "prompt"];
  63732. const MESSAGE_BOX_DEFAULT_OPTS = {
  63733. alert: { closeOnPressEscape: false, closeOnClickModal: false },
  63734. confirm: { showCancelButton: true },
  63735. prompt: { showCancelButton: true, showInput: true }
  63736. };
  63737. MESSAGE_BOX_VARIANTS.forEach((boxType) => {
  63738. MessageBox[boxType] = messageBoxFactory(boxType);
  63739. });
  63740. function messageBoxFactory(boxType) {
  63741. return (message, title, options, appContext) => {
  63742. let titleOrOpts = "";
  63743. if (isObject$1(title)) {
  63744. options = title;
  63745. titleOrOpts = "";
  63746. } else if (isUndefined(title)) {
  63747. titleOrOpts = "";
  63748. } else {
  63749. titleOrOpts = title;
  63750. }
  63751. return MessageBox(Object.assign({
  63752. title: titleOrOpts,
  63753. message,
  63754. type: "",
  63755. ...MESSAGE_BOX_DEFAULT_OPTS[boxType]
  63756. }, options, {
  63757. boxType
  63758. }), appContext);
  63759. };
  63760. }
  63761. MessageBox.close = () => {
  63762. messageInstance.forEach((_, vm) => {
  63763. vm.doClose();
  63764. });
  63765. messageInstance.clear();
  63766. };
  63767. MessageBox._context = null;
  63768. const _MessageBox = MessageBox;
  63769. _MessageBox.install = (app) => {
  63770. _MessageBox._context = app._context;
  63771. app.config.globalProperties.$msgbox = _MessageBox;
  63772. app.config.globalProperties.$messageBox = _MessageBox;
  63773. app.config.globalProperties.$alert = _MessageBox.alert;
  63774. app.config.globalProperties.$confirm = _MessageBox.confirm;
  63775. app.config.globalProperties.$prompt = _MessageBox.prompt;
  63776. };
  63777. const ElMessageBox = _MessageBox;
  63778. const notificationTypes = [
  63779. "primary",
  63780. "success",
  63781. "info",
  63782. "warning",
  63783. "error"
  63784. ];
  63785. const notificationProps = buildProps({
  63786. customClass: {
  63787. type: String,
  63788. default: ""
  63789. },
  63790. dangerouslyUseHTMLString: Boolean,
  63791. duration: {
  63792. type: Number,
  63793. default: 4500
  63794. },
  63795. icon: {
  63796. type: iconPropType
  63797. },
  63798. id: {
  63799. type: String,
  63800. default: ""
  63801. },
  63802. message: {
  63803. type: definePropType([
  63804. String,
  63805. Object,
  63806. Function
  63807. ]),
  63808. default: ""
  63809. },
  63810. offset: {
  63811. type: Number,
  63812. default: 0
  63813. },
  63814. onClick: {
  63815. type: definePropType(Function),
  63816. default: () => void 0
  63817. },
  63818. onClose: {
  63819. type: definePropType(Function),
  63820. required: true
  63821. },
  63822. position: {
  63823. type: String,
  63824. values: ["top-right", "top-left", "bottom-right", "bottom-left"],
  63825. default: "top-right"
  63826. },
  63827. showClose: {
  63828. type: Boolean,
  63829. default: true
  63830. },
  63831. title: {
  63832. type: String,
  63833. default: ""
  63834. },
  63835. type: {
  63836. type: String,
  63837. values: [...notificationTypes, ""],
  63838. default: ""
  63839. },
  63840. zIndex: Number,
  63841. closeIcon: {
  63842. type: iconPropType,
  63843. default: close_default
  63844. }
  63845. });
  63846. const notificationEmits = {
  63847. destroy: () => true
  63848. };
  63849. const __default__ = vue.defineComponent({
  63850. name: "ElNotification"
  63851. });
  63852. const _sfc_main = /* @__PURE__ */ vue.defineComponent({
  63853. ...__default__,
  63854. props: notificationProps,
  63855. emits: notificationEmits,
  63856. setup(__props, { expose }) {
  63857. const props = __props;
  63858. const { ns, zIndex } = useGlobalComponentSettings("notification");
  63859. const { nextZIndex, currentZIndex } = zIndex;
  63860. const visible = vue.ref(false);
  63861. let timer = void 0;
  63862. const typeClass = vue.computed(() => {
  63863. const type = props.type;
  63864. return type && TypeComponentsMap[props.type] ? ns.m(type) : "";
  63865. });
  63866. const iconComponent = vue.computed(() => {
  63867. if (!props.type)
  63868. return props.icon;
  63869. return TypeComponentsMap[props.type] || props.icon;
  63870. });
  63871. const horizontalClass = vue.computed(() => props.position.endsWith("right") ? "right" : "left");
  63872. const verticalProperty = vue.computed(() => props.position.startsWith("top") ? "top" : "bottom");
  63873. const positionStyle = vue.computed(() => {
  63874. var _a;
  63875. return {
  63876. [verticalProperty.value]: `${props.offset}px`,
  63877. zIndex: (_a = props.zIndex) != null ? _a : currentZIndex.value
  63878. };
  63879. });
  63880. function startTimer() {
  63881. if (props.duration > 0) {
  63882. ({ stop: timer } = useTimeoutFn(() => {
  63883. if (visible.value)
  63884. close();
  63885. }, props.duration));
  63886. }
  63887. }
  63888. function clearTimer() {
  63889. timer == null ? void 0 : timer();
  63890. }
  63891. function close() {
  63892. visible.value = false;
  63893. }
  63894. function onKeydown(event) {
  63895. const code = getEventCode(event);
  63896. switch (code) {
  63897. case EVENT_CODE.delete:
  63898. case EVENT_CODE.backspace:
  63899. clearTimer();
  63900. break;
  63901. case EVENT_CODE.esc:
  63902. if (visible.value) {
  63903. close();
  63904. }
  63905. break;
  63906. default:
  63907. startTimer();
  63908. break;
  63909. }
  63910. }
  63911. vue.onMounted(() => {
  63912. startTimer();
  63913. nextZIndex();
  63914. visible.value = true;
  63915. });
  63916. useEventListener(document, "keydown", onKeydown);
  63917. expose({
  63918. visible,
  63919. close
  63920. });
  63921. return (_ctx, _cache) => {
  63922. return vue.openBlock(), vue.createBlock(vue.Transition, {
  63923. name: vue.unref(ns).b("fade"),
  63924. onBeforeLeave: _ctx.onClose,
  63925. onAfterLeave: ($event) => _ctx.$emit("destroy"),
  63926. persisted: ""
  63927. }, {
  63928. default: vue.withCtx(() => [
  63929. vue.withDirectives(vue.createElementVNode("div", {
  63930. id: _ctx.id,
  63931. class: vue.normalizeClass([vue.unref(ns).b(), _ctx.customClass, vue.unref(horizontalClass)]),
  63932. style: vue.normalizeStyle(vue.unref(positionStyle)),
  63933. role: "alert",
  63934. onMouseenter: clearTimer,
  63935. onMouseleave: startTimer,
  63936. onClick: _ctx.onClick
  63937. }, [
  63938. vue.unref(iconComponent) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  63939. key: 0,
  63940. class: vue.normalizeClass([vue.unref(ns).e("icon"), vue.unref(typeClass)])
  63941. }, {
  63942. default: vue.withCtx(() => [
  63943. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(iconComponent))))
  63944. ]),
  63945. _: 1
  63946. }, 8, ["class"])) : vue.createCommentVNode("v-if", true),
  63947. vue.createElementVNode("div", {
  63948. class: vue.normalizeClass(vue.unref(ns).e("group"))
  63949. }, [
  63950. vue.createElementVNode("h2", {
  63951. class: vue.normalizeClass(vue.unref(ns).e("title")),
  63952. textContent: vue.toDisplayString(_ctx.title)
  63953. }, null, 10, ["textContent"]),
  63954. vue.withDirectives(vue.createElementVNode("div", {
  63955. class: vue.normalizeClass(vue.unref(ns).e("content")),
  63956. style: vue.normalizeStyle(!!_ctx.title ? void 0 : { margin: 0 })
  63957. }, [
  63958. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  63959. !_ctx.dangerouslyUseHTMLString ? (vue.openBlock(), vue.createElementBlock("p", { key: 0 }, vue.toDisplayString(_ctx.message), 1)) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  63960. vue.createCommentVNode(" Caution here, message could've been compromised, never use user's input as message "),
  63961. vue.createElementVNode("p", { innerHTML: _ctx.message }, null, 8, ["innerHTML"])
  63962. ], 2112))
  63963. ])
  63964. ], 6), [
  63965. [vue.vShow, _ctx.message]
  63966. ]),
  63967. _ctx.showClose ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  63968. key: 0,
  63969. class: vue.normalizeClass(vue.unref(ns).e("closeBtn")),
  63970. onClick: vue.withModifiers(close, ["stop"])
  63971. }, {
  63972. default: vue.withCtx(() => [
  63973. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.closeIcon)))
  63974. ]),
  63975. _: 1
  63976. }, 8, ["class", "onClick"])) : vue.createCommentVNode("v-if", true)
  63977. ], 2)
  63978. ], 46, ["id", "onClick"]), [
  63979. [vue.vShow, visible.value]
  63980. ])
  63981. ]),
  63982. _: 3
  63983. }, 8, ["name", "onBeforeLeave", "onAfterLeave"]);
  63984. };
  63985. }
  63986. });
  63987. var NotificationConstructor = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "notification.vue"]]);
  63988. const notifications = {
  63989. "top-left": [],
  63990. "top-right": [],
  63991. "bottom-left": [],
  63992. "bottom-right": []
  63993. };
  63994. const GAP_SIZE = 16;
  63995. let seed = 1;
  63996. const notify = function(options = {}, context) {
  63997. if (!isClient)
  63998. return { close: () => void 0 };
  63999. if (isString$1(options) || vue.isVNode(options)) {
  64000. options = { message: options };
  64001. }
  64002. const position = options.position || "top-right";
  64003. let verticalOffset = options.offset || 0;
  64004. notifications[position].forEach(({ vm: vm2 }) => {
  64005. var _a;
  64006. verticalOffset += (((_a = vm2.el) == null ? void 0 : _a.offsetHeight) || 0) + GAP_SIZE;
  64007. });
  64008. verticalOffset += GAP_SIZE;
  64009. const id = `notification_${seed++}`;
  64010. const userOnClose = options.onClose;
  64011. const props = {
  64012. ...options,
  64013. offset: verticalOffset,
  64014. id,
  64015. onClose: () => {
  64016. close(id, position, userOnClose);
  64017. }
  64018. };
  64019. let appendTo = document.body;
  64020. if (isElement$2(options.appendTo)) {
  64021. appendTo = options.appendTo;
  64022. } else if (isString$1(options.appendTo)) {
  64023. appendTo = document.querySelector(options.appendTo);
  64024. }
  64025. if (!isElement$2(appendTo)) {
  64026. debugWarn("ElNotification", "the appendTo option is not an HTMLElement. Falling back to document.body.");
  64027. appendTo = document.body;
  64028. }
  64029. const container = document.createElement("div");
  64030. const vm = vue.createVNode(NotificationConstructor, props, isFunction$1(props.message) ? props.message : vue.isVNode(props.message) ? () => props.message : null);
  64031. vm.appContext = isUndefined(context) ? notify._context : context;
  64032. vm.props.onDestroy = () => {
  64033. vue.render(null, container);
  64034. };
  64035. vue.render(vm, container);
  64036. notifications[position].push({ vm });
  64037. appendTo.appendChild(container.firstElementChild);
  64038. return {
  64039. close: () => {
  64040. vm.component.exposed.visible.value = false;
  64041. }
  64042. };
  64043. };
  64044. notificationTypes.forEach((type) => {
  64045. notify[type] = (options = {}, appContext) => {
  64046. if (isString$1(options) || vue.isVNode(options)) {
  64047. options = {
  64048. message: options
  64049. };
  64050. }
  64051. return notify({ ...options, type }, appContext);
  64052. };
  64053. });
  64054. function close(id, position, userOnClose) {
  64055. const orientedNotifications = notifications[position];
  64056. const idx = orientedNotifications.findIndex(({ vm: vm2 }) => {
  64057. var _a;
  64058. return ((_a = vm2.component) == null ? void 0 : _a.props.id) === id;
  64059. });
  64060. if (idx === -1)
  64061. return;
  64062. const { vm } = orientedNotifications[idx];
  64063. if (!vm)
  64064. return;
  64065. userOnClose == null ? void 0 : userOnClose(vm);
  64066. const removedHeight = vm.el.offsetHeight;
  64067. const verticalPos = position.split("-")[0];
  64068. orientedNotifications.splice(idx, 1);
  64069. const len = orientedNotifications.length;
  64070. if (len < 1)
  64071. return;
  64072. for (let i = idx; i < len; i++) {
  64073. const { el, component } = orientedNotifications[i].vm;
  64074. const pos = Number.parseInt(el.style[verticalPos], 10) - removedHeight - GAP_SIZE;
  64075. component.props.offset = pos;
  64076. }
  64077. }
  64078. function closeAll() {
  64079. for (const orientedNotifications of Object.values(notifications)) {
  64080. orientedNotifications.forEach(({ vm }) => {
  64081. vm.component.exposed.visible.value = false;
  64082. });
  64083. }
  64084. }
  64085. function updateOffsets(position = "top-right") {
  64086. var _a, _b, _c, _d;
  64087. let verticalOffset = ((_c = (_b = (_a = notifications[position][0]) == null ? void 0 : _a.vm.component) == null ? void 0 : _b.props) == null ? void 0 : _c.offset) || 0;
  64088. for (const { vm } of notifications[position]) {
  64089. vm.component.props.offset = verticalOffset;
  64090. verticalOffset += (((_d = vm.el) == null ? void 0 : _d.offsetHeight) || 0) + GAP_SIZE;
  64091. }
  64092. }
  64093. notify.closeAll = closeAll;
  64094. notify.updateOffsets = updateOffsets;
  64095. notify._context = null;
  64096. var Notify = notify;
  64097. const ElNotification = withInstallFunction(Notify, "$notify");
  64098. var Plugins = [
  64099. ElInfiniteScroll,
  64100. ElLoading,
  64101. ElMessage,
  64102. ElMessageBox,
  64103. ElNotification,
  64104. ElPopoverDirective
  64105. ];
  64106. var installer = makeInstaller([...Components, ...Plugins]);
  64107. const install = installer.install;
  64108. const version = installer.version;
  64109. exports.BAR_MAP = BAR_MAP;
  64110. exports.BORDER_HORIZONTAL_WIDTH = BORDER_HORIZONTAL_WIDTH;
  64111. exports.CAROUSEL_ITEM_NAME = CAROUSEL_ITEM_NAME;
  64112. exports.CASCADER_PANEL_INJECTION_KEY = CASCADER_PANEL_INJECTION_KEY;
  64113. exports.CHANGE_EVENT = CHANGE_EVENT;
  64114. exports.ClickOutside = ClickOutside;
  64115. exports.CommonPicker = CommonPicker;
  64116. exports.CommonProps = CommonProps;
  64117. exports.DEFAULT_DIALOG_TRANSITION = DEFAULT_DIALOG_TRANSITION;
  64118. exports.DEFAULT_EMPTY_VALUES = DEFAULT_EMPTY_VALUES;
  64119. exports.DEFAULT_FORMATS_DATE = DEFAULT_FORMATS_DATE;
  64120. exports.DEFAULT_FORMATS_DATEPICKER = DEFAULT_FORMATS_DATEPICKER;
  64121. exports.DEFAULT_FORMATS_TIME = DEFAULT_FORMATS_TIME;
  64122. exports.DEFAULT_VALUE_ON_CLEAR = DEFAULT_VALUE_ON_CLEAR;
  64123. exports.DROPDOWN_INJECTION_KEY = DROPDOWN_INJECTION_KEY;
  64124. exports.DROPDOWN_INSTANCE_INJECTION_KEY = DROPDOWN_INSTANCE_INJECTION_KEY;
  64125. exports.DefaultProps = DefaultProps;
  64126. exports.DynamicSizeGrid = DynamicSizeGrid$1;
  64127. exports.DynamicSizeList = DynamicSizeList$1;
  64128. exports.EVENT_CODE = EVENT_CODE;
  64129. exports.Effect = Effect;
  64130. exports.ElAffix = ElAffix;
  64131. exports.ElAlert = ElAlert;
  64132. exports.ElAnchor = ElAnchor;
  64133. exports.ElAnchorLink = ElAnchorLink;
  64134. exports.ElAside = ElAside;
  64135. exports.ElAutoResizer = ElAutoResizer;
  64136. exports.ElAutocomplete = ElAutocomplete;
  64137. exports.ElAvatar = ElAvatar;
  64138. exports.ElBacktop = ElBacktop;
  64139. exports.ElBadge = ElBadge;
  64140. exports.ElBreadcrumb = ElBreadcrumb;
  64141. exports.ElBreadcrumbItem = ElBreadcrumbItem;
  64142. exports.ElButton = ElButton;
  64143. exports.ElButtonGroup = ElButtonGroup$1;
  64144. exports.ElCalendar = ElCalendar;
  64145. exports.ElCard = ElCard;
  64146. exports.ElCarousel = ElCarousel;
  64147. exports.ElCarouselItem = ElCarouselItem;
  64148. exports.ElCascader = ElCascader;
  64149. exports.ElCascaderPanel = ElCascaderPanel;
  64150. exports.ElCheckTag = ElCheckTag;
  64151. exports.ElCheckbox = ElCheckbox;
  64152. exports.ElCheckboxButton = ElCheckboxButton;
  64153. exports.ElCheckboxGroup = ElCheckboxGroup$1;
  64154. exports.ElCol = ElCol;
  64155. exports.ElCollapse = ElCollapse;
  64156. exports.ElCollapseItem = ElCollapseItem;
  64157. exports.ElCollapseTransition = ElCollapseTransition;
  64158. exports.ElColorPicker = ElColorPicker;
  64159. exports.ElColorPickerPanel = ElColorPickerPanel;
  64160. exports.ElConfigProvider = ElConfigProvider;
  64161. exports.ElContainer = ElContainer;
  64162. exports.ElCountdown = ElCountdown;
  64163. exports.ElDatePicker = ElDatePicker;
  64164. exports.ElDatePickerPanel = ElDatePickerPanel;
  64165. exports.ElDescriptions = ElDescriptions;
  64166. exports.ElDescriptionsItem = ElDescriptionsItem;
  64167. exports.ElDialog = ElDialog;
  64168. exports.ElDivider = ElDivider;
  64169. exports.ElDrawer = ElDrawer;
  64170. exports.ElDropdown = ElDropdown;
  64171. exports.ElDropdownItem = ElDropdownItem;
  64172. exports.ElDropdownMenu = ElDropdownMenu;
  64173. exports.ElEmpty = ElEmpty;
  64174. exports.ElFooter = ElFooter;
  64175. exports.ElForm = ElForm;
  64176. exports.ElFormItem = ElFormItem;
  64177. exports.ElHeader = ElHeader;
  64178. exports.ElIcon = ElIcon;
  64179. exports.ElImage = ElImage;
  64180. exports.ElImageViewer = ElImageViewer;
  64181. exports.ElInfiniteScroll = ElInfiniteScroll;
  64182. exports.ElInput = ElInput;
  64183. exports.ElInputNumber = ElInputNumber;
  64184. exports.ElInputTag = ElInputTag;
  64185. exports.ElLink = ElLink;
  64186. exports.ElLoading = ElLoading;
  64187. exports.ElLoadingDirective = vLoading$1;
  64188. exports.ElLoadingService = Loading$1;
  64189. exports.ElMain = ElMain;
  64190. exports.ElMention = ElMention;
  64191. exports.ElMenu = ElMenu;
  64192. exports.ElMenuItem = ElMenuItem;
  64193. exports.ElMenuItemGroup = ElMenuItemGroup;
  64194. exports.ElMessage = ElMessage;
  64195. exports.ElMessageBox = ElMessageBox;
  64196. exports.ElNotification = ElNotification;
  64197. exports.ElOption = ElOption;
  64198. exports.ElOptionGroup = ElOptionGroup;
  64199. exports.ElOverlay = ElOverlay;
  64200. exports.ElPageHeader = ElPageHeader;
  64201. exports.ElPagination = ElPagination;
  64202. exports.ElPopconfirm = ElPopconfirm;
  64203. exports.ElPopover = ElPopover;
  64204. exports.ElPopoverDirective = ElPopoverDirective;
  64205. exports.ElPopper = ElPopper;
  64206. exports.ElPopperArrow = ElPopperArrow;
  64207. exports.ElPopperContent = ElPopperContent;
  64208. exports.ElPopperTrigger = ElPopperTrigger;
  64209. exports.ElProgress = ElProgress;
  64210. exports.ElRadio = ElRadio;
  64211. exports.ElRadioButton = ElRadioButton;
  64212. exports.ElRadioGroup = ElRadioGroup;
  64213. exports.ElRate = ElRate;
  64214. exports.ElResult = ElResult;
  64215. exports.ElRow = ElRow;
  64216. exports.ElScrollbar = ElScrollbar;
  64217. exports.ElSegmented = ElSegmented;
  64218. exports.ElSelect = ElSelect;
  64219. exports.ElSelectV2 = ElSelectV2;
  64220. exports.ElSkeleton = ElSkeleton;
  64221. exports.ElSkeletonItem = ElSkeletonItem;
  64222. exports.ElSlider = ElSlider;
  64223. exports.ElSpace = ElSpace;
  64224. exports.ElSplitter = ElSplitter;
  64225. exports.ElSplitterPanel = ElSplitterPanel;
  64226. exports.ElStatistic = ElStatistic;
  64227. exports.ElStep = ElStep;
  64228. exports.ElSteps = ElSteps;
  64229. exports.ElSubMenu = ElSubMenu;
  64230. exports.ElSwitch = ElSwitch;
  64231. exports.ElTabPane = ElTabPane;
  64232. exports.ElTable = ElTable;
  64233. exports.ElTableColumn = ElTableColumn;
  64234. exports.ElTableV2 = ElTableV2;
  64235. exports.ElTabs = ElTabs;
  64236. exports.ElTag = ElTag;
  64237. exports.ElText = ElText;
  64238. exports.ElTimePicker = ElTimePicker;
  64239. exports.ElTimeSelect = ElTimeSelect;
  64240. exports.ElTimeline = ElTimeline;
  64241. exports.ElTimelineItem = ElTimelineItem;
  64242. exports.ElTooltip = ElTooltip;
  64243. exports.ElTour = ElTour;
  64244. exports.ElTourStep = ElTourStep;
  64245. exports.ElTransfer = ElTransfer;
  64246. exports.ElTree = ElTree;
  64247. exports.ElTreeSelect = ElTreeSelect;
  64248. exports.ElTreeV2 = ElTreeV2;
  64249. exports.ElUpload = ElUpload;
  64250. exports.ElWatermark = ElWatermark;
  64251. exports.FIRST_KEYS = FIRST_KEYS;
  64252. exports.FIRST_LAST_KEYS = FIRST_LAST_KEYS;
  64253. exports.FORWARD_REF_INJECTION_KEY = FORWARD_REF_INJECTION_KEY;
  64254. exports.FixedSizeGrid = FixedSizeGrid$1;
  64255. exports.FixedSizeList = FixedSizeList$1;
  64256. exports.GAP = GAP;
  64257. exports.ID_INJECTION_KEY = ID_INJECTION_KEY;
  64258. exports.INPUT_EVENT = INPUT_EVENT;
  64259. exports.INSTALLED_KEY = INSTALLED_KEY;
  64260. exports.IconComponentMap = IconComponentMap;
  64261. exports.IconMap = IconMap;
  64262. exports.LAST_KEYS = LAST_KEYS;
  64263. exports.LEFT_CHECK_CHANGE_EVENT = LEFT_CHECK_CHANGE_EVENT;
  64264. exports.MENU_INJECTION_KEY = MENU_INJECTION_KEY;
  64265. exports.MESSAGE_DEFAULT_PLACEMENT = MESSAGE_DEFAULT_PLACEMENT;
  64266. exports.MINIMUM_INPUT_WIDTH = MINIMUM_INPUT_WIDTH;
  64267. exports.Mousewheel = Mousewheel;
  64268. exports.NODE_INSTANCE_INJECTION_KEY = NODE_INSTANCE_INJECTION_KEY;
  64269. exports.PICKER_BASE_INJECTION_KEY = PICKER_BASE_INJECTION_KEY;
  64270. exports.PICKER_POPPER_OPTIONS_INJECTION_KEY = PICKER_POPPER_OPTIONS_INJECTION_KEY;
  64271. exports.POPPER_CONTENT_INJECTION_KEY = POPPER_CONTENT_INJECTION_KEY;
  64272. exports.POPPER_INJECTION_KEY = POPPER_INJECTION_KEY;
  64273. exports.RIGHT_CHECK_CHANGE_EVENT = RIGHT_CHECK_CHANGE_EVENT;
  64274. exports.ROOT_COMMON_COLOR_INJECTION_KEY = ROOT_COMMON_COLOR_INJECTION_KEY;
  64275. exports.ROOT_COMMON_PICKER_INJECTION_KEY = ROOT_COMMON_PICKER_INJECTION_KEY;
  64276. exports.ROOT_PICKER_INJECTION_KEY = ROOT_PICKER_INJECTION_KEY;
  64277. exports.ROOT_PICKER_IS_DEFAULT_FORMAT_INJECTION_KEY = ROOT_PICKER_IS_DEFAULT_FORMAT_INJECTION_KEY;
  64278. exports.ROOT_TREE_INJECTION_KEY = ROOT_TREE_INJECTION_KEY$1;
  64279. exports.RowAlign = RowAlign;
  64280. exports.RowJustify = RowJustify;
  64281. exports.SCOPE = SCOPE$7;
  64282. exports.SIZE_INJECTION_KEY = SIZE_INJECTION_KEY;
  64283. exports.STEPS_INJECTION_KEY = STEPS_INJECTION_KEY;
  64284. exports.SUB_MENU_INJECTION_KEY = SUB_MENU_INJECTION_KEY;
  64285. exports.TIMELINE_INJECTION_KEY = TIMELINE_INJECTION_KEY;
  64286. exports.TOOLTIP_INJECTION_KEY = TOOLTIP_INJECTION_KEY;
  64287. exports.TREE_NODE_MAP_INJECTION_KEY = TREE_NODE_MAP_INJECTION_KEY;
  64288. exports.TableV2 = TableV2$1;
  64289. exports.TableV2Alignment = Alignment;
  64290. exports.TableV2FixedDir = FixedDir;
  64291. exports.TableV2Placeholder = placeholderSign;
  64292. exports.TableV2SortOrder = SortOrder;
  64293. exports.TimePickPanel = TimePickPanel;
  64294. exports.TrapFocus = TrapFocus;
  64295. exports.UPDATE_MODEL_EVENT = UPDATE_MODEL_EVENT;
  64296. exports.WEEK_DAYS = WEEK_DAYS;
  64297. exports.ZINDEX_INJECTION_KEY = ZINDEX_INJECTION_KEY;
  64298. exports.affixEmits = affixEmits;
  64299. exports.affixProps = affixProps;
  64300. exports.alertEffects = alertEffects;
  64301. exports.alertEmits = alertEmits;
  64302. exports.alertProps = alertProps;
  64303. exports.anchorEmits = anchorEmits;
  64304. exports.anchorProps = anchorProps;
  64305. exports.ariaProps = ariaProps;
  64306. exports.arrowMiddleware = arrowMiddleware;
  64307. exports.autoResizerProps = autoResizerProps;
  64308. exports.autocompleteEmits = autocompleteEmits;
  64309. exports.autocompleteProps = autocompleteProps;
  64310. exports.avatarEmits = avatarEmits;
  64311. exports.avatarProps = avatarProps;
  64312. exports.backtopEmits = backtopEmits;
  64313. exports.backtopProps = backtopProps;
  64314. exports.badgeProps = badgeProps;
  64315. exports.breadcrumbItemProps = breadcrumbItemProps;
  64316. exports.breadcrumbKey = breadcrumbKey;
  64317. exports.breadcrumbProps = breadcrumbProps;
  64318. exports.buildLocaleContext = buildLocaleContext;
  64319. exports.buildTimeList = buildTimeList;
  64320. exports.buildTranslator = buildTranslator;
  64321. exports.buttonEmits = buttonEmits;
  64322. exports.buttonGroupContextKey = buttonGroupContextKey;
  64323. exports.buttonNativeTypes = buttonNativeTypes;
  64324. exports.buttonProps = buttonProps;
  64325. exports.buttonTypes = buttonTypes;
  64326. exports.calendarEmits = calendarEmits;
  64327. exports.calendarProps = calendarProps;
  64328. exports.cardContextKey = cardContextKey;
  64329. exports.cardProps = cardProps;
  64330. exports.carouselContextKey = carouselContextKey;
  64331. exports.carouselEmits = carouselEmits;
  64332. exports.carouselItemProps = carouselItemProps;
  64333. exports.carouselProps = carouselProps;
  64334. exports.cascaderEmits = cascaderEmits;
  64335. exports.cascaderPanelEmits = cascaderPanelEmits;
  64336. exports.cascaderPanelProps = cascaderPanelProps;
  64337. exports.cascaderProps = cascaderProps;
  64338. exports.checkTagEmits = checkTagEmits;
  64339. exports.checkTagProps = checkTagProps;
  64340. exports.checkboxDefaultProps = checkboxDefaultProps;
  64341. exports.checkboxEmits = checkboxEmits;
  64342. exports.checkboxGroupContextKey = checkboxGroupContextKey;
  64343. exports.checkboxGroupEmits = checkboxGroupEmits;
  64344. exports.checkboxGroupProps = checkboxGroupProps;
  64345. exports.checkboxProps = checkboxProps;
  64346. exports.colProps = colProps;
  64347. exports.collapseContextKey = collapseContextKey;
  64348. exports.collapseEmits = collapseEmits;
  64349. exports.collapseItemProps = collapseItemProps;
  64350. exports.collapseProps = collapseProps;
  64351. exports.colorPickerEmits = colorPickerEmits;
  64352. exports.colorPickerPanelContextKey = colorPickerPanelContextKey;
  64353. exports.colorPickerPanelEmits = colorPickerPanelEmits;
  64354. exports.colorPickerPanelProps = colorPickerPanelProps;
  64355. exports.colorPickerProps = colorPickerProps;
  64356. exports.columnAlignment = columnAlignment;
  64357. exports.componentSizeMap = componentSizeMap;
  64358. exports.componentSizes = componentSizes;
  64359. exports.configProviderContextKey = configProviderContextKey;
  64360. exports.configProviderProps = configProviderProps;
  64361. exports.countdownEmits = countdownEmits;
  64362. exports.countdownProps = countdownProps;
  64363. exports.createModelToggleComposable = createModelToggleComposable;
  64364. exports.dateEquals = dateEquals;
  64365. exports.datePickTypes = datePickTypes;
  64366. exports.datePickerPanelProps = datePickerPanelProps;
  64367. exports.datePickerProps = datePickerProps;
  64368. exports.dayOrDaysToDate = dayOrDaysToDate;
  64369. exports.dayjs = dayjs;
  64370. exports["default"] = installer;
  64371. exports.defaultInitialZIndex = defaultInitialZIndex;
  64372. exports.defaultNamespace = defaultNamespace;
  64373. exports.defaultProps = defaultProps;
  64374. exports.descriptionItemProps = descriptionItemProps;
  64375. exports.descriptionProps = descriptionProps;
  64376. exports.dialogContextKey = dialogContextKey;
  64377. exports.dialogEmits = dialogEmits;
  64378. exports.dialogInjectionKey = dialogInjectionKey;
  64379. exports.dialogProps = dialogProps;
  64380. exports.dividerProps = dividerProps;
  64381. exports.drawerEmits = drawerEmits;
  64382. exports.drawerProps = drawerProps;
  64383. exports.dropdownItemProps = dropdownItemProps;
  64384. exports.dropdownMenuProps = dropdownMenuProps;
  64385. exports.dropdownProps = dropdownProps;
  64386. exports.elPaginationKey = elPaginationKey;
  64387. exports.emitChangeFn = emitChangeFn;
  64388. exports.emptyProps = emptyProps;
  64389. exports.emptyValuesContextKey = emptyValuesContextKey;
  64390. exports.extractDateFormat = extractDateFormat;
  64391. exports.extractTimeFormat = extractTimeFormat;
  64392. exports.formContextKey = formContextKey;
  64393. exports.formEmits = formEmits;
  64394. exports.formItemContextKey = formItemContextKey;
  64395. exports.formItemProps = formItemProps;
  64396. exports.formItemValidateStates = formItemValidateStates;
  64397. exports.formMetaProps = formMetaProps;
  64398. exports.formProps = formProps;
  64399. exports.formatter = formatter;
  64400. exports.genFileId = genFileId;
  64401. exports.getPositionDataWithUnit = getPositionDataWithUnit;
  64402. exports.iconProps = iconProps;
  64403. exports.imageEmits = imageEmits;
  64404. exports.imageProps = imageProps;
  64405. exports.imageViewerEmits = imageViewerEmits;
  64406. exports.imageViewerProps = imageViewerProps;
  64407. exports.inputEmits = inputEmits;
  64408. exports.inputNumberEmits = inputNumberEmits;
  64409. exports.inputNumberProps = inputNumberProps;
  64410. exports.inputProps = inputProps;
  64411. exports.inputTagEmits = inputTagEmits;
  64412. exports.inputTagProps = inputTagProps;
  64413. exports.install = install;
  64414. exports.linkEmits = linkEmits;
  64415. exports.linkProps = linkProps;
  64416. exports.localeContextKey = localeContextKey;
  64417. exports.makeInstaller = makeInstaller;
  64418. exports.makeList = makeList;
  64419. exports.mentionDefaultProps = mentionDefaultProps;
  64420. exports.mentionEmits = mentionEmits;
  64421. exports.mentionProps = mentionProps;
  64422. exports.menuEmits = menuEmits;
  64423. exports.menuItemEmits = menuItemEmits;
  64424. exports.menuItemGroupProps = menuItemGroupProps;
  64425. exports.menuItemProps = menuItemProps;
  64426. exports.menuProps = menuProps;
  64427. exports.messageConfig = messageConfig;
  64428. exports.messageDefaults = messageDefaults;
  64429. exports.messageEmits = messageEmits;
  64430. exports.messagePlacement = messagePlacement;
  64431. exports.messageProps = messageProps;
  64432. exports.messageTypes = messageTypes;
  64433. exports.namespaceContextKey = namespaceContextKey;
  64434. exports.notificationEmits = notificationEmits;
  64435. exports.notificationProps = notificationProps;
  64436. exports.notificationTypes = notificationTypes;
  64437. exports.overlayEmits = overlayEmits;
  64438. exports.overlayProps = overlayProps;
  64439. exports.pageHeaderEmits = pageHeaderEmits;
  64440. exports.pageHeaderProps = pageHeaderProps;
  64441. exports.paginationEmits = paginationEmits;
  64442. exports.paginationProps = paginationProps;
  64443. exports.parseDate = parseDate;
  64444. exports.popconfirmEmits = popconfirmEmits;
  64445. exports.popconfirmProps = popconfirmProps;
  64446. exports.popoverEmits = popoverEmits;
  64447. exports.popoverProps = popoverProps;
  64448. exports.popperArrowProps = popperArrowProps;
  64449. exports.popperContentEmits = popperContentEmits;
  64450. exports.popperContentProps = popperContentProps;
  64451. exports.popperCoreConfigProps = popperCoreConfigProps;
  64452. exports.popperProps = popperProps;
  64453. exports.popperTriggerProps = popperTriggerProps;
  64454. exports.progressProps = progressProps;
  64455. exports.provideGlobalConfig = provideGlobalConfig;
  64456. exports.radioButtonProps = radioButtonProps;
  64457. exports.radioDefaultProps = radioDefaultProps;
  64458. exports.radioEmits = radioEmits;
  64459. exports.radioGroupEmits = radioGroupEmits;
  64460. exports.radioGroupKey = radioGroupKey;
  64461. exports.radioGroupProps = radioGroupProps;
  64462. exports.radioProps = radioProps;
  64463. exports.radioPropsBase = radioPropsBase;
  64464. exports.rangeArr = rangeArr;
  64465. exports.rateEmits = rateEmits;
  64466. exports.rateProps = rateProps;
  64467. exports.renderThumbStyle = renderThumbStyle$1;
  64468. exports.resultProps = resultProps;
  64469. exports.roleTypes = roleTypes;
  64470. exports.rowContextKey = rowContextKey;
  64471. exports.rowProps = rowProps;
  64472. exports.scrollbarContextKey = scrollbarContextKey;
  64473. exports.scrollbarEmits = scrollbarEmits;
  64474. exports.scrollbarProps = scrollbarProps;
  64475. exports.segmentedEmits = segmentedEmits;
  64476. exports.segmentedProps = segmentedProps;
  64477. exports.selectEmits = selectEmits;
  64478. exports.selectGroupKey = selectGroupKey;
  64479. exports.selectKey = selectKey;
  64480. exports.selectProps = selectProps;
  64481. exports.selectV2InjectionKey = selectV2InjectionKey;
  64482. exports.skeletonItemProps = skeletonItemProps;
  64483. exports.skeletonProps = skeletonProps;
  64484. exports.sliderContextKey = sliderContextKey;
  64485. exports.sliderEmits = sliderEmits;
  64486. exports.sliderProps = sliderProps;
  64487. exports.spaceItemProps = spaceItemProps;
  64488. exports.spaceProps = spaceProps;
  64489. exports.splitterPanelProps = splitterPanelProps;
  64490. exports.splitterProps = splitterProps;
  64491. exports.statisticProps = statisticProps;
  64492. exports.stepProps = stepProps;
  64493. exports.stepsEmits = stepsEmits;
  64494. exports.stepsProps = stepsProps;
  64495. exports.subMenuProps = subMenuProps;
  64496. exports.switchEmits = switchEmits;
  64497. exports.switchProps = switchProps;
  64498. exports.tabBarProps = tabBarProps;
  64499. exports.tabNavEmits = tabNavEmits;
  64500. exports.tabNavProps = tabNavProps;
  64501. exports.tabPaneProps = tabPaneProps;
  64502. exports.tableV2Props = tableV2Props;
  64503. exports.tableV2RowProps = tableV2RowProps;
  64504. exports.tabsEmits = tabsEmits;
  64505. exports.tabsProps = tabsProps;
  64506. exports.tabsRootContextKey = tabsRootContextKey;
  64507. exports.tagEmits = tagEmits;
  64508. exports.tagProps = tagProps;
  64509. exports.textProps = textProps;
  64510. exports.thumbProps = thumbProps;
  64511. exports.timePickerDefaultProps = timePickerDefaultProps;
  64512. exports.timePickerRangeTriggerProps = timePickerRangeTriggerProps;
  64513. exports.timePickerRngeTriggerProps = timePickerRngeTriggerProps;
  64514. exports.timeSelectProps = timeSelectProps;
  64515. exports.timeUnits = timeUnits$1;
  64516. exports.timelineItemProps = timelineItemProps;
  64517. exports.tooltipEmits = tooltipEmits;
  64518. exports.tourContentEmits = tourContentEmits;
  64519. exports.tourContentProps = tourContentProps;
  64520. exports.tourEmits = tourEmits;
  64521. exports.tourPlacements = tourPlacements;
  64522. exports.tourProps = tourProps;
  64523. exports.tourStepEmits = tourStepEmits;
  64524. exports.tourStepProps = tourStepProps;
  64525. exports.tourStrategies = tourStrategies;
  64526. exports.transferCheckedChangeFn = transferCheckedChangeFn;
  64527. exports.transferEmits = transferEmits;
  64528. exports.transferProps = transferProps;
  64529. exports.translate = translate;
  64530. exports.treeEmits = treeEmits$1;
  64531. exports.uploadBaseProps = uploadBaseProps;
  64532. exports.uploadContentProps = uploadContentProps;
  64533. exports.uploadContextKey = uploadContextKey;
  64534. exports.uploadDraggerEmits = uploadDraggerEmits;
  64535. exports.uploadDraggerProps = uploadDraggerProps;
  64536. exports.uploadListEmits = uploadListEmits;
  64537. exports.uploadListProps = uploadListProps;
  64538. exports.uploadListTypes = uploadListTypes;
  64539. exports.uploadProps = uploadProps;
  64540. exports.useAriaProps = useAriaProps;
  64541. exports.useAttrs = useAttrs;
  64542. exports.useCalcInputWidth = useCalcInputWidth;
  64543. exports.useCascaderConfig = useCascaderConfig;
  64544. exports.useComposition = useComposition;
  64545. exports.useCursor = useCursor;
  64546. exports.useDelayedRender = useDelayedRender;
  64547. exports.useDelayedToggle = useDelayedToggle;
  64548. exports.useDelayedToggleProps = useDelayedToggleProps;
  64549. exports.useDeprecated = useDeprecated;
  64550. exports.useDialog = useDialog;
  64551. exports.useDisabled = useDisabled;
  64552. exports.useDraggable = useDraggable;
  64553. exports.useEmptyValues = useEmptyValues;
  64554. exports.useEmptyValuesProps = useEmptyValuesProps;
  64555. exports.useEscapeKeydown = useEscapeKeydown;
  64556. exports.useFloating = useFloating$1;
  64557. exports.useFloatingProps = useFloatingProps;
  64558. exports.useFocus = useFocus;
  64559. exports.useFocusController = useFocusController;
  64560. exports.useFormDisabled = useFormDisabled;
  64561. exports.useFormItem = useFormItem;
  64562. exports.useFormItemInputId = useFormItemInputId;
  64563. exports.useFormSize = useFormSize;
  64564. exports.useForwardRef = useForwardRef;
  64565. exports.useForwardRefDirective = useForwardRefDirective;
  64566. exports.useGetDerivedNamespace = useGetDerivedNamespace;
  64567. exports.useGlobalComponentSettings = useGlobalComponentSettings;
  64568. exports.useGlobalConfig = useGlobalConfig;
  64569. exports.useGlobalSize = useGlobalSize;
  64570. exports.useId = useId;
  64571. exports.useIdInjection = useIdInjection;
  64572. exports.useLocale = useLocale;
  64573. exports.useLockscreen = useLockscreen;
  64574. exports.useModal = useModal;
  64575. exports.useModelToggle = useModelToggle;
  64576. exports.useModelToggleEmits = useModelToggleEmits;
  64577. exports.useModelToggleProps = useModelToggleProps;
  64578. exports.useNamespace = useNamespace;
  64579. exports.useOrderedChildren = useOrderedChildren;
  64580. exports.usePopper = usePopper;
  64581. exports.usePopperArrowProps = usePopperArrowProps;
  64582. exports.usePopperContainer = usePopperContainer;
  64583. exports.usePopperContainerId = usePopperContainerId;
  64584. exports.usePopperContentEmits = usePopperContentEmits;
  64585. exports.usePopperContentProps = usePopperContentProps;
  64586. exports.usePopperCoreConfigProps = usePopperCoreConfigProps;
  64587. exports.usePopperProps = usePopperProps;
  64588. exports.usePopperTriggerProps = usePopperTriggerProps;
  64589. exports.usePreventGlobal = usePreventGlobal;
  64590. exports.useProp = useProp;
  64591. exports.useSameTarget = useSameTarget;
  64592. exports.useSize = useSize$1;
  64593. exports.useSizeProp = useSizeProp;
  64594. exports.useSizeProps = useSizeProps;
  64595. exports.useSpace = useSpace;
  64596. exports.useTeleport = useTeleport;
  64597. exports.useThrottleRender = useThrottleRender;
  64598. exports.useTimeout = useTimeout;
  64599. exports.useTooltipContentProps = useTooltipContentProps;
  64600. exports.useTooltipModelToggle = useTooltipModelToggle;
  64601. exports.useTooltipModelToggleEmits = useTooltipModelToggleEmits;
  64602. exports.useTooltipModelToggleProps = useTooltipModelToggleProps;
  64603. exports.useTooltipProps = useTooltipProps;
  64604. exports.useTooltipTriggerProps = useTooltipTriggerProps;
  64605. exports.useTransitionFallthrough = useTransitionFallthrough;
  64606. exports.useTransitionFallthroughEmits = useTransitionFallthroughEmits;
  64607. exports.useZIndex = useZIndex;
  64608. exports.vLoading = vLoading$1;
  64609. exports.vRepeatClick = vRepeatClick;
  64610. exports.valueEquals = valueEquals;
  64611. exports.version = version;
  64612. exports.virtualizedGridProps = virtualizedGridProps;
  64613. exports.virtualizedListProps = virtualizedListProps;
  64614. exports.virtualizedProps = virtualizedProps;
  64615. exports.virtualizedScrollbarProps = virtualizedScrollbarProps;
  64616. exports.watermarkProps = watermarkProps;
  64617. exports.zIndexContextKey = zIndexContextKey;
  64618. Object.defineProperty(exports, '__esModule', { value: true });
  64619. }));