index.full.mjs 1.9 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545345463454734548345493455034551345523455334554345553455634557345583455934560345613456234563345643456534566345673456834569345703457134572345733457434575345763457734578345793458034581345823458334584345853458634587345883458934590345913459234593345943459534596345973459834599346003460134602346033460434605346063460734608346093461034611346123461334614346153461634617346183461934620346213462234623346243462534626346273462834629346303463134632346333463434635346363463734638346393464034641346423464334644346453464634647346483464934650346513465234653346543465534656346573465834659346603466134662346633466434665346663466734668346693467034671346723467334674346753467634677346783467934680346813468234683346843468534686346873468834689346903469134692346933469434695346963469734698346993470034701347023470334704347053470634707347083470934710347113471234713347143471534716347173471834719347203472134722347233472434725347263472734728347293473034731347323473334734347353473634737347383473934740347413474234743347443474534746347473474834749347503475134752347533475434755347563475734758347593476034761347623476334764347653476634767347683476934770347713477234773347743477534776347773477834779347803478134782347833478434785347863478734788347893479034791347923479334794347953479634797347983479934800348013480234803348043480534806348073480834809348103481134812348133481434815348163481734818348193482034821348223482334824348253482634827348283482934830348313483234833348343483534836348373483834839348403484134842348433484434845348463484734848348493485034851348523485334854348553485634857348583485934860348613486234863348643486534866348673486834869348703487134872348733487434875348763487734878348793488034881348823488334884348853488634887348883488934890348913489234893348943489534896348973489834899349003490134902349033490434905349063490734908349093491034911349123491334914349153491634917349183491934920349213492234923349243492534926349273492834929349303493134932349333493434935349363493734938349393494034941349423494334944349453494634947349483494934950349513495234953349543495534956349573495834959349603496134962349633496434965349663496734968349693497034971349723497334974349753497634977349783497934980349813498234983349843498534986349873498834989349903499134992349933499434995349963499734998349993500035001350023500335004350053500635007350083500935010350113501235013350143501535016350173501835019350203502135022350233502435025350263502735028350293503035031350323503335034350353503635037350383503935040350413504235043350443504535046350473504835049350503505135052350533505435055350563505735058350593506035061350623506335064350653506635067350683506935070350713507235073350743507535076350773507835079350803508135082350833508435085350863508735088350893509035091350923509335094350953509635097350983509935100351013510235103351043510535106351073510835109351103511135112351133511435115351163511735118351193512035121351223512335124351253512635127351283512935130351313513235133351343513535136351373513835139351403514135142351433514435145351463514735148351493515035151351523515335154351553515635157351583515935160351613516235163351643516535166351673516835169351703517135172351733517435175351763517735178351793518035181351823518335184351853518635187351883518935190351913519235193351943519535196351973519835199352003520135202352033520435205352063520735208352093521035211352123521335214352153521635217352183521935220352213522235223352243522535226352273522835229352303523135232352333523435235352363523735238352393524035241352423524335244352453524635247352483524935250352513525235253352543525535256352573525835259352603526135262352633526435265352663526735268352693527035271352723527335274352753527635277352783527935280352813528235283352843528535286352873528835289352903529135292352933529435295352963529735298352993530035301353023530335304353053530635307353083530935310353113531235313353143531535316353173531835319353203532135322353233532435325353263532735328353293533035331353323533335334353353533635337353383533935340353413534235343353443534535346353473534835349353503535135352353533535435355353563535735358353593536035361353623536335364353653536635367353683536935370353713537235373353743537535376353773537835379353803538135382353833538435385353863538735388353893539035391353923539335394353953539635397353983539935400354013540235403354043540535406354073540835409354103541135412354133541435415354163541735418354193542035421354223542335424354253542635427354283542935430354313543235433354343543535436354373543835439354403544135442354433544435445354463544735448354493545035451354523545335454354553545635457354583545935460354613546235463354643546535466354673546835469354703547135472354733547435475354763547735478354793548035481354823548335484354853548635487354883548935490354913549235493354943549535496354973549835499355003550135502355033550435505355063550735508355093551035511355123551335514355153551635517355183551935520355213552235523355243552535526355273552835529355303553135532355333553435535355363553735538355393554035541355423554335544355453554635547355483554935550355513555235553355543555535556355573555835559355603556135562355633556435565355663556735568355693557035571355723557335574355753557635577355783557935580355813558235583355843558535586355873558835589355903559135592355933559435595355963559735598355993560035601356023560335604356053560635607356083560935610356113561235613356143561535616356173561835619356203562135622356233562435625356263562735628356293563035631356323563335634356353563635637356383563935640356413564235643356443564535646356473564835649356503565135652356533565435655356563565735658356593566035661356623566335664356653566635667356683566935670356713567235673356743567535676356773567835679356803568135682356833568435685356863568735688356893569035691356923569335694356953569635697356983569935700357013570235703357043570535706357073570835709357103571135712357133571435715357163571735718357193572035721357223572335724357253572635727357283572935730357313573235733357343573535736357373573835739357403574135742357433574435745357463574735748357493575035751357523575335754357553575635757357583575935760357613576235763357643576535766357673576835769357703577135772357733577435775357763577735778357793578035781357823578335784357853578635787357883578935790357913579235793357943579535796357973579835799358003580135802358033580435805358063580735808358093581035811358123581335814358153581635817358183581935820358213582235823358243582535826358273582835829358303583135832358333583435835358363583735838358393584035841358423584335844358453584635847358483584935850358513585235853358543585535856358573585835859358603586135862358633586435865358663586735868358693587035871358723587335874358753587635877358783587935880358813588235883358843588535886358873588835889358903589135892358933589435895358963589735898358993590035901359023590335904359053590635907359083590935910359113591235913359143591535916359173591835919359203592135922359233592435925359263592735928359293593035931359323593335934359353593635937359383593935940359413594235943359443594535946359473594835949359503595135952359533595435955359563595735958359593596035961359623596335964359653596635967359683596935970359713597235973359743597535976359773597835979359803598135982359833598435985359863598735988359893599035991359923599335994359953599635997359983599936000360013600236003360043600536006360073600836009360103601136012360133601436015360163601736018360193602036021360223602336024360253602636027360283602936030360313603236033360343603536036360373603836039360403604136042360433604436045360463604736048360493605036051360523605336054360553605636057360583605936060360613606236063360643606536066360673606836069360703607136072360733607436075360763607736078360793608036081360823608336084360853608636087360883608936090360913609236093360943609536096360973609836099361003610136102361033610436105361063610736108361093611036111361123611336114361153611636117361183611936120361213612236123361243612536126361273612836129361303613136132361333613436135361363613736138361393614036141361423614336144361453614636147361483614936150361513615236153361543615536156361573615836159361603616136162361633616436165361663616736168361693617036171361723617336174361753617636177361783617936180361813618236183361843618536186361873618836189361903619136192361933619436195361963619736198361993620036201362023620336204362053620636207362083620936210362113621236213362143621536216362173621836219362203622136222362233622436225362263622736228362293623036231362323623336234362353623636237362383623936240362413624236243362443624536246362473624836249362503625136252362533625436255362563625736258362593626036261362623626336264362653626636267362683626936270362713627236273362743627536276362773627836279362803628136282362833628436285362863628736288362893629036291362923629336294362953629636297362983629936300363013630236303363043630536306363073630836309363103631136312363133631436315363163631736318363193632036321363223632336324363253632636327363283632936330363313633236333363343633536336363373633836339363403634136342363433634436345363463634736348363493635036351363523635336354363553635636357363583635936360363613636236363363643636536366363673636836369363703637136372363733637436375363763637736378363793638036381363823638336384363853638636387363883638936390363913639236393363943639536396363973639836399364003640136402364033640436405364063640736408364093641036411364123641336414364153641636417364183641936420364213642236423364243642536426364273642836429364303643136432364333643436435364363643736438364393644036441364423644336444364453644636447364483644936450364513645236453364543645536456364573645836459364603646136462364633646436465364663646736468364693647036471364723647336474364753647636477364783647936480364813648236483364843648536486364873648836489364903649136492364933649436495364963649736498364993650036501365023650336504365053650636507365083650936510365113651236513365143651536516365173651836519365203652136522365233652436525365263652736528365293653036531365323653336534365353653636537365383653936540365413654236543365443654536546365473654836549365503655136552365533655436555365563655736558365593656036561365623656336564365653656636567365683656936570365713657236573365743657536576365773657836579365803658136582365833658436585365863658736588365893659036591365923659336594365953659636597365983659936600366013660236603366043660536606366073660836609366103661136612366133661436615366163661736618366193662036621366223662336624366253662636627366283662936630366313663236633366343663536636366373663836639366403664136642366433664436645366463664736648366493665036651366523665336654366553665636657366583665936660366613666236663366643666536666366673666836669366703667136672366733667436675366763667736678366793668036681366823668336684366853668636687366883668936690366913669236693366943669536696366973669836699367003670136702367033670436705367063670736708367093671036711367123671336714367153671636717367183671936720367213672236723367243672536726367273672836729367303673136732367333673436735367363673736738367393674036741367423674336744367453674636747367483674936750367513675236753367543675536756367573675836759367603676136762367633676436765367663676736768367693677036771367723677336774367753677636777367783677936780367813678236783367843678536786367873678836789367903679136792367933679436795367963679736798367993680036801368023680336804368053680636807368083680936810368113681236813368143681536816368173681836819368203682136822368233682436825368263682736828368293683036831368323683336834368353683636837368383683936840368413684236843368443684536846368473684836849368503685136852368533685436855368563685736858368593686036861368623686336864368653686636867368683686936870368713687236873368743687536876368773687836879368803688136882368833688436885368863688736888368893689036891368923689336894368953689636897368983689936900369013690236903369043690536906369073690836909369103691136912369133691436915369163691736918369193692036921369223692336924369253692636927369283692936930369313693236933369343693536936369373693836939369403694136942369433694436945369463694736948369493695036951369523695336954369553695636957369583695936960369613696236963369643696536966369673696836969369703697136972369733697436975369763697736978369793698036981369823698336984369853698636987369883698936990369913699236993369943699536996369973699836999370003700137002370033700437005370063700737008370093701037011370123701337014370153701637017370183701937020370213702237023370243702537026370273702837029370303703137032370333703437035370363703737038370393704037041370423704337044370453704637047370483704937050370513705237053370543705537056370573705837059370603706137062370633706437065370663706737068370693707037071370723707337074370753707637077370783707937080370813708237083370843708537086370873708837089370903709137092370933709437095370963709737098370993710037101371023710337104371053710637107371083710937110371113711237113371143711537116371173711837119371203712137122371233712437125371263712737128371293713037131371323713337134371353713637137371383713937140371413714237143371443714537146371473714837149371503715137152371533715437155371563715737158371593716037161371623716337164371653716637167371683716937170371713717237173371743717537176371773717837179371803718137182371833718437185371863718737188371893719037191371923719337194371953719637197371983719937200372013720237203372043720537206372073720837209372103721137212372133721437215372163721737218372193722037221372223722337224372253722637227372283722937230372313723237233372343723537236372373723837239372403724137242372433724437245372463724737248372493725037251372523725337254372553725637257372583725937260372613726237263372643726537266372673726837269372703727137272372733727437275372763727737278372793728037281372823728337284372853728637287372883728937290372913729237293372943729537296372973729837299373003730137302373033730437305373063730737308373093731037311373123731337314373153731637317373183731937320373213732237323373243732537326373273732837329373303733137332373333733437335373363733737338373393734037341373423734337344373453734637347373483734937350373513735237353373543735537356373573735837359373603736137362373633736437365373663736737368373693737037371373723737337374373753737637377373783737937380373813738237383373843738537386373873738837389373903739137392373933739437395373963739737398373993740037401374023740337404374053740637407374083740937410374113741237413374143741537416374173741837419374203742137422374233742437425374263742737428374293743037431374323743337434374353743637437374383743937440374413744237443374443744537446374473744837449374503745137452374533745437455374563745737458374593746037461374623746337464374653746637467374683746937470374713747237473374743747537476374773747837479374803748137482374833748437485374863748737488374893749037491374923749337494374953749637497374983749937500375013750237503375043750537506375073750837509375103751137512375133751437515375163751737518375193752037521375223752337524375253752637527375283752937530375313753237533375343753537536375373753837539375403754137542375433754437545375463754737548375493755037551375523755337554375553755637557375583755937560375613756237563375643756537566375673756837569375703757137572375733757437575375763757737578375793758037581375823758337584375853758637587375883758937590375913759237593375943759537596375973759837599376003760137602376033760437605376063760737608376093761037611376123761337614376153761637617376183761937620376213762237623376243762537626376273762837629376303763137632376333763437635376363763737638376393764037641376423764337644376453764637647376483764937650376513765237653376543765537656376573765837659376603766137662376633766437665376663766737668376693767037671376723767337674376753767637677376783767937680376813768237683376843768537686376873768837689376903769137692376933769437695376963769737698376993770037701377023770337704377053770637707377083770937710377113771237713377143771537716377173771837719377203772137722377233772437725377263772737728377293773037731377323773337734377353773637737377383773937740377413774237743377443774537746377473774837749377503775137752377533775437755377563775737758377593776037761377623776337764377653776637767377683776937770377713777237773377743777537776377773777837779377803778137782377833778437785377863778737788377893779037791377923779337794377953779637797377983779937800378013780237803378043780537806378073780837809378103781137812378133781437815378163781737818378193782037821378223782337824378253782637827378283782937830378313783237833378343783537836378373783837839378403784137842378433784437845378463784737848378493785037851378523785337854378553785637857378583785937860378613786237863378643786537866378673786837869378703787137872378733787437875378763787737878378793788037881378823788337884378853788637887378883788937890378913789237893378943789537896378973789837899379003790137902379033790437905379063790737908379093791037911379123791337914379153791637917379183791937920379213792237923379243792537926379273792837929379303793137932379333793437935379363793737938379393794037941379423794337944379453794637947379483794937950379513795237953379543795537956379573795837959379603796137962379633796437965379663796737968379693797037971379723797337974379753797637977379783797937980379813798237983379843798537986379873798837989379903799137992379933799437995379963799737998379993800038001380023800338004380053800638007380083800938010380113801238013380143801538016380173801838019380203802138022380233802438025380263802738028380293803038031380323803338034380353803638037380383803938040380413804238043380443804538046380473804838049380503805138052380533805438055380563805738058380593806038061380623806338064380653806638067380683806938070380713807238073380743807538076380773807838079380803808138082380833808438085380863808738088380893809038091380923809338094380953809638097380983809938100381013810238103381043810538106381073810838109381103811138112381133811438115381163811738118381193812038121381223812338124381253812638127381283812938130381313813238133381343813538136381373813838139381403814138142381433814438145381463814738148381493815038151381523815338154381553815638157381583815938160381613816238163381643816538166381673816838169381703817138172381733817438175381763817738178381793818038181381823818338184381853818638187381883818938190381913819238193381943819538196381973819838199382003820138202382033820438205382063820738208382093821038211382123821338214382153821638217382183821938220382213822238223382243822538226382273822838229382303823138232382333823438235382363823738238382393824038241382423824338244382453824638247382483824938250382513825238253382543825538256382573825838259382603826138262382633826438265382663826738268382693827038271382723827338274382753827638277382783827938280382813828238283382843828538286382873828838289382903829138292382933829438295382963829738298382993830038301383023830338304383053830638307383083830938310383113831238313383143831538316383173831838319383203832138322383233832438325383263832738328383293833038331383323833338334383353833638337383383833938340383413834238343383443834538346383473834838349383503835138352383533835438355383563835738358383593836038361383623836338364383653836638367383683836938370383713837238373383743837538376383773837838379383803838138382383833838438385383863838738388383893839038391383923839338394383953839638397383983839938400384013840238403384043840538406384073840838409384103841138412384133841438415384163841738418384193842038421384223842338424384253842638427384283842938430384313843238433384343843538436384373843838439384403844138442384433844438445384463844738448384493845038451384523845338454384553845638457384583845938460384613846238463384643846538466384673846838469384703847138472384733847438475384763847738478384793848038481384823848338484384853848638487384883848938490384913849238493384943849538496384973849838499385003850138502385033850438505385063850738508385093851038511385123851338514385153851638517385183851938520385213852238523385243852538526385273852838529385303853138532385333853438535385363853738538385393854038541385423854338544385453854638547385483854938550385513855238553385543855538556385573855838559385603856138562385633856438565385663856738568385693857038571385723857338574385753857638577385783857938580385813858238583385843858538586385873858838589385903859138592385933859438595385963859738598385993860038601386023860338604386053860638607386083860938610386113861238613386143861538616386173861838619386203862138622386233862438625386263862738628386293863038631386323863338634386353863638637386383863938640386413864238643386443864538646386473864838649386503865138652386533865438655386563865738658386593866038661386623866338664386653866638667386683866938670386713867238673386743867538676386773867838679386803868138682386833868438685386863868738688386893869038691386923869338694386953869638697386983869938700387013870238703387043870538706387073870838709387103871138712387133871438715387163871738718387193872038721387223872338724387253872638727387283872938730387313873238733387343873538736387373873838739387403874138742387433874438745387463874738748387493875038751387523875338754387553875638757387583875938760387613876238763387643876538766387673876838769387703877138772387733877438775387763877738778387793878038781387823878338784387853878638787387883878938790387913879238793387943879538796387973879838799388003880138802388033880438805388063880738808388093881038811388123881338814388153881638817388183881938820388213882238823388243882538826388273882838829388303883138832388333883438835388363883738838388393884038841388423884338844388453884638847388483884938850388513885238853388543885538856388573885838859388603886138862388633886438865388663886738868388693887038871388723887338874388753887638877388783887938880388813888238883388843888538886388873888838889388903889138892388933889438895388963889738898388993890038901389023890338904389053890638907389083890938910389113891238913389143891538916389173891838919389203892138922389233892438925389263892738928389293893038931389323893338934389353893638937389383893938940389413894238943389443894538946389473894838949389503895138952389533895438955389563895738958389593896038961389623896338964389653896638967389683896938970389713897238973389743897538976389773897838979389803898138982389833898438985389863898738988389893899038991389923899338994389953899638997389983899939000390013900239003390043900539006390073900839009390103901139012390133901439015390163901739018390193902039021390223902339024390253902639027390283902939030390313903239033390343903539036390373903839039390403904139042390433904439045390463904739048390493905039051390523905339054390553905639057390583905939060390613906239063390643906539066390673906839069390703907139072390733907439075390763907739078390793908039081390823908339084390853908639087390883908939090390913909239093390943909539096390973909839099391003910139102391033910439105391063910739108391093911039111391123911339114391153911639117391183911939120391213912239123391243912539126391273912839129391303913139132391333913439135391363913739138391393914039141391423914339144391453914639147391483914939150391513915239153391543915539156391573915839159391603916139162391633916439165391663916739168391693917039171391723917339174391753917639177391783917939180391813918239183391843918539186391873918839189391903919139192391933919439195391963919739198391993920039201392023920339204392053920639207392083920939210392113921239213392143921539216392173921839219392203922139222392233922439225392263922739228392293923039231392323923339234392353923639237392383923939240392413924239243392443924539246392473924839249392503925139252392533925439255392563925739258392593926039261392623926339264392653926639267392683926939270392713927239273392743927539276392773927839279392803928139282392833928439285392863928739288392893929039291392923929339294392953929639297392983929939300393013930239303393043930539306393073930839309393103931139312393133931439315393163931739318393193932039321393223932339324393253932639327393283932939330393313933239333393343933539336393373933839339393403934139342393433934439345393463934739348393493935039351393523935339354393553935639357393583935939360393613936239363393643936539366393673936839369393703937139372393733937439375393763937739378393793938039381393823938339384393853938639387393883938939390393913939239393393943939539396393973939839399394003940139402394033940439405394063940739408394093941039411394123941339414394153941639417394183941939420394213942239423394243942539426394273942839429394303943139432394333943439435394363943739438394393944039441394423944339444394453944639447394483944939450394513945239453394543945539456394573945839459394603946139462394633946439465394663946739468394693947039471394723947339474394753947639477394783947939480394813948239483394843948539486394873948839489394903949139492394933949439495394963949739498394993950039501395023950339504395053950639507395083950939510395113951239513395143951539516395173951839519395203952139522395233952439525395263952739528395293953039531395323953339534395353953639537395383953939540395413954239543395443954539546395473954839549395503955139552395533955439555395563955739558395593956039561395623956339564395653956639567395683956939570395713957239573395743957539576395773957839579395803958139582395833958439585395863958739588395893959039591395923959339594395953959639597395983959939600396013960239603396043960539606396073960839609396103961139612396133961439615396163961739618396193962039621396223962339624396253962639627396283962939630396313963239633396343963539636396373963839639396403964139642396433964439645396463964739648396493965039651396523965339654396553965639657396583965939660396613966239663396643966539666396673966839669396703967139672396733967439675396763967739678396793968039681396823968339684396853968639687396883968939690396913969239693396943969539696396973969839699397003970139702397033970439705397063970739708397093971039711397123971339714397153971639717397183971939720397213972239723397243972539726397273972839729397303973139732397333973439735397363973739738397393974039741397423974339744397453974639747397483974939750397513975239753397543975539756397573975839759397603976139762397633976439765397663976739768397693977039771397723977339774397753977639777397783977939780397813978239783397843978539786397873978839789397903979139792397933979439795397963979739798397993980039801398023980339804398053980639807398083980939810398113981239813398143981539816398173981839819398203982139822398233982439825398263982739828398293983039831398323983339834398353983639837398383983939840398413984239843398443984539846398473984839849398503985139852398533985439855398563985739858398593986039861398623986339864398653986639867398683986939870398713987239873398743987539876398773987839879398803988139882398833988439885398863988739888398893989039891398923989339894398953989639897398983989939900399013990239903399043990539906399073990839909399103991139912399133991439915399163991739918399193992039921399223992339924399253992639927399283992939930399313993239933399343993539936399373993839939399403994139942399433994439945399463994739948399493995039951399523995339954399553995639957399583995939960399613996239963399643996539966399673996839969399703997139972399733997439975399763997739978399793998039981399823998339984399853998639987399883998939990399913999239993399943999539996399973999839999400004000140002400034000440005400064000740008400094001040011400124001340014400154001640017400184001940020400214002240023400244002540026400274002840029400304003140032400334003440035400364003740038400394004040041400424004340044400454004640047400484004940050400514005240053400544005540056400574005840059400604006140062400634006440065400664006740068400694007040071400724007340074400754007640077400784007940080400814008240083400844008540086400874008840089400904009140092400934009440095400964009740098400994010040101401024010340104401054010640107401084010940110401114011240113401144011540116401174011840119401204012140122401234012440125401264012740128401294013040131401324013340134401354013640137401384013940140401414014240143401444014540146401474014840149401504015140152401534015440155401564015740158401594016040161401624016340164401654016640167401684016940170401714017240173401744017540176401774017840179401804018140182401834018440185401864018740188401894019040191401924019340194401954019640197401984019940200402014020240203402044020540206402074020840209402104021140212402134021440215402164021740218402194022040221402224022340224402254022640227402284022940230402314023240233402344023540236402374023840239402404024140242402434024440245402464024740248402494025040251402524025340254402554025640257402584025940260402614026240263402644026540266402674026840269402704027140272402734027440275402764027740278402794028040281402824028340284402854028640287402884028940290402914029240293402944029540296402974029840299403004030140302403034030440305403064030740308403094031040311403124031340314403154031640317403184031940320403214032240323403244032540326403274032840329403304033140332403334033440335403364033740338403394034040341403424034340344403454034640347403484034940350403514035240353403544035540356403574035840359403604036140362403634036440365403664036740368403694037040371403724037340374403754037640377403784037940380403814038240383403844038540386403874038840389403904039140392403934039440395403964039740398403994040040401404024040340404404054040640407404084040940410404114041240413404144041540416404174041840419404204042140422404234042440425404264042740428404294043040431404324043340434404354043640437404384043940440404414044240443404444044540446404474044840449404504045140452404534045440455404564045740458404594046040461404624046340464404654046640467404684046940470404714047240473404744047540476404774047840479404804048140482404834048440485404864048740488404894049040491404924049340494404954049640497404984049940500405014050240503405044050540506405074050840509405104051140512405134051440515405164051740518405194052040521405224052340524405254052640527405284052940530405314053240533405344053540536405374053840539405404054140542405434054440545405464054740548405494055040551405524055340554405554055640557405584055940560405614056240563405644056540566405674056840569405704057140572405734057440575405764057740578405794058040581405824058340584405854058640587405884058940590405914059240593405944059540596405974059840599406004060140602406034060440605406064060740608406094061040611406124061340614406154061640617406184061940620406214062240623406244062540626406274062840629406304063140632406334063440635406364063740638406394064040641406424064340644406454064640647406484064940650406514065240653406544065540656406574065840659406604066140662406634066440665406664066740668406694067040671406724067340674406754067640677406784067940680406814068240683406844068540686406874068840689406904069140692406934069440695406964069740698406994070040701407024070340704407054070640707407084070940710407114071240713407144071540716407174071840719407204072140722407234072440725407264072740728407294073040731407324073340734407354073640737407384073940740407414074240743407444074540746407474074840749407504075140752407534075440755407564075740758407594076040761407624076340764407654076640767407684076940770407714077240773407744077540776407774077840779407804078140782407834078440785407864078740788407894079040791407924079340794407954079640797407984079940800408014080240803408044080540806408074080840809408104081140812408134081440815408164081740818408194082040821408224082340824408254082640827408284082940830408314083240833408344083540836408374083840839408404084140842408434084440845408464084740848408494085040851408524085340854408554085640857408584085940860408614086240863408644086540866408674086840869408704087140872408734087440875408764087740878408794088040881408824088340884408854088640887408884088940890408914089240893408944089540896408974089840899409004090140902409034090440905409064090740908409094091040911409124091340914409154091640917409184091940920409214092240923409244092540926409274092840929409304093140932409334093440935409364093740938409394094040941409424094340944409454094640947409484094940950409514095240953409544095540956409574095840959409604096140962409634096440965409664096740968409694097040971409724097340974409754097640977409784097940980409814098240983409844098540986409874098840989409904099140992409934099440995409964099740998409994100041001410024100341004410054100641007410084100941010410114101241013410144101541016410174101841019410204102141022410234102441025410264102741028410294103041031410324103341034410354103641037410384103941040410414104241043410444104541046410474104841049410504105141052410534105441055410564105741058410594106041061410624106341064410654106641067410684106941070410714107241073410744107541076410774107841079410804108141082410834108441085410864108741088410894109041091410924109341094410954109641097410984109941100411014110241103411044110541106411074110841109411104111141112411134111441115411164111741118411194112041121411224112341124411254112641127411284112941130411314113241133411344113541136411374113841139411404114141142411434114441145411464114741148411494115041151411524115341154411554115641157411584115941160411614116241163411644116541166411674116841169411704117141172411734117441175411764117741178411794118041181411824118341184411854118641187411884118941190411914119241193411944119541196411974119841199412004120141202412034120441205412064120741208412094121041211412124121341214412154121641217412184121941220412214122241223412244122541226412274122841229412304123141232412334123441235412364123741238412394124041241412424124341244412454124641247412484124941250412514125241253412544125541256412574125841259412604126141262412634126441265412664126741268412694127041271412724127341274412754127641277412784127941280412814128241283412844128541286412874128841289412904129141292412934129441295412964129741298412994130041301413024130341304413054130641307413084130941310413114131241313413144131541316413174131841319413204132141322413234132441325413264132741328413294133041331413324133341334413354133641337413384133941340413414134241343413444134541346413474134841349413504135141352413534135441355413564135741358413594136041361413624136341364413654136641367413684136941370413714137241373413744137541376413774137841379413804138141382413834138441385413864138741388413894139041391413924139341394413954139641397413984139941400414014140241403414044140541406414074140841409414104141141412414134141441415414164141741418414194142041421414224142341424414254142641427414284142941430414314143241433414344143541436414374143841439414404144141442414434144441445414464144741448414494145041451414524145341454414554145641457414584145941460414614146241463414644146541466414674146841469414704147141472414734147441475414764147741478414794148041481414824148341484414854148641487414884148941490414914149241493414944149541496414974149841499415004150141502415034150441505415064150741508415094151041511415124151341514415154151641517415184151941520415214152241523415244152541526415274152841529415304153141532415334153441535415364153741538415394154041541415424154341544415454154641547415484154941550415514155241553415544155541556415574155841559415604156141562415634156441565415664156741568415694157041571415724157341574415754157641577415784157941580415814158241583415844158541586415874158841589415904159141592415934159441595415964159741598415994160041601416024160341604416054160641607416084160941610416114161241613416144161541616416174161841619416204162141622416234162441625416264162741628416294163041631416324163341634416354163641637416384163941640416414164241643416444164541646416474164841649416504165141652416534165441655416564165741658416594166041661416624166341664416654166641667416684166941670416714167241673416744167541676416774167841679416804168141682416834168441685416864168741688416894169041691416924169341694416954169641697416984169941700417014170241703417044170541706417074170841709417104171141712417134171441715417164171741718417194172041721417224172341724417254172641727417284172941730417314173241733417344173541736417374173841739417404174141742417434174441745417464174741748417494175041751417524175341754417554175641757417584175941760417614176241763417644176541766417674176841769417704177141772417734177441775417764177741778417794178041781417824178341784417854178641787417884178941790417914179241793417944179541796417974179841799418004180141802418034180441805418064180741808418094181041811418124181341814418154181641817418184181941820418214182241823418244182541826418274182841829418304183141832418334183441835418364183741838418394184041841418424184341844418454184641847418484184941850418514185241853418544185541856418574185841859418604186141862418634186441865418664186741868418694187041871418724187341874418754187641877418784187941880418814188241883418844188541886418874188841889418904189141892418934189441895418964189741898418994190041901419024190341904419054190641907419084190941910419114191241913419144191541916419174191841919419204192141922419234192441925419264192741928419294193041931419324193341934419354193641937419384193941940419414194241943419444194541946419474194841949419504195141952419534195441955419564195741958419594196041961419624196341964419654196641967419684196941970419714197241973419744197541976419774197841979419804198141982419834198441985419864198741988419894199041991419924199341994419954199641997419984199942000420014200242003420044200542006420074200842009420104201142012420134201442015420164201742018420194202042021420224202342024420254202642027420284202942030420314203242033420344203542036420374203842039420404204142042420434204442045420464204742048420494205042051420524205342054420554205642057420584205942060420614206242063420644206542066420674206842069420704207142072420734207442075420764207742078420794208042081420824208342084420854208642087420884208942090420914209242093420944209542096420974209842099421004210142102421034210442105421064210742108421094211042111421124211342114421154211642117421184211942120421214212242123421244212542126421274212842129421304213142132421334213442135421364213742138421394214042141421424214342144421454214642147421484214942150421514215242153421544215542156421574215842159421604216142162421634216442165421664216742168421694217042171421724217342174421754217642177421784217942180421814218242183421844218542186421874218842189421904219142192421934219442195421964219742198421994220042201422024220342204422054220642207422084220942210422114221242213422144221542216422174221842219422204222142222422234222442225422264222742228422294223042231422324223342234422354223642237422384223942240422414224242243422444224542246422474224842249422504225142252422534225442255422564225742258422594226042261422624226342264422654226642267422684226942270422714227242273422744227542276422774227842279422804228142282422834228442285422864228742288422894229042291422924229342294422954229642297422984229942300423014230242303423044230542306423074230842309423104231142312423134231442315423164231742318423194232042321423224232342324423254232642327423284232942330423314233242333423344233542336423374233842339423404234142342423434234442345423464234742348423494235042351423524235342354423554235642357423584235942360423614236242363423644236542366423674236842369423704237142372423734237442375423764237742378423794238042381423824238342384423854238642387423884238942390423914239242393423944239542396423974239842399424004240142402424034240442405424064240742408424094241042411424124241342414424154241642417424184241942420424214242242423424244242542426424274242842429424304243142432424334243442435424364243742438424394244042441424424244342444424454244642447424484244942450424514245242453424544245542456424574245842459424604246142462424634246442465424664246742468424694247042471424724247342474424754247642477424784247942480424814248242483424844248542486424874248842489424904249142492424934249442495424964249742498424994250042501425024250342504425054250642507425084250942510425114251242513425144251542516425174251842519425204252142522425234252442525425264252742528425294253042531425324253342534425354253642537425384253942540425414254242543425444254542546425474254842549425504255142552425534255442555425564255742558425594256042561425624256342564425654256642567425684256942570425714257242573425744257542576425774257842579425804258142582425834258442585425864258742588425894259042591425924259342594425954259642597425984259942600426014260242603426044260542606426074260842609426104261142612426134261442615426164261742618426194262042621426224262342624426254262642627426284262942630426314263242633426344263542636426374263842639426404264142642426434264442645426464264742648426494265042651426524265342654426554265642657426584265942660426614266242663426644266542666426674266842669426704267142672426734267442675426764267742678426794268042681426824268342684426854268642687426884268942690426914269242693426944269542696426974269842699427004270142702427034270442705427064270742708427094271042711427124271342714427154271642717427184271942720427214272242723427244272542726427274272842729427304273142732427334273442735427364273742738427394274042741427424274342744427454274642747427484274942750427514275242753427544275542756427574275842759427604276142762427634276442765427664276742768427694277042771427724277342774427754277642777427784277942780427814278242783427844278542786427874278842789427904279142792427934279442795427964279742798427994280042801428024280342804428054280642807428084280942810428114281242813428144281542816428174281842819428204282142822428234282442825428264282742828428294283042831428324283342834428354283642837428384283942840428414284242843428444284542846428474284842849428504285142852428534285442855428564285742858428594286042861428624286342864428654286642867428684286942870428714287242873428744287542876428774287842879428804288142882428834288442885428864288742888428894289042891428924289342894428954289642897428984289942900429014290242903429044290542906429074290842909429104291142912429134291442915429164291742918429194292042921429224292342924429254292642927429284292942930429314293242933429344293542936429374293842939429404294142942429434294442945429464294742948429494295042951429524295342954429554295642957429584295942960429614296242963429644296542966429674296842969429704297142972429734297442975429764297742978429794298042981429824298342984429854298642987429884298942990429914299242993429944299542996429974299842999430004300143002430034300443005430064300743008430094301043011430124301343014430154301643017430184301943020430214302243023430244302543026430274302843029430304303143032430334303443035430364303743038430394304043041430424304343044430454304643047430484304943050430514305243053430544305543056430574305843059430604306143062430634306443065430664306743068430694307043071430724307343074430754307643077430784307943080430814308243083430844308543086430874308843089430904309143092430934309443095430964309743098430994310043101431024310343104431054310643107431084310943110431114311243113431144311543116431174311843119431204312143122431234312443125431264312743128431294313043131431324313343134431354313643137431384313943140431414314243143431444314543146431474314843149431504315143152431534315443155431564315743158431594316043161431624316343164431654316643167431684316943170431714317243173431744317543176431774317843179431804318143182431834318443185431864318743188431894319043191431924319343194431954319643197431984319943200432014320243203432044320543206432074320843209432104321143212432134321443215432164321743218432194322043221432224322343224432254322643227432284322943230432314323243233432344323543236432374323843239432404324143242432434324443245432464324743248432494325043251432524325343254432554325643257432584325943260432614326243263432644326543266432674326843269432704327143272432734327443275432764327743278432794328043281432824328343284432854328643287432884328943290432914329243293432944329543296432974329843299433004330143302433034330443305433064330743308433094331043311433124331343314433154331643317433184331943320433214332243323433244332543326433274332843329433304333143332433334333443335433364333743338433394334043341433424334343344433454334643347433484334943350433514335243353433544335543356433574335843359433604336143362433634336443365433664336743368433694337043371433724337343374433754337643377433784337943380433814338243383433844338543386433874338843389433904339143392433934339443395433964339743398433994340043401434024340343404434054340643407434084340943410434114341243413434144341543416434174341843419434204342143422434234342443425434264342743428434294343043431434324343343434434354343643437434384343943440434414344243443434444344543446434474344843449434504345143452434534345443455434564345743458434594346043461434624346343464434654346643467434684346943470434714347243473434744347543476434774347843479434804348143482434834348443485434864348743488434894349043491434924349343494434954349643497434984349943500435014350243503435044350543506435074350843509435104351143512435134351443515435164351743518435194352043521435224352343524435254352643527435284352943530435314353243533435344353543536435374353843539435404354143542435434354443545435464354743548435494355043551435524355343554435554355643557435584355943560435614356243563435644356543566435674356843569435704357143572435734357443575435764357743578435794358043581435824358343584435854358643587435884358943590435914359243593435944359543596435974359843599436004360143602436034360443605436064360743608436094361043611436124361343614436154361643617436184361943620436214362243623436244362543626436274362843629436304363143632436334363443635436364363743638436394364043641436424364343644436454364643647436484364943650436514365243653436544365543656436574365843659436604366143662436634366443665436664366743668436694367043671436724367343674436754367643677436784367943680436814368243683436844368543686436874368843689436904369143692436934369443695436964369743698436994370043701437024370343704437054370643707437084370943710437114371243713437144371543716437174371843719437204372143722437234372443725437264372743728437294373043731437324373343734437354373643737437384373943740437414374243743437444374543746437474374843749437504375143752437534375443755437564375743758437594376043761437624376343764437654376643767437684376943770437714377243773437744377543776437774377843779437804378143782437834378443785437864378743788437894379043791437924379343794437954379643797437984379943800438014380243803438044380543806438074380843809438104381143812438134381443815438164381743818438194382043821438224382343824438254382643827438284382943830438314383243833438344383543836438374383843839438404384143842438434384443845438464384743848438494385043851438524385343854438554385643857438584385943860438614386243863438644386543866438674386843869438704387143872438734387443875438764387743878438794388043881438824388343884438854388643887438884388943890438914389243893438944389543896438974389843899439004390143902439034390443905439064390743908439094391043911439124391343914439154391643917439184391943920439214392243923439244392543926439274392843929439304393143932439334393443935439364393743938439394394043941439424394343944439454394643947439484394943950439514395243953439544395543956439574395843959439604396143962439634396443965439664396743968439694397043971439724397343974439754397643977439784397943980439814398243983439844398543986439874398843989439904399143992439934399443995439964399743998439994400044001440024400344004440054400644007440084400944010440114401244013440144401544016440174401844019440204402144022440234402444025440264402744028440294403044031440324403344034440354403644037440384403944040440414404244043440444404544046440474404844049440504405144052440534405444055440564405744058440594406044061440624406344064440654406644067440684406944070440714407244073440744407544076440774407844079440804408144082440834408444085440864408744088440894409044091440924409344094440954409644097440984409944100441014410244103441044410544106441074410844109441104411144112441134411444115441164411744118441194412044121441224412344124441254412644127441284412944130441314413244133441344413544136441374413844139441404414144142441434414444145441464414744148441494415044151441524415344154441554415644157441584415944160441614416244163441644416544166441674416844169441704417144172441734417444175441764417744178441794418044181441824418344184441854418644187441884418944190441914419244193441944419544196441974419844199442004420144202442034420444205442064420744208442094421044211442124421344214442154421644217442184421944220442214422244223442244422544226442274422844229442304423144232442334423444235442364423744238442394424044241442424424344244442454424644247442484424944250442514425244253442544425544256442574425844259442604426144262442634426444265442664426744268442694427044271442724427344274442754427644277442784427944280442814428244283442844428544286442874428844289442904429144292442934429444295442964429744298442994430044301443024430344304443054430644307443084430944310443114431244313443144431544316443174431844319443204432144322443234432444325443264432744328443294433044331443324433344334443354433644337443384433944340443414434244343443444434544346443474434844349443504435144352443534435444355443564435744358443594436044361443624436344364443654436644367443684436944370443714437244373443744437544376443774437844379443804438144382443834438444385443864438744388443894439044391443924439344394443954439644397443984439944400444014440244403444044440544406444074440844409444104441144412444134441444415444164441744418444194442044421444224442344424444254442644427444284442944430444314443244433444344443544436444374443844439444404444144442444434444444445444464444744448444494445044451444524445344454444554445644457444584445944460444614446244463444644446544466444674446844469444704447144472444734447444475444764447744478444794448044481444824448344484444854448644487444884448944490444914449244493444944449544496444974449844499445004450144502445034450444505445064450744508445094451044511445124451344514445154451644517445184451944520445214452244523445244452544526445274452844529445304453144532445334453444535445364453744538445394454044541445424454344544445454454644547445484454944550445514455244553445544455544556445574455844559445604456144562445634456444565445664456744568445694457044571445724457344574445754457644577445784457944580445814458244583445844458544586445874458844589445904459144592445934459444595445964459744598445994460044601446024460344604446054460644607446084460944610446114461244613446144461544616446174461844619446204462144622446234462444625446264462744628446294463044631446324463344634446354463644637446384463944640446414464244643446444464544646446474464844649446504465144652446534465444655446564465744658446594466044661446624466344664446654466644667446684466944670446714467244673446744467544676446774467844679446804468144682446834468444685446864468744688446894469044691446924469344694446954469644697446984469944700447014470244703447044470544706447074470844709447104471144712447134471444715447164471744718447194472044721447224472344724447254472644727447284472944730447314473244733447344473544736447374473844739447404474144742447434474444745447464474744748447494475044751447524475344754447554475644757447584475944760447614476244763447644476544766447674476844769447704477144772447734477444775447764477744778447794478044781447824478344784447854478644787447884478944790447914479244793447944479544796447974479844799448004480144802448034480444805448064480744808448094481044811448124481344814448154481644817448184481944820448214482244823448244482544826448274482844829448304483144832448334483444835448364483744838448394484044841448424484344844448454484644847448484484944850448514485244853448544485544856448574485844859448604486144862448634486444865448664486744868448694487044871448724487344874448754487644877448784487944880448814488244883448844488544886448874488844889448904489144892448934489444895448964489744898448994490044901449024490344904449054490644907449084490944910449114491244913449144491544916449174491844919449204492144922449234492444925449264492744928449294493044931449324493344934449354493644937449384493944940449414494244943449444494544946449474494844949449504495144952449534495444955449564495744958449594496044961449624496344964449654496644967449684496944970449714497244973449744497544976449774497844979449804498144982449834498444985449864498744988449894499044991449924499344994449954499644997449984499945000450014500245003450044500545006450074500845009450104501145012450134501445015450164501745018450194502045021450224502345024450254502645027450284502945030450314503245033450344503545036450374503845039450404504145042450434504445045450464504745048450494505045051450524505345054450554505645057450584505945060450614506245063450644506545066450674506845069450704507145072450734507445075450764507745078450794508045081450824508345084450854508645087450884508945090450914509245093450944509545096450974509845099451004510145102451034510445105451064510745108451094511045111451124511345114451154511645117451184511945120451214512245123451244512545126451274512845129451304513145132451334513445135451364513745138451394514045141451424514345144451454514645147451484514945150451514515245153451544515545156451574515845159451604516145162451634516445165451664516745168451694517045171451724517345174451754517645177451784517945180451814518245183451844518545186451874518845189451904519145192451934519445195451964519745198451994520045201452024520345204452054520645207452084520945210452114521245213452144521545216452174521845219452204522145222452234522445225452264522745228452294523045231452324523345234452354523645237452384523945240452414524245243452444524545246452474524845249452504525145252452534525445255452564525745258452594526045261452624526345264452654526645267452684526945270452714527245273452744527545276452774527845279452804528145282452834528445285452864528745288452894529045291452924529345294452954529645297452984529945300453014530245303453044530545306453074530845309453104531145312453134531445315453164531745318453194532045321453224532345324453254532645327453284532945330453314533245333453344533545336453374533845339453404534145342453434534445345453464534745348453494535045351453524535345354453554535645357453584535945360453614536245363453644536545366453674536845369453704537145372453734537445375453764537745378453794538045381453824538345384453854538645387453884538945390453914539245393453944539545396453974539845399454004540145402454034540445405454064540745408454094541045411454124541345414454154541645417454184541945420454214542245423454244542545426454274542845429454304543145432454334543445435454364543745438454394544045441454424544345444454454544645447454484544945450454514545245453454544545545456454574545845459454604546145462454634546445465454664546745468454694547045471454724547345474454754547645477454784547945480454814548245483454844548545486454874548845489454904549145492454934549445495454964549745498454994550045501455024550345504455054550645507455084550945510455114551245513455144551545516455174551845519455204552145522455234552445525455264552745528455294553045531455324553345534455354553645537455384553945540455414554245543455444554545546455474554845549455504555145552455534555445555455564555745558455594556045561455624556345564455654556645567455684556945570455714557245573455744557545576455774557845579455804558145582455834558445585455864558745588455894559045591455924559345594455954559645597455984559945600456014560245603456044560545606456074560845609456104561145612456134561445615456164561745618456194562045621456224562345624456254562645627456284562945630456314563245633456344563545636456374563845639456404564145642456434564445645456464564745648456494565045651456524565345654456554565645657456584565945660456614566245663456644566545666456674566845669456704567145672456734567445675456764567745678456794568045681456824568345684456854568645687456884568945690456914569245693456944569545696456974569845699457004570145702457034570445705457064570745708457094571045711457124571345714457154571645717457184571945720457214572245723457244572545726457274572845729457304573145732457334573445735457364573745738457394574045741457424574345744457454574645747457484574945750457514575245753457544575545756457574575845759457604576145762457634576445765457664576745768457694577045771457724577345774457754577645777457784577945780457814578245783457844578545786457874578845789457904579145792457934579445795457964579745798457994580045801458024580345804458054580645807458084580945810458114581245813458144581545816458174581845819458204582145822458234582445825458264582745828458294583045831458324583345834458354583645837458384583945840458414584245843458444584545846458474584845849458504585145852458534585445855458564585745858458594586045861458624586345864458654586645867458684586945870458714587245873458744587545876458774587845879458804588145882458834588445885458864588745888458894589045891458924589345894458954589645897458984589945900459014590245903459044590545906459074590845909459104591145912459134591445915459164591745918459194592045921459224592345924459254592645927459284592945930459314593245933459344593545936459374593845939459404594145942459434594445945459464594745948459494595045951459524595345954459554595645957459584595945960459614596245963459644596545966459674596845969459704597145972459734597445975459764597745978459794598045981459824598345984459854598645987459884598945990459914599245993459944599545996459974599845999460004600146002460034600446005460064600746008460094601046011460124601346014460154601646017460184601946020460214602246023460244602546026460274602846029460304603146032460334603446035460364603746038460394604046041460424604346044460454604646047460484604946050460514605246053460544605546056460574605846059460604606146062460634606446065460664606746068460694607046071460724607346074460754607646077460784607946080460814608246083460844608546086460874608846089460904609146092460934609446095460964609746098460994610046101461024610346104461054610646107461084610946110461114611246113461144611546116461174611846119461204612146122461234612446125461264612746128461294613046131461324613346134461354613646137461384613946140461414614246143461444614546146461474614846149461504615146152461534615446155461564615746158461594616046161461624616346164461654616646167461684616946170461714617246173461744617546176461774617846179461804618146182461834618446185461864618746188461894619046191461924619346194461954619646197461984619946200462014620246203462044620546206462074620846209462104621146212462134621446215462164621746218462194622046221462224622346224462254622646227462284622946230462314623246233462344623546236462374623846239462404624146242462434624446245462464624746248462494625046251462524625346254462554625646257462584625946260462614626246263462644626546266462674626846269462704627146272462734627446275462764627746278462794628046281462824628346284462854628646287462884628946290462914629246293462944629546296462974629846299463004630146302463034630446305463064630746308463094631046311463124631346314463154631646317463184631946320463214632246323463244632546326463274632846329463304633146332463334633446335463364633746338463394634046341463424634346344463454634646347463484634946350463514635246353463544635546356463574635846359463604636146362463634636446365463664636746368463694637046371463724637346374463754637646377463784637946380463814638246383463844638546386463874638846389463904639146392463934639446395463964639746398463994640046401464024640346404464054640646407464084640946410464114641246413464144641546416464174641846419464204642146422464234642446425464264642746428464294643046431464324643346434464354643646437464384643946440464414644246443464444644546446464474644846449464504645146452464534645446455464564645746458464594646046461464624646346464464654646646467464684646946470464714647246473464744647546476464774647846479464804648146482464834648446485464864648746488464894649046491464924649346494464954649646497464984649946500465014650246503465044650546506465074650846509465104651146512465134651446515465164651746518465194652046521465224652346524465254652646527465284652946530465314653246533465344653546536465374653846539465404654146542465434654446545465464654746548465494655046551465524655346554465554655646557465584655946560465614656246563465644656546566465674656846569465704657146572465734657446575465764657746578465794658046581465824658346584465854658646587465884658946590465914659246593465944659546596465974659846599466004660146602466034660446605466064660746608466094661046611466124661346614466154661646617466184661946620466214662246623466244662546626466274662846629466304663146632466334663446635466364663746638466394664046641466424664346644466454664646647466484664946650466514665246653466544665546656466574665846659466604666146662466634666446665466664666746668466694667046671466724667346674466754667646677466784667946680466814668246683466844668546686466874668846689466904669146692466934669446695466964669746698466994670046701467024670346704467054670646707467084670946710467114671246713467144671546716467174671846719467204672146722467234672446725467264672746728467294673046731467324673346734467354673646737467384673946740467414674246743467444674546746467474674846749467504675146752467534675446755467564675746758467594676046761467624676346764467654676646767467684676946770467714677246773467744677546776467774677846779467804678146782467834678446785467864678746788467894679046791467924679346794467954679646797467984679946800468014680246803468044680546806468074680846809468104681146812468134681446815468164681746818468194682046821468224682346824468254682646827468284682946830468314683246833468344683546836468374683846839468404684146842468434684446845468464684746848468494685046851468524685346854468554685646857468584685946860468614686246863468644686546866468674686846869468704687146872468734687446875468764687746878468794688046881468824688346884468854688646887468884688946890468914689246893468944689546896468974689846899469004690146902469034690446905469064690746908469094691046911469124691346914469154691646917469184691946920469214692246923469244692546926469274692846929469304693146932469334693446935469364693746938469394694046941469424694346944469454694646947469484694946950469514695246953469544695546956469574695846959469604696146962469634696446965469664696746968469694697046971469724697346974469754697646977469784697946980469814698246983469844698546986469874698846989469904699146992469934699446995469964699746998469994700047001470024700347004470054700647007470084700947010470114701247013470144701547016470174701847019470204702147022470234702447025470264702747028470294703047031470324703347034470354703647037470384703947040470414704247043470444704547046470474704847049470504705147052470534705447055470564705747058470594706047061470624706347064470654706647067470684706947070470714707247073470744707547076470774707847079470804708147082470834708447085470864708747088470894709047091470924709347094470954709647097470984709947100471014710247103471044710547106471074710847109471104711147112471134711447115471164711747118471194712047121471224712347124471254712647127471284712947130471314713247133471344713547136471374713847139471404714147142471434714447145471464714747148471494715047151471524715347154471554715647157471584715947160471614716247163471644716547166471674716847169471704717147172471734717447175471764717747178471794718047181471824718347184471854718647187471884718947190471914719247193471944719547196471974719847199472004720147202472034720447205472064720747208472094721047211472124721347214472154721647217472184721947220472214722247223472244722547226472274722847229472304723147232472334723447235472364723747238472394724047241472424724347244472454724647247472484724947250472514725247253472544725547256472574725847259472604726147262472634726447265472664726747268472694727047271472724727347274472754727647277472784727947280472814728247283472844728547286472874728847289472904729147292472934729447295472964729747298472994730047301473024730347304473054730647307473084730947310473114731247313473144731547316473174731847319473204732147322473234732447325473264732747328473294733047331473324733347334473354733647337473384733947340473414734247343473444734547346473474734847349473504735147352473534735447355473564735747358473594736047361473624736347364473654736647367473684736947370473714737247373473744737547376473774737847379473804738147382473834738447385473864738747388473894739047391473924739347394473954739647397473984739947400474014740247403474044740547406474074740847409474104741147412474134741447415474164741747418474194742047421474224742347424474254742647427474284742947430474314743247433474344743547436474374743847439474404744147442474434744447445474464744747448474494745047451474524745347454474554745647457474584745947460474614746247463474644746547466474674746847469474704747147472474734747447475474764747747478474794748047481474824748347484474854748647487474884748947490474914749247493474944749547496474974749847499475004750147502475034750447505475064750747508475094751047511475124751347514475154751647517475184751947520475214752247523475244752547526475274752847529475304753147532475334753447535475364753747538475394754047541475424754347544475454754647547475484754947550475514755247553475544755547556475574755847559475604756147562475634756447565475664756747568475694757047571475724757347574475754757647577475784757947580475814758247583475844758547586475874758847589475904759147592475934759447595475964759747598475994760047601476024760347604476054760647607476084760947610476114761247613476144761547616476174761847619476204762147622476234762447625476264762747628476294763047631476324763347634476354763647637476384763947640476414764247643476444764547646476474764847649476504765147652476534765447655476564765747658476594766047661476624766347664476654766647667476684766947670476714767247673476744767547676476774767847679476804768147682476834768447685476864768747688476894769047691476924769347694476954769647697476984769947700477014770247703477044770547706477074770847709477104771147712477134771447715477164771747718477194772047721477224772347724477254772647727477284772947730477314773247733477344773547736477374773847739477404774147742477434774447745477464774747748477494775047751477524775347754477554775647757477584775947760477614776247763477644776547766477674776847769477704777147772477734777447775477764777747778477794778047781477824778347784477854778647787477884778947790477914779247793477944779547796477974779847799478004780147802478034780447805478064780747808478094781047811478124781347814478154781647817478184781947820478214782247823478244782547826478274782847829478304783147832478334783447835478364783747838478394784047841478424784347844478454784647847478484784947850478514785247853478544785547856478574785847859478604786147862478634786447865478664786747868478694787047871478724787347874478754787647877478784787947880478814788247883478844788547886478874788847889478904789147892478934789447895478964789747898478994790047901479024790347904479054790647907479084790947910479114791247913479144791547916479174791847919479204792147922479234792447925479264792747928479294793047931479324793347934479354793647937479384793947940479414794247943479444794547946479474794847949479504795147952479534795447955479564795747958479594796047961479624796347964479654796647967479684796947970479714797247973479744797547976479774797847979479804798147982479834798447985479864798747988479894799047991479924799347994479954799647997479984799948000480014800248003480044800548006480074800848009480104801148012480134801448015480164801748018480194802048021480224802348024480254802648027480284802948030480314803248033480344803548036480374803848039480404804148042480434804448045480464804748048480494805048051480524805348054480554805648057480584805948060480614806248063480644806548066480674806848069480704807148072480734807448075480764807748078480794808048081480824808348084480854808648087480884808948090480914809248093480944809548096480974809848099481004810148102481034810448105481064810748108481094811048111481124811348114481154811648117481184811948120481214812248123481244812548126481274812848129481304813148132481334813448135481364813748138481394814048141481424814348144481454814648147481484814948150481514815248153481544815548156481574815848159481604816148162481634816448165481664816748168481694817048171481724817348174481754817648177481784817948180481814818248183481844818548186481874818848189481904819148192481934819448195481964819748198481994820048201482024820348204482054820648207482084820948210482114821248213482144821548216482174821848219482204822148222482234822448225482264822748228482294823048231482324823348234482354823648237482384823948240482414824248243482444824548246482474824848249482504825148252482534825448255482564825748258482594826048261482624826348264482654826648267482684826948270482714827248273482744827548276482774827848279482804828148282482834828448285482864828748288482894829048291482924829348294482954829648297482984829948300483014830248303483044830548306483074830848309483104831148312483134831448315483164831748318483194832048321483224832348324483254832648327483284832948330483314833248333483344833548336483374833848339483404834148342483434834448345483464834748348483494835048351483524835348354483554835648357483584835948360483614836248363483644836548366483674836848369483704837148372483734837448375483764837748378483794838048381483824838348384483854838648387483884838948390483914839248393483944839548396483974839848399484004840148402484034840448405484064840748408484094841048411484124841348414484154841648417484184841948420484214842248423484244842548426484274842848429484304843148432484334843448435484364843748438484394844048441484424844348444484454844648447484484844948450484514845248453484544845548456484574845848459484604846148462484634846448465484664846748468484694847048471484724847348474484754847648477484784847948480484814848248483484844848548486484874848848489484904849148492484934849448495484964849748498484994850048501485024850348504485054850648507485084850948510485114851248513485144851548516485174851848519485204852148522485234852448525485264852748528485294853048531485324853348534485354853648537485384853948540485414854248543485444854548546485474854848549485504855148552485534855448555485564855748558485594856048561485624856348564485654856648567485684856948570485714857248573485744857548576485774857848579485804858148582485834858448585485864858748588485894859048591485924859348594485954859648597485984859948600486014860248603486044860548606486074860848609486104861148612486134861448615486164861748618486194862048621486224862348624486254862648627486284862948630486314863248633486344863548636486374863848639486404864148642486434864448645486464864748648486494865048651486524865348654486554865648657486584865948660486614866248663486644866548666486674866848669486704867148672486734867448675486764867748678486794868048681486824868348684486854868648687486884868948690486914869248693486944869548696486974869848699487004870148702487034870448705487064870748708487094871048711487124871348714487154871648717487184871948720487214872248723487244872548726487274872848729487304873148732487334873448735487364873748738487394874048741487424874348744487454874648747487484874948750487514875248753487544875548756487574875848759487604876148762487634876448765487664876748768487694877048771487724877348774487754877648777487784877948780487814878248783487844878548786487874878848789487904879148792487934879448795487964879748798487994880048801488024880348804488054880648807488084880948810488114881248813488144881548816488174881848819488204882148822488234882448825488264882748828488294883048831488324883348834488354883648837488384883948840488414884248843488444884548846488474884848849488504885148852488534885448855488564885748858488594886048861488624886348864488654886648867488684886948870488714887248873488744887548876488774887848879488804888148882488834888448885488864888748888488894889048891488924889348894488954889648897488984889948900489014890248903489044890548906489074890848909489104891148912489134891448915489164891748918489194892048921489224892348924489254892648927489284892948930489314893248933489344893548936489374893848939489404894148942489434894448945489464894748948489494895048951489524895348954489554895648957489584895948960489614896248963489644896548966489674896848969489704897148972489734897448975489764897748978489794898048981489824898348984489854898648987489884898948990489914899248993489944899548996489974899848999490004900149002490034900449005490064900749008490094901049011490124901349014490154901649017490184901949020490214902249023490244902549026490274902849029490304903149032490334903449035490364903749038490394904049041490424904349044490454904649047490484904949050490514905249053490544905549056490574905849059490604906149062490634906449065490664906749068490694907049071490724907349074490754907649077490784907949080490814908249083490844908549086490874908849089490904909149092490934909449095490964909749098490994910049101491024910349104491054910649107491084910949110491114911249113491144911549116491174911849119491204912149122491234912449125491264912749128491294913049131491324913349134491354913649137491384913949140491414914249143491444914549146491474914849149491504915149152491534915449155491564915749158491594916049161491624916349164491654916649167491684916949170491714917249173491744917549176491774917849179491804918149182491834918449185491864918749188491894919049191491924919349194491954919649197491984919949200492014920249203492044920549206492074920849209492104921149212492134921449215492164921749218492194922049221492224922349224492254922649227492284922949230492314923249233492344923549236492374923849239492404924149242492434924449245492464924749248492494925049251492524925349254492554925649257492584925949260492614926249263492644926549266492674926849269492704927149272492734927449275492764927749278492794928049281492824928349284492854928649287492884928949290492914929249293492944929549296492974929849299493004930149302493034930449305493064930749308493094931049311493124931349314493154931649317493184931949320493214932249323493244932549326493274932849329493304933149332493334933449335493364933749338493394934049341493424934349344493454934649347493484934949350493514935249353493544935549356493574935849359493604936149362493634936449365493664936749368493694937049371493724937349374493754937649377493784937949380493814938249383493844938549386493874938849389493904939149392493934939449395493964939749398493994940049401494024940349404494054940649407494084940949410494114941249413494144941549416494174941849419494204942149422494234942449425494264942749428494294943049431494324943349434494354943649437494384943949440494414944249443494444944549446494474944849449494504945149452494534945449455494564945749458494594946049461494624946349464494654946649467494684946949470494714947249473494744947549476494774947849479494804948149482494834948449485494864948749488494894949049491494924949349494494954949649497494984949949500495014950249503495044950549506495074950849509495104951149512495134951449515495164951749518495194952049521495224952349524495254952649527495284952949530495314953249533495344953549536495374953849539495404954149542495434954449545495464954749548495494955049551495524955349554495554955649557495584955949560495614956249563495644956549566495674956849569495704957149572495734957449575495764957749578495794958049581495824958349584495854958649587495884958949590495914959249593495944959549596495974959849599496004960149602496034960449605496064960749608496094961049611496124961349614496154961649617496184961949620496214962249623496244962549626496274962849629496304963149632496334963449635496364963749638496394964049641496424964349644496454964649647496484964949650496514965249653496544965549656496574965849659496604966149662496634966449665496664966749668496694967049671496724967349674496754967649677496784967949680496814968249683496844968549686496874968849689496904969149692496934969449695496964969749698496994970049701497024970349704497054970649707497084970949710497114971249713497144971549716497174971849719497204972149722497234972449725497264972749728497294973049731497324973349734497354973649737497384973949740497414974249743497444974549746497474974849749497504975149752497534975449755497564975749758497594976049761497624976349764497654976649767497684976949770497714977249773497744977549776497774977849779497804978149782497834978449785497864978749788497894979049791497924979349794497954979649797497984979949800498014980249803498044980549806498074980849809498104981149812498134981449815498164981749818498194982049821498224982349824498254982649827498284982949830498314983249833498344983549836498374983849839498404984149842498434984449845498464984749848498494985049851498524985349854498554985649857498584985949860498614986249863498644986549866498674986849869498704987149872498734987449875498764987749878498794988049881498824988349884498854988649887498884988949890498914989249893498944989549896498974989849899499004990149902499034990449905499064990749908499094991049911499124991349914499154991649917499184991949920499214992249923499244992549926499274992849929499304993149932499334993449935499364993749938499394994049941499424994349944499454994649947499484994949950499514995249953499544995549956499574995849959499604996149962499634996449965499664996749968499694997049971499724997349974499754997649977499784997949980499814998249983499844998549986499874998849989499904999149992499934999449995499964999749998499995000050001500025000350004500055000650007500085000950010500115001250013500145001550016500175001850019500205002150022500235002450025500265002750028500295003050031500325003350034500355003650037500385003950040500415004250043500445004550046500475004850049500505005150052500535005450055500565005750058500595006050061500625006350064500655006650067500685006950070500715007250073500745007550076500775007850079500805008150082500835008450085500865008750088500895009050091500925009350094500955009650097500985009950100501015010250103501045010550106501075010850109501105011150112501135011450115501165011750118501195012050121501225012350124501255012650127501285012950130501315013250133501345013550136501375013850139501405014150142501435014450145501465014750148501495015050151501525015350154501555015650157501585015950160501615016250163501645016550166501675016850169501705017150172501735017450175501765017750178501795018050181501825018350184501855018650187501885018950190501915019250193501945019550196501975019850199502005020150202502035020450205502065020750208502095021050211502125021350214502155021650217502185021950220502215022250223502245022550226502275022850229502305023150232502335023450235502365023750238502395024050241502425024350244502455024650247502485024950250502515025250253502545025550256502575025850259502605026150262502635026450265502665026750268502695027050271502725027350274502755027650277502785027950280502815028250283502845028550286502875028850289502905029150292502935029450295502965029750298502995030050301503025030350304503055030650307503085030950310503115031250313503145031550316503175031850319503205032150322503235032450325503265032750328503295033050331503325033350334503355033650337503385033950340503415034250343503445034550346503475034850349503505035150352503535035450355503565035750358503595036050361503625036350364503655036650367503685036950370503715037250373503745037550376503775037850379503805038150382503835038450385503865038750388503895039050391503925039350394503955039650397503985039950400504015040250403504045040550406504075040850409504105041150412504135041450415504165041750418504195042050421504225042350424504255042650427504285042950430504315043250433504345043550436504375043850439504405044150442504435044450445504465044750448504495045050451504525045350454504555045650457504585045950460504615046250463504645046550466504675046850469504705047150472504735047450475504765047750478504795048050481504825048350484504855048650487504885048950490504915049250493504945049550496504975049850499505005050150502505035050450505505065050750508505095051050511505125051350514505155051650517505185051950520505215052250523505245052550526505275052850529505305053150532505335053450535505365053750538505395054050541505425054350544505455054650547505485054950550505515055250553505545055550556505575055850559505605056150562505635056450565505665056750568505695057050571505725057350574505755057650577505785057950580505815058250583505845058550586505875058850589505905059150592505935059450595505965059750598505995060050601506025060350604506055060650607506085060950610506115061250613506145061550616506175061850619506205062150622506235062450625506265062750628506295063050631506325063350634506355063650637506385063950640506415064250643506445064550646506475064850649506505065150652506535065450655506565065750658506595066050661506625066350664506655066650667506685066950670506715067250673506745067550676506775067850679506805068150682506835068450685506865068750688506895069050691506925069350694506955069650697506985069950700507015070250703507045070550706507075070850709507105071150712507135071450715507165071750718507195072050721507225072350724507255072650727507285072950730507315073250733507345073550736507375073850739507405074150742507435074450745507465074750748507495075050751507525075350754507555075650757507585075950760507615076250763507645076550766507675076850769507705077150772507735077450775507765077750778507795078050781507825078350784507855078650787507885078950790507915079250793507945079550796507975079850799508005080150802508035080450805508065080750808508095081050811508125081350814508155081650817508185081950820508215082250823508245082550826508275082850829508305083150832508335083450835508365083750838508395084050841508425084350844508455084650847508485084950850508515085250853508545085550856508575085850859508605086150862508635086450865508665086750868508695087050871508725087350874508755087650877508785087950880508815088250883508845088550886508875088850889508905089150892508935089450895508965089750898508995090050901509025090350904509055090650907509085090950910509115091250913509145091550916509175091850919509205092150922509235092450925509265092750928509295093050931509325093350934509355093650937509385093950940509415094250943509445094550946509475094850949509505095150952509535095450955509565095750958509595096050961509625096350964509655096650967509685096950970509715097250973509745097550976509775097850979509805098150982509835098450985509865098750988509895099050991509925099350994509955099650997509985099951000510015100251003510045100551006510075100851009510105101151012510135101451015510165101751018510195102051021510225102351024510255102651027510285102951030510315103251033510345103551036510375103851039510405104151042510435104451045510465104751048510495105051051510525105351054510555105651057510585105951060510615106251063510645106551066510675106851069510705107151072510735107451075510765107751078510795108051081510825108351084510855108651087510885108951090510915109251093510945109551096510975109851099511005110151102511035110451105511065110751108511095111051111511125111351114511155111651117511185111951120511215112251123511245112551126511275112851129511305113151132511335113451135511365113751138511395114051141511425114351144511455114651147511485114951150511515115251153511545115551156511575115851159511605116151162511635116451165511665116751168511695117051171511725117351174511755117651177511785117951180511815118251183511845118551186511875118851189511905119151192511935119451195511965119751198511995120051201512025120351204512055120651207512085120951210512115121251213512145121551216512175121851219512205122151222512235122451225512265122751228512295123051231512325123351234512355123651237512385123951240512415124251243512445124551246512475124851249512505125151252512535125451255512565125751258512595126051261512625126351264512655126651267512685126951270512715127251273512745127551276512775127851279512805128151282512835128451285512865128751288512895129051291512925129351294512955129651297512985129951300513015130251303513045130551306513075130851309513105131151312513135131451315513165131751318513195132051321513225132351324513255132651327513285132951330513315133251333513345133551336513375133851339513405134151342513435134451345513465134751348513495135051351513525135351354513555135651357513585135951360513615136251363513645136551366513675136851369513705137151372513735137451375513765137751378513795138051381513825138351384513855138651387513885138951390513915139251393513945139551396513975139851399514005140151402514035140451405514065140751408514095141051411514125141351414514155141651417514185141951420514215142251423514245142551426514275142851429514305143151432514335143451435514365143751438514395144051441514425144351444514455144651447514485144951450514515145251453514545145551456514575145851459514605146151462514635146451465514665146751468514695147051471514725147351474514755147651477514785147951480514815148251483514845148551486514875148851489514905149151492514935149451495514965149751498514995150051501515025150351504515055150651507515085150951510515115151251513515145151551516515175151851519515205152151522515235152451525515265152751528515295153051531515325153351534515355153651537515385153951540515415154251543515445154551546515475154851549515505155151552515535155451555515565155751558515595156051561515625156351564515655156651567515685156951570515715157251573515745157551576515775157851579515805158151582515835158451585515865158751588515895159051591515925159351594515955159651597515985159951600516015160251603516045160551606516075160851609516105161151612516135161451615516165161751618516195162051621516225162351624516255162651627516285162951630516315163251633516345163551636516375163851639516405164151642516435164451645516465164751648516495165051651516525165351654516555165651657516585165951660516615166251663516645166551666516675166851669516705167151672516735167451675516765167751678516795168051681516825168351684516855168651687516885168951690516915169251693516945169551696516975169851699517005170151702517035170451705517065170751708517095171051711517125171351714517155171651717517185171951720517215172251723517245172551726517275172851729517305173151732517335173451735517365173751738517395174051741517425174351744517455174651747517485174951750517515175251753517545175551756517575175851759517605176151762517635176451765517665176751768517695177051771517725177351774517755177651777517785177951780517815178251783517845178551786517875178851789517905179151792517935179451795517965179751798517995180051801518025180351804518055180651807518085180951810518115181251813518145181551816518175181851819518205182151822518235182451825518265182751828518295183051831518325183351834518355183651837518385183951840518415184251843518445184551846518475184851849518505185151852518535185451855518565185751858518595186051861518625186351864518655186651867518685186951870518715187251873518745187551876518775187851879518805188151882518835188451885518865188751888518895189051891518925189351894518955189651897518985189951900519015190251903519045190551906519075190851909519105191151912519135191451915519165191751918519195192051921519225192351924519255192651927519285192951930519315193251933519345193551936519375193851939519405194151942519435194451945519465194751948519495195051951519525195351954519555195651957519585195951960519615196251963519645196551966519675196851969519705197151972519735197451975519765197751978519795198051981519825198351984519855198651987519885198951990519915199251993519945199551996519975199851999520005200152002520035200452005520065200752008520095201052011520125201352014520155201652017520185201952020520215202252023520245202552026520275202852029520305203152032520335203452035520365203752038520395204052041520425204352044520455204652047520485204952050520515205252053520545205552056520575205852059520605206152062520635206452065520665206752068520695207052071520725207352074520755207652077520785207952080520815208252083520845208552086520875208852089520905209152092520935209452095520965209752098520995210052101521025210352104521055210652107521085210952110521115211252113521145211552116521175211852119521205212152122521235212452125521265212752128521295213052131521325213352134521355213652137521385213952140521415214252143521445214552146521475214852149521505215152152521535215452155521565215752158521595216052161521625216352164521655216652167521685216952170521715217252173521745217552176521775217852179521805218152182521835218452185521865218752188521895219052191521925219352194521955219652197521985219952200522015220252203522045220552206522075220852209522105221152212522135221452215522165221752218522195222052221522225222352224522255222652227522285222952230522315223252233522345223552236522375223852239522405224152242522435224452245522465224752248522495225052251522525225352254522555225652257522585225952260522615226252263522645226552266522675226852269522705227152272522735227452275522765227752278522795228052281522825228352284522855228652287522885228952290522915229252293522945229552296522975229852299523005230152302523035230452305523065230752308523095231052311523125231352314523155231652317523185231952320523215232252323523245232552326523275232852329523305233152332523335233452335523365233752338523395234052341523425234352344523455234652347523485234952350523515235252353523545235552356523575235852359523605236152362523635236452365523665236752368523695237052371523725237352374523755237652377523785237952380523815238252383523845238552386523875238852389523905239152392523935239452395523965239752398523995240052401524025240352404524055240652407524085240952410524115241252413524145241552416524175241852419524205242152422524235242452425524265242752428524295243052431524325243352434524355243652437524385243952440524415244252443524445244552446524475244852449524505245152452524535245452455524565245752458524595246052461524625246352464524655246652467524685246952470524715247252473524745247552476524775247852479524805248152482524835248452485524865248752488524895249052491524925249352494524955249652497524985249952500525015250252503525045250552506525075250852509525105251152512525135251452515525165251752518525195252052521525225252352524525255252652527525285252952530525315253252533525345253552536525375253852539525405254152542525435254452545525465254752548525495255052551525525255352554525555255652557525585255952560525615256252563525645256552566525675256852569525705257152572525735257452575525765257752578525795258052581525825258352584525855258652587525885258952590525915259252593525945259552596525975259852599526005260152602526035260452605526065260752608526095261052611526125261352614526155261652617526185261952620526215262252623526245262552626526275262852629526305263152632526335263452635526365263752638526395264052641526425264352644526455264652647526485264952650526515265252653526545265552656526575265852659526605266152662526635266452665526665266752668526695267052671526725267352674526755267652677526785267952680526815268252683526845268552686526875268852689526905269152692526935269452695526965269752698526995270052701527025270352704527055270652707527085270952710527115271252713527145271552716527175271852719527205272152722527235272452725527265272752728527295273052731527325273352734527355273652737527385273952740527415274252743527445274552746527475274852749527505275152752527535275452755527565275752758527595276052761527625276352764527655276652767527685276952770527715277252773527745277552776527775277852779527805278152782527835278452785527865278752788527895279052791527925279352794527955279652797527985279952800528015280252803528045280552806528075280852809528105281152812528135281452815528165281752818528195282052821528225282352824528255282652827528285282952830528315283252833528345283552836528375283852839528405284152842528435284452845528465284752848528495285052851528525285352854528555285652857528585285952860528615286252863528645286552866528675286852869528705287152872528735287452875528765287752878528795288052881528825288352884528855288652887528885288952890528915289252893528945289552896528975289852899529005290152902529035290452905529065290752908529095291052911529125291352914529155291652917529185291952920529215292252923529245292552926529275292852929529305293152932529335293452935529365293752938529395294052941529425294352944529455294652947529485294952950529515295252953529545295552956529575295852959529605296152962529635296452965529665296752968529695297052971529725297352974529755297652977529785297952980529815298252983529845298552986529875298852989529905299152992529935299452995529965299752998529995300053001530025300353004530055300653007530085300953010530115301253013530145301553016530175301853019530205302153022530235302453025530265302753028530295303053031530325303353034530355303653037530385303953040530415304253043530445304553046530475304853049530505305153052530535305453055530565305753058530595306053061530625306353064530655306653067530685306953070530715307253073530745307553076530775307853079530805308153082530835308453085530865308753088530895309053091530925309353094530955309653097530985309953100531015310253103531045310553106531075310853109531105311153112531135311453115531165311753118531195312053121531225312353124531255312653127531285312953130531315313253133531345313553136531375313853139531405314153142531435314453145531465314753148531495315053151531525315353154531555315653157531585315953160531615316253163531645316553166531675316853169531705317153172531735317453175531765317753178531795318053181531825318353184531855318653187531885318953190531915319253193531945319553196531975319853199532005320153202532035320453205532065320753208532095321053211532125321353214532155321653217532185321953220532215322253223532245322553226532275322853229532305323153232532335323453235532365323753238532395324053241532425324353244532455324653247532485324953250532515325253253532545325553256532575325853259532605326153262532635326453265532665326753268532695327053271532725327353274532755327653277532785327953280532815328253283532845328553286532875328853289532905329153292532935329453295532965329753298532995330053301533025330353304533055330653307533085330953310533115331253313533145331553316533175331853319533205332153322533235332453325533265332753328533295333053331533325333353334533355333653337533385333953340533415334253343533445334553346533475334853349533505335153352533535335453355533565335753358533595336053361533625336353364533655336653367533685336953370533715337253373533745337553376533775337853379533805338153382533835338453385533865338753388533895339053391533925339353394533955339653397533985339953400534015340253403534045340553406534075340853409534105341153412534135341453415534165341753418534195342053421534225342353424534255342653427534285342953430534315343253433534345343553436534375343853439534405344153442534435344453445534465344753448534495345053451534525345353454534555345653457534585345953460534615346253463534645346553466534675346853469534705347153472534735347453475534765347753478534795348053481534825348353484534855348653487534885348953490534915349253493534945349553496534975349853499535005350153502535035350453505535065350753508535095351053511535125351353514535155351653517535185351953520535215352253523535245352553526535275352853529535305353153532535335353453535535365353753538535395354053541535425354353544535455354653547535485354953550535515355253553535545355553556535575355853559535605356153562535635356453565535665356753568535695357053571535725357353574535755357653577535785357953580535815358253583535845358553586535875358853589535905359153592535935359453595535965359753598535995360053601536025360353604536055360653607536085360953610536115361253613536145361553616536175361853619536205362153622536235362453625536265362753628536295363053631536325363353634536355363653637536385363953640536415364253643536445364553646536475364853649536505365153652536535365453655536565365753658536595366053661536625366353664536655366653667536685366953670536715367253673536745367553676536775367853679536805368153682536835368453685536865368753688536895369053691536925369353694536955369653697536985369953700537015370253703537045370553706537075370853709537105371153712537135371453715537165371753718537195372053721537225372353724537255372653727537285372953730537315373253733537345373553736537375373853739537405374153742537435374453745537465374753748537495375053751537525375353754537555375653757537585375953760537615376253763537645376553766537675376853769537705377153772537735377453775537765377753778537795378053781537825378353784537855378653787537885378953790537915379253793537945379553796537975379853799538005380153802538035380453805538065380753808538095381053811538125381353814538155381653817538185381953820538215382253823538245382553826538275382853829538305383153832538335383453835538365383753838538395384053841538425384353844538455384653847538485384953850538515385253853538545385553856538575385853859538605386153862538635386453865538665386753868538695387053871538725387353874538755387653877538785387953880538815388253883538845388553886538875388853889538905389153892538935389453895538965389753898538995390053901539025390353904539055390653907539085390953910539115391253913539145391553916539175391853919539205392153922539235392453925539265392753928539295393053931539325393353934539355393653937539385393953940539415394253943539445394553946539475394853949539505395153952539535395453955539565395753958539595396053961539625396353964539655396653967539685396953970539715397253973539745397553976539775397853979539805398153982539835398453985539865398753988539895399053991539925399353994539955399653997539985399954000540015400254003540045400554006540075400854009540105401154012540135401454015540165401754018540195402054021540225402354024540255402654027540285402954030540315403254033540345403554036540375403854039540405404154042540435404454045540465404754048540495405054051540525405354054540555405654057540585405954060540615406254063540645406554066540675406854069540705407154072540735407454075540765407754078540795408054081540825408354084540855408654087540885408954090540915409254093540945409554096540975409854099541005410154102541035410454105541065410754108541095411054111541125411354114541155411654117541185411954120541215412254123541245412554126541275412854129541305413154132541335413454135541365413754138541395414054141541425414354144541455414654147541485414954150541515415254153541545415554156541575415854159541605416154162541635416454165541665416754168541695417054171541725417354174541755417654177541785417954180541815418254183541845418554186541875418854189541905419154192541935419454195541965419754198541995420054201542025420354204542055420654207542085420954210542115421254213542145421554216542175421854219542205422154222542235422454225542265422754228542295423054231542325423354234542355423654237542385423954240542415424254243542445424554246542475424854249542505425154252542535425454255542565425754258542595426054261542625426354264542655426654267542685426954270542715427254273542745427554276542775427854279542805428154282542835428454285542865428754288542895429054291542925429354294542955429654297542985429954300543015430254303543045430554306543075430854309543105431154312543135431454315543165431754318543195432054321543225432354324543255432654327543285432954330543315433254333543345433554336543375433854339543405434154342543435434454345543465434754348543495435054351543525435354354543555435654357543585435954360543615436254363543645436554366543675436854369543705437154372543735437454375543765437754378543795438054381543825438354384543855438654387543885438954390543915439254393543945439554396543975439854399544005440154402544035440454405544065440754408544095441054411544125441354414544155441654417544185441954420544215442254423544245442554426544275442854429544305443154432544335443454435544365443754438544395444054441544425444354444544455444654447544485444954450544515445254453544545445554456544575445854459544605446154462544635446454465544665446754468544695447054471544725447354474544755447654477544785447954480544815448254483544845448554486544875448854489544905449154492544935449454495544965449754498544995450054501545025450354504545055450654507545085450954510545115451254513545145451554516545175451854519545205452154522545235452454525545265452754528545295453054531545325453354534545355453654537545385453954540545415454254543545445454554546545475454854549545505455154552545535455454555545565455754558545595456054561545625456354564545655456654567545685456954570545715457254573545745457554576545775457854579545805458154582545835458454585545865458754588545895459054591545925459354594545955459654597545985459954600546015460254603546045460554606546075460854609546105461154612546135461454615546165461754618546195462054621546225462354624546255462654627546285462954630546315463254633546345463554636546375463854639546405464154642546435464454645546465464754648546495465054651546525465354654546555465654657546585465954660546615466254663546645466554666546675466854669546705467154672546735467454675546765467754678546795468054681546825468354684546855468654687546885468954690546915469254693546945469554696546975469854699547005470154702547035470454705547065470754708547095471054711547125471354714547155471654717547185471954720547215472254723547245472554726547275472854729547305473154732547335473454735547365473754738547395474054741547425474354744547455474654747547485474954750547515475254753547545475554756547575475854759547605476154762547635476454765547665476754768547695477054771547725477354774547755477654777547785477954780547815478254783547845478554786547875478854789547905479154792547935479454795547965479754798547995480054801548025480354804548055480654807548085480954810548115481254813548145481554816548175481854819548205482154822548235482454825548265482754828548295483054831548325483354834548355483654837548385483954840548415484254843548445484554846548475484854849548505485154852548535485454855548565485754858548595486054861548625486354864548655486654867548685486954870548715487254873548745487554876548775487854879548805488154882548835488454885548865488754888548895489054891548925489354894548955489654897548985489954900549015490254903549045490554906549075490854909549105491154912549135491454915549165491754918549195492054921549225492354924549255492654927549285492954930549315493254933549345493554936549375493854939549405494154942549435494454945549465494754948549495495054951549525495354954549555495654957549585495954960549615496254963549645496554966549675496854969549705497154972549735497454975549765497754978549795498054981549825498354984549855498654987549885498954990549915499254993549945499554996549975499854999550005500155002550035500455005550065500755008550095501055011550125501355014550155501655017550185501955020550215502255023550245502555026550275502855029550305503155032550335503455035550365503755038550395504055041550425504355044550455504655047550485504955050550515505255053550545505555056550575505855059550605506155062550635506455065550665506755068550695507055071550725507355074550755507655077550785507955080550815508255083550845508555086550875508855089550905509155092550935509455095550965509755098550995510055101551025510355104551055510655107551085510955110551115511255113551145511555116551175511855119551205512155122551235512455125551265512755128551295513055131551325513355134551355513655137551385513955140551415514255143551445514555146551475514855149551505515155152551535515455155551565515755158551595516055161551625516355164551655516655167551685516955170551715517255173551745517555176551775517855179551805518155182551835518455185551865518755188551895519055191551925519355194551955519655197551985519955200552015520255203552045520555206552075520855209552105521155212552135521455215552165521755218552195522055221552225522355224552255522655227552285522955230552315523255233552345523555236552375523855239552405524155242552435524455245552465524755248552495525055251552525525355254552555525655257552585525955260552615526255263552645526555266552675526855269552705527155272552735527455275552765527755278552795528055281552825528355284552855528655287552885528955290552915529255293552945529555296552975529855299553005530155302553035530455305553065530755308553095531055311553125531355314553155531655317553185531955320553215532255323553245532555326553275532855329553305533155332553335533455335553365533755338553395534055341553425534355344553455534655347553485534955350553515535255353553545535555356553575535855359553605536155362553635536455365553665536755368553695537055371553725537355374553755537655377553785537955380553815538255383553845538555386553875538855389553905539155392553935539455395553965539755398553995540055401554025540355404554055540655407554085540955410554115541255413554145541555416554175541855419554205542155422554235542455425554265542755428554295543055431554325543355434554355543655437554385543955440554415544255443554445544555446554475544855449554505545155452554535545455455554565545755458554595546055461554625546355464554655546655467554685546955470554715547255473554745547555476554775547855479554805548155482554835548455485554865548755488554895549055491554925549355494554955549655497554985549955500555015550255503555045550555506555075550855509555105551155512555135551455515555165551755518555195552055521555225552355524555255552655527555285552955530555315553255533555345553555536555375553855539555405554155542555435554455545555465554755548555495555055551555525555355554555555555655557555585555955560555615556255563555645556555566555675556855569555705557155572555735557455575555765557755578555795558055581555825558355584555855558655587555885558955590555915559255593555945559555596555975559855599556005560155602556035560455605556065560755608556095561055611556125561355614556155561655617556185561955620556215562255623556245562555626556275562855629556305563155632556335563455635556365563755638556395564055641556425564355644556455564655647556485564955650556515565255653556545565555656556575565855659556605566155662556635566455665556665566755668556695567055671556725567355674556755567655677556785567955680556815568255683556845568555686556875568855689556905569155692556935569455695556965569755698556995570055701557025570355704557055570655707557085570955710557115571255713557145571555716557175571855719557205572155722557235572455725557265572755728557295573055731557325573355734557355573655737557385573955740557415574255743557445574555746557475574855749557505575155752557535575455755557565575755758557595576055761557625576355764557655576655767557685576955770557715577255773557745577555776557775577855779557805578155782557835578455785557865578755788557895579055791557925579355794557955579655797557985579955800558015580255803558045580555806558075580855809558105581155812558135581455815558165581755818558195582055821558225582355824558255582655827558285582955830558315583255833558345583555836558375583855839558405584155842558435584455845558465584755848558495585055851558525585355854558555585655857558585585955860558615586255863558645586555866558675586855869558705587155872558735587455875558765587755878558795588055881558825588355884558855588655887558885588955890558915589255893558945589555896558975589855899559005590155902559035590455905559065590755908559095591055911559125591355914559155591655917559185591955920559215592255923559245592555926559275592855929559305593155932559335593455935559365593755938559395594055941559425594355944559455594655947559485594955950559515595255953559545595555956559575595855959559605596155962559635596455965559665596755968559695597055971559725597355974559755597655977559785597955980559815598255983559845598555986559875598855989559905599155992559935599455995559965599755998559995600056001560025600356004560055600656007560085600956010560115601256013560145601556016560175601856019560205602156022560235602456025560265602756028560295603056031560325603356034560355603656037560385603956040560415604256043560445604556046560475604856049560505605156052560535605456055560565605756058560595606056061560625606356064560655606656067560685606956070560715607256073560745607556076560775607856079560805608156082560835608456085560865608756088560895609056091560925609356094560955609656097560985609956100561015610256103561045610556106561075610856109561105611156112561135611456115561165611756118561195612056121561225612356124561255612656127561285612956130561315613256133561345613556136561375613856139561405614156142561435614456145561465614756148561495615056151561525615356154561555615656157561585615956160561615616256163561645616556166561675616856169561705617156172561735617456175561765617756178561795618056181561825618356184561855618656187561885618956190561915619256193561945619556196561975619856199562005620156202562035620456205562065620756208562095621056211562125621356214562155621656217562185621956220562215622256223562245622556226562275622856229562305623156232562335623456235562365623756238562395624056241562425624356244562455624656247562485624956250562515625256253562545625556256562575625856259562605626156262562635626456265562665626756268562695627056271562725627356274562755627656277562785627956280562815628256283562845628556286562875628856289562905629156292562935629456295562965629756298562995630056301563025630356304563055630656307563085630956310563115631256313563145631556316563175631856319563205632156322563235632456325563265632756328563295633056331563325633356334563355633656337563385633956340563415634256343563445634556346563475634856349563505635156352563535635456355563565635756358563595636056361563625636356364563655636656367563685636956370563715637256373563745637556376563775637856379563805638156382563835638456385563865638756388563895639056391563925639356394563955639656397563985639956400564015640256403564045640556406564075640856409564105641156412564135641456415564165641756418564195642056421564225642356424564255642656427564285642956430564315643256433564345643556436564375643856439564405644156442564435644456445564465644756448564495645056451564525645356454564555645656457564585645956460564615646256463564645646556466564675646856469564705647156472564735647456475564765647756478564795648056481564825648356484564855648656487564885648956490564915649256493564945649556496564975649856499565005650156502565035650456505565065650756508565095651056511565125651356514565155651656517565185651956520565215652256523565245652556526565275652856529565305653156532565335653456535565365653756538565395654056541565425654356544565455654656547565485654956550565515655256553565545655556556565575655856559565605656156562565635656456565565665656756568565695657056571565725657356574565755657656577565785657956580565815658256583565845658556586565875658856589565905659156592565935659456595565965659756598565995660056601566025660356604566055660656607566085660956610566115661256613566145661556616566175661856619566205662156622566235662456625566265662756628566295663056631566325663356634566355663656637566385663956640566415664256643566445664556646566475664856649566505665156652566535665456655566565665756658566595666056661566625666356664566655666656667566685666956670566715667256673566745667556676566775667856679566805668156682566835668456685566865668756688566895669056691566925669356694566955669656697566985669956700567015670256703567045670556706567075670856709567105671156712567135671456715567165671756718567195672056721567225672356724567255672656727567285672956730567315673256733567345673556736567375673856739567405674156742567435674456745567465674756748567495675056751567525675356754567555675656757567585675956760567615676256763567645676556766567675676856769567705677156772567735677456775567765677756778567795678056781567825678356784567855678656787567885678956790567915679256793567945679556796567975679856799568005680156802568035680456805568065680756808568095681056811568125681356814568155681656817568185681956820568215682256823568245682556826568275682856829568305683156832568335683456835568365683756838568395684056841568425684356844568455684656847568485684956850568515685256853568545685556856568575685856859568605686156862568635686456865568665686756868568695687056871568725687356874568755687656877568785687956880568815688256883568845688556886568875688856889568905689156892568935689456895568965689756898568995690056901569025690356904569055690656907569085690956910569115691256913569145691556916569175691856919569205692156922569235692456925569265692756928569295693056931569325693356934569355693656937569385693956940569415694256943569445694556946569475694856949569505695156952569535695456955569565695756958569595696056961569625696356964569655696656967569685696956970569715697256973569745697556976569775697856979569805698156982569835698456985569865698756988569895699056991569925699356994569955699656997569985699957000570015700257003570045700557006570075700857009570105701157012570135701457015570165701757018570195702057021570225702357024570255702657027570285702957030570315703257033570345703557036570375703857039570405704157042570435704457045570465704757048570495705057051570525705357054570555705657057570585705957060570615706257063570645706557066570675706857069570705707157072570735707457075570765707757078570795708057081570825708357084570855708657087570885708957090570915709257093570945709557096570975709857099571005710157102571035710457105571065710757108571095711057111571125711357114571155711657117571185711957120571215712257123571245712557126571275712857129571305713157132571335713457135571365713757138571395714057141571425714357144571455714657147571485714957150571515715257153571545715557156571575715857159571605716157162571635716457165571665716757168571695717057171571725717357174571755717657177571785717957180571815718257183571845718557186571875718857189571905719157192571935719457195571965719757198571995720057201572025720357204572055720657207572085720957210572115721257213572145721557216572175721857219572205722157222572235722457225572265722757228572295723057231572325723357234572355723657237572385723957240572415724257243572445724557246572475724857249572505725157252572535725457255572565725757258572595726057261572625726357264572655726657267572685726957270572715727257273572745727557276572775727857279572805728157282572835728457285572865728757288572895729057291572925729357294572955729657297572985729957300573015730257303573045730557306573075730857309573105731157312573135731457315573165731757318573195732057321573225732357324573255732657327573285732957330573315733257333573345733557336573375733857339573405734157342573435734457345573465734757348573495735057351573525735357354573555735657357573585735957360573615736257363573645736557366573675736857369573705737157372573735737457375573765737757378573795738057381573825738357384573855738657387573885738957390573915739257393573945739557396573975739857399574005740157402574035740457405574065740757408574095741057411574125741357414574155741657417574185741957420574215742257423574245742557426574275742857429574305743157432574335743457435574365743757438574395744057441574425744357444574455744657447574485744957450574515745257453574545745557456574575745857459574605746157462574635746457465574665746757468574695747057471574725747357474574755747657477574785747957480574815748257483574845748557486574875748857489574905749157492574935749457495574965749757498574995750057501575025750357504575055750657507575085750957510575115751257513575145751557516575175751857519575205752157522575235752457525575265752757528575295753057531575325753357534575355753657537575385753957540575415754257543575445754557546575475754857549575505755157552575535755457555575565755757558575595756057561575625756357564575655756657567575685756957570575715757257573575745757557576575775757857579575805758157582575835758457585575865758757588575895759057591575925759357594575955759657597575985759957600576015760257603576045760557606576075760857609576105761157612576135761457615576165761757618576195762057621576225762357624576255762657627576285762957630576315763257633576345763557636576375763857639576405764157642576435764457645576465764757648576495765057651576525765357654576555765657657576585765957660576615766257663576645766557666576675766857669576705767157672576735767457675576765767757678576795768057681576825768357684576855768657687576885768957690576915769257693576945769557696576975769857699577005770157702577035770457705577065770757708577095771057711577125771357714577155771657717577185771957720577215772257723577245772557726577275772857729577305773157732577335773457735577365773757738577395774057741577425774357744577455774657747577485774957750577515775257753577545775557756577575775857759577605776157762577635776457765577665776757768577695777057771577725777357774577755777657777577785777957780577815778257783577845778557786577875778857789577905779157792577935779457795577965779757798577995780057801578025780357804578055780657807578085780957810578115781257813578145781557816578175781857819578205782157822578235782457825578265782757828578295783057831578325783357834578355783657837578385783957840578415784257843578445784557846578475784857849578505785157852578535785457855578565785757858578595786057861578625786357864578655786657867578685786957870578715787257873578745787557876578775787857879578805788157882578835788457885578865788757888578895789057891578925789357894578955789657897578985789957900579015790257903579045790557906579075790857909579105791157912579135791457915579165791757918579195792057921579225792357924579255792657927579285792957930579315793257933579345793557936579375793857939579405794157942579435794457945579465794757948579495795057951579525795357954579555795657957579585795957960579615796257963579645796557966579675796857969579705797157972579735797457975579765797757978579795798057981579825798357984579855798657987579885798957990579915799257993579945799557996579975799857999580005800158002580035800458005580065800758008580095801058011580125801358014580155801658017580185801958020580215802258023580245802558026580275802858029580305803158032580335803458035580365803758038580395804058041580425804358044580455804658047580485804958050580515805258053580545805558056580575805858059580605806158062580635806458065580665806758068580695807058071580725807358074580755807658077580785807958080580815808258083580845808558086580875808858089580905809158092580935809458095580965809758098580995810058101581025810358104581055810658107581085810958110581115811258113581145811558116581175811858119581205812158122581235812458125581265812758128581295813058131581325813358134581355813658137581385813958140581415814258143581445814558146581475814858149581505815158152581535815458155581565815758158581595816058161581625816358164581655816658167581685816958170581715817258173581745817558176581775817858179581805818158182581835818458185581865818758188581895819058191581925819358194581955819658197581985819958200582015820258203582045820558206582075820858209582105821158212582135821458215582165821758218582195822058221582225822358224582255822658227582285822958230582315823258233582345823558236582375823858239582405824158242582435824458245582465824758248582495825058251582525825358254582555825658257582585825958260582615826258263582645826558266582675826858269582705827158272582735827458275582765827758278582795828058281582825828358284582855828658287582885828958290582915829258293582945829558296582975829858299583005830158302583035830458305583065830758308583095831058311583125831358314583155831658317583185831958320583215832258323583245832558326583275832858329583305833158332583335833458335583365833758338583395834058341583425834358344583455834658347583485834958350583515835258353583545835558356583575835858359583605836158362583635836458365583665836758368583695837058371583725837358374583755837658377583785837958380583815838258383583845838558386583875838858389583905839158392583935839458395583965839758398583995840058401584025840358404584055840658407584085840958410584115841258413584145841558416584175841858419584205842158422584235842458425584265842758428584295843058431584325843358434584355843658437584385843958440584415844258443584445844558446584475844858449584505845158452584535845458455584565845758458584595846058461584625846358464584655846658467584685846958470584715847258473584745847558476584775847858479584805848158482584835848458485584865848758488584895849058491584925849358494584955849658497584985849958500585015850258503585045850558506585075850858509585105851158512585135851458515585165851758518585195852058521585225852358524585255852658527585285852958530585315853258533585345853558536585375853858539585405854158542585435854458545585465854758548585495855058551585525855358554585555855658557585585855958560585615856258563585645856558566585675856858569585705857158572585735857458575585765857758578585795858058581585825858358584585855858658587585885858958590585915859258593585945859558596585975859858599586005860158602586035860458605586065860758608586095861058611586125861358614586155861658617586185861958620586215862258623586245862558626586275862858629586305863158632586335863458635586365863758638586395864058641586425864358644586455864658647586485864958650586515865258653586545865558656586575865858659586605866158662586635866458665586665866758668586695867058671586725867358674586755867658677586785867958680586815868258683586845868558686586875868858689586905869158692586935869458695586965869758698586995870058701587025870358704587055870658707587085870958710587115871258713587145871558716587175871858719587205872158722587235872458725587265872758728587295873058731587325873358734587355873658737587385873958740587415874258743587445874558746587475874858749587505875158752587535875458755587565875758758587595876058761587625876358764587655876658767587685876958770587715877258773587745877558776587775877858779587805878158782587835878458785587865878758788587895879058791587925879358794587955879658797587985879958800588015880258803588045880558806588075880858809588105881158812588135881458815588165881758818588195882058821588225882358824588255882658827588285882958830588315883258833588345883558836588375883858839588405884158842588435884458845588465884758848588495885058851588525885358854588555885658857588585885958860588615886258863588645886558866588675886858869588705887158872588735887458875588765887758878588795888058881588825888358884588855888658887588885888958890588915889258893588945889558896588975889858899589005890158902589035890458905589065890758908589095891058911589125891358914589155891658917589185891958920589215892258923589245892558926589275892858929589305893158932589335893458935589365893758938589395894058941589425894358944589455894658947589485894958950589515895258953589545895558956589575895858959589605896158962589635896458965589665896758968589695897058971589725897358974589755897658977589785897958980589815898258983589845898558986589875898858989589905899158992589935899458995589965899758998589995900059001590025900359004590055900659007590085900959010590115901259013590145901559016590175901859019590205902159022590235902459025590265902759028590295903059031590325903359034590355903659037590385903959040590415904259043590445904559046590475904859049590505905159052590535905459055590565905759058590595906059061590625906359064590655906659067590685906959070590715907259073590745907559076590775907859079590805908159082590835908459085590865908759088590895909059091590925909359094590955909659097590985909959100591015910259103591045910559106591075910859109591105911159112591135911459115591165911759118591195912059121591225912359124591255912659127591285912959130591315913259133591345913559136591375913859139591405914159142591435914459145591465914759148591495915059151591525915359154591555915659157591585915959160591615916259163591645916559166591675916859169591705917159172591735917459175591765917759178591795918059181591825918359184591855918659187591885918959190591915919259193591945919559196591975919859199592005920159202592035920459205592065920759208592095921059211592125921359214592155921659217592185921959220592215922259223592245922559226592275922859229592305923159232592335923459235592365923759238592395924059241592425924359244592455924659247592485924959250592515925259253592545925559256592575925859259592605926159262592635926459265592665926759268592695927059271592725927359274592755927659277592785927959280592815928259283592845928559286592875928859289592905929159292592935929459295592965929759298592995930059301593025930359304593055930659307593085930959310593115931259313593145931559316593175931859319593205932159322593235932459325593265932759328593295933059331593325933359334593355933659337593385933959340593415934259343593445934559346593475934859349593505935159352593535935459355593565935759358593595936059361593625936359364593655936659367593685936959370593715937259373593745937559376593775937859379593805938159382593835938459385593865938759388593895939059391593925939359394593955939659397593985939959400594015940259403594045940559406594075940859409594105941159412594135941459415594165941759418594195942059421594225942359424594255942659427594285942959430594315943259433594345943559436594375943859439594405944159442594435944459445594465944759448594495945059451594525945359454594555945659457594585945959460594615946259463594645946559466594675946859469594705947159472594735947459475594765947759478594795948059481594825948359484594855948659487594885948959490594915949259493594945949559496594975949859499595005950159502595035950459505595065950759508595095951059511595125951359514595155951659517595185951959520595215952259523595245952559526595275952859529595305953159532595335953459535595365953759538595395954059541595425954359544595455954659547595485954959550595515955259553595545955559556595575955859559595605956159562595635956459565595665956759568595695957059571595725957359574595755957659577595785957959580595815958259583595845958559586595875958859589595905959159592595935959459595595965959759598595995960059601596025960359604596055960659607596085960959610596115961259613596145961559616596175961859619596205962159622596235962459625596265962759628596295963059631596325963359634596355963659637596385963959640596415964259643596445964559646596475964859649596505965159652596535965459655596565965759658596595966059661596625966359664596655966659667596685966959670596715967259673596745967559676596775967859679596805968159682596835968459685596865968759688596895969059691596925969359694596955969659697596985969959700597015970259703597045970559706597075970859709597105971159712597135971459715597165971759718597195972059721597225972359724597255972659727597285972959730597315973259733597345973559736597375973859739597405974159742597435974459745597465974759748597495975059751597525975359754597555975659757597585975959760597615976259763597645976559766597675976859769597705977159772597735977459775597765977759778597795978059781597825978359784597855978659787597885978959790597915979259793597945979559796597975979859799598005980159802598035980459805598065980759808598095981059811598125981359814598155981659817598185981959820598215982259823598245982559826598275982859829598305983159832598335983459835598365983759838598395984059841598425984359844598455984659847598485984959850598515985259853598545985559856598575985859859598605986159862598635986459865598665986759868598695987059871598725987359874598755987659877598785987959880598815988259883598845988559886598875988859889598905989159892598935989459895598965989759898598995990059901599025990359904599055990659907599085990959910599115991259913599145991559916599175991859919599205992159922599235992459925599265992759928599295993059931599325993359934599355993659937599385993959940599415994259943599445994559946599475994859949599505995159952599535995459955599565995759958599595996059961599625996359964599655996659967599685996959970599715997259973599745997559976599775997859979599805998159982599835998459985599865998759988599895999059991599925999359994599955999659997599985999960000600016000260003600046000560006600076000860009600106001160012600136001460015600166001760018600196002060021600226002360024600256002660027600286002960030600316003260033600346003560036600376003860039600406004160042600436004460045600466004760048600496005060051600526005360054600556005660057600586005960060600616006260063600646006560066600676006860069600706007160072600736007460075600766007760078600796008060081600826008360084600856008660087600886008960090600916009260093600946009560096600976009860099601006010160102601036010460105601066010760108601096011060111601126011360114601156011660117601186011960120601216012260123601246012560126601276012860129601306013160132601336013460135601366013760138601396014060141601426014360144601456014660147601486014960150601516015260153601546015560156601576015860159601606016160162601636016460165601666016760168601696017060171601726017360174601756017660177601786017960180601816018260183601846018560186601876018860189601906019160192601936019460195601966019760198601996020060201602026020360204602056020660207602086020960210602116021260213602146021560216602176021860219602206022160222602236022460225602266022760228602296023060231602326023360234602356023660237602386023960240602416024260243602446024560246602476024860249602506025160252602536025460255602566025760258602596026060261602626026360264602656026660267602686026960270602716027260273602746027560276602776027860279602806028160282602836028460285602866028760288602896029060291602926029360294602956029660297602986029960300603016030260303603046030560306603076030860309603106031160312603136031460315603166031760318603196032060321603226032360324603256032660327603286032960330603316033260333603346033560336603376033860339603406034160342603436034460345603466034760348603496035060351603526035360354603556035660357603586035960360603616036260363603646036560366603676036860369603706037160372603736037460375603766037760378603796038060381603826038360384603856038660387603886038960390603916039260393603946039560396603976039860399604006040160402604036040460405604066040760408604096041060411604126041360414604156041660417604186041960420604216042260423604246042560426604276042860429604306043160432604336043460435604366043760438604396044060441604426044360444604456044660447604486044960450604516045260453604546045560456604576045860459604606046160462604636046460465604666046760468604696047060471604726047360474604756047660477604786047960480604816048260483604846048560486604876048860489604906049160492604936049460495604966049760498604996050060501605026050360504605056050660507605086050960510605116051260513605146051560516605176051860519605206052160522605236052460525605266052760528605296053060531605326053360534605356053660537605386053960540605416054260543605446054560546605476054860549605506055160552605536055460555605566055760558605596056060561605626056360564605656056660567605686056960570605716057260573605746057560576605776057860579605806058160582605836058460585605866058760588605896059060591605926059360594605956059660597605986059960600606016060260603606046060560606606076060860609606106061160612606136061460615606166061760618606196062060621606226062360624606256062660627606286062960630606316063260633606346063560636606376063860639606406064160642606436064460645606466064760648606496065060651606526065360654606556065660657606586065960660606616066260663606646066560666606676066860669606706067160672606736067460675606766067760678606796068060681606826068360684606856068660687606886068960690606916069260693606946069560696606976069860699607006070160702607036070460705607066070760708607096071060711607126071360714607156071660717607186071960720607216072260723607246072560726607276072860729607306073160732607336073460735607366073760738607396074060741607426074360744607456074660747607486074960750607516075260753607546075560756607576075860759607606076160762607636076460765607666076760768607696077060771607726077360774607756077660777607786077960780607816078260783607846078560786607876078860789607906079160792607936079460795607966079760798607996080060801608026080360804608056080660807608086080960810608116081260813608146081560816608176081860819608206082160822608236082460825608266082760828608296083060831608326083360834608356083660837608386083960840608416084260843608446084560846608476084860849608506085160852608536085460855608566085760858608596086060861608626086360864608656086660867608686086960870608716087260873608746087560876608776087860879608806088160882608836088460885608866088760888608896089060891608926089360894608956089660897608986089960900609016090260903609046090560906609076090860909609106091160912609136091460915609166091760918609196092060921609226092360924609256092660927609286092960930609316093260933609346093560936609376093860939609406094160942609436094460945609466094760948609496095060951609526095360954609556095660957609586095960960609616096260963609646096560966609676096860969609706097160972609736097460975609766097760978609796098060981609826098360984609856098660987609886098960990609916099260993609946099560996609976099860999610006100161002610036100461005610066100761008610096101061011610126101361014610156101661017610186101961020610216102261023610246102561026610276102861029610306103161032610336103461035610366103761038610396104061041610426104361044610456104661047610486104961050610516105261053610546105561056610576105861059610606106161062610636106461065610666106761068610696107061071610726107361074610756107661077610786107961080610816108261083610846108561086610876108861089610906109161092610936109461095610966109761098610996110061101611026110361104611056110661107611086110961110611116111261113611146111561116611176111861119611206112161122611236112461125611266112761128611296113061131611326113361134611356113661137611386113961140611416114261143611446114561146611476114861149611506115161152611536115461155611566115761158611596116061161611626116361164611656116661167611686116961170611716117261173611746117561176611776117861179611806118161182611836118461185611866118761188611896119061191611926119361194611956119661197611986119961200612016120261203612046120561206612076120861209612106121161212612136121461215612166121761218612196122061221612226122361224612256122661227612286122961230612316123261233612346123561236612376123861239612406124161242612436124461245612466124761248612496125061251612526125361254612556125661257612586125961260612616126261263612646126561266612676126861269612706127161272612736127461275612766127761278612796128061281612826128361284612856128661287612886128961290
  1. /*! Element Plus v2.9.8 */
  2. import { readonly, shallowRef, watchEffect, getCurrentScope, onScopeDispose, unref, ref, watch, getCurrentInstance, onMounted, nextTick, computed, defineComponent, openBlock, createElementBlock, createElementVNode, warn, isVNode, Fragment, Comment, onBeforeUnmount, isRef, inject, onUnmounted, h as h$1, Teleport as Teleport$1, onBeforeMount, provide, renderSlot, normalizeClass, normalizeStyle, mergeProps, useSlots, createBlock, Transition, withCtx, withDirectives, resolveDynamicComponent, createCommentVNode, createTextVNode, toDisplayString, createVNode, vShow, toRef, reactive, toRefs, onUpdated, TransitionGroup, useAttrs as useAttrs$1, withModifiers, onActivated, cloneVNode, Text as Text$1, onDeactivated, renderList, withKeys, createSlots, normalizeProps, guardReactiveProps, toRaw, vModelCheckbox, vModelRadio, resolveComponent, onBeforeUpdate, vModelText, toHandlers, markRaw, effectScope, resolveDirective, toHandlerKey, render, createApp, shallowReactive } from 'vue';
  3. 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])`;
  4. const isVisible = (element) => {
  5. const computed = getComputedStyle(element);
  6. return computed.position === "fixed" ? false : element.offsetParent !== null;
  7. };
  8. const obtainAllFocusableElements$1 = (element) => {
  9. return Array.from(element.querySelectorAll(FOCUSABLE_ELEMENT_SELECTORS)).filter((item) => isFocusable(item) && isVisible(item));
  10. };
  11. const isFocusable = (element) => {
  12. if (element.tabIndex > 0 || element.tabIndex === 0 && element.getAttribute("tabIndex") !== null) {
  13. return true;
  14. }
  15. if (element.tabIndex < 0 || element.hasAttribute("disabled") || element.getAttribute("aria-disabled") === "true") {
  16. return false;
  17. }
  18. switch (element.nodeName) {
  19. case "A": {
  20. return !!element.href && element.rel !== "ignore";
  21. }
  22. case "INPUT": {
  23. return !(element.type === "hidden" || element.type === "file");
  24. }
  25. case "BUTTON":
  26. case "SELECT":
  27. case "TEXTAREA": {
  28. return true;
  29. }
  30. default: {
  31. return false;
  32. }
  33. }
  34. };
  35. const triggerEvent = function(elm, name, ...opts) {
  36. let eventName;
  37. if (name.includes("mouse") || name.includes("click")) {
  38. eventName = "MouseEvents";
  39. } else if (name.includes("key")) {
  40. eventName = "KeyboardEvent";
  41. } else {
  42. eventName = "HTMLEvents";
  43. }
  44. const evt = document.createEvent(eventName);
  45. evt.initEvent(name, ...opts);
  46. elm.dispatchEvent(evt);
  47. return elm;
  48. };
  49. const isLeaf = (el) => !el.getAttribute("aria-owns");
  50. const getSibling = (el, distance, elClass) => {
  51. const { parentNode } = el;
  52. if (!parentNode)
  53. return null;
  54. const siblings = parentNode.querySelectorAll(elClass);
  55. const index = Array.prototype.indexOf.call(siblings, el);
  56. return siblings[index + distance] || null;
  57. };
  58. const focusNode = (el) => {
  59. if (!el)
  60. return;
  61. el.focus();
  62. !isLeaf(el) && el.click();
  63. };
  64. const composeEventHandlers = (theirsHandler, oursHandler, { checkForDefaultPrevented = true } = {}) => {
  65. const handleEvent = (event) => {
  66. const shouldPrevent = theirsHandler == null ? void 0 : theirsHandler(event);
  67. if (checkForDefaultPrevented === false || !shouldPrevent) {
  68. return oursHandler == null ? void 0 : oursHandler(event);
  69. }
  70. };
  71. return handleEvent;
  72. };
  73. const whenMouse = (handler) => {
  74. return (e) => e.pointerType === "mouse" ? handler(e) : void 0;
  75. };
  76. var __defProp$9 = Object.defineProperty;
  77. var __defProps$6 = Object.defineProperties;
  78. var __getOwnPropDescs$6 = Object.getOwnPropertyDescriptors;
  79. var __getOwnPropSymbols$b = Object.getOwnPropertySymbols;
  80. var __hasOwnProp$b = Object.prototype.hasOwnProperty;
  81. var __propIsEnum$b = Object.prototype.propertyIsEnumerable;
  82. var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
  83. var __spreadValues$9 = (a, b) => {
  84. for (var prop in b || (b = {}))
  85. if (__hasOwnProp$b.call(b, prop))
  86. __defNormalProp$9(a, prop, b[prop]);
  87. if (__getOwnPropSymbols$b)
  88. for (var prop of __getOwnPropSymbols$b(b)) {
  89. if (__propIsEnum$b.call(b, prop))
  90. __defNormalProp$9(a, prop, b[prop]);
  91. }
  92. return a;
  93. };
  94. var __spreadProps$6 = (a, b) => __defProps$6(a, __getOwnPropDescs$6(b));
  95. function computedEager(fn, options) {
  96. var _a;
  97. const result = shallowRef();
  98. watchEffect(() => {
  99. result.value = fn();
  100. }, __spreadProps$6(__spreadValues$9({}, options), {
  101. flush: (_a = options == null ? void 0 : options.flush) != null ? _a : "sync"
  102. }));
  103. return readonly(result);
  104. }
  105. var _a;
  106. const isClient = typeof window !== "undefined";
  107. const isDef = (val) => typeof val !== "undefined";
  108. const isString$2 = (val) => typeof val === "string";
  109. const noop$1 = () => {
  110. };
  111. const isIOS = isClient && ((_a = window == null ? void 0 : window.navigator) == null ? void 0 : _a.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
  112. function resolveUnref(r) {
  113. return typeof r === "function" ? r() : unref(r);
  114. }
  115. function createFilterWrapper(filter, fn) {
  116. function wrapper(...args) {
  117. filter(() => fn.apply(this, args), { fn, thisArg: this, args });
  118. }
  119. return wrapper;
  120. }
  121. function debounceFilter(ms, options = {}) {
  122. let timer;
  123. let maxTimer;
  124. const filter = (invoke) => {
  125. const duration = resolveUnref(ms);
  126. const maxDuration = resolveUnref(options.maxWait);
  127. if (timer)
  128. clearTimeout(timer);
  129. if (duration <= 0 || maxDuration !== void 0 && maxDuration <= 0) {
  130. if (maxTimer) {
  131. clearTimeout(maxTimer);
  132. maxTimer = null;
  133. }
  134. return invoke();
  135. }
  136. if (maxDuration && !maxTimer) {
  137. maxTimer = setTimeout(() => {
  138. if (timer)
  139. clearTimeout(timer);
  140. maxTimer = null;
  141. invoke();
  142. }, maxDuration);
  143. }
  144. timer = setTimeout(() => {
  145. if (maxTimer)
  146. clearTimeout(maxTimer);
  147. maxTimer = null;
  148. invoke();
  149. }, duration);
  150. };
  151. return filter;
  152. }
  153. function throttleFilter(ms, trailing = true, leading = true) {
  154. let lastExec = 0;
  155. let timer;
  156. let isLeading = true;
  157. const clear = () => {
  158. if (timer) {
  159. clearTimeout(timer);
  160. timer = void 0;
  161. }
  162. };
  163. const filter = (invoke) => {
  164. const duration = resolveUnref(ms);
  165. const elapsed = Date.now() - lastExec;
  166. clear();
  167. if (duration <= 0) {
  168. lastExec = Date.now();
  169. return invoke();
  170. }
  171. if (elapsed > duration && (leading || !isLeading)) {
  172. lastExec = Date.now();
  173. invoke();
  174. } else if (trailing) {
  175. timer = setTimeout(() => {
  176. lastExec = Date.now();
  177. isLeading = true;
  178. clear();
  179. invoke();
  180. }, duration);
  181. }
  182. if (!leading && !timer)
  183. timer = setTimeout(() => isLeading = true, duration);
  184. isLeading = false;
  185. };
  186. return filter;
  187. }
  188. function identity$1(arg) {
  189. return arg;
  190. }
  191. function tryOnScopeDispose(fn) {
  192. if (getCurrentScope()) {
  193. onScopeDispose(fn);
  194. return true;
  195. }
  196. return false;
  197. }
  198. function useDebounceFn(fn, ms = 200, options = {}) {
  199. return createFilterWrapper(debounceFilter(ms, options), fn);
  200. }
  201. function refDebounced(value, ms = 200, options = {}) {
  202. if (ms <= 0)
  203. return value;
  204. const debounced = ref(value.value);
  205. const updater = useDebounceFn(() => {
  206. debounced.value = value.value;
  207. }, ms, options);
  208. watch(value, () => updater());
  209. return debounced;
  210. }
  211. function useThrottleFn(fn, ms = 200, trailing = false, leading = true) {
  212. return createFilterWrapper(throttleFilter(ms, trailing, leading), fn);
  213. }
  214. function tryOnMounted(fn, sync = true) {
  215. if (getCurrentInstance())
  216. onMounted(fn);
  217. else if (sync)
  218. fn();
  219. else
  220. nextTick(fn);
  221. }
  222. function useTimeoutFn(cb, interval, options = {}) {
  223. const {
  224. immediate = true
  225. } = options;
  226. const isPending = ref(false);
  227. let timer = null;
  228. function clear() {
  229. if (timer) {
  230. clearTimeout(timer);
  231. timer = null;
  232. }
  233. }
  234. function stop() {
  235. isPending.value = false;
  236. clear();
  237. }
  238. function start(...args) {
  239. clear();
  240. isPending.value = true;
  241. timer = setTimeout(() => {
  242. isPending.value = false;
  243. timer = null;
  244. cb(...args);
  245. }, resolveUnref(interval));
  246. }
  247. if (immediate) {
  248. isPending.value = true;
  249. if (isClient)
  250. start();
  251. }
  252. tryOnScopeDispose(stop);
  253. return {
  254. isPending,
  255. start,
  256. stop
  257. };
  258. }
  259. function unrefElement(elRef) {
  260. var _a;
  261. const plain = resolveUnref(elRef);
  262. return (_a = plain == null ? void 0 : plain.$el) != null ? _a : plain;
  263. }
  264. const defaultWindow = isClient ? window : void 0;
  265. const defaultDocument = isClient ? window.document : void 0;
  266. function useEventListener(...args) {
  267. let target;
  268. let event;
  269. let listener;
  270. let options;
  271. if (isString$2(args[0])) {
  272. [event, listener, options] = args;
  273. target = defaultWindow;
  274. } else {
  275. [target, event, listener, options] = args;
  276. }
  277. if (!target)
  278. return noop$1;
  279. let cleanup = noop$1;
  280. const stopWatch = watch(() => unrefElement(target), (el) => {
  281. cleanup();
  282. if (!el)
  283. return;
  284. el.addEventListener(event, listener, options);
  285. cleanup = () => {
  286. el.removeEventListener(event, listener, options);
  287. cleanup = noop$1;
  288. };
  289. }, { immediate: true, flush: "post" });
  290. const stop = () => {
  291. stopWatch();
  292. cleanup();
  293. };
  294. tryOnScopeDispose(stop);
  295. return stop;
  296. }
  297. function onClickOutside(target, handler, options = {}) {
  298. const { window = defaultWindow, ignore, capture = true, detectIframe = false } = options;
  299. if (!window)
  300. return;
  301. const shouldListen = ref(true);
  302. let fallback;
  303. const listener = (event) => {
  304. window.clearTimeout(fallback);
  305. const el = unrefElement(target);
  306. const composedPath = event.composedPath();
  307. if (!el || el === event.target || composedPath.includes(el) || !shouldListen.value)
  308. return;
  309. if (ignore && ignore.length > 0) {
  310. if (ignore.some((target2) => {
  311. const el2 = unrefElement(target2);
  312. return el2 && (event.target === el2 || composedPath.includes(el2));
  313. }))
  314. return;
  315. }
  316. handler(event);
  317. };
  318. const cleanup = [
  319. useEventListener(window, "click", listener, { passive: true, capture }),
  320. useEventListener(window, "pointerdown", (e) => {
  321. const el = unrefElement(target);
  322. shouldListen.value = !!el && !e.composedPath().includes(el);
  323. }, { passive: true }),
  324. useEventListener(window, "pointerup", (e) => {
  325. if (e.button === 0) {
  326. const path = e.composedPath();
  327. e.composedPath = () => path;
  328. fallback = window.setTimeout(() => listener(e), 50);
  329. }
  330. }, { passive: true }),
  331. detectIframe && useEventListener(window, "blur", (event) => {
  332. var _a;
  333. const el = unrefElement(target);
  334. if (((_a = document.activeElement) == null ? void 0 : _a.tagName) === "IFRAME" && !(el == null ? void 0 : el.contains(document.activeElement)))
  335. handler(event);
  336. })
  337. ].filter(Boolean);
  338. const stop = () => cleanup.forEach((fn) => fn());
  339. return stop;
  340. }
  341. function useActiveElement(options = {}) {
  342. const { window = defaultWindow } = options;
  343. const counter = ref(0);
  344. if (window) {
  345. useEventListener(window, "blur", () => counter.value += 1, true);
  346. useEventListener(window, "focus", () => counter.value += 1, true);
  347. }
  348. return computed(() => {
  349. counter.value;
  350. return window == null ? void 0 : window.document.activeElement;
  351. });
  352. }
  353. function useSupported(callback, sync = false) {
  354. const isSupported = ref();
  355. const update = () => isSupported.value = Boolean(callback());
  356. update();
  357. tryOnMounted(update, sync);
  358. return isSupported;
  359. }
  360. const _global = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
  361. const globalKey = "__vueuse_ssr_handlers__";
  362. _global[globalKey] = _global[globalKey] || {};
  363. _global[globalKey];
  364. function useCssVar(prop, target, { window = defaultWindow, initialValue = "" } = {}) {
  365. const variable = ref(initialValue);
  366. const elRef = computed(() => {
  367. var _a;
  368. return unrefElement(target) || ((_a = window == null ? void 0 : window.document) == null ? void 0 : _a.documentElement);
  369. });
  370. watch([elRef, () => resolveUnref(prop)], ([el, prop2]) => {
  371. var _a;
  372. if (el && window) {
  373. const value = (_a = window.getComputedStyle(el).getPropertyValue(prop2)) == null ? void 0 : _a.trim();
  374. variable.value = value || initialValue;
  375. }
  376. }, { immediate: true });
  377. watch(variable, (val) => {
  378. var _a;
  379. if ((_a = elRef.value) == null ? void 0 : _a.style)
  380. elRef.value.style.setProperty(resolveUnref(prop), val);
  381. });
  382. return variable;
  383. }
  384. function useDocumentVisibility({ document = defaultDocument } = {}) {
  385. if (!document)
  386. return ref("visible");
  387. const visibility = ref(document.visibilityState);
  388. useEventListener(document, "visibilitychange", () => {
  389. visibility.value = document.visibilityState;
  390. });
  391. return visibility;
  392. }
  393. var __getOwnPropSymbols$f = Object.getOwnPropertySymbols;
  394. var __hasOwnProp$f = Object.prototype.hasOwnProperty;
  395. var __propIsEnum$f = Object.prototype.propertyIsEnumerable;
  396. var __objRest$2 = (source, exclude) => {
  397. var target = {};
  398. for (var prop in source)
  399. if (__hasOwnProp$f.call(source, prop) && exclude.indexOf(prop) < 0)
  400. target[prop] = source[prop];
  401. if (source != null && __getOwnPropSymbols$f)
  402. for (var prop of __getOwnPropSymbols$f(source)) {
  403. if (exclude.indexOf(prop) < 0 && __propIsEnum$f.call(source, prop))
  404. target[prop] = source[prop];
  405. }
  406. return target;
  407. };
  408. function useResizeObserver(target, callback, options = {}) {
  409. const _a = options, { window = defaultWindow } = _a, observerOptions = __objRest$2(_a, ["window"]);
  410. let observer;
  411. const isSupported = useSupported(() => window && "ResizeObserver" in window);
  412. const cleanup = () => {
  413. if (observer) {
  414. observer.disconnect();
  415. observer = void 0;
  416. }
  417. };
  418. const stopWatch = watch(() => unrefElement(target), (el) => {
  419. cleanup();
  420. if (isSupported.value && window && el) {
  421. observer = new ResizeObserver(callback);
  422. observer.observe(el, observerOptions);
  423. }
  424. }, { immediate: true, flush: "post" });
  425. const stop = () => {
  426. cleanup();
  427. stopWatch();
  428. };
  429. tryOnScopeDispose(stop);
  430. return {
  431. isSupported,
  432. stop
  433. };
  434. }
  435. function useElementBounding(target, options = {}) {
  436. const {
  437. reset = true,
  438. windowResize = true,
  439. windowScroll = true,
  440. immediate = true
  441. } = options;
  442. const height = ref(0);
  443. const bottom = ref(0);
  444. const left = ref(0);
  445. const right = ref(0);
  446. const top = ref(0);
  447. const width = ref(0);
  448. const x = ref(0);
  449. const y = ref(0);
  450. function update() {
  451. const el = unrefElement(target);
  452. if (!el) {
  453. if (reset) {
  454. height.value = 0;
  455. bottom.value = 0;
  456. left.value = 0;
  457. right.value = 0;
  458. top.value = 0;
  459. width.value = 0;
  460. x.value = 0;
  461. y.value = 0;
  462. }
  463. return;
  464. }
  465. const rect = el.getBoundingClientRect();
  466. height.value = rect.height;
  467. bottom.value = rect.bottom;
  468. left.value = rect.left;
  469. right.value = rect.right;
  470. top.value = rect.top;
  471. width.value = rect.width;
  472. x.value = rect.x;
  473. y.value = rect.y;
  474. }
  475. useResizeObserver(target, update);
  476. watch(() => unrefElement(target), (ele) => !ele && update());
  477. if (windowScroll)
  478. useEventListener("scroll", update, { passive: true });
  479. if (windowResize)
  480. useEventListener("resize", update, { passive: true });
  481. tryOnMounted(() => {
  482. if (immediate)
  483. update();
  484. });
  485. return {
  486. height,
  487. bottom,
  488. left,
  489. right,
  490. top,
  491. width,
  492. x,
  493. y,
  494. update
  495. };
  496. }
  497. var __getOwnPropSymbols$7 = Object.getOwnPropertySymbols;
  498. var __hasOwnProp$7 = Object.prototype.hasOwnProperty;
  499. var __propIsEnum$7 = Object.prototype.propertyIsEnumerable;
  500. var __objRest$1 = (source, exclude) => {
  501. var target = {};
  502. for (var prop in source)
  503. if (__hasOwnProp$7.call(source, prop) && exclude.indexOf(prop) < 0)
  504. target[prop] = source[prop];
  505. if (source != null && __getOwnPropSymbols$7)
  506. for (var prop of __getOwnPropSymbols$7(source)) {
  507. if (exclude.indexOf(prop) < 0 && __propIsEnum$7.call(source, prop))
  508. target[prop] = source[prop];
  509. }
  510. return target;
  511. };
  512. function useMutationObserver(target, callback, options = {}) {
  513. const _a = options, { window = defaultWindow } = _a, mutationOptions = __objRest$1(_a, ["window"]);
  514. let observer;
  515. const isSupported = useSupported(() => window && "MutationObserver" in window);
  516. const cleanup = () => {
  517. if (observer) {
  518. observer.disconnect();
  519. observer = void 0;
  520. }
  521. };
  522. const stopWatch = watch(() => unrefElement(target), (el) => {
  523. cleanup();
  524. if (isSupported.value && window && el) {
  525. observer = new MutationObserver(callback);
  526. observer.observe(el, mutationOptions);
  527. }
  528. }, { immediate: true });
  529. const stop = () => {
  530. cleanup();
  531. stopWatch();
  532. };
  533. tryOnScopeDispose(stop);
  534. return {
  535. isSupported,
  536. stop
  537. };
  538. }
  539. var SwipeDirection;
  540. (function(SwipeDirection2) {
  541. SwipeDirection2["UP"] = "UP";
  542. SwipeDirection2["RIGHT"] = "RIGHT";
  543. SwipeDirection2["DOWN"] = "DOWN";
  544. SwipeDirection2["LEFT"] = "LEFT";
  545. SwipeDirection2["NONE"] = "NONE";
  546. })(SwipeDirection || (SwipeDirection = {}));
  547. var __defProp = Object.defineProperty;
  548. var __getOwnPropSymbols = Object.getOwnPropertySymbols;
  549. var __hasOwnProp = Object.prototype.hasOwnProperty;
  550. var __propIsEnum = Object.prototype.propertyIsEnumerable;
  551. var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
  552. var __spreadValues = (a, b) => {
  553. for (var prop in b || (b = {}))
  554. if (__hasOwnProp.call(b, prop))
  555. __defNormalProp(a, prop, b[prop]);
  556. if (__getOwnPropSymbols)
  557. for (var prop of __getOwnPropSymbols(b)) {
  558. if (__propIsEnum.call(b, prop))
  559. __defNormalProp(a, prop, b[prop]);
  560. }
  561. return a;
  562. };
  563. const _TransitionPresets = {
  564. easeInSine: [0.12, 0, 0.39, 0],
  565. easeOutSine: [0.61, 1, 0.88, 1],
  566. easeInOutSine: [0.37, 0, 0.63, 1],
  567. easeInQuad: [0.11, 0, 0.5, 0],
  568. easeOutQuad: [0.5, 1, 0.89, 1],
  569. easeInOutQuad: [0.45, 0, 0.55, 1],
  570. easeInCubic: [0.32, 0, 0.67, 0],
  571. easeOutCubic: [0.33, 1, 0.68, 1],
  572. easeInOutCubic: [0.65, 0, 0.35, 1],
  573. easeInQuart: [0.5, 0, 0.75, 0],
  574. easeOutQuart: [0.25, 1, 0.5, 1],
  575. easeInOutQuart: [0.76, 0, 0.24, 1],
  576. easeInQuint: [0.64, 0, 0.78, 0],
  577. easeOutQuint: [0.22, 1, 0.36, 1],
  578. easeInOutQuint: [0.83, 0, 0.17, 1],
  579. easeInExpo: [0.7, 0, 0.84, 0],
  580. easeOutExpo: [0.16, 1, 0.3, 1],
  581. easeInOutExpo: [0.87, 0, 0.13, 1],
  582. easeInCirc: [0.55, 0, 1, 0.45],
  583. easeOutCirc: [0, 0.55, 0.45, 1],
  584. easeInOutCirc: [0.85, 0, 0.15, 1],
  585. easeInBack: [0.36, 0, 0.66, -0.56],
  586. easeOutBack: [0.34, 1.56, 0.64, 1],
  587. easeInOutBack: [0.68, -0.6, 0.32, 1.6]
  588. };
  589. __spreadValues({
  590. linear: identity$1
  591. }, _TransitionPresets);
  592. function useVModel(props, key, emit, options = {}) {
  593. var _a, _b, _c;
  594. const {
  595. passive = false,
  596. eventName,
  597. deep = false,
  598. defaultValue
  599. } = options;
  600. const vm = getCurrentInstance();
  601. 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));
  602. let event = eventName;
  603. if (!key) {
  604. {
  605. key = "modelValue";
  606. }
  607. }
  608. event = eventName || event || `update:${key.toString()}`;
  609. const getValue = () => isDef(props[key]) ? props[key] : defaultValue;
  610. if (passive) {
  611. const proxy = ref(getValue());
  612. watch(() => props[key], (v) => proxy.value = v);
  613. watch(proxy, (v) => {
  614. if (v !== props[key] || deep)
  615. _emit(event, v);
  616. }, {
  617. deep
  618. });
  619. return proxy;
  620. } else {
  621. return computed({
  622. get() {
  623. return getValue();
  624. },
  625. set(value) {
  626. _emit(event, value);
  627. }
  628. });
  629. }
  630. }
  631. function useWindowFocus({ window = defaultWindow } = {}) {
  632. if (!window)
  633. return ref(false);
  634. const focused = ref(window.document.hasFocus());
  635. useEventListener(window, "blur", () => {
  636. focused.value = false;
  637. });
  638. useEventListener(window, "focus", () => {
  639. focused.value = true;
  640. });
  641. return focused;
  642. }
  643. function useWindowSize(options = {}) {
  644. const {
  645. window = defaultWindow,
  646. initialWidth = Infinity,
  647. initialHeight = Infinity,
  648. listenOrientation = true
  649. } = options;
  650. const width = ref(initialWidth);
  651. const height = ref(initialHeight);
  652. const update = () => {
  653. if (window) {
  654. width.value = window.innerWidth;
  655. height.value = window.innerHeight;
  656. }
  657. };
  658. update();
  659. tryOnMounted(update);
  660. useEventListener("resize", update, { passive: true });
  661. if (listenOrientation)
  662. useEventListener("orientationchange", update, { passive: true });
  663. return { width, height };
  664. }
  665. const isFirefox = () => isClient && /firefox/i.test(window.navigator.userAgent);
  666. const isInContainer = (el, container) => {
  667. if (!isClient || !el || !container)
  668. return false;
  669. const elRect = el.getBoundingClientRect();
  670. let containerRect;
  671. if (container instanceof Element) {
  672. containerRect = container.getBoundingClientRect();
  673. } else {
  674. containerRect = {
  675. top: 0,
  676. right: window.innerWidth,
  677. bottom: window.innerHeight,
  678. left: 0
  679. };
  680. }
  681. return elRect.top < containerRect.bottom && elRect.bottom > containerRect.top && elRect.right > containerRect.left && elRect.left < containerRect.right;
  682. };
  683. const getOffsetTop = (el) => {
  684. let offset = 0;
  685. let parent = el;
  686. while (parent) {
  687. offset += parent.offsetTop;
  688. parent = parent.offsetParent;
  689. }
  690. return offset;
  691. };
  692. const getOffsetTopDistance = (el, containerEl) => {
  693. return Math.abs(getOffsetTop(el) - getOffsetTop(containerEl));
  694. };
  695. const getClientXY = (event) => {
  696. let clientX;
  697. let clientY;
  698. if (event.type === "touchend") {
  699. clientY = event.changedTouches[0].clientY;
  700. clientX = event.changedTouches[0].clientX;
  701. } else if (event.type.startsWith("touch")) {
  702. clientY = event.touches[0].clientY;
  703. clientX = event.touches[0].clientX;
  704. } else {
  705. clientY = event.clientY;
  706. clientX = event.clientX;
  707. }
  708. return {
  709. clientX,
  710. clientY
  711. };
  712. };
  713. function easeInOutCubic(t, b, c, d) {
  714. const cc = c - b;
  715. t /= d / 2;
  716. if (t < 1) {
  717. return cc / 2 * t * t * t + b;
  718. }
  719. return cc / 2 * ((t -= 2) * t * t + 2) + b;
  720. }
  721. const NOOP = () => {
  722. };
  723. const hasOwnProperty$p = Object.prototype.hasOwnProperty;
  724. const hasOwn = (val, key) => hasOwnProperty$p.call(val, key);
  725. const isArray$1 = Array.isArray;
  726. const isDate$1 = (val) => toTypeString(val) === "[object Date]";
  727. const isFunction$1 = (val) => typeof val === "function";
  728. const isString$1 = (val) => typeof val === "string";
  729. const isObject$1 = (val) => val !== null && typeof val === "object";
  730. const isPromise = (val) => {
  731. return isObject$1(val) && isFunction$1(val.then) && isFunction$1(val.catch);
  732. };
  733. const objectToString$1 = Object.prototype.toString;
  734. const toTypeString = (value) => objectToString$1.call(value);
  735. const isPlainObject$1 = (val) => toTypeString(val) === "[object Object]";
  736. const cacheStringFunction = (fn) => {
  737. const cache = /* @__PURE__ */ Object.create(null);
  738. return (str) => {
  739. const hit = cache[str];
  740. return hit || (cache[str] = fn(str));
  741. };
  742. };
  743. const camelizeRE = /-(\w)/g;
  744. const camelize = cacheStringFunction((str) => {
  745. return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
  746. });
  747. const hyphenateRE = /\B([A-Z])/g;
  748. const hyphenate = cacheStringFunction((str) => str.replace(hyphenateRE, "-$1").toLowerCase());
  749. const capitalize$2 = cacheStringFunction((str) => str.charAt(0).toUpperCase() + str.slice(1));
  750. var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
  751. var freeSelf = typeof self == "object" && self && self.Object === Object && self;
  752. var root = freeGlobal || freeSelf || Function("return this")();
  753. var Symbol$1 = root.Symbol;
  754. var objectProto$s = Object.prototype;
  755. var hasOwnProperty$o = objectProto$s.hasOwnProperty;
  756. var nativeObjectToString$3 = objectProto$s.toString;
  757. var symToStringTag$1 = Symbol$1 ? Symbol$1.toStringTag : void 0;
  758. function getRawTag(value) {
  759. var isOwn = hasOwnProperty$o.call(value, symToStringTag$1), tag = value[symToStringTag$1];
  760. try {
  761. value[symToStringTag$1] = void 0;
  762. var unmasked = true;
  763. } catch (e) {
  764. }
  765. var result = nativeObjectToString$3.call(value);
  766. if (unmasked) {
  767. if (isOwn) {
  768. value[symToStringTag$1] = tag;
  769. } else {
  770. delete value[symToStringTag$1];
  771. }
  772. }
  773. return result;
  774. }
  775. var objectProto$r = Object.prototype;
  776. var nativeObjectToString$2 = objectProto$r.toString;
  777. function objectToString(value) {
  778. return nativeObjectToString$2.call(value);
  779. }
  780. var nullTag = "[object Null]";
  781. var undefinedTag = "[object Undefined]";
  782. var symToStringTag = Symbol$1 ? Symbol$1.toStringTag : void 0;
  783. function baseGetTag(value) {
  784. if (value == null) {
  785. return value === void 0 ? undefinedTag : nullTag;
  786. }
  787. return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
  788. }
  789. function isObjectLike(value) {
  790. return value != null && typeof value == "object";
  791. }
  792. var symbolTag$3 = "[object Symbol]";
  793. function isSymbol(value) {
  794. return typeof value == "symbol" || isObjectLike(value) && baseGetTag(value) == symbolTag$3;
  795. }
  796. var NAN$2 = 0 / 0;
  797. function baseToNumber(value) {
  798. if (typeof value == "number") {
  799. return value;
  800. }
  801. if (isSymbol(value)) {
  802. return NAN$2;
  803. }
  804. return +value;
  805. }
  806. function arrayMap(array, iteratee) {
  807. var index = -1, length = array == null ? 0 : array.length, result = Array(length);
  808. while (++index < length) {
  809. result[index] = iteratee(array[index], index, array);
  810. }
  811. return result;
  812. }
  813. var isArray = Array.isArray;
  814. var INFINITY$5 = 1 / 0;
  815. var symbolProto$2 = Symbol$1 ? Symbol$1.prototype : void 0;
  816. var symbolToString = symbolProto$2 ? symbolProto$2.toString : void 0;
  817. function baseToString(value) {
  818. if (typeof value == "string") {
  819. return value;
  820. }
  821. if (isArray(value)) {
  822. return arrayMap(value, baseToString) + "";
  823. }
  824. if (isSymbol(value)) {
  825. return symbolToString ? symbolToString.call(value) : "";
  826. }
  827. var result = value + "";
  828. return result == "0" && 1 / value == -INFINITY$5 ? "-0" : result;
  829. }
  830. function createMathOperation(operator, defaultValue) {
  831. return function(value, other) {
  832. var result;
  833. if (value === void 0 && other === void 0) {
  834. return defaultValue;
  835. }
  836. if (value !== void 0) {
  837. result = value;
  838. }
  839. if (other !== void 0) {
  840. if (result === void 0) {
  841. return other;
  842. }
  843. if (typeof value == "string" || typeof other == "string") {
  844. value = baseToString(value);
  845. other = baseToString(other);
  846. } else {
  847. value = baseToNumber(value);
  848. other = baseToNumber(other);
  849. }
  850. result = operator(value, other);
  851. }
  852. return result;
  853. };
  854. }
  855. var add = createMathOperation(function(augend, addend) {
  856. return augend + addend;
  857. }, 0);
  858. var reWhitespace = /\s/;
  859. function trimmedEndIndex(string) {
  860. var index = string.length;
  861. while (index-- && reWhitespace.test(string.charAt(index))) {
  862. }
  863. return index;
  864. }
  865. var reTrimStart$2 = /^\s+/;
  866. function baseTrim(string) {
  867. return string ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart$2, "") : string;
  868. }
  869. function isObject(value) {
  870. var type = typeof value;
  871. return value != null && (type == "object" || type == "function");
  872. }
  873. var NAN$1 = 0 / 0;
  874. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  875. var reIsBinary = /^0b[01]+$/i;
  876. var reIsOctal = /^0o[0-7]+$/i;
  877. var freeParseInt = parseInt;
  878. function toNumber(value) {
  879. if (typeof value == "number") {
  880. return value;
  881. }
  882. if (isSymbol(value)) {
  883. return NAN$1;
  884. }
  885. if (isObject(value)) {
  886. var other = typeof value.valueOf == "function" ? value.valueOf() : value;
  887. value = isObject(other) ? other + "" : other;
  888. }
  889. if (typeof value != "string") {
  890. return value === 0 ? value : +value;
  891. }
  892. value = baseTrim(value);
  893. var isBinary = reIsBinary.test(value);
  894. return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN$1 : +value;
  895. }
  896. var INFINITY$4 = 1 / 0;
  897. var MAX_INTEGER = 17976931348623157e292;
  898. function toFinite(value) {
  899. if (!value) {
  900. return value === 0 ? value : 0;
  901. }
  902. value = toNumber(value);
  903. if (value === INFINITY$4 || value === -INFINITY$4) {
  904. var sign = value < 0 ? -1 : 1;
  905. return sign * MAX_INTEGER;
  906. }
  907. return value === value ? value : 0;
  908. }
  909. function toInteger(value) {
  910. var result = toFinite(value), remainder = result % 1;
  911. return result === result ? remainder ? result - remainder : result : 0;
  912. }
  913. var FUNC_ERROR_TEXT$b = "Expected a function";
  914. function after(n, func) {
  915. if (typeof func != "function") {
  916. throw new TypeError(FUNC_ERROR_TEXT$b);
  917. }
  918. n = toInteger(n);
  919. return function() {
  920. if (--n < 1) {
  921. return func.apply(this, arguments);
  922. }
  923. };
  924. }
  925. function identity(value) {
  926. return value;
  927. }
  928. var asyncTag = "[object AsyncFunction]";
  929. var funcTag$2 = "[object Function]";
  930. var genTag$1 = "[object GeneratorFunction]";
  931. var proxyTag = "[object Proxy]";
  932. function isFunction(value) {
  933. if (!isObject(value)) {
  934. return false;
  935. }
  936. var tag = baseGetTag(value);
  937. return tag == funcTag$2 || tag == genTag$1 || tag == asyncTag || tag == proxyTag;
  938. }
  939. var coreJsData = root["__core-js_shared__"];
  940. var maskSrcKey = function() {
  941. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || "");
  942. return uid ? "Symbol(src)_1." + uid : "";
  943. }();
  944. function isMasked(func) {
  945. return !!maskSrcKey && maskSrcKey in func;
  946. }
  947. var funcProto$2 = Function.prototype;
  948. var funcToString$2 = funcProto$2.toString;
  949. function toSource(func) {
  950. if (func != null) {
  951. try {
  952. return funcToString$2.call(func);
  953. } catch (e) {
  954. }
  955. try {
  956. return func + "";
  957. } catch (e) {
  958. }
  959. }
  960. return "";
  961. }
  962. var reRegExpChar$1 = /[\\^$.*+?()[\]{}|]/g;
  963. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  964. var funcProto$1 = Function.prototype;
  965. var objectProto$q = Object.prototype;
  966. var funcToString$1 = funcProto$1.toString;
  967. var hasOwnProperty$n = objectProto$q.hasOwnProperty;
  968. var reIsNative = RegExp("^" + funcToString$1.call(hasOwnProperty$n).replace(reRegExpChar$1, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$");
  969. function baseIsNative(value) {
  970. if (!isObject(value) || isMasked(value)) {
  971. return false;
  972. }
  973. var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
  974. return pattern.test(toSource(value));
  975. }
  976. function getValue$1(object, key) {
  977. return object == null ? void 0 : object[key];
  978. }
  979. function getNative(object, key) {
  980. var value = getValue$1(object, key);
  981. return baseIsNative(value) ? value : void 0;
  982. }
  983. var WeakMap = getNative(root, "WeakMap");
  984. var metaMap = WeakMap && new WeakMap();
  985. var baseSetData = !metaMap ? identity : function(func, data) {
  986. metaMap.set(func, data);
  987. return func;
  988. };
  989. var objectCreate = Object.create;
  990. var baseCreate = function() {
  991. function object() {
  992. }
  993. return function(proto) {
  994. if (!isObject(proto)) {
  995. return {};
  996. }
  997. if (objectCreate) {
  998. return objectCreate(proto);
  999. }
  1000. object.prototype = proto;
  1001. var result = new object();
  1002. object.prototype = void 0;
  1003. return result;
  1004. };
  1005. }();
  1006. function createCtor(Ctor) {
  1007. return function() {
  1008. var args = arguments;
  1009. switch (args.length) {
  1010. case 0:
  1011. return new Ctor();
  1012. case 1:
  1013. return new Ctor(args[0]);
  1014. case 2:
  1015. return new Ctor(args[0], args[1]);
  1016. case 3:
  1017. return new Ctor(args[0], args[1], args[2]);
  1018. case 4:
  1019. return new Ctor(args[0], args[1], args[2], args[3]);
  1020. case 5:
  1021. return new Ctor(args[0], args[1], args[2], args[3], args[4]);
  1022. case 6:
  1023. return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
  1024. case 7:
  1025. return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
  1026. }
  1027. var thisBinding = baseCreate(Ctor.prototype), result = Ctor.apply(thisBinding, args);
  1028. return isObject(result) ? result : thisBinding;
  1029. };
  1030. }
  1031. var WRAP_BIND_FLAG$8 = 1;
  1032. function createBind(func, bitmask, thisArg) {
  1033. var isBind = bitmask & WRAP_BIND_FLAG$8, Ctor = createCtor(func);
  1034. function wrapper() {
  1035. var fn = this && this !== root && this instanceof wrapper ? Ctor : func;
  1036. return fn.apply(isBind ? thisArg : this, arguments);
  1037. }
  1038. return wrapper;
  1039. }
  1040. function apply(func, thisArg, args) {
  1041. switch (args.length) {
  1042. case 0:
  1043. return func.call(thisArg);
  1044. case 1:
  1045. return func.call(thisArg, args[0]);
  1046. case 2:
  1047. return func.call(thisArg, args[0], args[1]);
  1048. case 3:
  1049. return func.call(thisArg, args[0], args[1], args[2]);
  1050. }
  1051. return func.apply(thisArg, args);
  1052. }
  1053. var nativeMax$g = Math.max;
  1054. function composeArgs(args, partials, holders, isCurried) {
  1055. 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;
  1056. while (++leftIndex < leftLength) {
  1057. result[leftIndex] = partials[leftIndex];
  1058. }
  1059. while (++argsIndex < holdersLength) {
  1060. if (isUncurried || argsIndex < argsLength) {
  1061. result[holders[argsIndex]] = args[argsIndex];
  1062. }
  1063. }
  1064. while (rangeLength--) {
  1065. result[leftIndex++] = args[argsIndex++];
  1066. }
  1067. return result;
  1068. }
  1069. var nativeMax$f = Math.max;
  1070. function composeArgsRight(args, partials, holders, isCurried) {
  1071. 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;
  1072. while (++argsIndex < rangeLength) {
  1073. result[argsIndex] = args[argsIndex];
  1074. }
  1075. var offset = argsIndex;
  1076. while (++rightIndex < rightLength) {
  1077. result[offset + rightIndex] = partials[rightIndex];
  1078. }
  1079. while (++holdersIndex < holdersLength) {
  1080. if (isUncurried || argsIndex < argsLength) {
  1081. result[offset + holders[holdersIndex]] = args[argsIndex++];
  1082. }
  1083. }
  1084. return result;
  1085. }
  1086. function countHolders(array, placeholder) {
  1087. var length = array.length, result = 0;
  1088. while (length--) {
  1089. if (array[length] === placeholder) {
  1090. ++result;
  1091. }
  1092. }
  1093. return result;
  1094. }
  1095. function baseLodash() {
  1096. }
  1097. var MAX_ARRAY_LENGTH$6 = 4294967295;
  1098. function LazyWrapper(value) {
  1099. this.__wrapped__ = value;
  1100. this.__actions__ = [];
  1101. this.__dir__ = 1;
  1102. this.__filtered__ = false;
  1103. this.__iteratees__ = [];
  1104. this.__takeCount__ = MAX_ARRAY_LENGTH$6;
  1105. this.__views__ = [];
  1106. }
  1107. LazyWrapper.prototype = baseCreate(baseLodash.prototype);
  1108. LazyWrapper.prototype.constructor = LazyWrapper;
  1109. function noop() {
  1110. }
  1111. var getData = !metaMap ? noop : function(func) {
  1112. return metaMap.get(func);
  1113. };
  1114. var realNames = {};
  1115. var objectProto$p = Object.prototype;
  1116. var hasOwnProperty$m = objectProto$p.hasOwnProperty;
  1117. function getFuncName(func) {
  1118. var result = func.name + "", array = realNames[result], length = hasOwnProperty$m.call(realNames, result) ? array.length : 0;
  1119. while (length--) {
  1120. var data = array[length], otherFunc = data.func;
  1121. if (otherFunc == null || otherFunc == func) {
  1122. return data.name;
  1123. }
  1124. }
  1125. return result;
  1126. }
  1127. function LodashWrapper(value, chainAll) {
  1128. this.__wrapped__ = value;
  1129. this.__actions__ = [];
  1130. this.__chain__ = !!chainAll;
  1131. this.__index__ = 0;
  1132. this.__values__ = void 0;
  1133. }
  1134. LodashWrapper.prototype = baseCreate(baseLodash.prototype);
  1135. LodashWrapper.prototype.constructor = LodashWrapper;
  1136. function copyArray(source, array) {
  1137. var index = -1, length = source.length;
  1138. array || (array = Array(length));
  1139. while (++index < length) {
  1140. array[index] = source[index];
  1141. }
  1142. return array;
  1143. }
  1144. function wrapperClone(wrapper) {
  1145. if (wrapper instanceof LazyWrapper) {
  1146. return wrapper.clone();
  1147. }
  1148. var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
  1149. result.__actions__ = copyArray(wrapper.__actions__);
  1150. result.__index__ = wrapper.__index__;
  1151. result.__values__ = wrapper.__values__;
  1152. return result;
  1153. }
  1154. var objectProto$o = Object.prototype;
  1155. var hasOwnProperty$l = objectProto$o.hasOwnProperty;
  1156. function lodash(value) {
  1157. if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
  1158. if (value instanceof LodashWrapper) {
  1159. return value;
  1160. }
  1161. if (hasOwnProperty$l.call(value, "__wrapped__")) {
  1162. return wrapperClone(value);
  1163. }
  1164. }
  1165. return new LodashWrapper(value);
  1166. }
  1167. lodash.prototype = baseLodash.prototype;
  1168. lodash.prototype.constructor = lodash;
  1169. function isLaziable(func) {
  1170. var funcName = getFuncName(func), other = lodash[funcName];
  1171. if (typeof other != "function" || !(funcName in LazyWrapper.prototype)) {
  1172. return false;
  1173. }
  1174. if (func === other) {
  1175. return true;
  1176. }
  1177. var data = getData(other);
  1178. return !!data && func === data[0];
  1179. }
  1180. var HOT_COUNT = 800;
  1181. var HOT_SPAN = 16;
  1182. var nativeNow = Date.now;
  1183. function shortOut(func) {
  1184. var count = 0, lastCalled = 0;
  1185. return function() {
  1186. var stamp = nativeNow(), remaining = HOT_SPAN - (stamp - lastCalled);
  1187. lastCalled = stamp;
  1188. if (remaining > 0) {
  1189. if (++count >= HOT_COUNT) {
  1190. return arguments[0];
  1191. }
  1192. } else {
  1193. count = 0;
  1194. }
  1195. return func.apply(void 0, arguments);
  1196. };
  1197. }
  1198. var setData = shortOut(baseSetData);
  1199. var reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/;
  1200. var reSplitDetails = /,? & /;
  1201. function getWrapDetails(source) {
  1202. var match = source.match(reWrapDetails);
  1203. return match ? match[1].split(reSplitDetails) : [];
  1204. }
  1205. var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/;
  1206. function insertWrapDetails(source, details) {
  1207. var length = details.length;
  1208. if (!length) {
  1209. return source;
  1210. }
  1211. var lastIndex = length - 1;
  1212. details[lastIndex] = (length > 1 ? "& " : "") + details[lastIndex];
  1213. details = details.join(length > 2 ? ", " : " ");
  1214. return source.replace(reWrapComment, "{\n/* [wrapped with " + details + "] */\n");
  1215. }
  1216. function constant(value) {
  1217. return function() {
  1218. return value;
  1219. };
  1220. }
  1221. var defineProperty = function() {
  1222. try {
  1223. var func = getNative(Object, "defineProperty");
  1224. func({}, "", {});
  1225. return func;
  1226. } catch (e) {
  1227. }
  1228. }();
  1229. var baseSetToString = !defineProperty ? identity : function(func, string) {
  1230. return defineProperty(func, "toString", {
  1231. "configurable": true,
  1232. "enumerable": false,
  1233. "value": constant(string),
  1234. "writable": true
  1235. });
  1236. };
  1237. var setToString = shortOut(baseSetToString);
  1238. function arrayEach(array, iteratee) {
  1239. var index = -1, length = array == null ? 0 : array.length;
  1240. while (++index < length) {
  1241. if (iteratee(array[index], index, array) === false) {
  1242. break;
  1243. }
  1244. }
  1245. return array;
  1246. }
  1247. function baseFindIndex(array, predicate, fromIndex, fromRight) {
  1248. var length = array.length, index = fromIndex + (fromRight ? 1 : -1);
  1249. while (fromRight ? index-- : ++index < length) {
  1250. if (predicate(array[index], index, array)) {
  1251. return index;
  1252. }
  1253. }
  1254. return -1;
  1255. }
  1256. function baseIsNaN(value) {
  1257. return value !== value;
  1258. }
  1259. function strictIndexOf(array, value, fromIndex) {
  1260. var index = fromIndex - 1, length = array.length;
  1261. while (++index < length) {
  1262. if (array[index] === value) {
  1263. return index;
  1264. }
  1265. }
  1266. return -1;
  1267. }
  1268. function baseIndexOf(array, value, fromIndex) {
  1269. return value === value ? strictIndexOf(array, value, fromIndex) : baseFindIndex(array, baseIsNaN, fromIndex);
  1270. }
  1271. function arrayIncludes(array, value) {
  1272. var length = array == null ? 0 : array.length;
  1273. return !!length && baseIndexOf(array, value, 0) > -1;
  1274. }
  1275. var WRAP_BIND_FLAG$7 = 1;
  1276. var WRAP_BIND_KEY_FLAG$6 = 2;
  1277. var WRAP_CURRY_FLAG$6 = 8;
  1278. var WRAP_CURRY_RIGHT_FLAG$3 = 16;
  1279. var WRAP_PARTIAL_FLAG$6 = 32;
  1280. var WRAP_PARTIAL_RIGHT_FLAG$3 = 64;
  1281. var WRAP_ARY_FLAG$4 = 128;
  1282. var WRAP_REARG_FLAG$3 = 256;
  1283. var WRAP_FLIP_FLAG$2 = 512;
  1284. var wrapFlags = [
  1285. ["ary", WRAP_ARY_FLAG$4],
  1286. ["bind", WRAP_BIND_FLAG$7],
  1287. ["bindKey", WRAP_BIND_KEY_FLAG$6],
  1288. ["curry", WRAP_CURRY_FLAG$6],
  1289. ["curryRight", WRAP_CURRY_RIGHT_FLAG$3],
  1290. ["flip", WRAP_FLIP_FLAG$2],
  1291. ["partial", WRAP_PARTIAL_FLAG$6],
  1292. ["partialRight", WRAP_PARTIAL_RIGHT_FLAG$3],
  1293. ["rearg", WRAP_REARG_FLAG$3]
  1294. ];
  1295. function updateWrapDetails(details, bitmask) {
  1296. arrayEach(wrapFlags, function(pair) {
  1297. var value = "_." + pair[0];
  1298. if (bitmask & pair[1] && !arrayIncludes(details, value)) {
  1299. details.push(value);
  1300. }
  1301. });
  1302. return details.sort();
  1303. }
  1304. function setWrapToString(wrapper, reference, bitmask) {
  1305. var source = reference + "";
  1306. return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
  1307. }
  1308. var WRAP_BIND_FLAG$6 = 1;
  1309. var WRAP_BIND_KEY_FLAG$5 = 2;
  1310. var WRAP_CURRY_BOUND_FLAG$1 = 4;
  1311. var WRAP_CURRY_FLAG$5 = 8;
  1312. var WRAP_PARTIAL_FLAG$5 = 32;
  1313. var WRAP_PARTIAL_RIGHT_FLAG$2 = 64;
  1314. function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
  1315. 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;
  1316. bitmask |= isCurry ? WRAP_PARTIAL_FLAG$5 : WRAP_PARTIAL_RIGHT_FLAG$2;
  1317. bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG$2 : WRAP_PARTIAL_FLAG$5);
  1318. if (!(bitmask & WRAP_CURRY_BOUND_FLAG$1)) {
  1319. bitmask &= ~(WRAP_BIND_FLAG$6 | WRAP_BIND_KEY_FLAG$5);
  1320. }
  1321. var newData = [
  1322. func,
  1323. bitmask,
  1324. thisArg,
  1325. newPartials,
  1326. newHolders,
  1327. newPartialsRight,
  1328. newHoldersRight,
  1329. argPos,
  1330. ary,
  1331. arity
  1332. ];
  1333. var result = wrapFunc.apply(void 0, newData);
  1334. if (isLaziable(func)) {
  1335. setData(result, newData);
  1336. }
  1337. result.placeholder = placeholder;
  1338. return setWrapToString(result, func, bitmask);
  1339. }
  1340. function getHolder(func) {
  1341. var object = func;
  1342. return object.placeholder;
  1343. }
  1344. var MAX_SAFE_INTEGER$5 = 9007199254740991;
  1345. var reIsUint = /^(?:0|[1-9]\d*)$/;
  1346. function isIndex(value, length) {
  1347. var type = typeof value;
  1348. length = length == null ? MAX_SAFE_INTEGER$5 : length;
  1349. return !!length && (type == "number" || type != "symbol" && reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length);
  1350. }
  1351. var nativeMin$e = Math.min;
  1352. function reorder(array, indexes) {
  1353. var arrLength = array.length, length = nativeMin$e(indexes.length, arrLength), oldArray = copyArray(array);
  1354. while (length--) {
  1355. var index = indexes[length];
  1356. array[length] = isIndex(index, arrLength) ? oldArray[index] : void 0;
  1357. }
  1358. return array;
  1359. }
  1360. var PLACEHOLDER$1 = "__lodash_placeholder__";
  1361. function replaceHolders(array, placeholder) {
  1362. var index = -1, length = array.length, resIndex = 0, result = [];
  1363. while (++index < length) {
  1364. var value = array[index];
  1365. if (value === placeholder || value === PLACEHOLDER$1) {
  1366. array[index] = PLACEHOLDER$1;
  1367. result[resIndex++] = index;
  1368. }
  1369. }
  1370. return result;
  1371. }
  1372. var WRAP_BIND_FLAG$5 = 1;
  1373. var WRAP_BIND_KEY_FLAG$4 = 2;
  1374. var WRAP_CURRY_FLAG$4 = 8;
  1375. var WRAP_CURRY_RIGHT_FLAG$2 = 16;
  1376. var WRAP_ARY_FLAG$3 = 128;
  1377. var WRAP_FLIP_FLAG$1 = 512;
  1378. function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
  1379. 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);
  1380. function wrapper() {
  1381. var length = arguments.length, args = Array(length), index = length;
  1382. while (index--) {
  1383. args[index] = arguments[index];
  1384. }
  1385. if (isCurried) {
  1386. var placeholder = getHolder(wrapper), holdersCount = countHolders(args, placeholder);
  1387. }
  1388. if (partials) {
  1389. args = composeArgs(args, partials, holders, isCurried);
  1390. }
  1391. if (partialsRight) {
  1392. args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
  1393. }
  1394. length -= holdersCount;
  1395. if (isCurried && length < arity) {
  1396. var newHolders = replaceHolders(args, placeholder);
  1397. return createRecurry(func, bitmask, createHybrid, wrapper.placeholder, thisArg, args, newHolders, argPos, ary, arity - length);
  1398. }
  1399. var thisBinding = isBind ? thisArg : this, fn = isBindKey ? thisBinding[func] : func;
  1400. length = args.length;
  1401. if (argPos) {
  1402. args = reorder(args, argPos);
  1403. } else if (isFlip && length > 1) {
  1404. args.reverse();
  1405. }
  1406. if (isAry && ary < length) {
  1407. args.length = ary;
  1408. }
  1409. if (this && this !== root && this instanceof wrapper) {
  1410. fn = Ctor || createCtor(fn);
  1411. }
  1412. return fn.apply(thisBinding, args);
  1413. }
  1414. return wrapper;
  1415. }
  1416. function createCurry(func, bitmask, arity) {
  1417. var Ctor = createCtor(func);
  1418. function wrapper() {
  1419. var length = arguments.length, args = Array(length), index = length, placeholder = getHolder(wrapper);
  1420. while (index--) {
  1421. args[index] = arguments[index];
  1422. }
  1423. var holders = length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder ? [] : replaceHolders(args, placeholder);
  1424. length -= holders.length;
  1425. if (length < arity) {
  1426. return createRecurry(func, bitmask, createHybrid, wrapper.placeholder, void 0, args, holders, void 0, void 0, arity - length);
  1427. }
  1428. var fn = this && this !== root && this instanceof wrapper ? Ctor : func;
  1429. return apply(fn, this, args);
  1430. }
  1431. return wrapper;
  1432. }
  1433. var WRAP_BIND_FLAG$4 = 1;
  1434. function createPartial(func, bitmask, thisArg, partials) {
  1435. var isBind = bitmask & WRAP_BIND_FLAG$4, Ctor = createCtor(func);
  1436. function wrapper() {
  1437. var argsIndex = -1, argsLength = arguments.length, leftIndex = -1, leftLength = partials.length, args = Array(leftLength + argsLength), fn = this && this !== root && this instanceof wrapper ? Ctor : func;
  1438. while (++leftIndex < leftLength) {
  1439. args[leftIndex] = partials[leftIndex];
  1440. }
  1441. while (argsLength--) {
  1442. args[leftIndex++] = arguments[++argsIndex];
  1443. }
  1444. return apply(fn, isBind ? thisArg : this, args);
  1445. }
  1446. return wrapper;
  1447. }
  1448. var PLACEHOLDER = "__lodash_placeholder__";
  1449. var WRAP_BIND_FLAG$3 = 1;
  1450. var WRAP_BIND_KEY_FLAG$3 = 2;
  1451. var WRAP_CURRY_BOUND_FLAG = 4;
  1452. var WRAP_CURRY_FLAG$3 = 8;
  1453. var WRAP_ARY_FLAG$2 = 128;
  1454. var WRAP_REARG_FLAG$2 = 256;
  1455. var nativeMin$d = Math.min;
  1456. function mergeData(data, source) {
  1457. 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);
  1458. 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;
  1459. if (!(isCommon || isCombo)) {
  1460. return data;
  1461. }
  1462. if (srcBitmask & WRAP_BIND_FLAG$3) {
  1463. data[2] = source[2];
  1464. newBitmask |= bitmask & WRAP_BIND_FLAG$3 ? 0 : WRAP_CURRY_BOUND_FLAG;
  1465. }
  1466. var value = source[3];
  1467. if (value) {
  1468. var partials = data[3];
  1469. data[3] = partials ? composeArgs(partials, value, source[4]) : value;
  1470. data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
  1471. }
  1472. value = source[5];
  1473. if (value) {
  1474. partials = data[5];
  1475. data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
  1476. data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
  1477. }
  1478. value = source[7];
  1479. if (value) {
  1480. data[7] = value;
  1481. }
  1482. if (srcBitmask & WRAP_ARY_FLAG$2) {
  1483. data[8] = data[8] == null ? source[8] : nativeMin$d(data[8], source[8]);
  1484. }
  1485. if (data[9] == null) {
  1486. data[9] = source[9];
  1487. }
  1488. data[0] = source[0];
  1489. data[1] = newBitmask;
  1490. return data;
  1491. }
  1492. var FUNC_ERROR_TEXT$a = "Expected a function";
  1493. var WRAP_BIND_FLAG$2 = 1;
  1494. var WRAP_BIND_KEY_FLAG$2 = 2;
  1495. var WRAP_CURRY_FLAG$2 = 8;
  1496. var WRAP_CURRY_RIGHT_FLAG$1 = 16;
  1497. var WRAP_PARTIAL_FLAG$4 = 32;
  1498. var WRAP_PARTIAL_RIGHT_FLAG$1 = 64;
  1499. var nativeMax$e = Math.max;
  1500. function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
  1501. var isBindKey = bitmask & WRAP_BIND_KEY_FLAG$2;
  1502. if (!isBindKey && typeof func != "function") {
  1503. throw new TypeError(FUNC_ERROR_TEXT$a);
  1504. }
  1505. var length = partials ? partials.length : 0;
  1506. if (!length) {
  1507. bitmask &= ~(WRAP_PARTIAL_FLAG$4 | WRAP_PARTIAL_RIGHT_FLAG$1);
  1508. partials = holders = void 0;
  1509. }
  1510. ary = ary === void 0 ? ary : nativeMax$e(toInteger(ary), 0);
  1511. arity = arity === void 0 ? arity : toInteger(arity);
  1512. length -= holders ? holders.length : 0;
  1513. if (bitmask & WRAP_PARTIAL_RIGHT_FLAG$1) {
  1514. var partialsRight = partials, holdersRight = holders;
  1515. partials = holders = void 0;
  1516. }
  1517. var data = isBindKey ? void 0 : getData(func);
  1518. var newData = [
  1519. func,
  1520. bitmask,
  1521. thisArg,
  1522. partials,
  1523. holders,
  1524. partialsRight,
  1525. holdersRight,
  1526. argPos,
  1527. ary,
  1528. arity
  1529. ];
  1530. if (data) {
  1531. mergeData(newData, data);
  1532. }
  1533. func = newData[0];
  1534. bitmask = newData[1];
  1535. thisArg = newData[2];
  1536. partials = newData[3];
  1537. holders = newData[4];
  1538. arity = newData[9] = newData[9] === void 0 ? isBindKey ? 0 : func.length : nativeMax$e(newData[9] - length, 0);
  1539. if (!arity && bitmask & (WRAP_CURRY_FLAG$2 | WRAP_CURRY_RIGHT_FLAG$1)) {
  1540. bitmask &= ~(WRAP_CURRY_FLAG$2 | WRAP_CURRY_RIGHT_FLAG$1);
  1541. }
  1542. if (!bitmask || bitmask == WRAP_BIND_FLAG$2) {
  1543. var result = createBind(func, bitmask, thisArg);
  1544. } else if (bitmask == WRAP_CURRY_FLAG$2 || bitmask == WRAP_CURRY_RIGHT_FLAG$1) {
  1545. result = createCurry(func, bitmask, arity);
  1546. } else if ((bitmask == WRAP_PARTIAL_FLAG$4 || bitmask == (WRAP_BIND_FLAG$2 | WRAP_PARTIAL_FLAG$4)) && !holders.length) {
  1547. result = createPartial(func, bitmask, thisArg, partials);
  1548. } else {
  1549. result = createHybrid.apply(void 0, newData);
  1550. }
  1551. var setter = data ? baseSetData : setData;
  1552. return setWrapToString(setter(result, newData), func, bitmask);
  1553. }
  1554. var WRAP_ARY_FLAG$1 = 128;
  1555. function ary(func, n, guard) {
  1556. n = guard ? void 0 : n;
  1557. n = func && n == null ? func.length : n;
  1558. return createWrap(func, WRAP_ARY_FLAG$1, void 0, void 0, void 0, void 0, n);
  1559. }
  1560. function baseAssignValue(object, key, value) {
  1561. if (key == "__proto__" && defineProperty) {
  1562. defineProperty(object, key, {
  1563. "configurable": true,
  1564. "enumerable": true,
  1565. "value": value,
  1566. "writable": true
  1567. });
  1568. } else {
  1569. object[key] = value;
  1570. }
  1571. }
  1572. function eq(value, other) {
  1573. return value === other || value !== value && other !== other;
  1574. }
  1575. var objectProto$n = Object.prototype;
  1576. var hasOwnProperty$k = objectProto$n.hasOwnProperty;
  1577. function assignValue(object, key, value) {
  1578. var objValue = object[key];
  1579. if (!(hasOwnProperty$k.call(object, key) && eq(objValue, value)) || value === void 0 && !(key in object)) {
  1580. baseAssignValue(object, key, value);
  1581. }
  1582. }
  1583. function copyObject(source, props, object, customizer) {
  1584. var isNew = !object;
  1585. object || (object = {});
  1586. var index = -1, length = props.length;
  1587. while (++index < length) {
  1588. var key = props[index];
  1589. var newValue = customizer ? customizer(object[key], source[key], key, object, source) : void 0;
  1590. if (newValue === void 0) {
  1591. newValue = source[key];
  1592. }
  1593. if (isNew) {
  1594. baseAssignValue(object, key, newValue);
  1595. } else {
  1596. assignValue(object, key, newValue);
  1597. }
  1598. }
  1599. return object;
  1600. }
  1601. var nativeMax$d = Math.max;
  1602. function overRest(func, start, transform) {
  1603. start = nativeMax$d(start === void 0 ? func.length - 1 : start, 0);
  1604. return function() {
  1605. var args = arguments, index = -1, length = nativeMax$d(args.length - start, 0), array = Array(length);
  1606. while (++index < length) {
  1607. array[index] = args[start + index];
  1608. }
  1609. index = -1;
  1610. var otherArgs = Array(start + 1);
  1611. while (++index < start) {
  1612. otherArgs[index] = args[index];
  1613. }
  1614. otherArgs[start] = transform(array);
  1615. return apply(func, this, otherArgs);
  1616. };
  1617. }
  1618. function baseRest(func, start) {
  1619. return setToString(overRest(func, start, identity), func + "");
  1620. }
  1621. var MAX_SAFE_INTEGER$4 = 9007199254740991;
  1622. function isLength(value) {
  1623. return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER$4;
  1624. }
  1625. function isArrayLike(value) {
  1626. return value != null && isLength(value.length) && !isFunction(value);
  1627. }
  1628. function isIterateeCall(value, index, object) {
  1629. if (!isObject(object)) {
  1630. return false;
  1631. }
  1632. var type = typeof index;
  1633. if (type == "number" ? isArrayLike(object) && isIndex(index, object.length) : type == "string" && index in object) {
  1634. return eq(object[index], value);
  1635. }
  1636. return false;
  1637. }
  1638. function createAssigner(assigner) {
  1639. return baseRest(function(object, sources) {
  1640. var index = -1, length = sources.length, customizer = length > 1 ? sources[length - 1] : void 0, guard = length > 2 ? sources[2] : void 0;
  1641. customizer = assigner.length > 3 && typeof customizer == "function" ? (length--, customizer) : void 0;
  1642. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  1643. customizer = length < 3 ? void 0 : customizer;
  1644. length = 1;
  1645. }
  1646. object = Object(object);
  1647. while (++index < length) {
  1648. var source = sources[index];
  1649. if (source) {
  1650. assigner(object, source, index, customizer);
  1651. }
  1652. }
  1653. return object;
  1654. });
  1655. }
  1656. var objectProto$m = Object.prototype;
  1657. function isPrototype(value) {
  1658. var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto$m;
  1659. return value === proto;
  1660. }
  1661. function baseTimes(n, iteratee) {
  1662. var index = -1, result = Array(n);
  1663. while (++index < n) {
  1664. result[index] = iteratee(index);
  1665. }
  1666. return result;
  1667. }
  1668. var argsTag$3 = "[object Arguments]";
  1669. function baseIsArguments(value) {
  1670. return isObjectLike(value) && baseGetTag(value) == argsTag$3;
  1671. }
  1672. var objectProto$l = Object.prototype;
  1673. var hasOwnProperty$j = objectProto$l.hasOwnProperty;
  1674. var propertyIsEnumerable$1 = objectProto$l.propertyIsEnumerable;
  1675. var isArguments = baseIsArguments(function() {
  1676. return arguments;
  1677. }()) ? baseIsArguments : function(value) {
  1678. return isObjectLike(value) && hasOwnProperty$j.call(value, "callee") && !propertyIsEnumerable$1.call(value, "callee");
  1679. };
  1680. function stubFalse() {
  1681. return false;
  1682. }
  1683. var freeExports$2 = typeof exports == "object" && exports && !exports.nodeType && exports;
  1684. var freeModule$2 = freeExports$2 && typeof module == "object" && module && !module.nodeType && module;
  1685. var moduleExports$2 = freeModule$2 && freeModule$2.exports === freeExports$2;
  1686. var Buffer$1 = moduleExports$2 ? root.Buffer : void 0;
  1687. var nativeIsBuffer = Buffer$1 ? Buffer$1.isBuffer : void 0;
  1688. var isBuffer = nativeIsBuffer || stubFalse;
  1689. var argsTag$2 = "[object Arguments]";
  1690. var arrayTag$2 = "[object Array]";
  1691. var boolTag$4 = "[object Boolean]";
  1692. var dateTag$4 = "[object Date]";
  1693. var errorTag$3 = "[object Error]";
  1694. var funcTag$1 = "[object Function]";
  1695. var mapTag$9 = "[object Map]";
  1696. var numberTag$4 = "[object Number]";
  1697. var objectTag$4 = "[object Object]";
  1698. var regexpTag$4 = "[object RegExp]";
  1699. var setTag$9 = "[object Set]";
  1700. var stringTag$4 = "[object String]";
  1701. var weakMapTag$3 = "[object WeakMap]";
  1702. var arrayBufferTag$4 = "[object ArrayBuffer]";
  1703. var dataViewTag$4 = "[object DataView]";
  1704. var float32Tag$2 = "[object Float32Array]";
  1705. var float64Tag$2 = "[object Float64Array]";
  1706. var int8Tag$2 = "[object Int8Array]";
  1707. var int16Tag$2 = "[object Int16Array]";
  1708. var int32Tag$2 = "[object Int32Array]";
  1709. var uint8Tag$2 = "[object Uint8Array]";
  1710. var uint8ClampedTag$2 = "[object Uint8ClampedArray]";
  1711. var uint16Tag$2 = "[object Uint16Array]";
  1712. var uint32Tag$2 = "[object Uint32Array]";
  1713. var typedArrayTags = {};
  1714. 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;
  1715. 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;
  1716. function baseIsTypedArray(value) {
  1717. return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
  1718. }
  1719. function baseUnary(func) {
  1720. return function(value) {
  1721. return func(value);
  1722. };
  1723. }
  1724. var freeExports$1 = typeof exports == "object" && exports && !exports.nodeType && exports;
  1725. var freeModule$1 = freeExports$1 && typeof module == "object" && module && !module.nodeType && module;
  1726. var moduleExports$1 = freeModule$1 && freeModule$1.exports === freeExports$1;
  1727. var freeProcess = moduleExports$1 && freeGlobal.process;
  1728. var nodeUtil = function() {
  1729. try {
  1730. var types = freeModule$1 && freeModule$1.require && freeModule$1.require("util").types;
  1731. if (types) {
  1732. return types;
  1733. }
  1734. return freeProcess && freeProcess.binding && freeProcess.binding("util");
  1735. } catch (e) {
  1736. }
  1737. }();
  1738. var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
  1739. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  1740. var objectProto$k = Object.prototype;
  1741. var hasOwnProperty$i = objectProto$k.hasOwnProperty;
  1742. function arrayLikeKeys(value, inherited) {
  1743. 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;
  1744. for (var key in value) {
  1745. 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)))) {
  1746. result.push(key);
  1747. }
  1748. }
  1749. return result;
  1750. }
  1751. function overArg(func, transform) {
  1752. return function(arg) {
  1753. return func(transform(arg));
  1754. };
  1755. }
  1756. var nativeKeys = overArg(Object.keys, Object);
  1757. var objectProto$j = Object.prototype;
  1758. var hasOwnProperty$h = objectProto$j.hasOwnProperty;
  1759. function baseKeys(object) {
  1760. if (!isPrototype(object)) {
  1761. return nativeKeys(object);
  1762. }
  1763. var result = [];
  1764. for (var key in Object(object)) {
  1765. if (hasOwnProperty$h.call(object, key) && key != "constructor") {
  1766. result.push(key);
  1767. }
  1768. }
  1769. return result;
  1770. }
  1771. function keys(object) {
  1772. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  1773. }
  1774. var objectProto$i = Object.prototype;
  1775. var hasOwnProperty$g = objectProto$i.hasOwnProperty;
  1776. var assign = createAssigner(function(object, source) {
  1777. if (isPrototype(source) || isArrayLike(source)) {
  1778. copyObject(source, keys(source), object);
  1779. return;
  1780. }
  1781. for (var key in source) {
  1782. if (hasOwnProperty$g.call(source, key)) {
  1783. assignValue(object, key, source[key]);
  1784. }
  1785. }
  1786. });
  1787. function nativeKeysIn(object) {
  1788. var result = [];
  1789. if (object != null) {
  1790. for (var key in Object(object)) {
  1791. result.push(key);
  1792. }
  1793. }
  1794. return result;
  1795. }
  1796. var objectProto$h = Object.prototype;
  1797. var hasOwnProperty$f = objectProto$h.hasOwnProperty;
  1798. function baseKeysIn(object) {
  1799. if (!isObject(object)) {
  1800. return nativeKeysIn(object);
  1801. }
  1802. var isProto = isPrototype(object), result = [];
  1803. for (var key in object) {
  1804. if (!(key == "constructor" && (isProto || !hasOwnProperty$f.call(object, key)))) {
  1805. result.push(key);
  1806. }
  1807. }
  1808. return result;
  1809. }
  1810. function keysIn(object) {
  1811. return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
  1812. }
  1813. var assignIn = createAssigner(function(object, source) {
  1814. copyObject(source, keysIn(source), object);
  1815. });
  1816. var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
  1817. copyObject(source, keysIn(source), object, customizer);
  1818. });
  1819. var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
  1820. copyObject(source, keys(source), object, customizer);
  1821. });
  1822. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/;
  1823. var reIsPlainProp = /^\w*$/;
  1824. function isKey(value, object) {
  1825. if (isArray(value)) {
  1826. return false;
  1827. }
  1828. var type = typeof value;
  1829. if (type == "number" || type == "symbol" || type == "boolean" || value == null || isSymbol(value)) {
  1830. return true;
  1831. }
  1832. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object(object);
  1833. }
  1834. var nativeCreate = getNative(Object, "create");
  1835. function hashClear() {
  1836. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  1837. this.size = 0;
  1838. }
  1839. function hashDelete(key) {
  1840. var result = this.has(key) && delete this.__data__[key];
  1841. this.size -= result ? 1 : 0;
  1842. return result;
  1843. }
  1844. var HASH_UNDEFINED$2 = "__lodash_hash_undefined__";
  1845. var objectProto$g = Object.prototype;
  1846. var hasOwnProperty$e = objectProto$g.hasOwnProperty;
  1847. function hashGet(key) {
  1848. var data = this.__data__;
  1849. if (nativeCreate) {
  1850. var result = data[key];
  1851. return result === HASH_UNDEFINED$2 ? void 0 : result;
  1852. }
  1853. return hasOwnProperty$e.call(data, key) ? data[key] : void 0;
  1854. }
  1855. var objectProto$f = Object.prototype;
  1856. var hasOwnProperty$d = objectProto$f.hasOwnProperty;
  1857. function hashHas(key) {
  1858. var data = this.__data__;
  1859. return nativeCreate ? data[key] !== void 0 : hasOwnProperty$d.call(data, key);
  1860. }
  1861. var HASH_UNDEFINED$1 = "__lodash_hash_undefined__";
  1862. function hashSet(key, value) {
  1863. var data = this.__data__;
  1864. this.size += this.has(key) ? 0 : 1;
  1865. data[key] = nativeCreate && value === void 0 ? HASH_UNDEFINED$1 : value;
  1866. return this;
  1867. }
  1868. function Hash(entries) {
  1869. var index = -1, length = entries == null ? 0 : entries.length;
  1870. this.clear();
  1871. while (++index < length) {
  1872. var entry = entries[index];
  1873. this.set(entry[0], entry[1]);
  1874. }
  1875. }
  1876. Hash.prototype.clear = hashClear;
  1877. Hash.prototype["delete"] = hashDelete;
  1878. Hash.prototype.get = hashGet;
  1879. Hash.prototype.has = hashHas;
  1880. Hash.prototype.set = hashSet;
  1881. function listCacheClear() {
  1882. this.__data__ = [];
  1883. this.size = 0;
  1884. }
  1885. function assocIndexOf(array, key) {
  1886. var length = array.length;
  1887. while (length--) {
  1888. if (eq(array[length][0], key)) {
  1889. return length;
  1890. }
  1891. }
  1892. return -1;
  1893. }
  1894. var arrayProto$5 = Array.prototype;
  1895. var splice$2 = arrayProto$5.splice;
  1896. function listCacheDelete(key) {
  1897. var data = this.__data__, index = assocIndexOf(data, key);
  1898. if (index < 0) {
  1899. return false;
  1900. }
  1901. var lastIndex = data.length - 1;
  1902. if (index == lastIndex) {
  1903. data.pop();
  1904. } else {
  1905. splice$2.call(data, index, 1);
  1906. }
  1907. --this.size;
  1908. return true;
  1909. }
  1910. function listCacheGet(key) {
  1911. var data = this.__data__, index = assocIndexOf(data, key);
  1912. return index < 0 ? void 0 : data[index][1];
  1913. }
  1914. function listCacheHas(key) {
  1915. return assocIndexOf(this.__data__, key) > -1;
  1916. }
  1917. function listCacheSet(key, value) {
  1918. var data = this.__data__, index = assocIndexOf(data, key);
  1919. if (index < 0) {
  1920. ++this.size;
  1921. data.push([key, value]);
  1922. } else {
  1923. data[index][1] = value;
  1924. }
  1925. return this;
  1926. }
  1927. function ListCache(entries) {
  1928. var index = -1, length = entries == null ? 0 : entries.length;
  1929. this.clear();
  1930. while (++index < length) {
  1931. var entry = entries[index];
  1932. this.set(entry[0], entry[1]);
  1933. }
  1934. }
  1935. ListCache.prototype.clear = listCacheClear;
  1936. ListCache.prototype["delete"] = listCacheDelete;
  1937. ListCache.prototype.get = listCacheGet;
  1938. ListCache.prototype.has = listCacheHas;
  1939. ListCache.prototype.set = listCacheSet;
  1940. var Map$1 = getNative(root, "Map");
  1941. function mapCacheClear() {
  1942. this.size = 0;
  1943. this.__data__ = {
  1944. "hash": new Hash(),
  1945. "map": new (Map$1 || ListCache)(),
  1946. "string": new Hash()
  1947. };
  1948. }
  1949. function isKeyable(value) {
  1950. var type = typeof value;
  1951. return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null;
  1952. }
  1953. function getMapData(map, key) {
  1954. var data = map.__data__;
  1955. return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
  1956. }
  1957. function mapCacheDelete(key) {
  1958. var result = getMapData(this, key)["delete"](key);
  1959. this.size -= result ? 1 : 0;
  1960. return result;
  1961. }
  1962. function mapCacheGet(key) {
  1963. return getMapData(this, key).get(key);
  1964. }
  1965. function mapCacheHas(key) {
  1966. return getMapData(this, key).has(key);
  1967. }
  1968. function mapCacheSet(key, value) {
  1969. var data = getMapData(this, key), size = data.size;
  1970. data.set(key, value);
  1971. this.size += data.size == size ? 0 : 1;
  1972. return this;
  1973. }
  1974. function MapCache(entries) {
  1975. var index = -1, length = entries == null ? 0 : entries.length;
  1976. this.clear();
  1977. while (++index < length) {
  1978. var entry = entries[index];
  1979. this.set(entry[0], entry[1]);
  1980. }
  1981. }
  1982. MapCache.prototype.clear = mapCacheClear;
  1983. MapCache.prototype["delete"] = mapCacheDelete;
  1984. MapCache.prototype.get = mapCacheGet;
  1985. MapCache.prototype.has = mapCacheHas;
  1986. MapCache.prototype.set = mapCacheSet;
  1987. var FUNC_ERROR_TEXT$9 = "Expected a function";
  1988. function memoize(func, resolver) {
  1989. if (typeof func != "function" || resolver != null && typeof resolver != "function") {
  1990. throw new TypeError(FUNC_ERROR_TEXT$9);
  1991. }
  1992. var memoized = function() {
  1993. var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache;
  1994. if (cache.has(key)) {
  1995. return cache.get(key);
  1996. }
  1997. var result = func.apply(this, args);
  1998. memoized.cache = cache.set(key, result) || cache;
  1999. return result;
  2000. };
  2001. memoized.cache = new (memoize.Cache || MapCache)();
  2002. return memoized;
  2003. }
  2004. memoize.Cache = MapCache;
  2005. var MAX_MEMOIZE_SIZE = 500;
  2006. function memoizeCapped(func) {
  2007. var result = memoize(func, function(key) {
  2008. if (cache.size === MAX_MEMOIZE_SIZE) {
  2009. cache.clear();
  2010. }
  2011. return key;
  2012. });
  2013. var cache = result.cache;
  2014. return result;
  2015. }
  2016. var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  2017. var reEscapeChar = /\\(\\)?/g;
  2018. var stringToPath = memoizeCapped(function(string) {
  2019. var result = [];
  2020. if (string.charCodeAt(0) === 46) {
  2021. result.push("");
  2022. }
  2023. string.replace(rePropName, function(match, number, quote, subString) {
  2024. result.push(quote ? subString.replace(reEscapeChar, "$1") : number || match);
  2025. });
  2026. return result;
  2027. });
  2028. function toString(value) {
  2029. return value == null ? "" : baseToString(value);
  2030. }
  2031. function castPath(value, object) {
  2032. if (isArray(value)) {
  2033. return value;
  2034. }
  2035. return isKey(value, object) ? [value] : stringToPath(toString(value));
  2036. }
  2037. var INFINITY$3 = 1 / 0;
  2038. function toKey(value) {
  2039. if (typeof value == "string" || isSymbol(value)) {
  2040. return value;
  2041. }
  2042. var result = value + "";
  2043. return result == "0" && 1 / value == -INFINITY$3 ? "-0" : result;
  2044. }
  2045. function baseGet(object, path) {
  2046. path = castPath(path, object);
  2047. var index = 0, length = path.length;
  2048. while (object != null && index < length) {
  2049. object = object[toKey(path[index++])];
  2050. }
  2051. return index && index == length ? object : void 0;
  2052. }
  2053. function get(object, path, defaultValue) {
  2054. var result = object == null ? void 0 : baseGet(object, path);
  2055. return result === void 0 ? defaultValue : result;
  2056. }
  2057. function baseAt(object, paths) {
  2058. var index = -1, length = paths.length, result = Array(length), skip = object == null;
  2059. while (++index < length) {
  2060. result[index] = skip ? void 0 : get(object, paths[index]);
  2061. }
  2062. return result;
  2063. }
  2064. function arrayPush(array, values) {
  2065. var index = -1, length = values.length, offset = array.length;
  2066. while (++index < length) {
  2067. array[offset + index] = values[index];
  2068. }
  2069. return array;
  2070. }
  2071. var spreadableSymbol = Symbol$1 ? Symbol$1.isConcatSpreadable : void 0;
  2072. function isFlattenable(value) {
  2073. return isArray(value) || isArguments(value) || !!(spreadableSymbol && value && value[spreadableSymbol]);
  2074. }
  2075. function baseFlatten(array, depth, predicate, isStrict, result) {
  2076. var index = -1, length = array.length;
  2077. predicate || (predicate = isFlattenable);
  2078. result || (result = []);
  2079. while (++index < length) {
  2080. var value = array[index];
  2081. if (depth > 0 && predicate(value)) {
  2082. if (depth > 1) {
  2083. baseFlatten(value, depth - 1, predicate, isStrict, result);
  2084. } else {
  2085. arrayPush(result, value);
  2086. }
  2087. } else if (!isStrict) {
  2088. result[result.length] = value;
  2089. }
  2090. }
  2091. return result;
  2092. }
  2093. function flatten(array) {
  2094. var length = array == null ? 0 : array.length;
  2095. return length ? baseFlatten(array, 1) : [];
  2096. }
  2097. function flatRest(func) {
  2098. return setToString(overRest(func, void 0, flatten), func + "");
  2099. }
  2100. var at$1 = flatRest(baseAt);
  2101. var getPrototype = overArg(Object.getPrototypeOf, Object);
  2102. var objectTag$3 = "[object Object]";
  2103. var funcProto = Function.prototype;
  2104. var objectProto$e = Object.prototype;
  2105. var funcToString = funcProto.toString;
  2106. var hasOwnProperty$c = objectProto$e.hasOwnProperty;
  2107. var objectCtorString = funcToString.call(Object);
  2108. function isPlainObject(value) {
  2109. if (!isObjectLike(value) || baseGetTag(value) != objectTag$3) {
  2110. return false;
  2111. }
  2112. var proto = getPrototype(value);
  2113. if (proto === null) {
  2114. return true;
  2115. }
  2116. var Ctor = hasOwnProperty$c.call(proto, "constructor") && proto.constructor;
  2117. return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString;
  2118. }
  2119. var domExcTag = "[object DOMException]";
  2120. var errorTag$2 = "[object Error]";
  2121. function isError(value) {
  2122. if (!isObjectLike(value)) {
  2123. return false;
  2124. }
  2125. var tag = baseGetTag(value);
  2126. return tag == errorTag$2 || tag == domExcTag || typeof value.message == "string" && typeof value.name == "string" && !isPlainObject(value);
  2127. }
  2128. var attempt = baseRest(function(func, args) {
  2129. try {
  2130. return apply(func, void 0, args);
  2131. } catch (e) {
  2132. return isError(e) ? e : new Error(e);
  2133. }
  2134. });
  2135. var FUNC_ERROR_TEXT$8 = "Expected a function";
  2136. function before(n, func) {
  2137. var result;
  2138. if (typeof func != "function") {
  2139. throw new TypeError(FUNC_ERROR_TEXT$8);
  2140. }
  2141. n = toInteger(n);
  2142. return function() {
  2143. if (--n > 0) {
  2144. result = func.apply(this, arguments);
  2145. }
  2146. if (n <= 1) {
  2147. func = void 0;
  2148. }
  2149. return result;
  2150. };
  2151. }
  2152. var WRAP_BIND_FLAG$1 = 1;
  2153. var WRAP_PARTIAL_FLAG$3 = 32;
  2154. var bind = baseRest(function(func, thisArg, partials) {
  2155. var bitmask = WRAP_BIND_FLAG$1;
  2156. if (partials.length) {
  2157. var holders = replaceHolders(partials, getHolder(bind));
  2158. bitmask |= WRAP_PARTIAL_FLAG$3;
  2159. }
  2160. return createWrap(func, bitmask, thisArg, partials, holders);
  2161. });
  2162. bind.placeholder = {};
  2163. var bindAll = flatRest(function(object, methodNames) {
  2164. arrayEach(methodNames, function(key) {
  2165. key = toKey(key);
  2166. baseAssignValue(object, key, bind(object[key], object));
  2167. });
  2168. return object;
  2169. });
  2170. var WRAP_BIND_FLAG = 1;
  2171. var WRAP_BIND_KEY_FLAG$1 = 2;
  2172. var WRAP_PARTIAL_FLAG$2 = 32;
  2173. var bindKey = baseRest(function(object, key, partials) {
  2174. var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG$1;
  2175. if (partials.length) {
  2176. var holders = replaceHolders(partials, getHolder(bindKey));
  2177. bitmask |= WRAP_PARTIAL_FLAG$2;
  2178. }
  2179. return createWrap(key, bitmask, object, partials, holders);
  2180. });
  2181. bindKey.placeholder = {};
  2182. function baseSlice(array, start, end) {
  2183. var index = -1, length = array.length;
  2184. if (start < 0) {
  2185. start = -start > length ? 0 : length + start;
  2186. }
  2187. end = end > length ? length : end;
  2188. if (end < 0) {
  2189. end += length;
  2190. }
  2191. length = start > end ? 0 : end - start >>> 0;
  2192. start >>>= 0;
  2193. var result = Array(length);
  2194. while (++index < length) {
  2195. result[index] = array[index + start];
  2196. }
  2197. return result;
  2198. }
  2199. function castSlice(array, start, end) {
  2200. var length = array.length;
  2201. end = end === void 0 ? length : end;
  2202. return !start && end >= length ? array : baseSlice(array, start, end);
  2203. }
  2204. var rsAstralRange$3 = "\\ud800-\\udfff";
  2205. var rsComboMarksRange$4 = "\\u0300-\\u036f";
  2206. var reComboHalfMarksRange$4 = "\\ufe20-\\ufe2f";
  2207. var rsComboSymbolsRange$4 = "\\u20d0-\\u20ff";
  2208. var rsComboRange$4 = rsComboMarksRange$4 + reComboHalfMarksRange$4 + rsComboSymbolsRange$4;
  2209. var rsVarRange$3 = "\\ufe0e\\ufe0f";
  2210. var rsZWJ$3 = "\\u200d";
  2211. var reHasUnicode = RegExp("[" + rsZWJ$3 + rsAstralRange$3 + rsComboRange$4 + rsVarRange$3 + "]");
  2212. function hasUnicode(string) {
  2213. return reHasUnicode.test(string);
  2214. }
  2215. function asciiToArray(string) {
  2216. return string.split("");
  2217. }
  2218. var rsAstralRange$2 = "\\ud800-\\udfff";
  2219. var rsComboMarksRange$3 = "\\u0300-\\u036f";
  2220. var reComboHalfMarksRange$3 = "\\ufe20-\\ufe2f";
  2221. var rsComboSymbolsRange$3 = "\\u20d0-\\u20ff";
  2222. var rsComboRange$3 = rsComboMarksRange$3 + reComboHalfMarksRange$3 + rsComboSymbolsRange$3;
  2223. var rsVarRange$2 = "\\ufe0e\\ufe0f";
  2224. var rsAstral$1 = "[" + rsAstralRange$2 + "]";
  2225. var rsCombo$3 = "[" + rsComboRange$3 + "]";
  2226. var rsFitz$2 = "\\ud83c[\\udffb-\\udfff]";
  2227. var rsModifier$2 = "(?:" + rsCombo$3 + "|" + rsFitz$2 + ")";
  2228. var rsNonAstral$2 = "[^" + rsAstralRange$2 + "]";
  2229. var rsRegional$2 = "(?:\\ud83c[\\udde6-\\uddff]){2}";
  2230. var rsSurrPair$2 = "[\\ud800-\\udbff][\\udc00-\\udfff]";
  2231. var rsZWJ$2 = "\\u200d";
  2232. var reOptMod$2 = rsModifier$2 + "?";
  2233. var rsOptVar$2 = "[" + rsVarRange$2 + "]?";
  2234. var rsOptJoin$2 = "(?:" + rsZWJ$2 + "(?:" + [rsNonAstral$2, rsRegional$2, rsSurrPair$2].join("|") + ")" + rsOptVar$2 + reOptMod$2 + ")*";
  2235. var rsSeq$2 = rsOptVar$2 + reOptMod$2 + rsOptJoin$2;
  2236. var rsSymbol$1 = "(?:" + [rsNonAstral$2 + rsCombo$3 + "?", rsCombo$3, rsRegional$2, rsSurrPair$2, rsAstral$1].join("|") + ")";
  2237. var reUnicode$1 = RegExp(rsFitz$2 + "(?=" + rsFitz$2 + ")|" + rsSymbol$1 + rsSeq$2, "g");
  2238. function unicodeToArray(string) {
  2239. return string.match(reUnicode$1) || [];
  2240. }
  2241. function stringToArray(string) {
  2242. return hasUnicode(string) ? unicodeToArray(string) : asciiToArray(string);
  2243. }
  2244. function createCaseFirst(methodName) {
  2245. return function(string) {
  2246. string = toString(string);
  2247. var strSymbols = hasUnicode(string) ? stringToArray(string) : void 0;
  2248. var chr = strSymbols ? strSymbols[0] : string.charAt(0);
  2249. var trailing = strSymbols ? castSlice(strSymbols, 1).join("") : string.slice(1);
  2250. return chr[methodName]() + trailing;
  2251. };
  2252. }
  2253. var upperFirst = createCaseFirst("toUpperCase");
  2254. function capitalize$1(string) {
  2255. return upperFirst(toString(string).toLowerCase());
  2256. }
  2257. function arrayReduce(array, iteratee, accumulator, initAccum) {
  2258. var index = -1, length = array == null ? 0 : array.length;
  2259. if (initAccum && length) {
  2260. accumulator = array[++index];
  2261. }
  2262. while (++index < length) {
  2263. accumulator = iteratee(accumulator, array[index], index, array);
  2264. }
  2265. return accumulator;
  2266. }
  2267. function basePropertyOf(object) {
  2268. return function(key) {
  2269. return object == null ? void 0 : object[key];
  2270. };
  2271. }
  2272. var deburredLetters = {
  2273. "\xC0": "A",
  2274. "\xC1": "A",
  2275. "\xC2": "A",
  2276. "\xC3": "A",
  2277. "\xC4": "A",
  2278. "\xC5": "A",
  2279. "\xE0": "a",
  2280. "\xE1": "a",
  2281. "\xE2": "a",
  2282. "\xE3": "a",
  2283. "\xE4": "a",
  2284. "\xE5": "a",
  2285. "\xC7": "C",
  2286. "\xE7": "c",
  2287. "\xD0": "D",
  2288. "\xF0": "d",
  2289. "\xC8": "E",
  2290. "\xC9": "E",
  2291. "\xCA": "E",
  2292. "\xCB": "E",
  2293. "\xE8": "e",
  2294. "\xE9": "e",
  2295. "\xEA": "e",
  2296. "\xEB": "e",
  2297. "\xCC": "I",
  2298. "\xCD": "I",
  2299. "\xCE": "I",
  2300. "\xCF": "I",
  2301. "\xEC": "i",
  2302. "\xED": "i",
  2303. "\xEE": "i",
  2304. "\xEF": "i",
  2305. "\xD1": "N",
  2306. "\xF1": "n",
  2307. "\xD2": "O",
  2308. "\xD3": "O",
  2309. "\xD4": "O",
  2310. "\xD5": "O",
  2311. "\xD6": "O",
  2312. "\xD8": "O",
  2313. "\xF2": "o",
  2314. "\xF3": "o",
  2315. "\xF4": "o",
  2316. "\xF5": "o",
  2317. "\xF6": "o",
  2318. "\xF8": "o",
  2319. "\xD9": "U",
  2320. "\xDA": "U",
  2321. "\xDB": "U",
  2322. "\xDC": "U",
  2323. "\xF9": "u",
  2324. "\xFA": "u",
  2325. "\xFB": "u",
  2326. "\xFC": "u",
  2327. "\xDD": "Y",
  2328. "\xFD": "y",
  2329. "\xFF": "y",
  2330. "\xC6": "Ae",
  2331. "\xE6": "ae",
  2332. "\xDE": "Th",
  2333. "\xFE": "th",
  2334. "\xDF": "ss",
  2335. "\u0100": "A",
  2336. "\u0102": "A",
  2337. "\u0104": "A",
  2338. "\u0101": "a",
  2339. "\u0103": "a",
  2340. "\u0105": "a",
  2341. "\u0106": "C",
  2342. "\u0108": "C",
  2343. "\u010A": "C",
  2344. "\u010C": "C",
  2345. "\u0107": "c",
  2346. "\u0109": "c",
  2347. "\u010B": "c",
  2348. "\u010D": "c",
  2349. "\u010E": "D",
  2350. "\u0110": "D",
  2351. "\u010F": "d",
  2352. "\u0111": "d",
  2353. "\u0112": "E",
  2354. "\u0114": "E",
  2355. "\u0116": "E",
  2356. "\u0118": "E",
  2357. "\u011A": "E",
  2358. "\u0113": "e",
  2359. "\u0115": "e",
  2360. "\u0117": "e",
  2361. "\u0119": "e",
  2362. "\u011B": "e",
  2363. "\u011C": "G",
  2364. "\u011E": "G",
  2365. "\u0120": "G",
  2366. "\u0122": "G",
  2367. "\u011D": "g",
  2368. "\u011F": "g",
  2369. "\u0121": "g",
  2370. "\u0123": "g",
  2371. "\u0124": "H",
  2372. "\u0126": "H",
  2373. "\u0125": "h",
  2374. "\u0127": "h",
  2375. "\u0128": "I",
  2376. "\u012A": "I",
  2377. "\u012C": "I",
  2378. "\u012E": "I",
  2379. "\u0130": "I",
  2380. "\u0129": "i",
  2381. "\u012B": "i",
  2382. "\u012D": "i",
  2383. "\u012F": "i",
  2384. "\u0131": "i",
  2385. "\u0134": "J",
  2386. "\u0135": "j",
  2387. "\u0136": "K",
  2388. "\u0137": "k",
  2389. "\u0138": "k",
  2390. "\u0139": "L",
  2391. "\u013B": "L",
  2392. "\u013D": "L",
  2393. "\u013F": "L",
  2394. "\u0141": "L",
  2395. "\u013A": "l",
  2396. "\u013C": "l",
  2397. "\u013E": "l",
  2398. "\u0140": "l",
  2399. "\u0142": "l",
  2400. "\u0143": "N",
  2401. "\u0145": "N",
  2402. "\u0147": "N",
  2403. "\u014A": "N",
  2404. "\u0144": "n",
  2405. "\u0146": "n",
  2406. "\u0148": "n",
  2407. "\u014B": "n",
  2408. "\u014C": "O",
  2409. "\u014E": "O",
  2410. "\u0150": "O",
  2411. "\u014D": "o",
  2412. "\u014F": "o",
  2413. "\u0151": "o",
  2414. "\u0154": "R",
  2415. "\u0156": "R",
  2416. "\u0158": "R",
  2417. "\u0155": "r",
  2418. "\u0157": "r",
  2419. "\u0159": "r",
  2420. "\u015A": "S",
  2421. "\u015C": "S",
  2422. "\u015E": "S",
  2423. "\u0160": "S",
  2424. "\u015B": "s",
  2425. "\u015D": "s",
  2426. "\u015F": "s",
  2427. "\u0161": "s",
  2428. "\u0162": "T",
  2429. "\u0164": "T",
  2430. "\u0166": "T",
  2431. "\u0163": "t",
  2432. "\u0165": "t",
  2433. "\u0167": "t",
  2434. "\u0168": "U",
  2435. "\u016A": "U",
  2436. "\u016C": "U",
  2437. "\u016E": "U",
  2438. "\u0170": "U",
  2439. "\u0172": "U",
  2440. "\u0169": "u",
  2441. "\u016B": "u",
  2442. "\u016D": "u",
  2443. "\u016F": "u",
  2444. "\u0171": "u",
  2445. "\u0173": "u",
  2446. "\u0174": "W",
  2447. "\u0175": "w",
  2448. "\u0176": "Y",
  2449. "\u0177": "y",
  2450. "\u0178": "Y",
  2451. "\u0179": "Z",
  2452. "\u017B": "Z",
  2453. "\u017D": "Z",
  2454. "\u017A": "z",
  2455. "\u017C": "z",
  2456. "\u017E": "z",
  2457. "\u0132": "IJ",
  2458. "\u0133": "ij",
  2459. "\u0152": "Oe",
  2460. "\u0153": "oe",
  2461. "\u0149": "'n",
  2462. "\u017F": "s"
  2463. };
  2464. var deburrLetter = basePropertyOf(deburredLetters);
  2465. var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
  2466. var rsComboMarksRange$2 = "\\u0300-\\u036f";
  2467. var reComboHalfMarksRange$2 = "\\ufe20-\\ufe2f";
  2468. var rsComboSymbolsRange$2 = "\\u20d0-\\u20ff";
  2469. var rsComboRange$2 = rsComboMarksRange$2 + reComboHalfMarksRange$2 + rsComboSymbolsRange$2;
  2470. var rsCombo$2 = "[" + rsComboRange$2 + "]";
  2471. var reComboMark = RegExp(rsCombo$2, "g");
  2472. function deburr(string) {
  2473. string = toString(string);
  2474. return string && string.replace(reLatin, deburrLetter).replace(reComboMark, "");
  2475. }
  2476. var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
  2477. function asciiWords(string) {
  2478. return string.match(reAsciiWord) || [];
  2479. }
  2480. 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 ]/;
  2481. function hasUnicodeWord(string) {
  2482. return reHasUnicodeWord.test(string);
  2483. }
  2484. var rsAstralRange$1 = "\\ud800-\\udfff";
  2485. var rsComboMarksRange$1 = "\\u0300-\\u036f";
  2486. var reComboHalfMarksRange$1 = "\\ufe20-\\ufe2f";
  2487. var rsComboSymbolsRange$1 = "\\u20d0-\\u20ff";
  2488. var rsComboRange$1 = rsComboMarksRange$1 + reComboHalfMarksRange$1 + rsComboSymbolsRange$1;
  2489. var rsDingbatRange = "\\u2700-\\u27bf";
  2490. var rsLowerRange = "a-z\\xdf-\\xf6\\xf8-\\xff";
  2491. var rsMathOpRange = "\\xac\\xb1\\xd7\\xf7";
  2492. var rsNonCharRange = "\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf";
  2493. var rsPunctuationRange = "\\u2000-\\u206f";
  2494. 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";
  2495. var rsUpperRange = "A-Z\\xc0-\\xd6\\xd8-\\xde";
  2496. var rsVarRange$1 = "\\ufe0e\\ufe0f";
  2497. var rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
  2498. var rsApos$1 = "['\u2019]";
  2499. var rsBreak = "[" + rsBreakRange + "]";
  2500. var rsCombo$1 = "[" + rsComboRange$1 + "]";
  2501. var rsDigits = "\\d+";
  2502. var rsDingbat = "[" + rsDingbatRange + "]";
  2503. var rsLower = "[" + rsLowerRange + "]";
  2504. var rsMisc = "[^" + rsAstralRange$1 + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + "]";
  2505. var rsFitz$1 = "\\ud83c[\\udffb-\\udfff]";
  2506. var rsModifier$1 = "(?:" + rsCombo$1 + "|" + rsFitz$1 + ")";
  2507. var rsNonAstral$1 = "[^" + rsAstralRange$1 + "]";
  2508. var rsRegional$1 = "(?:\\ud83c[\\udde6-\\uddff]){2}";
  2509. var rsSurrPair$1 = "[\\ud800-\\udbff][\\udc00-\\udfff]";
  2510. var rsUpper = "[" + rsUpperRange + "]";
  2511. var rsZWJ$1 = "\\u200d";
  2512. var rsMiscLower = "(?:" + rsLower + "|" + rsMisc + ")";
  2513. var rsMiscUpper = "(?:" + rsUpper + "|" + rsMisc + ")";
  2514. var rsOptContrLower = "(?:" + rsApos$1 + "(?:d|ll|m|re|s|t|ve))?";
  2515. var rsOptContrUpper = "(?:" + rsApos$1 + "(?:D|LL|M|RE|S|T|VE))?";
  2516. var reOptMod$1 = rsModifier$1 + "?";
  2517. var rsOptVar$1 = "[" + rsVarRange$1 + "]?";
  2518. var rsOptJoin$1 = "(?:" + rsZWJ$1 + "(?:" + [rsNonAstral$1, rsRegional$1, rsSurrPair$1].join("|") + ")" + rsOptVar$1 + reOptMod$1 + ")*";
  2519. var rsOrdLower = "\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])";
  2520. var rsOrdUpper = "\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])";
  2521. var rsSeq$1 = rsOptVar$1 + reOptMod$1 + rsOptJoin$1;
  2522. var rsEmoji = "(?:" + [rsDingbat, rsRegional$1, rsSurrPair$1].join("|") + ")" + rsSeq$1;
  2523. var reUnicodeWord = RegExp([
  2524. rsUpper + "?" + rsLower + "+" + rsOptContrLower + "(?=" + [rsBreak, rsUpper, "$"].join("|") + ")",
  2525. rsMiscUpper + "+" + rsOptContrUpper + "(?=" + [rsBreak, rsUpper + rsMiscLower, "$"].join("|") + ")",
  2526. rsUpper + "?" + rsMiscLower + "+" + rsOptContrLower,
  2527. rsUpper + "+" + rsOptContrUpper,
  2528. rsOrdUpper,
  2529. rsOrdLower,
  2530. rsDigits,
  2531. rsEmoji
  2532. ].join("|"), "g");
  2533. function unicodeWords(string) {
  2534. return string.match(reUnicodeWord) || [];
  2535. }
  2536. function words(string, pattern, guard) {
  2537. string = toString(string);
  2538. pattern = guard ? void 0 : pattern;
  2539. if (pattern === void 0) {
  2540. return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
  2541. }
  2542. return string.match(pattern) || [];
  2543. }
  2544. var rsApos = "['\u2019]";
  2545. var reApos = RegExp(rsApos, "g");
  2546. function createCompounder(callback) {
  2547. return function(string) {
  2548. return arrayReduce(words(deburr(string).replace(reApos, "")), callback, "");
  2549. };
  2550. }
  2551. var camelCase = createCompounder(function(result, word, index) {
  2552. word = word.toLowerCase();
  2553. return result + (index ? capitalize$1(word) : word);
  2554. });
  2555. function castArray$1() {
  2556. if (!arguments.length) {
  2557. return [];
  2558. }
  2559. var value = arguments[0];
  2560. return isArray(value) ? value : [value];
  2561. }
  2562. var nativeIsFinite$1 = root.isFinite;
  2563. var nativeMin$c = Math.min;
  2564. function createRound(methodName) {
  2565. var func = Math[methodName];
  2566. return function(number, precision) {
  2567. number = toNumber(number);
  2568. precision = precision == null ? 0 : nativeMin$c(toInteger(precision), 292);
  2569. if (precision && nativeIsFinite$1(number)) {
  2570. var pair = (toString(number) + "e").split("e"), value = func(pair[0] + "e" + (+pair[1] + precision));
  2571. pair = (toString(value) + "e").split("e");
  2572. return +(pair[0] + "e" + (+pair[1] - precision));
  2573. }
  2574. return func(number);
  2575. };
  2576. }
  2577. var ceil = createRound("ceil");
  2578. function chain(value) {
  2579. var result = lodash(value);
  2580. result.__chain__ = true;
  2581. return result;
  2582. }
  2583. var nativeCeil$3 = Math.ceil;
  2584. var nativeMax$c = Math.max;
  2585. function chunk(array, size, guard) {
  2586. if (guard ? isIterateeCall(array, size, guard) : size === void 0) {
  2587. size = 1;
  2588. } else {
  2589. size = nativeMax$c(toInteger(size), 0);
  2590. }
  2591. var length = array == null ? 0 : array.length;
  2592. if (!length || size < 1) {
  2593. return [];
  2594. }
  2595. var index = 0, resIndex = 0, result = Array(nativeCeil$3(length / size));
  2596. while (index < length) {
  2597. result[resIndex++] = baseSlice(array, index, index += size);
  2598. }
  2599. return result;
  2600. }
  2601. function baseClamp(number, lower, upper) {
  2602. if (number === number) {
  2603. if (upper !== void 0) {
  2604. number = number <= upper ? number : upper;
  2605. }
  2606. if (lower !== void 0) {
  2607. number = number >= lower ? number : lower;
  2608. }
  2609. }
  2610. return number;
  2611. }
  2612. function clamp(number, lower, upper) {
  2613. if (upper === void 0) {
  2614. upper = lower;
  2615. lower = void 0;
  2616. }
  2617. if (upper !== void 0) {
  2618. upper = toNumber(upper);
  2619. upper = upper === upper ? upper : 0;
  2620. }
  2621. if (lower !== void 0) {
  2622. lower = toNumber(lower);
  2623. lower = lower === lower ? lower : 0;
  2624. }
  2625. return baseClamp(toNumber(number), lower, upper);
  2626. }
  2627. function stackClear() {
  2628. this.__data__ = new ListCache();
  2629. this.size = 0;
  2630. }
  2631. function stackDelete(key) {
  2632. var data = this.__data__, result = data["delete"](key);
  2633. this.size = data.size;
  2634. return result;
  2635. }
  2636. function stackGet(key) {
  2637. return this.__data__.get(key);
  2638. }
  2639. function stackHas(key) {
  2640. return this.__data__.has(key);
  2641. }
  2642. var LARGE_ARRAY_SIZE$2 = 200;
  2643. function stackSet(key, value) {
  2644. var data = this.__data__;
  2645. if (data instanceof ListCache) {
  2646. var pairs = data.__data__;
  2647. if (!Map$1 || pairs.length < LARGE_ARRAY_SIZE$2 - 1) {
  2648. pairs.push([key, value]);
  2649. this.size = ++data.size;
  2650. return this;
  2651. }
  2652. data = this.__data__ = new MapCache(pairs);
  2653. }
  2654. data.set(key, value);
  2655. this.size = data.size;
  2656. return this;
  2657. }
  2658. function Stack(entries) {
  2659. var data = this.__data__ = new ListCache(entries);
  2660. this.size = data.size;
  2661. }
  2662. Stack.prototype.clear = stackClear;
  2663. Stack.prototype["delete"] = stackDelete;
  2664. Stack.prototype.get = stackGet;
  2665. Stack.prototype.has = stackHas;
  2666. Stack.prototype.set = stackSet;
  2667. function baseAssign(object, source) {
  2668. return object && copyObject(source, keys(source), object);
  2669. }
  2670. function baseAssignIn(object, source) {
  2671. return object && copyObject(source, keysIn(source), object);
  2672. }
  2673. var freeExports = typeof exports == "object" && exports && !exports.nodeType && exports;
  2674. var freeModule = freeExports && typeof module == "object" && module && !module.nodeType && module;
  2675. var moduleExports = freeModule && freeModule.exports === freeExports;
  2676. var Buffer = moduleExports ? root.Buffer : void 0;
  2677. var allocUnsafe = Buffer ? Buffer.allocUnsafe : void 0;
  2678. function cloneBuffer(buffer, isDeep) {
  2679. if (isDeep) {
  2680. return buffer.slice();
  2681. }
  2682. var length = buffer.length, result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
  2683. buffer.copy(result);
  2684. return result;
  2685. }
  2686. function arrayFilter(array, predicate) {
  2687. var index = -1, length = array == null ? 0 : array.length, resIndex = 0, result = [];
  2688. while (++index < length) {
  2689. var value = array[index];
  2690. if (predicate(value, index, array)) {
  2691. result[resIndex++] = value;
  2692. }
  2693. }
  2694. return result;
  2695. }
  2696. function stubArray() {
  2697. return [];
  2698. }
  2699. var objectProto$d = Object.prototype;
  2700. var propertyIsEnumerable = objectProto$d.propertyIsEnumerable;
  2701. var nativeGetSymbols$1 = Object.getOwnPropertySymbols;
  2702. var getSymbols = !nativeGetSymbols$1 ? stubArray : function(object) {
  2703. if (object == null) {
  2704. return [];
  2705. }
  2706. object = Object(object);
  2707. return arrayFilter(nativeGetSymbols$1(object), function(symbol) {
  2708. return propertyIsEnumerable.call(object, symbol);
  2709. });
  2710. };
  2711. function copySymbols(source, object) {
  2712. return copyObject(source, getSymbols(source), object);
  2713. }
  2714. var nativeGetSymbols = Object.getOwnPropertySymbols;
  2715. var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
  2716. var result = [];
  2717. while (object) {
  2718. arrayPush(result, getSymbols(object));
  2719. object = getPrototype(object);
  2720. }
  2721. return result;
  2722. };
  2723. function copySymbolsIn(source, object) {
  2724. return copyObject(source, getSymbolsIn(source), object);
  2725. }
  2726. function baseGetAllKeys(object, keysFunc, symbolsFunc) {
  2727. var result = keysFunc(object);
  2728. return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
  2729. }
  2730. function getAllKeys(object) {
  2731. return baseGetAllKeys(object, keys, getSymbols);
  2732. }
  2733. function getAllKeysIn(object) {
  2734. return baseGetAllKeys(object, keysIn, getSymbolsIn);
  2735. }
  2736. var DataView = getNative(root, "DataView");
  2737. var Promise$1 = getNative(root, "Promise");
  2738. var Set$1 = getNative(root, "Set");
  2739. var mapTag$8 = "[object Map]";
  2740. var objectTag$2 = "[object Object]";
  2741. var promiseTag = "[object Promise]";
  2742. var setTag$8 = "[object Set]";
  2743. var weakMapTag$2 = "[object WeakMap]";
  2744. var dataViewTag$3 = "[object DataView]";
  2745. var dataViewCtorString = toSource(DataView);
  2746. var mapCtorString = toSource(Map$1);
  2747. var promiseCtorString = toSource(Promise$1);
  2748. var setCtorString = toSource(Set$1);
  2749. var weakMapCtorString = toSource(WeakMap);
  2750. var getTag = baseGetTag;
  2751. if (DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag$3 || Map$1 && getTag(new Map$1()) != mapTag$8 || Promise$1 && getTag(Promise$1.resolve()) != promiseTag || Set$1 && getTag(new Set$1()) != setTag$8 || WeakMap && getTag(new WeakMap()) != weakMapTag$2) {
  2752. getTag = function(value) {
  2753. var result = baseGetTag(value), Ctor = result == objectTag$2 ? value.constructor : void 0, ctorString = Ctor ? toSource(Ctor) : "";
  2754. if (ctorString) {
  2755. switch (ctorString) {
  2756. case dataViewCtorString:
  2757. return dataViewTag$3;
  2758. case mapCtorString:
  2759. return mapTag$8;
  2760. case promiseCtorString:
  2761. return promiseTag;
  2762. case setCtorString:
  2763. return setTag$8;
  2764. case weakMapCtorString:
  2765. return weakMapTag$2;
  2766. }
  2767. }
  2768. return result;
  2769. };
  2770. }
  2771. var getTag$1 = getTag;
  2772. var objectProto$c = Object.prototype;
  2773. var hasOwnProperty$b = objectProto$c.hasOwnProperty;
  2774. function initCloneArray(array) {
  2775. var length = array.length, result = new array.constructor(length);
  2776. if (length && typeof array[0] == "string" && hasOwnProperty$b.call(array, "index")) {
  2777. result.index = array.index;
  2778. result.input = array.input;
  2779. }
  2780. return result;
  2781. }
  2782. var Uint8Array = root.Uint8Array;
  2783. function cloneArrayBuffer(arrayBuffer) {
  2784. var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  2785. new Uint8Array(result).set(new Uint8Array(arrayBuffer));
  2786. return result;
  2787. }
  2788. function cloneDataView(dataView, isDeep) {
  2789. var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
  2790. return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
  2791. }
  2792. var reFlags$1 = /\w*$/;
  2793. function cloneRegExp(regexp) {
  2794. var result = new regexp.constructor(regexp.source, reFlags$1.exec(regexp));
  2795. result.lastIndex = regexp.lastIndex;
  2796. return result;
  2797. }
  2798. var symbolProto$1 = Symbol$1 ? Symbol$1.prototype : void 0;
  2799. var symbolValueOf$1 = symbolProto$1 ? symbolProto$1.valueOf : void 0;
  2800. function cloneSymbol(symbol) {
  2801. return symbolValueOf$1 ? Object(symbolValueOf$1.call(symbol)) : {};
  2802. }
  2803. function cloneTypedArray(typedArray, isDeep) {
  2804. var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
  2805. return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
  2806. }
  2807. var boolTag$3 = "[object Boolean]";
  2808. var dateTag$3 = "[object Date]";
  2809. var mapTag$7 = "[object Map]";
  2810. var numberTag$3 = "[object Number]";
  2811. var regexpTag$3 = "[object RegExp]";
  2812. var setTag$7 = "[object Set]";
  2813. var stringTag$3 = "[object String]";
  2814. var symbolTag$2 = "[object Symbol]";
  2815. var arrayBufferTag$3 = "[object ArrayBuffer]";
  2816. var dataViewTag$2 = "[object DataView]";
  2817. var float32Tag$1 = "[object Float32Array]";
  2818. var float64Tag$1 = "[object Float64Array]";
  2819. var int8Tag$1 = "[object Int8Array]";
  2820. var int16Tag$1 = "[object Int16Array]";
  2821. var int32Tag$1 = "[object Int32Array]";
  2822. var uint8Tag$1 = "[object Uint8Array]";
  2823. var uint8ClampedTag$1 = "[object Uint8ClampedArray]";
  2824. var uint16Tag$1 = "[object Uint16Array]";
  2825. var uint32Tag$1 = "[object Uint32Array]";
  2826. function initCloneByTag(object, tag, isDeep) {
  2827. var Ctor = object.constructor;
  2828. switch (tag) {
  2829. case arrayBufferTag$3:
  2830. return cloneArrayBuffer(object);
  2831. case boolTag$3:
  2832. case dateTag$3:
  2833. return new Ctor(+object);
  2834. case dataViewTag$2:
  2835. return cloneDataView(object, isDeep);
  2836. case float32Tag$1:
  2837. case float64Tag$1:
  2838. case int8Tag$1:
  2839. case int16Tag$1:
  2840. case int32Tag$1:
  2841. case uint8Tag$1:
  2842. case uint8ClampedTag$1:
  2843. case uint16Tag$1:
  2844. case uint32Tag$1:
  2845. return cloneTypedArray(object, isDeep);
  2846. case mapTag$7:
  2847. return new Ctor();
  2848. case numberTag$3:
  2849. case stringTag$3:
  2850. return new Ctor(object);
  2851. case regexpTag$3:
  2852. return cloneRegExp(object);
  2853. case setTag$7:
  2854. return new Ctor();
  2855. case symbolTag$2:
  2856. return cloneSymbol(object);
  2857. }
  2858. }
  2859. function initCloneObject(object) {
  2860. return typeof object.constructor == "function" && !isPrototype(object) ? baseCreate(getPrototype(object)) : {};
  2861. }
  2862. var mapTag$6 = "[object Map]";
  2863. function baseIsMap(value) {
  2864. return isObjectLike(value) && getTag$1(value) == mapTag$6;
  2865. }
  2866. var nodeIsMap = nodeUtil && nodeUtil.isMap;
  2867. var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
  2868. var setTag$6 = "[object Set]";
  2869. function baseIsSet(value) {
  2870. return isObjectLike(value) && getTag$1(value) == setTag$6;
  2871. }
  2872. var nodeIsSet = nodeUtil && nodeUtil.isSet;
  2873. var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
  2874. var CLONE_DEEP_FLAG$7 = 1;
  2875. var CLONE_FLAT_FLAG$1 = 2;
  2876. var CLONE_SYMBOLS_FLAG$5 = 4;
  2877. var argsTag$1 = "[object Arguments]";
  2878. var arrayTag$1 = "[object Array]";
  2879. var boolTag$2 = "[object Boolean]";
  2880. var dateTag$2 = "[object Date]";
  2881. var errorTag$1 = "[object Error]";
  2882. var funcTag = "[object Function]";
  2883. var genTag = "[object GeneratorFunction]";
  2884. var mapTag$5 = "[object Map]";
  2885. var numberTag$2 = "[object Number]";
  2886. var objectTag$1 = "[object Object]";
  2887. var regexpTag$2 = "[object RegExp]";
  2888. var setTag$5 = "[object Set]";
  2889. var stringTag$2 = "[object String]";
  2890. var symbolTag$1 = "[object Symbol]";
  2891. var weakMapTag$1 = "[object WeakMap]";
  2892. var arrayBufferTag$2 = "[object ArrayBuffer]";
  2893. var dataViewTag$1 = "[object DataView]";
  2894. var float32Tag = "[object Float32Array]";
  2895. var float64Tag = "[object Float64Array]";
  2896. var int8Tag = "[object Int8Array]";
  2897. var int16Tag = "[object Int16Array]";
  2898. var int32Tag = "[object Int32Array]";
  2899. var uint8Tag = "[object Uint8Array]";
  2900. var uint8ClampedTag = "[object Uint8ClampedArray]";
  2901. var uint16Tag = "[object Uint16Array]";
  2902. var uint32Tag = "[object Uint32Array]";
  2903. var cloneableTags = {};
  2904. 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;
  2905. cloneableTags[errorTag$1] = cloneableTags[funcTag] = cloneableTags[weakMapTag$1] = false;
  2906. function baseClone(value, bitmask, customizer, key, object, stack) {
  2907. var result, isDeep = bitmask & CLONE_DEEP_FLAG$7, isFlat = bitmask & CLONE_FLAT_FLAG$1, isFull = bitmask & CLONE_SYMBOLS_FLAG$5;
  2908. if (customizer) {
  2909. result = object ? customizer(value, key, object, stack) : customizer(value);
  2910. }
  2911. if (result !== void 0) {
  2912. return result;
  2913. }
  2914. if (!isObject(value)) {
  2915. return value;
  2916. }
  2917. var isArr = isArray(value);
  2918. if (isArr) {
  2919. result = initCloneArray(value);
  2920. if (!isDeep) {
  2921. return copyArray(value, result);
  2922. }
  2923. } else {
  2924. var tag = getTag$1(value), isFunc = tag == funcTag || tag == genTag;
  2925. if (isBuffer(value)) {
  2926. return cloneBuffer(value, isDeep);
  2927. }
  2928. if (tag == objectTag$1 || tag == argsTag$1 || isFunc && !object) {
  2929. result = isFlat || isFunc ? {} : initCloneObject(value);
  2930. if (!isDeep) {
  2931. return isFlat ? copySymbolsIn(value, baseAssignIn(result, value)) : copySymbols(value, baseAssign(result, value));
  2932. }
  2933. } else {
  2934. if (!cloneableTags[tag]) {
  2935. return object ? value : {};
  2936. }
  2937. result = initCloneByTag(value, tag, isDeep);
  2938. }
  2939. }
  2940. stack || (stack = new Stack());
  2941. var stacked = stack.get(value);
  2942. if (stacked) {
  2943. return stacked;
  2944. }
  2945. stack.set(value, result);
  2946. if (isSet(value)) {
  2947. value.forEach(function(subValue) {
  2948. result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
  2949. });
  2950. } else if (isMap(value)) {
  2951. value.forEach(function(subValue, key2) {
  2952. result.set(key2, baseClone(subValue, bitmask, customizer, key2, value, stack));
  2953. });
  2954. }
  2955. var keysFunc = isFull ? isFlat ? getAllKeysIn : getAllKeys : isFlat ? keysIn : keys;
  2956. var props = isArr ? void 0 : keysFunc(value);
  2957. arrayEach(props || value, function(subValue, key2) {
  2958. if (props) {
  2959. key2 = subValue;
  2960. subValue = value[key2];
  2961. }
  2962. assignValue(result, key2, baseClone(subValue, bitmask, customizer, key2, value, stack));
  2963. });
  2964. return result;
  2965. }
  2966. var CLONE_SYMBOLS_FLAG$4 = 4;
  2967. function clone(value) {
  2968. return baseClone(value, CLONE_SYMBOLS_FLAG$4);
  2969. }
  2970. var CLONE_DEEP_FLAG$6 = 1;
  2971. var CLONE_SYMBOLS_FLAG$3 = 4;
  2972. function cloneDeep(value) {
  2973. return baseClone(value, CLONE_DEEP_FLAG$6 | CLONE_SYMBOLS_FLAG$3);
  2974. }
  2975. var CLONE_DEEP_FLAG$5 = 1;
  2976. var CLONE_SYMBOLS_FLAG$2 = 4;
  2977. function cloneDeepWith(value, customizer) {
  2978. customizer = typeof customizer == "function" ? customizer : void 0;
  2979. return baseClone(value, CLONE_DEEP_FLAG$5 | CLONE_SYMBOLS_FLAG$2, customizer);
  2980. }
  2981. var CLONE_SYMBOLS_FLAG$1 = 4;
  2982. function cloneWith(value, customizer) {
  2983. customizer = typeof customizer == "function" ? customizer : void 0;
  2984. return baseClone(value, CLONE_SYMBOLS_FLAG$1, customizer);
  2985. }
  2986. function wrapperCommit() {
  2987. return new LodashWrapper(this.value(), this.__chain__);
  2988. }
  2989. function compact(array) {
  2990. var index = -1, length = array == null ? 0 : array.length, resIndex = 0, result = [];
  2991. while (++index < length) {
  2992. var value = array[index];
  2993. if (value) {
  2994. result[resIndex++] = value;
  2995. }
  2996. }
  2997. return result;
  2998. }
  2999. function concat() {
  3000. var length = arguments.length;
  3001. if (!length) {
  3002. return [];
  3003. }
  3004. var args = Array(length - 1), array = arguments[0], index = length;
  3005. while (index--) {
  3006. args[index - 1] = arguments[index];
  3007. }
  3008. return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1));
  3009. }
  3010. var HASH_UNDEFINED = "__lodash_hash_undefined__";
  3011. function setCacheAdd(value) {
  3012. this.__data__.set(value, HASH_UNDEFINED);
  3013. return this;
  3014. }
  3015. function setCacheHas(value) {
  3016. return this.__data__.has(value);
  3017. }
  3018. function SetCache(values) {
  3019. var index = -1, length = values == null ? 0 : values.length;
  3020. this.__data__ = new MapCache();
  3021. while (++index < length) {
  3022. this.add(values[index]);
  3023. }
  3024. }
  3025. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  3026. SetCache.prototype.has = setCacheHas;
  3027. function arraySome(array, predicate) {
  3028. var index = -1, length = array == null ? 0 : array.length;
  3029. while (++index < length) {
  3030. if (predicate(array[index], index, array)) {
  3031. return true;
  3032. }
  3033. }
  3034. return false;
  3035. }
  3036. function cacheHas(cache, key) {
  3037. return cache.has(key);
  3038. }
  3039. var COMPARE_PARTIAL_FLAG$5 = 1;
  3040. var COMPARE_UNORDERED_FLAG$3 = 2;
  3041. function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
  3042. var isPartial = bitmask & COMPARE_PARTIAL_FLAG$5, arrLength = array.length, othLength = other.length;
  3043. if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
  3044. return false;
  3045. }
  3046. var arrStacked = stack.get(array);
  3047. var othStacked = stack.get(other);
  3048. if (arrStacked && othStacked) {
  3049. return arrStacked == other && othStacked == array;
  3050. }
  3051. var index = -1, result = true, seen = bitmask & COMPARE_UNORDERED_FLAG$3 ? new SetCache() : void 0;
  3052. stack.set(array, other);
  3053. stack.set(other, array);
  3054. while (++index < arrLength) {
  3055. var arrValue = array[index], othValue = other[index];
  3056. if (customizer) {
  3057. var compared = isPartial ? customizer(othValue, arrValue, index, other, array, stack) : customizer(arrValue, othValue, index, array, other, stack);
  3058. }
  3059. if (compared !== void 0) {
  3060. if (compared) {
  3061. continue;
  3062. }
  3063. result = false;
  3064. break;
  3065. }
  3066. if (seen) {
  3067. if (!arraySome(other, function(othValue2, othIndex) {
  3068. if (!cacheHas(seen, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) {
  3069. return seen.push(othIndex);
  3070. }
  3071. })) {
  3072. result = false;
  3073. break;
  3074. }
  3075. } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
  3076. result = false;
  3077. break;
  3078. }
  3079. }
  3080. stack["delete"](array);
  3081. stack["delete"](other);
  3082. return result;
  3083. }
  3084. function mapToArray(map) {
  3085. var index = -1, result = Array(map.size);
  3086. map.forEach(function(value, key) {
  3087. result[++index] = [key, value];
  3088. });
  3089. return result;
  3090. }
  3091. function setToArray(set) {
  3092. var index = -1, result = Array(set.size);
  3093. set.forEach(function(value) {
  3094. result[++index] = value;
  3095. });
  3096. return result;
  3097. }
  3098. var COMPARE_PARTIAL_FLAG$4 = 1;
  3099. var COMPARE_UNORDERED_FLAG$2 = 2;
  3100. var boolTag$1 = "[object Boolean]";
  3101. var dateTag$1 = "[object Date]";
  3102. var errorTag = "[object Error]";
  3103. var mapTag$4 = "[object Map]";
  3104. var numberTag$1 = "[object Number]";
  3105. var regexpTag$1 = "[object RegExp]";
  3106. var setTag$4 = "[object Set]";
  3107. var stringTag$1 = "[object String]";
  3108. var symbolTag = "[object Symbol]";
  3109. var arrayBufferTag$1 = "[object ArrayBuffer]";
  3110. var dataViewTag = "[object DataView]";
  3111. var symbolProto = Symbol$1 ? Symbol$1.prototype : void 0;
  3112. var symbolValueOf = symbolProto ? symbolProto.valueOf : void 0;
  3113. function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
  3114. switch (tag) {
  3115. case dataViewTag:
  3116. if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) {
  3117. return false;
  3118. }
  3119. object = object.buffer;
  3120. other = other.buffer;
  3121. case arrayBufferTag$1:
  3122. if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
  3123. return false;
  3124. }
  3125. return true;
  3126. case boolTag$1:
  3127. case dateTag$1:
  3128. case numberTag$1:
  3129. return eq(+object, +other);
  3130. case errorTag:
  3131. return object.name == other.name && object.message == other.message;
  3132. case regexpTag$1:
  3133. case stringTag$1:
  3134. return object == other + "";
  3135. case mapTag$4:
  3136. var convert = mapToArray;
  3137. case setTag$4:
  3138. var isPartial = bitmask & COMPARE_PARTIAL_FLAG$4;
  3139. convert || (convert = setToArray);
  3140. if (object.size != other.size && !isPartial) {
  3141. return false;
  3142. }
  3143. var stacked = stack.get(object);
  3144. if (stacked) {
  3145. return stacked == other;
  3146. }
  3147. bitmask |= COMPARE_UNORDERED_FLAG$2;
  3148. stack.set(object, other);
  3149. var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
  3150. stack["delete"](object);
  3151. return result;
  3152. case symbolTag:
  3153. if (symbolValueOf) {
  3154. return symbolValueOf.call(object) == symbolValueOf.call(other);
  3155. }
  3156. }
  3157. return false;
  3158. }
  3159. var COMPARE_PARTIAL_FLAG$3 = 1;
  3160. var objectProto$b = Object.prototype;
  3161. var hasOwnProperty$a = objectProto$b.hasOwnProperty;
  3162. function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
  3163. var isPartial = bitmask & COMPARE_PARTIAL_FLAG$3, objProps = getAllKeys(object), objLength = objProps.length, othProps = getAllKeys(other), othLength = othProps.length;
  3164. if (objLength != othLength && !isPartial) {
  3165. return false;
  3166. }
  3167. var index = objLength;
  3168. while (index--) {
  3169. var key = objProps[index];
  3170. if (!(isPartial ? key in other : hasOwnProperty$a.call(other, key))) {
  3171. return false;
  3172. }
  3173. }
  3174. var objStacked = stack.get(object);
  3175. var othStacked = stack.get(other);
  3176. if (objStacked && othStacked) {
  3177. return objStacked == other && othStacked == object;
  3178. }
  3179. var result = true;
  3180. stack.set(object, other);
  3181. stack.set(other, object);
  3182. var skipCtor = isPartial;
  3183. while (++index < objLength) {
  3184. key = objProps[index];
  3185. var objValue = object[key], othValue = other[key];
  3186. if (customizer) {
  3187. var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack);
  3188. }
  3189. if (!(compared === void 0 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
  3190. result = false;
  3191. break;
  3192. }
  3193. skipCtor || (skipCtor = key == "constructor");
  3194. }
  3195. if (result && !skipCtor) {
  3196. var objCtor = object.constructor, othCtor = other.constructor;
  3197. if (objCtor != othCtor && ("constructor" in object && "constructor" in other) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) {
  3198. result = false;
  3199. }
  3200. }
  3201. stack["delete"](object);
  3202. stack["delete"](other);
  3203. return result;
  3204. }
  3205. var COMPARE_PARTIAL_FLAG$2 = 1;
  3206. var argsTag = "[object Arguments]";
  3207. var arrayTag = "[object Array]";
  3208. var objectTag = "[object Object]";
  3209. var objectProto$a = Object.prototype;
  3210. var hasOwnProperty$9 = objectProto$a.hasOwnProperty;
  3211. function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
  3212. var objIsArr = isArray(object), othIsArr = isArray(other), objTag = objIsArr ? arrayTag : getTag$1(object), othTag = othIsArr ? arrayTag : getTag$1(other);
  3213. objTag = objTag == argsTag ? objectTag : objTag;
  3214. othTag = othTag == argsTag ? objectTag : othTag;
  3215. var objIsObj = objTag == objectTag, othIsObj = othTag == objectTag, isSameTag = objTag == othTag;
  3216. if (isSameTag && isBuffer(object)) {
  3217. if (!isBuffer(other)) {
  3218. return false;
  3219. }
  3220. objIsArr = true;
  3221. objIsObj = false;
  3222. }
  3223. if (isSameTag && !objIsObj) {
  3224. stack || (stack = new Stack());
  3225. return objIsArr || isTypedArray(object) ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
  3226. }
  3227. if (!(bitmask & COMPARE_PARTIAL_FLAG$2)) {
  3228. var objIsWrapped = objIsObj && hasOwnProperty$9.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty$9.call(other, "__wrapped__");
  3229. if (objIsWrapped || othIsWrapped) {
  3230. var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other;
  3231. stack || (stack = new Stack());
  3232. return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
  3233. }
  3234. }
  3235. if (!isSameTag) {
  3236. return false;
  3237. }
  3238. stack || (stack = new Stack());
  3239. return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
  3240. }
  3241. function baseIsEqual(value, other, bitmask, customizer, stack) {
  3242. if (value === other) {
  3243. return true;
  3244. }
  3245. if (value == null || other == null || !isObjectLike(value) && !isObjectLike(other)) {
  3246. return value !== value && other !== other;
  3247. }
  3248. return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
  3249. }
  3250. var COMPARE_PARTIAL_FLAG$1 = 1;
  3251. var COMPARE_UNORDERED_FLAG$1 = 2;
  3252. function baseIsMatch(object, source, matchData, customizer) {
  3253. var index = matchData.length, length = index, noCustomizer = !customizer;
  3254. if (object == null) {
  3255. return !length;
  3256. }
  3257. object = Object(object);
  3258. while (index--) {
  3259. var data = matchData[index];
  3260. if (noCustomizer && data[2] ? data[1] !== object[data[0]] : !(data[0] in object)) {
  3261. return false;
  3262. }
  3263. }
  3264. while (++index < length) {
  3265. data = matchData[index];
  3266. var key = data[0], objValue = object[key], srcValue = data[1];
  3267. if (noCustomizer && data[2]) {
  3268. if (objValue === void 0 && !(key in object)) {
  3269. return false;
  3270. }
  3271. } else {
  3272. var stack = new Stack();
  3273. if (customizer) {
  3274. var result = customizer(objValue, srcValue, key, object, source, stack);
  3275. }
  3276. if (!(result === void 0 ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG$1 | COMPARE_UNORDERED_FLAG$1, customizer, stack) : result)) {
  3277. return false;
  3278. }
  3279. }
  3280. }
  3281. return true;
  3282. }
  3283. function isStrictComparable(value) {
  3284. return value === value && !isObject(value);
  3285. }
  3286. function getMatchData(object) {
  3287. var result = keys(object), length = result.length;
  3288. while (length--) {
  3289. var key = result[length], value = object[key];
  3290. result[length] = [key, value, isStrictComparable(value)];
  3291. }
  3292. return result;
  3293. }
  3294. function matchesStrictComparable(key, srcValue) {
  3295. return function(object) {
  3296. if (object == null) {
  3297. return false;
  3298. }
  3299. return object[key] === srcValue && (srcValue !== void 0 || key in Object(object));
  3300. };
  3301. }
  3302. function baseMatches(source) {
  3303. var matchData = getMatchData(source);
  3304. if (matchData.length == 1 && matchData[0][2]) {
  3305. return matchesStrictComparable(matchData[0][0], matchData[0][1]);
  3306. }
  3307. return function(object) {
  3308. return object === source || baseIsMatch(object, source, matchData);
  3309. };
  3310. }
  3311. function baseHasIn(object, key) {
  3312. return object != null && key in Object(object);
  3313. }
  3314. function hasPath(object, path, hasFunc) {
  3315. path = castPath(path, object);
  3316. var index = -1, length = path.length, result = false;
  3317. while (++index < length) {
  3318. var key = toKey(path[index]);
  3319. if (!(result = object != null && hasFunc(object, key))) {
  3320. break;
  3321. }
  3322. object = object[key];
  3323. }
  3324. if (result || ++index != length) {
  3325. return result;
  3326. }
  3327. length = object == null ? 0 : object.length;
  3328. return !!length && isLength(length) && isIndex(key, length) && (isArray(object) || isArguments(object));
  3329. }
  3330. function hasIn(object, path) {
  3331. return object != null && hasPath(object, path, baseHasIn);
  3332. }
  3333. var COMPARE_PARTIAL_FLAG = 1;
  3334. var COMPARE_UNORDERED_FLAG = 2;
  3335. function baseMatchesProperty(path, srcValue) {
  3336. if (isKey(path) && isStrictComparable(srcValue)) {
  3337. return matchesStrictComparable(toKey(path), srcValue);
  3338. }
  3339. return function(object) {
  3340. var objValue = get(object, path);
  3341. return objValue === void 0 && objValue === srcValue ? hasIn(object, path) : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
  3342. };
  3343. }
  3344. function baseProperty(key) {
  3345. return function(object) {
  3346. return object == null ? void 0 : object[key];
  3347. };
  3348. }
  3349. function basePropertyDeep(path) {
  3350. return function(object) {
  3351. return baseGet(object, path);
  3352. };
  3353. }
  3354. function property(path) {
  3355. return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
  3356. }
  3357. function baseIteratee(value) {
  3358. if (typeof value == "function") {
  3359. return value;
  3360. }
  3361. if (value == null) {
  3362. return identity;
  3363. }
  3364. if (typeof value == "object") {
  3365. return isArray(value) ? baseMatchesProperty(value[0], value[1]) : baseMatches(value);
  3366. }
  3367. return property(value);
  3368. }
  3369. var FUNC_ERROR_TEXT$7 = "Expected a function";
  3370. function cond(pairs) {
  3371. var length = pairs == null ? 0 : pairs.length, toIteratee = baseIteratee;
  3372. pairs = !length ? [] : arrayMap(pairs, function(pair) {
  3373. if (typeof pair[1] != "function") {
  3374. throw new TypeError(FUNC_ERROR_TEXT$7);
  3375. }
  3376. return [toIteratee(pair[0]), pair[1]];
  3377. });
  3378. return baseRest(function(args) {
  3379. var index = -1;
  3380. while (++index < length) {
  3381. var pair = pairs[index];
  3382. if (apply(pair[0], this, args)) {
  3383. return apply(pair[1], this, args);
  3384. }
  3385. }
  3386. });
  3387. }
  3388. function baseConformsTo(object, source, props) {
  3389. var length = props.length;
  3390. if (object == null) {
  3391. return !length;
  3392. }
  3393. object = Object(object);
  3394. while (length--) {
  3395. var key = props[length], predicate = source[key], value = object[key];
  3396. if (value === void 0 && !(key in object) || !predicate(value)) {
  3397. return false;
  3398. }
  3399. }
  3400. return true;
  3401. }
  3402. function baseConforms(source) {
  3403. var props = keys(source);
  3404. return function(object) {
  3405. return baseConformsTo(object, source, props);
  3406. };
  3407. }
  3408. var CLONE_DEEP_FLAG$4 = 1;
  3409. function conforms(source) {
  3410. return baseConforms(baseClone(source, CLONE_DEEP_FLAG$4));
  3411. }
  3412. function conformsTo(object, source) {
  3413. return source == null || baseConformsTo(object, source, keys(source));
  3414. }
  3415. function arrayAggregator(array, setter, iteratee, accumulator) {
  3416. var index = -1, length = array == null ? 0 : array.length;
  3417. while (++index < length) {
  3418. var value = array[index];
  3419. setter(accumulator, value, iteratee(value), array);
  3420. }
  3421. return accumulator;
  3422. }
  3423. function createBaseFor(fromRight) {
  3424. return function(object, iteratee, keysFunc) {
  3425. var index = -1, iterable = Object(object), props = keysFunc(object), length = props.length;
  3426. while (length--) {
  3427. var key = props[fromRight ? length : ++index];
  3428. if (iteratee(iterable[key], key, iterable) === false) {
  3429. break;
  3430. }
  3431. }
  3432. return object;
  3433. };
  3434. }
  3435. var baseFor = createBaseFor();
  3436. function baseForOwn(object, iteratee) {
  3437. return object && baseFor(object, iteratee, keys);
  3438. }
  3439. function createBaseEach(eachFunc, fromRight) {
  3440. return function(collection, iteratee) {
  3441. if (collection == null) {
  3442. return collection;
  3443. }
  3444. if (!isArrayLike(collection)) {
  3445. return eachFunc(collection, iteratee);
  3446. }
  3447. var length = collection.length, index = fromRight ? length : -1, iterable = Object(collection);
  3448. while (fromRight ? index-- : ++index < length) {
  3449. if (iteratee(iterable[index], index, iterable) === false) {
  3450. break;
  3451. }
  3452. }
  3453. return collection;
  3454. };
  3455. }
  3456. var baseEach = createBaseEach(baseForOwn);
  3457. function baseAggregator(collection, setter, iteratee, accumulator) {
  3458. baseEach(collection, function(value, key, collection2) {
  3459. setter(accumulator, value, iteratee(value), collection2);
  3460. });
  3461. return accumulator;
  3462. }
  3463. function createAggregator(setter, initializer) {
  3464. return function(collection, iteratee) {
  3465. var func = isArray(collection) ? arrayAggregator : baseAggregator, accumulator = initializer ? initializer() : {};
  3466. return func(collection, setter, baseIteratee(iteratee), accumulator);
  3467. };
  3468. }
  3469. var objectProto$9 = Object.prototype;
  3470. var hasOwnProperty$8 = objectProto$9.hasOwnProperty;
  3471. var countBy = createAggregator(function(result, value, key) {
  3472. if (hasOwnProperty$8.call(result, key)) {
  3473. ++result[key];
  3474. } else {
  3475. baseAssignValue(result, key, 1);
  3476. }
  3477. });
  3478. function create(prototype, properties) {
  3479. var result = baseCreate(prototype);
  3480. return properties == null ? result : baseAssign(result, properties);
  3481. }
  3482. var WRAP_CURRY_FLAG$1 = 8;
  3483. function curry(func, arity, guard) {
  3484. arity = guard ? void 0 : arity;
  3485. var result = createWrap(func, WRAP_CURRY_FLAG$1, void 0, void 0, void 0, void 0, void 0, arity);
  3486. result.placeholder = curry.placeholder;
  3487. return result;
  3488. }
  3489. curry.placeholder = {};
  3490. var WRAP_CURRY_RIGHT_FLAG = 16;
  3491. function curryRight(func, arity, guard) {
  3492. arity = guard ? void 0 : arity;
  3493. var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, void 0, void 0, void 0, void 0, void 0, arity);
  3494. result.placeholder = curryRight.placeholder;
  3495. return result;
  3496. }
  3497. curryRight.placeholder = {};
  3498. var now = function() {
  3499. return root.Date.now();
  3500. };
  3501. var FUNC_ERROR_TEXT$6 = "Expected a function";
  3502. var nativeMax$b = Math.max;
  3503. var nativeMin$b = Math.min;
  3504. function debounce(func, wait, options) {
  3505. var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
  3506. if (typeof func != "function") {
  3507. throw new TypeError(FUNC_ERROR_TEXT$6);
  3508. }
  3509. wait = toNumber(wait) || 0;
  3510. if (isObject(options)) {
  3511. leading = !!options.leading;
  3512. maxing = "maxWait" in options;
  3513. maxWait = maxing ? nativeMax$b(toNumber(options.maxWait) || 0, wait) : maxWait;
  3514. trailing = "trailing" in options ? !!options.trailing : trailing;
  3515. }
  3516. function invokeFunc(time) {
  3517. var args = lastArgs, thisArg = lastThis;
  3518. lastArgs = lastThis = void 0;
  3519. lastInvokeTime = time;
  3520. result = func.apply(thisArg, args);
  3521. return result;
  3522. }
  3523. function leadingEdge(time) {
  3524. lastInvokeTime = time;
  3525. timerId = setTimeout(timerExpired, wait);
  3526. return leading ? invokeFunc(time) : result;
  3527. }
  3528. function remainingWait(time) {
  3529. var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
  3530. return maxing ? nativeMin$b(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
  3531. }
  3532. function shouldInvoke(time) {
  3533. var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime;
  3534. return lastCallTime === void 0 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
  3535. }
  3536. function timerExpired() {
  3537. var time = now();
  3538. if (shouldInvoke(time)) {
  3539. return trailingEdge(time);
  3540. }
  3541. timerId = setTimeout(timerExpired, remainingWait(time));
  3542. }
  3543. function trailingEdge(time) {
  3544. timerId = void 0;
  3545. if (trailing && lastArgs) {
  3546. return invokeFunc(time);
  3547. }
  3548. lastArgs = lastThis = void 0;
  3549. return result;
  3550. }
  3551. function cancel() {
  3552. if (timerId !== void 0) {
  3553. clearTimeout(timerId);
  3554. }
  3555. lastInvokeTime = 0;
  3556. lastArgs = lastCallTime = lastThis = timerId = void 0;
  3557. }
  3558. function flush() {
  3559. return timerId === void 0 ? result : trailingEdge(now());
  3560. }
  3561. function debounced() {
  3562. var time = now(), isInvoking = shouldInvoke(time);
  3563. lastArgs = arguments;
  3564. lastThis = this;
  3565. lastCallTime = time;
  3566. if (isInvoking) {
  3567. if (timerId === void 0) {
  3568. return leadingEdge(lastCallTime);
  3569. }
  3570. if (maxing) {
  3571. clearTimeout(timerId);
  3572. timerId = setTimeout(timerExpired, wait);
  3573. return invokeFunc(lastCallTime);
  3574. }
  3575. }
  3576. if (timerId === void 0) {
  3577. timerId = setTimeout(timerExpired, wait);
  3578. }
  3579. return result;
  3580. }
  3581. debounced.cancel = cancel;
  3582. debounced.flush = flush;
  3583. return debounced;
  3584. }
  3585. function defaultTo(value, defaultValue) {
  3586. return value == null || value !== value ? defaultValue : value;
  3587. }
  3588. var objectProto$8 = Object.prototype;
  3589. var hasOwnProperty$7 = objectProto$8.hasOwnProperty;
  3590. var defaults = baseRest(function(object, sources) {
  3591. object = Object(object);
  3592. var index = -1;
  3593. var length = sources.length;
  3594. var guard = length > 2 ? sources[2] : void 0;
  3595. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  3596. length = 1;
  3597. }
  3598. while (++index < length) {
  3599. var source = sources[index];
  3600. var props = keysIn(source);
  3601. var propsIndex = -1;
  3602. var propsLength = props.length;
  3603. while (++propsIndex < propsLength) {
  3604. var key = props[propsIndex];
  3605. var value = object[key];
  3606. if (value === void 0 || eq(value, objectProto$8[key]) && !hasOwnProperty$7.call(object, key)) {
  3607. object[key] = source[key];
  3608. }
  3609. }
  3610. }
  3611. return object;
  3612. });
  3613. function assignMergeValue(object, key, value) {
  3614. if (value !== void 0 && !eq(object[key], value) || value === void 0 && !(key in object)) {
  3615. baseAssignValue(object, key, value);
  3616. }
  3617. }
  3618. function isArrayLikeObject(value) {
  3619. return isObjectLike(value) && isArrayLike(value);
  3620. }
  3621. function safeGet(object, key) {
  3622. if (key === "constructor" && typeof object[key] === "function") {
  3623. return;
  3624. }
  3625. if (key == "__proto__") {
  3626. return;
  3627. }
  3628. return object[key];
  3629. }
  3630. function toPlainObject(value) {
  3631. return copyObject(value, keysIn(value));
  3632. }
  3633. function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
  3634. var objValue = safeGet(object, key), srcValue = safeGet(source, key), stacked = stack.get(srcValue);
  3635. if (stacked) {
  3636. assignMergeValue(object, key, stacked);
  3637. return;
  3638. }
  3639. var newValue = customizer ? customizer(objValue, srcValue, key + "", object, source, stack) : void 0;
  3640. var isCommon = newValue === void 0;
  3641. if (isCommon) {
  3642. var isArr = isArray(srcValue), isBuff = !isArr && isBuffer(srcValue), isTyped = !isArr && !isBuff && isTypedArray(srcValue);
  3643. newValue = srcValue;
  3644. if (isArr || isBuff || isTyped) {
  3645. if (isArray(objValue)) {
  3646. newValue = objValue;
  3647. } else if (isArrayLikeObject(objValue)) {
  3648. newValue = copyArray(objValue);
  3649. } else if (isBuff) {
  3650. isCommon = false;
  3651. newValue = cloneBuffer(srcValue, true);
  3652. } else if (isTyped) {
  3653. isCommon = false;
  3654. newValue = cloneTypedArray(srcValue, true);
  3655. } else {
  3656. newValue = [];
  3657. }
  3658. } else if (isPlainObject(srcValue) || isArguments(srcValue)) {
  3659. newValue = objValue;
  3660. if (isArguments(objValue)) {
  3661. newValue = toPlainObject(objValue);
  3662. } else if (!isObject(objValue) || isFunction(objValue)) {
  3663. newValue = initCloneObject(srcValue);
  3664. }
  3665. } else {
  3666. isCommon = false;
  3667. }
  3668. }
  3669. if (isCommon) {
  3670. stack.set(srcValue, newValue);
  3671. mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
  3672. stack["delete"](srcValue);
  3673. }
  3674. assignMergeValue(object, key, newValue);
  3675. }
  3676. function baseMerge(object, source, srcIndex, customizer, stack) {
  3677. if (object === source) {
  3678. return;
  3679. }
  3680. baseFor(source, function(srcValue, key) {
  3681. stack || (stack = new Stack());
  3682. if (isObject(srcValue)) {
  3683. baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
  3684. } else {
  3685. var newValue = customizer ? customizer(safeGet(object, key), srcValue, key + "", object, source, stack) : void 0;
  3686. if (newValue === void 0) {
  3687. newValue = srcValue;
  3688. }
  3689. assignMergeValue(object, key, newValue);
  3690. }
  3691. }, keysIn);
  3692. }
  3693. function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
  3694. if (isObject(objValue) && isObject(srcValue)) {
  3695. stack.set(srcValue, objValue);
  3696. baseMerge(objValue, srcValue, void 0, customDefaultsMerge, stack);
  3697. stack["delete"](srcValue);
  3698. }
  3699. return objValue;
  3700. }
  3701. var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
  3702. baseMerge(object, source, srcIndex, customizer);
  3703. });
  3704. var defaultsDeep = baseRest(function(args) {
  3705. args.push(void 0, customDefaultsMerge);
  3706. return apply(mergeWith, void 0, args);
  3707. });
  3708. var FUNC_ERROR_TEXT$5 = "Expected a function";
  3709. function baseDelay(func, wait, args) {
  3710. if (typeof func != "function") {
  3711. throw new TypeError(FUNC_ERROR_TEXT$5);
  3712. }
  3713. return setTimeout(function() {
  3714. func.apply(void 0, args);
  3715. }, wait);
  3716. }
  3717. var defer = baseRest(function(func, args) {
  3718. return baseDelay(func, 1, args);
  3719. });
  3720. var delay = baseRest(function(func, wait, args) {
  3721. return baseDelay(func, toNumber(wait) || 0, args);
  3722. });
  3723. function arrayIncludesWith(array, value, comparator) {
  3724. var index = -1, length = array == null ? 0 : array.length;
  3725. while (++index < length) {
  3726. if (comparator(value, array[index])) {
  3727. return true;
  3728. }
  3729. }
  3730. return false;
  3731. }
  3732. var LARGE_ARRAY_SIZE$1 = 200;
  3733. function baseDifference(array, values, iteratee, comparator) {
  3734. var index = -1, includes = arrayIncludes, isCommon = true, length = array.length, result = [], valuesLength = values.length;
  3735. if (!length) {
  3736. return result;
  3737. }
  3738. if (iteratee) {
  3739. values = arrayMap(values, baseUnary(iteratee));
  3740. }
  3741. if (comparator) {
  3742. includes = arrayIncludesWith;
  3743. isCommon = false;
  3744. } else if (values.length >= LARGE_ARRAY_SIZE$1) {
  3745. includes = cacheHas;
  3746. isCommon = false;
  3747. values = new SetCache(values);
  3748. }
  3749. outer:
  3750. while (++index < length) {
  3751. var value = array[index], computed = iteratee == null ? value : iteratee(value);
  3752. value = comparator || value !== 0 ? value : 0;
  3753. if (isCommon && computed === computed) {
  3754. var valuesIndex = valuesLength;
  3755. while (valuesIndex--) {
  3756. if (values[valuesIndex] === computed) {
  3757. continue outer;
  3758. }
  3759. }
  3760. result.push(value);
  3761. } else if (!includes(values, computed, comparator)) {
  3762. result.push(value);
  3763. }
  3764. }
  3765. return result;
  3766. }
  3767. var difference = baseRest(function(array, values) {
  3768. return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true)) : [];
  3769. });
  3770. function last(array) {
  3771. var length = array == null ? 0 : array.length;
  3772. return length ? array[length - 1] : void 0;
  3773. }
  3774. var differenceBy = baseRest(function(array, values) {
  3775. var iteratee = last(values);
  3776. if (isArrayLikeObject(iteratee)) {
  3777. iteratee = void 0;
  3778. }
  3779. return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), baseIteratee(iteratee)) : [];
  3780. });
  3781. var differenceWith = baseRest(function(array, values) {
  3782. var comparator = last(values);
  3783. if (isArrayLikeObject(comparator)) {
  3784. comparator = void 0;
  3785. }
  3786. return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), void 0, comparator) : [];
  3787. });
  3788. var divide = createMathOperation(function(dividend, divisor) {
  3789. return dividend / divisor;
  3790. }, 1);
  3791. function drop(array, n, guard) {
  3792. var length = array == null ? 0 : array.length;
  3793. if (!length) {
  3794. return [];
  3795. }
  3796. n = guard || n === void 0 ? 1 : toInteger(n);
  3797. return baseSlice(array, n < 0 ? 0 : n, length);
  3798. }
  3799. function dropRight(array, n, guard) {
  3800. var length = array == null ? 0 : array.length;
  3801. if (!length) {
  3802. return [];
  3803. }
  3804. n = guard || n === void 0 ? 1 : toInteger(n);
  3805. n = length - n;
  3806. return baseSlice(array, 0, n < 0 ? 0 : n);
  3807. }
  3808. function baseWhile(array, predicate, isDrop, fromRight) {
  3809. var length = array.length, index = fromRight ? length : -1;
  3810. while ((fromRight ? index-- : ++index < length) && predicate(array[index], index, array)) {
  3811. }
  3812. return isDrop ? baseSlice(array, fromRight ? 0 : index, fromRight ? index + 1 : length) : baseSlice(array, fromRight ? index + 1 : 0, fromRight ? length : index);
  3813. }
  3814. function dropRightWhile(array, predicate) {
  3815. return array && array.length ? baseWhile(array, baseIteratee(predicate), true, true) : [];
  3816. }
  3817. function dropWhile(array, predicate) {
  3818. return array && array.length ? baseWhile(array, baseIteratee(predicate), true) : [];
  3819. }
  3820. function castFunction(value) {
  3821. return typeof value == "function" ? value : identity;
  3822. }
  3823. function forEach(collection, iteratee) {
  3824. var func = isArray(collection) ? arrayEach : baseEach;
  3825. return func(collection, castFunction(iteratee));
  3826. }
  3827. function arrayEachRight(array, iteratee) {
  3828. var length = array == null ? 0 : array.length;
  3829. while (length--) {
  3830. if (iteratee(array[length], length, array) === false) {
  3831. break;
  3832. }
  3833. }
  3834. return array;
  3835. }
  3836. var baseForRight = createBaseFor(true);
  3837. function baseForOwnRight(object, iteratee) {
  3838. return object && baseForRight(object, iteratee, keys);
  3839. }
  3840. var baseEachRight = createBaseEach(baseForOwnRight, true);
  3841. function forEachRight(collection, iteratee) {
  3842. var func = isArray(collection) ? arrayEachRight : baseEachRight;
  3843. return func(collection, castFunction(iteratee));
  3844. }
  3845. function endsWith(string, target, position) {
  3846. string = toString(string);
  3847. target = baseToString(target);
  3848. var length = string.length;
  3849. position = position === void 0 ? length : baseClamp(toInteger(position), 0, length);
  3850. var end = position;
  3851. position -= target.length;
  3852. return position >= 0 && string.slice(position, end) == target;
  3853. }
  3854. function baseToPairs(object, props) {
  3855. return arrayMap(props, function(key) {
  3856. return [key, object[key]];
  3857. });
  3858. }
  3859. function setToPairs(set) {
  3860. var index = -1, result = Array(set.size);
  3861. set.forEach(function(value) {
  3862. result[++index] = [value, value];
  3863. });
  3864. return result;
  3865. }
  3866. var mapTag$3 = "[object Map]";
  3867. var setTag$3 = "[object Set]";
  3868. function createToPairs(keysFunc) {
  3869. return function(object) {
  3870. var tag = getTag$1(object);
  3871. if (tag == mapTag$3) {
  3872. return mapToArray(object);
  3873. }
  3874. if (tag == setTag$3) {
  3875. return setToPairs(object);
  3876. }
  3877. return baseToPairs(object, keysFunc(object));
  3878. };
  3879. }
  3880. var toPairs = createToPairs(keys);
  3881. var toPairsIn = createToPairs(keysIn);
  3882. var htmlEscapes = {
  3883. "&": "&amp;",
  3884. "<": "&lt;",
  3885. ">": "&gt;",
  3886. '"': "&quot;",
  3887. "'": "&#39;"
  3888. };
  3889. var escapeHtmlChar = basePropertyOf(htmlEscapes);
  3890. var reUnescapedHtml = /[&<>"']/g;
  3891. var reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
  3892. function escape(string) {
  3893. string = toString(string);
  3894. return string && reHasUnescapedHtml.test(string) ? string.replace(reUnescapedHtml, escapeHtmlChar) : string;
  3895. }
  3896. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
  3897. var reHasRegExpChar = RegExp(reRegExpChar.source);
  3898. function escapeRegExp(string) {
  3899. string = toString(string);
  3900. return string && reHasRegExpChar.test(string) ? string.replace(reRegExpChar, "\\$&") : string;
  3901. }
  3902. function arrayEvery(array, predicate) {
  3903. var index = -1, length = array == null ? 0 : array.length;
  3904. while (++index < length) {
  3905. if (!predicate(array[index], index, array)) {
  3906. return false;
  3907. }
  3908. }
  3909. return true;
  3910. }
  3911. function baseEvery(collection, predicate) {
  3912. var result = true;
  3913. baseEach(collection, function(value, index, collection2) {
  3914. result = !!predicate(value, index, collection2);
  3915. return result;
  3916. });
  3917. return result;
  3918. }
  3919. function every(collection, predicate, guard) {
  3920. var func = isArray(collection) ? arrayEvery : baseEvery;
  3921. if (guard && isIterateeCall(collection, predicate, guard)) {
  3922. predicate = void 0;
  3923. }
  3924. return func(collection, baseIteratee(predicate));
  3925. }
  3926. var MAX_ARRAY_LENGTH$5 = 4294967295;
  3927. function toLength(value) {
  3928. return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH$5) : 0;
  3929. }
  3930. function baseFill(array, value, start, end) {
  3931. var length = array.length;
  3932. start = toInteger(start);
  3933. if (start < 0) {
  3934. start = -start > length ? 0 : length + start;
  3935. }
  3936. end = end === void 0 || end > length ? length : toInteger(end);
  3937. if (end < 0) {
  3938. end += length;
  3939. }
  3940. end = start > end ? 0 : toLength(end);
  3941. while (start < end) {
  3942. array[start++] = value;
  3943. }
  3944. return array;
  3945. }
  3946. function fill(array, value, start, end) {
  3947. var length = array == null ? 0 : array.length;
  3948. if (!length) {
  3949. return [];
  3950. }
  3951. if (start && typeof start != "number" && isIterateeCall(array, value, start)) {
  3952. start = 0;
  3953. end = length;
  3954. }
  3955. return baseFill(array, value, start, end);
  3956. }
  3957. function baseFilter(collection, predicate) {
  3958. var result = [];
  3959. baseEach(collection, function(value, index, collection2) {
  3960. if (predicate(value, index, collection2)) {
  3961. result.push(value);
  3962. }
  3963. });
  3964. return result;
  3965. }
  3966. function filter(collection, predicate) {
  3967. var func = isArray(collection) ? arrayFilter : baseFilter;
  3968. return func(collection, baseIteratee(predicate));
  3969. }
  3970. function createFind(findIndexFunc) {
  3971. return function(collection, predicate, fromIndex) {
  3972. var iterable = Object(collection);
  3973. if (!isArrayLike(collection)) {
  3974. var iteratee = baseIteratee(predicate);
  3975. collection = keys(collection);
  3976. predicate = function(key) {
  3977. return iteratee(iterable[key], key, iterable);
  3978. };
  3979. }
  3980. var index = findIndexFunc(collection, predicate, fromIndex);
  3981. return index > -1 ? iterable[iteratee ? collection[index] : index] : void 0;
  3982. };
  3983. }
  3984. var nativeMax$a = Math.max;
  3985. function findIndex(array, predicate, fromIndex) {
  3986. var length = array == null ? 0 : array.length;
  3987. if (!length) {
  3988. return -1;
  3989. }
  3990. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  3991. if (index < 0) {
  3992. index = nativeMax$a(length + index, 0);
  3993. }
  3994. return baseFindIndex(array, baseIteratee(predicate), index);
  3995. }
  3996. var find = createFind(findIndex);
  3997. function baseFindKey(collection, predicate, eachFunc) {
  3998. var result;
  3999. eachFunc(collection, function(value, key, collection2) {
  4000. if (predicate(value, key, collection2)) {
  4001. result = key;
  4002. return false;
  4003. }
  4004. });
  4005. return result;
  4006. }
  4007. function findKey(object, predicate) {
  4008. return baseFindKey(object, baseIteratee(predicate), baseForOwn);
  4009. }
  4010. var nativeMax$9 = Math.max;
  4011. var nativeMin$a = Math.min;
  4012. function findLastIndex(array, predicate, fromIndex) {
  4013. var length = array == null ? 0 : array.length;
  4014. if (!length) {
  4015. return -1;
  4016. }
  4017. var index = length - 1;
  4018. if (fromIndex !== void 0) {
  4019. index = toInteger(fromIndex);
  4020. index = fromIndex < 0 ? nativeMax$9(length + index, 0) : nativeMin$a(index, length - 1);
  4021. }
  4022. return baseFindIndex(array, baseIteratee(predicate), index, true);
  4023. }
  4024. var findLast = createFind(findLastIndex);
  4025. function findLastKey(object, predicate) {
  4026. return baseFindKey(object, baseIteratee(predicate), baseForOwnRight);
  4027. }
  4028. function head(array) {
  4029. return array && array.length ? array[0] : void 0;
  4030. }
  4031. function baseMap(collection, iteratee) {
  4032. var index = -1, result = isArrayLike(collection) ? Array(collection.length) : [];
  4033. baseEach(collection, function(value, key, collection2) {
  4034. result[++index] = iteratee(value, key, collection2);
  4035. });
  4036. return result;
  4037. }
  4038. function map(collection, iteratee) {
  4039. var func = isArray(collection) ? arrayMap : baseMap;
  4040. return func(collection, baseIteratee(iteratee));
  4041. }
  4042. function flatMap(collection, iteratee) {
  4043. return baseFlatten(map(collection, iteratee), 1);
  4044. }
  4045. var INFINITY$2 = 1 / 0;
  4046. function flatMapDeep(collection, iteratee) {
  4047. return baseFlatten(map(collection, iteratee), INFINITY$2);
  4048. }
  4049. function flatMapDepth(collection, iteratee, depth) {
  4050. depth = depth === void 0 ? 1 : toInteger(depth);
  4051. return baseFlatten(map(collection, iteratee), depth);
  4052. }
  4053. var INFINITY$1 = 1 / 0;
  4054. function flattenDeep(array) {
  4055. var length = array == null ? 0 : array.length;
  4056. return length ? baseFlatten(array, INFINITY$1) : [];
  4057. }
  4058. function flattenDepth(array, depth) {
  4059. var length = array == null ? 0 : array.length;
  4060. if (!length) {
  4061. return [];
  4062. }
  4063. depth = depth === void 0 ? 1 : toInteger(depth);
  4064. return baseFlatten(array, depth);
  4065. }
  4066. var WRAP_FLIP_FLAG = 512;
  4067. function flip$1(func) {
  4068. return createWrap(func, WRAP_FLIP_FLAG);
  4069. }
  4070. var floor$1 = createRound("floor");
  4071. var FUNC_ERROR_TEXT$4 = "Expected a function";
  4072. var WRAP_CURRY_FLAG = 8;
  4073. var WRAP_PARTIAL_FLAG$1 = 32;
  4074. var WRAP_ARY_FLAG = 128;
  4075. var WRAP_REARG_FLAG$1 = 256;
  4076. function createFlow(fromRight) {
  4077. return flatRest(function(funcs) {
  4078. var length = funcs.length, index = length, prereq = LodashWrapper.prototype.thru;
  4079. if (fromRight) {
  4080. funcs.reverse();
  4081. }
  4082. while (index--) {
  4083. var func = funcs[index];
  4084. if (typeof func != "function") {
  4085. throw new TypeError(FUNC_ERROR_TEXT$4);
  4086. }
  4087. if (prereq && !wrapper && getFuncName(func) == "wrapper") {
  4088. var wrapper = new LodashWrapper([], true);
  4089. }
  4090. }
  4091. index = wrapper ? index : length;
  4092. while (++index < length) {
  4093. func = funcs[index];
  4094. var funcName = getFuncName(func), data = funcName == "wrapper" ? getData(func) : void 0;
  4095. 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) {
  4096. wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
  4097. } else {
  4098. wrapper = func.length == 1 && isLaziable(func) ? wrapper[funcName]() : wrapper.thru(func);
  4099. }
  4100. }
  4101. return function() {
  4102. var args = arguments, value = args[0];
  4103. if (wrapper && args.length == 1 && isArray(value)) {
  4104. return wrapper.plant(value).value();
  4105. }
  4106. var index2 = 0, result = length ? funcs[index2].apply(this, args) : value;
  4107. while (++index2 < length) {
  4108. result = funcs[index2].call(this, result);
  4109. }
  4110. return result;
  4111. };
  4112. });
  4113. }
  4114. var flow = createFlow();
  4115. var flowRight = createFlow(true);
  4116. function forIn(object, iteratee) {
  4117. return object == null ? object : baseFor(object, castFunction(iteratee), keysIn);
  4118. }
  4119. function forInRight(object, iteratee) {
  4120. return object == null ? object : baseForRight(object, castFunction(iteratee), keysIn);
  4121. }
  4122. function forOwn(object, iteratee) {
  4123. return object && baseForOwn(object, castFunction(iteratee));
  4124. }
  4125. function forOwnRight(object, iteratee) {
  4126. return object && baseForOwnRight(object, castFunction(iteratee));
  4127. }
  4128. function fromPairs(pairs) {
  4129. var index = -1, length = pairs == null ? 0 : pairs.length, result = {};
  4130. while (++index < length) {
  4131. var pair = pairs[index];
  4132. result[pair[0]] = pair[1];
  4133. }
  4134. return result;
  4135. }
  4136. function baseFunctions(object, props) {
  4137. return arrayFilter(props, function(key) {
  4138. return isFunction(object[key]);
  4139. });
  4140. }
  4141. function functions(object) {
  4142. return object == null ? [] : baseFunctions(object, keys(object));
  4143. }
  4144. function functionsIn(object) {
  4145. return object == null ? [] : baseFunctions(object, keysIn(object));
  4146. }
  4147. var objectProto$7 = Object.prototype;
  4148. var hasOwnProperty$6 = objectProto$7.hasOwnProperty;
  4149. var groupBy = createAggregator(function(result, value, key) {
  4150. if (hasOwnProperty$6.call(result, key)) {
  4151. result[key].push(value);
  4152. } else {
  4153. baseAssignValue(result, key, [value]);
  4154. }
  4155. });
  4156. function baseGt(value, other) {
  4157. return value > other;
  4158. }
  4159. function createRelationalOperation(operator) {
  4160. return function(value, other) {
  4161. if (!(typeof value == "string" && typeof other == "string")) {
  4162. value = toNumber(value);
  4163. other = toNumber(other);
  4164. }
  4165. return operator(value, other);
  4166. };
  4167. }
  4168. var gt$1 = createRelationalOperation(baseGt);
  4169. var gte = createRelationalOperation(function(value, other) {
  4170. return value >= other;
  4171. });
  4172. var objectProto$6 = Object.prototype;
  4173. var hasOwnProperty$5 = objectProto$6.hasOwnProperty;
  4174. function baseHas(object, key) {
  4175. return object != null && hasOwnProperty$5.call(object, key);
  4176. }
  4177. function has(object, path) {
  4178. return object != null && hasPath(object, path, baseHas);
  4179. }
  4180. var nativeMax$8 = Math.max;
  4181. var nativeMin$9 = Math.min;
  4182. function baseInRange(number, start, end) {
  4183. return number >= nativeMin$9(start, end) && number < nativeMax$8(start, end);
  4184. }
  4185. function inRange(number, start, end) {
  4186. start = toFinite(start);
  4187. if (end === void 0) {
  4188. end = start;
  4189. start = 0;
  4190. } else {
  4191. end = toFinite(end);
  4192. }
  4193. number = toNumber(number);
  4194. return baseInRange(number, start, end);
  4195. }
  4196. var stringTag = "[object String]";
  4197. function isString(value) {
  4198. return typeof value == "string" || !isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag;
  4199. }
  4200. function baseValues(object, props) {
  4201. return arrayMap(props, function(key) {
  4202. return object[key];
  4203. });
  4204. }
  4205. function values(object) {
  4206. return object == null ? [] : baseValues(object, keys(object));
  4207. }
  4208. var nativeMax$7 = Math.max;
  4209. function includes(collection, value, fromIndex, guard) {
  4210. collection = isArrayLike(collection) ? collection : values(collection);
  4211. fromIndex = fromIndex && !guard ? toInteger(fromIndex) : 0;
  4212. var length = collection.length;
  4213. if (fromIndex < 0) {
  4214. fromIndex = nativeMax$7(length + fromIndex, 0);
  4215. }
  4216. return isString(collection) ? fromIndex <= length && collection.indexOf(value, fromIndex) > -1 : !!length && baseIndexOf(collection, value, fromIndex) > -1;
  4217. }
  4218. var nativeMax$6 = Math.max;
  4219. function indexOf(array, value, fromIndex) {
  4220. var length = array == null ? 0 : array.length;
  4221. if (!length) {
  4222. return -1;
  4223. }
  4224. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  4225. if (index < 0) {
  4226. index = nativeMax$6(length + index, 0);
  4227. }
  4228. return baseIndexOf(array, value, index);
  4229. }
  4230. function initial$1(array) {
  4231. var length = array == null ? 0 : array.length;
  4232. return length ? baseSlice(array, 0, -1) : [];
  4233. }
  4234. var nativeMin$8 = Math.min;
  4235. function baseIntersection(arrays, iteratee, comparator) {
  4236. var includes = comparator ? arrayIncludesWith : arrayIncludes, length = arrays[0].length, othLength = arrays.length, othIndex = othLength, caches = Array(othLength), maxLength = Infinity, result = [];
  4237. while (othIndex--) {
  4238. var array = arrays[othIndex];
  4239. if (othIndex && iteratee) {
  4240. array = arrayMap(array, baseUnary(iteratee));
  4241. }
  4242. maxLength = nativeMin$8(array.length, maxLength);
  4243. caches[othIndex] = !comparator && (iteratee || length >= 120 && array.length >= 120) ? new SetCache(othIndex && array) : void 0;
  4244. }
  4245. array = arrays[0];
  4246. var index = -1, seen = caches[0];
  4247. outer:
  4248. while (++index < length && result.length < maxLength) {
  4249. var value = array[index], computed = iteratee ? iteratee(value) : value;
  4250. value = comparator || value !== 0 ? value : 0;
  4251. if (!(seen ? cacheHas(seen, computed) : includes(result, computed, comparator))) {
  4252. othIndex = othLength;
  4253. while (--othIndex) {
  4254. var cache = caches[othIndex];
  4255. if (!(cache ? cacheHas(cache, computed) : includes(arrays[othIndex], computed, comparator))) {
  4256. continue outer;
  4257. }
  4258. }
  4259. if (seen) {
  4260. seen.push(computed);
  4261. }
  4262. result.push(value);
  4263. }
  4264. }
  4265. return result;
  4266. }
  4267. function castArrayLikeObject(value) {
  4268. return isArrayLikeObject(value) ? value : [];
  4269. }
  4270. var intersection = baseRest(function(arrays) {
  4271. var mapped = arrayMap(arrays, castArrayLikeObject);
  4272. return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped) : [];
  4273. });
  4274. var intersectionBy = baseRest(function(arrays) {
  4275. var iteratee = last(arrays), mapped = arrayMap(arrays, castArrayLikeObject);
  4276. if (iteratee === last(mapped)) {
  4277. iteratee = void 0;
  4278. } else {
  4279. mapped.pop();
  4280. }
  4281. return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, baseIteratee(iteratee)) : [];
  4282. });
  4283. var intersectionWith = baseRest(function(arrays) {
  4284. var comparator = last(arrays), mapped = arrayMap(arrays, castArrayLikeObject);
  4285. comparator = typeof comparator == "function" ? comparator : void 0;
  4286. if (comparator) {
  4287. mapped.pop();
  4288. }
  4289. return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, void 0, comparator) : [];
  4290. });
  4291. function baseInverter(object, setter, iteratee, accumulator) {
  4292. baseForOwn(object, function(value, key, object2) {
  4293. setter(accumulator, iteratee(value), key, object2);
  4294. });
  4295. return accumulator;
  4296. }
  4297. function createInverter(setter, toIteratee) {
  4298. return function(object, iteratee) {
  4299. return baseInverter(object, setter, toIteratee(iteratee), {});
  4300. };
  4301. }
  4302. var objectProto$5 = Object.prototype;
  4303. var nativeObjectToString$1 = objectProto$5.toString;
  4304. var invert = createInverter(function(result, value, key) {
  4305. if (value != null && typeof value.toString != "function") {
  4306. value = nativeObjectToString$1.call(value);
  4307. }
  4308. result[value] = key;
  4309. }, constant(identity));
  4310. var objectProto$4 = Object.prototype;
  4311. var hasOwnProperty$4 = objectProto$4.hasOwnProperty;
  4312. var nativeObjectToString = objectProto$4.toString;
  4313. var invertBy = createInverter(function(result, value, key) {
  4314. if (value != null && typeof value.toString != "function") {
  4315. value = nativeObjectToString.call(value);
  4316. }
  4317. if (hasOwnProperty$4.call(result, value)) {
  4318. result[value].push(key);
  4319. } else {
  4320. result[value] = [key];
  4321. }
  4322. }, baseIteratee);
  4323. function parent(object, path) {
  4324. return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
  4325. }
  4326. function baseInvoke(object, path, args) {
  4327. path = castPath(path, object);
  4328. object = parent(object, path);
  4329. var func = object == null ? object : object[toKey(last(path))];
  4330. return func == null ? void 0 : apply(func, object, args);
  4331. }
  4332. var invoke = baseRest(baseInvoke);
  4333. var invokeMap = baseRest(function(collection, path, args) {
  4334. var index = -1, isFunc = typeof path == "function", result = isArrayLike(collection) ? Array(collection.length) : [];
  4335. baseEach(collection, function(value) {
  4336. result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
  4337. });
  4338. return result;
  4339. });
  4340. var arrayBufferTag = "[object ArrayBuffer]";
  4341. function baseIsArrayBuffer(value) {
  4342. return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;
  4343. }
  4344. var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer;
  4345. var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
  4346. var boolTag = "[object Boolean]";
  4347. function isBoolean$1(value) {
  4348. return value === true || value === false || isObjectLike(value) && baseGetTag(value) == boolTag;
  4349. }
  4350. var dateTag = "[object Date]";
  4351. function baseIsDate(value) {
  4352. return isObjectLike(value) && baseGetTag(value) == dateTag;
  4353. }
  4354. var nodeIsDate = nodeUtil && nodeUtil.isDate;
  4355. var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
  4356. function isElement$2(value) {
  4357. return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
  4358. }
  4359. var mapTag$2 = "[object Map]";
  4360. var setTag$2 = "[object Set]";
  4361. var objectProto$3 = Object.prototype;
  4362. var hasOwnProperty$3 = objectProto$3.hasOwnProperty;
  4363. function isEmpty$1(value) {
  4364. if (value == null) {
  4365. return true;
  4366. }
  4367. if (isArrayLike(value) && (isArray(value) || typeof value == "string" || typeof value.splice == "function" || isBuffer(value) || isTypedArray(value) || isArguments(value))) {
  4368. return !value.length;
  4369. }
  4370. var tag = getTag$1(value);
  4371. if (tag == mapTag$2 || tag == setTag$2) {
  4372. return !value.size;
  4373. }
  4374. if (isPrototype(value)) {
  4375. return !baseKeys(value).length;
  4376. }
  4377. for (var key in value) {
  4378. if (hasOwnProperty$3.call(value, key)) {
  4379. return false;
  4380. }
  4381. }
  4382. return true;
  4383. }
  4384. function isEqual$1(value, other) {
  4385. return baseIsEqual(value, other);
  4386. }
  4387. function isEqualWith(value, other, customizer) {
  4388. customizer = typeof customizer == "function" ? customizer : void 0;
  4389. var result = customizer ? customizer(value, other) : void 0;
  4390. return result === void 0 ? baseIsEqual(value, other, void 0, customizer) : !!result;
  4391. }
  4392. var nativeIsFinite = root.isFinite;
  4393. function isFinite(value) {
  4394. return typeof value == "number" && nativeIsFinite(value);
  4395. }
  4396. function isInteger(value) {
  4397. return typeof value == "number" && value == toInteger(value);
  4398. }
  4399. function isMatch(object, source) {
  4400. return object === source || baseIsMatch(object, source, getMatchData(source));
  4401. }
  4402. function isMatchWith(object, source, customizer) {
  4403. customizer = typeof customizer == "function" ? customizer : void 0;
  4404. return baseIsMatch(object, source, getMatchData(source), customizer);
  4405. }
  4406. var numberTag = "[object Number]";
  4407. function isNumber$1(value) {
  4408. return typeof value == "number" || isObjectLike(value) && baseGetTag(value) == numberTag;
  4409. }
  4410. function isNaN$1(value) {
  4411. return isNumber$1(value) && value != +value;
  4412. }
  4413. var isMaskable = coreJsData ? isFunction : stubFalse;
  4414. var CORE_ERROR_TEXT = "Unsupported core-js use. Try https://npms.io/search?q=ponyfill.";
  4415. function isNative(value) {
  4416. if (isMaskable(value)) {
  4417. throw new Error(CORE_ERROR_TEXT);
  4418. }
  4419. return baseIsNative(value);
  4420. }
  4421. function isNil(value) {
  4422. return value == null;
  4423. }
  4424. function isNull(value) {
  4425. return value === null;
  4426. }
  4427. var regexpTag = "[object RegExp]";
  4428. function baseIsRegExp(value) {
  4429. return isObjectLike(value) && baseGetTag(value) == regexpTag;
  4430. }
  4431. var nodeIsRegExp = nodeUtil && nodeUtil.isRegExp;
  4432. var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
  4433. var MAX_SAFE_INTEGER$3 = 9007199254740991;
  4434. function isSafeInteger(value) {
  4435. return isInteger(value) && value >= -MAX_SAFE_INTEGER$3 && value <= MAX_SAFE_INTEGER$3;
  4436. }
  4437. function isUndefined$1(value) {
  4438. return value === void 0;
  4439. }
  4440. var weakMapTag = "[object WeakMap]";
  4441. function isWeakMap(value) {
  4442. return isObjectLike(value) && getTag$1(value) == weakMapTag;
  4443. }
  4444. var weakSetTag = "[object WeakSet]";
  4445. function isWeakSet(value) {
  4446. return isObjectLike(value) && baseGetTag(value) == weakSetTag;
  4447. }
  4448. var CLONE_DEEP_FLAG$3 = 1;
  4449. function iteratee(func) {
  4450. return baseIteratee(typeof func == "function" ? func : baseClone(func, CLONE_DEEP_FLAG$3));
  4451. }
  4452. var arrayProto$4 = Array.prototype;
  4453. var nativeJoin = arrayProto$4.join;
  4454. function join(array, separator) {
  4455. return array == null ? "" : nativeJoin.call(array, separator);
  4456. }
  4457. var kebabCase = createCompounder(function(result, word, index) {
  4458. return result + (index ? "-" : "") + word.toLowerCase();
  4459. });
  4460. var keyBy = createAggregator(function(result, value, key) {
  4461. baseAssignValue(result, key, value);
  4462. });
  4463. function strictLastIndexOf(array, value, fromIndex) {
  4464. var index = fromIndex + 1;
  4465. while (index--) {
  4466. if (array[index] === value) {
  4467. return index;
  4468. }
  4469. }
  4470. return index;
  4471. }
  4472. var nativeMax$5 = Math.max;
  4473. var nativeMin$7 = Math.min;
  4474. function lastIndexOf(array, value, fromIndex) {
  4475. var length = array == null ? 0 : array.length;
  4476. if (!length) {
  4477. return -1;
  4478. }
  4479. var index = length;
  4480. if (fromIndex !== void 0) {
  4481. index = toInteger(fromIndex);
  4482. index = index < 0 ? nativeMax$5(length + index, 0) : nativeMin$7(index, length - 1);
  4483. }
  4484. return value === value ? strictLastIndexOf(array, value, index) : baseFindIndex(array, baseIsNaN, index, true);
  4485. }
  4486. var lowerCase = createCompounder(function(result, word, index) {
  4487. return result + (index ? " " : "") + word.toLowerCase();
  4488. });
  4489. var lowerFirst = createCaseFirst("toLowerCase");
  4490. function baseLt(value, other) {
  4491. return value < other;
  4492. }
  4493. var lt$1 = createRelationalOperation(baseLt);
  4494. var lte = createRelationalOperation(function(value, other) {
  4495. return value <= other;
  4496. });
  4497. function mapKeys(object, iteratee) {
  4498. var result = {};
  4499. iteratee = baseIteratee(iteratee);
  4500. baseForOwn(object, function(value, key, object2) {
  4501. baseAssignValue(result, iteratee(value, key, object2), value);
  4502. });
  4503. return result;
  4504. }
  4505. function mapValues(object, iteratee) {
  4506. var result = {};
  4507. iteratee = baseIteratee(iteratee);
  4508. baseForOwn(object, function(value, key, object2) {
  4509. baseAssignValue(result, key, iteratee(value, key, object2));
  4510. });
  4511. return result;
  4512. }
  4513. var CLONE_DEEP_FLAG$2 = 1;
  4514. function matches(source) {
  4515. return baseMatches(baseClone(source, CLONE_DEEP_FLAG$2));
  4516. }
  4517. var CLONE_DEEP_FLAG$1 = 1;
  4518. function matchesProperty(path, srcValue) {
  4519. return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG$1));
  4520. }
  4521. function baseExtremum(array, iteratee, comparator) {
  4522. var index = -1, length = array.length;
  4523. while (++index < length) {
  4524. var value = array[index], current = iteratee(value);
  4525. if (current != null && (computed === void 0 ? current === current && !isSymbol(current) : comparator(current, computed))) {
  4526. var computed = current, result = value;
  4527. }
  4528. }
  4529. return result;
  4530. }
  4531. function max$3(array) {
  4532. return array && array.length ? baseExtremum(array, identity, baseGt) : void 0;
  4533. }
  4534. function maxBy(array, iteratee) {
  4535. return array && array.length ? baseExtremum(array, baseIteratee(iteratee), baseGt) : void 0;
  4536. }
  4537. function baseSum(array, iteratee) {
  4538. var result, index = -1, length = array.length;
  4539. while (++index < length) {
  4540. var current = iteratee(array[index]);
  4541. if (current !== void 0) {
  4542. result = result === void 0 ? current : result + current;
  4543. }
  4544. }
  4545. return result;
  4546. }
  4547. var NAN = 0 / 0;
  4548. function baseMean(array, iteratee) {
  4549. var length = array == null ? 0 : array.length;
  4550. return length ? baseSum(array, iteratee) / length : NAN;
  4551. }
  4552. function mean(array) {
  4553. return baseMean(array, identity);
  4554. }
  4555. function meanBy(array, iteratee) {
  4556. return baseMean(array, baseIteratee(iteratee));
  4557. }
  4558. var merge = createAssigner(function(object, source, srcIndex) {
  4559. baseMerge(object, source, srcIndex);
  4560. });
  4561. var method = baseRest(function(path, args) {
  4562. return function(object) {
  4563. return baseInvoke(object, path, args);
  4564. };
  4565. });
  4566. var methodOf = baseRest(function(object, args) {
  4567. return function(path) {
  4568. return baseInvoke(object, path, args);
  4569. };
  4570. });
  4571. function min$3(array) {
  4572. return array && array.length ? baseExtremum(array, identity, baseLt) : void 0;
  4573. }
  4574. function minBy(array, iteratee) {
  4575. return array && array.length ? baseExtremum(array, baseIteratee(iteratee), baseLt) : void 0;
  4576. }
  4577. function mixin$1(object, source, options) {
  4578. var props = keys(source), methodNames = baseFunctions(source, props);
  4579. var chain = !(isObject(options) && "chain" in options) || !!options.chain, isFunc = isFunction(object);
  4580. arrayEach(methodNames, function(methodName) {
  4581. var func = source[methodName];
  4582. object[methodName] = func;
  4583. if (isFunc) {
  4584. object.prototype[methodName] = function() {
  4585. var chainAll = this.__chain__;
  4586. if (chain || chainAll) {
  4587. var result = object(this.__wrapped__), actions = result.__actions__ = copyArray(this.__actions__);
  4588. actions.push({ "func": func, "args": arguments, "thisArg": object });
  4589. result.__chain__ = chainAll;
  4590. return result;
  4591. }
  4592. return func.apply(object, arrayPush([this.value()], arguments));
  4593. };
  4594. }
  4595. });
  4596. return object;
  4597. }
  4598. var multiply = createMathOperation(function(multiplier, multiplicand) {
  4599. return multiplier * multiplicand;
  4600. }, 1);
  4601. var FUNC_ERROR_TEXT$3 = "Expected a function";
  4602. function negate(predicate) {
  4603. if (typeof predicate != "function") {
  4604. throw new TypeError(FUNC_ERROR_TEXT$3);
  4605. }
  4606. return function() {
  4607. var args = arguments;
  4608. switch (args.length) {
  4609. case 0:
  4610. return !predicate.call(this);
  4611. case 1:
  4612. return !predicate.call(this, args[0]);
  4613. case 2:
  4614. return !predicate.call(this, args[0], args[1]);
  4615. case 3:
  4616. return !predicate.call(this, args[0], args[1], args[2]);
  4617. }
  4618. return !predicate.apply(this, args);
  4619. };
  4620. }
  4621. function iteratorToArray(iterator) {
  4622. var data, result = [];
  4623. while (!(data = iterator.next()).done) {
  4624. result.push(data.value);
  4625. }
  4626. return result;
  4627. }
  4628. var mapTag$1 = "[object Map]";
  4629. var setTag$1 = "[object Set]";
  4630. var symIterator$1 = Symbol$1 ? Symbol$1.iterator : void 0;
  4631. function toArray(value) {
  4632. if (!value) {
  4633. return [];
  4634. }
  4635. if (isArrayLike(value)) {
  4636. return isString(value) ? stringToArray(value) : copyArray(value);
  4637. }
  4638. if (symIterator$1 && value[symIterator$1]) {
  4639. return iteratorToArray(value[symIterator$1]());
  4640. }
  4641. var tag = getTag$1(value), func = tag == mapTag$1 ? mapToArray : tag == setTag$1 ? setToArray : values;
  4642. return func(value);
  4643. }
  4644. function wrapperNext() {
  4645. if (this.__values__ === void 0) {
  4646. this.__values__ = toArray(this.value());
  4647. }
  4648. var done = this.__index__ >= this.__values__.length, value = done ? void 0 : this.__values__[this.__index__++];
  4649. return { "done": done, "value": value };
  4650. }
  4651. function baseNth(array, n) {
  4652. var length = array.length;
  4653. if (!length) {
  4654. return;
  4655. }
  4656. n += n < 0 ? length : 0;
  4657. return isIndex(n, length) ? array[n] : void 0;
  4658. }
  4659. function nth(array, n) {
  4660. return array && array.length ? baseNth(array, toInteger(n)) : void 0;
  4661. }
  4662. function nthArg(n) {
  4663. n = toInteger(n);
  4664. return baseRest(function(args) {
  4665. return baseNth(args, n);
  4666. });
  4667. }
  4668. function baseUnset(object, path) {
  4669. path = castPath(path, object);
  4670. object = parent(object, path);
  4671. return object == null || delete object[toKey(last(path))];
  4672. }
  4673. function customOmitClone(value) {
  4674. return isPlainObject(value) ? void 0 : value;
  4675. }
  4676. var CLONE_DEEP_FLAG = 1;
  4677. var CLONE_FLAT_FLAG = 2;
  4678. var CLONE_SYMBOLS_FLAG = 4;
  4679. var omit = flatRest(function(object, paths) {
  4680. var result = {};
  4681. if (object == null) {
  4682. return result;
  4683. }
  4684. var isDeep = false;
  4685. paths = arrayMap(paths, function(path) {
  4686. path = castPath(path, object);
  4687. isDeep || (isDeep = path.length > 1);
  4688. return path;
  4689. });
  4690. copyObject(object, getAllKeysIn(object), result);
  4691. if (isDeep) {
  4692. result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
  4693. }
  4694. var length = paths.length;
  4695. while (length--) {
  4696. baseUnset(result, paths[length]);
  4697. }
  4698. return result;
  4699. });
  4700. function baseSet(object, path, value, customizer) {
  4701. if (!isObject(object)) {
  4702. return object;
  4703. }
  4704. path = castPath(path, object);
  4705. var index = -1, length = path.length, lastIndex = length - 1, nested = object;
  4706. while (nested != null && ++index < length) {
  4707. var key = toKey(path[index]), newValue = value;
  4708. if (key === "__proto__" || key === "constructor" || key === "prototype") {
  4709. return object;
  4710. }
  4711. if (index != lastIndex) {
  4712. var objValue = nested[key];
  4713. newValue = customizer ? customizer(objValue, key, nested) : void 0;
  4714. if (newValue === void 0) {
  4715. newValue = isObject(objValue) ? objValue : isIndex(path[index + 1]) ? [] : {};
  4716. }
  4717. }
  4718. assignValue(nested, key, newValue);
  4719. nested = nested[key];
  4720. }
  4721. return object;
  4722. }
  4723. function basePickBy(object, paths, predicate) {
  4724. var index = -1, length = paths.length, result = {};
  4725. while (++index < length) {
  4726. var path = paths[index], value = baseGet(object, path);
  4727. if (predicate(value, path)) {
  4728. baseSet(result, castPath(path, object), value);
  4729. }
  4730. }
  4731. return result;
  4732. }
  4733. function pickBy(object, predicate) {
  4734. if (object == null) {
  4735. return {};
  4736. }
  4737. var props = arrayMap(getAllKeysIn(object), function(prop) {
  4738. return [prop];
  4739. });
  4740. predicate = baseIteratee(predicate);
  4741. return basePickBy(object, props, function(value, path) {
  4742. return predicate(value, path[0]);
  4743. });
  4744. }
  4745. function omitBy(object, predicate) {
  4746. return pickBy(object, negate(baseIteratee(predicate)));
  4747. }
  4748. function once(func) {
  4749. return before(2, func);
  4750. }
  4751. function baseSortBy(array, comparer) {
  4752. var length = array.length;
  4753. array.sort(comparer);
  4754. while (length--) {
  4755. array[length] = array[length].value;
  4756. }
  4757. return array;
  4758. }
  4759. function compareAscending(value, other) {
  4760. if (value !== other) {
  4761. var valIsDefined = value !== void 0, valIsNull = value === null, valIsReflexive = value === value, valIsSymbol = isSymbol(value);
  4762. var othIsDefined = other !== void 0, othIsNull = other === null, othIsReflexive = other === other, othIsSymbol = isSymbol(other);
  4763. if (!othIsNull && !othIsSymbol && !valIsSymbol && value > other || valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol || valIsNull && othIsDefined && othIsReflexive || !valIsDefined && othIsReflexive || !valIsReflexive) {
  4764. return 1;
  4765. }
  4766. if (!valIsNull && !valIsSymbol && !othIsSymbol && value < other || othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol || othIsNull && valIsDefined && valIsReflexive || !othIsDefined && valIsReflexive || !othIsReflexive) {
  4767. return -1;
  4768. }
  4769. }
  4770. return 0;
  4771. }
  4772. function compareMultiple(object, other, orders) {
  4773. var index = -1, objCriteria = object.criteria, othCriteria = other.criteria, length = objCriteria.length, ordersLength = orders.length;
  4774. while (++index < length) {
  4775. var result = compareAscending(objCriteria[index], othCriteria[index]);
  4776. if (result) {
  4777. if (index >= ordersLength) {
  4778. return result;
  4779. }
  4780. var order = orders[index];
  4781. return result * (order == "desc" ? -1 : 1);
  4782. }
  4783. }
  4784. return object.index - other.index;
  4785. }
  4786. function baseOrderBy(collection, iteratees, orders) {
  4787. if (iteratees.length) {
  4788. iteratees = arrayMap(iteratees, function(iteratee) {
  4789. if (isArray(iteratee)) {
  4790. return function(value) {
  4791. return baseGet(value, iteratee.length === 1 ? iteratee[0] : iteratee);
  4792. };
  4793. }
  4794. return iteratee;
  4795. });
  4796. } else {
  4797. iteratees = [identity];
  4798. }
  4799. var index = -1;
  4800. iteratees = arrayMap(iteratees, baseUnary(baseIteratee));
  4801. var result = baseMap(collection, function(value, key, collection2) {
  4802. var criteria = arrayMap(iteratees, function(iteratee) {
  4803. return iteratee(value);
  4804. });
  4805. return { "criteria": criteria, "index": ++index, "value": value };
  4806. });
  4807. return baseSortBy(result, function(object, other) {
  4808. return compareMultiple(object, other, orders);
  4809. });
  4810. }
  4811. function orderBy$1(collection, iteratees, orders, guard) {
  4812. if (collection == null) {
  4813. return [];
  4814. }
  4815. if (!isArray(iteratees)) {
  4816. iteratees = iteratees == null ? [] : [iteratees];
  4817. }
  4818. orders = guard ? void 0 : orders;
  4819. if (!isArray(orders)) {
  4820. orders = orders == null ? [] : [orders];
  4821. }
  4822. return baseOrderBy(collection, iteratees, orders);
  4823. }
  4824. function createOver(arrayFunc) {
  4825. return flatRest(function(iteratees) {
  4826. iteratees = arrayMap(iteratees, baseUnary(baseIteratee));
  4827. return baseRest(function(args) {
  4828. var thisArg = this;
  4829. return arrayFunc(iteratees, function(iteratee) {
  4830. return apply(iteratee, thisArg, args);
  4831. });
  4832. });
  4833. });
  4834. }
  4835. var over = createOver(arrayMap);
  4836. var castRest = baseRest;
  4837. var nativeMin$6 = Math.min;
  4838. var overArgs = castRest(function(func, transforms) {
  4839. transforms = transforms.length == 1 && isArray(transforms[0]) ? arrayMap(transforms[0], baseUnary(baseIteratee)) : arrayMap(baseFlatten(transforms, 1), baseUnary(baseIteratee));
  4840. var funcsLength = transforms.length;
  4841. return baseRest(function(args) {
  4842. var index = -1, length = nativeMin$6(args.length, funcsLength);
  4843. while (++index < length) {
  4844. args[index] = transforms[index].call(this, args[index]);
  4845. }
  4846. return apply(func, this, args);
  4847. });
  4848. });
  4849. var overEvery = createOver(arrayEvery);
  4850. var overSome = createOver(arraySome);
  4851. var MAX_SAFE_INTEGER$2 = 9007199254740991;
  4852. var nativeFloor$3 = Math.floor;
  4853. function baseRepeat(string, n) {
  4854. var result = "";
  4855. if (!string || n < 1 || n > MAX_SAFE_INTEGER$2) {
  4856. return result;
  4857. }
  4858. do {
  4859. if (n % 2) {
  4860. result += string;
  4861. }
  4862. n = nativeFloor$3(n / 2);
  4863. if (n) {
  4864. string += string;
  4865. }
  4866. } while (n);
  4867. return result;
  4868. }
  4869. var asciiSize = baseProperty("length");
  4870. var rsAstralRange = "\\ud800-\\udfff";
  4871. var rsComboMarksRange = "\\u0300-\\u036f";
  4872. var reComboHalfMarksRange = "\\ufe20-\\ufe2f";
  4873. var rsComboSymbolsRange = "\\u20d0-\\u20ff";
  4874. var rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange;
  4875. var rsVarRange = "\\ufe0e\\ufe0f";
  4876. var rsAstral = "[" + rsAstralRange + "]";
  4877. var rsCombo = "[" + rsComboRange + "]";
  4878. var rsFitz = "\\ud83c[\\udffb-\\udfff]";
  4879. var rsModifier = "(?:" + rsCombo + "|" + rsFitz + ")";
  4880. var rsNonAstral = "[^" + rsAstralRange + "]";
  4881. var rsRegional = "(?:\\ud83c[\\udde6-\\uddff]){2}";
  4882. var rsSurrPair = "[\\ud800-\\udbff][\\udc00-\\udfff]";
  4883. var rsZWJ = "\\u200d";
  4884. var reOptMod = rsModifier + "?";
  4885. var rsOptVar = "[" + rsVarRange + "]?";
  4886. var rsOptJoin = "(?:" + rsZWJ + "(?:" + [rsNonAstral, rsRegional, rsSurrPair].join("|") + ")" + rsOptVar + reOptMod + ")*";
  4887. var rsSeq = rsOptVar + reOptMod + rsOptJoin;
  4888. var rsSymbol = "(?:" + [rsNonAstral + rsCombo + "?", rsCombo, rsRegional, rsSurrPair, rsAstral].join("|") + ")";
  4889. var reUnicode = RegExp(rsFitz + "(?=" + rsFitz + ")|" + rsSymbol + rsSeq, "g");
  4890. function unicodeSize(string) {
  4891. var result = reUnicode.lastIndex = 0;
  4892. while (reUnicode.test(string)) {
  4893. ++result;
  4894. }
  4895. return result;
  4896. }
  4897. function stringSize(string) {
  4898. return hasUnicode(string) ? unicodeSize(string) : asciiSize(string);
  4899. }
  4900. var nativeCeil$2 = Math.ceil;
  4901. function createPadding(length, chars) {
  4902. chars = chars === void 0 ? " " : baseToString(chars);
  4903. var charsLength = chars.length;
  4904. if (charsLength < 2) {
  4905. return charsLength ? baseRepeat(chars, length) : chars;
  4906. }
  4907. var result = baseRepeat(chars, nativeCeil$2(length / stringSize(chars)));
  4908. return hasUnicode(chars) ? castSlice(stringToArray(result), 0, length).join("") : result.slice(0, length);
  4909. }
  4910. var nativeCeil$1 = Math.ceil;
  4911. var nativeFloor$2 = Math.floor;
  4912. function pad(string, length, chars) {
  4913. string = toString(string);
  4914. length = toInteger(length);
  4915. var strLength = length ? stringSize(string) : 0;
  4916. if (!length || strLength >= length) {
  4917. return string;
  4918. }
  4919. var mid = (length - strLength) / 2;
  4920. return createPadding(nativeFloor$2(mid), chars) + string + createPadding(nativeCeil$1(mid), chars);
  4921. }
  4922. function padEnd(string, length, chars) {
  4923. string = toString(string);
  4924. length = toInteger(length);
  4925. var strLength = length ? stringSize(string) : 0;
  4926. return length && strLength < length ? string + createPadding(length - strLength, chars) : string;
  4927. }
  4928. function padStart(string, length, chars) {
  4929. string = toString(string);
  4930. length = toInteger(length);
  4931. var strLength = length ? stringSize(string) : 0;
  4932. return length && strLength < length ? createPadding(length - strLength, chars) + string : string;
  4933. }
  4934. var reTrimStart$1 = /^\s+/;
  4935. var nativeParseInt = root.parseInt;
  4936. function parseInt$1(string, radix, guard) {
  4937. if (guard || radix == null) {
  4938. radix = 0;
  4939. } else if (radix) {
  4940. radix = +radix;
  4941. }
  4942. return nativeParseInt(toString(string).replace(reTrimStart$1, ""), radix || 0);
  4943. }
  4944. var WRAP_PARTIAL_FLAG = 32;
  4945. var partial = baseRest(function(func, partials) {
  4946. var holders = replaceHolders(partials, getHolder(partial));
  4947. return createWrap(func, WRAP_PARTIAL_FLAG, void 0, partials, holders);
  4948. });
  4949. partial.placeholder = {};
  4950. var WRAP_PARTIAL_RIGHT_FLAG = 64;
  4951. var partialRight = baseRest(function(func, partials) {
  4952. var holders = replaceHolders(partials, getHolder(partialRight));
  4953. return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, void 0, partials, holders);
  4954. });
  4955. partialRight.placeholder = {};
  4956. var partition = createAggregator(function(result, value, key) {
  4957. result[key ? 0 : 1].push(value);
  4958. }, function() {
  4959. return [[], []];
  4960. });
  4961. function basePick(object, paths) {
  4962. return basePickBy(object, paths, function(value, path) {
  4963. return hasIn(object, path);
  4964. });
  4965. }
  4966. var pick = flatRest(function(object, paths) {
  4967. return object == null ? {} : basePick(object, paths);
  4968. });
  4969. function wrapperPlant(value) {
  4970. var result, parent = this;
  4971. while (parent instanceof baseLodash) {
  4972. var clone = wrapperClone(parent);
  4973. clone.__index__ = 0;
  4974. clone.__values__ = void 0;
  4975. if (result) {
  4976. previous.__wrapped__ = clone;
  4977. } else {
  4978. result = clone;
  4979. }
  4980. var previous = clone;
  4981. parent = parent.__wrapped__;
  4982. }
  4983. previous.__wrapped__ = value;
  4984. return result;
  4985. }
  4986. function propertyOf(object) {
  4987. return function(path) {
  4988. return object == null ? void 0 : baseGet(object, path);
  4989. };
  4990. }
  4991. function baseIndexOfWith(array, value, fromIndex, comparator) {
  4992. var index = fromIndex - 1, length = array.length;
  4993. while (++index < length) {
  4994. if (comparator(array[index], value)) {
  4995. return index;
  4996. }
  4997. }
  4998. return -1;
  4999. }
  5000. var arrayProto$3 = Array.prototype;
  5001. var splice$1 = arrayProto$3.splice;
  5002. function basePullAll(array, values, iteratee, comparator) {
  5003. var indexOf = comparator ? baseIndexOfWith : baseIndexOf, index = -1, length = values.length, seen = array;
  5004. if (array === values) {
  5005. values = copyArray(values);
  5006. }
  5007. if (iteratee) {
  5008. seen = arrayMap(array, baseUnary(iteratee));
  5009. }
  5010. while (++index < length) {
  5011. var fromIndex = 0, value = values[index], computed = iteratee ? iteratee(value) : value;
  5012. while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
  5013. if (seen !== array) {
  5014. splice$1.call(seen, fromIndex, 1);
  5015. }
  5016. splice$1.call(array, fromIndex, 1);
  5017. }
  5018. }
  5019. return array;
  5020. }
  5021. function pullAll(array, values) {
  5022. return array && array.length && values && values.length ? basePullAll(array, values) : array;
  5023. }
  5024. var pull = baseRest(pullAll);
  5025. function pullAllBy(array, values, iteratee) {
  5026. return array && array.length && values && values.length ? basePullAll(array, values, baseIteratee(iteratee)) : array;
  5027. }
  5028. function pullAllWith(array, values, comparator) {
  5029. return array && array.length && values && values.length ? basePullAll(array, values, void 0, comparator) : array;
  5030. }
  5031. var arrayProto$2 = Array.prototype;
  5032. var splice = arrayProto$2.splice;
  5033. function basePullAt(array, indexes) {
  5034. var length = array ? indexes.length : 0, lastIndex = length - 1;
  5035. while (length--) {
  5036. var index = indexes[length];
  5037. if (length == lastIndex || index !== previous) {
  5038. var previous = index;
  5039. if (isIndex(index)) {
  5040. splice.call(array, index, 1);
  5041. } else {
  5042. baseUnset(array, index);
  5043. }
  5044. }
  5045. }
  5046. return array;
  5047. }
  5048. var pullAt = flatRest(function(array, indexes) {
  5049. var length = array == null ? 0 : array.length, result = baseAt(array, indexes);
  5050. basePullAt(array, arrayMap(indexes, function(index) {
  5051. return isIndex(index, length) ? +index : index;
  5052. }).sort(compareAscending));
  5053. return result;
  5054. });
  5055. var nativeFloor$1 = Math.floor;
  5056. var nativeRandom$1 = Math.random;
  5057. function baseRandom(lower, upper) {
  5058. return lower + nativeFloor$1(nativeRandom$1() * (upper - lower + 1));
  5059. }
  5060. var freeParseFloat = parseFloat;
  5061. var nativeMin$5 = Math.min;
  5062. var nativeRandom = Math.random;
  5063. function random(lower, upper, floating) {
  5064. if (floating && typeof floating != "boolean" && isIterateeCall(lower, upper, floating)) {
  5065. upper = floating = void 0;
  5066. }
  5067. if (floating === void 0) {
  5068. if (typeof upper == "boolean") {
  5069. floating = upper;
  5070. upper = void 0;
  5071. } else if (typeof lower == "boolean") {
  5072. floating = lower;
  5073. lower = void 0;
  5074. }
  5075. }
  5076. if (lower === void 0 && upper === void 0) {
  5077. lower = 0;
  5078. upper = 1;
  5079. } else {
  5080. lower = toFinite(lower);
  5081. if (upper === void 0) {
  5082. upper = lower;
  5083. lower = 0;
  5084. } else {
  5085. upper = toFinite(upper);
  5086. }
  5087. }
  5088. if (lower > upper) {
  5089. var temp = lower;
  5090. lower = upper;
  5091. upper = temp;
  5092. }
  5093. if (floating || lower % 1 || upper % 1) {
  5094. var rand = nativeRandom();
  5095. return nativeMin$5(lower + rand * (upper - lower + freeParseFloat("1e-" + ((rand + "").length - 1))), upper);
  5096. }
  5097. return baseRandom(lower, upper);
  5098. }
  5099. var nativeCeil = Math.ceil;
  5100. var nativeMax$4 = Math.max;
  5101. function baseRange(start, end, step, fromRight) {
  5102. var index = -1, length = nativeMax$4(nativeCeil((end - start) / (step || 1)), 0), result = Array(length);
  5103. while (length--) {
  5104. result[fromRight ? length : ++index] = start;
  5105. start += step;
  5106. }
  5107. return result;
  5108. }
  5109. function createRange(fromRight) {
  5110. return function(start, end, step) {
  5111. if (step && typeof step != "number" && isIterateeCall(start, end, step)) {
  5112. end = step = void 0;
  5113. }
  5114. start = toFinite(start);
  5115. if (end === void 0) {
  5116. end = start;
  5117. start = 0;
  5118. } else {
  5119. end = toFinite(end);
  5120. }
  5121. step = step === void 0 ? start < end ? 1 : -1 : toFinite(step);
  5122. return baseRange(start, end, step, fromRight);
  5123. };
  5124. }
  5125. var range$1 = createRange();
  5126. var rangeRight = createRange(true);
  5127. var WRAP_REARG_FLAG = 256;
  5128. var rearg = flatRest(function(func, indexes) {
  5129. return createWrap(func, WRAP_REARG_FLAG, void 0, void 0, void 0, indexes);
  5130. });
  5131. function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
  5132. eachFunc(collection, function(value, index, collection2) {
  5133. accumulator = initAccum ? (initAccum = false, value) : iteratee(accumulator, value, index, collection2);
  5134. });
  5135. return accumulator;
  5136. }
  5137. function reduce(collection, iteratee, accumulator) {
  5138. var func = isArray(collection) ? arrayReduce : baseReduce, initAccum = arguments.length < 3;
  5139. return func(collection, baseIteratee(iteratee), accumulator, initAccum, baseEach);
  5140. }
  5141. function arrayReduceRight(array, iteratee, accumulator, initAccum) {
  5142. var length = array == null ? 0 : array.length;
  5143. if (initAccum && length) {
  5144. accumulator = array[--length];
  5145. }
  5146. while (length--) {
  5147. accumulator = iteratee(accumulator, array[length], length, array);
  5148. }
  5149. return accumulator;
  5150. }
  5151. function reduceRight(collection, iteratee, accumulator) {
  5152. var func = isArray(collection) ? arrayReduceRight : baseReduce, initAccum = arguments.length < 3;
  5153. return func(collection, baseIteratee(iteratee), accumulator, initAccum, baseEachRight);
  5154. }
  5155. function reject(collection, predicate) {
  5156. var func = isArray(collection) ? arrayFilter : baseFilter;
  5157. return func(collection, negate(baseIteratee(predicate)));
  5158. }
  5159. function remove(array, predicate) {
  5160. var result = [];
  5161. if (!(array && array.length)) {
  5162. return result;
  5163. }
  5164. var index = -1, indexes = [], length = array.length;
  5165. predicate = baseIteratee(predicate);
  5166. while (++index < length) {
  5167. var value = array[index];
  5168. if (predicate(value, index, array)) {
  5169. result.push(value);
  5170. indexes.push(index);
  5171. }
  5172. }
  5173. basePullAt(array, indexes);
  5174. return result;
  5175. }
  5176. function repeat(string, n, guard) {
  5177. if (guard ? isIterateeCall(string, n, guard) : n === void 0) {
  5178. n = 1;
  5179. } else {
  5180. n = toInteger(n);
  5181. }
  5182. return baseRepeat(toString(string), n);
  5183. }
  5184. function replace() {
  5185. var args = arguments, string = toString(args[0]);
  5186. return args.length < 3 ? string : string.replace(args[1], args[2]);
  5187. }
  5188. var FUNC_ERROR_TEXT$2 = "Expected a function";
  5189. function rest(func, start) {
  5190. if (typeof func != "function") {
  5191. throw new TypeError(FUNC_ERROR_TEXT$2);
  5192. }
  5193. start = start === void 0 ? start : toInteger(start);
  5194. return baseRest(func, start);
  5195. }
  5196. function result(object, path, defaultValue) {
  5197. path = castPath(path, object);
  5198. var index = -1, length = path.length;
  5199. if (!length) {
  5200. length = 1;
  5201. object = void 0;
  5202. }
  5203. while (++index < length) {
  5204. var value = object == null ? void 0 : object[toKey(path[index])];
  5205. if (value === void 0) {
  5206. index = length;
  5207. value = defaultValue;
  5208. }
  5209. object = isFunction(value) ? value.call(object) : value;
  5210. }
  5211. return object;
  5212. }
  5213. var arrayProto$1 = Array.prototype;
  5214. var nativeReverse = arrayProto$1.reverse;
  5215. function reverse(array) {
  5216. return array == null ? array : nativeReverse.call(array);
  5217. }
  5218. var round$1 = createRound("round");
  5219. function arraySample(array) {
  5220. var length = array.length;
  5221. return length ? array[baseRandom(0, length - 1)] : void 0;
  5222. }
  5223. function baseSample(collection) {
  5224. return arraySample(values(collection));
  5225. }
  5226. function sample(collection) {
  5227. var func = isArray(collection) ? arraySample : baseSample;
  5228. return func(collection);
  5229. }
  5230. function shuffleSelf(array, size) {
  5231. var index = -1, length = array.length, lastIndex = length - 1;
  5232. size = size === void 0 ? length : size;
  5233. while (++index < size) {
  5234. var rand = baseRandom(index, lastIndex), value = array[rand];
  5235. array[rand] = array[index];
  5236. array[index] = value;
  5237. }
  5238. array.length = size;
  5239. return array;
  5240. }
  5241. function arraySampleSize(array, n) {
  5242. return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
  5243. }
  5244. function baseSampleSize(collection, n) {
  5245. var array = values(collection);
  5246. return shuffleSelf(array, baseClamp(n, 0, array.length));
  5247. }
  5248. function sampleSize(collection, n, guard) {
  5249. if (guard ? isIterateeCall(collection, n, guard) : n === void 0) {
  5250. n = 1;
  5251. } else {
  5252. n = toInteger(n);
  5253. }
  5254. var func = isArray(collection) ? arraySampleSize : baseSampleSize;
  5255. return func(collection, n);
  5256. }
  5257. function set(object, path, value) {
  5258. return object == null ? object : baseSet(object, path, value);
  5259. }
  5260. function setWith(object, path, value, customizer) {
  5261. customizer = typeof customizer == "function" ? customizer : void 0;
  5262. return object == null ? object : baseSet(object, path, value, customizer);
  5263. }
  5264. function arrayShuffle(array) {
  5265. return shuffleSelf(copyArray(array));
  5266. }
  5267. function baseShuffle(collection) {
  5268. return shuffleSelf(values(collection));
  5269. }
  5270. function shuffle(collection) {
  5271. var func = isArray(collection) ? arrayShuffle : baseShuffle;
  5272. return func(collection);
  5273. }
  5274. var mapTag = "[object Map]";
  5275. var setTag = "[object Set]";
  5276. function size(collection) {
  5277. if (collection == null) {
  5278. return 0;
  5279. }
  5280. if (isArrayLike(collection)) {
  5281. return isString(collection) ? stringSize(collection) : collection.length;
  5282. }
  5283. var tag = getTag$1(collection);
  5284. if (tag == mapTag || tag == setTag) {
  5285. return collection.size;
  5286. }
  5287. return baseKeys(collection).length;
  5288. }
  5289. function slice(array, start, end) {
  5290. var length = array == null ? 0 : array.length;
  5291. if (!length) {
  5292. return [];
  5293. }
  5294. if (end && typeof end != "number" && isIterateeCall(array, start, end)) {
  5295. start = 0;
  5296. end = length;
  5297. } else {
  5298. start = start == null ? 0 : toInteger(start);
  5299. end = end === void 0 ? length : toInteger(end);
  5300. }
  5301. return baseSlice(array, start, end);
  5302. }
  5303. var snakeCase = createCompounder(function(result, word, index) {
  5304. return result + (index ? "_" : "") + word.toLowerCase();
  5305. });
  5306. function baseSome(collection, predicate) {
  5307. var result;
  5308. baseEach(collection, function(value, index, collection2) {
  5309. result = predicate(value, index, collection2);
  5310. return !result;
  5311. });
  5312. return !!result;
  5313. }
  5314. function some(collection, predicate, guard) {
  5315. var func = isArray(collection) ? arraySome : baseSome;
  5316. if (guard && isIterateeCall(collection, predicate, guard)) {
  5317. predicate = void 0;
  5318. }
  5319. return func(collection, baseIteratee(predicate));
  5320. }
  5321. var sortBy = baseRest(function(collection, iteratees) {
  5322. if (collection == null) {
  5323. return [];
  5324. }
  5325. var length = iteratees.length;
  5326. if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
  5327. iteratees = [];
  5328. } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
  5329. iteratees = [iteratees[0]];
  5330. }
  5331. return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
  5332. });
  5333. var MAX_ARRAY_LENGTH$4 = 4294967295;
  5334. var MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH$4 - 1;
  5335. var nativeFloor = Math.floor;
  5336. var nativeMin$4 = Math.min;
  5337. function baseSortedIndexBy(array, value, iteratee, retHighest) {
  5338. var low = 0, high = array == null ? 0 : array.length;
  5339. if (high === 0) {
  5340. return 0;
  5341. }
  5342. value = iteratee(value);
  5343. var valIsNaN = value !== value, valIsNull = value === null, valIsSymbol = isSymbol(value), valIsUndefined = value === void 0;
  5344. while (low < high) {
  5345. var mid = nativeFloor((low + high) / 2), computed = iteratee(array[mid]), othIsDefined = computed !== void 0, othIsNull = computed === null, othIsReflexive = computed === computed, othIsSymbol = isSymbol(computed);
  5346. if (valIsNaN) {
  5347. var setLow = retHighest || othIsReflexive;
  5348. } else if (valIsUndefined) {
  5349. setLow = othIsReflexive && (retHighest || othIsDefined);
  5350. } else if (valIsNull) {
  5351. setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
  5352. } else if (valIsSymbol) {
  5353. setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
  5354. } else if (othIsNull || othIsSymbol) {
  5355. setLow = false;
  5356. } else {
  5357. setLow = retHighest ? computed <= value : computed < value;
  5358. }
  5359. if (setLow) {
  5360. low = mid + 1;
  5361. } else {
  5362. high = mid;
  5363. }
  5364. }
  5365. return nativeMin$4(high, MAX_ARRAY_INDEX);
  5366. }
  5367. var MAX_ARRAY_LENGTH$3 = 4294967295;
  5368. var HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH$3 >>> 1;
  5369. function baseSortedIndex(array, value, retHighest) {
  5370. var low = 0, high = array == null ? low : array.length;
  5371. if (typeof value == "number" && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
  5372. while (low < high) {
  5373. var mid = low + high >>> 1, computed = array[mid];
  5374. if (computed !== null && !isSymbol(computed) && (retHighest ? computed <= value : computed < value)) {
  5375. low = mid + 1;
  5376. } else {
  5377. high = mid;
  5378. }
  5379. }
  5380. return high;
  5381. }
  5382. return baseSortedIndexBy(array, value, identity, retHighest);
  5383. }
  5384. function sortedIndex(array, value) {
  5385. return baseSortedIndex(array, value);
  5386. }
  5387. function sortedIndexBy(array, value, iteratee) {
  5388. return baseSortedIndexBy(array, value, baseIteratee(iteratee));
  5389. }
  5390. function sortedIndexOf(array, value) {
  5391. var length = array == null ? 0 : array.length;
  5392. if (length) {
  5393. var index = baseSortedIndex(array, value);
  5394. if (index < length && eq(array[index], value)) {
  5395. return index;
  5396. }
  5397. }
  5398. return -1;
  5399. }
  5400. function sortedLastIndex(array, value) {
  5401. return baseSortedIndex(array, value, true);
  5402. }
  5403. function sortedLastIndexBy(array, value, iteratee) {
  5404. return baseSortedIndexBy(array, value, baseIteratee(iteratee), true);
  5405. }
  5406. function sortedLastIndexOf(array, value) {
  5407. var length = array == null ? 0 : array.length;
  5408. if (length) {
  5409. var index = baseSortedIndex(array, value, true) - 1;
  5410. if (eq(array[index], value)) {
  5411. return index;
  5412. }
  5413. }
  5414. return -1;
  5415. }
  5416. function baseSortedUniq(array, iteratee) {
  5417. var index = -1, length = array.length, resIndex = 0, result = [];
  5418. while (++index < length) {
  5419. var value = array[index], computed = iteratee ? iteratee(value) : value;
  5420. if (!index || !eq(computed, seen)) {
  5421. var seen = computed;
  5422. result[resIndex++] = value === 0 ? 0 : value;
  5423. }
  5424. }
  5425. return result;
  5426. }
  5427. function sortedUniq(array) {
  5428. return array && array.length ? baseSortedUniq(array) : [];
  5429. }
  5430. function sortedUniqBy(array, iteratee) {
  5431. return array && array.length ? baseSortedUniq(array, baseIteratee(iteratee)) : [];
  5432. }
  5433. var MAX_ARRAY_LENGTH$2 = 4294967295;
  5434. function split(string, separator, limit) {
  5435. if (limit && typeof limit != "number" && isIterateeCall(string, separator, limit)) {
  5436. separator = limit = void 0;
  5437. }
  5438. limit = limit === void 0 ? MAX_ARRAY_LENGTH$2 : limit >>> 0;
  5439. if (!limit) {
  5440. return [];
  5441. }
  5442. string = toString(string);
  5443. if (string && (typeof separator == "string" || separator != null && !isRegExp(separator))) {
  5444. separator = baseToString(separator);
  5445. if (!separator && hasUnicode(string)) {
  5446. return castSlice(stringToArray(string), 0, limit);
  5447. }
  5448. }
  5449. return string.split(separator, limit);
  5450. }
  5451. var FUNC_ERROR_TEXT$1 = "Expected a function";
  5452. var nativeMax$3 = Math.max;
  5453. function spread(func, start) {
  5454. if (typeof func != "function") {
  5455. throw new TypeError(FUNC_ERROR_TEXT$1);
  5456. }
  5457. start = start == null ? 0 : nativeMax$3(toInteger(start), 0);
  5458. return baseRest(function(args) {
  5459. var array = args[start], otherArgs = castSlice(args, 0, start);
  5460. if (array) {
  5461. arrayPush(otherArgs, array);
  5462. }
  5463. return apply(func, this, otherArgs);
  5464. });
  5465. }
  5466. var startCase = createCompounder(function(result, word, index) {
  5467. return result + (index ? " " : "") + upperFirst(word);
  5468. });
  5469. function startsWith(string, target, position) {
  5470. string = toString(string);
  5471. position = position == null ? 0 : baseClamp(toInteger(position), 0, string.length);
  5472. target = baseToString(target);
  5473. return string.slice(position, position + target.length) == target;
  5474. }
  5475. function stubObject() {
  5476. return {};
  5477. }
  5478. function stubString() {
  5479. return "";
  5480. }
  5481. function stubTrue() {
  5482. return true;
  5483. }
  5484. var subtract = createMathOperation(function(minuend, subtrahend) {
  5485. return minuend - subtrahend;
  5486. }, 0);
  5487. function sum$1(array) {
  5488. return array && array.length ? baseSum(array, identity) : 0;
  5489. }
  5490. function sumBy(array, iteratee) {
  5491. return array && array.length ? baseSum(array, baseIteratee(iteratee)) : 0;
  5492. }
  5493. function tail(array) {
  5494. var length = array == null ? 0 : array.length;
  5495. return length ? baseSlice(array, 1, length) : [];
  5496. }
  5497. function take(array, n, guard) {
  5498. if (!(array && array.length)) {
  5499. return [];
  5500. }
  5501. n = guard || n === void 0 ? 1 : toInteger(n);
  5502. return baseSlice(array, 0, n < 0 ? 0 : n);
  5503. }
  5504. function takeRight(array, n, guard) {
  5505. var length = array == null ? 0 : array.length;
  5506. if (!length) {
  5507. return [];
  5508. }
  5509. n = guard || n === void 0 ? 1 : toInteger(n);
  5510. n = length - n;
  5511. return baseSlice(array, n < 0 ? 0 : n, length);
  5512. }
  5513. function takeRightWhile(array, predicate) {
  5514. return array && array.length ? baseWhile(array, baseIteratee(predicate), false, true) : [];
  5515. }
  5516. function takeWhile(array, predicate) {
  5517. return array && array.length ? baseWhile(array, baseIteratee(predicate)) : [];
  5518. }
  5519. function tap(value, interceptor) {
  5520. interceptor(value);
  5521. return value;
  5522. }
  5523. var objectProto$2 = Object.prototype;
  5524. var hasOwnProperty$2 = objectProto$2.hasOwnProperty;
  5525. function customDefaultsAssignIn(objValue, srcValue, key, object) {
  5526. if (objValue === void 0 || eq(objValue, objectProto$2[key]) && !hasOwnProperty$2.call(object, key)) {
  5527. return srcValue;
  5528. }
  5529. return objValue;
  5530. }
  5531. var stringEscapes = {
  5532. "\\": "\\",
  5533. "'": "'",
  5534. "\n": "n",
  5535. "\r": "r",
  5536. "\u2028": "u2028",
  5537. "\u2029": "u2029"
  5538. };
  5539. function escapeStringChar(chr) {
  5540. return "\\" + stringEscapes[chr];
  5541. }
  5542. var reInterpolate = /<%=([\s\S]+?)%>/g;
  5543. var reEscape = /<%-([\s\S]+?)%>/g;
  5544. var reEvaluate = /<%([\s\S]+?)%>/g;
  5545. var templateSettings = {
  5546. "escape": reEscape,
  5547. "evaluate": reEvaluate,
  5548. "interpolate": reInterpolate,
  5549. "variable": "",
  5550. "imports": {
  5551. "_": { "escape": escape }
  5552. }
  5553. };
  5554. var INVALID_TEMPL_VAR_ERROR_TEXT = "Invalid `variable` option passed into `_.template`";
  5555. var reEmptyStringLeading = /\b__p \+= '';/g;
  5556. var reEmptyStringMiddle = /\b(__p \+=) '' \+/g;
  5557. var reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
  5558. var reForbiddenIdentifierChars = /[()=,{}\[\]\/\s]/;
  5559. var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
  5560. var reNoMatch = /($^)/;
  5561. var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
  5562. var objectProto$1 = Object.prototype;
  5563. var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
  5564. function template(string, options, guard) {
  5565. var settings = templateSettings.imports._.templateSettings || templateSettings;
  5566. if (guard && isIterateeCall(string, options, guard)) {
  5567. options = void 0;
  5568. }
  5569. string = toString(string);
  5570. options = assignInWith({}, options, settings, customDefaultsAssignIn);
  5571. var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn), importsKeys = keys(imports), importsValues = baseValues(imports, importsKeys);
  5572. var isEscaping, isEvaluating, index = 0, interpolate = options.interpolate || reNoMatch, source = "__p += '";
  5573. var reDelimiters = RegExp((options.escape || reNoMatch).source + "|" + interpolate.source + "|" + (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + "|" + (options.evaluate || reNoMatch).source + "|$", "g");
  5574. var sourceURL = hasOwnProperty$1.call(options, "sourceURL") ? "//# sourceURL=" + (options.sourceURL + "").replace(/\s/g, " ") + "\n" : "";
  5575. string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
  5576. interpolateValue || (interpolateValue = esTemplateValue);
  5577. source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
  5578. if (escapeValue) {
  5579. isEscaping = true;
  5580. source += "' +\n__e(" + escapeValue + ") +\n'";
  5581. }
  5582. if (evaluateValue) {
  5583. isEvaluating = true;
  5584. source += "';\n" + evaluateValue + ";\n__p += '";
  5585. }
  5586. if (interpolateValue) {
  5587. source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
  5588. }
  5589. index = offset + match.length;
  5590. return match;
  5591. });
  5592. source += "';\n";
  5593. var variable = hasOwnProperty$1.call(options, "variable") && options.variable;
  5594. if (!variable) {
  5595. source = "with (obj) {\n" + source + "\n}\n";
  5596. } else if (reForbiddenIdentifierChars.test(variable)) {
  5597. throw new Error(INVALID_TEMPL_VAR_ERROR_TEXT);
  5598. }
  5599. source = (isEvaluating ? source.replace(reEmptyStringLeading, "") : source).replace(reEmptyStringMiddle, "$1").replace(reEmptyStringTrailing, "$1;");
  5600. 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}";
  5601. var result = attempt(function() {
  5602. return Function(importsKeys, sourceURL + "return " + source).apply(void 0, importsValues);
  5603. });
  5604. result.source = source;
  5605. if (isError(result)) {
  5606. throw result;
  5607. }
  5608. return result;
  5609. }
  5610. var FUNC_ERROR_TEXT = "Expected a function";
  5611. function throttle(func, wait, options) {
  5612. var leading = true, trailing = true;
  5613. if (typeof func != "function") {
  5614. throw new TypeError(FUNC_ERROR_TEXT);
  5615. }
  5616. if (isObject(options)) {
  5617. leading = "leading" in options ? !!options.leading : leading;
  5618. trailing = "trailing" in options ? !!options.trailing : trailing;
  5619. }
  5620. return debounce(func, wait, {
  5621. "leading": leading,
  5622. "maxWait": wait,
  5623. "trailing": trailing
  5624. });
  5625. }
  5626. function thru(value, interceptor) {
  5627. return interceptor(value);
  5628. }
  5629. var MAX_SAFE_INTEGER$1 = 9007199254740991;
  5630. var MAX_ARRAY_LENGTH$1 = 4294967295;
  5631. var nativeMin$3 = Math.min;
  5632. function times(n, iteratee) {
  5633. n = toInteger(n);
  5634. if (n < 1 || n > MAX_SAFE_INTEGER$1) {
  5635. return [];
  5636. }
  5637. var index = MAX_ARRAY_LENGTH$1, length = nativeMin$3(n, MAX_ARRAY_LENGTH$1);
  5638. iteratee = castFunction(iteratee);
  5639. n -= MAX_ARRAY_LENGTH$1;
  5640. var result = baseTimes(length, iteratee);
  5641. while (++index < n) {
  5642. iteratee(index);
  5643. }
  5644. return result;
  5645. }
  5646. function wrapperToIterator() {
  5647. return this;
  5648. }
  5649. function baseWrapperValue(value, actions) {
  5650. var result = value;
  5651. if (result instanceof LazyWrapper) {
  5652. result = result.value();
  5653. }
  5654. return arrayReduce(actions, function(result2, action) {
  5655. return action.func.apply(action.thisArg, arrayPush([result2], action.args));
  5656. }, result);
  5657. }
  5658. function wrapperValue() {
  5659. return baseWrapperValue(this.__wrapped__, this.__actions__);
  5660. }
  5661. function toLower(value) {
  5662. return toString(value).toLowerCase();
  5663. }
  5664. function toPath(value) {
  5665. if (isArray(value)) {
  5666. return arrayMap(value, toKey);
  5667. }
  5668. return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));
  5669. }
  5670. var MAX_SAFE_INTEGER = 9007199254740991;
  5671. function toSafeInteger(value) {
  5672. return value ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER) : value === 0 ? value : 0;
  5673. }
  5674. function toUpper(value) {
  5675. return toString(value).toUpperCase();
  5676. }
  5677. function transform(object, iteratee, accumulator) {
  5678. var isArr = isArray(object), isArrLike = isArr || isBuffer(object) || isTypedArray(object);
  5679. iteratee = baseIteratee(iteratee);
  5680. if (accumulator == null) {
  5681. var Ctor = object && object.constructor;
  5682. if (isArrLike) {
  5683. accumulator = isArr ? new Ctor() : [];
  5684. } else if (isObject(object)) {
  5685. accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
  5686. } else {
  5687. accumulator = {};
  5688. }
  5689. }
  5690. (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object2) {
  5691. return iteratee(accumulator, value, index, object2);
  5692. });
  5693. return accumulator;
  5694. }
  5695. function charsEndIndex(strSymbols, chrSymbols) {
  5696. var index = strSymbols.length;
  5697. while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {
  5698. }
  5699. return index;
  5700. }
  5701. function charsStartIndex(strSymbols, chrSymbols) {
  5702. var index = -1, length = strSymbols.length;
  5703. while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {
  5704. }
  5705. return index;
  5706. }
  5707. function trim(string, chars, guard) {
  5708. string = toString(string);
  5709. if (string && (guard || chars === void 0)) {
  5710. return baseTrim(string);
  5711. }
  5712. if (!string || !(chars = baseToString(chars))) {
  5713. return string;
  5714. }
  5715. var strSymbols = stringToArray(string), chrSymbols = stringToArray(chars), start = charsStartIndex(strSymbols, chrSymbols), end = charsEndIndex(strSymbols, chrSymbols) + 1;
  5716. return castSlice(strSymbols, start, end).join("");
  5717. }
  5718. function trimEnd(string, chars, guard) {
  5719. string = toString(string);
  5720. if (string && (guard || chars === void 0)) {
  5721. return string.slice(0, trimmedEndIndex(string) + 1);
  5722. }
  5723. if (!string || !(chars = baseToString(chars))) {
  5724. return string;
  5725. }
  5726. var strSymbols = stringToArray(string), end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
  5727. return castSlice(strSymbols, 0, end).join("");
  5728. }
  5729. var reTrimStart = /^\s+/;
  5730. function trimStart(string, chars, guard) {
  5731. string = toString(string);
  5732. if (string && (guard || chars === void 0)) {
  5733. return string.replace(reTrimStart, "");
  5734. }
  5735. if (!string || !(chars = baseToString(chars))) {
  5736. return string;
  5737. }
  5738. var strSymbols = stringToArray(string), start = charsStartIndex(strSymbols, stringToArray(chars));
  5739. return castSlice(strSymbols, start).join("");
  5740. }
  5741. var DEFAULT_TRUNC_LENGTH = 30;
  5742. var DEFAULT_TRUNC_OMISSION = "...";
  5743. var reFlags = /\w*$/;
  5744. function truncate(string, options) {
  5745. var length = DEFAULT_TRUNC_LENGTH, omission = DEFAULT_TRUNC_OMISSION;
  5746. if (isObject(options)) {
  5747. var separator = "separator" in options ? options.separator : separator;
  5748. length = "length" in options ? toInteger(options.length) : length;
  5749. omission = "omission" in options ? baseToString(options.omission) : omission;
  5750. }
  5751. string = toString(string);
  5752. var strLength = string.length;
  5753. if (hasUnicode(string)) {
  5754. var strSymbols = stringToArray(string);
  5755. strLength = strSymbols.length;
  5756. }
  5757. if (length >= strLength) {
  5758. return string;
  5759. }
  5760. var end = length - stringSize(omission);
  5761. if (end < 1) {
  5762. return omission;
  5763. }
  5764. var result = strSymbols ? castSlice(strSymbols, 0, end).join("") : string.slice(0, end);
  5765. if (separator === void 0) {
  5766. return result + omission;
  5767. }
  5768. if (strSymbols) {
  5769. end += result.length - end;
  5770. }
  5771. if (isRegExp(separator)) {
  5772. if (string.slice(end).search(separator)) {
  5773. var match, substring = result;
  5774. if (!separator.global) {
  5775. separator = RegExp(separator.source, toString(reFlags.exec(separator)) + "g");
  5776. }
  5777. separator.lastIndex = 0;
  5778. while (match = separator.exec(substring)) {
  5779. var newEnd = match.index;
  5780. }
  5781. result = result.slice(0, newEnd === void 0 ? end : newEnd);
  5782. }
  5783. } else if (string.indexOf(baseToString(separator), end) != end) {
  5784. var index = result.lastIndexOf(separator);
  5785. if (index > -1) {
  5786. result = result.slice(0, index);
  5787. }
  5788. }
  5789. return result + omission;
  5790. }
  5791. function unary(func) {
  5792. return ary(func, 1);
  5793. }
  5794. var htmlUnescapes = {
  5795. "&amp;": "&",
  5796. "&lt;": "<",
  5797. "&gt;": ">",
  5798. "&quot;": '"',
  5799. "&#39;": "'"
  5800. };
  5801. var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
  5802. var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g;
  5803. var reHasEscapedHtml = RegExp(reEscapedHtml.source);
  5804. function unescape(string) {
  5805. string = toString(string);
  5806. return string && reHasEscapedHtml.test(string) ? string.replace(reEscapedHtml, unescapeHtmlChar) : string;
  5807. }
  5808. var INFINITY = 1 / 0;
  5809. var createSet = !(Set$1 && 1 / setToArray(new Set$1([, -0]))[1] == INFINITY) ? noop : function(values) {
  5810. return new Set$1(values);
  5811. };
  5812. var LARGE_ARRAY_SIZE = 200;
  5813. function baseUniq(array, iteratee, comparator) {
  5814. var index = -1, includes = arrayIncludes, length = array.length, isCommon = true, result = [], seen = result;
  5815. if (comparator) {
  5816. isCommon = false;
  5817. includes = arrayIncludesWith;
  5818. } else if (length >= LARGE_ARRAY_SIZE) {
  5819. var set = iteratee ? null : createSet(array);
  5820. if (set) {
  5821. return setToArray(set);
  5822. }
  5823. isCommon = false;
  5824. includes = cacheHas;
  5825. seen = new SetCache();
  5826. } else {
  5827. seen = iteratee ? [] : result;
  5828. }
  5829. outer:
  5830. while (++index < length) {
  5831. var value = array[index], computed = iteratee ? iteratee(value) : value;
  5832. value = comparator || value !== 0 ? value : 0;
  5833. if (isCommon && computed === computed) {
  5834. var seenIndex = seen.length;
  5835. while (seenIndex--) {
  5836. if (seen[seenIndex] === computed) {
  5837. continue outer;
  5838. }
  5839. }
  5840. if (iteratee) {
  5841. seen.push(computed);
  5842. }
  5843. result.push(value);
  5844. } else if (!includes(seen, computed, comparator)) {
  5845. if (seen !== result) {
  5846. seen.push(computed);
  5847. }
  5848. result.push(value);
  5849. }
  5850. }
  5851. return result;
  5852. }
  5853. var union = baseRest(function(arrays) {
  5854. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
  5855. });
  5856. var unionBy = baseRest(function(arrays) {
  5857. var iteratee = last(arrays);
  5858. if (isArrayLikeObject(iteratee)) {
  5859. iteratee = void 0;
  5860. }
  5861. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), baseIteratee(iteratee));
  5862. });
  5863. var unionWith = baseRest(function(arrays) {
  5864. var comparator = last(arrays);
  5865. comparator = typeof comparator == "function" ? comparator : void 0;
  5866. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), void 0, comparator);
  5867. });
  5868. function uniq(array) {
  5869. return array && array.length ? baseUniq(array) : [];
  5870. }
  5871. function uniqBy(array, iteratee) {
  5872. return array && array.length ? baseUniq(array, baseIteratee(iteratee)) : [];
  5873. }
  5874. function uniqWith(array, comparator) {
  5875. comparator = typeof comparator == "function" ? comparator : void 0;
  5876. return array && array.length ? baseUniq(array, void 0, comparator) : [];
  5877. }
  5878. var idCounter = 0;
  5879. function uniqueId(prefix) {
  5880. var id = ++idCounter;
  5881. return toString(prefix) + id;
  5882. }
  5883. function unset(object, path) {
  5884. return object == null ? true : baseUnset(object, path);
  5885. }
  5886. var nativeMax$2 = Math.max;
  5887. function unzip(array) {
  5888. if (!(array && array.length)) {
  5889. return [];
  5890. }
  5891. var length = 0;
  5892. array = arrayFilter(array, function(group) {
  5893. if (isArrayLikeObject(group)) {
  5894. length = nativeMax$2(group.length, length);
  5895. return true;
  5896. }
  5897. });
  5898. return baseTimes(length, function(index) {
  5899. return arrayMap(array, baseProperty(index));
  5900. });
  5901. }
  5902. function unzipWith(array, iteratee) {
  5903. if (!(array && array.length)) {
  5904. return [];
  5905. }
  5906. var result = unzip(array);
  5907. if (iteratee == null) {
  5908. return result;
  5909. }
  5910. return arrayMap(result, function(group) {
  5911. return apply(iteratee, void 0, group);
  5912. });
  5913. }
  5914. function baseUpdate(object, path, updater, customizer) {
  5915. return baseSet(object, path, updater(baseGet(object, path)), customizer);
  5916. }
  5917. function update(object, path, updater) {
  5918. return object == null ? object : baseUpdate(object, path, castFunction(updater));
  5919. }
  5920. function updateWith(object, path, updater, customizer) {
  5921. customizer = typeof customizer == "function" ? customizer : void 0;
  5922. return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
  5923. }
  5924. var upperCase = createCompounder(function(result, word, index) {
  5925. return result + (index ? " " : "") + word.toUpperCase();
  5926. });
  5927. function valuesIn(object) {
  5928. return object == null ? [] : baseValues(object, keysIn(object));
  5929. }
  5930. var without = baseRest(function(array, values) {
  5931. return isArrayLikeObject(array) ? baseDifference(array, values) : [];
  5932. });
  5933. function wrap(value, wrapper) {
  5934. return partial(castFunction(wrapper), value);
  5935. }
  5936. var wrapperAt = flatRest(function(paths) {
  5937. var length = paths.length, start = length ? paths[0] : 0, value = this.__wrapped__, interceptor = function(object) {
  5938. return baseAt(object, paths);
  5939. };
  5940. if (length > 1 || this.__actions__.length || !(value instanceof LazyWrapper) || !isIndex(start)) {
  5941. return this.thru(interceptor);
  5942. }
  5943. value = value.slice(start, +start + (length ? 1 : 0));
  5944. value.__actions__.push({
  5945. "func": thru,
  5946. "args": [interceptor],
  5947. "thisArg": void 0
  5948. });
  5949. return new LodashWrapper(value, this.__chain__).thru(function(array) {
  5950. if (length && !array.length) {
  5951. array.push(void 0);
  5952. }
  5953. return array;
  5954. });
  5955. });
  5956. function wrapperChain() {
  5957. return chain(this);
  5958. }
  5959. function wrapperReverse() {
  5960. var value = this.__wrapped__;
  5961. if (value instanceof LazyWrapper) {
  5962. var wrapped = value;
  5963. if (this.__actions__.length) {
  5964. wrapped = new LazyWrapper(this);
  5965. }
  5966. wrapped = wrapped.reverse();
  5967. wrapped.__actions__.push({
  5968. "func": thru,
  5969. "args": [reverse],
  5970. "thisArg": void 0
  5971. });
  5972. return new LodashWrapper(wrapped, this.__chain__);
  5973. }
  5974. return this.thru(reverse);
  5975. }
  5976. function baseXor(arrays, iteratee, comparator) {
  5977. var length = arrays.length;
  5978. if (length < 2) {
  5979. return length ? baseUniq(arrays[0]) : [];
  5980. }
  5981. var index = -1, result = Array(length);
  5982. while (++index < length) {
  5983. var array = arrays[index], othIndex = -1;
  5984. while (++othIndex < length) {
  5985. if (othIndex != index) {
  5986. result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator);
  5987. }
  5988. }
  5989. }
  5990. return baseUniq(baseFlatten(result, 1), iteratee, comparator);
  5991. }
  5992. var xor = baseRest(function(arrays) {
  5993. return baseXor(arrayFilter(arrays, isArrayLikeObject));
  5994. });
  5995. var xorBy = baseRest(function(arrays) {
  5996. var iteratee = last(arrays);
  5997. if (isArrayLikeObject(iteratee)) {
  5998. iteratee = void 0;
  5999. }
  6000. return baseXor(arrayFilter(arrays, isArrayLikeObject), baseIteratee(iteratee));
  6001. });
  6002. var xorWith = baseRest(function(arrays) {
  6003. var comparator = last(arrays);
  6004. comparator = typeof comparator == "function" ? comparator : void 0;
  6005. return baseXor(arrayFilter(arrays, isArrayLikeObject), void 0, comparator);
  6006. });
  6007. var zip = baseRest(unzip);
  6008. function baseZipObject(props, values, assignFunc) {
  6009. var index = -1, length = props.length, valsLength = values.length, result = {};
  6010. while (++index < length) {
  6011. var value = index < valsLength ? values[index] : void 0;
  6012. assignFunc(result, props[index], value);
  6013. }
  6014. return result;
  6015. }
  6016. function zipObject(props, values) {
  6017. return baseZipObject(props || [], values || [], assignValue);
  6018. }
  6019. function zipObjectDeep(props, values) {
  6020. return baseZipObject(props || [], values || [], baseSet);
  6021. }
  6022. var zipWith = baseRest(function(arrays) {
  6023. var length = arrays.length, iteratee = length > 1 ? arrays[length - 1] : void 0;
  6024. iteratee = typeof iteratee == "function" ? (arrays.pop(), iteratee) : void 0;
  6025. return unzipWith(arrays, iteratee);
  6026. });
  6027. var array = {
  6028. chunk,
  6029. compact,
  6030. concat,
  6031. difference,
  6032. differenceBy,
  6033. differenceWith,
  6034. drop,
  6035. dropRight,
  6036. dropRightWhile,
  6037. dropWhile,
  6038. fill,
  6039. findIndex,
  6040. findLastIndex,
  6041. first: head,
  6042. flatten,
  6043. flattenDeep,
  6044. flattenDepth,
  6045. fromPairs,
  6046. head,
  6047. indexOf,
  6048. initial: initial$1,
  6049. intersection,
  6050. intersectionBy,
  6051. intersectionWith,
  6052. join,
  6053. last,
  6054. lastIndexOf,
  6055. nth,
  6056. pull,
  6057. pullAll,
  6058. pullAllBy,
  6059. pullAllWith,
  6060. pullAt,
  6061. remove,
  6062. reverse,
  6063. slice,
  6064. sortedIndex,
  6065. sortedIndexBy,
  6066. sortedIndexOf,
  6067. sortedLastIndex,
  6068. sortedLastIndexBy,
  6069. sortedLastIndexOf,
  6070. sortedUniq,
  6071. sortedUniqBy,
  6072. tail,
  6073. take,
  6074. takeRight,
  6075. takeRightWhile,
  6076. takeWhile,
  6077. union,
  6078. unionBy,
  6079. unionWith,
  6080. uniq,
  6081. uniqBy,
  6082. uniqWith,
  6083. unzip,
  6084. unzipWith,
  6085. without,
  6086. xor,
  6087. xorBy,
  6088. xorWith,
  6089. zip,
  6090. zipObject,
  6091. zipObjectDeep,
  6092. zipWith
  6093. };
  6094. var collection = {
  6095. countBy,
  6096. each: forEach,
  6097. eachRight: forEachRight,
  6098. every,
  6099. filter,
  6100. find,
  6101. findLast,
  6102. flatMap,
  6103. flatMapDeep,
  6104. flatMapDepth,
  6105. forEach,
  6106. forEachRight,
  6107. groupBy,
  6108. includes,
  6109. invokeMap,
  6110. keyBy,
  6111. map,
  6112. orderBy: orderBy$1,
  6113. partition,
  6114. reduce,
  6115. reduceRight,
  6116. reject,
  6117. sample,
  6118. sampleSize,
  6119. shuffle,
  6120. size,
  6121. some,
  6122. sortBy
  6123. };
  6124. var date = {
  6125. now
  6126. };
  6127. var func = {
  6128. after,
  6129. ary,
  6130. before,
  6131. bind,
  6132. bindKey,
  6133. curry,
  6134. curryRight,
  6135. debounce,
  6136. defer,
  6137. delay,
  6138. flip: flip$1,
  6139. memoize,
  6140. negate,
  6141. once,
  6142. overArgs,
  6143. partial,
  6144. partialRight,
  6145. rearg,
  6146. rest,
  6147. spread,
  6148. throttle,
  6149. unary,
  6150. wrap
  6151. };
  6152. var lang = {
  6153. castArray: castArray$1,
  6154. clone,
  6155. cloneDeep,
  6156. cloneDeepWith,
  6157. cloneWith,
  6158. conformsTo,
  6159. eq,
  6160. gt: gt$1,
  6161. gte,
  6162. isArguments,
  6163. isArray,
  6164. isArrayBuffer,
  6165. isArrayLike,
  6166. isArrayLikeObject,
  6167. isBoolean: isBoolean$1,
  6168. isBuffer,
  6169. isDate,
  6170. isElement: isElement$2,
  6171. isEmpty: isEmpty$1,
  6172. isEqual: isEqual$1,
  6173. isEqualWith,
  6174. isError,
  6175. isFinite,
  6176. isFunction,
  6177. isInteger,
  6178. isLength,
  6179. isMap,
  6180. isMatch,
  6181. isMatchWith,
  6182. isNaN: isNaN$1,
  6183. isNative,
  6184. isNil,
  6185. isNull,
  6186. isNumber: isNumber$1,
  6187. isObject,
  6188. isObjectLike,
  6189. isPlainObject,
  6190. isRegExp,
  6191. isSafeInteger,
  6192. isSet,
  6193. isString,
  6194. isSymbol,
  6195. isTypedArray,
  6196. isUndefined: isUndefined$1,
  6197. isWeakMap,
  6198. isWeakSet,
  6199. lt: lt$1,
  6200. lte,
  6201. toArray,
  6202. toFinite,
  6203. toInteger,
  6204. toLength,
  6205. toNumber,
  6206. toPlainObject,
  6207. toSafeInteger,
  6208. toString
  6209. };
  6210. var math = {
  6211. add,
  6212. ceil,
  6213. divide,
  6214. floor: floor$1,
  6215. max: max$3,
  6216. maxBy,
  6217. mean,
  6218. meanBy,
  6219. min: min$3,
  6220. minBy,
  6221. multiply,
  6222. round: round$1,
  6223. subtract,
  6224. sum: sum$1,
  6225. sumBy
  6226. };
  6227. var number = {
  6228. clamp,
  6229. inRange,
  6230. random
  6231. };
  6232. var object = {
  6233. assign,
  6234. assignIn,
  6235. assignInWith,
  6236. assignWith,
  6237. at: at$1,
  6238. create,
  6239. defaults,
  6240. defaultsDeep,
  6241. entries: toPairs,
  6242. entriesIn: toPairsIn,
  6243. extend: assignIn,
  6244. extendWith: assignInWith,
  6245. findKey,
  6246. findLastKey,
  6247. forIn,
  6248. forInRight,
  6249. forOwn,
  6250. forOwnRight,
  6251. functions,
  6252. functionsIn,
  6253. get,
  6254. has,
  6255. hasIn,
  6256. invert,
  6257. invertBy,
  6258. invoke,
  6259. keys,
  6260. keysIn,
  6261. mapKeys,
  6262. mapValues,
  6263. merge,
  6264. mergeWith,
  6265. omit,
  6266. omitBy,
  6267. pick,
  6268. pickBy,
  6269. result,
  6270. set,
  6271. setWith,
  6272. toPairs,
  6273. toPairsIn,
  6274. transform,
  6275. unset,
  6276. update,
  6277. updateWith,
  6278. values,
  6279. valuesIn
  6280. };
  6281. var seq = {
  6282. at: wrapperAt,
  6283. chain,
  6284. commit: wrapperCommit,
  6285. lodash,
  6286. next: wrapperNext,
  6287. plant: wrapperPlant,
  6288. reverse: wrapperReverse,
  6289. tap,
  6290. thru,
  6291. toIterator: wrapperToIterator,
  6292. toJSON: wrapperValue,
  6293. value: wrapperValue,
  6294. valueOf: wrapperValue,
  6295. wrapperChain
  6296. };
  6297. var string$1 = {
  6298. camelCase,
  6299. capitalize: capitalize$1,
  6300. deburr,
  6301. endsWith,
  6302. escape,
  6303. escapeRegExp,
  6304. kebabCase,
  6305. lowerCase,
  6306. lowerFirst,
  6307. pad,
  6308. padEnd,
  6309. padStart,
  6310. parseInt: parseInt$1,
  6311. repeat,
  6312. replace,
  6313. snakeCase,
  6314. split,
  6315. startCase,
  6316. startsWith,
  6317. template,
  6318. templateSettings,
  6319. toLower,
  6320. toUpper,
  6321. trim,
  6322. trimEnd,
  6323. trimStart,
  6324. truncate,
  6325. unescape,
  6326. upperCase,
  6327. upperFirst,
  6328. words
  6329. };
  6330. var util = {
  6331. attempt,
  6332. bindAll,
  6333. cond,
  6334. conforms,
  6335. constant,
  6336. defaultTo,
  6337. flow,
  6338. flowRight,
  6339. identity,
  6340. iteratee,
  6341. matches,
  6342. matchesProperty,
  6343. method,
  6344. methodOf,
  6345. mixin: mixin$1,
  6346. noop,
  6347. nthArg,
  6348. over,
  6349. overEvery,
  6350. overSome,
  6351. property,
  6352. propertyOf,
  6353. range: range$1,
  6354. rangeRight,
  6355. stubArray,
  6356. stubFalse,
  6357. stubObject,
  6358. stubString,
  6359. stubTrue,
  6360. times,
  6361. toPath,
  6362. uniqueId
  6363. };
  6364. function lazyClone() {
  6365. var result = new LazyWrapper(this.__wrapped__);
  6366. result.__actions__ = copyArray(this.__actions__);
  6367. result.__dir__ = this.__dir__;
  6368. result.__filtered__ = this.__filtered__;
  6369. result.__iteratees__ = copyArray(this.__iteratees__);
  6370. result.__takeCount__ = this.__takeCount__;
  6371. result.__views__ = copyArray(this.__views__);
  6372. return result;
  6373. }
  6374. function lazyReverse() {
  6375. if (this.__filtered__) {
  6376. var result = new LazyWrapper(this);
  6377. result.__dir__ = -1;
  6378. result.__filtered__ = true;
  6379. } else {
  6380. result = this.clone();
  6381. result.__dir__ *= -1;
  6382. }
  6383. return result;
  6384. }
  6385. var nativeMax$1 = Math.max;
  6386. var nativeMin$2 = Math.min;
  6387. function getView(start, end, transforms) {
  6388. var index = -1, length = transforms.length;
  6389. while (++index < length) {
  6390. var data = transforms[index], size = data.size;
  6391. switch (data.type) {
  6392. case "drop":
  6393. start += size;
  6394. break;
  6395. case "dropRight":
  6396. end -= size;
  6397. break;
  6398. case "take":
  6399. end = nativeMin$2(end, start + size);
  6400. break;
  6401. case "takeRight":
  6402. start = nativeMax$1(start, end - size);
  6403. break;
  6404. }
  6405. }
  6406. return { "start": start, "end": end };
  6407. }
  6408. var LAZY_FILTER_FLAG$1 = 1;
  6409. var LAZY_MAP_FLAG = 2;
  6410. var nativeMin$1 = Math.min;
  6411. function lazyValue() {
  6412. 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__);
  6413. if (!isArr || !isRight && arrLength == length && takeCount == length) {
  6414. return baseWrapperValue(array, this.__actions__);
  6415. }
  6416. var result = [];
  6417. outer:
  6418. while (length-- && resIndex < takeCount) {
  6419. index += dir;
  6420. var iterIndex = -1, value = array[index];
  6421. while (++iterIndex < iterLength) {
  6422. var data = iteratees[iterIndex], iteratee = data.iteratee, type = data.type, computed = iteratee(value);
  6423. if (type == LAZY_MAP_FLAG) {
  6424. value = computed;
  6425. } else if (!computed) {
  6426. if (type == LAZY_FILTER_FLAG$1) {
  6427. continue outer;
  6428. } else {
  6429. break outer;
  6430. }
  6431. }
  6432. }
  6433. result[resIndex++] = value;
  6434. }
  6435. return result;
  6436. }
  6437. var VERSION = "4.17.21";
  6438. var WRAP_BIND_KEY_FLAG = 2;
  6439. var LAZY_FILTER_FLAG = 1;
  6440. var LAZY_WHILE_FLAG = 3;
  6441. var MAX_ARRAY_LENGTH = 4294967295;
  6442. var arrayProto = Array.prototype;
  6443. var objectProto = Object.prototype;
  6444. var hasOwnProperty = objectProto.hasOwnProperty;
  6445. var symIterator = Symbol$1 ? Symbol$1.iterator : void 0;
  6446. var nativeMax = Math.max;
  6447. var nativeMin = Math.min;
  6448. var mixin = function(func2) {
  6449. return function(object2, source, options) {
  6450. if (options == null) {
  6451. var isObj = isObject(source), props = isObj && keys(source), methodNames = props && props.length && baseFunctions(source, props);
  6452. if (!(methodNames ? methodNames.length : isObj)) {
  6453. options = source;
  6454. source = object2;
  6455. object2 = this;
  6456. }
  6457. }
  6458. return func2(object2, source, options);
  6459. };
  6460. }(mixin$1);
  6461. lodash.after = func.after;
  6462. lodash.ary = func.ary;
  6463. lodash.assign = object.assign;
  6464. lodash.assignIn = object.assignIn;
  6465. lodash.assignInWith = object.assignInWith;
  6466. lodash.assignWith = object.assignWith;
  6467. lodash.at = object.at;
  6468. lodash.before = func.before;
  6469. lodash.bind = func.bind;
  6470. lodash.bindAll = util.bindAll;
  6471. lodash.bindKey = func.bindKey;
  6472. lodash.castArray = lang.castArray;
  6473. lodash.chain = seq.chain;
  6474. lodash.chunk = array.chunk;
  6475. lodash.compact = array.compact;
  6476. lodash.concat = array.concat;
  6477. lodash.cond = util.cond;
  6478. lodash.conforms = util.conforms;
  6479. lodash.constant = util.constant;
  6480. lodash.countBy = collection.countBy;
  6481. lodash.create = object.create;
  6482. lodash.curry = func.curry;
  6483. lodash.curryRight = func.curryRight;
  6484. lodash.debounce = func.debounce;
  6485. lodash.defaults = object.defaults;
  6486. lodash.defaultsDeep = object.defaultsDeep;
  6487. lodash.defer = func.defer;
  6488. lodash.delay = func.delay;
  6489. lodash.difference = array.difference;
  6490. lodash.differenceBy = array.differenceBy;
  6491. lodash.differenceWith = array.differenceWith;
  6492. lodash.drop = array.drop;
  6493. lodash.dropRight = array.dropRight;
  6494. lodash.dropRightWhile = array.dropRightWhile;
  6495. lodash.dropWhile = array.dropWhile;
  6496. lodash.fill = array.fill;
  6497. lodash.filter = collection.filter;
  6498. lodash.flatMap = collection.flatMap;
  6499. lodash.flatMapDeep = collection.flatMapDeep;
  6500. lodash.flatMapDepth = collection.flatMapDepth;
  6501. lodash.flatten = array.flatten;
  6502. lodash.flattenDeep = array.flattenDeep;
  6503. lodash.flattenDepth = array.flattenDepth;
  6504. lodash.flip = func.flip;
  6505. lodash.flow = util.flow;
  6506. lodash.flowRight = util.flowRight;
  6507. lodash.fromPairs = array.fromPairs;
  6508. lodash.functions = object.functions;
  6509. lodash.functionsIn = object.functionsIn;
  6510. lodash.groupBy = collection.groupBy;
  6511. lodash.initial = array.initial;
  6512. lodash.intersection = array.intersection;
  6513. lodash.intersectionBy = array.intersectionBy;
  6514. lodash.intersectionWith = array.intersectionWith;
  6515. lodash.invert = object.invert;
  6516. lodash.invertBy = object.invertBy;
  6517. lodash.invokeMap = collection.invokeMap;
  6518. lodash.iteratee = util.iteratee;
  6519. lodash.keyBy = collection.keyBy;
  6520. lodash.keys = keys;
  6521. lodash.keysIn = object.keysIn;
  6522. lodash.map = collection.map;
  6523. lodash.mapKeys = object.mapKeys;
  6524. lodash.mapValues = object.mapValues;
  6525. lodash.matches = util.matches;
  6526. lodash.matchesProperty = util.matchesProperty;
  6527. lodash.memoize = func.memoize;
  6528. lodash.merge = object.merge;
  6529. lodash.mergeWith = object.mergeWith;
  6530. lodash.method = util.method;
  6531. lodash.methodOf = util.methodOf;
  6532. lodash.mixin = mixin;
  6533. lodash.negate = negate;
  6534. lodash.nthArg = util.nthArg;
  6535. lodash.omit = object.omit;
  6536. lodash.omitBy = object.omitBy;
  6537. lodash.once = func.once;
  6538. lodash.orderBy = collection.orderBy;
  6539. lodash.over = util.over;
  6540. lodash.overArgs = func.overArgs;
  6541. lodash.overEvery = util.overEvery;
  6542. lodash.overSome = util.overSome;
  6543. lodash.partial = func.partial;
  6544. lodash.partialRight = func.partialRight;
  6545. lodash.partition = collection.partition;
  6546. lodash.pick = object.pick;
  6547. lodash.pickBy = object.pickBy;
  6548. lodash.property = util.property;
  6549. lodash.propertyOf = util.propertyOf;
  6550. lodash.pull = array.pull;
  6551. lodash.pullAll = array.pullAll;
  6552. lodash.pullAllBy = array.pullAllBy;
  6553. lodash.pullAllWith = array.pullAllWith;
  6554. lodash.pullAt = array.pullAt;
  6555. lodash.range = util.range;
  6556. lodash.rangeRight = util.rangeRight;
  6557. lodash.rearg = func.rearg;
  6558. lodash.reject = collection.reject;
  6559. lodash.remove = array.remove;
  6560. lodash.rest = func.rest;
  6561. lodash.reverse = array.reverse;
  6562. lodash.sampleSize = collection.sampleSize;
  6563. lodash.set = object.set;
  6564. lodash.setWith = object.setWith;
  6565. lodash.shuffle = collection.shuffle;
  6566. lodash.slice = array.slice;
  6567. lodash.sortBy = collection.sortBy;
  6568. lodash.sortedUniq = array.sortedUniq;
  6569. lodash.sortedUniqBy = array.sortedUniqBy;
  6570. lodash.split = string$1.split;
  6571. lodash.spread = func.spread;
  6572. lodash.tail = array.tail;
  6573. lodash.take = array.take;
  6574. lodash.takeRight = array.takeRight;
  6575. lodash.takeRightWhile = array.takeRightWhile;
  6576. lodash.takeWhile = array.takeWhile;
  6577. lodash.tap = seq.tap;
  6578. lodash.throttle = func.throttle;
  6579. lodash.thru = thru;
  6580. lodash.toArray = lang.toArray;
  6581. lodash.toPairs = object.toPairs;
  6582. lodash.toPairsIn = object.toPairsIn;
  6583. lodash.toPath = util.toPath;
  6584. lodash.toPlainObject = lang.toPlainObject;
  6585. lodash.transform = object.transform;
  6586. lodash.unary = func.unary;
  6587. lodash.union = array.union;
  6588. lodash.unionBy = array.unionBy;
  6589. lodash.unionWith = array.unionWith;
  6590. lodash.uniq = array.uniq;
  6591. lodash.uniqBy = array.uniqBy;
  6592. lodash.uniqWith = array.uniqWith;
  6593. lodash.unset = object.unset;
  6594. lodash.unzip = array.unzip;
  6595. lodash.unzipWith = array.unzipWith;
  6596. lodash.update = object.update;
  6597. lodash.updateWith = object.updateWith;
  6598. lodash.values = object.values;
  6599. lodash.valuesIn = object.valuesIn;
  6600. lodash.without = array.without;
  6601. lodash.words = string$1.words;
  6602. lodash.wrap = func.wrap;
  6603. lodash.xor = array.xor;
  6604. lodash.xorBy = array.xorBy;
  6605. lodash.xorWith = array.xorWith;
  6606. lodash.zip = array.zip;
  6607. lodash.zipObject = array.zipObject;
  6608. lodash.zipObjectDeep = array.zipObjectDeep;
  6609. lodash.zipWith = array.zipWith;
  6610. lodash.entries = object.toPairs;
  6611. lodash.entriesIn = object.toPairsIn;
  6612. lodash.extend = object.assignIn;
  6613. lodash.extendWith = object.assignInWith;
  6614. mixin(lodash, lodash);
  6615. lodash.add = math.add;
  6616. lodash.attempt = util.attempt;
  6617. lodash.camelCase = string$1.camelCase;
  6618. lodash.capitalize = string$1.capitalize;
  6619. lodash.ceil = math.ceil;
  6620. lodash.clamp = number.clamp;
  6621. lodash.clone = lang.clone;
  6622. lodash.cloneDeep = lang.cloneDeep;
  6623. lodash.cloneDeepWith = lang.cloneDeepWith;
  6624. lodash.cloneWith = lang.cloneWith;
  6625. lodash.conformsTo = lang.conformsTo;
  6626. lodash.deburr = string$1.deburr;
  6627. lodash.defaultTo = util.defaultTo;
  6628. lodash.divide = math.divide;
  6629. lodash.endsWith = string$1.endsWith;
  6630. lodash.eq = lang.eq;
  6631. lodash.escape = string$1.escape;
  6632. lodash.escapeRegExp = string$1.escapeRegExp;
  6633. lodash.every = collection.every;
  6634. lodash.find = collection.find;
  6635. lodash.findIndex = array.findIndex;
  6636. lodash.findKey = object.findKey;
  6637. lodash.findLast = collection.findLast;
  6638. lodash.findLastIndex = array.findLastIndex;
  6639. lodash.findLastKey = object.findLastKey;
  6640. lodash.floor = math.floor;
  6641. lodash.forEach = collection.forEach;
  6642. lodash.forEachRight = collection.forEachRight;
  6643. lodash.forIn = object.forIn;
  6644. lodash.forInRight = object.forInRight;
  6645. lodash.forOwn = object.forOwn;
  6646. lodash.forOwnRight = object.forOwnRight;
  6647. lodash.get = object.get;
  6648. lodash.gt = lang.gt;
  6649. lodash.gte = lang.gte;
  6650. lodash.has = object.has;
  6651. lodash.hasIn = object.hasIn;
  6652. lodash.head = array.head;
  6653. lodash.identity = identity;
  6654. lodash.includes = collection.includes;
  6655. lodash.indexOf = array.indexOf;
  6656. lodash.inRange = number.inRange;
  6657. lodash.invoke = object.invoke;
  6658. lodash.isArguments = lang.isArguments;
  6659. lodash.isArray = isArray;
  6660. lodash.isArrayBuffer = lang.isArrayBuffer;
  6661. lodash.isArrayLike = lang.isArrayLike;
  6662. lodash.isArrayLikeObject = lang.isArrayLikeObject;
  6663. lodash.isBoolean = lang.isBoolean;
  6664. lodash.isBuffer = lang.isBuffer;
  6665. lodash.isDate = lang.isDate;
  6666. lodash.isElement = lang.isElement;
  6667. lodash.isEmpty = lang.isEmpty;
  6668. lodash.isEqual = lang.isEqual;
  6669. lodash.isEqualWith = lang.isEqualWith;
  6670. lodash.isError = lang.isError;
  6671. lodash.isFinite = lang.isFinite;
  6672. lodash.isFunction = lang.isFunction;
  6673. lodash.isInteger = lang.isInteger;
  6674. lodash.isLength = lang.isLength;
  6675. lodash.isMap = lang.isMap;
  6676. lodash.isMatch = lang.isMatch;
  6677. lodash.isMatchWith = lang.isMatchWith;
  6678. lodash.isNaN = lang.isNaN;
  6679. lodash.isNative = lang.isNative;
  6680. lodash.isNil = lang.isNil;
  6681. lodash.isNull = lang.isNull;
  6682. lodash.isNumber = lang.isNumber;
  6683. lodash.isObject = isObject;
  6684. lodash.isObjectLike = lang.isObjectLike;
  6685. lodash.isPlainObject = lang.isPlainObject;
  6686. lodash.isRegExp = lang.isRegExp;
  6687. lodash.isSafeInteger = lang.isSafeInteger;
  6688. lodash.isSet = lang.isSet;
  6689. lodash.isString = lang.isString;
  6690. lodash.isSymbol = lang.isSymbol;
  6691. lodash.isTypedArray = lang.isTypedArray;
  6692. lodash.isUndefined = lang.isUndefined;
  6693. lodash.isWeakMap = lang.isWeakMap;
  6694. lodash.isWeakSet = lang.isWeakSet;
  6695. lodash.join = array.join;
  6696. lodash.kebabCase = string$1.kebabCase;
  6697. lodash.last = last;
  6698. lodash.lastIndexOf = array.lastIndexOf;
  6699. lodash.lowerCase = string$1.lowerCase;
  6700. lodash.lowerFirst = string$1.lowerFirst;
  6701. lodash.lt = lang.lt;
  6702. lodash.lte = lang.lte;
  6703. lodash.max = math.max;
  6704. lodash.maxBy = math.maxBy;
  6705. lodash.mean = math.mean;
  6706. lodash.meanBy = math.meanBy;
  6707. lodash.min = math.min;
  6708. lodash.minBy = math.minBy;
  6709. lodash.stubArray = util.stubArray;
  6710. lodash.stubFalse = util.stubFalse;
  6711. lodash.stubObject = util.stubObject;
  6712. lodash.stubString = util.stubString;
  6713. lodash.stubTrue = util.stubTrue;
  6714. lodash.multiply = math.multiply;
  6715. lodash.nth = array.nth;
  6716. lodash.noop = util.noop;
  6717. lodash.now = date.now;
  6718. lodash.pad = string$1.pad;
  6719. lodash.padEnd = string$1.padEnd;
  6720. lodash.padStart = string$1.padStart;
  6721. lodash.parseInt = string$1.parseInt;
  6722. lodash.random = number.random;
  6723. lodash.reduce = collection.reduce;
  6724. lodash.reduceRight = collection.reduceRight;
  6725. lodash.repeat = string$1.repeat;
  6726. lodash.replace = string$1.replace;
  6727. lodash.result = object.result;
  6728. lodash.round = math.round;
  6729. lodash.sample = collection.sample;
  6730. lodash.size = collection.size;
  6731. lodash.snakeCase = string$1.snakeCase;
  6732. lodash.some = collection.some;
  6733. lodash.sortedIndex = array.sortedIndex;
  6734. lodash.sortedIndexBy = array.sortedIndexBy;
  6735. lodash.sortedIndexOf = array.sortedIndexOf;
  6736. lodash.sortedLastIndex = array.sortedLastIndex;
  6737. lodash.sortedLastIndexBy = array.sortedLastIndexBy;
  6738. lodash.sortedLastIndexOf = array.sortedLastIndexOf;
  6739. lodash.startCase = string$1.startCase;
  6740. lodash.startsWith = string$1.startsWith;
  6741. lodash.subtract = math.subtract;
  6742. lodash.sum = math.sum;
  6743. lodash.sumBy = math.sumBy;
  6744. lodash.template = string$1.template;
  6745. lodash.times = util.times;
  6746. lodash.toFinite = lang.toFinite;
  6747. lodash.toInteger = toInteger;
  6748. lodash.toLength = lang.toLength;
  6749. lodash.toLower = string$1.toLower;
  6750. lodash.toNumber = lang.toNumber;
  6751. lodash.toSafeInteger = lang.toSafeInteger;
  6752. lodash.toString = lang.toString;
  6753. lodash.toUpper = string$1.toUpper;
  6754. lodash.trim = string$1.trim;
  6755. lodash.trimEnd = string$1.trimEnd;
  6756. lodash.trimStart = string$1.trimStart;
  6757. lodash.truncate = string$1.truncate;
  6758. lodash.unescape = string$1.unescape;
  6759. lodash.uniqueId = util.uniqueId;
  6760. lodash.upperCase = string$1.upperCase;
  6761. lodash.upperFirst = string$1.upperFirst;
  6762. lodash.each = collection.forEach;
  6763. lodash.eachRight = collection.forEachRight;
  6764. lodash.first = array.head;
  6765. mixin(lodash, function() {
  6766. var source = {};
  6767. baseForOwn(lodash, function(func2, methodName) {
  6768. if (!hasOwnProperty.call(lodash.prototype, methodName)) {
  6769. source[methodName] = func2;
  6770. }
  6771. });
  6772. return source;
  6773. }(), { "chain": false });
  6774. lodash.VERSION = VERSION;
  6775. (lodash.templateSettings = string$1.templateSettings).imports._ = lodash;
  6776. arrayEach(["bind", "bindKey", "curry", "curryRight", "partial", "partialRight"], function(methodName) {
  6777. lodash[methodName].placeholder = lodash;
  6778. });
  6779. arrayEach(["drop", "take"], function(methodName, index) {
  6780. LazyWrapper.prototype[methodName] = function(n) {
  6781. n = n === void 0 ? 1 : nativeMax(toInteger(n), 0);
  6782. var result = this.__filtered__ && !index ? new LazyWrapper(this) : this.clone();
  6783. if (result.__filtered__) {
  6784. result.__takeCount__ = nativeMin(n, result.__takeCount__);
  6785. } else {
  6786. result.__views__.push({
  6787. "size": nativeMin(n, MAX_ARRAY_LENGTH),
  6788. "type": methodName + (result.__dir__ < 0 ? "Right" : "")
  6789. });
  6790. }
  6791. return result;
  6792. };
  6793. LazyWrapper.prototype[methodName + "Right"] = function(n) {
  6794. return this.reverse()[methodName](n).reverse();
  6795. };
  6796. });
  6797. arrayEach(["filter", "map", "takeWhile"], function(methodName, index) {
  6798. var type = index + 1, isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG;
  6799. LazyWrapper.prototype[methodName] = function(iteratee) {
  6800. var result = this.clone();
  6801. result.__iteratees__.push({
  6802. "iteratee": baseIteratee(iteratee),
  6803. "type": type
  6804. });
  6805. result.__filtered__ = result.__filtered__ || isFilter;
  6806. return result;
  6807. };
  6808. });
  6809. arrayEach(["head", "last"], function(methodName, index) {
  6810. var takeName = "take" + (index ? "Right" : "");
  6811. LazyWrapper.prototype[methodName] = function() {
  6812. return this[takeName](1).value()[0];
  6813. };
  6814. });
  6815. arrayEach(["initial", "tail"], function(methodName, index) {
  6816. var dropName = "drop" + (index ? "" : "Right");
  6817. LazyWrapper.prototype[methodName] = function() {
  6818. return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
  6819. };
  6820. });
  6821. LazyWrapper.prototype.compact = function() {
  6822. return this.filter(identity);
  6823. };
  6824. LazyWrapper.prototype.find = function(predicate) {
  6825. return this.filter(predicate).head();
  6826. };
  6827. LazyWrapper.prototype.findLast = function(predicate) {
  6828. return this.reverse().find(predicate);
  6829. };
  6830. LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
  6831. if (typeof path == "function") {
  6832. return new LazyWrapper(this);
  6833. }
  6834. return this.map(function(value) {
  6835. return baseInvoke(value, path, args);
  6836. });
  6837. });
  6838. LazyWrapper.prototype.reject = function(predicate) {
  6839. return this.filter(negate(baseIteratee(predicate)));
  6840. };
  6841. LazyWrapper.prototype.slice = function(start, end) {
  6842. start = toInteger(start);
  6843. var result = this;
  6844. if (result.__filtered__ && (start > 0 || end < 0)) {
  6845. return new LazyWrapper(result);
  6846. }
  6847. if (start < 0) {
  6848. result = result.takeRight(-start);
  6849. } else if (start) {
  6850. result = result.drop(start);
  6851. }
  6852. if (end !== void 0) {
  6853. end = toInteger(end);
  6854. result = end < 0 ? result.dropRight(-end) : result.take(end - start);
  6855. }
  6856. return result;
  6857. };
  6858. LazyWrapper.prototype.takeRightWhile = function(predicate) {
  6859. return this.reverse().takeWhile(predicate).reverse();
  6860. };
  6861. LazyWrapper.prototype.toArray = function() {
  6862. return this.take(MAX_ARRAY_LENGTH);
  6863. };
  6864. baseForOwn(LazyWrapper.prototype, function(func2, methodName) {
  6865. 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);
  6866. if (!lodashFunc) {
  6867. return;
  6868. }
  6869. lodash.prototype[methodName] = function() {
  6870. var value = this.__wrapped__, args = isTaker ? [1] : arguments, isLazy = value instanceof LazyWrapper, iteratee = args[0], useLazy = isLazy || isArray(value);
  6871. var interceptor = function(value2) {
  6872. var result2 = lodashFunc.apply(lodash, arrayPush([value2], args));
  6873. return isTaker && chainAll ? result2[0] : result2;
  6874. };
  6875. if (useLazy && checkIteratee && typeof iteratee == "function" && iteratee.length != 1) {
  6876. isLazy = useLazy = false;
  6877. }
  6878. var chainAll = this.__chain__, isHybrid = !!this.__actions__.length, isUnwrapped = retUnwrapped && !chainAll, onlyLazy = isLazy && !isHybrid;
  6879. if (!retUnwrapped && useLazy) {
  6880. value = onlyLazy ? value : new LazyWrapper(this);
  6881. var result = func2.apply(value, args);
  6882. result.__actions__.push({ "func": thru, "args": [interceptor], "thisArg": void 0 });
  6883. return new LodashWrapper(result, chainAll);
  6884. }
  6885. if (isUnwrapped && onlyLazy) {
  6886. return func2.apply(this, args);
  6887. }
  6888. result = this.thru(interceptor);
  6889. return isUnwrapped ? isTaker ? result.value()[0] : result.value() : result;
  6890. };
  6891. });
  6892. arrayEach(["pop", "push", "shift", "sort", "splice", "unshift"], function(methodName) {
  6893. var func2 = arrayProto[methodName], chainName = /^(?:push|sort|unshift)$/.test(methodName) ? "tap" : "thru", retUnwrapped = /^(?:pop|shift)$/.test(methodName);
  6894. lodash.prototype[methodName] = function() {
  6895. var args = arguments;
  6896. if (retUnwrapped && !this.__chain__) {
  6897. var value = this.value();
  6898. return func2.apply(isArray(value) ? value : [], args);
  6899. }
  6900. return this[chainName](function(value2) {
  6901. return func2.apply(isArray(value2) ? value2 : [], args);
  6902. });
  6903. };
  6904. });
  6905. baseForOwn(LazyWrapper.prototype, function(func2, methodName) {
  6906. var lodashFunc = lodash[methodName];
  6907. if (lodashFunc) {
  6908. var key = lodashFunc.name + "";
  6909. if (!hasOwnProperty.call(realNames, key)) {
  6910. realNames[key] = [];
  6911. }
  6912. realNames[key].push({ "name": methodName, "func": lodashFunc });
  6913. }
  6914. });
  6915. realNames[createHybrid(void 0, WRAP_BIND_KEY_FLAG).name] = [{
  6916. "name": "wrapper",
  6917. "func": void 0
  6918. }];
  6919. LazyWrapper.prototype.clone = lazyClone;
  6920. LazyWrapper.prototype.reverse = lazyReverse;
  6921. LazyWrapper.prototype.value = lazyValue;
  6922. lodash.prototype.at = seq.at;
  6923. lodash.prototype.chain = seq.wrapperChain;
  6924. lodash.prototype.commit = seq.commit;
  6925. lodash.prototype.next = seq.next;
  6926. lodash.prototype.plant = seq.plant;
  6927. lodash.prototype.reverse = seq.reverse;
  6928. lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = seq.value;
  6929. lodash.prototype.first = lodash.prototype.head;
  6930. if (symIterator) {
  6931. lodash.prototype[symIterator] = seq.toIterator;
  6932. }
  6933. /**
  6934. * @license
  6935. * Lodash (Custom Build) <https://lodash.com/>
  6936. * Build: `lodash modularize exports="es" -o ./`
  6937. * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
  6938. * Released under MIT license <https://lodash.com/license>
  6939. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  6940. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  6941. */
  6942. const isUndefined = (val) => val === void 0;
  6943. const isBoolean = (val) => typeof val === "boolean";
  6944. const isNumber = (val) => typeof val === "number";
  6945. const isEmpty = (val) => !val && val !== 0 || isArray$1(val) && val.length === 0 || isObject$1(val) && !Object.keys(val).length;
  6946. const isElement$1 = (e) => {
  6947. if (typeof Element === "undefined")
  6948. return false;
  6949. return e instanceof Element;
  6950. };
  6951. const isPropAbsent = (prop) => isNil(prop);
  6952. const isStringNumber = (val) => {
  6953. if (!isString$1(val)) {
  6954. return false;
  6955. }
  6956. return !Number.isNaN(Number(val));
  6957. };
  6958. const isWindow$1 = (val) => val === window;
  6959. const rAF = (fn) => isClient ? window.requestAnimationFrame(fn) : setTimeout(fn, 16);
  6960. const cAF = (handle) => isClient ? window.cancelAnimationFrame(handle) : clearTimeout(handle);
  6961. const escapeStringRegexp = (string = "") => string.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
  6962. const capitalize = (str) => capitalize$2(str);
  6963. const keysOf = (arr) => Object.keys(arr);
  6964. const entriesOf = (arr) => Object.entries(arr);
  6965. const getProp = (obj, path, defaultValue) => {
  6966. return {
  6967. get value() {
  6968. return get(obj, path, defaultValue);
  6969. },
  6970. set value(val) {
  6971. set(obj, path, val);
  6972. }
  6973. };
  6974. };
  6975. class ElementPlusError extends Error {
  6976. constructor(m) {
  6977. super(m);
  6978. this.name = "ElementPlusError";
  6979. }
  6980. }
  6981. function throwError(scope, m) {
  6982. throw new ElementPlusError(`[${scope}] ${m}`);
  6983. }
  6984. function debugWarn(scope, message) {
  6985. }
  6986. const classNameToArray = (cls = "") => cls.split(" ").filter((item) => !!item.trim());
  6987. const hasClass = (el, cls) => {
  6988. if (!el || !cls)
  6989. return false;
  6990. if (cls.includes(" "))
  6991. throw new Error("className should not contain space.");
  6992. return el.classList.contains(cls);
  6993. };
  6994. const addClass = (el, cls) => {
  6995. if (!el || !cls.trim())
  6996. return;
  6997. el.classList.add(...classNameToArray(cls));
  6998. };
  6999. const removeClass = (el, cls) => {
  7000. if (!el || !cls.trim())
  7001. return;
  7002. el.classList.remove(...classNameToArray(cls));
  7003. };
  7004. const getStyle = (element, styleName) => {
  7005. var _a;
  7006. if (!isClient || !element || !styleName)
  7007. return "";
  7008. let key = camelize(styleName);
  7009. if (key === "float")
  7010. key = "cssFloat";
  7011. try {
  7012. const style = element.style[key];
  7013. if (style)
  7014. return style;
  7015. const computed = (_a = document.defaultView) == null ? void 0 : _a.getComputedStyle(element, "");
  7016. return computed ? computed[key] : "";
  7017. } catch (e) {
  7018. return element.style[key];
  7019. }
  7020. };
  7021. const setStyle = (element, styleName, value) => {
  7022. if (!element || !styleName)
  7023. return;
  7024. if (isObject$1(styleName)) {
  7025. entriesOf(styleName).forEach(([prop, value2]) => setStyle(element, prop, value2));
  7026. } else {
  7027. const key = camelize(styleName);
  7028. element.style[key] = value;
  7029. }
  7030. };
  7031. function addUnit(value, defaultUnit = "px") {
  7032. if (!value)
  7033. return "";
  7034. if (isNumber(value) || isStringNumber(value)) {
  7035. return `${value}${defaultUnit}`;
  7036. } else if (isString$1(value)) {
  7037. return value;
  7038. }
  7039. }
  7040. const isScroll = (el, isVertical) => {
  7041. if (!isClient)
  7042. return false;
  7043. const key = {
  7044. undefined: "overflow",
  7045. true: "overflow-y",
  7046. false: "overflow-x"
  7047. }[String(isVertical)];
  7048. const overflow = getStyle(el, key);
  7049. return ["scroll", "auto", "overlay"].some((s) => overflow.includes(s));
  7050. };
  7051. const getScrollContainer = (el, isVertical) => {
  7052. if (!isClient)
  7053. return;
  7054. let parent = el;
  7055. while (parent) {
  7056. if ([window, document, document.documentElement].includes(parent))
  7057. return window;
  7058. if (isScroll(parent, isVertical))
  7059. return parent;
  7060. parent = parent.parentNode;
  7061. }
  7062. return parent;
  7063. };
  7064. let scrollBarWidth;
  7065. const getScrollBarWidth = (namespace) => {
  7066. var _a;
  7067. if (!isClient)
  7068. return 0;
  7069. if (scrollBarWidth !== void 0)
  7070. return scrollBarWidth;
  7071. const outer = document.createElement("div");
  7072. outer.className = `${namespace}-scrollbar__wrap`;
  7073. outer.style.visibility = "hidden";
  7074. outer.style.width = "100px";
  7075. outer.style.position = "absolute";
  7076. outer.style.top = "-9999px";
  7077. document.body.appendChild(outer);
  7078. const widthNoScroll = outer.offsetWidth;
  7079. outer.style.overflow = "scroll";
  7080. const inner = document.createElement("div");
  7081. inner.style.width = "100%";
  7082. outer.appendChild(inner);
  7083. const widthWithScroll = inner.offsetWidth;
  7084. (_a = outer.parentNode) == null ? void 0 : _a.removeChild(outer);
  7085. scrollBarWidth = widthNoScroll - widthWithScroll;
  7086. return scrollBarWidth;
  7087. };
  7088. function scrollIntoView(container, selected) {
  7089. if (!isClient)
  7090. return;
  7091. if (!selected) {
  7092. container.scrollTop = 0;
  7093. return;
  7094. }
  7095. const offsetParents = [];
  7096. let pointer = selected.offsetParent;
  7097. while (pointer !== null && container !== pointer && container.contains(pointer)) {
  7098. offsetParents.push(pointer);
  7099. pointer = pointer.offsetParent;
  7100. }
  7101. const top = selected.offsetTop + offsetParents.reduce((prev, curr) => prev + curr.offsetTop, 0);
  7102. const bottom = top + selected.offsetHeight;
  7103. const viewRectTop = container.scrollTop;
  7104. const viewRectBottom = viewRectTop + container.clientHeight;
  7105. if (top < viewRectTop) {
  7106. container.scrollTop = top;
  7107. } else if (bottom > viewRectBottom) {
  7108. container.scrollTop = bottom - container.clientHeight;
  7109. }
  7110. }
  7111. function animateScrollTo(container, from, to, duration, callback) {
  7112. const startTime = Date.now();
  7113. let handle;
  7114. const scroll = () => {
  7115. const timestamp = Date.now();
  7116. const time = timestamp - startTime;
  7117. const nextScrollTop = easeInOutCubic(time > duration ? duration : time, from, to, duration);
  7118. if (isWindow$1(container)) {
  7119. container.scrollTo(window.pageXOffset, nextScrollTop);
  7120. } else {
  7121. container.scrollTop = nextScrollTop;
  7122. }
  7123. if (time < duration) {
  7124. handle = rAF(scroll);
  7125. } else if (isFunction$1(callback)) {
  7126. callback();
  7127. }
  7128. };
  7129. scroll();
  7130. return () => {
  7131. handle && cAF(handle);
  7132. };
  7133. }
  7134. const getScrollElement = (target, container) => {
  7135. if (isWindow$1(container)) {
  7136. return target.ownerDocument.documentElement;
  7137. }
  7138. return container;
  7139. };
  7140. const getScrollTop = (container) => {
  7141. if (isWindow$1(container)) {
  7142. return window.scrollY;
  7143. }
  7144. return container.scrollTop;
  7145. };
  7146. const getElement = (target) => {
  7147. if (!isClient || target === "")
  7148. return null;
  7149. if (isString$1(target)) {
  7150. try {
  7151. return document.querySelector(target);
  7152. } catch (e) {
  7153. return null;
  7154. }
  7155. }
  7156. return target;
  7157. };
  7158. let target = !isClient ? void 0 : document.body;
  7159. function createGlobalNode(id) {
  7160. const el = document.createElement("div");
  7161. if (id !== void 0) {
  7162. el.setAttribute("id", id);
  7163. }
  7164. if (target) {
  7165. target.appendChild(el);
  7166. }
  7167. return el;
  7168. }
  7169. function removeGlobalNode(el) {
  7170. el.remove();
  7171. }
  7172. var arrow_down_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  7173. name: "ArrowDown",
  7174. __name: "arrow-down",
  7175. setup(__props) {
  7176. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  7177. xmlns: "http://www.w3.org/2000/svg",
  7178. viewBox: "0 0 1024 1024"
  7179. }, [
  7180. createElementVNode("path", {
  7181. fill: "currentColor",
  7182. d: "M831.872 340.864 512 652.672 192.128 340.864a30.592 30.592 0 0 0-42.752 0 29.12 29.12 0 0 0 0 41.6L489.664 714.24a32 32 0 0 0 44.672 0l340.288-331.712a29.12 29.12 0 0 0 0-41.728 30.592 30.592 0 0 0-42.752 0z"
  7183. })
  7184. ]));
  7185. }
  7186. });
  7187. var arrow_down_default = arrow_down_vue_vue_type_script_setup_true_lang_default;
  7188. var arrow_left_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  7189. name: "ArrowLeft",
  7190. __name: "arrow-left",
  7191. setup(__props) {
  7192. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  7193. xmlns: "http://www.w3.org/2000/svg",
  7194. viewBox: "0 0 1024 1024"
  7195. }, [
  7196. createElementVNode("path", {
  7197. fill: "currentColor",
  7198. d: "M609.408 149.376 277.76 489.6a32 32 0 0 0 0 44.672l331.648 340.352a29.12 29.12 0 0 0 41.728 0 30.592 30.592 0 0 0 0-42.752L339.264 511.936l311.872-319.872a30.592 30.592 0 0 0 0-42.688 29.12 29.12 0 0 0-41.728 0z"
  7199. })
  7200. ]));
  7201. }
  7202. });
  7203. var arrow_left_default = arrow_left_vue_vue_type_script_setup_true_lang_default;
  7204. var arrow_right_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  7205. name: "ArrowRight",
  7206. __name: "arrow-right",
  7207. setup(__props) {
  7208. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  7209. xmlns: "http://www.w3.org/2000/svg",
  7210. viewBox: "0 0 1024 1024"
  7211. }, [
  7212. createElementVNode("path", {
  7213. fill: "currentColor",
  7214. d: "M340.864 149.312a30.592 30.592 0 0 0 0 42.752L652.736 512 340.864 831.872a30.592 30.592 0 0 0 0 42.752 29.12 29.12 0 0 0 41.728 0L714.24 534.336a32 32 0 0 0 0-44.672L382.592 149.376a29.12 29.12 0 0 0-41.728 0z"
  7215. })
  7216. ]));
  7217. }
  7218. });
  7219. var arrow_right_default = arrow_right_vue_vue_type_script_setup_true_lang_default;
  7220. var arrow_up_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  7221. name: "ArrowUp",
  7222. __name: "arrow-up",
  7223. setup(__props) {
  7224. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  7225. xmlns: "http://www.w3.org/2000/svg",
  7226. viewBox: "0 0 1024 1024"
  7227. }, [
  7228. createElementVNode("path", {
  7229. fill: "currentColor",
  7230. 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"
  7231. })
  7232. ]));
  7233. }
  7234. });
  7235. var arrow_up_default = arrow_up_vue_vue_type_script_setup_true_lang_default;
  7236. var back_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  7237. name: "Back",
  7238. __name: "back",
  7239. setup(__props) {
  7240. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  7241. xmlns: "http://www.w3.org/2000/svg",
  7242. viewBox: "0 0 1024 1024"
  7243. }, [
  7244. createElementVNode("path", {
  7245. fill: "currentColor",
  7246. d: "M224 480h640a32 32 0 1 1 0 64H224a32 32 0 0 1 0-64"
  7247. }),
  7248. createElementVNode("path", {
  7249. fill: "currentColor",
  7250. 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"
  7251. })
  7252. ]));
  7253. }
  7254. });
  7255. var back_default = back_vue_vue_type_script_setup_true_lang_default;
  7256. var calendar_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  7257. name: "Calendar",
  7258. __name: "calendar",
  7259. setup(__props) {
  7260. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  7261. xmlns: "http://www.w3.org/2000/svg",
  7262. viewBox: "0 0 1024 1024"
  7263. }, [
  7264. createElementVNode("path", {
  7265. fill: "currentColor",
  7266. 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"
  7267. })
  7268. ]));
  7269. }
  7270. });
  7271. var calendar_default = calendar_vue_vue_type_script_setup_true_lang_default;
  7272. var caret_right_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  7273. name: "CaretRight",
  7274. __name: "caret-right",
  7275. setup(__props) {
  7276. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  7277. xmlns: "http://www.w3.org/2000/svg",
  7278. viewBox: "0 0 1024 1024"
  7279. }, [
  7280. createElementVNode("path", {
  7281. fill: "currentColor",
  7282. d: "M384 192v640l384-320.064z"
  7283. })
  7284. ]));
  7285. }
  7286. });
  7287. var caret_right_default = caret_right_vue_vue_type_script_setup_true_lang_default;
  7288. var caret_top_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  7289. name: "CaretTop",
  7290. __name: "caret-top",
  7291. setup(__props) {
  7292. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  7293. xmlns: "http://www.w3.org/2000/svg",
  7294. viewBox: "0 0 1024 1024"
  7295. }, [
  7296. createElementVNode("path", {
  7297. fill: "currentColor",
  7298. d: "M512 320 192 704h639.936z"
  7299. })
  7300. ]));
  7301. }
  7302. });
  7303. var caret_top_default = caret_top_vue_vue_type_script_setup_true_lang_default;
  7304. var check_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  7305. name: "Check",
  7306. __name: "check",
  7307. setup(__props) {
  7308. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  7309. xmlns: "http://www.w3.org/2000/svg",
  7310. viewBox: "0 0 1024 1024"
  7311. }, [
  7312. createElementVNode("path", {
  7313. fill: "currentColor",
  7314. 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"
  7315. })
  7316. ]));
  7317. }
  7318. });
  7319. var check_default = check_vue_vue_type_script_setup_true_lang_default;
  7320. var circle_check_filled_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  7321. name: "CircleCheckFilled",
  7322. __name: "circle-check-filled",
  7323. setup(__props) {
  7324. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  7325. xmlns: "http://www.w3.org/2000/svg",
  7326. viewBox: "0 0 1024 1024"
  7327. }, [
  7328. createElementVNode("path", {
  7329. fill: "currentColor",
  7330. d: "M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m-55.808 536.384-99.52-99.584a38.4 38.4 0 1 0-54.336 54.336l126.72 126.72a38.272 38.272 0 0 0 54.336 0l262.4-262.464a38.4 38.4 0 1 0-54.272-54.336z"
  7331. })
  7332. ]));
  7333. }
  7334. });
  7335. var circle_check_filled_default = circle_check_filled_vue_vue_type_script_setup_true_lang_default;
  7336. var circle_check_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  7337. name: "CircleCheck",
  7338. __name: "circle-check",
  7339. setup(__props) {
  7340. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  7341. xmlns: "http://www.w3.org/2000/svg",
  7342. viewBox: "0 0 1024 1024"
  7343. }, [
  7344. createElementVNode("path", {
  7345. fill: "currentColor",
  7346. 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"
  7347. }),
  7348. createElementVNode("path", {
  7349. fill: "currentColor",
  7350. d: "M745.344 361.344a32 32 0 0 1 45.312 45.312l-288 288a32 32 0 0 1-45.312 0l-160-160a32 32 0 1 1 45.312-45.312L480 626.752l265.344-265.408z"
  7351. })
  7352. ]));
  7353. }
  7354. });
  7355. var circle_check_default = circle_check_vue_vue_type_script_setup_true_lang_default;
  7356. var circle_close_filled_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  7357. name: "CircleCloseFilled",
  7358. __name: "circle-close-filled",
  7359. setup(__props) {
  7360. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  7361. xmlns: "http://www.w3.org/2000/svg",
  7362. viewBox: "0 0 1024 1024"
  7363. }, [
  7364. createElementVNode("path", {
  7365. fill: "currentColor",
  7366. 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"
  7367. })
  7368. ]));
  7369. }
  7370. });
  7371. var circle_close_filled_default = circle_close_filled_vue_vue_type_script_setup_true_lang_default;
  7372. var circle_close_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  7373. name: "CircleClose",
  7374. __name: "circle-close",
  7375. setup(__props) {
  7376. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  7377. xmlns: "http://www.w3.org/2000/svg",
  7378. viewBox: "0 0 1024 1024"
  7379. }, [
  7380. createElementVNode("path", {
  7381. fill: "currentColor",
  7382. 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"
  7383. }),
  7384. createElementVNode("path", {
  7385. fill: "currentColor",
  7386. 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"
  7387. })
  7388. ]));
  7389. }
  7390. });
  7391. var circle_close_default = circle_close_vue_vue_type_script_setup_true_lang_default;
  7392. var clock_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  7393. name: "Clock",
  7394. __name: "clock",
  7395. setup(__props) {
  7396. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  7397. xmlns: "http://www.w3.org/2000/svg",
  7398. viewBox: "0 0 1024 1024"
  7399. }, [
  7400. createElementVNode("path", {
  7401. fill: "currentColor",
  7402. 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"
  7403. }),
  7404. createElementVNode("path", {
  7405. fill: "currentColor",
  7406. d: "M480 256a32 32 0 0 1 32 32v256a32 32 0 0 1-64 0V288a32 32 0 0 1 32-32"
  7407. }),
  7408. createElementVNode("path", {
  7409. fill: "currentColor",
  7410. d: "M480 512h256q32 0 32 32t-32 32H480q-32 0-32-32t32-32"
  7411. })
  7412. ]));
  7413. }
  7414. });
  7415. var clock_default = clock_vue_vue_type_script_setup_true_lang_default;
  7416. var close_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  7417. name: "Close",
  7418. __name: "close",
  7419. setup(__props) {
  7420. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  7421. xmlns: "http://www.w3.org/2000/svg",
  7422. viewBox: "0 0 1024 1024"
  7423. }, [
  7424. createElementVNode("path", {
  7425. fill: "currentColor",
  7426. 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"
  7427. })
  7428. ]));
  7429. }
  7430. });
  7431. var close_default = close_vue_vue_type_script_setup_true_lang_default;
  7432. var d_arrow_left_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  7433. name: "DArrowLeft",
  7434. __name: "d-arrow-left",
  7435. setup(__props) {
  7436. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  7437. xmlns: "http://www.w3.org/2000/svg",
  7438. viewBox: "0 0 1024 1024"
  7439. }, [
  7440. createElementVNode("path", {
  7441. fill: "currentColor",
  7442. d: "M529.408 149.376a29.12 29.12 0 0 1 41.728 0 30.592 30.592 0 0 1 0 42.688L259.264 511.936l311.872 319.936a30.592 30.592 0 0 1-.512 43.264 29.12 29.12 0 0 1-41.216-.512L197.76 534.272a32 32 0 0 1 0-44.672l331.648-340.224zm256 0a29.12 29.12 0 0 1 41.728 0 30.592 30.592 0 0 1 0 42.688L515.264 511.936l311.872 319.936a30.592 30.592 0 0 1-.512 43.264 29.12 29.12 0 0 1-41.216-.512L453.76 534.272a32 32 0 0 1 0-44.672l331.648-340.224z"
  7443. })
  7444. ]));
  7445. }
  7446. });
  7447. var d_arrow_left_default = d_arrow_left_vue_vue_type_script_setup_true_lang_default;
  7448. var d_arrow_right_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  7449. name: "DArrowRight",
  7450. __name: "d-arrow-right",
  7451. setup(__props) {
  7452. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  7453. xmlns: "http://www.w3.org/2000/svg",
  7454. viewBox: "0 0 1024 1024"
  7455. }, [
  7456. createElementVNode("path", {
  7457. fill: "currentColor",
  7458. d: "M452.864 149.312a29.12 29.12 0 0 1 41.728.064L826.24 489.664a32 32 0 0 1 0 44.672L494.592 874.624a29.12 29.12 0 0 1-41.728 0 30.592 30.592 0 0 1 0-42.752L764.736 512 452.864 192a30.592 30.592 0 0 1 0-42.688m-256 0a29.12 29.12 0 0 1 41.728.064L570.24 489.664a32 32 0 0 1 0 44.672L238.592 874.624a29.12 29.12 0 0 1-41.728 0 30.592 30.592 0 0 1 0-42.752L508.736 512 196.864 192a30.592 30.592 0 0 1 0-42.688z"
  7459. })
  7460. ]));
  7461. }
  7462. });
  7463. var d_arrow_right_default = d_arrow_right_vue_vue_type_script_setup_true_lang_default;
  7464. var delete_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  7465. name: "Delete",
  7466. __name: "delete",
  7467. setup(__props) {
  7468. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  7469. xmlns: "http://www.w3.org/2000/svg",
  7470. viewBox: "0 0 1024 1024"
  7471. }, [
  7472. createElementVNode("path", {
  7473. fill: "currentColor",
  7474. 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"
  7475. })
  7476. ]));
  7477. }
  7478. });
  7479. var delete_default = delete_vue_vue_type_script_setup_true_lang_default;
  7480. var document_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  7481. name: "Document",
  7482. __name: "document",
  7483. setup(__props) {
  7484. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  7485. xmlns: "http://www.w3.org/2000/svg",
  7486. viewBox: "0 0 1024 1024"
  7487. }, [
  7488. createElementVNode("path", {
  7489. fill: "currentColor",
  7490. 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"
  7491. })
  7492. ]));
  7493. }
  7494. });
  7495. var document_default = document_vue_vue_type_script_setup_true_lang_default;
  7496. var full_screen_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  7497. name: "FullScreen",
  7498. __name: "full-screen",
  7499. setup(__props) {
  7500. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  7501. xmlns: "http://www.w3.org/2000/svg",
  7502. viewBox: "0 0 1024 1024"
  7503. }, [
  7504. createElementVNode("path", {
  7505. fill: "currentColor",
  7506. d: "m160 96.064 192 .192a32 32 0 0 1 0 64l-192-.192V352a32 32 0 0 1-64 0V96h64zm0 831.872V928H96V672a32 32 0 1 1 64 0v191.936l192-.192a32 32 0 1 1 0 64zM864 96.064V96h64v256a32 32 0 1 1-64 0V160.064l-192 .192a32 32 0 1 1 0-64l192-.192zm0 831.872-192-.192a32 32 0 0 1 0-64l192 .192V672a32 32 0 1 1 64 0v256h-64z"
  7507. })
  7508. ]));
  7509. }
  7510. });
  7511. var full_screen_default = full_screen_vue_vue_type_script_setup_true_lang_default;
  7512. var hide_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  7513. name: "Hide",
  7514. __name: "hide",
  7515. setup(__props) {
  7516. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  7517. xmlns: "http://www.w3.org/2000/svg",
  7518. viewBox: "0 0 1024 1024"
  7519. }, [
  7520. createElementVNode("path", {
  7521. fill: "currentColor",
  7522. d: "M876.8 156.8c0-9.6-3.2-16-9.6-22.4-6.4-6.4-12.8-9.6-22.4-9.6-9.6 0-16 3.2-22.4 9.6L736 220.8c-64-32-137.6-51.2-224-60.8-160 16-288 73.6-377.6 176C44.8 438.4 0 496 0 512s48 73.6 134.4 176c22.4 25.6 44.8 48 73.6 67.2l-86.4 89.6c-6.4 6.4-9.6 12.8-9.6 22.4 0 9.6 3.2 16 9.6 22.4 6.4 6.4 12.8 9.6 22.4 9.6 9.6 0 16-3.2 22.4-9.6l704-710.4c3.2-6.4 6.4-12.8 6.4-22.4Zm-646.4 528c-76.8-70.4-128-128-153.6-172.8 28.8-48 80-105.6 153.6-172.8C304 272 400 230.4 512 224c64 3.2 124.8 19.2 176 44.8l-54.4 54.4C598.4 300.8 560 288 512 288c-64 0-115.2 22.4-160 64s-64 96-64 160c0 48 12.8 89.6 35.2 124.8L256 707.2c-9.6-6.4-19.2-16-25.6-22.4Zm140.8-96c-12.8-22.4-19.2-48-19.2-76.8 0-44.8 16-83.2 48-112 32-28.8 67.2-48 112-48 28.8 0 54.4 6.4 73.6 19.2zM889.599 336c-12.8-16-28.8-28.8-41.6-41.6l-48 48c73.6 67.2 124.8 124.8 150.4 169.6-28.8 48-80 105.6-153.6 172.8-73.6 67.2-172.8 108.8-284.8 115.2-51.2-3.2-99.2-12.8-140.8-28.8l-48 48c57.6 22.4 118.4 38.4 188.8 44.8 160-16 288-73.6 377.6-176C979.199 585.6 1024 528 1024 512s-48.001-73.6-134.401-176Z"
  7523. }),
  7524. createElementVNode("path", {
  7525. fill: "currentColor",
  7526. d: "M511.998 672c-12.8 0-25.6-3.2-38.4-6.4l-51.2 51.2c28.8 12.8 57.6 19.2 89.6 19.2 64 0 115.2-22.4 160-64 41.6-41.6 64-96 64-160 0-32-6.4-64-19.2-89.6l-51.2 51.2c3.2 12.8 6.4 25.6 6.4 38.4 0 44.8-16 83.2-48 112-32 28.8-67.2 48-112 48Z"
  7527. })
  7528. ]));
  7529. }
  7530. });
  7531. var hide_default = hide_vue_vue_type_script_setup_true_lang_default;
  7532. var info_filled_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  7533. name: "InfoFilled",
  7534. __name: "info-filled",
  7535. setup(__props) {
  7536. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  7537. xmlns: "http://www.w3.org/2000/svg",
  7538. viewBox: "0 0 1024 1024"
  7539. }, [
  7540. createElementVNode("path", {
  7541. fill: "currentColor",
  7542. d: "M512 64a448 448 0 1 1 0 896.064A448 448 0 0 1 512 64m67.2 275.072c33.28 0 60.288-23.104 60.288-57.344s-27.072-57.344-60.288-57.344c-33.28 0-60.16 23.104-60.16 57.344s26.88 57.344 60.16 57.344M590.912 699.2c0-6.848 2.368-24.64 1.024-34.752l-52.608 60.544c-10.88 11.456-24.512 19.392-30.912 17.28a12.992 12.992 0 0 1-8.256-14.72l87.68-276.992c7.168-35.136-12.544-67.2-54.336-71.296-44.096 0-108.992 44.736-148.48 101.504 0 6.784-1.28 23.68.064 33.792l52.544-60.608c10.88-11.328 23.552-19.328 29.952-17.152a12.8 12.8 0 0 1 7.808 16.128L388.48 728.576c-10.048 32.256 8.96 63.872 55.04 71.04 67.84 0 107.904-43.648 147.456-100.416z"
  7543. })
  7544. ]));
  7545. }
  7546. });
  7547. var info_filled_default = info_filled_vue_vue_type_script_setup_true_lang_default;
  7548. var loading_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  7549. name: "Loading",
  7550. __name: "loading",
  7551. setup(__props) {
  7552. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  7553. xmlns: "http://www.w3.org/2000/svg",
  7554. viewBox: "0 0 1024 1024"
  7555. }, [
  7556. createElementVNode("path", {
  7557. fill: "currentColor",
  7558. d: "M512 64a32 32 0 0 1 32 32v192a32 32 0 0 1-64 0V96a32 32 0 0 1 32-32m0 640a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V736a32 32 0 0 1 32-32m448-192a32 32 0 0 1-32 32H736a32 32 0 1 1 0-64h192a32 32 0 0 1 32 32m-640 0a32 32 0 0 1-32 32H96a32 32 0 0 1 0-64h192a32 32 0 0 1 32 32M195.2 195.2a32 32 0 0 1 45.248 0L376.32 331.008a32 32 0 0 1-45.248 45.248L195.2 240.448a32 32 0 0 1 0-45.248zm452.544 452.544a32 32 0 0 1 45.248 0L828.8 783.552a32 32 0 0 1-45.248 45.248L647.744 692.992a32 32 0 0 1 0-45.248zM828.8 195.264a32 32 0 0 1 0 45.184L692.992 376.32a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0m-452.544 452.48a32 32 0 0 1 0 45.248L240.448 828.8a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0z"
  7559. })
  7560. ]));
  7561. }
  7562. });
  7563. var loading_default = loading_vue_vue_type_script_setup_true_lang_default;
  7564. var minus_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  7565. name: "Minus",
  7566. __name: "minus",
  7567. setup(__props) {
  7568. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  7569. xmlns: "http://www.w3.org/2000/svg",
  7570. viewBox: "0 0 1024 1024"
  7571. }, [
  7572. createElementVNode("path", {
  7573. fill: "currentColor",
  7574. d: "M128 544h768a32 32 0 1 0 0-64H128a32 32 0 0 0 0 64"
  7575. })
  7576. ]));
  7577. }
  7578. });
  7579. var minus_default = minus_vue_vue_type_script_setup_true_lang_default;
  7580. var more_filled_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  7581. name: "MoreFilled",
  7582. __name: "more-filled",
  7583. setup(__props) {
  7584. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  7585. xmlns: "http://www.w3.org/2000/svg",
  7586. viewBox: "0 0 1024 1024"
  7587. }, [
  7588. createElementVNode("path", {
  7589. fill: "currentColor",
  7590. 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"
  7591. })
  7592. ]));
  7593. }
  7594. });
  7595. var more_filled_default = more_filled_vue_vue_type_script_setup_true_lang_default;
  7596. var more_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  7597. name: "More",
  7598. __name: "more",
  7599. setup(__props) {
  7600. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  7601. xmlns: "http://www.w3.org/2000/svg",
  7602. viewBox: "0 0 1024 1024"
  7603. }, [
  7604. createElementVNode("path", {
  7605. fill: "currentColor",
  7606. 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"
  7607. })
  7608. ]));
  7609. }
  7610. });
  7611. var more_default = more_vue_vue_type_script_setup_true_lang_default;
  7612. var picture_filled_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  7613. name: "PictureFilled",
  7614. __name: "picture-filled",
  7615. setup(__props) {
  7616. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  7617. xmlns: "http://www.w3.org/2000/svg",
  7618. viewBox: "0 0 1024 1024"
  7619. }, [
  7620. createElementVNode("path", {
  7621. fill: "currentColor",
  7622. 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"
  7623. })
  7624. ]));
  7625. }
  7626. });
  7627. var picture_filled_default = picture_filled_vue_vue_type_script_setup_true_lang_default;
  7628. var plus_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  7629. name: "Plus",
  7630. __name: "plus",
  7631. setup(__props) {
  7632. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  7633. xmlns: "http://www.w3.org/2000/svg",
  7634. viewBox: "0 0 1024 1024"
  7635. }, [
  7636. createElementVNode("path", {
  7637. fill: "currentColor",
  7638. 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"
  7639. })
  7640. ]));
  7641. }
  7642. });
  7643. var plus_default = plus_vue_vue_type_script_setup_true_lang_default;
  7644. var question_filled_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  7645. name: "QuestionFilled",
  7646. __name: "question-filled",
  7647. setup(__props) {
  7648. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  7649. xmlns: "http://www.w3.org/2000/svg",
  7650. viewBox: "0 0 1024 1024"
  7651. }, [
  7652. createElementVNode("path", {
  7653. fill: "currentColor",
  7654. d: "M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m23.744 191.488c-52.096 0-92.928 14.784-123.2 44.352-30.976 29.568-45.76 70.4-45.76 122.496h80.256c0-29.568 5.632-52.8 17.6-68.992 13.376-19.712 35.2-28.864 66.176-28.864 23.936 0 42.944 6.336 56.32 19.712 12.672 13.376 19.712 31.68 19.712 54.912 0 17.6-6.336 34.496-19.008 49.984l-8.448 9.856c-45.76 40.832-73.216 70.4-82.368 89.408-9.856 19.008-14.08 42.24-14.08 68.992v9.856h80.96v-9.856c0-16.896 3.52-31.68 10.56-45.76 6.336-12.672 15.488-24.64 28.16-35.2 33.792-29.568 54.208-48.576 60.544-55.616 16.896-22.528 26.048-51.392 26.048-86.592 0-42.944-14.08-76.736-42.24-101.376-28.16-25.344-65.472-37.312-111.232-37.312zm-12.672 406.208a54.272 54.272 0 0 0-38.72 14.784 49.408 49.408 0 0 0-15.488 38.016c0 15.488 4.928 28.16 15.488 38.016A54.848 54.848 0 0 0 523.072 768c15.488 0 28.16-4.928 38.72-14.784a51.52 51.52 0 0 0 16.192-38.72 51.968 51.968 0 0 0-15.488-38.016 55.936 55.936 0 0 0-39.424-14.784z"
  7655. })
  7656. ]));
  7657. }
  7658. });
  7659. var question_filled_default = question_filled_vue_vue_type_script_setup_true_lang_default;
  7660. var refresh_left_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  7661. name: "RefreshLeft",
  7662. __name: "refresh-left",
  7663. setup(__props) {
  7664. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  7665. xmlns: "http://www.w3.org/2000/svg",
  7666. viewBox: "0 0 1024 1024"
  7667. }, [
  7668. createElementVNode("path", {
  7669. fill: "currentColor",
  7670. 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"
  7671. })
  7672. ]));
  7673. }
  7674. });
  7675. var refresh_left_default = refresh_left_vue_vue_type_script_setup_true_lang_default;
  7676. var refresh_right_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  7677. name: "RefreshRight",
  7678. __name: "refresh-right",
  7679. setup(__props) {
  7680. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  7681. xmlns: "http://www.w3.org/2000/svg",
  7682. viewBox: "0 0 1024 1024"
  7683. }, [
  7684. createElementVNode("path", {
  7685. fill: "currentColor",
  7686. d: "M784.512 230.272v-50.56a32 32 0 1 1 64 0v149.056a32 32 0 0 1-32 32H667.52a32 32 0 1 1 0-64h92.992A320 320 0 1 0 524.8 833.152a320 320 0 0 0 320-320h64a384 384 0 0 1-384 384 384 384 0 0 1-384-384 384 384 0 0 1 643.712-282.88z"
  7687. })
  7688. ]));
  7689. }
  7690. });
  7691. var refresh_right_default = refresh_right_vue_vue_type_script_setup_true_lang_default;
  7692. var scale_to_original_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  7693. name: "ScaleToOriginal",
  7694. __name: "scale-to-original",
  7695. setup(__props) {
  7696. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  7697. xmlns: "http://www.w3.org/2000/svg",
  7698. viewBox: "0 0 1024 1024"
  7699. }, [
  7700. createElementVNode("path", {
  7701. fill: "currentColor",
  7702. d: "M813.176 180.706a60.235 60.235 0 0 1 60.236 60.235v481.883a60.235 60.235 0 0 1-60.236 60.235H210.824a60.235 60.235 0 0 1-60.236-60.235V240.94a60.235 60.235 0 0 1 60.236-60.235h602.352zm0-60.235H210.824A120.47 120.47 0 0 0 90.353 240.94v481.883a120.47 120.47 0 0 0 120.47 120.47h602.353a120.47 120.47 0 0 0 120.471-120.47V240.94a120.47 120.47 0 0 0-120.47-120.47zm-120.47 180.705a30.118 30.118 0 0 0-30.118 30.118v301.177a30.118 30.118 0 0 0 60.236 0V331.294a30.118 30.118 0 0 0-30.118-30.118zm-361.412 0a30.118 30.118 0 0 0-30.118 30.118v301.177a30.118 30.118 0 1 0 60.236 0V331.294a30.118 30.118 0 0 0-30.118-30.118M512 361.412a30.118 30.118 0 0 0-30.118 30.117v30.118a30.118 30.118 0 0 0 60.236 0V391.53A30.118 30.118 0 0 0 512 361.412M512 512a30.118 30.118 0 0 0-30.118 30.118v30.117a30.118 30.118 0 0 0 60.236 0v-30.117A30.118 30.118 0 0 0 512 512"
  7703. })
  7704. ]));
  7705. }
  7706. });
  7707. var scale_to_original_default = scale_to_original_vue_vue_type_script_setup_true_lang_default;
  7708. var search_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  7709. name: "Search",
  7710. __name: "search",
  7711. setup(__props) {
  7712. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  7713. xmlns: "http://www.w3.org/2000/svg",
  7714. viewBox: "0 0 1024 1024"
  7715. }, [
  7716. createElementVNode("path", {
  7717. fill: "currentColor",
  7718. 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"
  7719. })
  7720. ]));
  7721. }
  7722. });
  7723. var search_default = search_vue_vue_type_script_setup_true_lang_default;
  7724. var sort_down_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  7725. name: "SortDown",
  7726. __name: "sort-down",
  7727. setup(__props) {
  7728. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  7729. xmlns: "http://www.w3.org/2000/svg",
  7730. viewBox: "0 0 1024 1024"
  7731. }, [
  7732. createElementVNode("path", {
  7733. fill: "currentColor",
  7734. 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"
  7735. })
  7736. ]));
  7737. }
  7738. });
  7739. var sort_down_default = sort_down_vue_vue_type_script_setup_true_lang_default;
  7740. var sort_up_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  7741. name: "SortUp",
  7742. __name: "sort-up",
  7743. setup(__props) {
  7744. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  7745. xmlns: "http://www.w3.org/2000/svg",
  7746. viewBox: "0 0 1024 1024"
  7747. }, [
  7748. createElementVNode("path", {
  7749. fill: "currentColor",
  7750. 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"
  7751. })
  7752. ]));
  7753. }
  7754. });
  7755. var sort_up_default = sort_up_vue_vue_type_script_setup_true_lang_default;
  7756. var star_filled_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  7757. name: "StarFilled",
  7758. __name: "star-filled",
  7759. setup(__props) {
  7760. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  7761. xmlns: "http://www.w3.org/2000/svg",
  7762. viewBox: "0 0 1024 1024"
  7763. }, [
  7764. createElementVNode("path", {
  7765. fill: "currentColor",
  7766. d: "M283.84 867.84 512 747.776l228.16 119.936a6.4 6.4 0 0 0 9.28-6.72l-43.52-254.08 184.512-179.904a6.4 6.4 0 0 0-3.52-10.88l-255.104-37.12L517.76 147.904a6.4 6.4 0 0 0-11.52 0L392.192 379.072l-255.104 37.12a6.4 6.4 0 0 0-3.52 10.88L318.08 606.976l-43.584 254.08a6.4 6.4 0 0 0 9.28 6.72z"
  7767. })
  7768. ]));
  7769. }
  7770. });
  7771. var star_filled_default = star_filled_vue_vue_type_script_setup_true_lang_default;
  7772. var star_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  7773. name: "Star",
  7774. __name: "star",
  7775. setup(__props) {
  7776. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  7777. xmlns: "http://www.w3.org/2000/svg",
  7778. viewBox: "0 0 1024 1024"
  7779. }, [
  7780. createElementVNode("path", {
  7781. fill: "currentColor",
  7782. 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"
  7783. })
  7784. ]));
  7785. }
  7786. });
  7787. var star_default = star_vue_vue_type_script_setup_true_lang_default;
  7788. var success_filled_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  7789. name: "SuccessFilled",
  7790. __name: "success-filled",
  7791. setup(__props) {
  7792. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  7793. xmlns: "http://www.w3.org/2000/svg",
  7794. viewBox: "0 0 1024 1024"
  7795. }, [
  7796. createElementVNode("path", {
  7797. fill: "currentColor",
  7798. d: "M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m-55.808 536.384-99.52-99.584a38.4 38.4 0 1 0-54.336 54.336l126.72 126.72a38.272 38.272 0 0 0 54.336 0l262.4-262.464a38.4 38.4 0 1 0-54.272-54.336z"
  7799. })
  7800. ]));
  7801. }
  7802. });
  7803. var success_filled_default = success_filled_vue_vue_type_script_setup_true_lang_default;
  7804. var view_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  7805. name: "View",
  7806. __name: "view",
  7807. setup(__props) {
  7808. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  7809. xmlns: "http://www.w3.org/2000/svg",
  7810. viewBox: "0 0 1024 1024"
  7811. }, [
  7812. createElementVNode("path", {
  7813. fill: "currentColor",
  7814. d: "M512 160c320 0 512 352 512 352S832 864 512 864 0 512 0 512s192-352 512-352m0 64c-225.28 0-384.128 208.064-436.8 288 52.608 79.872 211.456 288 436.8 288 225.28 0 384.128-208.064 436.8-288-52.608-79.872-211.456-288-436.8-288zm0 64a224 224 0 1 1 0 448 224 224 0 0 1 0-448m0 64a160.192 160.192 0 0 0-160 160c0 88.192 71.744 160 160 160s160-71.808 160-160-71.744-160-160-160"
  7815. })
  7816. ]));
  7817. }
  7818. });
  7819. var view_default = view_vue_vue_type_script_setup_true_lang_default;
  7820. var warning_filled_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  7821. name: "WarningFilled",
  7822. __name: "warning-filled",
  7823. setup(__props) {
  7824. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  7825. xmlns: "http://www.w3.org/2000/svg",
  7826. viewBox: "0 0 1024 1024"
  7827. }, [
  7828. createElementVNode("path", {
  7829. fill: "currentColor",
  7830. d: "M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m0 192a58.432 58.432 0 0 0-58.24 63.744l23.36 256.384a35.072 35.072 0 0 0 69.76 0l23.296-256.384A58.432 58.432 0 0 0 512 256m0 512a51.2 51.2 0 1 0 0-102.4 51.2 51.2 0 0 0 0 102.4"
  7831. })
  7832. ]));
  7833. }
  7834. });
  7835. var warning_filled_default = warning_filled_vue_vue_type_script_setup_true_lang_default;
  7836. var zoom_in_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  7837. name: "ZoomIn",
  7838. __name: "zoom-in",
  7839. setup(__props) {
  7840. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  7841. xmlns: "http://www.w3.org/2000/svg",
  7842. viewBox: "0 0 1024 1024"
  7843. }, [
  7844. createElementVNode("path", {
  7845. fill: "currentColor",
  7846. 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"
  7847. })
  7848. ]));
  7849. }
  7850. });
  7851. var zoom_in_default = zoom_in_vue_vue_type_script_setup_true_lang_default;
  7852. var zoom_out_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  7853. name: "ZoomOut",
  7854. __name: "zoom-out",
  7855. setup(__props) {
  7856. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  7857. xmlns: "http://www.w3.org/2000/svg",
  7858. viewBox: "0 0 1024 1024"
  7859. }, [
  7860. createElementVNode("path", {
  7861. fill: "currentColor",
  7862. 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"
  7863. })
  7864. ]));
  7865. }
  7866. });
  7867. var zoom_out_default = zoom_out_vue_vue_type_script_setup_true_lang_default;
  7868. /*! Element Plus Icons Vue v2.3.1 */
  7869. const epPropKey = "__epPropKey";
  7870. const definePropType = (val) => val;
  7871. const isEpProp = (val) => isObject$1(val) && !!val[epPropKey];
  7872. const buildProp = (prop, key) => {
  7873. if (!isObject$1(prop) || isEpProp(prop))
  7874. return prop;
  7875. const { values, required, default: defaultValue, type, validator } = prop;
  7876. const _validator = values || validator ? (val) => {
  7877. let valid = false;
  7878. let allowedValues = [];
  7879. if (values) {
  7880. allowedValues = Array.from(values);
  7881. if (hasOwn(prop, "default")) {
  7882. allowedValues.push(defaultValue);
  7883. }
  7884. valid || (valid = allowedValues.includes(val));
  7885. }
  7886. if (validator)
  7887. valid || (valid = validator(val));
  7888. if (!valid && allowedValues.length > 0) {
  7889. const allowValuesText = [...new Set(allowedValues)].map((value) => JSON.stringify(value)).join(", ");
  7890. warn(`Invalid prop: validation failed${key ? ` for prop "${key}"` : ""}. Expected one of [${allowValuesText}], got value ${JSON.stringify(val)}.`);
  7891. }
  7892. return valid;
  7893. } : void 0;
  7894. const epProp = {
  7895. type,
  7896. required: !!required,
  7897. validator: _validator,
  7898. [epPropKey]: true
  7899. };
  7900. if (hasOwn(prop, "default"))
  7901. epProp.default = defaultValue;
  7902. return epProp;
  7903. };
  7904. const buildProps = (props) => fromPairs(Object.entries(props).map(([key, option]) => [
  7905. key,
  7906. buildProp(option, key)
  7907. ]));
  7908. const iconPropType = definePropType([
  7909. String,
  7910. Object,
  7911. Function
  7912. ]);
  7913. const CloseComponents = {
  7914. Close: close_default
  7915. };
  7916. const TypeComponents = {
  7917. Close: close_default,
  7918. SuccessFilled: success_filled_default,
  7919. InfoFilled: info_filled_default,
  7920. WarningFilled: warning_filled_default,
  7921. CircleCloseFilled: circle_close_filled_default
  7922. };
  7923. const TypeComponentsMap = {
  7924. success: success_filled_default,
  7925. warning: warning_filled_default,
  7926. error: circle_close_filled_default,
  7927. info: info_filled_default
  7928. };
  7929. const ValidateComponentsMap = {
  7930. validating: loading_default,
  7931. success: circle_check_default,
  7932. error: circle_close_default
  7933. };
  7934. const withInstall = (main, extra) => {
  7935. main.install = (app) => {
  7936. for (const comp of [main, ...Object.values(extra != null ? extra : {})]) {
  7937. app.component(comp.name, comp);
  7938. }
  7939. };
  7940. if (extra) {
  7941. for (const [key, comp] of Object.entries(extra)) {
  7942. main[key] = comp;
  7943. }
  7944. }
  7945. return main;
  7946. };
  7947. const withInstallFunction = (fn, name) => {
  7948. fn.install = (app) => {
  7949. fn._context = app._context;
  7950. app.config.globalProperties[name] = fn;
  7951. };
  7952. return fn;
  7953. };
  7954. const withInstallDirective = (directive, name) => {
  7955. directive.install = (app) => {
  7956. app.directive(name, directive);
  7957. };
  7958. return directive;
  7959. };
  7960. const withNoopInstall = (component) => {
  7961. component.install = NOOP;
  7962. return component;
  7963. };
  7964. const composeRefs = (...refs) => {
  7965. return (el) => {
  7966. refs.forEach((ref) => {
  7967. if (isFunction$1(ref)) {
  7968. ref(el);
  7969. } else {
  7970. ref.value = el;
  7971. }
  7972. });
  7973. };
  7974. };
  7975. const EVENT_CODE = {
  7976. tab: "Tab",
  7977. enter: "Enter",
  7978. space: "Space",
  7979. left: "ArrowLeft",
  7980. up: "ArrowUp",
  7981. right: "ArrowRight",
  7982. down: "ArrowDown",
  7983. esc: "Escape",
  7984. delete: "Delete",
  7985. backspace: "Backspace",
  7986. numpadEnter: "NumpadEnter",
  7987. pageUp: "PageUp",
  7988. pageDown: "PageDown",
  7989. home: "Home",
  7990. end: "End"
  7991. };
  7992. const datePickTypes = [
  7993. "year",
  7994. "years",
  7995. "month",
  7996. "months",
  7997. "date",
  7998. "dates",
  7999. "week",
  8000. "datetime",
  8001. "datetimerange",
  8002. "daterange",
  8003. "monthrange",
  8004. "yearrange"
  8005. ];
  8006. const WEEK_DAYS = [
  8007. "sun",
  8008. "mon",
  8009. "tue",
  8010. "wed",
  8011. "thu",
  8012. "fri",
  8013. "sat"
  8014. ];
  8015. const UPDATE_MODEL_EVENT = "update:modelValue";
  8016. const CHANGE_EVENT = "change";
  8017. const INPUT_EVENT = "input";
  8018. const INSTALLED_KEY = Symbol("INSTALLED_KEY");
  8019. const componentSizes = ["", "default", "small", "large"];
  8020. const componentSizeMap = {
  8021. large: 40,
  8022. default: 32,
  8023. small: 24
  8024. };
  8025. const isValidComponentSize = (val) => ["", ...componentSizes].includes(val);
  8026. var PatchFlags = /* @__PURE__ */ ((PatchFlags2) => {
  8027. PatchFlags2[PatchFlags2["TEXT"] = 1] = "TEXT";
  8028. PatchFlags2[PatchFlags2["CLASS"] = 2] = "CLASS";
  8029. PatchFlags2[PatchFlags2["STYLE"] = 4] = "STYLE";
  8030. PatchFlags2[PatchFlags2["PROPS"] = 8] = "PROPS";
  8031. PatchFlags2[PatchFlags2["FULL_PROPS"] = 16] = "FULL_PROPS";
  8032. PatchFlags2[PatchFlags2["HYDRATE_EVENTS"] = 32] = "HYDRATE_EVENTS";
  8033. PatchFlags2[PatchFlags2["STABLE_FRAGMENT"] = 64] = "STABLE_FRAGMENT";
  8034. PatchFlags2[PatchFlags2["KEYED_FRAGMENT"] = 128] = "KEYED_FRAGMENT";
  8035. PatchFlags2[PatchFlags2["UNKEYED_FRAGMENT"] = 256] = "UNKEYED_FRAGMENT";
  8036. PatchFlags2[PatchFlags2["NEED_PATCH"] = 512] = "NEED_PATCH";
  8037. PatchFlags2[PatchFlags2["DYNAMIC_SLOTS"] = 1024] = "DYNAMIC_SLOTS";
  8038. PatchFlags2[PatchFlags2["HOISTED"] = -1] = "HOISTED";
  8039. PatchFlags2[PatchFlags2["BAIL"] = -2] = "BAIL";
  8040. return PatchFlags2;
  8041. })(PatchFlags || {});
  8042. function isFragment(node) {
  8043. return isVNode(node) && node.type === Fragment;
  8044. }
  8045. function isComment(node) {
  8046. return isVNode(node) && node.type === Comment;
  8047. }
  8048. function isValidElementNode(node) {
  8049. return isVNode(node) && !isFragment(node) && !isComment(node);
  8050. }
  8051. const getNormalizedProps = (node) => {
  8052. if (!isVNode(node)) {
  8053. return {};
  8054. }
  8055. const raw = node.props || {};
  8056. const type = (isVNode(node.type) ? node.type.props : void 0) || {};
  8057. const props = {};
  8058. Object.keys(type).forEach((key) => {
  8059. if (hasOwn(type[key], "default")) {
  8060. props[key] = type[key].default;
  8061. }
  8062. });
  8063. Object.keys(raw).forEach((key) => {
  8064. props[camelize(key)] = raw[key];
  8065. });
  8066. return props;
  8067. };
  8068. const ensureOnlyChild = (children) => {
  8069. if (!isArray$1(children) || children.length > 1) {
  8070. throw new Error("expect to receive a single Vue element child");
  8071. }
  8072. return children[0];
  8073. };
  8074. const flattedChildren = (children) => {
  8075. const vNodes = isArray$1(children) ? children : [children];
  8076. const result = [];
  8077. vNodes.forEach((child) => {
  8078. var _a;
  8079. if (isArray$1(child)) {
  8080. result.push(...flattedChildren(child));
  8081. } else if (isVNode(child) && ((_a = child.component) == null ? void 0 : _a.subTree)) {
  8082. result.push(child, ...flattedChildren(child.component.subTree));
  8083. } else if (isVNode(child) && isArray$1(child.children)) {
  8084. result.push(...flattedChildren(child.children));
  8085. } else if (isVNode(child) && child.shapeFlag === 2) {
  8086. result.push(...flattedChildren(child.type()));
  8087. } else {
  8088. result.push(child);
  8089. }
  8090. });
  8091. return result;
  8092. };
  8093. const unique = (arr) => [...new Set(arr)];
  8094. const castArray = (arr) => {
  8095. if (!arr && arr !== 0)
  8096. return [];
  8097. return isArray$1(arr) ? arr : [arr];
  8098. };
  8099. const isKorean = (text) => /([\uAC00-\uD7AF\u3130-\u318F])+/gi.test(text);
  8100. const mutable = (val) => val;
  8101. function throttleByRaf(cb) {
  8102. let timer = 0;
  8103. const throttle = (...args) => {
  8104. if (timer) {
  8105. cAF(timer);
  8106. }
  8107. timer = rAF(() => {
  8108. cb(...args);
  8109. timer = 0;
  8110. });
  8111. };
  8112. throttle.cancel = () => {
  8113. cAF(timer);
  8114. timer = 0;
  8115. };
  8116. return throttle;
  8117. }
  8118. const DEFAULT_EXCLUDE_KEYS = ["class", "style"];
  8119. const LISTENER_PREFIX = /^on[A-Z]/;
  8120. const useAttrs = (params = {}) => {
  8121. const { excludeListeners = false, excludeKeys } = params;
  8122. const allExcludeKeys = computed(() => {
  8123. return ((excludeKeys == null ? void 0 : excludeKeys.value) || []).concat(DEFAULT_EXCLUDE_KEYS);
  8124. });
  8125. const instance = getCurrentInstance();
  8126. if (!instance) {
  8127. return computed(() => ({}));
  8128. }
  8129. return computed(() => {
  8130. var _a;
  8131. return fromPairs(Object.entries((_a = instance.proxy) == null ? void 0 : _a.$attrs).filter(([key]) => !allExcludeKeys.value.includes(key) && !(excludeListeners && LISTENER_PREFIX.test(key))));
  8132. });
  8133. };
  8134. function useCalcInputWidth() {
  8135. const calculatorRef = shallowRef();
  8136. const calculatorWidth = ref(0);
  8137. const MINIMUM_INPUT_WIDTH = 11;
  8138. const inputStyle = computed(() => ({
  8139. minWidth: `${Math.max(calculatorWidth.value, MINIMUM_INPUT_WIDTH)}px`
  8140. }));
  8141. const resetCalculatorWidth = () => {
  8142. var _a, _b;
  8143. calculatorWidth.value = (_b = (_a = calculatorRef.value) == null ? void 0 : _a.getBoundingClientRect().width) != null ? _b : 0;
  8144. };
  8145. useResizeObserver(calculatorRef, resetCalculatorWidth);
  8146. return {
  8147. calculatorRef,
  8148. calculatorWidth,
  8149. inputStyle
  8150. };
  8151. }
  8152. const useDeprecated = ({ from, replacement, scope, version, ref, type = "API" }, condition) => {
  8153. watch(() => unref(condition), (val) => {
  8154. }, {
  8155. immediate: true
  8156. });
  8157. };
  8158. const useDraggable = (targetRef, dragRef, draggable, overflow) => {
  8159. let transform = {
  8160. offsetX: 0,
  8161. offsetY: 0
  8162. };
  8163. const onMousedown = (e) => {
  8164. const downX = e.clientX;
  8165. const downY = e.clientY;
  8166. const { offsetX, offsetY } = transform;
  8167. const targetRect = targetRef.value.getBoundingClientRect();
  8168. const targetLeft = targetRect.left;
  8169. const targetTop = targetRect.top;
  8170. const targetWidth = targetRect.width;
  8171. const targetHeight = targetRect.height;
  8172. const clientWidth = document.documentElement.clientWidth;
  8173. const clientHeight = document.documentElement.clientHeight;
  8174. const minLeft = -targetLeft + offsetX;
  8175. const minTop = -targetTop + offsetY;
  8176. const maxLeft = clientWidth - targetLeft - targetWidth + offsetX;
  8177. const maxTop = clientHeight - targetTop - targetHeight + offsetY;
  8178. const onMousemove = (e2) => {
  8179. let moveX = offsetX + e2.clientX - downX;
  8180. let moveY = offsetY + e2.clientY - downY;
  8181. if (!(overflow == null ? void 0 : overflow.value)) {
  8182. moveX = Math.min(Math.max(moveX, minLeft), maxLeft);
  8183. moveY = Math.min(Math.max(moveY, minTop), maxTop);
  8184. }
  8185. transform = {
  8186. offsetX: moveX,
  8187. offsetY: moveY
  8188. };
  8189. if (targetRef.value) {
  8190. targetRef.value.style.transform = `translate(${addUnit(moveX)}, ${addUnit(moveY)})`;
  8191. }
  8192. };
  8193. const onMouseup = () => {
  8194. document.removeEventListener("mousemove", onMousemove);
  8195. document.removeEventListener("mouseup", onMouseup);
  8196. };
  8197. document.addEventListener("mousemove", onMousemove);
  8198. document.addEventListener("mouseup", onMouseup);
  8199. };
  8200. const onDraggable = () => {
  8201. if (dragRef.value && targetRef.value) {
  8202. dragRef.value.addEventListener("mousedown", onMousedown);
  8203. }
  8204. };
  8205. const offDraggable = () => {
  8206. if (dragRef.value && targetRef.value) {
  8207. dragRef.value.removeEventListener("mousedown", onMousedown);
  8208. }
  8209. };
  8210. const resetPosition = () => {
  8211. transform = {
  8212. offsetX: 0,
  8213. offsetY: 0
  8214. };
  8215. if (targetRef.value) {
  8216. targetRef.value.style.transform = "none";
  8217. }
  8218. };
  8219. onMounted(() => {
  8220. watchEffect(() => {
  8221. if (draggable.value) {
  8222. onDraggable();
  8223. } else {
  8224. offDraggable();
  8225. }
  8226. });
  8227. });
  8228. onBeforeUnmount(() => {
  8229. offDraggable();
  8230. });
  8231. return {
  8232. resetPosition
  8233. };
  8234. };
  8235. const useFocus = (el) => {
  8236. return {
  8237. focus: () => {
  8238. var _a, _b;
  8239. (_b = (_a = el.value) == null ? void 0 : _a.focus) == null ? void 0 : _b.call(_a);
  8240. }
  8241. };
  8242. };
  8243. var English = {
  8244. name: "en",
  8245. el: {
  8246. breadcrumb: {
  8247. label: "Breadcrumb"
  8248. },
  8249. colorpicker: {
  8250. confirm: "OK",
  8251. clear: "Clear",
  8252. defaultLabel: "color picker",
  8253. description: "current color is {color}. press enter to select a new color.",
  8254. alphaLabel: "pick alpha value"
  8255. },
  8256. datepicker: {
  8257. now: "Now",
  8258. today: "Today",
  8259. cancel: "Cancel",
  8260. clear: "Clear",
  8261. confirm: "OK",
  8262. dateTablePrompt: "Use the arrow keys and enter to select the day of the month",
  8263. monthTablePrompt: "Use the arrow keys and enter to select the month",
  8264. yearTablePrompt: "Use the arrow keys and enter to select the year",
  8265. selectedDate: "Selected date",
  8266. selectDate: "Select date",
  8267. selectTime: "Select time",
  8268. startDate: "Start Date",
  8269. startTime: "Start Time",
  8270. endDate: "End Date",
  8271. endTime: "End Time",
  8272. prevYear: "Previous Year",
  8273. nextYear: "Next Year",
  8274. prevMonth: "Previous Month",
  8275. nextMonth: "Next Month",
  8276. year: "",
  8277. month1: "January",
  8278. month2: "February",
  8279. month3: "March",
  8280. month4: "April",
  8281. month5: "May",
  8282. month6: "June",
  8283. month7: "July",
  8284. month8: "August",
  8285. month9: "September",
  8286. month10: "October",
  8287. month11: "November",
  8288. month12: "December",
  8289. week: "week",
  8290. weeks: {
  8291. sun: "Sun",
  8292. mon: "Mon",
  8293. tue: "Tue",
  8294. wed: "Wed",
  8295. thu: "Thu",
  8296. fri: "Fri",
  8297. sat: "Sat"
  8298. },
  8299. weeksFull: {
  8300. sun: "Sunday",
  8301. mon: "Monday",
  8302. tue: "Tuesday",
  8303. wed: "Wednesday",
  8304. thu: "Thursday",
  8305. fri: "Friday",
  8306. sat: "Saturday"
  8307. },
  8308. months: {
  8309. jan: "Jan",
  8310. feb: "Feb",
  8311. mar: "Mar",
  8312. apr: "Apr",
  8313. may: "May",
  8314. jun: "Jun",
  8315. jul: "Jul",
  8316. aug: "Aug",
  8317. sep: "Sep",
  8318. oct: "Oct",
  8319. nov: "Nov",
  8320. dec: "Dec"
  8321. }
  8322. },
  8323. inputNumber: {
  8324. decrease: "decrease number",
  8325. increase: "increase number"
  8326. },
  8327. select: {
  8328. loading: "Loading",
  8329. noMatch: "No matching data",
  8330. noData: "No data",
  8331. placeholder: "Select"
  8332. },
  8333. mention: {
  8334. loading: "Loading"
  8335. },
  8336. dropdown: {
  8337. toggleDropdown: "Toggle Dropdown"
  8338. },
  8339. cascader: {
  8340. noMatch: "No matching data",
  8341. loading: "Loading",
  8342. placeholder: "Select",
  8343. noData: "No data"
  8344. },
  8345. pagination: {
  8346. goto: "Go to",
  8347. pagesize: "/page",
  8348. total: "Total {total}",
  8349. pageClassifier: "",
  8350. page: "Page",
  8351. prev: "Go to previous page",
  8352. next: "Go to next page",
  8353. currentPage: "page {pager}",
  8354. prevPages: "Previous {pager} pages",
  8355. nextPages: "Next {pager} pages",
  8356. deprecationWarning: "Deprecated usages detected, please refer to the el-pagination documentation for more details"
  8357. },
  8358. dialog: {
  8359. close: "Close this dialog"
  8360. },
  8361. drawer: {
  8362. close: "Close this dialog"
  8363. },
  8364. messagebox: {
  8365. title: "Message",
  8366. confirm: "OK",
  8367. cancel: "Cancel",
  8368. error: "Illegal input",
  8369. close: "Close this dialog"
  8370. },
  8371. upload: {
  8372. deleteTip: "press delete to remove",
  8373. delete: "Delete",
  8374. preview: "Preview",
  8375. continue: "Continue"
  8376. },
  8377. slider: {
  8378. defaultLabel: "slider between {min} and {max}",
  8379. defaultRangeStartLabel: "pick start value",
  8380. defaultRangeEndLabel: "pick end value"
  8381. },
  8382. table: {
  8383. emptyText: "No Data",
  8384. confirmFilter: "Confirm",
  8385. resetFilter: "Reset",
  8386. clearFilter: "All",
  8387. sumText: "Sum"
  8388. },
  8389. tour: {
  8390. next: "Next",
  8391. previous: "Previous",
  8392. finish: "Finish"
  8393. },
  8394. tree: {
  8395. emptyText: "No Data"
  8396. },
  8397. transfer: {
  8398. noMatch: "No matching data",
  8399. noData: "No data",
  8400. titles: ["List 1", "List 2"],
  8401. filterPlaceholder: "Enter keyword",
  8402. noCheckedFormat: "{total} items",
  8403. hasCheckedFormat: "{checked}/{total} checked"
  8404. },
  8405. image: {
  8406. error: "FAILED"
  8407. },
  8408. pageHeader: {
  8409. title: "Back"
  8410. },
  8411. popconfirm: {
  8412. confirmButtonText: "Yes",
  8413. cancelButtonText: "No"
  8414. },
  8415. carousel: {
  8416. leftArrow: "Carousel arrow left",
  8417. rightArrow: "Carousel arrow right",
  8418. indicator: "Carousel switch to index {index}"
  8419. }
  8420. }
  8421. };
  8422. const buildTranslator = (locale) => (path, option) => translate(path, option, unref(locale));
  8423. const translate = (path, option, locale) => get(locale, path, path).replace(/\{(\w+)\}/g, (_, key) => {
  8424. var _a;
  8425. return `${(_a = option == null ? void 0 : option[key]) != null ? _a : `{${key}}`}`;
  8426. });
  8427. const buildLocaleContext = (locale) => {
  8428. const lang = computed(() => unref(locale).name);
  8429. const localeRef = isRef(locale) ? locale : ref(locale);
  8430. return {
  8431. lang,
  8432. locale: localeRef,
  8433. t: buildTranslator(locale)
  8434. };
  8435. };
  8436. const localeContextKey = Symbol("localeContextKey");
  8437. const useLocale = (localeOverrides) => {
  8438. const locale = localeOverrides || inject(localeContextKey, ref());
  8439. return buildLocaleContext(computed(() => locale.value || English));
  8440. };
  8441. const defaultNamespace = "el";
  8442. const statePrefix = "is-";
  8443. const _bem = (namespace, block, blockSuffix, element, modifier) => {
  8444. let cls = `${namespace}-${block}`;
  8445. if (blockSuffix) {
  8446. cls += `-${blockSuffix}`;
  8447. }
  8448. if (element) {
  8449. cls += `__${element}`;
  8450. }
  8451. if (modifier) {
  8452. cls += `--${modifier}`;
  8453. }
  8454. return cls;
  8455. };
  8456. const namespaceContextKey = Symbol("namespaceContextKey");
  8457. const useGetDerivedNamespace = (namespaceOverrides) => {
  8458. const derivedNamespace = namespaceOverrides || (getCurrentInstance() ? inject(namespaceContextKey, ref(defaultNamespace)) : ref(defaultNamespace));
  8459. const namespace = computed(() => {
  8460. return unref(derivedNamespace) || defaultNamespace;
  8461. });
  8462. return namespace;
  8463. };
  8464. const useNamespace = (block, namespaceOverrides) => {
  8465. const namespace = useGetDerivedNamespace(namespaceOverrides);
  8466. const b = (blockSuffix = "") => _bem(namespace.value, block, blockSuffix, "", "");
  8467. const e = (element) => element ? _bem(namespace.value, block, "", element, "") : "";
  8468. const m = (modifier) => modifier ? _bem(namespace.value, block, "", "", modifier) : "";
  8469. const be = (blockSuffix, element) => blockSuffix && element ? _bem(namespace.value, block, blockSuffix, element, "") : "";
  8470. const em = (element, modifier) => element && modifier ? _bem(namespace.value, block, "", element, modifier) : "";
  8471. const bm = (blockSuffix, modifier) => blockSuffix && modifier ? _bem(namespace.value, block, blockSuffix, "", modifier) : "";
  8472. const bem = (blockSuffix, element, modifier) => blockSuffix && element && modifier ? _bem(namespace.value, block, blockSuffix, element, modifier) : "";
  8473. const is = (name, ...args) => {
  8474. const state = args.length >= 1 ? args[0] : true;
  8475. return name && state ? `${statePrefix}${name}` : "";
  8476. };
  8477. const cssVar = (object) => {
  8478. const styles = {};
  8479. for (const key in object) {
  8480. if (object[key]) {
  8481. styles[`--${namespace.value}-${key}`] = object[key];
  8482. }
  8483. }
  8484. return styles;
  8485. };
  8486. const cssVarBlock = (object) => {
  8487. const styles = {};
  8488. for (const key in object) {
  8489. if (object[key]) {
  8490. styles[`--${namespace.value}-${block}-${key}`] = object[key];
  8491. }
  8492. }
  8493. return styles;
  8494. };
  8495. const cssVarName = (name) => `--${namespace.value}-${name}`;
  8496. const cssVarBlockName = (name) => `--${namespace.value}-${block}-${name}`;
  8497. return {
  8498. namespace,
  8499. b,
  8500. e,
  8501. m,
  8502. be,
  8503. em,
  8504. bm,
  8505. bem,
  8506. is,
  8507. cssVar,
  8508. cssVarName,
  8509. cssVarBlock,
  8510. cssVarBlockName
  8511. };
  8512. };
  8513. const useLockscreen = (trigger, options = {}) => {
  8514. if (!isRef(trigger)) {
  8515. throwError("[useLockscreen]", "You need to pass a ref param to this function");
  8516. }
  8517. const ns = options.ns || useNamespace("popup");
  8518. const hiddenCls = computed(() => ns.bm("parent", "hidden"));
  8519. if (!isClient || hasClass(document.body, hiddenCls.value)) {
  8520. return;
  8521. }
  8522. let scrollBarWidth = 0;
  8523. let withoutHiddenClass = false;
  8524. let bodyWidth = "0";
  8525. const cleanup = () => {
  8526. setTimeout(() => {
  8527. if (typeof document === "undefined")
  8528. return;
  8529. if (withoutHiddenClass && document) {
  8530. document.body.style.width = bodyWidth;
  8531. removeClass(document.body, hiddenCls.value);
  8532. }
  8533. }, 200);
  8534. };
  8535. watch(trigger, (val) => {
  8536. if (!val) {
  8537. cleanup();
  8538. return;
  8539. }
  8540. withoutHiddenClass = !hasClass(document.body, hiddenCls.value);
  8541. if (withoutHiddenClass) {
  8542. bodyWidth = document.body.style.width;
  8543. addClass(document.body, hiddenCls.value);
  8544. }
  8545. scrollBarWidth = getScrollBarWidth(ns.namespace.value);
  8546. const bodyHasOverflow = document.documentElement.clientHeight < document.body.scrollHeight;
  8547. const bodyOverflowY = getStyle(document.body, "overflowY");
  8548. if (scrollBarWidth > 0 && (bodyHasOverflow || bodyOverflowY === "scroll") && withoutHiddenClass) {
  8549. document.body.style.width = `calc(100% - ${scrollBarWidth}px)`;
  8550. }
  8551. });
  8552. onScopeDispose(() => cleanup());
  8553. };
  8554. const modalStack = [];
  8555. const closeModal = (e) => {
  8556. if (modalStack.length === 0)
  8557. return;
  8558. if (e.code === EVENT_CODE.esc) {
  8559. e.stopPropagation();
  8560. const topModal = modalStack[modalStack.length - 1];
  8561. topModal.handleClose();
  8562. }
  8563. };
  8564. const useModal = (instance, visibleRef) => {
  8565. watch(visibleRef, (val) => {
  8566. if (val) {
  8567. modalStack.push(instance);
  8568. } else {
  8569. modalStack.splice(modalStack.indexOf(instance), 1);
  8570. }
  8571. });
  8572. };
  8573. if (isClient)
  8574. useEventListener(document, "keydown", closeModal);
  8575. const _prop = buildProp({
  8576. type: definePropType(Boolean),
  8577. default: null
  8578. });
  8579. const _event = buildProp({
  8580. type: definePropType(Function)
  8581. });
  8582. const createModelToggleComposable = (name) => {
  8583. const updateEventKey = `update:${name}`;
  8584. const updateEventKeyRaw = `onUpdate:${name}`;
  8585. const useModelToggleEmits2 = [updateEventKey];
  8586. const useModelToggleProps2 = {
  8587. [name]: _prop,
  8588. [updateEventKeyRaw]: _event
  8589. };
  8590. const useModelToggle2 = ({
  8591. indicator,
  8592. toggleReason,
  8593. shouldHideWhenRouteChanges,
  8594. shouldProceed,
  8595. onShow,
  8596. onHide
  8597. }) => {
  8598. const instance = getCurrentInstance();
  8599. const { emit } = instance;
  8600. const props = instance.props;
  8601. const hasUpdateHandler = computed(() => isFunction$1(props[updateEventKeyRaw]));
  8602. const isModelBindingAbsent = computed(() => props[name] === null);
  8603. const doShow = (event) => {
  8604. if (indicator.value === true) {
  8605. return;
  8606. }
  8607. indicator.value = true;
  8608. if (toggleReason) {
  8609. toggleReason.value = event;
  8610. }
  8611. if (isFunction$1(onShow)) {
  8612. onShow(event);
  8613. }
  8614. };
  8615. const doHide = (event) => {
  8616. if (indicator.value === false) {
  8617. return;
  8618. }
  8619. indicator.value = false;
  8620. if (toggleReason) {
  8621. toggleReason.value = event;
  8622. }
  8623. if (isFunction$1(onHide)) {
  8624. onHide(event);
  8625. }
  8626. };
  8627. const show = (event) => {
  8628. if (props.disabled === true || isFunction$1(shouldProceed) && !shouldProceed())
  8629. return;
  8630. const shouldEmit = hasUpdateHandler.value && isClient;
  8631. if (shouldEmit) {
  8632. emit(updateEventKey, true);
  8633. }
  8634. if (isModelBindingAbsent.value || !shouldEmit) {
  8635. doShow(event);
  8636. }
  8637. };
  8638. const hide = (event) => {
  8639. if (props.disabled === true || !isClient)
  8640. return;
  8641. const shouldEmit = hasUpdateHandler.value && isClient;
  8642. if (shouldEmit) {
  8643. emit(updateEventKey, false);
  8644. }
  8645. if (isModelBindingAbsent.value || !shouldEmit) {
  8646. doHide(event);
  8647. }
  8648. };
  8649. const onChange = (val) => {
  8650. if (!isBoolean(val))
  8651. return;
  8652. if (props.disabled && val) {
  8653. if (hasUpdateHandler.value) {
  8654. emit(updateEventKey, false);
  8655. }
  8656. } else if (indicator.value !== val) {
  8657. if (val) {
  8658. doShow();
  8659. } else {
  8660. doHide();
  8661. }
  8662. }
  8663. };
  8664. const toggle = () => {
  8665. if (indicator.value) {
  8666. hide();
  8667. } else {
  8668. show();
  8669. }
  8670. };
  8671. watch(() => props[name], onChange);
  8672. if (shouldHideWhenRouteChanges && instance.appContext.config.globalProperties.$route !== void 0) {
  8673. watch(() => ({
  8674. ...instance.proxy.$route
  8675. }), () => {
  8676. if (shouldHideWhenRouteChanges.value && indicator.value) {
  8677. hide();
  8678. }
  8679. });
  8680. }
  8681. onMounted(() => {
  8682. onChange(props[name]);
  8683. });
  8684. return {
  8685. hide,
  8686. show,
  8687. toggle,
  8688. hasUpdateHandler
  8689. };
  8690. };
  8691. return {
  8692. useModelToggle: useModelToggle2,
  8693. useModelToggleProps: useModelToggleProps2,
  8694. useModelToggleEmits: useModelToggleEmits2
  8695. };
  8696. };
  8697. const { useModelToggle, useModelToggleProps, useModelToggleEmits } = createModelToggleComposable("modelValue");
  8698. const usePreventGlobal = (indicator, evt, cb) => {
  8699. const prevent = (e) => {
  8700. if (cb(e))
  8701. e.stopImmediatePropagation();
  8702. };
  8703. let stop = void 0;
  8704. watch(() => indicator.value, (val) => {
  8705. if (val) {
  8706. stop = useEventListener(document, evt, prevent, true);
  8707. } else {
  8708. stop == null ? void 0 : stop();
  8709. }
  8710. }, { immediate: true });
  8711. };
  8712. const useProp = (name) => {
  8713. const vm = getCurrentInstance();
  8714. return computed(() => {
  8715. var _a, _b;
  8716. return (_b = (_a = vm == null ? void 0 : vm.proxy) == null ? void 0 : _a.$props) == null ? void 0 : _b[name];
  8717. });
  8718. };
  8719. 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});
  8720. const usePopper = (referenceElementRef, popperElementRef, opts = {}) => {
  8721. const stateUpdater = {
  8722. name: "updateState",
  8723. enabled: true,
  8724. phase: "write",
  8725. fn: ({ state }) => {
  8726. const derivedState = deriveState(state);
  8727. Object.assign(states.value, derivedState);
  8728. },
  8729. requires: ["computeStyles"]
  8730. };
  8731. const options = computed(() => {
  8732. const { onFirstUpdate, placement, strategy, modifiers } = unref(opts);
  8733. return {
  8734. onFirstUpdate,
  8735. placement: placement || "bottom",
  8736. strategy: strategy || "absolute",
  8737. modifiers: [
  8738. ...modifiers || [],
  8739. stateUpdater,
  8740. { name: "applyStyles", enabled: false }
  8741. ]
  8742. };
  8743. });
  8744. const instanceRef = shallowRef();
  8745. const states = ref({
  8746. styles: {
  8747. popper: {
  8748. position: unref(options).strategy,
  8749. left: "0",
  8750. top: "0"
  8751. },
  8752. arrow: {
  8753. position: "absolute"
  8754. }
  8755. },
  8756. attributes: {}
  8757. });
  8758. const destroy = () => {
  8759. if (!instanceRef.value)
  8760. return;
  8761. instanceRef.value.destroy();
  8762. instanceRef.value = void 0;
  8763. };
  8764. watch(options, (newOptions) => {
  8765. const instance = unref(instanceRef);
  8766. if (instance) {
  8767. instance.setOptions(newOptions);
  8768. }
  8769. }, {
  8770. deep: true
  8771. });
  8772. watch([referenceElementRef, popperElementRef], ([referenceElement, popperElement]) => {
  8773. destroy();
  8774. if (!referenceElement || !popperElement)
  8775. return;
  8776. instanceRef.value = yn(referenceElement, popperElement, unref(options));
  8777. });
  8778. onBeforeUnmount(() => {
  8779. destroy();
  8780. });
  8781. return {
  8782. state: computed(() => {
  8783. var _a;
  8784. return { ...((_a = unref(instanceRef)) == null ? void 0 : _a.state) || {} };
  8785. }),
  8786. styles: computed(() => unref(states).styles),
  8787. attributes: computed(() => unref(states).attributes),
  8788. update: () => {
  8789. var _a;
  8790. return (_a = unref(instanceRef)) == null ? void 0 : _a.update();
  8791. },
  8792. forceUpdate: () => {
  8793. var _a;
  8794. return (_a = unref(instanceRef)) == null ? void 0 : _a.forceUpdate();
  8795. },
  8796. instanceRef: computed(() => unref(instanceRef))
  8797. };
  8798. };
  8799. function deriveState(state) {
  8800. const elements = Object.keys(state.elements);
  8801. const styles = fromPairs(elements.map((element) => [element, state.styles[element] || {}]));
  8802. const attributes = fromPairs(elements.map((element) => [element, state.attributes[element]]));
  8803. return {
  8804. styles,
  8805. attributes
  8806. };
  8807. }
  8808. const useSameTarget = (handleClick) => {
  8809. if (!handleClick) {
  8810. return { onClick: NOOP, onMousedown: NOOP, onMouseup: NOOP };
  8811. }
  8812. let mousedownTarget = false;
  8813. let mouseupTarget = false;
  8814. const onClick = (e) => {
  8815. if (mousedownTarget && mouseupTarget) {
  8816. handleClick(e);
  8817. }
  8818. mousedownTarget = mouseupTarget = false;
  8819. };
  8820. const onMousedown = (e) => {
  8821. mousedownTarget = e.target === e.currentTarget;
  8822. };
  8823. const onMouseup = (e) => {
  8824. mouseupTarget = e.target === e.currentTarget;
  8825. };
  8826. return { onClick, onMousedown, onMouseup };
  8827. };
  8828. const useTeleport = (contentRenderer, appendToBody) => {
  8829. const isTeleportVisible = ref(false);
  8830. if (!isClient) {
  8831. return {
  8832. isTeleportVisible,
  8833. showTeleport: NOOP,
  8834. hideTeleport: NOOP,
  8835. renderTeleport: NOOP
  8836. };
  8837. }
  8838. let $el = null;
  8839. const showTeleport = () => {
  8840. isTeleportVisible.value = true;
  8841. if ($el !== null)
  8842. return;
  8843. $el = createGlobalNode();
  8844. };
  8845. const hideTeleport = () => {
  8846. isTeleportVisible.value = false;
  8847. if ($el !== null) {
  8848. removeGlobalNode($el);
  8849. $el = null;
  8850. }
  8851. };
  8852. const renderTeleport = () => {
  8853. return appendToBody.value !== true ? contentRenderer() : isTeleportVisible.value ? [h$1(Teleport$1, { to: $el }, contentRenderer())] : void 0;
  8854. };
  8855. onUnmounted(hideTeleport);
  8856. return {
  8857. isTeleportVisible,
  8858. showTeleport,
  8859. hideTeleport,
  8860. renderTeleport
  8861. };
  8862. };
  8863. const useThrottleRender = (loading, throttle = 0) => {
  8864. if (throttle === 0)
  8865. return loading;
  8866. const initVal = isObject$1(throttle) && Boolean(throttle.initVal);
  8867. const throttled = ref(initVal);
  8868. let timeoutHandle = null;
  8869. const dispatchThrottling = (timer) => {
  8870. if (isUndefined(timer)) {
  8871. throttled.value = loading.value;
  8872. return;
  8873. }
  8874. if (timeoutHandle) {
  8875. clearTimeout(timeoutHandle);
  8876. }
  8877. timeoutHandle = setTimeout(() => {
  8878. throttled.value = loading.value;
  8879. }, timer);
  8880. };
  8881. const dispatcher = (type) => {
  8882. if (type === "leading") {
  8883. if (isNumber(throttle)) {
  8884. dispatchThrottling(throttle);
  8885. } else {
  8886. dispatchThrottling(throttle.leading);
  8887. }
  8888. } else {
  8889. if (isObject$1(throttle)) {
  8890. dispatchThrottling(throttle.trailing);
  8891. } else {
  8892. throttled.value = false;
  8893. }
  8894. }
  8895. };
  8896. onMounted(() => dispatcher("leading"));
  8897. watch(() => loading.value, (val) => {
  8898. dispatcher(val ? "leading" : "trailing");
  8899. });
  8900. return throttled;
  8901. };
  8902. function useTimeout() {
  8903. let timeoutHandle;
  8904. const registerTimeout = (fn, delay) => {
  8905. cancelTimeout();
  8906. timeoutHandle = window.setTimeout(fn, delay);
  8907. };
  8908. const cancelTimeout = () => window.clearTimeout(timeoutHandle);
  8909. tryOnScopeDispose(() => cancelTimeout());
  8910. return {
  8911. registerTimeout,
  8912. cancelTimeout
  8913. };
  8914. }
  8915. const AFTER_APPEAR = "after-appear";
  8916. const AFTER_ENTER = "after-enter";
  8917. const AFTER_LEAVE = "after-leave";
  8918. const APPEAR = "appear";
  8919. const APPEAR_CANCELLED = "appear-cancelled";
  8920. const BEFORE_ENTER = "before-enter";
  8921. const BEFORE_LEAVE = "before-leave";
  8922. const ENTER = "enter";
  8923. const ENTER_CANCELLED = "enter-cancelled";
  8924. const LEAVE = "leave";
  8925. const LEAVE_CANCELLED = "leave-cancelled";
  8926. const useTransitionFallthroughEmits = [
  8927. AFTER_APPEAR,
  8928. AFTER_ENTER,
  8929. AFTER_LEAVE,
  8930. APPEAR,
  8931. APPEAR_CANCELLED,
  8932. BEFORE_ENTER,
  8933. BEFORE_LEAVE,
  8934. ENTER,
  8935. ENTER_CANCELLED,
  8936. LEAVE,
  8937. LEAVE_CANCELLED
  8938. ];
  8939. const useTransitionFallthrough = () => {
  8940. const { emit } = getCurrentInstance();
  8941. return {
  8942. onAfterAppear: () => {
  8943. emit(AFTER_APPEAR);
  8944. },
  8945. onAfterEnter: () => {
  8946. emit(AFTER_ENTER);
  8947. },
  8948. onAfterLeave: () => {
  8949. emit(AFTER_LEAVE);
  8950. },
  8951. onAppearCancelled: () => {
  8952. emit(APPEAR_CANCELLED);
  8953. },
  8954. onBeforeEnter: () => {
  8955. emit(BEFORE_ENTER);
  8956. },
  8957. onBeforeLeave: () => {
  8958. emit(BEFORE_LEAVE);
  8959. },
  8960. onEnter: () => {
  8961. emit(ENTER);
  8962. },
  8963. onEnterCancelled: () => {
  8964. emit(ENTER_CANCELLED);
  8965. },
  8966. onLeave: () => {
  8967. emit(LEAVE);
  8968. },
  8969. onLeaveCancelled: () => {
  8970. emit(LEAVE_CANCELLED);
  8971. }
  8972. };
  8973. };
  8974. const defaultIdInjection = {
  8975. prefix: Math.floor(Math.random() * 1e4),
  8976. current: 0
  8977. };
  8978. const ID_INJECTION_KEY = Symbol("elIdInjection");
  8979. const useIdInjection = () => {
  8980. return getCurrentInstance() ? inject(ID_INJECTION_KEY, defaultIdInjection) : defaultIdInjection;
  8981. };
  8982. const useId = (deterministicId) => {
  8983. const idInjection = useIdInjection();
  8984. const namespace = useGetDerivedNamespace();
  8985. const idRef = computedEager(() => unref(deterministicId) || `${namespace.value}-id-${idInjection.prefix}-${idInjection.current++}`);
  8986. return idRef;
  8987. };
  8988. let registeredEscapeHandlers = [];
  8989. const cachedHandler = (event) => {
  8990. if (event.code === EVENT_CODE.esc) {
  8991. registeredEscapeHandlers.forEach((registeredHandler) => registeredHandler(event));
  8992. }
  8993. };
  8994. const useEscapeKeydown = (handler) => {
  8995. onMounted(() => {
  8996. if (registeredEscapeHandlers.length === 0) {
  8997. document.addEventListener("keydown", cachedHandler);
  8998. }
  8999. if (isClient)
  9000. registeredEscapeHandlers.push(handler);
  9001. });
  9002. onBeforeUnmount(() => {
  9003. registeredEscapeHandlers = registeredEscapeHandlers.filter((registeredHandler) => registeredHandler !== handler);
  9004. if (registeredEscapeHandlers.length === 0) {
  9005. if (isClient)
  9006. document.removeEventListener("keydown", cachedHandler);
  9007. }
  9008. });
  9009. };
  9010. const usePopperContainerId = () => {
  9011. const namespace = useGetDerivedNamespace();
  9012. const idInjection = useIdInjection();
  9013. const id = computed(() => {
  9014. return `${namespace.value}-popper-container-${idInjection.prefix}`;
  9015. });
  9016. const selector = computed(() => `#${id.value}`);
  9017. return {
  9018. id,
  9019. selector
  9020. };
  9021. };
  9022. const createContainer = (id) => {
  9023. const container = document.createElement("div");
  9024. container.id = id;
  9025. document.body.appendChild(container);
  9026. return container;
  9027. };
  9028. const usePopperContainer = () => {
  9029. const { id, selector } = usePopperContainerId();
  9030. onBeforeMount(() => {
  9031. if (!isClient)
  9032. return;
  9033. if (!document.body.querySelector(selector.value)) {
  9034. createContainer(id.value);
  9035. }
  9036. });
  9037. return {
  9038. id,
  9039. selector
  9040. };
  9041. };
  9042. const useDelayedRender = ({
  9043. indicator,
  9044. intermediateIndicator,
  9045. shouldSetIntermediate = () => true,
  9046. beforeShow,
  9047. afterShow,
  9048. afterHide,
  9049. beforeHide
  9050. }) => {
  9051. watch(() => unref(indicator), (val) => {
  9052. if (val) {
  9053. beforeShow == null ? void 0 : beforeShow();
  9054. nextTick(() => {
  9055. if (!unref(indicator))
  9056. return;
  9057. if (shouldSetIntermediate("show")) {
  9058. intermediateIndicator.value = true;
  9059. }
  9060. });
  9061. } else {
  9062. beforeHide == null ? void 0 : beforeHide();
  9063. nextTick(() => {
  9064. if (unref(indicator))
  9065. return;
  9066. if (shouldSetIntermediate("hide")) {
  9067. intermediateIndicator.value = false;
  9068. }
  9069. });
  9070. }
  9071. });
  9072. watch(() => intermediateIndicator.value, (val) => {
  9073. if (val) {
  9074. afterShow == null ? void 0 : afterShow();
  9075. } else {
  9076. afterHide == null ? void 0 : afterHide();
  9077. }
  9078. });
  9079. };
  9080. const useDelayedToggleProps = buildProps({
  9081. showAfter: {
  9082. type: Number,
  9083. default: 0
  9084. },
  9085. hideAfter: {
  9086. type: Number,
  9087. default: 200
  9088. },
  9089. autoClose: {
  9090. type: Number,
  9091. default: 0
  9092. }
  9093. });
  9094. const useDelayedToggle = ({
  9095. showAfter,
  9096. hideAfter,
  9097. autoClose,
  9098. open,
  9099. close
  9100. }) => {
  9101. const { registerTimeout } = useTimeout();
  9102. const {
  9103. registerTimeout: registerTimeoutForAutoClose,
  9104. cancelTimeout: cancelTimeoutForAutoClose
  9105. } = useTimeout();
  9106. const onOpen = (event) => {
  9107. registerTimeout(() => {
  9108. open(event);
  9109. const _autoClose = unref(autoClose);
  9110. if (isNumber(_autoClose) && _autoClose > 0) {
  9111. registerTimeoutForAutoClose(() => {
  9112. close(event);
  9113. }, _autoClose);
  9114. }
  9115. }, unref(showAfter));
  9116. };
  9117. const onClose = (event) => {
  9118. cancelTimeoutForAutoClose();
  9119. registerTimeout(() => {
  9120. close(event);
  9121. }, unref(hideAfter));
  9122. };
  9123. return {
  9124. onOpen,
  9125. onClose
  9126. };
  9127. };
  9128. const FORWARD_REF_INJECTION_KEY = Symbol("elForwardRef");
  9129. const useForwardRef = (forwardRef) => {
  9130. const setForwardRef = (el) => {
  9131. forwardRef.value = el;
  9132. };
  9133. provide(FORWARD_REF_INJECTION_KEY, {
  9134. setForwardRef
  9135. });
  9136. };
  9137. const useForwardRefDirective = (setForwardRef) => {
  9138. return {
  9139. mounted(el) {
  9140. setForwardRef(el);
  9141. },
  9142. updated(el) {
  9143. setForwardRef(el);
  9144. },
  9145. unmounted() {
  9146. setForwardRef(null);
  9147. }
  9148. };
  9149. };
  9150. const initial = {
  9151. current: 0
  9152. };
  9153. const zIndex = ref(0);
  9154. const defaultInitialZIndex = 2e3;
  9155. const ZINDEX_INJECTION_KEY = Symbol("elZIndexContextKey");
  9156. const zIndexContextKey = Symbol("zIndexContextKey");
  9157. const useZIndex = (zIndexOverrides) => {
  9158. const increasingInjection = getCurrentInstance() ? inject(ZINDEX_INJECTION_KEY, initial) : initial;
  9159. const zIndexInjection = zIndexOverrides || (getCurrentInstance() ? inject(zIndexContextKey, void 0) : void 0);
  9160. const initialZIndex = computed(() => {
  9161. const zIndexFromInjection = unref(zIndexInjection);
  9162. return isNumber(zIndexFromInjection) ? zIndexFromInjection : defaultInitialZIndex;
  9163. });
  9164. const currentZIndex = computed(() => initialZIndex.value + zIndex.value);
  9165. const nextZIndex = () => {
  9166. increasingInjection.current++;
  9167. zIndex.value = increasingInjection.current;
  9168. return currentZIndex.value;
  9169. };
  9170. if (!isClient && !inject(ZINDEX_INJECTION_KEY)) ;
  9171. return {
  9172. initialZIndex,
  9173. currentZIndex,
  9174. nextZIndex
  9175. };
  9176. };
  9177. function getSide(placement) {
  9178. return placement.split('-')[0];
  9179. }
  9180. function getAlignment(placement) {
  9181. return placement.split('-')[1];
  9182. }
  9183. function getMainAxisFromPlacement(placement) {
  9184. return ['top', 'bottom'].includes(getSide(placement)) ? 'x' : 'y';
  9185. }
  9186. function getLengthFromAxis(axis) {
  9187. return axis === 'y' ? 'height' : 'width';
  9188. }
  9189. function computeCoordsFromPlacement(_ref, placement, rtl) {
  9190. let {
  9191. reference,
  9192. floating
  9193. } = _ref;
  9194. const commonX = reference.x + reference.width / 2 - floating.width / 2;
  9195. const commonY = reference.y + reference.height / 2 - floating.height / 2;
  9196. const mainAxis = getMainAxisFromPlacement(placement);
  9197. const length = getLengthFromAxis(mainAxis);
  9198. const commonAlign = reference[length] / 2 - floating[length] / 2;
  9199. const side = getSide(placement);
  9200. const isVertical = mainAxis === 'x';
  9201. let coords;
  9202. switch (side) {
  9203. case 'top':
  9204. coords = {
  9205. x: commonX,
  9206. y: reference.y - floating.height
  9207. };
  9208. break;
  9209. case 'bottom':
  9210. coords = {
  9211. x: commonX,
  9212. y: reference.y + reference.height
  9213. };
  9214. break;
  9215. case 'right':
  9216. coords = {
  9217. x: reference.x + reference.width,
  9218. y: commonY
  9219. };
  9220. break;
  9221. case 'left':
  9222. coords = {
  9223. x: reference.x - floating.width,
  9224. y: commonY
  9225. };
  9226. break;
  9227. default:
  9228. coords = {
  9229. x: reference.x,
  9230. y: reference.y
  9231. };
  9232. }
  9233. switch (getAlignment(placement)) {
  9234. case 'start':
  9235. coords[mainAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
  9236. break;
  9237. case 'end':
  9238. coords[mainAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
  9239. break;
  9240. }
  9241. return coords;
  9242. }
  9243. /**
  9244. * Computes the `x` and `y` coordinates that will place the floating element
  9245. * next to a reference element when it is given a certain positioning strategy.
  9246. *
  9247. * This export does not have any `platform` interface logic. You will need to
  9248. * write one for the platform you are using Floating UI with.
  9249. */
  9250. const computePosition$1 = async (reference, floating, config) => {
  9251. const {
  9252. placement = 'bottom',
  9253. strategy = 'absolute',
  9254. middleware = [],
  9255. platform
  9256. } = config;
  9257. const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
  9258. let rects = await platform.getElementRects({
  9259. reference,
  9260. floating,
  9261. strategy
  9262. });
  9263. let {
  9264. x,
  9265. y
  9266. } = computeCoordsFromPlacement(rects, placement, rtl);
  9267. let statefulPlacement = placement;
  9268. let middlewareData = {};
  9269. let resetCount = 0;
  9270. for (let i = 0; i < middleware.length; i++) {
  9271. const {
  9272. name,
  9273. fn
  9274. } = middleware[i];
  9275. const {
  9276. x: nextX,
  9277. y: nextY,
  9278. data,
  9279. reset
  9280. } = await fn({
  9281. x,
  9282. y,
  9283. initialPlacement: placement,
  9284. placement: statefulPlacement,
  9285. strategy,
  9286. middlewareData,
  9287. rects,
  9288. platform,
  9289. elements: {
  9290. reference,
  9291. floating
  9292. }
  9293. });
  9294. x = nextX != null ? nextX : x;
  9295. y = nextY != null ? nextY : y;
  9296. middlewareData = { ...middlewareData,
  9297. [name]: { ...middlewareData[name],
  9298. ...data
  9299. }
  9300. };
  9301. if (reset && resetCount <= 50) {
  9302. resetCount++;
  9303. if (typeof reset === 'object') {
  9304. if (reset.placement) {
  9305. statefulPlacement = reset.placement;
  9306. }
  9307. if (reset.rects) {
  9308. rects = reset.rects === true ? await platform.getElementRects({
  9309. reference,
  9310. floating,
  9311. strategy
  9312. }) : reset.rects;
  9313. }
  9314. ({
  9315. x,
  9316. y
  9317. } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
  9318. }
  9319. i = -1;
  9320. continue;
  9321. }
  9322. }
  9323. return {
  9324. x,
  9325. y,
  9326. placement: statefulPlacement,
  9327. strategy,
  9328. middlewareData
  9329. };
  9330. };
  9331. function expandPaddingObject(padding) {
  9332. return {
  9333. top: 0,
  9334. right: 0,
  9335. bottom: 0,
  9336. left: 0,
  9337. ...padding
  9338. };
  9339. }
  9340. function getSideObjectFromPadding(padding) {
  9341. return typeof padding !== 'number' ? expandPaddingObject(padding) : {
  9342. top: padding,
  9343. right: padding,
  9344. bottom: padding,
  9345. left: padding
  9346. };
  9347. }
  9348. function rectToClientRect(rect) {
  9349. return { ...rect,
  9350. top: rect.y,
  9351. left: rect.x,
  9352. right: rect.x + rect.width,
  9353. bottom: rect.y + rect.height
  9354. };
  9355. }
  9356. /**
  9357. * Resolves with an object of overflow side offsets that determine how much the
  9358. * element is overflowing a given clipping boundary.
  9359. * - positive = overflowing the boundary by that number of pixels
  9360. * - negative = how many pixels left before it will overflow
  9361. * - 0 = lies flush with the boundary
  9362. * @see https://floating-ui.com/docs/detectOverflow
  9363. */
  9364. async function detectOverflow(middlewareArguments, options) {
  9365. var _await$platform$isEle;
  9366. if (options === void 0) {
  9367. options = {};
  9368. }
  9369. const {
  9370. x,
  9371. y,
  9372. platform,
  9373. rects,
  9374. elements,
  9375. strategy
  9376. } = middlewareArguments;
  9377. const {
  9378. boundary = 'clippingAncestors',
  9379. rootBoundary = 'viewport',
  9380. elementContext = 'floating',
  9381. altBoundary = false,
  9382. padding = 0
  9383. } = options;
  9384. const paddingObject = getSideObjectFromPadding(padding);
  9385. const altContext = elementContext === 'floating' ? 'reference' : 'floating';
  9386. const element = elements[altBoundary ? altContext : elementContext];
  9387. const clippingClientRect = rectToClientRect(await platform.getClippingRect({
  9388. 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))),
  9389. boundary,
  9390. rootBoundary,
  9391. strategy
  9392. }));
  9393. const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
  9394. rect: elementContext === 'floating' ? { ...rects.floating,
  9395. x,
  9396. y
  9397. } : rects.reference,
  9398. offsetParent: await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating)),
  9399. strategy
  9400. }) : rects[elementContext]);
  9401. return {
  9402. top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
  9403. bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
  9404. left: clippingClientRect.left - elementClientRect.left + paddingObject.left,
  9405. right: elementClientRect.right - clippingClientRect.right + paddingObject.right
  9406. };
  9407. }
  9408. const min$2 = Math.min;
  9409. const max$2 = Math.max;
  9410. function within(min$1, value, max$1) {
  9411. return max$2(min$1, min$2(value, max$1));
  9412. }
  9413. /**
  9414. * Positions an inner element of the floating element such that it is centered
  9415. * to the reference element.
  9416. * @see https://floating-ui.com/docs/arrow
  9417. */
  9418. const arrow = options => ({
  9419. name: 'arrow',
  9420. options,
  9421. async fn(middlewareArguments) {
  9422. // Since `element` is required, we don't Partial<> the type
  9423. const {
  9424. element,
  9425. padding = 0
  9426. } = options != null ? options : {};
  9427. const {
  9428. x,
  9429. y,
  9430. placement,
  9431. rects,
  9432. platform
  9433. } = middlewareArguments;
  9434. if (element == null) {
  9435. return {};
  9436. }
  9437. const paddingObject = getSideObjectFromPadding(padding);
  9438. const coords = {
  9439. x,
  9440. y
  9441. };
  9442. const axis = getMainAxisFromPlacement(placement);
  9443. const alignment = getAlignment(placement);
  9444. const length = getLengthFromAxis(axis);
  9445. const arrowDimensions = await platform.getDimensions(element);
  9446. const minProp = axis === 'y' ? 'top' : 'left';
  9447. const maxProp = axis === 'y' ? 'bottom' : 'right';
  9448. const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
  9449. const startDiff = coords[axis] - rects.reference[axis];
  9450. const arrowOffsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(element));
  9451. let clientSize = arrowOffsetParent ? axis === 'y' ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
  9452. if (clientSize === 0) {
  9453. clientSize = rects.floating[length];
  9454. }
  9455. const centerToReference = endDiff / 2 - startDiff / 2; // Make sure the arrow doesn't overflow the floating element if the center
  9456. // point is outside the floating element's bounds
  9457. const min = paddingObject[minProp];
  9458. const max = clientSize - arrowDimensions[length] - paddingObject[maxProp];
  9459. const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
  9460. const offset = within(min, center, max); // Make sure that arrow points at the reference
  9461. const alignmentPadding = alignment === 'start' ? paddingObject[minProp] : paddingObject[maxProp];
  9462. const shouldAddOffset = alignmentPadding > 0 && center !== offset && rects.reference[length] <= rects.floating[length];
  9463. const alignmentOffset = shouldAddOffset ? center < min ? min - center : max - center : 0;
  9464. return {
  9465. [axis]: coords[axis] - alignmentOffset,
  9466. data: {
  9467. [axis]: offset,
  9468. centerOffset: center - offset
  9469. }
  9470. };
  9471. }
  9472. });
  9473. const hash$1 = {
  9474. left: 'right',
  9475. right: 'left',
  9476. bottom: 'top',
  9477. top: 'bottom'
  9478. };
  9479. function getOppositePlacement(placement) {
  9480. return placement.replace(/left|right|bottom|top/g, matched => hash$1[matched]);
  9481. }
  9482. function getAlignmentSides(placement, rects, rtl) {
  9483. if (rtl === void 0) {
  9484. rtl = false;
  9485. }
  9486. const alignment = getAlignment(placement);
  9487. const mainAxis = getMainAxisFromPlacement(placement);
  9488. const length = getLengthFromAxis(mainAxis);
  9489. let mainAlignmentSide = mainAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';
  9490. if (rects.reference[length] > rects.floating[length]) {
  9491. mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
  9492. }
  9493. return {
  9494. main: mainAlignmentSide,
  9495. cross: getOppositePlacement(mainAlignmentSide)
  9496. };
  9497. }
  9498. const hash = {
  9499. start: 'end',
  9500. end: 'start'
  9501. };
  9502. function getOppositeAlignmentPlacement(placement) {
  9503. return placement.replace(/start|end/g, matched => hash[matched]);
  9504. }
  9505. function getExpandedPlacements(placement) {
  9506. const oppositePlacement = getOppositePlacement(placement);
  9507. return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
  9508. }
  9509. /**
  9510. * Changes the placement of the floating element to one that will fit if the
  9511. * initially specified `placement` does not.
  9512. * @see https://floating-ui.com/docs/flip
  9513. */
  9514. const flip = function (options) {
  9515. if (options === void 0) {
  9516. options = {};
  9517. }
  9518. return {
  9519. name: 'flip',
  9520. options,
  9521. async fn(middlewareArguments) {
  9522. var _middlewareData$flip;
  9523. const {
  9524. placement,
  9525. middlewareData,
  9526. rects,
  9527. initialPlacement,
  9528. platform,
  9529. elements
  9530. } = middlewareArguments;
  9531. const {
  9532. mainAxis: checkMainAxis = true,
  9533. crossAxis: checkCrossAxis = true,
  9534. fallbackPlacements: specifiedFallbackPlacements,
  9535. fallbackStrategy = 'bestFit',
  9536. flipAlignment = true,
  9537. ...detectOverflowOptions
  9538. } = options;
  9539. const side = getSide(placement);
  9540. const isBasePlacement = side === initialPlacement;
  9541. const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
  9542. const placements = [initialPlacement, ...fallbackPlacements];
  9543. const overflow = await detectOverflow(middlewareArguments, detectOverflowOptions);
  9544. const overflows = [];
  9545. let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
  9546. if (checkMainAxis) {
  9547. overflows.push(overflow[side]);
  9548. }
  9549. if (checkCrossAxis) {
  9550. const {
  9551. main,
  9552. cross
  9553. } = getAlignmentSides(placement, rects, await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)));
  9554. overflows.push(overflow[main], overflow[cross]);
  9555. }
  9556. overflowsData = [...overflowsData, {
  9557. placement,
  9558. overflows
  9559. }]; // One or more sides is overflowing
  9560. if (!overflows.every(side => side <= 0)) {
  9561. var _middlewareData$flip$, _middlewareData$flip2;
  9562. const nextIndex = ((_middlewareData$flip$ = (_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) != null ? _middlewareData$flip$ : 0) + 1;
  9563. const nextPlacement = placements[nextIndex];
  9564. if (nextPlacement) {
  9565. // Try next placement and re-run the lifecycle
  9566. return {
  9567. data: {
  9568. index: nextIndex,
  9569. overflows: overflowsData
  9570. },
  9571. reset: {
  9572. placement: nextPlacement
  9573. }
  9574. };
  9575. }
  9576. let resetPlacement = 'bottom';
  9577. switch (fallbackStrategy) {
  9578. case 'bestFit':
  9579. {
  9580. var _overflowsData$map$so;
  9581. 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;
  9582. if (placement) {
  9583. resetPlacement = placement;
  9584. }
  9585. break;
  9586. }
  9587. case 'initialPlacement':
  9588. resetPlacement = initialPlacement;
  9589. break;
  9590. }
  9591. if (placement !== resetPlacement) {
  9592. return {
  9593. reset: {
  9594. placement: resetPlacement
  9595. }
  9596. };
  9597. }
  9598. }
  9599. return {};
  9600. }
  9601. };
  9602. };
  9603. async function convertValueToCoords(middlewareArguments, value) {
  9604. const {
  9605. placement,
  9606. platform,
  9607. elements
  9608. } = middlewareArguments;
  9609. const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
  9610. const side = getSide(placement);
  9611. const alignment = getAlignment(placement);
  9612. const isVertical = getMainAxisFromPlacement(placement) === 'x';
  9613. const mainAxisMulti = ['left', 'top'].includes(side) ? -1 : 1;
  9614. const crossAxisMulti = rtl && isVertical ? -1 : 1;
  9615. const rawValue = typeof value === 'function' ? value(middlewareArguments) : value; // eslint-disable-next-line prefer-const
  9616. let {
  9617. mainAxis,
  9618. crossAxis,
  9619. alignmentAxis
  9620. } = typeof rawValue === 'number' ? {
  9621. mainAxis: rawValue,
  9622. crossAxis: 0,
  9623. alignmentAxis: null
  9624. } : {
  9625. mainAxis: 0,
  9626. crossAxis: 0,
  9627. alignmentAxis: null,
  9628. ...rawValue
  9629. };
  9630. if (alignment && typeof alignmentAxis === 'number') {
  9631. crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis;
  9632. }
  9633. return isVertical ? {
  9634. x: crossAxis * crossAxisMulti,
  9635. y: mainAxis * mainAxisMulti
  9636. } : {
  9637. x: mainAxis * mainAxisMulti,
  9638. y: crossAxis * crossAxisMulti
  9639. };
  9640. }
  9641. /**
  9642. * Displaces the floating element from its reference element.
  9643. * @see https://floating-ui.com/docs/offset
  9644. */
  9645. const offset = function (value) {
  9646. if (value === void 0) {
  9647. value = 0;
  9648. }
  9649. return {
  9650. name: 'offset',
  9651. options: value,
  9652. async fn(middlewareArguments) {
  9653. const {
  9654. x,
  9655. y
  9656. } = middlewareArguments;
  9657. const diffCoords = await convertValueToCoords(middlewareArguments, value);
  9658. return {
  9659. x: x + diffCoords.x,
  9660. y: y + diffCoords.y,
  9661. data: diffCoords
  9662. };
  9663. }
  9664. };
  9665. };
  9666. function getCrossAxis(axis) {
  9667. return axis === 'x' ? 'y' : 'x';
  9668. }
  9669. /**
  9670. * Shifts the floating element in order to keep it in view when it will overflow
  9671. * a clipping boundary.
  9672. * @see https://floating-ui.com/docs/shift
  9673. */
  9674. const shift = function (options) {
  9675. if (options === void 0) {
  9676. options = {};
  9677. }
  9678. return {
  9679. name: 'shift',
  9680. options,
  9681. async fn(middlewareArguments) {
  9682. const {
  9683. x,
  9684. y,
  9685. placement
  9686. } = middlewareArguments;
  9687. const {
  9688. mainAxis: checkMainAxis = true,
  9689. crossAxis: checkCrossAxis = false,
  9690. limiter = {
  9691. fn: _ref => {
  9692. let {
  9693. x,
  9694. y
  9695. } = _ref;
  9696. return {
  9697. x,
  9698. y
  9699. };
  9700. }
  9701. },
  9702. ...detectOverflowOptions
  9703. } = options;
  9704. const coords = {
  9705. x,
  9706. y
  9707. };
  9708. const overflow = await detectOverflow(middlewareArguments, detectOverflowOptions);
  9709. const mainAxis = getMainAxisFromPlacement(getSide(placement));
  9710. const crossAxis = getCrossAxis(mainAxis);
  9711. let mainAxisCoord = coords[mainAxis];
  9712. let crossAxisCoord = coords[crossAxis];
  9713. if (checkMainAxis) {
  9714. const minSide = mainAxis === 'y' ? 'top' : 'left';
  9715. const maxSide = mainAxis === 'y' ? 'bottom' : 'right';
  9716. const min = mainAxisCoord + overflow[minSide];
  9717. const max = mainAxisCoord - overflow[maxSide];
  9718. mainAxisCoord = within(min, mainAxisCoord, max);
  9719. }
  9720. if (checkCrossAxis) {
  9721. const minSide = crossAxis === 'y' ? 'top' : 'left';
  9722. const maxSide = crossAxis === 'y' ? 'bottom' : 'right';
  9723. const min = crossAxisCoord + overflow[minSide];
  9724. const max = crossAxisCoord - overflow[maxSide];
  9725. crossAxisCoord = within(min, crossAxisCoord, max);
  9726. }
  9727. const limitedCoords = limiter.fn({ ...middlewareArguments,
  9728. [mainAxis]: mainAxisCoord,
  9729. [crossAxis]: crossAxisCoord
  9730. });
  9731. return { ...limitedCoords,
  9732. data: {
  9733. x: limitedCoords.x - x,
  9734. y: limitedCoords.y - y
  9735. }
  9736. };
  9737. }
  9738. };
  9739. };
  9740. function isWindow(value) {
  9741. return value && value.document && value.location && value.alert && value.setInterval;
  9742. }
  9743. function getWindow(node) {
  9744. if (node == null) {
  9745. return window;
  9746. }
  9747. if (!isWindow(node)) {
  9748. const ownerDocument = node.ownerDocument;
  9749. return ownerDocument ? ownerDocument.defaultView || window : window;
  9750. }
  9751. return node;
  9752. }
  9753. function getComputedStyle$1(element) {
  9754. return getWindow(element).getComputedStyle(element);
  9755. }
  9756. function getNodeName(node) {
  9757. return isWindow(node) ? '' : node ? (node.nodeName || '').toLowerCase() : '';
  9758. }
  9759. function getUAString() {
  9760. const uaData = navigator.userAgentData;
  9761. if (uaData != null && uaData.brands) {
  9762. return uaData.brands.map(item => item.brand + "/" + item.version).join(' ');
  9763. }
  9764. return navigator.userAgent;
  9765. }
  9766. function isHTMLElement(value) {
  9767. return value instanceof getWindow(value).HTMLElement;
  9768. }
  9769. function isElement(value) {
  9770. return value instanceof getWindow(value).Element;
  9771. }
  9772. function isNode(value) {
  9773. return value instanceof getWindow(value).Node;
  9774. }
  9775. function isShadowRoot(node) {
  9776. // Browsers without `ShadowRoot` support
  9777. if (typeof ShadowRoot === 'undefined') {
  9778. return false;
  9779. }
  9780. const OwnElement = getWindow(node).ShadowRoot;
  9781. return node instanceof OwnElement || node instanceof ShadowRoot;
  9782. }
  9783. function isOverflowElement(element) {
  9784. // Firefox wants us to check `-x` and `-y` variations as well
  9785. const {
  9786. overflow,
  9787. overflowX,
  9788. overflowY
  9789. } = getComputedStyle$1(element);
  9790. return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
  9791. }
  9792. function isTableElement(element) {
  9793. return ['table', 'td', 'th'].includes(getNodeName(element));
  9794. }
  9795. function isContainingBlock(element) {
  9796. // TODO: Try and use feature detection here instead
  9797. const isFirefox = /firefox/i.test(getUAString());
  9798. const css = getComputedStyle$1(element); // This is non-exhaustive but covers the most common CSS properties that
  9799. // create a containing block.
  9800. // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
  9801. return css.transform !== 'none' || css.perspective !== 'none' || // @ts-ignore (TS 4.1 compat)
  9802. css.contain === 'paint' || ['transform', 'perspective'].includes(css.willChange) || isFirefox && css.willChange === 'filter' || isFirefox && (css.filter ? css.filter !== 'none' : false);
  9803. }
  9804. function isLayoutViewport() {
  9805. // Not Safari
  9806. return !/^((?!chrome|android).)*safari/i.test(getUAString()); // Feature detection for this fails in various ways
  9807. // • Always-visible scrollbar or not
  9808. // • Width of <html>, etc.
  9809. // const vV = win.visualViewport;
  9810. // return vV ? Math.abs(win.innerWidth / vV.scale - vV.width) < 0.5 : true;
  9811. }
  9812. const min$1 = Math.min;
  9813. const max$1 = Math.max;
  9814. const round = Math.round;
  9815. function getBoundingClientRect(element, includeScale, isFixedStrategy) {
  9816. var _win$visualViewport$o, _win$visualViewport, _win$visualViewport$o2, _win$visualViewport2;
  9817. if (includeScale === void 0) {
  9818. includeScale = false;
  9819. }
  9820. if (isFixedStrategy === void 0) {
  9821. isFixedStrategy = false;
  9822. }
  9823. const clientRect = element.getBoundingClientRect();
  9824. let scaleX = 1;
  9825. let scaleY = 1;
  9826. if (includeScale && isHTMLElement(element)) {
  9827. scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;
  9828. scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;
  9829. }
  9830. const win = isElement(element) ? getWindow(element) : window;
  9831. const addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
  9832. 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;
  9833. 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;
  9834. const width = clientRect.width / scaleX;
  9835. const height = clientRect.height / scaleY;
  9836. return {
  9837. width,
  9838. height,
  9839. top: y,
  9840. right: x + width,
  9841. bottom: y + height,
  9842. left: x,
  9843. x,
  9844. y
  9845. };
  9846. }
  9847. function getDocumentElement(node) {
  9848. return ((isNode(node) ? node.ownerDocument : node.document) || window.document).documentElement;
  9849. }
  9850. function getNodeScroll(element) {
  9851. if (isElement(element)) {
  9852. return {
  9853. scrollLeft: element.scrollLeft,
  9854. scrollTop: element.scrollTop
  9855. };
  9856. }
  9857. return {
  9858. scrollLeft: element.pageXOffset,
  9859. scrollTop: element.pageYOffset
  9860. };
  9861. }
  9862. function getWindowScrollBarX(element) {
  9863. // If <html> has a CSS width greater than the viewport, then this will be
  9864. // incorrect for RTL.
  9865. return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft;
  9866. }
  9867. function isScaled(element) {
  9868. const rect = getBoundingClientRect(element);
  9869. return round(rect.width) !== element.offsetWidth || round(rect.height) !== element.offsetHeight;
  9870. }
  9871. function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
  9872. const isOffsetParentAnElement = isHTMLElement(offsetParent);
  9873. const documentElement = getDocumentElement(offsetParent);
  9874. const rect = getBoundingClientRect(element, // @ts-ignore - checked above (TS 4.1 compat)
  9875. isOffsetParentAnElement && isScaled(offsetParent), strategy === 'fixed');
  9876. let scroll = {
  9877. scrollLeft: 0,
  9878. scrollTop: 0
  9879. };
  9880. const offsets = {
  9881. x: 0,
  9882. y: 0
  9883. };
  9884. if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== 'fixed') {
  9885. if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
  9886. scroll = getNodeScroll(offsetParent);
  9887. }
  9888. if (isHTMLElement(offsetParent)) {
  9889. const offsetRect = getBoundingClientRect(offsetParent, true);
  9890. offsets.x = offsetRect.x + offsetParent.clientLeft;
  9891. offsets.y = offsetRect.y + offsetParent.clientTop;
  9892. } else if (documentElement) {
  9893. offsets.x = getWindowScrollBarX(documentElement);
  9894. }
  9895. }
  9896. return {
  9897. x: rect.left + scroll.scrollLeft - offsets.x,
  9898. y: rect.top + scroll.scrollTop - offsets.y,
  9899. width: rect.width,
  9900. height: rect.height
  9901. };
  9902. }
  9903. function getParentNode(node) {
  9904. if (getNodeName(node) === 'html') {
  9905. return node;
  9906. }
  9907. return (// this is a quicker (but less type safe) way to save quite some bytes from the bundle
  9908. // @ts-ignore
  9909. node.assignedSlot || // step into the shadow DOM of the parent of a slotted node
  9910. node.parentNode || ( // DOM Element detected
  9911. isShadowRoot(node) ? node.host : null) || // ShadowRoot detected
  9912. getDocumentElement(node) // fallback
  9913. );
  9914. }
  9915. function getTrueOffsetParent(element) {
  9916. if (!isHTMLElement(element) || getComputedStyle$1(element).position === 'fixed') {
  9917. return null;
  9918. }
  9919. return composedOffsetParent(element);
  9920. }
  9921. /**
  9922. * Polyfills the old offsetParent behavior from before the spec was changed:
  9923. * https://github.com/w3c/csswg-drafts/issues/159
  9924. */
  9925. function composedOffsetParent(element) {
  9926. let {
  9927. offsetParent
  9928. } = element;
  9929. let ancestor = element;
  9930. let foundInsideSlot = false;
  9931. while (ancestor && ancestor !== offsetParent) {
  9932. const {
  9933. assignedSlot
  9934. } = ancestor;
  9935. if (assignedSlot) {
  9936. let newOffsetParent = assignedSlot.offsetParent;
  9937. if (getComputedStyle$1(assignedSlot).display === 'contents') {
  9938. const hadStyleAttribute = assignedSlot.hasAttribute('style');
  9939. const oldDisplay = assignedSlot.style.display;
  9940. assignedSlot.style.display = getComputedStyle$1(ancestor).display;
  9941. newOffsetParent = assignedSlot.offsetParent;
  9942. assignedSlot.style.display = oldDisplay;
  9943. if (!hadStyleAttribute) {
  9944. assignedSlot.removeAttribute('style');
  9945. }
  9946. }
  9947. ancestor = assignedSlot;
  9948. if (offsetParent !== newOffsetParent) {
  9949. offsetParent = newOffsetParent;
  9950. foundInsideSlot = true;
  9951. }
  9952. } else if (isShadowRoot(ancestor) && ancestor.host && foundInsideSlot) {
  9953. break;
  9954. }
  9955. ancestor = isShadowRoot(ancestor) && ancestor.host || ancestor.parentNode;
  9956. }
  9957. return offsetParent;
  9958. }
  9959. function getContainingBlock(element) {
  9960. let currentNode = getParentNode(element);
  9961. if (isShadowRoot(currentNode)) {
  9962. currentNode = currentNode.host;
  9963. }
  9964. while (isHTMLElement(currentNode) && !['html', 'body'].includes(getNodeName(currentNode))) {
  9965. if (isContainingBlock(currentNode)) {
  9966. return currentNode;
  9967. } else {
  9968. const parent = currentNode.parentNode;
  9969. currentNode = isShadowRoot(parent) ? parent.host : parent;
  9970. }
  9971. }
  9972. return null;
  9973. } // Gets the closest ancestor positioned element. Handles some edge cases,
  9974. // such as table ancestors and cross browser bugs.
  9975. function getOffsetParent(element) {
  9976. const window = getWindow(element);
  9977. let offsetParent = getTrueOffsetParent(element);
  9978. while (offsetParent && isTableElement(offsetParent) && getComputedStyle$1(offsetParent).position === 'static') {
  9979. offsetParent = getTrueOffsetParent(offsetParent);
  9980. }
  9981. if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle$1(offsetParent).position === 'static' && !isContainingBlock(offsetParent))) {
  9982. return window;
  9983. }
  9984. return offsetParent || getContainingBlock(element) || window;
  9985. }
  9986. function getDimensions(element) {
  9987. if (isHTMLElement(element)) {
  9988. return {
  9989. width: element.offsetWidth,
  9990. height: element.offsetHeight
  9991. };
  9992. }
  9993. const rect = getBoundingClientRect(element);
  9994. return {
  9995. width: rect.width,
  9996. height: rect.height
  9997. };
  9998. }
  9999. function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
  10000. let {
  10001. rect,
  10002. offsetParent,
  10003. strategy
  10004. } = _ref;
  10005. const isOffsetParentAnElement = isHTMLElement(offsetParent);
  10006. const documentElement = getDocumentElement(offsetParent);
  10007. if (offsetParent === documentElement) {
  10008. return rect;
  10009. }
  10010. let scroll = {
  10011. scrollLeft: 0,
  10012. scrollTop: 0
  10013. };
  10014. const offsets = {
  10015. x: 0,
  10016. y: 0
  10017. };
  10018. if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== 'fixed') {
  10019. if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
  10020. scroll = getNodeScroll(offsetParent);
  10021. }
  10022. if (isHTMLElement(offsetParent)) {
  10023. const offsetRect = getBoundingClientRect(offsetParent, true);
  10024. offsets.x = offsetRect.x + offsetParent.clientLeft;
  10025. offsets.y = offsetRect.y + offsetParent.clientTop;
  10026. } // This doesn't appear to be need to be negated.
  10027. // else if (documentElement) {
  10028. // offsets.x = getWindowScrollBarX(documentElement);
  10029. // }
  10030. }
  10031. return { ...rect,
  10032. x: rect.x - scroll.scrollLeft + offsets.x,
  10033. y: rect.y - scroll.scrollTop + offsets.y
  10034. };
  10035. }
  10036. function getViewportRect(element, strategy) {
  10037. const win = getWindow(element);
  10038. const html = getDocumentElement(element);
  10039. const visualViewport = win.visualViewport;
  10040. let width = html.clientWidth;
  10041. let height = html.clientHeight;
  10042. let x = 0;
  10043. let y = 0;
  10044. if (visualViewport) {
  10045. width = visualViewport.width;
  10046. height = visualViewport.height;
  10047. const layoutViewport = isLayoutViewport();
  10048. if (layoutViewport || !layoutViewport && strategy === 'fixed') {
  10049. x = visualViewport.offsetLeft;
  10050. y = visualViewport.offsetTop;
  10051. }
  10052. }
  10053. return {
  10054. width,
  10055. height,
  10056. x,
  10057. y
  10058. };
  10059. }
  10060. // of the `<html>` and `<body>` rect bounds if horizontally scrollable
  10061. function getDocumentRect(element) {
  10062. var _element$ownerDocumen;
  10063. const html = getDocumentElement(element);
  10064. const scroll = getNodeScroll(element);
  10065. const body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
  10066. const width = max$1(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
  10067. const height = max$1(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
  10068. let x = -scroll.scrollLeft + getWindowScrollBarX(element);
  10069. const y = -scroll.scrollTop;
  10070. if (getComputedStyle$1(body || html).direction === 'rtl') {
  10071. x += max$1(html.clientWidth, body ? body.clientWidth : 0) - width;
  10072. }
  10073. return {
  10074. width,
  10075. height,
  10076. x,
  10077. y
  10078. };
  10079. }
  10080. function getNearestOverflowAncestor(node) {
  10081. const parentNode = getParentNode(node);
  10082. if (['html', 'body', '#document'].includes(getNodeName(parentNode))) {
  10083. // @ts-ignore assume body is always available
  10084. return node.ownerDocument.body;
  10085. }
  10086. if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
  10087. return parentNode;
  10088. }
  10089. return getNearestOverflowAncestor(parentNode);
  10090. }
  10091. function getOverflowAncestors(node, list) {
  10092. var _node$ownerDocument;
  10093. if (list === void 0) {
  10094. list = [];
  10095. }
  10096. const scrollableAncestor = getNearestOverflowAncestor(node);
  10097. const isBody = scrollableAncestor === ((_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.body);
  10098. const win = getWindow(scrollableAncestor);
  10099. const target = isBody ? [win].concat(win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : []) : scrollableAncestor;
  10100. const updatedList = list.concat(target);
  10101. return isBody ? updatedList : // @ts-ignore: isBody tells us target will be an HTMLElement here
  10102. updatedList.concat(getOverflowAncestors(target));
  10103. }
  10104. function contains(parent, child) {
  10105. const rootNode = child.getRootNode == null ? void 0 : child.getRootNode(); // First, attempt with faster native method
  10106. if (parent.contains(child)) {
  10107. return true;
  10108. } // then fallback to custom implementation with Shadow DOM support
  10109. else if (rootNode && isShadowRoot(rootNode)) {
  10110. let next = child;
  10111. do {
  10112. // use `===` replace node.isSameNode()
  10113. if (next && parent === next) {
  10114. return true;
  10115. } // @ts-ignore: need a better way to handle this...
  10116. next = next.parentNode || next.host;
  10117. } while (next);
  10118. }
  10119. return false;
  10120. }
  10121. function getInnerBoundingClientRect(element, strategy) {
  10122. const clientRect = getBoundingClientRect(element, false, strategy === 'fixed');
  10123. const top = clientRect.top + element.clientTop;
  10124. const left = clientRect.left + element.clientLeft;
  10125. return {
  10126. top,
  10127. left,
  10128. x: left,
  10129. y: top,
  10130. right: left + element.clientWidth,
  10131. bottom: top + element.clientHeight,
  10132. width: element.clientWidth,
  10133. height: element.clientHeight
  10134. };
  10135. }
  10136. function getClientRectFromClippingAncestor(element, clippingParent, strategy) {
  10137. if (clippingParent === 'viewport') {
  10138. return rectToClientRect(getViewportRect(element, strategy));
  10139. }
  10140. if (isElement(clippingParent)) {
  10141. return getInnerBoundingClientRect(clippingParent, strategy);
  10142. }
  10143. return rectToClientRect(getDocumentRect(getDocumentElement(element)));
  10144. } // A "clipping ancestor" is an overflowable container with the characteristic of
  10145. // clipping (or hiding) overflowing elements with a position different from
  10146. // `initial`
  10147. function getClippingAncestors(element) {
  10148. const clippingAncestors = getOverflowAncestors(element);
  10149. const canEscapeClipping = ['absolute', 'fixed'].includes(getComputedStyle$1(element).position);
  10150. const clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;
  10151. if (!isElement(clipperElement)) {
  10152. return [];
  10153. } // @ts-ignore isElement check ensures we return Array<Element>
  10154. return clippingAncestors.filter(clippingAncestors => isElement(clippingAncestors) && contains(clippingAncestors, clipperElement) && getNodeName(clippingAncestors) !== 'body');
  10155. } // Gets the maximum area that the element is visible in due to any number of
  10156. // clipping ancestors
  10157. function getClippingRect(_ref) {
  10158. let {
  10159. element,
  10160. boundary,
  10161. rootBoundary,
  10162. strategy
  10163. } = _ref;
  10164. const mainClippingAncestors = boundary === 'clippingAncestors' ? getClippingAncestors(element) : [].concat(boundary);
  10165. const clippingAncestors = [...mainClippingAncestors, rootBoundary];
  10166. const firstClippingAncestor = clippingAncestors[0];
  10167. const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
  10168. const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
  10169. accRect.top = max$1(rect.top, accRect.top);
  10170. accRect.right = min$1(rect.right, accRect.right);
  10171. accRect.bottom = min$1(rect.bottom, accRect.bottom);
  10172. accRect.left = max$1(rect.left, accRect.left);
  10173. return accRect;
  10174. }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
  10175. return {
  10176. width: clippingRect.right - clippingRect.left,
  10177. height: clippingRect.bottom - clippingRect.top,
  10178. x: clippingRect.left,
  10179. y: clippingRect.top
  10180. };
  10181. }
  10182. const platform = {
  10183. getClippingRect,
  10184. convertOffsetParentRelativeRectToViewportRelativeRect,
  10185. isElement,
  10186. getDimensions,
  10187. getOffsetParent,
  10188. getDocumentElement,
  10189. getElementRects: _ref => {
  10190. let {
  10191. reference,
  10192. floating,
  10193. strategy
  10194. } = _ref;
  10195. return {
  10196. reference: getRectRelativeToOffsetParent(reference, getOffsetParent(floating), strategy),
  10197. floating: { ...getDimensions(floating),
  10198. x: 0,
  10199. y: 0
  10200. }
  10201. };
  10202. },
  10203. getClientRects: element => Array.from(element.getClientRects()),
  10204. isRTL: element => getComputedStyle$1(element).direction === 'rtl'
  10205. };
  10206. /**
  10207. * Automatically updates the position of the floating element when necessary.
  10208. * @see https://floating-ui.com/docs/autoUpdate
  10209. */
  10210. function autoUpdate(reference, floating, update, options) {
  10211. if (options === void 0) {
  10212. options = {};
  10213. }
  10214. const {
  10215. ancestorScroll: _ancestorScroll = true,
  10216. ancestorResize: _ancestorResize = true,
  10217. elementResize = true,
  10218. animationFrame = false
  10219. } = options;
  10220. const ancestorScroll = _ancestorScroll && !animationFrame;
  10221. const ancestorResize = _ancestorResize && !animationFrame;
  10222. const ancestors = ancestorScroll || ancestorResize ? [...(isElement(reference) ? getOverflowAncestors(reference) : []), ...getOverflowAncestors(floating)] : [];
  10223. ancestors.forEach(ancestor => {
  10224. ancestorScroll && ancestor.addEventListener('scroll', update, {
  10225. passive: true
  10226. });
  10227. ancestorResize && ancestor.addEventListener('resize', update);
  10228. });
  10229. let observer = null;
  10230. if (elementResize) {
  10231. let initialUpdate = true;
  10232. observer = new ResizeObserver(() => {
  10233. if (!initialUpdate) {
  10234. update();
  10235. }
  10236. initialUpdate = false;
  10237. });
  10238. isElement(reference) && !animationFrame && observer.observe(reference);
  10239. observer.observe(floating);
  10240. }
  10241. let frameId;
  10242. let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
  10243. if (animationFrame) {
  10244. frameLoop();
  10245. }
  10246. function frameLoop() {
  10247. const nextRefRect = getBoundingClientRect(reference);
  10248. if (prevRefRect && (nextRefRect.x !== prevRefRect.x || nextRefRect.y !== prevRefRect.y || nextRefRect.width !== prevRefRect.width || nextRefRect.height !== prevRefRect.height)) {
  10249. update();
  10250. }
  10251. prevRefRect = nextRefRect;
  10252. frameId = requestAnimationFrame(frameLoop);
  10253. }
  10254. update();
  10255. return () => {
  10256. var _observer;
  10257. ancestors.forEach(ancestor => {
  10258. ancestorScroll && ancestor.removeEventListener('scroll', update);
  10259. ancestorResize && ancestor.removeEventListener('resize', update);
  10260. });
  10261. (_observer = observer) == null ? void 0 : _observer.disconnect();
  10262. observer = null;
  10263. if (animationFrame) {
  10264. cancelAnimationFrame(frameId);
  10265. }
  10266. };
  10267. }
  10268. /**
  10269. * Computes the `x` and `y` coordinates that will place the floating element
  10270. * next to a reference element when it is given a certain CSS positioning
  10271. * strategy.
  10272. */
  10273. const computePosition = (reference, floating, options) => computePosition$1(reference, floating, {
  10274. platform,
  10275. ...options
  10276. });
  10277. const useFloatingProps = buildProps({});
  10278. const unrefReference = (elRef) => {
  10279. if (!isClient)
  10280. return;
  10281. if (!elRef)
  10282. return elRef;
  10283. const unrefEl = unrefElement(elRef);
  10284. if (unrefEl)
  10285. return unrefEl;
  10286. return isRef(elRef) ? unrefEl : elRef;
  10287. };
  10288. const getPositionDataWithUnit = (record, key) => {
  10289. const value = record == null ? void 0 : record[key];
  10290. return isNil(value) ? "" : `${value}px`;
  10291. };
  10292. const useFloating$1 = ({
  10293. middleware,
  10294. placement,
  10295. strategy
  10296. }) => {
  10297. const referenceRef = ref();
  10298. const contentRef = ref();
  10299. const x = ref();
  10300. const y = ref();
  10301. const middlewareData = ref({});
  10302. const states = {
  10303. x,
  10304. y,
  10305. placement,
  10306. strategy,
  10307. middlewareData
  10308. };
  10309. const update = async () => {
  10310. if (!isClient)
  10311. return;
  10312. const referenceEl = unrefReference(referenceRef);
  10313. const contentEl = unrefElement(contentRef);
  10314. if (!referenceEl || !contentEl)
  10315. return;
  10316. const data = await computePosition(referenceEl, contentEl, {
  10317. placement: unref(placement),
  10318. strategy: unref(strategy),
  10319. middleware: unref(middleware)
  10320. });
  10321. keysOf(states).forEach((key) => {
  10322. states[key].value = data[key];
  10323. });
  10324. };
  10325. onMounted(() => {
  10326. watchEffect(() => {
  10327. update();
  10328. });
  10329. });
  10330. return {
  10331. ...states,
  10332. update,
  10333. referenceRef,
  10334. contentRef
  10335. };
  10336. };
  10337. const arrowMiddleware = ({
  10338. arrowRef,
  10339. padding
  10340. }) => {
  10341. return {
  10342. name: "arrow",
  10343. options: {
  10344. element: arrowRef,
  10345. padding
  10346. },
  10347. fn(args) {
  10348. const arrowEl = unref(arrowRef);
  10349. if (!arrowEl)
  10350. return {};
  10351. return arrow({
  10352. element: arrowEl,
  10353. padding
  10354. }).fn(args);
  10355. }
  10356. };
  10357. };
  10358. function useCursor(input) {
  10359. let selectionInfo;
  10360. function recordCursor() {
  10361. if (input.value == void 0)
  10362. return;
  10363. const { selectionStart, selectionEnd, value } = input.value;
  10364. if (selectionStart == null || selectionEnd == null)
  10365. return;
  10366. const beforeTxt = value.slice(0, Math.max(0, selectionStart));
  10367. const afterTxt = value.slice(Math.max(0, selectionEnd));
  10368. selectionInfo = {
  10369. selectionStart,
  10370. selectionEnd,
  10371. value,
  10372. beforeTxt,
  10373. afterTxt
  10374. };
  10375. }
  10376. function setCursor() {
  10377. if (input.value == void 0 || selectionInfo == void 0)
  10378. return;
  10379. const { value } = input.value;
  10380. const { beforeTxt, afterTxt, selectionStart } = selectionInfo;
  10381. if (beforeTxt == void 0 || afterTxt == void 0 || selectionStart == void 0)
  10382. return;
  10383. let startPos = value.length;
  10384. if (value.endsWith(afterTxt)) {
  10385. startPos = value.length - afterTxt.length;
  10386. } else if (value.startsWith(beforeTxt)) {
  10387. startPos = beforeTxt.length;
  10388. } else {
  10389. const beforeLastChar = beforeTxt[selectionStart - 1];
  10390. const newIndex = value.indexOf(beforeLastChar, selectionStart - 1);
  10391. if (newIndex !== -1) {
  10392. startPos = newIndex + 1;
  10393. }
  10394. }
  10395. input.value.setSelectionRange(startPos, startPos);
  10396. }
  10397. return [recordCursor, setCursor];
  10398. }
  10399. const getOrderedChildren = (vm, childComponentName, children) => {
  10400. const nodes = flattedChildren(vm.subTree).filter((n) => {
  10401. var _a;
  10402. return isVNode(n) && ((_a = n.type) == null ? void 0 : _a.name) === childComponentName && !!n.component;
  10403. });
  10404. const uids = nodes.map((n) => n.component.uid);
  10405. return uids.map((uid) => children[uid]).filter((p) => !!p);
  10406. };
  10407. const useOrderedChildren = (vm, childComponentName) => {
  10408. const children = {};
  10409. const orderedChildren = shallowRef([]);
  10410. const addChild = (child) => {
  10411. children[child.uid] = child;
  10412. orderedChildren.value = getOrderedChildren(vm, childComponentName, children);
  10413. };
  10414. const removeChild = (uid) => {
  10415. delete children[uid];
  10416. orderedChildren.value = orderedChildren.value.filter((children2) => children2.uid !== uid);
  10417. };
  10418. return {
  10419. children: orderedChildren,
  10420. addChild,
  10421. removeChild
  10422. };
  10423. };
  10424. const useSizeProp = buildProp({
  10425. type: String,
  10426. values: componentSizes,
  10427. required: false
  10428. });
  10429. const useSizeProps = {
  10430. size: useSizeProp
  10431. };
  10432. const SIZE_INJECTION_KEY = Symbol("size");
  10433. const useGlobalSize = () => {
  10434. const injectedSize = inject(SIZE_INJECTION_KEY, {});
  10435. return computed(() => {
  10436. return unref(injectedSize.size) || "";
  10437. });
  10438. };
  10439. function useFocusController(target, {
  10440. beforeFocus,
  10441. afterFocus,
  10442. beforeBlur,
  10443. afterBlur
  10444. } = {}) {
  10445. const instance = getCurrentInstance();
  10446. const { emit } = instance;
  10447. const wrapperRef = shallowRef();
  10448. const disabled = useProp("disabled");
  10449. const isFocused = ref(false);
  10450. const handleFocus = (event) => {
  10451. const cancelFocus = isFunction$1(beforeFocus) ? beforeFocus(event) : false;
  10452. if (cancelFocus || isFocused.value)
  10453. return;
  10454. isFocused.value = true;
  10455. emit("focus", event);
  10456. afterFocus == null ? void 0 : afterFocus();
  10457. };
  10458. const handleBlur = (event) => {
  10459. var _a;
  10460. const cancelBlur = isFunction$1(beforeBlur) ? beforeBlur(event) : false;
  10461. if (cancelBlur || event.relatedTarget && ((_a = wrapperRef.value) == null ? void 0 : _a.contains(event.relatedTarget)))
  10462. return;
  10463. isFocused.value = false;
  10464. emit("blur", event);
  10465. afterBlur == null ? void 0 : afterBlur();
  10466. };
  10467. const handleClick = () => {
  10468. var _a, _b;
  10469. if (((_a = wrapperRef.value) == null ? void 0 : _a.contains(document.activeElement)) && wrapperRef.value !== document.activeElement || disabled.value)
  10470. return;
  10471. (_b = target.value) == null ? void 0 : _b.focus();
  10472. };
  10473. watch([wrapperRef, disabled], ([el, disabled2]) => {
  10474. if (!el)
  10475. return;
  10476. if (disabled2) {
  10477. el.removeAttribute("tabindex");
  10478. } else {
  10479. el.setAttribute("tabindex", "-1");
  10480. }
  10481. });
  10482. useEventListener(wrapperRef, "focus", handleFocus, true);
  10483. useEventListener(wrapperRef, "blur", handleBlur, true);
  10484. useEventListener(wrapperRef, "click", handleClick, true);
  10485. return {
  10486. isFocused,
  10487. wrapperRef,
  10488. handleFocus,
  10489. handleBlur
  10490. };
  10491. }
  10492. function useComposition({
  10493. afterComposition,
  10494. emit
  10495. }) {
  10496. const isComposing = ref(false);
  10497. const handleCompositionStart = (event) => {
  10498. emit == null ? void 0 : emit("compositionstart", event);
  10499. isComposing.value = true;
  10500. };
  10501. const handleCompositionUpdate = (event) => {
  10502. var _a;
  10503. emit == null ? void 0 : emit("compositionupdate", event);
  10504. const text = (_a = event.target) == null ? void 0 : _a.value;
  10505. const lastCharacter = text[text.length - 1] || "";
  10506. isComposing.value = !isKorean(lastCharacter);
  10507. };
  10508. const handleCompositionEnd = (event) => {
  10509. emit == null ? void 0 : emit("compositionend", event);
  10510. if (isComposing.value) {
  10511. isComposing.value = false;
  10512. nextTick(() => afterComposition(event));
  10513. }
  10514. };
  10515. const handleComposition = (event) => {
  10516. event.type === "compositionend" ? handleCompositionEnd(event) : handleCompositionUpdate(event);
  10517. };
  10518. return {
  10519. isComposing,
  10520. handleComposition,
  10521. handleCompositionStart,
  10522. handleCompositionUpdate,
  10523. handleCompositionEnd
  10524. };
  10525. }
  10526. const emptyValuesContextKey = Symbol("emptyValuesContextKey");
  10527. const SCOPE$3 = "use-empty-values";
  10528. const DEFAULT_EMPTY_VALUES = ["", void 0, null];
  10529. const DEFAULT_VALUE_ON_CLEAR = void 0;
  10530. const useEmptyValuesProps = buildProps({
  10531. emptyValues: Array,
  10532. valueOnClear: {
  10533. type: [String, Number, Boolean, Function],
  10534. default: void 0,
  10535. validator: (val) => isFunction$1(val) ? !val() : !val
  10536. }
  10537. });
  10538. const useEmptyValues = (props, defaultValue) => {
  10539. const config = getCurrentInstance() ? inject(emptyValuesContextKey, ref({})) : ref({});
  10540. const emptyValues = computed(() => props.emptyValues || config.value.emptyValues || DEFAULT_EMPTY_VALUES);
  10541. const valueOnClear = computed(() => {
  10542. if (isFunction$1(props.valueOnClear)) {
  10543. return props.valueOnClear();
  10544. } else if (props.valueOnClear !== void 0) {
  10545. return props.valueOnClear;
  10546. } else if (isFunction$1(config.value.valueOnClear)) {
  10547. return config.value.valueOnClear();
  10548. } else if (config.value.valueOnClear !== void 0) {
  10549. return config.value.valueOnClear;
  10550. }
  10551. return defaultValue !== void 0 ? defaultValue : DEFAULT_VALUE_ON_CLEAR;
  10552. });
  10553. const isEmptyValue = (value) => {
  10554. return emptyValues.value.includes(value);
  10555. };
  10556. if (!emptyValues.value.includes(valueOnClear.value)) ;
  10557. return {
  10558. emptyValues,
  10559. valueOnClear,
  10560. isEmptyValue
  10561. };
  10562. };
  10563. const ariaProps = buildProps({
  10564. ariaLabel: String,
  10565. ariaOrientation: {
  10566. type: String,
  10567. values: ["horizontal", "vertical", "undefined"]
  10568. },
  10569. ariaControls: String
  10570. });
  10571. const useAriaProps = (arias) => {
  10572. return pick(ariaProps, arias);
  10573. };
  10574. const configProviderContextKey = Symbol();
  10575. const globalConfig = ref();
  10576. function useGlobalConfig(key, defaultValue = void 0) {
  10577. const config = getCurrentInstance() ? inject(configProviderContextKey, globalConfig) : globalConfig;
  10578. if (key) {
  10579. return computed(() => {
  10580. var _a, _b;
  10581. return (_b = (_a = config.value) == null ? void 0 : _a[key]) != null ? _b : defaultValue;
  10582. });
  10583. } else {
  10584. return config;
  10585. }
  10586. }
  10587. function useGlobalComponentSettings(block, sizeFallback) {
  10588. const config = useGlobalConfig();
  10589. const ns = useNamespace(block, computed(() => {
  10590. var _a;
  10591. return ((_a = config.value) == null ? void 0 : _a.namespace) || defaultNamespace;
  10592. }));
  10593. const locale = useLocale(computed(() => {
  10594. var _a;
  10595. return (_a = config.value) == null ? void 0 : _a.locale;
  10596. }));
  10597. const zIndex = useZIndex(computed(() => {
  10598. var _a;
  10599. return ((_a = config.value) == null ? void 0 : _a.zIndex) || defaultInitialZIndex;
  10600. }));
  10601. const size = computed(() => {
  10602. var _a;
  10603. return unref(sizeFallback) || ((_a = config.value) == null ? void 0 : _a.size) || "";
  10604. });
  10605. provideGlobalConfig(computed(() => unref(config) || {}));
  10606. return {
  10607. ns,
  10608. locale,
  10609. zIndex,
  10610. size
  10611. };
  10612. }
  10613. const provideGlobalConfig = (config, app, global = false) => {
  10614. var _a;
  10615. const inSetup = !!getCurrentInstance();
  10616. const oldConfig = inSetup ? useGlobalConfig() : void 0;
  10617. const provideFn = (_a = app == null ? void 0 : app.provide) != null ? _a : inSetup ? provide : void 0;
  10618. if (!provideFn) {
  10619. return;
  10620. }
  10621. const context = computed(() => {
  10622. const cfg = unref(config);
  10623. if (!(oldConfig == null ? void 0 : oldConfig.value))
  10624. return cfg;
  10625. return mergeConfig(oldConfig.value, cfg);
  10626. });
  10627. provideFn(configProviderContextKey, context);
  10628. provideFn(localeContextKey, computed(() => context.value.locale));
  10629. provideFn(namespaceContextKey, computed(() => context.value.namespace));
  10630. provideFn(zIndexContextKey, computed(() => context.value.zIndex));
  10631. provideFn(SIZE_INJECTION_KEY, {
  10632. size: computed(() => context.value.size || "")
  10633. });
  10634. provideFn(emptyValuesContextKey, computed(() => ({
  10635. emptyValues: context.value.emptyValues,
  10636. valueOnClear: context.value.valueOnClear
  10637. })));
  10638. if (global || !globalConfig.value) {
  10639. globalConfig.value = context.value;
  10640. }
  10641. return context;
  10642. };
  10643. const mergeConfig = (a, b) => {
  10644. const keys = [.../* @__PURE__ */ new Set([...keysOf(a), ...keysOf(b)])];
  10645. const obj = {};
  10646. for (const key of keys) {
  10647. obj[key] = b[key] !== void 0 ? b[key] : a[key];
  10648. }
  10649. return obj;
  10650. };
  10651. const configProviderProps = buildProps({
  10652. a11y: {
  10653. type: Boolean,
  10654. default: true
  10655. },
  10656. locale: {
  10657. type: definePropType(Object)
  10658. },
  10659. size: useSizeProp,
  10660. button: {
  10661. type: definePropType(Object)
  10662. },
  10663. experimentalFeatures: {
  10664. type: definePropType(Object)
  10665. },
  10666. keyboardNavigation: {
  10667. type: Boolean,
  10668. default: true
  10669. },
  10670. message: {
  10671. type: definePropType(Object)
  10672. },
  10673. zIndex: Number,
  10674. namespace: {
  10675. type: String,
  10676. default: "el"
  10677. },
  10678. ...useEmptyValuesProps
  10679. });
  10680. const messageConfig = {};
  10681. const ConfigProvider = defineComponent({
  10682. name: "ElConfigProvider",
  10683. props: configProviderProps,
  10684. setup(props, { slots }) {
  10685. watch(() => props.message, (val) => {
  10686. Object.assign(messageConfig, val != null ? val : {});
  10687. }, { immediate: true, deep: true });
  10688. const config = provideGlobalConfig(props);
  10689. return () => renderSlot(slots, "default", { config: config == null ? void 0 : config.value });
  10690. }
  10691. });
  10692. const ElConfigProvider = withInstall(ConfigProvider);
  10693. const version$1 = "2.9.8";
  10694. const makeInstaller = (components = []) => {
  10695. const install = (app, options) => {
  10696. if (app[INSTALLED_KEY])
  10697. return;
  10698. app[INSTALLED_KEY] = true;
  10699. components.forEach((c) => app.use(c));
  10700. if (options)
  10701. provideGlobalConfig(options, app, true);
  10702. };
  10703. return {
  10704. version: version$1,
  10705. install
  10706. };
  10707. };
  10708. const affixProps = buildProps({
  10709. zIndex: {
  10710. type: definePropType([Number, String]),
  10711. default: 100
  10712. },
  10713. target: {
  10714. type: String,
  10715. default: ""
  10716. },
  10717. offset: {
  10718. type: Number,
  10719. default: 0
  10720. },
  10721. position: {
  10722. type: String,
  10723. values: ["top", "bottom"],
  10724. default: "top"
  10725. }
  10726. });
  10727. const affixEmits = {
  10728. scroll: ({ scrollTop, fixed }) => isNumber(scrollTop) && isBoolean(fixed),
  10729. [CHANGE_EVENT]: (fixed) => isBoolean(fixed)
  10730. };
  10731. var _export_sfc = (sfc, props) => {
  10732. const target = sfc.__vccOpts || sfc;
  10733. for (const [key, val] of props) {
  10734. target[key] = val;
  10735. }
  10736. return target;
  10737. };
  10738. const COMPONENT_NAME$p = "ElAffix";
  10739. const __default__$1U = defineComponent({
  10740. name: COMPONENT_NAME$p
  10741. });
  10742. const _sfc_main$2x = /* @__PURE__ */ defineComponent({
  10743. ...__default__$1U,
  10744. props: affixProps,
  10745. emits: affixEmits,
  10746. setup(__props, { expose, emit }) {
  10747. const props = __props;
  10748. const ns = useNamespace("affix");
  10749. const target = shallowRef();
  10750. const root = shallowRef();
  10751. const scrollContainer = shallowRef();
  10752. const { height: windowHeight } = useWindowSize();
  10753. const {
  10754. height: rootHeight,
  10755. width: rootWidth,
  10756. top: rootTop,
  10757. bottom: rootBottom,
  10758. update: updateRoot
  10759. } = useElementBounding(root, { windowScroll: false });
  10760. const targetRect = useElementBounding(target);
  10761. const fixed = ref(false);
  10762. const scrollTop = ref(0);
  10763. const transform = ref(0);
  10764. const rootStyle = computed(() => {
  10765. return {
  10766. height: fixed.value ? `${rootHeight.value}px` : "",
  10767. width: fixed.value ? `${rootWidth.value}px` : ""
  10768. };
  10769. });
  10770. const affixStyle = computed(() => {
  10771. if (!fixed.value)
  10772. return {};
  10773. const offset = props.offset ? addUnit(props.offset) : 0;
  10774. return {
  10775. height: `${rootHeight.value}px`,
  10776. width: `${rootWidth.value}px`,
  10777. top: props.position === "top" ? offset : "",
  10778. bottom: props.position === "bottom" ? offset : "",
  10779. transform: transform.value ? `translateY(${transform.value}px)` : "",
  10780. zIndex: props.zIndex
  10781. };
  10782. });
  10783. const update = () => {
  10784. if (!scrollContainer.value)
  10785. return;
  10786. scrollTop.value = scrollContainer.value instanceof Window ? document.documentElement.scrollTop : scrollContainer.value.scrollTop || 0;
  10787. const { position, target: target2, offset } = props;
  10788. const rootHeightOffset = offset + rootHeight.value;
  10789. if (position === "top") {
  10790. if (target2) {
  10791. const difference = targetRect.bottom.value - rootHeightOffset;
  10792. fixed.value = offset > rootTop.value && targetRect.bottom.value > 0;
  10793. transform.value = difference < 0 ? difference : 0;
  10794. } else {
  10795. fixed.value = offset > rootTop.value;
  10796. }
  10797. } else if (target2) {
  10798. const difference = windowHeight.value - targetRect.top.value - rootHeightOffset;
  10799. fixed.value = windowHeight.value - offset < rootBottom.value && windowHeight.value > targetRect.top.value;
  10800. transform.value = difference < 0 ? -difference : 0;
  10801. } else {
  10802. fixed.value = windowHeight.value - offset < rootBottom.value;
  10803. }
  10804. };
  10805. const handleScroll = async () => {
  10806. updateRoot();
  10807. await nextTick();
  10808. emit("scroll", {
  10809. scrollTop: scrollTop.value,
  10810. fixed: fixed.value
  10811. });
  10812. };
  10813. watch(fixed, (val) => emit(CHANGE_EVENT, val));
  10814. onMounted(() => {
  10815. var _a;
  10816. if (props.target) {
  10817. target.value = (_a = document.querySelector(props.target)) != null ? _a : void 0;
  10818. if (!target.value)
  10819. throwError(COMPONENT_NAME$p, `Target does not exist: ${props.target}`);
  10820. } else {
  10821. target.value = document.documentElement;
  10822. }
  10823. scrollContainer.value = getScrollContainer(root.value, true);
  10824. updateRoot();
  10825. });
  10826. useEventListener(scrollContainer, "scroll", handleScroll);
  10827. watchEffect(update);
  10828. expose({
  10829. update,
  10830. updateRoot
  10831. });
  10832. return (_ctx, _cache) => {
  10833. return openBlock(), createElementBlock("div", {
  10834. ref_key: "root",
  10835. ref: root,
  10836. class: normalizeClass(unref(ns).b()),
  10837. style: normalizeStyle(unref(rootStyle))
  10838. }, [
  10839. createElementVNode("div", {
  10840. class: normalizeClass({ [unref(ns).m("fixed")]: fixed.value }),
  10841. style: normalizeStyle(unref(affixStyle))
  10842. }, [
  10843. renderSlot(_ctx.$slots, "default")
  10844. ], 6)
  10845. ], 6);
  10846. };
  10847. }
  10848. });
  10849. var Affix = /* @__PURE__ */ _export_sfc(_sfc_main$2x, [["__file", "affix.vue"]]);
  10850. const ElAffix = withInstall(Affix);
  10851. const iconProps = buildProps({
  10852. size: {
  10853. type: definePropType([Number, String])
  10854. },
  10855. color: {
  10856. type: String
  10857. }
  10858. });
  10859. const __default__$1T = defineComponent({
  10860. name: "ElIcon",
  10861. inheritAttrs: false
  10862. });
  10863. const _sfc_main$2w = /* @__PURE__ */ defineComponent({
  10864. ...__default__$1T,
  10865. props: iconProps,
  10866. setup(__props) {
  10867. const props = __props;
  10868. const ns = useNamespace("icon");
  10869. const style = computed(() => {
  10870. const { size, color } = props;
  10871. if (!size && !color)
  10872. return {};
  10873. return {
  10874. fontSize: isUndefined(size) ? void 0 : addUnit(size),
  10875. "--color": color
  10876. };
  10877. });
  10878. return (_ctx, _cache) => {
  10879. return openBlock(), createElementBlock("i", mergeProps({
  10880. class: unref(ns).b(),
  10881. style: unref(style)
  10882. }, _ctx.$attrs), [
  10883. renderSlot(_ctx.$slots, "default")
  10884. ], 16);
  10885. };
  10886. }
  10887. });
  10888. var Icon = /* @__PURE__ */ _export_sfc(_sfc_main$2w, [["__file", "icon.vue"]]);
  10889. const ElIcon = withInstall(Icon);
  10890. const alertEffects = ["light", "dark"];
  10891. const alertProps = buildProps({
  10892. title: {
  10893. type: String,
  10894. default: ""
  10895. },
  10896. description: {
  10897. type: String,
  10898. default: ""
  10899. },
  10900. type: {
  10901. type: String,
  10902. values: keysOf(TypeComponentsMap),
  10903. default: "info"
  10904. },
  10905. closable: {
  10906. type: Boolean,
  10907. default: true
  10908. },
  10909. closeText: {
  10910. type: String,
  10911. default: ""
  10912. },
  10913. showIcon: Boolean,
  10914. center: Boolean,
  10915. effect: {
  10916. type: String,
  10917. values: alertEffects,
  10918. default: "light"
  10919. }
  10920. });
  10921. const alertEmits = {
  10922. close: (evt) => evt instanceof MouseEvent
  10923. };
  10924. const __default__$1S = defineComponent({
  10925. name: "ElAlert"
  10926. });
  10927. const _sfc_main$2v = /* @__PURE__ */ defineComponent({
  10928. ...__default__$1S,
  10929. props: alertProps,
  10930. emits: alertEmits,
  10931. setup(__props, { emit }) {
  10932. const props = __props;
  10933. const { Close } = TypeComponents;
  10934. const slots = useSlots();
  10935. const ns = useNamespace("alert");
  10936. const visible = ref(true);
  10937. const iconComponent = computed(() => TypeComponentsMap[props.type]);
  10938. const hasDesc = computed(() => !!(props.description || slots.default));
  10939. const close = (evt) => {
  10940. visible.value = false;
  10941. emit("close", evt);
  10942. };
  10943. return (_ctx, _cache) => {
  10944. return openBlock(), createBlock(Transition, {
  10945. name: unref(ns).b("fade"),
  10946. persisted: ""
  10947. }, {
  10948. default: withCtx(() => [
  10949. withDirectives(createElementVNode("div", {
  10950. class: normalizeClass([unref(ns).b(), unref(ns).m(_ctx.type), unref(ns).is("center", _ctx.center), unref(ns).is(_ctx.effect)]),
  10951. role: "alert"
  10952. }, [
  10953. _ctx.showIcon && (_ctx.$slots.icon || unref(iconComponent)) ? (openBlock(), createBlock(unref(ElIcon), {
  10954. key: 0,
  10955. class: normalizeClass([unref(ns).e("icon"), { [unref(ns).is("big")]: unref(hasDesc) }])
  10956. }, {
  10957. default: withCtx(() => [
  10958. renderSlot(_ctx.$slots, "icon", {}, () => [
  10959. (openBlock(), createBlock(resolveDynamicComponent(unref(iconComponent))))
  10960. ])
  10961. ]),
  10962. _: 3
  10963. }, 8, ["class"])) : createCommentVNode("v-if", true),
  10964. createElementVNode("div", {
  10965. class: normalizeClass(unref(ns).e("content"))
  10966. }, [
  10967. _ctx.title || _ctx.$slots.title ? (openBlock(), createElementBlock("span", {
  10968. key: 0,
  10969. class: normalizeClass([unref(ns).e("title"), { "with-description": unref(hasDesc) }])
  10970. }, [
  10971. renderSlot(_ctx.$slots, "title", {}, () => [
  10972. createTextVNode(toDisplayString(_ctx.title), 1)
  10973. ])
  10974. ], 2)) : createCommentVNode("v-if", true),
  10975. unref(hasDesc) ? (openBlock(), createElementBlock("p", {
  10976. key: 1,
  10977. class: normalizeClass(unref(ns).e("description"))
  10978. }, [
  10979. renderSlot(_ctx.$slots, "default", {}, () => [
  10980. createTextVNode(toDisplayString(_ctx.description), 1)
  10981. ])
  10982. ], 2)) : createCommentVNode("v-if", true),
  10983. _ctx.closable ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
  10984. _ctx.closeText ? (openBlock(), createElementBlock("div", {
  10985. key: 0,
  10986. class: normalizeClass([unref(ns).e("close-btn"), unref(ns).is("customed")]),
  10987. onClick: close
  10988. }, toDisplayString(_ctx.closeText), 3)) : (openBlock(), createBlock(unref(ElIcon), {
  10989. key: 1,
  10990. class: normalizeClass(unref(ns).e("close-btn")),
  10991. onClick: close
  10992. }, {
  10993. default: withCtx(() => [
  10994. createVNode(unref(Close))
  10995. ]),
  10996. _: 1
  10997. }, 8, ["class"]))
  10998. ], 64)) : createCommentVNode("v-if", true)
  10999. ], 2)
  11000. ], 2), [
  11001. [vShow, visible.value]
  11002. ])
  11003. ]),
  11004. _: 3
  11005. }, 8, ["name"]);
  11006. };
  11007. }
  11008. });
  11009. var Alert = /* @__PURE__ */ _export_sfc(_sfc_main$2v, [["__file", "alert.vue"]]);
  11010. const ElAlert = withInstall(Alert);
  11011. const formContextKey = Symbol("formContextKey");
  11012. const formItemContextKey = Symbol("formItemContextKey");
  11013. const useFormSize = (fallback, ignore = {}) => {
  11014. const emptyRef = ref(void 0);
  11015. const size = ignore.prop ? emptyRef : useProp("size");
  11016. const globalConfig = ignore.global ? emptyRef : useGlobalSize();
  11017. const form = ignore.form ? { size: void 0 } : inject(formContextKey, void 0);
  11018. const formItem = ignore.formItem ? { size: void 0 } : inject(formItemContextKey, void 0);
  11019. return computed(() => size.value || unref(fallback) || (formItem == null ? void 0 : formItem.size) || (form == null ? void 0 : form.size) || globalConfig.value || "");
  11020. };
  11021. const useFormDisabled = (fallback) => {
  11022. const disabled = useProp("disabled");
  11023. const form = inject(formContextKey, void 0);
  11024. return computed(() => disabled.value || unref(fallback) || (form == null ? void 0 : form.disabled) || false);
  11025. };
  11026. const useSize = useFormSize;
  11027. const useDisabled = useFormDisabled;
  11028. const useFormItem = () => {
  11029. const form = inject(formContextKey, void 0);
  11030. const formItem = inject(formItemContextKey, void 0);
  11031. return {
  11032. form,
  11033. formItem
  11034. };
  11035. };
  11036. const useFormItemInputId = (props, {
  11037. formItemContext,
  11038. disableIdGeneration,
  11039. disableIdManagement
  11040. }) => {
  11041. if (!disableIdGeneration) {
  11042. disableIdGeneration = ref(false);
  11043. }
  11044. if (!disableIdManagement) {
  11045. disableIdManagement = ref(false);
  11046. }
  11047. const inputId = ref();
  11048. let idUnwatch = void 0;
  11049. const isLabeledByFormItem = computed(() => {
  11050. var _a;
  11051. return !!(!(props.label || props.ariaLabel) && formItemContext && formItemContext.inputIds && ((_a = formItemContext.inputIds) == null ? void 0 : _a.length) <= 1);
  11052. });
  11053. onMounted(() => {
  11054. idUnwatch = watch([toRef(props, "id"), disableIdGeneration], ([id, disableIdGeneration2]) => {
  11055. const newId = id != null ? id : !disableIdGeneration2 ? useId().value : void 0;
  11056. if (newId !== inputId.value) {
  11057. if (formItemContext == null ? void 0 : formItemContext.removeInputId) {
  11058. inputId.value && formItemContext.removeInputId(inputId.value);
  11059. if (!(disableIdManagement == null ? void 0 : disableIdManagement.value) && !disableIdGeneration2 && newId) {
  11060. formItemContext.addInputId(newId);
  11061. }
  11062. }
  11063. inputId.value = newId;
  11064. }
  11065. }, { immediate: true });
  11066. });
  11067. onUnmounted(() => {
  11068. idUnwatch && idUnwatch();
  11069. if (formItemContext == null ? void 0 : formItemContext.removeInputId) {
  11070. inputId.value && formItemContext.removeInputId(inputId.value);
  11071. }
  11072. });
  11073. return {
  11074. isLabeledByFormItem,
  11075. inputId
  11076. };
  11077. };
  11078. const formMetaProps = buildProps({
  11079. size: {
  11080. type: String,
  11081. values: componentSizes
  11082. },
  11083. disabled: Boolean
  11084. });
  11085. const formProps = buildProps({
  11086. ...formMetaProps,
  11087. model: Object,
  11088. rules: {
  11089. type: definePropType(Object)
  11090. },
  11091. labelPosition: {
  11092. type: String,
  11093. values: ["left", "right", "top"],
  11094. default: "right"
  11095. },
  11096. requireAsteriskPosition: {
  11097. type: String,
  11098. values: ["left", "right"],
  11099. default: "left"
  11100. },
  11101. labelWidth: {
  11102. type: [String, Number],
  11103. default: ""
  11104. },
  11105. labelSuffix: {
  11106. type: String,
  11107. default: ""
  11108. },
  11109. inline: Boolean,
  11110. inlineMessage: Boolean,
  11111. statusIcon: Boolean,
  11112. showMessage: {
  11113. type: Boolean,
  11114. default: true
  11115. },
  11116. validateOnRuleChange: {
  11117. type: Boolean,
  11118. default: true
  11119. },
  11120. hideRequiredAsterisk: Boolean,
  11121. scrollToError: Boolean,
  11122. scrollIntoViewOptions: {
  11123. type: [Object, Boolean]
  11124. }
  11125. });
  11126. const formEmits = {
  11127. validate: (prop, isValid, message) => (isArray$1(prop) || isString$1(prop)) && isBoolean(isValid) && isString$1(message)
  11128. };
  11129. function useFormLabelWidth() {
  11130. const potentialLabelWidthArr = ref([]);
  11131. const autoLabelWidth = computed(() => {
  11132. if (!potentialLabelWidthArr.value.length)
  11133. return "0";
  11134. const max = Math.max(...potentialLabelWidthArr.value);
  11135. return max ? `${max}px` : "";
  11136. });
  11137. function getLabelWidthIndex(width) {
  11138. const index = potentialLabelWidthArr.value.indexOf(width);
  11139. if (index === -1 && autoLabelWidth.value === "0") ;
  11140. return index;
  11141. }
  11142. function registerLabelWidth(val, oldVal) {
  11143. if (val && oldVal) {
  11144. const index = getLabelWidthIndex(oldVal);
  11145. potentialLabelWidthArr.value.splice(index, 1, val);
  11146. } else if (val) {
  11147. potentialLabelWidthArr.value.push(val);
  11148. }
  11149. }
  11150. function deregisterLabelWidth(val) {
  11151. const index = getLabelWidthIndex(val);
  11152. if (index > -1) {
  11153. potentialLabelWidthArr.value.splice(index, 1);
  11154. }
  11155. }
  11156. return {
  11157. autoLabelWidth,
  11158. registerLabelWidth,
  11159. deregisterLabelWidth
  11160. };
  11161. }
  11162. const filterFields = (fields, props) => {
  11163. const normalized = castArray$1(props);
  11164. return normalized.length > 0 ? fields.filter((field) => field.prop && normalized.includes(field.prop)) : fields;
  11165. };
  11166. const COMPONENT_NAME$o = "ElForm";
  11167. const __default__$1R = defineComponent({
  11168. name: COMPONENT_NAME$o
  11169. });
  11170. const _sfc_main$2u = /* @__PURE__ */ defineComponent({
  11171. ...__default__$1R,
  11172. props: formProps,
  11173. emits: formEmits,
  11174. setup(__props, { expose, emit }) {
  11175. const props = __props;
  11176. const fields = [];
  11177. const formSize = useFormSize();
  11178. const ns = useNamespace("form");
  11179. const formClasses = computed(() => {
  11180. const { labelPosition, inline } = props;
  11181. return [
  11182. ns.b(),
  11183. ns.m(formSize.value || "default"),
  11184. {
  11185. [ns.m(`label-${labelPosition}`)]: labelPosition,
  11186. [ns.m("inline")]: inline
  11187. }
  11188. ];
  11189. });
  11190. const getField = (prop) => {
  11191. return fields.find((field) => field.prop === prop);
  11192. };
  11193. const addField = (field) => {
  11194. fields.push(field);
  11195. };
  11196. const removeField = (field) => {
  11197. if (field.prop) {
  11198. fields.splice(fields.indexOf(field), 1);
  11199. }
  11200. };
  11201. const resetFields = (properties = []) => {
  11202. if (!props.model) {
  11203. return;
  11204. }
  11205. filterFields(fields, properties).forEach((field) => field.resetField());
  11206. };
  11207. const clearValidate = (props2 = []) => {
  11208. filterFields(fields, props2).forEach((field) => field.clearValidate());
  11209. };
  11210. const isValidatable = computed(() => {
  11211. const hasModel = !!props.model;
  11212. return hasModel;
  11213. });
  11214. const obtainValidateFields = (props2) => {
  11215. if (fields.length === 0)
  11216. return [];
  11217. const filteredFields = filterFields(fields, props2);
  11218. if (!filteredFields.length) {
  11219. return [];
  11220. }
  11221. return filteredFields;
  11222. };
  11223. const validate = async (callback) => validateField(void 0, callback);
  11224. const doValidateField = async (props2 = []) => {
  11225. if (!isValidatable.value)
  11226. return false;
  11227. const fields2 = obtainValidateFields(props2);
  11228. if (fields2.length === 0)
  11229. return true;
  11230. let validationErrors = {};
  11231. for (const field of fields2) {
  11232. try {
  11233. await field.validate("");
  11234. if (field.validateState === "error")
  11235. field.resetField();
  11236. } catch (fields3) {
  11237. validationErrors = {
  11238. ...validationErrors,
  11239. ...fields3
  11240. };
  11241. }
  11242. }
  11243. if (Object.keys(validationErrors).length === 0)
  11244. return true;
  11245. return Promise.reject(validationErrors);
  11246. };
  11247. const validateField = async (modelProps = [], callback) => {
  11248. const shouldThrow = !isFunction$1(callback);
  11249. try {
  11250. const result = await doValidateField(modelProps);
  11251. if (result === true) {
  11252. await (callback == null ? void 0 : callback(result));
  11253. }
  11254. return result;
  11255. } catch (e) {
  11256. if (e instanceof Error)
  11257. throw e;
  11258. const invalidFields = e;
  11259. if (props.scrollToError) {
  11260. scrollToField(Object.keys(invalidFields)[0]);
  11261. }
  11262. await (callback == null ? void 0 : callback(false, invalidFields));
  11263. return shouldThrow && Promise.reject(invalidFields);
  11264. }
  11265. };
  11266. const scrollToField = (prop) => {
  11267. var _a;
  11268. const field = filterFields(fields, prop)[0];
  11269. if (field) {
  11270. (_a = field.$el) == null ? void 0 : _a.scrollIntoView(props.scrollIntoViewOptions);
  11271. }
  11272. };
  11273. watch(() => props.rules, () => {
  11274. if (props.validateOnRuleChange) {
  11275. validate().catch((err) => debugWarn());
  11276. }
  11277. }, { deep: true, flush: "post" });
  11278. provide(formContextKey, reactive({
  11279. ...toRefs(props),
  11280. emit,
  11281. resetFields,
  11282. clearValidate,
  11283. validateField,
  11284. getField,
  11285. addField,
  11286. removeField,
  11287. ...useFormLabelWidth()
  11288. }));
  11289. expose({
  11290. validate,
  11291. validateField,
  11292. resetFields,
  11293. clearValidate,
  11294. scrollToField,
  11295. fields
  11296. });
  11297. return (_ctx, _cache) => {
  11298. return openBlock(), createElementBlock("form", {
  11299. class: normalizeClass(unref(formClasses))
  11300. }, [
  11301. renderSlot(_ctx.$slots, "default")
  11302. ], 2);
  11303. };
  11304. }
  11305. });
  11306. var Form = /* @__PURE__ */ _export_sfc(_sfc_main$2u, [["__file", "form.vue"]]);
  11307. function _extends() {
  11308. _extends = Object.assign ? Object.assign.bind() : function(target) {
  11309. for (var i = 1; i < arguments.length; i++) {
  11310. var source = arguments[i];
  11311. for (var key in source) {
  11312. if (Object.prototype.hasOwnProperty.call(source, key)) {
  11313. target[key] = source[key];
  11314. }
  11315. }
  11316. }
  11317. return target;
  11318. };
  11319. return _extends.apply(this, arguments);
  11320. }
  11321. function _inheritsLoose(subClass, superClass) {
  11322. subClass.prototype = Object.create(superClass.prototype);
  11323. subClass.prototype.constructor = subClass;
  11324. _setPrototypeOf(subClass, superClass);
  11325. }
  11326. function _getPrototypeOf(o) {
  11327. _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf2(o2) {
  11328. return o2.__proto__ || Object.getPrototypeOf(o2);
  11329. };
  11330. return _getPrototypeOf(o);
  11331. }
  11332. function _setPrototypeOf(o, p) {
  11333. _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf2(o2, p2) {
  11334. o2.__proto__ = p2;
  11335. return o2;
  11336. };
  11337. return _setPrototypeOf(o, p);
  11338. }
  11339. function _isNativeReflectConstruct() {
  11340. if (typeof Reflect === "undefined" || !Reflect.construct)
  11341. return false;
  11342. if (Reflect.construct.sham)
  11343. return false;
  11344. if (typeof Proxy === "function")
  11345. return true;
  11346. try {
  11347. Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
  11348. }));
  11349. return true;
  11350. } catch (e) {
  11351. return false;
  11352. }
  11353. }
  11354. function _construct(Parent, args, Class) {
  11355. if (_isNativeReflectConstruct()) {
  11356. _construct = Reflect.construct.bind();
  11357. } else {
  11358. _construct = function _construct2(Parent2, args2, Class2) {
  11359. var a = [null];
  11360. a.push.apply(a, args2);
  11361. var Constructor = Function.bind.apply(Parent2, a);
  11362. var instance = new Constructor();
  11363. if (Class2)
  11364. _setPrototypeOf(instance, Class2.prototype);
  11365. return instance;
  11366. };
  11367. }
  11368. return _construct.apply(null, arguments);
  11369. }
  11370. function _isNativeFunction(fn) {
  11371. return Function.toString.call(fn).indexOf("[native code]") !== -1;
  11372. }
  11373. function _wrapNativeSuper(Class) {
  11374. var _cache = typeof Map === "function" ? /* @__PURE__ */ new Map() : void 0;
  11375. _wrapNativeSuper = function _wrapNativeSuper2(Class2) {
  11376. if (Class2 === null || !_isNativeFunction(Class2))
  11377. return Class2;
  11378. if (typeof Class2 !== "function") {
  11379. throw new TypeError("Super expression must either be null or a function");
  11380. }
  11381. if (typeof _cache !== "undefined") {
  11382. if (_cache.has(Class2))
  11383. return _cache.get(Class2);
  11384. _cache.set(Class2, Wrapper);
  11385. }
  11386. function Wrapper() {
  11387. return _construct(Class2, arguments, _getPrototypeOf(this).constructor);
  11388. }
  11389. Wrapper.prototype = Object.create(Class2.prototype, {
  11390. constructor: {
  11391. value: Wrapper,
  11392. enumerable: false,
  11393. writable: true,
  11394. configurable: true
  11395. }
  11396. });
  11397. return _setPrototypeOf(Wrapper, Class2);
  11398. };
  11399. return _wrapNativeSuper(Class);
  11400. }
  11401. var formatRegExp = /%[sdj%]/g;
  11402. var warning = function warning2() {
  11403. };
  11404. if (typeof process !== "undefined" && process.env && false) {
  11405. warning = function warning3(type4, errors) {
  11406. if (typeof console !== "undefined" && console.warn && typeof ASYNC_VALIDATOR_NO_WARNING === "undefined") {
  11407. if (errors.every(function(e) {
  11408. return typeof e === "string";
  11409. })) {
  11410. console.warn(type4, errors);
  11411. }
  11412. }
  11413. };
  11414. }
  11415. function convertFieldsError(errors) {
  11416. if (!errors || !errors.length)
  11417. return null;
  11418. var fields = {};
  11419. errors.forEach(function(error) {
  11420. var field = error.field;
  11421. fields[field] = fields[field] || [];
  11422. fields[field].push(error);
  11423. });
  11424. return fields;
  11425. }
  11426. function format(template) {
  11427. for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  11428. args[_key - 1] = arguments[_key];
  11429. }
  11430. var i = 0;
  11431. var len = args.length;
  11432. if (typeof template === "function") {
  11433. return template.apply(null, args);
  11434. }
  11435. if (typeof template === "string") {
  11436. var str = template.replace(formatRegExp, function(x) {
  11437. if (x === "%%") {
  11438. return "%";
  11439. }
  11440. if (i >= len) {
  11441. return x;
  11442. }
  11443. switch (x) {
  11444. case "%s":
  11445. return String(args[i++]);
  11446. case "%d":
  11447. return Number(args[i++]);
  11448. case "%j":
  11449. try {
  11450. return JSON.stringify(args[i++]);
  11451. } catch (_) {
  11452. return "[Circular]";
  11453. }
  11454. break;
  11455. default:
  11456. return x;
  11457. }
  11458. });
  11459. return str;
  11460. }
  11461. return template;
  11462. }
  11463. function isNativeStringType(type4) {
  11464. return type4 === "string" || type4 === "url" || type4 === "hex" || type4 === "email" || type4 === "date" || type4 === "pattern";
  11465. }
  11466. function isEmptyValue(value, type4) {
  11467. if (value === void 0 || value === null) {
  11468. return true;
  11469. }
  11470. if (type4 === "array" && Array.isArray(value) && !value.length) {
  11471. return true;
  11472. }
  11473. if (isNativeStringType(type4) && typeof value === "string" && !value) {
  11474. return true;
  11475. }
  11476. return false;
  11477. }
  11478. function asyncParallelArray(arr, func, callback) {
  11479. var results = [];
  11480. var total = 0;
  11481. var arrLength = arr.length;
  11482. function count(errors) {
  11483. results.push.apply(results, errors || []);
  11484. total++;
  11485. if (total === arrLength) {
  11486. callback(results);
  11487. }
  11488. }
  11489. arr.forEach(function(a) {
  11490. func(a, count);
  11491. });
  11492. }
  11493. function asyncSerialArray(arr, func, callback) {
  11494. var index = 0;
  11495. var arrLength = arr.length;
  11496. function next(errors) {
  11497. if (errors && errors.length) {
  11498. callback(errors);
  11499. return;
  11500. }
  11501. var original = index;
  11502. index = index + 1;
  11503. if (original < arrLength) {
  11504. func(arr[original], next);
  11505. } else {
  11506. callback([]);
  11507. }
  11508. }
  11509. next([]);
  11510. }
  11511. function flattenObjArr(objArr) {
  11512. var ret = [];
  11513. Object.keys(objArr).forEach(function(k) {
  11514. ret.push.apply(ret, objArr[k] || []);
  11515. });
  11516. return ret;
  11517. }
  11518. var AsyncValidationError = /* @__PURE__ */ function(_Error) {
  11519. _inheritsLoose(AsyncValidationError2, _Error);
  11520. function AsyncValidationError2(errors, fields) {
  11521. var _this;
  11522. _this = _Error.call(this, "Async Validation Error") || this;
  11523. _this.errors = errors;
  11524. _this.fields = fields;
  11525. return _this;
  11526. }
  11527. return AsyncValidationError2;
  11528. }(/* @__PURE__ */ _wrapNativeSuper(Error));
  11529. function asyncMap(objArr, option, func, callback, source) {
  11530. if (option.first) {
  11531. var _pending = new Promise(function(resolve, reject) {
  11532. var next = function next2(errors) {
  11533. callback(errors);
  11534. return errors.length ? reject(new AsyncValidationError(errors, convertFieldsError(errors))) : resolve(source);
  11535. };
  11536. var flattenArr = flattenObjArr(objArr);
  11537. asyncSerialArray(flattenArr, func, next);
  11538. });
  11539. _pending["catch"](function(e) {
  11540. return e;
  11541. });
  11542. return _pending;
  11543. }
  11544. var firstFields = option.firstFields === true ? Object.keys(objArr) : option.firstFields || [];
  11545. var objArrKeys = Object.keys(objArr);
  11546. var objArrLength = objArrKeys.length;
  11547. var total = 0;
  11548. var results = [];
  11549. var pending = new Promise(function(resolve, reject) {
  11550. var next = function next2(errors) {
  11551. results.push.apply(results, errors);
  11552. total++;
  11553. if (total === objArrLength) {
  11554. callback(results);
  11555. return results.length ? reject(new AsyncValidationError(results, convertFieldsError(results))) : resolve(source);
  11556. }
  11557. };
  11558. if (!objArrKeys.length) {
  11559. callback(results);
  11560. resolve(source);
  11561. }
  11562. objArrKeys.forEach(function(key) {
  11563. var arr = objArr[key];
  11564. if (firstFields.indexOf(key) !== -1) {
  11565. asyncSerialArray(arr, func, next);
  11566. } else {
  11567. asyncParallelArray(arr, func, next);
  11568. }
  11569. });
  11570. });
  11571. pending["catch"](function(e) {
  11572. return e;
  11573. });
  11574. return pending;
  11575. }
  11576. function isErrorObj(obj) {
  11577. return !!(obj && obj.message !== void 0);
  11578. }
  11579. function getValue(value, path) {
  11580. var v = value;
  11581. for (var i = 0; i < path.length; i++) {
  11582. if (v == void 0) {
  11583. return v;
  11584. }
  11585. v = v[path[i]];
  11586. }
  11587. return v;
  11588. }
  11589. function complementError(rule, source) {
  11590. return function(oe) {
  11591. var fieldValue;
  11592. if (rule.fullFields) {
  11593. fieldValue = getValue(source, rule.fullFields);
  11594. } else {
  11595. fieldValue = source[oe.field || rule.fullField];
  11596. }
  11597. if (isErrorObj(oe)) {
  11598. oe.field = oe.field || rule.fullField;
  11599. oe.fieldValue = fieldValue;
  11600. return oe;
  11601. }
  11602. return {
  11603. message: typeof oe === "function" ? oe() : oe,
  11604. fieldValue,
  11605. field: oe.field || rule.fullField
  11606. };
  11607. };
  11608. }
  11609. function deepMerge(target, source) {
  11610. if (source) {
  11611. for (var s in source) {
  11612. if (source.hasOwnProperty(s)) {
  11613. var value = source[s];
  11614. if (typeof value === "object" && typeof target[s] === "object") {
  11615. target[s] = _extends({}, target[s], value);
  11616. } else {
  11617. target[s] = value;
  11618. }
  11619. }
  11620. }
  11621. }
  11622. return target;
  11623. }
  11624. var required$1 = function required(rule, value, source, errors, options, type4) {
  11625. if (rule.required && (!source.hasOwnProperty(rule.field) || isEmptyValue(value, type4 || rule.type))) {
  11626. errors.push(format(options.messages.required, rule.fullField));
  11627. }
  11628. };
  11629. var whitespace = function whitespace2(rule, value, source, errors, options) {
  11630. if (/^\s+$/.test(value) || value === "") {
  11631. errors.push(format(options.messages.whitespace, rule.fullField));
  11632. }
  11633. };
  11634. var urlReg;
  11635. var getUrlRegex = function() {
  11636. if (urlReg) {
  11637. return urlReg;
  11638. }
  11639. var word = "[a-fA-F\\d:]";
  11640. var b = function b2(options) {
  11641. return options && options.includeBoundaries ? "(?:(?<=\\s|^)(?=" + word + ")|(?<=" + word + ")(?=\\s|$))" : "";
  11642. };
  11643. 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}";
  11644. var v6seg = "[a-fA-F\\d]{1,4}";
  11645. 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();
  11646. var v46Exact = new RegExp("(?:^" + v4 + "$)|(?:^" + v6 + "$)");
  11647. var v4exact = new RegExp("^" + v4 + "$");
  11648. var v6exact = new RegExp("^" + v6 + "$");
  11649. var ip = function ip2(options) {
  11650. return options && options.exact ? v46Exact : new RegExp("(?:" + b(options) + v4 + b(options) + ")|(?:" + b(options) + v6 + b(options) + ")", "g");
  11651. };
  11652. ip.v4 = function(options) {
  11653. return options && options.exact ? v4exact : new RegExp("" + b(options) + v4 + b(options), "g");
  11654. };
  11655. ip.v6 = function(options) {
  11656. return options && options.exact ? v6exact : new RegExp("" + b(options) + v6 + b(options), "g");
  11657. };
  11658. var protocol = "(?:(?:[a-z]+:)?//)";
  11659. var auth = "(?:\\S+(?::\\S*)?@)?";
  11660. var ipv4 = ip.v4().source;
  11661. var ipv6 = ip.v6().source;
  11662. var host = "(?:(?:[a-z\\u00a1-\\uffff0-9][-_]*)*[a-z\\u00a1-\\uffff0-9]+)";
  11663. var domain = "(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*";
  11664. var tld = "(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))";
  11665. var port = "(?::\\d{2,5})?";
  11666. var path = '(?:[/?#][^\\s"]*)?';
  11667. var regex = "(?:" + protocol + "|www\\.)" + auth + "(?:localhost|" + ipv4 + "|" + ipv6 + "|" + host + domain + tld + ")" + port + path;
  11668. urlReg = new RegExp("(?:^" + regex + "$)", "i");
  11669. return urlReg;
  11670. };
  11671. var pattern$2 = {
  11672. 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,}))$/,
  11673. hex: /^#?([a-f0-9]{6}|[a-f0-9]{3})$/i
  11674. };
  11675. var types = {
  11676. integer: function integer(value) {
  11677. return types.number(value) && parseInt(value, 10) === value;
  11678. },
  11679. "float": function float(value) {
  11680. return types.number(value) && !types.integer(value);
  11681. },
  11682. array: function array(value) {
  11683. return Array.isArray(value);
  11684. },
  11685. regexp: function regexp(value) {
  11686. if (value instanceof RegExp) {
  11687. return true;
  11688. }
  11689. try {
  11690. return !!new RegExp(value);
  11691. } catch (e) {
  11692. return false;
  11693. }
  11694. },
  11695. date: function date(value) {
  11696. return typeof value.getTime === "function" && typeof value.getMonth === "function" && typeof value.getYear === "function" && !isNaN(value.getTime());
  11697. },
  11698. number: function number(value) {
  11699. if (isNaN(value)) {
  11700. return false;
  11701. }
  11702. return typeof value === "number";
  11703. },
  11704. object: function object(value) {
  11705. return typeof value === "object" && !types.array(value);
  11706. },
  11707. method: function method(value) {
  11708. return typeof value === "function";
  11709. },
  11710. email: function email(value) {
  11711. return typeof value === "string" && value.length <= 320 && !!value.match(pattern$2.email);
  11712. },
  11713. url: function url(value) {
  11714. return typeof value === "string" && value.length <= 2048 && !!value.match(getUrlRegex());
  11715. },
  11716. hex: function hex(value) {
  11717. return typeof value === "string" && !!value.match(pattern$2.hex);
  11718. }
  11719. };
  11720. var type$1 = function type(rule, value, source, errors, options) {
  11721. if (rule.required && value === void 0) {
  11722. required$1(rule, value, source, errors, options);
  11723. return;
  11724. }
  11725. var custom = ["integer", "float", "array", "regexp", "object", "method", "email", "number", "date", "url", "hex"];
  11726. var ruleType = rule.type;
  11727. if (custom.indexOf(ruleType) > -1) {
  11728. if (!types[ruleType](value)) {
  11729. errors.push(format(options.messages.types[ruleType], rule.fullField, rule.type));
  11730. }
  11731. } else if (ruleType && typeof value !== rule.type) {
  11732. errors.push(format(options.messages.types[ruleType], rule.fullField, rule.type));
  11733. }
  11734. };
  11735. var range = function range2(rule, value, source, errors, options) {
  11736. var len = typeof rule.len === "number";
  11737. var min = typeof rule.min === "number";
  11738. var max = typeof rule.max === "number";
  11739. var val = value;
  11740. var key = null;
  11741. var num = typeof value === "number";
  11742. var str = typeof value === "string";
  11743. var arr = Array.isArray(value);
  11744. if (num) {
  11745. key = "number";
  11746. } else if (str) {
  11747. key = "string";
  11748. } else if (arr) {
  11749. key = "array";
  11750. }
  11751. if (!key) {
  11752. return false;
  11753. }
  11754. if (arr) {
  11755. val = value.length;
  11756. }
  11757. if (str) {
  11758. val = value.length;
  11759. }
  11760. if (len) {
  11761. if (val !== rule.len) {
  11762. errors.push(format(options.messages[key].len, rule.fullField, rule.len));
  11763. }
  11764. } else if (min && !max && val < rule.min) {
  11765. errors.push(format(options.messages[key].min, rule.fullField, rule.min));
  11766. } else if (max && !min && val > rule.max) {
  11767. errors.push(format(options.messages[key].max, rule.fullField, rule.max));
  11768. } else if (min && max && (val < rule.min || val > rule.max)) {
  11769. errors.push(format(options.messages[key].range, rule.fullField, rule.min, rule.max));
  11770. }
  11771. };
  11772. var ENUM$1 = "enum";
  11773. var enumerable$1 = function enumerable(rule, value, source, errors, options) {
  11774. rule[ENUM$1] = Array.isArray(rule[ENUM$1]) ? rule[ENUM$1] : [];
  11775. if (rule[ENUM$1].indexOf(value) === -1) {
  11776. errors.push(format(options.messages[ENUM$1], rule.fullField, rule[ENUM$1].join(", ")));
  11777. }
  11778. };
  11779. var pattern$1 = function pattern(rule, value, source, errors, options) {
  11780. if (rule.pattern) {
  11781. if (rule.pattern instanceof RegExp) {
  11782. rule.pattern.lastIndex = 0;
  11783. if (!rule.pattern.test(value)) {
  11784. errors.push(format(options.messages.pattern.mismatch, rule.fullField, value, rule.pattern));
  11785. }
  11786. } else if (typeof rule.pattern === "string") {
  11787. var _pattern = new RegExp(rule.pattern);
  11788. if (!_pattern.test(value)) {
  11789. errors.push(format(options.messages.pattern.mismatch, rule.fullField, value, rule.pattern));
  11790. }
  11791. }
  11792. }
  11793. };
  11794. var rules = {
  11795. required: required$1,
  11796. whitespace,
  11797. type: type$1,
  11798. range,
  11799. "enum": enumerable$1,
  11800. pattern: pattern$1
  11801. };
  11802. var string = function string2(rule, value, callback, source, options) {
  11803. var errors = [];
  11804. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  11805. if (validate) {
  11806. if (isEmptyValue(value, "string") && !rule.required) {
  11807. return callback();
  11808. }
  11809. rules.required(rule, value, source, errors, options, "string");
  11810. if (!isEmptyValue(value, "string")) {
  11811. rules.type(rule, value, source, errors, options);
  11812. rules.range(rule, value, source, errors, options);
  11813. rules.pattern(rule, value, source, errors, options);
  11814. if (rule.whitespace === true) {
  11815. rules.whitespace(rule, value, source, errors, options);
  11816. }
  11817. }
  11818. }
  11819. callback(errors);
  11820. };
  11821. var method2 = function method3(rule, value, callback, source, options) {
  11822. var errors = [];
  11823. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  11824. if (validate) {
  11825. if (isEmptyValue(value) && !rule.required) {
  11826. return callback();
  11827. }
  11828. rules.required(rule, value, source, errors, options);
  11829. if (value !== void 0) {
  11830. rules.type(rule, value, source, errors, options);
  11831. }
  11832. }
  11833. callback(errors);
  11834. };
  11835. var number2 = function number3(rule, value, callback, source, options) {
  11836. var errors = [];
  11837. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  11838. if (validate) {
  11839. if (value === "") {
  11840. value = void 0;
  11841. }
  11842. if (isEmptyValue(value) && !rule.required) {
  11843. return callback();
  11844. }
  11845. rules.required(rule, value, source, errors, options);
  11846. if (value !== void 0) {
  11847. rules.type(rule, value, source, errors, options);
  11848. rules.range(rule, value, source, errors, options);
  11849. }
  11850. }
  11851. callback(errors);
  11852. };
  11853. var _boolean = function _boolean2(rule, value, callback, source, options) {
  11854. var errors = [];
  11855. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  11856. if (validate) {
  11857. if (isEmptyValue(value) && !rule.required) {
  11858. return callback();
  11859. }
  11860. rules.required(rule, value, source, errors, options);
  11861. if (value !== void 0) {
  11862. rules.type(rule, value, source, errors, options);
  11863. }
  11864. }
  11865. callback(errors);
  11866. };
  11867. var regexp2 = function regexp3(rule, value, callback, source, options) {
  11868. var errors = [];
  11869. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  11870. if (validate) {
  11871. if (isEmptyValue(value) && !rule.required) {
  11872. return callback();
  11873. }
  11874. rules.required(rule, value, source, errors, options);
  11875. if (!isEmptyValue(value)) {
  11876. rules.type(rule, value, source, errors, options);
  11877. }
  11878. }
  11879. callback(errors);
  11880. };
  11881. var integer2 = function integer3(rule, value, callback, source, options) {
  11882. var errors = [];
  11883. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  11884. if (validate) {
  11885. if (isEmptyValue(value) && !rule.required) {
  11886. return callback();
  11887. }
  11888. rules.required(rule, value, source, errors, options);
  11889. if (value !== void 0) {
  11890. rules.type(rule, value, source, errors, options);
  11891. rules.range(rule, value, source, errors, options);
  11892. }
  11893. }
  11894. callback(errors);
  11895. };
  11896. var floatFn = function floatFn2(rule, value, callback, source, options) {
  11897. var errors = [];
  11898. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  11899. if (validate) {
  11900. if (isEmptyValue(value) && !rule.required) {
  11901. return callback();
  11902. }
  11903. rules.required(rule, value, source, errors, options);
  11904. if (value !== void 0) {
  11905. rules.type(rule, value, source, errors, options);
  11906. rules.range(rule, value, source, errors, options);
  11907. }
  11908. }
  11909. callback(errors);
  11910. };
  11911. var array2 = function array3(rule, value, callback, source, options) {
  11912. var errors = [];
  11913. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  11914. if (validate) {
  11915. if ((value === void 0 || value === null) && !rule.required) {
  11916. return callback();
  11917. }
  11918. rules.required(rule, value, source, errors, options, "array");
  11919. if (value !== void 0 && value !== null) {
  11920. rules.type(rule, value, source, errors, options);
  11921. rules.range(rule, value, source, errors, options);
  11922. }
  11923. }
  11924. callback(errors);
  11925. };
  11926. var object2 = function object3(rule, value, callback, source, options) {
  11927. var errors = [];
  11928. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  11929. if (validate) {
  11930. if (isEmptyValue(value) && !rule.required) {
  11931. return callback();
  11932. }
  11933. rules.required(rule, value, source, errors, options);
  11934. if (value !== void 0) {
  11935. rules.type(rule, value, source, errors, options);
  11936. }
  11937. }
  11938. callback(errors);
  11939. };
  11940. var ENUM = "enum";
  11941. var enumerable2 = function enumerable3(rule, value, callback, source, options) {
  11942. var errors = [];
  11943. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  11944. if (validate) {
  11945. if (isEmptyValue(value) && !rule.required) {
  11946. return callback();
  11947. }
  11948. rules.required(rule, value, source, errors, options);
  11949. if (value !== void 0) {
  11950. rules[ENUM](rule, value, source, errors, options);
  11951. }
  11952. }
  11953. callback(errors);
  11954. };
  11955. var pattern2 = function pattern3(rule, value, callback, source, options) {
  11956. var errors = [];
  11957. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  11958. if (validate) {
  11959. if (isEmptyValue(value, "string") && !rule.required) {
  11960. return callback();
  11961. }
  11962. rules.required(rule, value, source, errors, options);
  11963. if (!isEmptyValue(value, "string")) {
  11964. rules.pattern(rule, value, source, errors, options);
  11965. }
  11966. }
  11967. callback(errors);
  11968. };
  11969. var date2 = function date3(rule, value, callback, source, options) {
  11970. var errors = [];
  11971. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  11972. if (validate) {
  11973. if (isEmptyValue(value, "date") && !rule.required) {
  11974. return callback();
  11975. }
  11976. rules.required(rule, value, source, errors, options);
  11977. if (!isEmptyValue(value, "date")) {
  11978. var dateObject;
  11979. if (value instanceof Date) {
  11980. dateObject = value;
  11981. } else {
  11982. dateObject = new Date(value);
  11983. }
  11984. rules.type(rule, dateObject, source, errors, options);
  11985. if (dateObject) {
  11986. rules.range(rule, dateObject.getTime(), source, errors, options);
  11987. }
  11988. }
  11989. }
  11990. callback(errors);
  11991. };
  11992. var required2 = function required3(rule, value, callback, source, options) {
  11993. var errors = [];
  11994. var type4 = Array.isArray(value) ? "array" : typeof value;
  11995. rules.required(rule, value, source, errors, options, type4);
  11996. callback(errors);
  11997. };
  11998. var type2 = function type3(rule, value, callback, source, options) {
  11999. var ruleType = rule.type;
  12000. var errors = [];
  12001. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  12002. if (validate) {
  12003. if (isEmptyValue(value, ruleType) && !rule.required) {
  12004. return callback();
  12005. }
  12006. rules.required(rule, value, source, errors, options, ruleType);
  12007. if (!isEmptyValue(value, ruleType)) {
  12008. rules.type(rule, value, source, errors, options);
  12009. }
  12010. }
  12011. callback(errors);
  12012. };
  12013. var any = function any2(rule, value, callback, source, options) {
  12014. var errors = [];
  12015. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  12016. if (validate) {
  12017. if (isEmptyValue(value) && !rule.required) {
  12018. return callback();
  12019. }
  12020. rules.required(rule, value, source, errors, options);
  12021. }
  12022. callback(errors);
  12023. };
  12024. var validators = {
  12025. string,
  12026. method: method2,
  12027. number: number2,
  12028. "boolean": _boolean,
  12029. regexp: regexp2,
  12030. integer: integer2,
  12031. "float": floatFn,
  12032. array: array2,
  12033. object: object2,
  12034. "enum": enumerable2,
  12035. pattern: pattern2,
  12036. date: date2,
  12037. url: type2,
  12038. hex: type2,
  12039. email: type2,
  12040. required: required2,
  12041. any
  12042. };
  12043. function newMessages() {
  12044. return {
  12045. "default": "Validation error on field %s",
  12046. required: "%s is required",
  12047. "enum": "%s must be one of %s",
  12048. whitespace: "%s cannot be empty",
  12049. date: {
  12050. format: "%s date %s is invalid for format %s",
  12051. parse: "%s date could not be parsed, %s is invalid ",
  12052. invalid: "%s date %s is invalid"
  12053. },
  12054. types: {
  12055. string: "%s is not a %s",
  12056. method: "%s is not a %s (function)",
  12057. array: "%s is not an %s",
  12058. object: "%s is not an %s",
  12059. number: "%s is not a %s",
  12060. date: "%s is not a %s",
  12061. "boolean": "%s is not a %s",
  12062. integer: "%s is not an %s",
  12063. "float": "%s is not a %s",
  12064. regexp: "%s is not a valid %s",
  12065. email: "%s is not a valid %s",
  12066. url: "%s is not a valid %s",
  12067. hex: "%s is not a valid %s"
  12068. },
  12069. string: {
  12070. len: "%s must be exactly %s characters",
  12071. min: "%s must be at least %s characters",
  12072. max: "%s cannot be longer than %s characters",
  12073. range: "%s must be between %s and %s characters"
  12074. },
  12075. number: {
  12076. len: "%s must equal %s",
  12077. min: "%s cannot be less than %s",
  12078. max: "%s cannot be greater than %s",
  12079. range: "%s must be between %s and %s"
  12080. },
  12081. array: {
  12082. len: "%s must be exactly %s in length",
  12083. min: "%s cannot be less than %s in length",
  12084. max: "%s cannot be greater than %s in length",
  12085. range: "%s must be between %s and %s in length"
  12086. },
  12087. pattern: {
  12088. mismatch: "%s value %s does not match pattern %s"
  12089. },
  12090. clone: function clone() {
  12091. var cloned = JSON.parse(JSON.stringify(this));
  12092. cloned.clone = this.clone;
  12093. return cloned;
  12094. }
  12095. };
  12096. }
  12097. var messages = newMessages();
  12098. var Schema = /* @__PURE__ */ function() {
  12099. function Schema2(descriptor) {
  12100. this.rules = null;
  12101. this._messages = messages;
  12102. this.define(descriptor);
  12103. }
  12104. var _proto = Schema2.prototype;
  12105. _proto.define = function define(rules2) {
  12106. var _this = this;
  12107. if (!rules2) {
  12108. throw new Error("Cannot configure a schema with no rules");
  12109. }
  12110. if (typeof rules2 !== "object" || Array.isArray(rules2)) {
  12111. throw new Error("Rules must be an object");
  12112. }
  12113. this.rules = {};
  12114. Object.keys(rules2).forEach(function(name) {
  12115. var item = rules2[name];
  12116. _this.rules[name] = Array.isArray(item) ? item : [item];
  12117. });
  12118. };
  12119. _proto.messages = function messages2(_messages) {
  12120. if (_messages) {
  12121. this._messages = deepMerge(newMessages(), _messages);
  12122. }
  12123. return this._messages;
  12124. };
  12125. _proto.validate = function validate(source_, o, oc) {
  12126. var _this2 = this;
  12127. if (o === void 0) {
  12128. o = {};
  12129. }
  12130. if (oc === void 0) {
  12131. oc = function oc2() {
  12132. };
  12133. }
  12134. var source = source_;
  12135. var options = o;
  12136. var callback = oc;
  12137. if (typeof options === "function") {
  12138. callback = options;
  12139. options = {};
  12140. }
  12141. if (!this.rules || Object.keys(this.rules).length === 0) {
  12142. if (callback) {
  12143. callback(null, source);
  12144. }
  12145. return Promise.resolve(source);
  12146. }
  12147. function complete(results) {
  12148. var errors = [];
  12149. var fields = {};
  12150. function add(e) {
  12151. if (Array.isArray(e)) {
  12152. var _errors;
  12153. errors = (_errors = errors).concat.apply(_errors, e);
  12154. } else {
  12155. errors.push(e);
  12156. }
  12157. }
  12158. for (var i = 0; i < results.length; i++) {
  12159. add(results[i]);
  12160. }
  12161. if (!errors.length) {
  12162. callback(null, source);
  12163. } else {
  12164. fields = convertFieldsError(errors);
  12165. callback(errors, fields);
  12166. }
  12167. }
  12168. if (options.messages) {
  12169. var messages$1 = this.messages();
  12170. if (messages$1 === messages) {
  12171. messages$1 = newMessages();
  12172. }
  12173. deepMerge(messages$1, options.messages);
  12174. options.messages = messages$1;
  12175. } else {
  12176. options.messages = this.messages();
  12177. }
  12178. var series = {};
  12179. var keys = options.keys || Object.keys(this.rules);
  12180. keys.forEach(function(z) {
  12181. var arr = _this2.rules[z];
  12182. var value = source[z];
  12183. arr.forEach(function(r) {
  12184. var rule = r;
  12185. if (typeof rule.transform === "function") {
  12186. if (source === source_) {
  12187. source = _extends({}, source);
  12188. }
  12189. value = source[z] = rule.transform(value);
  12190. }
  12191. if (typeof rule === "function") {
  12192. rule = {
  12193. validator: rule
  12194. };
  12195. } else {
  12196. rule = _extends({}, rule);
  12197. }
  12198. rule.validator = _this2.getValidationMethod(rule);
  12199. if (!rule.validator) {
  12200. return;
  12201. }
  12202. rule.field = z;
  12203. rule.fullField = rule.fullField || z;
  12204. rule.type = _this2.getType(rule);
  12205. series[z] = series[z] || [];
  12206. series[z].push({
  12207. rule,
  12208. value,
  12209. source,
  12210. field: z
  12211. });
  12212. });
  12213. });
  12214. var errorFields = {};
  12215. return asyncMap(series, options, function(data, doIt) {
  12216. var rule = data.rule;
  12217. var deep = (rule.type === "object" || rule.type === "array") && (typeof rule.fields === "object" || typeof rule.defaultField === "object");
  12218. deep = deep && (rule.required || !rule.required && data.value);
  12219. rule.field = data.field;
  12220. function addFullField(key, schema) {
  12221. return _extends({}, schema, {
  12222. fullField: rule.fullField + "." + key,
  12223. fullFields: rule.fullFields ? [].concat(rule.fullFields, [key]) : [key]
  12224. });
  12225. }
  12226. function cb(e) {
  12227. if (e === void 0) {
  12228. e = [];
  12229. }
  12230. var errorList = Array.isArray(e) ? e : [e];
  12231. if (!options.suppressWarning && errorList.length) {
  12232. Schema2.warning("async-validator:", errorList);
  12233. }
  12234. if (errorList.length && rule.message !== void 0) {
  12235. errorList = [].concat(rule.message);
  12236. }
  12237. var filledErrors = errorList.map(complementError(rule, source));
  12238. if (options.first && filledErrors.length) {
  12239. errorFields[rule.field] = 1;
  12240. return doIt(filledErrors);
  12241. }
  12242. if (!deep) {
  12243. doIt(filledErrors);
  12244. } else {
  12245. if (rule.required && !data.value) {
  12246. if (rule.message !== void 0) {
  12247. filledErrors = [].concat(rule.message).map(complementError(rule, source));
  12248. } else if (options.error) {
  12249. filledErrors = [options.error(rule, format(options.messages.required, rule.field))];
  12250. }
  12251. return doIt(filledErrors);
  12252. }
  12253. var fieldsSchema = {};
  12254. if (rule.defaultField) {
  12255. Object.keys(data.value).map(function(key) {
  12256. fieldsSchema[key] = rule.defaultField;
  12257. });
  12258. }
  12259. fieldsSchema = _extends({}, fieldsSchema, data.rule.fields);
  12260. var paredFieldsSchema = {};
  12261. Object.keys(fieldsSchema).forEach(function(field) {
  12262. var fieldSchema = fieldsSchema[field];
  12263. var fieldSchemaList = Array.isArray(fieldSchema) ? fieldSchema : [fieldSchema];
  12264. paredFieldsSchema[field] = fieldSchemaList.map(addFullField.bind(null, field));
  12265. });
  12266. var schema = new Schema2(paredFieldsSchema);
  12267. schema.messages(options.messages);
  12268. if (data.rule.options) {
  12269. data.rule.options.messages = options.messages;
  12270. data.rule.options.error = options.error;
  12271. }
  12272. schema.validate(data.value, data.rule.options || options, function(errs) {
  12273. var finalErrors = [];
  12274. if (filledErrors && filledErrors.length) {
  12275. finalErrors.push.apply(finalErrors, filledErrors);
  12276. }
  12277. if (errs && errs.length) {
  12278. finalErrors.push.apply(finalErrors, errs);
  12279. }
  12280. doIt(finalErrors.length ? finalErrors : null);
  12281. });
  12282. }
  12283. }
  12284. var res;
  12285. if (rule.asyncValidator) {
  12286. res = rule.asyncValidator(rule, data.value, cb, data.source, options);
  12287. } else if (rule.validator) {
  12288. try {
  12289. res = rule.validator(rule, data.value, cb, data.source, options);
  12290. } catch (error) {
  12291. console.error == null ? void 0 : console.error(error);
  12292. if (!options.suppressValidatorError) {
  12293. setTimeout(function() {
  12294. throw error;
  12295. }, 0);
  12296. }
  12297. cb(error.message);
  12298. }
  12299. if (res === true) {
  12300. cb();
  12301. } else if (res === false) {
  12302. cb(typeof rule.message === "function" ? rule.message(rule.fullField || rule.field) : rule.message || (rule.fullField || rule.field) + " fails");
  12303. } else if (res instanceof Array) {
  12304. cb(res);
  12305. } else if (res instanceof Error) {
  12306. cb(res.message);
  12307. }
  12308. }
  12309. if (res && res.then) {
  12310. res.then(function() {
  12311. return cb();
  12312. }, function(e) {
  12313. return cb(e);
  12314. });
  12315. }
  12316. }, function(results) {
  12317. complete(results);
  12318. }, source);
  12319. };
  12320. _proto.getType = function getType(rule) {
  12321. if (rule.type === void 0 && rule.pattern instanceof RegExp) {
  12322. rule.type = "pattern";
  12323. }
  12324. if (typeof rule.validator !== "function" && rule.type && !validators.hasOwnProperty(rule.type)) {
  12325. throw new Error(format("Unknown rule type %s", rule.type));
  12326. }
  12327. return rule.type || "string";
  12328. };
  12329. _proto.getValidationMethod = function getValidationMethod(rule) {
  12330. if (typeof rule.validator === "function") {
  12331. return rule.validator;
  12332. }
  12333. var keys = Object.keys(rule);
  12334. var messageIndex = keys.indexOf("message");
  12335. if (messageIndex !== -1) {
  12336. keys.splice(messageIndex, 1);
  12337. }
  12338. if (keys.length === 1 && keys[0] === "required") {
  12339. return validators.required;
  12340. }
  12341. return validators[this.getType(rule)] || void 0;
  12342. };
  12343. return Schema2;
  12344. }();
  12345. Schema.register = function register(type4, validator) {
  12346. if (typeof validator !== "function") {
  12347. throw new Error("Cannot register a validator by type, validator is not a function");
  12348. }
  12349. validators[type4] = validator;
  12350. };
  12351. Schema.warning = warning;
  12352. Schema.messages = messages;
  12353. Schema.validators = validators;
  12354. const formItemValidateStates = [
  12355. "",
  12356. "error",
  12357. "validating",
  12358. "success"
  12359. ];
  12360. const formItemProps = buildProps({
  12361. label: String,
  12362. labelWidth: {
  12363. type: [String, Number],
  12364. default: ""
  12365. },
  12366. labelPosition: {
  12367. type: String,
  12368. values: ["left", "right", "top", ""],
  12369. default: ""
  12370. },
  12371. prop: {
  12372. type: definePropType([String, Array])
  12373. },
  12374. required: {
  12375. type: Boolean,
  12376. default: void 0
  12377. },
  12378. rules: {
  12379. type: definePropType([Object, Array])
  12380. },
  12381. error: String,
  12382. validateStatus: {
  12383. type: String,
  12384. values: formItemValidateStates
  12385. },
  12386. for: String,
  12387. inlineMessage: {
  12388. type: [String, Boolean],
  12389. default: ""
  12390. },
  12391. showMessage: {
  12392. type: Boolean,
  12393. default: true
  12394. },
  12395. size: {
  12396. type: String,
  12397. values: componentSizes
  12398. }
  12399. });
  12400. const COMPONENT_NAME$n = "ElLabelWrap";
  12401. var FormLabelWrap = defineComponent({
  12402. name: COMPONENT_NAME$n,
  12403. props: {
  12404. isAutoWidth: Boolean,
  12405. updateAll: Boolean
  12406. },
  12407. setup(props, {
  12408. slots
  12409. }) {
  12410. const formContext = inject(formContextKey, void 0);
  12411. const formItemContext = inject(formItemContextKey);
  12412. if (!formItemContext)
  12413. throwError(COMPONENT_NAME$n, "usage: <el-form-item><label-wrap /></el-form-item>");
  12414. const ns = useNamespace("form");
  12415. const el = ref();
  12416. const computedWidth = ref(0);
  12417. const getLabelWidth = () => {
  12418. var _a;
  12419. if ((_a = el.value) == null ? void 0 : _a.firstElementChild) {
  12420. const width = window.getComputedStyle(el.value.firstElementChild).width;
  12421. return Math.ceil(Number.parseFloat(width));
  12422. } else {
  12423. return 0;
  12424. }
  12425. };
  12426. const updateLabelWidth = (action = "update") => {
  12427. nextTick(() => {
  12428. if (slots.default && props.isAutoWidth) {
  12429. if (action === "update") {
  12430. computedWidth.value = getLabelWidth();
  12431. } else if (action === "remove") {
  12432. formContext == null ? void 0 : formContext.deregisterLabelWidth(computedWidth.value);
  12433. }
  12434. }
  12435. });
  12436. };
  12437. const updateLabelWidthFn = () => updateLabelWidth("update");
  12438. onMounted(() => {
  12439. updateLabelWidthFn();
  12440. });
  12441. onBeforeUnmount(() => {
  12442. updateLabelWidth("remove");
  12443. });
  12444. onUpdated(() => updateLabelWidthFn());
  12445. watch(computedWidth, (val, oldVal) => {
  12446. if (props.updateAll) {
  12447. formContext == null ? void 0 : formContext.registerLabelWidth(val, oldVal);
  12448. }
  12449. });
  12450. useResizeObserver(computed(() => {
  12451. var _a, _b;
  12452. return (_b = (_a = el.value) == null ? void 0 : _a.firstElementChild) != null ? _b : null;
  12453. }), updateLabelWidthFn);
  12454. return () => {
  12455. var _a, _b;
  12456. if (!slots)
  12457. return null;
  12458. const {
  12459. isAutoWidth
  12460. } = props;
  12461. if (isAutoWidth) {
  12462. const autoLabelWidth = formContext == null ? void 0 : formContext.autoLabelWidth;
  12463. const hasLabel = formItemContext == null ? void 0 : formItemContext.hasLabel;
  12464. const style = {};
  12465. if (hasLabel && autoLabelWidth && autoLabelWidth !== "auto") {
  12466. const marginWidth = Math.max(0, Number.parseInt(autoLabelWidth, 10) - computedWidth.value);
  12467. const labelPosition = formItemContext.labelPosition || formContext.labelPosition;
  12468. const marginPosition = labelPosition === "left" ? "marginRight" : "marginLeft";
  12469. if (marginWidth) {
  12470. style[marginPosition] = `${marginWidth}px`;
  12471. }
  12472. }
  12473. return createVNode("div", {
  12474. "ref": el,
  12475. "class": [ns.be("item", "label-wrap")],
  12476. "style": style
  12477. }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
  12478. } else {
  12479. return createVNode(Fragment, {
  12480. "ref": el
  12481. }, [(_b = slots.default) == null ? void 0 : _b.call(slots)]);
  12482. }
  12483. };
  12484. }
  12485. });
  12486. const __default__$1Q = defineComponent({
  12487. name: "ElFormItem"
  12488. });
  12489. const _sfc_main$2t = /* @__PURE__ */ defineComponent({
  12490. ...__default__$1Q,
  12491. props: formItemProps,
  12492. setup(__props, { expose }) {
  12493. const props = __props;
  12494. const slots = useSlots();
  12495. const formContext = inject(formContextKey, void 0);
  12496. const parentFormItemContext = inject(formItemContextKey, void 0);
  12497. const _size = useFormSize(void 0, { formItem: false });
  12498. const ns = useNamespace("form-item");
  12499. const labelId = useId().value;
  12500. const inputIds = ref([]);
  12501. const validateState = ref("");
  12502. const validateStateDebounced = refDebounced(validateState, 100);
  12503. const validateMessage = ref("");
  12504. const formItemRef = ref();
  12505. let initialValue = void 0;
  12506. let isResettingField = false;
  12507. const labelPosition = computed(() => props.labelPosition || (formContext == null ? void 0 : formContext.labelPosition));
  12508. const labelStyle = computed(() => {
  12509. if (labelPosition.value === "top") {
  12510. return {};
  12511. }
  12512. const labelWidth = addUnit(props.labelWidth || (formContext == null ? void 0 : formContext.labelWidth) || "");
  12513. if (labelWidth)
  12514. return { width: labelWidth };
  12515. return {};
  12516. });
  12517. const contentStyle = computed(() => {
  12518. if (labelPosition.value === "top" || (formContext == null ? void 0 : formContext.inline)) {
  12519. return {};
  12520. }
  12521. if (!props.label && !props.labelWidth && isNested) {
  12522. return {};
  12523. }
  12524. const labelWidth = addUnit(props.labelWidth || (formContext == null ? void 0 : formContext.labelWidth) || "");
  12525. if (!props.label && !slots.label) {
  12526. return { marginLeft: labelWidth };
  12527. }
  12528. return {};
  12529. });
  12530. const formItemClasses = computed(() => [
  12531. ns.b(),
  12532. ns.m(_size.value),
  12533. ns.is("error", validateState.value === "error"),
  12534. ns.is("validating", validateState.value === "validating"),
  12535. ns.is("success", validateState.value === "success"),
  12536. ns.is("required", isRequired.value || props.required),
  12537. ns.is("no-asterisk", formContext == null ? void 0 : formContext.hideRequiredAsterisk),
  12538. (formContext == null ? void 0 : formContext.requireAsteriskPosition) === "right" ? "asterisk-right" : "asterisk-left",
  12539. {
  12540. [ns.m("feedback")]: formContext == null ? void 0 : formContext.statusIcon,
  12541. [ns.m(`label-${labelPosition.value}`)]: labelPosition.value
  12542. }
  12543. ]);
  12544. const _inlineMessage = computed(() => isBoolean(props.inlineMessage) ? props.inlineMessage : (formContext == null ? void 0 : formContext.inlineMessage) || false);
  12545. const validateClasses = computed(() => [
  12546. ns.e("error"),
  12547. { [ns.em("error", "inline")]: _inlineMessage.value }
  12548. ]);
  12549. const propString = computed(() => {
  12550. if (!props.prop)
  12551. return "";
  12552. return isString$1(props.prop) ? props.prop : props.prop.join(".");
  12553. });
  12554. const hasLabel = computed(() => {
  12555. return !!(props.label || slots.label);
  12556. });
  12557. const labelFor = computed(() => {
  12558. return props.for || (inputIds.value.length === 1 ? inputIds.value[0] : void 0);
  12559. });
  12560. const isGroup = computed(() => {
  12561. return !labelFor.value && hasLabel.value;
  12562. });
  12563. const isNested = !!parentFormItemContext;
  12564. const fieldValue = computed(() => {
  12565. const model = formContext == null ? void 0 : formContext.model;
  12566. if (!model || !props.prop) {
  12567. return;
  12568. }
  12569. return getProp(model, props.prop).value;
  12570. });
  12571. const normalizedRules = computed(() => {
  12572. const { required } = props;
  12573. const rules = [];
  12574. if (props.rules) {
  12575. rules.push(...castArray$1(props.rules));
  12576. }
  12577. const formRules = formContext == null ? void 0 : formContext.rules;
  12578. if (formRules && props.prop) {
  12579. const _rules = getProp(formRules, props.prop).value;
  12580. if (_rules) {
  12581. rules.push(...castArray$1(_rules));
  12582. }
  12583. }
  12584. if (required !== void 0) {
  12585. const requiredRules = rules.map((rule, i) => [rule, i]).filter(([rule]) => Object.keys(rule).includes("required"));
  12586. if (requiredRules.length > 0) {
  12587. for (const [rule, i] of requiredRules) {
  12588. if (rule.required === required)
  12589. continue;
  12590. rules[i] = { ...rule, required };
  12591. }
  12592. } else {
  12593. rules.push({ required });
  12594. }
  12595. }
  12596. return rules;
  12597. });
  12598. const validateEnabled = computed(() => normalizedRules.value.length > 0);
  12599. const getFilteredRule = (trigger) => {
  12600. const rules = normalizedRules.value;
  12601. return rules.filter((rule) => {
  12602. if (!rule.trigger || !trigger)
  12603. return true;
  12604. if (isArray$1(rule.trigger)) {
  12605. return rule.trigger.includes(trigger);
  12606. } else {
  12607. return rule.trigger === trigger;
  12608. }
  12609. }).map(({ trigger: trigger2, ...rule }) => rule);
  12610. };
  12611. const isRequired = computed(() => normalizedRules.value.some((rule) => rule.required));
  12612. const shouldShowError = computed(() => {
  12613. var _a;
  12614. return validateStateDebounced.value === "error" && props.showMessage && ((_a = formContext == null ? void 0 : formContext.showMessage) != null ? _a : true);
  12615. });
  12616. const currentLabel = computed(() => `${props.label || ""}${(formContext == null ? void 0 : formContext.labelSuffix) || ""}`);
  12617. const setValidationState = (state) => {
  12618. validateState.value = state;
  12619. };
  12620. const onValidationFailed = (error) => {
  12621. var _a, _b;
  12622. const { errors, fields } = error;
  12623. if (!errors || !fields) {
  12624. console.error(error);
  12625. }
  12626. setValidationState("error");
  12627. validateMessage.value = errors ? (_b = (_a = errors == null ? void 0 : errors[0]) == null ? void 0 : _a.message) != null ? _b : `${props.prop} is required` : "";
  12628. formContext == null ? void 0 : formContext.emit("validate", props.prop, false, validateMessage.value);
  12629. };
  12630. const onValidationSucceeded = () => {
  12631. setValidationState("success");
  12632. formContext == null ? void 0 : formContext.emit("validate", props.prop, true, "");
  12633. };
  12634. const doValidate = async (rules) => {
  12635. const modelName = propString.value;
  12636. const validator = new Schema({
  12637. [modelName]: rules
  12638. });
  12639. return validator.validate({ [modelName]: fieldValue.value }, { firstFields: true }).then(() => {
  12640. onValidationSucceeded();
  12641. return true;
  12642. }).catch((err) => {
  12643. onValidationFailed(err);
  12644. return Promise.reject(err);
  12645. });
  12646. };
  12647. const validate = async (trigger, callback) => {
  12648. if (isResettingField || !props.prop) {
  12649. return false;
  12650. }
  12651. const hasCallback = isFunction$1(callback);
  12652. if (!validateEnabled.value) {
  12653. callback == null ? void 0 : callback(false);
  12654. return false;
  12655. }
  12656. const rules = getFilteredRule(trigger);
  12657. if (rules.length === 0) {
  12658. callback == null ? void 0 : callback(true);
  12659. return true;
  12660. }
  12661. setValidationState("validating");
  12662. return doValidate(rules).then(() => {
  12663. callback == null ? void 0 : callback(true);
  12664. return true;
  12665. }).catch((err) => {
  12666. const { fields } = err;
  12667. callback == null ? void 0 : callback(false, fields);
  12668. return hasCallback ? false : Promise.reject(fields);
  12669. });
  12670. };
  12671. const clearValidate = () => {
  12672. setValidationState("");
  12673. validateMessage.value = "";
  12674. isResettingField = false;
  12675. };
  12676. const resetField = async () => {
  12677. const model = formContext == null ? void 0 : formContext.model;
  12678. if (!model || !props.prop)
  12679. return;
  12680. const computedValue = getProp(model, props.prop);
  12681. isResettingField = true;
  12682. computedValue.value = clone(initialValue);
  12683. await nextTick();
  12684. clearValidate();
  12685. isResettingField = false;
  12686. };
  12687. const addInputId = (id) => {
  12688. if (!inputIds.value.includes(id)) {
  12689. inputIds.value.push(id);
  12690. }
  12691. };
  12692. const removeInputId = (id) => {
  12693. inputIds.value = inputIds.value.filter((listId) => listId !== id);
  12694. };
  12695. watch(() => props.error, (val) => {
  12696. validateMessage.value = val || "";
  12697. setValidationState(val ? "error" : "");
  12698. }, { immediate: true });
  12699. watch(() => props.validateStatus, (val) => setValidationState(val || ""));
  12700. const context = reactive({
  12701. ...toRefs(props),
  12702. $el: formItemRef,
  12703. size: _size,
  12704. validateState,
  12705. labelId,
  12706. inputIds,
  12707. isGroup,
  12708. hasLabel,
  12709. fieldValue,
  12710. addInputId,
  12711. removeInputId,
  12712. resetField,
  12713. clearValidate,
  12714. validate
  12715. });
  12716. provide(formItemContextKey, context);
  12717. onMounted(() => {
  12718. if (props.prop) {
  12719. formContext == null ? void 0 : formContext.addField(context);
  12720. initialValue = clone(fieldValue.value);
  12721. }
  12722. });
  12723. onBeforeUnmount(() => {
  12724. formContext == null ? void 0 : formContext.removeField(context);
  12725. });
  12726. expose({
  12727. size: _size,
  12728. validateMessage,
  12729. validateState,
  12730. validate,
  12731. clearValidate,
  12732. resetField
  12733. });
  12734. return (_ctx, _cache) => {
  12735. var _a;
  12736. return openBlock(), createElementBlock("div", {
  12737. ref_key: "formItemRef",
  12738. ref: formItemRef,
  12739. class: normalizeClass(unref(formItemClasses)),
  12740. role: unref(isGroup) ? "group" : void 0,
  12741. "aria-labelledby": unref(isGroup) ? unref(labelId) : void 0
  12742. }, [
  12743. createVNode(unref(FormLabelWrap), {
  12744. "is-auto-width": unref(labelStyle).width === "auto",
  12745. "update-all": ((_a = unref(formContext)) == null ? void 0 : _a.labelWidth) === "auto"
  12746. }, {
  12747. default: withCtx(() => [
  12748. unref(hasLabel) ? (openBlock(), createBlock(resolveDynamicComponent(unref(labelFor) ? "label" : "div"), {
  12749. key: 0,
  12750. id: unref(labelId),
  12751. for: unref(labelFor),
  12752. class: normalizeClass(unref(ns).e("label")),
  12753. style: normalizeStyle(unref(labelStyle))
  12754. }, {
  12755. default: withCtx(() => [
  12756. renderSlot(_ctx.$slots, "label", { label: unref(currentLabel) }, () => [
  12757. createTextVNode(toDisplayString(unref(currentLabel)), 1)
  12758. ])
  12759. ]),
  12760. _: 3
  12761. }, 8, ["id", "for", "class", "style"])) : createCommentVNode("v-if", true)
  12762. ]),
  12763. _: 3
  12764. }, 8, ["is-auto-width", "update-all"]),
  12765. createElementVNode("div", {
  12766. class: normalizeClass(unref(ns).e("content")),
  12767. style: normalizeStyle(unref(contentStyle))
  12768. }, [
  12769. renderSlot(_ctx.$slots, "default"),
  12770. createVNode(TransitionGroup, {
  12771. name: `${unref(ns).namespace.value}-zoom-in-top`
  12772. }, {
  12773. default: withCtx(() => [
  12774. unref(shouldShowError) ? renderSlot(_ctx.$slots, "error", {
  12775. key: 0,
  12776. error: validateMessage.value
  12777. }, () => [
  12778. createElementVNode("div", {
  12779. class: normalizeClass(unref(validateClasses))
  12780. }, toDisplayString(validateMessage.value), 3)
  12781. ]) : createCommentVNode("v-if", true)
  12782. ]),
  12783. _: 3
  12784. }, 8, ["name"])
  12785. ], 6)
  12786. ], 10, ["role", "aria-labelledby"]);
  12787. };
  12788. }
  12789. });
  12790. var FormItem = /* @__PURE__ */ _export_sfc(_sfc_main$2t, [["__file", "form-item.vue"]]);
  12791. const ElForm = withInstall(Form, {
  12792. FormItem
  12793. });
  12794. const ElFormItem = withNoopInstall(FormItem);
  12795. let hiddenTextarea = void 0;
  12796. const HIDDEN_STYLE = {
  12797. height: "0",
  12798. visibility: "hidden",
  12799. overflow: isFirefox() ? "" : "hidden",
  12800. position: "absolute",
  12801. "z-index": "-1000",
  12802. top: "0",
  12803. right: "0"
  12804. };
  12805. const CONTEXT_STYLE = [
  12806. "letter-spacing",
  12807. "line-height",
  12808. "padding-top",
  12809. "padding-bottom",
  12810. "font-family",
  12811. "font-weight",
  12812. "font-size",
  12813. "text-rendering",
  12814. "text-transform",
  12815. "width",
  12816. "text-indent",
  12817. "padding-left",
  12818. "padding-right",
  12819. "border-width",
  12820. "box-sizing"
  12821. ];
  12822. function calculateNodeStyling(targetElement) {
  12823. const style = window.getComputedStyle(targetElement);
  12824. const boxSizing = style.getPropertyValue("box-sizing");
  12825. const paddingSize = Number.parseFloat(style.getPropertyValue("padding-bottom")) + Number.parseFloat(style.getPropertyValue("padding-top"));
  12826. const borderSize = Number.parseFloat(style.getPropertyValue("border-bottom-width")) + Number.parseFloat(style.getPropertyValue("border-top-width"));
  12827. const contextStyle = CONTEXT_STYLE.map((name) => [
  12828. name,
  12829. style.getPropertyValue(name)
  12830. ]);
  12831. return { contextStyle, paddingSize, borderSize, boxSizing };
  12832. }
  12833. function calcTextareaHeight(targetElement, minRows = 1, maxRows) {
  12834. var _a;
  12835. if (!hiddenTextarea) {
  12836. hiddenTextarea = document.createElement("textarea");
  12837. document.body.appendChild(hiddenTextarea);
  12838. }
  12839. const { paddingSize, borderSize, boxSizing, contextStyle } = calculateNodeStyling(targetElement);
  12840. contextStyle.forEach(([key, value]) => hiddenTextarea == null ? void 0 : hiddenTextarea.style.setProperty(key, value));
  12841. Object.entries(HIDDEN_STYLE).forEach(([key, value]) => hiddenTextarea == null ? void 0 : hiddenTextarea.style.setProperty(key, value, "important"));
  12842. hiddenTextarea.value = targetElement.value || targetElement.placeholder || "";
  12843. let height = hiddenTextarea.scrollHeight;
  12844. const result = {};
  12845. if (boxSizing === "border-box") {
  12846. height = height + borderSize;
  12847. } else if (boxSizing === "content-box") {
  12848. height = height - paddingSize;
  12849. }
  12850. hiddenTextarea.value = "";
  12851. const singleRowHeight = hiddenTextarea.scrollHeight - paddingSize;
  12852. if (isNumber(minRows)) {
  12853. let minHeight = singleRowHeight * minRows;
  12854. if (boxSizing === "border-box") {
  12855. minHeight = minHeight + paddingSize + borderSize;
  12856. }
  12857. height = Math.max(minHeight, height);
  12858. result.minHeight = `${minHeight}px`;
  12859. }
  12860. if (isNumber(maxRows)) {
  12861. let maxHeight = singleRowHeight * maxRows;
  12862. if (boxSizing === "border-box") {
  12863. maxHeight = maxHeight + paddingSize + borderSize;
  12864. }
  12865. height = Math.min(maxHeight, height);
  12866. }
  12867. result.height = `${height}px`;
  12868. (_a = hiddenTextarea.parentNode) == null ? void 0 : _a.removeChild(hiddenTextarea);
  12869. hiddenTextarea = void 0;
  12870. return result;
  12871. }
  12872. const inputProps = buildProps({
  12873. id: {
  12874. type: String,
  12875. default: void 0
  12876. },
  12877. size: useSizeProp,
  12878. disabled: Boolean,
  12879. modelValue: {
  12880. type: definePropType([
  12881. String,
  12882. Number,
  12883. Object
  12884. ]),
  12885. default: ""
  12886. },
  12887. maxlength: {
  12888. type: [String, Number]
  12889. },
  12890. minlength: {
  12891. type: [String, Number]
  12892. },
  12893. type: {
  12894. type: String,
  12895. default: "text"
  12896. },
  12897. resize: {
  12898. type: String,
  12899. values: ["none", "both", "horizontal", "vertical"]
  12900. },
  12901. autosize: {
  12902. type: definePropType([Boolean, Object]),
  12903. default: false
  12904. },
  12905. autocomplete: {
  12906. type: String,
  12907. default: "off"
  12908. },
  12909. formatter: {
  12910. type: Function
  12911. },
  12912. parser: {
  12913. type: Function
  12914. },
  12915. placeholder: {
  12916. type: String
  12917. },
  12918. form: {
  12919. type: String
  12920. },
  12921. readonly: Boolean,
  12922. clearable: Boolean,
  12923. showPassword: Boolean,
  12924. showWordLimit: Boolean,
  12925. suffixIcon: {
  12926. type: iconPropType
  12927. },
  12928. prefixIcon: {
  12929. type: iconPropType
  12930. },
  12931. containerRole: {
  12932. type: String,
  12933. default: void 0
  12934. },
  12935. tabindex: {
  12936. type: [String, Number],
  12937. default: 0
  12938. },
  12939. validateEvent: {
  12940. type: Boolean,
  12941. default: true
  12942. },
  12943. inputStyle: {
  12944. type: definePropType([Object, Array, String]),
  12945. default: () => mutable({})
  12946. },
  12947. autofocus: Boolean,
  12948. rows: {
  12949. type: Number,
  12950. default: 2
  12951. },
  12952. ...useAriaProps(["ariaLabel"])
  12953. });
  12954. const inputEmits = {
  12955. [UPDATE_MODEL_EVENT]: (value) => isString$1(value),
  12956. input: (value) => isString$1(value),
  12957. change: (value) => isString$1(value),
  12958. focus: (evt) => evt instanceof FocusEvent,
  12959. blur: (evt) => evt instanceof FocusEvent,
  12960. clear: () => true,
  12961. mouseleave: (evt) => evt instanceof MouseEvent,
  12962. mouseenter: (evt) => evt instanceof MouseEvent,
  12963. keydown: (evt) => evt instanceof Event,
  12964. compositionstart: (evt) => evt instanceof CompositionEvent,
  12965. compositionupdate: (evt) => evt instanceof CompositionEvent,
  12966. compositionend: (evt) => evt instanceof CompositionEvent
  12967. };
  12968. const COMPONENT_NAME$m = "ElInput";
  12969. const __default__$1P = defineComponent({
  12970. name: COMPONENT_NAME$m,
  12971. inheritAttrs: false
  12972. });
  12973. const _sfc_main$2s = /* @__PURE__ */ defineComponent({
  12974. ...__default__$1P,
  12975. props: inputProps,
  12976. emits: inputEmits,
  12977. setup(__props, { expose, emit }) {
  12978. const props = __props;
  12979. const rawAttrs = useAttrs$1();
  12980. const attrs = useAttrs();
  12981. const slots = useSlots();
  12982. const containerKls = computed(() => [
  12983. props.type === "textarea" ? nsTextarea.b() : nsInput.b(),
  12984. nsInput.m(inputSize.value),
  12985. nsInput.is("disabled", inputDisabled.value),
  12986. nsInput.is("exceed", inputExceed.value),
  12987. {
  12988. [nsInput.b("group")]: slots.prepend || slots.append,
  12989. [nsInput.m("prefix")]: slots.prefix || props.prefixIcon,
  12990. [nsInput.m("suffix")]: slots.suffix || props.suffixIcon || props.clearable || props.showPassword,
  12991. [nsInput.bm("suffix", "password-clear")]: showClear.value && showPwdVisible.value,
  12992. [nsInput.b("hidden")]: props.type === "hidden"
  12993. },
  12994. rawAttrs.class
  12995. ]);
  12996. const wrapperKls = computed(() => [
  12997. nsInput.e("wrapper"),
  12998. nsInput.is("focus", isFocused.value)
  12999. ]);
  13000. const { form: elForm, formItem: elFormItem } = useFormItem();
  13001. const { inputId } = useFormItemInputId(props, {
  13002. formItemContext: elFormItem
  13003. });
  13004. const inputSize = useFormSize();
  13005. const inputDisabled = useFormDisabled();
  13006. const nsInput = useNamespace("input");
  13007. const nsTextarea = useNamespace("textarea");
  13008. const input = shallowRef();
  13009. const textarea = shallowRef();
  13010. const hovering = ref(false);
  13011. const passwordVisible = ref(false);
  13012. const countStyle = ref();
  13013. const textareaCalcStyle = shallowRef(props.inputStyle);
  13014. const _ref = computed(() => input.value || textarea.value);
  13015. const { wrapperRef, isFocused, handleFocus, handleBlur } = useFocusController(_ref, {
  13016. beforeFocus() {
  13017. return inputDisabled.value;
  13018. },
  13019. afterBlur() {
  13020. var _a;
  13021. if (props.validateEvent) {
  13022. (_a = elFormItem == null ? void 0 : elFormItem.validate) == null ? void 0 : _a.call(elFormItem, "blur").catch((err) => debugWarn());
  13023. }
  13024. }
  13025. });
  13026. const needStatusIcon = computed(() => {
  13027. var _a;
  13028. return (_a = elForm == null ? void 0 : elForm.statusIcon) != null ? _a : false;
  13029. });
  13030. const validateState = computed(() => (elFormItem == null ? void 0 : elFormItem.validateState) || "");
  13031. const validateIcon = computed(() => validateState.value && ValidateComponentsMap[validateState.value]);
  13032. const passwordIcon = computed(() => passwordVisible.value ? view_default : hide_default);
  13033. const containerStyle = computed(() => [
  13034. rawAttrs.style
  13035. ]);
  13036. const textareaStyle = computed(() => [
  13037. props.inputStyle,
  13038. textareaCalcStyle.value,
  13039. { resize: props.resize }
  13040. ]);
  13041. const nativeInputValue = computed(() => isNil(props.modelValue) ? "" : String(props.modelValue));
  13042. const showClear = computed(() => props.clearable && !inputDisabled.value && !props.readonly && !!nativeInputValue.value && (isFocused.value || hovering.value));
  13043. const showPwdVisible = computed(() => props.showPassword && !inputDisabled.value && !!nativeInputValue.value && (!!nativeInputValue.value || isFocused.value));
  13044. const isWordLimitVisible = computed(() => props.showWordLimit && !!props.maxlength && (props.type === "text" || props.type === "textarea") && !inputDisabled.value && !props.readonly && !props.showPassword);
  13045. const textLength = computed(() => nativeInputValue.value.length);
  13046. const inputExceed = computed(() => !!isWordLimitVisible.value && textLength.value > Number(props.maxlength));
  13047. const suffixVisible = computed(() => !!slots.suffix || !!props.suffixIcon || showClear.value || props.showPassword || isWordLimitVisible.value || !!validateState.value && needStatusIcon.value);
  13048. const [recordCursor, setCursor] = useCursor(input);
  13049. useResizeObserver(textarea, (entries) => {
  13050. onceInitSizeTextarea();
  13051. if (!isWordLimitVisible.value || props.resize !== "both")
  13052. return;
  13053. const entry = entries[0];
  13054. const { width } = entry.contentRect;
  13055. countStyle.value = {
  13056. right: `calc(100% - ${width + 15 + 6}px)`
  13057. };
  13058. });
  13059. const resizeTextarea = () => {
  13060. const { type, autosize } = props;
  13061. if (!isClient || type !== "textarea" || !textarea.value)
  13062. return;
  13063. if (autosize) {
  13064. const minRows = isObject$1(autosize) ? autosize.minRows : void 0;
  13065. const maxRows = isObject$1(autosize) ? autosize.maxRows : void 0;
  13066. const textareaStyle2 = calcTextareaHeight(textarea.value, minRows, maxRows);
  13067. textareaCalcStyle.value = {
  13068. overflowY: "hidden",
  13069. ...textareaStyle2
  13070. };
  13071. nextTick(() => {
  13072. textarea.value.offsetHeight;
  13073. textareaCalcStyle.value = textareaStyle2;
  13074. });
  13075. } else {
  13076. textareaCalcStyle.value = {
  13077. minHeight: calcTextareaHeight(textarea.value).minHeight
  13078. };
  13079. }
  13080. };
  13081. const createOnceInitResize = (resizeTextarea2) => {
  13082. let isInit = false;
  13083. return () => {
  13084. var _a;
  13085. if (isInit || !props.autosize)
  13086. return;
  13087. const isElHidden = ((_a = textarea.value) == null ? void 0 : _a.offsetParent) === null;
  13088. if (!isElHidden) {
  13089. resizeTextarea2();
  13090. isInit = true;
  13091. }
  13092. };
  13093. };
  13094. const onceInitSizeTextarea = createOnceInitResize(resizeTextarea);
  13095. const setNativeInputValue = () => {
  13096. const input2 = _ref.value;
  13097. const formatterValue = props.formatter ? props.formatter(nativeInputValue.value) : nativeInputValue.value;
  13098. if (!input2 || input2.value === formatterValue)
  13099. return;
  13100. input2.value = formatterValue;
  13101. };
  13102. const handleInput = async (event) => {
  13103. recordCursor();
  13104. let { value } = event.target;
  13105. if (props.formatter && props.parser) {
  13106. value = props.parser(value);
  13107. }
  13108. if (isComposing.value)
  13109. return;
  13110. if (value === nativeInputValue.value) {
  13111. setNativeInputValue();
  13112. return;
  13113. }
  13114. emit(UPDATE_MODEL_EVENT, value);
  13115. emit(INPUT_EVENT, value);
  13116. await nextTick();
  13117. setNativeInputValue();
  13118. setCursor();
  13119. };
  13120. const handleChange = (event) => {
  13121. let { value } = event.target;
  13122. if (props.formatter && props.parser) {
  13123. value = props.parser(value);
  13124. }
  13125. emit(CHANGE_EVENT, value);
  13126. };
  13127. const {
  13128. isComposing,
  13129. handleCompositionStart,
  13130. handleCompositionUpdate,
  13131. handleCompositionEnd
  13132. } = useComposition({ emit, afterComposition: handleInput });
  13133. const handlePasswordVisible = () => {
  13134. recordCursor();
  13135. passwordVisible.value = !passwordVisible.value;
  13136. setTimeout(setCursor);
  13137. };
  13138. const focus = () => {
  13139. var _a;
  13140. return (_a = _ref.value) == null ? void 0 : _a.focus();
  13141. };
  13142. const blur = () => {
  13143. var _a;
  13144. return (_a = _ref.value) == null ? void 0 : _a.blur();
  13145. };
  13146. const handleMouseLeave = (evt) => {
  13147. hovering.value = false;
  13148. emit("mouseleave", evt);
  13149. };
  13150. const handleMouseEnter = (evt) => {
  13151. hovering.value = true;
  13152. emit("mouseenter", evt);
  13153. };
  13154. const handleKeydown = (evt) => {
  13155. emit("keydown", evt);
  13156. };
  13157. const select = () => {
  13158. var _a;
  13159. (_a = _ref.value) == null ? void 0 : _a.select();
  13160. };
  13161. const clear = () => {
  13162. emit(UPDATE_MODEL_EVENT, "");
  13163. emit(CHANGE_EVENT, "");
  13164. emit("clear");
  13165. emit(INPUT_EVENT, "");
  13166. };
  13167. watch(() => props.modelValue, () => {
  13168. var _a;
  13169. nextTick(() => resizeTextarea());
  13170. if (props.validateEvent) {
  13171. (_a = elFormItem == null ? void 0 : elFormItem.validate) == null ? void 0 : _a.call(elFormItem, "change").catch((err) => debugWarn());
  13172. }
  13173. });
  13174. watch(nativeInputValue, () => setNativeInputValue());
  13175. watch(() => props.type, async () => {
  13176. await nextTick();
  13177. setNativeInputValue();
  13178. resizeTextarea();
  13179. });
  13180. onMounted(() => {
  13181. if (!props.formatter && props.parser) ;
  13182. setNativeInputValue();
  13183. nextTick(resizeTextarea);
  13184. });
  13185. expose({
  13186. input,
  13187. textarea,
  13188. ref: _ref,
  13189. textareaStyle,
  13190. autosize: toRef(props, "autosize"),
  13191. isComposing,
  13192. focus,
  13193. blur,
  13194. select,
  13195. clear,
  13196. resizeTextarea
  13197. });
  13198. return (_ctx, _cache) => {
  13199. return openBlock(), createElementBlock("div", {
  13200. class: normalizeClass([
  13201. unref(containerKls),
  13202. {
  13203. [unref(nsInput).bm("group", "append")]: _ctx.$slots.append,
  13204. [unref(nsInput).bm("group", "prepend")]: _ctx.$slots.prepend
  13205. }
  13206. ]),
  13207. style: normalizeStyle(unref(containerStyle)),
  13208. onMouseenter: handleMouseEnter,
  13209. onMouseleave: handleMouseLeave
  13210. }, [
  13211. createCommentVNode(" input "),
  13212. _ctx.type !== "textarea" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  13213. createCommentVNode(" prepend slot "),
  13214. _ctx.$slots.prepend ? (openBlock(), createElementBlock("div", {
  13215. key: 0,
  13216. class: normalizeClass(unref(nsInput).be("group", "prepend"))
  13217. }, [
  13218. renderSlot(_ctx.$slots, "prepend")
  13219. ], 2)) : createCommentVNode("v-if", true),
  13220. createElementVNode("div", {
  13221. ref_key: "wrapperRef",
  13222. ref: wrapperRef,
  13223. class: normalizeClass(unref(wrapperKls))
  13224. }, [
  13225. createCommentVNode(" prefix slot "),
  13226. _ctx.$slots.prefix || _ctx.prefixIcon ? (openBlock(), createElementBlock("span", {
  13227. key: 0,
  13228. class: normalizeClass(unref(nsInput).e("prefix"))
  13229. }, [
  13230. createElementVNode("span", {
  13231. class: normalizeClass(unref(nsInput).e("prefix-inner"))
  13232. }, [
  13233. renderSlot(_ctx.$slots, "prefix"),
  13234. _ctx.prefixIcon ? (openBlock(), createBlock(unref(ElIcon), {
  13235. key: 0,
  13236. class: normalizeClass(unref(nsInput).e("icon"))
  13237. }, {
  13238. default: withCtx(() => [
  13239. (openBlock(), createBlock(resolveDynamicComponent(_ctx.prefixIcon)))
  13240. ]),
  13241. _: 1
  13242. }, 8, ["class"])) : createCommentVNode("v-if", true)
  13243. ], 2)
  13244. ], 2)) : createCommentVNode("v-if", true),
  13245. createElementVNode("input", mergeProps({
  13246. id: unref(inputId),
  13247. ref_key: "input",
  13248. ref: input,
  13249. class: unref(nsInput).e("inner")
  13250. }, unref(attrs), {
  13251. minlength: _ctx.minlength,
  13252. maxlength: _ctx.maxlength,
  13253. type: _ctx.showPassword ? passwordVisible.value ? "text" : "password" : _ctx.type,
  13254. disabled: unref(inputDisabled),
  13255. readonly: _ctx.readonly,
  13256. autocomplete: _ctx.autocomplete,
  13257. tabindex: _ctx.tabindex,
  13258. "aria-label": _ctx.ariaLabel,
  13259. placeholder: _ctx.placeholder,
  13260. style: _ctx.inputStyle,
  13261. form: _ctx.form,
  13262. autofocus: _ctx.autofocus,
  13263. role: _ctx.containerRole,
  13264. onCompositionstart: unref(handleCompositionStart),
  13265. onCompositionupdate: unref(handleCompositionUpdate),
  13266. onCompositionend: unref(handleCompositionEnd),
  13267. onInput: handleInput,
  13268. onChange: handleChange,
  13269. onKeydown: handleKeydown
  13270. }), null, 16, ["id", "minlength", "maxlength", "type", "disabled", "readonly", "autocomplete", "tabindex", "aria-label", "placeholder", "form", "autofocus", "role", "onCompositionstart", "onCompositionupdate", "onCompositionend"]),
  13271. createCommentVNode(" suffix slot "),
  13272. unref(suffixVisible) ? (openBlock(), createElementBlock("span", {
  13273. key: 1,
  13274. class: normalizeClass(unref(nsInput).e("suffix"))
  13275. }, [
  13276. createElementVNode("span", {
  13277. class: normalizeClass(unref(nsInput).e("suffix-inner"))
  13278. }, [
  13279. !unref(showClear) || !unref(showPwdVisible) || !unref(isWordLimitVisible) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  13280. renderSlot(_ctx.$slots, "suffix"),
  13281. _ctx.suffixIcon ? (openBlock(), createBlock(unref(ElIcon), {
  13282. key: 0,
  13283. class: normalizeClass(unref(nsInput).e("icon"))
  13284. }, {
  13285. default: withCtx(() => [
  13286. (openBlock(), createBlock(resolveDynamicComponent(_ctx.suffixIcon)))
  13287. ]),
  13288. _: 1
  13289. }, 8, ["class"])) : createCommentVNode("v-if", true)
  13290. ], 64)) : createCommentVNode("v-if", true),
  13291. unref(showClear) ? (openBlock(), createBlock(unref(ElIcon), {
  13292. key: 1,
  13293. class: normalizeClass([unref(nsInput).e("icon"), unref(nsInput).e("clear")]),
  13294. onMousedown: withModifiers(unref(NOOP), ["prevent"]),
  13295. onClick: clear
  13296. }, {
  13297. default: withCtx(() => [
  13298. createVNode(unref(circle_close_default))
  13299. ]),
  13300. _: 1
  13301. }, 8, ["class", "onMousedown"])) : createCommentVNode("v-if", true),
  13302. unref(showPwdVisible) ? (openBlock(), createBlock(unref(ElIcon), {
  13303. key: 2,
  13304. class: normalizeClass([unref(nsInput).e("icon"), unref(nsInput).e("password")]),
  13305. onClick: handlePasswordVisible
  13306. }, {
  13307. default: withCtx(() => [
  13308. (openBlock(), createBlock(resolveDynamicComponent(unref(passwordIcon))))
  13309. ]),
  13310. _: 1
  13311. }, 8, ["class"])) : createCommentVNode("v-if", true),
  13312. unref(isWordLimitVisible) ? (openBlock(), createElementBlock("span", {
  13313. key: 3,
  13314. class: normalizeClass(unref(nsInput).e("count"))
  13315. }, [
  13316. createElementVNode("span", {
  13317. class: normalizeClass(unref(nsInput).e("count-inner"))
  13318. }, toDisplayString(unref(textLength)) + " / " + toDisplayString(_ctx.maxlength), 3)
  13319. ], 2)) : createCommentVNode("v-if", true),
  13320. unref(validateState) && unref(validateIcon) && unref(needStatusIcon) ? (openBlock(), createBlock(unref(ElIcon), {
  13321. key: 4,
  13322. class: normalizeClass([
  13323. unref(nsInput).e("icon"),
  13324. unref(nsInput).e("validateIcon"),
  13325. unref(nsInput).is("loading", unref(validateState) === "validating")
  13326. ])
  13327. }, {
  13328. default: withCtx(() => [
  13329. (openBlock(), createBlock(resolveDynamicComponent(unref(validateIcon))))
  13330. ]),
  13331. _: 1
  13332. }, 8, ["class"])) : createCommentVNode("v-if", true)
  13333. ], 2)
  13334. ], 2)) : createCommentVNode("v-if", true)
  13335. ], 2),
  13336. createCommentVNode(" append slot "),
  13337. _ctx.$slots.append ? (openBlock(), createElementBlock("div", {
  13338. key: 1,
  13339. class: normalizeClass(unref(nsInput).be("group", "append"))
  13340. }, [
  13341. renderSlot(_ctx.$slots, "append")
  13342. ], 2)) : createCommentVNode("v-if", true)
  13343. ], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
  13344. createCommentVNode(" textarea "),
  13345. createElementVNode("textarea", mergeProps({
  13346. id: unref(inputId),
  13347. ref_key: "textarea",
  13348. ref: textarea,
  13349. class: [unref(nsTextarea).e("inner"), unref(nsInput).is("focus", unref(isFocused))]
  13350. }, unref(attrs), {
  13351. minlength: _ctx.minlength,
  13352. maxlength: _ctx.maxlength,
  13353. tabindex: _ctx.tabindex,
  13354. disabled: unref(inputDisabled),
  13355. readonly: _ctx.readonly,
  13356. autocomplete: _ctx.autocomplete,
  13357. style: unref(textareaStyle),
  13358. "aria-label": _ctx.ariaLabel,
  13359. placeholder: _ctx.placeholder,
  13360. form: _ctx.form,
  13361. autofocus: _ctx.autofocus,
  13362. rows: _ctx.rows,
  13363. role: _ctx.containerRole,
  13364. onCompositionstart: unref(handleCompositionStart),
  13365. onCompositionupdate: unref(handleCompositionUpdate),
  13366. onCompositionend: unref(handleCompositionEnd),
  13367. onInput: handleInput,
  13368. onFocus: unref(handleFocus),
  13369. onBlur: unref(handleBlur),
  13370. onChange: handleChange,
  13371. onKeydown: handleKeydown
  13372. }), null, 16, ["id", "minlength", "maxlength", "tabindex", "disabled", "readonly", "autocomplete", "aria-label", "placeholder", "form", "autofocus", "rows", "role", "onCompositionstart", "onCompositionupdate", "onCompositionend", "onFocus", "onBlur"]),
  13373. unref(isWordLimitVisible) ? (openBlock(), createElementBlock("span", {
  13374. key: 0,
  13375. style: normalizeStyle(countStyle.value),
  13376. class: normalizeClass(unref(nsInput).e("count"))
  13377. }, toDisplayString(unref(textLength)) + " / " + toDisplayString(_ctx.maxlength), 7)) : createCommentVNode("v-if", true)
  13378. ], 64))
  13379. ], 38);
  13380. };
  13381. }
  13382. });
  13383. var Input = /* @__PURE__ */ _export_sfc(_sfc_main$2s, [["__file", "input.vue"]]);
  13384. const ElInput = withInstall(Input);
  13385. const GAP = 4;
  13386. const BAR_MAP = {
  13387. vertical: {
  13388. offset: "offsetHeight",
  13389. scroll: "scrollTop",
  13390. scrollSize: "scrollHeight",
  13391. size: "height",
  13392. key: "vertical",
  13393. axis: "Y",
  13394. client: "clientY",
  13395. direction: "top"
  13396. },
  13397. horizontal: {
  13398. offset: "offsetWidth",
  13399. scroll: "scrollLeft",
  13400. scrollSize: "scrollWidth",
  13401. size: "width",
  13402. key: "horizontal",
  13403. axis: "X",
  13404. client: "clientX",
  13405. direction: "left"
  13406. }
  13407. };
  13408. const renderThumbStyle$1 = ({
  13409. move,
  13410. size,
  13411. bar
  13412. }) => ({
  13413. [bar.size]: size,
  13414. transform: `translate${bar.axis}(${move}%)`
  13415. });
  13416. const scrollbarContextKey = Symbol("scrollbarContextKey");
  13417. const thumbProps = buildProps({
  13418. vertical: Boolean,
  13419. size: String,
  13420. move: Number,
  13421. ratio: {
  13422. type: Number,
  13423. required: true
  13424. },
  13425. always: Boolean
  13426. });
  13427. const COMPONENT_NAME$l = "Thumb";
  13428. const _sfc_main$2r = /* @__PURE__ */ defineComponent({
  13429. __name: "thumb",
  13430. props: thumbProps,
  13431. setup(__props) {
  13432. const props = __props;
  13433. const scrollbar = inject(scrollbarContextKey);
  13434. const ns = useNamespace("scrollbar");
  13435. if (!scrollbar)
  13436. throwError(COMPONENT_NAME$l, "can not inject scrollbar context");
  13437. const instance = ref();
  13438. const thumb = ref();
  13439. const thumbState = ref({});
  13440. const visible = ref(false);
  13441. let cursorDown = false;
  13442. let cursorLeave = false;
  13443. let originalOnSelectStart = isClient ? document.onselectstart : null;
  13444. const bar = computed(() => BAR_MAP[props.vertical ? "vertical" : "horizontal"]);
  13445. const thumbStyle = computed(() => renderThumbStyle$1({
  13446. size: props.size,
  13447. move: props.move,
  13448. bar: bar.value
  13449. }));
  13450. const offsetRatio = computed(() => instance.value[bar.value.offset] ** 2 / scrollbar.wrapElement[bar.value.scrollSize] / props.ratio / thumb.value[bar.value.offset]);
  13451. const clickThumbHandler = (e) => {
  13452. var _a;
  13453. e.stopPropagation();
  13454. if (e.ctrlKey || [1, 2].includes(e.button))
  13455. return;
  13456. (_a = window.getSelection()) == null ? void 0 : _a.removeAllRanges();
  13457. startDrag(e);
  13458. const el = e.currentTarget;
  13459. if (!el)
  13460. return;
  13461. thumbState.value[bar.value.axis] = el[bar.value.offset] - (e[bar.value.client] - el.getBoundingClientRect()[bar.value.direction]);
  13462. };
  13463. const clickTrackHandler = (e) => {
  13464. if (!thumb.value || !instance.value || !scrollbar.wrapElement)
  13465. return;
  13466. const offset = Math.abs(e.target.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]);
  13467. const thumbHalf = thumb.value[bar.value.offset] / 2;
  13468. const thumbPositionPercentage = (offset - thumbHalf) * 100 * offsetRatio.value / instance.value[bar.value.offset];
  13469. scrollbar.wrapElement[bar.value.scroll] = thumbPositionPercentage * scrollbar.wrapElement[bar.value.scrollSize] / 100;
  13470. };
  13471. const startDrag = (e) => {
  13472. e.stopImmediatePropagation();
  13473. cursorDown = true;
  13474. document.addEventListener("mousemove", mouseMoveDocumentHandler);
  13475. document.addEventListener("mouseup", mouseUpDocumentHandler);
  13476. originalOnSelectStart = document.onselectstart;
  13477. document.onselectstart = () => false;
  13478. };
  13479. const mouseMoveDocumentHandler = (e) => {
  13480. if (!instance.value || !thumb.value)
  13481. return;
  13482. if (cursorDown === false)
  13483. return;
  13484. const prevPage = thumbState.value[bar.value.axis];
  13485. if (!prevPage)
  13486. return;
  13487. const offset = (instance.value.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]) * -1;
  13488. const thumbClickPosition = thumb.value[bar.value.offset] - prevPage;
  13489. const thumbPositionPercentage = (offset - thumbClickPosition) * 100 * offsetRatio.value / instance.value[bar.value.offset];
  13490. scrollbar.wrapElement[bar.value.scroll] = thumbPositionPercentage * scrollbar.wrapElement[bar.value.scrollSize] / 100;
  13491. };
  13492. const mouseUpDocumentHandler = () => {
  13493. cursorDown = false;
  13494. thumbState.value[bar.value.axis] = 0;
  13495. document.removeEventListener("mousemove", mouseMoveDocumentHandler);
  13496. document.removeEventListener("mouseup", mouseUpDocumentHandler);
  13497. restoreOnselectstart();
  13498. if (cursorLeave)
  13499. visible.value = false;
  13500. };
  13501. const mouseMoveScrollbarHandler = () => {
  13502. cursorLeave = false;
  13503. visible.value = !!props.size;
  13504. };
  13505. const mouseLeaveScrollbarHandler = () => {
  13506. cursorLeave = true;
  13507. visible.value = cursorDown;
  13508. };
  13509. onBeforeUnmount(() => {
  13510. restoreOnselectstart();
  13511. document.removeEventListener("mouseup", mouseUpDocumentHandler);
  13512. });
  13513. const restoreOnselectstart = () => {
  13514. if (document.onselectstart !== originalOnSelectStart)
  13515. document.onselectstart = originalOnSelectStart;
  13516. };
  13517. useEventListener(toRef(scrollbar, "scrollbarElement"), "mousemove", mouseMoveScrollbarHandler);
  13518. useEventListener(toRef(scrollbar, "scrollbarElement"), "mouseleave", mouseLeaveScrollbarHandler);
  13519. return (_ctx, _cache) => {
  13520. return openBlock(), createBlock(Transition, {
  13521. name: unref(ns).b("fade"),
  13522. persisted: ""
  13523. }, {
  13524. default: withCtx(() => [
  13525. withDirectives(createElementVNode("div", {
  13526. ref_key: "instance",
  13527. ref: instance,
  13528. class: normalizeClass([unref(ns).e("bar"), unref(ns).is(unref(bar).key)]),
  13529. onMousedown: clickTrackHandler,
  13530. onClick: withModifiers(() => {
  13531. }, ["stop"])
  13532. }, [
  13533. createElementVNode("div", {
  13534. ref_key: "thumb",
  13535. ref: thumb,
  13536. class: normalizeClass(unref(ns).e("thumb")),
  13537. style: normalizeStyle(unref(thumbStyle)),
  13538. onMousedown: clickThumbHandler
  13539. }, null, 38)
  13540. ], 42, ["onClick"]), [
  13541. [vShow, _ctx.always || visible.value]
  13542. ])
  13543. ]),
  13544. _: 1
  13545. }, 8, ["name"]);
  13546. };
  13547. }
  13548. });
  13549. var Thumb = /* @__PURE__ */ _export_sfc(_sfc_main$2r, [["__file", "thumb.vue"]]);
  13550. const barProps = buildProps({
  13551. always: {
  13552. type: Boolean,
  13553. default: true
  13554. },
  13555. minSize: {
  13556. type: Number,
  13557. required: true
  13558. }
  13559. });
  13560. const _sfc_main$2q = /* @__PURE__ */ defineComponent({
  13561. __name: "bar",
  13562. props: barProps,
  13563. setup(__props, { expose }) {
  13564. const props = __props;
  13565. const scrollbar = inject(scrollbarContextKey);
  13566. const moveX = ref(0);
  13567. const moveY = ref(0);
  13568. const sizeWidth = ref("");
  13569. const sizeHeight = ref("");
  13570. const ratioY = ref(1);
  13571. const ratioX = ref(1);
  13572. const handleScroll = (wrap) => {
  13573. if (wrap) {
  13574. const offsetHeight = wrap.offsetHeight - GAP;
  13575. const offsetWidth = wrap.offsetWidth - GAP;
  13576. moveY.value = wrap.scrollTop * 100 / offsetHeight * ratioY.value;
  13577. moveX.value = wrap.scrollLeft * 100 / offsetWidth * ratioX.value;
  13578. }
  13579. };
  13580. const update = () => {
  13581. const wrap = scrollbar == null ? void 0 : scrollbar.wrapElement;
  13582. if (!wrap)
  13583. return;
  13584. const offsetHeight = wrap.offsetHeight - GAP;
  13585. const offsetWidth = wrap.offsetWidth - GAP;
  13586. const originalHeight = offsetHeight ** 2 / wrap.scrollHeight;
  13587. const originalWidth = offsetWidth ** 2 / wrap.scrollWidth;
  13588. const height = Math.max(originalHeight, props.minSize);
  13589. const width = Math.max(originalWidth, props.minSize);
  13590. ratioY.value = originalHeight / (offsetHeight - originalHeight) / (height / (offsetHeight - height));
  13591. ratioX.value = originalWidth / (offsetWidth - originalWidth) / (width / (offsetWidth - width));
  13592. sizeHeight.value = height + GAP < offsetHeight ? `${height}px` : "";
  13593. sizeWidth.value = width + GAP < offsetWidth ? `${width}px` : "";
  13594. };
  13595. expose({
  13596. handleScroll,
  13597. update
  13598. });
  13599. return (_ctx, _cache) => {
  13600. return openBlock(), createElementBlock(Fragment, null, [
  13601. createVNode(Thumb, {
  13602. move: moveX.value,
  13603. ratio: ratioX.value,
  13604. size: sizeWidth.value,
  13605. always: _ctx.always
  13606. }, null, 8, ["move", "ratio", "size", "always"]),
  13607. createVNode(Thumb, {
  13608. move: moveY.value,
  13609. ratio: ratioY.value,
  13610. size: sizeHeight.value,
  13611. vertical: "",
  13612. always: _ctx.always
  13613. }, null, 8, ["move", "ratio", "size", "always"])
  13614. ], 64);
  13615. };
  13616. }
  13617. });
  13618. var Bar = /* @__PURE__ */ _export_sfc(_sfc_main$2q, [["__file", "bar.vue"]]);
  13619. const scrollbarProps = buildProps({
  13620. height: {
  13621. type: [String, Number],
  13622. default: ""
  13623. },
  13624. maxHeight: {
  13625. type: [String, Number],
  13626. default: ""
  13627. },
  13628. native: {
  13629. type: Boolean,
  13630. default: false
  13631. },
  13632. wrapStyle: {
  13633. type: definePropType([String, Object, Array]),
  13634. default: ""
  13635. },
  13636. wrapClass: {
  13637. type: [String, Array],
  13638. default: ""
  13639. },
  13640. viewClass: {
  13641. type: [String, Array],
  13642. default: ""
  13643. },
  13644. viewStyle: {
  13645. type: [String, Array, Object],
  13646. default: ""
  13647. },
  13648. noresize: Boolean,
  13649. tag: {
  13650. type: String,
  13651. default: "div"
  13652. },
  13653. always: Boolean,
  13654. minSize: {
  13655. type: Number,
  13656. default: 20
  13657. },
  13658. tabindex: {
  13659. type: [String, Number],
  13660. default: void 0
  13661. },
  13662. id: String,
  13663. role: String,
  13664. ...useAriaProps(["ariaLabel", "ariaOrientation"])
  13665. });
  13666. const scrollbarEmits = {
  13667. scroll: ({
  13668. scrollTop,
  13669. scrollLeft
  13670. }) => [scrollTop, scrollLeft].every(isNumber)
  13671. };
  13672. const COMPONENT_NAME$k = "ElScrollbar";
  13673. const __default__$1O = defineComponent({
  13674. name: COMPONENT_NAME$k
  13675. });
  13676. const _sfc_main$2p = /* @__PURE__ */ defineComponent({
  13677. ...__default__$1O,
  13678. props: scrollbarProps,
  13679. emits: scrollbarEmits,
  13680. setup(__props, { expose, emit }) {
  13681. const props = __props;
  13682. const ns = useNamespace("scrollbar");
  13683. let stopResizeObserver = void 0;
  13684. let stopResizeListener = void 0;
  13685. let wrapScrollTop = 0;
  13686. let wrapScrollLeft = 0;
  13687. const scrollbarRef = ref();
  13688. const wrapRef = ref();
  13689. const resizeRef = ref();
  13690. const barRef = ref();
  13691. const wrapStyle = computed(() => {
  13692. const style = {};
  13693. if (props.height)
  13694. style.height = addUnit(props.height);
  13695. if (props.maxHeight)
  13696. style.maxHeight = addUnit(props.maxHeight);
  13697. return [props.wrapStyle, style];
  13698. });
  13699. const wrapKls = computed(() => {
  13700. return [
  13701. props.wrapClass,
  13702. ns.e("wrap"),
  13703. { [ns.em("wrap", "hidden-default")]: !props.native }
  13704. ];
  13705. });
  13706. const resizeKls = computed(() => {
  13707. return [ns.e("view"), props.viewClass];
  13708. });
  13709. const handleScroll = () => {
  13710. var _a;
  13711. if (wrapRef.value) {
  13712. (_a = barRef.value) == null ? void 0 : _a.handleScroll(wrapRef.value);
  13713. wrapScrollTop = wrapRef.value.scrollTop;
  13714. wrapScrollLeft = wrapRef.value.scrollLeft;
  13715. emit("scroll", {
  13716. scrollTop: wrapRef.value.scrollTop,
  13717. scrollLeft: wrapRef.value.scrollLeft
  13718. });
  13719. }
  13720. };
  13721. function scrollTo(arg1, arg2) {
  13722. if (isObject$1(arg1)) {
  13723. wrapRef.value.scrollTo(arg1);
  13724. } else if (isNumber(arg1) && isNumber(arg2)) {
  13725. wrapRef.value.scrollTo(arg1, arg2);
  13726. }
  13727. }
  13728. const setScrollTop = (value) => {
  13729. if (!isNumber(value)) {
  13730. return;
  13731. }
  13732. wrapRef.value.scrollTop = value;
  13733. };
  13734. const setScrollLeft = (value) => {
  13735. if (!isNumber(value)) {
  13736. return;
  13737. }
  13738. wrapRef.value.scrollLeft = value;
  13739. };
  13740. const update = () => {
  13741. var _a;
  13742. (_a = barRef.value) == null ? void 0 : _a.update();
  13743. };
  13744. watch(() => props.noresize, (noresize) => {
  13745. if (noresize) {
  13746. stopResizeObserver == null ? void 0 : stopResizeObserver();
  13747. stopResizeListener == null ? void 0 : stopResizeListener();
  13748. } else {
  13749. ({ stop: stopResizeObserver } = useResizeObserver(resizeRef, update));
  13750. stopResizeListener = useEventListener("resize", update);
  13751. }
  13752. }, { immediate: true });
  13753. watch(() => [props.maxHeight, props.height], () => {
  13754. if (!props.native)
  13755. nextTick(() => {
  13756. var _a;
  13757. update();
  13758. if (wrapRef.value) {
  13759. (_a = barRef.value) == null ? void 0 : _a.handleScroll(wrapRef.value);
  13760. }
  13761. });
  13762. });
  13763. provide(scrollbarContextKey, reactive({
  13764. scrollbarElement: scrollbarRef,
  13765. wrapElement: wrapRef
  13766. }));
  13767. onActivated(() => {
  13768. if (wrapRef.value) {
  13769. wrapRef.value.scrollTop = wrapScrollTop;
  13770. wrapRef.value.scrollLeft = wrapScrollLeft;
  13771. }
  13772. });
  13773. onMounted(() => {
  13774. if (!props.native)
  13775. nextTick(() => {
  13776. update();
  13777. });
  13778. });
  13779. onUpdated(() => update());
  13780. expose({
  13781. wrapRef,
  13782. update,
  13783. scrollTo,
  13784. setScrollTop,
  13785. setScrollLeft,
  13786. handleScroll
  13787. });
  13788. return (_ctx, _cache) => {
  13789. return openBlock(), createElementBlock("div", {
  13790. ref_key: "scrollbarRef",
  13791. ref: scrollbarRef,
  13792. class: normalizeClass(unref(ns).b())
  13793. }, [
  13794. createElementVNode("div", {
  13795. ref_key: "wrapRef",
  13796. ref: wrapRef,
  13797. class: normalizeClass(unref(wrapKls)),
  13798. style: normalizeStyle(unref(wrapStyle)),
  13799. tabindex: _ctx.tabindex,
  13800. onScroll: handleScroll
  13801. }, [
  13802. (openBlock(), createBlock(resolveDynamicComponent(_ctx.tag), {
  13803. id: _ctx.id,
  13804. ref_key: "resizeRef",
  13805. ref: resizeRef,
  13806. class: normalizeClass(unref(resizeKls)),
  13807. style: normalizeStyle(_ctx.viewStyle),
  13808. role: _ctx.role,
  13809. "aria-label": _ctx.ariaLabel,
  13810. "aria-orientation": _ctx.ariaOrientation
  13811. }, {
  13812. default: withCtx(() => [
  13813. renderSlot(_ctx.$slots, "default")
  13814. ]),
  13815. _: 3
  13816. }, 8, ["id", "class", "style", "role", "aria-label", "aria-orientation"]))
  13817. ], 46, ["tabindex"]),
  13818. !_ctx.native ? (openBlock(), createBlock(Bar, {
  13819. key: 0,
  13820. ref_key: "barRef",
  13821. ref: barRef,
  13822. always: _ctx.always,
  13823. "min-size": _ctx.minSize
  13824. }, null, 8, ["always", "min-size"])) : createCommentVNode("v-if", true)
  13825. ], 2);
  13826. };
  13827. }
  13828. });
  13829. var Scrollbar$1 = /* @__PURE__ */ _export_sfc(_sfc_main$2p, [["__file", "scrollbar.vue"]]);
  13830. const ElScrollbar = withInstall(Scrollbar$1);
  13831. const POPPER_INJECTION_KEY = Symbol("popper");
  13832. const POPPER_CONTENT_INJECTION_KEY = Symbol("popperContent");
  13833. const Effect = {
  13834. LIGHT: "light",
  13835. DARK: "dark"
  13836. };
  13837. const roleTypes = [
  13838. "dialog",
  13839. "grid",
  13840. "group",
  13841. "listbox",
  13842. "menu",
  13843. "navigation",
  13844. "tooltip",
  13845. "tree"
  13846. ];
  13847. const popperProps = buildProps({
  13848. role: {
  13849. type: String,
  13850. values: roleTypes,
  13851. default: "tooltip"
  13852. }
  13853. });
  13854. const usePopperProps = popperProps;
  13855. const __default__$1N = defineComponent({
  13856. name: "ElPopper",
  13857. inheritAttrs: false
  13858. });
  13859. const _sfc_main$2o = /* @__PURE__ */ defineComponent({
  13860. ...__default__$1N,
  13861. props: popperProps,
  13862. setup(__props, { expose }) {
  13863. const props = __props;
  13864. const triggerRef = ref();
  13865. const popperInstanceRef = ref();
  13866. const contentRef = ref();
  13867. const referenceRef = ref();
  13868. const role = computed(() => props.role);
  13869. const popperProvides = {
  13870. triggerRef,
  13871. popperInstanceRef,
  13872. contentRef,
  13873. referenceRef,
  13874. role
  13875. };
  13876. expose(popperProvides);
  13877. provide(POPPER_INJECTION_KEY, popperProvides);
  13878. return (_ctx, _cache) => {
  13879. return renderSlot(_ctx.$slots, "default");
  13880. };
  13881. }
  13882. });
  13883. var Popper = /* @__PURE__ */ _export_sfc(_sfc_main$2o, [["__file", "popper.vue"]]);
  13884. const popperArrowProps = buildProps({
  13885. arrowOffset: {
  13886. type: Number,
  13887. default: 5
  13888. }
  13889. });
  13890. const usePopperArrowProps = popperArrowProps;
  13891. const __default__$1M = defineComponent({
  13892. name: "ElPopperArrow",
  13893. inheritAttrs: false
  13894. });
  13895. const _sfc_main$2n = /* @__PURE__ */ defineComponent({
  13896. ...__default__$1M,
  13897. props: popperArrowProps,
  13898. setup(__props, { expose }) {
  13899. const props = __props;
  13900. const ns = useNamespace("popper");
  13901. const { arrowOffset, arrowRef, arrowStyle } = inject(POPPER_CONTENT_INJECTION_KEY, void 0);
  13902. watch(() => props.arrowOffset, (val) => {
  13903. arrowOffset.value = val;
  13904. });
  13905. onBeforeUnmount(() => {
  13906. arrowRef.value = void 0;
  13907. });
  13908. expose({
  13909. arrowRef
  13910. });
  13911. return (_ctx, _cache) => {
  13912. return openBlock(), createElementBlock("span", {
  13913. ref_key: "arrowRef",
  13914. ref: arrowRef,
  13915. class: normalizeClass(unref(ns).e("arrow")),
  13916. style: normalizeStyle(unref(arrowStyle)),
  13917. "data-popper-arrow": ""
  13918. }, null, 6);
  13919. };
  13920. }
  13921. });
  13922. var ElPopperArrow = /* @__PURE__ */ _export_sfc(_sfc_main$2n, [["__file", "arrow.vue"]]);
  13923. const NAME = "ElOnlyChild";
  13924. const OnlyChild = defineComponent({
  13925. name: NAME,
  13926. setup(_, {
  13927. slots,
  13928. attrs
  13929. }) {
  13930. var _a;
  13931. const forwardRefInjection = inject(FORWARD_REF_INJECTION_KEY);
  13932. const forwardRefDirective = useForwardRefDirective((_a = forwardRefInjection == null ? void 0 : forwardRefInjection.setForwardRef) != null ? _a : NOOP);
  13933. return () => {
  13934. var _a2;
  13935. const defaultSlot = (_a2 = slots.default) == null ? void 0 : _a2.call(slots, attrs);
  13936. if (!defaultSlot)
  13937. return null;
  13938. if (defaultSlot.length > 1) {
  13939. return null;
  13940. }
  13941. const firstLegitNode = findFirstLegitChild(defaultSlot);
  13942. if (!firstLegitNode) {
  13943. return null;
  13944. }
  13945. return withDirectives(cloneVNode(firstLegitNode, attrs), [[forwardRefDirective]]);
  13946. };
  13947. }
  13948. });
  13949. function findFirstLegitChild(node) {
  13950. if (!node)
  13951. return null;
  13952. const children = node;
  13953. for (const child of children) {
  13954. if (isObject$1(child)) {
  13955. switch (child.type) {
  13956. case Comment:
  13957. continue;
  13958. case Text$1:
  13959. case "svg":
  13960. return wrapTextContent(child);
  13961. case Fragment:
  13962. return findFirstLegitChild(child.children);
  13963. default:
  13964. return child;
  13965. }
  13966. }
  13967. return wrapTextContent(child);
  13968. }
  13969. return null;
  13970. }
  13971. function wrapTextContent(s) {
  13972. const ns = useNamespace("only-child");
  13973. return createVNode("span", {
  13974. "class": ns.e("content")
  13975. }, [s]);
  13976. }
  13977. const popperTriggerProps = buildProps({
  13978. virtualRef: {
  13979. type: definePropType(Object)
  13980. },
  13981. virtualTriggering: Boolean,
  13982. onMouseenter: {
  13983. type: definePropType(Function)
  13984. },
  13985. onMouseleave: {
  13986. type: definePropType(Function)
  13987. },
  13988. onClick: {
  13989. type: definePropType(Function)
  13990. },
  13991. onKeydown: {
  13992. type: definePropType(Function)
  13993. },
  13994. onFocus: {
  13995. type: definePropType(Function)
  13996. },
  13997. onBlur: {
  13998. type: definePropType(Function)
  13999. },
  14000. onContextmenu: {
  14001. type: definePropType(Function)
  14002. },
  14003. id: String,
  14004. open: Boolean
  14005. });
  14006. const usePopperTriggerProps = popperTriggerProps;
  14007. const __default__$1L = defineComponent({
  14008. name: "ElPopperTrigger",
  14009. inheritAttrs: false
  14010. });
  14011. const _sfc_main$2m = /* @__PURE__ */ defineComponent({
  14012. ...__default__$1L,
  14013. props: popperTriggerProps,
  14014. setup(__props, { expose }) {
  14015. const props = __props;
  14016. const { role, triggerRef } = inject(POPPER_INJECTION_KEY, void 0);
  14017. useForwardRef(triggerRef);
  14018. const ariaControls = computed(() => {
  14019. return ariaHaspopup.value ? props.id : void 0;
  14020. });
  14021. const ariaDescribedby = computed(() => {
  14022. if (role && role.value === "tooltip") {
  14023. return props.open && props.id ? props.id : void 0;
  14024. }
  14025. return void 0;
  14026. });
  14027. const ariaHaspopup = computed(() => {
  14028. if (role && role.value !== "tooltip") {
  14029. return role.value;
  14030. }
  14031. return void 0;
  14032. });
  14033. const ariaExpanded = computed(() => {
  14034. return ariaHaspopup.value ? `${props.open}` : void 0;
  14035. });
  14036. let virtualTriggerAriaStopWatch = void 0;
  14037. const TRIGGER_ELE_EVENTS = [
  14038. "onMouseenter",
  14039. "onMouseleave",
  14040. "onClick",
  14041. "onKeydown",
  14042. "onFocus",
  14043. "onBlur",
  14044. "onContextmenu"
  14045. ];
  14046. onMounted(() => {
  14047. watch(() => props.virtualRef, (virtualEl) => {
  14048. if (virtualEl) {
  14049. triggerRef.value = unrefElement(virtualEl);
  14050. }
  14051. }, {
  14052. immediate: true
  14053. });
  14054. watch(triggerRef, (el, prevEl) => {
  14055. virtualTriggerAriaStopWatch == null ? void 0 : virtualTriggerAriaStopWatch();
  14056. virtualTriggerAriaStopWatch = void 0;
  14057. if (isElement$1(el)) {
  14058. TRIGGER_ELE_EVENTS.forEach((eventName) => {
  14059. var _a;
  14060. const handler = props[eventName];
  14061. if (handler) {
  14062. el.addEventListener(eventName.slice(2).toLowerCase(), handler);
  14063. (_a = prevEl == null ? void 0 : prevEl.removeEventListener) == null ? void 0 : _a.call(prevEl, eventName.slice(2).toLowerCase(), handler);
  14064. }
  14065. });
  14066. if (isFocusable(el)) {
  14067. virtualTriggerAriaStopWatch = watch([ariaControls, ariaDescribedby, ariaHaspopup, ariaExpanded], (watches) => {
  14068. [
  14069. "aria-controls",
  14070. "aria-describedby",
  14071. "aria-haspopup",
  14072. "aria-expanded"
  14073. ].forEach((key, idx) => {
  14074. isNil(watches[idx]) ? el.removeAttribute(key) : el.setAttribute(key, watches[idx]);
  14075. });
  14076. }, { immediate: true });
  14077. }
  14078. }
  14079. if (isElement$1(prevEl) && isFocusable(prevEl)) {
  14080. [
  14081. "aria-controls",
  14082. "aria-describedby",
  14083. "aria-haspopup",
  14084. "aria-expanded"
  14085. ].forEach((key) => prevEl.removeAttribute(key));
  14086. }
  14087. }, {
  14088. immediate: true
  14089. });
  14090. });
  14091. onBeforeUnmount(() => {
  14092. virtualTriggerAriaStopWatch == null ? void 0 : virtualTriggerAriaStopWatch();
  14093. virtualTriggerAriaStopWatch = void 0;
  14094. if (triggerRef.value && isElement$1(triggerRef.value)) {
  14095. const el = triggerRef.value;
  14096. TRIGGER_ELE_EVENTS.forEach((eventName) => {
  14097. const handler = props[eventName];
  14098. if (handler) {
  14099. el.removeEventListener(eventName.slice(2).toLowerCase(), handler);
  14100. }
  14101. });
  14102. triggerRef.value = void 0;
  14103. }
  14104. });
  14105. expose({
  14106. triggerRef
  14107. });
  14108. return (_ctx, _cache) => {
  14109. return !_ctx.virtualTriggering ? (openBlock(), createBlock(unref(OnlyChild), mergeProps({ key: 0 }, _ctx.$attrs, {
  14110. "aria-controls": unref(ariaControls),
  14111. "aria-describedby": unref(ariaDescribedby),
  14112. "aria-expanded": unref(ariaExpanded),
  14113. "aria-haspopup": unref(ariaHaspopup)
  14114. }), {
  14115. default: withCtx(() => [
  14116. renderSlot(_ctx.$slots, "default")
  14117. ]),
  14118. _: 3
  14119. }, 16, ["aria-controls", "aria-describedby", "aria-expanded", "aria-haspopup"])) : createCommentVNode("v-if", true);
  14120. };
  14121. }
  14122. });
  14123. var ElPopperTrigger = /* @__PURE__ */ _export_sfc(_sfc_main$2m, [["__file", "trigger.vue"]]);
  14124. const FOCUS_AFTER_TRAPPED = "focus-trap.focus-after-trapped";
  14125. const FOCUS_AFTER_RELEASED = "focus-trap.focus-after-released";
  14126. const FOCUSOUT_PREVENTED = "focus-trap.focusout-prevented";
  14127. const FOCUS_AFTER_TRAPPED_OPTS = {
  14128. cancelable: true,
  14129. bubbles: false
  14130. };
  14131. const FOCUSOUT_PREVENTED_OPTS = {
  14132. cancelable: true,
  14133. bubbles: false
  14134. };
  14135. const ON_TRAP_FOCUS_EVT = "focusAfterTrapped";
  14136. const ON_RELEASE_FOCUS_EVT = "focusAfterReleased";
  14137. const FOCUS_TRAP_INJECTION_KEY = Symbol("elFocusTrap");
  14138. const focusReason = ref();
  14139. const lastUserFocusTimestamp = ref(0);
  14140. const lastAutomatedFocusTimestamp = ref(0);
  14141. let focusReasonUserCount = 0;
  14142. const obtainAllFocusableElements = (element) => {
  14143. const nodes = [];
  14144. const walker = document.createTreeWalker(element, NodeFilter.SHOW_ELEMENT, {
  14145. acceptNode: (node) => {
  14146. const isHiddenInput = node.tagName === "INPUT" && node.type === "hidden";
  14147. if (node.disabled || node.hidden || isHiddenInput)
  14148. return NodeFilter.FILTER_SKIP;
  14149. return node.tabIndex >= 0 || node === document.activeElement ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
  14150. }
  14151. });
  14152. while (walker.nextNode())
  14153. nodes.push(walker.currentNode);
  14154. return nodes;
  14155. };
  14156. const getVisibleElement = (elements, container) => {
  14157. for (const element of elements) {
  14158. if (!isHidden(element, container))
  14159. return element;
  14160. }
  14161. };
  14162. const isHidden = (element, container) => {
  14163. if (getComputedStyle(element).visibility === "hidden")
  14164. return true;
  14165. while (element) {
  14166. if (container && element === container)
  14167. return false;
  14168. if (getComputedStyle(element).display === "none")
  14169. return true;
  14170. element = element.parentElement;
  14171. }
  14172. return false;
  14173. };
  14174. const getEdges = (container) => {
  14175. const focusable = obtainAllFocusableElements(container);
  14176. const first = getVisibleElement(focusable, container);
  14177. const last = getVisibleElement(focusable.reverse(), container);
  14178. return [first, last];
  14179. };
  14180. const isSelectable = (element) => {
  14181. return element instanceof HTMLInputElement && "select" in element;
  14182. };
  14183. const tryFocus = (element, shouldSelect) => {
  14184. if (element && element.focus) {
  14185. const prevFocusedElement = document.activeElement;
  14186. let cleanup = false;
  14187. if (isElement$1(element) && !isFocusable(element) && !element.getAttribute("tabindex")) {
  14188. element.setAttribute("tabindex", "-1");
  14189. cleanup = true;
  14190. }
  14191. element.focus({ preventScroll: true });
  14192. lastAutomatedFocusTimestamp.value = window.performance.now();
  14193. if (element !== prevFocusedElement && isSelectable(element) && shouldSelect) {
  14194. element.select();
  14195. }
  14196. if (isElement$1(element) && cleanup) {
  14197. element.removeAttribute("tabindex");
  14198. }
  14199. }
  14200. };
  14201. function removeFromStack(list, item) {
  14202. const copy = [...list];
  14203. const idx = list.indexOf(item);
  14204. if (idx !== -1) {
  14205. copy.splice(idx, 1);
  14206. }
  14207. return copy;
  14208. }
  14209. const createFocusableStack = () => {
  14210. let stack = [];
  14211. const push = (layer) => {
  14212. const currentLayer = stack[0];
  14213. if (currentLayer && layer !== currentLayer) {
  14214. currentLayer.pause();
  14215. }
  14216. stack = removeFromStack(stack, layer);
  14217. stack.unshift(layer);
  14218. };
  14219. const remove = (layer) => {
  14220. var _a, _b;
  14221. stack = removeFromStack(stack, layer);
  14222. (_b = (_a = stack[0]) == null ? void 0 : _a.resume) == null ? void 0 : _b.call(_a);
  14223. };
  14224. return {
  14225. push,
  14226. remove
  14227. };
  14228. };
  14229. const focusFirstDescendant = (elements, shouldSelect = false) => {
  14230. const prevFocusedElement = document.activeElement;
  14231. for (const element of elements) {
  14232. tryFocus(element, shouldSelect);
  14233. if (document.activeElement !== prevFocusedElement)
  14234. return;
  14235. }
  14236. };
  14237. const focusableStack = createFocusableStack();
  14238. const isFocusCausedByUserEvent = () => {
  14239. return lastUserFocusTimestamp.value > lastAutomatedFocusTimestamp.value;
  14240. };
  14241. const notifyFocusReasonPointer = () => {
  14242. focusReason.value = "pointer";
  14243. lastUserFocusTimestamp.value = window.performance.now();
  14244. };
  14245. const notifyFocusReasonKeydown = () => {
  14246. focusReason.value = "keyboard";
  14247. lastUserFocusTimestamp.value = window.performance.now();
  14248. };
  14249. const useFocusReason = () => {
  14250. onMounted(() => {
  14251. if (focusReasonUserCount === 0) {
  14252. document.addEventListener("mousedown", notifyFocusReasonPointer);
  14253. document.addEventListener("touchstart", notifyFocusReasonPointer);
  14254. document.addEventListener("keydown", notifyFocusReasonKeydown);
  14255. }
  14256. focusReasonUserCount++;
  14257. });
  14258. onBeforeUnmount(() => {
  14259. focusReasonUserCount--;
  14260. if (focusReasonUserCount <= 0) {
  14261. document.removeEventListener("mousedown", notifyFocusReasonPointer);
  14262. document.removeEventListener("touchstart", notifyFocusReasonPointer);
  14263. document.removeEventListener("keydown", notifyFocusReasonKeydown);
  14264. }
  14265. });
  14266. return {
  14267. focusReason,
  14268. lastUserFocusTimestamp,
  14269. lastAutomatedFocusTimestamp
  14270. };
  14271. };
  14272. const createFocusOutPreventedEvent = (detail) => {
  14273. return new CustomEvent(FOCUSOUT_PREVENTED, {
  14274. ...FOCUSOUT_PREVENTED_OPTS,
  14275. detail
  14276. });
  14277. };
  14278. const _sfc_main$2l = defineComponent({
  14279. name: "ElFocusTrap",
  14280. inheritAttrs: false,
  14281. props: {
  14282. loop: Boolean,
  14283. trapped: Boolean,
  14284. focusTrapEl: Object,
  14285. focusStartEl: {
  14286. type: [Object, String],
  14287. default: "first"
  14288. }
  14289. },
  14290. emits: [
  14291. ON_TRAP_FOCUS_EVT,
  14292. ON_RELEASE_FOCUS_EVT,
  14293. "focusin",
  14294. "focusout",
  14295. "focusout-prevented",
  14296. "release-requested"
  14297. ],
  14298. setup(props, { emit }) {
  14299. const forwardRef = ref();
  14300. let lastFocusBeforeTrapped;
  14301. let lastFocusAfterTrapped;
  14302. const { focusReason } = useFocusReason();
  14303. useEscapeKeydown((event) => {
  14304. if (props.trapped && !focusLayer.paused) {
  14305. emit("release-requested", event);
  14306. }
  14307. });
  14308. const focusLayer = {
  14309. paused: false,
  14310. pause() {
  14311. this.paused = true;
  14312. },
  14313. resume() {
  14314. this.paused = false;
  14315. }
  14316. };
  14317. const onKeydown = (e) => {
  14318. if (!props.loop && !props.trapped)
  14319. return;
  14320. if (focusLayer.paused)
  14321. return;
  14322. const { code, altKey, ctrlKey, metaKey, currentTarget, shiftKey } = e;
  14323. const { loop } = props;
  14324. const isTabbing = code === EVENT_CODE.tab && !altKey && !ctrlKey && !metaKey;
  14325. const currentFocusingEl = document.activeElement;
  14326. if (isTabbing && currentFocusingEl) {
  14327. const container = currentTarget;
  14328. const [first, last] = getEdges(container);
  14329. const isTabbable = first && last;
  14330. if (!isTabbable) {
  14331. if (currentFocusingEl === container) {
  14332. const focusoutPreventedEvent = createFocusOutPreventedEvent({
  14333. focusReason: focusReason.value
  14334. });
  14335. emit("focusout-prevented", focusoutPreventedEvent);
  14336. if (!focusoutPreventedEvent.defaultPrevented) {
  14337. e.preventDefault();
  14338. }
  14339. }
  14340. } else {
  14341. if (!shiftKey && currentFocusingEl === last) {
  14342. const focusoutPreventedEvent = createFocusOutPreventedEvent({
  14343. focusReason: focusReason.value
  14344. });
  14345. emit("focusout-prevented", focusoutPreventedEvent);
  14346. if (!focusoutPreventedEvent.defaultPrevented) {
  14347. e.preventDefault();
  14348. if (loop)
  14349. tryFocus(first, true);
  14350. }
  14351. } else if (shiftKey && [first, container].includes(currentFocusingEl)) {
  14352. const focusoutPreventedEvent = createFocusOutPreventedEvent({
  14353. focusReason: focusReason.value
  14354. });
  14355. emit("focusout-prevented", focusoutPreventedEvent);
  14356. if (!focusoutPreventedEvent.defaultPrevented) {
  14357. e.preventDefault();
  14358. if (loop)
  14359. tryFocus(last, true);
  14360. }
  14361. }
  14362. }
  14363. }
  14364. };
  14365. provide(FOCUS_TRAP_INJECTION_KEY, {
  14366. focusTrapRef: forwardRef,
  14367. onKeydown
  14368. });
  14369. watch(() => props.focusTrapEl, (focusTrapEl) => {
  14370. if (focusTrapEl) {
  14371. forwardRef.value = focusTrapEl;
  14372. }
  14373. }, { immediate: true });
  14374. watch([forwardRef], ([forwardRef2], [oldForwardRef]) => {
  14375. if (forwardRef2) {
  14376. forwardRef2.addEventListener("keydown", onKeydown);
  14377. forwardRef2.addEventListener("focusin", onFocusIn);
  14378. forwardRef2.addEventListener("focusout", onFocusOut);
  14379. }
  14380. if (oldForwardRef) {
  14381. oldForwardRef.removeEventListener("keydown", onKeydown);
  14382. oldForwardRef.removeEventListener("focusin", onFocusIn);
  14383. oldForwardRef.removeEventListener("focusout", onFocusOut);
  14384. }
  14385. });
  14386. const trapOnFocus = (e) => {
  14387. emit(ON_TRAP_FOCUS_EVT, e);
  14388. };
  14389. const releaseOnFocus = (e) => emit(ON_RELEASE_FOCUS_EVT, e);
  14390. const onFocusIn = (e) => {
  14391. const trapContainer = unref(forwardRef);
  14392. if (!trapContainer)
  14393. return;
  14394. const target = e.target;
  14395. const relatedTarget = e.relatedTarget;
  14396. const isFocusedInTrap = target && trapContainer.contains(target);
  14397. if (!props.trapped) {
  14398. const isPrevFocusedInTrap = relatedTarget && trapContainer.contains(relatedTarget);
  14399. if (!isPrevFocusedInTrap) {
  14400. lastFocusBeforeTrapped = relatedTarget;
  14401. }
  14402. }
  14403. if (isFocusedInTrap)
  14404. emit("focusin", e);
  14405. if (focusLayer.paused)
  14406. return;
  14407. if (props.trapped) {
  14408. if (isFocusedInTrap) {
  14409. lastFocusAfterTrapped = target;
  14410. } else {
  14411. tryFocus(lastFocusAfterTrapped, true);
  14412. }
  14413. }
  14414. };
  14415. const onFocusOut = (e) => {
  14416. const trapContainer = unref(forwardRef);
  14417. if (focusLayer.paused || !trapContainer)
  14418. return;
  14419. if (props.trapped) {
  14420. const relatedTarget = e.relatedTarget;
  14421. if (!isNil(relatedTarget) && !trapContainer.contains(relatedTarget)) {
  14422. setTimeout(() => {
  14423. if (!focusLayer.paused && props.trapped) {
  14424. const focusoutPreventedEvent = createFocusOutPreventedEvent({
  14425. focusReason: focusReason.value
  14426. });
  14427. emit("focusout-prevented", focusoutPreventedEvent);
  14428. if (!focusoutPreventedEvent.defaultPrevented) {
  14429. tryFocus(lastFocusAfterTrapped, true);
  14430. }
  14431. }
  14432. }, 0);
  14433. }
  14434. } else {
  14435. const target = e.target;
  14436. const isFocusedInTrap = target && trapContainer.contains(target);
  14437. if (!isFocusedInTrap)
  14438. emit("focusout", e);
  14439. }
  14440. };
  14441. async function startTrap() {
  14442. await nextTick();
  14443. const trapContainer = unref(forwardRef);
  14444. if (trapContainer) {
  14445. focusableStack.push(focusLayer);
  14446. const prevFocusedElement = trapContainer.contains(document.activeElement) ? lastFocusBeforeTrapped : document.activeElement;
  14447. lastFocusBeforeTrapped = prevFocusedElement;
  14448. const isPrevFocusContained = trapContainer.contains(prevFocusedElement);
  14449. if (!isPrevFocusContained) {
  14450. const focusEvent = new Event(FOCUS_AFTER_TRAPPED, FOCUS_AFTER_TRAPPED_OPTS);
  14451. trapContainer.addEventListener(FOCUS_AFTER_TRAPPED, trapOnFocus);
  14452. trapContainer.dispatchEvent(focusEvent);
  14453. if (!focusEvent.defaultPrevented) {
  14454. nextTick(() => {
  14455. let focusStartEl = props.focusStartEl;
  14456. if (!isString$1(focusStartEl)) {
  14457. tryFocus(focusStartEl);
  14458. if (document.activeElement !== focusStartEl) {
  14459. focusStartEl = "first";
  14460. }
  14461. }
  14462. if (focusStartEl === "first") {
  14463. focusFirstDescendant(obtainAllFocusableElements(trapContainer), true);
  14464. }
  14465. if (document.activeElement === prevFocusedElement || focusStartEl === "container") {
  14466. tryFocus(trapContainer);
  14467. }
  14468. });
  14469. }
  14470. }
  14471. }
  14472. }
  14473. function stopTrap() {
  14474. const trapContainer = unref(forwardRef);
  14475. if (trapContainer) {
  14476. trapContainer.removeEventListener(FOCUS_AFTER_TRAPPED, trapOnFocus);
  14477. const releasedEvent = new CustomEvent(FOCUS_AFTER_RELEASED, {
  14478. ...FOCUS_AFTER_TRAPPED_OPTS,
  14479. detail: {
  14480. focusReason: focusReason.value
  14481. }
  14482. });
  14483. trapContainer.addEventListener(FOCUS_AFTER_RELEASED, releaseOnFocus);
  14484. trapContainer.dispatchEvent(releasedEvent);
  14485. if (!releasedEvent.defaultPrevented && (focusReason.value == "keyboard" || !isFocusCausedByUserEvent() || trapContainer.contains(document.activeElement))) {
  14486. tryFocus(lastFocusBeforeTrapped != null ? lastFocusBeforeTrapped : document.body);
  14487. }
  14488. trapContainer.removeEventListener(FOCUS_AFTER_RELEASED, releaseOnFocus);
  14489. focusableStack.remove(focusLayer);
  14490. }
  14491. }
  14492. onMounted(() => {
  14493. if (props.trapped) {
  14494. startTrap();
  14495. }
  14496. watch(() => props.trapped, (trapped) => {
  14497. if (trapped) {
  14498. startTrap();
  14499. } else {
  14500. stopTrap();
  14501. }
  14502. });
  14503. });
  14504. onBeforeUnmount(() => {
  14505. if (props.trapped) {
  14506. stopTrap();
  14507. }
  14508. if (forwardRef.value) {
  14509. forwardRef.value.removeEventListener("keydown", onKeydown);
  14510. forwardRef.value.removeEventListener("focusin", onFocusIn);
  14511. forwardRef.value.removeEventListener("focusout", onFocusOut);
  14512. forwardRef.value = void 0;
  14513. }
  14514. });
  14515. return {
  14516. onKeydown
  14517. };
  14518. }
  14519. });
  14520. function _sfc_render$r(_ctx, _cache, $props, $setup, $data, $options) {
  14521. return renderSlot(_ctx.$slots, "default", { handleKeydown: _ctx.onKeydown });
  14522. }
  14523. var ElFocusTrap = /* @__PURE__ */ _export_sfc(_sfc_main$2l, [["render", _sfc_render$r], ["__file", "focus-trap.vue"]]);
  14524. const POSITIONING_STRATEGIES = ["fixed", "absolute"];
  14525. const popperCoreConfigProps = buildProps({
  14526. boundariesPadding: {
  14527. type: Number,
  14528. default: 0
  14529. },
  14530. fallbackPlacements: {
  14531. type: definePropType(Array),
  14532. default: void 0
  14533. },
  14534. gpuAcceleration: {
  14535. type: Boolean,
  14536. default: true
  14537. },
  14538. offset: {
  14539. type: Number,
  14540. default: 12
  14541. },
  14542. placement: {
  14543. type: String,
  14544. values: Ee,
  14545. default: "bottom"
  14546. },
  14547. popperOptions: {
  14548. type: definePropType(Object),
  14549. default: () => ({})
  14550. },
  14551. strategy: {
  14552. type: String,
  14553. values: POSITIONING_STRATEGIES,
  14554. default: "absolute"
  14555. }
  14556. });
  14557. const popperContentProps = buildProps({
  14558. ...popperCoreConfigProps,
  14559. id: String,
  14560. style: {
  14561. type: definePropType([String, Array, Object])
  14562. },
  14563. className: {
  14564. type: definePropType([String, Array, Object])
  14565. },
  14566. effect: {
  14567. type: definePropType(String),
  14568. default: "dark"
  14569. },
  14570. visible: Boolean,
  14571. enterable: {
  14572. type: Boolean,
  14573. default: true
  14574. },
  14575. pure: Boolean,
  14576. focusOnShow: {
  14577. type: Boolean,
  14578. default: false
  14579. },
  14580. trapping: {
  14581. type: Boolean,
  14582. default: false
  14583. },
  14584. popperClass: {
  14585. type: definePropType([String, Array, Object])
  14586. },
  14587. popperStyle: {
  14588. type: definePropType([String, Array, Object])
  14589. },
  14590. referenceEl: {
  14591. type: definePropType(Object)
  14592. },
  14593. triggerTargetEl: {
  14594. type: definePropType(Object)
  14595. },
  14596. stopPopperMouseEvent: {
  14597. type: Boolean,
  14598. default: true
  14599. },
  14600. virtualTriggering: Boolean,
  14601. zIndex: Number,
  14602. ...useAriaProps(["ariaLabel"])
  14603. });
  14604. const popperContentEmits = {
  14605. mouseenter: (evt) => evt instanceof MouseEvent,
  14606. mouseleave: (evt) => evt instanceof MouseEvent,
  14607. focus: () => true,
  14608. blur: () => true,
  14609. close: () => true
  14610. };
  14611. const usePopperCoreConfigProps = popperCoreConfigProps;
  14612. const usePopperContentProps = popperContentProps;
  14613. const usePopperContentEmits = popperContentEmits;
  14614. const buildPopperOptions = (props, modifiers = []) => {
  14615. const { placement, strategy, popperOptions } = props;
  14616. const options = {
  14617. placement,
  14618. strategy,
  14619. ...popperOptions,
  14620. modifiers: [...genModifiers(props), ...modifiers]
  14621. };
  14622. deriveExtraModifiers(options, popperOptions == null ? void 0 : popperOptions.modifiers);
  14623. return options;
  14624. };
  14625. const unwrapMeasurableEl = ($el) => {
  14626. if (!isClient)
  14627. return;
  14628. return unrefElement($el);
  14629. };
  14630. function genModifiers(options) {
  14631. const { offset, gpuAcceleration, fallbackPlacements } = options;
  14632. return [
  14633. {
  14634. name: "offset",
  14635. options: {
  14636. offset: [0, offset != null ? offset : 12]
  14637. }
  14638. },
  14639. {
  14640. name: "preventOverflow",
  14641. options: {
  14642. padding: {
  14643. top: 2,
  14644. bottom: 2,
  14645. left: 5,
  14646. right: 5
  14647. }
  14648. }
  14649. },
  14650. {
  14651. name: "flip",
  14652. options: {
  14653. padding: 5,
  14654. fallbackPlacements
  14655. }
  14656. },
  14657. {
  14658. name: "computeStyles",
  14659. options: {
  14660. gpuAcceleration
  14661. }
  14662. }
  14663. ];
  14664. }
  14665. function deriveExtraModifiers(options, modifiers) {
  14666. if (modifiers) {
  14667. options.modifiers = [...options.modifiers, ...modifiers != null ? modifiers : []];
  14668. }
  14669. }
  14670. const DEFAULT_ARROW_OFFSET = 0;
  14671. const usePopperContent = (props) => {
  14672. const { popperInstanceRef, contentRef, triggerRef, role } = inject(POPPER_INJECTION_KEY, void 0);
  14673. const arrowRef = ref();
  14674. const arrowOffset = ref();
  14675. const eventListenerModifier = computed(() => {
  14676. return {
  14677. name: "eventListeners",
  14678. enabled: !!props.visible
  14679. };
  14680. });
  14681. const arrowModifier = computed(() => {
  14682. var _a;
  14683. const arrowEl = unref(arrowRef);
  14684. const offset = (_a = unref(arrowOffset)) != null ? _a : DEFAULT_ARROW_OFFSET;
  14685. return {
  14686. name: "arrow",
  14687. enabled: !isUndefined$1(arrowEl),
  14688. options: {
  14689. element: arrowEl,
  14690. padding: offset
  14691. }
  14692. };
  14693. });
  14694. const options = computed(() => {
  14695. return {
  14696. onFirstUpdate: () => {
  14697. update();
  14698. },
  14699. ...buildPopperOptions(props, [
  14700. unref(arrowModifier),
  14701. unref(eventListenerModifier)
  14702. ])
  14703. };
  14704. });
  14705. const computedReference = computed(() => unwrapMeasurableEl(props.referenceEl) || unref(triggerRef));
  14706. const { attributes, state, styles, update, forceUpdate, instanceRef } = usePopper(computedReference, contentRef, options);
  14707. watch(instanceRef, (instance) => popperInstanceRef.value = instance);
  14708. onMounted(() => {
  14709. watch(() => {
  14710. var _a;
  14711. return (_a = unref(computedReference)) == null ? void 0 : _a.getBoundingClientRect();
  14712. }, () => {
  14713. update();
  14714. });
  14715. });
  14716. return {
  14717. attributes,
  14718. arrowRef,
  14719. contentRef,
  14720. instanceRef,
  14721. state,
  14722. styles,
  14723. role,
  14724. forceUpdate,
  14725. update
  14726. };
  14727. };
  14728. const usePopperContentDOM = (props, {
  14729. attributes,
  14730. styles,
  14731. role
  14732. }) => {
  14733. const { nextZIndex } = useZIndex();
  14734. const ns = useNamespace("popper");
  14735. const contentAttrs = computed(() => unref(attributes).popper);
  14736. const contentZIndex = ref(isNumber(props.zIndex) ? props.zIndex : nextZIndex());
  14737. const contentClass = computed(() => [
  14738. ns.b(),
  14739. ns.is("pure", props.pure),
  14740. ns.is(props.effect),
  14741. props.popperClass
  14742. ]);
  14743. const contentStyle = computed(() => {
  14744. return [
  14745. { zIndex: unref(contentZIndex) },
  14746. unref(styles).popper,
  14747. props.popperStyle || {}
  14748. ];
  14749. });
  14750. const ariaModal = computed(() => role.value === "dialog" ? "false" : void 0);
  14751. const arrowStyle = computed(() => unref(styles).arrow || {});
  14752. const updateZIndex = () => {
  14753. contentZIndex.value = isNumber(props.zIndex) ? props.zIndex : nextZIndex();
  14754. };
  14755. return {
  14756. ariaModal,
  14757. arrowStyle,
  14758. contentAttrs,
  14759. contentClass,
  14760. contentStyle,
  14761. contentZIndex,
  14762. updateZIndex
  14763. };
  14764. };
  14765. const usePopperContentFocusTrap = (props, emit) => {
  14766. const trapped = ref(false);
  14767. const focusStartRef = ref();
  14768. const onFocusAfterTrapped = () => {
  14769. emit("focus");
  14770. };
  14771. const onFocusAfterReleased = (event) => {
  14772. var _a;
  14773. if (((_a = event.detail) == null ? void 0 : _a.focusReason) !== "pointer") {
  14774. focusStartRef.value = "first";
  14775. emit("blur");
  14776. }
  14777. };
  14778. const onFocusInTrap = (event) => {
  14779. if (props.visible && !trapped.value) {
  14780. if (event.target) {
  14781. focusStartRef.value = event.target;
  14782. }
  14783. trapped.value = true;
  14784. }
  14785. };
  14786. const onFocusoutPrevented = (event) => {
  14787. if (!props.trapping) {
  14788. if (event.detail.focusReason === "pointer") {
  14789. event.preventDefault();
  14790. }
  14791. trapped.value = false;
  14792. }
  14793. };
  14794. const onReleaseRequested = () => {
  14795. trapped.value = false;
  14796. emit("close");
  14797. };
  14798. return {
  14799. focusStartRef,
  14800. trapped,
  14801. onFocusAfterReleased,
  14802. onFocusAfterTrapped,
  14803. onFocusInTrap,
  14804. onFocusoutPrevented,
  14805. onReleaseRequested
  14806. };
  14807. };
  14808. const __default__$1K = defineComponent({
  14809. name: "ElPopperContent"
  14810. });
  14811. const _sfc_main$2k = /* @__PURE__ */ defineComponent({
  14812. ...__default__$1K,
  14813. props: popperContentProps,
  14814. emits: popperContentEmits,
  14815. setup(__props, { expose, emit }) {
  14816. const props = __props;
  14817. const {
  14818. focusStartRef,
  14819. trapped,
  14820. onFocusAfterReleased,
  14821. onFocusAfterTrapped,
  14822. onFocusInTrap,
  14823. onFocusoutPrevented,
  14824. onReleaseRequested
  14825. } = usePopperContentFocusTrap(props, emit);
  14826. const { attributes, arrowRef, contentRef, styles, instanceRef, role, update } = usePopperContent(props);
  14827. const {
  14828. ariaModal,
  14829. arrowStyle,
  14830. contentAttrs,
  14831. contentClass,
  14832. contentStyle,
  14833. updateZIndex
  14834. } = usePopperContentDOM(props, {
  14835. styles,
  14836. attributes,
  14837. role
  14838. });
  14839. const formItemContext = inject(formItemContextKey, void 0);
  14840. const arrowOffset = ref();
  14841. provide(POPPER_CONTENT_INJECTION_KEY, {
  14842. arrowStyle,
  14843. arrowRef,
  14844. arrowOffset
  14845. });
  14846. if (formItemContext) {
  14847. provide(formItemContextKey, {
  14848. ...formItemContext,
  14849. addInputId: NOOP,
  14850. removeInputId: NOOP
  14851. });
  14852. }
  14853. let triggerTargetAriaStopWatch = void 0;
  14854. const updatePopper = (shouldUpdateZIndex = true) => {
  14855. update();
  14856. shouldUpdateZIndex && updateZIndex();
  14857. };
  14858. const togglePopperAlive = () => {
  14859. updatePopper(false);
  14860. if (props.visible && props.focusOnShow) {
  14861. trapped.value = true;
  14862. } else if (props.visible === false) {
  14863. trapped.value = false;
  14864. }
  14865. };
  14866. onMounted(() => {
  14867. watch(() => props.triggerTargetEl, (triggerTargetEl, prevTriggerTargetEl) => {
  14868. triggerTargetAriaStopWatch == null ? void 0 : triggerTargetAriaStopWatch();
  14869. triggerTargetAriaStopWatch = void 0;
  14870. const el = unref(triggerTargetEl || contentRef.value);
  14871. const prevEl = unref(prevTriggerTargetEl || contentRef.value);
  14872. if (isElement$1(el)) {
  14873. triggerTargetAriaStopWatch = watch([role, () => props.ariaLabel, ariaModal, () => props.id], (watches) => {
  14874. ["role", "aria-label", "aria-modal", "id"].forEach((key, idx) => {
  14875. isNil(watches[idx]) ? el.removeAttribute(key) : el.setAttribute(key, watches[idx]);
  14876. });
  14877. }, { immediate: true });
  14878. }
  14879. if (prevEl !== el && isElement$1(prevEl)) {
  14880. ["role", "aria-label", "aria-modal", "id"].forEach((key) => {
  14881. prevEl.removeAttribute(key);
  14882. });
  14883. }
  14884. }, { immediate: true });
  14885. watch(() => props.visible, togglePopperAlive, { immediate: true });
  14886. });
  14887. onBeforeUnmount(() => {
  14888. triggerTargetAriaStopWatch == null ? void 0 : triggerTargetAriaStopWatch();
  14889. triggerTargetAriaStopWatch = void 0;
  14890. });
  14891. expose({
  14892. popperContentRef: contentRef,
  14893. popperInstanceRef: instanceRef,
  14894. updatePopper,
  14895. contentStyle
  14896. });
  14897. return (_ctx, _cache) => {
  14898. return openBlock(), createElementBlock("div", mergeProps({
  14899. ref_key: "contentRef",
  14900. ref: contentRef
  14901. }, unref(contentAttrs), {
  14902. style: unref(contentStyle),
  14903. class: unref(contentClass),
  14904. tabindex: "-1",
  14905. onMouseenter: (e) => _ctx.$emit("mouseenter", e),
  14906. onMouseleave: (e) => _ctx.$emit("mouseleave", e)
  14907. }), [
  14908. createVNode(unref(ElFocusTrap), {
  14909. trapped: unref(trapped),
  14910. "trap-on-focus-in": true,
  14911. "focus-trap-el": unref(contentRef),
  14912. "focus-start-el": unref(focusStartRef),
  14913. onFocusAfterTrapped: unref(onFocusAfterTrapped),
  14914. onFocusAfterReleased: unref(onFocusAfterReleased),
  14915. onFocusin: unref(onFocusInTrap),
  14916. onFocusoutPrevented: unref(onFocusoutPrevented),
  14917. onReleaseRequested: unref(onReleaseRequested)
  14918. }, {
  14919. default: withCtx(() => [
  14920. renderSlot(_ctx.$slots, "default")
  14921. ]),
  14922. _: 3
  14923. }, 8, ["trapped", "focus-trap-el", "focus-start-el", "onFocusAfterTrapped", "onFocusAfterReleased", "onFocusin", "onFocusoutPrevented", "onReleaseRequested"])
  14924. ], 16, ["onMouseenter", "onMouseleave"]);
  14925. };
  14926. }
  14927. });
  14928. var ElPopperContent = /* @__PURE__ */ _export_sfc(_sfc_main$2k, [["__file", "content.vue"]]);
  14929. const ElPopper = withInstall(Popper);
  14930. const TOOLTIP_INJECTION_KEY = Symbol("elTooltip");
  14931. const useTooltipContentProps = buildProps({
  14932. ...useDelayedToggleProps,
  14933. ...popperContentProps,
  14934. appendTo: {
  14935. type: definePropType([String, Object])
  14936. },
  14937. content: {
  14938. type: String,
  14939. default: ""
  14940. },
  14941. rawContent: Boolean,
  14942. persistent: Boolean,
  14943. visible: {
  14944. type: definePropType(Boolean),
  14945. default: null
  14946. },
  14947. transition: String,
  14948. teleported: {
  14949. type: Boolean,
  14950. default: true
  14951. },
  14952. disabled: Boolean,
  14953. ...useAriaProps(["ariaLabel"])
  14954. });
  14955. const useTooltipTriggerProps = buildProps({
  14956. ...popperTriggerProps,
  14957. disabled: Boolean,
  14958. trigger: {
  14959. type: definePropType([String, Array]),
  14960. default: "hover"
  14961. },
  14962. triggerKeys: {
  14963. type: definePropType(Array),
  14964. default: () => [EVENT_CODE.enter, EVENT_CODE.numpadEnter, EVENT_CODE.space]
  14965. }
  14966. });
  14967. const {
  14968. useModelToggleProps: useTooltipModelToggleProps,
  14969. useModelToggleEmits: useTooltipModelToggleEmits,
  14970. useModelToggle: useTooltipModelToggle
  14971. } = createModelToggleComposable("visible");
  14972. const useTooltipProps = buildProps({
  14973. ...popperProps,
  14974. ...useTooltipModelToggleProps,
  14975. ...useTooltipContentProps,
  14976. ...useTooltipTriggerProps,
  14977. ...popperArrowProps,
  14978. showArrow: {
  14979. type: Boolean,
  14980. default: true
  14981. }
  14982. });
  14983. const tooltipEmits = [
  14984. ...useTooltipModelToggleEmits,
  14985. "before-show",
  14986. "before-hide",
  14987. "show",
  14988. "hide",
  14989. "open",
  14990. "close"
  14991. ];
  14992. const isTriggerType = (trigger, type) => {
  14993. if (isArray$1(trigger)) {
  14994. return trigger.includes(type);
  14995. }
  14996. return trigger === type;
  14997. };
  14998. const whenTrigger = (trigger, type, handler) => {
  14999. return (e) => {
  15000. isTriggerType(unref(trigger), type) && handler(e);
  15001. };
  15002. };
  15003. const __default__$1J = defineComponent({
  15004. name: "ElTooltipTrigger"
  15005. });
  15006. const _sfc_main$2j = /* @__PURE__ */ defineComponent({
  15007. ...__default__$1J,
  15008. props: useTooltipTriggerProps,
  15009. setup(__props, { expose }) {
  15010. const props = __props;
  15011. const ns = useNamespace("tooltip");
  15012. const { controlled, id, open, onOpen, onClose, onToggle } = inject(TOOLTIP_INJECTION_KEY, void 0);
  15013. const triggerRef = ref(null);
  15014. const stopWhenControlledOrDisabled = () => {
  15015. if (unref(controlled) || props.disabled) {
  15016. return true;
  15017. }
  15018. };
  15019. const trigger = toRef(props, "trigger");
  15020. const onMouseenter = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "hover", onOpen));
  15021. const onMouseleave = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "hover", onClose));
  15022. const onClick = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "click", (e) => {
  15023. if (e.button === 0) {
  15024. onToggle(e);
  15025. }
  15026. }));
  15027. const onFocus = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "focus", onOpen));
  15028. const onBlur = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "focus", onClose));
  15029. const onContextMenu = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "contextmenu", (e) => {
  15030. e.preventDefault();
  15031. onToggle(e);
  15032. }));
  15033. const onKeydown = composeEventHandlers(stopWhenControlledOrDisabled, (e) => {
  15034. const { code } = e;
  15035. if (props.triggerKeys.includes(code)) {
  15036. e.preventDefault();
  15037. onToggle(e);
  15038. }
  15039. });
  15040. expose({
  15041. triggerRef
  15042. });
  15043. return (_ctx, _cache) => {
  15044. return openBlock(), createBlock(unref(ElPopperTrigger), {
  15045. id: unref(id),
  15046. "virtual-ref": _ctx.virtualRef,
  15047. open: unref(open),
  15048. "virtual-triggering": _ctx.virtualTriggering,
  15049. class: normalizeClass(unref(ns).e("trigger")),
  15050. onBlur: unref(onBlur),
  15051. onClick: unref(onClick),
  15052. onContextmenu: unref(onContextMenu),
  15053. onFocus: unref(onFocus),
  15054. onMouseenter: unref(onMouseenter),
  15055. onMouseleave: unref(onMouseleave),
  15056. onKeydown: unref(onKeydown)
  15057. }, {
  15058. default: withCtx(() => [
  15059. renderSlot(_ctx.$slots, "default")
  15060. ]),
  15061. _: 3
  15062. }, 8, ["id", "virtual-ref", "open", "virtual-triggering", "class", "onBlur", "onClick", "onContextmenu", "onFocus", "onMouseenter", "onMouseleave", "onKeydown"]);
  15063. };
  15064. }
  15065. });
  15066. var ElTooltipTrigger = /* @__PURE__ */ _export_sfc(_sfc_main$2j, [["__file", "trigger.vue"]]);
  15067. const teleportProps = buildProps({
  15068. to: {
  15069. type: definePropType([String, Object]),
  15070. required: true
  15071. },
  15072. disabled: Boolean
  15073. });
  15074. const _sfc_main$2i = /* @__PURE__ */ defineComponent({
  15075. __name: "teleport",
  15076. props: teleportProps,
  15077. setup(__props) {
  15078. return (_ctx, _cache) => {
  15079. return _ctx.disabled ? renderSlot(_ctx.$slots, "default", { key: 0 }) : (openBlock(), createBlock(Teleport$1, {
  15080. key: 1,
  15081. to: _ctx.to
  15082. }, [
  15083. renderSlot(_ctx.$slots, "default")
  15084. ], 8, ["to"]));
  15085. };
  15086. }
  15087. });
  15088. var Teleport = /* @__PURE__ */ _export_sfc(_sfc_main$2i, [["__file", "teleport.vue"]]);
  15089. const ElTeleport = withInstall(Teleport);
  15090. var ElTeleport$1 = ElTeleport;
  15091. const __default__$1I = defineComponent({
  15092. name: "ElTooltipContent",
  15093. inheritAttrs: false
  15094. });
  15095. const _sfc_main$2h = /* @__PURE__ */ defineComponent({
  15096. ...__default__$1I,
  15097. props: useTooltipContentProps,
  15098. setup(__props, { expose }) {
  15099. const props = __props;
  15100. const { selector } = usePopperContainerId();
  15101. const ns = useNamespace("tooltip");
  15102. const contentRef = ref();
  15103. let stopHandle;
  15104. const {
  15105. controlled,
  15106. id,
  15107. open,
  15108. trigger,
  15109. onClose,
  15110. onOpen,
  15111. onShow,
  15112. onHide,
  15113. onBeforeShow,
  15114. onBeforeHide
  15115. } = inject(TOOLTIP_INJECTION_KEY, void 0);
  15116. const transitionClass = computed(() => {
  15117. return props.transition || `${ns.namespace.value}-fade-in-linear`;
  15118. });
  15119. const persistentRef = computed(() => {
  15120. return props.persistent;
  15121. });
  15122. onBeforeUnmount(() => {
  15123. stopHandle == null ? void 0 : stopHandle();
  15124. });
  15125. const shouldRender = computed(() => {
  15126. return unref(persistentRef) ? true : unref(open);
  15127. });
  15128. const shouldShow = computed(() => {
  15129. return props.disabled ? false : unref(open);
  15130. });
  15131. const appendTo = computed(() => {
  15132. return props.appendTo || selector.value;
  15133. });
  15134. const contentStyle = computed(() => {
  15135. var _a;
  15136. return (_a = props.style) != null ? _a : {};
  15137. });
  15138. const ariaHidden = ref(true);
  15139. const onTransitionLeave = () => {
  15140. onHide();
  15141. isFocusInsideContent() && tryFocus(document.body);
  15142. ariaHidden.value = true;
  15143. };
  15144. const stopWhenControlled = () => {
  15145. if (unref(controlled))
  15146. return true;
  15147. };
  15148. const onContentEnter = composeEventHandlers(stopWhenControlled, () => {
  15149. if (props.enterable && unref(trigger) === "hover") {
  15150. onOpen();
  15151. }
  15152. });
  15153. const onContentLeave = composeEventHandlers(stopWhenControlled, () => {
  15154. if (unref(trigger) === "hover") {
  15155. onClose();
  15156. }
  15157. });
  15158. const onBeforeEnter = () => {
  15159. var _a, _b;
  15160. (_b = (_a = contentRef.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a);
  15161. onBeforeShow == null ? void 0 : onBeforeShow();
  15162. };
  15163. const onBeforeLeave = () => {
  15164. onBeforeHide == null ? void 0 : onBeforeHide();
  15165. };
  15166. const onAfterShow = () => {
  15167. onShow();
  15168. stopHandle = onClickOutside(computed(() => {
  15169. var _a;
  15170. return (_a = contentRef.value) == null ? void 0 : _a.popperContentRef;
  15171. }), () => {
  15172. if (unref(controlled))
  15173. return;
  15174. const $trigger = unref(trigger);
  15175. if ($trigger !== "hover") {
  15176. onClose();
  15177. }
  15178. });
  15179. };
  15180. const onBlur = () => {
  15181. if (!props.virtualTriggering) {
  15182. onClose();
  15183. }
  15184. };
  15185. const isFocusInsideContent = (event) => {
  15186. var _a;
  15187. const popperContent = (_a = contentRef.value) == null ? void 0 : _a.popperContentRef;
  15188. const activeElement = (event == null ? void 0 : event.relatedTarget) || document.activeElement;
  15189. return popperContent == null ? void 0 : popperContent.contains(activeElement);
  15190. };
  15191. watch(() => unref(open), (val) => {
  15192. if (!val) {
  15193. stopHandle == null ? void 0 : stopHandle();
  15194. } else {
  15195. ariaHidden.value = false;
  15196. }
  15197. }, {
  15198. flush: "post"
  15199. });
  15200. watch(() => props.content, () => {
  15201. var _a, _b;
  15202. (_b = (_a = contentRef.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a);
  15203. });
  15204. expose({
  15205. contentRef,
  15206. isFocusInsideContent
  15207. });
  15208. return (_ctx, _cache) => {
  15209. return openBlock(), createBlock(unref(ElTeleport$1), {
  15210. disabled: !_ctx.teleported,
  15211. to: unref(appendTo)
  15212. }, {
  15213. default: withCtx(() => [
  15214. createVNode(Transition, {
  15215. name: unref(transitionClass),
  15216. onAfterLeave: onTransitionLeave,
  15217. onBeforeEnter,
  15218. onAfterEnter: onAfterShow,
  15219. onBeforeLeave
  15220. }, {
  15221. default: withCtx(() => [
  15222. unref(shouldRender) ? withDirectives((openBlock(), createBlock(unref(ElPopperContent), mergeProps({
  15223. key: 0,
  15224. id: unref(id),
  15225. ref_key: "contentRef",
  15226. ref: contentRef
  15227. }, _ctx.$attrs, {
  15228. "aria-label": _ctx.ariaLabel,
  15229. "aria-hidden": ariaHidden.value,
  15230. "boundaries-padding": _ctx.boundariesPadding,
  15231. "fallback-placements": _ctx.fallbackPlacements,
  15232. "gpu-acceleration": _ctx.gpuAcceleration,
  15233. offset: _ctx.offset,
  15234. placement: _ctx.placement,
  15235. "popper-options": _ctx.popperOptions,
  15236. strategy: _ctx.strategy,
  15237. effect: _ctx.effect,
  15238. enterable: _ctx.enterable,
  15239. pure: _ctx.pure,
  15240. "popper-class": _ctx.popperClass,
  15241. "popper-style": [_ctx.popperStyle, unref(contentStyle)],
  15242. "reference-el": _ctx.referenceEl,
  15243. "trigger-target-el": _ctx.triggerTargetEl,
  15244. visible: unref(shouldShow),
  15245. "z-index": _ctx.zIndex,
  15246. onMouseenter: unref(onContentEnter),
  15247. onMouseleave: unref(onContentLeave),
  15248. onBlur,
  15249. onClose: unref(onClose)
  15250. }), {
  15251. default: withCtx(() => [
  15252. renderSlot(_ctx.$slots, "default")
  15253. ]),
  15254. _: 3
  15255. }, 16, ["id", "aria-label", "aria-hidden", "boundaries-padding", "fallback-placements", "gpu-acceleration", "offset", "placement", "popper-options", "strategy", "effect", "enterable", "pure", "popper-class", "popper-style", "reference-el", "trigger-target-el", "visible", "z-index", "onMouseenter", "onMouseleave", "onClose"])), [
  15256. [vShow, unref(shouldShow)]
  15257. ]) : createCommentVNode("v-if", true)
  15258. ]),
  15259. _: 3
  15260. }, 8, ["name"])
  15261. ]),
  15262. _: 3
  15263. }, 8, ["disabled", "to"]);
  15264. };
  15265. }
  15266. });
  15267. var ElTooltipContent = /* @__PURE__ */ _export_sfc(_sfc_main$2h, [["__file", "content.vue"]]);
  15268. const __default__$1H = defineComponent({
  15269. name: "ElTooltip"
  15270. });
  15271. const _sfc_main$2g = /* @__PURE__ */ defineComponent({
  15272. ...__default__$1H,
  15273. props: useTooltipProps,
  15274. emits: tooltipEmits,
  15275. setup(__props, { expose, emit }) {
  15276. const props = __props;
  15277. usePopperContainer();
  15278. const id = useId();
  15279. const popperRef = ref();
  15280. const contentRef = ref();
  15281. const updatePopper = () => {
  15282. var _a;
  15283. const popperComponent = unref(popperRef);
  15284. if (popperComponent) {
  15285. (_a = popperComponent.popperInstanceRef) == null ? void 0 : _a.update();
  15286. }
  15287. };
  15288. const open = ref(false);
  15289. const toggleReason = ref();
  15290. const { show, hide, hasUpdateHandler } = useTooltipModelToggle({
  15291. indicator: open,
  15292. toggleReason
  15293. });
  15294. const { onOpen, onClose } = useDelayedToggle({
  15295. showAfter: toRef(props, "showAfter"),
  15296. hideAfter: toRef(props, "hideAfter"),
  15297. autoClose: toRef(props, "autoClose"),
  15298. open: show,
  15299. close: hide
  15300. });
  15301. const controlled = computed(() => isBoolean(props.visible) && !hasUpdateHandler.value);
  15302. provide(TOOLTIP_INJECTION_KEY, {
  15303. controlled,
  15304. id,
  15305. open: readonly(open),
  15306. trigger: toRef(props, "trigger"),
  15307. onOpen: (event) => {
  15308. onOpen(event);
  15309. },
  15310. onClose: (event) => {
  15311. onClose(event);
  15312. },
  15313. onToggle: (event) => {
  15314. if (unref(open)) {
  15315. onClose(event);
  15316. } else {
  15317. onOpen(event);
  15318. }
  15319. },
  15320. onShow: () => {
  15321. emit("show", toggleReason.value);
  15322. },
  15323. onHide: () => {
  15324. emit("hide", toggleReason.value);
  15325. },
  15326. onBeforeShow: () => {
  15327. emit("before-show", toggleReason.value);
  15328. },
  15329. onBeforeHide: () => {
  15330. emit("before-hide", toggleReason.value);
  15331. },
  15332. updatePopper
  15333. });
  15334. watch(() => props.disabled, (disabled) => {
  15335. if (disabled && open.value) {
  15336. open.value = false;
  15337. }
  15338. });
  15339. const isFocusInsideContent = (event) => {
  15340. var _a;
  15341. return (_a = contentRef.value) == null ? void 0 : _a.isFocusInsideContent(event);
  15342. };
  15343. onDeactivated(() => open.value && hide());
  15344. expose({
  15345. popperRef,
  15346. contentRef,
  15347. isFocusInsideContent,
  15348. updatePopper,
  15349. onOpen,
  15350. onClose,
  15351. hide
  15352. });
  15353. return (_ctx, _cache) => {
  15354. return openBlock(), createBlock(unref(ElPopper), {
  15355. ref_key: "popperRef",
  15356. ref: popperRef,
  15357. role: _ctx.role
  15358. }, {
  15359. default: withCtx(() => [
  15360. createVNode(ElTooltipTrigger, {
  15361. disabled: _ctx.disabled,
  15362. trigger: _ctx.trigger,
  15363. "trigger-keys": _ctx.triggerKeys,
  15364. "virtual-ref": _ctx.virtualRef,
  15365. "virtual-triggering": _ctx.virtualTriggering
  15366. }, {
  15367. default: withCtx(() => [
  15368. _ctx.$slots.default ? renderSlot(_ctx.$slots, "default", { key: 0 }) : createCommentVNode("v-if", true)
  15369. ]),
  15370. _: 3
  15371. }, 8, ["disabled", "trigger", "trigger-keys", "virtual-ref", "virtual-triggering"]),
  15372. createVNode(ElTooltipContent, {
  15373. ref_key: "contentRef",
  15374. ref: contentRef,
  15375. "aria-label": _ctx.ariaLabel,
  15376. "boundaries-padding": _ctx.boundariesPadding,
  15377. content: _ctx.content,
  15378. disabled: _ctx.disabled,
  15379. effect: _ctx.effect,
  15380. enterable: _ctx.enterable,
  15381. "fallback-placements": _ctx.fallbackPlacements,
  15382. "hide-after": _ctx.hideAfter,
  15383. "gpu-acceleration": _ctx.gpuAcceleration,
  15384. offset: _ctx.offset,
  15385. persistent: _ctx.persistent,
  15386. "popper-class": _ctx.popperClass,
  15387. "popper-style": _ctx.popperStyle,
  15388. placement: _ctx.placement,
  15389. "popper-options": _ctx.popperOptions,
  15390. pure: _ctx.pure,
  15391. "raw-content": _ctx.rawContent,
  15392. "reference-el": _ctx.referenceEl,
  15393. "trigger-target-el": _ctx.triggerTargetEl,
  15394. "show-after": _ctx.showAfter,
  15395. strategy: _ctx.strategy,
  15396. teleported: _ctx.teleported,
  15397. transition: _ctx.transition,
  15398. "virtual-triggering": _ctx.virtualTriggering,
  15399. "z-index": _ctx.zIndex,
  15400. "append-to": _ctx.appendTo
  15401. }, {
  15402. default: withCtx(() => [
  15403. renderSlot(_ctx.$slots, "content", {}, () => [
  15404. _ctx.rawContent ? (openBlock(), createElementBlock("span", {
  15405. key: 0,
  15406. innerHTML: _ctx.content
  15407. }, null, 8, ["innerHTML"])) : (openBlock(), createElementBlock("span", { key: 1 }, toDisplayString(_ctx.content), 1))
  15408. ]),
  15409. _ctx.showArrow ? (openBlock(), createBlock(unref(ElPopperArrow), {
  15410. key: 0,
  15411. "arrow-offset": _ctx.arrowOffset
  15412. }, null, 8, ["arrow-offset"])) : createCommentVNode("v-if", true)
  15413. ]),
  15414. _: 3
  15415. }, 8, ["aria-label", "boundaries-padding", "content", "disabled", "effect", "enterable", "fallback-placements", "hide-after", "gpu-acceleration", "offset", "persistent", "popper-class", "popper-style", "placement", "popper-options", "pure", "raw-content", "reference-el", "trigger-target-el", "show-after", "strategy", "teleported", "transition", "virtual-triggering", "z-index", "append-to"])
  15416. ]),
  15417. _: 3
  15418. }, 8, ["role"]);
  15419. };
  15420. }
  15421. });
  15422. var Tooltip = /* @__PURE__ */ _export_sfc(_sfc_main$2g, [["__file", "tooltip.vue"]]);
  15423. const ElTooltip = withInstall(Tooltip);
  15424. const autocompleteProps = buildProps({
  15425. valueKey: {
  15426. type: String,
  15427. default: "value"
  15428. },
  15429. modelValue: {
  15430. type: [String, Number],
  15431. default: ""
  15432. },
  15433. debounce: {
  15434. type: Number,
  15435. default: 300
  15436. },
  15437. placement: {
  15438. type: definePropType(String),
  15439. values: [
  15440. "top",
  15441. "top-start",
  15442. "top-end",
  15443. "bottom",
  15444. "bottom-start",
  15445. "bottom-end"
  15446. ],
  15447. default: "bottom-start"
  15448. },
  15449. fetchSuggestions: {
  15450. type: definePropType([Function, Array]),
  15451. default: NOOP
  15452. },
  15453. popperClass: {
  15454. type: String,
  15455. default: ""
  15456. },
  15457. triggerOnFocus: {
  15458. type: Boolean,
  15459. default: true
  15460. },
  15461. selectWhenUnmatched: {
  15462. type: Boolean,
  15463. default: false
  15464. },
  15465. hideLoading: {
  15466. type: Boolean,
  15467. default: false
  15468. },
  15469. teleported: useTooltipContentProps.teleported,
  15470. highlightFirstItem: {
  15471. type: Boolean,
  15472. default: false
  15473. },
  15474. fitInputWidth: {
  15475. type: Boolean,
  15476. default: false
  15477. },
  15478. clearable: {
  15479. type: Boolean,
  15480. default: false
  15481. },
  15482. disabled: {
  15483. type: Boolean,
  15484. default: false
  15485. },
  15486. name: String,
  15487. ...useAriaProps(["ariaLabel"])
  15488. });
  15489. const autocompleteEmits = {
  15490. [UPDATE_MODEL_EVENT]: (value) => isString$1(value),
  15491. [INPUT_EVENT]: (value) => isString$1(value),
  15492. [CHANGE_EVENT]: (value) => isString$1(value),
  15493. focus: (evt) => evt instanceof FocusEvent,
  15494. blur: (evt) => evt instanceof FocusEvent,
  15495. clear: () => true,
  15496. select: (item) => isObject$1(item)
  15497. };
  15498. const COMPONENT_NAME$j = "ElAutocomplete";
  15499. const __default__$1G = defineComponent({
  15500. name: COMPONENT_NAME$j,
  15501. inheritAttrs: false
  15502. });
  15503. const _sfc_main$2f = /* @__PURE__ */ defineComponent({
  15504. ...__default__$1G,
  15505. props: autocompleteProps,
  15506. emits: autocompleteEmits,
  15507. setup(__props, { expose, emit }) {
  15508. const props = __props;
  15509. const attrs = useAttrs();
  15510. const rawAttrs = useAttrs$1();
  15511. const disabled = useFormDisabled();
  15512. const ns = useNamespace("autocomplete");
  15513. const inputRef = ref();
  15514. const regionRef = ref();
  15515. const popperRef = ref();
  15516. const listboxRef = ref();
  15517. let readonly = false;
  15518. let ignoreFocusEvent = false;
  15519. const suggestions = ref([]);
  15520. const highlightedIndex = ref(-1);
  15521. const dropdownWidth = ref("");
  15522. const activated = ref(false);
  15523. const suggestionDisabled = ref(false);
  15524. const loading = ref(false);
  15525. const listboxId = useId();
  15526. const styles = computed(() => rawAttrs.style);
  15527. const suggestionVisible = computed(() => {
  15528. const isValidData = suggestions.value.length > 0;
  15529. return (isValidData || loading.value) && activated.value;
  15530. });
  15531. const suggestionLoading = computed(() => !props.hideLoading && loading.value);
  15532. const refInput = computed(() => {
  15533. if (inputRef.value) {
  15534. return Array.from(inputRef.value.$el.querySelectorAll("input"));
  15535. }
  15536. return [];
  15537. });
  15538. const onSuggestionShow = () => {
  15539. if (suggestionVisible.value) {
  15540. dropdownWidth.value = `${inputRef.value.$el.offsetWidth}px`;
  15541. }
  15542. };
  15543. const onHide = () => {
  15544. highlightedIndex.value = -1;
  15545. };
  15546. const getData = async (queryString) => {
  15547. if (suggestionDisabled.value)
  15548. return;
  15549. const cb = (suggestionList) => {
  15550. loading.value = false;
  15551. if (suggestionDisabled.value)
  15552. return;
  15553. if (isArray$1(suggestionList)) {
  15554. suggestions.value = suggestionList;
  15555. highlightedIndex.value = props.highlightFirstItem ? 0 : -1;
  15556. } else {
  15557. throwError(COMPONENT_NAME$j, "autocomplete suggestions must be an array");
  15558. }
  15559. };
  15560. loading.value = true;
  15561. if (isArray$1(props.fetchSuggestions)) {
  15562. cb(props.fetchSuggestions);
  15563. } else {
  15564. const result = await props.fetchSuggestions(queryString, cb);
  15565. if (isArray$1(result))
  15566. cb(result);
  15567. }
  15568. };
  15569. const debouncedGetData = debounce(getData, props.debounce);
  15570. const handleInput = (value) => {
  15571. const valuePresented = !!value;
  15572. emit(INPUT_EVENT, value);
  15573. emit(UPDATE_MODEL_EVENT, value);
  15574. suggestionDisabled.value = false;
  15575. activated.value || (activated.value = valuePresented);
  15576. if (!props.triggerOnFocus && !value) {
  15577. suggestionDisabled.value = true;
  15578. suggestions.value = [];
  15579. return;
  15580. }
  15581. debouncedGetData(value);
  15582. };
  15583. const handleMouseDown = (event) => {
  15584. var _a;
  15585. if (disabled.value)
  15586. return;
  15587. if (((_a = event.target) == null ? void 0 : _a.tagName) !== "INPUT" || refInput.value.includes(document.activeElement)) {
  15588. activated.value = true;
  15589. }
  15590. };
  15591. const handleChange = (value) => {
  15592. emit(CHANGE_EVENT, value);
  15593. };
  15594. const handleFocus = (evt) => {
  15595. var _a;
  15596. if (!ignoreFocusEvent) {
  15597. activated.value = true;
  15598. emit("focus", evt);
  15599. const queryString = (_a = props.modelValue) != null ? _a : "";
  15600. if (props.triggerOnFocus && !readonly) {
  15601. debouncedGetData(String(queryString));
  15602. }
  15603. } else {
  15604. ignoreFocusEvent = false;
  15605. }
  15606. };
  15607. const handleBlur = (evt) => {
  15608. setTimeout(() => {
  15609. var _a;
  15610. if ((_a = popperRef.value) == null ? void 0 : _a.isFocusInsideContent()) {
  15611. ignoreFocusEvent = true;
  15612. return;
  15613. }
  15614. activated.value && close();
  15615. emit("blur", evt);
  15616. });
  15617. };
  15618. const handleClear = () => {
  15619. activated.value = false;
  15620. emit(UPDATE_MODEL_EVENT, "");
  15621. emit("clear");
  15622. };
  15623. const handleKeyEnter = async () => {
  15624. if (suggestionVisible.value && highlightedIndex.value >= 0 && highlightedIndex.value < suggestions.value.length) {
  15625. handleSelect(suggestions.value[highlightedIndex.value]);
  15626. } else if (props.selectWhenUnmatched) {
  15627. emit("select", { value: props.modelValue });
  15628. suggestions.value = [];
  15629. highlightedIndex.value = -1;
  15630. }
  15631. };
  15632. const handleKeyEscape = (evt) => {
  15633. if (suggestionVisible.value) {
  15634. evt.preventDefault();
  15635. evt.stopPropagation();
  15636. close();
  15637. }
  15638. };
  15639. const close = () => {
  15640. activated.value = false;
  15641. };
  15642. const focus = () => {
  15643. var _a;
  15644. (_a = inputRef.value) == null ? void 0 : _a.focus();
  15645. };
  15646. const blur = () => {
  15647. var _a;
  15648. (_a = inputRef.value) == null ? void 0 : _a.blur();
  15649. };
  15650. const handleSelect = async (item) => {
  15651. emit(INPUT_EVENT, item[props.valueKey]);
  15652. emit(UPDATE_MODEL_EVENT, item[props.valueKey]);
  15653. emit("select", item);
  15654. suggestions.value = [];
  15655. highlightedIndex.value = -1;
  15656. };
  15657. const highlight = (index) => {
  15658. if (!suggestionVisible.value || loading.value)
  15659. return;
  15660. if (index < 0) {
  15661. highlightedIndex.value = -1;
  15662. return;
  15663. }
  15664. if (index >= suggestions.value.length) {
  15665. index = suggestions.value.length - 1;
  15666. }
  15667. const suggestion = regionRef.value.querySelector(`.${ns.be("suggestion", "wrap")}`);
  15668. const suggestionList = suggestion.querySelectorAll(`.${ns.be("suggestion", "list")} li`);
  15669. const highlightItem = suggestionList[index];
  15670. const scrollTop = suggestion.scrollTop;
  15671. const { offsetTop, scrollHeight } = highlightItem;
  15672. if (offsetTop + scrollHeight > scrollTop + suggestion.clientHeight) {
  15673. suggestion.scrollTop += scrollHeight;
  15674. }
  15675. if (offsetTop < scrollTop) {
  15676. suggestion.scrollTop -= scrollHeight;
  15677. }
  15678. highlightedIndex.value = index;
  15679. inputRef.value.ref.setAttribute("aria-activedescendant", `${listboxId.value}-item-${highlightedIndex.value}`);
  15680. };
  15681. const stopHandle = onClickOutside(listboxRef, () => {
  15682. var _a;
  15683. if ((_a = popperRef.value) == null ? void 0 : _a.isFocusInsideContent())
  15684. return;
  15685. suggestionVisible.value && close();
  15686. });
  15687. onBeforeUnmount(() => {
  15688. stopHandle == null ? void 0 : stopHandle();
  15689. });
  15690. onMounted(() => {
  15691. inputRef.value.ref.setAttribute("role", "textbox");
  15692. inputRef.value.ref.setAttribute("aria-autocomplete", "list");
  15693. inputRef.value.ref.setAttribute("aria-controls", "id");
  15694. inputRef.value.ref.setAttribute("aria-activedescendant", `${listboxId.value}-item-${highlightedIndex.value}`);
  15695. readonly = inputRef.value.ref.hasAttribute("readonly");
  15696. });
  15697. expose({
  15698. highlightedIndex,
  15699. activated,
  15700. loading,
  15701. inputRef,
  15702. popperRef,
  15703. suggestions,
  15704. handleSelect,
  15705. handleKeyEnter,
  15706. focus,
  15707. blur,
  15708. close,
  15709. highlight,
  15710. getData
  15711. });
  15712. return (_ctx, _cache) => {
  15713. return openBlock(), createBlock(unref(ElTooltip), {
  15714. ref_key: "popperRef",
  15715. ref: popperRef,
  15716. visible: unref(suggestionVisible),
  15717. placement: _ctx.placement,
  15718. "fallback-placements": ["bottom-start", "top-start"],
  15719. "popper-class": [unref(ns).e("popper"), _ctx.popperClass],
  15720. teleported: _ctx.teleported,
  15721. "gpu-acceleration": false,
  15722. pure: "",
  15723. "manual-mode": "",
  15724. effect: "light",
  15725. trigger: "click",
  15726. transition: `${unref(ns).namespace.value}-zoom-in-top`,
  15727. persistent: "",
  15728. role: "listbox",
  15729. onBeforeShow: onSuggestionShow,
  15730. onHide
  15731. }, {
  15732. content: withCtx(() => [
  15733. createElementVNode("div", {
  15734. ref_key: "regionRef",
  15735. ref: regionRef,
  15736. class: normalizeClass([unref(ns).b("suggestion"), unref(ns).is("loading", unref(suggestionLoading))]),
  15737. style: normalizeStyle({
  15738. [_ctx.fitInputWidth ? "width" : "minWidth"]: dropdownWidth.value,
  15739. outline: "none"
  15740. }),
  15741. role: "region"
  15742. }, [
  15743. createVNode(unref(ElScrollbar), {
  15744. id: unref(listboxId),
  15745. tag: "ul",
  15746. "wrap-class": unref(ns).be("suggestion", "wrap"),
  15747. "view-class": unref(ns).be("suggestion", "list"),
  15748. role: "listbox"
  15749. }, {
  15750. default: withCtx(() => [
  15751. unref(suggestionLoading) ? (openBlock(), createElementBlock("li", { key: 0 }, [
  15752. renderSlot(_ctx.$slots, "loading", {}, () => [
  15753. createVNode(unref(ElIcon), {
  15754. class: normalizeClass(unref(ns).is("loading"))
  15755. }, {
  15756. default: withCtx(() => [
  15757. createVNode(unref(loading_default))
  15758. ]),
  15759. _: 1
  15760. }, 8, ["class"])
  15761. ])
  15762. ])) : (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(suggestions.value, (item, index) => {
  15763. return openBlock(), createElementBlock("li", {
  15764. id: `${unref(listboxId)}-item-${index}`,
  15765. key: index,
  15766. class: normalizeClass({ highlighted: highlightedIndex.value === index }),
  15767. role: "option",
  15768. "aria-selected": highlightedIndex.value === index,
  15769. onClick: ($event) => handleSelect(item)
  15770. }, [
  15771. renderSlot(_ctx.$slots, "default", { item }, () => [
  15772. createTextVNode(toDisplayString(item[_ctx.valueKey]), 1)
  15773. ])
  15774. ], 10, ["id", "aria-selected", "onClick"]);
  15775. }), 128))
  15776. ]),
  15777. _: 3
  15778. }, 8, ["id", "wrap-class", "view-class"])
  15779. ], 6)
  15780. ]),
  15781. default: withCtx(() => [
  15782. createElementVNode("div", {
  15783. ref_key: "listboxRef",
  15784. ref: listboxRef,
  15785. class: normalizeClass([unref(ns).b(), _ctx.$attrs.class]),
  15786. style: normalizeStyle(unref(styles)),
  15787. role: "combobox",
  15788. "aria-haspopup": "listbox",
  15789. "aria-expanded": unref(suggestionVisible),
  15790. "aria-owns": unref(listboxId)
  15791. }, [
  15792. createVNode(unref(ElInput), mergeProps({
  15793. ref_key: "inputRef",
  15794. ref: inputRef
  15795. }, unref(attrs), {
  15796. clearable: _ctx.clearable,
  15797. disabled: unref(disabled),
  15798. name: _ctx.name,
  15799. "model-value": _ctx.modelValue,
  15800. "aria-label": _ctx.ariaLabel,
  15801. onInput: handleInput,
  15802. onChange: handleChange,
  15803. onFocus: handleFocus,
  15804. onBlur: handleBlur,
  15805. onClear: handleClear,
  15806. onKeydown: [
  15807. withKeys(withModifiers(($event) => highlight(highlightedIndex.value - 1), ["prevent"]), ["up"]),
  15808. withKeys(withModifiers(($event) => highlight(highlightedIndex.value + 1), ["prevent"]), ["down"]),
  15809. withKeys(handleKeyEnter, ["enter"]),
  15810. withKeys(close, ["tab"]),
  15811. withKeys(handleKeyEscape, ["esc"])
  15812. ],
  15813. onMousedown: handleMouseDown
  15814. }), createSlots({
  15815. _: 2
  15816. }, [
  15817. _ctx.$slots.prepend ? {
  15818. name: "prepend",
  15819. fn: withCtx(() => [
  15820. renderSlot(_ctx.$slots, "prepend")
  15821. ])
  15822. } : void 0,
  15823. _ctx.$slots.append ? {
  15824. name: "append",
  15825. fn: withCtx(() => [
  15826. renderSlot(_ctx.$slots, "append")
  15827. ])
  15828. } : void 0,
  15829. _ctx.$slots.prefix ? {
  15830. name: "prefix",
  15831. fn: withCtx(() => [
  15832. renderSlot(_ctx.$slots, "prefix")
  15833. ])
  15834. } : void 0,
  15835. _ctx.$slots.suffix ? {
  15836. name: "suffix",
  15837. fn: withCtx(() => [
  15838. renderSlot(_ctx.$slots, "suffix")
  15839. ])
  15840. } : void 0
  15841. ]), 1040, ["clearable", "disabled", "name", "model-value", "aria-label", "onKeydown"])
  15842. ], 14, ["aria-expanded", "aria-owns"])
  15843. ]),
  15844. _: 3
  15845. }, 8, ["visible", "placement", "popper-class", "teleported", "transition"]);
  15846. };
  15847. }
  15848. });
  15849. var Autocomplete = /* @__PURE__ */ _export_sfc(_sfc_main$2f, [["__file", "autocomplete.vue"]]);
  15850. const ElAutocomplete = withInstall(Autocomplete);
  15851. const avatarProps = buildProps({
  15852. size: {
  15853. type: [Number, String],
  15854. values: componentSizes,
  15855. default: "",
  15856. validator: (val) => isNumber(val)
  15857. },
  15858. shape: {
  15859. type: String,
  15860. values: ["circle", "square"],
  15861. default: "circle"
  15862. },
  15863. icon: {
  15864. type: iconPropType
  15865. },
  15866. src: {
  15867. type: String,
  15868. default: ""
  15869. },
  15870. alt: String,
  15871. srcSet: String,
  15872. fit: {
  15873. type: definePropType(String),
  15874. default: "cover"
  15875. }
  15876. });
  15877. const avatarEmits = {
  15878. error: (evt) => evt instanceof Event
  15879. };
  15880. const __default__$1F = defineComponent({
  15881. name: "ElAvatar"
  15882. });
  15883. const _sfc_main$2e = /* @__PURE__ */ defineComponent({
  15884. ...__default__$1F,
  15885. props: avatarProps,
  15886. emits: avatarEmits,
  15887. setup(__props, { emit }) {
  15888. const props = __props;
  15889. const ns = useNamespace("avatar");
  15890. const hasLoadError = ref(false);
  15891. const avatarClass = computed(() => {
  15892. const { size, icon, shape } = props;
  15893. const classList = [ns.b()];
  15894. if (isString$1(size))
  15895. classList.push(ns.m(size));
  15896. if (icon)
  15897. classList.push(ns.m("icon"));
  15898. if (shape)
  15899. classList.push(ns.m(shape));
  15900. return classList;
  15901. });
  15902. const sizeStyle = computed(() => {
  15903. const { size } = props;
  15904. return isNumber(size) ? ns.cssVarBlock({
  15905. size: addUnit(size) || ""
  15906. }) : void 0;
  15907. });
  15908. const fitStyle = computed(() => ({
  15909. objectFit: props.fit
  15910. }));
  15911. watch(() => props.src, () => hasLoadError.value = false);
  15912. function handleError(e) {
  15913. hasLoadError.value = true;
  15914. emit("error", e);
  15915. }
  15916. return (_ctx, _cache) => {
  15917. return openBlock(), createElementBlock("span", {
  15918. class: normalizeClass(unref(avatarClass)),
  15919. style: normalizeStyle(unref(sizeStyle))
  15920. }, [
  15921. (_ctx.src || _ctx.srcSet) && !hasLoadError.value ? (openBlock(), createElementBlock("img", {
  15922. key: 0,
  15923. src: _ctx.src,
  15924. alt: _ctx.alt,
  15925. srcset: _ctx.srcSet,
  15926. style: normalizeStyle(unref(fitStyle)),
  15927. onError: handleError
  15928. }, null, 44, ["src", "alt", "srcset"])) : _ctx.icon ? (openBlock(), createBlock(unref(ElIcon), { key: 1 }, {
  15929. default: withCtx(() => [
  15930. (openBlock(), createBlock(resolveDynamicComponent(_ctx.icon)))
  15931. ]),
  15932. _: 1
  15933. })) : renderSlot(_ctx.$slots, "default", { key: 2 })
  15934. ], 6);
  15935. };
  15936. }
  15937. });
  15938. var Avatar = /* @__PURE__ */ _export_sfc(_sfc_main$2e, [["__file", "avatar.vue"]]);
  15939. const ElAvatar = withInstall(Avatar);
  15940. const backtopProps = {
  15941. visibilityHeight: {
  15942. type: Number,
  15943. default: 200
  15944. },
  15945. target: {
  15946. type: String,
  15947. default: ""
  15948. },
  15949. right: {
  15950. type: Number,
  15951. default: 40
  15952. },
  15953. bottom: {
  15954. type: Number,
  15955. default: 40
  15956. }
  15957. };
  15958. const backtopEmits = {
  15959. click: (evt) => evt instanceof MouseEvent
  15960. };
  15961. const useBackTop = (props, emit, componentName) => {
  15962. const el = shallowRef();
  15963. const container = shallowRef();
  15964. const visible = ref(false);
  15965. const handleScroll = () => {
  15966. if (el.value)
  15967. visible.value = el.value.scrollTop >= props.visibilityHeight;
  15968. };
  15969. const handleClick = (event) => {
  15970. var _a;
  15971. (_a = el.value) == null ? void 0 : _a.scrollTo({ top: 0, behavior: "smooth" });
  15972. emit("click", event);
  15973. };
  15974. const handleScrollThrottled = useThrottleFn(handleScroll, 300, true);
  15975. useEventListener(container, "scroll", handleScrollThrottled);
  15976. onMounted(() => {
  15977. var _a;
  15978. container.value = document;
  15979. el.value = document.documentElement;
  15980. if (props.target) {
  15981. el.value = (_a = document.querySelector(props.target)) != null ? _a : void 0;
  15982. if (!el.value) {
  15983. throwError(componentName, `target does not exist: ${props.target}`);
  15984. }
  15985. container.value = el.value;
  15986. }
  15987. handleScroll();
  15988. });
  15989. return {
  15990. visible,
  15991. handleClick
  15992. };
  15993. };
  15994. const COMPONENT_NAME$i = "ElBacktop";
  15995. const __default__$1E = defineComponent({
  15996. name: COMPONENT_NAME$i
  15997. });
  15998. const _sfc_main$2d = /* @__PURE__ */ defineComponent({
  15999. ...__default__$1E,
  16000. props: backtopProps,
  16001. emits: backtopEmits,
  16002. setup(__props, { emit }) {
  16003. const props = __props;
  16004. const ns = useNamespace("backtop");
  16005. const { handleClick, visible } = useBackTop(props, emit, COMPONENT_NAME$i);
  16006. const backTopStyle = computed(() => ({
  16007. right: `${props.right}px`,
  16008. bottom: `${props.bottom}px`
  16009. }));
  16010. return (_ctx, _cache) => {
  16011. return openBlock(), createBlock(Transition, {
  16012. name: `${unref(ns).namespace.value}-fade-in`
  16013. }, {
  16014. default: withCtx(() => [
  16015. unref(visible) ? (openBlock(), createElementBlock("div", {
  16016. key: 0,
  16017. style: normalizeStyle(unref(backTopStyle)),
  16018. class: normalizeClass(unref(ns).b()),
  16019. onClick: withModifiers(unref(handleClick), ["stop"])
  16020. }, [
  16021. renderSlot(_ctx.$slots, "default", {}, () => [
  16022. createVNode(unref(ElIcon), {
  16023. class: normalizeClass(unref(ns).e("icon"))
  16024. }, {
  16025. default: withCtx(() => [
  16026. createVNode(unref(caret_top_default))
  16027. ]),
  16028. _: 1
  16029. }, 8, ["class"])
  16030. ])
  16031. ], 14, ["onClick"])) : createCommentVNode("v-if", true)
  16032. ]),
  16033. _: 3
  16034. }, 8, ["name"]);
  16035. };
  16036. }
  16037. });
  16038. var Backtop = /* @__PURE__ */ _export_sfc(_sfc_main$2d, [["__file", "backtop.vue"]]);
  16039. const ElBacktop = withInstall(Backtop);
  16040. const badgeProps = buildProps({
  16041. value: {
  16042. type: [String, Number],
  16043. default: ""
  16044. },
  16045. max: {
  16046. type: Number,
  16047. default: 99
  16048. },
  16049. isDot: Boolean,
  16050. hidden: Boolean,
  16051. type: {
  16052. type: String,
  16053. values: ["primary", "success", "warning", "info", "danger"],
  16054. default: "danger"
  16055. },
  16056. showZero: {
  16057. type: Boolean,
  16058. default: true
  16059. },
  16060. color: String,
  16061. badgeStyle: {
  16062. type: definePropType([String, Object, Array])
  16063. },
  16064. offset: {
  16065. type: definePropType(Array),
  16066. default: [0, 0]
  16067. },
  16068. badgeClass: {
  16069. type: String
  16070. }
  16071. });
  16072. const __default__$1D = defineComponent({
  16073. name: "ElBadge"
  16074. });
  16075. const _sfc_main$2c = /* @__PURE__ */ defineComponent({
  16076. ...__default__$1D,
  16077. props: badgeProps,
  16078. setup(__props, { expose }) {
  16079. const props = __props;
  16080. const ns = useNamespace("badge");
  16081. const content = computed(() => {
  16082. if (props.isDot)
  16083. return "";
  16084. if (isNumber(props.value) && isNumber(props.max)) {
  16085. return props.max < props.value ? `${props.max}+` : `${props.value}`;
  16086. }
  16087. return `${props.value}`;
  16088. });
  16089. const style = computed(() => {
  16090. var _a, _b, _c, _d, _e;
  16091. return [
  16092. {
  16093. backgroundColor: props.color,
  16094. marginRight: addUnit(-((_b = (_a = props.offset) == null ? void 0 : _a[0]) != null ? _b : 0)),
  16095. marginTop: addUnit((_d = (_c = props.offset) == null ? void 0 : _c[1]) != null ? _d : 0)
  16096. },
  16097. (_e = props.badgeStyle) != null ? _e : {}
  16098. ];
  16099. });
  16100. expose({
  16101. content
  16102. });
  16103. return (_ctx, _cache) => {
  16104. return openBlock(), createElementBlock("div", {
  16105. class: normalizeClass(unref(ns).b())
  16106. }, [
  16107. renderSlot(_ctx.$slots, "default"),
  16108. createVNode(Transition, {
  16109. name: `${unref(ns).namespace.value}-zoom-in-center`,
  16110. persisted: ""
  16111. }, {
  16112. default: withCtx(() => [
  16113. withDirectives(createElementVNode("sup", {
  16114. class: normalizeClass([
  16115. unref(ns).e("content"),
  16116. unref(ns).em("content", _ctx.type),
  16117. unref(ns).is("fixed", !!_ctx.$slots.default),
  16118. unref(ns).is("dot", _ctx.isDot),
  16119. unref(ns).is("hide-zero", !_ctx.showZero && props.value === 0),
  16120. _ctx.badgeClass
  16121. ]),
  16122. style: normalizeStyle(unref(style))
  16123. }, [
  16124. renderSlot(_ctx.$slots, "content", { value: unref(content) }, () => [
  16125. createTextVNode(toDisplayString(unref(content)), 1)
  16126. ])
  16127. ], 6), [
  16128. [vShow, !_ctx.hidden && (unref(content) || _ctx.isDot || _ctx.$slots.content)]
  16129. ])
  16130. ]),
  16131. _: 3
  16132. }, 8, ["name"])
  16133. ], 2);
  16134. };
  16135. }
  16136. });
  16137. var Badge = /* @__PURE__ */ _export_sfc(_sfc_main$2c, [["__file", "badge.vue"]]);
  16138. const ElBadge = withInstall(Badge);
  16139. const breadcrumbKey = Symbol("breadcrumbKey");
  16140. const breadcrumbProps = buildProps({
  16141. separator: {
  16142. type: String,
  16143. default: "/"
  16144. },
  16145. separatorIcon: {
  16146. type: iconPropType
  16147. }
  16148. });
  16149. const __default__$1C = defineComponent({
  16150. name: "ElBreadcrumb"
  16151. });
  16152. const _sfc_main$2b = /* @__PURE__ */ defineComponent({
  16153. ...__default__$1C,
  16154. props: breadcrumbProps,
  16155. setup(__props) {
  16156. const props = __props;
  16157. const { t } = useLocale();
  16158. const ns = useNamespace("breadcrumb");
  16159. const breadcrumb = ref();
  16160. provide(breadcrumbKey, props);
  16161. onMounted(() => {
  16162. const items = breadcrumb.value.querySelectorAll(`.${ns.e("item")}`);
  16163. if (items.length) {
  16164. items[items.length - 1].setAttribute("aria-current", "page");
  16165. }
  16166. });
  16167. return (_ctx, _cache) => {
  16168. return openBlock(), createElementBlock("div", {
  16169. ref_key: "breadcrumb",
  16170. ref: breadcrumb,
  16171. class: normalizeClass(unref(ns).b()),
  16172. "aria-label": unref(t)("el.breadcrumb.label"),
  16173. role: "navigation"
  16174. }, [
  16175. renderSlot(_ctx.$slots, "default")
  16176. ], 10, ["aria-label"]);
  16177. };
  16178. }
  16179. });
  16180. var Breadcrumb = /* @__PURE__ */ _export_sfc(_sfc_main$2b, [["__file", "breadcrumb.vue"]]);
  16181. const breadcrumbItemProps = buildProps({
  16182. to: {
  16183. type: definePropType([String, Object]),
  16184. default: ""
  16185. },
  16186. replace: Boolean
  16187. });
  16188. const __default__$1B = defineComponent({
  16189. name: "ElBreadcrumbItem"
  16190. });
  16191. const _sfc_main$2a = /* @__PURE__ */ defineComponent({
  16192. ...__default__$1B,
  16193. props: breadcrumbItemProps,
  16194. setup(__props) {
  16195. const props = __props;
  16196. const instance = getCurrentInstance();
  16197. const breadcrumbContext = inject(breadcrumbKey, void 0);
  16198. const ns = useNamespace("breadcrumb");
  16199. const router = instance.appContext.config.globalProperties.$router;
  16200. const link = ref();
  16201. const onClick = () => {
  16202. if (!props.to || !router)
  16203. return;
  16204. props.replace ? router.replace(props.to) : router.push(props.to);
  16205. };
  16206. return (_ctx, _cache) => {
  16207. var _a, _b;
  16208. return openBlock(), createElementBlock("span", {
  16209. class: normalizeClass(unref(ns).e("item"))
  16210. }, [
  16211. createElementVNode("span", {
  16212. ref_key: "link",
  16213. ref: link,
  16214. class: normalizeClass([unref(ns).e("inner"), unref(ns).is("link", !!_ctx.to)]),
  16215. role: "link",
  16216. onClick
  16217. }, [
  16218. renderSlot(_ctx.$slots, "default")
  16219. ], 2),
  16220. ((_a = unref(breadcrumbContext)) == null ? void 0 : _a.separatorIcon) ? (openBlock(), createBlock(unref(ElIcon), {
  16221. key: 0,
  16222. class: normalizeClass(unref(ns).e("separator"))
  16223. }, {
  16224. default: withCtx(() => [
  16225. (openBlock(), createBlock(resolveDynamicComponent(unref(breadcrumbContext).separatorIcon)))
  16226. ]),
  16227. _: 1
  16228. }, 8, ["class"])) : (openBlock(), createElementBlock("span", {
  16229. key: 1,
  16230. class: normalizeClass(unref(ns).e("separator")),
  16231. role: "presentation"
  16232. }, toDisplayString((_b = unref(breadcrumbContext)) == null ? void 0 : _b.separator), 3))
  16233. ], 2);
  16234. };
  16235. }
  16236. });
  16237. var BreadcrumbItem = /* @__PURE__ */ _export_sfc(_sfc_main$2a, [["__file", "breadcrumb-item.vue"]]);
  16238. const ElBreadcrumb = withInstall(Breadcrumb, {
  16239. BreadcrumbItem
  16240. });
  16241. const ElBreadcrumbItem = withNoopInstall(BreadcrumbItem);
  16242. const buttonGroupContextKey = Symbol("buttonGroupContextKey");
  16243. const useButton = (props, emit) => {
  16244. useDeprecated({
  16245. from: "type.text",
  16246. replacement: "link",
  16247. version: "3.0.0",
  16248. scope: "props",
  16249. ref: "https://element-plus.org/en-US/component/button.html#button-attributes"
  16250. }, computed(() => props.type === "text"));
  16251. const buttonGroupContext = inject(buttonGroupContextKey, void 0);
  16252. const globalConfig = useGlobalConfig("button");
  16253. const { form } = useFormItem();
  16254. const _size = useFormSize(computed(() => buttonGroupContext == null ? void 0 : buttonGroupContext.size));
  16255. const _disabled = useFormDisabled();
  16256. const _ref = ref();
  16257. const slots = useSlots();
  16258. const _type = computed(() => props.type || (buttonGroupContext == null ? void 0 : buttonGroupContext.type) || "");
  16259. const autoInsertSpace = computed(() => {
  16260. var _a, _b, _c;
  16261. return (_c = (_b = props.autoInsertSpace) != null ? _b : (_a = globalConfig.value) == null ? void 0 : _a.autoInsertSpace) != null ? _c : false;
  16262. });
  16263. const _props = computed(() => {
  16264. if (props.tag === "button") {
  16265. return {
  16266. ariaDisabled: _disabled.value || props.loading,
  16267. disabled: _disabled.value || props.loading,
  16268. autofocus: props.autofocus,
  16269. type: props.nativeType
  16270. };
  16271. }
  16272. return {};
  16273. });
  16274. const shouldAddSpace = computed(() => {
  16275. var _a;
  16276. const defaultSlot = (_a = slots.default) == null ? void 0 : _a.call(slots);
  16277. if (autoInsertSpace.value && (defaultSlot == null ? void 0 : defaultSlot.length) === 1) {
  16278. const slot = defaultSlot[0];
  16279. if ((slot == null ? void 0 : slot.type) === Text$1) {
  16280. const text = slot.children;
  16281. return /^\p{Unified_Ideograph}{2}$/u.test(text.trim());
  16282. }
  16283. }
  16284. return false;
  16285. });
  16286. const handleClick = (evt) => {
  16287. if (_disabled.value || props.loading) {
  16288. evt.stopPropagation();
  16289. return;
  16290. }
  16291. if (props.nativeType === "reset") {
  16292. form == null ? void 0 : form.resetFields();
  16293. }
  16294. emit("click", evt);
  16295. };
  16296. return {
  16297. _disabled,
  16298. _size,
  16299. _type,
  16300. _ref,
  16301. _props,
  16302. shouldAddSpace,
  16303. handleClick
  16304. };
  16305. };
  16306. const buttonTypes = [
  16307. "default",
  16308. "primary",
  16309. "success",
  16310. "warning",
  16311. "info",
  16312. "danger",
  16313. "text",
  16314. ""
  16315. ];
  16316. const buttonNativeTypes = ["button", "submit", "reset"];
  16317. const buttonProps = buildProps({
  16318. size: useSizeProp,
  16319. disabled: Boolean,
  16320. type: {
  16321. type: String,
  16322. values: buttonTypes,
  16323. default: ""
  16324. },
  16325. icon: {
  16326. type: iconPropType
  16327. },
  16328. nativeType: {
  16329. type: String,
  16330. values: buttonNativeTypes,
  16331. default: "button"
  16332. },
  16333. loading: Boolean,
  16334. loadingIcon: {
  16335. type: iconPropType,
  16336. default: () => loading_default
  16337. },
  16338. plain: Boolean,
  16339. text: Boolean,
  16340. link: Boolean,
  16341. bg: Boolean,
  16342. autofocus: Boolean,
  16343. round: Boolean,
  16344. circle: Boolean,
  16345. color: String,
  16346. dark: Boolean,
  16347. autoInsertSpace: {
  16348. type: Boolean,
  16349. default: void 0
  16350. },
  16351. tag: {
  16352. type: definePropType([String, Object]),
  16353. default: "button"
  16354. }
  16355. });
  16356. const buttonEmits = {
  16357. click: (evt) => evt instanceof MouseEvent
  16358. };
  16359. function bound01$1(n, max) {
  16360. if (isOnePointZero$1(n)) {
  16361. n = "100%";
  16362. }
  16363. var isPercent = isPercentage$1(n);
  16364. n = max === 360 ? n : Math.min(max, Math.max(0, parseFloat(n)));
  16365. if (isPercent) {
  16366. n = parseInt(String(n * max), 10) / 100;
  16367. }
  16368. if (Math.abs(n - max) < 1e-6) {
  16369. return 1;
  16370. }
  16371. if (max === 360) {
  16372. n = (n < 0 ? n % max + max : n % max) / parseFloat(String(max));
  16373. } else {
  16374. n = n % max / parseFloat(String(max));
  16375. }
  16376. return n;
  16377. }
  16378. function clamp01(val) {
  16379. return Math.min(1, Math.max(0, val));
  16380. }
  16381. function isOnePointZero$1(n) {
  16382. return typeof n === "string" && n.indexOf(".") !== -1 && parseFloat(n) === 1;
  16383. }
  16384. function isPercentage$1(n) {
  16385. return typeof n === "string" && n.indexOf("%") !== -1;
  16386. }
  16387. function boundAlpha(a) {
  16388. a = parseFloat(a);
  16389. if (isNaN(a) || a < 0 || a > 1) {
  16390. a = 1;
  16391. }
  16392. return a;
  16393. }
  16394. function convertToPercentage(n) {
  16395. if (n <= 1) {
  16396. return "".concat(Number(n) * 100, "%");
  16397. }
  16398. return n;
  16399. }
  16400. function pad2(c) {
  16401. return c.length === 1 ? "0" + c : String(c);
  16402. }
  16403. function rgbToRgb(r, g, b) {
  16404. return {
  16405. r: bound01$1(r, 255) * 255,
  16406. g: bound01$1(g, 255) * 255,
  16407. b: bound01$1(b, 255) * 255
  16408. };
  16409. }
  16410. function rgbToHsl(r, g, b) {
  16411. r = bound01$1(r, 255);
  16412. g = bound01$1(g, 255);
  16413. b = bound01$1(b, 255);
  16414. var max = Math.max(r, g, b);
  16415. var min = Math.min(r, g, b);
  16416. var h = 0;
  16417. var s = 0;
  16418. var l = (max + min) / 2;
  16419. if (max === min) {
  16420. s = 0;
  16421. h = 0;
  16422. } else {
  16423. var d = max - min;
  16424. s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
  16425. switch (max) {
  16426. case r:
  16427. h = (g - b) / d + (g < b ? 6 : 0);
  16428. break;
  16429. case g:
  16430. h = (b - r) / d + 2;
  16431. break;
  16432. case b:
  16433. h = (r - g) / d + 4;
  16434. break;
  16435. }
  16436. h /= 6;
  16437. }
  16438. return { h, s, l };
  16439. }
  16440. function hue2rgb(p, q, t) {
  16441. if (t < 0) {
  16442. t += 1;
  16443. }
  16444. if (t > 1) {
  16445. t -= 1;
  16446. }
  16447. if (t < 1 / 6) {
  16448. return p + (q - p) * (6 * t);
  16449. }
  16450. if (t < 1 / 2) {
  16451. return q;
  16452. }
  16453. if (t < 2 / 3) {
  16454. return p + (q - p) * (2 / 3 - t) * 6;
  16455. }
  16456. return p;
  16457. }
  16458. function hslToRgb(h, s, l) {
  16459. var r;
  16460. var g;
  16461. var b;
  16462. h = bound01$1(h, 360);
  16463. s = bound01$1(s, 100);
  16464. l = bound01$1(l, 100);
  16465. if (s === 0) {
  16466. g = l;
  16467. b = l;
  16468. r = l;
  16469. } else {
  16470. var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
  16471. var p = 2 * l - q;
  16472. r = hue2rgb(p, q, h + 1 / 3);
  16473. g = hue2rgb(p, q, h);
  16474. b = hue2rgb(p, q, h - 1 / 3);
  16475. }
  16476. return { r: r * 255, g: g * 255, b: b * 255 };
  16477. }
  16478. function rgbToHsv(r, g, b) {
  16479. r = bound01$1(r, 255);
  16480. g = bound01$1(g, 255);
  16481. b = bound01$1(b, 255);
  16482. var max = Math.max(r, g, b);
  16483. var min = Math.min(r, g, b);
  16484. var h = 0;
  16485. var v = max;
  16486. var d = max - min;
  16487. var s = max === 0 ? 0 : d / max;
  16488. if (max === min) {
  16489. h = 0;
  16490. } else {
  16491. switch (max) {
  16492. case r:
  16493. h = (g - b) / d + (g < b ? 6 : 0);
  16494. break;
  16495. case g:
  16496. h = (b - r) / d + 2;
  16497. break;
  16498. case b:
  16499. h = (r - g) / d + 4;
  16500. break;
  16501. }
  16502. h /= 6;
  16503. }
  16504. return { h, s, v };
  16505. }
  16506. function hsvToRgb(h, s, v) {
  16507. h = bound01$1(h, 360) * 6;
  16508. s = bound01$1(s, 100);
  16509. v = bound01$1(v, 100);
  16510. var i = Math.floor(h);
  16511. var f = h - i;
  16512. var p = v * (1 - s);
  16513. var q = v * (1 - f * s);
  16514. var t = v * (1 - (1 - f) * s);
  16515. var mod = i % 6;
  16516. var r = [v, q, p, p, t, v][mod];
  16517. var g = [t, v, v, q, p, p][mod];
  16518. var b = [p, p, t, v, v, q][mod];
  16519. return { r: r * 255, g: g * 255, b: b * 255 };
  16520. }
  16521. function rgbToHex(r, g, b, allow3Char) {
  16522. var hex = [
  16523. pad2(Math.round(r).toString(16)),
  16524. pad2(Math.round(g).toString(16)),
  16525. pad2(Math.round(b).toString(16))
  16526. ];
  16527. if (allow3Char && hex[0].startsWith(hex[0].charAt(1)) && hex[1].startsWith(hex[1].charAt(1)) && hex[2].startsWith(hex[2].charAt(1))) {
  16528. return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);
  16529. }
  16530. return hex.join("");
  16531. }
  16532. function rgbaToHex(r, g, b, a, allow4Char) {
  16533. var hex = [
  16534. pad2(Math.round(r).toString(16)),
  16535. pad2(Math.round(g).toString(16)),
  16536. pad2(Math.round(b).toString(16)),
  16537. pad2(convertDecimalToHex(a))
  16538. ];
  16539. 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))) {
  16540. return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0);
  16541. }
  16542. return hex.join("");
  16543. }
  16544. function convertDecimalToHex(d) {
  16545. return Math.round(parseFloat(d) * 255).toString(16);
  16546. }
  16547. function convertHexToDecimal(h) {
  16548. return parseIntFromHex(h) / 255;
  16549. }
  16550. function parseIntFromHex(val) {
  16551. return parseInt(val, 16);
  16552. }
  16553. function numberInputToObject(color) {
  16554. return {
  16555. r: color >> 16,
  16556. g: (color & 65280) >> 8,
  16557. b: color & 255
  16558. };
  16559. }
  16560. var names = {
  16561. aliceblue: "#f0f8ff",
  16562. antiquewhite: "#faebd7",
  16563. aqua: "#00ffff",
  16564. aquamarine: "#7fffd4",
  16565. azure: "#f0ffff",
  16566. beige: "#f5f5dc",
  16567. bisque: "#ffe4c4",
  16568. black: "#000000",
  16569. blanchedalmond: "#ffebcd",
  16570. blue: "#0000ff",
  16571. blueviolet: "#8a2be2",
  16572. brown: "#a52a2a",
  16573. burlywood: "#deb887",
  16574. cadetblue: "#5f9ea0",
  16575. chartreuse: "#7fff00",
  16576. chocolate: "#d2691e",
  16577. coral: "#ff7f50",
  16578. cornflowerblue: "#6495ed",
  16579. cornsilk: "#fff8dc",
  16580. crimson: "#dc143c",
  16581. cyan: "#00ffff",
  16582. darkblue: "#00008b",
  16583. darkcyan: "#008b8b",
  16584. darkgoldenrod: "#b8860b",
  16585. darkgray: "#a9a9a9",
  16586. darkgreen: "#006400",
  16587. darkgrey: "#a9a9a9",
  16588. darkkhaki: "#bdb76b",
  16589. darkmagenta: "#8b008b",
  16590. darkolivegreen: "#556b2f",
  16591. darkorange: "#ff8c00",
  16592. darkorchid: "#9932cc",
  16593. darkred: "#8b0000",
  16594. darksalmon: "#e9967a",
  16595. darkseagreen: "#8fbc8f",
  16596. darkslateblue: "#483d8b",
  16597. darkslategray: "#2f4f4f",
  16598. darkslategrey: "#2f4f4f",
  16599. darkturquoise: "#00ced1",
  16600. darkviolet: "#9400d3",
  16601. deeppink: "#ff1493",
  16602. deepskyblue: "#00bfff",
  16603. dimgray: "#696969",
  16604. dimgrey: "#696969",
  16605. dodgerblue: "#1e90ff",
  16606. firebrick: "#b22222",
  16607. floralwhite: "#fffaf0",
  16608. forestgreen: "#228b22",
  16609. fuchsia: "#ff00ff",
  16610. gainsboro: "#dcdcdc",
  16611. ghostwhite: "#f8f8ff",
  16612. goldenrod: "#daa520",
  16613. gold: "#ffd700",
  16614. gray: "#808080",
  16615. green: "#008000",
  16616. greenyellow: "#adff2f",
  16617. grey: "#808080",
  16618. honeydew: "#f0fff0",
  16619. hotpink: "#ff69b4",
  16620. indianred: "#cd5c5c",
  16621. indigo: "#4b0082",
  16622. ivory: "#fffff0",
  16623. khaki: "#f0e68c",
  16624. lavenderblush: "#fff0f5",
  16625. lavender: "#e6e6fa",
  16626. lawngreen: "#7cfc00",
  16627. lemonchiffon: "#fffacd",
  16628. lightblue: "#add8e6",
  16629. lightcoral: "#f08080",
  16630. lightcyan: "#e0ffff",
  16631. lightgoldenrodyellow: "#fafad2",
  16632. lightgray: "#d3d3d3",
  16633. lightgreen: "#90ee90",
  16634. lightgrey: "#d3d3d3",
  16635. lightpink: "#ffb6c1",
  16636. lightsalmon: "#ffa07a",
  16637. lightseagreen: "#20b2aa",
  16638. lightskyblue: "#87cefa",
  16639. lightslategray: "#778899",
  16640. lightslategrey: "#778899",
  16641. lightsteelblue: "#b0c4de",
  16642. lightyellow: "#ffffe0",
  16643. lime: "#00ff00",
  16644. limegreen: "#32cd32",
  16645. linen: "#faf0e6",
  16646. magenta: "#ff00ff",
  16647. maroon: "#800000",
  16648. mediumaquamarine: "#66cdaa",
  16649. mediumblue: "#0000cd",
  16650. mediumorchid: "#ba55d3",
  16651. mediumpurple: "#9370db",
  16652. mediumseagreen: "#3cb371",
  16653. mediumslateblue: "#7b68ee",
  16654. mediumspringgreen: "#00fa9a",
  16655. mediumturquoise: "#48d1cc",
  16656. mediumvioletred: "#c71585",
  16657. midnightblue: "#191970",
  16658. mintcream: "#f5fffa",
  16659. mistyrose: "#ffe4e1",
  16660. moccasin: "#ffe4b5",
  16661. navajowhite: "#ffdead",
  16662. navy: "#000080",
  16663. oldlace: "#fdf5e6",
  16664. olive: "#808000",
  16665. olivedrab: "#6b8e23",
  16666. orange: "#ffa500",
  16667. orangered: "#ff4500",
  16668. orchid: "#da70d6",
  16669. palegoldenrod: "#eee8aa",
  16670. palegreen: "#98fb98",
  16671. paleturquoise: "#afeeee",
  16672. palevioletred: "#db7093",
  16673. papayawhip: "#ffefd5",
  16674. peachpuff: "#ffdab9",
  16675. peru: "#cd853f",
  16676. pink: "#ffc0cb",
  16677. plum: "#dda0dd",
  16678. powderblue: "#b0e0e6",
  16679. purple: "#800080",
  16680. rebeccapurple: "#663399",
  16681. red: "#ff0000",
  16682. rosybrown: "#bc8f8f",
  16683. royalblue: "#4169e1",
  16684. saddlebrown: "#8b4513",
  16685. salmon: "#fa8072",
  16686. sandybrown: "#f4a460",
  16687. seagreen: "#2e8b57",
  16688. seashell: "#fff5ee",
  16689. sienna: "#a0522d",
  16690. silver: "#c0c0c0",
  16691. skyblue: "#87ceeb",
  16692. slateblue: "#6a5acd",
  16693. slategray: "#708090",
  16694. slategrey: "#708090",
  16695. snow: "#fffafa",
  16696. springgreen: "#00ff7f",
  16697. steelblue: "#4682b4",
  16698. tan: "#d2b48c",
  16699. teal: "#008080",
  16700. thistle: "#d8bfd8",
  16701. tomato: "#ff6347",
  16702. turquoise: "#40e0d0",
  16703. violet: "#ee82ee",
  16704. wheat: "#f5deb3",
  16705. white: "#ffffff",
  16706. whitesmoke: "#f5f5f5",
  16707. yellow: "#ffff00",
  16708. yellowgreen: "#9acd32"
  16709. };
  16710. function inputToRGB(color) {
  16711. var rgb = { r: 0, g: 0, b: 0 };
  16712. var a = 1;
  16713. var s = null;
  16714. var v = null;
  16715. var l = null;
  16716. var ok = false;
  16717. var format = false;
  16718. if (typeof color === "string") {
  16719. color = stringInputToObject(color);
  16720. }
  16721. if (typeof color === "object") {
  16722. if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) {
  16723. rgb = rgbToRgb(color.r, color.g, color.b);
  16724. ok = true;
  16725. format = String(color.r).substr(-1) === "%" ? "prgb" : "rgb";
  16726. } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) {
  16727. s = convertToPercentage(color.s);
  16728. v = convertToPercentage(color.v);
  16729. rgb = hsvToRgb(color.h, s, v);
  16730. ok = true;
  16731. format = "hsv";
  16732. } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) {
  16733. s = convertToPercentage(color.s);
  16734. l = convertToPercentage(color.l);
  16735. rgb = hslToRgb(color.h, s, l);
  16736. ok = true;
  16737. format = "hsl";
  16738. }
  16739. if (Object.prototype.hasOwnProperty.call(color, "a")) {
  16740. a = color.a;
  16741. }
  16742. }
  16743. a = boundAlpha(a);
  16744. return {
  16745. ok,
  16746. format: color.format || format,
  16747. r: Math.min(255, Math.max(rgb.r, 0)),
  16748. g: Math.min(255, Math.max(rgb.g, 0)),
  16749. b: Math.min(255, Math.max(rgb.b, 0)),
  16750. a
  16751. };
  16752. }
  16753. var CSS_INTEGER = "[-\\+]?\\d+%?";
  16754. var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?";
  16755. var CSS_UNIT = "(?:".concat(CSS_NUMBER, ")|(?:").concat(CSS_INTEGER, ")");
  16756. var PERMISSIVE_MATCH3 = "[\\s|\\(]+(".concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")\\s*\\)?");
  16757. var PERMISSIVE_MATCH4 = "[\\s|\\(]+(".concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")\\s*\\)?");
  16758. var matchers = {
  16759. CSS_UNIT: new RegExp(CSS_UNIT),
  16760. rgb: new RegExp("rgb" + PERMISSIVE_MATCH3),
  16761. rgba: new RegExp("rgba" + PERMISSIVE_MATCH4),
  16762. hsl: new RegExp("hsl" + PERMISSIVE_MATCH3),
  16763. hsla: new RegExp("hsla" + PERMISSIVE_MATCH4),
  16764. hsv: new RegExp("hsv" + PERMISSIVE_MATCH3),
  16765. hsva: new RegExp("hsva" + PERMISSIVE_MATCH4),
  16766. hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
  16767. hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
  16768. hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
  16769. hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
  16770. };
  16771. function stringInputToObject(color) {
  16772. color = color.trim().toLowerCase();
  16773. if (color.length === 0) {
  16774. return false;
  16775. }
  16776. var named = false;
  16777. if (names[color]) {
  16778. color = names[color];
  16779. named = true;
  16780. } else if (color === "transparent") {
  16781. return { r: 0, g: 0, b: 0, a: 0, format: "name" };
  16782. }
  16783. var match = matchers.rgb.exec(color);
  16784. if (match) {
  16785. return { r: match[1], g: match[2], b: match[3] };
  16786. }
  16787. match = matchers.rgba.exec(color);
  16788. if (match) {
  16789. return { r: match[1], g: match[2], b: match[3], a: match[4] };
  16790. }
  16791. match = matchers.hsl.exec(color);
  16792. if (match) {
  16793. return { h: match[1], s: match[2], l: match[3] };
  16794. }
  16795. match = matchers.hsla.exec(color);
  16796. if (match) {
  16797. return { h: match[1], s: match[2], l: match[3], a: match[4] };
  16798. }
  16799. match = matchers.hsv.exec(color);
  16800. if (match) {
  16801. return { h: match[1], s: match[2], v: match[3] };
  16802. }
  16803. match = matchers.hsva.exec(color);
  16804. if (match) {
  16805. return { h: match[1], s: match[2], v: match[3], a: match[4] };
  16806. }
  16807. match = matchers.hex8.exec(color);
  16808. if (match) {
  16809. return {
  16810. r: parseIntFromHex(match[1]),
  16811. g: parseIntFromHex(match[2]),
  16812. b: parseIntFromHex(match[3]),
  16813. a: convertHexToDecimal(match[4]),
  16814. format: named ? "name" : "hex8"
  16815. };
  16816. }
  16817. match = matchers.hex6.exec(color);
  16818. if (match) {
  16819. return {
  16820. r: parseIntFromHex(match[1]),
  16821. g: parseIntFromHex(match[2]),
  16822. b: parseIntFromHex(match[3]),
  16823. format: named ? "name" : "hex"
  16824. };
  16825. }
  16826. match = matchers.hex4.exec(color);
  16827. if (match) {
  16828. return {
  16829. r: parseIntFromHex(match[1] + match[1]),
  16830. g: parseIntFromHex(match[2] + match[2]),
  16831. b: parseIntFromHex(match[3] + match[3]),
  16832. a: convertHexToDecimal(match[4] + match[4]),
  16833. format: named ? "name" : "hex8"
  16834. };
  16835. }
  16836. match = matchers.hex3.exec(color);
  16837. if (match) {
  16838. return {
  16839. r: parseIntFromHex(match[1] + match[1]),
  16840. g: parseIntFromHex(match[2] + match[2]),
  16841. b: parseIntFromHex(match[3] + match[3]),
  16842. format: named ? "name" : "hex"
  16843. };
  16844. }
  16845. return false;
  16846. }
  16847. function isValidCSSUnit(color) {
  16848. return Boolean(matchers.CSS_UNIT.exec(String(color)));
  16849. }
  16850. var TinyColor = function() {
  16851. function TinyColor2(color, opts) {
  16852. if (color === void 0) {
  16853. color = "";
  16854. }
  16855. if (opts === void 0) {
  16856. opts = {};
  16857. }
  16858. var _a;
  16859. if (color instanceof TinyColor2) {
  16860. return color;
  16861. }
  16862. if (typeof color === "number") {
  16863. color = numberInputToObject(color);
  16864. }
  16865. this.originalInput = color;
  16866. var rgb = inputToRGB(color);
  16867. this.originalInput = color;
  16868. this.r = rgb.r;
  16869. this.g = rgb.g;
  16870. this.b = rgb.b;
  16871. this.a = rgb.a;
  16872. this.roundA = Math.round(100 * this.a) / 100;
  16873. this.format = (_a = opts.format) !== null && _a !== void 0 ? _a : rgb.format;
  16874. this.gradientType = opts.gradientType;
  16875. if (this.r < 1) {
  16876. this.r = Math.round(this.r);
  16877. }
  16878. if (this.g < 1) {
  16879. this.g = Math.round(this.g);
  16880. }
  16881. if (this.b < 1) {
  16882. this.b = Math.round(this.b);
  16883. }
  16884. this.isValid = rgb.ok;
  16885. }
  16886. TinyColor2.prototype.isDark = function() {
  16887. return this.getBrightness() < 128;
  16888. };
  16889. TinyColor2.prototype.isLight = function() {
  16890. return !this.isDark();
  16891. };
  16892. TinyColor2.prototype.getBrightness = function() {
  16893. var rgb = this.toRgb();
  16894. return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1e3;
  16895. };
  16896. TinyColor2.prototype.getLuminance = function() {
  16897. var rgb = this.toRgb();
  16898. var R;
  16899. var G;
  16900. var B;
  16901. var RsRGB = rgb.r / 255;
  16902. var GsRGB = rgb.g / 255;
  16903. var BsRGB = rgb.b / 255;
  16904. if (RsRGB <= 0.03928) {
  16905. R = RsRGB / 12.92;
  16906. } else {
  16907. R = Math.pow((RsRGB + 0.055) / 1.055, 2.4);
  16908. }
  16909. if (GsRGB <= 0.03928) {
  16910. G = GsRGB / 12.92;
  16911. } else {
  16912. G = Math.pow((GsRGB + 0.055) / 1.055, 2.4);
  16913. }
  16914. if (BsRGB <= 0.03928) {
  16915. B = BsRGB / 12.92;
  16916. } else {
  16917. B = Math.pow((BsRGB + 0.055) / 1.055, 2.4);
  16918. }
  16919. return 0.2126 * R + 0.7152 * G + 0.0722 * B;
  16920. };
  16921. TinyColor2.prototype.getAlpha = function() {
  16922. return this.a;
  16923. };
  16924. TinyColor2.prototype.setAlpha = function(alpha) {
  16925. this.a = boundAlpha(alpha);
  16926. this.roundA = Math.round(100 * this.a) / 100;
  16927. return this;
  16928. };
  16929. TinyColor2.prototype.toHsv = function() {
  16930. var hsv = rgbToHsv(this.r, this.g, this.b);
  16931. return { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: this.a };
  16932. };
  16933. TinyColor2.prototype.toHsvString = function() {
  16934. var hsv = rgbToHsv(this.r, this.g, this.b);
  16935. var h = Math.round(hsv.h * 360);
  16936. var s = Math.round(hsv.s * 100);
  16937. var v = Math.round(hsv.v * 100);
  16938. return this.a === 1 ? "hsv(".concat(h, ", ").concat(s, "%, ").concat(v, "%)") : "hsva(".concat(h, ", ").concat(s, "%, ").concat(v, "%, ").concat(this.roundA, ")");
  16939. };
  16940. TinyColor2.prototype.toHsl = function() {
  16941. var hsl = rgbToHsl(this.r, this.g, this.b);
  16942. return { h: hsl.h * 360, s: hsl.s, l: hsl.l, a: this.a };
  16943. };
  16944. TinyColor2.prototype.toHslString = function() {
  16945. var hsl = rgbToHsl(this.r, this.g, this.b);
  16946. var h = Math.round(hsl.h * 360);
  16947. var s = Math.round(hsl.s * 100);
  16948. var l = Math.round(hsl.l * 100);
  16949. return this.a === 1 ? "hsl(".concat(h, ", ").concat(s, "%, ").concat(l, "%)") : "hsla(".concat(h, ", ").concat(s, "%, ").concat(l, "%, ").concat(this.roundA, ")");
  16950. };
  16951. TinyColor2.prototype.toHex = function(allow3Char) {
  16952. if (allow3Char === void 0) {
  16953. allow3Char = false;
  16954. }
  16955. return rgbToHex(this.r, this.g, this.b, allow3Char);
  16956. };
  16957. TinyColor2.prototype.toHexString = function(allow3Char) {
  16958. if (allow3Char === void 0) {
  16959. allow3Char = false;
  16960. }
  16961. return "#" + this.toHex(allow3Char);
  16962. };
  16963. TinyColor2.prototype.toHex8 = function(allow4Char) {
  16964. if (allow4Char === void 0) {
  16965. allow4Char = false;
  16966. }
  16967. return rgbaToHex(this.r, this.g, this.b, this.a, allow4Char);
  16968. };
  16969. TinyColor2.prototype.toHex8String = function(allow4Char) {
  16970. if (allow4Char === void 0) {
  16971. allow4Char = false;
  16972. }
  16973. return "#" + this.toHex8(allow4Char);
  16974. };
  16975. TinyColor2.prototype.toRgb = function() {
  16976. return {
  16977. r: Math.round(this.r),
  16978. g: Math.round(this.g),
  16979. b: Math.round(this.b),
  16980. a: this.a
  16981. };
  16982. };
  16983. TinyColor2.prototype.toRgbString = function() {
  16984. var r = Math.round(this.r);
  16985. var g = Math.round(this.g);
  16986. var b = Math.round(this.b);
  16987. return this.a === 1 ? "rgb(".concat(r, ", ").concat(g, ", ").concat(b, ")") : "rgba(".concat(r, ", ").concat(g, ", ").concat(b, ", ").concat(this.roundA, ")");
  16988. };
  16989. TinyColor2.prototype.toPercentageRgb = function() {
  16990. var fmt = function(x) {
  16991. return "".concat(Math.round(bound01$1(x, 255) * 100), "%");
  16992. };
  16993. return {
  16994. r: fmt(this.r),
  16995. g: fmt(this.g),
  16996. b: fmt(this.b),
  16997. a: this.a
  16998. };
  16999. };
  17000. TinyColor2.prototype.toPercentageRgbString = function() {
  17001. var rnd = function(x) {
  17002. return Math.round(bound01$1(x, 255) * 100);
  17003. };
  17004. 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, ")");
  17005. };
  17006. TinyColor2.prototype.toName = function() {
  17007. if (this.a === 0) {
  17008. return "transparent";
  17009. }
  17010. if (this.a < 1) {
  17011. return false;
  17012. }
  17013. var hex = "#" + rgbToHex(this.r, this.g, this.b, false);
  17014. for (var _i = 0, _a = Object.entries(names); _i < _a.length; _i++) {
  17015. var _b = _a[_i], key = _b[0], value = _b[1];
  17016. if (hex === value) {
  17017. return key;
  17018. }
  17019. }
  17020. return false;
  17021. };
  17022. TinyColor2.prototype.toString = function(format) {
  17023. var formatSet = Boolean(format);
  17024. format = format !== null && format !== void 0 ? format : this.format;
  17025. var formattedString = false;
  17026. var hasAlpha = this.a < 1 && this.a >= 0;
  17027. var needsAlphaFormat = !formatSet && hasAlpha && (format.startsWith("hex") || format === "name");
  17028. if (needsAlphaFormat) {
  17029. if (format === "name" && this.a === 0) {
  17030. return this.toName();
  17031. }
  17032. return this.toRgbString();
  17033. }
  17034. if (format === "rgb") {
  17035. formattedString = this.toRgbString();
  17036. }
  17037. if (format === "prgb") {
  17038. formattedString = this.toPercentageRgbString();
  17039. }
  17040. if (format === "hex" || format === "hex6") {
  17041. formattedString = this.toHexString();
  17042. }
  17043. if (format === "hex3") {
  17044. formattedString = this.toHexString(true);
  17045. }
  17046. if (format === "hex4") {
  17047. formattedString = this.toHex8String(true);
  17048. }
  17049. if (format === "hex8") {
  17050. formattedString = this.toHex8String();
  17051. }
  17052. if (format === "name") {
  17053. formattedString = this.toName();
  17054. }
  17055. if (format === "hsl") {
  17056. formattedString = this.toHslString();
  17057. }
  17058. if (format === "hsv") {
  17059. formattedString = this.toHsvString();
  17060. }
  17061. return formattedString || this.toHexString();
  17062. };
  17063. TinyColor2.prototype.toNumber = function() {
  17064. return (Math.round(this.r) << 16) + (Math.round(this.g) << 8) + Math.round(this.b);
  17065. };
  17066. TinyColor2.prototype.clone = function() {
  17067. return new TinyColor2(this.toString());
  17068. };
  17069. TinyColor2.prototype.lighten = function(amount) {
  17070. if (amount === void 0) {
  17071. amount = 10;
  17072. }
  17073. var hsl = this.toHsl();
  17074. hsl.l += amount / 100;
  17075. hsl.l = clamp01(hsl.l);
  17076. return new TinyColor2(hsl);
  17077. };
  17078. TinyColor2.prototype.brighten = function(amount) {
  17079. if (amount === void 0) {
  17080. amount = 10;
  17081. }
  17082. var rgb = this.toRgb();
  17083. rgb.r = Math.max(0, Math.min(255, rgb.r - Math.round(255 * -(amount / 100))));
  17084. rgb.g = Math.max(0, Math.min(255, rgb.g - Math.round(255 * -(amount / 100))));
  17085. rgb.b = Math.max(0, Math.min(255, rgb.b - Math.round(255 * -(amount / 100))));
  17086. return new TinyColor2(rgb);
  17087. };
  17088. TinyColor2.prototype.darken = function(amount) {
  17089. if (amount === void 0) {
  17090. amount = 10;
  17091. }
  17092. var hsl = this.toHsl();
  17093. hsl.l -= amount / 100;
  17094. hsl.l = clamp01(hsl.l);
  17095. return new TinyColor2(hsl);
  17096. };
  17097. TinyColor2.prototype.tint = function(amount) {
  17098. if (amount === void 0) {
  17099. amount = 10;
  17100. }
  17101. return this.mix("white", amount);
  17102. };
  17103. TinyColor2.prototype.shade = function(amount) {
  17104. if (amount === void 0) {
  17105. amount = 10;
  17106. }
  17107. return this.mix("black", amount);
  17108. };
  17109. TinyColor2.prototype.desaturate = function(amount) {
  17110. if (amount === void 0) {
  17111. amount = 10;
  17112. }
  17113. var hsl = this.toHsl();
  17114. hsl.s -= amount / 100;
  17115. hsl.s = clamp01(hsl.s);
  17116. return new TinyColor2(hsl);
  17117. };
  17118. TinyColor2.prototype.saturate = function(amount) {
  17119. if (amount === void 0) {
  17120. amount = 10;
  17121. }
  17122. var hsl = this.toHsl();
  17123. hsl.s += amount / 100;
  17124. hsl.s = clamp01(hsl.s);
  17125. return new TinyColor2(hsl);
  17126. };
  17127. TinyColor2.prototype.greyscale = function() {
  17128. return this.desaturate(100);
  17129. };
  17130. TinyColor2.prototype.spin = function(amount) {
  17131. var hsl = this.toHsl();
  17132. var hue = (hsl.h + amount) % 360;
  17133. hsl.h = hue < 0 ? 360 + hue : hue;
  17134. return new TinyColor2(hsl);
  17135. };
  17136. TinyColor2.prototype.mix = function(color, amount) {
  17137. if (amount === void 0) {
  17138. amount = 50;
  17139. }
  17140. var rgb1 = this.toRgb();
  17141. var rgb2 = new TinyColor2(color).toRgb();
  17142. var p = amount / 100;
  17143. var rgba = {
  17144. r: (rgb2.r - rgb1.r) * p + rgb1.r,
  17145. g: (rgb2.g - rgb1.g) * p + rgb1.g,
  17146. b: (rgb2.b - rgb1.b) * p + rgb1.b,
  17147. a: (rgb2.a - rgb1.a) * p + rgb1.a
  17148. };
  17149. return new TinyColor2(rgba);
  17150. };
  17151. TinyColor2.prototype.analogous = function(results, slices) {
  17152. if (results === void 0) {
  17153. results = 6;
  17154. }
  17155. if (slices === void 0) {
  17156. slices = 30;
  17157. }
  17158. var hsl = this.toHsl();
  17159. var part = 360 / slices;
  17160. var ret = [this];
  17161. for (hsl.h = (hsl.h - (part * results >> 1) + 720) % 360; --results; ) {
  17162. hsl.h = (hsl.h + part) % 360;
  17163. ret.push(new TinyColor2(hsl));
  17164. }
  17165. return ret;
  17166. };
  17167. TinyColor2.prototype.complement = function() {
  17168. var hsl = this.toHsl();
  17169. hsl.h = (hsl.h + 180) % 360;
  17170. return new TinyColor2(hsl);
  17171. };
  17172. TinyColor2.prototype.monochromatic = function(results) {
  17173. if (results === void 0) {
  17174. results = 6;
  17175. }
  17176. var hsv = this.toHsv();
  17177. var h = hsv.h;
  17178. var s = hsv.s;
  17179. var v = hsv.v;
  17180. var res = [];
  17181. var modification = 1 / results;
  17182. while (results--) {
  17183. res.push(new TinyColor2({ h, s, v }));
  17184. v = (v + modification) % 1;
  17185. }
  17186. return res;
  17187. };
  17188. TinyColor2.prototype.splitcomplement = function() {
  17189. var hsl = this.toHsl();
  17190. var h = hsl.h;
  17191. return [
  17192. this,
  17193. new TinyColor2({ h: (h + 72) % 360, s: hsl.s, l: hsl.l }),
  17194. new TinyColor2({ h: (h + 216) % 360, s: hsl.s, l: hsl.l })
  17195. ];
  17196. };
  17197. TinyColor2.prototype.onBackground = function(background) {
  17198. var fg = this.toRgb();
  17199. var bg = new TinyColor2(background).toRgb();
  17200. return new TinyColor2({
  17201. r: bg.r + (fg.r - bg.r) * fg.a,
  17202. g: bg.g + (fg.g - bg.g) * fg.a,
  17203. b: bg.b + (fg.b - bg.b) * fg.a
  17204. });
  17205. };
  17206. TinyColor2.prototype.triad = function() {
  17207. return this.polyad(3);
  17208. };
  17209. TinyColor2.prototype.tetrad = function() {
  17210. return this.polyad(4);
  17211. };
  17212. TinyColor2.prototype.polyad = function(n) {
  17213. var hsl = this.toHsl();
  17214. var h = hsl.h;
  17215. var result = [this];
  17216. var increment = 360 / n;
  17217. for (var i = 1; i < n; i++) {
  17218. result.push(new TinyColor2({ h: (h + i * increment) % 360, s: hsl.s, l: hsl.l }));
  17219. }
  17220. return result;
  17221. };
  17222. TinyColor2.prototype.equals = function(color) {
  17223. return this.toRgbString() === new TinyColor2(color).toRgbString();
  17224. };
  17225. return TinyColor2;
  17226. }();
  17227. function darken(color, amount = 20) {
  17228. return color.mix("#141414", amount).toString();
  17229. }
  17230. function useButtonCustomStyle(props) {
  17231. const _disabled = useFormDisabled();
  17232. const ns = useNamespace("button");
  17233. return computed(() => {
  17234. let styles = {};
  17235. let buttonColor = props.color;
  17236. if (buttonColor) {
  17237. const match = buttonColor.match(/var\((.*?)\)/);
  17238. if (match) {
  17239. buttonColor = window.getComputedStyle(window.document.documentElement).getPropertyValue(match[1]);
  17240. }
  17241. const color = new TinyColor(buttonColor);
  17242. const activeBgColor = props.dark ? color.tint(20).toString() : darken(color, 20);
  17243. if (props.plain) {
  17244. styles = ns.cssVarBlock({
  17245. "bg-color": props.dark ? darken(color, 90) : color.tint(90).toString(),
  17246. "text-color": buttonColor,
  17247. "border-color": props.dark ? darken(color, 50) : color.tint(50).toString(),
  17248. "hover-text-color": `var(${ns.cssVarName("color-white")})`,
  17249. "hover-bg-color": buttonColor,
  17250. "hover-border-color": buttonColor,
  17251. "active-bg-color": activeBgColor,
  17252. "active-text-color": `var(${ns.cssVarName("color-white")})`,
  17253. "active-border-color": activeBgColor
  17254. });
  17255. if (_disabled.value) {
  17256. styles[ns.cssVarBlockName("disabled-bg-color")] = props.dark ? darken(color, 90) : color.tint(90).toString();
  17257. styles[ns.cssVarBlockName("disabled-text-color")] = props.dark ? darken(color, 50) : color.tint(50).toString();
  17258. styles[ns.cssVarBlockName("disabled-border-color")] = props.dark ? darken(color, 80) : color.tint(80).toString();
  17259. }
  17260. } else {
  17261. const hoverBgColor = props.dark ? darken(color, 30) : color.tint(30).toString();
  17262. const textColor = color.isDark() ? `var(${ns.cssVarName("color-white")})` : `var(${ns.cssVarName("color-black")})`;
  17263. styles = ns.cssVarBlock({
  17264. "bg-color": buttonColor,
  17265. "text-color": textColor,
  17266. "border-color": buttonColor,
  17267. "hover-bg-color": hoverBgColor,
  17268. "hover-text-color": textColor,
  17269. "hover-border-color": hoverBgColor,
  17270. "active-bg-color": activeBgColor,
  17271. "active-border-color": activeBgColor
  17272. });
  17273. if (_disabled.value) {
  17274. const disabledButtonColor = props.dark ? darken(color, 50) : color.tint(50).toString();
  17275. styles[ns.cssVarBlockName("disabled-bg-color")] = disabledButtonColor;
  17276. styles[ns.cssVarBlockName("disabled-text-color")] = props.dark ? "rgba(255, 255, 255, 0.5)" : `var(${ns.cssVarName("color-white")})`;
  17277. styles[ns.cssVarBlockName("disabled-border-color")] = disabledButtonColor;
  17278. }
  17279. }
  17280. }
  17281. return styles;
  17282. });
  17283. }
  17284. const __default__$1A = defineComponent({
  17285. name: "ElButton"
  17286. });
  17287. const _sfc_main$29 = /* @__PURE__ */ defineComponent({
  17288. ...__default__$1A,
  17289. props: buttonProps,
  17290. emits: buttonEmits,
  17291. setup(__props, { expose, emit }) {
  17292. const props = __props;
  17293. const buttonStyle = useButtonCustomStyle(props);
  17294. const ns = useNamespace("button");
  17295. const { _ref, _size, _type, _disabled, _props, shouldAddSpace, handleClick } = useButton(props, emit);
  17296. const buttonKls = computed(() => [
  17297. ns.b(),
  17298. ns.m(_type.value),
  17299. ns.m(_size.value),
  17300. ns.is("disabled", _disabled.value),
  17301. ns.is("loading", props.loading),
  17302. ns.is("plain", props.plain),
  17303. ns.is("round", props.round),
  17304. ns.is("circle", props.circle),
  17305. ns.is("text", props.text),
  17306. ns.is("link", props.link),
  17307. ns.is("has-bg", props.bg)
  17308. ]);
  17309. expose({
  17310. ref: _ref,
  17311. size: _size,
  17312. type: _type,
  17313. disabled: _disabled,
  17314. shouldAddSpace
  17315. });
  17316. return (_ctx, _cache) => {
  17317. return openBlock(), createBlock(resolveDynamicComponent(_ctx.tag), mergeProps({
  17318. ref_key: "_ref",
  17319. ref: _ref
  17320. }, unref(_props), {
  17321. class: unref(buttonKls),
  17322. style: unref(buttonStyle),
  17323. onClick: unref(handleClick)
  17324. }), {
  17325. default: withCtx(() => [
  17326. _ctx.loading ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  17327. _ctx.$slots.loading ? renderSlot(_ctx.$slots, "loading", { key: 0 }) : (openBlock(), createBlock(unref(ElIcon), {
  17328. key: 1,
  17329. class: normalizeClass(unref(ns).is("loading"))
  17330. }, {
  17331. default: withCtx(() => [
  17332. (openBlock(), createBlock(resolveDynamicComponent(_ctx.loadingIcon)))
  17333. ]),
  17334. _: 1
  17335. }, 8, ["class"]))
  17336. ], 64)) : _ctx.icon || _ctx.$slots.icon ? (openBlock(), createBlock(unref(ElIcon), { key: 1 }, {
  17337. default: withCtx(() => [
  17338. _ctx.icon ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.icon), { key: 0 })) : renderSlot(_ctx.$slots, "icon", { key: 1 })
  17339. ]),
  17340. _: 3
  17341. })) : createCommentVNode("v-if", true),
  17342. _ctx.$slots.default ? (openBlock(), createElementBlock("span", {
  17343. key: 2,
  17344. class: normalizeClass({ [unref(ns).em("text", "expand")]: unref(shouldAddSpace) })
  17345. }, [
  17346. renderSlot(_ctx.$slots, "default")
  17347. ], 2)) : createCommentVNode("v-if", true)
  17348. ]),
  17349. _: 3
  17350. }, 16, ["class", "style", "onClick"]);
  17351. };
  17352. }
  17353. });
  17354. var Button = /* @__PURE__ */ _export_sfc(_sfc_main$29, [["__file", "button.vue"]]);
  17355. const buttonGroupProps = {
  17356. size: buttonProps.size,
  17357. type: buttonProps.type
  17358. };
  17359. const __default__$1z = defineComponent({
  17360. name: "ElButtonGroup"
  17361. });
  17362. const _sfc_main$28 = /* @__PURE__ */ defineComponent({
  17363. ...__default__$1z,
  17364. props: buttonGroupProps,
  17365. setup(__props) {
  17366. const props = __props;
  17367. provide(buttonGroupContextKey, reactive({
  17368. size: toRef(props, "size"),
  17369. type: toRef(props, "type")
  17370. }));
  17371. const ns = useNamespace("button");
  17372. return (_ctx, _cache) => {
  17373. return openBlock(), createElementBlock("div", {
  17374. class: normalizeClass(unref(ns).b("group"))
  17375. }, [
  17376. renderSlot(_ctx.$slots, "default")
  17377. ], 2);
  17378. };
  17379. }
  17380. });
  17381. var ButtonGroup = /* @__PURE__ */ _export_sfc(_sfc_main$28, [["__file", "button-group.vue"]]);
  17382. const ElButton = withInstall(Button, {
  17383. ButtonGroup
  17384. });
  17385. const ElButtonGroup$1 = withNoopInstall(ButtonGroup);
  17386. var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
  17387. var dayjs_min = {exports: {}};
  17388. (function(module, exports) {
  17389. !function(t, e) {
  17390. module.exports = e() ;
  17391. }(commonjsGlobal, function() {
  17392. 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) {
  17393. var e2 = ["th", "st", "nd", "rd"], n2 = t2 % 100;
  17394. return "[" + t2 + (e2[(n2 - 20) % 10] || e2[n2] || e2[0]) + "]";
  17395. } }, m = function(t2, e2, n2) {
  17396. var r2 = String(t2);
  17397. return !r2 || r2.length >= e2 ? t2 : "" + Array(e2 + 1 - r2.length).join(n2) + t2;
  17398. }, v = { s: m, z: function(t2) {
  17399. var e2 = -t2.utcOffset(), n2 = Math.abs(e2), r2 = Math.floor(n2 / 60), i2 = n2 % 60;
  17400. return (e2 <= 0 ? "+" : "-") + m(r2, 2, "0") + ":" + m(i2, 2, "0");
  17401. }, m: function t2(e2, n2) {
  17402. if (e2.date() < n2.date())
  17403. return -t2(n2, e2);
  17404. 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);
  17405. return +(-(r2 + (n2 - i2) / (s2 ? i2 - u2 : u2 - i2)) || 0);
  17406. }, a: function(t2) {
  17407. return t2 < 0 ? Math.ceil(t2) || 0 : Math.floor(t2);
  17408. }, p: function(t2) {
  17409. 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$/, "");
  17410. }, u: function(t2) {
  17411. return t2 === void 0;
  17412. } }, g = "en", D = {};
  17413. D[g] = M;
  17414. var p = "$isDayjsObject", S = function(t2) {
  17415. return t2 instanceof _ || !(!t2 || !t2[p]);
  17416. }, w = function t2(e2, n2, r2) {
  17417. var i2;
  17418. if (!e2)
  17419. return g;
  17420. if (typeof e2 == "string") {
  17421. var s2 = e2.toLowerCase();
  17422. D[s2] && (i2 = s2), n2 && (D[s2] = n2, i2 = s2);
  17423. var u2 = e2.split("-");
  17424. if (!i2 && u2.length > 1)
  17425. return t2(u2[0]);
  17426. } else {
  17427. var a2 = e2.name;
  17428. D[a2] = e2, i2 = a2;
  17429. }
  17430. return !r2 && i2 && (g = i2), i2 || !r2 && g;
  17431. }, O = function(t2, e2) {
  17432. if (S(t2))
  17433. return t2.clone();
  17434. var n2 = typeof e2 == "object" ? e2 : {};
  17435. return n2.date = t2, n2.args = arguments, new _(n2);
  17436. }, b = v;
  17437. b.l = w, b.i = S, b.w = function(t2, e2) {
  17438. return O(t2, { locale: e2.$L, utc: e2.$u, x: e2.$x, $offset: e2.$offset });
  17439. };
  17440. var _ = function() {
  17441. function M2(t2) {
  17442. this.$L = w(t2.locale, null, true), this.parse(t2), this.$x = this.$x || t2.x || {}, this[p] = true;
  17443. }
  17444. var m2 = M2.prototype;
  17445. return m2.parse = function(t2) {
  17446. this.$d = function(t3) {
  17447. var e2 = t3.date, n2 = t3.utc;
  17448. if (e2 === null)
  17449. return new Date(NaN);
  17450. if (b.u(e2))
  17451. return new Date();
  17452. if (e2 instanceof Date)
  17453. return new Date(e2);
  17454. if (typeof e2 == "string" && !/Z$/i.test(e2)) {
  17455. var r2 = e2.match($);
  17456. if (r2) {
  17457. var i2 = r2[2] - 1 || 0, s2 = (r2[7] || "0").substring(0, 3);
  17458. 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);
  17459. }
  17460. }
  17461. return new Date(e2);
  17462. }(t2), this.init();
  17463. }, m2.init = function() {
  17464. var t2 = this.$d;
  17465. 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();
  17466. }, m2.$utils = function() {
  17467. return b;
  17468. }, m2.isValid = function() {
  17469. return !(this.$d.toString() === l);
  17470. }, m2.isSame = function(t2, e2) {
  17471. var n2 = O(t2);
  17472. return this.startOf(e2) <= n2 && n2 <= this.endOf(e2);
  17473. }, m2.isAfter = function(t2, e2) {
  17474. return O(t2) < this.startOf(e2);
  17475. }, m2.isBefore = function(t2, e2) {
  17476. return this.endOf(e2) < O(t2);
  17477. }, m2.$g = function(t2, e2, n2) {
  17478. return b.u(t2) ? this[e2] : this.set(n2, t2);
  17479. }, m2.unix = function() {
  17480. return Math.floor(this.valueOf() / 1e3);
  17481. }, m2.valueOf = function() {
  17482. return this.$d.getTime();
  17483. }, m2.startOf = function(t2, e2) {
  17484. var n2 = this, r2 = !!b.u(e2) || e2, f2 = b.p(t2), l2 = function(t3, e3) {
  17485. var i2 = b.w(n2.$u ? Date.UTC(n2.$y, e3, t3) : new Date(n2.$y, e3, t3), n2);
  17486. return r2 ? i2 : i2.endOf(a);
  17487. }, $2 = function(t3, e3) {
  17488. return b.w(n2.toDate()[t3].apply(n2.toDate("s"), (r2 ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(e3)), n2);
  17489. }, y2 = this.$W, M3 = this.$M, m3 = this.$D, v2 = "set" + (this.$u ? "UTC" : "");
  17490. switch (f2) {
  17491. case h:
  17492. return r2 ? l2(1, 0) : l2(31, 11);
  17493. case c:
  17494. return r2 ? l2(1, M3) : l2(0, M3 + 1);
  17495. case o:
  17496. var g2 = this.$locale().weekStart || 0, D2 = (y2 < g2 ? y2 + 7 : y2) - g2;
  17497. return l2(r2 ? m3 - D2 : m3 + (6 - D2), M3);
  17498. case a:
  17499. case d:
  17500. return $2(v2 + "Hours", 0);
  17501. case u:
  17502. return $2(v2 + "Minutes", 1);
  17503. case s:
  17504. return $2(v2 + "Seconds", 2);
  17505. case i:
  17506. return $2(v2 + "Milliseconds", 3);
  17507. default:
  17508. return this.clone();
  17509. }
  17510. }, m2.endOf = function(t2) {
  17511. return this.startOf(t2, false);
  17512. }, m2.$set = function(t2, e2) {
  17513. 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;
  17514. if (o2 === c || o2 === h) {
  17515. var y2 = this.clone().set(d, 1);
  17516. y2.$d[l2]($2), y2.init(), this.$d = y2.set(d, Math.min(this.$D, y2.daysInMonth())).$d;
  17517. } else
  17518. l2 && this.$d[l2]($2);
  17519. return this.init(), this;
  17520. }, m2.set = function(t2, e2) {
  17521. return this.clone().$set(t2, e2);
  17522. }, m2.get = function(t2) {
  17523. return this[b.p(t2)]();
  17524. }, m2.add = function(r2, f2) {
  17525. var d2, l2 = this;
  17526. r2 = Number(r2);
  17527. var $2 = b.p(f2), y2 = function(t2) {
  17528. var e2 = O(l2);
  17529. return b.w(e2.date(e2.date() + Math.round(t2 * r2)), l2);
  17530. };
  17531. if ($2 === c)
  17532. return this.set(c, this.$M + r2);
  17533. if ($2 === h)
  17534. return this.set(h, this.$y + r2);
  17535. if ($2 === a)
  17536. return y2(1);
  17537. if ($2 === o)
  17538. return y2(7);
  17539. var M3 = (d2 = {}, d2[s] = e, d2[u] = n, d2[i] = t, d2)[$2] || 1, m3 = this.$d.getTime() + r2 * M3;
  17540. return b.w(m3, this);
  17541. }, m2.subtract = function(t2, e2) {
  17542. return this.add(-1 * t2, e2);
  17543. }, m2.format = function(t2) {
  17544. var e2 = this, n2 = this.$locale();
  17545. if (!this.isValid())
  17546. return n2.invalidDate || l;
  17547. 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) {
  17548. return t3 && (t3[n3] || t3(e2, r2)) || i3[n3].slice(0, s3);
  17549. }, d2 = function(t3) {
  17550. return b.s(s2 % 12 || 12, t3, "0");
  17551. }, $2 = f2 || function(t3, e3, n3) {
  17552. var r3 = t3 < 12 ? "AM" : "PM";
  17553. return n3 ? r3.toLowerCase() : r3;
  17554. };
  17555. return r2.replace(y, function(t3, r3) {
  17556. return r3 || function(t4) {
  17557. switch (t4) {
  17558. case "YY":
  17559. return String(e2.$y).slice(-2);
  17560. case "YYYY":
  17561. return b.s(e2.$y, 4, "0");
  17562. case "M":
  17563. return a2 + 1;
  17564. case "MM":
  17565. return b.s(a2 + 1, 2, "0");
  17566. case "MMM":
  17567. return h2(n2.monthsShort, a2, c2, 3);
  17568. case "MMMM":
  17569. return h2(c2, a2);
  17570. case "D":
  17571. return e2.$D;
  17572. case "DD":
  17573. return b.s(e2.$D, 2, "0");
  17574. case "d":
  17575. return String(e2.$W);
  17576. case "dd":
  17577. return h2(n2.weekdaysMin, e2.$W, o2, 2);
  17578. case "ddd":
  17579. return h2(n2.weekdaysShort, e2.$W, o2, 3);
  17580. case "dddd":
  17581. return o2[e2.$W];
  17582. case "H":
  17583. return String(s2);
  17584. case "HH":
  17585. return b.s(s2, 2, "0");
  17586. case "h":
  17587. return d2(1);
  17588. case "hh":
  17589. return d2(2);
  17590. case "a":
  17591. return $2(s2, u2, true);
  17592. case "A":
  17593. return $2(s2, u2, false);
  17594. case "m":
  17595. return String(u2);
  17596. case "mm":
  17597. return b.s(u2, 2, "0");
  17598. case "s":
  17599. return String(e2.$s);
  17600. case "ss":
  17601. return b.s(e2.$s, 2, "0");
  17602. case "SSS":
  17603. return b.s(e2.$ms, 3, "0");
  17604. case "Z":
  17605. return i2;
  17606. }
  17607. return null;
  17608. }(t3) || i2.replace(":", "");
  17609. });
  17610. }, m2.utcOffset = function() {
  17611. return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
  17612. }, m2.diff = function(r2, d2, l2) {
  17613. var $2, y2 = this, M3 = b.p(d2), m3 = O(r2), v2 = (m3.utcOffset() - this.utcOffset()) * e, g2 = this - m3, D2 = function() {
  17614. return b.m(y2, m3);
  17615. };
  17616. switch (M3) {
  17617. case h:
  17618. $2 = D2() / 12;
  17619. break;
  17620. case c:
  17621. $2 = D2();
  17622. break;
  17623. case f:
  17624. $2 = D2() / 3;
  17625. break;
  17626. case o:
  17627. $2 = (g2 - v2) / 6048e5;
  17628. break;
  17629. case a:
  17630. $2 = (g2 - v2) / 864e5;
  17631. break;
  17632. case u:
  17633. $2 = g2 / n;
  17634. break;
  17635. case s:
  17636. $2 = g2 / e;
  17637. break;
  17638. case i:
  17639. $2 = g2 / t;
  17640. break;
  17641. default:
  17642. $2 = g2;
  17643. }
  17644. return l2 ? $2 : b.a($2);
  17645. }, m2.daysInMonth = function() {
  17646. return this.endOf(c).$D;
  17647. }, m2.$locale = function() {
  17648. return D[this.$L];
  17649. }, m2.locale = function(t2, e2) {
  17650. if (!t2)
  17651. return this.$L;
  17652. var n2 = this.clone(), r2 = w(t2, e2, true);
  17653. return r2 && (n2.$L = r2), n2;
  17654. }, m2.clone = function() {
  17655. return b.w(this.$d, this);
  17656. }, m2.toDate = function() {
  17657. return new Date(this.valueOf());
  17658. }, m2.toJSON = function() {
  17659. return this.isValid() ? this.toISOString() : null;
  17660. }, m2.toISOString = function() {
  17661. return this.$d.toISOString();
  17662. }, m2.toString = function() {
  17663. return this.$d.toUTCString();
  17664. }, M2;
  17665. }(), k = _.prototype;
  17666. return O.prototype = k, [["$ms", r], ["$s", i], ["$m", s], ["$H", u], ["$W", a], ["$M", c], ["$y", h], ["$D", d]].forEach(function(t2) {
  17667. k[t2[1]] = function(e2) {
  17668. return this.$g(e2, t2[0], t2[1]);
  17669. };
  17670. }), O.extend = function(t2, e2) {
  17671. return t2.$i || (t2(e2, _, O), t2.$i = true), O;
  17672. }, O.locale = w, O.isDayjs = S, O.unix = function(t2) {
  17673. return O(1e3 * t2);
  17674. }, O.en = D[g], O.Ls = D, O.p = {}, O;
  17675. });
  17676. })(dayjs_min);
  17677. var dayjs = dayjs_min.exports;
  17678. var customParseFormat$1 = {exports: {}};
  17679. (function(module, exports) {
  17680. !function(e, t) {
  17681. module.exports = t() ;
  17682. }(commonjsGlobal, function() {
  17683. 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) {
  17684. return (e2 = +e2) + (e2 > 68 ? 1900 : 2e3);
  17685. };
  17686. var f = function(e2) {
  17687. return function(t2) {
  17688. this[e2] = +t2;
  17689. };
  17690. }, h = [/[+-]\d\d:?(\d\d)?|Z/, function(e2) {
  17691. (this.zone || (this.zone = {})).offset = function(e3) {
  17692. if (!e3)
  17693. return 0;
  17694. if (e3 === "Z")
  17695. return 0;
  17696. var t2 = e3.match(/([+-]|\d\d)/g), n2 = 60 * t2[1] + (+t2[2] || 0);
  17697. return n2 === 0 ? 0 : t2[0] === "+" ? -n2 : n2;
  17698. }(e2);
  17699. }], u = function(e2) {
  17700. var t2 = s[e2];
  17701. return t2 && (t2.indexOf ? t2 : t2.s.concat(t2.f));
  17702. }, d = function(e2, t2) {
  17703. var n2, r2 = s.meridiem;
  17704. if (r2) {
  17705. for (var i2 = 1; i2 <= 24; i2 += 1)
  17706. if (e2.indexOf(r2(i2, 0, t2)) > -1) {
  17707. n2 = i2 > 12;
  17708. break;
  17709. }
  17710. } else
  17711. n2 = e2 === (t2 ? "pm" : "PM");
  17712. return n2;
  17713. }, c = { A: [o, function(e2) {
  17714. this.afternoon = d(e2, false);
  17715. }], a: [o, function(e2) {
  17716. this.afternoon = d(e2, true);
  17717. }], Q: [n, function(e2) {
  17718. this.month = 3 * (e2 - 1) + 1;
  17719. }], S: [n, function(e2) {
  17720. this.milliseconds = 100 * +e2;
  17721. }], SS: [r, function(e2) {
  17722. this.milliseconds = 10 * +e2;
  17723. }], SSS: [/\d{3}/, function(e2) {
  17724. this.milliseconds = +e2;
  17725. }], 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) {
  17726. var t2 = s.ordinal, n2 = e2.match(/\d+/);
  17727. if (this.day = n2[0], t2)
  17728. for (var r2 = 1; r2 <= 31; r2 += 1)
  17729. t2(r2).replace(/\[|\]/g, "") === e2 && (this.day = r2);
  17730. }], w: [i, f("week")], ww: [r, f("week")], M: [i, f("month")], MM: [r, f("month")], MMM: [o, function(e2) {
  17731. var t2 = u("months"), n2 = (u("monthsShort") || t2.map(function(e3) {
  17732. return e3.slice(0, 3);
  17733. })).indexOf(e2) + 1;
  17734. if (n2 < 1)
  17735. throw new Error();
  17736. this.month = n2 % 12 || n2;
  17737. }], MMMM: [o, function(e2) {
  17738. var t2 = u("months").indexOf(e2) + 1;
  17739. if (t2 < 1)
  17740. throw new Error();
  17741. this.month = t2 % 12 || t2;
  17742. }], Y: [/[+-]?\d+/, f("year")], YY: [r, function(e2) {
  17743. this.year = a(e2);
  17744. }], YYYY: [/\d{4}/, f("year")], Z: h, ZZ: h };
  17745. function l(n2) {
  17746. var r2, i2;
  17747. r2 = n2, i2 = s && s.formats;
  17748. for (var o2 = (n2 = r2.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g, function(t2, n3, r3) {
  17749. var o3 = r3 && r3.toUpperCase();
  17750. return n3 || i2[r3] || e[r3] || i2[o3].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, function(e2, t3, n4) {
  17751. return t3 || n4.slice(1);
  17752. });
  17753. })).match(t), a2 = o2.length, f2 = 0; f2 < a2; f2 += 1) {
  17754. var h2 = o2[f2], u2 = c[h2], d2 = u2 && u2[0], l2 = u2 && u2[1];
  17755. o2[f2] = l2 ? { regex: d2, parser: l2 } : h2.replace(/^\[|\]$/g, "");
  17756. }
  17757. return function(e2) {
  17758. for (var t2 = {}, n3 = 0, r3 = 0; n3 < a2; n3 += 1) {
  17759. var i3 = o2[n3];
  17760. if (typeof i3 == "string")
  17761. r3 += i3.length;
  17762. else {
  17763. var s2 = i3.regex, f3 = i3.parser, h3 = e2.slice(r3), u3 = s2.exec(h3)[0];
  17764. f3.call(t2, u3), e2 = e2.replace(u3, "");
  17765. }
  17766. }
  17767. return function(e3) {
  17768. var t3 = e3.afternoon;
  17769. if (t3 !== void 0) {
  17770. var n4 = e3.hours;
  17771. t3 ? n4 < 12 && (e3.hours += 12) : n4 === 12 && (e3.hours = 0), delete e3.afternoon;
  17772. }
  17773. }(t2), t2;
  17774. };
  17775. }
  17776. return function(e2, t2, n2) {
  17777. n2.p.customParseFormat = true, e2 && e2.parseTwoDigitYear && (a = e2.parseTwoDigitYear);
  17778. var r2 = t2.prototype, i2 = r2.parse;
  17779. r2.parse = function(e3) {
  17780. var t3 = e3.date, r3 = e3.utc, o2 = e3.args;
  17781. this.$u = r3;
  17782. var a2 = o2[1];
  17783. if (typeof a2 == "string") {
  17784. var f2 = o2[2] === true, h2 = o2[3] === true, u2 = f2 || h2, d2 = o2[2];
  17785. h2 && (d2 = o2[2]), s = this.$locale(), !f2 && d2 && (s = n2.Ls[d2]), this.$d = function(e4, t4, n3, r4) {
  17786. try {
  17787. if (["x", "X"].indexOf(t4) > -1)
  17788. return new Date((t4 === "X" ? 1e3 : 1) * e4);
  17789. 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;
  17790. o3 && !s2 || (v = s2 > 0 ? s2 - 1 : M2.getMonth());
  17791. var D, w = f3 || 0, g = h3 || 0, y = u3 || 0, L = d3 || 0;
  17792. 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);
  17793. } catch (e5) {
  17794. return new Date("");
  17795. }
  17796. }(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 = {};
  17797. } else if (a2 instanceof Array)
  17798. for (var c2 = a2.length, m = 1; m <= c2; m += 1) {
  17799. o2[1] = a2[m - 1];
  17800. var M = n2.apply(this, o2);
  17801. if (M.isValid()) {
  17802. this.$d = M.$d, this.$L = M.$L, this.init();
  17803. break;
  17804. }
  17805. m === c2 && (this.$d = new Date(""));
  17806. }
  17807. else
  17808. i2.call(this, e3);
  17809. };
  17810. };
  17811. });
  17812. })(customParseFormat$1);
  17813. var customParseFormat = customParseFormat$1.exports;
  17814. const timeUnits$1 = ["hours", "minutes", "seconds"];
  17815. const DEFAULT_FORMATS_TIME = "HH:mm:ss";
  17816. const DEFAULT_FORMATS_DATE = "YYYY-MM-DD";
  17817. const DEFAULT_FORMATS_DATEPICKER = {
  17818. date: DEFAULT_FORMATS_DATE,
  17819. dates: DEFAULT_FORMATS_DATE,
  17820. week: "gggg[w]ww",
  17821. year: "YYYY",
  17822. years: "YYYY",
  17823. month: "YYYY-MM",
  17824. months: "YYYY-MM",
  17825. datetime: `${DEFAULT_FORMATS_DATE} ${DEFAULT_FORMATS_TIME}`,
  17826. monthrange: "YYYY-MM",
  17827. yearrange: "YYYY",
  17828. daterange: DEFAULT_FORMATS_DATE,
  17829. datetimerange: `${DEFAULT_FORMATS_DATE} ${DEFAULT_FORMATS_TIME}`
  17830. };
  17831. const buildTimeList = (value, bound) => {
  17832. return [
  17833. value > 0 ? value - 1 : void 0,
  17834. value,
  17835. value < bound ? value + 1 : void 0
  17836. ];
  17837. };
  17838. const rangeArr = (n) => Array.from(Array.from({ length: n }).keys());
  17839. const extractDateFormat = (format) => {
  17840. return format.replace(/\W?m{1,2}|\W?ZZ/g, "").replace(/\W?h{1,2}|\W?s{1,3}|\W?a/gi, "").trim();
  17841. };
  17842. const extractTimeFormat = (format) => {
  17843. return format.replace(/\W?D{1,2}|\W?Do|\W?d{1,4}|\W?M{1,4}|\W?Y{2,4}/g, "").trim();
  17844. };
  17845. const dateEquals = function(a, b) {
  17846. const aIsDate = isDate$1(a);
  17847. const bIsDate = isDate$1(b);
  17848. if (aIsDate && bIsDate) {
  17849. return a.getTime() === b.getTime();
  17850. }
  17851. if (!aIsDate && !bIsDate) {
  17852. return a === b;
  17853. }
  17854. return false;
  17855. };
  17856. const valueEquals = function(a, b) {
  17857. const aIsArray = isArray$1(a);
  17858. const bIsArray = isArray$1(b);
  17859. if (aIsArray && bIsArray) {
  17860. if (a.length !== b.length) {
  17861. return false;
  17862. }
  17863. return a.every((item, index) => dateEquals(item, b[index]));
  17864. }
  17865. if (!aIsArray && !bIsArray) {
  17866. return dateEquals(a, b);
  17867. }
  17868. return false;
  17869. };
  17870. const parseDate = function(date, format, lang) {
  17871. const day = isEmpty(format) || format === "x" ? dayjs(date).locale(lang) : dayjs(date, format).locale(lang);
  17872. return day.isValid() ? day : void 0;
  17873. };
  17874. const formatter = function(date, format, lang) {
  17875. if (isEmpty(format))
  17876. return date;
  17877. if (format === "x")
  17878. return +date;
  17879. return dayjs(date).locale(lang).format(format);
  17880. };
  17881. const makeList = (total, method) => {
  17882. var _a;
  17883. const arr = [];
  17884. const disabledArr = method == null ? void 0 : method();
  17885. for (let i = 0; i < total; i++) {
  17886. arr.push((_a = disabledArr == null ? void 0 : disabledArr.includes(i)) != null ? _a : false);
  17887. }
  17888. return arr;
  17889. };
  17890. const dayOrDaysToDate = (dayOrDays) => {
  17891. return isArray$1(dayOrDays) ? dayOrDays.map((d) => d.toDate()) : dayOrDays.toDate();
  17892. };
  17893. const disabledTimeListsProps = buildProps({
  17894. disabledHours: {
  17895. type: definePropType(Function)
  17896. },
  17897. disabledMinutes: {
  17898. type: definePropType(Function)
  17899. },
  17900. disabledSeconds: {
  17901. type: definePropType(Function)
  17902. }
  17903. });
  17904. const timePanelSharedProps = buildProps({
  17905. visible: Boolean,
  17906. actualVisible: {
  17907. type: Boolean,
  17908. default: void 0
  17909. },
  17910. format: {
  17911. type: String,
  17912. default: ""
  17913. }
  17914. });
  17915. const timePickerDefaultProps = buildProps({
  17916. id: {
  17917. type: definePropType([Array, String])
  17918. },
  17919. name: {
  17920. type: definePropType([Array, String])
  17921. },
  17922. popperClass: {
  17923. type: String,
  17924. default: ""
  17925. },
  17926. format: String,
  17927. valueFormat: String,
  17928. dateFormat: String,
  17929. timeFormat: String,
  17930. type: {
  17931. type: String,
  17932. default: ""
  17933. },
  17934. clearable: {
  17935. type: Boolean,
  17936. default: true
  17937. },
  17938. clearIcon: {
  17939. type: definePropType([String, Object]),
  17940. default: circle_close_default
  17941. },
  17942. editable: {
  17943. type: Boolean,
  17944. default: true
  17945. },
  17946. prefixIcon: {
  17947. type: definePropType([String, Object]),
  17948. default: ""
  17949. },
  17950. size: useSizeProp,
  17951. readonly: Boolean,
  17952. disabled: Boolean,
  17953. placeholder: {
  17954. type: String,
  17955. default: ""
  17956. },
  17957. popperOptions: {
  17958. type: definePropType(Object),
  17959. default: () => ({})
  17960. },
  17961. modelValue: {
  17962. type: definePropType([Date, Array, String, Number]),
  17963. default: ""
  17964. },
  17965. rangeSeparator: {
  17966. type: String,
  17967. default: "-"
  17968. },
  17969. startPlaceholder: String,
  17970. endPlaceholder: String,
  17971. defaultValue: {
  17972. type: definePropType([Date, Array])
  17973. },
  17974. defaultTime: {
  17975. type: definePropType([Date, Array])
  17976. },
  17977. isRange: Boolean,
  17978. ...disabledTimeListsProps,
  17979. disabledDate: {
  17980. type: Function
  17981. },
  17982. cellClassName: {
  17983. type: Function
  17984. },
  17985. shortcuts: {
  17986. type: Array,
  17987. default: () => []
  17988. },
  17989. arrowControl: Boolean,
  17990. tabindex: {
  17991. type: definePropType([String, Number]),
  17992. default: 0
  17993. },
  17994. validateEvent: {
  17995. type: Boolean,
  17996. default: true
  17997. },
  17998. unlinkPanels: Boolean,
  17999. placement: {
  18000. type: definePropType(String),
  18001. values: Ee,
  18002. default: "bottom"
  18003. },
  18004. fallbackPlacements: {
  18005. type: definePropType(Array),
  18006. default: ["bottom", "top", "right", "left"]
  18007. },
  18008. ...useEmptyValuesProps,
  18009. ...useAriaProps(["ariaLabel"]),
  18010. showNow: {
  18011. type: Boolean,
  18012. default: true
  18013. }
  18014. });
  18015. const timePickerRangeTriggerProps = buildProps({
  18016. id: {
  18017. type: definePropType(Array)
  18018. },
  18019. name: {
  18020. type: definePropType(Array)
  18021. },
  18022. modelValue: {
  18023. type: definePropType([Array, String])
  18024. },
  18025. startPlaceholder: String,
  18026. endPlaceholder: String,
  18027. disabled: Boolean
  18028. });
  18029. const timePickerRngeTriggerProps = timePickerRangeTriggerProps;
  18030. const __default__$1y = defineComponent({
  18031. name: "PickerRangeTrigger",
  18032. inheritAttrs: false
  18033. });
  18034. const _sfc_main$27 = /* @__PURE__ */ defineComponent({
  18035. ...__default__$1y,
  18036. props: timePickerRangeTriggerProps,
  18037. emits: [
  18038. "mouseenter",
  18039. "mouseleave",
  18040. "click",
  18041. "touchstart",
  18042. "focus",
  18043. "blur",
  18044. "startInput",
  18045. "endInput",
  18046. "startChange",
  18047. "endChange"
  18048. ],
  18049. setup(__props, { expose, emit }) {
  18050. const attrs = useAttrs();
  18051. const nsDate = useNamespace("date");
  18052. const nsRange = useNamespace("range");
  18053. const inputRef = ref();
  18054. const endInputRef = ref();
  18055. const { wrapperRef, isFocused } = useFocusController(inputRef);
  18056. const handleClick = (evt) => {
  18057. emit("click", evt);
  18058. };
  18059. const handleMouseEnter = (evt) => {
  18060. emit("mouseenter", evt);
  18061. };
  18062. const handleMouseLeave = (evt) => {
  18063. emit("mouseleave", evt);
  18064. };
  18065. const handleTouchStart = (evt) => {
  18066. emit("mouseenter", evt);
  18067. };
  18068. const handleStartInput = (evt) => {
  18069. emit("startInput", evt);
  18070. };
  18071. const handleEndInput = (evt) => {
  18072. emit("endInput", evt);
  18073. };
  18074. const handleStartChange = (evt) => {
  18075. emit("startChange", evt);
  18076. };
  18077. const handleEndChange = (evt) => {
  18078. emit("endChange", evt);
  18079. };
  18080. const focus = () => {
  18081. var _a;
  18082. (_a = inputRef.value) == null ? void 0 : _a.focus();
  18083. };
  18084. const blur = () => {
  18085. var _a, _b;
  18086. (_a = inputRef.value) == null ? void 0 : _a.blur();
  18087. (_b = endInputRef.value) == null ? void 0 : _b.blur();
  18088. };
  18089. expose({
  18090. focus,
  18091. blur
  18092. });
  18093. return (_ctx, _cache) => {
  18094. return openBlock(), createElementBlock("div", {
  18095. ref_key: "wrapperRef",
  18096. ref: wrapperRef,
  18097. class: normalizeClass([unref(nsDate).is("active", unref(isFocused)), _ctx.$attrs.class]),
  18098. style: normalizeStyle(_ctx.$attrs.style),
  18099. onClick: handleClick,
  18100. onMouseenter: handleMouseEnter,
  18101. onMouseleave: handleMouseLeave,
  18102. onTouchstartPassive: handleTouchStart
  18103. }, [
  18104. renderSlot(_ctx.$slots, "prefix"),
  18105. createElementVNode("input", mergeProps(unref(attrs), {
  18106. id: _ctx.id && _ctx.id[0],
  18107. ref_key: "inputRef",
  18108. ref: inputRef,
  18109. name: _ctx.name && _ctx.name[0],
  18110. placeholder: _ctx.startPlaceholder,
  18111. value: _ctx.modelValue && _ctx.modelValue[0],
  18112. class: unref(nsRange).b("input"),
  18113. disabled: _ctx.disabled,
  18114. onInput: handleStartInput,
  18115. onChange: handleStartChange
  18116. }), null, 16, ["id", "name", "placeholder", "value", "disabled"]),
  18117. renderSlot(_ctx.$slots, "range-separator"),
  18118. createElementVNode("input", mergeProps(unref(attrs), {
  18119. id: _ctx.id && _ctx.id[1],
  18120. ref_key: "endInputRef",
  18121. ref: endInputRef,
  18122. name: _ctx.name && _ctx.name[1],
  18123. placeholder: _ctx.endPlaceholder,
  18124. value: _ctx.modelValue && _ctx.modelValue[1],
  18125. class: unref(nsRange).b("input"),
  18126. disabled: _ctx.disabled,
  18127. onInput: handleEndInput,
  18128. onChange: handleEndChange
  18129. }), null, 16, ["id", "name", "placeholder", "value", "disabled"]),
  18130. renderSlot(_ctx.$slots, "suffix")
  18131. ], 38);
  18132. };
  18133. }
  18134. });
  18135. var PickerRangeTrigger = /* @__PURE__ */ _export_sfc(_sfc_main$27, [["__file", "picker-range-trigger.vue"]]);
  18136. const __default__$1x = defineComponent({
  18137. name: "Picker"
  18138. });
  18139. const _sfc_main$26 = /* @__PURE__ */ defineComponent({
  18140. ...__default__$1x,
  18141. props: timePickerDefaultProps,
  18142. emits: [
  18143. UPDATE_MODEL_EVENT,
  18144. CHANGE_EVENT,
  18145. "focus",
  18146. "blur",
  18147. "clear",
  18148. "calendar-change",
  18149. "panel-change",
  18150. "visible-change",
  18151. "keydown"
  18152. ],
  18153. setup(__props, { expose, emit }) {
  18154. const props = __props;
  18155. const attrs = useAttrs$1();
  18156. const { lang } = useLocale();
  18157. const nsDate = useNamespace("date");
  18158. const nsInput = useNamespace("input");
  18159. const nsRange = useNamespace("range");
  18160. const { form, formItem } = useFormItem();
  18161. const elPopperOptions = inject("ElPopperOptions", {});
  18162. const { valueOnClear } = useEmptyValues(props, null);
  18163. const refPopper = ref();
  18164. const inputRef = ref();
  18165. const pickerVisible = ref(false);
  18166. const pickerActualVisible = ref(false);
  18167. const valueOnOpen = ref(null);
  18168. let hasJustTabExitedInput = false;
  18169. const { isFocused, handleFocus, handleBlur } = useFocusController(inputRef, {
  18170. beforeFocus() {
  18171. return props.readonly || pickerDisabled.value;
  18172. },
  18173. afterFocus() {
  18174. pickerVisible.value = true;
  18175. },
  18176. beforeBlur(event) {
  18177. var _a;
  18178. return !hasJustTabExitedInput && ((_a = refPopper.value) == null ? void 0 : _a.isFocusInsideContent(event));
  18179. },
  18180. afterBlur() {
  18181. handleChange();
  18182. pickerVisible.value = false;
  18183. hasJustTabExitedInput = false;
  18184. props.validateEvent && (formItem == null ? void 0 : formItem.validate("blur").catch((err) => debugWarn()));
  18185. }
  18186. });
  18187. const rangeInputKls = computed(() => [
  18188. nsDate.b("editor"),
  18189. nsDate.bm("editor", props.type),
  18190. nsInput.e("wrapper"),
  18191. nsDate.is("disabled", pickerDisabled.value),
  18192. nsDate.is("active", pickerVisible.value),
  18193. nsRange.b("editor"),
  18194. pickerSize ? nsRange.bm("editor", pickerSize.value) : "",
  18195. attrs.class
  18196. ]);
  18197. const clearIconKls = computed(() => [
  18198. nsInput.e("icon"),
  18199. nsRange.e("close-icon"),
  18200. !showClose.value ? nsRange.e("close-icon--hidden") : ""
  18201. ]);
  18202. watch(pickerVisible, (val) => {
  18203. if (!val) {
  18204. userInput.value = null;
  18205. nextTick(() => {
  18206. emitChange(props.modelValue);
  18207. });
  18208. } else {
  18209. nextTick(() => {
  18210. if (val) {
  18211. valueOnOpen.value = props.modelValue;
  18212. }
  18213. });
  18214. }
  18215. });
  18216. const emitChange = (val, isClear) => {
  18217. if (isClear || !valueEquals(val, valueOnOpen.value)) {
  18218. emit(CHANGE_EVENT, val);
  18219. isClear && (valueOnOpen.value = val);
  18220. props.validateEvent && (formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn()));
  18221. }
  18222. };
  18223. const emitInput = (input) => {
  18224. if (!valueEquals(props.modelValue, input)) {
  18225. let formatted;
  18226. if (isArray$1(input)) {
  18227. formatted = input.map((item) => formatter(item, props.valueFormat, lang.value));
  18228. } else if (input) {
  18229. formatted = formatter(input, props.valueFormat, lang.value);
  18230. }
  18231. emit(UPDATE_MODEL_EVENT, input ? formatted : input, lang.value);
  18232. }
  18233. };
  18234. const emitKeydown = (e) => {
  18235. emit("keydown", e);
  18236. };
  18237. const refInput = computed(() => {
  18238. if (inputRef.value) {
  18239. return Array.from(inputRef.value.$el.querySelectorAll("input"));
  18240. }
  18241. return [];
  18242. });
  18243. const setSelectionRange = (start, end, pos) => {
  18244. const _inputs = refInput.value;
  18245. if (!_inputs.length)
  18246. return;
  18247. if (!pos || pos === "min") {
  18248. _inputs[0].setSelectionRange(start, end);
  18249. _inputs[0].focus();
  18250. } else if (pos === "max") {
  18251. _inputs[1].setSelectionRange(start, end);
  18252. _inputs[1].focus();
  18253. }
  18254. };
  18255. const onPick = (date = "", visible = false) => {
  18256. pickerVisible.value = visible;
  18257. let result;
  18258. if (isArray$1(date)) {
  18259. result = date.map((_) => _.toDate());
  18260. } else {
  18261. result = date ? date.toDate() : date;
  18262. }
  18263. userInput.value = null;
  18264. emitInput(result);
  18265. };
  18266. const onBeforeShow = () => {
  18267. pickerActualVisible.value = true;
  18268. };
  18269. const onShow = () => {
  18270. emit("visible-change", true);
  18271. };
  18272. const onHide = () => {
  18273. pickerActualVisible.value = false;
  18274. pickerVisible.value = false;
  18275. emit("visible-change", false);
  18276. };
  18277. const handleOpen = () => {
  18278. pickerVisible.value = true;
  18279. };
  18280. const handleClose = () => {
  18281. pickerVisible.value = false;
  18282. };
  18283. const pickerDisabled = computed(() => {
  18284. return props.disabled || (form == null ? void 0 : form.disabled);
  18285. });
  18286. const parsedValue = computed(() => {
  18287. let dayOrDays;
  18288. if (valueIsEmpty.value) {
  18289. if (pickerOptions.value.getDefaultValue) {
  18290. dayOrDays = pickerOptions.value.getDefaultValue();
  18291. }
  18292. } else {
  18293. if (isArray$1(props.modelValue)) {
  18294. dayOrDays = props.modelValue.map((d) => parseDate(d, props.valueFormat, lang.value));
  18295. } else {
  18296. dayOrDays = parseDate(props.modelValue, props.valueFormat, lang.value);
  18297. }
  18298. }
  18299. if (pickerOptions.value.getRangeAvailableTime) {
  18300. const availableResult = pickerOptions.value.getRangeAvailableTime(dayOrDays);
  18301. if (!isEqual$1(availableResult, dayOrDays)) {
  18302. dayOrDays = availableResult;
  18303. if (!valueIsEmpty.value) {
  18304. emitInput(dayOrDaysToDate(dayOrDays));
  18305. }
  18306. }
  18307. }
  18308. if (isArray$1(dayOrDays) && dayOrDays.some((day) => !day)) {
  18309. dayOrDays = [];
  18310. }
  18311. return dayOrDays;
  18312. });
  18313. const displayValue = computed(() => {
  18314. if (!pickerOptions.value.panelReady)
  18315. return "";
  18316. const formattedValue = formatDayjsToString(parsedValue.value);
  18317. if (isArray$1(userInput.value)) {
  18318. return [
  18319. userInput.value[0] || formattedValue && formattedValue[0] || "",
  18320. userInput.value[1] || formattedValue && formattedValue[1] || ""
  18321. ];
  18322. } else if (userInput.value !== null) {
  18323. return userInput.value;
  18324. }
  18325. if (!isTimePicker.value && valueIsEmpty.value)
  18326. return "";
  18327. if (!pickerVisible.value && valueIsEmpty.value)
  18328. return "";
  18329. if (formattedValue) {
  18330. return isDatesPicker.value || isMonthsPicker.value || isYearsPicker.value ? formattedValue.join(", ") : formattedValue;
  18331. }
  18332. return "";
  18333. });
  18334. const isTimeLikePicker = computed(() => props.type.includes("time"));
  18335. const isTimePicker = computed(() => props.type.startsWith("time"));
  18336. const isDatesPicker = computed(() => props.type === "dates");
  18337. const isMonthsPicker = computed(() => props.type === "months");
  18338. const isYearsPicker = computed(() => props.type === "years");
  18339. const triggerIcon = computed(() => props.prefixIcon || (isTimeLikePicker.value ? clock_default : calendar_default));
  18340. const showClose = ref(false);
  18341. const onClearIconClick = (event) => {
  18342. if (props.readonly || pickerDisabled.value)
  18343. return;
  18344. if (showClose.value) {
  18345. event.stopPropagation();
  18346. if (pickerOptions.value.handleClear) {
  18347. pickerOptions.value.handleClear();
  18348. } else {
  18349. emitInput(valueOnClear.value);
  18350. }
  18351. emitChange(valueOnClear.value, true);
  18352. showClose.value = false;
  18353. onHide();
  18354. }
  18355. emit("clear");
  18356. };
  18357. const valueIsEmpty = computed(() => {
  18358. const { modelValue } = props;
  18359. return !modelValue || isArray$1(modelValue) && !modelValue.filter(Boolean).length;
  18360. });
  18361. const onMouseDownInput = async (event) => {
  18362. var _a;
  18363. if (props.readonly || pickerDisabled.value)
  18364. return;
  18365. if (((_a = event.target) == null ? void 0 : _a.tagName) !== "INPUT" || isFocused.value) {
  18366. pickerVisible.value = true;
  18367. }
  18368. };
  18369. const onMouseEnter = () => {
  18370. if (props.readonly || pickerDisabled.value)
  18371. return;
  18372. if (!valueIsEmpty.value && props.clearable) {
  18373. showClose.value = true;
  18374. }
  18375. };
  18376. const onMouseLeave = () => {
  18377. showClose.value = false;
  18378. };
  18379. const onTouchStartInput = (event) => {
  18380. var _a;
  18381. if (props.readonly || pickerDisabled.value)
  18382. return;
  18383. if (((_a = event.touches[0].target) == null ? void 0 : _a.tagName) !== "INPUT" || isFocused.value) {
  18384. pickerVisible.value = true;
  18385. }
  18386. };
  18387. const isRangeInput = computed(() => {
  18388. return props.type.includes("range");
  18389. });
  18390. const pickerSize = useFormSize();
  18391. const popperEl = computed(() => {
  18392. var _a, _b;
  18393. return (_b = (_a = unref(refPopper)) == null ? void 0 : _a.popperRef) == null ? void 0 : _b.contentRef;
  18394. });
  18395. const stophandle = onClickOutside(inputRef, (e) => {
  18396. const unrefedPopperEl = unref(popperEl);
  18397. const inputEl = unrefElement(inputRef);
  18398. if (unrefedPopperEl && (e.target === unrefedPopperEl || e.composedPath().includes(unrefedPopperEl)) || e.target === inputEl || inputEl && e.composedPath().includes(inputEl))
  18399. return;
  18400. pickerVisible.value = false;
  18401. });
  18402. onBeforeUnmount(() => {
  18403. stophandle == null ? void 0 : stophandle();
  18404. });
  18405. const userInput = ref(null);
  18406. const handleChange = () => {
  18407. if (userInput.value) {
  18408. const value = parseUserInputToDayjs(displayValue.value);
  18409. if (value) {
  18410. if (isValidValue(value)) {
  18411. emitInput(dayOrDaysToDate(value));
  18412. userInput.value = null;
  18413. }
  18414. }
  18415. }
  18416. if (userInput.value === "") {
  18417. emitInput(valueOnClear.value);
  18418. emitChange(valueOnClear.value, true);
  18419. userInput.value = null;
  18420. }
  18421. };
  18422. const parseUserInputToDayjs = (value) => {
  18423. if (!value)
  18424. return null;
  18425. return pickerOptions.value.parseUserInput(value);
  18426. };
  18427. const formatDayjsToString = (value) => {
  18428. if (!value)
  18429. return null;
  18430. return pickerOptions.value.formatToString(value);
  18431. };
  18432. const isValidValue = (value) => {
  18433. return pickerOptions.value.isValidValue(value);
  18434. };
  18435. const handleKeydownInput = async (event) => {
  18436. if (props.readonly || pickerDisabled.value)
  18437. return;
  18438. const { code } = event;
  18439. emitKeydown(event);
  18440. if (code === EVENT_CODE.esc) {
  18441. if (pickerVisible.value === true) {
  18442. pickerVisible.value = false;
  18443. event.preventDefault();
  18444. event.stopPropagation();
  18445. }
  18446. return;
  18447. }
  18448. if (code === EVENT_CODE.down) {
  18449. if (pickerOptions.value.handleFocusPicker) {
  18450. event.preventDefault();
  18451. event.stopPropagation();
  18452. }
  18453. if (pickerVisible.value === false) {
  18454. pickerVisible.value = true;
  18455. await nextTick();
  18456. }
  18457. if (pickerOptions.value.handleFocusPicker) {
  18458. pickerOptions.value.handleFocusPicker();
  18459. return;
  18460. }
  18461. }
  18462. if (code === EVENT_CODE.tab) {
  18463. hasJustTabExitedInput = true;
  18464. return;
  18465. }
  18466. if (code === EVENT_CODE.enter || code === EVENT_CODE.numpadEnter) {
  18467. if (userInput.value === null || userInput.value === "" || isValidValue(parseUserInputToDayjs(displayValue.value))) {
  18468. handleChange();
  18469. pickerVisible.value = false;
  18470. }
  18471. event.stopPropagation();
  18472. return;
  18473. }
  18474. if (userInput.value) {
  18475. event.stopPropagation();
  18476. return;
  18477. }
  18478. if (pickerOptions.value.handleKeydownInput) {
  18479. pickerOptions.value.handleKeydownInput(event);
  18480. }
  18481. };
  18482. const onUserInput = (e) => {
  18483. userInput.value = e;
  18484. if (!pickerVisible.value) {
  18485. pickerVisible.value = true;
  18486. }
  18487. };
  18488. const handleStartInput = (event) => {
  18489. const target = event.target;
  18490. if (userInput.value) {
  18491. userInput.value = [target.value, userInput.value[1]];
  18492. } else {
  18493. userInput.value = [target.value, null];
  18494. }
  18495. };
  18496. const handleEndInput = (event) => {
  18497. const target = event.target;
  18498. if (userInput.value) {
  18499. userInput.value = [userInput.value[0], target.value];
  18500. } else {
  18501. userInput.value = [null, target.value];
  18502. }
  18503. };
  18504. const handleStartChange = () => {
  18505. var _a;
  18506. const values = userInput.value;
  18507. const value = parseUserInputToDayjs(values && values[0]);
  18508. const parsedVal = unref(parsedValue);
  18509. if (value && value.isValid()) {
  18510. userInput.value = [
  18511. formatDayjsToString(value),
  18512. ((_a = displayValue.value) == null ? void 0 : _a[1]) || null
  18513. ];
  18514. const newValue = [value, parsedVal && (parsedVal[1] || null)];
  18515. if (isValidValue(newValue)) {
  18516. emitInput(dayOrDaysToDate(newValue));
  18517. userInput.value = null;
  18518. }
  18519. }
  18520. };
  18521. const handleEndChange = () => {
  18522. var _a;
  18523. const values = unref(userInput);
  18524. const value = parseUserInputToDayjs(values && values[1]);
  18525. const parsedVal = unref(parsedValue);
  18526. if (value && value.isValid()) {
  18527. userInput.value = [
  18528. ((_a = unref(displayValue)) == null ? void 0 : _a[0]) || null,
  18529. formatDayjsToString(value)
  18530. ];
  18531. const newValue = [parsedVal && parsedVal[0], value];
  18532. if (isValidValue(newValue)) {
  18533. emitInput(dayOrDaysToDate(newValue));
  18534. userInput.value = null;
  18535. }
  18536. }
  18537. };
  18538. const pickerOptions = ref({});
  18539. const onSetPickerOption = (e) => {
  18540. pickerOptions.value[e[0]] = e[1];
  18541. pickerOptions.value.panelReady = true;
  18542. };
  18543. const onCalendarChange = (e) => {
  18544. emit("calendar-change", e);
  18545. };
  18546. const onPanelChange = (value, mode, view) => {
  18547. emit("panel-change", value, mode, view);
  18548. };
  18549. const focus = () => {
  18550. var _a;
  18551. (_a = inputRef.value) == null ? void 0 : _a.focus();
  18552. };
  18553. const blur = () => {
  18554. var _a;
  18555. (_a = inputRef.value) == null ? void 0 : _a.blur();
  18556. };
  18557. provide("EP_PICKER_BASE", {
  18558. props
  18559. });
  18560. expose({
  18561. focus,
  18562. blur,
  18563. handleOpen,
  18564. handleClose,
  18565. onPick
  18566. });
  18567. return (_ctx, _cache) => {
  18568. return openBlock(), createBlock(unref(ElTooltip), mergeProps({
  18569. ref_key: "refPopper",
  18570. ref: refPopper,
  18571. visible: pickerVisible.value,
  18572. effect: "light",
  18573. pure: "",
  18574. trigger: "click"
  18575. }, _ctx.$attrs, {
  18576. role: "dialog",
  18577. teleported: "",
  18578. transition: `${unref(nsDate).namespace.value}-zoom-in-top`,
  18579. "popper-class": [`${unref(nsDate).namespace.value}-picker__popper`, _ctx.popperClass],
  18580. "popper-options": unref(elPopperOptions),
  18581. "fallback-placements": _ctx.fallbackPlacements,
  18582. "gpu-acceleration": false,
  18583. placement: _ctx.placement,
  18584. "stop-popper-mouse-event": false,
  18585. "hide-after": 0,
  18586. persistent: "",
  18587. onBeforeShow,
  18588. onShow,
  18589. onHide
  18590. }), {
  18591. default: withCtx(() => [
  18592. !unref(isRangeInput) ? (openBlock(), createBlock(unref(ElInput), {
  18593. key: 0,
  18594. id: _ctx.id,
  18595. ref_key: "inputRef",
  18596. ref: inputRef,
  18597. "container-role": "combobox",
  18598. "model-value": unref(displayValue),
  18599. name: _ctx.name,
  18600. size: unref(pickerSize),
  18601. disabled: unref(pickerDisabled),
  18602. placeholder: _ctx.placeholder,
  18603. class: normalizeClass([unref(nsDate).b("editor"), unref(nsDate).bm("editor", _ctx.type), _ctx.$attrs.class]),
  18604. style: normalizeStyle(_ctx.$attrs.style),
  18605. readonly: !_ctx.editable || _ctx.readonly || unref(isDatesPicker) || unref(isMonthsPicker) || unref(isYearsPicker) || _ctx.type === "week",
  18606. "aria-label": _ctx.ariaLabel,
  18607. tabindex: _ctx.tabindex,
  18608. "validate-event": false,
  18609. onInput: onUserInput,
  18610. onFocus: unref(handleFocus),
  18611. onBlur: unref(handleBlur),
  18612. onKeydown: handleKeydownInput,
  18613. onChange: handleChange,
  18614. onMousedown: onMouseDownInput,
  18615. onMouseenter: onMouseEnter,
  18616. onMouseleave: onMouseLeave,
  18617. onTouchstartPassive: onTouchStartInput,
  18618. onClick: withModifiers(() => {
  18619. }, ["stop"])
  18620. }, {
  18621. prefix: withCtx(() => [
  18622. unref(triggerIcon) ? (openBlock(), createBlock(unref(ElIcon), {
  18623. key: 0,
  18624. class: normalizeClass(unref(nsInput).e("icon")),
  18625. onMousedown: withModifiers(onMouseDownInput, ["prevent"]),
  18626. onTouchstartPassive: onTouchStartInput
  18627. }, {
  18628. default: withCtx(() => [
  18629. (openBlock(), createBlock(resolveDynamicComponent(unref(triggerIcon))))
  18630. ]),
  18631. _: 1
  18632. }, 8, ["class", "onMousedown"])) : createCommentVNode("v-if", true)
  18633. ]),
  18634. suffix: withCtx(() => [
  18635. showClose.value && _ctx.clearIcon ? (openBlock(), createBlock(unref(ElIcon), {
  18636. key: 0,
  18637. class: normalizeClass(`${unref(nsInput).e("icon")} clear-icon`),
  18638. onMousedown: withModifiers(unref(NOOP), ["prevent"]),
  18639. onClick: onClearIconClick
  18640. }, {
  18641. default: withCtx(() => [
  18642. (openBlock(), createBlock(resolveDynamicComponent(_ctx.clearIcon)))
  18643. ]),
  18644. _: 1
  18645. }, 8, ["class", "onMousedown"])) : createCommentVNode("v-if", true)
  18646. ]),
  18647. _: 1
  18648. }, 8, ["id", "model-value", "name", "size", "disabled", "placeholder", "class", "style", "readonly", "aria-label", "tabindex", "onFocus", "onBlur", "onClick"])) : (openBlock(), createBlock(PickerRangeTrigger, {
  18649. key: 1,
  18650. id: _ctx.id,
  18651. ref_key: "inputRef",
  18652. ref: inputRef,
  18653. "model-value": unref(displayValue),
  18654. name: _ctx.name,
  18655. disabled: unref(pickerDisabled),
  18656. readonly: !_ctx.editable || _ctx.readonly,
  18657. "start-placeholder": _ctx.startPlaceholder,
  18658. "end-placeholder": _ctx.endPlaceholder,
  18659. class: normalizeClass(unref(rangeInputKls)),
  18660. style: normalizeStyle(_ctx.$attrs.style),
  18661. "aria-label": _ctx.ariaLabel,
  18662. tabindex: _ctx.tabindex,
  18663. autocomplete: "off",
  18664. role: "combobox",
  18665. onClick: onMouseDownInput,
  18666. onFocus: unref(handleFocus),
  18667. onBlur: unref(handleBlur),
  18668. onStartInput: handleStartInput,
  18669. onStartChange: handleStartChange,
  18670. onEndInput: handleEndInput,
  18671. onEndChange: handleEndChange,
  18672. onMousedown: onMouseDownInput,
  18673. onMouseenter: onMouseEnter,
  18674. onMouseleave: onMouseLeave,
  18675. onTouchstartPassive: onTouchStartInput,
  18676. onKeydown: handleKeydownInput
  18677. }, {
  18678. prefix: withCtx(() => [
  18679. unref(triggerIcon) ? (openBlock(), createBlock(unref(ElIcon), {
  18680. key: 0,
  18681. class: normalizeClass([unref(nsInput).e("icon"), unref(nsRange).e("icon")])
  18682. }, {
  18683. default: withCtx(() => [
  18684. (openBlock(), createBlock(resolveDynamicComponent(unref(triggerIcon))))
  18685. ]),
  18686. _: 1
  18687. }, 8, ["class"])) : createCommentVNode("v-if", true)
  18688. ]),
  18689. "range-separator": withCtx(() => [
  18690. renderSlot(_ctx.$slots, "range-separator", {}, () => [
  18691. createElementVNode("span", {
  18692. class: normalizeClass(unref(nsRange).b("separator"))
  18693. }, toDisplayString(_ctx.rangeSeparator), 3)
  18694. ])
  18695. ]),
  18696. suffix: withCtx(() => [
  18697. _ctx.clearIcon ? (openBlock(), createBlock(unref(ElIcon), {
  18698. key: 0,
  18699. class: normalizeClass(unref(clearIconKls)),
  18700. onMousedown: withModifiers(unref(NOOP), ["prevent"]),
  18701. onClick: onClearIconClick
  18702. }, {
  18703. default: withCtx(() => [
  18704. (openBlock(), createBlock(resolveDynamicComponent(_ctx.clearIcon)))
  18705. ]),
  18706. _: 1
  18707. }, 8, ["class", "onMousedown"])) : createCommentVNode("v-if", true)
  18708. ]),
  18709. _: 3
  18710. }, 8, ["id", "model-value", "name", "disabled", "readonly", "start-placeholder", "end-placeholder", "class", "style", "aria-label", "tabindex", "onFocus", "onBlur"]))
  18711. ]),
  18712. content: withCtx(() => [
  18713. renderSlot(_ctx.$slots, "default", {
  18714. visible: pickerVisible.value,
  18715. actualVisible: pickerActualVisible.value,
  18716. parsedValue: unref(parsedValue),
  18717. format: _ctx.format,
  18718. dateFormat: _ctx.dateFormat,
  18719. timeFormat: _ctx.timeFormat,
  18720. unlinkPanels: _ctx.unlinkPanels,
  18721. type: _ctx.type,
  18722. defaultValue: _ctx.defaultValue,
  18723. showNow: _ctx.showNow,
  18724. onPick,
  18725. onSelectRange: setSelectionRange,
  18726. onSetPickerOption,
  18727. onCalendarChange,
  18728. onPanelChange,
  18729. onMousedown: withModifiers(() => {
  18730. }, ["stop"])
  18731. })
  18732. ]),
  18733. _: 3
  18734. }, 16, ["visible", "transition", "popper-class", "popper-options", "fallback-placements", "placement"]);
  18735. };
  18736. }
  18737. });
  18738. var CommonPicker = /* @__PURE__ */ _export_sfc(_sfc_main$26, [["__file", "picker.vue"]]);
  18739. const panelTimePickerProps = buildProps({
  18740. ...timePanelSharedProps,
  18741. datetimeRole: String,
  18742. parsedValue: {
  18743. type: definePropType(Object)
  18744. }
  18745. });
  18746. const useTimePanel = ({
  18747. getAvailableHours,
  18748. getAvailableMinutes,
  18749. getAvailableSeconds
  18750. }) => {
  18751. const getAvailableTime = (date, role, first, compareDate) => {
  18752. const availableTimeGetters = {
  18753. hour: getAvailableHours,
  18754. minute: getAvailableMinutes,
  18755. second: getAvailableSeconds
  18756. };
  18757. let result = date;
  18758. ["hour", "minute", "second"].forEach((type) => {
  18759. if (availableTimeGetters[type]) {
  18760. let availableTimeSlots;
  18761. const method = availableTimeGetters[type];
  18762. switch (type) {
  18763. case "minute": {
  18764. availableTimeSlots = method(result.hour(), role, compareDate);
  18765. break;
  18766. }
  18767. case "second": {
  18768. availableTimeSlots = method(result.hour(), result.minute(), role, compareDate);
  18769. break;
  18770. }
  18771. default: {
  18772. availableTimeSlots = method(role, compareDate);
  18773. break;
  18774. }
  18775. }
  18776. if ((availableTimeSlots == null ? void 0 : availableTimeSlots.length) && !availableTimeSlots.includes(result[type]())) {
  18777. const pos = first ? 0 : availableTimeSlots.length - 1;
  18778. result = result[type](availableTimeSlots[pos]);
  18779. }
  18780. }
  18781. });
  18782. return result;
  18783. };
  18784. const timePickerOptions = {};
  18785. const onSetOption = ([key, val]) => {
  18786. timePickerOptions[key] = val;
  18787. };
  18788. return {
  18789. timePickerOptions,
  18790. getAvailableTime,
  18791. onSetOption
  18792. };
  18793. };
  18794. const makeAvailableArr = (disabledList) => {
  18795. const trueOrNumber = (isDisabled, index) => isDisabled || index;
  18796. const getNumber = (predicate) => predicate !== true;
  18797. return disabledList.map(trueOrNumber).filter(getNumber);
  18798. };
  18799. const getTimeLists = (disabledHours, disabledMinutes, disabledSeconds) => {
  18800. const getHoursList = (role, compare) => {
  18801. return makeList(24, disabledHours && (() => disabledHours == null ? void 0 : disabledHours(role, compare)));
  18802. };
  18803. const getMinutesList = (hour, role, compare) => {
  18804. return makeList(60, disabledMinutes && (() => disabledMinutes == null ? void 0 : disabledMinutes(hour, role, compare)));
  18805. };
  18806. const getSecondsList = (hour, minute, role, compare) => {
  18807. return makeList(60, disabledSeconds && (() => disabledSeconds == null ? void 0 : disabledSeconds(hour, minute, role, compare)));
  18808. };
  18809. return {
  18810. getHoursList,
  18811. getMinutesList,
  18812. getSecondsList
  18813. };
  18814. };
  18815. const buildAvailableTimeSlotGetter = (disabledHours, disabledMinutes, disabledSeconds) => {
  18816. const { getHoursList, getMinutesList, getSecondsList } = getTimeLists(disabledHours, disabledMinutes, disabledSeconds);
  18817. const getAvailableHours = (role, compare) => {
  18818. return makeAvailableArr(getHoursList(role, compare));
  18819. };
  18820. const getAvailableMinutes = (hour, role, compare) => {
  18821. return makeAvailableArr(getMinutesList(hour, role, compare));
  18822. };
  18823. const getAvailableSeconds = (hour, minute, role, compare) => {
  18824. return makeAvailableArr(getSecondsList(hour, minute, role, compare));
  18825. };
  18826. return {
  18827. getAvailableHours,
  18828. getAvailableMinutes,
  18829. getAvailableSeconds
  18830. };
  18831. };
  18832. const useOldValue = (props) => {
  18833. const oldValue = ref(props.parsedValue);
  18834. watch(() => props.visible, (val) => {
  18835. if (!val) {
  18836. oldValue.value = props.parsedValue;
  18837. }
  18838. });
  18839. return oldValue;
  18840. };
  18841. const nodeList = /* @__PURE__ */ new Map();
  18842. if (isClient) {
  18843. let startClick;
  18844. document.addEventListener("mousedown", (e) => startClick = e);
  18845. document.addEventListener("mouseup", (e) => {
  18846. if (startClick) {
  18847. for (const handlers of nodeList.values()) {
  18848. for (const { documentHandler } of handlers) {
  18849. documentHandler(e, startClick);
  18850. }
  18851. }
  18852. startClick = void 0;
  18853. }
  18854. });
  18855. }
  18856. function createDocumentHandler(el, binding) {
  18857. let excludes = [];
  18858. if (isArray$1(binding.arg)) {
  18859. excludes = binding.arg;
  18860. } else if (isElement$1(binding.arg)) {
  18861. excludes.push(binding.arg);
  18862. }
  18863. return function(mouseup, mousedown) {
  18864. const popperRef = binding.instance.popperRef;
  18865. const mouseUpTarget = mouseup.target;
  18866. const mouseDownTarget = mousedown == null ? void 0 : mousedown.target;
  18867. const isBound = !binding || !binding.instance;
  18868. const isTargetExists = !mouseUpTarget || !mouseDownTarget;
  18869. const isContainedByEl = el.contains(mouseUpTarget) || el.contains(mouseDownTarget);
  18870. const isSelf = el === mouseUpTarget;
  18871. const isTargetExcluded = excludes.length && excludes.some((item) => item == null ? void 0 : item.contains(mouseUpTarget)) || excludes.length && excludes.includes(mouseDownTarget);
  18872. const isContainedByPopper = popperRef && (popperRef.contains(mouseUpTarget) || popperRef.contains(mouseDownTarget));
  18873. if (isBound || isTargetExists || isContainedByEl || isSelf || isTargetExcluded || isContainedByPopper) {
  18874. return;
  18875. }
  18876. binding.value(mouseup, mousedown);
  18877. };
  18878. }
  18879. const ClickOutside = {
  18880. beforeMount(el, binding) {
  18881. if (!nodeList.has(el)) {
  18882. nodeList.set(el, []);
  18883. }
  18884. nodeList.get(el).push({
  18885. documentHandler: createDocumentHandler(el, binding),
  18886. bindingFn: binding.value
  18887. });
  18888. },
  18889. updated(el, binding) {
  18890. if (!nodeList.has(el)) {
  18891. nodeList.set(el, []);
  18892. }
  18893. const handlers = nodeList.get(el);
  18894. const oldHandlerIndex = handlers.findIndex((item) => item.bindingFn === binding.oldValue);
  18895. const newHandler = {
  18896. documentHandler: createDocumentHandler(el, binding),
  18897. bindingFn: binding.value
  18898. };
  18899. if (oldHandlerIndex >= 0) {
  18900. handlers.splice(oldHandlerIndex, 1, newHandler);
  18901. } else {
  18902. handlers.push(newHandler);
  18903. }
  18904. },
  18905. unmounted(el) {
  18906. nodeList.delete(el);
  18907. }
  18908. };
  18909. const REPEAT_INTERVAL = 100;
  18910. const REPEAT_DELAY = 600;
  18911. const vRepeatClick = {
  18912. beforeMount(el, binding) {
  18913. const value = binding.value;
  18914. const { interval = REPEAT_INTERVAL, delay = REPEAT_DELAY } = isFunction$1(value) ? {} : value;
  18915. let intervalId;
  18916. let delayId;
  18917. const handler = () => isFunction$1(value) ? value() : value.handler();
  18918. const clear = () => {
  18919. if (delayId) {
  18920. clearTimeout(delayId);
  18921. delayId = void 0;
  18922. }
  18923. if (intervalId) {
  18924. clearInterval(intervalId);
  18925. intervalId = void 0;
  18926. }
  18927. };
  18928. el.addEventListener("mousedown", (evt) => {
  18929. if (evt.button !== 0)
  18930. return;
  18931. clear();
  18932. handler();
  18933. document.addEventListener("mouseup", () => clear(), {
  18934. once: true
  18935. });
  18936. delayId = setTimeout(() => {
  18937. intervalId = setInterval(() => {
  18938. handler();
  18939. }, interval);
  18940. }, delay);
  18941. });
  18942. }
  18943. };
  18944. const FOCUSABLE_CHILDREN = "_trap-focus-children";
  18945. const FOCUS_STACK = [];
  18946. const FOCUS_HANDLER = (e) => {
  18947. if (FOCUS_STACK.length === 0)
  18948. return;
  18949. const focusableElement = FOCUS_STACK[FOCUS_STACK.length - 1][FOCUSABLE_CHILDREN];
  18950. if (focusableElement.length > 0 && e.code === EVENT_CODE.tab) {
  18951. if (focusableElement.length === 1) {
  18952. e.preventDefault();
  18953. if (document.activeElement !== focusableElement[0]) {
  18954. focusableElement[0].focus();
  18955. }
  18956. return;
  18957. }
  18958. const goingBackward = e.shiftKey;
  18959. const isFirst = e.target === focusableElement[0];
  18960. const isLast = e.target === focusableElement[focusableElement.length - 1];
  18961. if (isFirst && goingBackward) {
  18962. e.preventDefault();
  18963. focusableElement[focusableElement.length - 1].focus();
  18964. }
  18965. if (isLast && !goingBackward) {
  18966. e.preventDefault();
  18967. focusableElement[0].focus();
  18968. }
  18969. }
  18970. };
  18971. const TrapFocus = {
  18972. beforeMount(el) {
  18973. el[FOCUSABLE_CHILDREN] = obtainAllFocusableElements$1(el);
  18974. FOCUS_STACK.push(el);
  18975. if (FOCUS_STACK.length <= 1) {
  18976. document.addEventListener("keydown", FOCUS_HANDLER);
  18977. }
  18978. },
  18979. updated(el) {
  18980. nextTick(() => {
  18981. el[FOCUSABLE_CHILDREN] = obtainAllFocusableElements$1(el);
  18982. });
  18983. },
  18984. unmounted() {
  18985. FOCUS_STACK.shift();
  18986. if (FOCUS_STACK.length === 0) {
  18987. document.removeEventListener("keydown", FOCUS_HANDLER);
  18988. }
  18989. }
  18990. };
  18991. 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;/**
  18992. * Checks if an event is supported in the current execution environment.
  18993. *
  18994. * NOTE: This will not work correctly for non-generic events such as `change`,
  18995. * `reset`, `load`, `error`, and `select`.
  18996. *
  18997. * Borrows from Modernizr.
  18998. *
  18999. * @param {string} eventNameSuffix Event name, e.g. "click".
  19000. * @param {?boolean} capture Check if the capture phase is supported.
  19001. * @return {boolean} True if the event is supported.
  19002. * @internal
  19003. * @license Modernizr 3.0.0pre (Custom Build) | MIT
  19004. */
  19005. const mousewheel = function(element, callback) {
  19006. if (element && element.addEventListener) {
  19007. const fn = function(event) {
  19008. const normalized = Y(event);
  19009. callback && Reflect.apply(callback, this, [event, normalized]);
  19010. };
  19011. element.addEventListener("wheel", fn, { passive: true });
  19012. }
  19013. };
  19014. const Mousewheel = {
  19015. beforeMount(el, binding) {
  19016. mousewheel(el, binding.value);
  19017. }
  19018. };
  19019. const basicTimeSpinnerProps = buildProps({
  19020. role: {
  19021. type: String,
  19022. required: true
  19023. },
  19024. spinnerDate: {
  19025. type: definePropType(Object),
  19026. required: true
  19027. },
  19028. showSeconds: {
  19029. type: Boolean,
  19030. default: true
  19031. },
  19032. arrowControl: Boolean,
  19033. amPmMode: {
  19034. type: definePropType(String),
  19035. default: ""
  19036. },
  19037. ...disabledTimeListsProps
  19038. });
  19039. const _sfc_main$25 = /* @__PURE__ */ defineComponent({
  19040. __name: "basic-time-spinner",
  19041. props: basicTimeSpinnerProps,
  19042. emits: [CHANGE_EVENT, "select-range", "set-option"],
  19043. setup(__props, { emit }) {
  19044. const props = __props;
  19045. const pickerBase = inject("EP_PICKER_BASE");
  19046. const { isRange, format } = pickerBase.props;
  19047. const ns = useNamespace("time");
  19048. const { getHoursList, getMinutesList, getSecondsList } = getTimeLists(props.disabledHours, props.disabledMinutes, props.disabledSeconds);
  19049. let isScrolling = false;
  19050. const currentScrollbar = ref();
  19051. const listHoursRef = ref();
  19052. const listMinutesRef = ref();
  19053. const listSecondsRef = ref();
  19054. const listRefsMap = {
  19055. hours: listHoursRef,
  19056. minutes: listMinutesRef,
  19057. seconds: listSecondsRef
  19058. };
  19059. const spinnerItems = computed(() => {
  19060. return props.showSeconds ? timeUnits$1 : timeUnits$1.slice(0, 2);
  19061. });
  19062. const timePartials = computed(() => {
  19063. const { spinnerDate } = props;
  19064. const hours = spinnerDate.hour();
  19065. const minutes = spinnerDate.minute();
  19066. const seconds = spinnerDate.second();
  19067. return { hours, minutes, seconds };
  19068. });
  19069. const timeList = computed(() => {
  19070. const { hours, minutes } = unref(timePartials);
  19071. const { role, spinnerDate } = props;
  19072. const compare = !isRange ? spinnerDate : void 0;
  19073. return {
  19074. hours: getHoursList(role, compare),
  19075. minutes: getMinutesList(hours, role, compare),
  19076. seconds: getSecondsList(hours, minutes, role, compare)
  19077. };
  19078. });
  19079. const arrowControlTimeList = computed(() => {
  19080. const { hours, minutes, seconds } = unref(timePartials);
  19081. return {
  19082. hours: buildTimeList(hours, 23),
  19083. minutes: buildTimeList(minutes, 59),
  19084. seconds: buildTimeList(seconds, 59)
  19085. };
  19086. });
  19087. const debouncedResetScroll = debounce((type) => {
  19088. isScrolling = false;
  19089. adjustCurrentSpinner(type);
  19090. }, 200);
  19091. const getAmPmFlag = (hour) => {
  19092. const shouldShowAmPm = !!props.amPmMode;
  19093. if (!shouldShowAmPm)
  19094. return "";
  19095. const isCapital = props.amPmMode === "A";
  19096. let content = hour < 12 ? " am" : " pm";
  19097. if (isCapital)
  19098. content = content.toUpperCase();
  19099. return content;
  19100. };
  19101. const emitSelectRange = (type) => {
  19102. let range = [0, 0];
  19103. if (!format || format === DEFAULT_FORMATS_TIME) {
  19104. switch (type) {
  19105. case "hours":
  19106. range = [0, 2];
  19107. break;
  19108. case "minutes":
  19109. range = [3, 5];
  19110. break;
  19111. case "seconds":
  19112. range = [6, 8];
  19113. break;
  19114. }
  19115. }
  19116. const [left, right] = range;
  19117. emit("select-range", left, right);
  19118. currentScrollbar.value = type;
  19119. };
  19120. const adjustCurrentSpinner = (type) => {
  19121. adjustSpinner(type, unref(timePartials)[type]);
  19122. };
  19123. const adjustSpinners = () => {
  19124. adjustCurrentSpinner("hours");
  19125. adjustCurrentSpinner("minutes");
  19126. adjustCurrentSpinner("seconds");
  19127. };
  19128. const getScrollbarElement = (el) => el.querySelector(`.${ns.namespace.value}-scrollbar__wrap`);
  19129. const adjustSpinner = (type, value) => {
  19130. if (props.arrowControl)
  19131. return;
  19132. const scrollbar = unref(listRefsMap[type]);
  19133. if (scrollbar && scrollbar.$el) {
  19134. getScrollbarElement(scrollbar.$el).scrollTop = Math.max(0, value * typeItemHeight(type));
  19135. }
  19136. };
  19137. const typeItemHeight = (type) => {
  19138. const scrollbar = unref(listRefsMap[type]);
  19139. const listItem = scrollbar == null ? void 0 : scrollbar.$el.querySelector("li");
  19140. if (listItem) {
  19141. return Number.parseFloat(getStyle(listItem, "height")) || 0;
  19142. }
  19143. return 0;
  19144. };
  19145. const onIncrement = () => {
  19146. scrollDown(1);
  19147. };
  19148. const onDecrement = () => {
  19149. scrollDown(-1);
  19150. };
  19151. const scrollDown = (step) => {
  19152. if (!currentScrollbar.value) {
  19153. emitSelectRange("hours");
  19154. }
  19155. const label = currentScrollbar.value;
  19156. const now = unref(timePartials)[label];
  19157. const total = currentScrollbar.value === "hours" ? 24 : 60;
  19158. const next = findNextUnDisabled(label, now, step, total);
  19159. modifyDateField(label, next);
  19160. adjustSpinner(label, next);
  19161. nextTick(() => emitSelectRange(label));
  19162. };
  19163. const findNextUnDisabled = (type, now, step, total) => {
  19164. let next = (now + step + total) % total;
  19165. const list = unref(timeList)[type];
  19166. while (list[next] && next !== now) {
  19167. next = (next + step + total) % total;
  19168. }
  19169. return next;
  19170. };
  19171. const modifyDateField = (type, value) => {
  19172. const list = unref(timeList)[type];
  19173. const isDisabled = list[value];
  19174. if (isDisabled)
  19175. return;
  19176. const { hours, minutes, seconds } = unref(timePartials);
  19177. let changeTo;
  19178. switch (type) {
  19179. case "hours":
  19180. changeTo = props.spinnerDate.hour(value).minute(minutes).second(seconds);
  19181. break;
  19182. case "minutes":
  19183. changeTo = props.spinnerDate.hour(hours).minute(value).second(seconds);
  19184. break;
  19185. case "seconds":
  19186. changeTo = props.spinnerDate.hour(hours).minute(minutes).second(value);
  19187. break;
  19188. }
  19189. emit(CHANGE_EVENT, changeTo);
  19190. };
  19191. const handleClick = (type, { value, disabled }) => {
  19192. if (!disabled) {
  19193. modifyDateField(type, value);
  19194. emitSelectRange(type);
  19195. adjustSpinner(type, value);
  19196. }
  19197. };
  19198. const handleScroll = (type) => {
  19199. const scrollbar = unref(listRefsMap[type]);
  19200. if (!scrollbar)
  19201. return;
  19202. isScrolling = true;
  19203. debouncedResetScroll(type);
  19204. const value = Math.min(Math.round((getScrollbarElement(scrollbar.$el).scrollTop - (scrollBarHeight(type) * 0.5 - 10) / typeItemHeight(type) + 3) / typeItemHeight(type)), type === "hours" ? 23 : 59);
  19205. modifyDateField(type, value);
  19206. };
  19207. const scrollBarHeight = (type) => {
  19208. return unref(listRefsMap[type]).$el.offsetHeight;
  19209. };
  19210. const bindScrollEvent = () => {
  19211. const bindFunction = (type) => {
  19212. const scrollbar = unref(listRefsMap[type]);
  19213. if (scrollbar && scrollbar.$el) {
  19214. getScrollbarElement(scrollbar.$el).onscroll = () => {
  19215. handleScroll(type);
  19216. };
  19217. }
  19218. };
  19219. bindFunction("hours");
  19220. bindFunction("minutes");
  19221. bindFunction("seconds");
  19222. };
  19223. onMounted(() => {
  19224. nextTick(() => {
  19225. !props.arrowControl && bindScrollEvent();
  19226. adjustSpinners();
  19227. if (props.role === "start")
  19228. emitSelectRange("hours");
  19229. });
  19230. });
  19231. const setRef = (scrollbar, type) => {
  19232. listRefsMap[type].value = scrollbar != null ? scrollbar : void 0;
  19233. };
  19234. emit("set-option", [`${props.role}_scrollDown`, scrollDown]);
  19235. emit("set-option", [`${props.role}_emitSelectRange`, emitSelectRange]);
  19236. watch(() => props.spinnerDate, () => {
  19237. if (isScrolling)
  19238. return;
  19239. adjustSpinners();
  19240. });
  19241. return (_ctx, _cache) => {
  19242. return openBlock(), createElementBlock("div", {
  19243. class: normalizeClass([unref(ns).b("spinner"), { "has-seconds": _ctx.showSeconds }])
  19244. }, [
  19245. !_ctx.arrowControl ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(unref(spinnerItems), (item) => {
  19246. return openBlock(), createBlock(unref(ElScrollbar), {
  19247. key: item,
  19248. ref_for: true,
  19249. ref: (scrollbar) => setRef(scrollbar, item),
  19250. class: normalizeClass(unref(ns).be("spinner", "wrapper")),
  19251. "wrap-style": "max-height: inherit;",
  19252. "view-class": unref(ns).be("spinner", "list"),
  19253. noresize: "",
  19254. tag: "ul",
  19255. onMouseenter: ($event) => emitSelectRange(item),
  19256. onMousemove: ($event) => adjustCurrentSpinner(item)
  19257. }, {
  19258. default: withCtx(() => [
  19259. (openBlock(true), createElementBlock(Fragment, null, renderList(unref(timeList)[item], (disabled, key) => {
  19260. return openBlock(), createElementBlock("li", {
  19261. key,
  19262. class: normalizeClass([
  19263. unref(ns).be("spinner", "item"),
  19264. unref(ns).is("active", key === unref(timePartials)[item]),
  19265. unref(ns).is("disabled", disabled)
  19266. ]),
  19267. onClick: ($event) => handleClick(item, { value: key, disabled })
  19268. }, [
  19269. item === "hours" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  19270. createTextVNode(toDisplayString(("0" + (_ctx.amPmMode ? key % 12 || 12 : key)).slice(-2)) + toDisplayString(getAmPmFlag(key)), 1)
  19271. ], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
  19272. createTextVNode(toDisplayString(("0" + key).slice(-2)), 1)
  19273. ], 64))
  19274. ], 10, ["onClick"]);
  19275. }), 128))
  19276. ]),
  19277. _: 2
  19278. }, 1032, ["class", "view-class", "onMouseenter", "onMousemove"]);
  19279. }), 128)) : createCommentVNode("v-if", true),
  19280. _ctx.arrowControl ? (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(unref(spinnerItems), (item) => {
  19281. return openBlock(), createElementBlock("div", {
  19282. key: item,
  19283. class: normalizeClass([unref(ns).be("spinner", "wrapper"), unref(ns).is("arrow")]),
  19284. onMouseenter: ($event) => emitSelectRange(item)
  19285. }, [
  19286. withDirectives((openBlock(), createBlock(unref(ElIcon), {
  19287. class: normalizeClass(["arrow-up", unref(ns).be("spinner", "arrow")])
  19288. }, {
  19289. default: withCtx(() => [
  19290. createVNode(unref(arrow_up_default))
  19291. ]),
  19292. _: 1
  19293. }, 8, ["class"])), [
  19294. [unref(vRepeatClick), onDecrement]
  19295. ]),
  19296. withDirectives((openBlock(), createBlock(unref(ElIcon), {
  19297. class: normalizeClass(["arrow-down", unref(ns).be("spinner", "arrow")])
  19298. }, {
  19299. default: withCtx(() => [
  19300. createVNode(unref(arrow_down_default))
  19301. ]),
  19302. _: 1
  19303. }, 8, ["class"])), [
  19304. [unref(vRepeatClick), onIncrement]
  19305. ]),
  19306. createElementVNode("ul", {
  19307. class: normalizeClass(unref(ns).be("spinner", "list"))
  19308. }, [
  19309. (openBlock(true), createElementBlock(Fragment, null, renderList(unref(arrowControlTimeList)[item], (time, key) => {
  19310. return openBlock(), createElementBlock("li", {
  19311. key,
  19312. class: normalizeClass([
  19313. unref(ns).be("spinner", "item"),
  19314. unref(ns).is("active", time === unref(timePartials)[item]),
  19315. unref(ns).is("disabled", unref(timeList)[item][time])
  19316. ])
  19317. }, [
  19318. unref(isNumber)(time) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  19319. item === "hours" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  19320. createTextVNode(toDisplayString(("0" + (_ctx.amPmMode ? time % 12 || 12 : time)).slice(-2)) + toDisplayString(getAmPmFlag(time)), 1)
  19321. ], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
  19322. createTextVNode(toDisplayString(("0" + time).slice(-2)), 1)
  19323. ], 64))
  19324. ], 64)) : createCommentVNode("v-if", true)
  19325. ], 2);
  19326. }), 128))
  19327. ], 2)
  19328. ], 42, ["onMouseenter"]);
  19329. }), 128)) : createCommentVNode("v-if", true)
  19330. ], 2);
  19331. };
  19332. }
  19333. });
  19334. var TimeSpinner = /* @__PURE__ */ _export_sfc(_sfc_main$25, [["__file", "basic-time-spinner.vue"]]);
  19335. const _sfc_main$24 = /* @__PURE__ */ defineComponent({
  19336. __name: "panel-time-pick",
  19337. props: panelTimePickerProps,
  19338. emits: ["pick", "select-range", "set-picker-option"],
  19339. setup(__props, { emit }) {
  19340. const props = __props;
  19341. const pickerBase = inject("EP_PICKER_BASE");
  19342. const {
  19343. arrowControl,
  19344. disabledHours,
  19345. disabledMinutes,
  19346. disabledSeconds,
  19347. defaultValue
  19348. } = pickerBase.props;
  19349. const { getAvailableHours, getAvailableMinutes, getAvailableSeconds } = buildAvailableTimeSlotGetter(disabledHours, disabledMinutes, disabledSeconds);
  19350. const ns = useNamespace("time");
  19351. const { t, lang } = useLocale();
  19352. const selectionRange = ref([0, 2]);
  19353. const oldValue = useOldValue(props);
  19354. const transitionName = computed(() => {
  19355. return isUndefined(props.actualVisible) ? `${ns.namespace.value}-zoom-in-top` : "";
  19356. });
  19357. const showSeconds = computed(() => {
  19358. return props.format.includes("ss");
  19359. });
  19360. const amPmMode = computed(() => {
  19361. if (props.format.includes("A"))
  19362. return "A";
  19363. if (props.format.includes("a"))
  19364. return "a";
  19365. return "";
  19366. });
  19367. const isValidValue = (_date) => {
  19368. const parsedDate = dayjs(_date).locale(lang.value);
  19369. const result = getRangeAvailableTime(parsedDate);
  19370. return parsedDate.isSame(result);
  19371. };
  19372. const handleCancel = () => {
  19373. emit("pick", oldValue.value, false);
  19374. };
  19375. const handleConfirm = (visible = false, first = false) => {
  19376. if (first)
  19377. return;
  19378. emit("pick", props.parsedValue, visible);
  19379. };
  19380. const handleChange = (_date) => {
  19381. if (!props.visible) {
  19382. return;
  19383. }
  19384. const result = getRangeAvailableTime(_date).millisecond(0);
  19385. emit("pick", result, true);
  19386. };
  19387. const setSelectionRange = (start, end) => {
  19388. emit("select-range", start, end);
  19389. selectionRange.value = [start, end];
  19390. };
  19391. const changeSelectionRange = (step) => {
  19392. const list = [0, 3].concat(showSeconds.value ? [6] : []);
  19393. const mapping = ["hours", "minutes"].concat(showSeconds.value ? ["seconds"] : []);
  19394. const index = list.indexOf(selectionRange.value[0]);
  19395. const next = (index + step + list.length) % list.length;
  19396. timePickerOptions["start_emitSelectRange"](mapping[next]);
  19397. };
  19398. const handleKeydown = (event) => {
  19399. const code = event.code;
  19400. const { left, right, up, down } = EVENT_CODE;
  19401. if ([left, right].includes(code)) {
  19402. const step = code === left ? -1 : 1;
  19403. changeSelectionRange(step);
  19404. event.preventDefault();
  19405. return;
  19406. }
  19407. if ([up, down].includes(code)) {
  19408. const step = code === up ? -1 : 1;
  19409. timePickerOptions["start_scrollDown"](step);
  19410. event.preventDefault();
  19411. return;
  19412. }
  19413. };
  19414. const { timePickerOptions, onSetOption, getAvailableTime } = useTimePanel({
  19415. getAvailableHours,
  19416. getAvailableMinutes,
  19417. getAvailableSeconds
  19418. });
  19419. const getRangeAvailableTime = (date) => {
  19420. return getAvailableTime(date, props.datetimeRole || "", true);
  19421. };
  19422. const parseUserInput = (value) => {
  19423. if (!value)
  19424. return null;
  19425. return dayjs(value, props.format).locale(lang.value);
  19426. };
  19427. const formatToString = (value) => {
  19428. if (!value)
  19429. return null;
  19430. return value.format(props.format);
  19431. };
  19432. const getDefaultValue = () => {
  19433. return dayjs(defaultValue).locale(lang.value);
  19434. };
  19435. emit("set-picker-option", ["isValidValue", isValidValue]);
  19436. emit("set-picker-option", ["formatToString", formatToString]);
  19437. emit("set-picker-option", ["parseUserInput", parseUserInput]);
  19438. emit("set-picker-option", ["handleKeydownInput", handleKeydown]);
  19439. emit("set-picker-option", ["getRangeAvailableTime", getRangeAvailableTime]);
  19440. emit("set-picker-option", ["getDefaultValue", getDefaultValue]);
  19441. return (_ctx, _cache) => {
  19442. return openBlock(), createBlock(Transition, { name: unref(transitionName) }, {
  19443. default: withCtx(() => [
  19444. _ctx.actualVisible || _ctx.visible ? (openBlock(), createElementBlock("div", {
  19445. key: 0,
  19446. class: normalizeClass(unref(ns).b("panel"))
  19447. }, [
  19448. createElementVNode("div", {
  19449. class: normalizeClass([unref(ns).be("panel", "content"), { "has-seconds": unref(showSeconds) }])
  19450. }, [
  19451. createVNode(TimeSpinner, {
  19452. ref: "spinner",
  19453. role: _ctx.datetimeRole || "start",
  19454. "arrow-control": unref(arrowControl),
  19455. "show-seconds": unref(showSeconds),
  19456. "am-pm-mode": unref(amPmMode),
  19457. "spinner-date": _ctx.parsedValue,
  19458. "disabled-hours": unref(disabledHours),
  19459. "disabled-minutes": unref(disabledMinutes),
  19460. "disabled-seconds": unref(disabledSeconds),
  19461. onChange: handleChange,
  19462. onSetOption: unref(onSetOption),
  19463. onSelectRange: setSelectionRange
  19464. }, null, 8, ["role", "arrow-control", "show-seconds", "am-pm-mode", "spinner-date", "disabled-hours", "disabled-minutes", "disabled-seconds", "onSetOption"])
  19465. ], 2),
  19466. createElementVNode("div", {
  19467. class: normalizeClass(unref(ns).be("panel", "footer"))
  19468. }, [
  19469. createElementVNode("button", {
  19470. type: "button",
  19471. class: normalizeClass([unref(ns).be("panel", "btn"), "cancel"]),
  19472. onClick: handleCancel
  19473. }, toDisplayString(unref(t)("el.datepicker.cancel")), 3),
  19474. createElementVNode("button", {
  19475. type: "button",
  19476. class: normalizeClass([unref(ns).be("panel", "btn"), "confirm"]),
  19477. onClick: ($event) => handleConfirm()
  19478. }, toDisplayString(unref(t)("el.datepicker.confirm")), 11, ["onClick"])
  19479. ], 2)
  19480. ], 2)) : createCommentVNode("v-if", true)
  19481. ]),
  19482. _: 1
  19483. }, 8, ["name"]);
  19484. };
  19485. }
  19486. });
  19487. var TimePickPanel = /* @__PURE__ */ _export_sfc(_sfc_main$24, [["__file", "panel-time-pick.vue"]]);
  19488. const panelTimeRangeProps = buildProps({
  19489. ...timePanelSharedProps,
  19490. parsedValue: {
  19491. type: definePropType(Array)
  19492. }
  19493. });
  19494. const _sfc_main$23 = /* @__PURE__ */ defineComponent({
  19495. __name: "panel-time-range",
  19496. props: panelTimeRangeProps,
  19497. emits: ["pick", "select-range", "set-picker-option"],
  19498. setup(__props, { emit }) {
  19499. const props = __props;
  19500. const makeSelectRange = (start, end) => {
  19501. const result = [];
  19502. for (let i = start; i <= end; i++) {
  19503. result.push(i);
  19504. }
  19505. return result;
  19506. };
  19507. const { t, lang } = useLocale();
  19508. const nsTime = useNamespace("time");
  19509. const nsPicker = useNamespace("picker");
  19510. const pickerBase = inject("EP_PICKER_BASE");
  19511. const {
  19512. arrowControl,
  19513. disabledHours,
  19514. disabledMinutes,
  19515. disabledSeconds,
  19516. defaultValue
  19517. } = pickerBase.props;
  19518. const startContainerKls = computed(() => [
  19519. nsTime.be("range-picker", "body"),
  19520. nsTime.be("panel", "content"),
  19521. nsTime.is("arrow", arrowControl),
  19522. showSeconds.value ? "has-seconds" : ""
  19523. ]);
  19524. const endContainerKls = computed(() => [
  19525. nsTime.be("range-picker", "body"),
  19526. nsTime.be("panel", "content"),
  19527. nsTime.is("arrow", arrowControl),
  19528. showSeconds.value ? "has-seconds" : ""
  19529. ]);
  19530. const startTime = computed(() => props.parsedValue[0]);
  19531. const endTime = computed(() => props.parsedValue[1]);
  19532. const oldValue = useOldValue(props);
  19533. const handleCancel = () => {
  19534. emit("pick", oldValue.value, false);
  19535. };
  19536. const showSeconds = computed(() => {
  19537. return props.format.includes("ss");
  19538. });
  19539. const amPmMode = computed(() => {
  19540. if (props.format.includes("A"))
  19541. return "A";
  19542. if (props.format.includes("a"))
  19543. return "a";
  19544. return "";
  19545. });
  19546. const handleConfirm = (visible = false) => {
  19547. emit("pick", [startTime.value, endTime.value], visible);
  19548. };
  19549. const handleMinChange = (date) => {
  19550. handleChange(date.millisecond(0), endTime.value);
  19551. };
  19552. const handleMaxChange = (date) => {
  19553. handleChange(startTime.value, date.millisecond(0));
  19554. };
  19555. const isValidValue = (_date) => {
  19556. const parsedDate = _date.map((_) => dayjs(_).locale(lang.value));
  19557. const result = getRangeAvailableTime(parsedDate);
  19558. return parsedDate[0].isSame(result[0]) && parsedDate[1].isSame(result[1]);
  19559. };
  19560. const handleChange = (start, end) => {
  19561. if (!props.visible) {
  19562. return;
  19563. }
  19564. emit("pick", [start, end], true);
  19565. };
  19566. const btnConfirmDisabled = computed(() => {
  19567. return startTime.value > endTime.value;
  19568. });
  19569. const selectionRange = ref([0, 2]);
  19570. const setMinSelectionRange = (start, end) => {
  19571. emit("select-range", start, end, "min");
  19572. selectionRange.value = [start, end];
  19573. };
  19574. const offset = computed(() => showSeconds.value ? 11 : 8);
  19575. const setMaxSelectionRange = (start, end) => {
  19576. emit("select-range", start, end, "max");
  19577. const _offset = unref(offset);
  19578. selectionRange.value = [start + _offset, end + _offset];
  19579. };
  19580. const changeSelectionRange = (step) => {
  19581. const list = showSeconds.value ? [0, 3, 6, 11, 14, 17] : [0, 3, 8, 11];
  19582. const mapping = ["hours", "minutes"].concat(showSeconds.value ? ["seconds"] : []);
  19583. const index = list.indexOf(selectionRange.value[0]);
  19584. const next = (index + step + list.length) % list.length;
  19585. const half = list.length / 2;
  19586. if (next < half) {
  19587. timePickerOptions["start_emitSelectRange"](mapping[next]);
  19588. } else {
  19589. timePickerOptions["end_emitSelectRange"](mapping[next - half]);
  19590. }
  19591. };
  19592. const handleKeydown = (event) => {
  19593. const code = event.code;
  19594. const { left, right, up, down } = EVENT_CODE;
  19595. if ([left, right].includes(code)) {
  19596. const step = code === left ? -1 : 1;
  19597. changeSelectionRange(step);
  19598. event.preventDefault();
  19599. return;
  19600. }
  19601. if ([up, down].includes(code)) {
  19602. const step = code === up ? -1 : 1;
  19603. const role = selectionRange.value[0] < offset.value ? "start" : "end";
  19604. timePickerOptions[`${role}_scrollDown`](step);
  19605. event.preventDefault();
  19606. return;
  19607. }
  19608. };
  19609. const disabledHours_ = (role, compare) => {
  19610. const defaultDisable = disabledHours ? disabledHours(role) : [];
  19611. const isStart = role === "start";
  19612. const compareDate = compare || (isStart ? endTime.value : startTime.value);
  19613. const compareHour = compareDate.hour();
  19614. const nextDisable = isStart ? makeSelectRange(compareHour + 1, 23) : makeSelectRange(0, compareHour - 1);
  19615. return union(defaultDisable, nextDisable);
  19616. };
  19617. const disabledMinutes_ = (hour, role, compare) => {
  19618. const defaultDisable = disabledMinutes ? disabledMinutes(hour, role) : [];
  19619. const isStart = role === "start";
  19620. const compareDate = compare || (isStart ? endTime.value : startTime.value);
  19621. const compareHour = compareDate.hour();
  19622. if (hour !== compareHour) {
  19623. return defaultDisable;
  19624. }
  19625. const compareMinute = compareDate.minute();
  19626. const nextDisable = isStart ? makeSelectRange(compareMinute + 1, 59) : makeSelectRange(0, compareMinute - 1);
  19627. return union(defaultDisable, nextDisable);
  19628. };
  19629. const disabledSeconds_ = (hour, minute, role, compare) => {
  19630. const defaultDisable = disabledSeconds ? disabledSeconds(hour, minute, role) : [];
  19631. const isStart = role === "start";
  19632. const compareDate = compare || (isStart ? endTime.value : startTime.value);
  19633. const compareHour = compareDate.hour();
  19634. const compareMinute = compareDate.minute();
  19635. if (hour !== compareHour || minute !== compareMinute) {
  19636. return defaultDisable;
  19637. }
  19638. const compareSecond = compareDate.second();
  19639. const nextDisable = isStart ? makeSelectRange(compareSecond + 1, 59) : makeSelectRange(0, compareSecond - 1);
  19640. return union(defaultDisable, nextDisable);
  19641. };
  19642. const getRangeAvailableTime = ([start, end]) => {
  19643. return [
  19644. getAvailableTime(start, "start", true, end),
  19645. getAvailableTime(end, "end", false, start)
  19646. ];
  19647. };
  19648. const { getAvailableHours, getAvailableMinutes, getAvailableSeconds } = buildAvailableTimeSlotGetter(disabledHours_, disabledMinutes_, disabledSeconds_);
  19649. const {
  19650. timePickerOptions,
  19651. getAvailableTime,
  19652. onSetOption
  19653. } = useTimePanel({
  19654. getAvailableHours,
  19655. getAvailableMinutes,
  19656. getAvailableSeconds
  19657. });
  19658. const parseUserInput = (days) => {
  19659. if (!days)
  19660. return null;
  19661. if (isArray$1(days)) {
  19662. return days.map((d) => dayjs(d, props.format).locale(lang.value));
  19663. }
  19664. return dayjs(days, props.format).locale(lang.value);
  19665. };
  19666. const formatToString = (days) => {
  19667. if (!days)
  19668. return null;
  19669. if (isArray$1(days)) {
  19670. return days.map((d) => d.format(props.format));
  19671. }
  19672. return days.format(props.format);
  19673. };
  19674. const getDefaultValue = () => {
  19675. if (isArray$1(defaultValue)) {
  19676. return defaultValue.map((d) => dayjs(d).locale(lang.value));
  19677. }
  19678. const defaultDay = dayjs(defaultValue).locale(lang.value);
  19679. return [defaultDay, defaultDay.add(60, "m")];
  19680. };
  19681. emit("set-picker-option", ["formatToString", formatToString]);
  19682. emit("set-picker-option", ["parseUserInput", parseUserInput]);
  19683. emit("set-picker-option", ["isValidValue", isValidValue]);
  19684. emit("set-picker-option", ["handleKeydownInput", handleKeydown]);
  19685. emit("set-picker-option", ["getDefaultValue", getDefaultValue]);
  19686. emit("set-picker-option", ["getRangeAvailableTime", getRangeAvailableTime]);
  19687. return (_ctx, _cache) => {
  19688. return _ctx.actualVisible ? (openBlock(), createElementBlock("div", {
  19689. key: 0,
  19690. class: normalizeClass([unref(nsTime).b("range-picker"), unref(nsPicker).b("panel")])
  19691. }, [
  19692. createElementVNode("div", {
  19693. class: normalizeClass(unref(nsTime).be("range-picker", "content"))
  19694. }, [
  19695. createElementVNode("div", {
  19696. class: normalizeClass(unref(nsTime).be("range-picker", "cell"))
  19697. }, [
  19698. createElementVNode("div", {
  19699. class: normalizeClass(unref(nsTime).be("range-picker", "header"))
  19700. }, toDisplayString(unref(t)("el.datepicker.startTime")), 3),
  19701. createElementVNode("div", {
  19702. class: normalizeClass(unref(startContainerKls))
  19703. }, [
  19704. createVNode(TimeSpinner, {
  19705. ref: "minSpinner",
  19706. role: "start",
  19707. "show-seconds": unref(showSeconds),
  19708. "am-pm-mode": unref(amPmMode),
  19709. "arrow-control": unref(arrowControl),
  19710. "spinner-date": unref(startTime),
  19711. "disabled-hours": disabledHours_,
  19712. "disabled-minutes": disabledMinutes_,
  19713. "disabled-seconds": disabledSeconds_,
  19714. onChange: handleMinChange,
  19715. onSetOption: unref(onSetOption),
  19716. onSelectRange: setMinSelectionRange
  19717. }, null, 8, ["show-seconds", "am-pm-mode", "arrow-control", "spinner-date", "onSetOption"])
  19718. ], 2)
  19719. ], 2),
  19720. createElementVNode("div", {
  19721. class: normalizeClass(unref(nsTime).be("range-picker", "cell"))
  19722. }, [
  19723. createElementVNode("div", {
  19724. class: normalizeClass(unref(nsTime).be("range-picker", "header"))
  19725. }, toDisplayString(unref(t)("el.datepicker.endTime")), 3),
  19726. createElementVNode("div", {
  19727. class: normalizeClass(unref(endContainerKls))
  19728. }, [
  19729. createVNode(TimeSpinner, {
  19730. ref: "maxSpinner",
  19731. role: "end",
  19732. "show-seconds": unref(showSeconds),
  19733. "am-pm-mode": unref(amPmMode),
  19734. "arrow-control": unref(arrowControl),
  19735. "spinner-date": unref(endTime),
  19736. "disabled-hours": disabledHours_,
  19737. "disabled-minutes": disabledMinutes_,
  19738. "disabled-seconds": disabledSeconds_,
  19739. onChange: handleMaxChange,
  19740. onSetOption: unref(onSetOption),
  19741. onSelectRange: setMaxSelectionRange
  19742. }, null, 8, ["show-seconds", "am-pm-mode", "arrow-control", "spinner-date", "onSetOption"])
  19743. ], 2)
  19744. ], 2)
  19745. ], 2),
  19746. createElementVNode("div", {
  19747. class: normalizeClass(unref(nsTime).be("panel", "footer"))
  19748. }, [
  19749. createElementVNode("button", {
  19750. type: "button",
  19751. class: normalizeClass([unref(nsTime).be("panel", "btn"), "cancel"]),
  19752. onClick: ($event) => handleCancel()
  19753. }, toDisplayString(unref(t)("el.datepicker.cancel")), 11, ["onClick"]),
  19754. createElementVNode("button", {
  19755. type: "button",
  19756. class: normalizeClass([unref(nsTime).be("panel", "btn"), "confirm"]),
  19757. disabled: unref(btnConfirmDisabled),
  19758. onClick: ($event) => handleConfirm()
  19759. }, toDisplayString(unref(t)("el.datepicker.confirm")), 11, ["disabled", "onClick"])
  19760. ], 2)
  19761. ], 2)) : createCommentVNode("v-if", true);
  19762. };
  19763. }
  19764. });
  19765. var TimeRangePanel = /* @__PURE__ */ _export_sfc(_sfc_main$23, [["__file", "panel-time-range.vue"]]);
  19766. dayjs.extend(customParseFormat);
  19767. var TimePicker = defineComponent({
  19768. name: "ElTimePicker",
  19769. install: null,
  19770. props: {
  19771. ...timePickerDefaultProps,
  19772. isRange: {
  19773. type: Boolean,
  19774. default: false
  19775. }
  19776. },
  19777. emits: [UPDATE_MODEL_EVENT],
  19778. setup(props, ctx) {
  19779. const commonPicker = ref();
  19780. const [type, Panel] = props.isRange ? ["timerange", TimeRangePanel] : ["time", TimePickPanel];
  19781. const modelUpdater = (value) => ctx.emit(UPDATE_MODEL_EVENT, value);
  19782. provide("ElPopperOptions", props.popperOptions);
  19783. ctx.expose({
  19784. focus: () => {
  19785. var _a;
  19786. (_a = commonPicker.value) == null ? void 0 : _a.focus();
  19787. },
  19788. blur: () => {
  19789. var _a;
  19790. (_a = commonPicker.value) == null ? void 0 : _a.blur();
  19791. },
  19792. handleOpen: () => {
  19793. var _a;
  19794. (_a = commonPicker.value) == null ? void 0 : _a.handleOpen();
  19795. },
  19796. handleClose: () => {
  19797. var _a;
  19798. (_a = commonPicker.value) == null ? void 0 : _a.handleClose();
  19799. }
  19800. });
  19801. return () => {
  19802. var _a;
  19803. const format = (_a = props.format) != null ? _a : DEFAULT_FORMATS_TIME;
  19804. return createVNode(CommonPicker, mergeProps(props, {
  19805. "ref": commonPicker,
  19806. "type": type,
  19807. "format": format,
  19808. "onUpdate:modelValue": modelUpdater
  19809. }), {
  19810. default: (props2) => createVNode(Panel, props2, null)
  19811. });
  19812. };
  19813. }
  19814. });
  19815. const ElTimePicker = withInstall(TimePicker);
  19816. const getPrevMonthLastDays = (date, count) => {
  19817. const lastDay = date.subtract(1, "month").endOf("month").date();
  19818. return rangeArr(count).map((_, index) => lastDay - (count - index - 1));
  19819. };
  19820. const getMonthDays = (date) => {
  19821. const days = date.daysInMonth();
  19822. return rangeArr(days).map((_, index) => index + 1);
  19823. };
  19824. const toNestedArr = (days) => rangeArr(days.length / 7).map((index) => {
  19825. const start = index * 7;
  19826. return days.slice(start, start + 7);
  19827. });
  19828. const dateTableProps = buildProps({
  19829. selectedDay: {
  19830. type: definePropType(Object)
  19831. },
  19832. range: {
  19833. type: definePropType(Array)
  19834. },
  19835. date: {
  19836. type: definePropType(Object),
  19837. required: true
  19838. },
  19839. hideHeader: {
  19840. type: Boolean
  19841. }
  19842. });
  19843. const dateTableEmits = {
  19844. pick: (value) => isObject$1(value)
  19845. };
  19846. var localeData$1 = {exports: {}};
  19847. (function(module, exports) {
  19848. !function(n, e) {
  19849. module.exports = e() ;
  19850. }(commonjsGlobal, function() {
  19851. return function(n, e, t) {
  19852. var r = e.prototype, o = function(n2) {
  19853. return n2 && (n2.indexOf ? n2 : n2.s);
  19854. }, u = function(n2, e2, t2, r2, u2) {
  19855. var i2 = n2.name ? n2 : n2.$locale(), a2 = o(i2[e2]), s2 = o(i2[t2]), f = a2 || s2.map(function(n3) {
  19856. return n3.slice(0, r2);
  19857. });
  19858. if (!u2)
  19859. return f;
  19860. var d = i2.weekStart;
  19861. return f.map(function(n3, e3) {
  19862. return f[(e3 + (d || 0)) % 7];
  19863. });
  19864. }, i = function() {
  19865. return t.Ls[t.locale()];
  19866. }, a = function(n2, e2) {
  19867. return n2.formats[e2] || function(n3) {
  19868. return n3.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, function(n4, e3, t2) {
  19869. return e3 || t2.slice(1);
  19870. });
  19871. }(n2.formats[e2.toUpperCase()]);
  19872. }, s = function() {
  19873. var n2 = this;
  19874. return { months: function(e2) {
  19875. return e2 ? e2.format("MMMM") : u(n2, "months");
  19876. }, monthsShort: function(e2) {
  19877. return e2 ? e2.format("MMM") : u(n2, "monthsShort", "months", 3);
  19878. }, firstDayOfWeek: function() {
  19879. return n2.$locale().weekStart || 0;
  19880. }, weekdays: function(e2) {
  19881. return e2 ? e2.format("dddd") : u(n2, "weekdays");
  19882. }, weekdaysMin: function(e2) {
  19883. return e2 ? e2.format("dd") : u(n2, "weekdaysMin", "weekdays", 2);
  19884. }, weekdaysShort: function(e2) {
  19885. return e2 ? e2.format("ddd") : u(n2, "weekdaysShort", "weekdays", 3);
  19886. }, longDateFormat: function(e2) {
  19887. return a(n2.$locale(), e2);
  19888. }, meridiem: this.$locale().meridiem, ordinal: this.$locale().ordinal };
  19889. };
  19890. r.localeData = function() {
  19891. return s.bind(this)();
  19892. }, t.localeData = function() {
  19893. var n2 = i();
  19894. return { firstDayOfWeek: function() {
  19895. return n2.weekStart || 0;
  19896. }, weekdays: function() {
  19897. return t.weekdays();
  19898. }, weekdaysShort: function() {
  19899. return t.weekdaysShort();
  19900. }, weekdaysMin: function() {
  19901. return t.weekdaysMin();
  19902. }, months: function() {
  19903. return t.months();
  19904. }, monthsShort: function() {
  19905. return t.monthsShort();
  19906. }, longDateFormat: function(e2) {
  19907. return a(n2, e2);
  19908. }, meridiem: n2.meridiem, ordinal: n2.ordinal };
  19909. }, t.months = function() {
  19910. return u(i(), "months");
  19911. }, t.monthsShort = function() {
  19912. return u(i(), "monthsShort", "months", 3);
  19913. }, t.weekdays = function(n2) {
  19914. return u(i(), "weekdays", null, null, n2);
  19915. }, t.weekdaysShort = function(n2) {
  19916. return u(i(), "weekdaysShort", "weekdays", 3, n2);
  19917. }, t.weekdaysMin = function(n2) {
  19918. return u(i(), "weekdaysMin", "weekdays", 2, n2);
  19919. };
  19920. };
  19921. });
  19922. })(localeData$1);
  19923. var localeData = localeData$1.exports;
  19924. const useDateTable = (props, emit) => {
  19925. dayjs.extend(localeData);
  19926. const firstDayOfWeek = dayjs.localeData().firstDayOfWeek();
  19927. const { t, lang } = useLocale();
  19928. const now = dayjs().locale(lang.value);
  19929. const isInRange = computed(() => !!props.range && !!props.range.length);
  19930. const rows = computed(() => {
  19931. let days = [];
  19932. if (isInRange.value) {
  19933. const [start, end] = props.range;
  19934. const currentMonthRange = rangeArr(end.date() - start.date() + 1).map((index) => ({
  19935. text: start.date() + index,
  19936. type: "current"
  19937. }));
  19938. let remaining = currentMonthRange.length % 7;
  19939. remaining = remaining === 0 ? 0 : 7 - remaining;
  19940. const nextMonthRange = rangeArr(remaining).map((_, index) => ({
  19941. text: index + 1,
  19942. type: "next"
  19943. }));
  19944. days = currentMonthRange.concat(nextMonthRange);
  19945. } else {
  19946. const firstDay = props.date.startOf("month").day();
  19947. const prevMonthDays = getPrevMonthLastDays(props.date, (firstDay - firstDayOfWeek + 7) % 7).map((day) => ({
  19948. text: day,
  19949. type: "prev"
  19950. }));
  19951. const currentMonthDays = getMonthDays(props.date).map((day) => ({
  19952. text: day,
  19953. type: "current"
  19954. }));
  19955. days = [...prevMonthDays, ...currentMonthDays];
  19956. const remaining = 7 - (days.length % 7 || 7);
  19957. const nextMonthDays = rangeArr(remaining).map((_, index) => ({
  19958. text: index + 1,
  19959. type: "next"
  19960. }));
  19961. days = days.concat(nextMonthDays);
  19962. }
  19963. return toNestedArr(days);
  19964. });
  19965. const weekDays = computed(() => {
  19966. const start = firstDayOfWeek;
  19967. if (start === 0) {
  19968. return WEEK_DAYS.map((_) => t(`el.datepicker.weeks.${_}`));
  19969. } else {
  19970. return WEEK_DAYS.slice(start).concat(WEEK_DAYS.slice(0, start)).map((_) => t(`el.datepicker.weeks.${_}`));
  19971. }
  19972. });
  19973. const getFormattedDate = (day, type) => {
  19974. switch (type) {
  19975. case "prev":
  19976. return props.date.startOf("month").subtract(1, "month").date(day);
  19977. case "next":
  19978. return props.date.startOf("month").add(1, "month").date(day);
  19979. case "current":
  19980. return props.date.date(day);
  19981. }
  19982. };
  19983. const handlePickDay = ({ text, type }) => {
  19984. const date = getFormattedDate(text, type);
  19985. emit("pick", date);
  19986. };
  19987. const getSlotData = ({ text, type }) => {
  19988. const day = getFormattedDate(text, type);
  19989. return {
  19990. isSelected: day.isSame(props.selectedDay),
  19991. type: `${type}-month`,
  19992. day: day.format("YYYY-MM-DD"),
  19993. date: day.toDate()
  19994. };
  19995. };
  19996. return {
  19997. now,
  19998. isInRange,
  19999. rows,
  20000. weekDays,
  20001. getFormattedDate,
  20002. handlePickDay,
  20003. getSlotData
  20004. };
  20005. };
  20006. const __default__$1w = defineComponent({
  20007. name: "DateTable"
  20008. });
  20009. const _sfc_main$22 = /* @__PURE__ */ defineComponent({
  20010. ...__default__$1w,
  20011. props: dateTableProps,
  20012. emits: dateTableEmits,
  20013. setup(__props, { expose, emit }) {
  20014. const props = __props;
  20015. const {
  20016. isInRange,
  20017. now,
  20018. rows,
  20019. weekDays,
  20020. getFormattedDate,
  20021. handlePickDay,
  20022. getSlotData
  20023. } = useDateTable(props, emit);
  20024. const nsTable = useNamespace("calendar-table");
  20025. const nsDay = useNamespace("calendar-day");
  20026. const getCellClass = ({ text, type }) => {
  20027. const classes = [type];
  20028. if (type === "current") {
  20029. const date = getFormattedDate(text, type);
  20030. if (date.isSame(props.selectedDay, "day")) {
  20031. classes.push(nsDay.is("selected"));
  20032. }
  20033. if (date.isSame(now, "day")) {
  20034. classes.push(nsDay.is("today"));
  20035. }
  20036. }
  20037. return classes;
  20038. };
  20039. expose({
  20040. getFormattedDate
  20041. });
  20042. return (_ctx, _cache) => {
  20043. return openBlock(), createElementBlock("table", {
  20044. class: normalizeClass([unref(nsTable).b(), unref(nsTable).is("range", unref(isInRange))]),
  20045. cellspacing: "0",
  20046. cellpadding: "0"
  20047. }, [
  20048. !_ctx.hideHeader ? (openBlock(), createElementBlock("thead", { key: 0 }, [
  20049. createElementVNode("tr", null, [
  20050. (openBlock(true), createElementBlock(Fragment, null, renderList(unref(weekDays), (day) => {
  20051. return openBlock(), createElementBlock("th", {
  20052. key: day,
  20053. scope: "col"
  20054. }, toDisplayString(day), 1);
  20055. }), 128))
  20056. ])
  20057. ])) : createCommentVNode("v-if", true),
  20058. createElementVNode("tbody", null, [
  20059. (openBlock(true), createElementBlock(Fragment, null, renderList(unref(rows), (row, index) => {
  20060. return openBlock(), createElementBlock("tr", {
  20061. key: index,
  20062. class: normalizeClass({
  20063. [unref(nsTable).e("row")]: true,
  20064. [unref(nsTable).em("row", "hide-border")]: index === 0 && _ctx.hideHeader
  20065. })
  20066. }, [
  20067. (openBlock(true), createElementBlock(Fragment, null, renderList(row, (cell, key) => {
  20068. return openBlock(), createElementBlock("td", {
  20069. key,
  20070. class: normalizeClass(getCellClass(cell)),
  20071. onClick: ($event) => unref(handlePickDay)(cell)
  20072. }, [
  20073. createElementVNode("div", {
  20074. class: normalizeClass(unref(nsDay).b())
  20075. }, [
  20076. renderSlot(_ctx.$slots, "date-cell", {
  20077. data: unref(getSlotData)(cell)
  20078. }, () => [
  20079. createElementVNode("span", null, toDisplayString(cell.text), 1)
  20080. ])
  20081. ], 2)
  20082. ], 10, ["onClick"]);
  20083. }), 128))
  20084. ], 2);
  20085. }), 128))
  20086. ])
  20087. ], 2);
  20088. };
  20089. }
  20090. });
  20091. var DateTable$1 = /* @__PURE__ */ _export_sfc(_sfc_main$22, [["__file", "date-table.vue"]]);
  20092. const adjacentMonth = (start, end) => {
  20093. const firstMonthLastDay = start.endOf("month");
  20094. const lastMonthFirstDay = end.startOf("month");
  20095. const isSameWeek = firstMonthLastDay.isSame(lastMonthFirstDay, "week");
  20096. const lastMonthStartDay = isSameWeek ? lastMonthFirstDay.add(1, "week") : lastMonthFirstDay;
  20097. return [
  20098. [start, firstMonthLastDay],
  20099. [lastMonthStartDay.startOf("week"), end]
  20100. ];
  20101. };
  20102. const threeConsecutiveMonth = (start, end) => {
  20103. const firstMonthLastDay = start.endOf("month");
  20104. const secondMonthFirstDay = start.add(1, "month").startOf("month");
  20105. const secondMonthStartDay = firstMonthLastDay.isSame(secondMonthFirstDay, "week") ? secondMonthFirstDay.add(1, "week") : secondMonthFirstDay;
  20106. const secondMonthLastDay = secondMonthStartDay.endOf("month");
  20107. const lastMonthFirstDay = end.startOf("month");
  20108. const lastMonthStartDay = secondMonthLastDay.isSame(lastMonthFirstDay, "week") ? lastMonthFirstDay.add(1, "week") : lastMonthFirstDay;
  20109. return [
  20110. [start, firstMonthLastDay],
  20111. [secondMonthStartDay.startOf("week"), secondMonthLastDay],
  20112. [lastMonthStartDay.startOf("week"), end]
  20113. ];
  20114. };
  20115. const useCalendar = (props, emit, componentName) => {
  20116. const { lang } = useLocale();
  20117. const selectedDay = ref();
  20118. const now = dayjs().locale(lang.value);
  20119. const realSelectedDay = computed({
  20120. get() {
  20121. if (!props.modelValue)
  20122. return selectedDay.value;
  20123. return date.value;
  20124. },
  20125. set(val) {
  20126. if (!val)
  20127. return;
  20128. selectedDay.value = val;
  20129. const result = val.toDate();
  20130. emit(INPUT_EVENT, result);
  20131. emit(UPDATE_MODEL_EVENT, result);
  20132. }
  20133. });
  20134. const validatedRange = computed(() => {
  20135. if (!props.range || !isArray$1(props.range) || props.range.length !== 2 || props.range.some((item) => !isDate$1(item)))
  20136. return [];
  20137. const rangeArrDayjs = props.range.map((_) => dayjs(_).locale(lang.value));
  20138. const [startDayjs, endDayjs] = rangeArrDayjs;
  20139. if (startDayjs.isAfter(endDayjs)) {
  20140. return [];
  20141. }
  20142. if (startDayjs.isSame(endDayjs, "month")) {
  20143. return calculateValidatedDateRange(startDayjs, endDayjs);
  20144. } else {
  20145. if (startDayjs.add(1, "month").month() !== endDayjs.month()) {
  20146. return [];
  20147. }
  20148. return calculateValidatedDateRange(startDayjs, endDayjs);
  20149. }
  20150. });
  20151. const date = computed(() => {
  20152. if (!props.modelValue) {
  20153. return realSelectedDay.value || (validatedRange.value.length ? validatedRange.value[0][0] : now);
  20154. } else {
  20155. return dayjs(props.modelValue).locale(lang.value);
  20156. }
  20157. });
  20158. const prevMonthDayjs = computed(() => date.value.subtract(1, "month").date(1));
  20159. const nextMonthDayjs = computed(() => date.value.add(1, "month").date(1));
  20160. const prevYearDayjs = computed(() => date.value.subtract(1, "year").date(1));
  20161. const nextYearDayjs = computed(() => date.value.add(1, "year").date(1));
  20162. const calculateValidatedDateRange = (startDayjs, endDayjs) => {
  20163. const firstDay = startDayjs.startOf("week");
  20164. const lastDay = endDayjs.endOf("week");
  20165. const firstMonth = firstDay.get("month");
  20166. const lastMonth = lastDay.get("month");
  20167. if (firstMonth === lastMonth) {
  20168. return [[firstDay, lastDay]];
  20169. } else if ((firstMonth + 1) % 12 === lastMonth) {
  20170. return adjacentMonth(firstDay, lastDay);
  20171. } else if (firstMonth + 2 === lastMonth || (firstMonth + 1) % 11 === lastMonth) {
  20172. return threeConsecutiveMonth(firstDay, lastDay);
  20173. } else {
  20174. return [];
  20175. }
  20176. };
  20177. const pickDay = (day) => {
  20178. realSelectedDay.value = day;
  20179. };
  20180. const selectDate = (type) => {
  20181. const dateMap = {
  20182. "prev-month": prevMonthDayjs.value,
  20183. "next-month": nextMonthDayjs.value,
  20184. "prev-year": prevYearDayjs.value,
  20185. "next-year": nextYearDayjs.value,
  20186. today: now
  20187. };
  20188. const day = dateMap[type];
  20189. if (!day.isSame(date.value, "day")) {
  20190. pickDay(day);
  20191. }
  20192. };
  20193. return {
  20194. calculateValidatedDateRange,
  20195. date,
  20196. realSelectedDay,
  20197. pickDay,
  20198. selectDate,
  20199. validatedRange
  20200. };
  20201. };
  20202. const isValidRange$1 = (range) => isArray$1(range) && range.length === 2 && range.every((item) => isDate$1(item));
  20203. const calendarProps = buildProps({
  20204. modelValue: {
  20205. type: Date
  20206. },
  20207. range: {
  20208. type: definePropType(Array),
  20209. validator: isValidRange$1
  20210. }
  20211. });
  20212. const calendarEmits = {
  20213. [UPDATE_MODEL_EVENT]: (value) => isDate$1(value),
  20214. [INPUT_EVENT]: (value) => isDate$1(value)
  20215. };
  20216. const COMPONENT_NAME$h = "ElCalendar";
  20217. const __default__$1v = defineComponent({
  20218. name: COMPONENT_NAME$h
  20219. });
  20220. const _sfc_main$21 = /* @__PURE__ */ defineComponent({
  20221. ...__default__$1v,
  20222. props: calendarProps,
  20223. emits: calendarEmits,
  20224. setup(__props, { expose, emit }) {
  20225. const props = __props;
  20226. const ns = useNamespace("calendar");
  20227. const {
  20228. calculateValidatedDateRange,
  20229. date,
  20230. pickDay,
  20231. realSelectedDay,
  20232. selectDate,
  20233. validatedRange
  20234. } = useCalendar(props, emit);
  20235. const { t } = useLocale();
  20236. const i18nDate = computed(() => {
  20237. const pickedMonth = `el.datepicker.month${date.value.format("M")}`;
  20238. return `${date.value.year()} ${t("el.datepicker.year")} ${t(pickedMonth)}`;
  20239. });
  20240. expose({
  20241. selectedDay: realSelectedDay,
  20242. pickDay,
  20243. selectDate,
  20244. calculateValidatedDateRange
  20245. });
  20246. return (_ctx, _cache) => {
  20247. return openBlock(), createElementBlock("div", {
  20248. class: normalizeClass(unref(ns).b())
  20249. }, [
  20250. createElementVNode("div", {
  20251. class: normalizeClass(unref(ns).e("header"))
  20252. }, [
  20253. renderSlot(_ctx.$slots, "header", { date: unref(i18nDate) }, () => [
  20254. createElementVNode("div", {
  20255. class: normalizeClass(unref(ns).e("title"))
  20256. }, toDisplayString(unref(i18nDate)), 3),
  20257. unref(validatedRange).length === 0 ? (openBlock(), createElementBlock("div", {
  20258. key: 0,
  20259. class: normalizeClass(unref(ns).e("button-group"))
  20260. }, [
  20261. createVNode(unref(ElButtonGroup$1), null, {
  20262. default: withCtx(() => [
  20263. createVNode(unref(ElButton), {
  20264. size: "small",
  20265. onClick: ($event) => unref(selectDate)("prev-month")
  20266. }, {
  20267. default: withCtx(() => [
  20268. createTextVNode(toDisplayString(unref(t)("el.datepicker.prevMonth")), 1)
  20269. ]),
  20270. _: 1
  20271. }, 8, ["onClick"]),
  20272. createVNode(unref(ElButton), {
  20273. size: "small",
  20274. onClick: ($event) => unref(selectDate)("today")
  20275. }, {
  20276. default: withCtx(() => [
  20277. createTextVNode(toDisplayString(unref(t)("el.datepicker.today")), 1)
  20278. ]),
  20279. _: 1
  20280. }, 8, ["onClick"]),
  20281. createVNode(unref(ElButton), {
  20282. size: "small",
  20283. onClick: ($event) => unref(selectDate)("next-month")
  20284. }, {
  20285. default: withCtx(() => [
  20286. createTextVNode(toDisplayString(unref(t)("el.datepicker.nextMonth")), 1)
  20287. ]),
  20288. _: 1
  20289. }, 8, ["onClick"])
  20290. ]),
  20291. _: 1
  20292. })
  20293. ], 2)) : createCommentVNode("v-if", true)
  20294. ])
  20295. ], 2),
  20296. unref(validatedRange).length === 0 ? (openBlock(), createElementBlock("div", {
  20297. key: 0,
  20298. class: normalizeClass(unref(ns).e("body"))
  20299. }, [
  20300. createVNode(DateTable$1, {
  20301. date: unref(date),
  20302. "selected-day": unref(realSelectedDay),
  20303. onPick: unref(pickDay)
  20304. }, createSlots({
  20305. _: 2
  20306. }, [
  20307. _ctx.$slots["date-cell"] ? {
  20308. name: "date-cell",
  20309. fn: withCtx((data) => [
  20310. renderSlot(_ctx.$slots, "date-cell", normalizeProps(guardReactiveProps(data)))
  20311. ])
  20312. } : void 0
  20313. ]), 1032, ["date", "selected-day", "onPick"])
  20314. ], 2)) : (openBlock(), createElementBlock("div", {
  20315. key: 1,
  20316. class: normalizeClass(unref(ns).e("body"))
  20317. }, [
  20318. (openBlock(true), createElementBlock(Fragment, null, renderList(unref(validatedRange), (range_, index) => {
  20319. return openBlock(), createBlock(DateTable$1, {
  20320. key: index,
  20321. date: range_[0],
  20322. "selected-day": unref(realSelectedDay),
  20323. range: range_,
  20324. "hide-header": index !== 0,
  20325. onPick: unref(pickDay)
  20326. }, createSlots({
  20327. _: 2
  20328. }, [
  20329. _ctx.$slots["date-cell"] ? {
  20330. name: "date-cell",
  20331. fn: withCtx((data) => [
  20332. renderSlot(_ctx.$slots, "date-cell", normalizeProps(guardReactiveProps(data)))
  20333. ])
  20334. } : void 0
  20335. ]), 1032, ["date", "selected-day", "range", "hide-header", "onPick"]);
  20336. }), 128))
  20337. ], 2))
  20338. ], 2);
  20339. };
  20340. }
  20341. });
  20342. var Calendar = /* @__PURE__ */ _export_sfc(_sfc_main$21, [["__file", "calendar.vue"]]);
  20343. const ElCalendar = withInstall(Calendar);
  20344. const cardProps = buildProps({
  20345. header: {
  20346. type: String,
  20347. default: ""
  20348. },
  20349. footer: {
  20350. type: String,
  20351. default: ""
  20352. },
  20353. bodyStyle: {
  20354. type: definePropType([String, Object, Array]),
  20355. default: ""
  20356. },
  20357. headerClass: String,
  20358. bodyClass: String,
  20359. footerClass: String,
  20360. shadow: {
  20361. type: String,
  20362. values: ["always", "hover", "never"],
  20363. default: "always"
  20364. }
  20365. });
  20366. const __default__$1u = defineComponent({
  20367. name: "ElCard"
  20368. });
  20369. const _sfc_main$20 = /* @__PURE__ */ defineComponent({
  20370. ...__default__$1u,
  20371. props: cardProps,
  20372. setup(__props) {
  20373. const ns = useNamespace("card");
  20374. return (_ctx, _cache) => {
  20375. return openBlock(), createElementBlock("div", {
  20376. class: normalizeClass([unref(ns).b(), unref(ns).is(`${_ctx.shadow}-shadow`)])
  20377. }, [
  20378. _ctx.$slots.header || _ctx.header ? (openBlock(), createElementBlock("div", {
  20379. key: 0,
  20380. class: normalizeClass([unref(ns).e("header"), _ctx.headerClass])
  20381. }, [
  20382. renderSlot(_ctx.$slots, "header", {}, () => [
  20383. createTextVNode(toDisplayString(_ctx.header), 1)
  20384. ])
  20385. ], 2)) : createCommentVNode("v-if", true),
  20386. createElementVNode("div", {
  20387. class: normalizeClass([unref(ns).e("body"), _ctx.bodyClass]),
  20388. style: normalizeStyle(_ctx.bodyStyle)
  20389. }, [
  20390. renderSlot(_ctx.$slots, "default")
  20391. ], 6),
  20392. _ctx.$slots.footer || _ctx.footer ? (openBlock(), createElementBlock("div", {
  20393. key: 1,
  20394. class: normalizeClass([unref(ns).e("footer"), _ctx.footerClass])
  20395. }, [
  20396. renderSlot(_ctx.$slots, "footer", {}, () => [
  20397. createTextVNode(toDisplayString(_ctx.footer), 1)
  20398. ])
  20399. ], 2)) : createCommentVNode("v-if", true)
  20400. ], 2);
  20401. };
  20402. }
  20403. });
  20404. var Card = /* @__PURE__ */ _export_sfc(_sfc_main$20, [["__file", "card.vue"]]);
  20405. const ElCard = withInstall(Card);
  20406. const carouselProps = buildProps({
  20407. initialIndex: {
  20408. type: Number,
  20409. default: 0
  20410. },
  20411. height: {
  20412. type: String,
  20413. default: ""
  20414. },
  20415. trigger: {
  20416. type: String,
  20417. values: ["hover", "click"],
  20418. default: "hover"
  20419. },
  20420. autoplay: {
  20421. type: Boolean,
  20422. default: true
  20423. },
  20424. interval: {
  20425. type: Number,
  20426. default: 3e3
  20427. },
  20428. indicatorPosition: {
  20429. type: String,
  20430. values: ["", "none", "outside"],
  20431. default: ""
  20432. },
  20433. arrow: {
  20434. type: String,
  20435. values: ["always", "hover", "never"],
  20436. default: "hover"
  20437. },
  20438. type: {
  20439. type: String,
  20440. values: ["", "card"],
  20441. default: ""
  20442. },
  20443. cardScale: {
  20444. type: Number,
  20445. default: 0.83
  20446. },
  20447. loop: {
  20448. type: Boolean,
  20449. default: true
  20450. },
  20451. direction: {
  20452. type: String,
  20453. values: ["horizontal", "vertical"],
  20454. default: "horizontal"
  20455. },
  20456. pauseOnHover: {
  20457. type: Boolean,
  20458. default: true
  20459. },
  20460. motionBlur: Boolean
  20461. });
  20462. const carouselEmits = {
  20463. change: (current, prev) => [current, prev].every(isNumber)
  20464. };
  20465. const carouselContextKey = Symbol("carouselContextKey");
  20466. const CAROUSEL_ITEM_NAME = "ElCarouselItem";
  20467. const THROTTLE_TIME = 300;
  20468. const useCarousel = (props, emit, componentName) => {
  20469. const {
  20470. children: items,
  20471. addChild: addItem,
  20472. removeChild: removeItem
  20473. } = useOrderedChildren(getCurrentInstance(), CAROUSEL_ITEM_NAME);
  20474. const slots = useSlots();
  20475. const activeIndex = ref(-1);
  20476. const timer = ref(null);
  20477. const hover = ref(false);
  20478. const root = ref();
  20479. const containerHeight = ref(0);
  20480. const isItemsTwoLength = ref(true);
  20481. const isFirstCall = ref(true);
  20482. const isTransitioning = ref(false);
  20483. const arrowDisplay = computed(() => props.arrow !== "never" && !unref(isVertical));
  20484. const hasLabel = computed(() => {
  20485. return items.value.some((item) => item.props.label.toString().length > 0);
  20486. });
  20487. const isCardType = computed(() => props.type === "card");
  20488. const isVertical = computed(() => props.direction === "vertical");
  20489. const containerStyle = computed(() => {
  20490. if (props.height !== "auto") {
  20491. return {
  20492. height: props.height
  20493. };
  20494. }
  20495. return {
  20496. height: `${containerHeight.value}px`,
  20497. overflow: "hidden"
  20498. };
  20499. });
  20500. const throttledArrowClick = throttle((index) => {
  20501. setActiveItem(index);
  20502. }, THROTTLE_TIME, { trailing: true });
  20503. const throttledIndicatorHover = throttle((index) => {
  20504. handleIndicatorHover(index);
  20505. }, THROTTLE_TIME);
  20506. const isTwoLengthShow = (index) => {
  20507. if (!isItemsTwoLength.value)
  20508. return true;
  20509. return activeIndex.value <= 1 ? index <= 1 : index > 1;
  20510. };
  20511. function pauseTimer() {
  20512. if (timer.value) {
  20513. clearInterval(timer.value);
  20514. timer.value = null;
  20515. }
  20516. }
  20517. function startTimer() {
  20518. if (props.interval <= 0 || !props.autoplay || timer.value)
  20519. return;
  20520. timer.value = setInterval(() => playSlides(), props.interval);
  20521. }
  20522. const playSlides = () => {
  20523. if (!isFirstCall.value) {
  20524. isTransitioning.value = true;
  20525. }
  20526. isFirstCall.value = false;
  20527. if (activeIndex.value < items.value.length - 1) {
  20528. activeIndex.value = activeIndex.value + 1;
  20529. } else if (props.loop) {
  20530. activeIndex.value = 0;
  20531. } else {
  20532. isTransitioning.value = false;
  20533. }
  20534. };
  20535. function setActiveItem(index) {
  20536. if (!isFirstCall.value) {
  20537. isTransitioning.value = true;
  20538. }
  20539. isFirstCall.value = false;
  20540. if (isString$1(index)) {
  20541. const filteredItems = items.value.filter((item) => item.props.name === index);
  20542. if (filteredItems.length > 0) {
  20543. index = items.value.indexOf(filteredItems[0]);
  20544. }
  20545. }
  20546. index = Number(index);
  20547. if (Number.isNaN(index) || index !== Math.floor(index)) {
  20548. return;
  20549. }
  20550. const itemCount = items.value.length;
  20551. const oldIndex = activeIndex.value;
  20552. if (index < 0) {
  20553. activeIndex.value = props.loop ? itemCount - 1 : 0;
  20554. } else if (index >= itemCount) {
  20555. activeIndex.value = props.loop ? 0 : itemCount - 1;
  20556. } else {
  20557. activeIndex.value = index;
  20558. }
  20559. if (oldIndex === activeIndex.value) {
  20560. resetItemPosition(oldIndex);
  20561. }
  20562. resetTimer();
  20563. }
  20564. function resetItemPosition(oldIndex) {
  20565. items.value.forEach((item, index) => {
  20566. item.translateItem(index, activeIndex.value, oldIndex);
  20567. });
  20568. }
  20569. function itemInStage(item, index) {
  20570. var _a, _b, _c, _d;
  20571. const _items = unref(items);
  20572. const itemCount = _items.length;
  20573. if (itemCount === 0 || !item.states.inStage)
  20574. return false;
  20575. const nextItemIndex = index + 1;
  20576. const prevItemIndex = index - 1;
  20577. const lastItemIndex = itemCount - 1;
  20578. const isLastItemActive = _items[lastItemIndex].states.active;
  20579. const isFirstItemActive = _items[0].states.active;
  20580. const isNextItemActive = (_b = (_a = _items[nextItemIndex]) == null ? void 0 : _a.states) == null ? void 0 : _b.active;
  20581. const isPrevItemActive = (_d = (_c = _items[prevItemIndex]) == null ? void 0 : _c.states) == null ? void 0 : _d.active;
  20582. if (index === lastItemIndex && isFirstItemActive || isNextItemActive) {
  20583. return "left";
  20584. } else if (index === 0 && isLastItemActive || isPrevItemActive) {
  20585. return "right";
  20586. }
  20587. return false;
  20588. }
  20589. function handleMouseEnter() {
  20590. hover.value = true;
  20591. if (props.pauseOnHover) {
  20592. pauseTimer();
  20593. }
  20594. }
  20595. function handleMouseLeave() {
  20596. hover.value = false;
  20597. startTimer();
  20598. }
  20599. function handleTransitionEnd() {
  20600. isTransitioning.value = false;
  20601. }
  20602. function handleButtonEnter(arrow) {
  20603. if (unref(isVertical))
  20604. return;
  20605. items.value.forEach((item, index) => {
  20606. if (arrow === itemInStage(item, index)) {
  20607. item.states.hover = true;
  20608. }
  20609. });
  20610. }
  20611. function handleButtonLeave() {
  20612. if (unref(isVertical))
  20613. return;
  20614. items.value.forEach((item) => {
  20615. item.states.hover = false;
  20616. });
  20617. }
  20618. function handleIndicatorClick(index) {
  20619. if (index !== activeIndex.value) {
  20620. if (!isFirstCall.value) {
  20621. isTransitioning.value = true;
  20622. }
  20623. }
  20624. activeIndex.value = index;
  20625. }
  20626. function handleIndicatorHover(index) {
  20627. if (props.trigger === "hover" && index !== activeIndex.value) {
  20628. activeIndex.value = index;
  20629. if (!isFirstCall.value) {
  20630. isTransitioning.value = true;
  20631. }
  20632. }
  20633. }
  20634. function prev() {
  20635. setActiveItem(activeIndex.value - 1);
  20636. }
  20637. function next() {
  20638. setActiveItem(activeIndex.value + 1);
  20639. }
  20640. function resetTimer() {
  20641. pauseTimer();
  20642. if (!props.pauseOnHover)
  20643. startTimer();
  20644. }
  20645. function setContainerHeight(height) {
  20646. if (props.height !== "auto")
  20647. return;
  20648. containerHeight.value = height;
  20649. }
  20650. function PlaceholderItem() {
  20651. var _a;
  20652. const defaultSlots = (_a = slots.default) == null ? void 0 : _a.call(slots);
  20653. if (!defaultSlots)
  20654. return null;
  20655. const flatSlots = flattedChildren(defaultSlots);
  20656. const normalizeSlots = flatSlots.filter((slot) => {
  20657. return isVNode(slot) && slot.type.name === CAROUSEL_ITEM_NAME;
  20658. });
  20659. if ((normalizeSlots == null ? void 0 : normalizeSlots.length) === 2 && props.loop && !isCardType.value) {
  20660. isItemsTwoLength.value = true;
  20661. return normalizeSlots;
  20662. }
  20663. isItemsTwoLength.value = false;
  20664. return null;
  20665. }
  20666. watch(() => activeIndex.value, (current, prev2) => {
  20667. resetItemPosition(prev2);
  20668. if (isItemsTwoLength.value) {
  20669. current = current % 2;
  20670. prev2 = prev2 % 2;
  20671. }
  20672. if (prev2 > -1) {
  20673. emit(CHANGE_EVENT, current, prev2);
  20674. }
  20675. });
  20676. watch(() => props.autoplay, (autoplay) => {
  20677. autoplay ? startTimer() : pauseTimer();
  20678. });
  20679. watch(() => props.loop, () => {
  20680. setActiveItem(activeIndex.value);
  20681. });
  20682. watch(() => props.interval, () => {
  20683. resetTimer();
  20684. });
  20685. const resizeObserver = shallowRef();
  20686. onMounted(() => {
  20687. watch(() => items.value, () => {
  20688. if (items.value.length > 0)
  20689. setActiveItem(props.initialIndex);
  20690. }, {
  20691. immediate: true
  20692. });
  20693. resizeObserver.value = useResizeObserver(root.value, () => {
  20694. resetItemPosition();
  20695. });
  20696. startTimer();
  20697. });
  20698. onBeforeUnmount(() => {
  20699. pauseTimer();
  20700. if (root.value && resizeObserver.value)
  20701. resizeObserver.value.stop();
  20702. });
  20703. provide(carouselContextKey, {
  20704. root,
  20705. isCardType,
  20706. isVertical,
  20707. items,
  20708. loop: props.loop,
  20709. cardScale: props.cardScale,
  20710. addItem,
  20711. removeItem,
  20712. setActiveItem,
  20713. setContainerHeight
  20714. });
  20715. return {
  20716. root,
  20717. activeIndex,
  20718. arrowDisplay,
  20719. hasLabel,
  20720. hover,
  20721. isCardType,
  20722. isTransitioning,
  20723. items,
  20724. isVertical,
  20725. containerStyle,
  20726. isItemsTwoLength,
  20727. handleButtonEnter,
  20728. handleTransitionEnd,
  20729. handleButtonLeave,
  20730. handleIndicatorClick,
  20731. handleMouseEnter,
  20732. handleMouseLeave,
  20733. setActiveItem,
  20734. prev,
  20735. next,
  20736. PlaceholderItem,
  20737. isTwoLengthShow,
  20738. throttledArrowClick,
  20739. throttledIndicatorHover
  20740. };
  20741. };
  20742. const COMPONENT_NAME$g = "ElCarousel";
  20743. const __default__$1t = defineComponent({
  20744. name: COMPONENT_NAME$g
  20745. });
  20746. const _sfc_main$1$ = /* @__PURE__ */ defineComponent({
  20747. ...__default__$1t,
  20748. props: carouselProps,
  20749. emits: carouselEmits,
  20750. setup(__props, { expose, emit }) {
  20751. const props = __props;
  20752. const {
  20753. root,
  20754. activeIndex,
  20755. arrowDisplay,
  20756. hasLabel,
  20757. hover,
  20758. isCardType,
  20759. items,
  20760. isVertical,
  20761. containerStyle,
  20762. handleButtonEnter,
  20763. handleButtonLeave,
  20764. isTransitioning,
  20765. handleIndicatorClick,
  20766. handleMouseEnter,
  20767. handleMouseLeave,
  20768. handleTransitionEnd,
  20769. setActiveItem,
  20770. prev,
  20771. next,
  20772. PlaceholderItem,
  20773. isTwoLengthShow,
  20774. throttledArrowClick,
  20775. throttledIndicatorHover
  20776. } = useCarousel(props, emit);
  20777. const ns = useNamespace("carousel");
  20778. const { t } = useLocale();
  20779. const carouselClasses = computed(() => {
  20780. const classes = [ns.b(), ns.m(props.direction)];
  20781. if (unref(isCardType)) {
  20782. classes.push(ns.m("card"));
  20783. }
  20784. return classes;
  20785. });
  20786. const carouselContainer = computed(() => {
  20787. const classes = [ns.e("container")];
  20788. if (props.motionBlur && unref(isTransitioning) && items.value.length > 1) {
  20789. classes.push(unref(isVertical) ? `${ns.namespace.value}-transitioning-vertical` : `${ns.namespace.value}-transitioning`);
  20790. }
  20791. return classes;
  20792. });
  20793. const indicatorsClasses = computed(() => {
  20794. const classes = [ns.e("indicators"), ns.em("indicators", props.direction)];
  20795. if (unref(hasLabel)) {
  20796. classes.push(ns.em("indicators", "labels"));
  20797. }
  20798. if (props.indicatorPosition === "outside") {
  20799. classes.push(ns.em("indicators", "outside"));
  20800. }
  20801. if (unref(isVertical)) {
  20802. classes.push(ns.em("indicators", "right"));
  20803. }
  20804. return classes;
  20805. });
  20806. expose({
  20807. activeIndex,
  20808. setActiveItem,
  20809. prev,
  20810. next
  20811. });
  20812. return (_ctx, _cache) => {
  20813. return openBlock(), createElementBlock("div", {
  20814. ref_key: "root",
  20815. ref: root,
  20816. class: normalizeClass(unref(carouselClasses)),
  20817. onMouseenter: withModifiers(unref(handleMouseEnter), ["stop"]),
  20818. onMouseleave: withModifiers(unref(handleMouseLeave), ["stop"])
  20819. }, [
  20820. unref(arrowDisplay) ? (openBlock(), createBlock(Transition, {
  20821. key: 0,
  20822. name: "carousel-arrow-left",
  20823. persisted: ""
  20824. }, {
  20825. default: withCtx(() => [
  20826. withDirectives(createElementVNode("button", {
  20827. type: "button",
  20828. class: normalizeClass([unref(ns).e("arrow"), unref(ns).em("arrow", "left")]),
  20829. "aria-label": unref(t)("el.carousel.leftArrow"),
  20830. onMouseenter: ($event) => unref(handleButtonEnter)("left"),
  20831. onMouseleave: unref(handleButtonLeave),
  20832. onClick: withModifiers(($event) => unref(throttledArrowClick)(unref(activeIndex) - 1), ["stop"])
  20833. }, [
  20834. createVNode(unref(ElIcon), null, {
  20835. default: withCtx(() => [
  20836. createVNode(unref(arrow_left_default))
  20837. ]),
  20838. _: 1
  20839. })
  20840. ], 42, ["aria-label", "onMouseenter", "onMouseleave", "onClick"]), [
  20841. [
  20842. vShow,
  20843. (_ctx.arrow === "always" || unref(hover)) && (props.loop || unref(activeIndex) > 0)
  20844. ]
  20845. ])
  20846. ]),
  20847. _: 1
  20848. })) : createCommentVNode("v-if", true),
  20849. unref(arrowDisplay) ? (openBlock(), createBlock(Transition, {
  20850. key: 1,
  20851. name: "carousel-arrow-right",
  20852. persisted: ""
  20853. }, {
  20854. default: withCtx(() => [
  20855. withDirectives(createElementVNode("button", {
  20856. type: "button",
  20857. class: normalizeClass([unref(ns).e("arrow"), unref(ns).em("arrow", "right")]),
  20858. "aria-label": unref(t)("el.carousel.rightArrow"),
  20859. onMouseenter: ($event) => unref(handleButtonEnter)("right"),
  20860. onMouseleave: unref(handleButtonLeave),
  20861. onClick: withModifiers(($event) => unref(throttledArrowClick)(unref(activeIndex) + 1), ["stop"])
  20862. }, [
  20863. createVNode(unref(ElIcon), null, {
  20864. default: withCtx(() => [
  20865. createVNode(unref(arrow_right_default))
  20866. ]),
  20867. _: 1
  20868. })
  20869. ], 42, ["aria-label", "onMouseenter", "onMouseleave", "onClick"]), [
  20870. [
  20871. vShow,
  20872. (_ctx.arrow === "always" || unref(hover)) && (props.loop || unref(activeIndex) < unref(items).length - 1)
  20873. ]
  20874. ])
  20875. ]),
  20876. _: 1
  20877. })) : createCommentVNode("v-if", true),
  20878. createElementVNode("div", {
  20879. class: normalizeClass(unref(carouselContainer)),
  20880. style: normalizeStyle(unref(containerStyle)),
  20881. onTransitionend: unref(handleTransitionEnd)
  20882. }, [
  20883. createVNode(unref(PlaceholderItem)),
  20884. renderSlot(_ctx.$slots, "default")
  20885. ], 46, ["onTransitionend"]),
  20886. _ctx.indicatorPosition !== "none" ? (openBlock(), createElementBlock("ul", {
  20887. key: 2,
  20888. class: normalizeClass(unref(indicatorsClasses))
  20889. }, [
  20890. (openBlock(true), createElementBlock(Fragment, null, renderList(unref(items), (item, index) => {
  20891. return withDirectives((openBlock(), createElementBlock("li", {
  20892. key: index,
  20893. class: normalizeClass([
  20894. unref(ns).e("indicator"),
  20895. unref(ns).em("indicator", _ctx.direction),
  20896. unref(ns).is("active", index === unref(activeIndex))
  20897. ]),
  20898. onMouseenter: ($event) => unref(throttledIndicatorHover)(index),
  20899. onClick: withModifiers(($event) => unref(handleIndicatorClick)(index), ["stop"])
  20900. }, [
  20901. createElementVNode("button", {
  20902. class: normalizeClass(unref(ns).e("button")),
  20903. "aria-label": unref(t)("el.carousel.indicator", { index: index + 1 })
  20904. }, [
  20905. unref(hasLabel) ? (openBlock(), createElementBlock("span", { key: 0 }, toDisplayString(item.props.label), 1)) : createCommentVNode("v-if", true)
  20906. ], 10, ["aria-label"])
  20907. ], 42, ["onMouseenter", "onClick"])), [
  20908. [vShow, unref(isTwoLengthShow)(index)]
  20909. ]);
  20910. }), 128))
  20911. ], 2)) : createCommentVNode("v-if", true),
  20912. props.motionBlur ? (openBlock(), createElementBlock("svg", {
  20913. key: 3,
  20914. xmlns: "http://www.w3.org/2000/svg",
  20915. version: "1.1",
  20916. style: { "display": "none" }
  20917. }, [
  20918. createElementVNode("defs", null, [
  20919. createElementVNode("filter", { id: "elCarouselHorizontal" }, [
  20920. createElementVNode("feGaussianBlur", {
  20921. in: "SourceGraphic",
  20922. stdDeviation: "12,0"
  20923. })
  20924. ]),
  20925. createElementVNode("filter", { id: "elCarouselVertical" }, [
  20926. createElementVNode("feGaussianBlur", {
  20927. in: "SourceGraphic",
  20928. stdDeviation: "0,10"
  20929. })
  20930. ])
  20931. ])
  20932. ])) : createCommentVNode("v-if", true)
  20933. ], 42, ["onMouseenter", "onMouseleave"]);
  20934. };
  20935. }
  20936. });
  20937. var Carousel = /* @__PURE__ */ _export_sfc(_sfc_main$1$, [["__file", "carousel.vue"]]);
  20938. const carouselItemProps = buildProps({
  20939. name: { type: String, default: "" },
  20940. label: {
  20941. type: [String, Number],
  20942. default: ""
  20943. }
  20944. });
  20945. const useCarouselItem = (props) => {
  20946. const carouselContext = inject(carouselContextKey);
  20947. const instance = getCurrentInstance();
  20948. const carouselItemRef = ref();
  20949. const hover = ref(false);
  20950. const translate = ref(0);
  20951. const scale = ref(1);
  20952. const active = ref(false);
  20953. const ready = ref(false);
  20954. const inStage = ref(false);
  20955. const animating = ref(false);
  20956. const { isCardType, isVertical, cardScale } = carouselContext;
  20957. function processIndex(index, activeIndex, length) {
  20958. const lastItemIndex = length - 1;
  20959. const prevItemIndex = activeIndex - 1;
  20960. const nextItemIndex = activeIndex + 1;
  20961. const halfItemIndex = length / 2;
  20962. if (activeIndex === 0 && index === lastItemIndex) {
  20963. return -1;
  20964. } else if (activeIndex === lastItemIndex && index === 0) {
  20965. return length;
  20966. } else if (index < prevItemIndex && activeIndex - index >= halfItemIndex) {
  20967. return length + 1;
  20968. } else if (index > nextItemIndex && index - activeIndex >= halfItemIndex) {
  20969. return -2;
  20970. }
  20971. return index;
  20972. }
  20973. function calcCardTranslate(index, activeIndex) {
  20974. var _a, _b;
  20975. const parentWidth = unref(isVertical) ? ((_a = carouselContext.root.value) == null ? void 0 : _a.offsetHeight) || 0 : ((_b = carouselContext.root.value) == null ? void 0 : _b.offsetWidth) || 0;
  20976. if (inStage.value) {
  20977. return parentWidth * ((2 - cardScale) * (index - activeIndex) + 1) / 4;
  20978. } else if (index < activeIndex) {
  20979. return -(1 + cardScale) * parentWidth / 4;
  20980. } else {
  20981. return (3 + cardScale) * parentWidth / 4;
  20982. }
  20983. }
  20984. function calcTranslate(index, activeIndex, isVertical2) {
  20985. const rootEl = carouselContext.root.value;
  20986. if (!rootEl)
  20987. return 0;
  20988. const distance = (isVertical2 ? rootEl.offsetHeight : rootEl.offsetWidth) || 0;
  20989. return distance * (index - activeIndex);
  20990. }
  20991. const translateItem = (index, activeIndex, oldIndex) => {
  20992. var _a;
  20993. const _isCardType = unref(isCardType);
  20994. const carouselItemLength = (_a = carouselContext.items.value.length) != null ? _a : Number.NaN;
  20995. const isActive = index === activeIndex;
  20996. if (!_isCardType && !isUndefined(oldIndex)) {
  20997. animating.value = isActive || index === oldIndex;
  20998. }
  20999. if (!isActive && carouselItemLength > 2 && carouselContext.loop) {
  21000. index = processIndex(index, activeIndex, carouselItemLength);
  21001. }
  21002. const _isVertical = unref(isVertical);
  21003. active.value = isActive;
  21004. if (_isCardType) {
  21005. inStage.value = Math.round(Math.abs(index - activeIndex)) <= 1;
  21006. translate.value = calcCardTranslate(index, activeIndex);
  21007. scale.value = unref(active) ? 1 : cardScale;
  21008. } else {
  21009. translate.value = calcTranslate(index, activeIndex, _isVertical);
  21010. }
  21011. ready.value = true;
  21012. if (isActive && carouselItemRef.value) {
  21013. carouselContext.setContainerHeight(carouselItemRef.value.offsetHeight);
  21014. }
  21015. };
  21016. function handleItemClick() {
  21017. if (carouselContext && unref(isCardType)) {
  21018. const index = carouselContext.items.value.findIndex(({ uid }) => uid === instance.uid);
  21019. carouselContext.setActiveItem(index);
  21020. }
  21021. }
  21022. onMounted(() => {
  21023. carouselContext.addItem({
  21024. props,
  21025. states: reactive({
  21026. hover,
  21027. translate,
  21028. scale,
  21029. active,
  21030. ready,
  21031. inStage,
  21032. animating
  21033. }),
  21034. uid: instance.uid,
  21035. translateItem
  21036. });
  21037. });
  21038. onUnmounted(() => {
  21039. carouselContext.removeItem(instance.uid);
  21040. });
  21041. return {
  21042. carouselItemRef,
  21043. active,
  21044. animating,
  21045. hover,
  21046. inStage,
  21047. isVertical,
  21048. translate,
  21049. isCardType,
  21050. scale,
  21051. ready,
  21052. handleItemClick
  21053. };
  21054. };
  21055. const __default__$1s = defineComponent({
  21056. name: CAROUSEL_ITEM_NAME
  21057. });
  21058. const _sfc_main$1_ = /* @__PURE__ */ defineComponent({
  21059. ...__default__$1s,
  21060. props: carouselItemProps,
  21061. setup(__props) {
  21062. const props = __props;
  21063. const ns = useNamespace("carousel");
  21064. const {
  21065. carouselItemRef,
  21066. active,
  21067. animating,
  21068. hover,
  21069. inStage,
  21070. isVertical,
  21071. translate,
  21072. isCardType,
  21073. scale,
  21074. ready,
  21075. handleItemClick
  21076. } = useCarouselItem(props);
  21077. const itemKls = computed(() => [
  21078. ns.e("item"),
  21079. ns.is("active", active.value),
  21080. ns.is("in-stage", inStage.value),
  21081. ns.is("hover", hover.value),
  21082. ns.is("animating", animating.value),
  21083. {
  21084. [ns.em("item", "card")]: isCardType.value,
  21085. [ns.em("item", "card-vertical")]: isCardType.value && isVertical.value
  21086. }
  21087. ]);
  21088. const itemStyle = computed(() => {
  21089. const translateType = `translate${unref(isVertical) ? "Y" : "X"}`;
  21090. const _translate = `${translateType}(${unref(translate)}px)`;
  21091. const _scale = `scale(${unref(scale)})`;
  21092. const transform = [_translate, _scale].join(" ");
  21093. return {
  21094. transform
  21095. };
  21096. });
  21097. return (_ctx, _cache) => {
  21098. return withDirectives((openBlock(), createElementBlock("div", {
  21099. ref_key: "carouselItemRef",
  21100. ref: carouselItemRef,
  21101. class: normalizeClass(unref(itemKls)),
  21102. style: normalizeStyle(unref(itemStyle)),
  21103. onClick: unref(handleItemClick)
  21104. }, [
  21105. unref(isCardType) ? withDirectives((openBlock(), createElementBlock("div", {
  21106. key: 0,
  21107. class: normalizeClass(unref(ns).e("mask"))
  21108. }, null, 2)), [
  21109. [vShow, !unref(active)]
  21110. ]) : createCommentVNode("v-if", true),
  21111. renderSlot(_ctx.$slots, "default")
  21112. ], 14, ["onClick"])), [
  21113. [vShow, unref(ready)]
  21114. ]);
  21115. };
  21116. }
  21117. });
  21118. var CarouselItem = /* @__PURE__ */ _export_sfc(_sfc_main$1_, [["__file", "carousel-item.vue"]]);
  21119. const ElCarousel = withInstall(Carousel, {
  21120. CarouselItem
  21121. });
  21122. const ElCarouselItem = withNoopInstall(CarouselItem);
  21123. const checkboxProps = {
  21124. modelValue: {
  21125. type: [Number, String, Boolean],
  21126. default: void 0
  21127. },
  21128. label: {
  21129. type: [String, Boolean, Number, Object],
  21130. default: void 0
  21131. },
  21132. value: {
  21133. type: [String, Boolean, Number, Object],
  21134. default: void 0
  21135. },
  21136. indeterminate: Boolean,
  21137. disabled: Boolean,
  21138. checked: Boolean,
  21139. name: {
  21140. type: String,
  21141. default: void 0
  21142. },
  21143. trueValue: {
  21144. type: [String, Number],
  21145. default: void 0
  21146. },
  21147. falseValue: {
  21148. type: [String, Number],
  21149. default: void 0
  21150. },
  21151. trueLabel: {
  21152. type: [String, Number],
  21153. default: void 0
  21154. },
  21155. falseLabel: {
  21156. type: [String, Number],
  21157. default: void 0
  21158. },
  21159. id: {
  21160. type: String,
  21161. default: void 0
  21162. },
  21163. border: Boolean,
  21164. size: useSizeProp,
  21165. tabindex: [String, Number],
  21166. validateEvent: {
  21167. type: Boolean,
  21168. default: true
  21169. },
  21170. ...useAriaProps(["ariaControls"])
  21171. };
  21172. const checkboxEmits = {
  21173. [UPDATE_MODEL_EVENT]: (val) => isString$1(val) || isNumber(val) || isBoolean(val),
  21174. change: (val) => isString$1(val) || isNumber(val) || isBoolean(val)
  21175. };
  21176. const checkboxGroupContextKey = Symbol("checkboxGroupContextKey");
  21177. const useCheckboxDisabled = ({
  21178. model,
  21179. isChecked
  21180. }) => {
  21181. const checkboxGroup = inject(checkboxGroupContextKey, void 0);
  21182. const isLimitDisabled = computed(() => {
  21183. var _a, _b;
  21184. const max = (_a = checkboxGroup == null ? void 0 : checkboxGroup.max) == null ? void 0 : _a.value;
  21185. const min = (_b = checkboxGroup == null ? void 0 : checkboxGroup.min) == null ? void 0 : _b.value;
  21186. return !isUndefined(max) && model.value.length >= max && !isChecked.value || !isUndefined(min) && model.value.length <= min && isChecked.value;
  21187. });
  21188. const isDisabled = useFormDisabled(computed(() => (checkboxGroup == null ? void 0 : checkboxGroup.disabled.value) || isLimitDisabled.value));
  21189. return {
  21190. isDisabled,
  21191. isLimitDisabled
  21192. };
  21193. };
  21194. const useCheckboxEvent = (props, {
  21195. model,
  21196. isLimitExceeded,
  21197. hasOwnLabel,
  21198. isDisabled,
  21199. isLabeledByFormItem
  21200. }) => {
  21201. const checkboxGroup = inject(checkboxGroupContextKey, void 0);
  21202. const { formItem } = useFormItem();
  21203. const { emit } = getCurrentInstance();
  21204. function getLabeledValue(value) {
  21205. var _a, _b, _c, _d;
  21206. 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;
  21207. }
  21208. function emitChangeEvent(checked, e) {
  21209. emit(CHANGE_EVENT, getLabeledValue(checked), e);
  21210. }
  21211. function handleChange(e) {
  21212. if (isLimitExceeded.value)
  21213. return;
  21214. const target = e.target;
  21215. emit(CHANGE_EVENT, getLabeledValue(target.checked), e);
  21216. }
  21217. async function onClickRoot(e) {
  21218. if (isLimitExceeded.value)
  21219. return;
  21220. if (!hasOwnLabel.value && !isDisabled.value && isLabeledByFormItem.value) {
  21221. const eventTargets = e.composedPath();
  21222. const hasLabel = eventTargets.some((item) => item.tagName === "LABEL");
  21223. if (!hasLabel) {
  21224. model.value = getLabeledValue([false, props.falseValue, props.falseLabel].includes(model.value));
  21225. await nextTick();
  21226. emitChangeEvent(model.value, e);
  21227. }
  21228. }
  21229. }
  21230. const validateEvent = computed(() => (checkboxGroup == null ? void 0 : checkboxGroup.validateEvent) || props.validateEvent);
  21231. watch(() => props.modelValue, () => {
  21232. if (validateEvent.value) {
  21233. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
  21234. }
  21235. });
  21236. return {
  21237. handleChange,
  21238. onClickRoot
  21239. };
  21240. };
  21241. const useCheckboxModel = (props) => {
  21242. const selfModel = ref(false);
  21243. const { emit } = getCurrentInstance();
  21244. const checkboxGroup = inject(checkboxGroupContextKey, void 0);
  21245. const isGroup = computed(() => isUndefined(checkboxGroup) === false);
  21246. const isLimitExceeded = ref(false);
  21247. const model = computed({
  21248. get() {
  21249. var _a, _b;
  21250. return isGroup.value ? (_a = checkboxGroup == null ? void 0 : checkboxGroup.modelValue) == null ? void 0 : _a.value : (_b = props.modelValue) != null ? _b : selfModel.value;
  21251. },
  21252. set(val) {
  21253. var _a, _b;
  21254. if (isGroup.value && isArray$1(val)) {
  21255. 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;
  21256. isLimitExceeded.value === false && ((_b = checkboxGroup == null ? void 0 : checkboxGroup.changeEvent) == null ? void 0 : _b.call(checkboxGroup, val));
  21257. } else {
  21258. emit(UPDATE_MODEL_EVENT, val);
  21259. selfModel.value = val;
  21260. }
  21261. }
  21262. });
  21263. return {
  21264. model,
  21265. isGroup,
  21266. isLimitExceeded
  21267. };
  21268. };
  21269. const useCheckboxStatus = (props, slots, { model }) => {
  21270. const checkboxGroup = inject(checkboxGroupContextKey, void 0);
  21271. const isFocused = ref(false);
  21272. const actualValue = computed(() => {
  21273. if (!isPropAbsent(props.value)) {
  21274. return props.value;
  21275. }
  21276. return props.label;
  21277. });
  21278. const isChecked = computed(() => {
  21279. const value = model.value;
  21280. if (isBoolean(value)) {
  21281. return value;
  21282. } else if (isArray$1(value)) {
  21283. if (isObject$1(actualValue.value)) {
  21284. return value.map(toRaw).some((o) => isEqual$1(o, actualValue.value));
  21285. } else {
  21286. return value.map(toRaw).includes(actualValue.value);
  21287. }
  21288. } else if (value !== null && value !== void 0) {
  21289. return value === props.trueValue || value === props.trueLabel;
  21290. } else {
  21291. return !!value;
  21292. }
  21293. });
  21294. const checkboxButtonSize = useFormSize(computed(() => {
  21295. var _a;
  21296. return (_a = checkboxGroup == null ? void 0 : checkboxGroup.size) == null ? void 0 : _a.value;
  21297. }), {
  21298. prop: true
  21299. });
  21300. const checkboxSize = useFormSize(computed(() => {
  21301. var _a;
  21302. return (_a = checkboxGroup == null ? void 0 : checkboxGroup.size) == null ? void 0 : _a.value;
  21303. }));
  21304. const hasOwnLabel = computed(() => {
  21305. return !!slots.default || !isPropAbsent(actualValue.value);
  21306. });
  21307. return {
  21308. checkboxButtonSize,
  21309. isChecked,
  21310. isFocused,
  21311. checkboxSize,
  21312. hasOwnLabel,
  21313. actualValue
  21314. };
  21315. };
  21316. const useCheckbox = (props, slots) => {
  21317. const { formItem: elFormItem } = useFormItem();
  21318. const { model, isGroup, isLimitExceeded } = useCheckboxModel(props);
  21319. const {
  21320. isFocused,
  21321. isChecked,
  21322. checkboxButtonSize,
  21323. checkboxSize,
  21324. hasOwnLabel,
  21325. actualValue
  21326. } = useCheckboxStatus(props, slots, { model });
  21327. const { isDisabled } = useCheckboxDisabled({ model, isChecked });
  21328. const { inputId, isLabeledByFormItem } = useFormItemInputId(props, {
  21329. formItemContext: elFormItem,
  21330. disableIdGeneration: hasOwnLabel,
  21331. disableIdManagement: isGroup
  21332. });
  21333. const { handleChange, onClickRoot } = useCheckboxEvent(props, {
  21334. model,
  21335. isLimitExceeded,
  21336. hasOwnLabel,
  21337. isDisabled,
  21338. isLabeledByFormItem
  21339. });
  21340. const setStoreValue = () => {
  21341. function addToStore() {
  21342. var _a, _b;
  21343. if (isArray$1(model.value) && !model.value.includes(actualValue.value)) {
  21344. model.value.push(actualValue.value);
  21345. } else {
  21346. model.value = (_b = (_a = props.trueValue) != null ? _a : props.trueLabel) != null ? _b : true;
  21347. }
  21348. }
  21349. props.checked && addToStore();
  21350. };
  21351. setStoreValue();
  21352. useDeprecated({
  21353. from: "label act as value",
  21354. replacement: "value",
  21355. version: "3.0.0",
  21356. scope: "el-checkbox",
  21357. ref: "https://element-plus.org/en-US/component/checkbox.html"
  21358. }, computed(() => isGroup.value && isPropAbsent(props.value)));
  21359. useDeprecated({
  21360. from: "true-label",
  21361. replacement: "true-value",
  21362. version: "3.0.0",
  21363. scope: "el-checkbox",
  21364. ref: "https://element-plus.org/en-US/component/checkbox.html"
  21365. }, computed(() => !!props.trueLabel));
  21366. useDeprecated({
  21367. from: "false-label",
  21368. replacement: "false-value",
  21369. version: "3.0.0",
  21370. scope: "el-checkbox",
  21371. ref: "https://element-plus.org/en-US/component/checkbox.html"
  21372. }, computed(() => !!props.falseLabel));
  21373. return {
  21374. inputId,
  21375. isLabeledByFormItem,
  21376. isChecked,
  21377. isDisabled,
  21378. isFocused,
  21379. checkboxButtonSize,
  21380. checkboxSize,
  21381. hasOwnLabel,
  21382. model,
  21383. actualValue,
  21384. handleChange,
  21385. onClickRoot
  21386. };
  21387. };
  21388. const __default__$1r = defineComponent({
  21389. name: "ElCheckbox"
  21390. });
  21391. const _sfc_main$1Z = /* @__PURE__ */ defineComponent({
  21392. ...__default__$1r,
  21393. props: checkboxProps,
  21394. emits: checkboxEmits,
  21395. setup(__props) {
  21396. const props = __props;
  21397. const slots = useSlots();
  21398. const {
  21399. inputId,
  21400. isLabeledByFormItem,
  21401. isChecked,
  21402. isDisabled,
  21403. isFocused,
  21404. checkboxSize,
  21405. hasOwnLabel,
  21406. model,
  21407. actualValue,
  21408. handleChange,
  21409. onClickRoot
  21410. } = useCheckbox(props, slots);
  21411. const ns = useNamespace("checkbox");
  21412. const compKls = computed(() => {
  21413. return [
  21414. ns.b(),
  21415. ns.m(checkboxSize.value),
  21416. ns.is("disabled", isDisabled.value),
  21417. ns.is("bordered", props.border),
  21418. ns.is("checked", isChecked.value)
  21419. ];
  21420. });
  21421. const spanKls = computed(() => {
  21422. return [
  21423. ns.e("input"),
  21424. ns.is("disabled", isDisabled.value),
  21425. ns.is("checked", isChecked.value),
  21426. ns.is("indeterminate", props.indeterminate),
  21427. ns.is("focus", isFocused.value)
  21428. ];
  21429. });
  21430. return (_ctx, _cache) => {
  21431. return openBlock(), createBlock(resolveDynamicComponent(!unref(hasOwnLabel) && unref(isLabeledByFormItem) ? "span" : "label"), {
  21432. class: normalizeClass(unref(compKls)),
  21433. "aria-controls": _ctx.indeterminate ? _ctx.ariaControls : null,
  21434. onClick: unref(onClickRoot)
  21435. }, {
  21436. default: withCtx(() => {
  21437. var _a, _b, _c, _d;
  21438. return [
  21439. createElementVNode("span", {
  21440. class: normalizeClass(unref(spanKls))
  21441. }, [
  21442. _ctx.trueValue || _ctx.falseValue || _ctx.trueLabel || _ctx.falseLabel ? withDirectives((openBlock(), createElementBlock("input", {
  21443. key: 0,
  21444. id: unref(inputId),
  21445. "onUpdate:modelValue": ($event) => isRef(model) ? model.value = $event : null,
  21446. class: normalizeClass(unref(ns).e("original")),
  21447. type: "checkbox",
  21448. indeterminate: _ctx.indeterminate,
  21449. name: _ctx.name,
  21450. tabindex: _ctx.tabindex,
  21451. disabled: unref(isDisabled),
  21452. "true-value": (_b = (_a = _ctx.trueValue) != null ? _a : _ctx.trueLabel) != null ? _b : true,
  21453. "false-value": (_d = (_c = _ctx.falseValue) != null ? _c : _ctx.falseLabel) != null ? _d : false,
  21454. onChange: unref(handleChange),
  21455. onFocus: ($event) => isFocused.value = true,
  21456. onBlur: ($event) => isFocused.value = false,
  21457. onClick: withModifiers(() => {
  21458. }, ["stop"])
  21459. }, null, 42, ["id", "onUpdate:modelValue", "indeterminate", "name", "tabindex", "disabled", "true-value", "false-value", "onChange", "onFocus", "onBlur", "onClick"])), [
  21460. [vModelCheckbox, unref(model)]
  21461. ]) : withDirectives((openBlock(), createElementBlock("input", {
  21462. key: 1,
  21463. id: unref(inputId),
  21464. "onUpdate:modelValue": ($event) => isRef(model) ? model.value = $event : null,
  21465. class: normalizeClass(unref(ns).e("original")),
  21466. type: "checkbox",
  21467. indeterminate: _ctx.indeterminate,
  21468. disabled: unref(isDisabled),
  21469. value: unref(actualValue),
  21470. name: _ctx.name,
  21471. tabindex: _ctx.tabindex,
  21472. onChange: unref(handleChange),
  21473. onFocus: ($event) => isFocused.value = true,
  21474. onBlur: ($event) => isFocused.value = false,
  21475. onClick: withModifiers(() => {
  21476. }, ["stop"])
  21477. }, null, 42, ["id", "onUpdate:modelValue", "indeterminate", "disabled", "value", "name", "tabindex", "onChange", "onFocus", "onBlur", "onClick"])), [
  21478. [vModelCheckbox, unref(model)]
  21479. ]),
  21480. createElementVNode("span", {
  21481. class: normalizeClass(unref(ns).e("inner"))
  21482. }, null, 2)
  21483. ], 2),
  21484. unref(hasOwnLabel) ? (openBlock(), createElementBlock("span", {
  21485. key: 0,
  21486. class: normalizeClass(unref(ns).e("label"))
  21487. }, [
  21488. renderSlot(_ctx.$slots, "default"),
  21489. !_ctx.$slots.default ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  21490. createTextVNode(toDisplayString(_ctx.label), 1)
  21491. ], 64)) : createCommentVNode("v-if", true)
  21492. ], 2)) : createCommentVNode("v-if", true)
  21493. ];
  21494. }),
  21495. _: 3
  21496. }, 8, ["class", "aria-controls", "onClick"]);
  21497. };
  21498. }
  21499. });
  21500. var Checkbox = /* @__PURE__ */ _export_sfc(_sfc_main$1Z, [["__file", "checkbox.vue"]]);
  21501. const __default__$1q = defineComponent({
  21502. name: "ElCheckboxButton"
  21503. });
  21504. const _sfc_main$1Y = /* @__PURE__ */ defineComponent({
  21505. ...__default__$1q,
  21506. props: checkboxProps,
  21507. emits: checkboxEmits,
  21508. setup(__props) {
  21509. const props = __props;
  21510. const slots = useSlots();
  21511. const {
  21512. isFocused,
  21513. isChecked,
  21514. isDisabled,
  21515. checkboxButtonSize,
  21516. model,
  21517. actualValue,
  21518. handleChange
  21519. } = useCheckbox(props, slots);
  21520. const checkboxGroup = inject(checkboxGroupContextKey, void 0);
  21521. const ns = useNamespace("checkbox");
  21522. const activeStyle = computed(() => {
  21523. var _a, _b, _c, _d;
  21524. const fillValue = (_b = (_a = checkboxGroup == null ? void 0 : checkboxGroup.fill) == null ? void 0 : _a.value) != null ? _b : "";
  21525. return {
  21526. backgroundColor: fillValue,
  21527. borderColor: fillValue,
  21528. color: (_d = (_c = checkboxGroup == null ? void 0 : checkboxGroup.textColor) == null ? void 0 : _c.value) != null ? _d : "",
  21529. boxShadow: fillValue ? `-1px 0 0 0 ${fillValue}` : void 0
  21530. };
  21531. });
  21532. const labelKls = computed(() => {
  21533. return [
  21534. ns.b("button"),
  21535. ns.bm("button", checkboxButtonSize.value),
  21536. ns.is("disabled", isDisabled.value),
  21537. ns.is("checked", isChecked.value),
  21538. ns.is("focus", isFocused.value)
  21539. ];
  21540. });
  21541. return (_ctx, _cache) => {
  21542. var _a, _b, _c, _d;
  21543. return openBlock(), createElementBlock("label", {
  21544. class: normalizeClass(unref(labelKls))
  21545. }, [
  21546. _ctx.trueValue || _ctx.falseValue || _ctx.trueLabel || _ctx.falseLabel ? withDirectives((openBlock(), createElementBlock("input", {
  21547. key: 0,
  21548. "onUpdate:modelValue": ($event) => isRef(model) ? model.value = $event : null,
  21549. class: normalizeClass(unref(ns).be("button", "original")),
  21550. type: "checkbox",
  21551. name: _ctx.name,
  21552. tabindex: _ctx.tabindex,
  21553. disabled: unref(isDisabled),
  21554. "true-value": (_b = (_a = _ctx.trueValue) != null ? _a : _ctx.trueLabel) != null ? _b : true,
  21555. "false-value": (_d = (_c = _ctx.falseValue) != null ? _c : _ctx.falseLabel) != null ? _d : false,
  21556. onChange: unref(handleChange),
  21557. onFocus: ($event) => isFocused.value = true,
  21558. onBlur: ($event) => isFocused.value = false,
  21559. onClick: withModifiers(() => {
  21560. }, ["stop"])
  21561. }, null, 42, ["onUpdate:modelValue", "name", "tabindex", "disabled", "true-value", "false-value", "onChange", "onFocus", "onBlur", "onClick"])), [
  21562. [vModelCheckbox, unref(model)]
  21563. ]) : withDirectives((openBlock(), createElementBlock("input", {
  21564. key: 1,
  21565. "onUpdate:modelValue": ($event) => isRef(model) ? model.value = $event : null,
  21566. class: normalizeClass(unref(ns).be("button", "original")),
  21567. type: "checkbox",
  21568. name: _ctx.name,
  21569. tabindex: _ctx.tabindex,
  21570. disabled: unref(isDisabled),
  21571. value: unref(actualValue),
  21572. onChange: unref(handleChange),
  21573. onFocus: ($event) => isFocused.value = true,
  21574. onBlur: ($event) => isFocused.value = false,
  21575. onClick: withModifiers(() => {
  21576. }, ["stop"])
  21577. }, null, 42, ["onUpdate:modelValue", "name", "tabindex", "disabled", "value", "onChange", "onFocus", "onBlur", "onClick"])), [
  21578. [vModelCheckbox, unref(model)]
  21579. ]),
  21580. _ctx.$slots.default || _ctx.label ? (openBlock(), createElementBlock("span", {
  21581. key: 2,
  21582. class: normalizeClass(unref(ns).be("button", "inner")),
  21583. style: normalizeStyle(unref(isChecked) ? unref(activeStyle) : void 0)
  21584. }, [
  21585. renderSlot(_ctx.$slots, "default", {}, () => [
  21586. createTextVNode(toDisplayString(_ctx.label), 1)
  21587. ])
  21588. ], 6)) : createCommentVNode("v-if", true)
  21589. ], 2);
  21590. };
  21591. }
  21592. });
  21593. var CheckboxButton = /* @__PURE__ */ _export_sfc(_sfc_main$1Y, [["__file", "checkbox-button.vue"]]);
  21594. const checkboxGroupProps = buildProps({
  21595. modelValue: {
  21596. type: definePropType(Array),
  21597. default: () => []
  21598. },
  21599. disabled: Boolean,
  21600. min: Number,
  21601. max: Number,
  21602. size: useSizeProp,
  21603. fill: String,
  21604. textColor: String,
  21605. tag: {
  21606. type: String,
  21607. default: "div"
  21608. },
  21609. validateEvent: {
  21610. type: Boolean,
  21611. default: true
  21612. },
  21613. ...useAriaProps(["ariaLabel"])
  21614. });
  21615. const checkboxGroupEmits = {
  21616. [UPDATE_MODEL_EVENT]: (val) => isArray$1(val),
  21617. change: (val) => isArray$1(val)
  21618. };
  21619. const __default__$1p = defineComponent({
  21620. name: "ElCheckboxGroup"
  21621. });
  21622. const _sfc_main$1X = /* @__PURE__ */ defineComponent({
  21623. ...__default__$1p,
  21624. props: checkboxGroupProps,
  21625. emits: checkboxGroupEmits,
  21626. setup(__props, { emit }) {
  21627. const props = __props;
  21628. const ns = useNamespace("checkbox");
  21629. const { formItem } = useFormItem();
  21630. const { inputId: groupId, isLabeledByFormItem } = useFormItemInputId(props, {
  21631. formItemContext: formItem
  21632. });
  21633. const changeEvent = async (value) => {
  21634. emit(UPDATE_MODEL_EVENT, value);
  21635. await nextTick();
  21636. emit(CHANGE_EVENT, value);
  21637. };
  21638. const modelValue = computed({
  21639. get() {
  21640. return props.modelValue;
  21641. },
  21642. set(val) {
  21643. changeEvent(val);
  21644. }
  21645. });
  21646. provide(checkboxGroupContextKey, {
  21647. ...pick(toRefs(props), [
  21648. "size",
  21649. "min",
  21650. "max",
  21651. "disabled",
  21652. "validateEvent",
  21653. "fill",
  21654. "textColor"
  21655. ]),
  21656. modelValue,
  21657. changeEvent
  21658. });
  21659. watch(() => props.modelValue, () => {
  21660. if (props.validateEvent) {
  21661. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
  21662. }
  21663. });
  21664. return (_ctx, _cache) => {
  21665. var _a;
  21666. return openBlock(), createBlock(resolveDynamicComponent(_ctx.tag), {
  21667. id: unref(groupId),
  21668. class: normalizeClass(unref(ns).b("group")),
  21669. role: "group",
  21670. "aria-label": !unref(isLabeledByFormItem) ? _ctx.ariaLabel || "checkbox-group" : void 0,
  21671. "aria-labelledby": unref(isLabeledByFormItem) ? (_a = unref(formItem)) == null ? void 0 : _a.labelId : void 0
  21672. }, {
  21673. default: withCtx(() => [
  21674. renderSlot(_ctx.$slots, "default")
  21675. ]),
  21676. _: 3
  21677. }, 8, ["id", "class", "aria-label", "aria-labelledby"]);
  21678. };
  21679. }
  21680. });
  21681. var CheckboxGroup = /* @__PURE__ */ _export_sfc(_sfc_main$1X, [["__file", "checkbox-group.vue"]]);
  21682. const ElCheckbox = withInstall(Checkbox, {
  21683. CheckboxButton,
  21684. CheckboxGroup
  21685. });
  21686. const ElCheckboxButton = withNoopInstall(CheckboxButton);
  21687. const ElCheckboxGroup$1 = withNoopInstall(CheckboxGroup);
  21688. const radioPropsBase = buildProps({
  21689. modelValue: {
  21690. type: [String, Number, Boolean],
  21691. default: void 0
  21692. },
  21693. size: useSizeProp,
  21694. disabled: Boolean,
  21695. label: {
  21696. type: [String, Number, Boolean],
  21697. default: void 0
  21698. },
  21699. value: {
  21700. type: [String, Number, Boolean],
  21701. default: void 0
  21702. },
  21703. name: {
  21704. type: String,
  21705. default: void 0
  21706. }
  21707. });
  21708. const radioProps = buildProps({
  21709. ...radioPropsBase,
  21710. border: Boolean
  21711. });
  21712. const radioEmits = {
  21713. [UPDATE_MODEL_EVENT]: (val) => isString$1(val) || isNumber(val) || isBoolean(val),
  21714. [CHANGE_EVENT]: (val) => isString$1(val) || isNumber(val) || isBoolean(val)
  21715. };
  21716. const radioGroupKey = Symbol("radioGroupKey");
  21717. const useRadio = (props, emit) => {
  21718. const radioRef = ref();
  21719. const radioGroup = inject(radioGroupKey, void 0);
  21720. const isGroup = computed(() => !!radioGroup);
  21721. const actualValue = computed(() => {
  21722. if (!isPropAbsent(props.value)) {
  21723. return props.value;
  21724. }
  21725. return props.label;
  21726. });
  21727. const modelValue = computed({
  21728. get() {
  21729. return isGroup.value ? radioGroup.modelValue : props.modelValue;
  21730. },
  21731. set(val) {
  21732. if (isGroup.value) {
  21733. radioGroup.changeEvent(val);
  21734. } else {
  21735. emit && emit(UPDATE_MODEL_EVENT, val);
  21736. }
  21737. radioRef.value.checked = props.modelValue === actualValue.value;
  21738. }
  21739. });
  21740. const size = useFormSize(computed(() => radioGroup == null ? void 0 : radioGroup.size));
  21741. const disabled = useFormDisabled(computed(() => radioGroup == null ? void 0 : radioGroup.disabled));
  21742. const focus = ref(false);
  21743. const tabIndex = computed(() => {
  21744. return disabled.value || isGroup.value && modelValue.value !== actualValue.value ? -1 : 0;
  21745. });
  21746. useDeprecated({
  21747. from: "label act as value",
  21748. replacement: "value",
  21749. version: "3.0.0",
  21750. scope: "el-radio",
  21751. ref: "https://element-plus.org/en-US/component/radio.html"
  21752. }, computed(() => isGroup.value && isPropAbsent(props.value)));
  21753. return {
  21754. radioRef,
  21755. isGroup,
  21756. radioGroup,
  21757. focus,
  21758. size,
  21759. disabled,
  21760. tabIndex,
  21761. modelValue,
  21762. actualValue
  21763. };
  21764. };
  21765. const __default__$1o = defineComponent({
  21766. name: "ElRadio"
  21767. });
  21768. const _sfc_main$1W = /* @__PURE__ */ defineComponent({
  21769. ...__default__$1o,
  21770. props: radioProps,
  21771. emits: radioEmits,
  21772. setup(__props, { emit }) {
  21773. const props = __props;
  21774. const ns = useNamespace("radio");
  21775. const { radioRef, radioGroup, focus, size, disabled, modelValue, actualValue } = useRadio(props, emit);
  21776. function handleChange() {
  21777. nextTick(() => emit(CHANGE_EVENT, modelValue.value));
  21778. }
  21779. return (_ctx, _cache) => {
  21780. var _a;
  21781. return openBlock(), createElementBlock("label", {
  21782. class: normalizeClass([
  21783. unref(ns).b(),
  21784. unref(ns).is("disabled", unref(disabled)),
  21785. unref(ns).is("focus", unref(focus)),
  21786. unref(ns).is("bordered", _ctx.border),
  21787. unref(ns).is("checked", unref(modelValue) === unref(actualValue)),
  21788. unref(ns).m(unref(size))
  21789. ])
  21790. }, [
  21791. createElementVNode("span", {
  21792. class: normalizeClass([
  21793. unref(ns).e("input"),
  21794. unref(ns).is("disabled", unref(disabled)),
  21795. unref(ns).is("checked", unref(modelValue) === unref(actualValue))
  21796. ])
  21797. }, [
  21798. withDirectives(createElementVNode("input", {
  21799. ref_key: "radioRef",
  21800. ref: radioRef,
  21801. "onUpdate:modelValue": ($event) => isRef(modelValue) ? modelValue.value = $event : null,
  21802. class: normalizeClass(unref(ns).e("original")),
  21803. value: unref(actualValue),
  21804. name: _ctx.name || ((_a = unref(radioGroup)) == null ? void 0 : _a.name),
  21805. disabled: unref(disabled),
  21806. checked: unref(modelValue) === unref(actualValue),
  21807. type: "radio",
  21808. onFocus: ($event) => focus.value = true,
  21809. onBlur: ($event) => focus.value = false,
  21810. onChange: handleChange,
  21811. onClick: withModifiers(() => {
  21812. }, ["stop"])
  21813. }, null, 42, ["onUpdate:modelValue", "value", "name", "disabled", "checked", "onFocus", "onBlur", "onClick"]), [
  21814. [vModelRadio, unref(modelValue)]
  21815. ]),
  21816. createElementVNode("span", {
  21817. class: normalizeClass(unref(ns).e("inner"))
  21818. }, null, 2)
  21819. ], 2),
  21820. createElementVNode("span", {
  21821. class: normalizeClass(unref(ns).e("label")),
  21822. onKeydown: withModifiers(() => {
  21823. }, ["stop"])
  21824. }, [
  21825. renderSlot(_ctx.$slots, "default", {}, () => [
  21826. createTextVNode(toDisplayString(_ctx.label), 1)
  21827. ])
  21828. ], 42, ["onKeydown"])
  21829. ], 2);
  21830. };
  21831. }
  21832. });
  21833. var Radio = /* @__PURE__ */ _export_sfc(_sfc_main$1W, [["__file", "radio.vue"]]);
  21834. const radioButtonProps = buildProps({
  21835. ...radioPropsBase
  21836. });
  21837. const __default__$1n = defineComponent({
  21838. name: "ElRadioButton"
  21839. });
  21840. const _sfc_main$1V = /* @__PURE__ */ defineComponent({
  21841. ...__default__$1n,
  21842. props: radioButtonProps,
  21843. setup(__props) {
  21844. const props = __props;
  21845. const ns = useNamespace("radio");
  21846. const { radioRef, focus, size, disabled, modelValue, radioGroup, actualValue } = useRadio(props);
  21847. const activeStyle = computed(() => {
  21848. return {
  21849. backgroundColor: (radioGroup == null ? void 0 : radioGroup.fill) || "",
  21850. borderColor: (radioGroup == null ? void 0 : radioGroup.fill) || "",
  21851. boxShadow: (radioGroup == null ? void 0 : radioGroup.fill) ? `-1px 0 0 0 ${radioGroup.fill}` : "",
  21852. color: (radioGroup == null ? void 0 : radioGroup.textColor) || ""
  21853. };
  21854. });
  21855. return (_ctx, _cache) => {
  21856. var _a;
  21857. return openBlock(), createElementBlock("label", {
  21858. class: normalizeClass([
  21859. unref(ns).b("button"),
  21860. unref(ns).is("active", unref(modelValue) === unref(actualValue)),
  21861. unref(ns).is("disabled", unref(disabled)),
  21862. unref(ns).is("focus", unref(focus)),
  21863. unref(ns).bm("button", unref(size))
  21864. ])
  21865. }, [
  21866. withDirectives(createElementVNode("input", {
  21867. ref_key: "radioRef",
  21868. ref: radioRef,
  21869. "onUpdate:modelValue": ($event) => isRef(modelValue) ? modelValue.value = $event : null,
  21870. class: normalizeClass(unref(ns).be("button", "original-radio")),
  21871. value: unref(actualValue),
  21872. type: "radio",
  21873. name: _ctx.name || ((_a = unref(radioGroup)) == null ? void 0 : _a.name),
  21874. disabled: unref(disabled),
  21875. onFocus: ($event) => focus.value = true,
  21876. onBlur: ($event) => focus.value = false,
  21877. onClick: withModifiers(() => {
  21878. }, ["stop"])
  21879. }, null, 42, ["onUpdate:modelValue", "value", "name", "disabled", "onFocus", "onBlur", "onClick"]), [
  21880. [vModelRadio, unref(modelValue)]
  21881. ]),
  21882. createElementVNode("span", {
  21883. class: normalizeClass(unref(ns).be("button", "inner")),
  21884. style: normalizeStyle(unref(modelValue) === unref(actualValue) ? unref(activeStyle) : {}),
  21885. onKeydown: withModifiers(() => {
  21886. }, ["stop"])
  21887. }, [
  21888. renderSlot(_ctx.$slots, "default", {}, () => [
  21889. createTextVNode(toDisplayString(_ctx.label), 1)
  21890. ])
  21891. ], 46, ["onKeydown"])
  21892. ], 2);
  21893. };
  21894. }
  21895. });
  21896. var RadioButton = /* @__PURE__ */ _export_sfc(_sfc_main$1V, [["__file", "radio-button.vue"]]);
  21897. const radioGroupProps = buildProps({
  21898. id: {
  21899. type: String,
  21900. default: void 0
  21901. },
  21902. size: useSizeProp,
  21903. disabled: Boolean,
  21904. modelValue: {
  21905. type: [String, Number, Boolean],
  21906. default: void 0
  21907. },
  21908. fill: {
  21909. type: String,
  21910. default: ""
  21911. },
  21912. textColor: {
  21913. type: String,
  21914. default: ""
  21915. },
  21916. name: {
  21917. type: String,
  21918. default: void 0
  21919. },
  21920. validateEvent: {
  21921. type: Boolean,
  21922. default: true
  21923. },
  21924. ...useAriaProps(["ariaLabel"])
  21925. });
  21926. const radioGroupEmits = radioEmits;
  21927. const __default__$1m = defineComponent({
  21928. name: "ElRadioGroup"
  21929. });
  21930. const _sfc_main$1U = /* @__PURE__ */ defineComponent({
  21931. ...__default__$1m,
  21932. props: radioGroupProps,
  21933. emits: radioGroupEmits,
  21934. setup(__props, { emit }) {
  21935. const props = __props;
  21936. const ns = useNamespace("radio");
  21937. const radioId = useId();
  21938. const radioGroupRef = ref();
  21939. const { formItem } = useFormItem();
  21940. const { inputId: groupId, isLabeledByFormItem } = useFormItemInputId(props, {
  21941. formItemContext: formItem
  21942. });
  21943. const changeEvent = (value) => {
  21944. emit(UPDATE_MODEL_EVENT, value);
  21945. nextTick(() => emit(CHANGE_EVENT, value));
  21946. };
  21947. onMounted(() => {
  21948. const radios = radioGroupRef.value.querySelectorAll("[type=radio]");
  21949. const firstLabel = radios[0];
  21950. if (!Array.from(radios).some((radio) => radio.checked) && firstLabel) {
  21951. firstLabel.tabIndex = 0;
  21952. }
  21953. });
  21954. const name = computed(() => {
  21955. return props.name || radioId.value;
  21956. });
  21957. provide(radioGroupKey, reactive({
  21958. ...toRefs(props),
  21959. changeEvent,
  21960. name
  21961. }));
  21962. watch(() => props.modelValue, () => {
  21963. if (props.validateEvent) {
  21964. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
  21965. }
  21966. });
  21967. return (_ctx, _cache) => {
  21968. return openBlock(), createElementBlock("div", {
  21969. id: unref(groupId),
  21970. ref_key: "radioGroupRef",
  21971. ref: radioGroupRef,
  21972. class: normalizeClass(unref(ns).b("group")),
  21973. role: "radiogroup",
  21974. "aria-label": !unref(isLabeledByFormItem) ? _ctx.ariaLabel || "radio-group" : void 0,
  21975. "aria-labelledby": unref(isLabeledByFormItem) ? unref(formItem).labelId : void 0
  21976. }, [
  21977. renderSlot(_ctx.$slots, "default")
  21978. ], 10, ["id", "aria-label", "aria-labelledby"]);
  21979. };
  21980. }
  21981. });
  21982. var RadioGroup = /* @__PURE__ */ _export_sfc(_sfc_main$1U, [["__file", "radio-group.vue"]]);
  21983. const ElRadio = withInstall(Radio, {
  21984. RadioButton,
  21985. RadioGroup
  21986. });
  21987. const ElRadioGroup = withNoopInstall(RadioGroup);
  21988. const ElRadioButton = withNoopInstall(RadioButton);
  21989. var NodeContent$1 = defineComponent({
  21990. name: "NodeContent",
  21991. setup() {
  21992. const ns = useNamespace("cascader-node");
  21993. return {
  21994. ns
  21995. };
  21996. },
  21997. render() {
  21998. const { ns } = this;
  21999. const { node, panel } = this.$parent;
  22000. const { data, label } = node;
  22001. const { renderLabelFn } = panel;
  22002. return h$1("span", { class: ns.e("label") }, renderLabelFn ? renderLabelFn({ node, data }) : label);
  22003. }
  22004. });
  22005. const CASCADER_PANEL_INJECTION_KEY = Symbol();
  22006. const _sfc_main$1T = defineComponent({
  22007. name: "ElCascaderNode",
  22008. components: {
  22009. ElCheckbox,
  22010. ElRadio,
  22011. NodeContent: NodeContent$1,
  22012. ElIcon,
  22013. Check: check_default,
  22014. Loading: loading_default,
  22015. ArrowRight: arrow_right_default
  22016. },
  22017. props: {
  22018. node: {
  22019. type: Object,
  22020. required: true
  22021. },
  22022. menuId: String
  22023. },
  22024. emits: ["expand"],
  22025. setup(props, { emit }) {
  22026. const panel = inject(CASCADER_PANEL_INJECTION_KEY);
  22027. const ns = useNamespace("cascader-node");
  22028. const isHoverMenu = computed(() => panel.isHoverMenu);
  22029. const multiple = computed(() => panel.config.multiple);
  22030. const checkStrictly = computed(() => panel.config.checkStrictly);
  22031. const checkedNodeId = computed(() => {
  22032. var _a;
  22033. return (_a = panel.checkedNodes[0]) == null ? void 0 : _a.uid;
  22034. });
  22035. const isDisabled = computed(() => props.node.isDisabled);
  22036. const isLeaf = computed(() => props.node.isLeaf);
  22037. const expandable = computed(() => checkStrictly.value && !isLeaf.value || !isDisabled.value);
  22038. const inExpandingPath = computed(() => isInPath(panel.expandingNode));
  22039. const inCheckedPath = computed(() => checkStrictly.value && panel.checkedNodes.some(isInPath));
  22040. const isInPath = (node) => {
  22041. var _a;
  22042. const { level, uid } = props.node;
  22043. return ((_a = node == null ? void 0 : node.pathNodes[level - 1]) == null ? void 0 : _a.uid) === uid;
  22044. };
  22045. const doExpand = () => {
  22046. if (inExpandingPath.value)
  22047. return;
  22048. panel.expandNode(props.node);
  22049. };
  22050. const doCheck = (checked) => {
  22051. const { node } = props;
  22052. if (checked === node.checked)
  22053. return;
  22054. panel.handleCheckChange(node, checked);
  22055. };
  22056. const doLoad = () => {
  22057. panel.lazyLoad(props.node, () => {
  22058. if (!isLeaf.value)
  22059. doExpand();
  22060. });
  22061. };
  22062. const handleHoverExpand = (e) => {
  22063. if (!isHoverMenu.value)
  22064. return;
  22065. handleExpand();
  22066. !isLeaf.value && emit("expand", e);
  22067. };
  22068. const handleExpand = () => {
  22069. const { node } = props;
  22070. if (!expandable.value || node.loading)
  22071. return;
  22072. node.loaded ? doExpand() : doLoad();
  22073. };
  22074. const handleClick = () => {
  22075. if (isHoverMenu.value && !isLeaf.value)
  22076. return;
  22077. if (isLeaf.value && !isDisabled.value && !checkStrictly.value && !multiple.value) {
  22078. handleCheck(true);
  22079. } else {
  22080. handleExpand();
  22081. }
  22082. };
  22083. const handleSelectCheck = (checked) => {
  22084. if (checkStrictly.value) {
  22085. doCheck(checked);
  22086. if (props.node.loaded) {
  22087. doExpand();
  22088. }
  22089. } else {
  22090. handleCheck(checked);
  22091. }
  22092. };
  22093. const handleCheck = (checked) => {
  22094. if (!props.node.loaded) {
  22095. doLoad();
  22096. } else {
  22097. doCheck(checked);
  22098. !checkStrictly.value && doExpand();
  22099. }
  22100. };
  22101. return {
  22102. panel,
  22103. isHoverMenu,
  22104. multiple,
  22105. checkStrictly,
  22106. checkedNodeId,
  22107. isDisabled,
  22108. isLeaf,
  22109. expandable,
  22110. inExpandingPath,
  22111. inCheckedPath,
  22112. ns,
  22113. handleHoverExpand,
  22114. handleExpand,
  22115. handleClick,
  22116. handleCheck,
  22117. handleSelectCheck
  22118. };
  22119. }
  22120. });
  22121. function _sfc_render$q(_ctx, _cache, $props, $setup, $data, $options) {
  22122. const _component_el_checkbox = resolveComponent("el-checkbox");
  22123. const _component_el_radio = resolveComponent("el-radio");
  22124. const _component_check = resolveComponent("check");
  22125. const _component_el_icon = resolveComponent("el-icon");
  22126. const _component_node_content = resolveComponent("node-content");
  22127. const _component_loading = resolveComponent("loading");
  22128. const _component_arrow_right = resolveComponent("arrow-right");
  22129. return openBlock(), createElementBlock("li", {
  22130. id: `${_ctx.menuId}-${_ctx.node.uid}`,
  22131. role: "menuitem",
  22132. "aria-haspopup": !_ctx.isLeaf,
  22133. "aria-owns": _ctx.isLeaf ? void 0 : _ctx.menuId,
  22134. "aria-expanded": _ctx.inExpandingPath,
  22135. tabindex: _ctx.expandable ? -1 : void 0,
  22136. class: normalizeClass([
  22137. _ctx.ns.b(),
  22138. _ctx.ns.is("selectable", _ctx.checkStrictly),
  22139. _ctx.ns.is("active", _ctx.node.checked),
  22140. _ctx.ns.is("disabled", !_ctx.expandable),
  22141. _ctx.inExpandingPath && "in-active-path",
  22142. _ctx.inCheckedPath && "in-checked-path"
  22143. ]),
  22144. onMouseenter: _ctx.handleHoverExpand,
  22145. onFocus: _ctx.handleHoverExpand,
  22146. onClick: _ctx.handleClick
  22147. }, [
  22148. createCommentVNode(" prefix "),
  22149. _ctx.multiple ? (openBlock(), createBlock(_component_el_checkbox, {
  22150. key: 0,
  22151. "model-value": _ctx.node.checked,
  22152. indeterminate: _ctx.node.indeterminate,
  22153. disabled: _ctx.isDisabled,
  22154. onClick: withModifiers(() => {
  22155. }, ["stop"]),
  22156. "onUpdate:modelValue": _ctx.handleSelectCheck
  22157. }, null, 8, ["model-value", "indeterminate", "disabled", "onClick", "onUpdate:modelValue"])) : _ctx.checkStrictly ? (openBlock(), createBlock(_component_el_radio, {
  22158. key: 1,
  22159. "model-value": _ctx.checkedNodeId,
  22160. label: _ctx.node.uid,
  22161. disabled: _ctx.isDisabled,
  22162. "onUpdate:modelValue": _ctx.handleSelectCheck,
  22163. onClick: withModifiers(() => {
  22164. }, ["stop"])
  22165. }, {
  22166. default: withCtx(() => [
  22167. 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 "),
  22168. createElementVNode("span")
  22169. ]),
  22170. _: 1
  22171. }, 8, ["model-value", "label", "disabled", "onUpdate:modelValue", "onClick"])) : _ctx.isLeaf && _ctx.node.checked ? (openBlock(), createBlock(_component_el_icon, {
  22172. key: 2,
  22173. class: normalizeClass(_ctx.ns.e("prefix"))
  22174. }, {
  22175. default: withCtx(() => [
  22176. createVNode(_component_check)
  22177. ]),
  22178. _: 1
  22179. }, 8, ["class"])) : createCommentVNode("v-if", true),
  22180. createCommentVNode(" content "),
  22181. createVNode(_component_node_content),
  22182. createCommentVNode(" postfix "),
  22183. !_ctx.isLeaf ? (openBlock(), createElementBlock(Fragment, { key: 3 }, [
  22184. _ctx.node.loading ? (openBlock(), createBlock(_component_el_icon, {
  22185. key: 0,
  22186. class: normalizeClass([_ctx.ns.is("loading"), _ctx.ns.e("postfix")])
  22187. }, {
  22188. default: withCtx(() => [
  22189. createVNode(_component_loading)
  22190. ]),
  22191. _: 1
  22192. }, 8, ["class"])) : (openBlock(), createBlock(_component_el_icon, {
  22193. key: 1,
  22194. class: normalizeClass(["arrow-right", _ctx.ns.e("postfix")])
  22195. }, {
  22196. default: withCtx(() => [
  22197. createVNode(_component_arrow_right)
  22198. ]),
  22199. _: 1
  22200. }, 8, ["class"]))
  22201. ], 64)) : createCommentVNode("v-if", true)
  22202. ], 42, ["id", "aria-haspopup", "aria-owns", "aria-expanded", "tabindex", "onMouseenter", "onFocus", "onClick"]);
  22203. }
  22204. var ElCascaderNode = /* @__PURE__ */ _export_sfc(_sfc_main$1T, [["render", _sfc_render$q], ["__file", "node.vue"]]);
  22205. const _sfc_main$1S = defineComponent({
  22206. name: "ElCascaderMenu",
  22207. components: {
  22208. Loading: loading_default,
  22209. ElIcon,
  22210. ElScrollbar,
  22211. ElCascaderNode
  22212. },
  22213. props: {
  22214. nodes: {
  22215. type: Array,
  22216. required: true
  22217. },
  22218. index: {
  22219. type: Number,
  22220. required: true
  22221. }
  22222. },
  22223. setup(props) {
  22224. const instance = getCurrentInstance();
  22225. const ns = useNamespace("cascader-menu");
  22226. const { t } = useLocale();
  22227. const id = useId();
  22228. let activeNode = null;
  22229. let hoverTimer = null;
  22230. const panel = inject(CASCADER_PANEL_INJECTION_KEY);
  22231. const hoverZone = ref(null);
  22232. const isEmpty = computed(() => !props.nodes.length);
  22233. const isLoading = computed(() => !panel.initialLoaded);
  22234. const menuId = computed(() => `${id.value}-${props.index}`);
  22235. const handleExpand = (e) => {
  22236. activeNode = e.target;
  22237. };
  22238. const handleMouseMove = (e) => {
  22239. if (!panel.isHoverMenu || !activeNode || !hoverZone.value)
  22240. return;
  22241. if (activeNode.contains(e.target)) {
  22242. clearHoverTimer();
  22243. const el = instance.vnode.el;
  22244. const { left } = el.getBoundingClientRect();
  22245. const { offsetWidth, offsetHeight } = el;
  22246. const startX = e.clientX - left;
  22247. const top = activeNode.offsetTop;
  22248. const bottom = top + activeNode.offsetHeight;
  22249. hoverZone.value.innerHTML = `
  22250. <path style="pointer-events: auto;" fill="transparent" d="M${startX} ${top} L${offsetWidth} 0 V${top} Z" />
  22251. <path style="pointer-events: auto;" fill="transparent" d="M${startX} ${bottom} L${offsetWidth} ${offsetHeight} V${bottom} Z" />
  22252. `;
  22253. } else if (!hoverTimer) {
  22254. hoverTimer = window.setTimeout(clearHoverZone, panel.config.hoverThreshold);
  22255. }
  22256. };
  22257. const clearHoverTimer = () => {
  22258. if (!hoverTimer)
  22259. return;
  22260. clearTimeout(hoverTimer);
  22261. hoverTimer = null;
  22262. };
  22263. const clearHoverZone = () => {
  22264. if (!hoverZone.value)
  22265. return;
  22266. hoverZone.value.innerHTML = "";
  22267. clearHoverTimer();
  22268. };
  22269. return {
  22270. ns,
  22271. panel,
  22272. hoverZone,
  22273. isEmpty,
  22274. isLoading,
  22275. menuId,
  22276. t,
  22277. handleExpand,
  22278. handleMouseMove,
  22279. clearHoverZone
  22280. };
  22281. }
  22282. });
  22283. function _sfc_render$p(_ctx, _cache, $props, $setup, $data, $options) {
  22284. const _component_el_cascader_node = resolveComponent("el-cascader-node");
  22285. const _component_loading = resolveComponent("loading");
  22286. const _component_el_icon = resolveComponent("el-icon");
  22287. const _component_el_scrollbar = resolveComponent("el-scrollbar");
  22288. return openBlock(), createBlock(_component_el_scrollbar, {
  22289. key: _ctx.menuId,
  22290. tag: "ul",
  22291. role: "menu",
  22292. class: normalizeClass(_ctx.ns.b()),
  22293. "wrap-class": _ctx.ns.e("wrap"),
  22294. "view-class": [_ctx.ns.e("list"), _ctx.ns.is("empty", _ctx.isEmpty)],
  22295. onMousemove: _ctx.handleMouseMove,
  22296. onMouseleave: _ctx.clearHoverZone
  22297. }, {
  22298. default: withCtx(() => {
  22299. var _a;
  22300. return [
  22301. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.nodes, (node) => {
  22302. return openBlock(), createBlock(_component_el_cascader_node, {
  22303. key: node.uid,
  22304. node,
  22305. "menu-id": _ctx.menuId,
  22306. onExpand: _ctx.handleExpand
  22307. }, null, 8, ["node", "menu-id", "onExpand"]);
  22308. }), 128)),
  22309. _ctx.isLoading ? (openBlock(), createElementBlock("div", {
  22310. key: 0,
  22311. class: normalizeClass(_ctx.ns.e("empty-text"))
  22312. }, [
  22313. createVNode(_component_el_icon, {
  22314. size: "14",
  22315. class: normalizeClass(_ctx.ns.is("loading"))
  22316. }, {
  22317. default: withCtx(() => [
  22318. createVNode(_component_loading)
  22319. ]),
  22320. _: 1
  22321. }, 8, ["class"]),
  22322. createTextVNode(" " + toDisplayString(_ctx.t("el.cascader.loading")), 1)
  22323. ], 2)) : _ctx.isEmpty ? (openBlock(), createElementBlock("div", {
  22324. key: 1,
  22325. class: normalizeClass(_ctx.ns.e("empty-text"))
  22326. }, [
  22327. renderSlot(_ctx.$slots, "empty", {}, () => [
  22328. createTextVNode(toDisplayString(_ctx.t("el.cascader.noData")), 1)
  22329. ])
  22330. ], 2)) : ((_a = _ctx.panel) == null ? void 0 : _a.isHoverMenu) ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
  22331. createCommentVNode(" eslint-disable-next-line vue/html-self-closing "),
  22332. (openBlock(), createElementBlock("svg", {
  22333. ref: "hoverZone",
  22334. class: normalizeClass(_ctx.ns.e("hover-zone"))
  22335. }, null, 2))
  22336. ], 2112)) : createCommentVNode("v-if", true)
  22337. ];
  22338. }),
  22339. _: 3
  22340. }, 8, ["class", "wrap-class", "view-class", "onMousemove", "onMouseleave"]);
  22341. }
  22342. var ElCascaderMenu = /* @__PURE__ */ _export_sfc(_sfc_main$1S, [["render", _sfc_render$p], ["__file", "menu.vue"]]);
  22343. let uid = 0;
  22344. const calculatePathNodes = (node) => {
  22345. const nodes = [node];
  22346. let { parent } = node;
  22347. while (parent) {
  22348. nodes.unshift(parent);
  22349. parent = parent.parent;
  22350. }
  22351. return nodes;
  22352. };
  22353. class Node$2 {
  22354. constructor(data, config, parent, root = false) {
  22355. this.data = data;
  22356. this.config = config;
  22357. this.parent = parent;
  22358. this.root = root;
  22359. this.uid = uid++;
  22360. this.checked = false;
  22361. this.indeterminate = false;
  22362. this.loading = false;
  22363. const { value: valueKey, label: labelKey, children: childrenKey } = config;
  22364. const childrenData = data[childrenKey];
  22365. const pathNodes = calculatePathNodes(this);
  22366. this.level = root ? 0 : parent ? parent.level + 1 : 1;
  22367. this.value = data[valueKey];
  22368. this.label = data[labelKey];
  22369. this.pathNodes = pathNodes;
  22370. this.pathValues = pathNodes.map((node) => node.value);
  22371. this.pathLabels = pathNodes.map((node) => node.label);
  22372. this.childrenData = childrenData;
  22373. this.children = (childrenData || []).map((child) => new Node$2(child, config, this));
  22374. this.loaded = !config.lazy || this.isLeaf || !isEmpty(childrenData);
  22375. }
  22376. get isDisabled() {
  22377. const { data, parent, config } = this;
  22378. const { disabled, checkStrictly } = config;
  22379. const isDisabled = isFunction$1(disabled) ? disabled(data, this) : !!data[disabled];
  22380. return isDisabled || !checkStrictly && (parent == null ? void 0 : parent.isDisabled);
  22381. }
  22382. get isLeaf() {
  22383. const { data, config, childrenData, loaded } = this;
  22384. const { lazy, leaf } = config;
  22385. const isLeaf = isFunction$1(leaf) ? leaf(data, this) : data[leaf];
  22386. return isUndefined(isLeaf) ? lazy && !loaded ? false : !(isArray$1(childrenData) && childrenData.length) : !!isLeaf;
  22387. }
  22388. get valueByOption() {
  22389. return this.config.emitPath ? this.pathValues : this.value;
  22390. }
  22391. appendChild(childData) {
  22392. const { childrenData, children } = this;
  22393. const node = new Node$2(childData, this.config, this);
  22394. if (isArray$1(childrenData)) {
  22395. childrenData.push(childData);
  22396. } else {
  22397. this.childrenData = [childData];
  22398. }
  22399. children.push(node);
  22400. return node;
  22401. }
  22402. calcText(allLevels, separator) {
  22403. const text = allLevels ? this.pathLabels.join(separator) : this.label;
  22404. this.text = text;
  22405. return text;
  22406. }
  22407. broadcast(event, ...args) {
  22408. const handlerName = `onParent${capitalize(event)}`;
  22409. this.children.forEach((child) => {
  22410. if (child) {
  22411. child.broadcast(event, ...args);
  22412. child[handlerName] && child[handlerName](...args);
  22413. }
  22414. });
  22415. }
  22416. emit(event, ...args) {
  22417. const { parent } = this;
  22418. const handlerName = `onChild${capitalize(event)}`;
  22419. if (parent) {
  22420. parent[handlerName] && parent[handlerName](...args);
  22421. parent.emit(event, ...args);
  22422. }
  22423. }
  22424. onParentCheck(checked) {
  22425. if (!this.isDisabled) {
  22426. this.setCheckState(checked);
  22427. }
  22428. }
  22429. onChildCheck() {
  22430. const { children } = this;
  22431. const validChildren = children.filter((child) => !child.isDisabled);
  22432. const checked = validChildren.length ? validChildren.every((child) => child.checked) : false;
  22433. this.setCheckState(checked);
  22434. }
  22435. setCheckState(checked) {
  22436. const totalNum = this.children.length;
  22437. const checkedNum = this.children.reduce((c, p) => {
  22438. const num = p.checked ? 1 : p.indeterminate ? 0.5 : 0;
  22439. return c + num;
  22440. }, 0);
  22441. this.checked = this.loaded && this.children.filter((child) => !child.isDisabled).every((child) => child.loaded && child.checked) && checked;
  22442. this.indeterminate = this.loaded && checkedNum !== totalNum && checkedNum > 0;
  22443. }
  22444. doCheck(checked) {
  22445. if (this.checked === checked)
  22446. return;
  22447. const { checkStrictly, multiple } = this.config;
  22448. if (checkStrictly || !multiple) {
  22449. this.checked = checked;
  22450. } else {
  22451. this.broadcast("check", checked);
  22452. this.setCheckState(checked);
  22453. this.emit("check");
  22454. }
  22455. }
  22456. }
  22457. var Node$3 = Node$2;
  22458. const flatNodes = (nodes, leafOnly) => {
  22459. return nodes.reduce((res, node) => {
  22460. if (node.isLeaf) {
  22461. res.push(node);
  22462. } else {
  22463. !leafOnly && res.push(node);
  22464. res = res.concat(flatNodes(node.children, leafOnly));
  22465. }
  22466. return res;
  22467. }, []);
  22468. };
  22469. class Store {
  22470. constructor(data, config) {
  22471. this.config = config;
  22472. const nodes = (data || []).map((nodeData) => new Node$3(nodeData, this.config));
  22473. this.nodes = nodes;
  22474. this.allNodes = flatNodes(nodes, false);
  22475. this.leafNodes = flatNodes(nodes, true);
  22476. }
  22477. getNodes() {
  22478. return this.nodes;
  22479. }
  22480. getFlattedNodes(leafOnly) {
  22481. return leafOnly ? this.leafNodes : this.allNodes;
  22482. }
  22483. appendNode(nodeData, parentNode) {
  22484. const node = parentNode ? parentNode.appendChild(nodeData) : new Node$3(nodeData, this.config);
  22485. if (!parentNode)
  22486. this.nodes.push(node);
  22487. this.appendAllNodesAndLeafNodes(node);
  22488. }
  22489. appendNodes(nodeDataList, parentNode) {
  22490. nodeDataList.forEach((nodeData) => this.appendNode(nodeData, parentNode));
  22491. }
  22492. appendAllNodesAndLeafNodes(node) {
  22493. this.allNodes.push(node);
  22494. node.isLeaf && this.leafNodes.push(node);
  22495. if (node.children) {
  22496. node.children.forEach((subNode) => {
  22497. this.appendAllNodesAndLeafNodes(subNode);
  22498. });
  22499. }
  22500. }
  22501. getNodeByValue(value, leafOnly = false) {
  22502. if (!value && value !== 0)
  22503. return null;
  22504. const node = this.getFlattedNodes(leafOnly).find((node2) => isEqual$1(node2.value, value) || isEqual$1(node2.pathValues, value));
  22505. return node || null;
  22506. }
  22507. getSameNode(node) {
  22508. if (!node)
  22509. return null;
  22510. const node_ = this.getFlattedNodes(false).find(({ value, level }) => isEqual$1(node.value, value) && node.level === level);
  22511. return node_ || null;
  22512. }
  22513. }
  22514. const CommonProps = buildProps({
  22515. modelValue: {
  22516. type: definePropType([Number, String, Array])
  22517. },
  22518. options: {
  22519. type: definePropType(Array),
  22520. default: () => []
  22521. },
  22522. props: {
  22523. type: definePropType(Object),
  22524. default: () => ({})
  22525. }
  22526. });
  22527. const DefaultProps = {
  22528. expandTrigger: "click",
  22529. multiple: false,
  22530. checkStrictly: false,
  22531. emitPath: true,
  22532. lazy: false,
  22533. lazyLoad: NOOP,
  22534. value: "value",
  22535. label: "label",
  22536. children: "children",
  22537. leaf: "leaf",
  22538. disabled: "disabled",
  22539. hoverThreshold: 500
  22540. };
  22541. const useCascaderConfig = (props) => {
  22542. return computed(() => ({
  22543. ...DefaultProps,
  22544. ...props.props
  22545. }));
  22546. };
  22547. const getMenuIndex = (el) => {
  22548. if (!el)
  22549. return 0;
  22550. const pieces = el.id.split("-");
  22551. return Number(pieces[pieces.length - 2]);
  22552. };
  22553. const checkNode = (el) => {
  22554. if (!el)
  22555. return;
  22556. const input = el.querySelector("input");
  22557. if (input) {
  22558. input.click();
  22559. } else if (isLeaf(el)) {
  22560. el.click();
  22561. }
  22562. };
  22563. const sortByOriginalOrder = (oldNodes, newNodes) => {
  22564. const newNodesCopy = newNodes.slice(0);
  22565. const newIds = newNodesCopy.map((node) => node.uid);
  22566. const res = oldNodes.reduce((acc, item) => {
  22567. const index = newIds.indexOf(item.uid);
  22568. if (index > -1) {
  22569. acc.push(item);
  22570. newNodesCopy.splice(index, 1);
  22571. newIds.splice(index, 1);
  22572. }
  22573. return acc;
  22574. }, []);
  22575. res.push(...newNodesCopy);
  22576. return res;
  22577. };
  22578. const _sfc_main$1R = defineComponent({
  22579. name: "ElCascaderPanel",
  22580. components: {
  22581. ElCascaderMenu
  22582. },
  22583. props: {
  22584. ...CommonProps,
  22585. border: {
  22586. type: Boolean,
  22587. default: true
  22588. },
  22589. renderLabel: Function
  22590. },
  22591. emits: [UPDATE_MODEL_EVENT, CHANGE_EVENT, "close", "expand-change"],
  22592. setup(props, { emit, slots }) {
  22593. let manualChecked = false;
  22594. const ns = useNamespace("cascader");
  22595. const config = useCascaderConfig(props);
  22596. let store = null;
  22597. const initialLoaded = ref(true);
  22598. const menuList = ref([]);
  22599. const checkedValue = ref(null);
  22600. const menus = ref([]);
  22601. const expandingNode = ref(null);
  22602. const checkedNodes = ref([]);
  22603. const isHoverMenu = computed(() => config.value.expandTrigger === "hover");
  22604. const renderLabelFn = computed(() => props.renderLabel || slots.default);
  22605. const initStore = () => {
  22606. const { options } = props;
  22607. const cfg = config.value;
  22608. manualChecked = false;
  22609. store = new Store(options, cfg);
  22610. menus.value = [store.getNodes()];
  22611. if (cfg.lazy && isEmpty(props.options)) {
  22612. initialLoaded.value = false;
  22613. lazyLoad(void 0, (list) => {
  22614. if (list) {
  22615. store = new Store(list, cfg);
  22616. menus.value = [store.getNodes()];
  22617. }
  22618. initialLoaded.value = true;
  22619. syncCheckedValue(false, true);
  22620. });
  22621. } else {
  22622. syncCheckedValue(false, true);
  22623. }
  22624. };
  22625. const lazyLoad = (node, cb) => {
  22626. const cfg = config.value;
  22627. node = node || new Node$3({}, cfg, void 0, true);
  22628. node.loading = true;
  22629. const resolve = (dataList) => {
  22630. const _node = node;
  22631. const parent = _node.root ? null : _node;
  22632. dataList && (store == null ? void 0 : store.appendNodes(dataList, parent));
  22633. _node.loading = false;
  22634. _node.loaded = true;
  22635. _node.childrenData = _node.childrenData || [];
  22636. cb && cb(dataList);
  22637. };
  22638. cfg.lazyLoad(node, resolve);
  22639. };
  22640. const expandNode = (node, silent) => {
  22641. var _a;
  22642. const { level } = node;
  22643. const newMenus = menus.value.slice(0, level);
  22644. let newExpandingNode;
  22645. if (node.isLeaf) {
  22646. newExpandingNode = node.pathNodes[level - 2];
  22647. } else {
  22648. newExpandingNode = node;
  22649. newMenus.push(node.children);
  22650. }
  22651. if (((_a = expandingNode.value) == null ? void 0 : _a.uid) !== (newExpandingNode == null ? void 0 : newExpandingNode.uid)) {
  22652. expandingNode.value = node;
  22653. menus.value = newMenus;
  22654. !silent && emit("expand-change", (node == null ? void 0 : node.pathValues) || []);
  22655. }
  22656. };
  22657. const handleCheckChange = (node, checked, emitClose = true) => {
  22658. const { checkStrictly, multiple } = config.value;
  22659. const oldNode = checkedNodes.value[0];
  22660. manualChecked = true;
  22661. !multiple && (oldNode == null ? void 0 : oldNode.doCheck(false));
  22662. node.doCheck(checked);
  22663. calculateCheckedValue();
  22664. emitClose && !multiple && !checkStrictly && emit("close");
  22665. !emitClose && !multiple && !checkStrictly && expandParentNode(node);
  22666. };
  22667. const expandParentNode = (node) => {
  22668. if (!node)
  22669. return;
  22670. node = node.parent;
  22671. expandParentNode(node);
  22672. node && expandNode(node);
  22673. };
  22674. const getFlattedNodes = (leafOnly) => {
  22675. return store == null ? void 0 : store.getFlattedNodes(leafOnly);
  22676. };
  22677. const getCheckedNodes = (leafOnly) => {
  22678. var _a;
  22679. return (_a = getFlattedNodes(leafOnly)) == null ? void 0 : _a.filter((node) => node.checked !== false);
  22680. };
  22681. const clearCheckedNodes = () => {
  22682. checkedNodes.value.forEach((node) => node.doCheck(false));
  22683. calculateCheckedValue();
  22684. menus.value = menus.value.slice(0, 1);
  22685. expandingNode.value = null;
  22686. emit("expand-change", []);
  22687. };
  22688. const calculateCheckedValue = () => {
  22689. var _a;
  22690. const { checkStrictly, multiple } = config.value;
  22691. const oldNodes = checkedNodes.value;
  22692. const newNodes = getCheckedNodes(!checkStrictly);
  22693. const nodes = sortByOriginalOrder(oldNodes, newNodes);
  22694. const values = nodes.map((node) => node.valueByOption);
  22695. checkedNodes.value = nodes;
  22696. checkedValue.value = multiple ? values : (_a = values[0]) != null ? _a : null;
  22697. };
  22698. const syncCheckedValue = (loaded = false, forced = false) => {
  22699. const { modelValue } = props;
  22700. const { lazy, multiple, checkStrictly } = config.value;
  22701. const leafOnly = !checkStrictly;
  22702. if (!initialLoaded.value || manualChecked || !forced && isEqual$1(modelValue, checkedValue.value))
  22703. return;
  22704. if (lazy && !loaded) {
  22705. const values = unique(flattenDeep(castArray(modelValue)));
  22706. const nodes = values.map((val) => store == null ? void 0 : store.getNodeByValue(val)).filter((node) => !!node && !node.loaded && !node.loading);
  22707. if (nodes.length) {
  22708. nodes.forEach((node) => {
  22709. lazyLoad(node, () => syncCheckedValue(false, forced));
  22710. });
  22711. } else {
  22712. syncCheckedValue(true, forced);
  22713. }
  22714. } else {
  22715. const values = multiple ? castArray(modelValue) : [modelValue];
  22716. const nodes = unique(values.map((val) => store == null ? void 0 : store.getNodeByValue(val, leafOnly)));
  22717. syncMenuState(nodes, forced);
  22718. checkedValue.value = cloneDeep(modelValue);
  22719. }
  22720. };
  22721. const syncMenuState = (newCheckedNodes, reserveExpandingState = true) => {
  22722. const { checkStrictly } = config.value;
  22723. const oldNodes = checkedNodes.value;
  22724. const newNodes = newCheckedNodes.filter((node) => !!node && (checkStrictly || node.isLeaf));
  22725. const oldExpandingNode = store == null ? void 0 : store.getSameNode(expandingNode.value);
  22726. const newExpandingNode = reserveExpandingState && oldExpandingNode || newNodes[0];
  22727. if (newExpandingNode) {
  22728. newExpandingNode.pathNodes.forEach((node) => expandNode(node, true));
  22729. } else {
  22730. expandingNode.value = null;
  22731. }
  22732. oldNodes.forEach((node) => node.doCheck(false));
  22733. reactive(newNodes).forEach((node) => node.doCheck(true));
  22734. checkedNodes.value = newNodes;
  22735. nextTick(scrollToExpandingNode);
  22736. };
  22737. const scrollToExpandingNode = () => {
  22738. if (!isClient)
  22739. return;
  22740. menuList.value.forEach((menu) => {
  22741. const menuElement = menu == null ? void 0 : menu.$el;
  22742. if (menuElement) {
  22743. const container = menuElement.querySelector(`.${ns.namespace.value}-scrollbar__wrap`);
  22744. const activeNode = menuElement.querySelector(`.${ns.b("node")}.${ns.is("active")}`) || menuElement.querySelector(`.${ns.b("node")}.in-active-path`);
  22745. scrollIntoView(container, activeNode);
  22746. }
  22747. });
  22748. };
  22749. const handleKeyDown = (e) => {
  22750. const target = e.target;
  22751. const { code } = e;
  22752. switch (code) {
  22753. case EVENT_CODE.up:
  22754. case EVENT_CODE.down: {
  22755. e.preventDefault();
  22756. const distance = code === EVENT_CODE.up ? -1 : 1;
  22757. focusNode(getSibling(target, distance, `.${ns.b("node")}[tabindex="-1"]`));
  22758. break;
  22759. }
  22760. case EVENT_CODE.left: {
  22761. e.preventDefault();
  22762. const preMenu = menuList.value[getMenuIndex(target) - 1];
  22763. const expandedNode = preMenu == null ? void 0 : preMenu.$el.querySelector(`.${ns.b("node")}[aria-expanded="true"]`);
  22764. focusNode(expandedNode);
  22765. break;
  22766. }
  22767. case EVENT_CODE.right: {
  22768. e.preventDefault();
  22769. const nextMenu = menuList.value[getMenuIndex(target) + 1];
  22770. const firstNode = nextMenu == null ? void 0 : nextMenu.$el.querySelector(`.${ns.b("node")}[tabindex="-1"]`);
  22771. focusNode(firstNode);
  22772. break;
  22773. }
  22774. case EVENT_CODE.enter:
  22775. case EVENT_CODE.numpadEnter:
  22776. checkNode(target);
  22777. break;
  22778. }
  22779. };
  22780. provide(CASCADER_PANEL_INJECTION_KEY, reactive({
  22781. config,
  22782. expandingNode,
  22783. checkedNodes,
  22784. isHoverMenu,
  22785. initialLoaded,
  22786. renderLabelFn,
  22787. lazyLoad,
  22788. expandNode,
  22789. handleCheckChange
  22790. }));
  22791. watch([config, () => props.options], initStore, {
  22792. deep: true,
  22793. immediate: true
  22794. });
  22795. watch(() => props.modelValue, () => {
  22796. manualChecked = false;
  22797. syncCheckedValue();
  22798. }, {
  22799. deep: true
  22800. });
  22801. watch(() => checkedValue.value, (val) => {
  22802. if (!isEqual$1(val, props.modelValue)) {
  22803. emit(UPDATE_MODEL_EVENT, val);
  22804. emit(CHANGE_EVENT, val);
  22805. }
  22806. });
  22807. onBeforeUpdate(() => menuList.value = []);
  22808. onMounted(() => !isEmpty(props.modelValue) && syncCheckedValue());
  22809. return {
  22810. ns,
  22811. menuList,
  22812. menus,
  22813. checkedNodes,
  22814. handleKeyDown,
  22815. handleCheckChange,
  22816. getFlattedNodes,
  22817. getCheckedNodes,
  22818. clearCheckedNodes,
  22819. calculateCheckedValue,
  22820. scrollToExpandingNode
  22821. };
  22822. }
  22823. });
  22824. function _sfc_render$o(_ctx, _cache, $props, $setup, $data, $options) {
  22825. const _component_el_cascader_menu = resolveComponent("el-cascader-menu");
  22826. return openBlock(), createElementBlock("div", {
  22827. class: normalizeClass([_ctx.ns.b("panel"), _ctx.ns.is("bordered", _ctx.border)]),
  22828. onKeydown: _ctx.handleKeyDown
  22829. }, [
  22830. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.menus, (menu, index) => {
  22831. return openBlock(), createBlock(_component_el_cascader_menu, {
  22832. key: index,
  22833. ref_for: true,
  22834. ref: (item) => _ctx.menuList[index] = item,
  22835. index,
  22836. nodes: [...menu]
  22837. }, {
  22838. empty: withCtx(() => [
  22839. renderSlot(_ctx.$slots, "empty")
  22840. ]),
  22841. _: 2
  22842. }, 1032, ["index", "nodes"]);
  22843. }), 128))
  22844. ], 42, ["onKeydown"]);
  22845. }
  22846. var CascaderPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1R, [["render", _sfc_render$o], ["__file", "index.vue"]]);
  22847. const ElCascaderPanel = withInstall(CascaderPanel);
  22848. const tagProps = buildProps({
  22849. type: {
  22850. type: String,
  22851. values: ["primary", "success", "info", "warning", "danger"],
  22852. default: "primary"
  22853. },
  22854. closable: Boolean,
  22855. disableTransitions: Boolean,
  22856. hit: Boolean,
  22857. color: String,
  22858. size: {
  22859. type: String,
  22860. values: componentSizes
  22861. },
  22862. effect: {
  22863. type: String,
  22864. values: ["dark", "light", "plain"],
  22865. default: "light"
  22866. },
  22867. round: Boolean
  22868. });
  22869. const tagEmits = {
  22870. close: (evt) => evt instanceof MouseEvent,
  22871. click: (evt) => evt instanceof MouseEvent
  22872. };
  22873. const __default__$1l = defineComponent({
  22874. name: "ElTag"
  22875. });
  22876. const _sfc_main$1Q = /* @__PURE__ */ defineComponent({
  22877. ...__default__$1l,
  22878. props: tagProps,
  22879. emits: tagEmits,
  22880. setup(__props, { emit }) {
  22881. const props = __props;
  22882. const tagSize = useFormSize();
  22883. const ns = useNamespace("tag");
  22884. const containerKls = computed(() => {
  22885. const { type, hit, effect, closable, round } = props;
  22886. return [
  22887. ns.b(),
  22888. ns.is("closable", closable),
  22889. ns.m(type || "primary"),
  22890. ns.m(tagSize.value),
  22891. ns.m(effect),
  22892. ns.is("hit", hit),
  22893. ns.is("round", round)
  22894. ];
  22895. });
  22896. const handleClose = (event) => {
  22897. emit("close", event);
  22898. };
  22899. const handleClick = (event) => {
  22900. emit("click", event);
  22901. };
  22902. const handleVNodeMounted = (vnode) => {
  22903. var _a, _b, _c;
  22904. 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) {
  22905. vnode.component.subTree.component.bum = null;
  22906. }
  22907. };
  22908. return (_ctx, _cache) => {
  22909. return _ctx.disableTransitions ? (openBlock(), createElementBlock("span", {
  22910. key: 0,
  22911. class: normalizeClass(unref(containerKls)),
  22912. style: normalizeStyle({ backgroundColor: _ctx.color }),
  22913. onClick: handleClick
  22914. }, [
  22915. createElementVNode("span", {
  22916. class: normalizeClass(unref(ns).e("content"))
  22917. }, [
  22918. renderSlot(_ctx.$slots, "default")
  22919. ], 2),
  22920. _ctx.closable ? (openBlock(), createBlock(unref(ElIcon), {
  22921. key: 0,
  22922. class: normalizeClass(unref(ns).e("close")),
  22923. onClick: withModifiers(handleClose, ["stop"])
  22924. }, {
  22925. default: withCtx(() => [
  22926. createVNode(unref(close_default))
  22927. ]),
  22928. _: 1
  22929. }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true)
  22930. ], 6)) : (openBlock(), createBlock(Transition, {
  22931. key: 1,
  22932. name: `${unref(ns).namespace.value}-zoom-in-center`,
  22933. appear: "",
  22934. onVnodeMounted: handleVNodeMounted
  22935. }, {
  22936. default: withCtx(() => [
  22937. createElementVNode("span", {
  22938. class: normalizeClass(unref(containerKls)),
  22939. style: normalizeStyle({ backgroundColor: _ctx.color }),
  22940. onClick: handleClick
  22941. }, [
  22942. createElementVNode("span", {
  22943. class: normalizeClass(unref(ns).e("content"))
  22944. }, [
  22945. renderSlot(_ctx.$slots, "default")
  22946. ], 2),
  22947. _ctx.closable ? (openBlock(), createBlock(unref(ElIcon), {
  22948. key: 0,
  22949. class: normalizeClass(unref(ns).e("close")),
  22950. onClick: withModifiers(handleClose, ["stop"])
  22951. }, {
  22952. default: withCtx(() => [
  22953. createVNode(unref(close_default))
  22954. ]),
  22955. _: 1
  22956. }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true)
  22957. ], 6)
  22958. ]),
  22959. _: 3
  22960. }, 8, ["name"]));
  22961. };
  22962. }
  22963. });
  22964. var Tag = /* @__PURE__ */ _export_sfc(_sfc_main$1Q, [["__file", "tag.vue"]]);
  22965. const ElTag = withInstall(Tag);
  22966. const cascaderProps = buildProps({
  22967. ...CommonProps,
  22968. size: useSizeProp,
  22969. placeholder: String,
  22970. disabled: Boolean,
  22971. clearable: Boolean,
  22972. filterable: Boolean,
  22973. filterMethod: {
  22974. type: definePropType(Function),
  22975. default: (node, keyword) => node.text.includes(keyword)
  22976. },
  22977. separator: {
  22978. type: String,
  22979. default: " / "
  22980. },
  22981. showAllLevels: {
  22982. type: Boolean,
  22983. default: true
  22984. },
  22985. collapseTags: Boolean,
  22986. maxCollapseTags: {
  22987. type: Number,
  22988. default: 1
  22989. },
  22990. collapseTagsTooltip: {
  22991. type: Boolean,
  22992. default: false
  22993. },
  22994. debounce: {
  22995. type: Number,
  22996. default: 300
  22997. },
  22998. beforeFilter: {
  22999. type: definePropType(Function),
  23000. default: () => true
  23001. },
  23002. placement: {
  23003. type: definePropType(String),
  23004. values: Ee,
  23005. default: "bottom-start"
  23006. },
  23007. fallbackPlacements: {
  23008. type: definePropType(Array),
  23009. default: ["bottom-start", "bottom", "top-start", "top", "right", "left"]
  23010. },
  23011. popperClass: {
  23012. type: String,
  23013. default: ""
  23014. },
  23015. teleported: useTooltipContentProps.teleported,
  23016. tagType: { ...tagProps.type, default: "info" },
  23017. tagEffect: { ...tagProps.effect, default: "light" },
  23018. validateEvent: {
  23019. type: Boolean,
  23020. default: true
  23021. },
  23022. persistent: {
  23023. type: Boolean,
  23024. default: true
  23025. },
  23026. ...useEmptyValuesProps
  23027. });
  23028. const cascaderEmits = {
  23029. [UPDATE_MODEL_EVENT]: (_) => true,
  23030. [CHANGE_EVENT]: (_) => true,
  23031. focus: (evt) => evt instanceof FocusEvent,
  23032. blur: (evt) => evt instanceof FocusEvent,
  23033. clear: () => true,
  23034. visibleChange: (val) => isBoolean(val),
  23035. expandChange: (val) => !!val,
  23036. removeTag: (val) => !!val
  23037. };
  23038. const COMPONENT_NAME$f = "ElCascader";
  23039. const __default__$1k = defineComponent({
  23040. name: COMPONENT_NAME$f
  23041. });
  23042. const _sfc_main$1P = /* @__PURE__ */ defineComponent({
  23043. ...__default__$1k,
  23044. props: cascaderProps,
  23045. emits: cascaderEmits,
  23046. setup(__props, { expose, emit }) {
  23047. const props = __props;
  23048. const popperOptions = {
  23049. modifiers: [
  23050. {
  23051. name: "arrowPosition",
  23052. enabled: true,
  23053. phase: "main",
  23054. fn: ({ state }) => {
  23055. const { modifiersData, placement } = state;
  23056. if (["right", "left", "bottom", "top"].includes(placement))
  23057. return;
  23058. modifiersData.arrow.x = 35;
  23059. },
  23060. requires: ["arrow"]
  23061. }
  23062. ]
  23063. };
  23064. const attrs = useAttrs$1();
  23065. let inputInitialHeight = 0;
  23066. let pressDeleteCount = 0;
  23067. const nsCascader = useNamespace("cascader");
  23068. const nsInput = useNamespace("input");
  23069. const { t } = useLocale();
  23070. const { form, formItem } = useFormItem();
  23071. const { valueOnClear } = useEmptyValues(props);
  23072. const { isComposing, handleComposition } = useComposition({
  23073. afterComposition(event) {
  23074. var _a;
  23075. const text = (_a = event.target) == null ? void 0 : _a.value;
  23076. handleInput(text);
  23077. }
  23078. });
  23079. const tooltipRef = ref(null);
  23080. const input = ref(null);
  23081. const tagWrapper = ref(null);
  23082. const cascaderPanelRef = ref(null);
  23083. const suggestionPanel = ref(null);
  23084. const popperVisible = ref(false);
  23085. const inputHover = ref(false);
  23086. const filtering = ref(false);
  23087. const filterFocus = ref(false);
  23088. const inputValue = ref("");
  23089. const searchInputValue = ref("");
  23090. const presentTags = ref([]);
  23091. const allPresentTags = ref([]);
  23092. const suggestions = ref([]);
  23093. const cascaderStyle = computed(() => {
  23094. return attrs.style;
  23095. });
  23096. const isDisabled = computed(() => props.disabled || (form == null ? void 0 : form.disabled));
  23097. const inputPlaceholder = computed(() => props.placeholder || t("el.cascader.placeholder"));
  23098. const currentPlaceholder = computed(() => searchInputValue.value || presentTags.value.length > 0 || isComposing.value ? "" : inputPlaceholder.value);
  23099. const realSize = useFormSize();
  23100. const tagSize = computed(() => realSize.value === "small" ? "small" : "default");
  23101. const multiple = computed(() => !!props.props.multiple);
  23102. const readonly = computed(() => !props.filterable || multiple.value);
  23103. const searchKeyword = computed(() => multiple.value ? searchInputValue.value : inputValue.value);
  23104. const checkedNodes = computed(() => {
  23105. var _a;
  23106. return ((_a = cascaderPanelRef.value) == null ? void 0 : _a.checkedNodes) || [];
  23107. });
  23108. const clearBtnVisible = computed(() => {
  23109. if (!props.clearable || isDisabled.value || filtering.value || !inputHover.value)
  23110. return false;
  23111. return !!checkedNodes.value.length;
  23112. });
  23113. const presentText = computed(() => {
  23114. const { showAllLevels, separator } = props;
  23115. const nodes = checkedNodes.value;
  23116. return nodes.length ? multiple.value ? "" : nodes[0].calcText(showAllLevels, separator) : "";
  23117. });
  23118. const validateState = computed(() => (formItem == null ? void 0 : formItem.validateState) || "");
  23119. const checkedValue = computed({
  23120. get() {
  23121. return cloneDeep(props.modelValue);
  23122. },
  23123. set(val) {
  23124. const value = val != null ? val : valueOnClear.value;
  23125. emit(UPDATE_MODEL_EVENT, value);
  23126. emit(CHANGE_EVENT, value);
  23127. if (props.validateEvent) {
  23128. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
  23129. }
  23130. }
  23131. });
  23132. const cascaderKls = computed(() => {
  23133. return [
  23134. nsCascader.b(),
  23135. nsCascader.m(realSize.value),
  23136. nsCascader.is("disabled", isDisabled.value),
  23137. attrs.class
  23138. ];
  23139. });
  23140. const cascaderIconKls = computed(() => {
  23141. return [
  23142. nsInput.e("icon"),
  23143. "icon-arrow-down",
  23144. nsCascader.is("reverse", popperVisible.value)
  23145. ];
  23146. });
  23147. const inputClass = computed(() => {
  23148. return nsCascader.is("focus", popperVisible.value || filterFocus.value);
  23149. });
  23150. const contentRef = computed(() => {
  23151. var _a, _b;
  23152. return (_b = (_a = tooltipRef.value) == null ? void 0 : _a.popperRef) == null ? void 0 : _b.contentRef;
  23153. });
  23154. const togglePopperVisible = (visible) => {
  23155. var _a, _b, _c;
  23156. if (isDisabled.value)
  23157. return;
  23158. visible = visible != null ? visible : !popperVisible.value;
  23159. if (visible !== popperVisible.value) {
  23160. popperVisible.value = visible;
  23161. (_b = (_a = input.value) == null ? void 0 : _a.input) == null ? void 0 : _b.setAttribute("aria-expanded", `${visible}`);
  23162. if (visible) {
  23163. updatePopperPosition();
  23164. nextTick((_c = cascaderPanelRef.value) == null ? void 0 : _c.scrollToExpandingNode);
  23165. } else if (props.filterable) {
  23166. syncPresentTextValue();
  23167. }
  23168. emit("visibleChange", visible);
  23169. }
  23170. };
  23171. const updatePopperPosition = () => {
  23172. nextTick(() => {
  23173. var _a;
  23174. (_a = tooltipRef.value) == null ? void 0 : _a.updatePopper();
  23175. });
  23176. };
  23177. const hideSuggestionPanel = () => {
  23178. filtering.value = false;
  23179. };
  23180. const genTag = (node) => {
  23181. const { showAllLevels, separator } = props;
  23182. return {
  23183. node,
  23184. key: node.uid,
  23185. text: node.calcText(showAllLevels, separator),
  23186. hitState: false,
  23187. closable: !isDisabled.value && !node.isDisabled,
  23188. isCollapseTag: false
  23189. };
  23190. };
  23191. const deleteTag = (tag) => {
  23192. var _a;
  23193. const node = tag.node;
  23194. node.doCheck(false);
  23195. (_a = cascaderPanelRef.value) == null ? void 0 : _a.calculateCheckedValue();
  23196. emit("removeTag", node.valueByOption);
  23197. };
  23198. const calculatePresentTags = () => {
  23199. if (!multiple.value)
  23200. return;
  23201. const nodes = checkedNodes.value;
  23202. const tags = [];
  23203. const allTags = [];
  23204. nodes.forEach((node) => allTags.push(genTag(node)));
  23205. allPresentTags.value = allTags;
  23206. if (nodes.length) {
  23207. nodes.slice(0, props.maxCollapseTags).forEach((node) => tags.push(genTag(node)));
  23208. const rest = nodes.slice(props.maxCollapseTags);
  23209. const restCount = rest.length;
  23210. if (restCount) {
  23211. if (props.collapseTags) {
  23212. tags.push({
  23213. key: -1,
  23214. text: `+ ${restCount}`,
  23215. closable: false,
  23216. isCollapseTag: true
  23217. });
  23218. } else {
  23219. rest.forEach((node) => tags.push(genTag(node)));
  23220. }
  23221. }
  23222. }
  23223. presentTags.value = tags;
  23224. };
  23225. const calculateSuggestions = () => {
  23226. var _a, _b;
  23227. const { filterMethod, showAllLevels, separator } = props;
  23228. const res = (_b = (_a = cascaderPanelRef.value) == null ? void 0 : _a.getFlattedNodes(!props.props.checkStrictly)) == null ? void 0 : _b.filter((node) => {
  23229. if (node.isDisabled)
  23230. return false;
  23231. node.calcText(showAllLevels, separator);
  23232. return filterMethod(node, searchKeyword.value);
  23233. });
  23234. if (multiple.value) {
  23235. presentTags.value.forEach((tag) => {
  23236. tag.hitState = false;
  23237. });
  23238. allPresentTags.value.forEach((tag) => {
  23239. tag.hitState = false;
  23240. });
  23241. }
  23242. filtering.value = true;
  23243. suggestions.value = res;
  23244. updatePopperPosition();
  23245. };
  23246. const focusFirstNode = () => {
  23247. var _a;
  23248. let firstNode;
  23249. if (filtering.value && suggestionPanel.value) {
  23250. firstNode = suggestionPanel.value.$el.querySelector(`.${nsCascader.e("suggestion-item")}`);
  23251. } else {
  23252. firstNode = (_a = cascaderPanelRef.value) == null ? void 0 : _a.$el.querySelector(`.${nsCascader.b("node")}[tabindex="-1"]`);
  23253. }
  23254. if (firstNode) {
  23255. firstNode.focus();
  23256. !filtering.value && firstNode.click();
  23257. }
  23258. };
  23259. const updateStyle = () => {
  23260. var _a, _b;
  23261. const inputInner = (_a = input.value) == null ? void 0 : _a.input;
  23262. const tagWrapperEl = tagWrapper.value;
  23263. const suggestionPanelEl = (_b = suggestionPanel.value) == null ? void 0 : _b.$el;
  23264. if (!isClient || !inputInner)
  23265. return;
  23266. if (suggestionPanelEl) {
  23267. const suggestionList = suggestionPanelEl.querySelector(`.${nsCascader.e("suggestion-list")}`);
  23268. suggestionList.style.minWidth = `${inputInner.offsetWidth}px`;
  23269. }
  23270. if (tagWrapperEl) {
  23271. const { offsetHeight } = tagWrapperEl;
  23272. const height = presentTags.value.length > 0 ? `${Math.max(offsetHeight, inputInitialHeight) - 2}px` : `${inputInitialHeight}px`;
  23273. inputInner.style.height = height;
  23274. updatePopperPosition();
  23275. }
  23276. };
  23277. const getCheckedNodes = (leafOnly) => {
  23278. var _a;
  23279. return (_a = cascaderPanelRef.value) == null ? void 0 : _a.getCheckedNodes(leafOnly);
  23280. };
  23281. const handleExpandChange = (value) => {
  23282. updatePopperPosition();
  23283. emit("expandChange", value);
  23284. };
  23285. const handleKeyDown = (e) => {
  23286. if (isComposing.value)
  23287. return;
  23288. switch (e.code) {
  23289. case EVENT_CODE.enter:
  23290. case EVENT_CODE.numpadEnter:
  23291. togglePopperVisible();
  23292. break;
  23293. case EVENT_CODE.down:
  23294. togglePopperVisible(true);
  23295. nextTick(focusFirstNode);
  23296. e.preventDefault();
  23297. break;
  23298. case EVENT_CODE.esc:
  23299. if (popperVisible.value === true) {
  23300. e.preventDefault();
  23301. e.stopPropagation();
  23302. togglePopperVisible(false);
  23303. }
  23304. break;
  23305. case EVENT_CODE.tab:
  23306. togglePopperVisible(false);
  23307. break;
  23308. }
  23309. };
  23310. const handleClear = () => {
  23311. var _a;
  23312. (_a = cascaderPanelRef.value) == null ? void 0 : _a.clearCheckedNodes();
  23313. if (!popperVisible.value && props.filterable) {
  23314. syncPresentTextValue();
  23315. }
  23316. togglePopperVisible(false);
  23317. emit("clear");
  23318. };
  23319. const syncPresentTextValue = () => {
  23320. const { value } = presentText;
  23321. inputValue.value = value;
  23322. searchInputValue.value = value;
  23323. };
  23324. const handleSuggestionClick = (node) => {
  23325. var _a, _b;
  23326. const { checked } = node;
  23327. if (multiple.value) {
  23328. (_a = cascaderPanelRef.value) == null ? void 0 : _a.handleCheckChange(node, !checked, false);
  23329. } else {
  23330. !checked && ((_b = cascaderPanelRef.value) == null ? void 0 : _b.handleCheckChange(node, true, false));
  23331. togglePopperVisible(false);
  23332. }
  23333. };
  23334. const handleSuggestionKeyDown = (e) => {
  23335. const target = e.target;
  23336. const { code } = e;
  23337. switch (code) {
  23338. case EVENT_CODE.up:
  23339. case EVENT_CODE.down: {
  23340. e.preventDefault();
  23341. const distance = code === EVENT_CODE.up ? -1 : 1;
  23342. focusNode(getSibling(target, distance, `.${nsCascader.e("suggestion-item")}[tabindex="-1"]`));
  23343. break;
  23344. }
  23345. case EVENT_CODE.enter:
  23346. case EVENT_CODE.numpadEnter:
  23347. target.click();
  23348. break;
  23349. }
  23350. };
  23351. const handleDelete = () => {
  23352. const tags = presentTags.value;
  23353. const lastTag = tags[tags.length - 1];
  23354. pressDeleteCount = searchInputValue.value ? 0 : pressDeleteCount + 1;
  23355. if (!lastTag || !pressDeleteCount || props.collapseTags && tags.length > 1)
  23356. return;
  23357. if (lastTag.hitState) {
  23358. deleteTag(lastTag);
  23359. } else {
  23360. lastTag.hitState = true;
  23361. }
  23362. };
  23363. const handleFocus = (e) => {
  23364. const el = e.target;
  23365. const name = nsCascader.e("search-input");
  23366. if (el.className === name) {
  23367. filterFocus.value = true;
  23368. }
  23369. emit("focus", e);
  23370. };
  23371. const handleBlur = (e) => {
  23372. filterFocus.value = false;
  23373. emit("blur", e);
  23374. };
  23375. const handleFilter = debounce(() => {
  23376. const { value } = searchKeyword;
  23377. if (!value)
  23378. return;
  23379. const passed = props.beforeFilter(value);
  23380. if (isPromise(passed)) {
  23381. passed.then(calculateSuggestions).catch(() => {
  23382. });
  23383. } else if (passed !== false) {
  23384. calculateSuggestions();
  23385. } else {
  23386. hideSuggestionPanel();
  23387. }
  23388. }, props.debounce);
  23389. const handleInput = (val, e) => {
  23390. !popperVisible.value && togglePopperVisible(true);
  23391. if (e == null ? void 0 : e.isComposing)
  23392. return;
  23393. val ? handleFilter() : hideSuggestionPanel();
  23394. };
  23395. const getInputInnerHeight = (inputInner) => Number.parseFloat(useCssVar(nsInput.cssVarName("input-height"), inputInner).value) - 2;
  23396. watch(filtering, updatePopperPosition);
  23397. watch([checkedNodes, isDisabled, () => props.collapseTags], calculatePresentTags);
  23398. watch(presentTags, () => {
  23399. nextTick(() => updateStyle());
  23400. });
  23401. watch(realSize, async () => {
  23402. await nextTick();
  23403. const inputInner = input.value.input;
  23404. inputInitialHeight = getInputInnerHeight(inputInner) || inputInitialHeight;
  23405. updateStyle();
  23406. });
  23407. watch(presentText, syncPresentTextValue, { immediate: true });
  23408. onMounted(() => {
  23409. const inputInner = input.value.input;
  23410. const inputInnerHeight = getInputInnerHeight(inputInner);
  23411. inputInitialHeight = inputInner.offsetHeight || inputInnerHeight;
  23412. useResizeObserver(inputInner, updateStyle);
  23413. });
  23414. expose({
  23415. getCheckedNodes,
  23416. cascaderPanelRef,
  23417. togglePopperVisible,
  23418. contentRef,
  23419. presentText
  23420. });
  23421. return (_ctx, _cache) => {
  23422. return openBlock(), createBlock(unref(ElTooltip), {
  23423. ref_key: "tooltipRef",
  23424. ref: tooltipRef,
  23425. visible: popperVisible.value,
  23426. teleported: _ctx.teleported,
  23427. "popper-class": [unref(nsCascader).e("dropdown"), _ctx.popperClass],
  23428. "popper-options": popperOptions,
  23429. "fallback-placements": _ctx.fallbackPlacements,
  23430. "stop-popper-mouse-event": false,
  23431. "gpu-acceleration": false,
  23432. placement: _ctx.placement,
  23433. transition: `${unref(nsCascader).namespace.value}-zoom-in-top`,
  23434. effect: "light",
  23435. pure: "",
  23436. persistent: _ctx.persistent,
  23437. onHide: hideSuggestionPanel
  23438. }, {
  23439. default: withCtx(() => [
  23440. withDirectives((openBlock(), createElementBlock("div", {
  23441. class: normalizeClass(unref(cascaderKls)),
  23442. style: normalizeStyle(unref(cascaderStyle)),
  23443. onClick: () => togglePopperVisible(unref(readonly) ? void 0 : true),
  23444. onKeydown: handleKeyDown,
  23445. onMouseenter: ($event) => inputHover.value = true,
  23446. onMouseleave: ($event) => inputHover.value = false
  23447. }, [
  23448. createVNode(unref(ElInput), {
  23449. ref_key: "input",
  23450. ref: input,
  23451. modelValue: inputValue.value,
  23452. "onUpdate:modelValue": ($event) => inputValue.value = $event,
  23453. placeholder: unref(currentPlaceholder),
  23454. readonly: unref(readonly),
  23455. disabled: unref(isDisabled),
  23456. "validate-event": false,
  23457. size: unref(realSize),
  23458. class: normalizeClass(unref(inputClass)),
  23459. tabindex: unref(multiple) && _ctx.filterable && !unref(isDisabled) ? -1 : void 0,
  23460. onCompositionstart: unref(handleComposition),
  23461. onCompositionupdate: unref(handleComposition),
  23462. onCompositionend: unref(handleComposition),
  23463. onFocus: handleFocus,
  23464. onBlur: handleBlur,
  23465. onInput: handleInput
  23466. }, createSlots({
  23467. suffix: withCtx(() => [
  23468. unref(clearBtnVisible) ? (openBlock(), createBlock(unref(ElIcon), {
  23469. key: "clear",
  23470. class: normalizeClass([unref(nsInput).e("icon"), "icon-circle-close"]),
  23471. onClick: withModifiers(handleClear, ["stop"])
  23472. }, {
  23473. default: withCtx(() => [
  23474. createVNode(unref(circle_close_default))
  23475. ]),
  23476. _: 1
  23477. }, 8, ["class", "onClick"])) : (openBlock(), createBlock(unref(ElIcon), {
  23478. key: "arrow-down",
  23479. class: normalizeClass(unref(cascaderIconKls)),
  23480. onClick: withModifiers(($event) => togglePopperVisible(), ["stop"])
  23481. }, {
  23482. default: withCtx(() => [
  23483. createVNode(unref(arrow_down_default))
  23484. ]),
  23485. _: 1
  23486. }, 8, ["class", "onClick"]))
  23487. ]),
  23488. _: 2
  23489. }, [
  23490. _ctx.$slots.prefix ? {
  23491. name: "prefix",
  23492. fn: withCtx(() => [
  23493. renderSlot(_ctx.$slots, "prefix")
  23494. ])
  23495. } : void 0
  23496. ]), 1032, ["modelValue", "onUpdate:modelValue", "placeholder", "readonly", "disabled", "size", "class", "tabindex", "onCompositionstart", "onCompositionupdate", "onCompositionend"]),
  23497. unref(multiple) ? (openBlock(), createElementBlock("div", {
  23498. key: 0,
  23499. ref_key: "tagWrapper",
  23500. ref: tagWrapper,
  23501. class: normalizeClass([
  23502. unref(nsCascader).e("tags"),
  23503. unref(nsCascader).is("validate", Boolean(unref(validateState)))
  23504. ])
  23505. }, [
  23506. (openBlock(true), createElementBlock(Fragment, null, renderList(presentTags.value, (tag) => {
  23507. return openBlock(), createBlock(unref(ElTag), {
  23508. key: tag.key,
  23509. type: _ctx.tagType,
  23510. size: unref(tagSize),
  23511. effect: _ctx.tagEffect,
  23512. hit: tag.hitState,
  23513. closable: tag.closable,
  23514. "disable-transitions": "",
  23515. onClose: ($event) => deleteTag(tag)
  23516. }, {
  23517. default: withCtx(() => [
  23518. tag.isCollapseTag === false ? (openBlock(), createElementBlock("span", { key: 0 }, toDisplayString(tag.text), 1)) : (openBlock(), createBlock(unref(ElTooltip), {
  23519. key: 1,
  23520. disabled: popperVisible.value || !_ctx.collapseTagsTooltip,
  23521. "fallback-placements": ["bottom", "top", "right", "left"],
  23522. placement: "bottom",
  23523. effect: "light"
  23524. }, {
  23525. default: withCtx(() => [
  23526. createElementVNode("span", null, toDisplayString(tag.text), 1)
  23527. ]),
  23528. content: withCtx(() => [
  23529. createElementVNode("div", {
  23530. class: normalizeClass(unref(nsCascader).e("collapse-tags"))
  23531. }, [
  23532. (openBlock(true), createElementBlock(Fragment, null, renderList(allPresentTags.value.slice(_ctx.maxCollapseTags), (tag2, idx) => {
  23533. return openBlock(), createElementBlock("div", {
  23534. key: idx,
  23535. class: normalizeClass(unref(nsCascader).e("collapse-tag"))
  23536. }, [
  23537. (openBlock(), createBlock(unref(ElTag), {
  23538. key: tag2.key,
  23539. class: "in-tooltip",
  23540. type: _ctx.tagType,
  23541. size: unref(tagSize),
  23542. effect: _ctx.tagEffect,
  23543. hit: tag2.hitState,
  23544. closable: tag2.closable,
  23545. "disable-transitions": "",
  23546. onClose: ($event) => deleteTag(tag2)
  23547. }, {
  23548. default: withCtx(() => [
  23549. createElementVNode("span", null, toDisplayString(tag2.text), 1)
  23550. ]),
  23551. _: 2
  23552. }, 1032, ["type", "size", "effect", "hit", "closable", "onClose"]))
  23553. ], 2);
  23554. }), 128))
  23555. ], 2)
  23556. ]),
  23557. _: 2
  23558. }, 1032, ["disabled"]))
  23559. ]),
  23560. _: 2
  23561. }, 1032, ["type", "size", "effect", "hit", "closable", "onClose"]);
  23562. }), 128)),
  23563. _ctx.filterable && !unref(isDisabled) ? withDirectives((openBlock(), createElementBlock("input", {
  23564. key: 0,
  23565. "onUpdate:modelValue": ($event) => searchInputValue.value = $event,
  23566. type: "text",
  23567. class: normalizeClass(unref(nsCascader).e("search-input")),
  23568. placeholder: unref(presentText) ? "" : unref(inputPlaceholder),
  23569. onInput: (e) => handleInput(searchInputValue.value, e),
  23570. onClick: withModifiers(($event) => togglePopperVisible(true), ["stop"]),
  23571. onKeydown: withKeys(handleDelete, ["delete"]),
  23572. onCompositionstart: unref(handleComposition),
  23573. onCompositionupdate: unref(handleComposition),
  23574. onCompositionend: unref(handleComposition),
  23575. onFocus: handleFocus,
  23576. onBlur: handleBlur
  23577. }, null, 42, ["onUpdate:modelValue", "placeholder", "onInput", "onClick", "onKeydown", "onCompositionstart", "onCompositionupdate", "onCompositionend"])), [
  23578. [vModelText, searchInputValue.value]
  23579. ]) : createCommentVNode("v-if", true)
  23580. ], 2)) : createCommentVNode("v-if", true)
  23581. ], 46, ["onClick", "onMouseenter", "onMouseleave"])), [
  23582. [unref(ClickOutside), () => togglePopperVisible(false), unref(contentRef)]
  23583. ])
  23584. ]),
  23585. content: withCtx(() => [
  23586. withDirectives(createVNode(unref(ElCascaderPanel), {
  23587. ref_key: "cascaderPanelRef",
  23588. ref: cascaderPanelRef,
  23589. modelValue: unref(checkedValue),
  23590. "onUpdate:modelValue": ($event) => isRef(checkedValue) ? checkedValue.value = $event : null,
  23591. options: _ctx.options,
  23592. props: props.props,
  23593. border: false,
  23594. "render-label": _ctx.$slots.default,
  23595. onExpandChange: handleExpandChange,
  23596. onClose: ($event) => _ctx.$nextTick(() => togglePopperVisible(false))
  23597. }, {
  23598. empty: withCtx(() => [
  23599. renderSlot(_ctx.$slots, "empty")
  23600. ]),
  23601. _: 3
  23602. }, 8, ["modelValue", "onUpdate:modelValue", "options", "props", "render-label", "onClose"]), [
  23603. [vShow, !filtering.value]
  23604. ]),
  23605. _ctx.filterable ? withDirectives((openBlock(), createBlock(unref(ElScrollbar), {
  23606. key: 0,
  23607. ref_key: "suggestionPanel",
  23608. ref: suggestionPanel,
  23609. tag: "ul",
  23610. class: normalizeClass(unref(nsCascader).e("suggestion-panel")),
  23611. "view-class": unref(nsCascader).e("suggestion-list"),
  23612. onKeydown: handleSuggestionKeyDown
  23613. }, {
  23614. default: withCtx(() => [
  23615. suggestions.value.length ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(suggestions.value, (item) => {
  23616. return openBlock(), createElementBlock("li", {
  23617. key: item.uid,
  23618. class: normalizeClass([
  23619. unref(nsCascader).e("suggestion-item"),
  23620. unref(nsCascader).is("checked", item.checked)
  23621. ]),
  23622. tabindex: -1,
  23623. onClick: ($event) => handleSuggestionClick(item)
  23624. }, [
  23625. renderSlot(_ctx.$slots, "suggestion-item", { item }, () => [
  23626. createElementVNode("span", null, toDisplayString(item.text), 1),
  23627. item.checked ? (openBlock(), createBlock(unref(ElIcon), { key: 0 }, {
  23628. default: withCtx(() => [
  23629. createVNode(unref(check_default))
  23630. ]),
  23631. _: 1
  23632. })) : createCommentVNode("v-if", true)
  23633. ])
  23634. ], 10, ["onClick"]);
  23635. }), 128)) : renderSlot(_ctx.$slots, "empty", { key: 1 }, () => [
  23636. createElementVNode("li", {
  23637. class: normalizeClass(unref(nsCascader).e("empty-text"))
  23638. }, toDisplayString(unref(t)("el.cascader.noMatch")), 3)
  23639. ])
  23640. ]),
  23641. _: 3
  23642. }, 8, ["class", "view-class"])), [
  23643. [vShow, filtering.value]
  23644. ]) : createCommentVNode("v-if", true)
  23645. ]),
  23646. _: 3
  23647. }, 8, ["visible", "teleported", "popper-class", "fallback-placements", "placement", "transition", "persistent"]);
  23648. };
  23649. }
  23650. });
  23651. var Cascader = /* @__PURE__ */ _export_sfc(_sfc_main$1P, [["__file", "cascader.vue"]]);
  23652. const ElCascader = withInstall(Cascader);
  23653. const checkTagProps = buildProps({
  23654. checked: Boolean,
  23655. disabled: Boolean,
  23656. type: {
  23657. type: String,
  23658. values: ["primary", "success", "info", "warning", "danger"],
  23659. default: "primary"
  23660. }
  23661. });
  23662. const checkTagEmits = {
  23663. "update:checked": (value) => isBoolean(value),
  23664. [CHANGE_EVENT]: (value) => isBoolean(value)
  23665. };
  23666. const __default__$1j = defineComponent({
  23667. name: "ElCheckTag"
  23668. });
  23669. const _sfc_main$1O = /* @__PURE__ */ defineComponent({
  23670. ...__default__$1j,
  23671. props: checkTagProps,
  23672. emits: checkTagEmits,
  23673. setup(__props, { emit }) {
  23674. const props = __props;
  23675. const ns = useNamespace("check-tag");
  23676. const isDisabled = computed(() => props.disabled);
  23677. const containerKls = computed(() => [
  23678. ns.b(),
  23679. ns.is("checked", props.checked),
  23680. ns.is("disabled", isDisabled.value),
  23681. ns.m(props.type || "primary")
  23682. ]);
  23683. const handleChange = () => {
  23684. if (isDisabled.value)
  23685. return;
  23686. const checked = !props.checked;
  23687. emit(CHANGE_EVENT, checked);
  23688. emit("update:checked", checked);
  23689. };
  23690. return (_ctx, _cache) => {
  23691. return openBlock(), createElementBlock("span", {
  23692. class: normalizeClass(unref(containerKls)),
  23693. onClick: handleChange
  23694. }, [
  23695. renderSlot(_ctx.$slots, "default")
  23696. ], 2);
  23697. };
  23698. }
  23699. });
  23700. var CheckTag = /* @__PURE__ */ _export_sfc(_sfc_main$1O, [["__file", "check-tag.vue"]]);
  23701. const ElCheckTag = withInstall(CheckTag);
  23702. const rowContextKey = Symbol("rowContextKey");
  23703. const RowJustify = [
  23704. "start",
  23705. "center",
  23706. "end",
  23707. "space-around",
  23708. "space-between",
  23709. "space-evenly"
  23710. ];
  23711. const RowAlign = ["top", "middle", "bottom"];
  23712. const rowProps = buildProps({
  23713. tag: {
  23714. type: String,
  23715. default: "div"
  23716. },
  23717. gutter: {
  23718. type: Number,
  23719. default: 0
  23720. },
  23721. justify: {
  23722. type: String,
  23723. values: RowJustify,
  23724. default: "start"
  23725. },
  23726. align: {
  23727. type: String,
  23728. values: RowAlign
  23729. }
  23730. });
  23731. const __default__$1i = defineComponent({
  23732. name: "ElRow"
  23733. });
  23734. const _sfc_main$1N = /* @__PURE__ */ defineComponent({
  23735. ...__default__$1i,
  23736. props: rowProps,
  23737. setup(__props) {
  23738. const props = __props;
  23739. const ns = useNamespace("row");
  23740. const gutter = computed(() => props.gutter);
  23741. provide(rowContextKey, {
  23742. gutter
  23743. });
  23744. const style = computed(() => {
  23745. const styles = {};
  23746. if (!props.gutter) {
  23747. return styles;
  23748. }
  23749. styles.marginRight = styles.marginLeft = `-${props.gutter / 2}px`;
  23750. return styles;
  23751. });
  23752. const rowKls = computed(() => [
  23753. ns.b(),
  23754. ns.is(`justify-${props.justify}`, props.justify !== "start"),
  23755. ns.is(`align-${props.align}`, !!props.align)
  23756. ]);
  23757. return (_ctx, _cache) => {
  23758. return openBlock(), createBlock(resolveDynamicComponent(_ctx.tag), {
  23759. class: normalizeClass(unref(rowKls)),
  23760. style: normalizeStyle(unref(style))
  23761. }, {
  23762. default: withCtx(() => [
  23763. renderSlot(_ctx.$slots, "default")
  23764. ]),
  23765. _: 3
  23766. }, 8, ["class", "style"]);
  23767. };
  23768. }
  23769. });
  23770. var Row$1 = /* @__PURE__ */ _export_sfc(_sfc_main$1N, [["__file", "row.vue"]]);
  23771. const ElRow = withInstall(Row$1);
  23772. const colProps = buildProps({
  23773. tag: {
  23774. type: String,
  23775. default: "div"
  23776. },
  23777. span: {
  23778. type: Number,
  23779. default: 24
  23780. },
  23781. offset: {
  23782. type: Number,
  23783. default: 0
  23784. },
  23785. pull: {
  23786. type: Number,
  23787. default: 0
  23788. },
  23789. push: {
  23790. type: Number,
  23791. default: 0
  23792. },
  23793. xs: {
  23794. type: definePropType([Number, Object]),
  23795. default: () => mutable({})
  23796. },
  23797. sm: {
  23798. type: definePropType([Number, Object]),
  23799. default: () => mutable({})
  23800. },
  23801. md: {
  23802. type: definePropType([Number, Object]),
  23803. default: () => mutable({})
  23804. },
  23805. lg: {
  23806. type: definePropType([Number, Object]),
  23807. default: () => mutable({})
  23808. },
  23809. xl: {
  23810. type: definePropType([Number, Object]),
  23811. default: () => mutable({})
  23812. }
  23813. });
  23814. const __default__$1h = defineComponent({
  23815. name: "ElCol"
  23816. });
  23817. const _sfc_main$1M = /* @__PURE__ */ defineComponent({
  23818. ...__default__$1h,
  23819. props: colProps,
  23820. setup(__props) {
  23821. const props = __props;
  23822. const { gutter } = inject(rowContextKey, { gutter: computed(() => 0) });
  23823. const ns = useNamespace("col");
  23824. const style = computed(() => {
  23825. const styles = {};
  23826. if (gutter.value) {
  23827. styles.paddingLeft = styles.paddingRight = `${gutter.value / 2}px`;
  23828. }
  23829. return styles;
  23830. });
  23831. const colKls = computed(() => {
  23832. const classes = [];
  23833. const pos = ["span", "offset", "pull", "push"];
  23834. pos.forEach((prop) => {
  23835. const size = props[prop];
  23836. if (isNumber(size)) {
  23837. if (prop === "span")
  23838. classes.push(ns.b(`${props[prop]}`));
  23839. else if (size > 0)
  23840. classes.push(ns.b(`${prop}-${props[prop]}`));
  23841. }
  23842. });
  23843. const sizes = ["xs", "sm", "md", "lg", "xl"];
  23844. sizes.forEach((size) => {
  23845. if (isNumber(props[size])) {
  23846. classes.push(ns.b(`${size}-${props[size]}`));
  23847. } else if (isObject$1(props[size])) {
  23848. Object.entries(props[size]).forEach(([prop, sizeProp]) => {
  23849. classes.push(prop !== "span" ? ns.b(`${size}-${prop}-${sizeProp}`) : ns.b(`${size}-${sizeProp}`));
  23850. });
  23851. }
  23852. });
  23853. if (gutter.value) {
  23854. classes.push(ns.is("guttered"));
  23855. }
  23856. return [ns.b(), classes];
  23857. });
  23858. return (_ctx, _cache) => {
  23859. return openBlock(), createBlock(resolveDynamicComponent(_ctx.tag), {
  23860. class: normalizeClass(unref(colKls)),
  23861. style: normalizeStyle(unref(style))
  23862. }, {
  23863. default: withCtx(() => [
  23864. renderSlot(_ctx.$slots, "default")
  23865. ]),
  23866. _: 3
  23867. }, 8, ["class", "style"]);
  23868. };
  23869. }
  23870. });
  23871. var Col = /* @__PURE__ */ _export_sfc(_sfc_main$1M, [["__file", "col.vue"]]);
  23872. const ElCol = withInstall(Col);
  23873. const emitChangeFn = (value) => isNumber(value) || isString$1(value) || isArray$1(value);
  23874. const collapseProps = buildProps({
  23875. accordion: Boolean,
  23876. modelValue: {
  23877. type: definePropType([Array, String, Number]),
  23878. default: () => mutable([])
  23879. }
  23880. });
  23881. const collapseEmits = {
  23882. [UPDATE_MODEL_EVENT]: emitChangeFn,
  23883. [CHANGE_EVENT]: emitChangeFn
  23884. };
  23885. const collapseContextKey = Symbol("collapseContextKey");
  23886. const useCollapse = (props, emit) => {
  23887. const activeNames = ref(castArray$1(props.modelValue));
  23888. const setActiveNames = (_activeNames) => {
  23889. activeNames.value = _activeNames;
  23890. const value = props.accordion ? activeNames.value[0] : activeNames.value;
  23891. emit(UPDATE_MODEL_EVENT, value);
  23892. emit(CHANGE_EVENT, value);
  23893. };
  23894. const handleItemClick = (name) => {
  23895. if (props.accordion) {
  23896. setActiveNames([activeNames.value[0] === name ? "" : name]);
  23897. } else {
  23898. const _activeNames = [...activeNames.value];
  23899. const index = _activeNames.indexOf(name);
  23900. if (index > -1) {
  23901. _activeNames.splice(index, 1);
  23902. } else {
  23903. _activeNames.push(name);
  23904. }
  23905. setActiveNames(_activeNames);
  23906. }
  23907. };
  23908. watch(() => props.modelValue, () => activeNames.value = castArray$1(props.modelValue), { deep: true });
  23909. provide(collapseContextKey, {
  23910. activeNames,
  23911. handleItemClick
  23912. });
  23913. return {
  23914. activeNames,
  23915. setActiveNames
  23916. };
  23917. };
  23918. const useCollapseDOM = () => {
  23919. const ns = useNamespace("collapse");
  23920. const rootKls = computed(() => ns.b());
  23921. return {
  23922. rootKls
  23923. };
  23924. };
  23925. const __default__$1g = defineComponent({
  23926. name: "ElCollapse"
  23927. });
  23928. const _sfc_main$1L = /* @__PURE__ */ defineComponent({
  23929. ...__default__$1g,
  23930. props: collapseProps,
  23931. emits: collapseEmits,
  23932. setup(__props, { expose, emit }) {
  23933. const props = __props;
  23934. const { activeNames, setActiveNames } = useCollapse(props, emit);
  23935. const { rootKls } = useCollapseDOM();
  23936. expose({
  23937. activeNames,
  23938. setActiveNames
  23939. });
  23940. return (_ctx, _cache) => {
  23941. return openBlock(), createElementBlock("div", {
  23942. class: normalizeClass(unref(rootKls))
  23943. }, [
  23944. renderSlot(_ctx.$slots, "default")
  23945. ], 2);
  23946. };
  23947. }
  23948. });
  23949. var Collapse = /* @__PURE__ */ _export_sfc(_sfc_main$1L, [["__file", "collapse.vue"]]);
  23950. const __default__$1f = defineComponent({
  23951. name: "ElCollapseTransition"
  23952. });
  23953. const _sfc_main$1K = /* @__PURE__ */ defineComponent({
  23954. ...__default__$1f,
  23955. setup(__props) {
  23956. const ns = useNamespace("collapse-transition");
  23957. const reset = (el) => {
  23958. el.style.maxHeight = "";
  23959. el.style.overflow = el.dataset.oldOverflow;
  23960. el.style.paddingTop = el.dataset.oldPaddingTop;
  23961. el.style.paddingBottom = el.dataset.oldPaddingBottom;
  23962. };
  23963. const on = {
  23964. beforeEnter(el) {
  23965. if (!el.dataset)
  23966. el.dataset = {};
  23967. el.dataset.oldPaddingTop = el.style.paddingTop;
  23968. el.dataset.oldPaddingBottom = el.style.paddingBottom;
  23969. if (el.style.height)
  23970. el.dataset.elExistsHeight = el.style.height;
  23971. el.style.maxHeight = 0;
  23972. el.style.paddingTop = 0;
  23973. el.style.paddingBottom = 0;
  23974. },
  23975. enter(el) {
  23976. requestAnimationFrame(() => {
  23977. el.dataset.oldOverflow = el.style.overflow;
  23978. if (el.dataset.elExistsHeight) {
  23979. el.style.maxHeight = el.dataset.elExistsHeight;
  23980. } else if (el.scrollHeight !== 0) {
  23981. el.style.maxHeight = `${el.scrollHeight}px`;
  23982. } else {
  23983. el.style.maxHeight = 0;
  23984. }
  23985. el.style.paddingTop = el.dataset.oldPaddingTop;
  23986. el.style.paddingBottom = el.dataset.oldPaddingBottom;
  23987. el.style.overflow = "hidden";
  23988. });
  23989. },
  23990. afterEnter(el) {
  23991. el.style.maxHeight = "";
  23992. el.style.overflow = el.dataset.oldOverflow;
  23993. },
  23994. enterCancelled(el) {
  23995. reset(el);
  23996. },
  23997. beforeLeave(el) {
  23998. if (!el.dataset)
  23999. el.dataset = {};
  24000. el.dataset.oldPaddingTop = el.style.paddingTop;
  24001. el.dataset.oldPaddingBottom = el.style.paddingBottom;
  24002. el.dataset.oldOverflow = el.style.overflow;
  24003. el.style.maxHeight = `${el.scrollHeight}px`;
  24004. el.style.overflow = "hidden";
  24005. },
  24006. leave(el) {
  24007. if (el.scrollHeight !== 0) {
  24008. el.style.maxHeight = 0;
  24009. el.style.paddingTop = 0;
  24010. el.style.paddingBottom = 0;
  24011. }
  24012. },
  24013. afterLeave(el) {
  24014. reset(el);
  24015. },
  24016. leaveCancelled(el) {
  24017. reset(el);
  24018. }
  24019. };
  24020. return (_ctx, _cache) => {
  24021. return openBlock(), createBlock(Transition, mergeProps({
  24022. name: unref(ns).b()
  24023. }, toHandlers(on)), {
  24024. default: withCtx(() => [
  24025. renderSlot(_ctx.$slots, "default")
  24026. ]),
  24027. _: 3
  24028. }, 16, ["name"]);
  24029. };
  24030. }
  24031. });
  24032. var CollapseTransition = /* @__PURE__ */ _export_sfc(_sfc_main$1K, [["__file", "collapse-transition.vue"]]);
  24033. const ElCollapseTransition = withInstall(CollapseTransition);
  24034. const collapseItemProps = buildProps({
  24035. title: {
  24036. type: String,
  24037. default: ""
  24038. },
  24039. name: {
  24040. type: definePropType([String, Number]),
  24041. default: void 0
  24042. },
  24043. icon: {
  24044. type: iconPropType,
  24045. default: arrow_right_default
  24046. },
  24047. disabled: Boolean
  24048. });
  24049. const useCollapseItem = (props) => {
  24050. const collapse = inject(collapseContextKey);
  24051. const { namespace } = useNamespace("collapse");
  24052. const focusing = ref(false);
  24053. const isClick = ref(false);
  24054. const idInjection = useIdInjection();
  24055. const id = computed(() => idInjection.current++);
  24056. const name = computed(() => {
  24057. var _a;
  24058. return (_a = props.name) != null ? _a : `${namespace.value}-id-${idInjection.prefix}-${unref(id)}`;
  24059. });
  24060. const isActive = computed(() => collapse == null ? void 0 : collapse.activeNames.value.includes(unref(name)));
  24061. const handleFocus = () => {
  24062. setTimeout(() => {
  24063. if (!isClick.value) {
  24064. focusing.value = true;
  24065. } else {
  24066. isClick.value = false;
  24067. }
  24068. }, 50);
  24069. };
  24070. const handleHeaderClick = () => {
  24071. if (props.disabled)
  24072. return;
  24073. collapse == null ? void 0 : collapse.handleItemClick(unref(name));
  24074. focusing.value = false;
  24075. isClick.value = true;
  24076. };
  24077. const handleEnterClick = () => {
  24078. collapse == null ? void 0 : collapse.handleItemClick(unref(name));
  24079. };
  24080. return {
  24081. focusing,
  24082. id,
  24083. isActive,
  24084. handleFocus,
  24085. handleHeaderClick,
  24086. handleEnterClick
  24087. };
  24088. };
  24089. const useCollapseItemDOM = (props, { focusing, isActive, id }) => {
  24090. const ns = useNamespace("collapse");
  24091. const rootKls = computed(() => [
  24092. ns.b("item"),
  24093. ns.is("active", unref(isActive)),
  24094. ns.is("disabled", props.disabled)
  24095. ]);
  24096. const headKls = computed(() => [
  24097. ns.be("item", "header"),
  24098. ns.is("active", unref(isActive)),
  24099. { focusing: unref(focusing) && !props.disabled }
  24100. ]);
  24101. const arrowKls = computed(() => [
  24102. ns.be("item", "arrow"),
  24103. ns.is("active", unref(isActive))
  24104. ]);
  24105. const itemWrapperKls = computed(() => ns.be("item", "wrap"));
  24106. const itemContentKls = computed(() => ns.be("item", "content"));
  24107. const scopedContentId = computed(() => ns.b(`content-${unref(id)}`));
  24108. const scopedHeadId = computed(() => ns.b(`head-${unref(id)}`));
  24109. return {
  24110. arrowKls,
  24111. headKls,
  24112. rootKls,
  24113. itemWrapperKls,
  24114. itemContentKls,
  24115. scopedContentId,
  24116. scopedHeadId
  24117. };
  24118. };
  24119. const __default__$1e = defineComponent({
  24120. name: "ElCollapseItem"
  24121. });
  24122. const _sfc_main$1J = /* @__PURE__ */ defineComponent({
  24123. ...__default__$1e,
  24124. props: collapseItemProps,
  24125. setup(__props, { expose }) {
  24126. const props = __props;
  24127. const {
  24128. focusing,
  24129. id,
  24130. isActive,
  24131. handleFocus,
  24132. handleHeaderClick,
  24133. handleEnterClick
  24134. } = useCollapseItem(props);
  24135. const {
  24136. arrowKls,
  24137. headKls,
  24138. rootKls,
  24139. itemWrapperKls,
  24140. itemContentKls,
  24141. scopedContentId,
  24142. scopedHeadId
  24143. } = useCollapseItemDOM(props, { focusing, isActive, id });
  24144. expose({
  24145. isActive
  24146. });
  24147. return (_ctx, _cache) => {
  24148. return openBlock(), createElementBlock("div", {
  24149. class: normalizeClass(unref(rootKls))
  24150. }, [
  24151. createElementVNode("button", {
  24152. id: unref(scopedHeadId),
  24153. class: normalizeClass(unref(headKls)),
  24154. "aria-expanded": unref(isActive),
  24155. "aria-controls": unref(scopedContentId),
  24156. "aria-describedby": unref(scopedContentId),
  24157. tabindex: _ctx.disabled ? -1 : 0,
  24158. type: "button",
  24159. onClick: unref(handleHeaderClick),
  24160. onKeydown: withKeys(withModifiers(unref(handleEnterClick), ["stop", "prevent"]), ["space", "enter"]),
  24161. onFocus: unref(handleFocus),
  24162. onBlur: ($event) => focusing.value = false
  24163. }, [
  24164. renderSlot(_ctx.$slots, "title", {}, () => [
  24165. createTextVNode(toDisplayString(_ctx.title), 1)
  24166. ]),
  24167. renderSlot(_ctx.$slots, "icon", { isActive: unref(isActive) }, () => [
  24168. createVNode(unref(ElIcon), {
  24169. class: normalizeClass(unref(arrowKls))
  24170. }, {
  24171. default: withCtx(() => [
  24172. (openBlock(), createBlock(resolveDynamicComponent(_ctx.icon)))
  24173. ]),
  24174. _: 1
  24175. }, 8, ["class"])
  24176. ])
  24177. ], 42, ["id", "aria-expanded", "aria-controls", "aria-describedby", "tabindex", "onClick", "onKeydown", "onFocus", "onBlur"]),
  24178. createVNode(unref(ElCollapseTransition), null, {
  24179. default: withCtx(() => [
  24180. withDirectives(createElementVNode("div", {
  24181. id: unref(scopedContentId),
  24182. role: "region",
  24183. class: normalizeClass(unref(itemWrapperKls)),
  24184. "aria-hidden": !unref(isActive),
  24185. "aria-labelledby": unref(scopedHeadId)
  24186. }, [
  24187. createElementVNode("div", {
  24188. class: normalizeClass(unref(itemContentKls))
  24189. }, [
  24190. renderSlot(_ctx.$slots, "default")
  24191. ], 2)
  24192. ], 10, ["id", "aria-hidden", "aria-labelledby"]), [
  24193. [vShow, unref(isActive)]
  24194. ])
  24195. ]),
  24196. _: 3
  24197. })
  24198. ], 2);
  24199. };
  24200. }
  24201. });
  24202. var CollapseItem = /* @__PURE__ */ _export_sfc(_sfc_main$1J, [["__file", "collapse-item.vue"]]);
  24203. const ElCollapse = withInstall(Collapse, {
  24204. CollapseItem
  24205. });
  24206. const ElCollapseItem = withNoopInstall(CollapseItem);
  24207. const alphaSliderProps = buildProps({
  24208. color: {
  24209. type: definePropType(Object),
  24210. required: true
  24211. },
  24212. vertical: {
  24213. type: Boolean,
  24214. default: false
  24215. }
  24216. });
  24217. let isDragging = false;
  24218. function draggable(element, options) {
  24219. if (!isClient)
  24220. return;
  24221. const moveFn = function(event) {
  24222. var _a;
  24223. (_a = options.drag) == null ? void 0 : _a.call(options, event);
  24224. };
  24225. const upFn = function(event) {
  24226. var _a;
  24227. document.removeEventListener("mousemove", moveFn);
  24228. document.removeEventListener("mouseup", upFn);
  24229. document.removeEventListener("touchmove", moveFn);
  24230. document.removeEventListener("touchend", upFn);
  24231. document.onselectstart = null;
  24232. document.ondragstart = null;
  24233. isDragging = false;
  24234. (_a = options.end) == null ? void 0 : _a.call(options, event);
  24235. };
  24236. const downFn = function(event) {
  24237. var _a;
  24238. if (isDragging)
  24239. return;
  24240. event.preventDefault();
  24241. document.onselectstart = () => false;
  24242. document.ondragstart = () => false;
  24243. document.addEventListener("mousemove", moveFn);
  24244. document.addEventListener("mouseup", upFn);
  24245. document.addEventListener("touchmove", moveFn);
  24246. document.addEventListener("touchend", upFn);
  24247. isDragging = true;
  24248. (_a = options.start) == null ? void 0 : _a.call(options, event);
  24249. };
  24250. element.addEventListener("mousedown", downFn);
  24251. element.addEventListener("touchstart", downFn, { passive: false });
  24252. }
  24253. const useAlphaSlider = (props) => {
  24254. const instance = getCurrentInstance();
  24255. const { t } = useLocale();
  24256. const thumb = shallowRef();
  24257. const bar = shallowRef();
  24258. const alpha = computed(() => props.color.get("alpha"));
  24259. const alphaLabel = computed(() => t("el.colorpicker.alphaLabel"));
  24260. function handleClick(event) {
  24261. var _a;
  24262. const target = event.target;
  24263. if (target !== thumb.value) {
  24264. handleDrag(event);
  24265. }
  24266. (_a = thumb.value) == null ? void 0 : _a.focus();
  24267. }
  24268. function handleDrag(event) {
  24269. if (!bar.value || !thumb.value)
  24270. return;
  24271. const el = instance.vnode.el;
  24272. const rect = el.getBoundingClientRect();
  24273. const { clientX, clientY } = getClientXY(event);
  24274. if (!props.vertical) {
  24275. let left = clientX - rect.left;
  24276. left = Math.max(thumb.value.offsetWidth / 2, left);
  24277. left = Math.min(left, rect.width - thumb.value.offsetWidth / 2);
  24278. props.color.set("alpha", Math.round((left - thumb.value.offsetWidth / 2) / (rect.width - thumb.value.offsetWidth) * 100));
  24279. } else {
  24280. let top = clientY - rect.top;
  24281. top = Math.max(thumb.value.offsetHeight / 2, top);
  24282. top = Math.min(top, rect.height - thumb.value.offsetHeight / 2);
  24283. props.color.set("alpha", Math.round((top - thumb.value.offsetHeight / 2) / (rect.height - thumb.value.offsetHeight) * 100));
  24284. }
  24285. }
  24286. function handleKeydown(event) {
  24287. const { code, shiftKey } = event;
  24288. const step = shiftKey ? 10 : 1;
  24289. switch (code) {
  24290. case EVENT_CODE.left:
  24291. case EVENT_CODE.down:
  24292. event.preventDefault();
  24293. event.stopPropagation();
  24294. incrementPosition(-step);
  24295. break;
  24296. case EVENT_CODE.right:
  24297. case EVENT_CODE.up:
  24298. event.preventDefault();
  24299. event.stopPropagation();
  24300. incrementPosition(step);
  24301. break;
  24302. }
  24303. }
  24304. function incrementPosition(step) {
  24305. let next = alpha.value + step;
  24306. next = next < 0 ? 0 : next > 100 ? 100 : next;
  24307. props.color.set("alpha", next);
  24308. }
  24309. return {
  24310. thumb,
  24311. bar,
  24312. alpha,
  24313. alphaLabel,
  24314. handleDrag,
  24315. handleClick,
  24316. handleKeydown
  24317. };
  24318. };
  24319. const useAlphaSliderDOM = (props, {
  24320. bar,
  24321. thumb,
  24322. handleDrag
  24323. }) => {
  24324. const instance = getCurrentInstance();
  24325. const ns = useNamespace("color-alpha-slider");
  24326. const thumbLeft = ref(0);
  24327. const thumbTop = ref(0);
  24328. const background = ref();
  24329. function getThumbLeft() {
  24330. if (!thumb.value)
  24331. return 0;
  24332. if (props.vertical)
  24333. return 0;
  24334. const el = instance.vnode.el;
  24335. const alpha = props.color.get("alpha");
  24336. if (!el)
  24337. return 0;
  24338. return Math.round(alpha * (el.offsetWidth - thumb.value.offsetWidth / 2) / 100);
  24339. }
  24340. function getThumbTop() {
  24341. if (!thumb.value)
  24342. return 0;
  24343. const el = instance.vnode.el;
  24344. if (!props.vertical)
  24345. return 0;
  24346. const alpha = props.color.get("alpha");
  24347. if (!el)
  24348. return 0;
  24349. return Math.round(alpha * (el.offsetHeight - thumb.value.offsetHeight / 2) / 100);
  24350. }
  24351. function getBackground() {
  24352. if (props.color && props.color.value) {
  24353. const { r, g, b } = props.color.toRgb();
  24354. return `linear-gradient(to right, rgba(${r}, ${g}, ${b}, 0) 0%, rgba(${r}, ${g}, ${b}, 1) 100%)`;
  24355. }
  24356. return "";
  24357. }
  24358. function update() {
  24359. thumbLeft.value = getThumbLeft();
  24360. thumbTop.value = getThumbTop();
  24361. background.value = getBackground();
  24362. }
  24363. onMounted(() => {
  24364. if (!bar.value || !thumb.value)
  24365. return;
  24366. const dragConfig = {
  24367. drag: (event) => {
  24368. handleDrag(event);
  24369. },
  24370. end: (event) => {
  24371. handleDrag(event);
  24372. }
  24373. };
  24374. draggable(bar.value, dragConfig);
  24375. draggable(thumb.value, dragConfig);
  24376. update();
  24377. });
  24378. watch(() => props.color.get("alpha"), () => update());
  24379. watch(() => props.color.value, () => update());
  24380. const rootKls = computed(() => [ns.b(), ns.is("vertical", props.vertical)]);
  24381. const barKls = computed(() => ns.e("bar"));
  24382. const thumbKls = computed(() => ns.e("thumb"));
  24383. const barStyle = computed(() => ({ background: background.value }));
  24384. const thumbStyle = computed(() => ({
  24385. left: addUnit(thumbLeft.value),
  24386. top: addUnit(thumbTop.value)
  24387. }));
  24388. return { rootKls, barKls, barStyle, thumbKls, thumbStyle, update };
  24389. };
  24390. const COMPONENT_NAME$e = "ElColorAlphaSlider";
  24391. const __default__$1d = defineComponent({
  24392. name: COMPONENT_NAME$e
  24393. });
  24394. const _sfc_main$1I = /* @__PURE__ */ defineComponent({
  24395. ...__default__$1d,
  24396. props: alphaSliderProps,
  24397. setup(__props, { expose }) {
  24398. const props = __props;
  24399. const {
  24400. alpha,
  24401. alphaLabel,
  24402. bar,
  24403. thumb,
  24404. handleDrag,
  24405. handleClick,
  24406. handleKeydown
  24407. } = useAlphaSlider(props);
  24408. const { rootKls, barKls, barStyle, thumbKls, thumbStyle, update } = useAlphaSliderDOM(props, {
  24409. bar,
  24410. thumb,
  24411. handleDrag
  24412. });
  24413. expose({
  24414. update,
  24415. bar,
  24416. thumb
  24417. });
  24418. return (_ctx, _cache) => {
  24419. return openBlock(), createElementBlock("div", {
  24420. class: normalizeClass(unref(rootKls))
  24421. }, [
  24422. createElementVNode("div", {
  24423. ref_key: "bar",
  24424. ref: bar,
  24425. class: normalizeClass(unref(barKls)),
  24426. style: normalizeStyle(unref(barStyle)),
  24427. onClick: unref(handleClick)
  24428. }, null, 14, ["onClick"]),
  24429. createElementVNode("div", {
  24430. ref_key: "thumb",
  24431. ref: thumb,
  24432. class: normalizeClass(unref(thumbKls)),
  24433. style: normalizeStyle(unref(thumbStyle)),
  24434. "aria-label": unref(alphaLabel),
  24435. "aria-valuenow": unref(alpha),
  24436. "aria-orientation": _ctx.vertical ? "vertical" : "horizontal",
  24437. "aria-valuemin": "0",
  24438. "aria-valuemax": "100",
  24439. role: "slider",
  24440. tabindex: "0",
  24441. onKeydown: unref(handleKeydown)
  24442. }, null, 46, ["aria-label", "aria-valuenow", "aria-orientation", "onKeydown"])
  24443. ], 2);
  24444. };
  24445. }
  24446. });
  24447. var AlphaSlider = /* @__PURE__ */ _export_sfc(_sfc_main$1I, [["__file", "alpha-slider.vue"]]);
  24448. const _sfc_main$1H = defineComponent({
  24449. name: "ElColorHueSlider",
  24450. props: {
  24451. color: {
  24452. type: Object,
  24453. required: true
  24454. },
  24455. vertical: Boolean
  24456. },
  24457. setup(props) {
  24458. const ns = useNamespace("color-hue-slider");
  24459. const instance = getCurrentInstance();
  24460. const thumb = ref();
  24461. const bar = ref();
  24462. const thumbLeft = ref(0);
  24463. const thumbTop = ref(0);
  24464. const hueValue = computed(() => {
  24465. return props.color.get("hue");
  24466. });
  24467. watch(() => hueValue.value, () => {
  24468. update();
  24469. });
  24470. function handleClick(event) {
  24471. const target = event.target;
  24472. if (target !== thumb.value) {
  24473. handleDrag(event);
  24474. }
  24475. }
  24476. function handleDrag(event) {
  24477. if (!bar.value || !thumb.value)
  24478. return;
  24479. const el = instance.vnode.el;
  24480. const rect = el.getBoundingClientRect();
  24481. const { clientX, clientY } = getClientXY(event);
  24482. let hue;
  24483. if (!props.vertical) {
  24484. let left = clientX - rect.left;
  24485. left = Math.min(left, rect.width - thumb.value.offsetWidth / 2);
  24486. left = Math.max(thumb.value.offsetWidth / 2, left);
  24487. hue = Math.round((left - thumb.value.offsetWidth / 2) / (rect.width - thumb.value.offsetWidth) * 360);
  24488. } else {
  24489. let top = clientY - rect.top;
  24490. top = Math.min(top, rect.height - thumb.value.offsetHeight / 2);
  24491. top = Math.max(thumb.value.offsetHeight / 2, top);
  24492. hue = Math.round((top - thumb.value.offsetHeight / 2) / (rect.height - thumb.value.offsetHeight) * 360);
  24493. }
  24494. props.color.set("hue", hue);
  24495. }
  24496. function getThumbLeft() {
  24497. if (!thumb.value)
  24498. return 0;
  24499. const el = instance.vnode.el;
  24500. if (props.vertical)
  24501. return 0;
  24502. const hue = props.color.get("hue");
  24503. if (!el)
  24504. return 0;
  24505. return Math.round(hue * (el.offsetWidth - thumb.value.offsetWidth / 2) / 360);
  24506. }
  24507. function getThumbTop() {
  24508. if (!thumb.value)
  24509. return 0;
  24510. const el = instance.vnode.el;
  24511. if (!props.vertical)
  24512. return 0;
  24513. const hue = props.color.get("hue");
  24514. if (!el)
  24515. return 0;
  24516. return Math.round(hue * (el.offsetHeight - thumb.value.offsetHeight / 2) / 360);
  24517. }
  24518. function update() {
  24519. thumbLeft.value = getThumbLeft();
  24520. thumbTop.value = getThumbTop();
  24521. }
  24522. onMounted(() => {
  24523. if (!bar.value || !thumb.value)
  24524. return;
  24525. const dragConfig = {
  24526. drag: (event) => {
  24527. handleDrag(event);
  24528. },
  24529. end: (event) => {
  24530. handleDrag(event);
  24531. }
  24532. };
  24533. draggable(bar.value, dragConfig);
  24534. draggable(thumb.value, dragConfig);
  24535. update();
  24536. });
  24537. return {
  24538. bar,
  24539. thumb,
  24540. thumbLeft,
  24541. thumbTop,
  24542. hueValue,
  24543. handleClick,
  24544. update,
  24545. ns
  24546. };
  24547. }
  24548. });
  24549. function _sfc_render$n(_ctx, _cache, $props, $setup, $data, $options) {
  24550. return openBlock(), createElementBlock("div", {
  24551. class: normalizeClass([_ctx.ns.b(), _ctx.ns.is("vertical", _ctx.vertical)])
  24552. }, [
  24553. createElementVNode("div", {
  24554. ref: "bar",
  24555. class: normalizeClass(_ctx.ns.e("bar")),
  24556. onClick: _ctx.handleClick
  24557. }, null, 10, ["onClick"]),
  24558. createElementVNode("div", {
  24559. ref: "thumb",
  24560. class: normalizeClass(_ctx.ns.e("thumb")),
  24561. style: normalizeStyle({
  24562. left: _ctx.thumbLeft + "px",
  24563. top: _ctx.thumbTop + "px"
  24564. })
  24565. }, null, 6)
  24566. ], 2);
  24567. }
  24568. var HueSlider = /* @__PURE__ */ _export_sfc(_sfc_main$1H, [["render", _sfc_render$n], ["__file", "hue-slider.vue"]]);
  24569. const colorPickerProps = buildProps({
  24570. modelValue: String,
  24571. id: String,
  24572. showAlpha: Boolean,
  24573. colorFormat: String,
  24574. disabled: Boolean,
  24575. size: useSizeProp,
  24576. popperClass: {
  24577. type: String,
  24578. default: ""
  24579. },
  24580. tabindex: {
  24581. type: [String, Number],
  24582. default: 0
  24583. },
  24584. teleported: useTooltipContentProps.teleported,
  24585. predefine: {
  24586. type: definePropType(Array)
  24587. },
  24588. validateEvent: {
  24589. type: Boolean,
  24590. default: true
  24591. },
  24592. ...useAriaProps(["ariaLabel"])
  24593. });
  24594. const colorPickerEmits = {
  24595. [UPDATE_MODEL_EVENT]: (val) => isString$1(val) || isNil(val),
  24596. [CHANGE_EVENT]: (val) => isString$1(val) || isNil(val),
  24597. activeChange: (val) => isString$1(val) || isNil(val),
  24598. focus: (evt) => evt instanceof FocusEvent,
  24599. blur: (evt) => evt instanceof FocusEvent
  24600. };
  24601. const colorPickerContextKey = Symbol("colorPickerContextKey");
  24602. const hsv2hsl = function(hue, sat, val) {
  24603. return [
  24604. hue,
  24605. sat * val / ((hue = (2 - sat) * val) < 1 ? hue : 2 - hue) || 0,
  24606. hue / 2
  24607. ];
  24608. };
  24609. const isOnePointZero = function(n) {
  24610. return isString$1(n) && n.includes(".") && Number.parseFloat(n) === 1;
  24611. };
  24612. const isPercentage = function(n) {
  24613. return isString$1(n) && n.includes("%");
  24614. };
  24615. const bound01 = function(value, max) {
  24616. if (isOnePointZero(value))
  24617. value = "100%";
  24618. const processPercent = isPercentage(value);
  24619. value = Math.min(max, Math.max(0, Number.parseFloat(`${value}`)));
  24620. if (processPercent) {
  24621. value = Number.parseInt(`${value * max}`, 10) / 100;
  24622. }
  24623. if (Math.abs(value - max) < 1e-6) {
  24624. return 1;
  24625. }
  24626. return value % max / Number.parseFloat(max);
  24627. };
  24628. const INT_HEX_MAP = {
  24629. 10: "A",
  24630. 11: "B",
  24631. 12: "C",
  24632. 13: "D",
  24633. 14: "E",
  24634. 15: "F"
  24635. };
  24636. const hexOne = (value) => {
  24637. value = Math.min(Math.round(value), 255);
  24638. const high = Math.floor(value / 16);
  24639. const low = value % 16;
  24640. return `${INT_HEX_MAP[high] || high}${INT_HEX_MAP[low] || low}`;
  24641. };
  24642. const toHex = function({ r, g, b }) {
  24643. if (Number.isNaN(+r) || Number.isNaN(+g) || Number.isNaN(+b))
  24644. return "";
  24645. return `#${hexOne(r)}${hexOne(g)}${hexOne(b)}`;
  24646. };
  24647. const HEX_INT_MAP = {
  24648. A: 10,
  24649. B: 11,
  24650. C: 12,
  24651. D: 13,
  24652. E: 14,
  24653. F: 15
  24654. };
  24655. const parseHexChannel = function(hex) {
  24656. if (hex.length === 2) {
  24657. return (HEX_INT_MAP[hex[0].toUpperCase()] || +hex[0]) * 16 + (HEX_INT_MAP[hex[1].toUpperCase()] || +hex[1]);
  24658. }
  24659. return HEX_INT_MAP[hex[1].toUpperCase()] || +hex[1];
  24660. };
  24661. const hsl2hsv = function(hue, sat, light) {
  24662. sat = sat / 100;
  24663. light = light / 100;
  24664. let smin = sat;
  24665. const lmin = Math.max(light, 0.01);
  24666. light *= 2;
  24667. sat *= light <= 1 ? light : 2 - light;
  24668. smin *= lmin <= 1 ? lmin : 2 - lmin;
  24669. const v = (light + sat) / 2;
  24670. const sv = light === 0 ? 2 * smin / (lmin + smin) : 2 * sat / (light + sat);
  24671. return {
  24672. h: hue,
  24673. s: sv * 100,
  24674. v: v * 100
  24675. };
  24676. };
  24677. const rgb2hsv = (r, g, b) => {
  24678. r = bound01(r, 255);
  24679. g = bound01(g, 255);
  24680. b = bound01(b, 255);
  24681. const max = Math.max(r, g, b);
  24682. const min = Math.min(r, g, b);
  24683. let h;
  24684. const v = max;
  24685. const d = max - min;
  24686. const s = max === 0 ? 0 : d / max;
  24687. if (max === min) {
  24688. h = 0;
  24689. } else {
  24690. switch (max) {
  24691. case r: {
  24692. h = (g - b) / d + (g < b ? 6 : 0);
  24693. break;
  24694. }
  24695. case g: {
  24696. h = (b - r) / d + 2;
  24697. break;
  24698. }
  24699. case b: {
  24700. h = (r - g) / d + 4;
  24701. break;
  24702. }
  24703. }
  24704. h /= 6;
  24705. }
  24706. return { h: h * 360, s: s * 100, v: v * 100 };
  24707. };
  24708. const hsv2rgb = function(h, s, v) {
  24709. h = bound01(h, 360) * 6;
  24710. s = bound01(s, 100);
  24711. v = bound01(v, 100);
  24712. const i = Math.floor(h);
  24713. const f = h - i;
  24714. const p = v * (1 - s);
  24715. const q = v * (1 - f * s);
  24716. const t = v * (1 - (1 - f) * s);
  24717. const mod = i % 6;
  24718. const r = [v, q, p, p, t, v][mod];
  24719. const g = [t, v, v, q, p, p][mod];
  24720. const b = [p, p, t, v, v, q][mod];
  24721. return {
  24722. r: Math.round(r * 255),
  24723. g: Math.round(g * 255),
  24724. b: Math.round(b * 255)
  24725. };
  24726. };
  24727. class Color {
  24728. constructor(options = {}) {
  24729. this._hue = 0;
  24730. this._saturation = 100;
  24731. this._value = 100;
  24732. this._alpha = 100;
  24733. this.enableAlpha = false;
  24734. this.format = "hex";
  24735. this.value = "";
  24736. for (const option in options) {
  24737. if (hasOwn(options, option)) {
  24738. this[option] = options[option];
  24739. }
  24740. }
  24741. if (options.value) {
  24742. this.fromString(options.value);
  24743. } else {
  24744. this.doOnChange();
  24745. }
  24746. }
  24747. set(prop, value) {
  24748. if (arguments.length === 1 && typeof prop === "object") {
  24749. for (const p in prop) {
  24750. if (hasOwn(prop, p)) {
  24751. this.set(p, prop[p]);
  24752. }
  24753. }
  24754. return;
  24755. }
  24756. this[`_${prop}`] = value;
  24757. this.doOnChange();
  24758. }
  24759. get(prop) {
  24760. if (prop === "alpha") {
  24761. return Math.floor(this[`_${prop}`]);
  24762. }
  24763. return this[`_${prop}`];
  24764. }
  24765. toRgb() {
  24766. return hsv2rgb(this._hue, this._saturation, this._value);
  24767. }
  24768. fromString(value) {
  24769. if (!value) {
  24770. this._hue = 0;
  24771. this._saturation = 100;
  24772. this._value = 100;
  24773. this.doOnChange();
  24774. return;
  24775. }
  24776. const fromHSV = (h, s, v) => {
  24777. this._hue = Math.max(0, Math.min(360, h));
  24778. this._saturation = Math.max(0, Math.min(100, s));
  24779. this._value = Math.max(0, Math.min(100, v));
  24780. this.doOnChange();
  24781. };
  24782. if (value.includes("hsl")) {
  24783. const parts = value.replace(/hsla|hsl|\(|\)/gm, "").split(/\s|,/g).filter((val) => val !== "").map((val, index) => index > 2 ? Number.parseFloat(val) : Number.parseInt(val, 10));
  24784. if (parts.length === 4) {
  24785. this._alpha = Number.parseFloat(parts[3]) * 100;
  24786. } else if (parts.length === 3) {
  24787. this._alpha = 100;
  24788. }
  24789. if (parts.length >= 3) {
  24790. const { h, s, v } = hsl2hsv(parts[0], parts[1], parts[2]);
  24791. fromHSV(h, s, v);
  24792. }
  24793. } else if (value.includes("hsv")) {
  24794. const parts = value.replace(/hsva|hsv|\(|\)/gm, "").split(/\s|,/g).filter((val) => val !== "").map((val, index) => index > 2 ? Number.parseFloat(val) : Number.parseInt(val, 10));
  24795. if (parts.length === 4) {
  24796. this._alpha = Number.parseFloat(parts[3]) * 100;
  24797. } else if (parts.length === 3) {
  24798. this._alpha = 100;
  24799. }
  24800. if (parts.length >= 3) {
  24801. fromHSV(parts[0], parts[1], parts[2]);
  24802. }
  24803. } else if (value.includes("rgb")) {
  24804. const parts = value.replace(/rgba|rgb|\(|\)/gm, "").split(/\s|,/g).filter((val) => val !== "").map((val, index) => index > 2 ? Number.parseFloat(val) : Number.parseInt(val, 10));
  24805. if (parts.length === 4) {
  24806. this._alpha = Number.parseFloat(parts[3]) * 100;
  24807. } else if (parts.length === 3) {
  24808. this._alpha = 100;
  24809. }
  24810. if (parts.length >= 3) {
  24811. const { h, s, v } = rgb2hsv(parts[0], parts[1], parts[2]);
  24812. fromHSV(h, s, v);
  24813. }
  24814. } else if (value.includes("#")) {
  24815. const hex = value.replace("#", "").trim();
  24816. if (!/^[0-9a-fA-F]{3}$|^[0-9a-fA-F]{6}$|^[0-9a-fA-F]{8}$/.test(hex))
  24817. return;
  24818. let r, g, b;
  24819. if (hex.length === 3) {
  24820. r = parseHexChannel(hex[0] + hex[0]);
  24821. g = parseHexChannel(hex[1] + hex[1]);
  24822. b = parseHexChannel(hex[2] + hex[2]);
  24823. } else if (hex.length === 6 || hex.length === 8) {
  24824. r = parseHexChannel(hex.slice(0, 2));
  24825. g = parseHexChannel(hex.slice(2, 4));
  24826. b = parseHexChannel(hex.slice(4, 6));
  24827. }
  24828. if (hex.length === 8) {
  24829. this._alpha = parseHexChannel(hex.slice(6)) / 255 * 100;
  24830. } else if (hex.length === 3 || hex.length === 6) {
  24831. this._alpha = 100;
  24832. }
  24833. const { h, s, v } = rgb2hsv(r, g, b);
  24834. fromHSV(h, s, v);
  24835. }
  24836. }
  24837. compare(color) {
  24838. return Math.abs(color._hue - this._hue) < 2 && Math.abs(color._saturation - this._saturation) < 1 && Math.abs(color._value - this._value) < 1 && Math.abs(color._alpha - this._alpha) < 1;
  24839. }
  24840. doOnChange() {
  24841. const { _hue, _saturation, _value, _alpha, format } = this;
  24842. if (this.enableAlpha) {
  24843. switch (format) {
  24844. case "hsl": {
  24845. const hsl = hsv2hsl(_hue, _saturation / 100, _value / 100);
  24846. this.value = `hsla(${_hue}, ${Math.round(hsl[1] * 100)}%, ${Math.round(hsl[2] * 100)}%, ${this.get("alpha") / 100})`;
  24847. break;
  24848. }
  24849. case "hsv": {
  24850. this.value = `hsva(${_hue}, ${Math.round(_saturation)}%, ${Math.round(_value)}%, ${this.get("alpha") / 100})`;
  24851. break;
  24852. }
  24853. case "hex": {
  24854. this.value = `${toHex(hsv2rgb(_hue, _saturation, _value))}${hexOne(_alpha * 255 / 100)}`;
  24855. break;
  24856. }
  24857. default: {
  24858. const { r, g, b } = hsv2rgb(_hue, _saturation, _value);
  24859. this.value = `rgba(${r}, ${g}, ${b}, ${this.get("alpha") / 100})`;
  24860. }
  24861. }
  24862. } else {
  24863. switch (format) {
  24864. case "hsl": {
  24865. const hsl = hsv2hsl(_hue, _saturation / 100, _value / 100);
  24866. this.value = `hsl(${_hue}, ${Math.round(hsl[1] * 100)}%, ${Math.round(hsl[2] * 100)}%)`;
  24867. break;
  24868. }
  24869. case "hsv": {
  24870. this.value = `hsv(${_hue}, ${Math.round(_saturation)}%, ${Math.round(_value)}%)`;
  24871. break;
  24872. }
  24873. case "rgb": {
  24874. const { r, g, b } = hsv2rgb(_hue, _saturation, _value);
  24875. this.value = `rgb(${r}, ${g}, ${b})`;
  24876. break;
  24877. }
  24878. default: {
  24879. this.value = toHex(hsv2rgb(_hue, _saturation, _value));
  24880. }
  24881. }
  24882. }
  24883. }
  24884. }
  24885. const _sfc_main$1G = defineComponent({
  24886. props: {
  24887. colors: {
  24888. type: Array,
  24889. required: true
  24890. },
  24891. color: {
  24892. type: Object,
  24893. required: true
  24894. },
  24895. enableAlpha: {
  24896. type: Boolean,
  24897. required: true
  24898. }
  24899. },
  24900. setup(props) {
  24901. const ns = useNamespace("color-predefine");
  24902. const { currentColor } = inject(colorPickerContextKey);
  24903. const rgbaColors = ref(parseColors(props.colors, props.color));
  24904. watch(() => currentColor.value, (val) => {
  24905. const color = new Color();
  24906. color.fromString(val);
  24907. rgbaColors.value.forEach((item) => {
  24908. item.selected = color.compare(item);
  24909. });
  24910. });
  24911. watchEffect(() => {
  24912. rgbaColors.value = parseColors(props.colors, props.color);
  24913. });
  24914. function handleSelect(index) {
  24915. props.color.fromString(props.colors[index]);
  24916. }
  24917. function parseColors(colors, color) {
  24918. return colors.map((value) => {
  24919. const c = new Color();
  24920. c.enableAlpha = props.enableAlpha;
  24921. c.format = "rgba";
  24922. c.fromString(value);
  24923. c.selected = c.value === color.value;
  24924. return c;
  24925. });
  24926. }
  24927. return {
  24928. rgbaColors,
  24929. handleSelect,
  24930. ns
  24931. };
  24932. }
  24933. });
  24934. function _sfc_render$m(_ctx, _cache, $props, $setup, $data, $options) {
  24935. return openBlock(), createElementBlock("div", {
  24936. class: normalizeClass(_ctx.ns.b())
  24937. }, [
  24938. createElementVNode("div", {
  24939. class: normalizeClass(_ctx.ns.e("colors"))
  24940. }, [
  24941. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.rgbaColors, (item, index) => {
  24942. return openBlock(), createElementBlock("div", {
  24943. key: _ctx.colors[index],
  24944. class: normalizeClass([
  24945. _ctx.ns.e("color-selector"),
  24946. _ctx.ns.is("alpha", item._alpha < 100),
  24947. { selected: item.selected }
  24948. ]),
  24949. onClick: ($event) => _ctx.handleSelect(index)
  24950. }, [
  24951. createElementVNode("div", {
  24952. style: normalizeStyle({ backgroundColor: item.value })
  24953. }, null, 4)
  24954. ], 10, ["onClick"]);
  24955. }), 128))
  24956. ], 2)
  24957. ], 2);
  24958. }
  24959. var Predefine = /* @__PURE__ */ _export_sfc(_sfc_main$1G, [["render", _sfc_render$m], ["__file", "predefine.vue"]]);
  24960. const _sfc_main$1F = defineComponent({
  24961. name: "ElSlPanel",
  24962. props: {
  24963. color: {
  24964. type: Object,
  24965. required: true
  24966. }
  24967. },
  24968. setup(props) {
  24969. const ns = useNamespace("color-svpanel");
  24970. const instance = getCurrentInstance();
  24971. const cursorTop = ref(0);
  24972. const cursorLeft = ref(0);
  24973. const background = ref("hsl(0, 100%, 50%)");
  24974. const colorValue = computed(() => {
  24975. const hue = props.color.get("hue");
  24976. const value = props.color.get("value");
  24977. return { hue, value };
  24978. });
  24979. function update() {
  24980. const saturation = props.color.get("saturation");
  24981. const value = props.color.get("value");
  24982. const el = instance.vnode.el;
  24983. const { clientWidth: width, clientHeight: height } = el;
  24984. cursorLeft.value = saturation * width / 100;
  24985. cursorTop.value = (100 - value) * height / 100;
  24986. background.value = `hsl(${props.color.get("hue")}, 100%, 50%)`;
  24987. }
  24988. function handleDrag(event) {
  24989. const el = instance.vnode.el;
  24990. const rect = el.getBoundingClientRect();
  24991. const { clientX, clientY } = getClientXY(event);
  24992. let left = clientX - rect.left;
  24993. let top = clientY - rect.top;
  24994. left = Math.max(0, left);
  24995. left = Math.min(left, rect.width);
  24996. top = Math.max(0, top);
  24997. top = Math.min(top, rect.height);
  24998. cursorLeft.value = left;
  24999. cursorTop.value = top;
  25000. props.color.set({
  25001. saturation: left / rect.width * 100,
  25002. value: 100 - top / rect.height * 100
  25003. });
  25004. }
  25005. watch(() => colorValue.value, () => {
  25006. update();
  25007. });
  25008. onMounted(() => {
  25009. draggable(instance.vnode.el, {
  25010. drag: (event) => {
  25011. handleDrag(event);
  25012. },
  25013. end: (event) => {
  25014. handleDrag(event);
  25015. }
  25016. });
  25017. update();
  25018. });
  25019. return {
  25020. cursorTop,
  25021. cursorLeft,
  25022. background,
  25023. colorValue,
  25024. handleDrag,
  25025. update,
  25026. ns
  25027. };
  25028. }
  25029. });
  25030. function _sfc_render$l(_ctx, _cache, $props, $setup, $data, $options) {
  25031. return openBlock(), createElementBlock("div", {
  25032. class: normalizeClass(_ctx.ns.b()),
  25033. style: normalizeStyle({
  25034. backgroundColor: _ctx.background
  25035. })
  25036. }, [
  25037. createElementVNode("div", {
  25038. class: normalizeClass(_ctx.ns.e("white"))
  25039. }, null, 2),
  25040. createElementVNode("div", {
  25041. class: normalizeClass(_ctx.ns.e("black"))
  25042. }, null, 2),
  25043. createElementVNode("div", {
  25044. class: normalizeClass(_ctx.ns.e("cursor")),
  25045. style: normalizeStyle({
  25046. top: _ctx.cursorTop + "px",
  25047. left: _ctx.cursorLeft + "px"
  25048. })
  25049. }, [
  25050. createElementVNode("div")
  25051. ], 6)
  25052. ], 6);
  25053. }
  25054. var SvPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1F, [["render", _sfc_render$l], ["__file", "sv-panel.vue"]]);
  25055. const __default__$1c = defineComponent({
  25056. name: "ElColorPicker"
  25057. });
  25058. const _sfc_main$1E = /* @__PURE__ */ defineComponent({
  25059. ...__default__$1c,
  25060. props: colorPickerProps,
  25061. emits: colorPickerEmits,
  25062. setup(__props, { expose, emit }) {
  25063. const props = __props;
  25064. const { t } = useLocale();
  25065. const ns = useNamespace("color");
  25066. const { formItem } = useFormItem();
  25067. const colorSize = useFormSize();
  25068. const colorDisabled = useFormDisabled();
  25069. const { inputId: buttonId, isLabeledByFormItem } = useFormItemInputId(props, {
  25070. formItemContext: formItem
  25071. });
  25072. const hue = ref();
  25073. const sv = ref();
  25074. const alpha = ref();
  25075. const popper = ref();
  25076. const triggerRef = ref();
  25077. const inputRef = ref();
  25078. const { isFocused, handleFocus, handleBlur } = useFocusController(triggerRef, {
  25079. beforeFocus() {
  25080. return colorDisabled.value;
  25081. },
  25082. beforeBlur(event) {
  25083. var _a;
  25084. return (_a = popper.value) == null ? void 0 : _a.isFocusInsideContent(event);
  25085. },
  25086. afterBlur() {
  25087. setShowPicker(false);
  25088. resetColor();
  25089. }
  25090. });
  25091. let shouldActiveChange = true;
  25092. const color = reactive(new Color({
  25093. enableAlpha: props.showAlpha,
  25094. format: props.colorFormat || "",
  25095. value: props.modelValue
  25096. }));
  25097. const showPicker = ref(false);
  25098. const showPanelColor = ref(false);
  25099. const customInput = ref("");
  25100. const displayedColor = computed(() => {
  25101. if (!props.modelValue && !showPanelColor.value) {
  25102. return "transparent";
  25103. }
  25104. return displayedRgb(color, props.showAlpha);
  25105. });
  25106. const currentColor = computed(() => {
  25107. return !props.modelValue && !showPanelColor.value ? "" : color.value;
  25108. });
  25109. const buttonAriaLabel = computed(() => {
  25110. return !isLabeledByFormItem.value ? props.ariaLabel || t("el.colorpicker.defaultLabel") : void 0;
  25111. });
  25112. const buttonAriaLabelledby = computed(() => {
  25113. return isLabeledByFormItem.value ? formItem == null ? void 0 : formItem.labelId : void 0;
  25114. });
  25115. const btnKls = computed(() => {
  25116. return [
  25117. ns.b("picker"),
  25118. ns.is("disabled", colorDisabled.value),
  25119. ns.bm("picker", colorSize.value),
  25120. ns.is("focused", isFocused.value)
  25121. ];
  25122. });
  25123. function displayedRgb(color2, showAlpha) {
  25124. if (!(color2 instanceof Color)) {
  25125. throw new TypeError("color should be instance of _color Class");
  25126. }
  25127. const { r, g, b } = color2.toRgb();
  25128. return showAlpha ? `rgba(${r}, ${g}, ${b}, ${color2.get("alpha") / 100})` : `rgb(${r}, ${g}, ${b})`;
  25129. }
  25130. function setShowPicker(value) {
  25131. showPicker.value = value;
  25132. }
  25133. const debounceSetShowPicker = debounce(setShowPicker, 100, { leading: true });
  25134. function show() {
  25135. if (colorDisabled.value)
  25136. return;
  25137. setShowPicker(true);
  25138. }
  25139. function hide() {
  25140. debounceSetShowPicker(false);
  25141. resetColor();
  25142. }
  25143. function resetColor() {
  25144. nextTick(() => {
  25145. if (props.modelValue) {
  25146. color.fromString(props.modelValue);
  25147. } else {
  25148. color.value = "";
  25149. nextTick(() => {
  25150. showPanelColor.value = false;
  25151. });
  25152. }
  25153. });
  25154. }
  25155. function handleTrigger() {
  25156. if (colorDisabled.value)
  25157. return;
  25158. if (showPicker.value) {
  25159. resetColor();
  25160. }
  25161. debounceSetShowPicker(!showPicker.value);
  25162. }
  25163. function handleConfirm() {
  25164. color.fromString(customInput.value);
  25165. }
  25166. function confirmValue() {
  25167. const value = color.value;
  25168. emit(UPDATE_MODEL_EVENT, value);
  25169. emit(CHANGE_EVENT, value);
  25170. if (props.validateEvent) {
  25171. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
  25172. }
  25173. debounceSetShowPicker(false);
  25174. nextTick(() => {
  25175. const newColor = new Color({
  25176. enableAlpha: props.showAlpha,
  25177. format: props.colorFormat || "",
  25178. value: props.modelValue
  25179. });
  25180. if (!color.compare(newColor)) {
  25181. resetColor();
  25182. }
  25183. });
  25184. }
  25185. function clear() {
  25186. debounceSetShowPicker(false);
  25187. emit(UPDATE_MODEL_EVENT, null);
  25188. emit(CHANGE_EVENT, null);
  25189. if (props.modelValue !== null && props.validateEvent) {
  25190. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
  25191. }
  25192. resetColor();
  25193. }
  25194. function handleClickOutside() {
  25195. if (!showPicker.value)
  25196. return;
  25197. hide();
  25198. isFocused.value && focus();
  25199. }
  25200. function handleEsc(event) {
  25201. event.preventDefault();
  25202. event.stopPropagation();
  25203. setShowPicker(false);
  25204. resetColor();
  25205. }
  25206. function handleKeyDown(event) {
  25207. switch (event.code) {
  25208. case EVENT_CODE.enter:
  25209. case EVENT_CODE.numpadEnter:
  25210. case EVENT_CODE.space:
  25211. event.preventDefault();
  25212. event.stopPropagation();
  25213. show();
  25214. inputRef.value.focus();
  25215. break;
  25216. case EVENT_CODE.esc:
  25217. handleEsc(event);
  25218. break;
  25219. }
  25220. }
  25221. function focus() {
  25222. triggerRef.value.focus();
  25223. }
  25224. function blur() {
  25225. triggerRef.value.blur();
  25226. }
  25227. onMounted(() => {
  25228. if (props.modelValue) {
  25229. customInput.value = currentColor.value;
  25230. }
  25231. });
  25232. watch(() => props.modelValue, (newVal) => {
  25233. if (!newVal) {
  25234. showPanelColor.value = false;
  25235. } else if (newVal && newVal !== color.value) {
  25236. shouldActiveChange = false;
  25237. color.fromString(newVal);
  25238. }
  25239. });
  25240. watch(() => [props.colorFormat, props.showAlpha], () => {
  25241. color.enableAlpha = props.showAlpha;
  25242. color.format = props.colorFormat || color.format;
  25243. color.doOnChange();
  25244. emit(UPDATE_MODEL_EVENT, color.value);
  25245. });
  25246. watch(() => currentColor.value, (val) => {
  25247. customInput.value = val;
  25248. shouldActiveChange && emit("activeChange", val);
  25249. shouldActiveChange = true;
  25250. });
  25251. watch(() => color.value, () => {
  25252. if (!props.modelValue && !showPanelColor.value) {
  25253. showPanelColor.value = true;
  25254. }
  25255. });
  25256. watch(() => showPicker.value, () => {
  25257. nextTick(() => {
  25258. var _a, _b, _c;
  25259. (_a = hue.value) == null ? void 0 : _a.update();
  25260. (_b = sv.value) == null ? void 0 : _b.update();
  25261. (_c = alpha.value) == null ? void 0 : _c.update();
  25262. });
  25263. });
  25264. provide(colorPickerContextKey, {
  25265. currentColor
  25266. });
  25267. expose({
  25268. color,
  25269. show,
  25270. hide,
  25271. focus,
  25272. blur
  25273. });
  25274. return (_ctx, _cache) => {
  25275. return openBlock(), createBlock(unref(ElTooltip), {
  25276. ref_key: "popper",
  25277. ref: popper,
  25278. visible: showPicker.value,
  25279. "show-arrow": false,
  25280. "fallback-placements": ["bottom", "top", "right", "left"],
  25281. offset: 0,
  25282. "gpu-acceleration": false,
  25283. "popper-class": [unref(ns).be("picker", "panel"), unref(ns).b("dropdown"), _ctx.popperClass],
  25284. "stop-popper-mouse-event": false,
  25285. effect: "light",
  25286. trigger: "click",
  25287. teleported: _ctx.teleported,
  25288. transition: `${unref(ns).namespace.value}-zoom-in-top`,
  25289. persistent: "",
  25290. onHide: ($event) => setShowPicker(false)
  25291. }, {
  25292. content: withCtx(() => [
  25293. withDirectives((openBlock(), createElementBlock("div", {
  25294. onKeydown: withKeys(handleEsc, ["esc"])
  25295. }, [
  25296. createElementVNode("div", {
  25297. class: normalizeClass(unref(ns).be("dropdown", "main-wrapper"))
  25298. }, [
  25299. createVNode(HueSlider, {
  25300. ref_key: "hue",
  25301. ref: hue,
  25302. class: "hue-slider",
  25303. color: unref(color),
  25304. vertical: ""
  25305. }, null, 8, ["color"]),
  25306. createVNode(SvPanel, {
  25307. ref_key: "sv",
  25308. ref: sv,
  25309. color: unref(color)
  25310. }, null, 8, ["color"])
  25311. ], 2),
  25312. _ctx.showAlpha ? (openBlock(), createBlock(AlphaSlider, {
  25313. key: 0,
  25314. ref_key: "alpha",
  25315. ref: alpha,
  25316. color: unref(color)
  25317. }, null, 8, ["color"])) : createCommentVNode("v-if", true),
  25318. _ctx.predefine ? (openBlock(), createBlock(Predefine, {
  25319. key: 1,
  25320. ref: "predefine",
  25321. "enable-alpha": _ctx.showAlpha,
  25322. color: unref(color),
  25323. colors: _ctx.predefine
  25324. }, null, 8, ["enable-alpha", "color", "colors"])) : createCommentVNode("v-if", true),
  25325. createElementVNode("div", {
  25326. class: normalizeClass(unref(ns).be("dropdown", "btns"))
  25327. }, [
  25328. createElementVNode("span", {
  25329. class: normalizeClass(unref(ns).be("dropdown", "value"))
  25330. }, [
  25331. createVNode(unref(ElInput), {
  25332. ref_key: "inputRef",
  25333. ref: inputRef,
  25334. modelValue: customInput.value,
  25335. "onUpdate:modelValue": ($event) => customInput.value = $event,
  25336. "validate-event": false,
  25337. size: "small",
  25338. onKeyup: withKeys(handleConfirm, ["enter"]),
  25339. onBlur: handleConfirm
  25340. }, null, 8, ["modelValue", "onUpdate:modelValue", "onKeyup"])
  25341. ], 2),
  25342. createVNode(unref(ElButton), {
  25343. class: normalizeClass(unref(ns).be("dropdown", "link-btn")),
  25344. text: "",
  25345. size: "small",
  25346. onClick: clear
  25347. }, {
  25348. default: withCtx(() => [
  25349. createTextVNode(toDisplayString(unref(t)("el.colorpicker.clear")), 1)
  25350. ]),
  25351. _: 1
  25352. }, 8, ["class"]),
  25353. createVNode(unref(ElButton), {
  25354. plain: "",
  25355. size: "small",
  25356. class: normalizeClass(unref(ns).be("dropdown", "btn")),
  25357. onClick: confirmValue
  25358. }, {
  25359. default: withCtx(() => [
  25360. createTextVNode(toDisplayString(unref(t)("el.colorpicker.confirm")), 1)
  25361. ]),
  25362. _: 1
  25363. }, 8, ["class"])
  25364. ], 2)
  25365. ], 40, ["onKeydown"])), [
  25366. [unref(ClickOutside), handleClickOutside, triggerRef.value]
  25367. ])
  25368. ]),
  25369. default: withCtx(() => [
  25370. createElementVNode("div", mergeProps({
  25371. id: unref(buttonId),
  25372. ref_key: "triggerRef",
  25373. ref: triggerRef
  25374. }, _ctx.$attrs, {
  25375. class: unref(btnKls),
  25376. role: "button",
  25377. "aria-label": unref(buttonAriaLabel),
  25378. "aria-labelledby": unref(buttonAriaLabelledby),
  25379. "aria-description": unref(t)("el.colorpicker.description", { color: _ctx.modelValue || "" }),
  25380. "aria-disabled": unref(colorDisabled),
  25381. tabindex: unref(colorDisabled) ? void 0 : _ctx.tabindex,
  25382. onKeydown: handleKeyDown,
  25383. onFocus: unref(handleFocus),
  25384. onBlur: unref(handleBlur)
  25385. }), [
  25386. unref(colorDisabled) ? (openBlock(), createElementBlock("div", {
  25387. key: 0,
  25388. class: normalizeClass(unref(ns).be("picker", "mask"))
  25389. }, null, 2)) : createCommentVNode("v-if", true),
  25390. createElementVNode("div", {
  25391. class: normalizeClass(unref(ns).be("picker", "trigger")),
  25392. onClick: handleTrigger
  25393. }, [
  25394. createElementVNode("span", {
  25395. class: normalizeClass([unref(ns).be("picker", "color"), unref(ns).is("alpha", _ctx.showAlpha)])
  25396. }, [
  25397. createElementVNode("span", {
  25398. class: normalizeClass(unref(ns).be("picker", "color-inner")),
  25399. style: normalizeStyle({
  25400. backgroundColor: unref(displayedColor)
  25401. })
  25402. }, [
  25403. withDirectives(createVNode(unref(ElIcon), {
  25404. class: normalizeClass([unref(ns).be("picker", "icon"), unref(ns).is("icon-arrow-down")])
  25405. }, {
  25406. default: withCtx(() => [
  25407. createVNode(unref(arrow_down_default))
  25408. ]),
  25409. _: 1
  25410. }, 8, ["class"]), [
  25411. [vShow, _ctx.modelValue || showPanelColor.value]
  25412. ]),
  25413. withDirectives(createVNode(unref(ElIcon), {
  25414. class: normalizeClass([unref(ns).be("picker", "empty"), unref(ns).is("icon-close")])
  25415. }, {
  25416. default: withCtx(() => [
  25417. createVNode(unref(close_default))
  25418. ]),
  25419. _: 1
  25420. }, 8, ["class"]), [
  25421. [vShow, !_ctx.modelValue && !showPanelColor.value]
  25422. ])
  25423. ], 6)
  25424. ], 2)
  25425. ], 2)
  25426. ], 16, ["id", "aria-label", "aria-labelledby", "aria-description", "aria-disabled", "tabindex", "onFocus", "onBlur"])
  25427. ]),
  25428. _: 1
  25429. }, 8, ["visible", "popper-class", "teleported", "transition", "onHide"]);
  25430. };
  25431. }
  25432. });
  25433. var ColorPicker = /* @__PURE__ */ _export_sfc(_sfc_main$1E, [["__file", "color-picker.vue"]]);
  25434. const ElColorPicker = withInstall(ColorPicker);
  25435. const __default__$1b = defineComponent({
  25436. name: "ElContainer"
  25437. });
  25438. const _sfc_main$1D = /* @__PURE__ */ defineComponent({
  25439. ...__default__$1b,
  25440. props: {
  25441. direction: {
  25442. type: String
  25443. }
  25444. },
  25445. setup(__props) {
  25446. const props = __props;
  25447. const slots = useSlots();
  25448. const ns = useNamespace("container");
  25449. const isVertical = computed(() => {
  25450. if (props.direction === "vertical") {
  25451. return true;
  25452. } else if (props.direction === "horizontal") {
  25453. return false;
  25454. }
  25455. if (slots && slots.default) {
  25456. const vNodes = slots.default();
  25457. return vNodes.some((vNode) => {
  25458. const tag = vNode.type.name;
  25459. return tag === "ElHeader" || tag === "ElFooter";
  25460. });
  25461. } else {
  25462. return false;
  25463. }
  25464. });
  25465. return (_ctx, _cache) => {
  25466. return openBlock(), createElementBlock("section", {
  25467. class: normalizeClass([unref(ns).b(), unref(ns).is("vertical", unref(isVertical))])
  25468. }, [
  25469. renderSlot(_ctx.$slots, "default")
  25470. ], 2);
  25471. };
  25472. }
  25473. });
  25474. var Container = /* @__PURE__ */ _export_sfc(_sfc_main$1D, [["__file", "container.vue"]]);
  25475. const __default__$1a = defineComponent({
  25476. name: "ElAside"
  25477. });
  25478. const _sfc_main$1C = /* @__PURE__ */ defineComponent({
  25479. ...__default__$1a,
  25480. props: {
  25481. width: {
  25482. type: String,
  25483. default: null
  25484. }
  25485. },
  25486. setup(__props) {
  25487. const props = __props;
  25488. const ns = useNamespace("aside");
  25489. const style = computed(() => props.width ? ns.cssVarBlock({ width: props.width }) : {});
  25490. return (_ctx, _cache) => {
  25491. return openBlock(), createElementBlock("aside", {
  25492. class: normalizeClass(unref(ns).b()),
  25493. style: normalizeStyle(unref(style))
  25494. }, [
  25495. renderSlot(_ctx.$slots, "default")
  25496. ], 6);
  25497. };
  25498. }
  25499. });
  25500. var Aside = /* @__PURE__ */ _export_sfc(_sfc_main$1C, [["__file", "aside.vue"]]);
  25501. const __default__$19 = defineComponent({
  25502. name: "ElFooter"
  25503. });
  25504. const _sfc_main$1B = /* @__PURE__ */ defineComponent({
  25505. ...__default__$19,
  25506. props: {
  25507. height: {
  25508. type: String,
  25509. default: null
  25510. }
  25511. },
  25512. setup(__props) {
  25513. const props = __props;
  25514. const ns = useNamespace("footer");
  25515. const style = computed(() => props.height ? ns.cssVarBlock({ height: props.height }) : {});
  25516. return (_ctx, _cache) => {
  25517. return openBlock(), createElementBlock("footer", {
  25518. class: normalizeClass(unref(ns).b()),
  25519. style: normalizeStyle(unref(style))
  25520. }, [
  25521. renderSlot(_ctx.$slots, "default")
  25522. ], 6);
  25523. };
  25524. }
  25525. });
  25526. var Footer$2 = /* @__PURE__ */ _export_sfc(_sfc_main$1B, [["__file", "footer.vue"]]);
  25527. const __default__$18 = defineComponent({
  25528. name: "ElHeader"
  25529. });
  25530. const _sfc_main$1A = /* @__PURE__ */ defineComponent({
  25531. ...__default__$18,
  25532. props: {
  25533. height: {
  25534. type: String,
  25535. default: null
  25536. }
  25537. },
  25538. setup(__props) {
  25539. const props = __props;
  25540. const ns = useNamespace("header");
  25541. const style = computed(() => {
  25542. return props.height ? ns.cssVarBlock({
  25543. height: props.height
  25544. }) : {};
  25545. });
  25546. return (_ctx, _cache) => {
  25547. return openBlock(), createElementBlock("header", {
  25548. class: normalizeClass(unref(ns).b()),
  25549. style: normalizeStyle(unref(style))
  25550. }, [
  25551. renderSlot(_ctx.$slots, "default")
  25552. ], 6);
  25553. };
  25554. }
  25555. });
  25556. var Header$1 = /* @__PURE__ */ _export_sfc(_sfc_main$1A, [["__file", "header.vue"]]);
  25557. const __default__$17 = defineComponent({
  25558. name: "ElMain"
  25559. });
  25560. const _sfc_main$1z = /* @__PURE__ */ defineComponent({
  25561. ...__default__$17,
  25562. setup(__props) {
  25563. const ns = useNamespace("main");
  25564. return (_ctx, _cache) => {
  25565. return openBlock(), createElementBlock("main", {
  25566. class: normalizeClass(unref(ns).b())
  25567. }, [
  25568. renderSlot(_ctx.$slots, "default")
  25569. ], 2);
  25570. };
  25571. }
  25572. });
  25573. var Main = /* @__PURE__ */ _export_sfc(_sfc_main$1z, [["__file", "main.vue"]]);
  25574. const ElContainer = withInstall(Container, {
  25575. Aside,
  25576. Footer: Footer$2,
  25577. Header: Header$1,
  25578. Main
  25579. });
  25580. const ElAside = withNoopInstall(Aside);
  25581. const ElFooter = withNoopInstall(Footer$2);
  25582. const ElHeader = withNoopInstall(Header$1);
  25583. const ElMain = withNoopInstall(Main);
  25584. var advancedFormat$1 = {exports: {}};
  25585. (function(module, exports) {
  25586. !function(e, t) {
  25587. module.exports = t() ;
  25588. }(commonjsGlobal, function() {
  25589. return function(e, t) {
  25590. var r = t.prototype, n = r.format;
  25591. r.format = function(e2) {
  25592. var t2 = this, r2 = this.$locale();
  25593. if (!this.isValid())
  25594. return n.bind(this)(e2);
  25595. 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) {
  25596. switch (e3) {
  25597. case "Q":
  25598. return Math.ceil((t2.$M + 1) / 3);
  25599. case "Do":
  25600. return r2.ordinal(t2.$D);
  25601. case "gggg":
  25602. return t2.weekYear();
  25603. case "GGGG":
  25604. return t2.isoWeekYear();
  25605. case "wo":
  25606. return r2.ordinal(t2.week(), "W");
  25607. case "w":
  25608. case "ww":
  25609. return s.s(t2.week(), e3 === "w" ? 1 : 2, "0");
  25610. case "W":
  25611. case "WW":
  25612. return s.s(t2.isoWeek(), e3 === "W" ? 1 : 2, "0");
  25613. case "k":
  25614. case "kk":
  25615. return s.s(String(t2.$H === 0 ? 24 : t2.$H), e3 === "k" ? 1 : 2, "0");
  25616. case "X":
  25617. return Math.floor(t2.$d.getTime() / 1e3);
  25618. case "x":
  25619. return t2.$d.getTime();
  25620. case "z":
  25621. return "[" + t2.offsetName() + "]";
  25622. case "zzz":
  25623. return "[" + t2.offsetName("long") + "]";
  25624. default:
  25625. return e3;
  25626. }
  25627. });
  25628. return n.bind(this)(a);
  25629. };
  25630. };
  25631. });
  25632. })(advancedFormat$1);
  25633. var advancedFormat = advancedFormat$1.exports;
  25634. var weekOfYear$1 = {exports: {}};
  25635. (function(module, exports) {
  25636. !function(e, t) {
  25637. module.exports = t() ;
  25638. }(commonjsGlobal, function() {
  25639. var e = "week", t = "year";
  25640. return function(i, n, r) {
  25641. var f = n.prototype;
  25642. f.week = function(i2) {
  25643. if (i2 === void 0 && (i2 = null), i2 !== null)
  25644. return this.add(7 * (i2 - this.week()), "day");
  25645. var n2 = this.$locale().yearStart || 1;
  25646. if (this.month() === 11 && this.date() > 25) {
  25647. var f2 = r(this).startOf(t).add(1, t).date(n2), s = r(this).endOf(e);
  25648. if (f2.isBefore(s))
  25649. return 1;
  25650. }
  25651. var a = r(this).startOf(t).date(n2).startOf(e).subtract(1, "millisecond"), o = this.diff(a, e, true);
  25652. return o < 0 ? r(this).startOf("week").week() : Math.ceil(o);
  25653. }, f.weeks = function(e2) {
  25654. return e2 === void 0 && (e2 = null), this.week(e2);
  25655. };
  25656. };
  25657. });
  25658. })(weekOfYear$1);
  25659. var weekOfYear = weekOfYear$1.exports;
  25660. var weekYear$1 = {exports: {}};
  25661. (function(module, exports) {
  25662. !function(e, t) {
  25663. module.exports = t() ;
  25664. }(commonjsGlobal, function() {
  25665. return function(e, t) {
  25666. t.prototype.weekYear = function() {
  25667. var e2 = this.month(), t2 = this.week(), n = this.year();
  25668. return t2 === 1 && e2 === 11 ? n + 1 : e2 === 0 && t2 >= 52 ? n - 1 : n;
  25669. };
  25670. };
  25671. });
  25672. })(weekYear$1);
  25673. var weekYear = weekYear$1.exports;
  25674. var dayOfYear$1 = {exports: {}};
  25675. (function(module, exports) {
  25676. !function(e, t) {
  25677. module.exports = t() ;
  25678. }(commonjsGlobal, function() {
  25679. return function(e, t, n) {
  25680. t.prototype.dayOfYear = function(e2) {
  25681. var t2 = Math.round((n(this).startOf("day") - n(this).startOf("year")) / 864e5) + 1;
  25682. return e2 == null ? t2 : this.add(e2 - t2, "day");
  25683. };
  25684. };
  25685. });
  25686. })(dayOfYear$1);
  25687. var dayOfYear = dayOfYear$1.exports;
  25688. var isSameOrAfter$1 = {exports: {}};
  25689. (function(module, exports) {
  25690. !function(e, t) {
  25691. module.exports = t() ;
  25692. }(commonjsGlobal, function() {
  25693. return function(e, t) {
  25694. t.prototype.isSameOrAfter = function(e2, t2) {
  25695. return this.isSame(e2, t2) || this.isAfter(e2, t2);
  25696. };
  25697. };
  25698. });
  25699. })(isSameOrAfter$1);
  25700. var isSameOrAfter = isSameOrAfter$1.exports;
  25701. var isSameOrBefore$1 = {exports: {}};
  25702. (function(module, exports) {
  25703. !function(e, i) {
  25704. module.exports = i() ;
  25705. }(commonjsGlobal, function() {
  25706. return function(e, i) {
  25707. i.prototype.isSameOrBefore = function(e2, i2) {
  25708. return this.isSame(e2, i2) || this.isBefore(e2, i2);
  25709. };
  25710. };
  25711. });
  25712. })(isSameOrBefore$1);
  25713. var isSameOrBefore = isSameOrBefore$1.exports;
  25714. const ROOT_PICKER_INJECTION_KEY = Symbol();
  25715. const datePickerProps = buildProps({
  25716. ...timePickerDefaultProps,
  25717. type: {
  25718. type: definePropType(String),
  25719. default: "date"
  25720. }
  25721. });
  25722. const selectionModes = [
  25723. "date",
  25724. "dates",
  25725. "year",
  25726. "years",
  25727. "month",
  25728. "months",
  25729. "week",
  25730. "range"
  25731. ];
  25732. const datePickerSharedProps = buildProps({
  25733. disabledDate: {
  25734. type: definePropType(Function)
  25735. },
  25736. date: {
  25737. type: definePropType(Object),
  25738. required: true
  25739. },
  25740. minDate: {
  25741. type: definePropType(Object)
  25742. },
  25743. maxDate: {
  25744. type: definePropType(Object)
  25745. },
  25746. parsedValue: {
  25747. type: definePropType([Object, Array])
  25748. },
  25749. rangeState: {
  25750. type: definePropType(Object),
  25751. default: () => ({
  25752. endDate: null,
  25753. selecting: false
  25754. })
  25755. }
  25756. });
  25757. const panelSharedProps = buildProps({
  25758. type: {
  25759. type: definePropType(String),
  25760. required: true,
  25761. values: datePickTypes
  25762. },
  25763. dateFormat: String,
  25764. timeFormat: String,
  25765. showNow: {
  25766. type: Boolean,
  25767. default: true
  25768. }
  25769. });
  25770. const panelRangeSharedProps = buildProps({
  25771. unlinkPanels: Boolean,
  25772. parsedValue: {
  25773. type: definePropType(Array)
  25774. }
  25775. });
  25776. const selectionModeWithDefault = (mode) => {
  25777. return {
  25778. type: String,
  25779. values: selectionModes,
  25780. default: mode
  25781. };
  25782. };
  25783. const panelDatePickProps = buildProps({
  25784. ...panelSharedProps,
  25785. parsedValue: {
  25786. type: definePropType([Object, Array])
  25787. },
  25788. visible: {
  25789. type: Boolean
  25790. },
  25791. format: {
  25792. type: String,
  25793. default: ""
  25794. }
  25795. });
  25796. const isValidRange = (range) => {
  25797. if (!isArray$1(range))
  25798. return false;
  25799. const [left, right] = range;
  25800. return dayjs.isDayjs(left) && dayjs.isDayjs(right) && dayjs(left).isValid() && dayjs(right).isValid() && left.isSameOrBefore(right);
  25801. };
  25802. const getDefaultValue = (defaultValue, { lang, unit, unlinkPanels }) => {
  25803. let start;
  25804. if (isArray$1(defaultValue)) {
  25805. let [left, right] = defaultValue.map((d) => dayjs(d).locale(lang));
  25806. if (!unlinkPanels) {
  25807. right = left.add(1, unit);
  25808. }
  25809. return [left, right];
  25810. } else if (defaultValue) {
  25811. start = dayjs(defaultValue);
  25812. } else {
  25813. start = dayjs();
  25814. }
  25815. start = start.locale(lang);
  25816. return [start, start.add(1, unit)];
  25817. };
  25818. const buildPickerTable = (dimension, rows, {
  25819. columnIndexOffset,
  25820. startDate,
  25821. nextEndDate,
  25822. now,
  25823. unit,
  25824. relativeDateGetter,
  25825. setCellMetadata,
  25826. setRowMetadata
  25827. }) => {
  25828. for (let rowIndex = 0; rowIndex < dimension.row; rowIndex++) {
  25829. const row = rows[rowIndex];
  25830. for (let columnIndex = 0; columnIndex < dimension.column; columnIndex++) {
  25831. let cell = row[columnIndex + columnIndexOffset];
  25832. if (!cell) {
  25833. cell = {
  25834. row: rowIndex,
  25835. column: columnIndex,
  25836. type: "normal",
  25837. inRange: false,
  25838. start: false,
  25839. end: false
  25840. };
  25841. }
  25842. const index = rowIndex * dimension.column + columnIndex;
  25843. const nextStartDate = relativeDateGetter(index);
  25844. cell.dayjs = nextStartDate;
  25845. cell.date = nextStartDate.toDate();
  25846. cell.timestamp = nextStartDate.valueOf();
  25847. cell.type = "normal";
  25848. cell.inRange = !!(startDate && nextStartDate.isSameOrAfter(startDate, unit) && nextEndDate && nextStartDate.isSameOrBefore(nextEndDate, unit)) || !!(startDate && nextStartDate.isSameOrBefore(startDate, unit) && nextEndDate && nextStartDate.isSameOrAfter(nextEndDate, unit));
  25849. if (startDate == null ? void 0 : startDate.isSameOrAfter(nextEndDate)) {
  25850. cell.start = !!nextEndDate && nextStartDate.isSame(nextEndDate, unit);
  25851. cell.end = startDate && nextStartDate.isSame(startDate, unit);
  25852. } else {
  25853. cell.start = !!startDate && nextStartDate.isSame(startDate, unit);
  25854. cell.end = !!nextEndDate && nextStartDate.isSame(nextEndDate, unit);
  25855. }
  25856. const isToday = nextStartDate.isSame(now, unit);
  25857. if (isToday) {
  25858. cell.type = "today";
  25859. }
  25860. setCellMetadata == null ? void 0 : setCellMetadata(cell, { rowIndex, columnIndex });
  25861. row[columnIndex + columnIndexOffset] = cell;
  25862. }
  25863. setRowMetadata == null ? void 0 : setRowMetadata(row);
  25864. }
  25865. };
  25866. const datesInMonth = (year, month, lang) => {
  25867. const firstDay = dayjs().locale(lang).startOf("month").month(month).year(year);
  25868. const numOfDays = firstDay.daysInMonth();
  25869. return rangeArr(numOfDays).map((n) => firstDay.add(n, "day").toDate());
  25870. };
  25871. const getValidDateOfMonth = (year, month, lang, disabledDate) => {
  25872. const _value = dayjs().year(year).month(month).startOf("month");
  25873. const _date = datesInMonth(year, month, lang).find((date) => {
  25874. return !(disabledDate == null ? void 0 : disabledDate(date));
  25875. });
  25876. if (_date) {
  25877. return dayjs(_date).locale(lang);
  25878. }
  25879. return _value.locale(lang);
  25880. };
  25881. const getValidDateOfYear = (value, lang, disabledDate) => {
  25882. const year = value.year();
  25883. if (!(disabledDate == null ? void 0 : disabledDate(value.toDate()))) {
  25884. return value.locale(lang);
  25885. }
  25886. const month = value.month();
  25887. if (!datesInMonth(year, month, lang).every(disabledDate)) {
  25888. return getValidDateOfMonth(year, month, lang, disabledDate);
  25889. }
  25890. for (let i = 0; i < 12; i++) {
  25891. if (!datesInMonth(year, i, lang).every(disabledDate)) {
  25892. return getValidDateOfMonth(year, i, lang, disabledDate);
  25893. }
  25894. }
  25895. return value;
  25896. };
  25897. const correctlyParseUserInput = (value, format, lang, defaultFormat) => {
  25898. if (isArray$1(value)) {
  25899. return value.map((v) => correctlyParseUserInput(v, format, lang, defaultFormat));
  25900. }
  25901. if (isString$1(value)) {
  25902. const dayjsValue = defaultFormat.value ? dayjs(value) : dayjs(value, format);
  25903. if (!dayjsValue.isValid()) {
  25904. return dayjsValue;
  25905. }
  25906. }
  25907. return dayjs(value, format).locale(lang);
  25908. };
  25909. const basicDateTableProps = buildProps({
  25910. ...datePickerSharedProps,
  25911. cellClassName: {
  25912. type: definePropType(Function)
  25913. },
  25914. showWeekNumber: Boolean,
  25915. selectionMode: selectionModeWithDefault("date")
  25916. });
  25917. const basicDateTableEmits = ["changerange", "pick", "select"];
  25918. const isNormalDay = (type = "") => {
  25919. return ["normal", "today"].includes(type);
  25920. };
  25921. const useBasicDateTable = (props, emit) => {
  25922. const { lang } = useLocale();
  25923. const tbodyRef = ref();
  25924. const currentCellRef = ref();
  25925. const lastRow = ref();
  25926. const lastColumn = ref();
  25927. const tableRows = ref([[], [], [], [], [], []]);
  25928. let focusWithClick = false;
  25929. const firstDayOfWeek = props.date.$locale().weekStart || 7;
  25930. const WEEKS_CONSTANT = props.date.locale("en").localeData().weekdaysShort().map((_) => _.toLowerCase());
  25931. const offsetDay = computed(() => {
  25932. return firstDayOfWeek > 3 ? 7 - firstDayOfWeek : -firstDayOfWeek;
  25933. });
  25934. const startDate = computed(() => {
  25935. const startDayOfMonth = props.date.startOf("month");
  25936. return startDayOfMonth.subtract(startDayOfMonth.day() || 7, "day");
  25937. });
  25938. const WEEKS = computed(() => {
  25939. return WEEKS_CONSTANT.concat(WEEKS_CONSTANT).slice(firstDayOfWeek, firstDayOfWeek + 7);
  25940. });
  25941. const hasCurrent = computed(() => {
  25942. return flatten(unref(rows)).some((row) => {
  25943. return row.isCurrent;
  25944. });
  25945. });
  25946. const days = computed(() => {
  25947. const startOfMonth = props.date.startOf("month");
  25948. const startOfMonthDay = startOfMonth.day() || 7;
  25949. const dateCountOfMonth = startOfMonth.daysInMonth();
  25950. const dateCountOfLastMonth = startOfMonth.subtract(1, "month").daysInMonth();
  25951. return {
  25952. startOfMonthDay,
  25953. dateCountOfMonth,
  25954. dateCountOfLastMonth
  25955. };
  25956. });
  25957. const selectedDate = computed(() => {
  25958. return props.selectionMode === "dates" ? castArray(props.parsedValue) : [];
  25959. });
  25960. const setDateText = (cell, { count, rowIndex, columnIndex }) => {
  25961. const { startOfMonthDay, dateCountOfMonth, dateCountOfLastMonth } = unref(days);
  25962. const offset = unref(offsetDay);
  25963. if (rowIndex >= 0 && rowIndex <= 1) {
  25964. const numberOfDaysFromPreviousMonth = startOfMonthDay + offset < 0 ? 7 + startOfMonthDay + offset : startOfMonthDay + offset;
  25965. if (columnIndex + rowIndex * 7 >= numberOfDaysFromPreviousMonth) {
  25966. cell.text = count;
  25967. return true;
  25968. } else {
  25969. cell.text = dateCountOfLastMonth - (numberOfDaysFromPreviousMonth - columnIndex % 7) + 1 + rowIndex * 7;
  25970. cell.type = "prev-month";
  25971. }
  25972. } else {
  25973. if (count <= dateCountOfMonth) {
  25974. cell.text = count;
  25975. } else {
  25976. cell.text = count - dateCountOfMonth;
  25977. cell.type = "next-month";
  25978. }
  25979. return true;
  25980. }
  25981. return false;
  25982. };
  25983. const setCellMetadata = (cell, { columnIndex, rowIndex }, count) => {
  25984. const { disabledDate, cellClassName } = props;
  25985. const _selectedDate = unref(selectedDate);
  25986. const shouldIncrement = setDateText(cell, { count, rowIndex, columnIndex });
  25987. const cellDate = cell.dayjs.toDate();
  25988. cell.selected = _selectedDate.find((d) => d.isSame(cell.dayjs, "day"));
  25989. cell.isSelected = !!cell.selected;
  25990. cell.isCurrent = isCurrent(cell);
  25991. cell.disabled = disabledDate == null ? void 0 : disabledDate(cellDate);
  25992. cell.customClass = cellClassName == null ? void 0 : cellClassName(cellDate);
  25993. return shouldIncrement;
  25994. };
  25995. const setRowMetadata = (row) => {
  25996. if (props.selectionMode === "week") {
  25997. const [start, end] = props.showWeekNumber ? [1, 7] : [0, 6];
  25998. const isActive = isWeekActive(row[start + 1]);
  25999. row[start].inRange = isActive;
  26000. row[start].start = isActive;
  26001. row[end].inRange = isActive;
  26002. row[end].end = isActive;
  26003. }
  26004. };
  26005. const rows = computed(() => {
  26006. const { minDate, maxDate, rangeState, showWeekNumber } = props;
  26007. const offset = unref(offsetDay);
  26008. const rows_ = unref(tableRows);
  26009. const dateUnit = "day";
  26010. let count = 1;
  26011. if (showWeekNumber) {
  26012. for (let rowIndex = 0; rowIndex < 6; rowIndex++) {
  26013. if (!rows_[rowIndex][0]) {
  26014. rows_[rowIndex][0] = {
  26015. type: "week",
  26016. text: unref(startDate).add(rowIndex * 7 + 1, dateUnit).week()
  26017. };
  26018. }
  26019. }
  26020. }
  26021. buildPickerTable({ row: 6, column: 7 }, rows_, {
  26022. startDate: minDate,
  26023. columnIndexOffset: showWeekNumber ? 1 : 0,
  26024. nextEndDate: rangeState.endDate || maxDate || rangeState.selecting && minDate || null,
  26025. now: dayjs().locale(unref(lang)).startOf(dateUnit),
  26026. unit: dateUnit,
  26027. relativeDateGetter: (idx) => unref(startDate).add(idx - offset, dateUnit),
  26028. setCellMetadata: (...args) => {
  26029. if (setCellMetadata(...args, count)) {
  26030. count += 1;
  26031. }
  26032. },
  26033. setRowMetadata
  26034. });
  26035. return rows_;
  26036. });
  26037. watch(() => props.date, async () => {
  26038. var _a;
  26039. if ((_a = unref(tbodyRef)) == null ? void 0 : _a.contains(document.activeElement)) {
  26040. await nextTick();
  26041. await focus();
  26042. }
  26043. });
  26044. const focus = async () => {
  26045. var _a;
  26046. return (_a = unref(currentCellRef)) == null ? void 0 : _a.focus();
  26047. };
  26048. const isCurrent = (cell) => {
  26049. return props.selectionMode === "date" && isNormalDay(cell.type) && cellMatchesDate(cell, props.parsedValue);
  26050. };
  26051. const cellMatchesDate = (cell, date) => {
  26052. if (!date)
  26053. return false;
  26054. return dayjs(date).locale(unref(lang)).isSame(props.date.date(Number(cell.text)), "day");
  26055. };
  26056. const getDateOfCell = (row, column) => {
  26057. const offsetFromStart = row * 7 + (column - (props.showWeekNumber ? 1 : 0)) - unref(offsetDay);
  26058. return unref(startDate).add(offsetFromStart, "day");
  26059. };
  26060. const handleMouseMove = (event) => {
  26061. var _a;
  26062. if (!props.rangeState.selecting)
  26063. return;
  26064. let target = event.target;
  26065. if (target.tagName === "SPAN") {
  26066. target = (_a = target.parentNode) == null ? void 0 : _a.parentNode;
  26067. }
  26068. if (target.tagName === "DIV") {
  26069. target = target.parentNode;
  26070. }
  26071. if (target.tagName !== "TD")
  26072. return;
  26073. const row = target.parentNode.rowIndex - 1;
  26074. const column = target.cellIndex;
  26075. if (unref(rows)[row][column].disabled)
  26076. return;
  26077. if (row !== unref(lastRow) || column !== unref(lastColumn)) {
  26078. lastRow.value = row;
  26079. lastColumn.value = column;
  26080. emit("changerange", {
  26081. selecting: true,
  26082. endDate: getDateOfCell(row, column)
  26083. });
  26084. }
  26085. };
  26086. const isSelectedCell = (cell) => {
  26087. return !unref(hasCurrent) && (cell == null ? void 0 : cell.text) === 1 && cell.type === "normal" || cell.isCurrent;
  26088. };
  26089. const handleFocus = (event) => {
  26090. if (focusWithClick || unref(hasCurrent) || props.selectionMode !== "date")
  26091. return;
  26092. handlePickDate(event, true);
  26093. };
  26094. const handleMouseDown = (event) => {
  26095. const target = event.target.closest("td");
  26096. if (!target)
  26097. return;
  26098. focusWithClick = true;
  26099. };
  26100. const handleMouseUp = (event) => {
  26101. const target = event.target.closest("td");
  26102. if (!target)
  26103. return;
  26104. focusWithClick = false;
  26105. };
  26106. const handleRangePick = (newDate) => {
  26107. if (!props.rangeState.selecting || !props.minDate) {
  26108. emit("pick", { minDate: newDate, maxDate: null });
  26109. emit("select", true);
  26110. } else {
  26111. if (newDate >= props.minDate) {
  26112. emit("pick", { minDate: props.minDate, maxDate: newDate });
  26113. } else {
  26114. emit("pick", { minDate: newDate, maxDate: props.minDate });
  26115. }
  26116. emit("select", false);
  26117. }
  26118. };
  26119. const handleWeekPick = (newDate) => {
  26120. const weekNumber = newDate.week();
  26121. const value = `${newDate.year()}w${weekNumber}`;
  26122. emit("pick", {
  26123. year: newDate.year(),
  26124. week: weekNumber,
  26125. value,
  26126. date: newDate.startOf("week")
  26127. });
  26128. };
  26129. const handleDatesPick = (newDate, selected) => {
  26130. const newValue = selected ? castArray(props.parsedValue).filter((d) => (d == null ? void 0 : d.valueOf()) !== newDate.valueOf()) : castArray(props.parsedValue).concat([newDate]);
  26131. emit("pick", newValue);
  26132. };
  26133. const handlePickDate = (event, isKeyboardMovement = false) => {
  26134. const target = event.target.closest("td");
  26135. if (!target)
  26136. return;
  26137. const row = target.parentNode.rowIndex - 1;
  26138. const column = target.cellIndex;
  26139. const cell = unref(rows)[row][column];
  26140. if (cell.disabled || cell.type === "week")
  26141. return;
  26142. const newDate = getDateOfCell(row, column);
  26143. switch (props.selectionMode) {
  26144. case "range": {
  26145. handleRangePick(newDate);
  26146. break;
  26147. }
  26148. case "date": {
  26149. emit("pick", newDate, isKeyboardMovement);
  26150. break;
  26151. }
  26152. case "week": {
  26153. handleWeekPick(newDate);
  26154. break;
  26155. }
  26156. case "dates": {
  26157. handleDatesPick(newDate, !!cell.selected);
  26158. break;
  26159. }
  26160. }
  26161. };
  26162. const isWeekActive = (cell) => {
  26163. if (props.selectionMode !== "week")
  26164. return false;
  26165. let newDate = props.date.startOf("day");
  26166. if (cell.type === "prev-month") {
  26167. newDate = newDate.subtract(1, "month");
  26168. }
  26169. if (cell.type === "next-month") {
  26170. newDate = newDate.add(1, "month");
  26171. }
  26172. newDate = newDate.date(Number.parseInt(cell.text, 10));
  26173. if (props.parsedValue && !isArray$1(props.parsedValue)) {
  26174. const dayOffset = (props.parsedValue.day() - firstDayOfWeek + 7) % 7 - 1;
  26175. const weekDate = props.parsedValue.subtract(dayOffset, "day");
  26176. return weekDate.isSame(newDate, "day");
  26177. }
  26178. return false;
  26179. };
  26180. return {
  26181. WEEKS,
  26182. rows,
  26183. tbodyRef,
  26184. currentCellRef,
  26185. focus,
  26186. isCurrent,
  26187. isWeekActive,
  26188. isSelectedCell,
  26189. handlePickDate,
  26190. handleMouseUp,
  26191. handleMouseDown,
  26192. handleMouseMove,
  26193. handleFocus
  26194. };
  26195. };
  26196. const useBasicDateTableDOM = (props, {
  26197. isCurrent,
  26198. isWeekActive
  26199. }) => {
  26200. const ns = useNamespace("date-table");
  26201. const { t } = useLocale();
  26202. const tableKls = computed(() => [
  26203. ns.b(),
  26204. { "is-week-mode": props.selectionMode === "week" }
  26205. ]);
  26206. const tableLabel = computed(() => t("el.datepicker.dateTablePrompt"));
  26207. const weekLabel = computed(() => t("el.datepicker.week"));
  26208. const getCellClasses = (cell) => {
  26209. const classes = [];
  26210. if (isNormalDay(cell.type) && !cell.disabled) {
  26211. classes.push("available");
  26212. if (cell.type === "today") {
  26213. classes.push("today");
  26214. }
  26215. } else {
  26216. classes.push(cell.type);
  26217. }
  26218. if (isCurrent(cell)) {
  26219. classes.push("current");
  26220. }
  26221. if (cell.inRange && (isNormalDay(cell.type) || props.selectionMode === "week")) {
  26222. classes.push("in-range");
  26223. if (cell.start) {
  26224. classes.push("start-date");
  26225. }
  26226. if (cell.end) {
  26227. classes.push("end-date");
  26228. }
  26229. }
  26230. if (cell.disabled) {
  26231. classes.push("disabled");
  26232. }
  26233. if (cell.selected) {
  26234. classes.push("selected");
  26235. }
  26236. if (cell.customClass) {
  26237. classes.push(cell.customClass);
  26238. }
  26239. return classes.join(" ");
  26240. };
  26241. const getRowKls = (cell) => [
  26242. ns.e("row"),
  26243. { current: isWeekActive(cell) }
  26244. ];
  26245. return {
  26246. tableKls,
  26247. tableLabel,
  26248. weekLabel,
  26249. getCellClasses,
  26250. getRowKls,
  26251. t
  26252. };
  26253. };
  26254. const basicCellProps = buildProps({
  26255. cell: {
  26256. type: definePropType(Object)
  26257. }
  26258. });
  26259. var ElDatePickerCell = defineComponent({
  26260. name: "ElDatePickerCell",
  26261. props: basicCellProps,
  26262. setup(props) {
  26263. const ns = useNamespace("date-table-cell");
  26264. const {
  26265. slots
  26266. } = inject(ROOT_PICKER_INJECTION_KEY);
  26267. return () => {
  26268. const {
  26269. cell
  26270. } = props;
  26271. return renderSlot(slots, "default", {
  26272. ...cell
  26273. }, () => {
  26274. var _a;
  26275. return [createVNode("div", {
  26276. "class": ns.b()
  26277. }, [createVNode("span", {
  26278. "class": ns.e("text")
  26279. }, [(_a = cell == null ? void 0 : cell.renderText) != null ? _a : cell == null ? void 0 : cell.text])])];
  26280. });
  26281. };
  26282. }
  26283. });
  26284. const _sfc_main$1y = /* @__PURE__ */ defineComponent({
  26285. __name: "basic-date-table",
  26286. props: basicDateTableProps,
  26287. emits: basicDateTableEmits,
  26288. setup(__props, { expose, emit }) {
  26289. const props = __props;
  26290. const {
  26291. WEEKS,
  26292. rows,
  26293. tbodyRef,
  26294. currentCellRef,
  26295. focus,
  26296. isCurrent,
  26297. isWeekActive,
  26298. isSelectedCell,
  26299. handlePickDate,
  26300. handleMouseUp,
  26301. handleMouseDown,
  26302. handleMouseMove,
  26303. handleFocus
  26304. } = useBasicDateTable(props, emit);
  26305. const { tableLabel, tableKls, weekLabel, getCellClasses, getRowKls, t } = useBasicDateTableDOM(props, {
  26306. isCurrent,
  26307. isWeekActive
  26308. });
  26309. let isUnmounting = false;
  26310. onBeforeUnmount(() => {
  26311. isUnmounting = true;
  26312. });
  26313. expose({
  26314. focus
  26315. });
  26316. return (_ctx, _cache) => {
  26317. return openBlock(), createElementBlock("table", {
  26318. "aria-label": unref(tableLabel),
  26319. class: normalizeClass(unref(tableKls)),
  26320. cellspacing: "0",
  26321. cellpadding: "0",
  26322. role: "grid",
  26323. onClick: unref(handlePickDate),
  26324. onMousemove: unref(handleMouseMove),
  26325. onMousedown: withModifiers(unref(handleMouseDown), ["prevent"]),
  26326. onMouseup: unref(handleMouseUp)
  26327. }, [
  26328. createElementVNode("tbody", {
  26329. ref_key: "tbodyRef",
  26330. ref: tbodyRef
  26331. }, [
  26332. createElementVNode("tr", null, [
  26333. _ctx.showWeekNumber ? (openBlock(), createElementBlock("th", {
  26334. key: 0,
  26335. scope: "col"
  26336. }, toDisplayString(unref(weekLabel)), 1)) : createCommentVNode("v-if", true),
  26337. (openBlock(true), createElementBlock(Fragment, null, renderList(unref(WEEKS), (week, key) => {
  26338. return openBlock(), createElementBlock("th", {
  26339. key,
  26340. "aria-label": unref(t)("el.datepicker.weeksFull." + week),
  26341. scope: "col"
  26342. }, toDisplayString(unref(t)("el.datepicker.weeks." + week)), 9, ["aria-label"]);
  26343. }), 128))
  26344. ]),
  26345. (openBlock(true), createElementBlock(Fragment, null, renderList(unref(rows), (row, rowKey) => {
  26346. return openBlock(), createElementBlock("tr", {
  26347. key: rowKey,
  26348. class: normalizeClass(unref(getRowKls)(row[1]))
  26349. }, [
  26350. (openBlock(true), createElementBlock(Fragment, null, renderList(row, (cell, columnKey) => {
  26351. return openBlock(), createElementBlock("td", {
  26352. key: `${rowKey}.${columnKey}`,
  26353. ref_for: true,
  26354. ref: (el) => !unref(isUnmounting) && unref(isSelectedCell)(cell) && (currentCellRef.value = el),
  26355. class: normalizeClass(unref(getCellClasses)(cell)),
  26356. "aria-current": cell.isCurrent ? "date" : void 0,
  26357. "aria-selected": cell.isCurrent,
  26358. tabindex: unref(isSelectedCell)(cell) ? 0 : -1,
  26359. onFocus: unref(handleFocus)
  26360. }, [
  26361. createVNode(unref(ElDatePickerCell), { cell }, null, 8, ["cell"])
  26362. ], 42, ["aria-current", "aria-selected", "tabindex", "onFocus"]);
  26363. }), 128))
  26364. ], 2);
  26365. }), 128))
  26366. ], 512)
  26367. ], 42, ["aria-label", "onClick", "onMousemove", "onMousedown", "onMouseup"]);
  26368. };
  26369. }
  26370. });
  26371. var DateTable = /* @__PURE__ */ _export_sfc(_sfc_main$1y, [["__file", "basic-date-table.vue"]]);
  26372. const basicMonthTableProps = buildProps({
  26373. ...datePickerSharedProps,
  26374. selectionMode: selectionModeWithDefault("month")
  26375. });
  26376. const _sfc_main$1x = /* @__PURE__ */ defineComponent({
  26377. __name: "basic-month-table",
  26378. props: basicMonthTableProps,
  26379. emits: ["changerange", "pick", "select"],
  26380. setup(__props, { expose, emit }) {
  26381. const props = __props;
  26382. const ns = useNamespace("month-table");
  26383. const { t, lang } = useLocale();
  26384. const tbodyRef = ref();
  26385. const currentCellRef = ref();
  26386. const months = ref(props.date.locale("en").localeData().monthsShort().map((_) => _.toLowerCase()));
  26387. const tableRows = ref([
  26388. [],
  26389. [],
  26390. []
  26391. ]);
  26392. const lastRow = ref();
  26393. const lastColumn = ref();
  26394. const rows = computed(() => {
  26395. var _a, _b;
  26396. const rows2 = tableRows.value;
  26397. const now = dayjs().locale(lang.value).startOf("month");
  26398. for (let i = 0; i < 3; i++) {
  26399. const row = rows2[i];
  26400. for (let j = 0; j < 4; j++) {
  26401. const cell = row[j] || (row[j] = {
  26402. row: i,
  26403. column: j,
  26404. type: "normal",
  26405. inRange: false,
  26406. start: false,
  26407. end: false,
  26408. text: -1,
  26409. disabled: false
  26410. });
  26411. cell.type = "normal";
  26412. const index = i * 4 + j;
  26413. const calTime = props.date.startOf("year").month(index);
  26414. const calEndDate = props.rangeState.endDate || props.maxDate || props.rangeState.selecting && props.minDate || null;
  26415. 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"));
  26416. if ((_a = props.minDate) == null ? void 0 : _a.isSameOrAfter(calEndDate)) {
  26417. cell.start = !!(calEndDate && calTime.isSame(calEndDate, "month"));
  26418. cell.end = props.minDate && calTime.isSame(props.minDate, "month");
  26419. } else {
  26420. cell.start = !!(props.minDate && calTime.isSame(props.minDate, "month"));
  26421. cell.end = !!(calEndDate && calTime.isSame(calEndDate, "month"));
  26422. }
  26423. const isToday = now.isSame(calTime);
  26424. if (isToday) {
  26425. cell.type = "today";
  26426. }
  26427. cell.text = index;
  26428. cell.disabled = ((_b = props.disabledDate) == null ? void 0 : _b.call(props, calTime.toDate())) || false;
  26429. }
  26430. }
  26431. return rows2;
  26432. });
  26433. const focus = () => {
  26434. var _a;
  26435. (_a = currentCellRef.value) == null ? void 0 : _a.focus();
  26436. };
  26437. const getCellStyle = (cell) => {
  26438. const style = {};
  26439. const year = props.date.year();
  26440. const today = /* @__PURE__ */ new Date();
  26441. const month = cell.text;
  26442. style.disabled = props.disabledDate ? datesInMonth(year, month, lang.value).every(props.disabledDate) : false;
  26443. style.current = castArray(props.parsedValue).findIndex((date) => dayjs.isDayjs(date) && date.year() === year && date.month() === month) >= 0;
  26444. style.today = today.getFullYear() === year && today.getMonth() === month;
  26445. if (cell.inRange) {
  26446. style["in-range"] = true;
  26447. if (cell.start) {
  26448. style["start-date"] = true;
  26449. }
  26450. if (cell.end) {
  26451. style["end-date"] = true;
  26452. }
  26453. }
  26454. return style;
  26455. };
  26456. const isSelectedCell = (cell) => {
  26457. const year = props.date.year();
  26458. const month = cell.text;
  26459. return castArray(props.date).findIndex((date) => date.year() === year && date.month() === month) >= 0;
  26460. };
  26461. const handleMouseMove = (event) => {
  26462. var _a;
  26463. if (!props.rangeState.selecting)
  26464. return;
  26465. let target = event.target;
  26466. if (target.tagName === "SPAN") {
  26467. target = (_a = target.parentNode) == null ? void 0 : _a.parentNode;
  26468. }
  26469. if (target.tagName === "DIV") {
  26470. target = target.parentNode;
  26471. }
  26472. if (target.tagName !== "TD")
  26473. return;
  26474. const row = target.parentNode.rowIndex;
  26475. const column = target.cellIndex;
  26476. if (rows.value[row][column].disabled)
  26477. return;
  26478. if (row !== lastRow.value || column !== lastColumn.value) {
  26479. lastRow.value = row;
  26480. lastColumn.value = column;
  26481. emit("changerange", {
  26482. selecting: true,
  26483. endDate: props.date.startOf("year").month(row * 4 + column)
  26484. });
  26485. }
  26486. };
  26487. const handleMonthTableClick = (event) => {
  26488. var _a;
  26489. const target = (_a = event.target) == null ? void 0 : _a.closest("td");
  26490. if ((target == null ? void 0 : target.tagName) !== "TD")
  26491. return;
  26492. if (hasClass(target, "disabled"))
  26493. return;
  26494. const column = target.cellIndex;
  26495. const row = target.parentNode.rowIndex;
  26496. const month = row * 4 + column;
  26497. const newDate = props.date.startOf("year").month(month);
  26498. if (props.selectionMode === "months") {
  26499. if (event.type === "keydown") {
  26500. emit("pick", castArray(props.parsedValue), false);
  26501. return;
  26502. }
  26503. const newMonth = getValidDateOfMonth(props.date.year(), month, lang.value, props.disabledDate);
  26504. 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)]);
  26505. emit("pick", newValue);
  26506. } else if (props.selectionMode === "range") {
  26507. if (!props.rangeState.selecting) {
  26508. emit("pick", { minDate: newDate, maxDate: null });
  26509. emit("select", true);
  26510. } else {
  26511. if (props.minDate && newDate >= props.minDate) {
  26512. emit("pick", { minDate: props.minDate, maxDate: newDate });
  26513. } else {
  26514. emit("pick", { minDate: newDate, maxDate: props.minDate });
  26515. }
  26516. emit("select", false);
  26517. }
  26518. } else {
  26519. emit("pick", month);
  26520. }
  26521. };
  26522. watch(() => props.date, async () => {
  26523. var _a, _b;
  26524. if ((_a = tbodyRef.value) == null ? void 0 : _a.contains(document.activeElement)) {
  26525. await nextTick();
  26526. (_b = currentCellRef.value) == null ? void 0 : _b.focus();
  26527. }
  26528. });
  26529. expose({
  26530. focus
  26531. });
  26532. return (_ctx, _cache) => {
  26533. return openBlock(), createElementBlock("table", {
  26534. role: "grid",
  26535. "aria-label": unref(t)("el.datepicker.monthTablePrompt"),
  26536. class: normalizeClass(unref(ns).b()),
  26537. onClick: handleMonthTableClick,
  26538. onMousemove: handleMouseMove
  26539. }, [
  26540. createElementVNode("tbody", {
  26541. ref_key: "tbodyRef",
  26542. ref: tbodyRef
  26543. }, [
  26544. (openBlock(true), createElementBlock(Fragment, null, renderList(unref(rows), (row, key) => {
  26545. return openBlock(), createElementBlock("tr", { key }, [
  26546. (openBlock(true), createElementBlock(Fragment, null, renderList(row, (cell, key_) => {
  26547. return openBlock(), createElementBlock("td", {
  26548. key: key_,
  26549. ref_for: true,
  26550. ref: (el) => isSelectedCell(cell) && (currentCellRef.value = el),
  26551. class: normalizeClass(getCellStyle(cell)),
  26552. "aria-selected": `${isSelectedCell(cell)}`,
  26553. "aria-label": unref(t)(`el.datepicker.month${+cell.text + 1}`),
  26554. tabindex: isSelectedCell(cell) ? 0 : -1,
  26555. onKeydown: [
  26556. withKeys(withModifiers(handleMonthTableClick, ["prevent", "stop"]), ["space"]),
  26557. withKeys(withModifiers(handleMonthTableClick, ["prevent", "stop"]), ["enter"])
  26558. ]
  26559. }, [
  26560. createVNode(unref(ElDatePickerCell), {
  26561. cell: {
  26562. ...cell,
  26563. renderText: unref(t)("el.datepicker.months." + months.value[cell.text])
  26564. }
  26565. }, null, 8, ["cell"])
  26566. ], 42, ["aria-selected", "aria-label", "tabindex", "onKeydown"]);
  26567. }), 128))
  26568. ]);
  26569. }), 128))
  26570. ], 512)
  26571. ], 42, ["aria-label"]);
  26572. };
  26573. }
  26574. });
  26575. var MonthTable = /* @__PURE__ */ _export_sfc(_sfc_main$1x, [["__file", "basic-month-table.vue"]]);
  26576. const basicYearTableProps = buildProps({
  26577. ...datePickerSharedProps,
  26578. selectionMode: selectionModeWithDefault("year")
  26579. });
  26580. const _sfc_main$1w = /* @__PURE__ */ defineComponent({
  26581. __name: "basic-year-table",
  26582. props: basicYearTableProps,
  26583. emits: ["changerange", "pick", "select"],
  26584. setup(__props, { expose, emit }) {
  26585. const props = __props;
  26586. const datesInYear = (year, lang2) => {
  26587. const firstDay = dayjs(String(year)).locale(lang2).startOf("year");
  26588. const lastDay = firstDay.endOf("year");
  26589. const numOfDays = lastDay.dayOfYear();
  26590. return rangeArr(numOfDays).map((n) => firstDay.add(n, "day").toDate());
  26591. };
  26592. const ns = useNamespace("year-table");
  26593. const { t, lang } = useLocale();
  26594. const tbodyRef = ref();
  26595. const currentCellRef = ref();
  26596. const startYear = computed(() => {
  26597. return Math.floor(props.date.year() / 10) * 10;
  26598. });
  26599. const tableRows = ref([[], [], []]);
  26600. const lastRow = ref();
  26601. const lastColumn = ref();
  26602. const rows = computed(() => {
  26603. var _a;
  26604. const rows2 = tableRows.value;
  26605. const now = dayjs().locale(lang.value).startOf("year");
  26606. for (let i = 0; i < 3; i++) {
  26607. const row = rows2[i];
  26608. for (let j = 0; j < 4; j++) {
  26609. if (i * 4 + j >= 10) {
  26610. break;
  26611. }
  26612. let cell = row[j];
  26613. if (!cell) {
  26614. cell = {
  26615. row: i,
  26616. column: j,
  26617. type: "normal",
  26618. inRange: false,
  26619. start: false,
  26620. end: false,
  26621. text: -1,
  26622. disabled: false
  26623. };
  26624. }
  26625. cell.type = "normal";
  26626. const index = i * 4 + j + startYear.value;
  26627. const calTime = dayjs().year(index);
  26628. const calEndDate = props.rangeState.endDate || props.maxDate || props.rangeState.selecting && props.minDate || null;
  26629. 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"));
  26630. if ((_a = props.minDate) == null ? void 0 : _a.isSameOrAfter(calEndDate)) {
  26631. cell.start = !!(calEndDate && calTime.isSame(calEndDate, "year"));
  26632. cell.end = !!(props.minDate && calTime.isSame(props.minDate, "year"));
  26633. } else {
  26634. cell.start = !!(props.minDate && calTime.isSame(props.minDate, "year"));
  26635. cell.end = !!(calEndDate && calTime.isSame(calEndDate, "year"));
  26636. }
  26637. const isToday = now.isSame(calTime);
  26638. if (isToday) {
  26639. cell.type = "today";
  26640. }
  26641. cell.text = index;
  26642. const cellDate = calTime.toDate();
  26643. cell.disabled = props.disabledDate && props.disabledDate(cellDate) || false;
  26644. row[j] = cell;
  26645. }
  26646. }
  26647. return rows2;
  26648. });
  26649. const focus = () => {
  26650. var _a;
  26651. (_a = currentCellRef.value) == null ? void 0 : _a.focus();
  26652. };
  26653. const getCellKls = (cell) => {
  26654. const kls = {};
  26655. const today = dayjs().locale(lang.value);
  26656. const year = cell.text;
  26657. kls.disabled = props.disabledDate ? datesInYear(year, lang.value).every(props.disabledDate) : false;
  26658. kls.today = today.year() === year;
  26659. kls.current = castArray(props.parsedValue).findIndex((d) => d.year() === year) >= 0;
  26660. if (cell.inRange) {
  26661. kls["in-range"] = true;
  26662. if (cell.start) {
  26663. kls["start-date"] = true;
  26664. }
  26665. if (cell.end) {
  26666. kls["end-date"] = true;
  26667. }
  26668. }
  26669. return kls;
  26670. };
  26671. const isSelectedCell = (cell) => {
  26672. const year = cell.text;
  26673. return castArray(props.date).findIndex((date) => date.year() === year) >= 0;
  26674. };
  26675. const handleYearTableClick = (event) => {
  26676. var _a;
  26677. const target = (_a = event.target) == null ? void 0 : _a.closest("td");
  26678. if (!target || !target.textContent || hasClass(target, "disabled"))
  26679. return;
  26680. const column = target.cellIndex;
  26681. const row = target.parentNode.rowIndex;
  26682. const selectedYear = row * 4 + column + startYear.value;
  26683. const newDate = dayjs().year(selectedYear);
  26684. if (props.selectionMode === "range") {
  26685. if (!props.rangeState.selecting) {
  26686. emit("pick", { minDate: newDate, maxDate: null });
  26687. emit("select", true);
  26688. } else {
  26689. if (props.minDate && newDate >= props.minDate) {
  26690. emit("pick", { minDate: props.minDate, maxDate: newDate });
  26691. } else {
  26692. emit("pick", { minDate: newDate, maxDate: props.minDate });
  26693. }
  26694. emit("select", false);
  26695. }
  26696. } else if (props.selectionMode === "years") {
  26697. if (event.type === "keydown") {
  26698. emit("pick", castArray(props.parsedValue), false);
  26699. return;
  26700. }
  26701. const vaildYear = getValidDateOfYear(newDate.startOf("year"), lang.value, props.disabledDate);
  26702. const newValue = hasClass(target, "current") ? castArray(props.parsedValue).filter((d) => (d == null ? void 0 : d.year()) !== selectedYear) : castArray(props.parsedValue).concat([vaildYear]);
  26703. emit("pick", newValue);
  26704. } else {
  26705. emit("pick", selectedYear);
  26706. }
  26707. };
  26708. const handleMouseMove = (event) => {
  26709. var _a;
  26710. if (!props.rangeState.selecting)
  26711. return;
  26712. const target = (_a = event.target) == null ? void 0 : _a.closest("td");
  26713. if (!target)
  26714. return;
  26715. const row = target.parentNode.rowIndex;
  26716. const column = target.cellIndex;
  26717. if (rows.value[row][column].disabled)
  26718. return;
  26719. if (row !== lastRow.value || column !== lastColumn.value) {
  26720. lastRow.value = row;
  26721. lastColumn.value = column;
  26722. emit("changerange", {
  26723. selecting: true,
  26724. endDate: dayjs().year(startYear.value).add(row * 4 + column, "year")
  26725. });
  26726. }
  26727. };
  26728. watch(() => props.date, async () => {
  26729. var _a, _b;
  26730. if ((_a = tbodyRef.value) == null ? void 0 : _a.contains(document.activeElement)) {
  26731. await nextTick();
  26732. (_b = currentCellRef.value) == null ? void 0 : _b.focus();
  26733. }
  26734. });
  26735. expose({
  26736. focus
  26737. });
  26738. return (_ctx, _cache) => {
  26739. return openBlock(), createElementBlock("table", {
  26740. role: "grid",
  26741. "aria-label": unref(t)("el.datepicker.yearTablePrompt"),
  26742. class: normalizeClass(unref(ns).b()),
  26743. onClick: handleYearTableClick,
  26744. onMousemove: handleMouseMove
  26745. }, [
  26746. createElementVNode("tbody", {
  26747. ref_key: "tbodyRef",
  26748. ref: tbodyRef
  26749. }, [
  26750. (openBlock(true), createElementBlock(Fragment, null, renderList(unref(rows), (row, rowKey) => {
  26751. return openBlock(), createElementBlock("tr", { key: rowKey }, [
  26752. (openBlock(true), createElementBlock(Fragment, null, renderList(row, (cell, cellKey) => {
  26753. return openBlock(), createElementBlock("td", {
  26754. key: `${rowKey}_${cellKey}`,
  26755. ref_for: true,
  26756. ref: (el) => isSelectedCell(cell) && (currentCellRef.value = el),
  26757. class: normalizeClass(["available", getCellKls(cell)]),
  26758. "aria-selected": isSelectedCell(cell),
  26759. "aria-label": String(cell.text),
  26760. tabindex: isSelectedCell(cell) ? 0 : -1,
  26761. onKeydown: [
  26762. withKeys(withModifiers(handleYearTableClick, ["prevent", "stop"]), ["space"]),
  26763. withKeys(withModifiers(handleYearTableClick, ["prevent", "stop"]), ["enter"])
  26764. ]
  26765. }, [
  26766. createVNode(unref(ElDatePickerCell), { cell }, null, 8, ["cell"])
  26767. ], 42, ["aria-selected", "aria-label", "tabindex", "onKeydown"]);
  26768. }), 128))
  26769. ]);
  26770. }), 128))
  26771. ], 512)
  26772. ], 42, ["aria-label"]);
  26773. };
  26774. }
  26775. });
  26776. var YearTable = /* @__PURE__ */ _export_sfc(_sfc_main$1w, [["__file", "basic-year-table.vue"]]);
  26777. const _sfc_main$1v = /* @__PURE__ */ defineComponent({
  26778. __name: "panel-date-pick",
  26779. props: panelDatePickProps,
  26780. emits: ["pick", "set-picker-option", "panel-change"],
  26781. setup(__props, { emit: contextEmit }) {
  26782. const props = __props;
  26783. const timeWithinRange = (_, __, ___) => true;
  26784. const ppNs = useNamespace("picker-panel");
  26785. const dpNs = useNamespace("date-picker");
  26786. const attrs = useAttrs$1();
  26787. const slots = useSlots();
  26788. const { t, lang } = useLocale();
  26789. const pickerBase = inject("EP_PICKER_BASE");
  26790. const isDefaultFormat = inject("ElIsDefaultFormat");
  26791. const popper = inject(TOOLTIP_INJECTION_KEY);
  26792. const { shortcuts, disabledDate, cellClassName, defaultTime } = pickerBase.props;
  26793. const defaultValue = toRef(pickerBase.props, "defaultValue");
  26794. const currentViewRef = ref();
  26795. const innerDate = ref(dayjs().locale(lang.value));
  26796. const isChangeToNow = ref(false);
  26797. let isShortcut = false;
  26798. const defaultTimeD = computed(() => {
  26799. return dayjs(defaultTime).locale(lang.value);
  26800. });
  26801. const month = computed(() => {
  26802. return innerDate.value.month();
  26803. });
  26804. const year = computed(() => {
  26805. return innerDate.value.year();
  26806. });
  26807. const selectableRange = ref([]);
  26808. const userInputDate = ref(null);
  26809. const userInputTime = ref(null);
  26810. const checkDateWithinRange = (date) => {
  26811. return selectableRange.value.length > 0 ? timeWithinRange(date, selectableRange.value, props.format || "HH:mm:ss") : true;
  26812. };
  26813. const formatEmit = (emitDayjs) => {
  26814. if (defaultTime && !visibleTime.value && !isChangeToNow.value && !isShortcut) {
  26815. return defaultTimeD.value.year(emitDayjs.year()).month(emitDayjs.month()).date(emitDayjs.date());
  26816. }
  26817. if (showTime.value)
  26818. return emitDayjs.millisecond(0);
  26819. return emitDayjs.startOf("day");
  26820. };
  26821. const emit = (value, ...args) => {
  26822. if (!value) {
  26823. contextEmit("pick", value, ...args);
  26824. } else if (isArray$1(value)) {
  26825. const dates = value.map(formatEmit);
  26826. contextEmit("pick", dates, ...args);
  26827. } else {
  26828. contextEmit("pick", formatEmit(value), ...args);
  26829. }
  26830. userInputDate.value = null;
  26831. userInputTime.value = null;
  26832. isChangeToNow.value = false;
  26833. isShortcut = false;
  26834. };
  26835. const handleDatePick = async (value, keepOpen) => {
  26836. if (selectionMode.value === "date") {
  26837. value = value;
  26838. let newDate = props.parsedValue ? props.parsedValue.year(value.year()).month(value.month()).date(value.date()) : value;
  26839. if (!checkDateWithinRange(newDate)) {
  26840. newDate = selectableRange.value[0][0].year(value.year()).month(value.month()).date(value.date());
  26841. }
  26842. innerDate.value = newDate;
  26843. emit(newDate, showTime.value || keepOpen);
  26844. if (props.type === "datetime") {
  26845. await nextTick();
  26846. handleFocusPicker();
  26847. }
  26848. } else if (selectionMode.value === "week") {
  26849. emit(value.date);
  26850. } else if (selectionMode.value === "dates") {
  26851. emit(value, true);
  26852. }
  26853. };
  26854. const moveByMonth = (forward) => {
  26855. const action = forward ? "add" : "subtract";
  26856. innerDate.value = innerDate.value[action](1, "month");
  26857. handlePanelChange("month");
  26858. };
  26859. const moveByYear = (forward) => {
  26860. const currentDate = innerDate.value;
  26861. const action = forward ? "add" : "subtract";
  26862. innerDate.value = currentView.value === "year" ? currentDate[action](10, "year") : currentDate[action](1, "year");
  26863. handlePanelChange("year");
  26864. };
  26865. const currentView = ref("date");
  26866. const yearLabel = computed(() => {
  26867. const yearTranslation = t("el.datepicker.year");
  26868. if (currentView.value === "year") {
  26869. const startYear = Math.floor(year.value / 10) * 10;
  26870. if (yearTranslation) {
  26871. return `${startYear} ${yearTranslation} - ${startYear + 9} ${yearTranslation}`;
  26872. }
  26873. return `${startYear} - ${startYear + 9}`;
  26874. }
  26875. return `${year.value} ${yearTranslation}`;
  26876. });
  26877. const handleShortcutClick = (shortcut) => {
  26878. const shortcutValue = isFunction$1(shortcut.value) ? shortcut.value() : shortcut.value;
  26879. if (shortcutValue) {
  26880. isShortcut = true;
  26881. emit(dayjs(shortcutValue).locale(lang.value));
  26882. return;
  26883. }
  26884. if (shortcut.onClick) {
  26885. shortcut.onClick({
  26886. attrs,
  26887. slots,
  26888. emit: contextEmit
  26889. });
  26890. }
  26891. };
  26892. const selectionMode = computed(() => {
  26893. const { type } = props;
  26894. if (["week", "month", "months", "year", "years", "dates"].includes(type))
  26895. return type;
  26896. return "date";
  26897. });
  26898. const isMultipleType = computed(() => {
  26899. return selectionMode.value === "dates" || selectionMode.value === "months" || selectionMode.value === "years";
  26900. });
  26901. const keyboardMode = computed(() => {
  26902. return selectionMode.value === "date" ? currentView.value : selectionMode.value;
  26903. });
  26904. const hasShortcuts = computed(() => !!shortcuts.length);
  26905. const handleMonthPick = async (month2, keepOpen) => {
  26906. if (selectionMode.value === "month") {
  26907. innerDate.value = getValidDateOfMonth(innerDate.value.year(), month2, lang.value, disabledDate);
  26908. emit(innerDate.value, false);
  26909. } else if (selectionMode.value === "months") {
  26910. emit(month2, keepOpen != null ? keepOpen : true);
  26911. } else {
  26912. innerDate.value = getValidDateOfMonth(innerDate.value.year(), month2, lang.value, disabledDate);
  26913. currentView.value = "date";
  26914. if (["month", "year", "date", "week"].includes(selectionMode.value)) {
  26915. emit(innerDate.value, true);
  26916. await nextTick();
  26917. handleFocusPicker();
  26918. }
  26919. }
  26920. handlePanelChange("month");
  26921. };
  26922. const handleYearPick = async (year2, keepOpen) => {
  26923. if (selectionMode.value === "year") {
  26924. const data = innerDate.value.startOf("year").year(year2);
  26925. innerDate.value = getValidDateOfYear(data, lang.value, disabledDate);
  26926. emit(innerDate.value, false);
  26927. } else if (selectionMode.value === "years") {
  26928. emit(year2, keepOpen != null ? keepOpen : true);
  26929. } else {
  26930. const data = innerDate.value.year(year2);
  26931. innerDate.value = getValidDateOfYear(data, lang.value, disabledDate);
  26932. currentView.value = "month";
  26933. if (["month", "year", "date", "week"].includes(selectionMode.value)) {
  26934. emit(innerDate.value, true);
  26935. await nextTick();
  26936. handleFocusPicker();
  26937. }
  26938. }
  26939. handlePanelChange("year");
  26940. };
  26941. const showPicker = async (view) => {
  26942. currentView.value = view;
  26943. await nextTick();
  26944. handleFocusPicker();
  26945. };
  26946. const showTime = computed(() => props.type === "datetime" || props.type === "datetimerange");
  26947. const footerVisible = computed(() => {
  26948. const showDateFooter = showTime.value || selectionMode.value === "dates";
  26949. const showYearFooter = selectionMode.value === "years";
  26950. const showMonthFooter = selectionMode.value === "months";
  26951. const isDateView = currentView.value === "date";
  26952. const isYearView = currentView.value === "year";
  26953. const isMonthView = currentView.value === "month";
  26954. return showDateFooter && isDateView || showYearFooter && isYearView || showMonthFooter && isMonthView;
  26955. });
  26956. const disabledConfirm = computed(() => {
  26957. if (!disabledDate)
  26958. return false;
  26959. if (!props.parsedValue)
  26960. return true;
  26961. if (isArray$1(props.parsedValue)) {
  26962. return disabledDate(props.parsedValue[0].toDate());
  26963. }
  26964. return disabledDate(props.parsedValue.toDate());
  26965. });
  26966. const onConfirm = () => {
  26967. if (isMultipleType.value) {
  26968. emit(props.parsedValue);
  26969. } else {
  26970. let result = props.parsedValue;
  26971. if (!result) {
  26972. const defaultTimeD2 = dayjs(defaultTime).locale(lang.value);
  26973. const defaultValueD = getDefaultValue();
  26974. result = defaultTimeD2.year(defaultValueD.year()).month(defaultValueD.month()).date(defaultValueD.date());
  26975. }
  26976. innerDate.value = result;
  26977. emit(result);
  26978. }
  26979. };
  26980. const disabledNow = computed(() => {
  26981. if (!disabledDate)
  26982. return false;
  26983. return disabledDate(dayjs().locale(lang.value).toDate());
  26984. });
  26985. const changeToNow = () => {
  26986. const now = dayjs().locale(lang.value);
  26987. const nowDate = now.toDate();
  26988. isChangeToNow.value = true;
  26989. if ((!disabledDate || !disabledDate(nowDate)) && checkDateWithinRange(nowDate)) {
  26990. innerDate.value = dayjs().locale(lang.value);
  26991. emit(innerDate.value);
  26992. }
  26993. };
  26994. const timeFormat = computed(() => {
  26995. return props.timeFormat || extractTimeFormat(props.format);
  26996. });
  26997. const dateFormat = computed(() => {
  26998. return props.dateFormat || extractDateFormat(props.format);
  26999. });
  27000. const visibleTime = computed(() => {
  27001. if (userInputTime.value)
  27002. return userInputTime.value;
  27003. if (!props.parsedValue && !defaultValue.value)
  27004. return;
  27005. return (props.parsedValue || innerDate.value).format(timeFormat.value);
  27006. });
  27007. const visibleDate = computed(() => {
  27008. if (userInputDate.value)
  27009. return userInputDate.value;
  27010. if (!props.parsedValue && !defaultValue.value)
  27011. return;
  27012. return (props.parsedValue || innerDate.value).format(dateFormat.value);
  27013. });
  27014. const timePickerVisible = ref(false);
  27015. const onTimePickerInputFocus = () => {
  27016. timePickerVisible.value = true;
  27017. };
  27018. const handleTimePickClose = () => {
  27019. timePickerVisible.value = false;
  27020. };
  27021. const getUnits = (date) => {
  27022. return {
  27023. hour: date.hour(),
  27024. minute: date.minute(),
  27025. second: date.second(),
  27026. year: date.year(),
  27027. month: date.month(),
  27028. date: date.date()
  27029. };
  27030. };
  27031. const handleTimePick = (value, visible, first) => {
  27032. const { hour, minute, second } = getUnits(value);
  27033. const newDate = props.parsedValue ? props.parsedValue.hour(hour).minute(minute).second(second) : value;
  27034. innerDate.value = newDate;
  27035. emit(innerDate.value, true);
  27036. if (!first) {
  27037. timePickerVisible.value = visible;
  27038. }
  27039. };
  27040. const handleVisibleTimeChange = (value) => {
  27041. const newDate = dayjs(value, timeFormat.value).locale(lang.value);
  27042. if (newDate.isValid() && checkDateWithinRange(newDate)) {
  27043. const { year: year2, month: month2, date } = getUnits(innerDate.value);
  27044. innerDate.value = newDate.year(year2).month(month2).date(date);
  27045. userInputTime.value = null;
  27046. timePickerVisible.value = false;
  27047. emit(innerDate.value, true);
  27048. }
  27049. };
  27050. const handleVisibleDateChange = (value) => {
  27051. const newDate = correctlyParseUserInput(value, dateFormat.value, lang.value, isDefaultFormat);
  27052. if (newDate.isValid()) {
  27053. if (disabledDate && disabledDate(newDate.toDate())) {
  27054. return;
  27055. }
  27056. const { hour, minute, second } = getUnits(innerDate.value);
  27057. innerDate.value = newDate.hour(hour).minute(minute).second(second);
  27058. userInputDate.value = null;
  27059. emit(innerDate.value, true);
  27060. }
  27061. };
  27062. const isValidValue = (date) => {
  27063. return dayjs.isDayjs(date) && date.isValid() && (disabledDate ? !disabledDate(date.toDate()) : true);
  27064. };
  27065. const formatToString = (value) => {
  27066. return isArray$1(value) ? value.map((_) => _.format(props.format)) : value.format(props.format);
  27067. };
  27068. const parseUserInput = (value) => {
  27069. return correctlyParseUserInput(value, props.format, lang.value, isDefaultFormat);
  27070. };
  27071. const getDefaultValue = () => {
  27072. const parseDate = dayjs(defaultValue.value).locale(lang.value);
  27073. if (!defaultValue.value) {
  27074. const defaultTimeDValue = defaultTimeD.value;
  27075. return dayjs().hour(defaultTimeDValue.hour()).minute(defaultTimeDValue.minute()).second(defaultTimeDValue.second()).locale(lang.value);
  27076. }
  27077. return parseDate;
  27078. };
  27079. const handleFocusPicker = () => {
  27080. var _a;
  27081. if (["week", "month", "year", "date"].includes(selectionMode.value)) {
  27082. (_a = currentViewRef.value) == null ? void 0 : _a.focus();
  27083. }
  27084. };
  27085. const _handleFocusPicker = () => {
  27086. handleFocusPicker();
  27087. if (selectionMode.value === "week") {
  27088. handleKeyControl(EVENT_CODE.down);
  27089. }
  27090. };
  27091. const handleKeydownTable = (event) => {
  27092. const { code } = event;
  27093. const validCode = [
  27094. EVENT_CODE.up,
  27095. EVENT_CODE.down,
  27096. EVENT_CODE.left,
  27097. EVENT_CODE.right,
  27098. EVENT_CODE.home,
  27099. EVENT_CODE.end,
  27100. EVENT_CODE.pageUp,
  27101. EVENT_CODE.pageDown
  27102. ];
  27103. if (validCode.includes(code)) {
  27104. handleKeyControl(code);
  27105. event.stopPropagation();
  27106. event.preventDefault();
  27107. }
  27108. if ([EVENT_CODE.enter, EVENT_CODE.space, EVENT_CODE.numpadEnter].includes(code) && userInputDate.value === null && userInputTime.value === null) {
  27109. event.preventDefault();
  27110. emit(innerDate.value, false);
  27111. }
  27112. };
  27113. const handleKeyControl = (code) => {
  27114. var _a;
  27115. const { up, down, left, right, home, end, pageUp, pageDown } = EVENT_CODE;
  27116. const mapping = {
  27117. year: {
  27118. [up]: -4,
  27119. [down]: 4,
  27120. [left]: -1,
  27121. [right]: 1,
  27122. offset: (date, step) => date.setFullYear(date.getFullYear() + step)
  27123. },
  27124. month: {
  27125. [up]: -4,
  27126. [down]: 4,
  27127. [left]: -1,
  27128. [right]: 1,
  27129. offset: (date, step) => date.setMonth(date.getMonth() + step)
  27130. },
  27131. week: {
  27132. [up]: -1,
  27133. [down]: 1,
  27134. [left]: -1,
  27135. [right]: 1,
  27136. offset: (date, step) => date.setDate(date.getDate() + step * 7)
  27137. },
  27138. date: {
  27139. [up]: -7,
  27140. [down]: 7,
  27141. [left]: -1,
  27142. [right]: 1,
  27143. [home]: (date) => -date.getDay(),
  27144. [end]: (date) => -date.getDay() + 6,
  27145. [pageUp]: (date) => -new Date(date.getFullYear(), date.getMonth(), 0).getDate(),
  27146. [pageDown]: (date) => new Date(date.getFullYear(), date.getMonth() + 1, 0).getDate(),
  27147. offset: (date, step) => date.setDate(date.getDate() + step)
  27148. }
  27149. };
  27150. const newDate = innerDate.value.toDate();
  27151. while (Math.abs(innerDate.value.diff(newDate, "year", true)) < 1) {
  27152. const map = mapping[keyboardMode.value];
  27153. if (!map)
  27154. return;
  27155. map.offset(newDate, isFunction$1(map[code]) ? map[code](newDate) : (_a = map[code]) != null ? _a : 0);
  27156. if (disabledDate && disabledDate(newDate)) {
  27157. break;
  27158. }
  27159. const result = dayjs(newDate).locale(lang.value);
  27160. innerDate.value = result;
  27161. contextEmit("pick", result, true);
  27162. break;
  27163. }
  27164. };
  27165. const handlePanelChange = (mode) => {
  27166. contextEmit("panel-change", innerDate.value.toDate(), mode, currentView.value);
  27167. };
  27168. watch(() => selectionMode.value, (val) => {
  27169. if (["month", "year"].includes(val)) {
  27170. currentView.value = val;
  27171. return;
  27172. } else if (val === "years") {
  27173. currentView.value = "year";
  27174. return;
  27175. } else if (val === "months") {
  27176. currentView.value = "month";
  27177. return;
  27178. }
  27179. currentView.value = "date";
  27180. }, { immediate: true });
  27181. watch(() => currentView.value, () => {
  27182. popper == null ? void 0 : popper.updatePopper();
  27183. });
  27184. watch(() => defaultValue.value, (val) => {
  27185. if (val) {
  27186. innerDate.value = getDefaultValue();
  27187. }
  27188. }, { immediate: true });
  27189. watch(() => props.parsedValue, (val) => {
  27190. if (val) {
  27191. if (isMultipleType.value)
  27192. return;
  27193. if (isArray$1(val))
  27194. return;
  27195. innerDate.value = val;
  27196. } else {
  27197. innerDate.value = getDefaultValue();
  27198. }
  27199. }, { immediate: true });
  27200. contextEmit("set-picker-option", ["isValidValue", isValidValue]);
  27201. contextEmit("set-picker-option", ["formatToString", formatToString]);
  27202. contextEmit("set-picker-option", ["parseUserInput", parseUserInput]);
  27203. contextEmit("set-picker-option", ["handleFocusPicker", _handleFocusPicker]);
  27204. return (_ctx, _cache) => {
  27205. return openBlock(), createElementBlock("div", {
  27206. class: normalizeClass([
  27207. unref(ppNs).b(),
  27208. unref(dpNs).b(),
  27209. {
  27210. "has-sidebar": _ctx.$slots.sidebar || unref(hasShortcuts),
  27211. "has-time": unref(showTime)
  27212. }
  27213. ])
  27214. }, [
  27215. createElementVNode("div", {
  27216. class: normalizeClass(unref(ppNs).e("body-wrapper"))
  27217. }, [
  27218. renderSlot(_ctx.$slots, "sidebar", {
  27219. class: normalizeClass(unref(ppNs).e("sidebar"))
  27220. }),
  27221. unref(hasShortcuts) ? (openBlock(), createElementBlock("div", {
  27222. key: 0,
  27223. class: normalizeClass(unref(ppNs).e("sidebar"))
  27224. }, [
  27225. (openBlock(true), createElementBlock(Fragment, null, renderList(unref(shortcuts), (shortcut, key) => {
  27226. return openBlock(), createElementBlock("button", {
  27227. key,
  27228. type: "button",
  27229. class: normalizeClass(unref(ppNs).e("shortcut")),
  27230. onClick: ($event) => handleShortcutClick(shortcut)
  27231. }, toDisplayString(shortcut.text), 11, ["onClick"]);
  27232. }), 128))
  27233. ], 2)) : createCommentVNode("v-if", true),
  27234. createElementVNode("div", {
  27235. class: normalizeClass(unref(ppNs).e("body"))
  27236. }, [
  27237. unref(showTime) ? (openBlock(), createElementBlock("div", {
  27238. key: 0,
  27239. class: normalizeClass(unref(dpNs).e("time-header"))
  27240. }, [
  27241. createElementVNode("span", {
  27242. class: normalizeClass(unref(dpNs).e("editor-wrap"))
  27243. }, [
  27244. createVNode(unref(ElInput), {
  27245. placeholder: unref(t)("el.datepicker.selectDate"),
  27246. "model-value": unref(visibleDate),
  27247. size: "small",
  27248. "validate-event": false,
  27249. onInput: (val) => userInputDate.value = val,
  27250. onChange: handleVisibleDateChange
  27251. }, null, 8, ["placeholder", "model-value", "onInput"])
  27252. ], 2),
  27253. withDirectives((openBlock(), createElementBlock("span", {
  27254. class: normalizeClass(unref(dpNs).e("editor-wrap"))
  27255. }, [
  27256. createVNode(unref(ElInput), {
  27257. placeholder: unref(t)("el.datepicker.selectTime"),
  27258. "model-value": unref(visibleTime),
  27259. size: "small",
  27260. "validate-event": false,
  27261. onFocus: onTimePickerInputFocus,
  27262. onInput: (val) => userInputTime.value = val,
  27263. onChange: handleVisibleTimeChange
  27264. }, null, 8, ["placeholder", "model-value", "onInput"]),
  27265. createVNode(unref(TimePickPanel), {
  27266. visible: timePickerVisible.value,
  27267. format: unref(timeFormat),
  27268. "parsed-value": innerDate.value,
  27269. onPick: handleTimePick
  27270. }, null, 8, ["visible", "format", "parsed-value"])
  27271. ], 2)), [
  27272. [unref(ClickOutside), handleTimePickClose]
  27273. ])
  27274. ], 2)) : createCommentVNode("v-if", true),
  27275. withDirectives(createElementVNode("div", {
  27276. class: normalizeClass([
  27277. unref(dpNs).e("header"),
  27278. (currentView.value === "year" || currentView.value === "month") && unref(dpNs).e("header--bordered")
  27279. ])
  27280. }, [
  27281. createElementVNode("span", {
  27282. class: normalizeClass(unref(dpNs).e("prev-btn"))
  27283. }, [
  27284. createElementVNode("button", {
  27285. type: "button",
  27286. "aria-label": unref(t)(`el.datepicker.prevYear`),
  27287. class: normalizeClass(["d-arrow-left", unref(ppNs).e("icon-btn")]),
  27288. onClick: ($event) => moveByYear(false)
  27289. }, [
  27290. renderSlot(_ctx.$slots, "prev-year", {}, () => [
  27291. createVNode(unref(ElIcon), null, {
  27292. default: withCtx(() => [
  27293. createVNode(unref(d_arrow_left_default))
  27294. ]),
  27295. _: 1
  27296. })
  27297. ])
  27298. ], 10, ["aria-label", "onClick"]),
  27299. withDirectives(createElementVNode("button", {
  27300. type: "button",
  27301. "aria-label": unref(t)(`el.datepicker.prevMonth`),
  27302. class: normalizeClass([unref(ppNs).e("icon-btn"), "arrow-left"]),
  27303. onClick: ($event) => moveByMonth(false)
  27304. }, [
  27305. renderSlot(_ctx.$slots, "prev-month", {}, () => [
  27306. createVNode(unref(ElIcon), null, {
  27307. default: withCtx(() => [
  27308. createVNode(unref(arrow_left_default))
  27309. ]),
  27310. _: 1
  27311. })
  27312. ])
  27313. ], 10, ["aria-label", "onClick"]), [
  27314. [vShow, currentView.value === "date"]
  27315. ])
  27316. ], 2),
  27317. createElementVNode("span", {
  27318. role: "button",
  27319. class: normalizeClass(unref(dpNs).e("header-label")),
  27320. "aria-live": "polite",
  27321. tabindex: "0",
  27322. onKeydown: withKeys(($event) => showPicker("year"), ["enter"]),
  27323. onClick: ($event) => showPicker("year")
  27324. }, toDisplayString(unref(yearLabel)), 43, ["onKeydown", "onClick"]),
  27325. withDirectives(createElementVNode("span", {
  27326. role: "button",
  27327. "aria-live": "polite",
  27328. tabindex: "0",
  27329. class: normalizeClass([
  27330. unref(dpNs).e("header-label"),
  27331. { active: currentView.value === "month" }
  27332. ]),
  27333. onKeydown: withKeys(($event) => showPicker("month"), ["enter"]),
  27334. onClick: ($event) => showPicker("month")
  27335. }, toDisplayString(unref(t)(`el.datepicker.month${unref(month) + 1}`)), 43, ["onKeydown", "onClick"]), [
  27336. [vShow, currentView.value === "date"]
  27337. ]),
  27338. createElementVNode("span", {
  27339. class: normalizeClass(unref(dpNs).e("next-btn"))
  27340. }, [
  27341. withDirectives(createElementVNode("button", {
  27342. type: "button",
  27343. "aria-label": unref(t)(`el.datepicker.nextMonth`),
  27344. class: normalizeClass([unref(ppNs).e("icon-btn"), "arrow-right"]),
  27345. onClick: ($event) => moveByMonth(true)
  27346. }, [
  27347. renderSlot(_ctx.$slots, "next-month", {}, () => [
  27348. createVNode(unref(ElIcon), null, {
  27349. default: withCtx(() => [
  27350. createVNode(unref(arrow_right_default))
  27351. ]),
  27352. _: 1
  27353. })
  27354. ])
  27355. ], 10, ["aria-label", "onClick"]), [
  27356. [vShow, currentView.value === "date"]
  27357. ]),
  27358. createElementVNode("button", {
  27359. type: "button",
  27360. "aria-label": unref(t)(`el.datepicker.nextYear`),
  27361. class: normalizeClass([unref(ppNs).e("icon-btn"), "d-arrow-right"]),
  27362. onClick: ($event) => moveByYear(true)
  27363. }, [
  27364. renderSlot(_ctx.$slots, "next-year", {}, () => [
  27365. createVNode(unref(ElIcon), null, {
  27366. default: withCtx(() => [
  27367. createVNode(unref(d_arrow_right_default))
  27368. ]),
  27369. _: 1
  27370. })
  27371. ])
  27372. ], 10, ["aria-label", "onClick"])
  27373. ], 2)
  27374. ], 2), [
  27375. [vShow, currentView.value !== "time"]
  27376. ]),
  27377. createElementVNode("div", {
  27378. class: normalizeClass(unref(ppNs).e("content")),
  27379. onKeydown: handleKeydownTable
  27380. }, [
  27381. currentView.value === "date" ? (openBlock(), createBlock(DateTable, {
  27382. key: 0,
  27383. ref_key: "currentViewRef",
  27384. ref: currentViewRef,
  27385. "selection-mode": unref(selectionMode),
  27386. date: innerDate.value,
  27387. "parsed-value": _ctx.parsedValue,
  27388. "disabled-date": unref(disabledDate),
  27389. "cell-class-name": unref(cellClassName),
  27390. onPick: handleDatePick
  27391. }, null, 8, ["selection-mode", "date", "parsed-value", "disabled-date", "cell-class-name"])) : createCommentVNode("v-if", true),
  27392. currentView.value === "year" ? (openBlock(), createBlock(YearTable, {
  27393. key: 1,
  27394. ref_key: "currentViewRef",
  27395. ref: currentViewRef,
  27396. "selection-mode": unref(selectionMode),
  27397. date: innerDate.value,
  27398. "disabled-date": unref(disabledDate),
  27399. "parsed-value": _ctx.parsedValue,
  27400. onPick: handleYearPick
  27401. }, null, 8, ["selection-mode", "date", "disabled-date", "parsed-value"])) : createCommentVNode("v-if", true),
  27402. currentView.value === "month" ? (openBlock(), createBlock(MonthTable, {
  27403. key: 2,
  27404. ref_key: "currentViewRef",
  27405. ref: currentViewRef,
  27406. "selection-mode": unref(selectionMode),
  27407. date: innerDate.value,
  27408. "parsed-value": _ctx.parsedValue,
  27409. "disabled-date": unref(disabledDate),
  27410. onPick: handleMonthPick
  27411. }, null, 8, ["selection-mode", "date", "parsed-value", "disabled-date"])) : createCommentVNode("v-if", true)
  27412. ], 34)
  27413. ], 2)
  27414. ], 2),
  27415. withDirectives(createElementVNode("div", {
  27416. class: normalizeClass(unref(ppNs).e("footer"))
  27417. }, [
  27418. withDirectives(createVNode(unref(ElButton), {
  27419. text: "",
  27420. size: "small",
  27421. class: normalizeClass(unref(ppNs).e("link-btn")),
  27422. disabled: unref(disabledNow),
  27423. onClick: changeToNow
  27424. }, {
  27425. default: withCtx(() => [
  27426. createTextVNode(toDisplayString(unref(t)("el.datepicker.now")), 1)
  27427. ]),
  27428. _: 1
  27429. }, 8, ["class", "disabled"]), [
  27430. [vShow, !unref(isMultipleType) && _ctx.showNow]
  27431. ]),
  27432. createVNode(unref(ElButton), {
  27433. plain: "",
  27434. size: "small",
  27435. class: normalizeClass(unref(ppNs).e("link-btn")),
  27436. disabled: unref(disabledConfirm),
  27437. onClick: onConfirm
  27438. }, {
  27439. default: withCtx(() => [
  27440. createTextVNode(toDisplayString(unref(t)("el.datepicker.confirm")), 1)
  27441. ]),
  27442. _: 1
  27443. }, 8, ["class", "disabled"])
  27444. ], 2), [
  27445. [vShow, unref(footerVisible)]
  27446. ])
  27447. ], 2);
  27448. };
  27449. }
  27450. });
  27451. var DatePickPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1v, [["__file", "panel-date-pick.vue"]]);
  27452. const panelDateRangeProps = buildProps({
  27453. ...panelSharedProps,
  27454. ...panelRangeSharedProps,
  27455. visible: Boolean
  27456. });
  27457. const useShortcut = (lang) => {
  27458. const { emit } = getCurrentInstance();
  27459. const attrs = useAttrs$1();
  27460. const slots = useSlots();
  27461. const handleShortcutClick = (shortcut) => {
  27462. const shortcutValues = isFunction$1(shortcut.value) ? shortcut.value() : shortcut.value;
  27463. if (shortcutValues) {
  27464. emit("pick", [
  27465. dayjs(shortcutValues[0]).locale(lang.value),
  27466. dayjs(shortcutValues[1]).locale(lang.value)
  27467. ]);
  27468. return;
  27469. }
  27470. if (shortcut.onClick) {
  27471. shortcut.onClick({
  27472. attrs,
  27473. slots,
  27474. emit
  27475. });
  27476. }
  27477. };
  27478. return handleShortcutClick;
  27479. };
  27480. const useRangePicker = (props, {
  27481. defaultValue,
  27482. leftDate,
  27483. rightDate,
  27484. unit,
  27485. onParsedValueChanged
  27486. }) => {
  27487. const { emit } = getCurrentInstance();
  27488. const { pickerNs } = inject(ROOT_PICKER_INJECTION_KEY);
  27489. const drpNs = useNamespace("date-range-picker");
  27490. const { t, lang } = useLocale();
  27491. const handleShortcutClick = useShortcut(lang);
  27492. const minDate = ref();
  27493. const maxDate = ref();
  27494. const rangeState = ref({
  27495. endDate: null,
  27496. selecting: false
  27497. });
  27498. const handleChangeRange = (val) => {
  27499. rangeState.value = val;
  27500. };
  27501. const handleRangeConfirm = (visible = false) => {
  27502. const _minDate = unref(minDate);
  27503. const _maxDate = unref(maxDate);
  27504. if (isValidRange([_minDate, _maxDate])) {
  27505. emit("pick", [_minDate, _maxDate], visible);
  27506. }
  27507. };
  27508. const onSelect = (selecting) => {
  27509. rangeState.value.selecting = selecting;
  27510. if (!selecting) {
  27511. rangeState.value.endDate = null;
  27512. }
  27513. };
  27514. const onReset = (parsedValue) => {
  27515. if (isArray$1(parsedValue) && parsedValue.length === 2) {
  27516. const [start, end] = parsedValue;
  27517. minDate.value = start;
  27518. leftDate.value = start;
  27519. maxDate.value = end;
  27520. onParsedValueChanged(unref(minDate), unref(maxDate));
  27521. } else {
  27522. restoreDefault();
  27523. }
  27524. };
  27525. const restoreDefault = () => {
  27526. const [start, end] = getDefaultValue(unref(defaultValue), {
  27527. lang: unref(lang),
  27528. unit,
  27529. unlinkPanels: props.unlinkPanels
  27530. });
  27531. minDate.value = void 0;
  27532. maxDate.value = void 0;
  27533. leftDate.value = start;
  27534. rightDate.value = end;
  27535. };
  27536. watch(defaultValue, (val) => {
  27537. if (val) {
  27538. restoreDefault();
  27539. }
  27540. }, { immediate: true });
  27541. watch(() => props.parsedValue, onReset, { immediate: true });
  27542. return {
  27543. minDate,
  27544. maxDate,
  27545. rangeState,
  27546. lang,
  27547. ppNs: pickerNs,
  27548. drpNs,
  27549. handleChangeRange,
  27550. handleRangeConfirm,
  27551. handleShortcutClick,
  27552. onSelect,
  27553. onReset,
  27554. t
  27555. };
  27556. };
  27557. const unit$2 = "month";
  27558. const _sfc_main$1u = /* @__PURE__ */ defineComponent({
  27559. __name: "panel-date-range",
  27560. props: panelDateRangeProps,
  27561. emits: [
  27562. "pick",
  27563. "set-picker-option",
  27564. "calendar-change",
  27565. "panel-change"
  27566. ],
  27567. setup(__props, { emit }) {
  27568. const props = __props;
  27569. const pickerBase = inject("EP_PICKER_BASE");
  27570. const isDefaultFormat = inject("ElIsDefaultFormat");
  27571. const { disabledDate, cellClassName, defaultTime, clearable } = pickerBase.props;
  27572. const format = toRef(pickerBase.props, "format");
  27573. const shortcuts = toRef(pickerBase.props, "shortcuts");
  27574. const defaultValue = toRef(pickerBase.props, "defaultValue");
  27575. const { lang } = useLocale();
  27576. const leftDate = ref(dayjs().locale(lang.value));
  27577. const rightDate = ref(dayjs().locale(lang.value).add(1, unit$2));
  27578. const {
  27579. minDate,
  27580. maxDate,
  27581. rangeState,
  27582. ppNs,
  27583. drpNs,
  27584. handleChangeRange,
  27585. handleRangeConfirm,
  27586. handleShortcutClick,
  27587. onSelect,
  27588. onReset,
  27589. t
  27590. } = useRangePicker(props, {
  27591. defaultValue,
  27592. leftDate,
  27593. rightDate,
  27594. unit: unit$2,
  27595. onParsedValueChanged
  27596. });
  27597. watch(() => props.visible, (visible) => {
  27598. if (!visible && rangeState.value.selecting) {
  27599. onReset(props.parsedValue);
  27600. onSelect(false);
  27601. }
  27602. });
  27603. const dateUserInput = ref({
  27604. min: null,
  27605. max: null
  27606. });
  27607. const timeUserInput = ref({
  27608. min: null,
  27609. max: null
  27610. });
  27611. const leftLabel = computed(() => {
  27612. return `${leftDate.value.year()} ${t("el.datepicker.year")} ${t(`el.datepicker.month${leftDate.value.month() + 1}`)}`;
  27613. });
  27614. const rightLabel = computed(() => {
  27615. return `${rightDate.value.year()} ${t("el.datepicker.year")} ${t(`el.datepicker.month${rightDate.value.month() + 1}`)}`;
  27616. });
  27617. const leftYear = computed(() => {
  27618. return leftDate.value.year();
  27619. });
  27620. const leftMonth = computed(() => {
  27621. return leftDate.value.month();
  27622. });
  27623. const rightYear = computed(() => {
  27624. return rightDate.value.year();
  27625. });
  27626. const rightMonth = computed(() => {
  27627. return rightDate.value.month();
  27628. });
  27629. const hasShortcuts = computed(() => !!shortcuts.value.length);
  27630. const minVisibleDate = computed(() => {
  27631. if (dateUserInput.value.min !== null)
  27632. return dateUserInput.value.min;
  27633. if (minDate.value)
  27634. return minDate.value.format(dateFormat.value);
  27635. return "";
  27636. });
  27637. const maxVisibleDate = computed(() => {
  27638. if (dateUserInput.value.max !== null)
  27639. return dateUserInput.value.max;
  27640. if (maxDate.value || minDate.value)
  27641. return (maxDate.value || minDate.value).format(dateFormat.value);
  27642. return "";
  27643. });
  27644. const minVisibleTime = computed(() => {
  27645. if (timeUserInput.value.min !== null)
  27646. return timeUserInput.value.min;
  27647. if (minDate.value)
  27648. return minDate.value.format(timeFormat.value);
  27649. return "";
  27650. });
  27651. const maxVisibleTime = computed(() => {
  27652. if (timeUserInput.value.max !== null)
  27653. return timeUserInput.value.max;
  27654. if (maxDate.value || minDate.value)
  27655. return (maxDate.value || minDate.value).format(timeFormat.value);
  27656. return "";
  27657. });
  27658. const timeFormat = computed(() => {
  27659. return props.timeFormat || extractTimeFormat(format.value);
  27660. });
  27661. const dateFormat = computed(() => {
  27662. return props.dateFormat || extractDateFormat(format.value);
  27663. });
  27664. const isValidValue = (date) => {
  27665. return isValidRange(date) && (disabledDate ? !disabledDate(date[0].toDate()) && !disabledDate(date[1].toDate()) : true);
  27666. };
  27667. const leftPrevYear = () => {
  27668. leftDate.value = leftDate.value.subtract(1, "year");
  27669. if (!props.unlinkPanels) {
  27670. rightDate.value = leftDate.value.add(1, "month");
  27671. }
  27672. handlePanelChange("year");
  27673. };
  27674. const leftPrevMonth = () => {
  27675. leftDate.value = leftDate.value.subtract(1, "month");
  27676. if (!props.unlinkPanels) {
  27677. rightDate.value = leftDate.value.add(1, "month");
  27678. }
  27679. handlePanelChange("month");
  27680. };
  27681. const rightNextYear = () => {
  27682. if (!props.unlinkPanels) {
  27683. leftDate.value = leftDate.value.add(1, "year");
  27684. rightDate.value = leftDate.value.add(1, "month");
  27685. } else {
  27686. rightDate.value = rightDate.value.add(1, "year");
  27687. }
  27688. handlePanelChange("year");
  27689. };
  27690. const rightNextMonth = () => {
  27691. if (!props.unlinkPanels) {
  27692. leftDate.value = leftDate.value.add(1, "month");
  27693. rightDate.value = leftDate.value.add(1, "month");
  27694. } else {
  27695. rightDate.value = rightDate.value.add(1, "month");
  27696. }
  27697. handlePanelChange("month");
  27698. };
  27699. const leftNextYear = () => {
  27700. leftDate.value = leftDate.value.add(1, "year");
  27701. handlePanelChange("year");
  27702. };
  27703. const leftNextMonth = () => {
  27704. leftDate.value = leftDate.value.add(1, "month");
  27705. handlePanelChange("month");
  27706. };
  27707. const rightPrevYear = () => {
  27708. rightDate.value = rightDate.value.subtract(1, "year");
  27709. handlePanelChange("year");
  27710. };
  27711. const rightPrevMonth = () => {
  27712. rightDate.value = rightDate.value.subtract(1, "month");
  27713. handlePanelChange("month");
  27714. };
  27715. const handlePanelChange = (mode) => {
  27716. emit("panel-change", [leftDate.value.toDate(), rightDate.value.toDate()], mode);
  27717. };
  27718. const enableMonthArrow = computed(() => {
  27719. const nextMonth = (leftMonth.value + 1) % 12;
  27720. const yearOffset = leftMonth.value + 1 >= 12 ? 1 : 0;
  27721. return props.unlinkPanels && new Date(leftYear.value + yearOffset, nextMonth) < new Date(rightYear.value, rightMonth.value);
  27722. });
  27723. const enableYearArrow = computed(() => {
  27724. return props.unlinkPanels && rightYear.value * 12 + rightMonth.value - (leftYear.value * 12 + leftMonth.value + 1) >= 12;
  27725. });
  27726. const btnDisabled = computed(() => {
  27727. return !(minDate.value && maxDate.value && !rangeState.value.selecting && isValidRange([minDate.value, maxDate.value]));
  27728. });
  27729. const showTime = computed(() => props.type === "datetime" || props.type === "datetimerange");
  27730. const formatEmit = (emitDayjs, index) => {
  27731. if (!emitDayjs)
  27732. return;
  27733. if (defaultTime) {
  27734. const defaultTimeD = dayjs(defaultTime[index] || defaultTime).locale(lang.value);
  27735. return defaultTimeD.year(emitDayjs.year()).month(emitDayjs.month()).date(emitDayjs.date());
  27736. }
  27737. return emitDayjs;
  27738. };
  27739. const handleRangePick = (val, close = true) => {
  27740. const min_ = val.minDate;
  27741. const max_ = val.maxDate;
  27742. const minDate_ = formatEmit(min_, 0);
  27743. const maxDate_ = formatEmit(max_, 1);
  27744. if (maxDate.value === maxDate_ && minDate.value === minDate_) {
  27745. return;
  27746. }
  27747. emit("calendar-change", [min_.toDate(), max_ && max_.toDate()]);
  27748. maxDate.value = maxDate_;
  27749. minDate.value = minDate_;
  27750. if (!close || showTime.value)
  27751. return;
  27752. handleRangeConfirm();
  27753. };
  27754. const minTimePickerVisible = ref(false);
  27755. const maxTimePickerVisible = ref(false);
  27756. const handleMinTimeClose = () => {
  27757. minTimePickerVisible.value = false;
  27758. };
  27759. const handleMaxTimeClose = () => {
  27760. maxTimePickerVisible.value = false;
  27761. };
  27762. const handleDateInput = (value, type) => {
  27763. dateUserInput.value[type] = value;
  27764. const parsedValueD = dayjs(value, dateFormat.value).locale(lang.value);
  27765. if (parsedValueD.isValid()) {
  27766. if (disabledDate && disabledDate(parsedValueD.toDate())) {
  27767. return;
  27768. }
  27769. if (type === "min") {
  27770. leftDate.value = parsedValueD;
  27771. minDate.value = (minDate.value || leftDate.value).year(parsedValueD.year()).month(parsedValueD.month()).date(parsedValueD.date());
  27772. if (!props.unlinkPanels && (!maxDate.value || maxDate.value.isBefore(minDate.value))) {
  27773. rightDate.value = parsedValueD.add(1, "month");
  27774. maxDate.value = minDate.value.add(1, "month");
  27775. }
  27776. } else {
  27777. rightDate.value = parsedValueD;
  27778. maxDate.value = (maxDate.value || rightDate.value).year(parsedValueD.year()).month(parsedValueD.month()).date(parsedValueD.date());
  27779. if (!props.unlinkPanels && (!minDate.value || minDate.value.isAfter(maxDate.value))) {
  27780. leftDate.value = parsedValueD.subtract(1, "month");
  27781. minDate.value = maxDate.value.subtract(1, "month");
  27782. }
  27783. }
  27784. }
  27785. };
  27786. const handleDateChange = (_, type) => {
  27787. dateUserInput.value[type] = null;
  27788. };
  27789. const handleTimeInput = (value, type) => {
  27790. timeUserInput.value[type] = value;
  27791. const parsedValueD = dayjs(value, timeFormat.value).locale(lang.value);
  27792. if (parsedValueD.isValid()) {
  27793. if (type === "min") {
  27794. minTimePickerVisible.value = true;
  27795. minDate.value = (minDate.value || leftDate.value).hour(parsedValueD.hour()).minute(parsedValueD.minute()).second(parsedValueD.second());
  27796. } else {
  27797. maxTimePickerVisible.value = true;
  27798. maxDate.value = (maxDate.value || rightDate.value).hour(parsedValueD.hour()).minute(parsedValueD.minute()).second(parsedValueD.second());
  27799. rightDate.value = maxDate.value;
  27800. }
  27801. }
  27802. };
  27803. const handleTimeChange = (value, type) => {
  27804. timeUserInput.value[type] = null;
  27805. if (type === "min") {
  27806. leftDate.value = minDate.value;
  27807. minTimePickerVisible.value = false;
  27808. if (!maxDate.value || maxDate.value.isBefore(minDate.value)) {
  27809. maxDate.value = minDate.value;
  27810. }
  27811. } else {
  27812. rightDate.value = maxDate.value;
  27813. maxTimePickerVisible.value = false;
  27814. if (maxDate.value && maxDate.value.isBefore(minDate.value)) {
  27815. minDate.value = maxDate.value;
  27816. }
  27817. }
  27818. };
  27819. const handleMinTimePick = (value, visible, first) => {
  27820. if (timeUserInput.value.min)
  27821. return;
  27822. if (value) {
  27823. leftDate.value = value;
  27824. minDate.value = (minDate.value || leftDate.value).hour(value.hour()).minute(value.minute()).second(value.second());
  27825. }
  27826. if (!first) {
  27827. minTimePickerVisible.value = visible;
  27828. }
  27829. if (!maxDate.value || maxDate.value.isBefore(minDate.value)) {
  27830. maxDate.value = minDate.value;
  27831. rightDate.value = value;
  27832. }
  27833. };
  27834. const handleMaxTimePick = (value, visible, first) => {
  27835. if (timeUserInput.value.max)
  27836. return;
  27837. if (value) {
  27838. rightDate.value = value;
  27839. maxDate.value = (maxDate.value || rightDate.value).hour(value.hour()).minute(value.minute()).second(value.second());
  27840. }
  27841. if (!first) {
  27842. maxTimePickerVisible.value = visible;
  27843. }
  27844. if (maxDate.value && maxDate.value.isBefore(minDate.value)) {
  27845. minDate.value = maxDate.value;
  27846. }
  27847. };
  27848. const handleClear = () => {
  27849. leftDate.value = getDefaultValue(unref(defaultValue), {
  27850. lang: unref(lang),
  27851. unit: "month",
  27852. unlinkPanels: props.unlinkPanels
  27853. })[0];
  27854. rightDate.value = leftDate.value.add(1, "month");
  27855. maxDate.value = void 0;
  27856. minDate.value = void 0;
  27857. emit("pick", null);
  27858. };
  27859. const formatToString = (value) => {
  27860. return isArray$1(value) ? value.map((_) => _.format(format.value)) : value.format(format.value);
  27861. };
  27862. const parseUserInput = (value) => {
  27863. return correctlyParseUserInput(value, format.value, lang.value, isDefaultFormat);
  27864. };
  27865. function onParsedValueChanged(minDate2, maxDate2) {
  27866. if (props.unlinkPanels && maxDate2) {
  27867. const minDateYear = (minDate2 == null ? void 0 : minDate2.year()) || 0;
  27868. const minDateMonth = (minDate2 == null ? void 0 : minDate2.month()) || 0;
  27869. const maxDateYear = maxDate2.year();
  27870. const maxDateMonth = maxDate2.month();
  27871. rightDate.value = minDateYear === maxDateYear && minDateMonth === maxDateMonth ? maxDate2.add(1, unit$2) : maxDate2;
  27872. } else {
  27873. rightDate.value = leftDate.value.add(1, unit$2);
  27874. if (maxDate2) {
  27875. rightDate.value = rightDate.value.hour(maxDate2.hour()).minute(maxDate2.minute()).second(maxDate2.second());
  27876. }
  27877. }
  27878. }
  27879. emit("set-picker-option", ["isValidValue", isValidValue]);
  27880. emit("set-picker-option", ["parseUserInput", parseUserInput]);
  27881. emit("set-picker-option", ["formatToString", formatToString]);
  27882. emit("set-picker-option", ["handleClear", handleClear]);
  27883. return (_ctx, _cache) => {
  27884. return openBlock(), createElementBlock("div", {
  27885. class: normalizeClass([
  27886. unref(ppNs).b(),
  27887. unref(drpNs).b(),
  27888. {
  27889. "has-sidebar": _ctx.$slots.sidebar || unref(hasShortcuts),
  27890. "has-time": unref(showTime)
  27891. }
  27892. ])
  27893. }, [
  27894. createElementVNode("div", {
  27895. class: normalizeClass(unref(ppNs).e("body-wrapper"))
  27896. }, [
  27897. renderSlot(_ctx.$slots, "sidebar", {
  27898. class: normalizeClass(unref(ppNs).e("sidebar"))
  27899. }),
  27900. unref(hasShortcuts) ? (openBlock(), createElementBlock("div", {
  27901. key: 0,
  27902. class: normalizeClass(unref(ppNs).e("sidebar"))
  27903. }, [
  27904. (openBlock(true), createElementBlock(Fragment, null, renderList(unref(shortcuts), (shortcut, key) => {
  27905. return openBlock(), createElementBlock("button", {
  27906. key,
  27907. type: "button",
  27908. class: normalizeClass(unref(ppNs).e("shortcut")),
  27909. onClick: ($event) => unref(handleShortcutClick)(shortcut)
  27910. }, toDisplayString(shortcut.text), 11, ["onClick"]);
  27911. }), 128))
  27912. ], 2)) : createCommentVNode("v-if", true),
  27913. createElementVNode("div", {
  27914. class: normalizeClass(unref(ppNs).e("body"))
  27915. }, [
  27916. unref(showTime) ? (openBlock(), createElementBlock("div", {
  27917. key: 0,
  27918. class: normalizeClass(unref(drpNs).e("time-header"))
  27919. }, [
  27920. createElementVNode("span", {
  27921. class: normalizeClass(unref(drpNs).e("editors-wrap"))
  27922. }, [
  27923. createElementVNode("span", {
  27924. class: normalizeClass(unref(drpNs).e("time-picker-wrap"))
  27925. }, [
  27926. createVNode(unref(ElInput), {
  27927. size: "small",
  27928. disabled: unref(rangeState).selecting,
  27929. placeholder: unref(t)("el.datepicker.startDate"),
  27930. class: normalizeClass(unref(drpNs).e("editor")),
  27931. "model-value": unref(minVisibleDate),
  27932. "validate-event": false,
  27933. onInput: (val) => handleDateInput(val, "min"),
  27934. onChange: (val) => handleDateChange(val, "min")
  27935. }, null, 8, ["disabled", "placeholder", "class", "model-value", "onInput", "onChange"])
  27936. ], 2),
  27937. withDirectives((openBlock(), createElementBlock("span", {
  27938. class: normalizeClass(unref(drpNs).e("time-picker-wrap"))
  27939. }, [
  27940. createVNode(unref(ElInput), {
  27941. size: "small",
  27942. class: normalizeClass(unref(drpNs).e("editor")),
  27943. disabled: unref(rangeState).selecting,
  27944. placeholder: unref(t)("el.datepicker.startTime"),
  27945. "model-value": unref(minVisibleTime),
  27946. "validate-event": false,
  27947. onFocus: ($event) => minTimePickerVisible.value = true,
  27948. onInput: (val) => handleTimeInput(val, "min"),
  27949. onChange: (val) => handleTimeChange(val, "min")
  27950. }, null, 8, ["class", "disabled", "placeholder", "model-value", "onFocus", "onInput", "onChange"]),
  27951. createVNode(unref(TimePickPanel), {
  27952. visible: minTimePickerVisible.value,
  27953. format: unref(timeFormat),
  27954. "datetime-role": "start",
  27955. "parsed-value": leftDate.value,
  27956. onPick: handleMinTimePick
  27957. }, null, 8, ["visible", "format", "parsed-value"])
  27958. ], 2)), [
  27959. [unref(ClickOutside), handleMinTimeClose]
  27960. ])
  27961. ], 2),
  27962. createElementVNode("span", null, [
  27963. createVNode(unref(ElIcon), null, {
  27964. default: withCtx(() => [
  27965. createVNode(unref(arrow_right_default))
  27966. ]),
  27967. _: 1
  27968. })
  27969. ]),
  27970. createElementVNode("span", {
  27971. class: normalizeClass([unref(drpNs).e("editors-wrap"), "is-right"])
  27972. }, [
  27973. createElementVNode("span", {
  27974. class: normalizeClass(unref(drpNs).e("time-picker-wrap"))
  27975. }, [
  27976. createVNode(unref(ElInput), {
  27977. size: "small",
  27978. class: normalizeClass(unref(drpNs).e("editor")),
  27979. disabled: unref(rangeState).selecting,
  27980. placeholder: unref(t)("el.datepicker.endDate"),
  27981. "model-value": unref(maxVisibleDate),
  27982. readonly: !unref(minDate),
  27983. "validate-event": false,
  27984. onInput: (val) => handleDateInput(val, "max"),
  27985. onChange: (val) => handleDateChange(val, "max")
  27986. }, null, 8, ["class", "disabled", "placeholder", "model-value", "readonly", "onInput", "onChange"])
  27987. ], 2),
  27988. withDirectives((openBlock(), createElementBlock("span", {
  27989. class: normalizeClass(unref(drpNs).e("time-picker-wrap"))
  27990. }, [
  27991. createVNode(unref(ElInput), {
  27992. size: "small",
  27993. class: normalizeClass(unref(drpNs).e("editor")),
  27994. disabled: unref(rangeState).selecting,
  27995. placeholder: unref(t)("el.datepicker.endTime"),
  27996. "model-value": unref(maxVisibleTime),
  27997. readonly: !unref(minDate),
  27998. "validate-event": false,
  27999. onFocus: ($event) => unref(minDate) && (maxTimePickerVisible.value = true),
  28000. onInput: (val) => handleTimeInput(val, "max"),
  28001. onChange: (val) => handleTimeChange(val, "max")
  28002. }, null, 8, ["class", "disabled", "placeholder", "model-value", "readonly", "onFocus", "onInput", "onChange"]),
  28003. createVNode(unref(TimePickPanel), {
  28004. "datetime-role": "end",
  28005. visible: maxTimePickerVisible.value,
  28006. format: unref(timeFormat),
  28007. "parsed-value": rightDate.value,
  28008. onPick: handleMaxTimePick
  28009. }, null, 8, ["visible", "format", "parsed-value"])
  28010. ], 2)), [
  28011. [unref(ClickOutside), handleMaxTimeClose]
  28012. ])
  28013. ], 2)
  28014. ], 2)) : createCommentVNode("v-if", true),
  28015. createElementVNode("div", {
  28016. class: normalizeClass([[unref(ppNs).e("content"), unref(drpNs).e("content")], "is-left"])
  28017. }, [
  28018. createElementVNode("div", {
  28019. class: normalizeClass(unref(drpNs).e("header"))
  28020. }, [
  28021. createElementVNode("button", {
  28022. type: "button",
  28023. class: normalizeClass([unref(ppNs).e("icon-btn"), "d-arrow-left"]),
  28024. "aria-label": unref(t)(`el.datepicker.prevYear`),
  28025. onClick: leftPrevYear
  28026. }, [
  28027. renderSlot(_ctx.$slots, "prev-year", {}, () => [
  28028. createVNode(unref(ElIcon), null, {
  28029. default: withCtx(() => [
  28030. createVNode(unref(d_arrow_left_default))
  28031. ]),
  28032. _: 1
  28033. })
  28034. ])
  28035. ], 10, ["aria-label"]),
  28036. createElementVNode("button", {
  28037. type: "button",
  28038. class: normalizeClass([unref(ppNs).e("icon-btn"), "arrow-left"]),
  28039. "aria-label": unref(t)(`el.datepicker.prevMonth`),
  28040. onClick: leftPrevMonth
  28041. }, [
  28042. renderSlot(_ctx.$slots, "prev-month", {}, () => [
  28043. createVNode(unref(ElIcon), null, {
  28044. default: withCtx(() => [
  28045. createVNode(unref(arrow_left_default))
  28046. ]),
  28047. _: 1
  28048. })
  28049. ])
  28050. ], 10, ["aria-label"]),
  28051. _ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
  28052. key: 0,
  28053. type: "button",
  28054. disabled: !unref(enableYearArrow),
  28055. class: normalizeClass([[unref(ppNs).e("icon-btn"), { "is-disabled": !unref(enableYearArrow) }], "d-arrow-right"]),
  28056. "aria-label": unref(t)(`el.datepicker.nextYear`),
  28057. onClick: leftNextYear
  28058. }, [
  28059. renderSlot(_ctx.$slots, "next-year", {}, () => [
  28060. createVNode(unref(ElIcon), null, {
  28061. default: withCtx(() => [
  28062. createVNode(unref(d_arrow_right_default))
  28063. ]),
  28064. _: 1
  28065. })
  28066. ])
  28067. ], 10, ["disabled", "aria-label"])) : createCommentVNode("v-if", true),
  28068. _ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
  28069. key: 1,
  28070. type: "button",
  28071. disabled: !unref(enableMonthArrow),
  28072. class: normalizeClass([[
  28073. unref(ppNs).e("icon-btn"),
  28074. { "is-disabled": !unref(enableMonthArrow) }
  28075. ], "arrow-right"]),
  28076. "aria-label": unref(t)(`el.datepicker.nextMonth`),
  28077. onClick: leftNextMonth
  28078. }, [
  28079. renderSlot(_ctx.$slots, "next-month", {}, () => [
  28080. createVNode(unref(ElIcon), null, {
  28081. default: withCtx(() => [
  28082. createVNode(unref(arrow_right_default))
  28083. ]),
  28084. _: 1
  28085. })
  28086. ])
  28087. ], 10, ["disabled", "aria-label"])) : createCommentVNode("v-if", true),
  28088. createElementVNode("div", null, toDisplayString(unref(leftLabel)), 1)
  28089. ], 2),
  28090. createVNode(DateTable, {
  28091. "selection-mode": "range",
  28092. date: leftDate.value,
  28093. "min-date": unref(minDate),
  28094. "max-date": unref(maxDate),
  28095. "range-state": unref(rangeState),
  28096. "disabled-date": unref(disabledDate),
  28097. "cell-class-name": unref(cellClassName),
  28098. onChangerange: unref(handleChangeRange),
  28099. onPick: handleRangePick,
  28100. onSelect: unref(onSelect)
  28101. }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "cell-class-name", "onChangerange", "onSelect"])
  28102. ], 2),
  28103. createElementVNode("div", {
  28104. class: normalizeClass([[unref(ppNs).e("content"), unref(drpNs).e("content")], "is-right"])
  28105. }, [
  28106. createElementVNode("div", {
  28107. class: normalizeClass(unref(drpNs).e("header"))
  28108. }, [
  28109. _ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
  28110. key: 0,
  28111. type: "button",
  28112. disabled: !unref(enableYearArrow),
  28113. class: normalizeClass([[unref(ppNs).e("icon-btn"), { "is-disabled": !unref(enableYearArrow) }], "d-arrow-left"]),
  28114. "aria-label": unref(t)(`el.datepicker.prevYear`),
  28115. onClick: rightPrevYear
  28116. }, [
  28117. renderSlot(_ctx.$slots, "prev-year", {}, () => [
  28118. createVNode(unref(ElIcon), null, {
  28119. default: withCtx(() => [
  28120. createVNode(unref(d_arrow_left_default))
  28121. ]),
  28122. _: 1
  28123. })
  28124. ])
  28125. ], 10, ["disabled", "aria-label"])) : createCommentVNode("v-if", true),
  28126. _ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
  28127. key: 1,
  28128. type: "button",
  28129. disabled: !unref(enableMonthArrow),
  28130. class: normalizeClass([[
  28131. unref(ppNs).e("icon-btn"),
  28132. { "is-disabled": !unref(enableMonthArrow) }
  28133. ], "arrow-left"]),
  28134. "aria-label": unref(t)(`el.datepicker.prevMonth`),
  28135. onClick: rightPrevMonth
  28136. }, [
  28137. renderSlot(_ctx.$slots, "prev-month", {}, () => [
  28138. createVNode(unref(ElIcon), null, {
  28139. default: withCtx(() => [
  28140. createVNode(unref(arrow_left_default))
  28141. ]),
  28142. _: 1
  28143. })
  28144. ])
  28145. ], 10, ["disabled", "aria-label"])) : createCommentVNode("v-if", true),
  28146. createElementVNode("button", {
  28147. type: "button",
  28148. "aria-label": unref(t)(`el.datepicker.nextYear`),
  28149. class: normalizeClass([unref(ppNs).e("icon-btn"), "d-arrow-right"]),
  28150. onClick: rightNextYear
  28151. }, [
  28152. renderSlot(_ctx.$slots, "next-year", {}, () => [
  28153. createVNode(unref(ElIcon), null, {
  28154. default: withCtx(() => [
  28155. createVNode(unref(d_arrow_right_default))
  28156. ]),
  28157. _: 1
  28158. })
  28159. ])
  28160. ], 10, ["aria-label"]),
  28161. createElementVNode("button", {
  28162. type: "button",
  28163. class: normalizeClass([unref(ppNs).e("icon-btn"), "arrow-right"]),
  28164. "aria-label": unref(t)(`el.datepicker.nextMonth`),
  28165. onClick: rightNextMonth
  28166. }, [
  28167. renderSlot(_ctx.$slots, "next-month", {}, () => [
  28168. createVNode(unref(ElIcon), null, {
  28169. default: withCtx(() => [
  28170. createVNode(unref(arrow_right_default))
  28171. ]),
  28172. _: 1
  28173. })
  28174. ])
  28175. ], 10, ["aria-label"]),
  28176. createElementVNode("div", null, toDisplayString(unref(rightLabel)), 1)
  28177. ], 2),
  28178. createVNode(DateTable, {
  28179. "selection-mode": "range",
  28180. date: rightDate.value,
  28181. "min-date": unref(minDate),
  28182. "max-date": unref(maxDate),
  28183. "range-state": unref(rangeState),
  28184. "disabled-date": unref(disabledDate),
  28185. "cell-class-name": unref(cellClassName),
  28186. onChangerange: unref(handleChangeRange),
  28187. onPick: handleRangePick,
  28188. onSelect: unref(onSelect)
  28189. }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "cell-class-name", "onChangerange", "onSelect"])
  28190. ], 2)
  28191. ], 2)
  28192. ], 2),
  28193. unref(showTime) ? (openBlock(), createElementBlock("div", {
  28194. key: 0,
  28195. class: normalizeClass(unref(ppNs).e("footer"))
  28196. }, [
  28197. unref(clearable) ? (openBlock(), createBlock(unref(ElButton), {
  28198. key: 0,
  28199. text: "",
  28200. size: "small",
  28201. class: normalizeClass(unref(ppNs).e("link-btn")),
  28202. onClick: handleClear
  28203. }, {
  28204. default: withCtx(() => [
  28205. createTextVNode(toDisplayString(unref(t)("el.datepicker.clear")), 1)
  28206. ]),
  28207. _: 1
  28208. }, 8, ["class"])) : createCommentVNode("v-if", true),
  28209. createVNode(unref(ElButton), {
  28210. plain: "",
  28211. size: "small",
  28212. class: normalizeClass(unref(ppNs).e("link-btn")),
  28213. disabled: unref(btnDisabled),
  28214. onClick: ($event) => unref(handleRangeConfirm)(false)
  28215. }, {
  28216. default: withCtx(() => [
  28217. createTextVNode(toDisplayString(unref(t)("el.datepicker.confirm")), 1)
  28218. ]),
  28219. _: 1
  28220. }, 8, ["class", "disabled", "onClick"])
  28221. ], 2)) : createCommentVNode("v-if", true)
  28222. ], 2);
  28223. };
  28224. }
  28225. });
  28226. var DateRangePickPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1u, [["__file", "panel-date-range.vue"]]);
  28227. const panelMonthRangeProps = buildProps({
  28228. ...panelRangeSharedProps
  28229. });
  28230. const panelMonthRangeEmits = [
  28231. "pick",
  28232. "set-picker-option",
  28233. "calendar-change"
  28234. ];
  28235. const useMonthRangeHeader = ({
  28236. unlinkPanels,
  28237. leftDate,
  28238. rightDate
  28239. }) => {
  28240. const { t } = useLocale();
  28241. const leftPrevYear = () => {
  28242. leftDate.value = leftDate.value.subtract(1, "year");
  28243. if (!unlinkPanels.value) {
  28244. rightDate.value = rightDate.value.subtract(1, "year");
  28245. }
  28246. };
  28247. const rightNextYear = () => {
  28248. if (!unlinkPanels.value) {
  28249. leftDate.value = leftDate.value.add(1, "year");
  28250. }
  28251. rightDate.value = rightDate.value.add(1, "year");
  28252. };
  28253. const leftNextYear = () => {
  28254. leftDate.value = leftDate.value.add(1, "year");
  28255. };
  28256. const rightPrevYear = () => {
  28257. rightDate.value = rightDate.value.subtract(1, "year");
  28258. };
  28259. const leftLabel = computed(() => {
  28260. return `${leftDate.value.year()} ${t("el.datepicker.year")}`;
  28261. });
  28262. const rightLabel = computed(() => {
  28263. return `${rightDate.value.year()} ${t("el.datepicker.year")}`;
  28264. });
  28265. const leftYear = computed(() => {
  28266. return leftDate.value.year();
  28267. });
  28268. const rightYear = computed(() => {
  28269. return rightDate.value.year() === leftDate.value.year() ? leftDate.value.year() + 1 : rightDate.value.year();
  28270. });
  28271. return {
  28272. leftPrevYear,
  28273. rightNextYear,
  28274. leftNextYear,
  28275. rightPrevYear,
  28276. leftLabel,
  28277. rightLabel,
  28278. leftYear,
  28279. rightYear
  28280. };
  28281. };
  28282. const unit$1 = "year";
  28283. const __default__$16 = defineComponent({
  28284. name: "DatePickerMonthRange"
  28285. });
  28286. const _sfc_main$1t = /* @__PURE__ */ defineComponent({
  28287. ...__default__$16,
  28288. props: panelMonthRangeProps,
  28289. emits: panelMonthRangeEmits,
  28290. setup(__props, { emit }) {
  28291. const props = __props;
  28292. const { lang } = useLocale();
  28293. const pickerBase = inject("EP_PICKER_BASE");
  28294. const isDefaultFormat = inject("ElIsDefaultFormat");
  28295. const { shortcuts, disabledDate } = pickerBase.props;
  28296. const format = toRef(pickerBase.props, "format");
  28297. const defaultValue = toRef(pickerBase.props, "defaultValue");
  28298. const leftDate = ref(dayjs().locale(lang.value));
  28299. const rightDate = ref(dayjs().locale(lang.value).add(1, unit$1));
  28300. const {
  28301. minDate,
  28302. maxDate,
  28303. rangeState,
  28304. ppNs,
  28305. drpNs,
  28306. handleChangeRange,
  28307. handleRangeConfirm,
  28308. handleShortcutClick,
  28309. onSelect
  28310. } = useRangePicker(props, {
  28311. defaultValue,
  28312. leftDate,
  28313. rightDate,
  28314. unit: unit$1,
  28315. onParsedValueChanged
  28316. });
  28317. const hasShortcuts = computed(() => !!shortcuts.length);
  28318. const {
  28319. leftPrevYear,
  28320. rightNextYear,
  28321. leftNextYear,
  28322. rightPrevYear,
  28323. leftLabel,
  28324. rightLabel,
  28325. leftYear,
  28326. rightYear
  28327. } = useMonthRangeHeader({
  28328. unlinkPanels: toRef(props, "unlinkPanels"),
  28329. leftDate,
  28330. rightDate
  28331. });
  28332. const enableYearArrow = computed(() => {
  28333. return props.unlinkPanels && rightYear.value > leftYear.value + 1;
  28334. });
  28335. const handleRangePick = (val, close = true) => {
  28336. const minDate_ = val.minDate;
  28337. const maxDate_ = val.maxDate;
  28338. if (maxDate.value === maxDate_ && minDate.value === minDate_) {
  28339. return;
  28340. }
  28341. emit("calendar-change", [minDate_.toDate(), maxDate_ && maxDate_.toDate()]);
  28342. maxDate.value = maxDate_;
  28343. minDate.value = minDate_;
  28344. if (!close)
  28345. return;
  28346. handleRangeConfirm();
  28347. };
  28348. const handleClear = () => {
  28349. leftDate.value = getDefaultValue(unref(defaultValue), {
  28350. lang: unref(lang),
  28351. unit: "year",
  28352. unlinkPanels: props.unlinkPanels
  28353. })[0];
  28354. rightDate.value = leftDate.value.add(1, "year");
  28355. emit("pick", null);
  28356. };
  28357. const formatToString = (value) => {
  28358. return isArray$1(value) ? value.map((_) => _.format(format.value)) : value.format(format.value);
  28359. };
  28360. const parseUserInput = (value) => {
  28361. return correctlyParseUserInput(value, format.value, lang.value, isDefaultFormat);
  28362. };
  28363. function onParsedValueChanged(minDate2, maxDate2) {
  28364. if (props.unlinkPanels && maxDate2) {
  28365. const minDateYear = (minDate2 == null ? void 0 : minDate2.year()) || 0;
  28366. const maxDateYear = maxDate2.year();
  28367. rightDate.value = minDateYear === maxDateYear ? maxDate2.add(1, unit$1) : maxDate2;
  28368. } else {
  28369. rightDate.value = leftDate.value.add(1, unit$1);
  28370. }
  28371. }
  28372. emit("set-picker-option", ["isValidValue", isValidRange]);
  28373. emit("set-picker-option", ["formatToString", formatToString]);
  28374. emit("set-picker-option", ["parseUserInput", parseUserInput]);
  28375. emit("set-picker-option", ["handleClear", handleClear]);
  28376. return (_ctx, _cache) => {
  28377. return openBlock(), createElementBlock("div", {
  28378. class: normalizeClass([
  28379. unref(ppNs).b(),
  28380. unref(drpNs).b(),
  28381. {
  28382. "has-sidebar": Boolean(_ctx.$slots.sidebar) || unref(hasShortcuts)
  28383. }
  28384. ])
  28385. }, [
  28386. createElementVNode("div", {
  28387. class: normalizeClass(unref(ppNs).e("body-wrapper"))
  28388. }, [
  28389. renderSlot(_ctx.$slots, "sidebar", {
  28390. class: normalizeClass(unref(ppNs).e("sidebar"))
  28391. }),
  28392. unref(hasShortcuts) ? (openBlock(), createElementBlock("div", {
  28393. key: 0,
  28394. class: normalizeClass(unref(ppNs).e("sidebar"))
  28395. }, [
  28396. (openBlock(true), createElementBlock(Fragment, null, renderList(unref(shortcuts), (shortcut, key) => {
  28397. return openBlock(), createElementBlock("button", {
  28398. key,
  28399. type: "button",
  28400. class: normalizeClass(unref(ppNs).e("shortcut")),
  28401. onClick: ($event) => unref(handleShortcutClick)(shortcut)
  28402. }, toDisplayString(shortcut.text), 11, ["onClick"]);
  28403. }), 128))
  28404. ], 2)) : createCommentVNode("v-if", true),
  28405. createElementVNode("div", {
  28406. class: normalizeClass(unref(ppNs).e("body"))
  28407. }, [
  28408. createElementVNode("div", {
  28409. class: normalizeClass([[unref(ppNs).e("content"), unref(drpNs).e("content")], "is-left"])
  28410. }, [
  28411. createElementVNode("div", {
  28412. class: normalizeClass(unref(drpNs).e("header"))
  28413. }, [
  28414. createElementVNode("button", {
  28415. type: "button",
  28416. class: normalizeClass([unref(ppNs).e("icon-btn"), "d-arrow-left"]),
  28417. onClick: unref(leftPrevYear)
  28418. }, [
  28419. renderSlot(_ctx.$slots, "prev-year", {}, () => [
  28420. createVNode(unref(ElIcon), null, {
  28421. default: withCtx(() => [
  28422. createVNode(unref(d_arrow_left_default))
  28423. ]),
  28424. _: 1
  28425. })
  28426. ])
  28427. ], 10, ["onClick"]),
  28428. _ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
  28429. key: 0,
  28430. type: "button",
  28431. disabled: !unref(enableYearArrow),
  28432. class: normalizeClass([[
  28433. unref(ppNs).e("icon-btn"),
  28434. { [unref(ppNs).is("disabled")]: !unref(enableYearArrow) }
  28435. ], "d-arrow-right"]),
  28436. onClick: unref(leftNextYear)
  28437. }, [
  28438. renderSlot(_ctx.$slots, "next-year", {}, () => [
  28439. createVNode(unref(ElIcon), null, {
  28440. default: withCtx(() => [
  28441. createVNode(unref(d_arrow_right_default))
  28442. ]),
  28443. _: 1
  28444. })
  28445. ])
  28446. ], 10, ["disabled", "onClick"])) : createCommentVNode("v-if", true),
  28447. createElementVNode("div", null, toDisplayString(unref(leftLabel)), 1)
  28448. ], 2),
  28449. createVNode(MonthTable, {
  28450. "selection-mode": "range",
  28451. date: leftDate.value,
  28452. "min-date": unref(minDate),
  28453. "max-date": unref(maxDate),
  28454. "range-state": unref(rangeState),
  28455. "disabled-date": unref(disabledDate),
  28456. onChangerange: unref(handleChangeRange),
  28457. onPick: handleRangePick,
  28458. onSelect: unref(onSelect)
  28459. }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "onChangerange", "onSelect"])
  28460. ], 2),
  28461. createElementVNode("div", {
  28462. class: normalizeClass([[unref(ppNs).e("content"), unref(drpNs).e("content")], "is-right"])
  28463. }, [
  28464. createElementVNode("div", {
  28465. class: normalizeClass(unref(drpNs).e("header"))
  28466. }, [
  28467. _ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
  28468. key: 0,
  28469. type: "button",
  28470. disabled: !unref(enableYearArrow),
  28471. class: normalizeClass([[unref(ppNs).e("icon-btn"), { "is-disabled": !unref(enableYearArrow) }], "d-arrow-left"]),
  28472. onClick: unref(rightPrevYear)
  28473. }, [
  28474. renderSlot(_ctx.$slots, "prev-year", {}, () => [
  28475. createVNode(unref(ElIcon), null, {
  28476. default: withCtx(() => [
  28477. createVNode(unref(d_arrow_left_default))
  28478. ]),
  28479. _: 1
  28480. })
  28481. ])
  28482. ], 10, ["disabled", "onClick"])) : createCommentVNode("v-if", true),
  28483. createElementVNode("button", {
  28484. type: "button",
  28485. class: normalizeClass([unref(ppNs).e("icon-btn"), "d-arrow-right"]),
  28486. onClick: unref(rightNextYear)
  28487. }, [
  28488. renderSlot(_ctx.$slots, "next-year", {}, () => [
  28489. createVNode(unref(ElIcon), null, {
  28490. default: withCtx(() => [
  28491. createVNode(unref(d_arrow_right_default))
  28492. ]),
  28493. _: 1
  28494. })
  28495. ])
  28496. ], 10, ["onClick"]),
  28497. createElementVNode("div", null, toDisplayString(unref(rightLabel)), 1)
  28498. ], 2),
  28499. createVNode(MonthTable, {
  28500. "selection-mode": "range",
  28501. date: rightDate.value,
  28502. "min-date": unref(minDate),
  28503. "max-date": unref(maxDate),
  28504. "range-state": unref(rangeState),
  28505. "disabled-date": unref(disabledDate),
  28506. onChangerange: unref(handleChangeRange),
  28507. onPick: handleRangePick,
  28508. onSelect: unref(onSelect)
  28509. }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "onChangerange", "onSelect"])
  28510. ], 2)
  28511. ], 2)
  28512. ], 2)
  28513. ], 2);
  28514. };
  28515. }
  28516. });
  28517. var MonthRangePickPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1t, [["__file", "panel-month-range.vue"]]);
  28518. const panelYearRangeProps = buildProps({
  28519. ...panelRangeSharedProps
  28520. });
  28521. const panelYearRangeEmits = [
  28522. "pick",
  28523. "set-picker-option",
  28524. "calendar-change"
  28525. ];
  28526. const useYearRangeHeader = ({
  28527. unlinkPanels,
  28528. leftDate,
  28529. rightDate
  28530. }) => {
  28531. const leftPrevYear = () => {
  28532. leftDate.value = leftDate.value.subtract(10, "year");
  28533. if (!unlinkPanels.value) {
  28534. rightDate.value = rightDate.value.subtract(10, "year");
  28535. }
  28536. };
  28537. const rightNextYear = () => {
  28538. if (!unlinkPanels.value) {
  28539. leftDate.value = leftDate.value.add(10, "year");
  28540. }
  28541. rightDate.value = rightDate.value.add(10, "year");
  28542. };
  28543. const leftNextYear = () => {
  28544. leftDate.value = leftDate.value.add(10, "year");
  28545. };
  28546. const rightPrevYear = () => {
  28547. rightDate.value = rightDate.value.subtract(10, "year");
  28548. };
  28549. const leftLabel = computed(() => {
  28550. const leftStartDate = Math.floor(leftDate.value.year() / 10) * 10;
  28551. return `${leftStartDate}-${leftStartDate + 9}`;
  28552. });
  28553. const rightLabel = computed(() => {
  28554. const rightStartDate = Math.floor(rightDate.value.year() / 10) * 10;
  28555. return `${rightStartDate}-${rightStartDate + 9}`;
  28556. });
  28557. const leftYear = computed(() => {
  28558. const leftEndDate = Math.floor(leftDate.value.year() / 10) * 10 + 9;
  28559. return leftEndDate;
  28560. });
  28561. const rightYear = computed(() => {
  28562. const rightStartDate = Math.floor(rightDate.value.year() / 10) * 10;
  28563. return rightStartDate;
  28564. });
  28565. return {
  28566. leftPrevYear,
  28567. rightNextYear,
  28568. leftNextYear,
  28569. rightPrevYear,
  28570. leftLabel,
  28571. rightLabel,
  28572. leftYear,
  28573. rightYear
  28574. };
  28575. };
  28576. const unit = "year";
  28577. const __default__$15 = defineComponent({
  28578. name: "DatePickerYearRange"
  28579. });
  28580. const _sfc_main$1s = /* @__PURE__ */ defineComponent({
  28581. ...__default__$15,
  28582. props: panelYearRangeProps,
  28583. emits: panelYearRangeEmits,
  28584. setup(__props, { emit }) {
  28585. const props = __props;
  28586. const { lang } = useLocale();
  28587. const leftDate = ref(dayjs().locale(lang.value));
  28588. const rightDate = ref(leftDate.value.add(10, "year"));
  28589. const { pickerNs: ppNs } = inject(ROOT_PICKER_INJECTION_KEY);
  28590. const drpNs = useNamespace("date-range-picker");
  28591. const isDefaultFormat = inject("isDefaultFormat");
  28592. const hasShortcuts = computed(() => !!shortcuts.length);
  28593. const panelKls = computed(() => [
  28594. ppNs.b(),
  28595. drpNs.b(),
  28596. {
  28597. "has-sidebar": Boolean(useSlots().sidebar) || hasShortcuts.value
  28598. }
  28599. ]);
  28600. const leftPanelKls = computed(() => {
  28601. return {
  28602. content: [ppNs.e("content"), drpNs.e("content"), "is-left"],
  28603. arrowLeftBtn: [ppNs.e("icon-btn"), "d-arrow-left"],
  28604. arrowRightBtn: [
  28605. ppNs.e("icon-btn"),
  28606. { [ppNs.is("disabled")]: !enableYearArrow.value },
  28607. "d-arrow-right"
  28608. ]
  28609. };
  28610. });
  28611. const rightPanelKls = computed(() => {
  28612. return {
  28613. content: [ppNs.e("content"), drpNs.e("content"), "is-right"],
  28614. arrowLeftBtn: [
  28615. ppNs.e("icon-btn"),
  28616. { "is-disabled": !enableYearArrow.value },
  28617. "d-arrow-left"
  28618. ],
  28619. arrowRightBtn: [ppNs.e("icon-btn"), "d-arrow-right"]
  28620. };
  28621. });
  28622. const handleShortcutClick = useShortcut(lang);
  28623. const {
  28624. leftPrevYear,
  28625. rightNextYear,
  28626. leftNextYear,
  28627. rightPrevYear,
  28628. leftLabel,
  28629. rightLabel,
  28630. leftYear,
  28631. rightYear
  28632. } = useYearRangeHeader({
  28633. unlinkPanels: toRef(props, "unlinkPanels"),
  28634. leftDate,
  28635. rightDate
  28636. });
  28637. const enableYearArrow = computed(() => {
  28638. return props.unlinkPanels && rightYear.value > leftYear.value + 1;
  28639. });
  28640. const minDate = ref();
  28641. const maxDate = ref();
  28642. const rangeState = ref({
  28643. endDate: null,
  28644. selecting: false
  28645. });
  28646. const handleChangeRange = (val) => {
  28647. rangeState.value = val;
  28648. };
  28649. const handleRangePick = (val, close = true) => {
  28650. const minDate_ = val.minDate;
  28651. const maxDate_ = val.maxDate;
  28652. if (maxDate.value === maxDate_ && minDate.value === minDate_) {
  28653. return;
  28654. }
  28655. emit("calendar-change", [minDate_.toDate(), maxDate_ && maxDate_.toDate()]);
  28656. maxDate.value = maxDate_;
  28657. minDate.value = minDate_;
  28658. if (!close)
  28659. return;
  28660. handleConfirm();
  28661. };
  28662. const handleConfirm = (visible = false) => {
  28663. if (isValidRange([minDate.value, maxDate.value])) {
  28664. emit("pick", [minDate.value, maxDate.value], visible);
  28665. }
  28666. };
  28667. const onSelect = (selecting) => {
  28668. rangeState.value.selecting = selecting;
  28669. if (!selecting) {
  28670. rangeState.value.endDate = null;
  28671. }
  28672. };
  28673. const pickerBase = inject("EP_PICKER_BASE");
  28674. const { shortcuts, disabledDate } = pickerBase.props;
  28675. const format = toRef(pickerBase.props, "format");
  28676. const defaultValue = toRef(pickerBase.props, "defaultValue");
  28677. const getDefaultValue = () => {
  28678. let start;
  28679. if (isArray$1(defaultValue.value)) {
  28680. const left = dayjs(defaultValue.value[0]);
  28681. let right = dayjs(defaultValue.value[1]);
  28682. if (!props.unlinkPanels) {
  28683. right = left.add(10, unit);
  28684. }
  28685. return [left, right];
  28686. } else if (defaultValue.value) {
  28687. start = dayjs(defaultValue.value);
  28688. } else {
  28689. start = dayjs();
  28690. }
  28691. start = start.locale(lang.value);
  28692. return [start, start.add(10, unit)];
  28693. };
  28694. watch(() => defaultValue.value, (val) => {
  28695. if (val) {
  28696. const defaultArr = getDefaultValue();
  28697. leftDate.value = defaultArr[0];
  28698. rightDate.value = defaultArr[1];
  28699. }
  28700. }, { immediate: true });
  28701. watch(() => props.parsedValue, (newVal) => {
  28702. if (newVal && newVal.length === 2) {
  28703. minDate.value = newVal[0];
  28704. maxDate.value = newVal[1];
  28705. leftDate.value = minDate.value;
  28706. if (props.unlinkPanels && maxDate.value) {
  28707. const minDateYear = minDate.value.year();
  28708. const maxDateYear = maxDate.value.year();
  28709. rightDate.value = minDateYear === maxDateYear ? maxDate.value.add(10, "year") : maxDate.value;
  28710. } else {
  28711. rightDate.value = leftDate.value.add(10, "year");
  28712. }
  28713. } else {
  28714. const defaultArr = getDefaultValue();
  28715. minDate.value = void 0;
  28716. maxDate.value = void 0;
  28717. leftDate.value = defaultArr[0];
  28718. rightDate.value = defaultArr[1];
  28719. }
  28720. }, { immediate: true });
  28721. const parseUserInput = (value) => {
  28722. return correctlyParseUserInput(value, format.value, lang.value, isDefaultFormat);
  28723. };
  28724. const formatToString = (value) => {
  28725. return isArray$1(value) ? value.map((day) => day.format(format.value)) : value.format(format.value);
  28726. };
  28727. const isValidValue = (date) => {
  28728. return isValidRange(date) && (disabledDate ? !disabledDate(date[0].toDate()) && !disabledDate(date[1].toDate()) : true);
  28729. };
  28730. const handleClear = () => {
  28731. const defaultArr = getDefaultValue();
  28732. leftDate.value = defaultArr[0];
  28733. rightDate.value = defaultArr[1];
  28734. maxDate.value = void 0;
  28735. minDate.value = void 0;
  28736. emit("pick", null);
  28737. };
  28738. emit("set-picker-option", ["isValidValue", isValidValue]);
  28739. emit("set-picker-option", ["parseUserInput", parseUserInput]);
  28740. emit("set-picker-option", ["formatToString", formatToString]);
  28741. emit("set-picker-option", ["handleClear", handleClear]);
  28742. return (_ctx, _cache) => {
  28743. return openBlock(), createElementBlock("div", {
  28744. class: normalizeClass(unref(panelKls))
  28745. }, [
  28746. createElementVNode("div", {
  28747. class: normalizeClass(unref(ppNs).e("body-wrapper"))
  28748. }, [
  28749. renderSlot(_ctx.$slots, "sidebar", {
  28750. class: normalizeClass(unref(ppNs).e("sidebar"))
  28751. }),
  28752. unref(hasShortcuts) ? (openBlock(), createElementBlock("div", {
  28753. key: 0,
  28754. class: normalizeClass(unref(ppNs).e("sidebar"))
  28755. }, [
  28756. (openBlock(true), createElementBlock(Fragment, null, renderList(unref(shortcuts), (shortcut, key) => {
  28757. return openBlock(), createElementBlock("button", {
  28758. key,
  28759. type: "button",
  28760. class: normalizeClass(unref(ppNs).e("shortcut")),
  28761. onClick: ($event) => unref(handleShortcutClick)(shortcut)
  28762. }, toDisplayString(shortcut.text), 11, ["onClick"]);
  28763. }), 128))
  28764. ], 2)) : createCommentVNode("v-if", true),
  28765. createElementVNode("div", {
  28766. class: normalizeClass(unref(ppNs).e("body"))
  28767. }, [
  28768. createElementVNode("div", {
  28769. class: normalizeClass(unref(leftPanelKls).content)
  28770. }, [
  28771. createElementVNode("div", {
  28772. class: normalizeClass(unref(drpNs).e("header"))
  28773. }, [
  28774. createElementVNode("button", {
  28775. type: "button",
  28776. class: normalizeClass(unref(leftPanelKls).arrowLeftBtn),
  28777. onClick: unref(leftPrevYear)
  28778. }, [
  28779. renderSlot(_ctx.$slots, "prev-year", {}, () => [
  28780. createVNode(unref(ElIcon), null, {
  28781. default: withCtx(() => [
  28782. createVNode(unref(d_arrow_left_default))
  28783. ]),
  28784. _: 1
  28785. })
  28786. ])
  28787. ], 10, ["onClick"]),
  28788. _ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
  28789. key: 0,
  28790. type: "button",
  28791. disabled: !unref(enableYearArrow),
  28792. class: normalizeClass(unref(leftPanelKls).arrowRightBtn),
  28793. onClick: unref(leftNextYear)
  28794. }, [
  28795. renderSlot(_ctx.$slots, "next-year", {}, () => [
  28796. createVNode(unref(ElIcon), null, {
  28797. default: withCtx(() => [
  28798. createVNode(unref(d_arrow_right_default))
  28799. ]),
  28800. _: 1
  28801. })
  28802. ])
  28803. ], 10, ["disabled", "onClick"])) : createCommentVNode("v-if", true),
  28804. createElementVNode("div", null, toDisplayString(unref(leftLabel)), 1)
  28805. ], 2),
  28806. createVNode(YearTable, {
  28807. "selection-mode": "range",
  28808. date: leftDate.value,
  28809. "min-date": minDate.value,
  28810. "max-date": maxDate.value,
  28811. "range-state": rangeState.value,
  28812. "disabled-date": unref(disabledDate),
  28813. onChangerange: handleChangeRange,
  28814. onPick: handleRangePick,
  28815. onSelect
  28816. }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date"])
  28817. ], 2),
  28818. createElementVNode("div", {
  28819. class: normalizeClass(unref(rightPanelKls).content)
  28820. }, [
  28821. createElementVNode("div", {
  28822. class: normalizeClass(unref(drpNs).e("header"))
  28823. }, [
  28824. _ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
  28825. key: 0,
  28826. type: "button",
  28827. disabled: !unref(enableYearArrow),
  28828. class: normalizeClass(unref(rightPanelKls).arrowLeftBtn),
  28829. onClick: unref(rightPrevYear)
  28830. }, [
  28831. renderSlot(_ctx.$slots, "prev-year", {}, () => [
  28832. createVNode(unref(ElIcon), null, {
  28833. default: withCtx(() => [
  28834. createVNode(unref(d_arrow_left_default))
  28835. ]),
  28836. _: 1
  28837. })
  28838. ])
  28839. ], 10, ["disabled", "onClick"])) : createCommentVNode("v-if", true),
  28840. createElementVNode("button", {
  28841. type: "button",
  28842. class: normalizeClass(unref(rightPanelKls).arrowRightBtn),
  28843. onClick: unref(rightNextYear)
  28844. }, [
  28845. renderSlot(_ctx.$slots, "next-year", {}, () => [
  28846. createVNode(unref(ElIcon), null, {
  28847. default: withCtx(() => [
  28848. createVNode(unref(d_arrow_right_default))
  28849. ]),
  28850. _: 1
  28851. })
  28852. ])
  28853. ], 10, ["onClick"]),
  28854. createElementVNode("div", null, toDisplayString(unref(rightLabel)), 1)
  28855. ], 2),
  28856. createVNode(YearTable, {
  28857. "selection-mode": "range",
  28858. date: rightDate.value,
  28859. "min-date": minDate.value,
  28860. "max-date": maxDate.value,
  28861. "range-state": rangeState.value,
  28862. "disabled-date": unref(disabledDate),
  28863. onChangerange: handleChangeRange,
  28864. onPick: handleRangePick,
  28865. onSelect
  28866. }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date"])
  28867. ], 2)
  28868. ], 2)
  28869. ], 2)
  28870. ], 2);
  28871. };
  28872. }
  28873. });
  28874. var YearRangePickPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1s, [["__file", "panel-year-range.vue"]]);
  28875. const getPanel = function(type) {
  28876. switch (type) {
  28877. case "daterange":
  28878. case "datetimerange": {
  28879. return DateRangePickPanel;
  28880. }
  28881. case "monthrange": {
  28882. return MonthRangePickPanel;
  28883. }
  28884. case "yearrange": {
  28885. return YearRangePickPanel;
  28886. }
  28887. default: {
  28888. return DatePickPanel;
  28889. }
  28890. }
  28891. };
  28892. dayjs.extend(localeData);
  28893. dayjs.extend(advancedFormat);
  28894. dayjs.extend(customParseFormat);
  28895. dayjs.extend(weekOfYear);
  28896. dayjs.extend(weekYear);
  28897. dayjs.extend(dayOfYear);
  28898. dayjs.extend(isSameOrAfter);
  28899. dayjs.extend(isSameOrBefore);
  28900. var DatePicker = defineComponent({
  28901. name: "ElDatePicker",
  28902. install: null,
  28903. props: datePickerProps,
  28904. emits: [UPDATE_MODEL_EVENT],
  28905. setup(props, {
  28906. expose,
  28907. emit,
  28908. slots
  28909. }) {
  28910. const ns = useNamespace("picker-panel");
  28911. const isDefaultFormat = computed(() => {
  28912. return !props.format;
  28913. });
  28914. provide("ElIsDefaultFormat", isDefaultFormat);
  28915. provide("ElPopperOptions", reactive(toRef(props, "popperOptions")));
  28916. provide(ROOT_PICKER_INJECTION_KEY, {
  28917. slots,
  28918. pickerNs: ns
  28919. });
  28920. const commonPicker = ref();
  28921. const refProps = {
  28922. focus: () => {
  28923. var _a;
  28924. (_a = commonPicker.value) == null ? void 0 : _a.focus();
  28925. },
  28926. blur: () => {
  28927. var _a;
  28928. (_a = commonPicker.value) == null ? void 0 : _a.blur();
  28929. },
  28930. handleOpen: () => {
  28931. var _a;
  28932. (_a = commonPicker.value) == null ? void 0 : _a.handleOpen();
  28933. },
  28934. handleClose: () => {
  28935. var _a;
  28936. (_a = commonPicker.value) == null ? void 0 : _a.handleClose();
  28937. }
  28938. };
  28939. expose(refProps);
  28940. const onModelValueUpdated = (val) => {
  28941. emit(UPDATE_MODEL_EVENT, val);
  28942. };
  28943. return () => {
  28944. var _a;
  28945. const format = (_a = props.format) != null ? _a : DEFAULT_FORMATS_DATEPICKER[props.type] || DEFAULT_FORMATS_DATE;
  28946. const Component = getPanel(props.type);
  28947. return createVNode(CommonPicker, mergeProps(props, {
  28948. "format": format,
  28949. "type": props.type,
  28950. "ref": commonPicker,
  28951. "onUpdate:modelValue": onModelValueUpdated
  28952. }), {
  28953. default: (scopedProps) => createVNode(Component, scopedProps, {
  28954. "prev-month": slots["prev-month"],
  28955. "next-month": slots["next-month"],
  28956. "prev-year": slots["prev-year"],
  28957. "next-year": slots["next-year"]
  28958. }),
  28959. "range-separator": slots["range-separator"]
  28960. });
  28961. };
  28962. }
  28963. });
  28964. const ElDatePicker = withInstall(DatePicker);
  28965. const descriptionsKey = Symbol("elDescriptions");
  28966. var ElDescriptionsCell = defineComponent({
  28967. name: "ElDescriptionsCell",
  28968. props: {
  28969. cell: {
  28970. type: Object
  28971. },
  28972. tag: {
  28973. type: String,
  28974. default: "td"
  28975. },
  28976. type: {
  28977. type: String
  28978. }
  28979. },
  28980. setup() {
  28981. const descriptions = inject(descriptionsKey, {});
  28982. return {
  28983. descriptions
  28984. };
  28985. },
  28986. render() {
  28987. var _a;
  28988. const item = getNormalizedProps(this.cell);
  28989. const directives = (((_a = this.cell) == null ? void 0 : _a.dirs) || []).map((dire) => {
  28990. const { dir, arg, modifiers, value } = dire;
  28991. return [dir, value, arg, modifiers];
  28992. });
  28993. const { border, direction } = this.descriptions;
  28994. const isVertical = direction === "vertical";
  28995. const renderLabel = () => {
  28996. var _a2, _b, _c;
  28997. return ((_c = (_b = (_a2 = this.cell) == null ? void 0 : _a2.children) == null ? void 0 : _b.label) == null ? void 0 : _c.call(_b)) || item.label;
  28998. };
  28999. const renderContent = () => {
  29000. var _a2, _b, _c;
  29001. return (_c = (_b = (_a2 = this.cell) == null ? void 0 : _a2.children) == null ? void 0 : _b.default) == null ? void 0 : _c.call(_b);
  29002. };
  29003. const span = item.span;
  29004. const rowspan = item.rowspan;
  29005. const align = item.align ? `is-${item.align}` : "";
  29006. const labelAlign = item.labelAlign ? `is-${item.labelAlign}` : align;
  29007. const className = item.className;
  29008. const labelClassName = item.labelClassName;
  29009. const width = this.type === "label" ? item.labelWidth || this.descriptions.labelWidth || item.width : item.width;
  29010. const style = {
  29011. width: addUnit(width),
  29012. minWidth: addUnit(item.minWidth)
  29013. };
  29014. const ns = useNamespace("descriptions");
  29015. switch (this.type) {
  29016. case "label":
  29017. return withDirectives(h$1(this.tag, {
  29018. style,
  29019. class: [
  29020. ns.e("cell"),
  29021. ns.e("label"),
  29022. ns.is("bordered-label", border),
  29023. ns.is("vertical-label", isVertical),
  29024. labelAlign,
  29025. labelClassName
  29026. ],
  29027. colSpan: isVertical ? span : 1,
  29028. rowspan: isVertical ? 1 : rowspan
  29029. }, renderLabel()), directives);
  29030. case "content":
  29031. return withDirectives(h$1(this.tag, {
  29032. style,
  29033. class: [
  29034. ns.e("cell"),
  29035. ns.e("content"),
  29036. ns.is("bordered-content", border),
  29037. ns.is("vertical-content", isVertical),
  29038. align,
  29039. className
  29040. ],
  29041. colSpan: isVertical ? span : span * 2 - 1,
  29042. rowspan: isVertical ? rowspan * 2 - 1 : rowspan
  29043. }, renderContent()), directives);
  29044. default: {
  29045. const label = renderLabel();
  29046. const labelStyle = {};
  29047. const width2 = addUnit(item.labelWidth || this.descriptions.labelWidth);
  29048. if (width2) {
  29049. labelStyle.width = width2;
  29050. labelStyle.display = "inline-block";
  29051. }
  29052. return withDirectives(h$1("td", {
  29053. style,
  29054. class: [ns.e("cell"), align],
  29055. colSpan: span,
  29056. rowspan
  29057. }, [
  29058. !isNil(label) ? h$1("span", {
  29059. style: labelStyle,
  29060. class: [ns.e("label"), labelClassName]
  29061. }, label) : void 0,
  29062. h$1("span", {
  29063. class: [ns.e("content"), className]
  29064. }, renderContent())
  29065. ]), directives);
  29066. }
  29067. }
  29068. }
  29069. });
  29070. const descriptionsRowProps = buildProps({
  29071. row: {
  29072. type: definePropType(Array),
  29073. default: () => []
  29074. }
  29075. });
  29076. const __default__$14 = defineComponent({
  29077. name: "ElDescriptionsRow"
  29078. });
  29079. const _sfc_main$1r = /* @__PURE__ */ defineComponent({
  29080. ...__default__$14,
  29081. props: descriptionsRowProps,
  29082. setup(__props) {
  29083. const descriptions = inject(descriptionsKey, {});
  29084. return (_ctx, _cache) => {
  29085. return unref(descriptions).direction === "vertical" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  29086. createElementVNode("tr", null, [
  29087. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.row, (cell, _index) => {
  29088. return openBlock(), createBlock(unref(ElDescriptionsCell), {
  29089. key: `tr1-${_index}`,
  29090. cell,
  29091. tag: "th",
  29092. type: "label"
  29093. }, null, 8, ["cell"]);
  29094. }), 128))
  29095. ]),
  29096. createElementVNode("tr", null, [
  29097. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.row, (cell, _index) => {
  29098. return openBlock(), createBlock(unref(ElDescriptionsCell), {
  29099. key: `tr2-${_index}`,
  29100. cell,
  29101. tag: "td",
  29102. type: "content"
  29103. }, null, 8, ["cell"]);
  29104. }), 128))
  29105. ])
  29106. ], 64)) : (openBlock(), createElementBlock("tr", { key: 1 }, [
  29107. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.row, (cell, _index) => {
  29108. return openBlock(), createElementBlock(Fragment, {
  29109. key: `tr3-${_index}`
  29110. }, [
  29111. unref(descriptions).border ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  29112. createVNode(unref(ElDescriptionsCell), {
  29113. cell,
  29114. tag: "td",
  29115. type: "label"
  29116. }, null, 8, ["cell"]),
  29117. createVNode(unref(ElDescriptionsCell), {
  29118. cell,
  29119. tag: "td",
  29120. type: "content"
  29121. }, null, 8, ["cell"])
  29122. ], 64)) : (openBlock(), createBlock(unref(ElDescriptionsCell), {
  29123. key: 1,
  29124. cell,
  29125. tag: "td",
  29126. type: "both"
  29127. }, null, 8, ["cell"]))
  29128. ], 64);
  29129. }), 128))
  29130. ]));
  29131. };
  29132. }
  29133. });
  29134. var ElDescriptionsRow = /* @__PURE__ */ _export_sfc(_sfc_main$1r, [["__file", "descriptions-row.vue"]]);
  29135. const descriptionProps = buildProps({
  29136. border: Boolean,
  29137. column: {
  29138. type: Number,
  29139. default: 3
  29140. },
  29141. direction: {
  29142. type: String,
  29143. values: ["horizontal", "vertical"],
  29144. default: "horizontal"
  29145. },
  29146. size: useSizeProp,
  29147. title: {
  29148. type: String,
  29149. default: ""
  29150. },
  29151. extra: {
  29152. type: String,
  29153. default: ""
  29154. },
  29155. labelWidth: {
  29156. type: [String, Number],
  29157. default: ""
  29158. }
  29159. });
  29160. const COMPONENT_NAME$d = "ElDescriptionsItem";
  29161. const __default__$13 = defineComponent({
  29162. name: "ElDescriptions"
  29163. });
  29164. const _sfc_main$1q = /* @__PURE__ */ defineComponent({
  29165. ...__default__$13,
  29166. props: descriptionProps,
  29167. setup(__props) {
  29168. const props = __props;
  29169. const ns = useNamespace("descriptions");
  29170. const descriptionsSize = useFormSize();
  29171. const slots = useSlots();
  29172. provide(descriptionsKey, props);
  29173. const descriptionKls = computed(() => [ns.b(), ns.m(descriptionsSize.value)]);
  29174. const filledNode = (node, span, count, isLast = false) => {
  29175. if (!node.props) {
  29176. node.props = {};
  29177. }
  29178. if (span > count) {
  29179. node.props.span = count;
  29180. }
  29181. if (isLast) {
  29182. node.props.span = span;
  29183. }
  29184. return node;
  29185. };
  29186. const getRows = () => {
  29187. if (!slots.default)
  29188. return [];
  29189. const children = flattedChildren(slots.default()).filter((node) => {
  29190. var _a;
  29191. return ((_a = node == null ? void 0 : node.type) == null ? void 0 : _a.name) === COMPONENT_NAME$d;
  29192. });
  29193. const rows = [];
  29194. let temp = [];
  29195. let count = props.column;
  29196. let totalSpan = 0;
  29197. const rowspanTemp = [];
  29198. children.forEach((node, index) => {
  29199. var _a, _b, _c;
  29200. const span = ((_a = node.props) == null ? void 0 : _a.span) || 1;
  29201. const rowspan = ((_b = node.props) == null ? void 0 : _b.rowspan) || 1;
  29202. const rowNo = rows.length;
  29203. rowspanTemp[rowNo] || (rowspanTemp[rowNo] = 0);
  29204. if (rowspan > 1) {
  29205. for (let i = 1; i < rowspan; i++) {
  29206. rowspanTemp[_c = rowNo + i] || (rowspanTemp[_c] = 0);
  29207. rowspanTemp[rowNo + i]++;
  29208. totalSpan++;
  29209. }
  29210. }
  29211. if (rowspanTemp[rowNo] > 0) {
  29212. count -= rowspanTemp[rowNo];
  29213. rowspanTemp[rowNo] = 0;
  29214. }
  29215. if (index < children.length - 1) {
  29216. totalSpan += span > count ? count : span;
  29217. }
  29218. if (index === children.length - 1) {
  29219. const lastSpan = props.column - totalSpan % props.column;
  29220. temp.push(filledNode(node, lastSpan, count, true));
  29221. rows.push(temp);
  29222. return;
  29223. }
  29224. if (span < count) {
  29225. count -= span;
  29226. temp.push(node);
  29227. } else {
  29228. temp.push(filledNode(node, span, count));
  29229. rows.push(temp);
  29230. count = props.column;
  29231. temp = [];
  29232. }
  29233. });
  29234. return rows;
  29235. };
  29236. return (_ctx, _cache) => {
  29237. return openBlock(), createElementBlock("div", {
  29238. class: normalizeClass(unref(descriptionKls))
  29239. }, [
  29240. _ctx.title || _ctx.extra || _ctx.$slots.title || _ctx.$slots.extra ? (openBlock(), createElementBlock("div", {
  29241. key: 0,
  29242. class: normalizeClass(unref(ns).e("header"))
  29243. }, [
  29244. createElementVNode("div", {
  29245. class: normalizeClass(unref(ns).e("title"))
  29246. }, [
  29247. renderSlot(_ctx.$slots, "title", {}, () => [
  29248. createTextVNode(toDisplayString(_ctx.title), 1)
  29249. ])
  29250. ], 2),
  29251. createElementVNode("div", {
  29252. class: normalizeClass(unref(ns).e("extra"))
  29253. }, [
  29254. renderSlot(_ctx.$slots, "extra", {}, () => [
  29255. createTextVNode(toDisplayString(_ctx.extra), 1)
  29256. ])
  29257. ], 2)
  29258. ], 2)) : createCommentVNode("v-if", true),
  29259. createElementVNode("div", {
  29260. class: normalizeClass(unref(ns).e("body"))
  29261. }, [
  29262. createElementVNode("table", {
  29263. class: normalizeClass([unref(ns).e("table"), unref(ns).is("bordered", _ctx.border)])
  29264. }, [
  29265. createElementVNode("tbody", null, [
  29266. (openBlock(true), createElementBlock(Fragment, null, renderList(getRows(), (row, _index) => {
  29267. return openBlock(), createBlock(ElDescriptionsRow, {
  29268. key: _index,
  29269. row
  29270. }, null, 8, ["row"]);
  29271. }), 128))
  29272. ])
  29273. ], 2)
  29274. ], 2)
  29275. ], 2);
  29276. };
  29277. }
  29278. });
  29279. var Descriptions = /* @__PURE__ */ _export_sfc(_sfc_main$1q, [["__file", "description.vue"]]);
  29280. const descriptionItemProps = buildProps({
  29281. label: {
  29282. type: String,
  29283. default: ""
  29284. },
  29285. span: {
  29286. type: Number,
  29287. default: 1
  29288. },
  29289. rowspan: {
  29290. type: Number,
  29291. default: 1
  29292. },
  29293. width: {
  29294. type: [String, Number],
  29295. default: ""
  29296. },
  29297. minWidth: {
  29298. type: [String, Number],
  29299. default: ""
  29300. },
  29301. labelWidth: {
  29302. type: [String, Number],
  29303. default: ""
  29304. },
  29305. align: {
  29306. type: String,
  29307. default: "left"
  29308. },
  29309. labelAlign: {
  29310. type: String,
  29311. default: ""
  29312. },
  29313. className: {
  29314. type: String,
  29315. default: ""
  29316. },
  29317. labelClassName: {
  29318. type: String,
  29319. default: ""
  29320. }
  29321. });
  29322. const DescriptionItem = defineComponent({
  29323. name: COMPONENT_NAME$d,
  29324. props: descriptionItemProps
  29325. });
  29326. const ElDescriptions = withInstall(Descriptions, {
  29327. DescriptionsItem: DescriptionItem
  29328. });
  29329. const ElDescriptionsItem = withNoopInstall(DescriptionItem);
  29330. const overlayProps = buildProps({
  29331. mask: {
  29332. type: Boolean,
  29333. default: true
  29334. },
  29335. customMaskEvent: Boolean,
  29336. overlayClass: {
  29337. type: definePropType([
  29338. String,
  29339. Array,
  29340. Object
  29341. ])
  29342. },
  29343. zIndex: {
  29344. type: definePropType([String, Number])
  29345. }
  29346. });
  29347. const overlayEmits = {
  29348. click: (evt) => evt instanceof MouseEvent
  29349. };
  29350. const BLOCK = "overlay";
  29351. var Overlay$1 = defineComponent({
  29352. name: "ElOverlay",
  29353. props: overlayProps,
  29354. emits: overlayEmits,
  29355. setup(props, { slots, emit }) {
  29356. const ns = useNamespace(BLOCK);
  29357. const onMaskClick = (e) => {
  29358. emit("click", e);
  29359. };
  29360. const { onClick, onMousedown, onMouseup } = useSameTarget(props.customMaskEvent ? void 0 : onMaskClick);
  29361. return () => {
  29362. return props.mask ? createVNode("div", {
  29363. class: [ns.b(), props.overlayClass],
  29364. style: {
  29365. zIndex: props.zIndex
  29366. },
  29367. onClick,
  29368. onMousedown,
  29369. onMouseup
  29370. }, [renderSlot(slots, "default")], PatchFlags.STYLE | PatchFlags.CLASS | PatchFlags.PROPS, ["onClick", "onMouseup", "onMousedown"]) : h$1("div", {
  29371. class: props.overlayClass,
  29372. style: {
  29373. zIndex: props.zIndex,
  29374. position: "fixed",
  29375. top: "0px",
  29376. right: "0px",
  29377. bottom: "0px",
  29378. left: "0px"
  29379. }
  29380. }, [renderSlot(slots, "default")]);
  29381. };
  29382. }
  29383. });
  29384. const ElOverlay = Overlay$1;
  29385. const dialogInjectionKey = Symbol("dialogInjectionKey");
  29386. const dialogContentProps = buildProps({
  29387. center: Boolean,
  29388. alignCenter: Boolean,
  29389. closeIcon: {
  29390. type: iconPropType
  29391. },
  29392. draggable: Boolean,
  29393. overflow: Boolean,
  29394. fullscreen: Boolean,
  29395. headerClass: String,
  29396. bodyClass: String,
  29397. footerClass: String,
  29398. showClose: {
  29399. type: Boolean,
  29400. default: true
  29401. },
  29402. title: {
  29403. type: String,
  29404. default: ""
  29405. },
  29406. ariaLevel: {
  29407. type: String,
  29408. default: "2"
  29409. }
  29410. });
  29411. const dialogContentEmits = {
  29412. close: () => true
  29413. };
  29414. const __default__$12 = defineComponent({ name: "ElDialogContent" });
  29415. const _sfc_main$1p = /* @__PURE__ */ defineComponent({
  29416. ...__default__$12,
  29417. props: dialogContentProps,
  29418. emits: dialogContentEmits,
  29419. setup(__props, { expose }) {
  29420. const props = __props;
  29421. const { t } = useLocale();
  29422. const { Close } = CloseComponents;
  29423. const { dialogRef, headerRef, bodyId, ns, style } = inject(dialogInjectionKey);
  29424. const { focusTrapRef } = inject(FOCUS_TRAP_INJECTION_KEY);
  29425. const dialogKls = computed(() => [
  29426. ns.b(),
  29427. ns.is("fullscreen", props.fullscreen),
  29428. ns.is("draggable", props.draggable),
  29429. ns.is("align-center", props.alignCenter),
  29430. { [ns.m("center")]: props.center }
  29431. ]);
  29432. const composedDialogRef = composeRefs(focusTrapRef, dialogRef);
  29433. const draggable = computed(() => props.draggable);
  29434. const overflow = computed(() => props.overflow);
  29435. const { resetPosition } = useDraggable(dialogRef, headerRef, draggable, overflow);
  29436. expose({
  29437. resetPosition
  29438. });
  29439. return (_ctx, _cache) => {
  29440. return openBlock(), createElementBlock("div", {
  29441. ref: unref(composedDialogRef),
  29442. class: normalizeClass(unref(dialogKls)),
  29443. style: normalizeStyle(unref(style)),
  29444. tabindex: "-1"
  29445. }, [
  29446. createElementVNode("header", {
  29447. ref_key: "headerRef",
  29448. ref: headerRef,
  29449. class: normalizeClass([unref(ns).e("header"), _ctx.headerClass, { "show-close": _ctx.showClose }])
  29450. }, [
  29451. renderSlot(_ctx.$slots, "header", {}, () => [
  29452. createElementVNode("span", {
  29453. role: "heading",
  29454. "aria-level": _ctx.ariaLevel,
  29455. class: normalizeClass(unref(ns).e("title"))
  29456. }, toDisplayString(_ctx.title), 11, ["aria-level"])
  29457. ]),
  29458. _ctx.showClose ? (openBlock(), createElementBlock("button", {
  29459. key: 0,
  29460. "aria-label": unref(t)("el.dialog.close"),
  29461. class: normalizeClass(unref(ns).e("headerbtn")),
  29462. type: "button",
  29463. onClick: ($event) => _ctx.$emit("close")
  29464. }, [
  29465. createVNode(unref(ElIcon), {
  29466. class: normalizeClass(unref(ns).e("close"))
  29467. }, {
  29468. default: withCtx(() => [
  29469. (openBlock(), createBlock(resolveDynamicComponent(_ctx.closeIcon || unref(Close))))
  29470. ]),
  29471. _: 1
  29472. }, 8, ["class"])
  29473. ], 10, ["aria-label", "onClick"])) : createCommentVNode("v-if", true)
  29474. ], 2),
  29475. createElementVNode("div", {
  29476. id: unref(bodyId),
  29477. class: normalizeClass([unref(ns).e("body"), _ctx.bodyClass])
  29478. }, [
  29479. renderSlot(_ctx.$slots, "default")
  29480. ], 10, ["id"]),
  29481. _ctx.$slots.footer ? (openBlock(), createElementBlock("footer", {
  29482. key: 0,
  29483. class: normalizeClass([unref(ns).e("footer"), _ctx.footerClass])
  29484. }, [
  29485. renderSlot(_ctx.$slots, "footer")
  29486. ], 2)) : createCommentVNode("v-if", true)
  29487. ], 6);
  29488. };
  29489. }
  29490. });
  29491. var ElDialogContent = /* @__PURE__ */ _export_sfc(_sfc_main$1p, [["__file", "dialog-content.vue"]]);
  29492. const dialogProps = buildProps({
  29493. ...dialogContentProps,
  29494. appendToBody: Boolean,
  29495. appendTo: {
  29496. type: definePropType([String, Object]),
  29497. default: "body"
  29498. },
  29499. beforeClose: {
  29500. type: definePropType(Function)
  29501. },
  29502. destroyOnClose: Boolean,
  29503. closeOnClickModal: {
  29504. type: Boolean,
  29505. default: true
  29506. },
  29507. closeOnPressEscape: {
  29508. type: Boolean,
  29509. default: true
  29510. },
  29511. lockScroll: {
  29512. type: Boolean,
  29513. default: true
  29514. },
  29515. modal: {
  29516. type: Boolean,
  29517. default: true
  29518. },
  29519. openDelay: {
  29520. type: Number,
  29521. default: 0
  29522. },
  29523. closeDelay: {
  29524. type: Number,
  29525. default: 0
  29526. },
  29527. top: {
  29528. type: String
  29529. },
  29530. modelValue: Boolean,
  29531. modalClass: String,
  29532. headerClass: String,
  29533. bodyClass: String,
  29534. footerClass: String,
  29535. width: {
  29536. type: [String, Number]
  29537. },
  29538. zIndex: {
  29539. type: Number
  29540. },
  29541. trapFocus: Boolean,
  29542. headerAriaLevel: {
  29543. type: String,
  29544. default: "2"
  29545. }
  29546. });
  29547. const dialogEmits = {
  29548. open: () => true,
  29549. opened: () => true,
  29550. close: () => true,
  29551. closed: () => true,
  29552. [UPDATE_MODEL_EVENT]: (value) => isBoolean(value),
  29553. openAutoFocus: () => true,
  29554. closeAutoFocus: () => true
  29555. };
  29556. const useDialog = (props, targetRef) => {
  29557. var _a;
  29558. const instance = getCurrentInstance();
  29559. const emit = instance.emit;
  29560. const { nextZIndex } = useZIndex();
  29561. let lastPosition = "";
  29562. const titleId = useId();
  29563. const bodyId = useId();
  29564. const visible = ref(false);
  29565. const closed = ref(false);
  29566. const rendered = ref(false);
  29567. const zIndex = ref((_a = props.zIndex) != null ? _a : nextZIndex());
  29568. let openTimer = void 0;
  29569. let closeTimer = void 0;
  29570. const namespace = useGlobalConfig("namespace", defaultNamespace);
  29571. const style = computed(() => {
  29572. const style2 = {};
  29573. const varPrefix = `--${namespace.value}-dialog`;
  29574. if (!props.fullscreen) {
  29575. if (props.top) {
  29576. style2[`${varPrefix}-margin-top`] = props.top;
  29577. }
  29578. if (props.width) {
  29579. style2[`${varPrefix}-width`] = addUnit(props.width);
  29580. }
  29581. }
  29582. return style2;
  29583. });
  29584. const overlayDialogStyle = computed(() => {
  29585. if (props.alignCenter) {
  29586. return { display: "flex" };
  29587. }
  29588. return {};
  29589. });
  29590. function afterEnter() {
  29591. emit("opened");
  29592. }
  29593. function afterLeave() {
  29594. emit("closed");
  29595. emit(UPDATE_MODEL_EVENT, false);
  29596. if (props.destroyOnClose) {
  29597. rendered.value = false;
  29598. }
  29599. }
  29600. function beforeLeave() {
  29601. emit("close");
  29602. }
  29603. function open() {
  29604. closeTimer == null ? void 0 : closeTimer();
  29605. openTimer == null ? void 0 : openTimer();
  29606. if (props.openDelay && props.openDelay > 0) {
  29607. ({ stop: openTimer } = useTimeoutFn(() => doOpen(), props.openDelay));
  29608. } else {
  29609. doOpen();
  29610. }
  29611. }
  29612. function close() {
  29613. openTimer == null ? void 0 : openTimer();
  29614. closeTimer == null ? void 0 : closeTimer();
  29615. if (props.closeDelay && props.closeDelay > 0) {
  29616. ({ stop: closeTimer } = useTimeoutFn(() => doClose(), props.closeDelay));
  29617. } else {
  29618. doClose();
  29619. }
  29620. }
  29621. function handleClose() {
  29622. function hide(shouldCancel) {
  29623. if (shouldCancel)
  29624. return;
  29625. closed.value = true;
  29626. visible.value = false;
  29627. }
  29628. if (props.beforeClose) {
  29629. props.beforeClose(hide);
  29630. } else {
  29631. close();
  29632. }
  29633. }
  29634. function onModalClick() {
  29635. if (props.closeOnClickModal) {
  29636. handleClose();
  29637. }
  29638. }
  29639. function doOpen() {
  29640. if (!isClient)
  29641. return;
  29642. visible.value = true;
  29643. }
  29644. function doClose() {
  29645. visible.value = false;
  29646. }
  29647. function onOpenAutoFocus() {
  29648. emit("openAutoFocus");
  29649. }
  29650. function onCloseAutoFocus() {
  29651. emit("closeAutoFocus");
  29652. }
  29653. function onFocusoutPrevented(event) {
  29654. var _a2;
  29655. if (((_a2 = event.detail) == null ? void 0 : _a2.focusReason) === "pointer") {
  29656. event.preventDefault();
  29657. }
  29658. }
  29659. if (props.lockScroll) {
  29660. useLockscreen(visible);
  29661. }
  29662. function onCloseRequested() {
  29663. if (props.closeOnPressEscape) {
  29664. handleClose();
  29665. }
  29666. }
  29667. watch(() => props.modelValue, (val) => {
  29668. if (val) {
  29669. closed.value = false;
  29670. open();
  29671. rendered.value = true;
  29672. zIndex.value = isUndefined$1(props.zIndex) ? nextZIndex() : zIndex.value++;
  29673. nextTick(() => {
  29674. emit("open");
  29675. if (targetRef.value) {
  29676. targetRef.value.parentElement.scrollTop = 0;
  29677. targetRef.value.parentElement.scrollLeft = 0;
  29678. targetRef.value.scrollTop = 0;
  29679. }
  29680. });
  29681. } else {
  29682. if (visible.value) {
  29683. close();
  29684. }
  29685. }
  29686. });
  29687. watch(() => props.fullscreen, (val) => {
  29688. if (!targetRef.value)
  29689. return;
  29690. if (val) {
  29691. lastPosition = targetRef.value.style.transform;
  29692. targetRef.value.style.transform = "";
  29693. } else {
  29694. targetRef.value.style.transform = lastPosition;
  29695. }
  29696. });
  29697. onMounted(() => {
  29698. if (props.modelValue) {
  29699. visible.value = true;
  29700. rendered.value = true;
  29701. open();
  29702. }
  29703. });
  29704. return {
  29705. afterEnter,
  29706. afterLeave,
  29707. beforeLeave,
  29708. handleClose,
  29709. onModalClick,
  29710. close,
  29711. doClose,
  29712. onOpenAutoFocus,
  29713. onCloseAutoFocus,
  29714. onCloseRequested,
  29715. onFocusoutPrevented,
  29716. titleId,
  29717. bodyId,
  29718. closed,
  29719. style,
  29720. overlayDialogStyle,
  29721. rendered,
  29722. visible,
  29723. zIndex
  29724. };
  29725. };
  29726. const __default__$11 = defineComponent({
  29727. name: "ElDialog",
  29728. inheritAttrs: false
  29729. });
  29730. const _sfc_main$1o = /* @__PURE__ */ defineComponent({
  29731. ...__default__$11,
  29732. props: dialogProps,
  29733. emits: dialogEmits,
  29734. setup(__props, { expose }) {
  29735. const props = __props;
  29736. const slots = useSlots();
  29737. useDeprecated({
  29738. scope: "el-dialog",
  29739. from: "the title slot",
  29740. replacement: "the header slot",
  29741. version: "3.0.0",
  29742. ref: "https://element-plus.org/en-US/component/dialog.html#slots"
  29743. }, computed(() => !!slots.title));
  29744. const ns = useNamespace("dialog");
  29745. const dialogRef = ref();
  29746. const headerRef = ref();
  29747. const dialogContentRef = ref();
  29748. const {
  29749. visible,
  29750. titleId,
  29751. bodyId,
  29752. style,
  29753. overlayDialogStyle,
  29754. rendered,
  29755. zIndex,
  29756. afterEnter,
  29757. afterLeave,
  29758. beforeLeave,
  29759. handleClose,
  29760. onModalClick,
  29761. onOpenAutoFocus,
  29762. onCloseAutoFocus,
  29763. onCloseRequested,
  29764. onFocusoutPrevented
  29765. } = useDialog(props, dialogRef);
  29766. provide(dialogInjectionKey, {
  29767. dialogRef,
  29768. headerRef,
  29769. bodyId,
  29770. ns,
  29771. rendered,
  29772. style
  29773. });
  29774. const overlayEvent = useSameTarget(onModalClick);
  29775. const draggable = computed(() => props.draggable && !props.fullscreen);
  29776. const resetPosition = () => {
  29777. var _a;
  29778. (_a = dialogContentRef.value) == null ? void 0 : _a.resetPosition();
  29779. };
  29780. expose({
  29781. visible,
  29782. dialogContentRef,
  29783. resetPosition,
  29784. handleClose
  29785. });
  29786. return (_ctx, _cache) => {
  29787. return openBlock(), createBlock(unref(ElTeleport$1), {
  29788. to: _ctx.appendTo,
  29789. disabled: _ctx.appendTo !== "body" ? false : !_ctx.appendToBody
  29790. }, {
  29791. default: withCtx(() => [
  29792. createVNode(Transition, {
  29793. name: "dialog-fade",
  29794. onAfterEnter: unref(afterEnter),
  29795. onAfterLeave: unref(afterLeave),
  29796. onBeforeLeave: unref(beforeLeave),
  29797. persisted: ""
  29798. }, {
  29799. default: withCtx(() => [
  29800. withDirectives(createVNode(unref(ElOverlay), {
  29801. "custom-mask-event": "",
  29802. mask: _ctx.modal,
  29803. "overlay-class": _ctx.modalClass,
  29804. "z-index": unref(zIndex)
  29805. }, {
  29806. default: withCtx(() => [
  29807. createElementVNode("div", {
  29808. role: "dialog",
  29809. "aria-modal": "true",
  29810. "aria-label": _ctx.title || void 0,
  29811. "aria-labelledby": !_ctx.title ? unref(titleId) : void 0,
  29812. "aria-describedby": unref(bodyId),
  29813. class: normalizeClass(`${unref(ns).namespace.value}-overlay-dialog`),
  29814. style: normalizeStyle(unref(overlayDialogStyle)),
  29815. onClick: unref(overlayEvent).onClick,
  29816. onMousedown: unref(overlayEvent).onMousedown,
  29817. onMouseup: unref(overlayEvent).onMouseup
  29818. }, [
  29819. createVNode(unref(ElFocusTrap), {
  29820. loop: "",
  29821. trapped: unref(visible),
  29822. "focus-start-el": "container",
  29823. onFocusAfterTrapped: unref(onOpenAutoFocus),
  29824. onFocusAfterReleased: unref(onCloseAutoFocus),
  29825. onFocusoutPrevented: unref(onFocusoutPrevented),
  29826. onReleaseRequested: unref(onCloseRequested)
  29827. }, {
  29828. default: withCtx(() => [
  29829. unref(rendered) ? (openBlock(), createBlock(ElDialogContent, mergeProps({
  29830. key: 0,
  29831. ref_key: "dialogContentRef",
  29832. ref: dialogContentRef
  29833. }, _ctx.$attrs, {
  29834. center: _ctx.center,
  29835. "align-center": _ctx.alignCenter,
  29836. "close-icon": _ctx.closeIcon,
  29837. draggable: unref(draggable),
  29838. overflow: _ctx.overflow,
  29839. fullscreen: _ctx.fullscreen,
  29840. "header-class": _ctx.headerClass,
  29841. "body-class": _ctx.bodyClass,
  29842. "footer-class": _ctx.footerClass,
  29843. "show-close": _ctx.showClose,
  29844. title: _ctx.title,
  29845. "aria-level": _ctx.headerAriaLevel,
  29846. onClose: unref(handleClose)
  29847. }), createSlots({
  29848. header: withCtx(() => [
  29849. !_ctx.$slots.title ? renderSlot(_ctx.$slots, "header", {
  29850. key: 0,
  29851. close: unref(handleClose),
  29852. titleId: unref(titleId),
  29853. titleClass: unref(ns).e("title")
  29854. }) : renderSlot(_ctx.$slots, "title", { key: 1 })
  29855. ]),
  29856. default: withCtx(() => [
  29857. renderSlot(_ctx.$slots, "default")
  29858. ]),
  29859. _: 2
  29860. }, [
  29861. _ctx.$slots.footer ? {
  29862. name: "footer",
  29863. fn: withCtx(() => [
  29864. renderSlot(_ctx.$slots, "footer")
  29865. ])
  29866. } : void 0
  29867. ]), 1040, ["center", "align-center", "close-icon", "draggable", "overflow", "fullscreen", "header-class", "body-class", "footer-class", "show-close", "title", "aria-level", "onClose"])) : createCommentVNode("v-if", true)
  29868. ]),
  29869. _: 3
  29870. }, 8, ["trapped", "onFocusAfterTrapped", "onFocusAfterReleased", "onFocusoutPrevented", "onReleaseRequested"])
  29871. ], 46, ["aria-label", "aria-labelledby", "aria-describedby", "onClick", "onMousedown", "onMouseup"])
  29872. ]),
  29873. _: 3
  29874. }, 8, ["mask", "overlay-class", "z-index"]), [
  29875. [vShow, unref(visible)]
  29876. ])
  29877. ]),
  29878. _: 3
  29879. }, 8, ["onAfterEnter", "onAfterLeave", "onBeforeLeave"])
  29880. ]),
  29881. _: 3
  29882. }, 8, ["to", "disabled"]);
  29883. };
  29884. }
  29885. });
  29886. var Dialog = /* @__PURE__ */ _export_sfc(_sfc_main$1o, [["__file", "dialog.vue"]]);
  29887. const ElDialog = withInstall(Dialog);
  29888. const dividerProps = buildProps({
  29889. direction: {
  29890. type: String,
  29891. values: ["horizontal", "vertical"],
  29892. default: "horizontal"
  29893. },
  29894. contentPosition: {
  29895. type: String,
  29896. values: ["left", "center", "right"],
  29897. default: "center"
  29898. },
  29899. borderStyle: {
  29900. type: definePropType(String),
  29901. default: "solid"
  29902. }
  29903. });
  29904. const __default__$10 = defineComponent({
  29905. name: "ElDivider"
  29906. });
  29907. const _sfc_main$1n = /* @__PURE__ */ defineComponent({
  29908. ...__default__$10,
  29909. props: dividerProps,
  29910. setup(__props) {
  29911. const props = __props;
  29912. const ns = useNamespace("divider");
  29913. const dividerStyle = computed(() => {
  29914. return ns.cssVar({
  29915. "border-style": props.borderStyle
  29916. });
  29917. });
  29918. return (_ctx, _cache) => {
  29919. return openBlock(), createElementBlock("div", {
  29920. class: normalizeClass([unref(ns).b(), unref(ns).m(_ctx.direction)]),
  29921. style: normalizeStyle(unref(dividerStyle)),
  29922. role: "separator"
  29923. }, [
  29924. _ctx.$slots.default && _ctx.direction !== "vertical" ? (openBlock(), createElementBlock("div", {
  29925. key: 0,
  29926. class: normalizeClass([unref(ns).e("text"), unref(ns).is(_ctx.contentPosition)])
  29927. }, [
  29928. renderSlot(_ctx.$slots, "default")
  29929. ], 2)) : createCommentVNode("v-if", true)
  29930. ], 6);
  29931. };
  29932. }
  29933. });
  29934. var Divider = /* @__PURE__ */ _export_sfc(_sfc_main$1n, [["__file", "divider.vue"]]);
  29935. const ElDivider = withInstall(Divider);
  29936. const drawerProps = buildProps({
  29937. ...dialogProps,
  29938. direction: {
  29939. type: String,
  29940. default: "rtl",
  29941. values: ["ltr", "rtl", "ttb", "btt"]
  29942. },
  29943. size: {
  29944. type: [String, Number],
  29945. default: "30%"
  29946. },
  29947. withHeader: {
  29948. type: Boolean,
  29949. default: true
  29950. },
  29951. modalFade: {
  29952. type: Boolean,
  29953. default: true
  29954. },
  29955. headerAriaLevel: {
  29956. type: String,
  29957. default: "2"
  29958. }
  29959. });
  29960. const drawerEmits = dialogEmits;
  29961. const __default__$$ = defineComponent({
  29962. name: "ElDrawer",
  29963. inheritAttrs: false
  29964. });
  29965. const _sfc_main$1m = /* @__PURE__ */ defineComponent({
  29966. ...__default__$$,
  29967. props: drawerProps,
  29968. emits: drawerEmits,
  29969. setup(__props, { expose }) {
  29970. const props = __props;
  29971. const slots = useSlots();
  29972. useDeprecated({
  29973. scope: "el-drawer",
  29974. from: "the title slot",
  29975. replacement: "the header slot",
  29976. version: "3.0.0",
  29977. ref: "https://element-plus.org/en-US/component/drawer.html#slots"
  29978. }, computed(() => !!slots.title));
  29979. const drawerRef = ref();
  29980. const focusStartRef = ref();
  29981. const ns = useNamespace("drawer");
  29982. const { t } = useLocale();
  29983. const {
  29984. afterEnter,
  29985. afterLeave,
  29986. beforeLeave,
  29987. visible,
  29988. rendered,
  29989. titleId,
  29990. bodyId,
  29991. zIndex,
  29992. onModalClick,
  29993. onOpenAutoFocus,
  29994. onCloseAutoFocus,
  29995. onFocusoutPrevented,
  29996. onCloseRequested,
  29997. handleClose
  29998. } = useDialog(props, drawerRef);
  29999. const isHorizontal = computed(() => props.direction === "rtl" || props.direction === "ltr");
  30000. const drawerSize = computed(() => addUnit(props.size));
  30001. expose({
  30002. handleClose,
  30003. afterEnter,
  30004. afterLeave
  30005. });
  30006. return (_ctx, _cache) => {
  30007. return openBlock(), createBlock(unref(ElTeleport$1), {
  30008. to: _ctx.appendTo,
  30009. disabled: _ctx.appendTo !== "body" ? false : !_ctx.appendToBody
  30010. }, {
  30011. default: withCtx(() => [
  30012. createVNode(Transition, {
  30013. name: unref(ns).b("fade"),
  30014. onAfterEnter: unref(afterEnter),
  30015. onAfterLeave: unref(afterLeave),
  30016. onBeforeLeave: unref(beforeLeave),
  30017. persisted: ""
  30018. }, {
  30019. default: withCtx(() => [
  30020. withDirectives(createVNode(unref(ElOverlay), {
  30021. mask: _ctx.modal,
  30022. "overlay-class": _ctx.modalClass,
  30023. "z-index": unref(zIndex),
  30024. onClick: unref(onModalClick)
  30025. }, {
  30026. default: withCtx(() => [
  30027. createVNode(unref(ElFocusTrap), {
  30028. loop: "",
  30029. trapped: unref(visible),
  30030. "focus-trap-el": drawerRef.value,
  30031. "focus-start-el": focusStartRef.value,
  30032. onFocusAfterTrapped: unref(onOpenAutoFocus),
  30033. onFocusAfterReleased: unref(onCloseAutoFocus),
  30034. onFocusoutPrevented: unref(onFocusoutPrevented),
  30035. onReleaseRequested: unref(onCloseRequested)
  30036. }, {
  30037. default: withCtx(() => [
  30038. createElementVNode("div", mergeProps({
  30039. ref_key: "drawerRef",
  30040. ref: drawerRef,
  30041. "aria-modal": "true",
  30042. "aria-label": _ctx.title || void 0,
  30043. "aria-labelledby": !_ctx.title ? unref(titleId) : void 0,
  30044. "aria-describedby": unref(bodyId)
  30045. }, _ctx.$attrs, {
  30046. class: [unref(ns).b(), _ctx.direction, unref(visible) && "open"],
  30047. style: unref(isHorizontal) ? "width: " + unref(drawerSize) : "height: " + unref(drawerSize),
  30048. role: "dialog",
  30049. onClick: withModifiers(() => {
  30050. }, ["stop"])
  30051. }), [
  30052. createElementVNode("span", {
  30053. ref_key: "focusStartRef",
  30054. ref: focusStartRef,
  30055. class: normalizeClass(unref(ns).e("sr-focus")),
  30056. tabindex: "-1"
  30057. }, null, 2),
  30058. _ctx.withHeader ? (openBlock(), createElementBlock("header", {
  30059. key: 0,
  30060. class: normalizeClass([unref(ns).e("header"), _ctx.headerClass])
  30061. }, [
  30062. !_ctx.$slots.title ? renderSlot(_ctx.$slots, "header", {
  30063. key: 0,
  30064. close: unref(handleClose),
  30065. titleId: unref(titleId),
  30066. titleClass: unref(ns).e("title")
  30067. }, () => [
  30068. !_ctx.$slots.title ? (openBlock(), createElementBlock("span", {
  30069. key: 0,
  30070. id: unref(titleId),
  30071. role: "heading",
  30072. "aria-level": _ctx.headerAriaLevel,
  30073. class: normalizeClass(unref(ns).e("title"))
  30074. }, toDisplayString(_ctx.title), 11, ["id", "aria-level"])) : createCommentVNode("v-if", true)
  30075. ]) : renderSlot(_ctx.$slots, "title", { key: 1 }, () => [
  30076. createCommentVNode(" DEPRECATED SLOT ")
  30077. ]),
  30078. _ctx.showClose ? (openBlock(), createElementBlock("button", {
  30079. key: 2,
  30080. "aria-label": unref(t)("el.drawer.close"),
  30081. class: normalizeClass(unref(ns).e("close-btn")),
  30082. type: "button",
  30083. onClick: unref(handleClose)
  30084. }, [
  30085. createVNode(unref(ElIcon), {
  30086. class: normalizeClass(unref(ns).e("close"))
  30087. }, {
  30088. default: withCtx(() => [
  30089. createVNode(unref(close_default))
  30090. ]),
  30091. _: 1
  30092. }, 8, ["class"])
  30093. ], 10, ["aria-label", "onClick"])) : createCommentVNode("v-if", true)
  30094. ], 2)) : createCommentVNode("v-if", true),
  30095. unref(rendered) ? (openBlock(), createElementBlock("div", {
  30096. key: 1,
  30097. id: unref(bodyId),
  30098. class: normalizeClass([unref(ns).e("body"), _ctx.bodyClass])
  30099. }, [
  30100. renderSlot(_ctx.$slots, "default")
  30101. ], 10, ["id"])) : createCommentVNode("v-if", true),
  30102. _ctx.$slots.footer ? (openBlock(), createElementBlock("div", {
  30103. key: 2,
  30104. class: normalizeClass([unref(ns).e("footer"), _ctx.footerClass])
  30105. }, [
  30106. renderSlot(_ctx.$slots, "footer")
  30107. ], 2)) : createCommentVNode("v-if", true)
  30108. ], 16, ["aria-label", "aria-labelledby", "aria-describedby", "onClick"])
  30109. ]),
  30110. _: 3
  30111. }, 8, ["trapped", "focus-trap-el", "focus-start-el", "onFocusAfterTrapped", "onFocusAfterReleased", "onFocusoutPrevented", "onReleaseRequested"])
  30112. ]),
  30113. _: 3
  30114. }, 8, ["mask", "overlay-class", "z-index", "onClick"]), [
  30115. [vShow, unref(visible)]
  30116. ])
  30117. ]),
  30118. _: 3
  30119. }, 8, ["name", "onAfterEnter", "onAfterLeave", "onBeforeLeave"])
  30120. ]),
  30121. _: 3
  30122. }, 8, ["to", "disabled"]);
  30123. };
  30124. }
  30125. });
  30126. var Drawer = /* @__PURE__ */ _export_sfc(_sfc_main$1m, [["__file", "drawer.vue"]]);
  30127. const ElDrawer = withInstall(Drawer);
  30128. const _sfc_main$1l = /* @__PURE__ */ defineComponent({
  30129. inheritAttrs: false
  30130. });
  30131. function _sfc_render$k(_ctx, _cache, $props, $setup, $data, $options) {
  30132. return renderSlot(_ctx.$slots, "default");
  30133. }
  30134. var Collection = /* @__PURE__ */ _export_sfc(_sfc_main$1l, [["render", _sfc_render$k], ["__file", "collection.vue"]]);
  30135. const _sfc_main$1k = /* @__PURE__ */ defineComponent({
  30136. name: "ElCollectionItem",
  30137. inheritAttrs: false
  30138. });
  30139. function _sfc_render$j(_ctx, _cache, $props, $setup, $data, $options) {
  30140. return renderSlot(_ctx.$slots, "default");
  30141. }
  30142. var CollectionItem = /* @__PURE__ */ _export_sfc(_sfc_main$1k, [["render", _sfc_render$j], ["__file", "collection-item.vue"]]);
  30143. const COLLECTION_ITEM_SIGN = `data-el-collection-item`;
  30144. const createCollectionWithScope = (name) => {
  30145. const COLLECTION_NAME = `El${name}Collection`;
  30146. const COLLECTION_ITEM_NAME = `${COLLECTION_NAME}Item`;
  30147. const COLLECTION_INJECTION_KEY = Symbol(COLLECTION_NAME);
  30148. const COLLECTION_ITEM_INJECTION_KEY = Symbol(COLLECTION_ITEM_NAME);
  30149. const ElCollection = {
  30150. ...Collection,
  30151. name: COLLECTION_NAME,
  30152. setup() {
  30153. const collectionRef = ref();
  30154. const itemMap = /* @__PURE__ */ new Map();
  30155. const getItems = () => {
  30156. const collectionEl = unref(collectionRef);
  30157. if (!collectionEl)
  30158. return [];
  30159. const orderedNodes = Array.from(collectionEl.querySelectorAll(`[${COLLECTION_ITEM_SIGN}]`));
  30160. const items = [...itemMap.values()];
  30161. return items.sort((a, b) => orderedNodes.indexOf(a.ref) - orderedNodes.indexOf(b.ref));
  30162. };
  30163. provide(COLLECTION_INJECTION_KEY, {
  30164. itemMap,
  30165. getItems,
  30166. collectionRef
  30167. });
  30168. }
  30169. };
  30170. const ElCollectionItem = {
  30171. ...CollectionItem,
  30172. name: COLLECTION_ITEM_NAME,
  30173. setup(_, { attrs }) {
  30174. const collectionItemRef = ref();
  30175. const collectionInjection = inject(COLLECTION_INJECTION_KEY, void 0);
  30176. provide(COLLECTION_ITEM_INJECTION_KEY, {
  30177. collectionItemRef
  30178. });
  30179. onMounted(() => {
  30180. const collectionItemEl = unref(collectionItemRef);
  30181. if (collectionItemEl) {
  30182. collectionInjection.itemMap.set(collectionItemEl, {
  30183. ref: collectionItemEl,
  30184. ...attrs
  30185. });
  30186. }
  30187. });
  30188. onBeforeUnmount(() => {
  30189. const collectionItemEl = unref(collectionItemRef);
  30190. collectionInjection.itemMap.delete(collectionItemEl);
  30191. });
  30192. }
  30193. };
  30194. return {
  30195. COLLECTION_INJECTION_KEY,
  30196. COLLECTION_ITEM_INJECTION_KEY,
  30197. ElCollection,
  30198. ElCollectionItem
  30199. };
  30200. };
  30201. const rovingFocusGroupProps = buildProps({
  30202. style: { type: definePropType([String, Array, Object]) },
  30203. currentTabId: {
  30204. type: definePropType(String)
  30205. },
  30206. defaultCurrentTabId: String,
  30207. loop: Boolean,
  30208. dir: {
  30209. type: String,
  30210. values: ["ltr", "rtl"],
  30211. default: "ltr"
  30212. },
  30213. orientation: {
  30214. type: definePropType(String)
  30215. },
  30216. onBlur: Function,
  30217. onFocus: Function,
  30218. onMousedown: Function
  30219. });
  30220. const {
  30221. ElCollection: ElCollection$1,
  30222. ElCollectionItem: ElCollectionItem$1,
  30223. COLLECTION_INJECTION_KEY: COLLECTION_INJECTION_KEY$1,
  30224. COLLECTION_ITEM_INJECTION_KEY: COLLECTION_ITEM_INJECTION_KEY$1
  30225. } = createCollectionWithScope("RovingFocusGroup");
  30226. const ROVING_FOCUS_GROUP_INJECTION_KEY = Symbol("elRovingFocusGroup");
  30227. const ROVING_FOCUS_GROUP_ITEM_INJECTION_KEY = Symbol("elRovingFocusGroupItem");
  30228. const MAP_KEY_TO_FOCUS_INTENT = {
  30229. ArrowLeft: "prev",
  30230. ArrowUp: "prev",
  30231. ArrowRight: "next",
  30232. ArrowDown: "next",
  30233. PageUp: "first",
  30234. Home: "first",
  30235. PageDown: "last",
  30236. End: "last"
  30237. };
  30238. const getDirectionAwareKey = (key, dir) => {
  30239. if (dir !== "rtl")
  30240. return key;
  30241. switch (key) {
  30242. case EVENT_CODE.right:
  30243. return EVENT_CODE.left;
  30244. case EVENT_CODE.left:
  30245. return EVENT_CODE.right;
  30246. default:
  30247. return key;
  30248. }
  30249. };
  30250. const getFocusIntent = (event, orientation, dir) => {
  30251. const key = getDirectionAwareKey(event.code, dir);
  30252. if (orientation === "vertical" && [EVENT_CODE.left, EVENT_CODE.right].includes(key))
  30253. return void 0;
  30254. if (orientation === "horizontal" && [EVENT_CODE.up, EVENT_CODE.down].includes(key))
  30255. return void 0;
  30256. return MAP_KEY_TO_FOCUS_INTENT[key];
  30257. };
  30258. const reorderArray = (array, atIdx) => {
  30259. return array.map((_, idx) => array[(idx + atIdx) % array.length]);
  30260. };
  30261. const focusFirst = (elements) => {
  30262. const { activeElement: prevActive } = document;
  30263. for (const element of elements) {
  30264. if (element === prevActive)
  30265. return;
  30266. element.focus();
  30267. if (prevActive !== document.activeElement)
  30268. return;
  30269. }
  30270. };
  30271. const CURRENT_TAB_ID_CHANGE_EVT = "currentTabIdChange";
  30272. const ENTRY_FOCUS_EVT = "rovingFocusGroup.entryFocus";
  30273. const EVT_OPTS = { bubbles: false, cancelable: true };
  30274. const _sfc_main$1j = defineComponent({
  30275. name: "ElRovingFocusGroupImpl",
  30276. inheritAttrs: false,
  30277. props: rovingFocusGroupProps,
  30278. emits: [CURRENT_TAB_ID_CHANGE_EVT, "entryFocus"],
  30279. setup(props, { emit }) {
  30280. var _a;
  30281. const currentTabbedId = ref((_a = props.currentTabId || props.defaultCurrentTabId) != null ? _a : null);
  30282. const isBackingOut = ref(false);
  30283. const isClickFocus = ref(false);
  30284. const rovingFocusGroupRef = ref();
  30285. const { getItems } = inject(COLLECTION_INJECTION_KEY$1, void 0);
  30286. const rovingFocusGroupRootStyle = computed(() => {
  30287. return [
  30288. {
  30289. outline: "none"
  30290. },
  30291. props.style
  30292. ];
  30293. });
  30294. const onItemFocus = (tabbedId) => {
  30295. emit(CURRENT_TAB_ID_CHANGE_EVT, tabbedId);
  30296. };
  30297. const onItemShiftTab = () => {
  30298. isBackingOut.value = true;
  30299. };
  30300. const onMousedown = composeEventHandlers((e) => {
  30301. var _a2;
  30302. (_a2 = props.onMousedown) == null ? void 0 : _a2.call(props, e);
  30303. }, () => {
  30304. isClickFocus.value = true;
  30305. });
  30306. const onFocus = composeEventHandlers((e) => {
  30307. var _a2;
  30308. (_a2 = props.onFocus) == null ? void 0 : _a2.call(props, e);
  30309. }, (e) => {
  30310. const isKeyboardFocus = !unref(isClickFocus);
  30311. const { target, currentTarget } = e;
  30312. if (target === currentTarget && isKeyboardFocus && !unref(isBackingOut)) {
  30313. const entryFocusEvt = new Event(ENTRY_FOCUS_EVT, EVT_OPTS);
  30314. currentTarget == null ? void 0 : currentTarget.dispatchEvent(entryFocusEvt);
  30315. if (!entryFocusEvt.defaultPrevented) {
  30316. const items = getItems().filter((item) => item.focusable);
  30317. const activeItem = items.find((item) => item.active);
  30318. const currentItem = items.find((item) => item.id === unref(currentTabbedId));
  30319. const candidates = [activeItem, currentItem, ...items].filter(Boolean);
  30320. const candidateNodes = candidates.map((item) => item.ref);
  30321. focusFirst(candidateNodes);
  30322. }
  30323. }
  30324. isClickFocus.value = false;
  30325. });
  30326. const onBlur = composeEventHandlers((e) => {
  30327. var _a2;
  30328. (_a2 = props.onBlur) == null ? void 0 : _a2.call(props, e);
  30329. }, () => {
  30330. isBackingOut.value = false;
  30331. });
  30332. const handleEntryFocus = (...args) => {
  30333. emit("entryFocus", ...args);
  30334. };
  30335. provide(ROVING_FOCUS_GROUP_INJECTION_KEY, {
  30336. currentTabbedId: readonly(currentTabbedId),
  30337. loop: toRef(props, "loop"),
  30338. tabIndex: computed(() => {
  30339. return unref(isBackingOut) ? -1 : 0;
  30340. }),
  30341. rovingFocusGroupRef,
  30342. rovingFocusGroupRootStyle,
  30343. orientation: toRef(props, "orientation"),
  30344. dir: toRef(props, "dir"),
  30345. onItemFocus,
  30346. onItemShiftTab,
  30347. onBlur,
  30348. onFocus,
  30349. onMousedown
  30350. });
  30351. watch(() => props.currentTabId, (val) => {
  30352. currentTabbedId.value = val != null ? val : null;
  30353. });
  30354. useEventListener(rovingFocusGroupRef, ENTRY_FOCUS_EVT, handleEntryFocus);
  30355. }
  30356. });
  30357. function _sfc_render$i(_ctx, _cache, $props, $setup, $data, $options) {
  30358. return renderSlot(_ctx.$slots, "default");
  30359. }
  30360. var ElRovingFocusGroupImpl = /* @__PURE__ */ _export_sfc(_sfc_main$1j, [["render", _sfc_render$i], ["__file", "roving-focus-group-impl.vue"]]);
  30361. const _sfc_main$1i = defineComponent({
  30362. name: "ElRovingFocusGroup",
  30363. components: {
  30364. ElFocusGroupCollection: ElCollection$1,
  30365. ElRovingFocusGroupImpl
  30366. }
  30367. });
  30368. function _sfc_render$h(_ctx, _cache, $props, $setup, $data, $options) {
  30369. const _component_el_roving_focus_group_impl = resolveComponent("el-roving-focus-group-impl");
  30370. const _component_el_focus_group_collection = resolveComponent("el-focus-group-collection");
  30371. return openBlock(), createBlock(_component_el_focus_group_collection, null, {
  30372. default: withCtx(() => [
  30373. createVNode(_component_el_roving_focus_group_impl, normalizeProps(guardReactiveProps(_ctx.$attrs)), {
  30374. default: withCtx(() => [
  30375. renderSlot(_ctx.$slots, "default")
  30376. ]),
  30377. _: 3
  30378. }, 16)
  30379. ]),
  30380. _: 3
  30381. });
  30382. }
  30383. var ElRovingFocusGroup = /* @__PURE__ */ _export_sfc(_sfc_main$1i, [["render", _sfc_render$h], ["__file", "roving-focus-group.vue"]]);
  30384. const _sfc_main$1h = defineComponent({
  30385. components: {
  30386. ElRovingFocusCollectionItem: ElCollectionItem$1
  30387. },
  30388. props: {
  30389. focusable: {
  30390. type: Boolean,
  30391. default: true
  30392. },
  30393. active: {
  30394. type: Boolean,
  30395. default: false
  30396. }
  30397. },
  30398. emits: ["mousedown", "focus", "keydown"],
  30399. setup(props, { emit }) {
  30400. const { currentTabbedId, loop, onItemFocus, onItemShiftTab } = inject(ROVING_FOCUS_GROUP_INJECTION_KEY, void 0);
  30401. const { getItems } = inject(COLLECTION_INJECTION_KEY$1, void 0);
  30402. const id = useId();
  30403. const rovingFocusGroupItemRef = ref();
  30404. const handleMousedown = composeEventHandlers((e) => {
  30405. emit("mousedown", e);
  30406. }, (e) => {
  30407. if (!props.focusable) {
  30408. e.preventDefault();
  30409. } else {
  30410. onItemFocus(unref(id));
  30411. }
  30412. });
  30413. const handleFocus = composeEventHandlers((e) => {
  30414. emit("focus", e);
  30415. }, () => {
  30416. onItemFocus(unref(id));
  30417. });
  30418. const handleKeydown = composeEventHandlers((e) => {
  30419. emit("keydown", e);
  30420. }, (e) => {
  30421. const { code, shiftKey, target, currentTarget } = e;
  30422. if (code === EVENT_CODE.tab && shiftKey) {
  30423. onItemShiftTab();
  30424. return;
  30425. }
  30426. if (target !== currentTarget)
  30427. return;
  30428. const focusIntent = getFocusIntent(e);
  30429. if (focusIntent) {
  30430. e.preventDefault();
  30431. const items = getItems().filter((item) => item.focusable);
  30432. let elements = items.map((item) => item.ref);
  30433. switch (focusIntent) {
  30434. case "last": {
  30435. elements.reverse();
  30436. break;
  30437. }
  30438. case "prev":
  30439. case "next": {
  30440. if (focusIntent === "prev") {
  30441. elements.reverse();
  30442. }
  30443. const currentIdx = elements.indexOf(currentTarget);
  30444. elements = loop.value ? reorderArray(elements, currentIdx + 1) : elements.slice(currentIdx + 1);
  30445. break;
  30446. }
  30447. }
  30448. nextTick(() => {
  30449. focusFirst(elements);
  30450. });
  30451. }
  30452. });
  30453. const isCurrentTab = computed(() => currentTabbedId.value === unref(id));
  30454. provide(ROVING_FOCUS_GROUP_ITEM_INJECTION_KEY, {
  30455. rovingFocusGroupItemRef,
  30456. tabIndex: computed(() => unref(isCurrentTab) ? 0 : -1),
  30457. handleMousedown,
  30458. handleFocus,
  30459. handleKeydown
  30460. });
  30461. return {
  30462. id,
  30463. handleKeydown,
  30464. handleFocus,
  30465. handleMousedown
  30466. };
  30467. }
  30468. });
  30469. function _sfc_render$g(_ctx, _cache, $props, $setup, $data, $options) {
  30470. const _component_el_roving_focus_collection_item = resolveComponent("el-roving-focus-collection-item");
  30471. return openBlock(), createBlock(_component_el_roving_focus_collection_item, {
  30472. id: _ctx.id,
  30473. focusable: _ctx.focusable,
  30474. active: _ctx.active
  30475. }, {
  30476. default: withCtx(() => [
  30477. renderSlot(_ctx.$slots, "default")
  30478. ]),
  30479. _: 3
  30480. }, 8, ["id", "focusable", "active"]);
  30481. }
  30482. var ElRovingFocusItem = /* @__PURE__ */ _export_sfc(_sfc_main$1h, [["render", _sfc_render$g], ["__file", "roving-focus-item.vue"]]);
  30483. const dropdownProps = buildProps({
  30484. trigger: useTooltipTriggerProps.trigger,
  30485. triggerKeys: {
  30486. type: definePropType(Array),
  30487. default: () => [
  30488. EVENT_CODE.enter,
  30489. EVENT_CODE.numpadEnter,
  30490. EVENT_CODE.space,
  30491. EVENT_CODE.down
  30492. ]
  30493. },
  30494. effect: {
  30495. ...useTooltipContentProps.effect,
  30496. default: "light"
  30497. },
  30498. type: {
  30499. type: definePropType(String)
  30500. },
  30501. placement: {
  30502. type: definePropType(String),
  30503. default: "bottom"
  30504. },
  30505. popperOptions: {
  30506. type: definePropType(Object),
  30507. default: () => ({})
  30508. },
  30509. id: String,
  30510. size: {
  30511. type: String,
  30512. default: ""
  30513. },
  30514. splitButton: Boolean,
  30515. hideOnClick: {
  30516. type: Boolean,
  30517. default: true
  30518. },
  30519. loop: {
  30520. type: Boolean,
  30521. default: true
  30522. },
  30523. showTimeout: {
  30524. type: Number,
  30525. default: 150
  30526. },
  30527. hideTimeout: {
  30528. type: Number,
  30529. default: 150
  30530. },
  30531. tabindex: {
  30532. type: definePropType([Number, String]),
  30533. default: 0
  30534. },
  30535. maxHeight: {
  30536. type: definePropType([Number, String]),
  30537. default: ""
  30538. },
  30539. popperClass: {
  30540. type: String,
  30541. default: ""
  30542. },
  30543. disabled: Boolean,
  30544. role: {
  30545. type: String,
  30546. values: roleTypes,
  30547. default: "menu"
  30548. },
  30549. buttonProps: {
  30550. type: definePropType(Object)
  30551. },
  30552. teleported: useTooltipContentProps.teleported,
  30553. persistent: {
  30554. type: Boolean,
  30555. default: true
  30556. }
  30557. });
  30558. const dropdownItemProps = buildProps({
  30559. command: {
  30560. type: [Object, String, Number],
  30561. default: () => ({})
  30562. },
  30563. disabled: Boolean,
  30564. divided: Boolean,
  30565. textValue: String,
  30566. icon: {
  30567. type: iconPropType
  30568. }
  30569. });
  30570. const dropdownMenuProps = buildProps({
  30571. onKeydown: { type: definePropType(Function) }
  30572. });
  30573. const FIRST_KEYS = [
  30574. EVENT_CODE.down,
  30575. EVENT_CODE.pageDown,
  30576. EVENT_CODE.home
  30577. ];
  30578. const LAST_KEYS = [EVENT_CODE.up, EVENT_CODE.pageUp, EVENT_CODE.end];
  30579. const FIRST_LAST_KEYS = [...FIRST_KEYS, ...LAST_KEYS];
  30580. const {
  30581. ElCollection,
  30582. ElCollectionItem,
  30583. COLLECTION_INJECTION_KEY,
  30584. COLLECTION_ITEM_INJECTION_KEY
  30585. } = createCollectionWithScope("Dropdown");
  30586. const DROPDOWN_INJECTION_KEY = Symbol("elDropdown");
  30587. const { ButtonGroup: ElButtonGroup } = ElButton;
  30588. const _sfc_main$1g = defineComponent({
  30589. name: "ElDropdown",
  30590. components: {
  30591. ElButton,
  30592. ElButtonGroup,
  30593. ElScrollbar,
  30594. ElDropdownCollection: ElCollection,
  30595. ElTooltip,
  30596. ElRovingFocusGroup,
  30597. ElOnlyChild: OnlyChild,
  30598. ElIcon,
  30599. ArrowDown: arrow_down_default
  30600. },
  30601. props: dropdownProps,
  30602. emits: ["visible-change", "click", "command"],
  30603. setup(props, { emit }) {
  30604. const _instance = getCurrentInstance();
  30605. const ns = useNamespace("dropdown");
  30606. const { t } = useLocale();
  30607. const triggeringElementRef = ref();
  30608. const referenceElementRef = ref();
  30609. const popperRef = ref();
  30610. const contentRef = ref();
  30611. const scrollbar = ref(null);
  30612. const currentTabId = ref(null);
  30613. const isUsingKeyboard = ref(false);
  30614. const wrapStyle = computed(() => ({
  30615. maxHeight: addUnit(props.maxHeight)
  30616. }));
  30617. const dropdownTriggerKls = computed(() => [ns.m(dropdownSize.value)]);
  30618. const trigger = computed(() => castArray$1(props.trigger));
  30619. const defaultTriggerId = useId().value;
  30620. const triggerId = computed(() => props.id || defaultTriggerId);
  30621. watch([triggeringElementRef, trigger], ([triggeringElement, trigger2], [prevTriggeringElement]) => {
  30622. var _a, _b, _c;
  30623. if ((_a = prevTriggeringElement == null ? void 0 : prevTriggeringElement.$el) == null ? void 0 : _a.removeEventListener) {
  30624. prevTriggeringElement.$el.removeEventListener("pointerenter", onAutofocusTriggerEnter);
  30625. }
  30626. if ((_b = triggeringElement == null ? void 0 : triggeringElement.$el) == null ? void 0 : _b.removeEventListener) {
  30627. triggeringElement.$el.removeEventListener("pointerenter", onAutofocusTriggerEnter);
  30628. }
  30629. if (((_c = triggeringElement == null ? void 0 : triggeringElement.$el) == null ? void 0 : _c.addEventListener) && trigger2.includes("hover")) {
  30630. triggeringElement.$el.addEventListener("pointerenter", onAutofocusTriggerEnter);
  30631. }
  30632. }, { immediate: true });
  30633. onBeforeUnmount(() => {
  30634. var _a, _b;
  30635. if ((_b = (_a = triggeringElementRef.value) == null ? void 0 : _a.$el) == null ? void 0 : _b.removeEventListener) {
  30636. triggeringElementRef.value.$el.removeEventListener("pointerenter", onAutofocusTriggerEnter);
  30637. }
  30638. });
  30639. function handleClick() {
  30640. handleClose();
  30641. }
  30642. function handleClose() {
  30643. var _a;
  30644. (_a = popperRef.value) == null ? void 0 : _a.onClose();
  30645. }
  30646. function handleOpen() {
  30647. var _a;
  30648. (_a = popperRef.value) == null ? void 0 : _a.onOpen();
  30649. }
  30650. const dropdownSize = useFormSize();
  30651. function commandHandler(...args) {
  30652. emit("command", ...args);
  30653. }
  30654. function onAutofocusTriggerEnter() {
  30655. var _a, _b;
  30656. (_b = (_a = triggeringElementRef.value) == null ? void 0 : _a.$el) == null ? void 0 : _b.focus();
  30657. }
  30658. function onItemEnter() {
  30659. }
  30660. function onItemLeave() {
  30661. const contentEl = unref(contentRef);
  30662. trigger.value.includes("hover") && (contentEl == null ? void 0 : contentEl.focus());
  30663. currentTabId.value = null;
  30664. }
  30665. function handleCurrentTabIdChange(id) {
  30666. currentTabId.value = id;
  30667. }
  30668. function handleEntryFocus(e) {
  30669. if (!isUsingKeyboard.value) {
  30670. e.preventDefault();
  30671. e.stopImmediatePropagation();
  30672. }
  30673. }
  30674. function handleBeforeShowTooltip() {
  30675. emit("visible-change", true);
  30676. }
  30677. function handleShowTooltip(event) {
  30678. var _a;
  30679. if ((event == null ? void 0 : event.type) === "keydown") {
  30680. (_a = contentRef.value) == null ? void 0 : _a.focus();
  30681. }
  30682. }
  30683. function handleBeforeHideTooltip() {
  30684. emit("visible-change", false);
  30685. }
  30686. provide(DROPDOWN_INJECTION_KEY, {
  30687. contentRef,
  30688. role: computed(() => props.role),
  30689. triggerId,
  30690. isUsingKeyboard,
  30691. onItemEnter,
  30692. onItemLeave
  30693. });
  30694. provide("elDropdown", {
  30695. instance: _instance,
  30696. dropdownSize,
  30697. handleClick,
  30698. commandHandler,
  30699. trigger: toRef(props, "trigger"),
  30700. hideOnClick: toRef(props, "hideOnClick")
  30701. });
  30702. const onFocusAfterTrapped = (e) => {
  30703. var _a, _b;
  30704. e.preventDefault();
  30705. (_b = (_a = contentRef.value) == null ? void 0 : _a.focus) == null ? void 0 : _b.call(_a, {
  30706. preventScroll: true
  30707. });
  30708. };
  30709. const handlerMainButtonClick = (event) => {
  30710. emit("click", event);
  30711. };
  30712. return {
  30713. t,
  30714. ns,
  30715. scrollbar,
  30716. wrapStyle,
  30717. dropdownTriggerKls,
  30718. dropdownSize,
  30719. triggerId,
  30720. currentTabId,
  30721. handleCurrentTabIdChange,
  30722. handlerMainButtonClick,
  30723. handleEntryFocus,
  30724. handleClose,
  30725. handleOpen,
  30726. handleBeforeShowTooltip,
  30727. handleShowTooltip,
  30728. handleBeforeHideTooltip,
  30729. onFocusAfterTrapped,
  30730. popperRef,
  30731. contentRef,
  30732. triggeringElementRef,
  30733. referenceElementRef
  30734. };
  30735. }
  30736. });
  30737. function _sfc_render$f(_ctx, _cache, $props, $setup, $data, $options) {
  30738. var _a;
  30739. const _component_el_dropdown_collection = resolveComponent("el-dropdown-collection");
  30740. const _component_el_roving_focus_group = resolveComponent("el-roving-focus-group");
  30741. const _component_el_scrollbar = resolveComponent("el-scrollbar");
  30742. const _component_el_only_child = resolveComponent("el-only-child");
  30743. const _component_el_tooltip = resolveComponent("el-tooltip");
  30744. const _component_el_button = resolveComponent("el-button");
  30745. const _component_arrow_down = resolveComponent("arrow-down");
  30746. const _component_el_icon = resolveComponent("el-icon");
  30747. const _component_el_button_group = resolveComponent("el-button-group");
  30748. return openBlock(), createElementBlock("div", {
  30749. class: normalizeClass([_ctx.ns.b(), _ctx.ns.is("disabled", _ctx.disabled)])
  30750. }, [
  30751. createVNode(_component_el_tooltip, {
  30752. ref: "popperRef",
  30753. role: _ctx.role,
  30754. effect: _ctx.effect,
  30755. "fallback-placements": ["bottom", "top"],
  30756. "popper-options": _ctx.popperOptions,
  30757. "gpu-acceleration": false,
  30758. "hide-after": _ctx.trigger === "hover" ? _ctx.hideTimeout : 0,
  30759. "manual-mode": true,
  30760. placement: _ctx.placement,
  30761. "popper-class": [_ctx.ns.e("popper"), _ctx.popperClass],
  30762. "reference-element": (_a = _ctx.referenceElementRef) == null ? void 0 : _a.$el,
  30763. trigger: _ctx.trigger,
  30764. "trigger-keys": _ctx.triggerKeys,
  30765. "trigger-target-el": _ctx.contentRef,
  30766. "show-after": _ctx.trigger === "hover" ? _ctx.showTimeout : 0,
  30767. "stop-popper-mouse-event": false,
  30768. "virtual-ref": _ctx.triggeringElementRef,
  30769. "virtual-triggering": _ctx.splitButton,
  30770. disabled: _ctx.disabled,
  30771. transition: `${_ctx.ns.namespace.value}-zoom-in-top`,
  30772. teleported: _ctx.teleported,
  30773. pure: "",
  30774. persistent: _ctx.persistent,
  30775. onBeforeShow: _ctx.handleBeforeShowTooltip,
  30776. onShow: _ctx.handleShowTooltip,
  30777. onBeforeHide: _ctx.handleBeforeHideTooltip
  30778. }, createSlots({
  30779. content: withCtx(() => [
  30780. createVNode(_component_el_scrollbar, {
  30781. ref: "scrollbar",
  30782. "wrap-style": _ctx.wrapStyle,
  30783. tag: "div",
  30784. "view-class": _ctx.ns.e("list")
  30785. }, {
  30786. default: withCtx(() => [
  30787. createVNode(_component_el_roving_focus_group, {
  30788. loop: _ctx.loop,
  30789. "current-tab-id": _ctx.currentTabId,
  30790. orientation: "horizontal",
  30791. onCurrentTabIdChange: _ctx.handleCurrentTabIdChange,
  30792. onEntryFocus: _ctx.handleEntryFocus
  30793. }, {
  30794. default: withCtx(() => [
  30795. createVNode(_component_el_dropdown_collection, null, {
  30796. default: withCtx(() => [
  30797. renderSlot(_ctx.$slots, "dropdown")
  30798. ]),
  30799. _: 3
  30800. })
  30801. ]),
  30802. _: 3
  30803. }, 8, ["loop", "current-tab-id", "onCurrentTabIdChange", "onEntryFocus"])
  30804. ]),
  30805. _: 3
  30806. }, 8, ["wrap-style", "view-class"])
  30807. ]),
  30808. _: 2
  30809. }, [
  30810. !_ctx.splitButton ? {
  30811. name: "default",
  30812. fn: withCtx(() => [
  30813. createVNode(_component_el_only_child, {
  30814. id: _ctx.triggerId,
  30815. ref: "triggeringElementRef",
  30816. role: "button",
  30817. tabindex: _ctx.tabindex
  30818. }, {
  30819. default: withCtx(() => [
  30820. renderSlot(_ctx.$slots, "default")
  30821. ]),
  30822. _: 3
  30823. }, 8, ["id", "tabindex"])
  30824. ])
  30825. } : void 0
  30826. ]), 1032, ["role", "effect", "popper-options", "hide-after", "placement", "popper-class", "reference-element", "trigger", "trigger-keys", "trigger-target-el", "show-after", "virtual-ref", "virtual-triggering", "disabled", "transition", "teleported", "persistent", "onBeforeShow", "onShow", "onBeforeHide"]),
  30827. _ctx.splitButton ? (openBlock(), createBlock(_component_el_button_group, { key: 0 }, {
  30828. default: withCtx(() => [
  30829. createVNode(_component_el_button, mergeProps({ ref: "referenceElementRef" }, _ctx.buttonProps, {
  30830. size: _ctx.dropdownSize,
  30831. type: _ctx.type,
  30832. disabled: _ctx.disabled,
  30833. tabindex: _ctx.tabindex,
  30834. onClick: _ctx.handlerMainButtonClick
  30835. }), {
  30836. default: withCtx(() => [
  30837. renderSlot(_ctx.$slots, "default")
  30838. ]),
  30839. _: 3
  30840. }, 16, ["size", "type", "disabled", "tabindex", "onClick"]),
  30841. createVNode(_component_el_button, mergeProps({
  30842. id: _ctx.triggerId,
  30843. ref: "triggeringElementRef"
  30844. }, _ctx.buttonProps, {
  30845. role: "button",
  30846. size: _ctx.dropdownSize,
  30847. type: _ctx.type,
  30848. class: _ctx.ns.e("caret-button"),
  30849. disabled: _ctx.disabled,
  30850. tabindex: _ctx.tabindex,
  30851. "aria-label": _ctx.t("el.dropdown.toggleDropdown")
  30852. }), {
  30853. default: withCtx(() => [
  30854. createVNode(_component_el_icon, {
  30855. class: normalizeClass(_ctx.ns.e("icon"))
  30856. }, {
  30857. default: withCtx(() => [
  30858. createVNode(_component_arrow_down)
  30859. ]),
  30860. _: 1
  30861. }, 8, ["class"])
  30862. ]),
  30863. _: 1
  30864. }, 16, ["id", "size", "type", "class", "disabled", "tabindex", "aria-label"])
  30865. ]),
  30866. _: 3
  30867. })) : createCommentVNode("v-if", true)
  30868. ], 2);
  30869. }
  30870. var Dropdown = /* @__PURE__ */ _export_sfc(_sfc_main$1g, [["render", _sfc_render$f], ["__file", "dropdown.vue"]]);
  30871. const _sfc_main$1f = defineComponent({
  30872. name: "DropdownItemImpl",
  30873. components: {
  30874. ElIcon
  30875. },
  30876. props: dropdownItemProps,
  30877. emits: ["pointermove", "pointerleave", "click", "clickimpl"],
  30878. setup(_, { emit }) {
  30879. const ns = useNamespace("dropdown");
  30880. const { role: menuRole } = inject(DROPDOWN_INJECTION_KEY, void 0);
  30881. const { collectionItemRef: dropdownCollectionItemRef } = inject(COLLECTION_ITEM_INJECTION_KEY, void 0);
  30882. const { collectionItemRef: rovingFocusCollectionItemRef } = inject(COLLECTION_ITEM_INJECTION_KEY$1, void 0);
  30883. const {
  30884. rovingFocusGroupItemRef,
  30885. tabIndex,
  30886. handleFocus,
  30887. handleKeydown: handleItemKeydown,
  30888. handleMousedown
  30889. } = inject(ROVING_FOCUS_GROUP_ITEM_INJECTION_KEY, void 0);
  30890. const itemRef = composeRefs(dropdownCollectionItemRef, rovingFocusCollectionItemRef, rovingFocusGroupItemRef);
  30891. const role = computed(() => {
  30892. if (menuRole.value === "menu") {
  30893. return "menuitem";
  30894. } else if (menuRole.value === "navigation") {
  30895. return "link";
  30896. }
  30897. return "button";
  30898. });
  30899. const handleKeydown = composeEventHandlers((e) => {
  30900. if ([EVENT_CODE.enter, EVENT_CODE.numpadEnter, EVENT_CODE.space].includes(e.code)) {
  30901. e.preventDefault();
  30902. e.stopImmediatePropagation();
  30903. emit("clickimpl", e);
  30904. return true;
  30905. }
  30906. }, handleItemKeydown);
  30907. return {
  30908. ns,
  30909. itemRef,
  30910. dataset: {
  30911. [COLLECTION_ITEM_SIGN]: ""
  30912. },
  30913. role,
  30914. tabIndex,
  30915. handleFocus,
  30916. handleKeydown,
  30917. handleMousedown
  30918. };
  30919. }
  30920. });
  30921. function _sfc_render$e(_ctx, _cache, $props, $setup, $data, $options) {
  30922. const _component_el_icon = resolveComponent("el-icon");
  30923. return openBlock(), createElementBlock(Fragment, null, [
  30924. _ctx.divided ? (openBlock(), createElementBlock("li", {
  30925. key: 0,
  30926. role: "separator",
  30927. class: normalizeClass(_ctx.ns.bem("menu", "item", "divided"))
  30928. }, null, 2)) : createCommentVNode("v-if", true),
  30929. createElementVNode("li", mergeProps({ ref: _ctx.itemRef }, { ..._ctx.dataset, ..._ctx.$attrs }, {
  30930. "aria-disabled": _ctx.disabled,
  30931. class: [_ctx.ns.be("menu", "item"), _ctx.ns.is("disabled", _ctx.disabled)],
  30932. tabindex: _ctx.tabIndex,
  30933. role: _ctx.role,
  30934. onClick: (e) => _ctx.$emit("clickimpl", e),
  30935. onFocus: _ctx.handleFocus,
  30936. onKeydown: withModifiers(_ctx.handleKeydown, ["self"]),
  30937. onMousedown: _ctx.handleMousedown,
  30938. onPointermove: (e) => _ctx.$emit("pointermove", e),
  30939. onPointerleave: (e) => _ctx.$emit("pointerleave", e)
  30940. }), [
  30941. _ctx.icon ? (openBlock(), createBlock(_component_el_icon, { key: 0 }, {
  30942. default: withCtx(() => [
  30943. (openBlock(), createBlock(resolveDynamicComponent(_ctx.icon)))
  30944. ]),
  30945. _: 1
  30946. })) : createCommentVNode("v-if", true),
  30947. renderSlot(_ctx.$slots, "default")
  30948. ], 16, ["aria-disabled", "tabindex", "role", "onClick", "onFocus", "onKeydown", "onMousedown", "onPointermove", "onPointerleave"])
  30949. ], 64);
  30950. }
  30951. var ElDropdownItemImpl = /* @__PURE__ */ _export_sfc(_sfc_main$1f, [["render", _sfc_render$e], ["__file", "dropdown-item-impl.vue"]]);
  30952. const useDropdown = () => {
  30953. const elDropdown = inject("elDropdown", {});
  30954. const _elDropdownSize = computed(() => elDropdown == null ? void 0 : elDropdown.dropdownSize);
  30955. return {
  30956. elDropdown,
  30957. _elDropdownSize
  30958. };
  30959. };
  30960. const _sfc_main$1e = defineComponent({
  30961. name: "ElDropdownItem",
  30962. components: {
  30963. ElDropdownCollectionItem: ElCollectionItem,
  30964. ElRovingFocusItem,
  30965. ElDropdownItemImpl
  30966. },
  30967. inheritAttrs: false,
  30968. props: dropdownItemProps,
  30969. emits: ["pointermove", "pointerleave", "click"],
  30970. setup(props, { emit, attrs }) {
  30971. const { elDropdown } = useDropdown();
  30972. const _instance = getCurrentInstance();
  30973. const itemRef = ref(null);
  30974. const textContent = computed(() => {
  30975. var _a, _b;
  30976. return (_b = (_a = unref(itemRef)) == null ? void 0 : _a.textContent) != null ? _b : "";
  30977. });
  30978. const { onItemEnter, onItemLeave } = inject(DROPDOWN_INJECTION_KEY, void 0);
  30979. const handlePointerMove = composeEventHandlers((e) => {
  30980. emit("pointermove", e);
  30981. return e.defaultPrevented;
  30982. }, whenMouse((e) => {
  30983. if (props.disabled) {
  30984. onItemLeave(e);
  30985. return;
  30986. }
  30987. const target = e.currentTarget;
  30988. if (target === document.activeElement || target.contains(document.activeElement)) {
  30989. return;
  30990. }
  30991. onItemEnter(e);
  30992. if (!e.defaultPrevented) {
  30993. target == null ? void 0 : target.focus();
  30994. }
  30995. }));
  30996. const handlePointerLeave = composeEventHandlers((e) => {
  30997. emit("pointerleave", e);
  30998. return e.defaultPrevented;
  30999. }, whenMouse(onItemLeave));
  31000. const handleClick = composeEventHandlers((e) => {
  31001. if (props.disabled) {
  31002. return;
  31003. }
  31004. emit("click", e);
  31005. return e.type !== "keydown" && e.defaultPrevented;
  31006. }, (e) => {
  31007. var _a, _b, _c;
  31008. if (props.disabled) {
  31009. e.stopImmediatePropagation();
  31010. return;
  31011. }
  31012. if ((_a = elDropdown == null ? void 0 : elDropdown.hideOnClick) == null ? void 0 : _a.value) {
  31013. (_b = elDropdown.handleClick) == null ? void 0 : _b.call(elDropdown);
  31014. }
  31015. (_c = elDropdown.commandHandler) == null ? void 0 : _c.call(elDropdown, props.command, _instance, e);
  31016. });
  31017. const propsAndAttrs = computed(() => ({ ...props, ...attrs }));
  31018. return {
  31019. handleClick,
  31020. handlePointerMove,
  31021. handlePointerLeave,
  31022. textContent,
  31023. propsAndAttrs
  31024. };
  31025. }
  31026. });
  31027. function _sfc_render$d(_ctx, _cache, $props, $setup, $data, $options) {
  31028. var _a;
  31029. const _component_el_dropdown_item_impl = resolveComponent("el-dropdown-item-impl");
  31030. const _component_el_roving_focus_item = resolveComponent("el-roving-focus-item");
  31031. const _component_el_dropdown_collection_item = resolveComponent("el-dropdown-collection-item");
  31032. return openBlock(), createBlock(_component_el_dropdown_collection_item, {
  31033. disabled: _ctx.disabled,
  31034. "text-value": (_a = _ctx.textValue) != null ? _a : _ctx.textContent
  31035. }, {
  31036. default: withCtx(() => [
  31037. createVNode(_component_el_roving_focus_item, {
  31038. focusable: !_ctx.disabled
  31039. }, {
  31040. default: withCtx(() => [
  31041. createVNode(_component_el_dropdown_item_impl, mergeProps(_ctx.propsAndAttrs, {
  31042. onPointerleave: _ctx.handlePointerLeave,
  31043. onPointermove: _ctx.handlePointerMove,
  31044. onClickimpl: _ctx.handleClick
  31045. }), {
  31046. default: withCtx(() => [
  31047. renderSlot(_ctx.$slots, "default")
  31048. ]),
  31049. _: 3
  31050. }, 16, ["onPointerleave", "onPointermove", "onClickimpl"])
  31051. ]),
  31052. _: 3
  31053. }, 8, ["focusable"])
  31054. ]),
  31055. _: 3
  31056. }, 8, ["disabled", "text-value"]);
  31057. }
  31058. var DropdownItem = /* @__PURE__ */ _export_sfc(_sfc_main$1e, [["render", _sfc_render$d], ["__file", "dropdown-item.vue"]]);
  31059. const _sfc_main$1d = defineComponent({
  31060. name: "ElDropdownMenu",
  31061. props: dropdownMenuProps,
  31062. setup(props) {
  31063. const ns = useNamespace("dropdown");
  31064. const { _elDropdownSize } = useDropdown();
  31065. const size = _elDropdownSize.value;
  31066. const { focusTrapRef, onKeydown } = inject(FOCUS_TRAP_INJECTION_KEY, void 0);
  31067. const { contentRef, role, triggerId } = inject(DROPDOWN_INJECTION_KEY, void 0);
  31068. const { collectionRef: dropdownCollectionRef, getItems } = inject(COLLECTION_INJECTION_KEY, void 0);
  31069. const {
  31070. rovingFocusGroupRef,
  31071. rovingFocusGroupRootStyle,
  31072. tabIndex,
  31073. onBlur,
  31074. onFocus,
  31075. onMousedown
  31076. } = inject(ROVING_FOCUS_GROUP_INJECTION_KEY, void 0);
  31077. const { collectionRef: rovingFocusGroupCollectionRef } = inject(COLLECTION_INJECTION_KEY$1, void 0);
  31078. const dropdownKls = computed(() => {
  31079. return [ns.b("menu"), ns.bm("menu", size == null ? void 0 : size.value)];
  31080. });
  31081. const dropdownListWrapperRef = composeRefs(contentRef, dropdownCollectionRef, focusTrapRef, rovingFocusGroupRef, rovingFocusGroupCollectionRef);
  31082. const composedKeydown = composeEventHandlers((e) => {
  31083. var _a;
  31084. (_a = props.onKeydown) == null ? void 0 : _a.call(props, e);
  31085. }, (e) => {
  31086. const { currentTarget, code, target } = e;
  31087. currentTarget.contains(target);
  31088. if (EVENT_CODE.tab === code) {
  31089. e.stopImmediatePropagation();
  31090. }
  31091. e.preventDefault();
  31092. if (target !== unref(contentRef) || !FIRST_LAST_KEYS.includes(code))
  31093. return;
  31094. const items = getItems().filter((item) => !item.disabled);
  31095. const targets = items.map((item) => item.ref);
  31096. if (LAST_KEYS.includes(code)) {
  31097. targets.reverse();
  31098. }
  31099. focusFirst(targets);
  31100. });
  31101. const handleKeydown = (e) => {
  31102. composedKeydown(e);
  31103. onKeydown(e);
  31104. };
  31105. return {
  31106. size,
  31107. rovingFocusGroupRootStyle,
  31108. tabIndex,
  31109. dropdownKls,
  31110. role,
  31111. triggerId,
  31112. dropdownListWrapperRef,
  31113. handleKeydown,
  31114. onBlur,
  31115. onFocus,
  31116. onMousedown
  31117. };
  31118. }
  31119. });
  31120. function _sfc_render$c(_ctx, _cache, $props, $setup, $data, $options) {
  31121. return openBlock(), createElementBlock("ul", {
  31122. ref: _ctx.dropdownListWrapperRef,
  31123. class: normalizeClass(_ctx.dropdownKls),
  31124. style: normalizeStyle(_ctx.rovingFocusGroupRootStyle),
  31125. tabindex: -1,
  31126. role: _ctx.role,
  31127. "aria-labelledby": _ctx.triggerId,
  31128. onBlur: _ctx.onBlur,
  31129. onFocus: _ctx.onFocus,
  31130. onKeydown: withModifiers(_ctx.handleKeydown, ["self"]),
  31131. onMousedown: withModifiers(_ctx.onMousedown, ["self"])
  31132. }, [
  31133. renderSlot(_ctx.$slots, "default")
  31134. ], 46, ["role", "aria-labelledby", "onBlur", "onFocus", "onKeydown", "onMousedown"]);
  31135. }
  31136. var DropdownMenu = /* @__PURE__ */ _export_sfc(_sfc_main$1d, [["render", _sfc_render$c], ["__file", "dropdown-menu.vue"]]);
  31137. const ElDropdown = withInstall(Dropdown, {
  31138. DropdownItem,
  31139. DropdownMenu
  31140. });
  31141. const ElDropdownItem = withNoopInstall(DropdownItem);
  31142. const ElDropdownMenu = withNoopInstall(DropdownMenu);
  31143. const __default__$_ = defineComponent({
  31144. name: "ImgEmpty"
  31145. });
  31146. const _sfc_main$1c = /* @__PURE__ */ defineComponent({
  31147. ...__default__$_,
  31148. setup(__props) {
  31149. const ns = useNamespace("empty");
  31150. const id = useId();
  31151. return (_ctx, _cache) => {
  31152. return openBlock(), createElementBlock("svg", {
  31153. viewBox: "0 0 79 86",
  31154. version: "1.1",
  31155. xmlns: "http://www.w3.org/2000/svg",
  31156. "xmlns:xlink": "http://www.w3.org/1999/xlink"
  31157. }, [
  31158. createElementVNode("defs", null, [
  31159. createElementVNode("linearGradient", {
  31160. id: `linearGradient-1-${unref(id)}`,
  31161. x1: "38.8503086%",
  31162. y1: "0%",
  31163. x2: "61.1496914%",
  31164. y2: "100%"
  31165. }, [
  31166. createElementVNode("stop", {
  31167. "stop-color": `var(${unref(ns).cssVarBlockName("fill-color-1")})`,
  31168. offset: "0%"
  31169. }, null, 8, ["stop-color"]),
  31170. createElementVNode("stop", {
  31171. "stop-color": `var(${unref(ns).cssVarBlockName("fill-color-4")})`,
  31172. offset: "100%"
  31173. }, null, 8, ["stop-color"])
  31174. ], 8, ["id"]),
  31175. createElementVNode("linearGradient", {
  31176. id: `linearGradient-2-${unref(id)}`,
  31177. x1: "0%",
  31178. y1: "9.5%",
  31179. x2: "100%",
  31180. y2: "90.5%"
  31181. }, [
  31182. createElementVNode("stop", {
  31183. "stop-color": `var(${unref(ns).cssVarBlockName("fill-color-1")})`,
  31184. offset: "0%"
  31185. }, null, 8, ["stop-color"]),
  31186. createElementVNode("stop", {
  31187. "stop-color": `var(${unref(ns).cssVarBlockName("fill-color-6")})`,
  31188. offset: "100%"
  31189. }, null, 8, ["stop-color"])
  31190. ], 8, ["id"]),
  31191. createElementVNode("rect", {
  31192. id: `path-3-${unref(id)}`,
  31193. x: "0",
  31194. y: "0",
  31195. width: "17",
  31196. height: "36"
  31197. }, null, 8, ["id"])
  31198. ]),
  31199. createElementVNode("g", {
  31200. stroke: "none",
  31201. "stroke-width": "1",
  31202. fill: "none",
  31203. "fill-rule": "evenodd"
  31204. }, [
  31205. createElementVNode("g", { transform: "translate(-1268.000000, -535.000000)" }, [
  31206. createElementVNode("g", { transform: "translate(1268.000000, 535.000000)" }, [
  31207. createElementVNode("path", {
  31208. 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",
  31209. fill: `var(${unref(ns).cssVarBlockName("fill-color-3")})`
  31210. }, null, 8, ["fill"]),
  31211. createElementVNode("polygon", {
  31212. fill: `var(${unref(ns).cssVarBlockName("fill-color-7")})`,
  31213. transform: "translate(27.500000, 51.500000) scale(1, -1) translate(-27.500000, -51.500000) ",
  31214. points: "13 58 53 58 42 45 2 45"
  31215. }, null, 8, ["fill"]),
  31216. createElementVNode("g", { transform: "translate(34.500000, 31.500000) scale(-1, 1) rotate(-25.000000) translate(-34.500000, -31.500000) translate(7.000000, 10.000000)" }, [
  31217. createElementVNode("polygon", {
  31218. fill: `var(${unref(ns).cssVarBlockName("fill-color-7")})`,
  31219. transform: "translate(11.500000, 5.000000) scale(1, -1) translate(-11.500000, -5.000000) ",
  31220. points: "2.84078316e-14 3 18 3 23 7 5 7"
  31221. }, null, 8, ["fill"]),
  31222. createElementVNode("polygon", {
  31223. fill: `var(${unref(ns).cssVarBlockName("fill-color-5")})`,
  31224. points: "-3.69149156e-15 7 38 7 38 43 -3.69149156e-15 43"
  31225. }, null, 8, ["fill"]),
  31226. createElementVNode("rect", {
  31227. fill: `url(#linearGradient-1-${unref(id)})`,
  31228. transform: "translate(46.500000, 25.000000) scale(-1, 1) translate(-46.500000, -25.000000) ",
  31229. x: "38",
  31230. y: "7",
  31231. width: "17",
  31232. height: "36"
  31233. }, null, 8, ["fill"]),
  31234. createElementVNode("polygon", {
  31235. fill: `var(${unref(ns).cssVarBlockName("fill-color-2")})`,
  31236. transform: "translate(39.500000, 3.500000) scale(-1, 1) translate(-39.500000, -3.500000) ",
  31237. points: "24 7 41 7 55 -3.63806207e-12 38 -3.63806207e-12"
  31238. }, null, 8, ["fill"])
  31239. ]),
  31240. createElementVNode("rect", {
  31241. fill: `url(#linearGradient-2-${unref(id)})`,
  31242. x: "13",
  31243. y: "45",
  31244. width: "40",
  31245. height: "36"
  31246. }, null, 8, ["fill"]),
  31247. createElementVNode("g", { transform: "translate(53.000000, 45.000000)" }, [
  31248. createElementVNode("use", {
  31249. fill: `var(${unref(ns).cssVarBlockName("fill-color-8")})`,
  31250. transform: "translate(8.500000, 18.000000) scale(-1, 1) translate(-8.500000, -18.000000) ",
  31251. "xlink:href": `#path-3-${unref(id)}`
  31252. }, null, 8, ["fill", "xlink:href"]),
  31253. createElementVNode("polygon", {
  31254. fill: `var(${unref(ns).cssVarBlockName("fill-color-9")})`,
  31255. mask: `url(#mask-4-${unref(id)})`,
  31256. transform: "translate(12.000000, 9.000000) scale(-1, 1) translate(-12.000000, -9.000000) ",
  31257. points: "7 0 24 0 20 18 7 16.5"
  31258. }, null, 8, ["fill", "mask"])
  31259. ]),
  31260. createElementVNode("polygon", {
  31261. fill: `var(${unref(ns).cssVarBlockName("fill-color-2")})`,
  31262. transform: "translate(66.000000, 51.500000) scale(-1, 1) translate(-66.000000, -51.500000) ",
  31263. points: "62 45 79 45 70 58 53 58"
  31264. }, null, 8, ["fill"])
  31265. ])
  31266. ])
  31267. ])
  31268. ]);
  31269. };
  31270. }
  31271. });
  31272. var ImgEmpty = /* @__PURE__ */ _export_sfc(_sfc_main$1c, [["__file", "img-empty.vue"]]);
  31273. const emptyProps = buildProps({
  31274. image: {
  31275. type: String,
  31276. default: ""
  31277. },
  31278. imageSize: Number,
  31279. description: {
  31280. type: String,
  31281. default: ""
  31282. }
  31283. });
  31284. const __default__$Z = defineComponent({
  31285. name: "ElEmpty"
  31286. });
  31287. const _sfc_main$1b = /* @__PURE__ */ defineComponent({
  31288. ...__default__$Z,
  31289. props: emptyProps,
  31290. setup(__props) {
  31291. const props = __props;
  31292. const { t } = useLocale();
  31293. const ns = useNamespace("empty");
  31294. const emptyDescription = computed(() => props.description || t("el.table.emptyText"));
  31295. const imageStyle = computed(() => ({
  31296. width: addUnit(props.imageSize)
  31297. }));
  31298. return (_ctx, _cache) => {
  31299. return openBlock(), createElementBlock("div", {
  31300. class: normalizeClass(unref(ns).b())
  31301. }, [
  31302. createElementVNode("div", {
  31303. class: normalizeClass(unref(ns).e("image")),
  31304. style: normalizeStyle(unref(imageStyle))
  31305. }, [
  31306. _ctx.image ? (openBlock(), createElementBlock("img", {
  31307. key: 0,
  31308. src: _ctx.image,
  31309. ondragstart: "return false"
  31310. }, null, 8, ["src"])) : renderSlot(_ctx.$slots, "image", { key: 1 }, () => [
  31311. createVNode(ImgEmpty)
  31312. ])
  31313. ], 6),
  31314. createElementVNode("div", {
  31315. class: normalizeClass(unref(ns).e("description"))
  31316. }, [
  31317. _ctx.$slots.description ? renderSlot(_ctx.$slots, "description", { key: 0 }) : (openBlock(), createElementBlock("p", { key: 1 }, toDisplayString(unref(emptyDescription)), 1))
  31318. ], 2),
  31319. _ctx.$slots.default ? (openBlock(), createElementBlock("div", {
  31320. key: 0,
  31321. class: normalizeClass(unref(ns).e("bottom"))
  31322. }, [
  31323. renderSlot(_ctx.$slots, "default")
  31324. ], 2)) : createCommentVNode("v-if", true)
  31325. ], 2);
  31326. };
  31327. }
  31328. });
  31329. var Empty = /* @__PURE__ */ _export_sfc(_sfc_main$1b, [["__file", "empty.vue"]]);
  31330. const ElEmpty = withInstall(Empty);
  31331. const imageViewerProps = buildProps({
  31332. urlList: {
  31333. type: definePropType(Array),
  31334. default: () => mutable([])
  31335. },
  31336. zIndex: {
  31337. type: Number
  31338. },
  31339. initialIndex: {
  31340. type: Number,
  31341. default: 0
  31342. },
  31343. infinite: {
  31344. type: Boolean,
  31345. default: true
  31346. },
  31347. hideOnClickModal: Boolean,
  31348. teleported: Boolean,
  31349. closeOnPressEscape: {
  31350. type: Boolean,
  31351. default: true
  31352. },
  31353. zoomRate: {
  31354. type: Number,
  31355. default: 1.2
  31356. },
  31357. minScale: {
  31358. type: Number,
  31359. default: 0.2
  31360. },
  31361. maxScale: {
  31362. type: Number,
  31363. default: 7
  31364. },
  31365. showProgress: {
  31366. type: Boolean,
  31367. default: false
  31368. },
  31369. crossorigin: {
  31370. type: definePropType(String)
  31371. }
  31372. });
  31373. const imageViewerEmits = {
  31374. close: () => true,
  31375. switch: (index) => isNumber(index),
  31376. rotate: (deg) => isNumber(deg)
  31377. };
  31378. const __default__$Y = defineComponent({
  31379. name: "ElImageViewer"
  31380. });
  31381. const _sfc_main$1a = /* @__PURE__ */ defineComponent({
  31382. ...__default__$Y,
  31383. props: imageViewerProps,
  31384. emits: imageViewerEmits,
  31385. setup(__props, { expose, emit }) {
  31386. var _a;
  31387. const props = __props;
  31388. const modes = {
  31389. CONTAIN: {
  31390. name: "contain",
  31391. icon: markRaw(full_screen_default)
  31392. },
  31393. ORIGINAL: {
  31394. name: "original",
  31395. icon: markRaw(scale_to_original_default)
  31396. }
  31397. };
  31398. let stopWheelListener;
  31399. let prevOverflow = "";
  31400. const { t } = useLocale();
  31401. const ns = useNamespace("image-viewer");
  31402. const { nextZIndex } = useZIndex();
  31403. const wrapper = ref();
  31404. const imgRefs = ref([]);
  31405. const scopeEventListener = effectScope();
  31406. const loading = ref(true);
  31407. const activeIndex = ref(props.initialIndex);
  31408. const mode = shallowRef(modes.CONTAIN);
  31409. const transform = ref({
  31410. scale: 1,
  31411. deg: 0,
  31412. offsetX: 0,
  31413. offsetY: 0,
  31414. enableTransition: false
  31415. });
  31416. const zIndex = ref((_a = props.zIndex) != null ? _a : nextZIndex());
  31417. const isSingle = computed(() => {
  31418. const { urlList } = props;
  31419. return urlList.length <= 1;
  31420. });
  31421. const isFirst = computed(() => activeIndex.value === 0);
  31422. const isLast = computed(() => activeIndex.value === props.urlList.length - 1);
  31423. const currentImg = computed(() => props.urlList[activeIndex.value]);
  31424. const arrowPrevKls = computed(() => [
  31425. ns.e("btn"),
  31426. ns.e("prev"),
  31427. ns.is("disabled", !props.infinite && isFirst.value)
  31428. ]);
  31429. const arrowNextKls = computed(() => [
  31430. ns.e("btn"),
  31431. ns.e("next"),
  31432. ns.is("disabled", !props.infinite && isLast.value)
  31433. ]);
  31434. const imgStyle = computed(() => {
  31435. const { scale, deg, offsetX, offsetY, enableTransition } = transform.value;
  31436. let translateX = offsetX / scale;
  31437. let translateY = offsetY / scale;
  31438. const radian = deg * Math.PI / 180;
  31439. const cosRadian = Math.cos(radian);
  31440. const sinRadian = Math.sin(radian);
  31441. translateX = translateX * cosRadian + translateY * sinRadian;
  31442. translateY = translateY * cosRadian - offsetX / scale * sinRadian;
  31443. const style = {
  31444. transform: `scale(${scale}) rotate(${deg}deg) translate(${translateX}px, ${translateY}px)`,
  31445. transition: enableTransition ? "transform .3s" : ""
  31446. };
  31447. if (mode.value.name === modes.CONTAIN.name) {
  31448. style.maxWidth = style.maxHeight = "100%";
  31449. }
  31450. return style;
  31451. });
  31452. const progress = computed(() => `${activeIndex.value + 1} / ${props.urlList.length}`);
  31453. function hide() {
  31454. unregisterEventListener();
  31455. stopWheelListener == null ? void 0 : stopWheelListener();
  31456. document.body.style.overflow = prevOverflow;
  31457. emit("close");
  31458. }
  31459. function registerEventListener() {
  31460. const keydownHandler = throttle((e) => {
  31461. switch (e.code) {
  31462. case EVENT_CODE.esc:
  31463. props.closeOnPressEscape && hide();
  31464. break;
  31465. case EVENT_CODE.space:
  31466. toggleMode();
  31467. break;
  31468. case EVENT_CODE.left:
  31469. prev();
  31470. break;
  31471. case EVENT_CODE.up:
  31472. handleActions("zoomIn");
  31473. break;
  31474. case EVENT_CODE.right:
  31475. next();
  31476. break;
  31477. case EVENT_CODE.down:
  31478. handleActions("zoomOut");
  31479. break;
  31480. }
  31481. });
  31482. const mousewheelHandler = throttle((e) => {
  31483. const delta = e.deltaY || e.deltaX;
  31484. handleActions(delta < 0 ? "zoomIn" : "zoomOut", {
  31485. zoomRate: props.zoomRate,
  31486. enableTransition: false
  31487. });
  31488. });
  31489. scopeEventListener.run(() => {
  31490. useEventListener(document, "keydown", keydownHandler);
  31491. useEventListener(document, "wheel", mousewheelHandler);
  31492. });
  31493. }
  31494. function unregisterEventListener() {
  31495. scopeEventListener.stop();
  31496. }
  31497. function handleImgLoad() {
  31498. loading.value = false;
  31499. }
  31500. function handleImgError(e) {
  31501. loading.value = false;
  31502. e.target.alt = t("el.image.error");
  31503. }
  31504. function handleMouseDown(e) {
  31505. if (loading.value || e.button !== 0 || !wrapper.value)
  31506. return;
  31507. transform.value.enableTransition = false;
  31508. const { offsetX, offsetY } = transform.value;
  31509. const startX = e.pageX;
  31510. const startY = e.pageY;
  31511. const dragHandler = throttle((ev) => {
  31512. transform.value = {
  31513. ...transform.value,
  31514. offsetX: offsetX + ev.pageX - startX,
  31515. offsetY: offsetY + ev.pageY - startY
  31516. };
  31517. });
  31518. const removeMousemove = useEventListener(document, "mousemove", dragHandler);
  31519. useEventListener(document, "mouseup", () => {
  31520. removeMousemove();
  31521. });
  31522. e.preventDefault();
  31523. }
  31524. function reset() {
  31525. transform.value = {
  31526. scale: 1,
  31527. deg: 0,
  31528. offsetX: 0,
  31529. offsetY: 0,
  31530. enableTransition: false
  31531. };
  31532. }
  31533. function toggleMode() {
  31534. if (loading.value)
  31535. return;
  31536. const modeNames = keysOf(modes);
  31537. const modeValues = Object.values(modes);
  31538. const currentMode = mode.value.name;
  31539. const index = modeValues.findIndex((i) => i.name === currentMode);
  31540. const nextIndex = (index + 1) % modeNames.length;
  31541. mode.value = modes[modeNames[nextIndex]];
  31542. reset();
  31543. }
  31544. function setActiveItem(index) {
  31545. const len = props.urlList.length;
  31546. activeIndex.value = (index + len) % len;
  31547. }
  31548. function prev() {
  31549. if (isFirst.value && !props.infinite)
  31550. return;
  31551. setActiveItem(activeIndex.value - 1);
  31552. }
  31553. function next() {
  31554. if (isLast.value && !props.infinite)
  31555. return;
  31556. setActiveItem(activeIndex.value + 1);
  31557. }
  31558. function handleActions(action, options = {}) {
  31559. if (loading.value)
  31560. return;
  31561. const { minScale, maxScale } = props;
  31562. const { zoomRate, rotateDeg, enableTransition } = {
  31563. zoomRate: props.zoomRate,
  31564. rotateDeg: 90,
  31565. enableTransition: true,
  31566. ...options
  31567. };
  31568. switch (action) {
  31569. case "zoomOut":
  31570. if (transform.value.scale > minScale) {
  31571. transform.value.scale = Number.parseFloat((transform.value.scale / zoomRate).toFixed(3));
  31572. }
  31573. break;
  31574. case "zoomIn":
  31575. if (transform.value.scale < maxScale) {
  31576. transform.value.scale = Number.parseFloat((transform.value.scale * zoomRate).toFixed(3));
  31577. }
  31578. break;
  31579. case "clockwise":
  31580. transform.value.deg += rotateDeg;
  31581. emit("rotate", transform.value.deg);
  31582. break;
  31583. case "anticlockwise":
  31584. transform.value.deg -= rotateDeg;
  31585. emit("rotate", transform.value.deg);
  31586. break;
  31587. }
  31588. transform.value.enableTransition = enableTransition;
  31589. }
  31590. function onFocusoutPrevented(event) {
  31591. var _a2;
  31592. if (((_a2 = event.detail) == null ? void 0 : _a2.focusReason) === "pointer") {
  31593. event.preventDefault();
  31594. }
  31595. }
  31596. function onCloseRequested() {
  31597. if (props.closeOnPressEscape) {
  31598. hide();
  31599. }
  31600. }
  31601. function wheelHandler(e) {
  31602. if (!e.ctrlKey)
  31603. return;
  31604. if (e.deltaY < 0) {
  31605. e.preventDefault();
  31606. return false;
  31607. } else if (e.deltaY > 0) {
  31608. e.preventDefault();
  31609. return false;
  31610. }
  31611. }
  31612. watch(currentImg, () => {
  31613. nextTick(() => {
  31614. const $img = imgRefs.value[0];
  31615. if (!($img == null ? void 0 : $img.complete)) {
  31616. loading.value = true;
  31617. }
  31618. });
  31619. });
  31620. watch(activeIndex, (val) => {
  31621. reset();
  31622. emit("switch", val);
  31623. });
  31624. onMounted(() => {
  31625. registerEventListener();
  31626. stopWheelListener = useEventListener("wheel", wheelHandler, {
  31627. passive: false
  31628. });
  31629. prevOverflow = document.body.style.overflow;
  31630. document.body.style.overflow = "hidden";
  31631. });
  31632. expose({
  31633. setActiveItem
  31634. });
  31635. return (_ctx, _cache) => {
  31636. return openBlock(), createBlock(unref(ElTeleport$1), {
  31637. to: "body",
  31638. disabled: !_ctx.teleported
  31639. }, {
  31640. default: withCtx(() => [
  31641. createVNode(Transition, {
  31642. name: "viewer-fade",
  31643. appear: ""
  31644. }, {
  31645. default: withCtx(() => [
  31646. createElementVNode("div", {
  31647. ref_key: "wrapper",
  31648. ref: wrapper,
  31649. tabindex: -1,
  31650. class: normalizeClass(unref(ns).e("wrapper")),
  31651. style: normalizeStyle({ zIndex: zIndex.value })
  31652. }, [
  31653. createVNode(unref(ElFocusTrap), {
  31654. loop: "",
  31655. trapped: "",
  31656. "focus-trap-el": wrapper.value,
  31657. "focus-start-el": "container",
  31658. onFocusoutPrevented,
  31659. onReleaseRequested: onCloseRequested
  31660. }, {
  31661. default: withCtx(() => [
  31662. createElementVNode("div", {
  31663. class: normalizeClass(unref(ns).e("mask")),
  31664. onClick: withModifiers(($event) => _ctx.hideOnClickModal && hide(), ["self"])
  31665. }, null, 10, ["onClick"]),
  31666. createCommentVNode(" CLOSE "),
  31667. createElementVNode("span", {
  31668. class: normalizeClass([unref(ns).e("btn"), unref(ns).e("close")]),
  31669. onClick: hide
  31670. }, [
  31671. createVNode(unref(ElIcon), null, {
  31672. default: withCtx(() => [
  31673. createVNode(unref(close_default))
  31674. ]),
  31675. _: 1
  31676. })
  31677. ], 2),
  31678. createCommentVNode(" ARROW "),
  31679. !unref(isSingle) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  31680. createElementVNode("span", {
  31681. class: normalizeClass(unref(arrowPrevKls)),
  31682. onClick: prev
  31683. }, [
  31684. createVNode(unref(ElIcon), null, {
  31685. default: withCtx(() => [
  31686. createVNode(unref(arrow_left_default))
  31687. ]),
  31688. _: 1
  31689. })
  31690. ], 2),
  31691. createElementVNode("span", {
  31692. class: normalizeClass(unref(arrowNextKls)),
  31693. onClick: next
  31694. }, [
  31695. createVNode(unref(ElIcon), null, {
  31696. default: withCtx(() => [
  31697. createVNode(unref(arrow_right_default))
  31698. ]),
  31699. _: 1
  31700. })
  31701. ], 2)
  31702. ], 64)) : createCommentVNode("v-if", true),
  31703. _ctx.$slots.progress || _ctx.showProgress ? (openBlock(), createElementBlock("div", {
  31704. key: 1,
  31705. class: normalizeClass([unref(ns).e("btn"), unref(ns).e("progress")])
  31706. }, [
  31707. renderSlot(_ctx.$slots, "progress", {
  31708. activeIndex: activeIndex.value,
  31709. total: _ctx.urlList.length
  31710. }, () => [
  31711. createTextVNode(toDisplayString(unref(progress)), 1)
  31712. ])
  31713. ], 2)) : createCommentVNode("v-if", true),
  31714. createCommentVNode(" ACTIONS "),
  31715. createElementVNode("div", {
  31716. class: normalizeClass([unref(ns).e("btn"), unref(ns).e("actions")])
  31717. }, [
  31718. createElementVNode("div", {
  31719. class: normalizeClass(unref(ns).e("actions__inner"))
  31720. }, [
  31721. renderSlot(_ctx.$slots, "toolbar", {
  31722. actions: handleActions,
  31723. prev,
  31724. next,
  31725. reset: toggleMode,
  31726. activeIndex: activeIndex.value,
  31727. setActiveItem
  31728. }, () => [
  31729. createVNode(unref(ElIcon), {
  31730. onClick: ($event) => handleActions("zoomOut")
  31731. }, {
  31732. default: withCtx(() => [
  31733. createVNode(unref(zoom_out_default))
  31734. ]),
  31735. _: 1
  31736. }, 8, ["onClick"]),
  31737. createVNode(unref(ElIcon), {
  31738. onClick: ($event) => handleActions("zoomIn")
  31739. }, {
  31740. default: withCtx(() => [
  31741. createVNode(unref(zoom_in_default))
  31742. ]),
  31743. _: 1
  31744. }, 8, ["onClick"]),
  31745. createElementVNode("i", {
  31746. class: normalizeClass(unref(ns).e("actions__divider"))
  31747. }, null, 2),
  31748. createVNode(unref(ElIcon), { onClick: toggleMode }, {
  31749. default: withCtx(() => [
  31750. (openBlock(), createBlock(resolveDynamicComponent(unref(mode).icon)))
  31751. ]),
  31752. _: 1
  31753. }),
  31754. createElementVNode("i", {
  31755. class: normalizeClass(unref(ns).e("actions__divider"))
  31756. }, null, 2),
  31757. createVNode(unref(ElIcon), {
  31758. onClick: ($event) => handleActions("anticlockwise")
  31759. }, {
  31760. default: withCtx(() => [
  31761. createVNode(unref(refresh_left_default))
  31762. ]),
  31763. _: 1
  31764. }, 8, ["onClick"]),
  31765. createVNode(unref(ElIcon), {
  31766. onClick: ($event) => handleActions("clockwise")
  31767. }, {
  31768. default: withCtx(() => [
  31769. createVNode(unref(refresh_right_default))
  31770. ]),
  31771. _: 1
  31772. }, 8, ["onClick"])
  31773. ])
  31774. ], 2)
  31775. ], 2),
  31776. createCommentVNode(" CANVAS "),
  31777. createElementVNode("div", {
  31778. class: normalizeClass(unref(ns).e("canvas"))
  31779. }, [
  31780. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.urlList, (url, i) => {
  31781. return withDirectives((openBlock(), createElementBlock("img", {
  31782. ref_for: true,
  31783. ref: (el) => imgRefs.value[i] = el,
  31784. key: url,
  31785. src: url,
  31786. style: normalizeStyle(unref(imgStyle)),
  31787. class: normalizeClass(unref(ns).e("img")),
  31788. crossorigin: _ctx.crossorigin,
  31789. onLoad: handleImgLoad,
  31790. onError: handleImgError,
  31791. onMousedown: handleMouseDown
  31792. }, null, 46, ["src", "crossorigin"])), [
  31793. [vShow, i === activeIndex.value]
  31794. ]);
  31795. }), 128))
  31796. ], 2),
  31797. renderSlot(_ctx.$slots, "default")
  31798. ]),
  31799. _: 3
  31800. }, 8, ["focus-trap-el"])
  31801. ], 6)
  31802. ]),
  31803. _: 3
  31804. })
  31805. ]),
  31806. _: 3
  31807. }, 8, ["disabled"]);
  31808. };
  31809. }
  31810. });
  31811. var ImageViewer = /* @__PURE__ */ _export_sfc(_sfc_main$1a, [["__file", "image-viewer.vue"]]);
  31812. const ElImageViewer = withInstall(ImageViewer);
  31813. const imageProps = buildProps({
  31814. hideOnClickModal: Boolean,
  31815. src: {
  31816. type: String,
  31817. default: ""
  31818. },
  31819. fit: {
  31820. type: String,
  31821. values: ["", "contain", "cover", "fill", "none", "scale-down"],
  31822. default: ""
  31823. },
  31824. loading: {
  31825. type: String,
  31826. values: ["eager", "lazy"]
  31827. },
  31828. lazy: Boolean,
  31829. scrollContainer: {
  31830. type: definePropType([String, Object])
  31831. },
  31832. previewSrcList: {
  31833. type: definePropType(Array),
  31834. default: () => mutable([])
  31835. },
  31836. previewTeleported: Boolean,
  31837. zIndex: {
  31838. type: Number
  31839. },
  31840. initialIndex: {
  31841. type: Number,
  31842. default: 0
  31843. },
  31844. infinite: {
  31845. type: Boolean,
  31846. default: true
  31847. },
  31848. closeOnPressEscape: {
  31849. type: Boolean,
  31850. default: true
  31851. },
  31852. zoomRate: {
  31853. type: Number,
  31854. default: 1.2
  31855. },
  31856. minScale: {
  31857. type: Number,
  31858. default: 0.2
  31859. },
  31860. maxScale: {
  31861. type: Number,
  31862. default: 7
  31863. },
  31864. showProgress: {
  31865. type: Boolean,
  31866. default: false
  31867. },
  31868. crossorigin: {
  31869. type: definePropType(String)
  31870. }
  31871. });
  31872. const imageEmits = {
  31873. load: (evt) => evt instanceof Event,
  31874. error: (evt) => evt instanceof Event,
  31875. switch: (val) => isNumber(val),
  31876. close: () => true,
  31877. show: () => true
  31878. };
  31879. const __default__$X = defineComponent({
  31880. name: "ElImage",
  31881. inheritAttrs: false
  31882. });
  31883. const _sfc_main$19 = /* @__PURE__ */ defineComponent({
  31884. ...__default__$X,
  31885. props: imageProps,
  31886. emits: imageEmits,
  31887. setup(__props, { expose, emit }) {
  31888. const props = __props;
  31889. const { t } = useLocale();
  31890. const ns = useNamespace("image");
  31891. const rawAttrs = useAttrs$1();
  31892. const containerAttrs = computed(() => {
  31893. return fromPairs(Object.entries(rawAttrs).filter(([key]) => /^(data-|on[A-Z])/i.test(key) || ["id", "style"].includes(key)));
  31894. });
  31895. const imgAttrs = useAttrs({
  31896. excludeListeners: true,
  31897. excludeKeys: computed(() => {
  31898. return Object.keys(containerAttrs.value);
  31899. })
  31900. });
  31901. const imageSrc = ref();
  31902. const hasLoadError = ref(false);
  31903. const isLoading = ref(true);
  31904. const showViewer = ref(false);
  31905. const container = ref();
  31906. const _scrollContainer = ref();
  31907. const supportLoading = isClient && "loading" in HTMLImageElement.prototype;
  31908. let stopScrollListener;
  31909. const imageKls = computed(() => [
  31910. ns.e("inner"),
  31911. preview.value && ns.e("preview"),
  31912. isLoading.value && ns.is("loading")
  31913. ]);
  31914. const imageStyle = computed(() => {
  31915. const { fit } = props;
  31916. if (isClient && fit) {
  31917. return { objectFit: fit };
  31918. }
  31919. return {};
  31920. });
  31921. const preview = computed(() => {
  31922. const { previewSrcList } = props;
  31923. return isArray$1(previewSrcList) && previewSrcList.length > 0;
  31924. });
  31925. const imageIndex = computed(() => {
  31926. const { previewSrcList, initialIndex } = props;
  31927. let previewIndex = initialIndex;
  31928. if (initialIndex > previewSrcList.length - 1) {
  31929. previewIndex = 0;
  31930. }
  31931. return previewIndex;
  31932. });
  31933. const isManual = computed(() => {
  31934. if (props.loading === "eager")
  31935. return false;
  31936. return !supportLoading && props.loading === "lazy" || props.lazy;
  31937. });
  31938. const loadImage = () => {
  31939. if (!isClient)
  31940. return;
  31941. isLoading.value = true;
  31942. hasLoadError.value = false;
  31943. imageSrc.value = props.src;
  31944. };
  31945. function handleLoad(event) {
  31946. isLoading.value = false;
  31947. hasLoadError.value = false;
  31948. emit("load", event);
  31949. }
  31950. function handleError(event) {
  31951. isLoading.value = false;
  31952. hasLoadError.value = true;
  31953. emit("error", event);
  31954. }
  31955. function handleLazyLoad() {
  31956. if (isInContainer(container.value, _scrollContainer.value)) {
  31957. loadImage();
  31958. removeLazyLoadListener();
  31959. }
  31960. }
  31961. const lazyLoadHandler = useThrottleFn(handleLazyLoad, 200, true);
  31962. async function addLazyLoadListener() {
  31963. var _a;
  31964. if (!isClient)
  31965. return;
  31966. await nextTick();
  31967. const { scrollContainer } = props;
  31968. if (isElement$1(scrollContainer)) {
  31969. _scrollContainer.value = scrollContainer;
  31970. } else if (isString$1(scrollContainer) && scrollContainer !== "") {
  31971. _scrollContainer.value = (_a = document.querySelector(scrollContainer)) != null ? _a : void 0;
  31972. } else if (container.value) {
  31973. _scrollContainer.value = getScrollContainer(container.value);
  31974. }
  31975. if (_scrollContainer.value) {
  31976. stopScrollListener = useEventListener(_scrollContainer, "scroll", lazyLoadHandler);
  31977. setTimeout(() => handleLazyLoad(), 100);
  31978. }
  31979. }
  31980. function removeLazyLoadListener() {
  31981. if (!isClient || !_scrollContainer.value || !lazyLoadHandler)
  31982. return;
  31983. stopScrollListener == null ? void 0 : stopScrollListener();
  31984. _scrollContainer.value = void 0;
  31985. }
  31986. function clickHandler() {
  31987. if (!preview.value)
  31988. return;
  31989. showViewer.value = true;
  31990. emit("show");
  31991. }
  31992. function closeViewer() {
  31993. showViewer.value = false;
  31994. emit("close");
  31995. }
  31996. function switchViewer(val) {
  31997. emit("switch", val);
  31998. }
  31999. watch(() => props.src, () => {
  32000. if (isManual.value) {
  32001. isLoading.value = true;
  32002. hasLoadError.value = false;
  32003. removeLazyLoadListener();
  32004. addLazyLoadListener();
  32005. } else {
  32006. loadImage();
  32007. }
  32008. });
  32009. onMounted(() => {
  32010. if (isManual.value) {
  32011. addLazyLoadListener();
  32012. } else {
  32013. loadImage();
  32014. }
  32015. });
  32016. expose({
  32017. showPreview: clickHandler
  32018. });
  32019. return (_ctx, _cache) => {
  32020. return openBlock(), createElementBlock("div", mergeProps({
  32021. ref_key: "container",
  32022. ref: container
  32023. }, unref(containerAttrs), {
  32024. class: [unref(ns).b(), _ctx.$attrs.class]
  32025. }), [
  32026. hasLoadError.value ? renderSlot(_ctx.$slots, "error", { key: 0 }, () => [
  32027. createElementVNode("div", {
  32028. class: normalizeClass(unref(ns).e("error"))
  32029. }, toDisplayString(unref(t)("el.image.error")), 3)
  32030. ]) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
  32031. imageSrc.value !== void 0 ? (openBlock(), createElementBlock("img", mergeProps({ key: 0 }, unref(imgAttrs), {
  32032. src: imageSrc.value,
  32033. loading: _ctx.loading,
  32034. style: unref(imageStyle),
  32035. class: unref(imageKls),
  32036. crossorigin: _ctx.crossorigin,
  32037. onClick: clickHandler,
  32038. onLoad: handleLoad,
  32039. onError: handleError
  32040. }), null, 16, ["src", "loading", "crossorigin"])) : createCommentVNode("v-if", true),
  32041. isLoading.value ? (openBlock(), createElementBlock("div", {
  32042. key: 1,
  32043. class: normalizeClass(unref(ns).e("wrapper"))
  32044. }, [
  32045. renderSlot(_ctx.$slots, "placeholder", {}, () => [
  32046. createElementVNode("div", {
  32047. class: normalizeClass(unref(ns).e("placeholder"))
  32048. }, null, 2)
  32049. ])
  32050. ], 2)) : createCommentVNode("v-if", true)
  32051. ], 64)),
  32052. unref(preview) ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
  32053. showViewer.value ? (openBlock(), createBlock(unref(ElImageViewer), {
  32054. key: 0,
  32055. "z-index": _ctx.zIndex,
  32056. "initial-index": unref(imageIndex),
  32057. infinite: _ctx.infinite,
  32058. "zoom-rate": _ctx.zoomRate,
  32059. "min-scale": _ctx.minScale,
  32060. "max-scale": _ctx.maxScale,
  32061. "show-progress": _ctx.showProgress,
  32062. "url-list": _ctx.previewSrcList,
  32063. crossorigin: _ctx.crossorigin,
  32064. "hide-on-click-modal": _ctx.hideOnClickModal,
  32065. teleported: _ctx.previewTeleported,
  32066. "close-on-press-escape": _ctx.closeOnPressEscape,
  32067. onClose: closeViewer,
  32068. onSwitch: switchViewer
  32069. }, {
  32070. progress: withCtx((progress) => [
  32071. renderSlot(_ctx.$slots, "progress", normalizeProps(guardReactiveProps(progress)))
  32072. ]),
  32073. toolbar: withCtx((toolbar) => [
  32074. renderSlot(_ctx.$slots, "toolbar", normalizeProps(guardReactiveProps(toolbar)))
  32075. ]),
  32076. default: withCtx(() => [
  32077. _ctx.$slots.viewer ? (openBlock(), createElementBlock("div", { key: 0 }, [
  32078. renderSlot(_ctx.$slots, "viewer")
  32079. ])) : createCommentVNode("v-if", true)
  32080. ]),
  32081. _: 3
  32082. }, 8, ["z-index", "initial-index", "infinite", "zoom-rate", "min-scale", "max-scale", "show-progress", "url-list", "crossorigin", "hide-on-click-modal", "teleported", "close-on-press-escape"])) : createCommentVNode("v-if", true)
  32083. ], 64)) : createCommentVNode("v-if", true)
  32084. ], 16);
  32085. };
  32086. }
  32087. });
  32088. var Image$1 = /* @__PURE__ */ _export_sfc(_sfc_main$19, [["__file", "image.vue"]]);
  32089. const ElImage = withInstall(Image$1);
  32090. const inputNumberProps = buildProps({
  32091. id: {
  32092. type: String,
  32093. default: void 0
  32094. },
  32095. step: {
  32096. type: Number,
  32097. default: 1
  32098. },
  32099. stepStrictly: Boolean,
  32100. max: {
  32101. type: Number,
  32102. default: Number.POSITIVE_INFINITY
  32103. },
  32104. min: {
  32105. type: Number,
  32106. default: Number.NEGATIVE_INFINITY
  32107. },
  32108. modelValue: Number,
  32109. readonly: Boolean,
  32110. disabled: Boolean,
  32111. size: useSizeProp,
  32112. controls: {
  32113. type: Boolean,
  32114. default: true
  32115. },
  32116. controlsPosition: {
  32117. type: String,
  32118. default: "",
  32119. values: ["", "right"]
  32120. },
  32121. valueOnClear: {
  32122. type: [String, Number, null],
  32123. validator: (val) => val === null || isNumber(val) || ["min", "max"].includes(val),
  32124. default: null
  32125. },
  32126. name: String,
  32127. placeholder: String,
  32128. precision: {
  32129. type: Number,
  32130. validator: (val) => val >= 0 && val === Number.parseInt(`${val}`, 10)
  32131. },
  32132. validateEvent: {
  32133. type: Boolean,
  32134. default: true
  32135. },
  32136. ...useAriaProps(["ariaLabel"])
  32137. });
  32138. const inputNumberEmits = {
  32139. [CHANGE_EVENT]: (cur, prev) => prev !== cur,
  32140. blur: (e) => e instanceof FocusEvent,
  32141. focus: (e) => e instanceof FocusEvent,
  32142. [INPUT_EVENT]: (val) => isNumber(val) || isNil(val),
  32143. [UPDATE_MODEL_EVENT]: (val) => isNumber(val) || isNil(val)
  32144. };
  32145. const __default__$W = defineComponent({
  32146. name: "ElInputNumber"
  32147. });
  32148. const _sfc_main$18 = /* @__PURE__ */ defineComponent({
  32149. ...__default__$W,
  32150. props: inputNumberProps,
  32151. emits: inputNumberEmits,
  32152. setup(__props, { expose, emit }) {
  32153. const props = __props;
  32154. const { t } = useLocale();
  32155. const ns = useNamespace("input-number");
  32156. const input = ref();
  32157. const data = reactive({
  32158. currentValue: props.modelValue,
  32159. userInput: null
  32160. });
  32161. const { formItem } = useFormItem();
  32162. const minDisabled = computed(() => isNumber(props.modelValue) && props.modelValue <= props.min);
  32163. const maxDisabled = computed(() => isNumber(props.modelValue) && props.modelValue >= props.max);
  32164. const numPrecision = computed(() => {
  32165. const stepPrecision = getPrecision(props.step);
  32166. if (!isUndefined(props.precision)) {
  32167. if (stepPrecision > props.precision) ;
  32168. return props.precision;
  32169. } else {
  32170. return Math.max(getPrecision(props.modelValue), stepPrecision);
  32171. }
  32172. });
  32173. const controlsAtRight = computed(() => {
  32174. return props.controls && props.controlsPosition === "right";
  32175. });
  32176. const inputNumberSize = useFormSize();
  32177. const inputNumberDisabled = useFormDisabled();
  32178. const displayValue = computed(() => {
  32179. if (data.userInput !== null) {
  32180. return data.userInput;
  32181. }
  32182. let currentValue = data.currentValue;
  32183. if (isNil(currentValue))
  32184. return "";
  32185. if (isNumber(currentValue)) {
  32186. if (Number.isNaN(currentValue))
  32187. return "";
  32188. if (!isUndefined(props.precision)) {
  32189. currentValue = currentValue.toFixed(props.precision);
  32190. }
  32191. }
  32192. return currentValue;
  32193. });
  32194. const toPrecision = (num, pre) => {
  32195. if (isUndefined(pre))
  32196. pre = numPrecision.value;
  32197. if (pre === 0)
  32198. return Math.round(num);
  32199. let snum = String(num);
  32200. const pointPos = snum.indexOf(".");
  32201. if (pointPos === -1)
  32202. return num;
  32203. const nums = snum.replace(".", "").split("");
  32204. const datum = nums[pointPos + pre];
  32205. if (!datum)
  32206. return num;
  32207. const length = snum.length;
  32208. if (snum.charAt(length - 1) === "5") {
  32209. snum = `${snum.slice(0, Math.max(0, length - 1))}6`;
  32210. }
  32211. return Number.parseFloat(Number(snum).toFixed(pre));
  32212. };
  32213. const getPrecision = (value) => {
  32214. if (isNil(value))
  32215. return 0;
  32216. const valueString = value.toString();
  32217. const dotPosition = valueString.indexOf(".");
  32218. let precision = 0;
  32219. if (dotPosition !== -1) {
  32220. precision = valueString.length - dotPosition - 1;
  32221. }
  32222. return precision;
  32223. };
  32224. const ensurePrecision = (val, coefficient = 1) => {
  32225. if (!isNumber(val))
  32226. return data.currentValue;
  32227. return toPrecision(val + props.step * coefficient);
  32228. };
  32229. const increase = () => {
  32230. if (props.readonly || inputNumberDisabled.value || maxDisabled.value)
  32231. return;
  32232. const value = Number(displayValue.value) || 0;
  32233. const newVal = ensurePrecision(value);
  32234. setCurrentValue(newVal);
  32235. emit(INPUT_EVENT, data.currentValue);
  32236. setCurrentValueToModelValue();
  32237. };
  32238. const decrease = () => {
  32239. if (props.readonly || inputNumberDisabled.value || minDisabled.value)
  32240. return;
  32241. const value = Number(displayValue.value) || 0;
  32242. const newVal = ensurePrecision(value, -1);
  32243. setCurrentValue(newVal);
  32244. emit(INPUT_EVENT, data.currentValue);
  32245. setCurrentValueToModelValue();
  32246. };
  32247. const verifyValue = (value, update) => {
  32248. const { max, min, step, precision, stepStrictly, valueOnClear } = props;
  32249. if (max < min) {
  32250. throwError("InputNumber", "min should not be greater than max.");
  32251. }
  32252. let newVal = Number(value);
  32253. if (isNil(value) || Number.isNaN(newVal)) {
  32254. return null;
  32255. }
  32256. if (value === "") {
  32257. if (valueOnClear === null) {
  32258. return null;
  32259. }
  32260. newVal = isString$1(valueOnClear) ? { min, max }[valueOnClear] : valueOnClear;
  32261. }
  32262. if (stepStrictly) {
  32263. newVal = toPrecision(Math.round(newVal / step) * step, precision);
  32264. if (newVal !== value) {
  32265. update && emit(UPDATE_MODEL_EVENT, newVal);
  32266. }
  32267. }
  32268. if (!isUndefined(precision)) {
  32269. newVal = toPrecision(newVal, precision);
  32270. }
  32271. if (newVal > max || newVal < min) {
  32272. newVal = newVal > max ? max : min;
  32273. update && emit(UPDATE_MODEL_EVENT, newVal);
  32274. }
  32275. return newVal;
  32276. };
  32277. const setCurrentValue = (value, emitChange = true) => {
  32278. var _a;
  32279. const oldVal = data.currentValue;
  32280. const newVal = verifyValue(value);
  32281. if (!emitChange) {
  32282. emit(UPDATE_MODEL_EVENT, newVal);
  32283. return;
  32284. }
  32285. if (oldVal === newVal && value)
  32286. return;
  32287. data.userInput = null;
  32288. emit(UPDATE_MODEL_EVENT, newVal);
  32289. if (oldVal !== newVal) {
  32290. emit(CHANGE_EVENT, newVal, oldVal);
  32291. }
  32292. if (props.validateEvent) {
  32293. (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "change").catch((err) => debugWarn());
  32294. }
  32295. data.currentValue = newVal;
  32296. };
  32297. const handleInput = (value) => {
  32298. data.userInput = value;
  32299. const newVal = value === "" ? null : Number(value);
  32300. emit(INPUT_EVENT, newVal);
  32301. setCurrentValue(newVal, false);
  32302. };
  32303. const handleInputChange = (value) => {
  32304. const newVal = value !== "" ? Number(value) : "";
  32305. if (isNumber(newVal) && !Number.isNaN(newVal) || value === "") {
  32306. setCurrentValue(newVal);
  32307. }
  32308. setCurrentValueToModelValue();
  32309. data.userInput = null;
  32310. };
  32311. const focus = () => {
  32312. var _a, _b;
  32313. (_b = (_a = input.value) == null ? void 0 : _a.focus) == null ? void 0 : _b.call(_a);
  32314. };
  32315. const blur = () => {
  32316. var _a, _b;
  32317. (_b = (_a = input.value) == null ? void 0 : _a.blur) == null ? void 0 : _b.call(_a);
  32318. };
  32319. const handleFocus = (event) => {
  32320. emit("focus", event);
  32321. };
  32322. const handleBlur = (event) => {
  32323. var _a, _b;
  32324. data.userInput = null;
  32325. if (isFirefox() && data.currentValue === null && ((_a = input.value) == null ? void 0 : _a.input)) {
  32326. input.value.input.value = "";
  32327. }
  32328. emit("blur", event);
  32329. if (props.validateEvent) {
  32330. (_b = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _b.call(formItem, "blur").catch((err) => debugWarn());
  32331. }
  32332. };
  32333. const setCurrentValueToModelValue = () => {
  32334. if (data.currentValue !== props.modelValue) {
  32335. data.currentValue = props.modelValue;
  32336. }
  32337. };
  32338. const handleWheel = (e) => {
  32339. if (document.activeElement === e.target)
  32340. e.preventDefault();
  32341. };
  32342. watch(() => props.modelValue, (value, oldValue) => {
  32343. const newValue = verifyValue(value, true);
  32344. if (data.userInput === null && newValue !== oldValue) {
  32345. data.currentValue = newValue;
  32346. }
  32347. }, { immediate: true });
  32348. onMounted(() => {
  32349. var _a;
  32350. const { min, max, modelValue } = props;
  32351. const innerInput = (_a = input.value) == null ? void 0 : _a.input;
  32352. innerInput.setAttribute("role", "spinbutton");
  32353. if (Number.isFinite(max)) {
  32354. innerInput.setAttribute("aria-valuemax", String(max));
  32355. } else {
  32356. innerInput.removeAttribute("aria-valuemax");
  32357. }
  32358. if (Number.isFinite(min)) {
  32359. innerInput.setAttribute("aria-valuemin", String(min));
  32360. } else {
  32361. innerInput.removeAttribute("aria-valuemin");
  32362. }
  32363. innerInput.setAttribute("aria-valuenow", data.currentValue || data.currentValue === 0 ? String(data.currentValue) : "");
  32364. innerInput.setAttribute("aria-disabled", String(inputNumberDisabled.value));
  32365. if (!isNumber(modelValue) && modelValue != null) {
  32366. let val = Number(modelValue);
  32367. if (Number.isNaN(val)) {
  32368. val = null;
  32369. }
  32370. emit(UPDATE_MODEL_EVENT, val);
  32371. }
  32372. innerInput.addEventListener("wheel", handleWheel, { passive: false });
  32373. });
  32374. onUpdated(() => {
  32375. var _a, _b;
  32376. const innerInput = (_a = input.value) == null ? void 0 : _a.input;
  32377. innerInput == null ? void 0 : innerInput.setAttribute("aria-valuenow", `${(_b = data.currentValue) != null ? _b : ""}`);
  32378. });
  32379. expose({
  32380. focus,
  32381. blur
  32382. });
  32383. return (_ctx, _cache) => {
  32384. return openBlock(), createElementBlock("div", {
  32385. class: normalizeClass([
  32386. unref(ns).b(),
  32387. unref(ns).m(unref(inputNumberSize)),
  32388. unref(ns).is("disabled", unref(inputNumberDisabled)),
  32389. unref(ns).is("without-controls", !_ctx.controls),
  32390. unref(ns).is("controls-right", unref(controlsAtRight))
  32391. ]),
  32392. onDragstart: withModifiers(() => {
  32393. }, ["prevent"])
  32394. }, [
  32395. _ctx.controls ? withDirectives((openBlock(), createElementBlock("span", {
  32396. key: 0,
  32397. role: "button",
  32398. "aria-label": unref(t)("el.inputNumber.decrease"),
  32399. class: normalizeClass([unref(ns).e("decrease"), unref(ns).is("disabled", unref(minDisabled))]),
  32400. onKeydown: withKeys(decrease, ["enter"])
  32401. }, [
  32402. renderSlot(_ctx.$slots, "decrease-icon", {}, () => [
  32403. createVNode(unref(ElIcon), null, {
  32404. default: withCtx(() => [
  32405. unref(controlsAtRight) ? (openBlock(), createBlock(unref(arrow_down_default), { key: 0 })) : (openBlock(), createBlock(unref(minus_default), { key: 1 }))
  32406. ]),
  32407. _: 1
  32408. })
  32409. ])
  32410. ], 42, ["aria-label", "onKeydown"])), [
  32411. [unref(vRepeatClick), decrease]
  32412. ]) : createCommentVNode("v-if", true),
  32413. _ctx.controls ? withDirectives((openBlock(), createElementBlock("span", {
  32414. key: 1,
  32415. role: "button",
  32416. "aria-label": unref(t)("el.inputNumber.increase"),
  32417. class: normalizeClass([unref(ns).e("increase"), unref(ns).is("disabled", unref(maxDisabled))]),
  32418. onKeydown: withKeys(increase, ["enter"])
  32419. }, [
  32420. renderSlot(_ctx.$slots, "increase-icon", {}, () => [
  32421. createVNode(unref(ElIcon), null, {
  32422. default: withCtx(() => [
  32423. unref(controlsAtRight) ? (openBlock(), createBlock(unref(arrow_up_default), { key: 0 })) : (openBlock(), createBlock(unref(plus_default), { key: 1 }))
  32424. ]),
  32425. _: 1
  32426. })
  32427. ])
  32428. ], 42, ["aria-label", "onKeydown"])), [
  32429. [unref(vRepeatClick), increase]
  32430. ]) : createCommentVNode("v-if", true),
  32431. createVNode(unref(ElInput), {
  32432. id: _ctx.id,
  32433. ref_key: "input",
  32434. ref: input,
  32435. type: "number",
  32436. step: _ctx.step,
  32437. "model-value": unref(displayValue),
  32438. placeholder: _ctx.placeholder,
  32439. readonly: _ctx.readonly,
  32440. disabled: unref(inputNumberDisabled),
  32441. size: unref(inputNumberSize),
  32442. max: _ctx.max,
  32443. min: _ctx.min,
  32444. name: _ctx.name,
  32445. "aria-label": _ctx.ariaLabel,
  32446. "validate-event": false,
  32447. onKeydown: [
  32448. withKeys(withModifiers(increase, ["prevent"]), ["up"]),
  32449. withKeys(withModifiers(decrease, ["prevent"]), ["down"])
  32450. ],
  32451. onBlur: handleBlur,
  32452. onFocus: handleFocus,
  32453. onInput: handleInput,
  32454. onChange: handleInputChange
  32455. }, createSlots({
  32456. _: 2
  32457. }, [
  32458. _ctx.$slots.prefix ? {
  32459. name: "prefix",
  32460. fn: withCtx(() => [
  32461. renderSlot(_ctx.$slots, "prefix")
  32462. ])
  32463. } : void 0,
  32464. _ctx.$slots.suffix ? {
  32465. name: "suffix",
  32466. fn: withCtx(() => [
  32467. renderSlot(_ctx.$slots, "suffix")
  32468. ])
  32469. } : void 0
  32470. ]), 1032, ["id", "step", "model-value", "placeholder", "readonly", "disabled", "size", "max", "min", "name", "aria-label", "onKeydown"])
  32471. ], 42, ["onDragstart"]);
  32472. };
  32473. }
  32474. });
  32475. var InputNumber = /* @__PURE__ */ _export_sfc(_sfc_main$18, [["__file", "input-number.vue"]]);
  32476. const ElInputNumber = withInstall(InputNumber);
  32477. const inputTagProps = buildProps({
  32478. modelValue: {
  32479. type: definePropType(Array)
  32480. },
  32481. max: Number,
  32482. tagType: { ...tagProps.type, default: "info" },
  32483. tagEffect: tagProps.effect,
  32484. trigger: {
  32485. type: definePropType(String),
  32486. default: EVENT_CODE.enter
  32487. },
  32488. draggable: {
  32489. type: Boolean,
  32490. default: false
  32491. },
  32492. size: useSizeProp,
  32493. clearable: Boolean,
  32494. disabled: {
  32495. type: Boolean,
  32496. default: void 0
  32497. },
  32498. validateEvent: {
  32499. type: Boolean,
  32500. default: true
  32501. },
  32502. readonly: Boolean,
  32503. autofocus: Boolean,
  32504. id: {
  32505. type: String,
  32506. default: void 0
  32507. },
  32508. tabindex: {
  32509. type: [String, Number],
  32510. default: 0
  32511. },
  32512. maxlength: {
  32513. type: [String, Number]
  32514. },
  32515. minlength: {
  32516. type: [String, Number]
  32517. },
  32518. placeholder: String,
  32519. autocomplete: {
  32520. type: String,
  32521. default: "off"
  32522. },
  32523. saveOnBlur: {
  32524. type: Boolean,
  32525. default: true
  32526. },
  32527. ariaLabel: String
  32528. });
  32529. const inputTagEmits = {
  32530. [UPDATE_MODEL_EVENT]: (value) => isArray$1(value) || isUndefined(value),
  32531. [CHANGE_EVENT]: (value) => isArray$1(value) || isUndefined(value),
  32532. [INPUT_EVENT]: (value) => isString$1(value),
  32533. "add-tag": (value) => isString$1(value),
  32534. "remove-tag": (value) => isString$1(value),
  32535. focus: (evt) => evt instanceof FocusEvent,
  32536. blur: (evt) => evt instanceof FocusEvent,
  32537. clear: () => true
  32538. };
  32539. function useDragTag({
  32540. wrapperRef,
  32541. handleDragged,
  32542. afterDragged
  32543. }) {
  32544. const ns = useNamespace("input-tag");
  32545. const dropIndicatorRef = shallowRef();
  32546. const showDropIndicator = ref(false);
  32547. let draggingIndex;
  32548. let draggingTag;
  32549. let dropIndex;
  32550. let dropType;
  32551. function getTagClassName(index) {
  32552. return `.${ns.e("inner")} .${ns.namespace.value}-tag:nth-child(${index + 1})`;
  32553. }
  32554. function handleDragStart(event, index) {
  32555. draggingIndex = index;
  32556. draggingTag = wrapperRef.value.querySelector(getTagClassName(index));
  32557. if (draggingTag) {
  32558. draggingTag.style.opacity = "0.5";
  32559. }
  32560. event.dataTransfer.effectAllowed = "move";
  32561. }
  32562. function handleDragOver(event, index) {
  32563. dropIndex = index;
  32564. event.preventDefault();
  32565. event.dataTransfer.dropEffect = "move";
  32566. if (isUndefined(draggingIndex) || draggingIndex === index) {
  32567. showDropIndicator.value = false;
  32568. return;
  32569. }
  32570. const dropPosition = wrapperRef.value.querySelector(getTagClassName(index)).getBoundingClientRect();
  32571. const dropPrev = !(draggingIndex + 1 === index);
  32572. const dropNext = !(draggingIndex - 1 === index);
  32573. const distance = event.clientX - dropPosition.left;
  32574. const prevPercent = dropPrev ? dropNext ? 0.5 : 1 : -1;
  32575. const nextPercent = dropNext ? dropPrev ? 0.5 : 0 : 1;
  32576. if (distance <= dropPosition.width * prevPercent) {
  32577. dropType = "before";
  32578. } else if (distance > dropPosition.width * nextPercent) {
  32579. dropType = "after";
  32580. } else {
  32581. dropType = void 0;
  32582. }
  32583. const innerEl = wrapperRef.value.querySelector(`.${ns.e("inner")}`);
  32584. const innerPosition = innerEl.getBoundingClientRect();
  32585. const gap = Number.parseFloat(getStyle(innerEl, "gap")) / 2;
  32586. const indicatorTop = dropPosition.top - innerPosition.top;
  32587. let indicatorLeft = -9999;
  32588. if (dropType === "before") {
  32589. indicatorLeft = Math.max(dropPosition.left - innerPosition.left - gap, Math.floor(-gap / 2));
  32590. } else if (dropType === "after") {
  32591. const left = dropPosition.right - innerPosition.left;
  32592. indicatorLeft = left + (innerPosition.width === left ? Math.floor(gap / 2) : gap);
  32593. }
  32594. setStyle(dropIndicatorRef.value, {
  32595. top: `${indicatorTop}px`,
  32596. left: `${indicatorLeft}px`
  32597. });
  32598. showDropIndicator.value = !!dropType;
  32599. }
  32600. function handleDragEnd(event) {
  32601. event.preventDefault();
  32602. if (draggingTag) {
  32603. draggingTag.style.opacity = "";
  32604. }
  32605. if (dropType && !isUndefined(draggingIndex) && !isUndefined(dropIndex) && draggingIndex !== dropIndex) {
  32606. handleDragged(draggingIndex, dropIndex, dropType);
  32607. }
  32608. showDropIndicator.value = false;
  32609. draggingIndex = void 0;
  32610. draggingTag = null;
  32611. dropIndex = void 0;
  32612. dropType = void 0;
  32613. afterDragged == null ? void 0 : afterDragged();
  32614. }
  32615. return {
  32616. dropIndicatorRef,
  32617. showDropIndicator,
  32618. handleDragStart,
  32619. handleDragOver,
  32620. handleDragEnd
  32621. };
  32622. }
  32623. function useHovering() {
  32624. const hovering = ref(false);
  32625. const handleMouseEnter = () => {
  32626. hovering.value = true;
  32627. };
  32628. const handleMouseLeave = () => {
  32629. hovering.value = false;
  32630. };
  32631. return {
  32632. hovering,
  32633. handleMouseEnter,
  32634. handleMouseLeave
  32635. };
  32636. }
  32637. function useInputTag({ props, emit, formItem }) {
  32638. const disabled = useFormDisabled();
  32639. const size = useFormSize();
  32640. const inputRef = shallowRef();
  32641. const inputValue = ref();
  32642. const tagSize = computed(() => {
  32643. return ["small"].includes(size.value) ? "small" : "default";
  32644. });
  32645. const placeholder = computed(() => {
  32646. var _a;
  32647. return ((_a = props.modelValue) == null ? void 0 : _a.length) ? void 0 : props.placeholder;
  32648. });
  32649. const closable = computed(() => !(props.readonly || disabled.value));
  32650. const inputLimit = computed(() => {
  32651. var _a, _b;
  32652. return isUndefined(props.max) ? false : ((_b = (_a = props.modelValue) == null ? void 0 : _a.length) != null ? _b : 0) >= props.max;
  32653. });
  32654. const handleInput = (event) => {
  32655. if (inputLimit.value) {
  32656. inputValue.value = void 0;
  32657. return;
  32658. }
  32659. if (isComposing.value)
  32660. return;
  32661. emit(INPUT_EVENT, event.target.value);
  32662. };
  32663. const handleKeydown = (event) => {
  32664. var _a;
  32665. if (isComposing.value)
  32666. return;
  32667. switch (event.code) {
  32668. case props.trigger:
  32669. event.preventDefault();
  32670. event.stopPropagation();
  32671. handleAddTag();
  32672. break;
  32673. case EVENT_CODE.numpadEnter:
  32674. if (props.trigger === EVENT_CODE.enter) {
  32675. event.preventDefault();
  32676. event.stopPropagation();
  32677. handleAddTag();
  32678. }
  32679. break;
  32680. case EVENT_CODE.backspace:
  32681. if (!inputValue.value && ((_a = props.modelValue) == null ? void 0 : _a.length)) {
  32682. event.preventDefault();
  32683. event.stopPropagation();
  32684. handleRemoveTag(props.modelValue.length - 1);
  32685. }
  32686. break;
  32687. }
  32688. };
  32689. const handleAddTag = () => {
  32690. var _a, _b;
  32691. const value = (_a = inputValue.value) == null ? void 0 : _a.trim();
  32692. if (!value || inputLimit.value)
  32693. return;
  32694. const list = [...(_b = props.modelValue) != null ? _b : [], value];
  32695. emit(UPDATE_MODEL_EVENT, list);
  32696. emit(CHANGE_EVENT, list);
  32697. emit("add-tag", value);
  32698. inputValue.value = void 0;
  32699. };
  32700. const handleRemoveTag = (index) => {
  32701. var _a;
  32702. const value = ((_a = props.modelValue) != null ? _a : []).slice();
  32703. const [item] = value.splice(index, 1);
  32704. emit(UPDATE_MODEL_EVENT, value);
  32705. emit(CHANGE_EVENT, value);
  32706. emit("remove-tag", item);
  32707. };
  32708. const handleClear = () => {
  32709. inputValue.value = void 0;
  32710. emit(UPDATE_MODEL_EVENT, void 0);
  32711. emit(CHANGE_EVENT, void 0);
  32712. emit("clear");
  32713. };
  32714. const handleDragged = (draggingIndex, dropIndex, type) => {
  32715. var _a;
  32716. const value = ((_a = props.modelValue) != null ? _a : []).slice();
  32717. const [draggedItem] = value.splice(draggingIndex, 1);
  32718. const step = dropIndex > draggingIndex && type === "before" ? -1 : dropIndex < draggingIndex && type === "after" ? 1 : 0;
  32719. value.splice(dropIndex + step, 0, draggedItem);
  32720. emit(UPDATE_MODEL_EVENT, value);
  32721. emit(CHANGE_EVENT, value);
  32722. };
  32723. const focus = () => {
  32724. var _a;
  32725. (_a = inputRef.value) == null ? void 0 : _a.focus();
  32726. };
  32727. const blur = () => {
  32728. var _a;
  32729. (_a = inputRef.value) == null ? void 0 : _a.blur();
  32730. };
  32731. const { wrapperRef, isFocused } = useFocusController(inputRef, {
  32732. beforeFocus() {
  32733. return disabled.value;
  32734. },
  32735. afterBlur() {
  32736. var _a;
  32737. if (props.saveOnBlur) {
  32738. handleAddTag();
  32739. } else {
  32740. inputValue.value = void 0;
  32741. }
  32742. if (props.validateEvent) {
  32743. (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "blur").catch((err) => debugWarn());
  32744. }
  32745. }
  32746. });
  32747. const {
  32748. isComposing,
  32749. handleCompositionStart,
  32750. handleCompositionUpdate,
  32751. handleCompositionEnd
  32752. } = useComposition({ afterComposition: handleInput });
  32753. watch(() => props.modelValue, () => {
  32754. var _a;
  32755. if (props.validateEvent) {
  32756. (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, CHANGE_EVENT).catch((err) => debugWarn());
  32757. }
  32758. });
  32759. return {
  32760. inputRef,
  32761. wrapperRef,
  32762. isFocused,
  32763. isComposing,
  32764. inputValue,
  32765. size,
  32766. tagSize,
  32767. placeholder,
  32768. closable,
  32769. disabled,
  32770. inputLimit,
  32771. handleDragged,
  32772. handleInput,
  32773. handleKeydown,
  32774. handleAddTag,
  32775. handleRemoveTag,
  32776. handleClear,
  32777. handleCompositionStart,
  32778. handleCompositionUpdate,
  32779. handleCompositionEnd,
  32780. focus,
  32781. blur
  32782. };
  32783. }
  32784. function useInputTagDom({
  32785. props,
  32786. isFocused,
  32787. hovering,
  32788. disabled,
  32789. inputValue,
  32790. size,
  32791. validateState,
  32792. validateIcon,
  32793. needStatusIcon
  32794. }) {
  32795. const attrs = useAttrs$1();
  32796. const slots = useSlots();
  32797. const ns = useNamespace("input-tag");
  32798. const nsInput = useNamespace("input");
  32799. const containerKls = computed(() => [
  32800. ns.b(),
  32801. ns.is("focused", isFocused.value),
  32802. ns.is("hovering", hovering.value),
  32803. ns.is("disabled", disabled.value),
  32804. ns.m(size.value),
  32805. ns.e("wrapper"),
  32806. attrs.class
  32807. ]);
  32808. const containerStyle = computed(() => [attrs.style]);
  32809. const innerKls = computed(() => {
  32810. var _a, _b;
  32811. return [
  32812. ns.e("inner"),
  32813. ns.is("draggable", props.draggable),
  32814. ns.is("left-space", !((_a = props.modelValue) == null ? void 0 : _a.length) && !slots.prefix),
  32815. ns.is("right-space", !((_b = props.modelValue) == null ? void 0 : _b.length) && !showSuffix.value)
  32816. ];
  32817. });
  32818. const showClear = computed(() => {
  32819. var _a;
  32820. return props.clearable && !disabled.value && !props.readonly && (((_a = props.modelValue) == null ? void 0 : _a.length) || inputValue.value) && (isFocused.value || hovering.value);
  32821. });
  32822. const showSuffix = computed(() => {
  32823. return slots.suffix || showClear.value || validateState.value && validateIcon.value && needStatusIcon.value;
  32824. });
  32825. return {
  32826. ns,
  32827. nsInput,
  32828. containerKls,
  32829. containerStyle,
  32830. innerKls,
  32831. showClear,
  32832. showSuffix
  32833. };
  32834. }
  32835. const __default__$V = defineComponent({
  32836. name: "ElInputTag",
  32837. inheritAttrs: false
  32838. });
  32839. const _sfc_main$17 = /* @__PURE__ */ defineComponent({
  32840. ...__default__$V,
  32841. props: inputTagProps,
  32842. emits: inputTagEmits,
  32843. setup(__props, { expose, emit }) {
  32844. const props = __props;
  32845. const attrs = useAttrs();
  32846. const slots = useSlots();
  32847. const { form, formItem } = useFormItem();
  32848. const { inputId } = useFormItemInputId(props, { formItemContext: formItem });
  32849. const needStatusIcon = computed(() => {
  32850. var _a;
  32851. return (_a = form == null ? void 0 : form.statusIcon) != null ? _a : false;
  32852. });
  32853. const validateState = computed(() => (formItem == null ? void 0 : formItem.validateState) || "");
  32854. const validateIcon = computed(() => {
  32855. return validateState.value && ValidateComponentsMap[validateState.value];
  32856. });
  32857. const {
  32858. inputRef,
  32859. wrapperRef,
  32860. isFocused,
  32861. inputValue,
  32862. size,
  32863. tagSize,
  32864. placeholder,
  32865. closable,
  32866. disabled,
  32867. handleDragged,
  32868. handleInput,
  32869. handleKeydown,
  32870. handleRemoveTag,
  32871. handleClear,
  32872. handleCompositionStart,
  32873. handleCompositionUpdate,
  32874. handleCompositionEnd,
  32875. focus,
  32876. blur
  32877. } = useInputTag({ props, emit, formItem });
  32878. const { hovering, handleMouseEnter, handleMouseLeave } = useHovering();
  32879. const { calculatorRef, inputStyle } = useCalcInputWidth();
  32880. const {
  32881. dropIndicatorRef,
  32882. showDropIndicator,
  32883. handleDragStart,
  32884. handleDragOver,
  32885. handleDragEnd
  32886. } = useDragTag({ wrapperRef, handleDragged, afterDragged: focus });
  32887. const {
  32888. ns,
  32889. nsInput,
  32890. containerKls,
  32891. containerStyle,
  32892. innerKls,
  32893. showClear,
  32894. showSuffix
  32895. } = useInputTagDom({
  32896. props,
  32897. hovering,
  32898. isFocused,
  32899. inputValue,
  32900. disabled,
  32901. size,
  32902. validateState,
  32903. validateIcon,
  32904. needStatusIcon
  32905. });
  32906. expose({
  32907. focus,
  32908. blur
  32909. });
  32910. return (_ctx, _cache) => {
  32911. return openBlock(), createElementBlock("div", {
  32912. ref_key: "wrapperRef",
  32913. ref: wrapperRef,
  32914. class: normalizeClass(unref(containerKls)),
  32915. style: normalizeStyle(unref(containerStyle)),
  32916. onMouseenter: unref(handleMouseEnter),
  32917. onMouseleave: unref(handleMouseLeave)
  32918. }, [
  32919. unref(slots).prefix ? (openBlock(), createElementBlock("div", {
  32920. key: 0,
  32921. class: normalizeClass(unref(ns).e("prefix"))
  32922. }, [
  32923. renderSlot(_ctx.$slots, "prefix")
  32924. ], 2)) : createCommentVNode("v-if", true),
  32925. createElementVNode("div", {
  32926. class: normalizeClass(unref(innerKls))
  32927. }, [
  32928. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.modelValue, (item, index) => {
  32929. return openBlock(), createBlock(unref(ElTag), {
  32930. key: index,
  32931. size: unref(tagSize),
  32932. closable: unref(closable),
  32933. type: _ctx.tagType,
  32934. effect: _ctx.tagEffect,
  32935. draggable: unref(closable) && _ctx.draggable,
  32936. "disable-transitions": "",
  32937. onClose: ($event) => unref(handleRemoveTag)(index),
  32938. onDragstart: (event) => unref(handleDragStart)(event, index),
  32939. onDragover: (event) => unref(handleDragOver)(event, index),
  32940. onDragend: unref(handleDragEnd),
  32941. onDrop: withModifiers(() => {
  32942. }, ["stop"])
  32943. }, {
  32944. default: withCtx(() => [
  32945. renderSlot(_ctx.$slots, "tag", {
  32946. value: item,
  32947. index
  32948. }, () => [
  32949. createTextVNode(toDisplayString(item), 1)
  32950. ])
  32951. ]),
  32952. _: 2
  32953. }, 1032, ["size", "closable", "type", "effect", "draggable", "onClose", "onDragstart", "onDragover", "onDragend", "onDrop"]);
  32954. }), 128)),
  32955. createElementVNode("div", {
  32956. class: normalizeClass(unref(ns).e("input-wrapper"))
  32957. }, [
  32958. withDirectives(createElementVNode("input", mergeProps({
  32959. id: unref(inputId),
  32960. ref_key: "inputRef",
  32961. ref: inputRef,
  32962. "onUpdate:modelValue": ($event) => isRef(inputValue) ? inputValue.value = $event : null
  32963. }, unref(attrs), {
  32964. type: "text",
  32965. minlength: _ctx.minlength,
  32966. maxlength: _ctx.maxlength,
  32967. disabled: unref(disabled),
  32968. readonly: _ctx.readonly,
  32969. autocomplete: _ctx.autocomplete,
  32970. tabindex: _ctx.tabindex,
  32971. placeholder: unref(placeholder),
  32972. autofocus: _ctx.autofocus,
  32973. ariaLabel: _ctx.ariaLabel,
  32974. class: unref(ns).e("input"),
  32975. style: unref(inputStyle),
  32976. onCompositionstart: unref(handleCompositionStart),
  32977. onCompositionupdate: unref(handleCompositionUpdate),
  32978. onCompositionend: unref(handleCompositionEnd),
  32979. onInput: unref(handleInput),
  32980. onKeydown: unref(handleKeydown)
  32981. }), null, 16, ["id", "onUpdate:modelValue", "minlength", "maxlength", "disabled", "readonly", "autocomplete", "tabindex", "placeholder", "autofocus", "ariaLabel", "onCompositionstart", "onCompositionupdate", "onCompositionend", "onInput", "onKeydown"]), [
  32982. [vModelText, unref(inputValue)]
  32983. ]),
  32984. createElementVNode("span", {
  32985. ref_key: "calculatorRef",
  32986. ref: calculatorRef,
  32987. "aria-hidden": "true",
  32988. class: normalizeClass(unref(ns).e("input-calculator")),
  32989. textContent: toDisplayString(unref(inputValue))
  32990. }, null, 10, ["textContent"])
  32991. ], 2),
  32992. withDirectives(createElementVNode("div", {
  32993. ref_key: "dropIndicatorRef",
  32994. ref: dropIndicatorRef,
  32995. class: normalizeClass(unref(ns).e("drop-indicator"))
  32996. }, null, 2), [
  32997. [vShow, unref(showDropIndicator)]
  32998. ])
  32999. ], 2),
  33000. unref(showSuffix) ? (openBlock(), createElementBlock("div", {
  33001. key: 1,
  33002. class: normalizeClass(unref(ns).e("suffix"))
  33003. }, [
  33004. renderSlot(_ctx.$slots, "suffix"),
  33005. unref(showClear) ? (openBlock(), createBlock(unref(ElIcon), {
  33006. key: 0,
  33007. class: normalizeClass([unref(ns).e("icon"), unref(ns).e("clear")]),
  33008. onMousedown: withModifiers(unref(NOOP), ["prevent"]),
  33009. onClick: unref(handleClear)
  33010. }, {
  33011. default: withCtx(() => [
  33012. createVNode(unref(circle_close_default))
  33013. ]),
  33014. _: 1
  33015. }, 8, ["class", "onMousedown", "onClick"])) : createCommentVNode("v-if", true),
  33016. unref(validateState) && unref(validateIcon) && unref(needStatusIcon) ? (openBlock(), createBlock(unref(ElIcon), {
  33017. key: 1,
  33018. class: normalizeClass([
  33019. unref(nsInput).e("icon"),
  33020. unref(nsInput).e("validateIcon"),
  33021. unref(nsInput).is("loading", unref(validateState) === "validating")
  33022. ])
  33023. }, {
  33024. default: withCtx(() => [
  33025. (openBlock(), createBlock(resolveDynamicComponent(unref(validateIcon))))
  33026. ]),
  33027. _: 1
  33028. }, 8, ["class"])) : createCommentVNode("v-if", true)
  33029. ], 2)) : createCommentVNode("v-if", true)
  33030. ], 46, ["onMouseenter", "onMouseleave"]);
  33031. };
  33032. }
  33033. });
  33034. var InputTag = /* @__PURE__ */ _export_sfc(_sfc_main$17, [["__file", "input-tag.vue"]]);
  33035. const ElInputTag = withInstall(InputTag);
  33036. const linkProps = buildProps({
  33037. type: {
  33038. type: String,
  33039. values: ["primary", "success", "warning", "info", "danger", "default"],
  33040. default: "default"
  33041. },
  33042. underline: {
  33043. type: Boolean,
  33044. default: true
  33045. },
  33046. disabled: Boolean,
  33047. href: { type: String, default: "" },
  33048. target: {
  33049. type: String,
  33050. default: "_self"
  33051. },
  33052. icon: {
  33053. type: iconPropType
  33054. }
  33055. });
  33056. const linkEmits = {
  33057. click: (evt) => evt instanceof MouseEvent
  33058. };
  33059. const __default__$U = defineComponent({
  33060. name: "ElLink"
  33061. });
  33062. const _sfc_main$16 = /* @__PURE__ */ defineComponent({
  33063. ...__default__$U,
  33064. props: linkProps,
  33065. emits: linkEmits,
  33066. setup(__props, { emit }) {
  33067. const props = __props;
  33068. const ns = useNamespace("link");
  33069. const linkKls = computed(() => [
  33070. ns.b(),
  33071. ns.m(props.type),
  33072. ns.is("disabled", props.disabled),
  33073. ns.is("underline", props.underline && !props.disabled)
  33074. ]);
  33075. function handleClick(event) {
  33076. if (!props.disabled)
  33077. emit("click", event);
  33078. }
  33079. return (_ctx, _cache) => {
  33080. return openBlock(), createElementBlock("a", {
  33081. class: normalizeClass(unref(linkKls)),
  33082. href: _ctx.disabled || !_ctx.href ? void 0 : _ctx.href,
  33083. target: _ctx.disabled || !_ctx.href ? void 0 : _ctx.target,
  33084. onClick: handleClick
  33085. }, [
  33086. _ctx.icon ? (openBlock(), createBlock(unref(ElIcon), { key: 0 }, {
  33087. default: withCtx(() => [
  33088. (openBlock(), createBlock(resolveDynamicComponent(_ctx.icon)))
  33089. ]),
  33090. _: 1
  33091. })) : createCommentVNode("v-if", true),
  33092. _ctx.$slots.default ? (openBlock(), createElementBlock("span", {
  33093. key: 1,
  33094. class: normalizeClass(unref(ns).e("inner"))
  33095. }, [
  33096. renderSlot(_ctx.$slots, "default")
  33097. ], 2)) : createCommentVNode("v-if", true),
  33098. _ctx.$slots.icon ? renderSlot(_ctx.$slots, "icon", { key: 2 }) : createCommentVNode("v-if", true)
  33099. ], 10, ["href", "target"]);
  33100. };
  33101. }
  33102. });
  33103. var Link = /* @__PURE__ */ _export_sfc(_sfc_main$16, [["__file", "link.vue"]]);
  33104. const ElLink = withInstall(Link);
  33105. class SubMenu$1 {
  33106. constructor(parent, domNode) {
  33107. this.parent = parent;
  33108. this.domNode = domNode;
  33109. this.subIndex = 0;
  33110. this.subIndex = 0;
  33111. this.init();
  33112. }
  33113. init() {
  33114. this.subMenuItems = this.domNode.querySelectorAll("li");
  33115. this.addListeners();
  33116. }
  33117. gotoSubIndex(idx) {
  33118. if (idx === this.subMenuItems.length) {
  33119. idx = 0;
  33120. } else if (idx < 0) {
  33121. idx = this.subMenuItems.length - 1;
  33122. }
  33123. this.subMenuItems[idx].focus();
  33124. this.subIndex = idx;
  33125. }
  33126. addListeners() {
  33127. const parentNode = this.parent.domNode;
  33128. Array.prototype.forEach.call(this.subMenuItems, (el) => {
  33129. el.addEventListener("keydown", (event) => {
  33130. let prevDef = false;
  33131. switch (event.code) {
  33132. case EVENT_CODE.down: {
  33133. this.gotoSubIndex(this.subIndex + 1);
  33134. prevDef = true;
  33135. break;
  33136. }
  33137. case EVENT_CODE.up: {
  33138. this.gotoSubIndex(this.subIndex - 1);
  33139. prevDef = true;
  33140. break;
  33141. }
  33142. case EVENT_CODE.tab: {
  33143. triggerEvent(parentNode, "mouseleave");
  33144. break;
  33145. }
  33146. case EVENT_CODE.enter:
  33147. case EVENT_CODE.numpadEnter:
  33148. case EVENT_CODE.space: {
  33149. prevDef = true;
  33150. event.currentTarget.click();
  33151. break;
  33152. }
  33153. }
  33154. if (prevDef) {
  33155. event.preventDefault();
  33156. event.stopPropagation();
  33157. }
  33158. return false;
  33159. });
  33160. });
  33161. }
  33162. }
  33163. var SubMenu$2 = SubMenu$1;
  33164. class MenuItem$1 {
  33165. constructor(domNode, namespace) {
  33166. this.domNode = domNode;
  33167. this.submenu = null;
  33168. this.submenu = null;
  33169. this.init(namespace);
  33170. }
  33171. init(namespace) {
  33172. this.domNode.setAttribute("tabindex", "0");
  33173. const menuChild = this.domNode.querySelector(`.${namespace}-menu`);
  33174. if (menuChild) {
  33175. this.submenu = new SubMenu$2(this, menuChild);
  33176. }
  33177. this.addListeners();
  33178. }
  33179. addListeners() {
  33180. this.domNode.addEventListener("keydown", (event) => {
  33181. let prevDef = false;
  33182. switch (event.code) {
  33183. case EVENT_CODE.down: {
  33184. triggerEvent(event.currentTarget, "mouseenter");
  33185. this.submenu && this.submenu.gotoSubIndex(0);
  33186. prevDef = true;
  33187. break;
  33188. }
  33189. case EVENT_CODE.up: {
  33190. triggerEvent(event.currentTarget, "mouseenter");
  33191. this.submenu && this.submenu.gotoSubIndex(this.submenu.subMenuItems.length - 1);
  33192. prevDef = true;
  33193. break;
  33194. }
  33195. case EVENT_CODE.tab: {
  33196. triggerEvent(event.currentTarget, "mouseleave");
  33197. break;
  33198. }
  33199. case EVENT_CODE.enter:
  33200. case EVENT_CODE.numpadEnter:
  33201. case EVENT_CODE.space: {
  33202. prevDef = true;
  33203. event.currentTarget.click();
  33204. break;
  33205. }
  33206. }
  33207. if (prevDef) {
  33208. event.preventDefault();
  33209. }
  33210. });
  33211. }
  33212. }
  33213. var MenuItem$2 = MenuItem$1;
  33214. class Menu$1 {
  33215. constructor(domNode, namespace) {
  33216. this.domNode = domNode;
  33217. this.init(namespace);
  33218. }
  33219. init(namespace) {
  33220. const menuChildren = this.domNode.childNodes;
  33221. Array.from(menuChildren).forEach((child) => {
  33222. if (child.nodeType === 1) {
  33223. new MenuItem$2(child, namespace);
  33224. }
  33225. });
  33226. }
  33227. }
  33228. var Menubar = Menu$1;
  33229. const __default__$T = defineComponent({
  33230. name: "ElMenuCollapseTransition"
  33231. });
  33232. const _sfc_main$15 = /* @__PURE__ */ defineComponent({
  33233. ...__default__$T,
  33234. setup(__props) {
  33235. const ns = useNamespace("menu");
  33236. const listeners = {
  33237. onBeforeEnter: (el) => el.style.opacity = "0.2",
  33238. onEnter(el, done) {
  33239. addClass(el, `${ns.namespace.value}-opacity-transition`);
  33240. el.style.opacity = "1";
  33241. done();
  33242. },
  33243. onAfterEnter(el) {
  33244. removeClass(el, `${ns.namespace.value}-opacity-transition`);
  33245. el.style.opacity = "";
  33246. },
  33247. onBeforeLeave(el) {
  33248. if (!el.dataset)
  33249. el.dataset = {};
  33250. if (hasClass(el, ns.m("collapse"))) {
  33251. removeClass(el, ns.m("collapse"));
  33252. el.dataset.oldOverflow = el.style.overflow;
  33253. el.dataset.scrollWidth = el.clientWidth.toString();
  33254. addClass(el, ns.m("collapse"));
  33255. } else {
  33256. addClass(el, ns.m("collapse"));
  33257. el.dataset.oldOverflow = el.style.overflow;
  33258. el.dataset.scrollWidth = el.clientWidth.toString();
  33259. removeClass(el, ns.m("collapse"));
  33260. }
  33261. el.style.width = `${el.scrollWidth}px`;
  33262. el.style.overflow = "hidden";
  33263. },
  33264. onLeave(el) {
  33265. addClass(el, "horizontal-collapse-transition");
  33266. el.style.width = `${el.dataset.scrollWidth}px`;
  33267. }
  33268. };
  33269. return (_ctx, _cache) => {
  33270. return openBlock(), createBlock(Transition, mergeProps({ mode: "out-in" }, unref(listeners)), {
  33271. default: withCtx(() => [
  33272. renderSlot(_ctx.$slots, "default")
  33273. ]),
  33274. _: 3
  33275. }, 16);
  33276. };
  33277. }
  33278. });
  33279. var ElMenuCollapseTransition = /* @__PURE__ */ _export_sfc(_sfc_main$15, [["__file", "menu-collapse-transition.vue"]]);
  33280. function useMenu(instance, currentIndex) {
  33281. const indexPath = computed(() => {
  33282. let parent = instance.parent;
  33283. const path = [currentIndex.value];
  33284. while (parent.type.name !== "ElMenu") {
  33285. if (parent.props.index) {
  33286. path.unshift(parent.props.index);
  33287. }
  33288. parent = parent.parent;
  33289. }
  33290. return path;
  33291. });
  33292. const parentMenu = computed(() => {
  33293. let parent = instance.parent;
  33294. while (parent && !["ElMenu", "ElSubMenu"].includes(parent.type.name)) {
  33295. parent = parent.parent;
  33296. }
  33297. return parent;
  33298. });
  33299. return {
  33300. parentMenu,
  33301. indexPath
  33302. };
  33303. }
  33304. function useMenuColor(props) {
  33305. const menuBarColor = computed(() => {
  33306. const color = props.backgroundColor;
  33307. return color ? new TinyColor(color).shade(20).toString() : "";
  33308. });
  33309. return menuBarColor;
  33310. }
  33311. const useMenuCssVar = (props, level) => {
  33312. const ns = useNamespace("menu");
  33313. return computed(() => ns.cssVarBlock({
  33314. "text-color": props.textColor || "",
  33315. "hover-text-color": props.textColor || "",
  33316. "bg-color": props.backgroundColor || "",
  33317. "hover-bg-color": useMenuColor(props).value || "",
  33318. "active-color": props.activeTextColor || "",
  33319. level: `${level}`
  33320. }));
  33321. };
  33322. const subMenuProps = buildProps({
  33323. index: {
  33324. type: String,
  33325. required: true
  33326. },
  33327. showTimeout: Number,
  33328. hideTimeout: Number,
  33329. popperClass: String,
  33330. disabled: Boolean,
  33331. teleported: {
  33332. type: Boolean,
  33333. default: void 0
  33334. },
  33335. popperOffset: Number,
  33336. expandCloseIcon: {
  33337. type: iconPropType
  33338. },
  33339. expandOpenIcon: {
  33340. type: iconPropType
  33341. },
  33342. collapseCloseIcon: {
  33343. type: iconPropType
  33344. },
  33345. collapseOpenIcon: {
  33346. type: iconPropType
  33347. }
  33348. });
  33349. const COMPONENT_NAME$c = "ElSubMenu";
  33350. var SubMenu = defineComponent({
  33351. name: COMPONENT_NAME$c,
  33352. props: subMenuProps,
  33353. setup(props, { slots, expose }) {
  33354. const instance = getCurrentInstance();
  33355. const { indexPath, parentMenu } = useMenu(instance, computed(() => props.index));
  33356. const nsMenu = useNamespace("menu");
  33357. const nsSubMenu = useNamespace("sub-menu");
  33358. const rootMenu = inject("rootMenu");
  33359. if (!rootMenu)
  33360. throwError(COMPONENT_NAME$c, "can not inject root menu");
  33361. const subMenu = inject(`subMenu:${parentMenu.value.uid}`);
  33362. if (!subMenu)
  33363. throwError(COMPONENT_NAME$c, "can not inject sub menu");
  33364. const items = ref({});
  33365. const subMenus = ref({});
  33366. let timeout;
  33367. const mouseInChild = ref(false);
  33368. const verticalTitleRef = ref();
  33369. const vPopper = ref();
  33370. const currentPlacement = computed(() => mode.value === "horizontal" && isFirstLevel.value ? "bottom-start" : "right-start");
  33371. const subMenuTitleIcon = computed(() => {
  33372. return mode.value === "horizontal" && isFirstLevel.value || mode.value === "vertical" && !rootMenu.props.collapse ? props.expandCloseIcon && props.expandOpenIcon ? opened.value ? props.expandOpenIcon : props.expandCloseIcon : arrow_down_default : props.collapseCloseIcon && props.collapseOpenIcon ? opened.value ? props.collapseOpenIcon : props.collapseCloseIcon : arrow_right_default;
  33373. });
  33374. const isFirstLevel = computed(() => subMenu.level === 0);
  33375. const appendToBody = computed(() => {
  33376. const value = props.teleported;
  33377. return value === void 0 ? isFirstLevel.value : value;
  33378. });
  33379. const menuTransitionName = computed(() => rootMenu.props.collapse ? `${nsMenu.namespace.value}-zoom-in-left` : `${nsMenu.namespace.value}-zoom-in-top`);
  33380. const fallbackPlacements = computed(() => mode.value === "horizontal" && isFirstLevel.value ? [
  33381. "bottom-start",
  33382. "bottom-end",
  33383. "top-start",
  33384. "top-end",
  33385. "right-start",
  33386. "left-start"
  33387. ] : [
  33388. "right-start",
  33389. "right",
  33390. "right-end",
  33391. "left-start",
  33392. "bottom-start",
  33393. "bottom-end",
  33394. "top-start",
  33395. "top-end"
  33396. ]);
  33397. const opened = computed(() => rootMenu.openedMenus.includes(props.index));
  33398. const active = computed(() => [...Object.values(items.value), ...Object.values(subMenus.value)].some(({ active: active2 }) => active2));
  33399. const mode = computed(() => rootMenu.props.mode);
  33400. const persistent = computed(() => rootMenu.props.persistent);
  33401. const item = reactive({
  33402. index: props.index,
  33403. indexPath,
  33404. active
  33405. });
  33406. const ulStyle = useMenuCssVar(rootMenu.props, subMenu.level + 1);
  33407. const subMenuPopperOffset = computed(() => {
  33408. var _a;
  33409. return (_a = props.popperOffset) != null ? _a : rootMenu.props.popperOffset;
  33410. });
  33411. const subMenuPopperClass = computed(() => {
  33412. var _a;
  33413. return (_a = props.popperClass) != null ? _a : rootMenu.props.popperClass;
  33414. });
  33415. const subMenuShowTimeout = computed(() => {
  33416. var _a;
  33417. return (_a = props.showTimeout) != null ? _a : rootMenu.props.showTimeout;
  33418. });
  33419. const subMenuHideTimeout = computed(() => {
  33420. var _a;
  33421. return (_a = props.hideTimeout) != null ? _a : rootMenu.props.hideTimeout;
  33422. });
  33423. const doDestroy = () => {
  33424. var _a, _b, _c;
  33425. return (_c = (_b = (_a = vPopper.value) == null ? void 0 : _a.popperRef) == null ? void 0 : _b.popperInstanceRef) == null ? void 0 : _c.destroy();
  33426. };
  33427. const handleCollapseToggle = (value) => {
  33428. if (!value) {
  33429. doDestroy();
  33430. }
  33431. };
  33432. const handleClick = () => {
  33433. if (rootMenu.props.menuTrigger === "hover" && rootMenu.props.mode === "horizontal" || rootMenu.props.collapse && rootMenu.props.mode === "vertical" || props.disabled)
  33434. return;
  33435. rootMenu.handleSubMenuClick({
  33436. index: props.index,
  33437. indexPath: indexPath.value,
  33438. active: active.value
  33439. });
  33440. };
  33441. const handleMouseenter = (event, showTimeout = subMenuShowTimeout.value) => {
  33442. var _a;
  33443. if (event.type === "focus")
  33444. return;
  33445. if (rootMenu.props.menuTrigger === "click" && rootMenu.props.mode === "horizontal" || !rootMenu.props.collapse && rootMenu.props.mode === "vertical" || props.disabled) {
  33446. subMenu.mouseInChild.value = true;
  33447. return;
  33448. }
  33449. subMenu.mouseInChild.value = true;
  33450. timeout == null ? void 0 : timeout();
  33451. ({ stop: timeout } = useTimeoutFn(() => {
  33452. rootMenu.openMenu(props.index, indexPath.value);
  33453. }, showTimeout));
  33454. if (appendToBody.value) {
  33455. (_a = parentMenu.value.vnode.el) == null ? void 0 : _a.dispatchEvent(new MouseEvent("mouseenter"));
  33456. }
  33457. };
  33458. const handleMouseleave = (deepDispatch = false) => {
  33459. var _a;
  33460. if (rootMenu.props.menuTrigger === "click" && rootMenu.props.mode === "horizontal" || !rootMenu.props.collapse && rootMenu.props.mode === "vertical") {
  33461. subMenu.mouseInChild.value = false;
  33462. return;
  33463. }
  33464. timeout == null ? void 0 : timeout();
  33465. subMenu.mouseInChild.value = false;
  33466. ({ stop: timeout } = useTimeoutFn(() => !mouseInChild.value && rootMenu.closeMenu(props.index, indexPath.value), subMenuHideTimeout.value));
  33467. if (appendToBody.value && deepDispatch) {
  33468. (_a = subMenu.handleMouseleave) == null ? void 0 : _a.call(subMenu, true);
  33469. }
  33470. };
  33471. watch(() => rootMenu.props.collapse, (value) => handleCollapseToggle(Boolean(value)));
  33472. {
  33473. const addSubMenu = (item2) => {
  33474. subMenus.value[item2.index] = item2;
  33475. };
  33476. const removeSubMenu = (item2) => {
  33477. delete subMenus.value[item2.index];
  33478. };
  33479. provide(`subMenu:${instance.uid}`, {
  33480. addSubMenu,
  33481. removeSubMenu,
  33482. handleMouseleave,
  33483. mouseInChild,
  33484. level: subMenu.level + 1
  33485. });
  33486. }
  33487. expose({
  33488. opened
  33489. });
  33490. onMounted(() => {
  33491. rootMenu.addSubMenu(item);
  33492. subMenu.addSubMenu(item);
  33493. });
  33494. onBeforeUnmount(() => {
  33495. subMenu.removeSubMenu(item);
  33496. rootMenu.removeSubMenu(item);
  33497. });
  33498. return () => {
  33499. var _a;
  33500. const titleTag = [
  33501. (_a = slots.title) == null ? void 0 : _a.call(slots),
  33502. h$1(ElIcon, {
  33503. class: nsSubMenu.e("icon-arrow"),
  33504. style: {
  33505. transform: opened.value ? props.expandCloseIcon && props.expandOpenIcon || props.collapseCloseIcon && props.collapseOpenIcon && rootMenu.props.collapse ? "none" : "rotateZ(180deg)" : "none"
  33506. }
  33507. }, {
  33508. default: () => isString$1(subMenuTitleIcon.value) ? h$1(instance.appContext.components[subMenuTitleIcon.value]) : h$1(subMenuTitleIcon.value)
  33509. })
  33510. ];
  33511. const child = rootMenu.isMenuPopup ? h$1(ElTooltip, {
  33512. ref: vPopper,
  33513. visible: opened.value,
  33514. effect: "light",
  33515. pure: true,
  33516. offset: subMenuPopperOffset.value,
  33517. showArrow: false,
  33518. persistent: persistent.value,
  33519. popperClass: subMenuPopperClass.value,
  33520. placement: currentPlacement.value,
  33521. teleported: appendToBody.value,
  33522. fallbackPlacements: fallbackPlacements.value,
  33523. transition: menuTransitionName.value,
  33524. gpuAcceleration: false
  33525. }, {
  33526. content: () => {
  33527. var _a2;
  33528. return h$1("div", {
  33529. class: [
  33530. nsMenu.m(mode.value),
  33531. nsMenu.m("popup-container"),
  33532. subMenuPopperClass.value
  33533. ],
  33534. onMouseenter: (evt) => handleMouseenter(evt, 100),
  33535. onMouseleave: () => handleMouseleave(true),
  33536. onFocus: (evt) => handleMouseenter(evt, 100)
  33537. }, [
  33538. h$1("ul", {
  33539. class: [
  33540. nsMenu.b(),
  33541. nsMenu.m("popup"),
  33542. nsMenu.m(`popup-${currentPlacement.value}`)
  33543. ],
  33544. style: ulStyle.value
  33545. }, [(_a2 = slots.default) == null ? void 0 : _a2.call(slots)])
  33546. ]);
  33547. },
  33548. default: () => h$1("div", {
  33549. class: nsSubMenu.e("title"),
  33550. onClick: handleClick
  33551. }, titleTag)
  33552. }) : h$1(Fragment, {}, [
  33553. h$1("div", {
  33554. class: nsSubMenu.e("title"),
  33555. ref: verticalTitleRef,
  33556. onClick: handleClick
  33557. }, titleTag),
  33558. h$1(ElCollapseTransition, {}, {
  33559. default: () => {
  33560. var _a2;
  33561. return withDirectives(h$1("ul", {
  33562. role: "menu",
  33563. class: [nsMenu.b(), nsMenu.m("inline")],
  33564. style: ulStyle.value
  33565. }, [(_a2 = slots.default) == null ? void 0 : _a2.call(slots)]), [[vShow, opened.value]]);
  33566. }
  33567. })
  33568. ]);
  33569. return h$1("li", {
  33570. class: [
  33571. nsSubMenu.b(),
  33572. nsSubMenu.is("active", active.value),
  33573. nsSubMenu.is("opened", opened.value),
  33574. nsSubMenu.is("disabled", props.disabled)
  33575. ],
  33576. role: "menuitem",
  33577. ariaHaspopup: true,
  33578. ariaExpanded: opened.value,
  33579. onMouseenter: handleMouseenter,
  33580. onMouseleave: () => handleMouseleave(),
  33581. onFocus: handleMouseenter
  33582. }, [child]);
  33583. };
  33584. }
  33585. });
  33586. const menuProps = buildProps({
  33587. mode: {
  33588. type: String,
  33589. values: ["horizontal", "vertical"],
  33590. default: "vertical"
  33591. },
  33592. defaultActive: {
  33593. type: String,
  33594. default: ""
  33595. },
  33596. defaultOpeneds: {
  33597. type: definePropType(Array),
  33598. default: () => mutable([])
  33599. },
  33600. uniqueOpened: Boolean,
  33601. router: Boolean,
  33602. menuTrigger: {
  33603. type: String,
  33604. values: ["hover", "click"],
  33605. default: "hover"
  33606. },
  33607. collapse: Boolean,
  33608. backgroundColor: String,
  33609. textColor: String,
  33610. activeTextColor: String,
  33611. closeOnClickOutside: Boolean,
  33612. collapseTransition: {
  33613. type: Boolean,
  33614. default: true
  33615. },
  33616. ellipsis: {
  33617. type: Boolean,
  33618. default: true
  33619. },
  33620. popperOffset: {
  33621. type: Number,
  33622. default: 6
  33623. },
  33624. ellipsisIcon: {
  33625. type: iconPropType,
  33626. default: () => more_default
  33627. },
  33628. popperEffect: {
  33629. type: definePropType(String),
  33630. default: "dark"
  33631. },
  33632. popperClass: String,
  33633. showTimeout: {
  33634. type: Number,
  33635. default: 300
  33636. },
  33637. hideTimeout: {
  33638. type: Number,
  33639. default: 300
  33640. },
  33641. persistent: {
  33642. type: Boolean,
  33643. default: true
  33644. }
  33645. });
  33646. const checkIndexPath = (indexPath) => isArray$1(indexPath) && indexPath.every((path) => isString$1(path));
  33647. const menuEmits = {
  33648. close: (index, indexPath) => isString$1(index) && checkIndexPath(indexPath),
  33649. open: (index, indexPath) => isString$1(index) && checkIndexPath(indexPath),
  33650. select: (index, indexPath, item, routerResult) => isString$1(index) && checkIndexPath(indexPath) && isObject$1(item) && (routerResult === void 0 || routerResult instanceof Promise)
  33651. };
  33652. var Menu = defineComponent({
  33653. name: "ElMenu",
  33654. props: menuProps,
  33655. emits: menuEmits,
  33656. setup(props, { emit, slots, expose }) {
  33657. const instance = getCurrentInstance();
  33658. const router = instance.appContext.config.globalProperties.$router;
  33659. const menu = ref();
  33660. const nsMenu = useNamespace("menu");
  33661. const nsSubMenu = useNamespace("sub-menu");
  33662. const sliceIndex = ref(-1);
  33663. const openedMenus = ref(props.defaultOpeneds && !props.collapse ? props.defaultOpeneds.slice(0) : []);
  33664. const activeIndex = ref(props.defaultActive);
  33665. const items = ref({});
  33666. const subMenus = ref({});
  33667. const isMenuPopup = computed(() => props.mode === "horizontal" || props.mode === "vertical" && props.collapse);
  33668. const initMenu = () => {
  33669. const activeItem = activeIndex.value && items.value[activeIndex.value];
  33670. if (!activeItem || props.mode === "horizontal" || props.collapse)
  33671. return;
  33672. const indexPath = activeItem.indexPath;
  33673. indexPath.forEach((index) => {
  33674. const subMenu = subMenus.value[index];
  33675. subMenu && openMenu(index, subMenu.indexPath);
  33676. });
  33677. };
  33678. const openMenu = (index, indexPath) => {
  33679. if (openedMenus.value.includes(index))
  33680. return;
  33681. if (props.uniqueOpened) {
  33682. openedMenus.value = openedMenus.value.filter((index2) => indexPath.includes(index2));
  33683. }
  33684. openedMenus.value.push(index);
  33685. emit("open", index, indexPath);
  33686. };
  33687. const close = (index) => {
  33688. const i = openedMenus.value.indexOf(index);
  33689. if (i !== -1) {
  33690. openedMenus.value.splice(i, 1);
  33691. }
  33692. };
  33693. const closeMenu = (index, indexPath) => {
  33694. close(index);
  33695. emit("close", index, indexPath);
  33696. };
  33697. const handleSubMenuClick = ({
  33698. index,
  33699. indexPath
  33700. }) => {
  33701. const isOpened = openedMenus.value.includes(index);
  33702. isOpened ? closeMenu(index, indexPath) : openMenu(index, indexPath);
  33703. };
  33704. const handleMenuItemClick = (menuItem) => {
  33705. if (props.mode === "horizontal" || props.collapse) {
  33706. openedMenus.value = [];
  33707. }
  33708. const { index, indexPath } = menuItem;
  33709. if (isNil(index) || isNil(indexPath))
  33710. return;
  33711. if (props.router && router) {
  33712. const route = menuItem.route || index;
  33713. const routerResult = router.push(route).then((res) => {
  33714. if (!res)
  33715. activeIndex.value = index;
  33716. return res;
  33717. });
  33718. emit("select", index, indexPath, { index, indexPath, route }, routerResult);
  33719. } else {
  33720. activeIndex.value = index;
  33721. emit("select", index, indexPath, { index, indexPath });
  33722. }
  33723. };
  33724. const updateActiveIndex = (val) => {
  33725. var _a;
  33726. const itemsInData = items.value;
  33727. const item = itemsInData[val] || activeIndex.value && itemsInData[activeIndex.value] || itemsInData[props.defaultActive];
  33728. activeIndex.value = (_a = item == null ? void 0 : item.index) != null ? _a : val;
  33729. };
  33730. const calcMenuItemWidth = (menuItem) => {
  33731. const computedStyle = getComputedStyle(menuItem);
  33732. const marginLeft = Number.parseInt(computedStyle.marginLeft, 10);
  33733. const marginRight = Number.parseInt(computedStyle.marginRight, 10);
  33734. return menuItem.offsetWidth + marginLeft + marginRight || 0;
  33735. };
  33736. const calcSliceIndex = () => {
  33737. var _a, _b;
  33738. if (!menu.value)
  33739. return -1;
  33740. const items2 = Array.from((_b = (_a = menu.value) == null ? void 0 : _a.childNodes) != null ? _b : []).filter((item) => item.nodeName !== "#text" || item.nodeValue);
  33741. const moreItemWidth = 64;
  33742. const computedMenuStyle = getComputedStyle(menu.value);
  33743. const paddingLeft = Number.parseInt(computedMenuStyle.paddingLeft, 10);
  33744. const paddingRight = Number.parseInt(computedMenuStyle.paddingRight, 10);
  33745. const menuWidth = menu.value.clientWidth - paddingLeft - paddingRight;
  33746. let calcWidth = 0;
  33747. let sliceIndex2 = 0;
  33748. items2.forEach((item, index) => {
  33749. if (item.nodeName === "#comment")
  33750. return;
  33751. calcWidth += calcMenuItemWidth(item);
  33752. if (calcWidth <= menuWidth - moreItemWidth) {
  33753. sliceIndex2 = index + 1;
  33754. }
  33755. });
  33756. return sliceIndex2 === items2.length ? -1 : sliceIndex2;
  33757. };
  33758. const getIndexPath = (index) => subMenus.value[index].indexPath;
  33759. const debounce = (fn, wait = 33.34) => {
  33760. let timmer;
  33761. return () => {
  33762. timmer && clearTimeout(timmer);
  33763. timmer = setTimeout(() => {
  33764. fn();
  33765. }, wait);
  33766. };
  33767. };
  33768. let isFirstTimeRender = true;
  33769. const handleResize = () => {
  33770. if (sliceIndex.value === calcSliceIndex())
  33771. return;
  33772. const callback = () => {
  33773. sliceIndex.value = -1;
  33774. nextTick(() => {
  33775. sliceIndex.value = calcSliceIndex();
  33776. });
  33777. };
  33778. isFirstTimeRender ? callback() : debounce(callback)();
  33779. isFirstTimeRender = false;
  33780. };
  33781. watch(() => props.defaultActive, (currentActive) => {
  33782. if (!items.value[currentActive]) {
  33783. activeIndex.value = "";
  33784. }
  33785. updateActiveIndex(currentActive);
  33786. });
  33787. watch(() => props.collapse, (value) => {
  33788. if (value)
  33789. openedMenus.value = [];
  33790. });
  33791. watch(items.value, initMenu);
  33792. let resizeStopper;
  33793. watchEffect(() => {
  33794. if (props.mode === "horizontal" && props.ellipsis)
  33795. resizeStopper = useResizeObserver(menu, handleResize).stop;
  33796. else
  33797. resizeStopper == null ? void 0 : resizeStopper();
  33798. });
  33799. const mouseInChild = ref(false);
  33800. {
  33801. const addSubMenu = (item) => {
  33802. subMenus.value[item.index] = item;
  33803. };
  33804. const removeSubMenu = (item) => {
  33805. delete subMenus.value[item.index];
  33806. };
  33807. const addMenuItem = (item) => {
  33808. items.value[item.index] = item;
  33809. };
  33810. const removeMenuItem = (item) => {
  33811. delete items.value[item.index];
  33812. };
  33813. provide("rootMenu", reactive({
  33814. props,
  33815. openedMenus,
  33816. items,
  33817. subMenus,
  33818. activeIndex,
  33819. isMenuPopup,
  33820. addMenuItem,
  33821. removeMenuItem,
  33822. addSubMenu,
  33823. removeSubMenu,
  33824. openMenu,
  33825. closeMenu,
  33826. handleMenuItemClick,
  33827. handleSubMenuClick
  33828. }));
  33829. provide(`subMenu:${instance.uid}`, {
  33830. addSubMenu,
  33831. removeSubMenu,
  33832. mouseInChild,
  33833. level: 0
  33834. });
  33835. }
  33836. onMounted(() => {
  33837. if (props.mode === "horizontal") {
  33838. new Menubar(instance.vnode.el, nsMenu.namespace.value);
  33839. }
  33840. });
  33841. {
  33842. const open = (index) => {
  33843. const { indexPath } = subMenus.value[index];
  33844. indexPath.forEach((i) => openMenu(i, indexPath));
  33845. };
  33846. expose({
  33847. open,
  33848. close,
  33849. updateActiveIndex,
  33850. handleResize
  33851. });
  33852. }
  33853. const ulStyle = useMenuCssVar(props, 0);
  33854. return () => {
  33855. var _a, _b;
  33856. let slot = (_b = (_a = slots.default) == null ? void 0 : _a.call(slots)) != null ? _b : [];
  33857. const vShowMore = [];
  33858. if (props.mode === "horizontal" && menu.value) {
  33859. const originalSlot = flattedChildren(slot);
  33860. const slotDefault = sliceIndex.value === -1 ? originalSlot : originalSlot.slice(0, sliceIndex.value);
  33861. const slotMore = sliceIndex.value === -1 ? [] : originalSlot.slice(sliceIndex.value);
  33862. if ((slotMore == null ? void 0 : slotMore.length) && props.ellipsis) {
  33863. slot = slotDefault;
  33864. vShowMore.push(h$1(SubMenu, {
  33865. index: "sub-menu-more",
  33866. class: nsSubMenu.e("hide-arrow"),
  33867. popperOffset: props.popperOffset
  33868. }, {
  33869. title: () => h$1(ElIcon, {
  33870. class: nsSubMenu.e("icon-more")
  33871. }, {
  33872. default: () => h$1(props.ellipsisIcon)
  33873. }),
  33874. default: () => slotMore
  33875. }));
  33876. }
  33877. }
  33878. const directives = props.closeOnClickOutside ? [
  33879. [
  33880. ClickOutside,
  33881. () => {
  33882. if (!openedMenus.value.length)
  33883. return;
  33884. if (!mouseInChild.value) {
  33885. openedMenus.value.forEach((openedMenu) => emit("close", openedMenu, getIndexPath(openedMenu)));
  33886. openedMenus.value = [];
  33887. }
  33888. }
  33889. ]
  33890. ] : [];
  33891. const vMenu = withDirectives(h$1("ul", {
  33892. key: String(props.collapse),
  33893. role: "menubar",
  33894. ref: menu,
  33895. style: ulStyle.value,
  33896. class: {
  33897. [nsMenu.b()]: true,
  33898. [nsMenu.m(props.mode)]: true,
  33899. [nsMenu.m("collapse")]: props.collapse
  33900. }
  33901. }, [...slot, ...vShowMore]), directives);
  33902. if (props.collapseTransition && props.mode === "vertical") {
  33903. return h$1(ElMenuCollapseTransition, () => vMenu);
  33904. }
  33905. return vMenu;
  33906. };
  33907. }
  33908. });
  33909. const menuItemProps = buildProps({
  33910. index: {
  33911. type: definePropType([String, null]),
  33912. default: null
  33913. },
  33914. route: {
  33915. type: definePropType([String, Object])
  33916. },
  33917. disabled: Boolean
  33918. });
  33919. const menuItemEmits = {
  33920. click: (item) => isString$1(item.index) && isArray$1(item.indexPath)
  33921. };
  33922. const COMPONENT_NAME$b = "ElMenuItem";
  33923. const __default__$S = defineComponent({
  33924. name: COMPONENT_NAME$b
  33925. });
  33926. const _sfc_main$14 = /* @__PURE__ */ defineComponent({
  33927. ...__default__$S,
  33928. props: menuItemProps,
  33929. emits: menuItemEmits,
  33930. setup(__props, { expose, emit }) {
  33931. const props = __props;
  33932. const instance = getCurrentInstance();
  33933. const rootMenu = inject("rootMenu");
  33934. const nsMenu = useNamespace("menu");
  33935. const nsMenuItem = useNamespace("menu-item");
  33936. if (!rootMenu)
  33937. throwError(COMPONENT_NAME$b, "can not inject root menu");
  33938. const { parentMenu, indexPath } = useMenu(instance, toRef(props, "index"));
  33939. const subMenu = inject(`subMenu:${parentMenu.value.uid}`);
  33940. if (!subMenu)
  33941. throwError(COMPONENT_NAME$b, "can not inject sub menu");
  33942. const active = computed(() => props.index === rootMenu.activeIndex);
  33943. const item = reactive({
  33944. index: props.index,
  33945. indexPath,
  33946. active
  33947. });
  33948. const handleClick = () => {
  33949. if (!props.disabled) {
  33950. rootMenu.handleMenuItemClick({
  33951. index: props.index,
  33952. indexPath: indexPath.value,
  33953. route: props.route
  33954. });
  33955. emit("click", item);
  33956. }
  33957. };
  33958. onMounted(() => {
  33959. subMenu.addSubMenu(item);
  33960. rootMenu.addMenuItem(item);
  33961. });
  33962. onBeforeUnmount(() => {
  33963. subMenu.removeSubMenu(item);
  33964. rootMenu.removeMenuItem(item);
  33965. });
  33966. expose({
  33967. parentMenu,
  33968. rootMenu,
  33969. active,
  33970. nsMenu,
  33971. nsMenuItem,
  33972. handleClick
  33973. });
  33974. return (_ctx, _cache) => {
  33975. return openBlock(), createElementBlock("li", {
  33976. class: normalizeClass([
  33977. unref(nsMenuItem).b(),
  33978. unref(nsMenuItem).is("active", unref(active)),
  33979. unref(nsMenuItem).is("disabled", _ctx.disabled)
  33980. ]),
  33981. role: "menuitem",
  33982. tabindex: "-1",
  33983. onClick: handleClick
  33984. }, [
  33985. unref(parentMenu).type.name === "ElMenu" && unref(rootMenu).props.collapse && _ctx.$slots.title ? (openBlock(), createBlock(unref(ElTooltip), {
  33986. key: 0,
  33987. effect: unref(rootMenu).props.popperEffect,
  33988. placement: "right",
  33989. "fallback-placements": ["left"],
  33990. persistent: unref(rootMenu).props.persistent
  33991. }, {
  33992. content: withCtx(() => [
  33993. renderSlot(_ctx.$slots, "title")
  33994. ]),
  33995. default: withCtx(() => [
  33996. createElementVNode("div", {
  33997. class: normalizeClass(unref(nsMenu).be("tooltip", "trigger"))
  33998. }, [
  33999. renderSlot(_ctx.$slots, "default")
  34000. ], 2)
  34001. ]),
  34002. _: 3
  34003. }, 8, ["effect", "persistent"])) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
  34004. renderSlot(_ctx.$slots, "default"),
  34005. renderSlot(_ctx.$slots, "title")
  34006. ], 64))
  34007. ], 2);
  34008. };
  34009. }
  34010. });
  34011. var MenuItem = /* @__PURE__ */ _export_sfc(_sfc_main$14, [["__file", "menu-item.vue"]]);
  34012. const menuItemGroupProps = {
  34013. title: String
  34014. };
  34015. const __default__$R = defineComponent({
  34016. name: "ElMenuItemGroup"
  34017. });
  34018. const _sfc_main$13 = /* @__PURE__ */ defineComponent({
  34019. ...__default__$R,
  34020. props: menuItemGroupProps,
  34021. setup(__props) {
  34022. const ns = useNamespace("menu-item-group");
  34023. return (_ctx, _cache) => {
  34024. return openBlock(), createElementBlock("li", {
  34025. class: normalizeClass(unref(ns).b())
  34026. }, [
  34027. createElementVNode("div", {
  34028. class: normalizeClass(unref(ns).e("title"))
  34029. }, [
  34030. !_ctx.$slots.title ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  34031. createTextVNode(toDisplayString(_ctx.title), 1)
  34032. ], 64)) : renderSlot(_ctx.$slots, "title", { key: 1 })
  34033. ], 2),
  34034. createElementVNode("ul", null, [
  34035. renderSlot(_ctx.$slots, "default")
  34036. ])
  34037. ], 2);
  34038. };
  34039. }
  34040. });
  34041. var MenuItemGroup = /* @__PURE__ */ _export_sfc(_sfc_main$13, [["__file", "menu-item-group.vue"]]);
  34042. const ElMenu = withInstall(Menu, {
  34043. MenuItem,
  34044. MenuItemGroup,
  34045. SubMenu
  34046. });
  34047. const ElMenuItem = withNoopInstall(MenuItem);
  34048. const ElMenuItemGroup = withNoopInstall(MenuItemGroup);
  34049. const ElSubMenu = withNoopInstall(SubMenu);
  34050. const pageHeaderProps = buildProps({
  34051. icon: {
  34052. type: iconPropType,
  34053. default: () => back_default
  34054. },
  34055. title: String,
  34056. content: {
  34057. type: String,
  34058. default: ""
  34059. }
  34060. });
  34061. const pageHeaderEmits = {
  34062. back: () => true
  34063. };
  34064. const __default__$Q = defineComponent({
  34065. name: "ElPageHeader"
  34066. });
  34067. const _sfc_main$12 = /* @__PURE__ */ defineComponent({
  34068. ...__default__$Q,
  34069. props: pageHeaderProps,
  34070. emits: pageHeaderEmits,
  34071. setup(__props, { emit }) {
  34072. const { t } = useLocale();
  34073. const ns = useNamespace("page-header");
  34074. function handleClick() {
  34075. emit("back");
  34076. }
  34077. return (_ctx, _cache) => {
  34078. return openBlock(), createElementBlock("div", {
  34079. class: normalizeClass([
  34080. unref(ns).b(),
  34081. {
  34082. [unref(ns).m("has-breadcrumb")]: !!_ctx.$slots.breadcrumb,
  34083. [unref(ns).m("has-extra")]: !!_ctx.$slots.extra,
  34084. [unref(ns).is("contentful")]: !!_ctx.$slots.default
  34085. }
  34086. ])
  34087. }, [
  34088. _ctx.$slots.breadcrumb ? (openBlock(), createElementBlock("div", {
  34089. key: 0,
  34090. class: normalizeClass(unref(ns).e("breadcrumb"))
  34091. }, [
  34092. renderSlot(_ctx.$slots, "breadcrumb")
  34093. ], 2)) : createCommentVNode("v-if", true),
  34094. createElementVNode("div", {
  34095. class: normalizeClass(unref(ns).e("header"))
  34096. }, [
  34097. createElementVNode("div", {
  34098. class: normalizeClass(unref(ns).e("left"))
  34099. }, [
  34100. createElementVNode("div", {
  34101. class: normalizeClass(unref(ns).e("back")),
  34102. role: "button",
  34103. tabindex: "0",
  34104. onClick: handleClick
  34105. }, [
  34106. _ctx.icon || _ctx.$slots.icon ? (openBlock(), createElementBlock("div", {
  34107. key: 0,
  34108. "aria-label": _ctx.title || unref(t)("el.pageHeader.title"),
  34109. class: normalizeClass(unref(ns).e("icon"))
  34110. }, [
  34111. renderSlot(_ctx.$slots, "icon", {}, () => [
  34112. _ctx.icon ? (openBlock(), createBlock(unref(ElIcon), { key: 0 }, {
  34113. default: withCtx(() => [
  34114. (openBlock(), createBlock(resolveDynamicComponent(_ctx.icon)))
  34115. ]),
  34116. _: 1
  34117. })) : createCommentVNode("v-if", true)
  34118. ])
  34119. ], 10, ["aria-label"])) : createCommentVNode("v-if", true),
  34120. createElementVNode("div", {
  34121. class: normalizeClass(unref(ns).e("title"))
  34122. }, [
  34123. renderSlot(_ctx.$slots, "title", {}, () => [
  34124. createTextVNode(toDisplayString(_ctx.title || unref(t)("el.pageHeader.title")), 1)
  34125. ])
  34126. ], 2)
  34127. ], 2),
  34128. createVNode(unref(ElDivider), { direction: "vertical" }),
  34129. createElementVNode("div", {
  34130. class: normalizeClass(unref(ns).e("content"))
  34131. }, [
  34132. renderSlot(_ctx.$slots, "content", {}, () => [
  34133. createTextVNode(toDisplayString(_ctx.content), 1)
  34134. ])
  34135. ], 2)
  34136. ], 2),
  34137. _ctx.$slots.extra ? (openBlock(), createElementBlock("div", {
  34138. key: 0,
  34139. class: normalizeClass(unref(ns).e("extra"))
  34140. }, [
  34141. renderSlot(_ctx.$slots, "extra")
  34142. ], 2)) : createCommentVNode("v-if", true)
  34143. ], 2),
  34144. _ctx.$slots.default ? (openBlock(), createElementBlock("div", {
  34145. key: 1,
  34146. class: normalizeClass(unref(ns).e("main"))
  34147. }, [
  34148. renderSlot(_ctx.$slots, "default")
  34149. ], 2)) : createCommentVNode("v-if", true)
  34150. ], 2);
  34151. };
  34152. }
  34153. });
  34154. var PageHeader = /* @__PURE__ */ _export_sfc(_sfc_main$12, [["__file", "page-header.vue"]]);
  34155. const ElPageHeader = withInstall(PageHeader);
  34156. const elPaginationKey = Symbol("elPaginationKey");
  34157. const paginationPrevProps = buildProps({
  34158. disabled: Boolean,
  34159. currentPage: {
  34160. type: Number,
  34161. default: 1
  34162. },
  34163. prevText: {
  34164. type: String
  34165. },
  34166. prevIcon: {
  34167. type: iconPropType
  34168. }
  34169. });
  34170. const paginationPrevEmits = {
  34171. click: (evt) => evt instanceof MouseEvent
  34172. };
  34173. const __default__$P = defineComponent({
  34174. name: "ElPaginationPrev"
  34175. });
  34176. const _sfc_main$11 = /* @__PURE__ */ defineComponent({
  34177. ...__default__$P,
  34178. props: paginationPrevProps,
  34179. emits: paginationPrevEmits,
  34180. setup(__props) {
  34181. const props = __props;
  34182. const { t } = useLocale();
  34183. const internalDisabled = computed(() => props.disabled || props.currentPage <= 1);
  34184. return (_ctx, _cache) => {
  34185. return openBlock(), createElementBlock("button", {
  34186. type: "button",
  34187. class: "btn-prev",
  34188. disabled: unref(internalDisabled),
  34189. "aria-label": _ctx.prevText || unref(t)("el.pagination.prev"),
  34190. "aria-disabled": unref(internalDisabled),
  34191. onClick: ($event) => _ctx.$emit("click", $event)
  34192. }, [
  34193. _ctx.prevText ? (openBlock(), createElementBlock("span", { key: 0 }, toDisplayString(_ctx.prevText), 1)) : (openBlock(), createBlock(unref(ElIcon), { key: 1 }, {
  34194. default: withCtx(() => [
  34195. (openBlock(), createBlock(resolveDynamicComponent(_ctx.prevIcon)))
  34196. ]),
  34197. _: 1
  34198. }))
  34199. ], 8, ["disabled", "aria-label", "aria-disabled", "onClick"]);
  34200. };
  34201. }
  34202. });
  34203. var Prev = /* @__PURE__ */ _export_sfc(_sfc_main$11, [["__file", "prev.vue"]]);
  34204. const paginationNextProps = buildProps({
  34205. disabled: Boolean,
  34206. currentPage: {
  34207. type: Number,
  34208. default: 1
  34209. },
  34210. pageCount: {
  34211. type: Number,
  34212. default: 50
  34213. },
  34214. nextText: {
  34215. type: String
  34216. },
  34217. nextIcon: {
  34218. type: iconPropType
  34219. }
  34220. });
  34221. const __default__$O = defineComponent({
  34222. name: "ElPaginationNext"
  34223. });
  34224. const _sfc_main$10 = /* @__PURE__ */ defineComponent({
  34225. ...__default__$O,
  34226. props: paginationNextProps,
  34227. emits: ["click"],
  34228. setup(__props) {
  34229. const props = __props;
  34230. const { t } = useLocale();
  34231. const internalDisabled = computed(() => props.disabled || props.currentPage === props.pageCount || props.pageCount === 0);
  34232. return (_ctx, _cache) => {
  34233. return openBlock(), createElementBlock("button", {
  34234. type: "button",
  34235. class: "btn-next",
  34236. disabled: unref(internalDisabled),
  34237. "aria-label": _ctx.nextText || unref(t)("el.pagination.next"),
  34238. "aria-disabled": unref(internalDisabled),
  34239. onClick: ($event) => _ctx.$emit("click", $event)
  34240. }, [
  34241. _ctx.nextText ? (openBlock(), createElementBlock("span", { key: 0 }, toDisplayString(_ctx.nextText), 1)) : (openBlock(), createBlock(unref(ElIcon), { key: 1 }, {
  34242. default: withCtx(() => [
  34243. (openBlock(), createBlock(resolveDynamicComponent(_ctx.nextIcon)))
  34244. ]),
  34245. _: 1
  34246. }))
  34247. ], 8, ["disabled", "aria-label", "aria-disabled", "onClick"]);
  34248. };
  34249. }
  34250. });
  34251. var Next = /* @__PURE__ */ _export_sfc(_sfc_main$10, [["__file", "next.vue"]]);
  34252. const selectGroupKey = Symbol("ElSelectGroup");
  34253. const selectKey = Symbol("ElSelect");
  34254. const COMPONENT_NAME$a = "ElOption";
  34255. const optionProps = buildProps({
  34256. value: {
  34257. type: [String, Number, Boolean, Object],
  34258. required: true
  34259. },
  34260. label: {
  34261. type: [String, Number]
  34262. },
  34263. created: Boolean,
  34264. disabled: Boolean
  34265. });
  34266. function useOption$1(props, states) {
  34267. const select = inject(selectKey);
  34268. if (!select) {
  34269. throwError(COMPONENT_NAME$a, "usage: <el-select><el-option /></el-select/>");
  34270. }
  34271. const selectGroup = inject(selectGroupKey, { disabled: false });
  34272. const itemSelected = computed(() => {
  34273. return contains(castArray$1(select.props.modelValue), props.value);
  34274. });
  34275. const limitReached = computed(() => {
  34276. var _a;
  34277. if (select.props.multiple) {
  34278. const modelValue = castArray$1((_a = select.props.modelValue) != null ? _a : []);
  34279. return !itemSelected.value && modelValue.length >= select.props.multipleLimit && select.props.multipleLimit > 0;
  34280. } else {
  34281. return false;
  34282. }
  34283. });
  34284. const currentLabel = computed(() => {
  34285. return props.label || (isObject$1(props.value) ? "" : props.value);
  34286. });
  34287. const currentValue = computed(() => {
  34288. return props.value || props.label || "";
  34289. });
  34290. const isDisabled = computed(() => {
  34291. return props.disabled || states.groupDisabled || limitReached.value;
  34292. });
  34293. const instance = getCurrentInstance();
  34294. const contains = (arr = [], target) => {
  34295. if (!isObject$1(props.value)) {
  34296. return arr && arr.includes(target);
  34297. } else {
  34298. const valueKey = select.props.valueKey;
  34299. return arr && arr.some((item) => {
  34300. return toRaw(get(item, valueKey)) === get(target, valueKey);
  34301. });
  34302. }
  34303. };
  34304. const hoverItem = () => {
  34305. if (!props.disabled && !selectGroup.disabled) {
  34306. select.states.hoveringIndex = select.optionsArray.indexOf(instance.proxy);
  34307. }
  34308. };
  34309. const updateOption = (query) => {
  34310. const regexp = new RegExp(escapeStringRegexp(query), "i");
  34311. states.visible = regexp.test(String(currentLabel.value)) || props.created;
  34312. };
  34313. watch(() => currentLabel.value, () => {
  34314. if (!props.created && !select.props.remote)
  34315. select.setSelected();
  34316. });
  34317. watch(() => props.value, (val, oldVal) => {
  34318. const { remote, valueKey } = select.props;
  34319. const shouldUpdate = remote ? val !== oldVal : !isEqual$1(val, oldVal);
  34320. if (shouldUpdate) {
  34321. select.onOptionDestroy(oldVal, instance.proxy);
  34322. select.onOptionCreate(instance.proxy);
  34323. }
  34324. if (!props.created && !remote) {
  34325. if (valueKey && isObject$1(val) && isObject$1(oldVal) && val[valueKey] === oldVal[valueKey]) {
  34326. return;
  34327. }
  34328. select.setSelected();
  34329. }
  34330. });
  34331. watch(() => selectGroup.disabled, () => {
  34332. states.groupDisabled = selectGroup.disabled;
  34333. }, { immediate: true });
  34334. return {
  34335. select,
  34336. currentLabel,
  34337. currentValue,
  34338. itemSelected,
  34339. isDisabled,
  34340. hoverItem,
  34341. updateOption
  34342. };
  34343. }
  34344. const _sfc_main$$ = defineComponent({
  34345. name: COMPONENT_NAME$a,
  34346. componentName: COMPONENT_NAME$a,
  34347. props: optionProps,
  34348. setup(props) {
  34349. const ns = useNamespace("select");
  34350. const id = useId();
  34351. const containerKls = computed(() => [
  34352. ns.be("dropdown", "item"),
  34353. ns.is("disabled", unref(isDisabled)),
  34354. ns.is("selected", unref(itemSelected)),
  34355. ns.is("hovering", unref(hover))
  34356. ]);
  34357. const states = reactive({
  34358. index: -1,
  34359. groupDisabled: false,
  34360. visible: true,
  34361. hover: false
  34362. });
  34363. const {
  34364. currentLabel,
  34365. itemSelected,
  34366. isDisabled,
  34367. select,
  34368. hoverItem,
  34369. updateOption
  34370. } = useOption$1(props, states);
  34371. const { visible, hover } = toRefs(states);
  34372. const vm = getCurrentInstance().proxy;
  34373. select.onOptionCreate(vm);
  34374. onBeforeUnmount(() => {
  34375. const key = vm.value;
  34376. const { selected: selectedOptions } = select.states;
  34377. const doesSelected = selectedOptions.some((item) => {
  34378. return item.value === vm.value;
  34379. });
  34380. nextTick(() => {
  34381. if (select.states.cachedOptions.get(key) === vm && !doesSelected) {
  34382. select.states.cachedOptions.delete(key);
  34383. }
  34384. });
  34385. select.onOptionDestroy(key, vm);
  34386. });
  34387. function selectOptionClick() {
  34388. if (!isDisabled.value) {
  34389. select.handleOptionSelect(vm);
  34390. }
  34391. }
  34392. return {
  34393. ns,
  34394. id,
  34395. containerKls,
  34396. currentLabel,
  34397. itemSelected,
  34398. isDisabled,
  34399. select,
  34400. visible,
  34401. hover,
  34402. states,
  34403. hoverItem,
  34404. updateOption,
  34405. selectOptionClick
  34406. };
  34407. }
  34408. });
  34409. function _sfc_render$b(_ctx, _cache) {
  34410. return withDirectives((openBlock(), createElementBlock("li", {
  34411. id: _ctx.id,
  34412. class: normalizeClass(_ctx.containerKls),
  34413. role: "option",
  34414. "aria-disabled": _ctx.isDisabled || void 0,
  34415. "aria-selected": _ctx.itemSelected,
  34416. onMousemove: _ctx.hoverItem,
  34417. onClick: withModifiers(_ctx.selectOptionClick, ["stop"])
  34418. }, [
  34419. renderSlot(_ctx.$slots, "default", {}, () => [
  34420. createElementVNode("span", null, toDisplayString(_ctx.currentLabel), 1)
  34421. ])
  34422. ], 42, ["id", "aria-disabled", "aria-selected", "onMousemove", "onClick"])), [
  34423. [vShow, _ctx.visible]
  34424. ]);
  34425. }
  34426. var Option = /* @__PURE__ */ _export_sfc(_sfc_main$$, [["render", _sfc_render$b], ["__file", "option.vue"]]);
  34427. const _sfc_main$_ = defineComponent({
  34428. name: "ElSelectDropdown",
  34429. componentName: "ElSelectDropdown",
  34430. setup() {
  34431. const select = inject(selectKey);
  34432. const ns = useNamespace("select");
  34433. const popperClass = computed(() => select.props.popperClass);
  34434. const isMultiple = computed(() => select.props.multiple);
  34435. const isFitInputWidth = computed(() => select.props.fitInputWidth);
  34436. const minWidth = ref("");
  34437. function updateMinWidth() {
  34438. var _a;
  34439. minWidth.value = `${(_a = select.selectRef) == null ? void 0 : _a.offsetWidth}px`;
  34440. }
  34441. onMounted(() => {
  34442. updateMinWidth();
  34443. useResizeObserver(select.selectRef, updateMinWidth);
  34444. });
  34445. return {
  34446. ns,
  34447. minWidth,
  34448. popperClass,
  34449. isMultiple,
  34450. isFitInputWidth
  34451. };
  34452. }
  34453. });
  34454. function _sfc_render$a(_ctx, _cache, $props, $setup, $data, $options) {
  34455. return openBlock(), createElementBlock("div", {
  34456. class: normalizeClass([_ctx.ns.b("dropdown"), _ctx.ns.is("multiple", _ctx.isMultiple), _ctx.popperClass]),
  34457. style: normalizeStyle({ [_ctx.isFitInputWidth ? "width" : "minWidth"]: _ctx.minWidth })
  34458. }, [
  34459. _ctx.$slots.header ? (openBlock(), createElementBlock("div", {
  34460. key: 0,
  34461. class: normalizeClass(_ctx.ns.be("dropdown", "header"))
  34462. }, [
  34463. renderSlot(_ctx.$slots, "header")
  34464. ], 2)) : createCommentVNode("v-if", true),
  34465. renderSlot(_ctx.$slots, "default"),
  34466. _ctx.$slots.footer ? (openBlock(), createElementBlock("div", {
  34467. key: 1,
  34468. class: normalizeClass(_ctx.ns.be("dropdown", "footer"))
  34469. }, [
  34470. renderSlot(_ctx.$slots, "footer")
  34471. ], 2)) : createCommentVNode("v-if", true)
  34472. ], 6);
  34473. }
  34474. var ElSelectMenu$1 = /* @__PURE__ */ _export_sfc(_sfc_main$_, [["render", _sfc_render$a], ["__file", "select-dropdown.vue"]]);
  34475. const useSelect$3 = (props, emit) => {
  34476. const { t } = useLocale();
  34477. const contentId = useId();
  34478. const nsSelect = useNamespace("select");
  34479. const nsInput = useNamespace("input");
  34480. const states = reactive({
  34481. inputValue: "",
  34482. options: /* @__PURE__ */ new Map(),
  34483. cachedOptions: /* @__PURE__ */ new Map(),
  34484. optionValues: [],
  34485. selected: [],
  34486. selectionWidth: 0,
  34487. collapseItemWidth: 0,
  34488. selectedLabel: "",
  34489. hoveringIndex: -1,
  34490. previousQuery: null,
  34491. inputHovering: false,
  34492. menuVisibleOnFocus: false,
  34493. isBeforeHide: false
  34494. });
  34495. const selectRef = ref();
  34496. const selectionRef = ref();
  34497. const tooltipRef = ref();
  34498. const tagTooltipRef = ref();
  34499. const inputRef = ref();
  34500. const prefixRef = ref();
  34501. const suffixRef = ref();
  34502. const menuRef = ref();
  34503. const tagMenuRef = ref();
  34504. const collapseItemRef = ref();
  34505. const scrollbarRef = ref();
  34506. const {
  34507. isComposing,
  34508. handleCompositionStart,
  34509. handleCompositionUpdate,
  34510. handleCompositionEnd
  34511. } = useComposition({
  34512. afterComposition: (e) => onInput(e)
  34513. });
  34514. const { wrapperRef, isFocused, handleBlur } = useFocusController(inputRef, {
  34515. beforeFocus() {
  34516. return selectDisabled.value;
  34517. },
  34518. afterFocus() {
  34519. if (props.automaticDropdown && !expanded.value) {
  34520. expanded.value = true;
  34521. states.menuVisibleOnFocus = true;
  34522. }
  34523. },
  34524. beforeBlur(event) {
  34525. var _a, _b;
  34526. return ((_a = tooltipRef.value) == null ? void 0 : _a.isFocusInsideContent(event)) || ((_b = tagTooltipRef.value) == null ? void 0 : _b.isFocusInsideContent(event));
  34527. },
  34528. afterBlur() {
  34529. var _a;
  34530. expanded.value = false;
  34531. states.menuVisibleOnFocus = false;
  34532. if (props.validateEvent) {
  34533. (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "blur").catch((err) => debugWarn());
  34534. }
  34535. }
  34536. });
  34537. const expanded = ref(false);
  34538. const hoverOption = ref();
  34539. const { form, formItem } = useFormItem();
  34540. const { inputId } = useFormItemInputId(props, {
  34541. formItemContext: formItem
  34542. });
  34543. const { valueOnClear, isEmptyValue } = useEmptyValues(props);
  34544. const selectDisabled = computed(() => props.disabled || (form == null ? void 0 : form.disabled));
  34545. const hasModelValue = computed(() => {
  34546. return isArray$1(props.modelValue) ? props.modelValue.length > 0 : !isEmptyValue(props.modelValue);
  34547. });
  34548. const needStatusIcon = computed(() => {
  34549. var _a;
  34550. return (_a = form == null ? void 0 : form.statusIcon) != null ? _a : false;
  34551. });
  34552. const showClose = computed(() => {
  34553. return props.clearable && !selectDisabled.value && states.inputHovering && hasModelValue.value;
  34554. });
  34555. const iconComponent = computed(() => props.remote && props.filterable && !props.remoteShowSuffix ? "" : props.suffixIcon);
  34556. const iconReverse = computed(() => nsSelect.is("reverse", !!(iconComponent.value && expanded.value)));
  34557. const validateState = computed(() => (formItem == null ? void 0 : formItem.validateState) || "");
  34558. const validateIcon = computed(() => validateState.value && ValidateComponentsMap[validateState.value]);
  34559. const debounce$1 = computed(() => props.remote ? 300 : 0);
  34560. const isRemoteSearchEmpty = computed(() => props.remote && !states.inputValue && states.options.size === 0);
  34561. const emptyText = computed(() => {
  34562. if (props.loading) {
  34563. return props.loadingText || t("el.select.loading");
  34564. } else {
  34565. if (props.filterable && states.inputValue && states.options.size > 0 && filteredOptionsCount.value === 0) {
  34566. return props.noMatchText || t("el.select.noMatch");
  34567. }
  34568. if (states.options.size === 0) {
  34569. return props.noDataText || t("el.select.noData");
  34570. }
  34571. }
  34572. return null;
  34573. });
  34574. const filteredOptionsCount = computed(() => optionsArray.value.filter((option) => option.visible).length);
  34575. const optionsArray = computed(() => {
  34576. const list = Array.from(states.options.values());
  34577. const newList = [];
  34578. states.optionValues.forEach((item) => {
  34579. const index = list.findIndex((i) => i.value === item);
  34580. if (index > -1) {
  34581. newList.push(list[index]);
  34582. }
  34583. });
  34584. return newList.length >= list.length ? newList : list;
  34585. });
  34586. const cachedOptionsArray = computed(() => Array.from(states.cachedOptions.values()));
  34587. const showNewOption = computed(() => {
  34588. const hasExistingOption = optionsArray.value.filter((option) => {
  34589. return !option.created;
  34590. }).some((option) => {
  34591. return option.currentLabel === states.inputValue;
  34592. });
  34593. return props.filterable && props.allowCreate && states.inputValue !== "" && !hasExistingOption;
  34594. });
  34595. const updateOptions = () => {
  34596. if (props.filterable && isFunction$1(props.filterMethod))
  34597. return;
  34598. if (props.filterable && props.remote && isFunction$1(props.remoteMethod))
  34599. return;
  34600. optionsArray.value.forEach((option) => {
  34601. var _a;
  34602. (_a = option.updateOption) == null ? void 0 : _a.call(option, states.inputValue);
  34603. });
  34604. };
  34605. const selectSize = useFormSize();
  34606. const collapseTagSize = computed(() => ["small"].includes(selectSize.value) ? "small" : "default");
  34607. const dropdownMenuVisible = computed({
  34608. get() {
  34609. return expanded.value && !isRemoteSearchEmpty.value;
  34610. },
  34611. set(val) {
  34612. expanded.value = val;
  34613. }
  34614. });
  34615. const shouldShowPlaceholder = computed(() => {
  34616. if (props.multiple && !isUndefined(props.modelValue)) {
  34617. return castArray$1(props.modelValue).length === 0 && !states.inputValue;
  34618. }
  34619. const value = isArray$1(props.modelValue) ? props.modelValue[0] : props.modelValue;
  34620. return props.filterable || isUndefined(value) ? !states.inputValue : true;
  34621. });
  34622. const currentPlaceholder = computed(() => {
  34623. var _a;
  34624. const _placeholder = (_a = props.placeholder) != null ? _a : t("el.select.placeholder");
  34625. return props.multiple || !hasModelValue.value ? _placeholder : states.selectedLabel;
  34626. });
  34627. const mouseEnterEventName = computed(() => isIOS ? null : "mouseenter");
  34628. watch(() => props.modelValue, (val, oldVal) => {
  34629. if (props.multiple) {
  34630. if (props.filterable && !props.reserveKeyword) {
  34631. states.inputValue = "";
  34632. handleQueryChange("");
  34633. }
  34634. }
  34635. setSelected();
  34636. if (!isEqual$1(val, oldVal) && props.validateEvent) {
  34637. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
  34638. }
  34639. }, {
  34640. flush: "post",
  34641. deep: true
  34642. });
  34643. watch(() => expanded.value, (val) => {
  34644. if (val) {
  34645. handleQueryChange(states.inputValue);
  34646. } else {
  34647. states.inputValue = "";
  34648. states.previousQuery = null;
  34649. states.isBeforeHide = true;
  34650. }
  34651. emit("visible-change", val);
  34652. });
  34653. watch(() => states.options.entries(), () => {
  34654. if (!isClient)
  34655. return;
  34656. setSelected();
  34657. if (props.defaultFirstOption && (props.filterable || props.remote) && filteredOptionsCount.value) {
  34658. checkDefaultFirstOption();
  34659. }
  34660. }, {
  34661. flush: "post"
  34662. });
  34663. watch([() => states.hoveringIndex, optionsArray], ([val]) => {
  34664. if (isNumber(val) && val > -1) {
  34665. hoverOption.value = optionsArray.value[val] || {};
  34666. } else {
  34667. hoverOption.value = {};
  34668. }
  34669. optionsArray.value.forEach((option) => {
  34670. option.hover = hoverOption.value === option;
  34671. });
  34672. });
  34673. watchEffect(() => {
  34674. if (states.isBeforeHide)
  34675. return;
  34676. updateOptions();
  34677. });
  34678. const handleQueryChange = (val) => {
  34679. if (states.previousQuery === val || isComposing.value) {
  34680. return;
  34681. }
  34682. states.previousQuery = val;
  34683. if (props.filterable && isFunction$1(props.filterMethod)) {
  34684. props.filterMethod(val);
  34685. } else if (props.filterable && props.remote && isFunction$1(props.remoteMethod)) {
  34686. props.remoteMethod(val);
  34687. }
  34688. if (props.defaultFirstOption && (props.filterable || props.remote) && filteredOptionsCount.value) {
  34689. nextTick(checkDefaultFirstOption);
  34690. } else {
  34691. nextTick(updateHoveringIndex);
  34692. }
  34693. };
  34694. const checkDefaultFirstOption = () => {
  34695. const optionsInDropdown = optionsArray.value.filter((n) => n.visible && !n.disabled && !n.states.groupDisabled);
  34696. const userCreatedOption = optionsInDropdown.find((n) => n.created);
  34697. const firstOriginOption = optionsInDropdown[0];
  34698. const valueList = optionsArray.value.map((item) => item.value);
  34699. states.hoveringIndex = getValueIndex(valueList, userCreatedOption || firstOriginOption);
  34700. };
  34701. const setSelected = () => {
  34702. if (!props.multiple) {
  34703. const value = isArray$1(props.modelValue) ? props.modelValue[0] : props.modelValue;
  34704. const option = getOption(value);
  34705. states.selectedLabel = option.currentLabel;
  34706. states.selected = [option];
  34707. return;
  34708. } else {
  34709. states.selectedLabel = "";
  34710. }
  34711. const result = [];
  34712. if (!isUndefined(props.modelValue)) {
  34713. castArray$1(props.modelValue).forEach((value) => {
  34714. result.push(getOption(value));
  34715. });
  34716. }
  34717. states.selected = result;
  34718. };
  34719. const getOption = (value) => {
  34720. let option;
  34721. const isObjectValue = isPlainObject$1(value);
  34722. for (let i = states.cachedOptions.size - 1; i >= 0; i--) {
  34723. const cachedOption = cachedOptionsArray.value[i];
  34724. const isEqualValue = isObjectValue ? get(cachedOption.value, props.valueKey) === get(value, props.valueKey) : cachedOption.value === value;
  34725. if (isEqualValue) {
  34726. option = {
  34727. value,
  34728. currentLabel: cachedOption.currentLabel,
  34729. get isDisabled() {
  34730. return cachedOption.isDisabled;
  34731. }
  34732. };
  34733. break;
  34734. }
  34735. }
  34736. if (option)
  34737. return option;
  34738. const label = isObjectValue ? value.label : value != null ? value : "";
  34739. const newOption = {
  34740. value,
  34741. currentLabel: label
  34742. };
  34743. return newOption;
  34744. };
  34745. const updateHoveringIndex = () => {
  34746. states.hoveringIndex = optionsArray.value.findIndex((item) => states.selected.some((selected) => getValueKey(selected) === getValueKey(item)));
  34747. };
  34748. const resetSelectionWidth = () => {
  34749. states.selectionWidth = selectionRef.value.getBoundingClientRect().width;
  34750. };
  34751. const resetCollapseItemWidth = () => {
  34752. states.collapseItemWidth = collapseItemRef.value.getBoundingClientRect().width;
  34753. };
  34754. const updateTooltip = () => {
  34755. var _a, _b;
  34756. (_b = (_a = tooltipRef.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a);
  34757. };
  34758. const updateTagTooltip = () => {
  34759. var _a, _b;
  34760. (_b = (_a = tagTooltipRef.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a);
  34761. };
  34762. const onInputChange = () => {
  34763. if (states.inputValue.length > 0 && !expanded.value) {
  34764. expanded.value = true;
  34765. }
  34766. handleQueryChange(states.inputValue);
  34767. };
  34768. const onInput = (event) => {
  34769. states.inputValue = event.target.value;
  34770. if (props.remote) {
  34771. debouncedOnInputChange();
  34772. } else {
  34773. return onInputChange();
  34774. }
  34775. };
  34776. const debouncedOnInputChange = debounce(() => {
  34777. onInputChange();
  34778. }, debounce$1.value);
  34779. const emitChange = (val) => {
  34780. if (!isEqual$1(props.modelValue, val)) {
  34781. emit(CHANGE_EVENT, val);
  34782. }
  34783. };
  34784. const getLastNotDisabledIndex = (value) => findLastIndex(value, (it) => {
  34785. const option = states.cachedOptions.get(it);
  34786. return option && !option.disabled && !option.states.groupDisabled;
  34787. });
  34788. const deletePrevTag = (e) => {
  34789. if (!props.multiple)
  34790. return;
  34791. if (e.code === EVENT_CODE.delete)
  34792. return;
  34793. if (e.target.value.length <= 0) {
  34794. const value = castArray$1(props.modelValue).slice();
  34795. const lastNotDisabledIndex = getLastNotDisabledIndex(value);
  34796. if (lastNotDisabledIndex < 0)
  34797. return;
  34798. const removeTagValue = value[lastNotDisabledIndex];
  34799. value.splice(lastNotDisabledIndex, 1);
  34800. emit(UPDATE_MODEL_EVENT, value);
  34801. emitChange(value);
  34802. emit("remove-tag", removeTagValue);
  34803. }
  34804. };
  34805. const deleteTag = (event, tag) => {
  34806. const index = states.selected.indexOf(tag);
  34807. if (index > -1 && !selectDisabled.value) {
  34808. const value = castArray$1(props.modelValue).slice();
  34809. value.splice(index, 1);
  34810. emit(UPDATE_MODEL_EVENT, value);
  34811. emitChange(value);
  34812. emit("remove-tag", tag.value);
  34813. }
  34814. event.stopPropagation();
  34815. focus();
  34816. };
  34817. const deleteSelected = (event) => {
  34818. event.stopPropagation();
  34819. const value = props.multiple ? [] : valueOnClear.value;
  34820. if (props.multiple) {
  34821. for (const item of states.selected) {
  34822. if (item.isDisabled)
  34823. value.push(item.value);
  34824. }
  34825. }
  34826. emit(UPDATE_MODEL_EVENT, value);
  34827. emitChange(value);
  34828. states.hoveringIndex = -1;
  34829. expanded.value = false;
  34830. emit("clear");
  34831. focus();
  34832. };
  34833. const handleOptionSelect = (option) => {
  34834. var _a;
  34835. if (props.multiple) {
  34836. const value = castArray$1((_a = props.modelValue) != null ? _a : []).slice();
  34837. const optionIndex = getValueIndex(value, option);
  34838. if (optionIndex > -1) {
  34839. value.splice(optionIndex, 1);
  34840. } else if (props.multipleLimit <= 0 || value.length < props.multipleLimit) {
  34841. value.push(option.value);
  34842. }
  34843. emit(UPDATE_MODEL_EVENT, value);
  34844. emitChange(value);
  34845. if (option.created) {
  34846. handleQueryChange("");
  34847. }
  34848. if (props.filterable && !props.reserveKeyword) {
  34849. states.inputValue = "";
  34850. }
  34851. } else {
  34852. emit(UPDATE_MODEL_EVENT, option.value);
  34853. emitChange(option.value);
  34854. expanded.value = false;
  34855. }
  34856. focus();
  34857. if (expanded.value)
  34858. return;
  34859. nextTick(() => {
  34860. scrollToOption(option);
  34861. });
  34862. };
  34863. const getValueIndex = (arr, option) => {
  34864. if (isUndefined(option))
  34865. return -1;
  34866. if (!isObject$1(option.value))
  34867. return arr.indexOf(option.value);
  34868. return arr.findIndex((item) => {
  34869. return isEqual$1(get(item, props.valueKey), getValueKey(option));
  34870. });
  34871. };
  34872. const scrollToOption = (option) => {
  34873. var _a, _b, _c, _d, _e;
  34874. const targetOption = isArray$1(option) ? option[0] : option;
  34875. let target = null;
  34876. if (targetOption == null ? void 0 : targetOption.value) {
  34877. const options = optionsArray.value.filter((item) => item.value === targetOption.value);
  34878. if (options.length > 0) {
  34879. target = options[0].$el;
  34880. }
  34881. }
  34882. if (tooltipRef.value && target) {
  34883. 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")}`);
  34884. if (menu) {
  34885. scrollIntoView(menu, target);
  34886. }
  34887. }
  34888. (_e = scrollbarRef.value) == null ? void 0 : _e.handleScroll();
  34889. };
  34890. const onOptionCreate = (vm) => {
  34891. states.options.set(vm.value, vm);
  34892. states.cachedOptions.set(vm.value, vm);
  34893. };
  34894. const onOptionDestroy = (key, vm) => {
  34895. if (states.options.get(key) === vm) {
  34896. states.options.delete(key);
  34897. }
  34898. };
  34899. const popperRef = computed(() => {
  34900. var _a, _b;
  34901. return (_b = (_a = tooltipRef.value) == null ? void 0 : _a.popperRef) == null ? void 0 : _b.contentRef;
  34902. });
  34903. const handleMenuEnter = () => {
  34904. states.isBeforeHide = false;
  34905. nextTick(() => {
  34906. var _a;
  34907. (_a = scrollbarRef.value) == null ? void 0 : _a.update();
  34908. scrollToOption(states.selected);
  34909. });
  34910. };
  34911. const focus = () => {
  34912. var _a;
  34913. (_a = inputRef.value) == null ? void 0 : _a.focus();
  34914. };
  34915. const blur = () => {
  34916. var _a;
  34917. if (expanded.value) {
  34918. expanded.value = false;
  34919. nextTick(() => {
  34920. var _a2;
  34921. return (_a2 = inputRef.value) == null ? void 0 : _a2.blur();
  34922. });
  34923. return;
  34924. }
  34925. (_a = inputRef.value) == null ? void 0 : _a.blur();
  34926. };
  34927. const handleClearClick = (event) => {
  34928. deleteSelected(event);
  34929. };
  34930. const handleClickOutside = (event) => {
  34931. expanded.value = false;
  34932. if (isFocused.value) {
  34933. const _event = new FocusEvent("focus", event);
  34934. nextTick(() => handleBlur(_event));
  34935. }
  34936. };
  34937. const handleEsc = () => {
  34938. if (states.inputValue.length > 0) {
  34939. states.inputValue = "";
  34940. } else {
  34941. expanded.value = false;
  34942. }
  34943. };
  34944. const toggleMenu = () => {
  34945. if (selectDisabled.value)
  34946. return;
  34947. if (isIOS)
  34948. states.inputHovering = true;
  34949. if (states.menuVisibleOnFocus) {
  34950. states.menuVisibleOnFocus = false;
  34951. } else {
  34952. expanded.value = !expanded.value;
  34953. }
  34954. };
  34955. const selectOption = () => {
  34956. if (!expanded.value) {
  34957. toggleMenu();
  34958. } else {
  34959. const option = optionsArray.value[states.hoveringIndex];
  34960. if (option && !option.isDisabled) {
  34961. handleOptionSelect(option);
  34962. }
  34963. }
  34964. };
  34965. const getValueKey = (item) => {
  34966. return isObject$1(item.value) ? get(item.value, props.valueKey) : item.value;
  34967. };
  34968. const optionsAllDisabled = computed(() => optionsArray.value.filter((option) => option.visible).every((option) => option.isDisabled));
  34969. const showTagList = computed(() => {
  34970. if (!props.multiple) {
  34971. return [];
  34972. }
  34973. return props.collapseTags ? states.selected.slice(0, props.maxCollapseTags) : states.selected;
  34974. });
  34975. const collapseTagList = computed(() => {
  34976. if (!props.multiple) {
  34977. return [];
  34978. }
  34979. return props.collapseTags ? states.selected.slice(props.maxCollapseTags) : [];
  34980. });
  34981. const navigateOptions = (direction) => {
  34982. if (!expanded.value) {
  34983. expanded.value = true;
  34984. return;
  34985. }
  34986. if (states.options.size === 0 || filteredOptionsCount.value === 0 || isComposing.value)
  34987. return;
  34988. if (!optionsAllDisabled.value) {
  34989. if (direction === "next") {
  34990. states.hoveringIndex++;
  34991. if (states.hoveringIndex === states.options.size) {
  34992. states.hoveringIndex = 0;
  34993. }
  34994. } else if (direction === "prev") {
  34995. states.hoveringIndex--;
  34996. if (states.hoveringIndex < 0) {
  34997. states.hoveringIndex = states.options.size - 1;
  34998. }
  34999. }
  35000. const option = optionsArray.value[states.hoveringIndex];
  35001. if (option.isDisabled || !option.visible) {
  35002. navigateOptions(direction);
  35003. }
  35004. nextTick(() => scrollToOption(hoverOption.value));
  35005. }
  35006. };
  35007. const getGapWidth = () => {
  35008. if (!selectionRef.value)
  35009. return 0;
  35010. const style = window.getComputedStyle(selectionRef.value);
  35011. return Number.parseFloat(style.gap || "6px");
  35012. };
  35013. const tagStyle = computed(() => {
  35014. const gapWidth = getGapWidth();
  35015. const maxWidth = collapseItemRef.value && props.maxCollapseTags === 1 ? states.selectionWidth - states.collapseItemWidth - gapWidth : states.selectionWidth;
  35016. return { maxWidth: `${maxWidth}px` };
  35017. });
  35018. const collapseTagStyle = computed(() => {
  35019. return { maxWidth: `${states.selectionWidth}px` };
  35020. });
  35021. const popupScroll = (data) => {
  35022. emit("popup-scroll", data);
  35023. };
  35024. useResizeObserver(selectionRef, resetSelectionWidth);
  35025. useResizeObserver(menuRef, updateTooltip);
  35026. useResizeObserver(wrapperRef, updateTooltip);
  35027. useResizeObserver(tagMenuRef, updateTagTooltip);
  35028. useResizeObserver(collapseItemRef, resetCollapseItemWidth);
  35029. onMounted(() => {
  35030. setSelected();
  35031. });
  35032. return {
  35033. inputId,
  35034. contentId,
  35035. nsSelect,
  35036. nsInput,
  35037. states,
  35038. isFocused,
  35039. expanded,
  35040. optionsArray,
  35041. hoverOption,
  35042. selectSize,
  35043. filteredOptionsCount,
  35044. updateTooltip,
  35045. updateTagTooltip,
  35046. debouncedOnInputChange,
  35047. onInput,
  35048. deletePrevTag,
  35049. deleteTag,
  35050. deleteSelected,
  35051. handleOptionSelect,
  35052. scrollToOption,
  35053. hasModelValue,
  35054. shouldShowPlaceholder,
  35055. currentPlaceholder,
  35056. mouseEnterEventName,
  35057. needStatusIcon,
  35058. showClose,
  35059. iconComponent,
  35060. iconReverse,
  35061. validateState,
  35062. validateIcon,
  35063. showNewOption,
  35064. updateOptions,
  35065. collapseTagSize,
  35066. setSelected,
  35067. selectDisabled,
  35068. emptyText,
  35069. handleCompositionStart,
  35070. handleCompositionUpdate,
  35071. handleCompositionEnd,
  35072. onOptionCreate,
  35073. onOptionDestroy,
  35074. handleMenuEnter,
  35075. focus,
  35076. blur,
  35077. handleClearClick,
  35078. handleClickOutside,
  35079. handleEsc,
  35080. toggleMenu,
  35081. selectOption,
  35082. getValueKey,
  35083. navigateOptions,
  35084. dropdownMenuVisible,
  35085. showTagList,
  35086. collapseTagList,
  35087. popupScroll,
  35088. tagStyle,
  35089. collapseTagStyle,
  35090. popperRef,
  35091. inputRef,
  35092. tooltipRef,
  35093. tagTooltipRef,
  35094. prefixRef,
  35095. suffixRef,
  35096. selectRef,
  35097. wrapperRef,
  35098. selectionRef,
  35099. scrollbarRef,
  35100. menuRef,
  35101. tagMenuRef,
  35102. collapseItemRef
  35103. };
  35104. };
  35105. var ElOptions = defineComponent({
  35106. name: "ElOptions",
  35107. setup(_, { slots }) {
  35108. const select = inject(selectKey);
  35109. let cachedValueList = [];
  35110. return () => {
  35111. var _a, _b;
  35112. const children = (_a = slots.default) == null ? void 0 : _a.call(slots);
  35113. const valueList = [];
  35114. function filterOptions(children2) {
  35115. if (!isArray$1(children2))
  35116. return;
  35117. children2.forEach((item) => {
  35118. var _a2, _b2, _c, _d;
  35119. const name = (_a2 = (item == null ? void 0 : item.type) || {}) == null ? void 0 : _a2.name;
  35120. if (name === "ElOptionGroup") {
  35121. 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);
  35122. } else if (name === "ElOption") {
  35123. valueList.push((_d = item.props) == null ? void 0 : _d.value);
  35124. } else if (isArray$1(item.children)) {
  35125. filterOptions(item.children);
  35126. }
  35127. });
  35128. }
  35129. if (children.length) {
  35130. filterOptions((_b = children[0]) == null ? void 0 : _b.children);
  35131. }
  35132. if (!isEqual$1(valueList, cachedValueList)) {
  35133. cachedValueList = valueList;
  35134. if (select) {
  35135. select.states.optionValues = valueList;
  35136. }
  35137. }
  35138. return children;
  35139. };
  35140. }
  35141. });
  35142. const SelectProps$1 = buildProps({
  35143. name: String,
  35144. id: String,
  35145. modelValue: {
  35146. type: definePropType([
  35147. Array,
  35148. String,
  35149. Number,
  35150. Boolean,
  35151. Object
  35152. ]),
  35153. default: void 0
  35154. },
  35155. autocomplete: {
  35156. type: String,
  35157. default: "off"
  35158. },
  35159. automaticDropdown: Boolean,
  35160. size: useSizeProp,
  35161. effect: {
  35162. type: definePropType(String),
  35163. default: "light"
  35164. },
  35165. disabled: Boolean,
  35166. clearable: Boolean,
  35167. filterable: Boolean,
  35168. allowCreate: Boolean,
  35169. loading: Boolean,
  35170. popperClass: {
  35171. type: String,
  35172. default: ""
  35173. },
  35174. popperOptions: {
  35175. type: definePropType(Object),
  35176. default: () => ({})
  35177. },
  35178. remote: Boolean,
  35179. loadingText: String,
  35180. noMatchText: String,
  35181. noDataText: String,
  35182. remoteMethod: Function,
  35183. filterMethod: Function,
  35184. multiple: Boolean,
  35185. multipleLimit: {
  35186. type: Number,
  35187. default: 0
  35188. },
  35189. placeholder: {
  35190. type: String
  35191. },
  35192. defaultFirstOption: Boolean,
  35193. reserveKeyword: {
  35194. type: Boolean,
  35195. default: true
  35196. },
  35197. valueKey: {
  35198. type: String,
  35199. default: "value"
  35200. },
  35201. collapseTags: Boolean,
  35202. collapseTagsTooltip: Boolean,
  35203. maxCollapseTags: {
  35204. type: Number,
  35205. default: 1
  35206. },
  35207. teleported: useTooltipContentProps.teleported,
  35208. persistent: {
  35209. type: Boolean,
  35210. default: true
  35211. },
  35212. clearIcon: {
  35213. type: iconPropType,
  35214. default: circle_close_default
  35215. },
  35216. fitInputWidth: Boolean,
  35217. suffixIcon: {
  35218. type: iconPropType,
  35219. default: arrow_down_default
  35220. },
  35221. tagType: { ...tagProps.type, default: "info" },
  35222. tagEffect: { ...tagProps.effect, default: "light" },
  35223. validateEvent: {
  35224. type: Boolean,
  35225. default: true
  35226. },
  35227. remoteShowSuffix: Boolean,
  35228. showArrow: {
  35229. type: Boolean,
  35230. default: true
  35231. },
  35232. offset: {
  35233. type: Number,
  35234. default: 12
  35235. },
  35236. placement: {
  35237. type: definePropType(String),
  35238. values: Ee,
  35239. default: "bottom-start"
  35240. },
  35241. fallbackPlacements: {
  35242. type: definePropType(Array),
  35243. default: ["bottom-start", "top-start", "right", "left"]
  35244. },
  35245. tabindex: {
  35246. type: [String, Number],
  35247. default: 0
  35248. },
  35249. appendTo: String,
  35250. ...useEmptyValuesProps,
  35251. ...useAriaProps(["ariaLabel"])
  35252. });
  35253. const selectEmits$1 = {
  35254. [UPDATE_MODEL_EVENT]: (val) => true,
  35255. [CHANGE_EVENT]: (val) => true,
  35256. "popup-scroll": scrollbarEmits.scroll,
  35257. "remove-tag": (val) => true,
  35258. "visible-change": (visible) => true,
  35259. focus: (evt) => evt instanceof FocusEvent,
  35260. blur: (evt) => evt instanceof FocusEvent,
  35261. clear: () => true
  35262. };
  35263. const COMPONENT_NAME$9 = "ElSelect";
  35264. const _sfc_main$Z = defineComponent({
  35265. name: COMPONENT_NAME$9,
  35266. componentName: COMPONENT_NAME$9,
  35267. components: {
  35268. ElSelectMenu: ElSelectMenu$1,
  35269. ElOption: Option,
  35270. ElOptions,
  35271. ElTag,
  35272. ElScrollbar,
  35273. ElTooltip,
  35274. ElIcon
  35275. },
  35276. directives: { ClickOutside },
  35277. props: SelectProps$1,
  35278. emits: [
  35279. UPDATE_MODEL_EVENT,
  35280. CHANGE_EVENT,
  35281. "remove-tag",
  35282. "clear",
  35283. "visible-change",
  35284. "focus",
  35285. "blur",
  35286. "popup-scroll"
  35287. ],
  35288. setup(props, { emit }) {
  35289. const modelValue = computed(() => {
  35290. const { modelValue: rawModelValue, multiple } = props;
  35291. const fallback = multiple ? [] : void 0;
  35292. if (isArray$1(rawModelValue)) {
  35293. return multiple ? rawModelValue : fallback;
  35294. }
  35295. return multiple ? fallback : rawModelValue;
  35296. });
  35297. const _props = reactive({
  35298. ...toRefs(props),
  35299. modelValue
  35300. });
  35301. const API = useSelect$3(_props, emit);
  35302. const { calculatorRef, inputStyle } = useCalcInputWidth();
  35303. provide(selectKey, reactive({
  35304. props: _props,
  35305. states: API.states,
  35306. selectRef: API.selectRef,
  35307. optionsArray: API.optionsArray,
  35308. setSelected: API.setSelected,
  35309. handleOptionSelect: API.handleOptionSelect,
  35310. onOptionCreate: API.onOptionCreate,
  35311. onOptionDestroy: API.onOptionDestroy
  35312. }));
  35313. const selectedLabel = computed(() => {
  35314. if (!props.multiple) {
  35315. return API.states.selectedLabel;
  35316. }
  35317. return API.states.selected.map((i) => i.currentLabel);
  35318. });
  35319. return {
  35320. ...API,
  35321. modelValue,
  35322. selectedLabel,
  35323. calculatorRef,
  35324. inputStyle
  35325. };
  35326. }
  35327. });
  35328. function _sfc_render$9(_ctx, _cache) {
  35329. const _component_el_tag = resolveComponent("el-tag");
  35330. const _component_el_tooltip = resolveComponent("el-tooltip");
  35331. const _component_el_icon = resolveComponent("el-icon");
  35332. const _component_el_option = resolveComponent("el-option");
  35333. const _component_el_options = resolveComponent("el-options");
  35334. const _component_el_scrollbar = resolveComponent("el-scrollbar");
  35335. const _component_el_select_menu = resolveComponent("el-select-menu");
  35336. const _directive_click_outside = resolveDirective("click-outside");
  35337. return withDirectives((openBlock(), createElementBlock("div", {
  35338. ref: "selectRef",
  35339. class: normalizeClass([_ctx.nsSelect.b(), _ctx.nsSelect.m(_ctx.selectSize)]),
  35340. [toHandlerKey(_ctx.mouseEnterEventName)]: ($event) => _ctx.states.inputHovering = true,
  35341. onMouseleave: ($event) => _ctx.states.inputHovering = false
  35342. }, [
  35343. createVNode(_component_el_tooltip, {
  35344. ref: "tooltipRef",
  35345. visible: _ctx.dropdownMenuVisible,
  35346. placement: _ctx.placement,
  35347. teleported: _ctx.teleported,
  35348. "popper-class": [_ctx.nsSelect.e("popper"), _ctx.popperClass],
  35349. "popper-options": _ctx.popperOptions,
  35350. "fallback-placements": _ctx.fallbackPlacements,
  35351. effect: _ctx.effect,
  35352. pure: "",
  35353. trigger: "click",
  35354. transition: `${_ctx.nsSelect.namespace.value}-zoom-in-top`,
  35355. "stop-popper-mouse-event": false,
  35356. "gpu-acceleration": false,
  35357. persistent: _ctx.persistent,
  35358. "append-to": _ctx.appendTo,
  35359. "show-arrow": _ctx.showArrow,
  35360. offset: _ctx.offset,
  35361. onBeforeShow: _ctx.handleMenuEnter,
  35362. onHide: ($event) => _ctx.states.isBeforeHide = false
  35363. }, {
  35364. default: withCtx(() => {
  35365. var _a;
  35366. return [
  35367. createElementVNode("div", {
  35368. ref: "wrapperRef",
  35369. class: normalizeClass([
  35370. _ctx.nsSelect.e("wrapper"),
  35371. _ctx.nsSelect.is("focused", _ctx.isFocused),
  35372. _ctx.nsSelect.is("hovering", _ctx.states.inputHovering),
  35373. _ctx.nsSelect.is("filterable", _ctx.filterable),
  35374. _ctx.nsSelect.is("disabled", _ctx.selectDisabled)
  35375. ]),
  35376. onClick: withModifiers(_ctx.toggleMenu, ["prevent"])
  35377. }, [
  35378. _ctx.$slots.prefix ? (openBlock(), createElementBlock("div", {
  35379. key: 0,
  35380. ref: "prefixRef",
  35381. class: normalizeClass(_ctx.nsSelect.e("prefix"))
  35382. }, [
  35383. renderSlot(_ctx.$slots, "prefix")
  35384. ], 2)) : createCommentVNode("v-if", true),
  35385. createElementVNode("div", {
  35386. ref: "selectionRef",
  35387. class: normalizeClass([
  35388. _ctx.nsSelect.e("selection"),
  35389. _ctx.nsSelect.is("near", _ctx.multiple && !_ctx.$slots.prefix && !!_ctx.states.selected.length)
  35390. ])
  35391. }, [
  35392. _ctx.multiple ? renderSlot(_ctx.$slots, "tag", { key: 0 }, () => [
  35393. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.showTagList, (item) => {
  35394. return openBlock(), createElementBlock("div", {
  35395. key: _ctx.getValueKey(item),
  35396. class: normalizeClass(_ctx.nsSelect.e("selected-item"))
  35397. }, [
  35398. createVNode(_component_el_tag, {
  35399. closable: !_ctx.selectDisabled && !item.isDisabled,
  35400. size: _ctx.collapseTagSize,
  35401. type: _ctx.tagType,
  35402. effect: _ctx.tagEffect,
  35403. "disable-transitions": "",
  35404. style: normalizeStyle(_ctx.tagStyle),
  35405. onClose: ($event) => _ctx.deleteTag($event, item)
  35406. }, {
  35407. default: withCtx(() => [
  35408. createElementVNode("span", {
  35409. class: normalizeClass(_ctx.nsSelect.e("tags-text"))
  35410. }, [
  35411. renderSlot(_ctx.$slots, "label", {
  35412. label: item.currentLabel,
  35413. value: item.value
  35414. }, () => [
  35415. createTextVNode(toDisplayString(item.currentLabel), 1)
  35416. ])
  35417. ], 2)
  35418. ]),
  35419. _: 2
  35420. }, 1032, ["closable", "size", "type", "effect", "style", "onClose"])
  35421. ], 2);
  35422. }), 128)),
  35423. _ctx.collapseTags && _ctx.states.selected.length > _ctx.maxCollapseTags ? (openBlock(), createBlock(_component_el_tooltip, {
  35424. key: 0,
  35425. ref: "tagTooltipRef",
  35426. disabled: _ctx.dropdownMenuVisible || !_ctx.collapseTagsTooltip,
  35427. "fallback-placements": ["bottom", "top", "right", "left"],
  35428. effect: _ctx.effect,
  35429. placement: "bottom",
  35430. teleported: _ctx.teleported
  35431. }, {
  35432. default: withCtx(() => [
  35433. createElementVNode("div", {
  35434. ref: "collapseItemRef",
  35435. class: normalizeClass(_ctx.nsSelect.e("selected-item"))
  35436. }, [
  35437. createVNode(_component_el_tag, {
  35438. closable: false,
  35439. size: _ctx.collapseTagSize,
  35440. type: _ctx.tagType,
  35441. effect: _ctx.tagEffect,
  35442. "disable-transitions": "",
  35443. style: normalizeStyle(_ctx.collapseTagStyle)
  35444. }, {
  35445. default: withCtx(() => [
  35446. createElementVNode("span", {
  35447. class: normalizeClass(_ctx.nsSelect.e("tags-text"))
  35448. }, " + " + toDisplayString(_ctx.states.selected.length - _ctx.maxCollapseTags), 3)
  35449. ]),
  35450. _: 1
  35451. }, 8, ["size", "type", "effect", "style"])
  35452. ], 2)
  35453. ]),
  35454. content: withCtx(() => [
  35455. createElementVNode("div", {
  35456. ref: "tagMenuRef",
  35457. class: normalizeClass(_ctx.nsSelect.e("selection"))
  35458. }, [
  35459. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.collapseTagList, (item) => {
  35460. return openBlock(), createElementBlock("div", {
  35461. key: _ctx.getValueKey(item),
  35462. class: normalizeClass(_ctx.nsSelect.e("selected-item"))
  35463. }, [
  35464. createVNode(_component_el_tag, {
  35465. class: "in-tooltip",
  35466. closable: !_ctx.selectDisabled && !item.isDisabled,
  35467. size: _ctx.collapseTagSize,
  35468. type: _ctx.tagType,
  35469. effect: _ctx.tagEffect,
  35470. "disable-transitions": "",
  35471. onClose: ($event) => _ctx.deleteTag($event, item)
  35472. }, {
  35473. default: withCtx(() => [
  35474. createElementVNode("span", {
  35475. class: normalizeClass(_ctx.nsSelect.e("tags-text"))
  35476. }, [
  35477. renderSlot(_ctx.$slots, "label", {
  35478. label: item.currentLabel,
  35479. value: item.value
  35480. }, () => [
  35481. createTextVNode(toDisplayString(item.currentLabel), 1)
  35482. ])
  35483. ], 2)
  35484. ]),
  35485. _: 2
  35486. }, 1032, ["closable", "size", "type", "effect", "onClose"])
  35487. ], 2);
  35488. }), 128))
  35489. ], 2)
  35490. ]),
  35491. _: 3
  35492. }, 8, ["disabled", "effect", "teleported"])) : createCommentVNode("v-if", true)
  35493. ]) : createCommentVNode("v-if", true),
  35494. createElementVNode("div", {
  35495. class: normalizeClass([
  35496. _ctx.nsSelect.e("selected-item"),
  35497. _ctx.nsSelect.e("input-wrapper"),
  35498. _ctx.nsSelect.is("hidden", !_ctx.filterable)
  35499. ])
  35500. }, [
  35501. withDirectives(createElementVNode("input", {
  35502. id: _ctx.inputId,
  35503. ref: "inputRef",
  35504. "onUpdate:modelValue": ($event) => _ctx.states.inputValue = $event,
  35505. type: "text",
  35506. name: _ctx.name,
  35507. class: normalizeClass([_ctx.nsSelect.e("input"), _ctx.nsSelect.is(_ctx.selectSize)]),
  35508. disabled: _ctx.selectDisabled,
  35509. autocomplete: _ctx.autocomplete,
  35510. style: normalizeStyle(_ctx.inputStyle),
  35511. tabindex: _ctx.tabindex,
  35512. role: "combobox",
  35513. readonly: !_ctx.filterable,
  35514. spellcheck: "false",
  35515. "aria-activedescendant": ((_a = _ctx.hoverOption) == null ? void 0 : _a.id) || "",
  35516. "aria-controls": _ctx.contentId,
  35517. "aria-expanded": _ctx.dropdownMenuVisible,
  35518. "aria-label": _ctx.ariaLabel,
  35519. "aria-autocomplete": "none",
  35520. "aria-haspopup": "listbox",
  35521. onKeydown: [
  35522. withKeys(withModifiers(($event) => _ctx.navigateOptions("next"), ["stop", "prevent"]), ["down"]),
  35523. withKeys(withModifiers(($event) => _ctx.navigateOptions("prev"), ["stop", "prevent"]), ["up"]),
  35524. withKeys(withModifiers(_ctx.handleEsc, ["stop", "prevent"]), ["esc"]),
  35525. withKeys(withModifiers(_ctx.selectOption, ["stop", "prevent"]), ["enter"]),
  35526. withKeys(withModifiers(_ctx.deletePrevTag, ["stop"]), ["delete"])
  35527. ],
  35528. onCompositionstart: _ctx.handleCompositionStart,
  35529. onCompositionupdate: _ctx.handleCompositionUpdate,
  35530. onCompositionend: _ctx.handleCompositionEnd,
  35531. onInput: _ctx.onInput,
  35532. onClick: withModifiers(_ctx.toggleMenu, ["stop"])
  35533. }, null, 46, ["id", "onUpdate:modelValue", "name", "disabled", "autocomplete", "tabindex", "readonly", "aria-activedescendant", "aria-controls", "aria-expanded", "aria-label", "onKeydown", "onCompositionstart", "onCompositionupdate", "onCompositionend", "onInput", "onClick"]), [
  35534. [vModelText, _ctx.states.inputValue]
  35535. ]),
  35536. _ctx.filterable ? (openBlock(), createElementBlock("span", {
  35537. key: 0,
  35538. ref: "calculatorRef",
  35539. "aria-hidden": "true",
  35540. class: normalizeClass(_ctx.nsSelect.e("input-calculator")),
  35541. textContent: toDisplayString(_ctx.states.inputValue)
  35542. }, null, 10, ["textContent"])) : createCommentVNode("v-if", true)
  35543. ], 2),
  35544. _ctx.shouldShowPlaceholder ? (openBlock(), createElementBlock("div", {
  35545. key: 1,
  35546. class: normalizeClass([
  35547. _ctx.nsSelect.e("selected-item"),
  35548. _ctx.nsSelect.e("placeholder"),
  35549. _ctx.nsSelect.is("transparent", !_ctx.hasModelValue || _ctx.expanded && !_ctx.states.inputValue)
  35550. ])
  35551. }, [
  35552. _ctx.hasModelValue ? renderSlot(_ctx.$slots, "label", {
  35553. key: 0,
  35554. label: _ctx.currentPlaceholder,
  35555. value: _ctx.modelValue
  35556. }, () => [
  35557. createElementVNode("span", null, toDisplayString(_ctx.currentPlaceholder), 1)
  35558. ]) : (openBlock(), createElementBlock("span", { key: 1 }, toDisplayString(_ctx.currentPlaceholder), 1))
  35559. ], 2)) : createCommentVNode("v-if", true)
  35560. ], 2),
  35561. createElementVNode("div", {
  35562. ref: "suffixRef",
  35563. class: normalizeClass(_ctx.nsSelect.e("suffix"))
  35564. }, [
  35565. _ctx.iconComponent && !_ctx.showClose ? (openBlock(), createBlock(_component_el_icon, {
  35566. key: 0,
  35567. class: normalizeClass([_ctx.nsSelect.e("caret"), _ctx.nsSelect.e("icon"), _ctx.iconReverse])
  35568. }, {
  35569. default: withCtx(() => [
  35570. (openBlock(), createBlock(resolveDynamicComponent(_ctx.iconComponent)))
  35571. ]),
  35572. _: 1
  35573. }, 8, ["class"])) : createCommentVNode("v-if", true),
  35574. _ctx.showClose && _ctx.clearIcon ? (openBlock(), createBlock(_component_el_icon, {
  35575. key: 1,
  35576. class: normalizeClass([
  35577. _ctx.nsSelect.e("caret"),
  35578. _ctx.nsSelect.e("icon"),
  35579. _ctx.nsSelect.e("clear")
  35580. ]),
  35581. onClick: _ctx.handleClearClick
  35582. }, {
  35583. default: withCtx(() => [
  35584. (openBlock(), createBlock(resolveDynamicComponent(_ctx.clearIcon)))
  35585. ]),
  35586. _: 1
  35587. }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true),
  35588. _ctx.validateState && _ctx.validateIcon && _ctx.needStatusIcon ? (openBlock(), createBlock(_component_el_icon, {
  35589. key: 2,
  35590. class: normalizeClass([
  35591. _ctx.nsInput.e("icon"),
  35592. _ctx.nsInput.e("validateIcon"),
  35593. _ctx.nsInput.is("loading", _ctx.validateState === "validating")
  35594. ])
  35595. }, {
  35596. default: withCtx(() => [
  35597. (openBlock(), createBlock(resolveDynamicComponent(_ctx.validateIcon)))
  35598. ]),
  35599. _: 1
  35600. }, 8, ["class"])) : createCommentVNode("v-if", true)
  35601. ], 2)
  35602. ], 10, ["onClick"])
  35603. ];
  35604. }),
  35605. content: withCtx(() => [
  35606. createVNode(_component_el_select_menu, { ref: "menuRef" }, {
  35607. default: withCtx(() => [
  35608. _ctx.$slots.header ? (openBlock(), createElementBlock("div", {
  35609. key: 0,
  35610. class: normalizeClass(_ctx.nsSelect.be("dropdown", "header")),
  35611. onClick: withModifiers(() => {
  35612. }, ["stop"])
  35613. }, [
  35614. renderSlot(_ctx.$slots, "header")
  35615. ], 10, ["onClick"])) : createCommentVNode("v-if", true),
  35616. withDirectives(createVNode(_component_el_scrollbar, {
  35617. id: _ctx.contentId,
  35618. ref: "scrollbarRef",
  35619. tag: "ul",
  35620. "wrap-class": _ctx.nsSelect.be("dropdown", "wrap"),
  35621. "view-class": _ctx.nsSelect.be("dropdown", "list"),
  35622. class: normalizeClass([_ctx.nsSelect.is("empty", _ctx.filteredOptionsCount === 0)]),
  35623. role: "listbox",
  35624. "aria-label": _ctx.ariaLabel,
  35625. "aria-orientation": "vertical",
  35626. onScroll: _ctx.popupScroll
  35627. }, {
  35628. default: withCtx(() => [
  35629. _ctx.showNewOption ? (openBlock(), createBlock(_component_el_option, {
  35630. key: 0,
  35631. value: _ctx.states.inputValue,
  35632. created: true
  35633. }, null, 8, ["value"])) : createCommentVNode("v-if", true),
  35634. createVNode(_component_el_options, null, {
  35635. default: withCtx(() => [
  35636. renderSlot(_ctx.$slots, "default")
  35637. ]),
  35638. _: 3
  35639. })
  35640. ]),
  35641. _: 3
  35642. }, 8, ["id", "wrap-class", "view-class", "class", "aria-label", "onScroll"]), [
  35643. [vShow, _ctx.states.options.size > 0 && !_ctx.loading]
  35644. ]),
  35645. _ctx.$slots.loading && _ctx.loading ? (openBlock(), createElementBlock("div", {
  35646. key: 1,
  35647. class: normalizeClass(_ctx.nsSelect.be("dropdown", "loading"))
  35648. }, [
  35649. renderSlot(_ctx.$slots, "loading")
  35650. ], 2)) : _ctx.loading || _ctx.filteredOptionsCount === 0 ? (openBlock(), createElementBlock("div", {
  35651. key: 2,
  35652. class: normalizeClass(_ctx.nsSelect.be("dropdown", "empty"))
  35653. }, [
  35654. renderSlot(_ctx.$slots, "empty", {}, () => [
  35655. createElementVNode("span", null, toDisplayString(_ctx.emptyText), 1)
  35656. ])
  35657. ], 2)) : createCommentVNode("v-if", true),
  35658. _ctx.$slots.footer ? (openBlock(), createElementBlock("div", {
  35659. key: 3,
  35660. class: normalizeClass(_ctx.nsSelect.be("dropdown", "footer")),
  35661. onClick: withModifiers(() => {
  35662. }, ["stop"])
  35663. }, [
  35664. renderSlot(_ctx.$slots, "footer")
  35665. ], 10, ["onClick"])) : createCommentVNode("v-if", true)
  35666. ]),
  35667. _: 3
  35668. }, 512)
  35669. ]),
  35670. _: 3
  35671. }, 8, ["visible", "placement", "teleported", "popper-class", "popper-options", "fallback-placements", "effect", "transition", "persistent", "append-to", "show-arrow", "offset", "onBeforeShow", "onHide"])
  35672. ], 16, ["onMouseleave"])), [
  35673. [_directive_click_outside, _ctx.handleClickOutside, _ctx.popperRef]
  35674. ]);
  35675. }
  35676. var Select$1 = /* @__PURE__ */ _export_sfc(_sfc_main$Z, [["render", _sfc_render$9], ["__file", "select.vue"]]);
  35677. const _sfc_main$Y = defineComponent({
  35678. name: "ElOptionGroup",
  35679. componentName: "ElOptionGroup",
  35680. props: {
  35681. label: String,
  35682. disabled: Boolean
  35683. },
  35684. setup(props) {
  35685. const ns = useNamespace("select");
  35686. const groupRef = ref();
  35687. const instance = getCurrentInstance();
  35688. const children = ref([]);
  35689. provide(selectGroupKey, reactive({
  35690. ...toRefs(props)
  35691. }));
  35692. const visible = computed(() => children.value.some((option) => option.visible === true));
  35693. const isOption = (node) => {
  35694. var _a;
  35695. return node.type.name === "ElOption" && !!((_a = node.component) == null ? void 0 : _a.proxy);
  35696. };
  35697. const flattedChildren = (node) => {
  35698. const nodes = castArray$1(node);
  35699. const children2 = [];
  35700. nodes.forEach((child) => {
  35701. var _a;
  35702. if (!isVNode(child))
  35703. return;
  35704. if (isOption(child)) {
  35705. children2.push(child.component.proxy);
  35706. } else if (isArray$1(child.children) && child.children.length) {
  35707. children2.push(...flattedChildren(child.children));
  35708. } else if ((_a = child.component) == null ? void 0 : _a.subTree) {
  35709. children2.push(...flattedChildren(child.component.subTree));
  35710. }
  35711. });
  35712. return children2;
  35713. };
  35714. const updateChildren = () => {
  35715. children.value = flattedChildren(instance.subTree);
  35716. };
  35717. onMounted(() => {
  35718. updateChildren();
  35719. });
  35720. useMutationObserver(groupRef, updateChildren, {
  35721. attributes: true,
  35722. subtree: true,
  35723. childList: true
  35724. });
  35725. return {
  35726. groupRef,
  35727. visible,
  35728. ns
  35729. };
  35730. }
  35731. });
  35732. function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) {
  35733. return withDirectives((openBlock(), createElementBlock("ul", {
  35734. ref: "groupRef",
  35735. class: normalizeClass(_ctx.ns.be("group", "wrap"))
  35736. }, [
  35737. createElementVNode("li", {
  35738. class: normalizeClass(_ctx.ns.be("group", "title"))
  35739. }, toDisplayString(_ctx.label), 3),
  35740. createElementVNode("li", null, [
  35741. createElementVNode("ul", {
  35742. class: normalizeClass(_ctx.ns.b("group"))
  35743. }, [
  35744. renderSlot(_ctx.$slots, "default")
  35745. ], 2)
  35746. ])
  35747. ], 2)), [
  35748. [vShow, _ctx.visible]
  35749. ]);
  35750. }
  35751. var OptionGroup = /* @__PURE__ */ _export_sfc(_sfc_main$Y, [["render", _sfc_render$8], ["__file", "option-group.vue"]]);
  35752. const ElSelect = withInstall(Select$1, {
  35753. Option,
  35754. OptionGroup
  35755. });
  35756. const ElOption = withNoopInstall(Option);
  35757. const ElOptionGroup = withNoopInstall(OptionGroup);
  35758. const usePagination = () => inject(elPaginationKey, {});
  35759. const paginationSizesProps = buildProps({
  35760. pageSize: {
  35761. type: Number,
  35762. required: true
  35763. },
  35764. pageSizes: {
  35765. type: definePropType(Array),
  35766. default: () => mutable([10, 20, 30, 40, 50, 100])
  35767. },
  35768. popperClass: {
  35769. type: String
  35770. },
  35771. disabled: Boolean,
  35772. teleported: Boolean,
  35773. size: {
  35774. type: String,
  35775. values: componentSizes
  35776. },
  35777. appendSizeTo: String
  35778. });
  35779. const __default__$N = defineComponent({
  35780. name: "ElPaginationSizes"
  35781. });
  35782. const _sfc_main$X = /* @__PURE__ */ defineComponent({
  35783. ...__default__$N,
  35784. props: paginationSizesProps,
  35785. emits: ["page-size-change"],
  35786. setup(__props, { emit }) {
  35787. const props = __props;
  35788. const { t } = useLocale();
  35789. const ns = useNamespace("pagination");
  35790. const pagination = usePagination();
  35791. const innerPageSize = ref(props.pageSize);
  35792. watch(() => props.pageSizes, (newVal, oldVal) => {
  35793. if (isEqual$1(newVal, oldVal))
  35794. return;
  35795. if (isArray$1(newVal)) {
  35796. const pageSize = newVal.includes(props.pageSize) ? props.pageSize : props.pageSizes[0];
  35797. emit("page-size-change", pageSize);
  35798. }
  35799. });
  35800. watch(() => props.pageSize, (newVal) => {
  35801. innerPageSize.value = newVal;
  35802. });
  35803. const innerPageSizes = computed(() => props.pageSizes);
  35804. function handleChange(val) {
  35805. var _a;
  35806. if (val !== innerPageSize.value) {
  35807. innerPageSize.value = val;
  35808. (_a = pagination.handleSizeChange) == null ? void 0 : _a.call(pagination, Number(val));
  35809. }
  35810. }
  35811. return (_ctx, _cache) => {
  35812. return openBlock(), createElementBlock("span", {
  35813. class: normalizeClass(unref(ns).e("sizes"))
  35814. }, [
  35815. createVNode(unref(ElSelect), {
  35816. "model-value": innerPageSize.value,
  35817. disabled: _ctx.disabled,
  35818. "popper-class": _ctx.popperClass,
  35819. size: _ctx.size,
  35820. teleported: _ctx.teleported,
  35821. "validate-event": false,
  35822. "append-to": _ctx.appendSizeTo,
  35823. onChange: handleChange
  35824. }, {
  35825. default: withCtx(() => [
  35826. (openBlock(true), createElementBlock(Fragment, null, renderList(unref(innerPageSizes), (item) => {
  35827. return openBlock(), createBlock(unref(ElOption), {
  35828. key: item,
  35829. value: item,
  35830. label: item + unref(t)("el.pagination.pagesize")
  35831. }, null, 8, ["value", "label"]);
  35832. }), 128))
  35833. ]),
  35834. _: 1
  35835. }, 8, ["model-value", "disabled", "popper-class", "size", "teleported", "append-to"])
  35836. ], 2);
  35837. };
  35838. }
  35839. });
  35840. var Sizes = /* @__PURE__ */ _export_sfc(_sfc_main$X, [["__file", "sizes.vue"]]);
  35841. const paginationJumperProps = buildProps({
  35842. size: {
  35843. type: String,
  35844. values: componentSizes
  35845. }
  35846. });
  35847. const __default__$M = defineComponent({
  35848. name: "ElPaginationJumper"
  35849. });
  35850. const _sfc_main$W = /* @__PURE__ */ defineComponent({
  35851. ...__default__$M,
  35852. props: paginationJumperProps,
  35853. setup(__props) {
  35854. const { t } = useLocale();
  35855. const ns = useNamespace("pagination");
  35856. const { pageCount, disabled, currentPage, changeEvent } = usePagination();
  35857. const userInput = ref();
  35858. const innerValue = computed(() => {
  35859. var _a;
  35860. return (_a = userInput.value) != null ? _a : currentPage == null ? void 0 : currentPage.value;
  35861. });
  35862. function handleInput(val) {
  35863. userInput.value = val ? +val : "";
  35864. }
  35865. function handleChange(val) {
  35866. val = Math.trunc(+val);
  35867. changeEvent == null ? void 0 : changeEvent(val);
  35868. userInput.value = void 0;
  35869. }
  35870. return (_ctx, _cache) => {
  35871. return openBlock(), createElementBlock("span", {
  35872. class: normalizeClass(unref(ns).e("jump")),
  35873. disabled: unref(disabled)
  35874. }, [
  35875. createElementVNode("span", {
  35876. class: normalizeClass([unref(ns).e("goto")])
  35877. }, toDisplayString(unref(t)("el.pagination.goto")), 3),
  35878. createVNode(unref(ElInput), {
  35879. size: _ctx.size,
  35880. class: normalizeClass([unref(ns).e("editor"), unref(ns).is("in-pagination")]),
  35881. min: 1,
  35882. max: unref(pageCount),
  35883. disabled: unref(disabled),
  35884. "model-value": unref(innerValue),
  35885. "validate-event": false,
  35886. "aria-label": unref(t)("el.pagination.page"),
  35887. type: "number",
  35888. "onUpdate:modelValue": handleInput,
  35889. onChange: handleChange
  35890. }, null, 8, ["size", "class", "max", "disabled", "model-value", "aria-label"]),
  35891. createElementVNode("span", {
  35892. class: normalizeClass([unref(ns).e("classifier")])
  35893. }, toDisplayString(unref(t)("el.pagination.pageClassifier")), 3)
  35894. ], 10, ["disabled"]);
  35895. };
  35896. }
  35897. });
  35898. var Jumper = /* @__PURE__ */ _export_sfc(_sfc_main$W, [["__file", "jumper.vue"]]);
  35899. const paginationTotalProps = buildProps({
  35900. total: {
  35901. type: Number,
  35902. default: 1e3
  35903. }
  35904. });
  35905. const __default__$L = defineComponent({
  35906. name: "ElPaginationTotal"
  35907. });
  35908. const _sfc_main$V = /* @__PURE__ */ defineComponent({
  35909. ...__default__$L,
  35910. props: paginationTotalProps,
  35911. setup(__props) {
  35912. const { t } = useLocale();
  35913. const ns = useNamespace("pagination");
  35914. const { disabled } = usePagination();
  35915. return (_ctx, _cache) => {
  35916. return openBlock(), createElementBlock("span", {
  35917. class: normalizeClass(unref(ns).e("total")),
  35918. disabled: unref(disabled)
  35919. }, toDisplayString(unref(t)("el.pagination.total", {
  35920. total: _ctx.total
  35921. })), 11, ["disabled"]);
  35922. };
  35923. }
  35924. });
  35925. var Total = /* @__PURE__ */ _export_sfc(_sfc_main$V, [["__file", "total.vue"]]);
  35926. const paginationPagerProps = buildProps({
  35927. currentPage: {
  35928. type: Number,
  35929. default: 1
  35930. },
  35931. pageCount: {
  35932. type: Number,
  35933. required: true
  35934. },
  35935. pagerCount: {
  35936. type: Number,
  35937. default: 7
  35938. },
  35939. disabled: Boolean
  35940. });
  35941. const __default__$K = defineComponent({
  35942. name: "ElPaginationPager"
  35943. });
  35944. const _sfc_main$U = /* @__PURE__ */ defineComponent({
  35945. ...__default__$K,
  35946. props: paginationPagerProps,
  35947. emits: [CHANGE_EVENT],
  35948. setup(__props, { emit }) {
  35949. const props = __props;
  35950. const nsPager = useNamespace("pager");
  35951. const nsIcon = useNamespace("icon");
  35952. const { t } = useLocale();
  35953. const showPrevMore = ref(false);
  35954. const showNextMore = ref(false);
  35955. const quickPrevHover = ref(false);
  35956. const quickNextHover = ref(false);
  35957. const quickPrevFocus = ref(false);
  35958. const quickNextFocus = ref(false);
  35959. const pagers = computed(() => {
  35960. const pagerCount = props.pagerCount;
  35961. const halfPagerCount = (pagerCount - 1) / 2;
  35962. const currentPage = Number(props.currentPage);
  35963. const pageCount = Number(props.pageCount);
  35964. let showPrevMore2 = false;
  35965. let showNextMore2 = false;
  35966. if (pageCount > pagerCount) {
  35967. if (currentPage > pagerCount - halfPagerCount) {
  35968. showPrevMore2 = true;
  35969. }
  35970. if (currentPage < pageCount - halfPagerCount) {
  35971. showNextMore2 = true;
  35972. }
  35973. }
  35974. const array = [];
  35975. if (showPrevMore2 && !showNextMore2) {
  35976. const startPage = pageCount - (pagerCount - 2);
  35977. for (let i = startPage; i < pageCount; i++) {
  35978. array.push(i);
  35979. }
  35980. } else if (!showPrevMore2 && showNextMore2) {
  35981. for (let i = 2; i < pagerCount; i++) {
  35982. array.push(i);
  35983. }
  35984. } else if (showPrevMore2 && showNextMore2) {
  35985. const offset = Math.floor(pagerCount / 2) - 1;
  35986. for (let i = currentPage - offset; i <= currentPage + offset; i++) {
  35987. array.push(i);
  35988. }
  35989. } else {
  35990. for (let i = 2; i < pageCount; i++) {
  35991. array.push(i);
  35992. }
  35993. }
  35994. return array;
  35995. });
  35996. const prevMoreKls = computed(() => [
  35997. "more",
  35998. "btn-quickprev",
  35999. nsIcon.b(),
  36000. nsPager.is("disabled", props.disabled)
  36001. ]);
  36002. const nextMoreKls = computed(() => [
  36003. "more",
  36004. "btn-quicknext",
  36005. nsIcon.b(),
  36006. nsPager.is("disabled", props.disabled)
  36007. ]);
  36008. const tabindex = computed(() => props.disabled ? -1 : 0);
  36009. watchEffect(() => {
  36010. const halfPagerCount = (props.pagerCount - 1) / 2;
  36011. showPrevMore.value = false;
  36012. showNextMore.value = false;
  36013. if (props.pageCount > props.pagerCount) {
  36014. if (props.currentPage > props.pagerCount - halfPagerCount) {
  36015. showPrevMore.value = true;
  36016. }
  36017. if (props.currentPage < props.pageCount - halfPagerCount) {
  36018. showNextMore.value = true;
  36019. }
  36020. }
  36021. });
  36022. function onMouseEnter(forward = false) {
  36023. if (props.disabled)
  36024. return;
  36025. if (forward) {
  36026. quickPrevHover.value = true;
  36027. } else {
  36028. quickNextHover.value = true;
  36029. }
  36030. }
  36031. function onFocus(forward = false) {
  36032. if (forward) {
  36033. quickPrevFocus.value = true;
  36034. } else {
  36035. quickNextFocus.value = true;
  36036. }
  36037. }
  36038. function onEnter(e) {
  36039. const target = e.target;
  36040. if (target.tagName.toLowerCase() === "li" && Array.from(target.classList).includes("number")) {
  36041. const newPage = Number(target.textContent);
  36042. if (newPage !== props.currentPage) {
  36043. emit(CHANGE_EVENT, newPage);
  36044. }
  36045. } else if (target.tagName.toLowerCase() === "li" && Array.from(target.classList).includes("more")) {
  36046. onPagerClick(e);
  36047. }
  36048. }
  36049. function onPagerClick(event) {
  36050. const target = event.target;
  36051. if (target.tagName.toLowerCase() === "ul" || props.disabled) {
  36052. return;
  36053. }
  36054. let newPage = Number(target.textContent);
  36055. const pageCount = props.pageCount;
  36056. const currentPage = props.currentPage;
  36057. const pagerCountOffset = props.pagerCount - 2;
  36058. if (target.className.includes("more")) {
  36059. if (target.className.includes("quickprev")) {
  36060. newPage = currentPage - pagerCountOffset;
  36061. } else if (target.className.includes("quicknext")) {
  36062. newPage = currentPage + pagerCountOffset;
  36063. }
  36064. }
  36065. if (!Number.isNaN(+newPage)) {
  36066. if (newPage < 1) {
  36067. newPage = 1;
  36068. }
  36069. if (newPage > pageCount) {
  36070. newPage = pageCount;
  36071. }
  36072. }
  36073. if (newPage !== currentPage) {
  36074. emit(CHANGE_EVENT, newPage);
  36075. }
  36076. }
  36077. return (_ctx, _cache) => {
  36078. return openBlock(), createElementBlock("ul", {
  36079. class: normalizeClass(unref(nsPager).b()),
  36080. onClick: onPagerClick,
  36081. onKeyup: withKeys(onEnter, ["enter"])
  36082. }, [
  36083. _ctx.pageCount > 0 ? (openBlock(), createElementBlock("li", {
  36084. key: 0,
  36085. class: normalizeClass([[
  36086. unref(nsPager).is("active", _ctx.currentPage === 1),
  36087. unref(nsPager).is("disabled", _ctx.disabled)
  36088. ], "number"]),
  36089. "aria-current": _ctx.currentPage === 1,
  36090. "aria-label": unref(t)("el.pagination.currentPage", { pager: 1 }),
  36091. tabindex: unref(tabindex)
  36092. }, " 1 ", 10, ["aria-current", "aria-label", "tabindex"])) : createCommentVNode("v-if", true),
  36093. showPrevMore.value ? (openBlock(), createElementBlock("li", {
  36094. key: 1,
  36095. class: normalizeClass(unref(prevMoreKls)),
  36096. tabindex: unref(tabindex),
  36097. "aria-label": unref(t)("el.pagination.prevPages", { pager: _ctx.pagerCount - 2 }),
  36098. onMouseenter: ($event) => onMouseEnter(true),
  36099. onMouseleave: ($event) => quickPrevHover.value = false,
  36100. onFocus: ($event) => onFocus(true),
  36101. onBlur: ($event) => quickPrevFocus.value = false
  36102. }, [
  36103. (quickPrevHover.value || quickPrevFocus.value) && !_ctx.disabled ? (openBlock(), createBlock(unref(d_arrow_left_default), { key: 0 })) : (openBlock(), createBlock(unref(more_filled_default), { key: 1 }))
  36104. ], 42, ["tabindex", "aria-label", "onMouseenter", "onMouseleave", "onFocus", "onBlur"])) : createCommentVNode("v-if", true),
  36105. (openBlock(true), createElementBlock(Fragment, null, renderList(unref(pagers), (pager) => {
  36106. return openBlock(), createElementBlock("li", {
  36107. key: pager,
  36108. class: normalizeClass([[
  36109. unref(nsPager).is("active", _ctx.currentPage === pager),
  36110. unref(nsPager).is("disabled", _ctx.disabled)
  36111. ], "number"]),
  36112. "aria-current": _ctx.currentPage === pager,
  36113. "aria-label": unref(t)("el.pagination.currentPage", { pager }),
  36114. tabindex: unref(tabindex)
  36115. }, toDisplayString(pager), 11, ["aria-current", "aria-label", "tabindex"]);
  36116. }), 128)),
  36117. showNextMore.value ? (openBlock(), createElementBlock("li", {
  36118. key: 2,
  36119. class: normalizeClass(unref(nextMoreKls)),
  36120. tabindex: unref(tabindex),
  36121. "aria-label": unref(t)("el.pagination.nextPages", { pager: _ctx.pagerCount - 2 }),
  36122. onMouseenter: ($event) => onMouseEnter(),
  36123. onMouseleave: ($event) => quickNextHover.value = false,
  36124. onFocus: ($event) => onFocus(),
  36125. onBlur: ($event) => quickNextFocus.value = false
  36126. }, [
  36127. (quickNextHover.value || quickNextFocus.value) && !_ctx.disabled ? (openBlock(), createBlock(unref(d_arrow_right_default), { key: 0 })) : (openBlock(), createBlock(unref(more_filled_default), { key: 1 }))
  36128. ], 42, ["tabindex", "aria-label", "onMouseenter", "onMouseleave", "onFocus", "onBlur"])) : createCommentVNode("v-if", true),
  36129. _ctx.pageCount > 1 ? (openBlock(), createElementBlock("li", {
  36130. key: 3,
  36131. class: normalizeClass([[
  36132. unref(nsPager).is("active", _ctx.currentPage === _ctx.pageCount),
  36133. unref(nsPager).is("disabled", _ctx.disabled)
  36134. ], "number"]),
  36135. "aria-current": _ctx.currentPage === _ctx.pageCount,
  36136. "aria-label": unref(t)("el.pagination.currentPage", { pager: _ctx.pageCount }),
  36137. tabindex: unref(tabindex)
  36138. }, toDisplayString(_ctx.pageCount), 11, ["aria-current", "aria-label", "tabindex"])) : createCommentVNode("v-if", true)
  36139. ], 42, ["onKeyup"]);
  36140. };
  36141. }
  36142. });
  36143. var Pager = /* @__PURE__ */ _export_sfc(_sfc_main$U, [["__file", "pager.vue"]]);
  36144. const isAbsent = (v) => typeof v !== "number";
  36145. const paginationProps = buildProps({
  36146. pageSize: Number,
  36147. defaultPageSize: Number,
  36148. total: Number,
  36149. pageCount: Number,
  36150. pagerCount: {
  36151. type: Number,
  36152. validator: (value) => {
  36153. return isNumber(value) && Math.trunc(value) === value && value > 4 && value < 22 && value % 2 === 1;
  36154. },
  36155. default: 7
  36156. },
  36157. currentPage: Number,
  36158. defaultCurrentPage: Number,
  36159. layout: {
  36160. type: String,
  36161. default: ["prev", "pager", "next", "jumper", "->", "total"].join(", ")
  36162. },
  36163. pageSizes: {
  36164. type: definePropType(Array),
  36165. default: () => mutable([10, 20, 30, 40, 50, 100])
  36166. },
  36167. popperClass: {
  36168. type: String,
  36169. default: ""
  36170. },
  36171. prevText: {
  36172. type: String,
  36173. default: ""
  36174. },
  36175. prevIcon: {
  36176. type: iconPropType,
  36177. default: () => arrow_left_default
  36178. },
  36179. nextText: {
  36180. type: String,
  36181. default: ""
  36182. },
  36183. nextIcon: {
  36184. type: iconPropType,
  36185. default: () => arrow_right_default
  36186. },
  36187. teleported: {
  36188. type: Boolean,
  36189. default: true
  36190. },
  36191. small: Boolean,
  36192. size: useSizeProp,
  36193. background: Boolean,
  36194. disabled: Boolean,
  36195. hideOnSinglePage: Boolean,
  36196. appendSizeTo: String
  36197. });
  36198. const paginationEmits = {
  36199. "update:current-page": (val) => isNumber(val),
  36200. "update:page-size": (val) => isNumber(val),
  36201. "size-change": (val) => isNumber(val),
  36202. change: (currentPage, pageSize) => isNumber(currentPage) && isNumber(pageSize),
  36203. "current-change": (val) => isNumber(val),
  36204. "prev-click": (val) => isNumber(val),
  36205. "next-click": (val) => isNumber(val)
  36206. };
  36207. const componentName = "ElPagination";
  36208. var Pagination = defineComponent({
  36209. name: componentName,
  36210. props: paginationProps,
  36211. emits: paginationEmits,
  36212. setup(props, { emit, slots }) {
  36213. const { t } = useLocale();
  36214. const ns = useNamespace("pagination");
  36215. const vnodeProps = getCurrentInstance().vnode.props || {};
  36216. const _globalSize = useGlobalSize();
  36217. const _size = computed(() => {
  36218. var _a;
  36219. return props.small ? "small" : (_a = props.size) != null ? _a : _globalSize.value;
  36220. });
  36221. useDeprecated({
  36222. from: "small",
  36223. replacement: "size",
  36224. version: "3.0.0",
  36225. scope: "el-pagination",
  36226. ref: "https://element-plus.org/zh-CN/component/pagination.html"
  36227. }, computed(() => !!props.small));
  36228. const hasCurrentPageListener = "onUpdate:currentPage" in vnodeProps || "onUpdate:current-page" in vnodeProps || "onCurrentChange" in vnodeProps;
  36229. const hasPageSizeListener = "onUpdate:pageSize" in vnodeProps || "onUpdate:page-size" in vnodeProps || "onSizeChange" in vnodeProps;
  36230. const assertValidUsage = computed(() => {
  36231. if (isAbsent(props.total) && isAbsent(props.pageCount))
  36232. return false;
  36233. if (!isAbsent(props.currentPage) && !hasCurrentPageListener)
  36234. return false;
  36235. if (props.layout.includes("sizes")) {
  36236. if (!isAbsent(props.pageCount)) {
  36237. if (!hasPageSizeListener)
  36238. return false;
  36239. } else if (!isAbsent(props.total)) {
  36240. if (!isAbsent(props.pageSize)) {
  36241. if (!hasPageSizeListener) {
  36242. return false;
  36243. }
  36244. }
  36245. }
  36246. }
  36247. return true;
  36248. });
  36249. const innerPageSize = ref(isAbsent(props.defaultPageSize) ? 10 : props.defaultPageSize);
  36250. const innerCurrentPage = ref(isAbsent(props.defaultCurrentPage) ? 1 : props.defaultCurrentPage);
  36251. const pageSizeBridge = computed({
  36252. get() {
  36253. return isAbsent(props.pageSize) ? innerPageSize.value : props.pageSize;
  36254. },
  36255. set(v) {
  36256. if (isAbsent(props.pageSize)) {
  36257. innerPageSize.value = v;
  36258. }
  36259. if (hasPageSizeListener) {
  36260. emit("update:page-size", v);
  36261. emit("size-change", v);
  36262. }
  36263. }
  36264. });
  36265. const pageCountBridge = computed(() => {
  36266. let pageCount = 0;
  36267. if (!isAbsent(props.pageCount)) {
  36268. pageCount = props.pageCount;
  36269. } else if (!isAbsent(props.total)) {
  36270. pageCount = Math.max(1, Math.ceil(props.total / pageSizeBridge.value));
  36271. }
  36272. return pageCount;
  36273. });
  36274. const currentPageBridge = computed({
  36275. get() {
  36276. return isAbsent(props.currentPage) ? innerCurrentPage.value : props.currentPage;
  36277. },
  36278. set(v) {
  36279. let newCurrentPage = v;
  36280. if (v < 1) {
  36281. newCurrentPage = 1;
  36282. } else if (v > pageCountBridge.value) {
  36283. newCurrentPage = pageCountBridge.value;
  36284. }
  36285. if (isAbsent(props.currentPage)) {
  36286. innerCurrentPage.value = newCurrentPage;
  36287. }
  36288. if (hasCurrentPageListener) {
  36289. emit("update:current-page", newCurrentPage);
  36290. emit("current-change", newCurrentPage);
  36291. }
  36292. }
  36293. });
  36294. watch(pageCountBridge, (val) => {
  36295. if (currentPageBridge.value > val)
  36296. currentPageBridge.value = val;
  36297. });
  36298. watch([currentPageBridge, pageSizeBridge], (value) => {
  36299. emit(CHANGE_EVENT, ...value);
  36300. }, { flush: "post" });
  36301. function handleCurrentChange(val) {
  36302. currentPageBridge.value = val;
  36303. }
  36304. function handleSizeChange(val) {
  36305. pageSizeBridge.value = val;
  36306. const newPageCount = pageCountBridge.value;
  36307. if (currentPageBridge.value > newPageCount) {
  36308. currentPageBridge.value = newPageCount;
  36309. }
  36310. }
  36311. function prev() {
  36312. if (props.disabled)
  36313. return;
  36314. currentPageBridge.value -= 1;
  36315. emit("prev-click", currentPageBridge.value);
  36316. }
  36317. function next() {
  36318. if (props.disabled)
  36319. return;
  36320. currentPageBridge.value += 1;
  36321. emit("next-click", currentPageBridge.value);
  36322. }
  36323. function addClass(element, cls) {
  36324. if (element) {
  36325. if (!element.props) {
  36326. element.props = {};
  36327. }
  36328. element.props.class = [element.props.class, cls].join(" ");
  36329. }
  36330. }
  36331. provide(elPaginationKey, {
  36332. pageCount: pageCountBridge,
  36333. disabled: computed(() => props.disabled),
  36334. currentPage: currentPageBridge,
  36335. changeEvent: handleCurrentChange,
  36336. handleSizeChange
  36337. });
  36338. return () => {
  36339. var _a, _b;
  36340. if (!assertValidUsage.value) {
  36341. debugWarn(componentName, t("el.pagination.deprecationWarning"));
  36342. return null;
  36343. }
  36344. if (!props.layout)
  36345. return null;
  36346. if (props.hideOnSinglePage && pageCountBridge.value <= 1)
  36347. return null;
  36348. const rootChildren = [];
  36349. const rightWrapperChildren = [];
  36350. const rightWrapperRoot = h$1("div", { class: ns.e("rightwrapper") }, rightWrapperChildren);
  36351. const TEMPLATE_MAP = {
  36352. prev: h$1(Prev, {
  36353. disabled: props.disabled,
  36354. currentPage: currentPageBridge.value,
  36355. prevText: props.prevText,
  36356. prevIcon: props.prevIcon,
  36357. onClick: prev
  36358. }),
  36359. jumper: h$1(Jumper, {
  36360. size: _size.value
  36361. }),
  36362. pager: h$1(Pager, {
  36363. currentPage: currentPageBridge.value,
  36364. pageCount: pageCountBridge.value,
  36365. pagerCount: props.pagerCount,
  36366. onChange: handleCurrentChange,
  36367. disabled: props.disabled
  36368. }),
  36369. next: h$1(Next, {
  36370. disabled: props.disabled,
  36371. currentPage: currentPageBridge.value,
  36372. pageCount: pageCountBridge.value,
  36373. nextText: props.nextText,
  36374. nextIcon: props.nextIcon,
  36375. onClick: next
  36376. }),
  36377. sizes: h$1(Sizes, {
  36378. pageSize: pageSizeBridge.value,
  36379. pageSizes: props.pageSizes,
  36380. popperClass: props.popperClass,
  36381. disabled: props.disabled,
  36382. teleported: props.teleported,
  36383. size: _size.value,
  36384. appendSizeTo: props.appendSizeTo
  36385. }),
  36386. slot: (_b = (_a = slots == null ? void 0 : slots.default) == null ? void 0 : _a.call(slots)) != null ? _b : null,
  36387. total: h$1(Total, { total: isAbsent(props.total) ? 0 : props.total })
  36388. };
  36389. const components = props.layout.split(",").map((item) => item.trim());
  36390. let haveRightWrapper = false;
  36391. components.forEach((c) => {
  36392. if (c === "->") {
  36393. haveRightWrapper = true;
  36394. return;
  36395. }
  36396. if (!haveRightWrapper) {
  36397. rootChildren.push(TEMPLATE_MAP[c]);
  36398. } else {
  36399. rightWrapperChildren.push(TEMPLATE_MAP[c]);
  36400. }
  36401. });
  36402. addClass(rootChildren[0], ns.is("first"));
  36403. addClass(rootChildren[rootChildren.length - 1], ns.is("last"));
  36404. if (haveRightWrapper && rightWrapperChildren.length > 0) {
  36405. addClass(rightWrapperChildren[0], ns.is("first"));
  36406. addClass(rightWrapperChildren[rightWrapperChildren.length - 1], ns.is("last"));
  36407. rootChildren.push(rightWrapperRoot);
  36408. }
  36409. return h$1("div", {
  36410. class: [
  36411. ns.b(),
  36412. ns.is("background", props.background),
  36413. ns.m(_size.value)
  36414. ]
  36415. }, rootChildren);
  36416. };
  36417. }
  36418. });
  36419. const ElPagination = withInstall(Pagination);
  36420. const popconfirmProps = buildProps({
  36421. title: String,
  36422. confirmButtonText: String,
  36423. cancelButtonText: String,
  36424. confirmButtonType: {
  36425. type: String,
  36426. values: buttonTypes,
  36427. default: "primary"
  36428. },
  36429. cancelButtonType: {
  36430. type: String,
  36431. values: buttonTypes,
  36432. default: "text"
  36433. },
  36434. icon: {
  36435. type: iconPropType,
  36436. default: () => question_filled_default
  36437. },
  36438. iconColor: {
  36439. type: String,
  36440. default: "#f90"
  36441. },
  36442. hideIcon: {
  36443. type: Boolean,
  36444. default: false
  36445. },
  36446. hideAfter: {
  36447. type: Number,
  36448. default: 200
  36449. },
  36450. teleported: useTooltipContentProps.teleported,
  36451. persistent: useTooltipContentProps.persistent,
  36452. width: {
  36453. type: [String, Number],
  36454. default: 150
  36455. }
  36456. });
  36457. const popconfirmEmits = {
  36458. confirm: (e) => e instanceof MouseEvent,
  36459. cancel: (e) => e instanceof MouseEvent
  36460. };
  36461. const __default__$J = defineComponent({
  36462. name: "ElPopconfirm"
  36463. });
  36464. const _sfc_main$T = /* @__PURE__ */ defineComponent({
  36465. ...__default__$J,
  36466. props: popconfirmProps,
  36467. emits: popconfirmEmits,
  36468. setup(__props, { emit }) {
  36469. const props = __props;
  36470. const { t } = useLocale();
  36471. const ns = useNamespace("popconfirm");
  36472. const tooltipRef = ref();
  36473. const hidePopper = () => {
  36474. var _a, _b;
  36475. (_b = (_a = tooltipRef.value) == null ? void 0 : _a.onClose) == null ? void 0 : _b.call(_a);
  36476. };
  36477. const style = computed(() => {
  36478. return {
  36479. width: addUnit(props.width)
  36480. };
  36481. });
  36482. const confirm = (e) => {
  36483. emit("confirm", e);
  36484. hidePopper();
  36485. };
  36486. const cancel = (e) => {
  36487. emit("cancel", e);
  36488. hidePopper();
  36489. };
  36490. const finalConfirmButtonText = computed(() => props.confirmButtonText || t("el.popconfirm.confirmButtonText"));
  36491. const finalCancelButtonText = computed(() => props.cancelButtonText || t("el.popconfirm.cancelButtonText"));
  36492. return (_ctx, _cache) => {
  36493. return openBlock(), createBlock(unref(ElTooltip), mergeProps({
  36494. ref_key: "tooltipRef",
  36495. ref: tooltipRef,
  36496. trigger: "click",
  36497. effect: "light"
  36498. }, _ctx.$attrs, {
  36499. "popper-class": `${unref(ns).namespace.value}-popover`,
  36500. "popper-style": unref(style),
  36501. teleported: _ctx.teleported,
  36502. "fallback-placements": ["bottom", "top", "right", "left"],
  36503. "hide-after": _ctx.hideAfter,
  36504. persistent: _ctx.persistent
  36505. }), {
  36506. content: withCtx(() => [
  36507. createElementVNode("div", {
  36508. class: normalizeClass(unref(ns).b())
  36509. }, [
  36510. createElementVNode("div", {
  36511. class: normalizeClass(unref(ns).e("main"))
  36512. }, [
  36513. !_ctx.hideIcon && _ctx.icon ? (openBlock(), createBlock(unref(ElIcon), {
  36514. key: 0,
  36515. class: normalizeClass(unref(ns).e("icon")),
  36516. style: normalizeStyle({ color: _ctx.iconColor })
  36517. }, {
  36518. default: withCtx(() => [
  36519. (openBlock(), createBlock(resolveDynamicComponent(_ctx.icon)))
  36520. ]),
  36521. _: 1
  36522. }, 8, ["class", "style"])) : createCommentVNode("v-if", true),
  36523. createTextVNode(" " + toDisplayString(_ctx.title), 1)
  36524. ], 2),
  36525. createElementVNode("div", {
  36526. class: normalizeClass(unref(ns).e("action"))
  36527. }, [
  36528. renderSlot(_ctx.$slots, "actions", {
  36529. confirm,
  36530. cancel
  36531. }, () => [
  36532. createVNode(unref(ElButton), {
  36533. size: "small",
  36534. type: _ctx.cancelButtonType === "text" ? "" : _ctx.cancelButtonType,
  36535. text: _ctx.cancelButtonType === "text",
  36536. onClick: cancel
  36537. }, {
  36538. default: withCtx(() => [
  36539. createTextVNode(toDisplayString(unref(finalCancelButtonText)), 1)
  36540. ]),
  36541. _: 1
  36542. }, 8, ["type", "text"]),
  36543. createVNode(unref(ElButton), {
  36544. size: "small",
  36545. type: _ctx.confirmButtonType === "text" ? "" : _ctx.confirmButtonType,
  36546. text: _ctx.confirmButtonType === "text",
  36547. onClick: confirm
  36548. }, {
  36549. default: withCtx(() => [
  36550. createTextVNode(toDisplayString(unref(finalConfirmButtonText)), 1)
  36551. ]),
  36552. _: 1
  36553. }, 8, ["type", "text"])
  36554. ])
  36555. ], 2)
  36556. ], 2)
  36557. ]),
  36558. default: withCtx(() => [
  36559. _ctx.$slots.reference ? renderSlot(_ctx.$slots, "reference", { key: 0 }) : createCommentVNode("v-if", true)
  36560. ]),
  36561. _: 3
  36562. }, 16, ["popper-class", "popper-style", "teleported", "hide-after", "persistent"]);
  36563. };
  36564. }
  36565. });
  36566. var Popconfirm = /* @__PURE__ */ _export_sfc(_sfc_main$T, [["__file", "popconfirm.vue"]]);
  36567. const ElPopconfirm = withInstall(Popconfirm);
  36568. const popoverProps = buildProps({
  36569. trigger: useTooltipTriggerProps.trigger,
  36570. triggerKeys: useTooltipTriggerProps.triggerKeys,
  36571. placement: dropdownProps.placement,
  36572. disabled: useTooltipTriggerProps.disabled,
  36573. visible: useTooltipContentProps.visible,
  36574. transition: useTooltipContentProps.transition,
  36575. popperOptions: dropdownProps.popperOptions,
  36576. tabindex: dropdownProps.tabindex,
  36577. content: useTooltipContentProps.content,
  36578. popperStyle: useTooltipContentProps.popperStyle,
  36579. popperClass: useTooltipContentProps.popperClass,
  36580. enterable: {
  36581. ...useTooltipContentProps.enterable,
  36582. default: true
  36583. },
  36584. effect: {
  36585. ...useTooltipContentProps.effect,
  36586. default: "light"
  36587. },
  36588. teleported: useTooltipContentProps.teleported,
  36589. title: String,
  36590. width: {
  36591. type: [String, Number],
  36592. default: 150
  36593. },
  36594. offset: {
  36595. type: Number,
  36596. default: void 0
  36597. },
  36598. showAfter: {
  36599. type: Number,
  36600. default: 0
  36601. },
  36602. hideAfter: {
  36603. type: Number,
  36604. default: 200
  36605. },
  36606. autoClose: {
  36607. type: Number,
  36608. default: 0
  36609. },
  36610. showArrow: {
  36611. type: Boolean,
  36612. default: true
  36613. },
  36614. persistent: {
  36615. type: Boolean,
  36616. default: true
  36617. },
  36618. "onUpdate:visible": {
  36619. type: Function
  36620. }
  36621. });
  36622. const popoverEmits = {
  36623. "update:visible": (value) => isBoolean(value),
  36624. "before-enter": () => true,
  36625. "before-leave": () => true,
  36626. "after-enter": () => true,
  36627. "after-leave": () => true
  36628. };
  36629. const updateEventKeyRaw = `onUpdate:visible`;
  36630. const __default__$I = defineComponent({
  36631. name: "ElPopover"
  36632. });
  36633. const _sfc_main$S = /* @__PURE__ */ defineComponent({
  36634. ...__default__$I,
  36635. props: popoverProps,
  36636. emits: popoverEmits,
  36637. setup(__props, { expose, emit }) {
  36638. const props = __props;
  36639. const onUpdateVisible = computed(() => {
  36640. return props[updateEventKeyRaw];
  36641. });
  36642. const ns = useNamespace("popover");
  36643. const tooltipRef = ref();
  36644. const popperRef = computed(() => {
  36645. var _a;
  36646. return (_a = unref(tooltipRef)) == null ? void 0 : _a.popperRef;
  36647. });
  36648. const style = computed(() => {
  36649. return [
  36650. {
  36651. width: addUnit(props.width)
  36652. },
  36653. props.popperStyle
  36654. ];
  36655. });
  36656. const kls = computed(() => {
  36657. return [ns.b(), props.popperClass, { [ns.m("plain")]: !!props.content }];
  36658. });
  36659. const gpuAcceleration = computed(() => {
  36660. return props.transition === `${ns.namespace.value}-fade-in-linear`;
  36661. });
  36662. const hide = () => {
  36663. var _a;
  36664. (_a = tooltipRef.value) == null ? void 0 : _a.hide();
  36665. };
  36666. const beforeEnter = () => {
  36667. emit("before-enter");
  36668. };
  36669. const beforeLeave = () => {
  36670. emit("before-leave");
  36671. };
  36672. const afterEnter = () => {
  36673. emit("after-enter");
  36674. };
  36675. const afterLeave = () => {
  36676. emit("update:visible", false);
  36677. emit("after-leave");
  36678. };
  36679. expose({
  36680. popperRef,
  36681. hide
  36682. });
  36683. return (_ctx, _cache) => {
  36684. return openBlock(), createBlock(unref(ElTooltip), mergeProps({
  36685. ref_key: "tooltipRef",
  36686. ref: tooltipRef
  36687. }, _ctx.$attrs, {
  36688. trigger: _ctx.trigger,
  36689. "trigger-keys": _ctx.triggerKeys,
  36690. placement: _ctx.placement,
  36691. disabled: _ctx.disabled,
  36692. visible: _ctx.visible,
  36693. transition: _ctx.transition,
  36694. "popper-options": _ctx.popperOptions,
  36695. tabindex: _ctx.tabindex,
  36696. content: _ctx.content,
  36697. offset: _ctx.offset,
  36698. "show-after": _ctx.showAfter,
  36699. "hide-after": _ctx.hideAfter,
  36700. "auto-close": _ctx.autoClose,
  36701. "show-arrow": _ctx.showArrow,
  36702. "aria-label": _ctx.title,
  36703. effect: _ctx.effect,
  36704. enterable: _ctx.enterable,
  36705. "popper-class": unref(kls),
  36706. "popper-style": unref(style),
  36707. teleported: _ctx.teleported,
  36708. persistent: _ctx.persistent,
  36709. "gpu-acceleration": unref(gpuAcceleration),
  36710. "onUpdate:visible": unref(onUpdateVisible),
  36711. onBeforeShow: beforeEnter,
  36712. onBeforeHide: beforeLeave,
  36713. onShow: afterEnter,
  36714. onHide: afterLeave
  36715. }), {
  36716. content: withCtx(() => [
  36717. _ctx.title ? (openBlock(), createElementBlock("div", {
  36718. key: 0,
  36719. class: normalizeClass(unref(ns).e("title")),
  36720. role: "title"
  36721. }, toDisplayString(_ctx.title), 3)) : createCommentVNode("v-if", true),
  36722. renderSlot(_ctx.$slots, "default", {}, () => [
  36723. createTextVNode(toDisplayString(_ctx.content), 1)
  36724. ])
  36725. ]),
  36726. default: withCtx(() => [
  36727. _ctx.$slots.reference ? renderSlot(_ctx.$slots, "reference", { key: 0 }) : createCommentVNode("v-if", true)
  36728. ]),
  36729. _: 3
  36730. }, 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", "persistent", "gpu-acceleration", "onUpdate:visible"]);
  36731. };
  36732. }
  36733. });
  36734. var Popover = /* @__PURE__ */ _export_sfc(_sfc_main$S, [["__file", "popover.vue"]]);
  36735. const attachEvents = (el, binding) => {
  36736. const popperComponent = binding.arg || binding.value;
  36737. const popover = popperComponent == null ? void 0 : popperComponent.popperRef;
  36738. if (popover) {
  36739. popover.triggerRef = el;
  36740. }
  36741. };
  36742. var PopoverDirective = {
  36743. mounted(el, binding) {
  36744. attachEvents(el, binding);
  36745. },
  36746. updated(el, binding) {
  36747. attachEvents(el, binding);
  36748. }
  36749. };
  36750. const VPopover = "popover";
  36751. const ElPopoverDirective = withInstallDirective(PopoverDirective, VPopover);
  36752. const ElPopover = withInstall(Popover, {
  36753. directive: ElPopoverDirective
  36754. });
  36755. const progressProps = buildProps({
  36756. type: {
  36757. type: String,
  36758. default: "line",
  36759. values: ["line", "circle", "dashboard"]
  36760. },
  36761. percentage: {
  36762. type: Number,
  36763. default: 0,
  36764. validator: (val) => val >= 0 && val <= 100
  36765. },
  36766. status: {
  36767. type: String,
  36768. default: "",
  36769. values: ["", "success", "exception", "warning"]
  36770. },
  36771. indeterminate: Boolean,
  36772. duration: {
  36773. type: Number,
  36774. default: 3
  36775. },
  36776. strokeWidth: {
  36777. type: Number,
  36778. default: 6
  36779. },
  36780. strokeLinecap: {
  36781. type: definePropType(String),
  36782. default: "round"
  36783. },
  36784. textInside: Boolean,
  36785. width: {
  36786. type: Number,
  36787. default: 126
  36788. },
  36789. showText: {
  36790. type: Boolean,
  36791. default: true
  36792. },
  36793. color: {
  36794. type: definePropType([
  36795. String,
  36796. Array,
  36797. Function
  36798. ]),
  36799. default: ""
  36800. },
  36801. striped: Boolean,
  36802. stripedFlow: Boolean,
  36803. format: {
  36804. type: definePropType(Function),
  36805. default: (percentage) => `${percentage}%`
  36806. }
  36807. });
  36808. const __default__$H = defineComponent({
  36809. name: "ElProgress"
  36810. });
  36811. const _sfc_main$R = /* @__PURE__ */ defineComponent({
  36812. ...__default__$H,
  36813. props: progressProps,
  36814. setup(__props) {
  36815. const props = __props;
  36816. const STATUS_COLOR_MAP = {
  36817. success: "#13ce66",
  36818. exception: "#ff4949",
  36819. warning: "#e6a23c",
  36820. default: "#20a0ff"
  36821. };
  36822. const ns = useNamespace("progress");
  36823. const barStyle = computed(() => {
  36824. const barStyle2 = {
  36825. width: `${props.percentage}%`,
  36826. animationDuration: `${props.duration}s`
  36827. };
  36828. const color = getCurrentColor(props.percentage);
  36829. if (color.includes("gradient")) {
  36830. barStyle2.background = color;
  36831. } else {
  36832. barStyle2.backgroundColor = color;
  36833. }
  36834. return barStyle2;
  36835. });
  36836. const relativeStrokeWidth = computed(() => (props.strokeWidth / props.width * 100).toFixed(1));
  36837. const radius = computed(() => {
  36838. if (["circle", "dashboard"].includes(props.type)) {
  36839. return Number.parseInt(`${50 - Number.parseFloat(relativeStrokeWidth.value) / 2}`, 10);
  36840. }
  36841. return 0;
  36842. });
  36843. const trackPath = computed(() => {
  36844. const r = radius.value;
  36845. const isDashboard = props.type === "dashboard";
  36846. return `
  36847. M 50 50
  36848. m 0 ${isDashboard ? "" : "-"}${r}
  36849. a ${r} ${r} 0 1 1 0 ${isDashboard ? "-" : ""}${r * 2}
  36850. a ${r} ${r} 0 1 1 0 ${isDashboard ? "" : "-"}${r * 2}
  36851. `;
  36852. });
  36853. const perimeter = computed(() => 2 * Math.PI * radius.value);
  36854. const rate = computed(() => props.type === "dashboard" ? 0.75 : 1);
  36855. const strokeDashoffset = computed(() => {
  36856. const offset = -1 * perimeter.value * (1 - rate.value) / 2;
  36857. return `${offset}px`;
  36858. });
  36859. const trailPathStyle = computed(() => ({
  36860. strokeDasharray: `${perimeter.value * rate.value}px, ${perimeter.value}px`,
  36861. strokeDashoffset: strokeDashoffset.value
  36862. }));
  36863. const circlePathStyle = computed(() => ({
  36864. strokeDasharray: `${perimeter.value * rate.value * (props.percentage / 100)}px, ${perimeter.value}px`,
  36865. strokeDashoffset: strokeDashoffset.value,
  36866. transition: "stroke-dasharray 0.6s ease 0s, stroke 0.6s ease, opacity ease 0.6s"
  36867. }));
  36868. const stroke = computed(() => {
  36869. let ret;
  36870. if (props.color) {
  36871. ret = getCurrentColor(props.percentage);
  36872. } else {
  36873. ret = STATUS_COLOR_MAP[props.status] || STATUS_COLOR_MAP.default;
  36874. }
  36875. return ret;
  36876. });
  36877. const statusIcon = computed(() => {
  36878. if (props.status === "warning") {
  36879. return warning_filled_default;
  36880. }
  36881. if (props.type === "line") {
  36882. return props.status === "success" ? circle_check_default : circle_close_default;
  36883. } else {
  36884. return props.status === "success" ? check_default : close_default;
  36885. }
  36886. });
  36887. const progressTextSize = computed(() => {
  36888. return props.type === "line" ? 12 + props.strokeWidth * 0.4 : props.width * 0.111111 + 2;
  36889. });
  36890. const content = computed(() => props.format(props.percentage));
  36891. function getColors(color) {
  36892. const span = 100 / color.length;
  36893. const seriesColors = color.map((seriesColor, index) => {
  36894. if (isString$1(seriesColor)) {
  36895. return {
  36896. color: seriesColor,
  36897. percentage: (index + 1) * span
  36898. };
  36899. }
  36900. return seriesColor;
  36901. });
  36902. return seriesColors.sort((a, b) => a.percentage - b.percentage);
  36903. }
  36904. const getCurrentColor = (percentage) => {
  36905. var _a;
  36906. const { color } = props;
  36907. if (isFunction$1(color)) {
  36908. return color(percentage);
  36909. } else if (isString$1(color)) {
  36910. return color;
  36911. } else {
  36912. const colors = getColors(color);
  36913. for (const color2 of colors) {
  36914. if (color2.percentage > percentage)
  36915. return color2.color;
  36916. }
  36917. return (_a = colors[colors.length - 1]) == null ? void 0 : _a.color;
  36918. }
  36919. };
  36920. return (_ctx, _cache) => {
  36921. return openBlock(), createElementBlock("div", {
  36922. class: normalizeClass([
  36923. unref(ns).b(),
  36924. unref(ns).m(_ctx.type),
  36925. unref(ns).is(_ctx.status),
  36926. {
  36927. [unref(ns).m("without-text")]: !_ctx.showText,
  36928. [unref(ns).m("text-inside")]: _ctx.textInside
  36929. }
  36930. ]),
  36931. role: "progressbar",
  36932. "aria-valuenow": _ctx.percentage,
  36933. "aria-valuemin": "0",
  36934. "aria-valuemax": "100"
  36935. }, [
  36936. _ctx.type === "line" ? (openBlock(), createElementBlock("div", {
  36937. key: 0,
  36938. class: normalizeClass(unref(ns).b("bar"))
  36939. }, [
  36940. createElementVNode("div", {
  36941. class: normalizeClass(unref(ns).be("bar", "outer")),
  36942. style: normalizeStyle({ height: `${_ctx.strokeWidth}px` })
  36943. }, [
  36944. createElementVNode("div", {
  36945. class: normalizeClass([
  36946. unref(ns).be("bar", "inner"),
  36947. { [unref(ns).bem("bar", "inner", "indeterminate")]: _ctx.indeterminate },
  36948. { [unref(ns).bem("bar", "inner", "striped")]: _ctx.striped },
  36949. { [unref(ns).bem("bar", "inner", "striped-flow")]: _ctx.stripedFlow }
  36950. ]),
  36951. style: normalizeStyle(unref(barStyle))
  36952. }, [
  36953. (_ctx.showText || _ctx.$slots.default) && _ctx.textInside ? (openBlock(), createElementBlock("div", {
  36954. key: 0,
  36955. class: normalizeClass(unref(ns).be("bar", "innerText"))
  36956. }, [
  36957. renderSlot(_ctx.$slots, "default", { percentage: _ctx.percentage }, () => [
  36958. createElementVNode("span", null, toDisplayString(unref(content)), 1)
  36959. ])
  36960. ], 2)) : createCommentVNode("v-if", true)
  36961. ], 6)
  36962. ], 6)
  36963. ], 2)) : (openBlock(), createElementBlock("div", {
  36964. key: 1,
  36965. class: normalizeClass(unref(ns).b("circle")),
  36966. style: normalizeStyle({ height: `${_ctx.width}px`, width: `${_ctx.width}px` })
  36967. }, [
  36968. (openBlock(), createElementBlock("svg", { viewBox: "0 0 100 100" }, [
  36969. createElementVNode("path", {
  36970. class: normalizeClass(unref(ns).be("circle", "track")),
  36971. d: unref(trackPath),
  36972. stroke: `var(${unref(ns).cssVarName("fill-color-light")}, #e5e9f2)`,
  36973. "stroke-linecap": _ctx.strokeLinecap,
  36974. "stroke-width": unref(relativeStrokeWidth),
  36975. fill: "none",
  36976. style: normalizeStyle(unref(trailPathStyle))
  36977. }, null, 14, ["d", "stroke", "stroke-linecap", "stroke-width"]),
  36978. createElementVNode("path", {
  36979. class: normalizeClass(unref(ns).be("circle", "path")),
  36980. d: unref(trackPath),
  36981. stroke: unref(stroke),
  36982. fill: "none",
  36983. opacity: _ctx.percentage ? 1 : 0,
  36984. "stroke-linecap": _ctx.strokeLinecap,
  36985. "stroke-width": unref(relativeStrokeWidth),
  36986. style: normalizeStyle(unref(circlePathStyle))
  36987. }, null, 14, ["d", "stroke", "opacity", "stroke-linecap", "stroke-width"])
  36988. ]))
  36989. ], 6)),
  36990. (_ctx.showText || _ctx.$slots.default) && !_ctx.textInside ? (openBlock(), createElementBlock("div", {
  36991. key: 2,
  36992. class: normalizeClass(unref(ns).e("text")),
  36993. style: normalizeStyle({ fontSize: `${unref(progressTextSize)}px` })
  36994. }, [
  36995. renderSlot(_ctx.$slots, "default", { percentage: _ctx.percentage }, () => [
  36996. !_ctx.status ? (openBlock(), createElementBlock("span", { key: 0 }, toDisplayString(unref(content)), 1)) : (openBlock(), createBlock(unref(ElIcon), { key: 1 }, {
  36997. default: withCtx(() => [
  36998. (openBlock(), createBlock(resolveDynamicComponent(unref(statusIcon))))
  36999. ]),
  37000. _: 1
  37001. }))
  37002. ])
  37003. ], 6)) : createCommentVNode("v-if", true)
  37004. ], 10, ["aria-valuenow"]);
  37005. };
  37006. }
  37007. });
  37008. var Progress = /* @__PURE__ */ _export_sfc(_sfc_main$R, [["__file", "progress.vue"]]);
  37009. const ElProgress = withInstall(Progress);
  37010. const rateProps = buildProps({
  37011. modelValue: {
  37012. type: Number,
  37013. default: 0
  37014. },
  37015. id: {
  37016. type: String,
  37017. default: void 0
  37018. },
  37019. lowThreshold: {
  37020. type: Number,
  37021. default: 2
  37022. },
  37023. highThreshold: {
  37024. type: Number,
  37025. default: 4
  37026. },
  37027. max: {
  37028. type: Number,
  37029. default: 5
  37030. },
  37031. colors: {
  37032. type: definePropType([Array, Object]),
  37033. default: () => mutable(["", "", ""])
  37034. },
  37035. voidColor: {
  37036. type: String,
  37037. default: ""
  37038. },
  37039. disabledVoidColor: {
  37040. type: String,
  37041. default: ""
  37042. },
  37043. icons: {
  37044. type: definePropType([Array, Object]),
  37045. default: () => [star_filled_default, star_filled_default, star_filled_default]
  37046. },
  37047. voidIcon: {
  37048. type: iconPropType,
  37049. default: () => star_default
  37050. },
  37051. disabledVoidIcon: {
  37052. type: iconPropType,
  37053. default: () => star_filled_default
  37054. },
  37055. disabled: Boolean,
  37056. allowHalf: Boolean,
  37057. showText: Boolean,
  37058. showScore: Boolean,
  37059. textColor: {
  37060. type: String,
  37061. default: ""
  37062. },
  37063. texts: {
  37064. type: definePropType(Array),
  37065. default: () => mutable([
  37066. "Extremely bad",
  37067. "Disappointed",
  37068. "Fair",
  37069. "Satisfied",
  37070. "Surprise"
  37071. ])
  37072. },
  37073. scoreTemplate: {
  37074. type: String,
  37075. default: "{value}"
  37076. },
  37077. size: useSizeProp,
  37078. clearable: Boolean,
  37079. ...useAriaProps(["ariaLabel"])
  37080. });
  37081. const rateEmits = {
  37082. [CHANGE_EVENT]: (value) => isNumber(value),
  37083. [UPDATE_MODEL_EVENT]: (value) => isNumber(value)
  37084. };
  37085. const __default__$G = defineComponent({
  37086. name: "ElRate"
  37087. });
  37088. const _sfc_main$Q = /* @__PURE__ */ defineComponent({
  37089. ...__default__$G,
  37090. props: rateProps,
  37091. emits: rateEmits,
  37092. setup(__props, { expose, emit }) {
  37093. const props = __props;
  37094. function getValueFromMap(value, map) {
  37095. const isExcludedObject = (val) => isObject$1(val);
  37096. const matchedKeys = Object.keys(map).map((key) => +key).filter((key) => {
  37097. const val = map[key];
  37098. const excluded = isExcludedObject(val) ? val.excluded : false;
  37099. return excluded ? value < key : value <= key;
  37100. }).sort((a, b) => a - b);
  37101. const matchedValue = map[matchedKeys[0]];
  37102. return isExcludedObject(matchedValue) && matchedValue.value || matchedValue;
  37103. }
  37104. const formContext = inject(formContextKey, void 0);
  37105. const formItemContext = inject(formItemContextKey, void 0);
  37106. const rateSize = useFormSize();
  37107. const ns = useNamespace("rate");
  37108. const { inputId, isLabeledByFormItem } = useFormItemInputId(props, {
  37109. formItemContext
  37110. });
  37111. const currentValue = ref(props.modelValue);
  37112. const hoverIndex = ref(-1);
  37113. const pointerAtLeftHalf = ref(true);
  37114. const rateClasses = computed(() => [ns.b(), ns.m(rateSize.value)]);
  37115. const rateDisabled = computed(() => props.disabled || (formContext == null ? void 0 : formContext.disabled));
  37116. const rateStyles = computed(() => {
  37117. return ns.cssVarBlock({
  37118. "void-color": props.voidColor,
  37119. "disabled-void-color": props.disabledVoidColor,
  37120. "fill-color": activeColor.value
  37121. });
  37122. });
  37123. const text = computed(() => {
  37124. let result = "";
  37125. if (props.showScore) {
  37126. result = props.scoreTemplate.replace(/\{\s*value\s*\}/, rateDisabled.value ? `${props.modelValue}` : `${currentValue.value}`);
  37127. } else if (props.showText) {
  37128. result = props.texts[Math.ceil(currentValue.value) - 1];
  37129. }
  37130. return result;
  37131. });
  37132. const valueDecimal = computed(() => props.modelValue * 100 - Math.floor(props.modelValue) * 100);
  37133. const colorMap = computed(() => isArray$1(props.colors) ? {
  37134. [props.lowThreshold]: props.colors[0],
  37135. [props.highThreshold]: { value: props.colors[1], excluded: true },
  37136. [props.max]: props.colors[2]
  37137. } : props.colors);
  37138. const activeColor = computed(() => {
  37139. const color = getValueFromMap(currentValue.value, colorMap.value);
  37140. return isObject$1(color) ? "" : color;
  37141. });
  37142. const decimalStyle = computed(() => {
  37143. let width = "";
  37144. if (rateDisabled.value) {
  37145. width = `${valueDecimal.value}%`;
  37146. } else if (props.allowHalf) {
  37147. width = "50%";
  37148. }
  37149. return {
  37150. color: activeColor.value,
  37151. width
  37152. };
  37153. });
  37154. const componentMap = computed(() => {
  37155. let icons = isArray$1(props.icons) ? [...props.icons] : { ...props.icons };
  37156. icons = markRaw(icons);
  37157. return isArray$1(icons) ? {
  37158. [props.lowThreshold]: icons[0],
  37159. [props.highThreshold]: {
  37160. value: icons[1],
  37161. excluded: true
  37162. },
  37163. [props.max]: icons[2]
  37164. } : icons;
  37165. });
  37166. const decimalIconComponent = computed(() => getValueFromMap(props.modelValue, componentMap.value));
  37167. const voidComponent = computed(() => rateDisabled.value ? isString$1(props.disabledVoidIcon) ? props.disabledVoidIcon : markRaw(props.disabledVoidIcon) : isString$1(props.voidIcon) ? props.voidIcon : markRaw(props.voidIcon));
  37168. const activeComponent = computed(() => getValueFromMap(currentValue.value, componentMap.value));
  37169. function showDecimalIcon(item) {
  37170. const showWhenDisabled = rateDisabled.value && valueDecimal.value > 0 && item - 1 < props.modelValue && item > props.modelValue;
  37171. const showWhenAllowHalf = props.allowHalf && pointerAtLeftHalf.value && item - 0.5 <= currentValue.value && item > currentValue.value;
  37172. return showWhenDisabled || showWhenAllowHalf;
  37173. }
  37174. function emitValue(value) {
  37175. if (props.clearable && value === props.modelValue) {
  37176. value = 0;
  37177. }
  37178. emit(UPDATE_MODEL_EVENT, value);
  37179. if (props.modelValue !== value) {
  37180. emit(CHANGE_EVENT, value);
  37181. }
  37182. }
  37183. function selectValue(value) {
  37184. if (rateDisabled.value) {
  37185. return;
  37186. }
  37187. if (props.allowHalf && pointerAtLeftHalf.value) {
  37188. emitValue(currentValue.value);
  37189. } else {
  37190. emitValue(value);
  37191. }
  37192. }
  37193. function handleKey(e) {
  37194. if (rateDisabled.value) {
  37195. return;
  37196. }
  37197. let _currentValue = currentValue.value;
  37198. const code = e.code;
  37199. if (code === EVENT_CODE.up || code === EVENT_CODE.right) {
  37200. if (props.allowHalf) {
  37201. _currentValue += 0.5;
  37202. } else {
  37203. _currentValue += 1;
  37204. }
  37205. e.stopPropagation();
  37206. e.preventDefault();
  37207. } else if (code === EVENT_CODE.left || code === EVENT_CODE.down) {
  37208. if (props.allowHalf) {
  37209. _currentValue -= 0.5;
  37210. } else {
  37211. _currentValue -= 1;
  37212. }
  37213. e.stopPropagation();
  37214. e.preventDefault();
  37215. }
  37216. _currentValue = _currentValue < 0 ? 0 : _currentValue;
  37217. _currentValue = _currentValue > props.max ? props.max : _currentValue;
  37218. emit(UPDATE_MODEL_EVENT, _currentValue);
  37219. emit(CHANGE_EVENT, _currentValue);
  37220. return _currentValue;
  37221. }
  37222. function setCurrentValue(value, event) {
  37223. if (rateDisabled.value) {
  37224. return;
  37225. }
  37226. if (props.allowHalf && event) {
  37227. let target = event.target;
  37228. if (hasClass(target, ns.e("item"))) {
  37229. target = target.querySelector(`.${ns.e("icon")}`);
  37230. }
  37231. if (target.clientWidth === 0 || hasClass(target, ns.e("decimal"))) {
  37232. target = target.parentNode;
  37233. }
  37234. pointerAtLeftHalf.value = event.offsetX * 2 <= target.clientWidth;
  37235. currentValue.value = pointerAtLeftHalf.value ? value - 0.5 : value;
  37236. } else {
  37237. currentValue.value = value;
  37238. }
  37239. hoverIndex.value = value;
  37240. }
  37241. function resetCurrentValue() {
  37242. if (rateDisabled.value) {
  37243. return;
  37244. }
  37245. if (props.allowHalf) {
  37246. pointerAtLeftHalf.value = props.modelValue !== Math.floor(props.modelValue);
  37247. }
  37248. currentValue.value = props.modelValue;
  37249. hoverIndex.value = -1;
  37250. }
  37251. watch(() => props.modelValue, (val) => {
  37252. currentValue.value = val;
  37253. pointerAtLeftHalf.value = props.modelValue !== Math.floor(props.modelValue);
  37254. });
  37255. if (!props.modelValue) {
  37256. emit(UPDATE_MODEL_EVENT, 0);
  37257. }
  37258. expose({
  37259. setCurrentValue,
  37260. resetCurrentValue
  37261. });
  37262. return (_ctx, _cache) => {
  37263. var _a;
  37264. return openBlock(), createElementBlock("div", {
  37265. id: unref(inputId),
  37266. class: normalizeClass([unref(rateClasses), unref(ns).is("disabled", unref(rateDisabled))]),
  37267. role: "slider",
  37268. "aria-label": !unref(isLabeledByFormItem) ? _ctx.ariaLabel || "rating" : void 0,
  37269. "aria-labelledby": unref(isLabeledByFormItem) ? (_a = unref(formItemContext)) == null ? void 0 : _a.labelId : void 0,
  37270. "aria-valuenow": currentValue.value,
  37271. "aria-valuetext": unref(text) || void 0,
  37272. "aria-valuemin": "0",
  37273. "aria-valuemax": _ctx.max,
  37274. tabindex: "0",
  37275. style: normalizeStyle(unref(rateStyles)),
  37276. onKeydown: handleKey
  37277. }, [
  37278. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.max, (item, key) => {
  37279. return openBlock(), createElementBlock("span", {
  37280. key,
  37281. class: normalizeClass(unref(ns).e("item")),
  37282. onMousemove: ($event) => setCurrentValue(item, $event),
  37283. onMouseleave: resetCurrentValue,
  37284. onClick: ($event) => selectValue(item)
  37285. }, [
  37286. createVNode(unref(ElIcon), {
  37287. class: normalizeClass([
  37288. unref(ns).e("icon"),
  37289. { hover: hoverIndex.value === item },
  37290. unref(ns).is("active", item <= currentValue.value)
  37291. ])
  37292. }, {
  37293. default: withCtx(() => [
  37294. !showDecimalIcon(item) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  37295. withDirectives((openBlock(), createBlock(resolveDynamicComponent(unref(activeComponent)), null, null, 512)), [
  37296. [vShow, item <= currentValue.value]
  37297. ]),
  37298. withDirectives((openBlock(), createBlock(resolveDynamicComponent(unref(voidComponent)), null, null, 512)), [
  37299. [vShow, !(item <= currentValue.value)]
  37300. ])
  37301. ], 64)) : createCommentVNode("v-if", true),
  37302. showDecimalIcon(item) ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
  37303. (openBlock(), createBlock(resolveDynamicComponent(unref(voidComponent)), {
  37304. class: normalizeClass([unref(ns).em("decimal", "box")])
  37305. }, null, 8, ["class"])),
  37306. createVNode(unref(ElIcon), {
  37307. style: normalizeStyle(unref(decimalStyle)),
  37308. class: normalizeClass([unref(ns).e("icon"), unref(ns).e("decimal")])
  37309. }, {
  37310. default: withCtx(() => [
  37311. (openBlock(), createBlock(resolveDynamicComponent(unref(decimalIconComponent))))
  37312. ]),
  37313. _: 1
  37314. }, 8, ["style", "class"])
  37315. ], 64)) : createCommentVNode("v-if", true)
  37316. ]),
  37317. _: 2
  37318. }, 1032, ["class"])
  37319. ], 42, ["onMousemove", "onClick"]);
  37320. }), 128)),
  37321. _ctx.showText || _ctx.showScore ? (openBlock(), createElementBlock("span", {
  37322. key: 0,
  37323. class: normalizeClass(unref(ns).e("text")),
  37324. style: normalizeStyle({ color: _ctx.textColor })
  37325. }, toDisplayString(unref(text)), 7)) : createCommentVNode("v-if", true)
  37326. ], 46, ["id", "aria-label", "aria-labelledby", "aria-valuenow", "aria-valuetext", "aria-valuemax"]);
  37327. };
  37328. }
  37329. });
  37330. var Rate = /* @__PURE__ */ _export_sfc(_sfc_main$Q, [["__file", "rate.vue"]]);
  37331. const ElRate = withInstall(Rate);
  37332. const IconMap = {
  37333. success: "icon-success",
  37334. warning: "icon-warning",
  37335. error: "icon-error",
  37336. info: "icon-info"
  37337. };
  37338. const IconComponentMap = {
  37339. [IconMap.success]: circle_check_filled_default,
  37340. [IconMap.warning]: warning_filled_default,
  37341. [IconMap.error]: circle_close_filled_default,
  37342. [IconMap.info]: info_filled_default
  37343. };
  37344. const resultProps = buildProps({
  37345. title: {
  37346. type: String,
  37347. default: ""
  37348. },
  37349. subTitle: {
  37350. type: String,
  37351. default: ""
  37352. },
  37353. icon: {
  37354. type: String,
  37355. values: ["success", "warning", "info", "error"],
  37356. default: "info"
  37357. }
  37358. });
  37359. const __default__$F = defineComponent({
  37360. name: "ElResult"
  37361. });
  37362. const _sfc_main$P = /* @__PURE__ */ defineComponent({
  37363. ...__default__$F,
  37364. props: resultProps,
  37365. setup(__props) {
  37366. const props = __props;
  37367. const ns = useNamespace("result");
  37368. const resultIcon = computed(() => {
  37369. const icon = props.icon;
  37370. const iconClass = icon && IconMap[icon] ? IconMap[icon] : "icon-info";
  37371. const iconComponent = IconComponentMap[iconClass] || IconComponentMap["icon-info"];
  37372. return {
  37373. class: iconClass,
  37374. component: iconComponent
  37375. };
  37376. });
  37377. return (_ctx, _cache) => {
  37378. return openBlock(), createElementBlock("div", {
  37379. class: normalizeClass(unref(ns).b())
  37380. }, [
  37381. createElementVNode("div", {
  37382. class: normalizeClass(unref(ns).e("icon"))
  37383. }, [
  37384. renderSlot(_ctx.$slots, "icon", {}, () => [
  37385. unref(resultIcon).component ? (openBlock(), createBlock(resolveDynamicComponent(unref(resultIcon).component), {
  37386. key: 0,
  37387. class: normalizeClass(unref(resultIcon).class)
  37388. }, null, 8, ["class"])) : createCommentVNode("v-if", true)
  37389. ])
  37390. ], 2),
  37391. _ctx.title || _ctx.$slots.title ? (openBlock(), createElementBlock("div", {
  37392. key: 0,
  37393. class: normalizeClass(unref(ns).e("title"))
  37394. }, [
  37395. renderSlot(_ctx.$slots, "title", {}, () => [
  37396. createElementVNode("p", null, toDisplayString(_ctx.title), 1)
  37397. ])
  37398. ], 2)) : createCommentVNode("v-if", true),
  37399. _ctx.subTitle || _ctx.$slots["sub-title"] ? (openBlock(), createElementBlock("div", {
  37400. key: 1,
  37401. class: normalizeClass(unref(ns).e("subtitle"))
  37402. }, [
  37403. renderSlot(_ctx.$slots, "sub-title", {}, () => [
  37404. createElementVNode("p", null, toDisplayString(_ctx.subTitle), 1)
  37405. ])
  37406. ], 2)) : createCommentVNode("v-if", true),
  37407. _ctx.$slots.extra ? (openBlock(), createElementBlock("div", {
  37408. key: 2,
  37409. class: normalizeClass(unref(ns).e("extra"))
  37410. }, [
  37411. renderSlot(_ctx.$slots, "extra")
  37412. ], 2)) : createCommentVNode("v-if", true)
  37413. ], 2);
  37414. };
  37415. }
  37416. });
  37417. var Result = /* @__PURE__ */ _export_sfc(_sfc_main$P, [["__file", "result.vue"]]);
  37418. const ElResult = withInstall(Result);
  37419. var safeIsNaN = Number.isNaN || function ponyfill(value) {
  37420. return typeof value === "number" && value !== value;
  37421. };
  37422. function isEqual(first, second) {
  37423. if (first === second) {
  37424. return true;
  37425. }
  37426. if (safeIsNaN(first) && safeIsNaN(second)) {
  37427. return true;
  37428. }
  37429. return false;
  37430. }
  37431. function areInputsEqual(newInputs, lastInputs) {
  37432. if (newInputs.length !== lastInputs.length) {
  37433. return false;
  37434. }
  37435. for (var i = 0; i < newInputs.length; i++) {
  37436. if (!isEqual(newInputs[i], lastInputs[i])) {
  37437. return false;
  37438. }
  37439. }
  37440. return true;
  37441. }
  37442. function memoizeOne(resultFn, isEqual2) {
  37443. if (isEqual2 === void 0) {
  37444. isEqual2 = areInputsEqual;
  37445. }
  37446. var cache = null;
  37447. function memoized() {
  37448. var newArgs = [];
  37449. for (var _i = 0; _i < arguments.length; _i++) {
  37450. newArgs[_i] = arguments[_i];
  37451. }
  37452. if (cache && cache.lastThis === this && isEqual2(newArgs, cache.lastArgs)) {
  37453. return cache.lastResult;
  37454. }
  37455. var lastResult = resultFn.apply(this, newArgs);
  37456. cache = {
  37457. lastResult,
  37458. lastArgs: newArgs,
  37459. lastThis: this
  37460. };
  37461. return lastResult;
  37462. }
  37463. memoized.clear = function clear() {
  37464. cache = null;
  37465. };
  37466. return memoized;
  37467. }
  37468. const useCache = () => {
  37469. const vm = getCurrentInstance();
  37470. const props = vm.proxy.$props;
  37471. return computed(() => {
  37472. const _getItemStyleCache = (_, __, ___) => ({});
  37473. return props.perfMode ? memoize(_getItemStyleCache) : memoizeOne(_getItemStyleCache);
  37474. });
  37475. };
  37476. const DEFAULT_DYNAMIC_LIST_ITEM_SIZE = 50;
  37477. const ITEM_RENDER_EVT = "itemRendered";
  37478. const SCROLL_EVT = "scroll";
  37479. const FORWARD = "forward";
  37480. const BACKWARD = "backward";
  37481. const AUTO_ALIGNMENT = "auto";
  37482. const SMART_ALIGNMENT = "smart";
  37483. const START_ALIGNMENT = "start";
  37484. const CENTERED_ALIGNMENT = "center";
  37485. const END_ALIGNMENT = "end";
  37486. const HORIZONTAL = "horizontal";
  37487. const VERTICAL = "vertical";
  37488. const LTR = "ltr";
  37489. const RTL = "rtl";
  37490. const RTL_OFFSET_NAG = "negative";
  37491. const RTL_OFFSET_POS_ASC = "positive-ascending";
  37492. const RTL_OFFSET_POS_DESC = "positive-descending";
  37493. const ScrollbarDirKey = {
  37494. [HORIZONTAL]: "left",
  37495. [VERTICAL]: "top"
  37496. };
  37497. const SCROLLBAR_MIN_SIZE = 20;
  37498. const LayoutKeys = {
  37499. [HORIZONTAL]: "deltaX",
  37500. [VERTICAL]: "deltaY"
  37501. };
  37502. const useWheel = ({ atEndEdge, atStartEdge, layout }, onWheelDelta) => {
  37503. let frameHandle;
  37504. let offset = 0;
  37505. const hasReachedEdge = (offset2) => {
  37506. const edgeReached = offset2 < 0 && atStartEdge.value || offset2 > 0 && atEndEdge.value;
  37507. return edgeReached;
  37508. };
  37509. const onWheel = (e) => {
  37510. cAF(frameHandle);
  37511. const newOffset = e[LayoutKeys[layout.value]];
  37512. if (hasReachedEdge(offset) && hasReachedEdge(offset + newOffset))
  37513. return;
  37514. offset += newOffset;
  37515. if (!isFirefox()) {
  37516. e.preventDefault();
  37517. }
  37518. frameHandle = rAF(() => {
  37519. onWheelDelta(offset);
  37520. offset = 0;
  37521. });
  37522. };
  37523. return {
  37524. hasReachedEdge,
  37525. onWheel
  37526. };
  37527. };
  37528. var useWheel$1 = useWheel;
  37529. const itemSize$1 = buildProp({
  37530. type: definePropType([Number, Function]),
  37531. required: true
  37532. });
  37533. const estimatedItemSize = buildProp({
  37534. type: Number
  37535. });
  37536. const cache = buildProp({
  37537. type: Number,
  37538. default: 2
  37539. });
  37540. const direction = buildProp({
  37541. type: String,
  37542. values: ["ltr", "rtl"],
  37543. default: "ltr"
  37544. });
  37545. const initScrollOffset = buildProp({
  37546. type: Number,
  37547. default: 0
  37548. });
  37549. const total = buildProp({
  37550. type: Number,
  37551. required: true
  37552. });
  37553. const layout = buildProp({
  37554. type: String,
  37555. values: ["horizontal", "vertical"],
  37556. default: VERTICAL
  37557. });
  37558. const virtualizedProps = buildProps({
  37559. className: {
  37560. type: String,
  37561. default: ""
  37562. },
  37563. containerElement: {
  37564. type: definePropType([String, Object]),
  37565. default: "div"
  37566. },
  37567. data: {
  37568. type: definePropType(Array),
  37569. default: () => mutable([])
  37570. },
  37571. direction,
  37572. height: {
  37573. type: [String, Number],
  37574. required: true
  37575. },
  37576. innerElement: {
  37577. type: [String, Object],
  37578. default: "div"
  37579. },
  37580. style: {
  37581. type: definePropType([Object, String, Array])
  37582. },
  37583. useIsScrolling: {
  37584. type: Boolean,
  37585. default: false
  37586. },
  37587. width: {
  37588. type: [Number, String],
  37589. required: false
  37590. },
  37591. perfMode: {
  37592. type: Boolean,
  37593. default: true
  37594. },
  37595. scrollbarAlwaysOn: {
  37596. type: Boolean,
  37597. default: false
  37598. }
  37599. });
  37600. const virtualizedListProps = buildProps({
  37601. cache,
  37602. estimatedItemSize,
  37603. layout,
  37604. initScrollOffset,
  37605. total,
  37606. itemSize: itemSize$1,
  37607. ...virtualizedProps
  37608. });
  37609. const scrollbarSize = {
  37610. type: Number,
  37611. default: 6
  37612. };
  37613. const startGap = { type: Number, default: 0 };
  37614. const endGap = { type: Number, default: 2 };
  37615. const virtualizedGridProps = buildProps({
  37616. columnCache: cache,
  37617. columnWidth: itemSize$1,
  37618. estimatedColumnWidth: estimatedItemSize,
  37619. estimatedRowHeight: estimatedItemSize,
  37620. initScrollLeft: initScrollOffset,
  37621. initScrollTop: initScrollOffset,
  37622. itemKey: {
  37623. type: definePropType(Function),
  37624. default: ({
  37625. columnIndex,
  37626. rowIndex
  37627. }) => `${rowIndex}:${columnIndex}`
  37628. },
  37629. rowCache: cache,
  37630. rowHeight: itemSize$1,
  37631. totalColumn: total,
  37632. totalRow: total,
  37633. hScrollbarSize: scrollbarSize,
  37634. vScrollbarSize: scrollbarSize,
  37635. scrollbarStartGap: startGap,
  37636. scrollbarEndGap: endGap,
  37637. role: String,
  37638. ...virtualizedProps
  37639. });
  37640. const virtualizedScrollbarProps = buildProps({
  37641. alwaysOn: Boolean,
  37642. class: String,
  37643. layout,
  37644. total,
  37645. ratio: {
  37646. type: Number,
  37647. required: true
  37648. },
  37649. clientSize: {
  37650. type: Number,
  37651. required: true
  37652. },
  37653. scrollFrom: {
  37654. type: Number,
  37655. required: true
  37656. },
  37657. scrollbarSize,
  37658. startGap,
  37659. endGap,
  37660. visible: Boolean
  37661. });
  37662. const getScrollDir = (prev, cur) => prev < cur ? FORWARD : BACKWARD;
  37663. const isHorizontal = (dir) => dir === LTR || dir === RTL || dir === HORIZONTAL;
  37664. const isRTL = (dir) => dir === RTL;
  37665. let cachedRTLResult = null;
  37666. function getRTLOffsetType(recalculate = false) {
  37667. if (cachedRTLResult === null || recalculate) {
  37668. const outerDiv = document.createElement("div");
  37669. const outerStyle = outerDiv.style;
  37670. outerStyle.width = "50px";
  37671. outerStyle.height = "50px";
  37672. outerStyle.overflow = "scroll";
  37673. outerStyle.direction = "rtl";
  37674. const innerDiv = document.createElement("div");
  37675. const innerStyle = innerDiv.style;
  37676. innerStyle.width = "100px";
  37677. innerStyle.height = "100px";
  37678. outerDiv.appendChild(innerDiv);
  37679. document.body.appendChild(outerDiv);
  37680. if (outerDiv.scrollLeft > 0) {
  37681. cachedRTLResult = RTL_OFFSET_POS_DESC;
  37682. } else {
  37683. outerDiv.scrollLeft = 1;
  37684. if (outerDiv.scrollLeft === 0) {
  37685. cachedRTLResult = RTL_OFFSET_NAG;
  37686. } else {
  37687. cachedRTLResult = RTL_OFFSET_POS_ASC;
  37688. }
  37689. }
  37690. document.body.removeChild(outerDiv);
  37691. return cachedRTLResult;
  37692. }
  37693. return cachedRTLResult;
  37694. }
  37695. function renderThumbStyle({ move, size, bar }, layout) {
  37696. const style = {};
  37697. const translate = `translate${bar.axis}(${move}px)`;
  37698. style[bar.size] = size;
  37699. style.transform = translate;
  37700. if (layout === "horizontal") {
  37701. style.height = "100%";
  37702. } else {
  37703. style.width = "100%";
  37704. }
  37705. return style;
  37706. }
  37707. const ScrollBar = defineComponent({
  37708. name: "ElVirtualScrollBar",
  37709. props: virtualizedScrollbarProps,
  37710. emits: ["scroll", "start-move", "stop-move"],
  37711. setup(props, { emit }) {
  37712. const GAP = computed(() => props.startGap + props.endGap);
  37713. const nsVirtualScrollbar = useNamespace("virtual-scrollbar");
  37714. const nsScrollbar = useNamespace("scrollbar");
  37715. const trackRef = ref();
  37716. const thumbRef = ref();
  37717. let frameHandle = null;
  37718. let onselectstartStore = null;
  37719. const state = reactive({
  37720. isDragging: false,
  37721. traveled: 0
  37722. });
  37723. const bar = computed(() => BAR_MAP[props.layout]);
  37724. const trackSize = computed(() => props.clientSize - unref(GAP));
  37725. const trackStyle = computed(() => ({
  37726. position: "absolute",
  37727. width: `${HORIZONTAL === props.layout ? trackSize.value : props.scrollbarSize}px`,
  37728. height: `${HORIZONTAL === props.layout ? props.scrollbarSize : trackSize.value}px`,
  37729. [ScrollbarDirKey[props.layout]]: "2px",
  37730. right: "2px",
  37731. bottom: "2px",
  37732. borderRadius: "4px"
  37733. }));
  37734. const thumbSize = computed(() => {
  37735. const ratio = props.ratio;
  37736. const clientSize = props.clientSize;
  37737. if (ratio >= 100) {
  37738. return Number.POSITIVE_INFINITY;
  37739. }
  37740. if (ratio >= 50) {
  37741. return ratio * clientSize / 100;
  37742. }
  37743. const SCROLLBAR_MAX_SIZE = clientSize / 3;
  37744. return Math.floor(Math.min(Math.max(ratio * clientSize, SCROLLBAR_MIN_SIZE), SCROLLBAR_MAX_SIZE));
  37745. });
  37746. const thumbStyle = computed(() => {
  37747. if (!Number.isFinite(thumbSize.value)) {
  37748. return {
  37749. display: "none"
  37750. };
  37751. }
  37752. const thumb = `${thumbSize.value}px`;
  37753. const style = renderThumbStyle({
  37754. bar: bar.value,
  37755. size: thumb,
  37756. move: state.traveled
  37757. }, props.layout);
  37758. return style;
  37759. });
  37760. const totalSteps = computed(() => Math.floor(props.clientSize - thumbSize.value - unref(GAP)));
  37761. const attachEvents = () => {
  37762. window.addEventListener("mousemove", onMouseMove);
  37763. window.addEventListener("mouseup", onMouseUp);
  37764. const thumbEl = unref(thumbRef);
  37765. if (!thumbEl)
  37766. return;
  37767. onselectstartStore = document.onselectstart;
  37768. document.onselectstart = () => false;
  37769. thumbEl.addEventListener("touchmove", onMouseMove, { passive: true });
  37770. thumbEl.addEventListener("touchend", onMouseUp);
  37771. };
  37772. const detachEvents = () => {
  37773. window.removeEventListener("mousemove", onMouseMove);
  37774. window.removeEventListener("mouseup", onMouseUp);
  37775. document.onselectstart = onselectstartStore;
  37776. onselectstartStore = null;
  37777. const thumbEl = unref(thumbRef);
  37778. if (!thumbEl)
  37779. return;
  37780. thumbEl.removeEventListener("touchmove", onMouseMove);
  37781. thumbEl.removeEventListener("touchend", onMouseUp);
  37782. };
  37783. const onThumbMouseDown = (e) => {
  37784. e.stopImmediatePropagation();
  37785. if (e.ctrlKey || [1, 2].includes(e.button)) {
  37786. return;
  37787. }
  37788. state.isDragging = true;
  37789. state[bar.value.axis] = e.currentTarget[bar.value.offset] - (e[bar.value.client] - e.currentTarget.getBoundingClientRect()[bar.value.direction]);
  37790. emit("start-move");
  37791. attachEvents();
  37792. };
  37793. const onMouseUp = () => {
  37794. state.isDragging = false;
  37795. state[bar.value.axis] = 0;
  37796. emit("stop-move");
  37797. detachEvents();
  37798. };
  37799. const onMouseMove = (e) => {
  37800. const { isDragging } = state;
  37801. if (!isDragging)
  37802. return;
  37803. if (!thumbRef.value || !trackRef.value)
  37804. return;
  37805. const prevPage = state[bar.value.axis];
  37806. if (!prevPage)
  37807. return;
  37808. cAF(frameHandle);
  37809. const offset = (trackRef.value.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]) * -1;
  37810. const thumbClickPosition = thumbRef.value[bar.value.offset] - prevPage;
  37811. const distance = offset - thumbClickPosition;
  37812. frameHandle = rAF(() => {
  37813. state.traveled = Math.max(props.startGap, Math.min(distance, totalSteps.value));
  37814. emit("scroll", distance, totalSteps.value);
  37815. });
  37816. };
  37817. const clickTrackHandler = (e) => {
  37818. const offset = Math.abs(e.target.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]);
  37819. const thumbHalf = thumbRef.value[bar.value.offset] / 2;
  37820. const distance = offset - thumbHalf;
  37821. state.traveled = Math.max(0, Math.min(distance, totalSteps.value));
  37822. emit("scroll", distance, totalSteps.value);
  37823. };
  37824. watch(() => props.scrollFrom, (v) => {
  37825. if (state.isDragging)
  37826. return;
  37827. state.traveled = Math.ceil(v * totalSteps.value);
  37828. });
  37829. onBeforeUnmount(() => {
  37830. detachEvents();
  37831. });
  37832. return () => {
  37833. return h$1("div", {
  37834. role: "presentation",
  37835. ref: trackRef,
  37836. class: [
  37837. nsVirtualScrollbar.b(),
  37838. props.class,
  37839. (props.alwaysOn || state.isDragging) && "always-on"
  37840. ],
  37841. style: trackStyle.value,
  37842. onMousedown: withModifiers(clickTrackHandler, ["stop", "prevent"]),
  37843. onTouchstartPrevent: onThumbMouseDown
  37844. }, h$1("div", {
  37845. ref: thumbRef,
  37846. class: nsScrollbar.e("thumb"),
  37847. style: thumbStyle.value,
  37848. onMousedown: onThumbMouseDown
  37849. }, []));
  37850. };
  37851. }
  37852. });
  37853. var Scrollbar = ScrollBar;
  37854. const createList = ({
  37855. name,
  37856. getOffset,
  37857. getItemSize,
  37858. getItemOffset,
  37859. getEstimatedTotalSize,
  37860. getStartIndexForOffset,
  37861. getStopIndexForStartIndex,
  37862. initCache,
  37863. clearCache,
  37864. validateProps
  37865. }) => {
  37866. return defineComponent({
  37867. name: name != null ? name : "ElVirtualList",
  37868. props: virtualizedListProps,
  37869. emits: [ITEM_RENDER_EVT, SCROLL_EVT],
  37870. setup(props, { emit, expose }) {
  37871. validateProps(props);
  37872. const instance = getCurrentInstance();
  37873. const ns = useNamespace("vl");
  37874. const dynamicSizeCache = ref(initCache(props, instance));
  37875. const getItemStyleCache = useCache();
  37876. const windowRef = ref();
  37877. const innerRef = ref();
  37878. const scrollbarRef = ref();
  37879. const states = ref({
  37880. isScrolling: false,
  37881. scrollDir: "forward",
  37882. scrollOffset: isNumber(props.initScrollOffset) ? props.initScrollOffset : 0,
  37883. updateRequested: false,
  37884. isScrollbarDragging: false,
  37885. scrollbarAlwaysOn: props.scrollbarAlwaysOn
  37886. });
  37887. const itemsToRender = computed(() => {
  37888. const { total, cache } = props;
  37889. const { isScrolling, scrollDir, scrollOffset } = unref(states);
  37890. if (total === 0) {
  37891. return [0, 0, 0, 0];
  37892. }
  37893. const startIndex = getStartIndexForOffset(props, scrollOffset, unref(dynamicSizeCache));
  37894. const stopIndex = getStopIndexForStartIndex(props, startIndex, scrollOffset, unref(dynamicSizeCache));
  37895. const cacheBackward = !isScrolling || scrollDir === BACKWARD ? Math.max(1, cache) : 1;
  37896. const cacheForward = !isScrolling || scrollDir === FORWARD ? Math.max(1, cache) : 1;
  37897. return [
  37898. Math.max(0, startIndex - cacheBackward),
  37899. Math.max(0, Math.min(total - 1, stopIndex + cacheForward)),
  37900. startIndex,
  37901. stopIndex
  37902. ];
  37903. });
  37904. const estimatedTotalSize = computed(() => getEstimatedTotalSize(props, unref(dynamicSizeCache)));
  37905. const _isHorizontal = computed(() => isHorizontal(props.layout));
  37906. const windowStyle = computed(() => [
  37907. {
  37908. position: "relative",
  37909. [`overflow-${_isHorizontal.value ? "x" : "y"}`]: "scroll",
  37910. WebkitOverflowScrolling: "touch",
  37911. willChange: "transform"
  37912. },
  37913. {
  37914. direction: props.direction,
  37915. height: isNumber(props.height) ? `${props.height}px` : props.height,
  37916. width: isNumber(props.width) ? `${props.width}px` : props.width
  37917. },
  37918. props.style
  37919. ]);
  37920. const innerStyle = computed(() => {
  37921. const size = unref(estimatedTotalSize);
  37922. const horizontal = unref(_isHorizontal);
  37923. return {
  37924. height: horizontal ? "100%" : `${size}px`,
  37925. pointerEvents: unref(states).isScrolling ? "none" : void 0,
  37926. width: horizontal ? `${size}px` : "100%"
  37927. };
  37928. });
  37929. const clientSize = computed(() => _isHorizontal.value ? props.width : props.height);
  37930. const { onWheel } = useWheel$1({
  37931. atStartEdge: computed(() => states.value.scrollOffset <= 0),
  37932. atEndEdge: computed(() => states.value.scrollOffset >= estimatedTotalSize.value),
  37933. layout: computed(() => props.layout)
  37934. }, (offset) => {
  37935. var _a, _b;
  37936. (_b = (_a = scrollbarRef.value).onMouseUp) == null ? void 0 : _b.call(_a);
  37937. scrollTo(Math.min(states.value.scrollOffset + offset, estimatedTotalSize.value - clientSize.value));
  37938. });
  37939. useEventListener(windowRef, "wheel", onWheel, {
  37940. passive: false
  37941. });
  37942. const emitEvents = () => {
  37943. const { total } = props;
  37944. if (total > 0) {
  37945. const [cacheStart, cacheEnd, visibleStart, visibleEnd] = unref(itemsToRender);
  37946. emit(ITEM_RENDER_EVT, cacheStart, cacheEnd, visibleStart, visibleEnd);
  37947. }
  37948. const { scrollDir, scrollOffset, updateRequested } = unref(states);
  37949. emit(SCROLL_EVT, scrollDir, scrollOffset, updateRequested);
  37950. };
  37951. const scrollVertically = (e) => {
  37952. const { clientHeight, scrollHeight, scrollTop } = e.currentTarget;
  37953. const _states = unref(states);
  37954. if (_states.scrollOffset === scrollTop) {
  37955. return;
  37956. }
  37957. const scrollOffset = Math.max(0, Math.min(scrollTop, scrollHeight - clientHeight));
  37958. states.value = {
  37959. ..._states,
  37960. isScrolling: true,
  37961. scrollDir: getScrollDir(_states.scrollOffset, scrollOffset),
  37962. scrollOffset,
  37963. updateRequested: false
  37964. };
  37965. nextTick(resetIsScrolling);
  37966. };
  37967. const scrollHorizontally = (e) => {
  37968. const { clientWidth, scrollLeft, scrollWidth } = e.currentTarget;
  37969. const _states = unref(states);
  37970. if (_states.scrollOffset === scrollLeft) {
  37971. return;
  37972. }
  37973. const { direction } = props;
  37974. let scrollOffset = scrollLeft;
  37975. if (direction === RTL) {
  37976. switch (getRTLOffsetType()) {
  37977. case RTL_OFFSET_NAG: {
  37978. scrollOffset = -scrollLeft;
  37979. break;
  37980. }
  37981. case RTL_OFFSET_POS_DESC: {
  37982. scrollOffset = scrollWidth - clientWidth - scrollLeft;
  37983. break;
  37984. }
  37985. }
  37986. }
  37987. scrollOffset = Math.max(0, Math.min(scrollOffset, scrollWidth - clientWidth));
  37988. states.value = {
  37989. ..._states,
  37990. isScrolling: true,
  37991. scrollDir: getScrollDir(_states.scrollOffset, scrollOffset),
  37992. scrollOffset,
  37993. updateRequested: false
  37994. };
  37995. nextTick(resetIsScrolling);
  37996. };
  37997. const onScroll = (e) => {
  37998. unref(_isHorizontal) ? scrollHorizontally(e) : scrollVertically(e);
  37999. emitEvents();
  38000. };
  38001. const onScrollbarScroll = (distanceToGo, totalSteps) => {
  38002. const offset = (estimatedTotalSize.value - clientSize.value) / totalSteps * distanceToGo;
  38003. scrollTo(Math.min(estimatedTotalSize.value - clientSize.value, offset));
  38004. };
  38005. const scrollTo = (offset) => {
  38006. offset = Math.max(offset, 0);
  38007. if (offset === unref(states).scrollOffset) {
  38008. return;
  38009. }
  38010. states.value = {
  38011. ...unref(states),
  38012. scrollOffset: offset,
  38013. scrollDir: getScrollDir(unref(states).scrollOffset, offset),
  38014. updateRequested: true
  38015. };
  38016. nextTick(resetIsScrolling);
  38017. };
  38018. const scrollToItem = (idx, alignment = AUTO_ALIGNMENT) => {
  38019. const { scrollOffset } = unref(states);
  38020. idx = Math.max(0, Math.min(idx, props.total - 1));
  38021. scrollTo(getOffset(props, idx, alignment, scrollOffset, unref(dynamicSizeCache)));
  38022. };
  38023. const getItemStyle = (idx) => {
  38024. const { direction, itemSize, layout } = props;
  38025. const itemStyleCache = getItemStyleCache.value(clearCache && itemSize, clearCache && layout, clearCache && direction);
  38026. let style;
  38027. if (hasOwn(itemStyleCache, String(idx))) {
  38028. style = itemStyleCache[idx];
  38029. } else {
  38030. const offset = getItemOffset(props, idx, unref(dynamicSizeCache));
  38031. const size = getItemSize(props, idx, unref(dynamicSizeCache));
  38032. const horizontal = unref(_isHorizontal);
  38033. const isRtl = direction === RTL;
  38034. const offsetHorizontal = horizontal ? offset : 0;
  38035. itemStyleCache[idx] = style = {
  38036. position: "absolute",
  38037. left: isRtl ? void 0 : `${offsetHorizontal}px`,
  38038. right: isRtl ? `${offsetHorizontal}px` : void 0,
  38039. top: !horizontal ? `${offset}px` : 0,
  38040. height: !horizontal ? `${size}px` : "100%",
  38041. width: horizontal ? `${size}px` : "100%"
  38042. };
  38043. }
  38044. return style;
  38045. };
  38046. const resetIsScrolling = () => {
  38047. states.value.isScrolling = false;
  38048. nextTick(() => {
  38049. getItemStyleCache.value(-1, null, null);
  38050. });
  38051. };
  38052. const resetScrollTop = () => {
  38053. const window = windowRef.value;
  38054. if (window) {
  38055. window.scrollTop = 0;
  38056. }
  38057. };
  38058. onMounted(() => {
  38059. if (!isClient)
  38060. return;
  38061. const { initScrollOffset } = props;
  38062. const windowElement = unref(windowRef);
  38063. if (isNumber(initScrollOffset) && windowElement) {
  38064. if (unref(_isHorizontal)) {
  38065. windowElement.scrollLeft = initScrollOffset;
  38066. } else {
  38067. windowElement.scrollTop = initScrollOffset;
  38068. }
  38069. }
  38070. emitEvents();
  38071. });
  38072. onUpdated(() => {
  38073. const { direction, layout } = props;
  38074. const { scrollOffset, updateRequested } = unref(states);
  38075. const windowElement = unref(windowRef);
  38076. if (updateRequested && windowElement) {
  38077. if (layout === HORIZONTAL) {
  38078. if (direction === RTL) {
  38079. switch (getRTLOffsetType()) {
  38080. case RTL_OFFSET_NAG: {
  38081. windowElement.scrollLeft = -scrollOffset;
  38082. break;
  38083. }
  38084. case RTL_OFFSET_POS_ASC: {
  38085. windowElement.scrollLeft = scrollOffset;
  38086. break;
  38087. }
  38088. default: {
  38089. const { clientWidth, scrollWidth } = windowElement;
  38090. windowElement.scrollLeft = scrollWidth - clientWidth - scrollOffset;
  38091. break;
  38092. }
  38093. }
  38094. } else {
  38095. windowElement.scrollLeft = scrollOffset;
  38096. }
  38097. } else {
  38098. windowElement.scrollTop = scrollOffset;
  38099. }
  38100. }
  38101. });
  38102. onActivated(() => {
  38103. unref(windowRef).scrollTop = unref(states).scrollOffset;
  38104. });
  38105. const api = {
  38106. ns,
  38107. clientSize,
  38108. estimatedTotalSize,
  38109. windowStyle,
  38110. windowRef,
  38111. innerRef,
  38112. innerStyle,
  38113. itemsToRender,
  38114. scrollbarRef,
  38115. states,
  38116. getItemStyle,
  38117. onScroll,
  38118. onScrollbarScroll,
  38119. onWheel,
  38120. scrollTo,
  38121. scrollToItem,
  38122. resetScrollTop
  38123. };
  38124. expose({
  38125. windowRef,
  38126. innerRef,
  38127. getItemStyleCache,
  38128. scrollTo,
  38129. scrollToItem,
  38130. resetScrollTop,
  38131. states
  38132. });
  38133. return api;
  38134. },
  38135. render(ctx) {
  38136. var _a;
  38137. const {
  38138. $slots,
  38139. className,
  38140. clientSize,
  38141. containerElement,
  38142. data,
  38143. getItemStyle,
  38144. innerElement,
  38145. itemsToRender,
  38146. innerStyle,
  38147. layout,
  38148. total,
  38149. onScroll,
  38150. onScrollbarScroll,
  38151. states,
  38152. useIsScrolling,
  38153. windowStyle,
  38154. ns
  38155. } = ctx;
  38156. const [start, end] = itemsToRender;
  38157. const Container = resolveDynamicComponent(containerElement);
  38158. const Inner = resolveDynamicComponent(innerElement);
  38159. const children = [];
  38160. if (total > 0) {
  38161. for (let i = start; i <= end; i++) {
  38162. children.push(h$1(Fragment, { key: i }, (_a = $slots.default) == null ? void 0 : _a.call($slots, {
  38163. data,
  38164. index: i,
  38165. isScrolling: useIsScrolling ? states.isScrolling : void 0,
  38166. style: getItemStyle(i)
  38167. })));
  38168. }
  38169. }
  38170. const InnerNode = [
  38171. h$1(Inner, {
  38172. style: innerStyle,
  38173. ref: "innerRef"
  38174. }, !isString$1(Inner) ? {
  38175. default: () => children
  38176. } : children)
  38177. ];
  38178. const scrollbar = h$1(Scrollbar, {
  38179. ref: "scrollbarRef",
  38180. clientSize,
  38181. layout,
  38182. onScroll: onScrollbarScroll,
  38183. ratio: clientSize * 100 / this.estimatedTotalSize,
  38184. scrollFrom: states.scrollOffset / (this.estimatedTotalSize - clientSize),
  38185. total
  38186. });
  38187. const listContainer = h$1(Container, {
  38188. class: [ns.e("window"), className],
  38189. style: windowStyle,
  38190. onScroll,
  38191. ref: "windowRef",
  38192. key: 0
  38193. }, !isString$1(Container) ? { default: () => [InnerNode] } : [InnerNode]);
  38194. return h$1("div", {
  38195. key: 0,
  38196. class: [ns.e("wrapper"), states.scrollbarAlwaysOn ? "always-on" : ""]
  38197. }, [listContainer, scrollbar]);
  38198. }
  38199. });
  38200. };
  38201. var createList$1 = createList;
  38202. const FixedSizeList = createList$1({
  38203. name: "ElFixedSizeList",
  38204. getItemOffset: ({ itemSize }, index) => index * itemSize,
  38205. getItemSize: ({ itemSize }) => itemSize,
  38206. getEstimatedTotalSize: ({ total, itemSize }) => itemSize * total,
  38207. getOffset: ({ height, total, itemSize, layout, width }, index, alignment, scrollOffset) => {
  38208. const size = isHorizontal(layout) ? width : height;
  38209. const lastItemOffset = Math.max(0, total * itemSize - size);
  38210. const maxOffset = Math.min(lastItemOffset, index * itemSize);
  38211. const minOffset = Math.max(0, (index + 1) * itemSize - size);
  38212. if (alignment === SMART_ALIGNMENT) {
  38213. if (scrollOffset >= minOffset - size && scrollOffset <= maxOffset + size) {
  38214. alignment = AUTO_ALIGNMENT;
  38215. } else {
  38216. alignment = CENTERED_ALIGNMENT;
  38217. }
  38218. }
  38219. switch (alignment) {
  38220. case START_ALIGNMENT: {
  38221. return maxOffset;
  38222. }
  38223. case END_ALIGNMENT: {
  38224. return minOffset;
  38225. }
  38226. case CENTERED_ALIGNMENT: {
  38227. const middleOffset = Math.round(minOffset + (maxOffset - minOffset) / 2);
  38228. if (middleOffset < Math.ceil(size / 2)) {
  38229. return 0;
  38230. } else if (middleOffset > lastItemOffset + Math.floor(size / 2)) {
  38231. return lastItemOffset;
  38232. } else {
  38233. return middleOffset;
  38234. }
  38235. }
  38236. case AUTO_ALIGNMENT:
  38237. default: {
  38238. if (scrollOffset >= minOffset && scrollOffset <= maxOffset) {
  38239. return scrollOffset;
  38240. } else if (scrollOffset < minOffset) {
  38241. return minOffset;
  38242. } else {
  38243. return maxOffset;
  38244. }
  38245. }
  38246. }
  38247. },
  38248. getStartIndexForOffset: ({ total, itemSize }, offset) => Math.max(0, Math.min(total - 1, Math.floor(offset / itemSize))),
  38249. getStopIndexForStartIndex: ({ height, total, itemSize, layout, width }, startIndex, scrollOffset) => {
  38250. const offset = startIndex * itemSize;
  38251. const size = isHorizontal(layout) ? width : height;
  38252. const numVisibleItems = Math.ceil((size + scrollOffset - offset) / itemSize);
  38253. return Math.max(0, Math.min(total - 1, startIndex + numVisibleItems - 1));
  38254. },
  38255. initCache() {
  38256. return void 0;
  38257. },
  38258. clearCache: true,
  38259. validateProps() {
  38260. }
  38261. });
  38262. var FixedSizeList$1 = FixedSizeList;
  38263. const getItemFromCache$1 = (props, index, listCache) => {
  38264. const { itemSize } = props;
  38265. const { items, lastVisitedIndex } = listCache;
  38266. if (index > lastVisitedIndex) {
  38267. let offset = 0;
  38268. if (lastVisitedIndex >= 0) {
  38269. const item = items[lastVisitedIndex];
  38270. offset = item.offset + item.size;
  38271. }
  38272. for (let i = lastVisitedIndex + 1; i <= index; i++) {
  38273. const size = itemSize(i);
  38274. items[i] = {
  38275. offset,
  38276. size
  38277. };
  38278. offset += size;
  38279. }
  38280. listCache.lastVisitedIndex = index;
  38281. }
  38282. return items[index];
  38283. };
  38284. const findItem$1 = (props, listCache, offset) => {
  38285. const { items, lastVisitedIndex } = listCache;
  38286. const lastVisitedOffset = lastVisitedIndex > 0 ? items[lastVisitedIndex].offset : 0;
  38287. if (lastVisitedOffset >= offset) {
  38288. return bs$1(props, listCache, 0, lastVisitedIndex, offset);
  38289. }
  38290. return es$1(props, listCache, Math.max(0, lastVisitedIndex), offset);
  38291. };
  38292. const bs$1 = (props, listCache, low, high, offset) => {
  38293. while (low <= high) {
  38294. const mid = low + Math.floor((high - low) / 2);
  38295. const currentOffset = getItemFromCache$1(props, mid, listCache).offset;
  38296. if (currentOffset === offset) {
  38297. return mid;
  38298. } else if (currentOffset < offset) {
  38299. low = mid + 1;
  38300. } else if (currentOffset > offset) {
  38301. high = mid - 1;
  38302. }
  38303. }
  38304. return Math.max(0, low - 1);
  38305. };
  38306. const es$1 = (props, listCache, index, offset) => {
  38307. const { total } = props;
  38308. let exponent = 1;
  38309. while (index < total && getItemFromCache$1(props, index, listCache).offset < offset) {
  38310. index += exponent;
  38311. exponent *= 2;
  38312. }
  38313. return bs$1(props, listCache, Math.floor(index / 2), Math.min(index, total - 1), offset);
  38314. };
  38315. const getEstimatedTotalSize = ({ total }, { items, estimatedItemSize, lastVisitedIndex }) => {
  38316. let totalSizeOfMeasuredItems = 0;
  38317. if (lastVisitedIndex >= total) {
  38318. lastVisitedIndex = total - 1;
  38319. }
  38320. if (lastVisitedIndex >= 0) {
  38321. const item = items[lastVisitedIndex];
  38322. totalSizeOfMeasuredItems = item.offset + item.size;
  38323. }
  38324. const numUnmeasuredItems = total - lastVisitedIndex - 1;
  38325. const totalSizeOfUnmeasuredItems = numUnmeasuredItems * estimatedItemSize;
  38326. return totalSizeOfMeasuredItems + totalSizeOfUnmeasuredItems;
  38327. };
  38328. const DynamicSizeList = createList$1({
  38329. name: "ElDynamicSizeList",
  38330. getItemOffset: (props, index, listCache) => getItemFromCache$1(props, index, listCache).offset,
  38331. getItemSize: (_, index, { items }) => items[index].size,
  38332. getEstimatedTotalSize,
  38333. getOffset: (props, index, alignment, scrollOffset, listCache) => {
  38334. const { height, layout, width } = props;
  38335. const size = isHorizontal(layout) ? width : height;
  38336. const item = getItemFromCache$1(props, index, listCache);
  38337. const estimatedTotalSize = getEstimatedTotalSize(props, listCache);
  38338. const maxOffset = Math.max(0, Math.min(estimatedTotalSize - size, item.offset));
  38339. const minOffset = Math.max(0, item.offset - size + item.size);
  38340. if (alignment === SMART_ALIGNMENT) {
  38341. if (scrollOffset >= minOffset - size && scrollOffset <= maxOffset + size) {
  38342. alignment = AUTO_ALIGNMENT;
  38343. } else {
  38344. alignment = CENTERED_ALIGNMENT;
  38345. }
  38346. }
  38347. switch (alignment) {
  38348. case START_ALIGNMENT: {
  38349. return maxOffset;
  38350. }
  38351. case END_ALIGNMENT: {
  38352. return minOffset;
  38353. }
  38354. case CENTERED_ALIGNMENT: {
  38355. return Math.round(minOffset + (maxOffset - minOffset) / 2);
  38356. }
  38357. case AUTO_ALIGNMENT:
  38358. default: {
  38359. if (scrollOffset >= minOffset && scrollOffset <= maxOffset) {
  38360. return scrollOffset;
  38361. } else if (scrollOffset < minOffset) {
  38362. return minOffset;
  38363. } else {
  38364. return maxOffset;
  38365. }
  38366. }
  38367. }
  38368. },
  38369. getStartIndexForOffset: (props, offset, listCache) => findItem$1(props, listCache, offset),
  38370. getStopIndexForStartIndex: (props, startIndex, scrollOffset, listCache) => {
  38371. const { height, total, layout, width } = props;
  38372. const size = isHorizontal(layout) ? width : height;
  38373. const item = getItemFromCache$1(props, startIndex, listCache);
  38374. const maxOffset = scrollOffset + size;
  38375. let offset = item.offset + item.size;
  38376. let stopIndex = startIndex;
  38377. while (stopIndex < total - 1 && offset < maxOffset) {
  38378. stopIndex++;
  38379. offset += getItemFromCache$1(props, stopIndex, listCache).size;
  38380. }
  38381. return stopIndex;
  38382. },
  38383. initCache({ estimatedItemSize = DEFAULT_DYNAMIC_LIST_ITEM_SIZE }, instance) {
  38384. const cache = {
  38385. items: {},
  38386. estimatedItemSize,
  38387. lastVisitedIndex: -1
  38388. };
  38389. cache.clearCacheAfterIndex = (index, forceUpdate = true) => {
  38390. var _a, _b;
  38391. cache.lastVisitedIndex = Math.min(cache.lastVisitedIndex, index - 1);
  38392. (_a = instance.exposed) == null ? void 0 : _a.getItemStyleCache(-1);
  38393. if (forceUpdate) {
  38394. (_b = instance.proxy) == null ? void 0 : _b.$forceUpdate();
  38395. }
  38396. };
  38397. return cache;
  38398. },
  38399. clearCache: false,
  38400. validateProps: ({ itemSize }) => {
  38401. }
  38402. });
  38403. var DynamicSizeList$1 = DynamicSizeList;
  38404. const useGridWheel = ({ atXEndEdge, atXStartEdge, atYEndEdge, atYStartEdge }, onWheelDelta) => {
  38405. let frameHandle = null;
  38406. let xOffset = 0;
  38407. let yOffset = 0;
  38408. const hasReachedEdge = (x, y) => {
  38409. const xEdgeReached = x <= 0 && atXStartEdge.value || x >= 0 && atXEndEdge.value;
  38410. const yEdgeReached = y <= 0 && atYStartEdge.value || y >= 0 && atYEndEdge.value;
  38411. return xEdgeReached && yEdgeReached;
  38412. };
  38413. const onWheel = (e) => {
  38414. cAF(frameHandle);
  38415. let x = e.deltaX;
  38416. let y = e.deltaY;
  38417. if (Math.abs(x) > Math.abs(y)) {
  38418. y = 0;
  38419. } else {
  38420. x = 0;
  38421. }
  38422. if (e.shiftKey && y !== 0) {
  38423. x = y;
  38424. y = 0;
  38425. }
  38426. if (hasReachedEdge(xOffset, yOffset) && hasReachedEdge(xOffset + x, yOffset + y))
  38427. return;
  38428. xOffset += x;
  38429. yOffset += y;
  38430. e.preventDefault();
  38431. frameHandle = rAF(() => {
  38432. onWheelDelta(xOffset, yOffset);
  38433. xOffset = 0;
  38434. yOffset = 0;
  38435. });
  38436. };
  38437. return {
  38438. hasReachedEdge,
  38439. onWheel
  38440. };
  38441. };
  38442. const createGrid = ({
  38443. name,
  38444. clearCache,
  38445. getColumnPosition,
  38446. getColumnStartIndexForOffset,
  38447. getColumnStopIndexForStartIndex,
  38448. getEstimatedTotalHeight,
  38449. getEstimatedTotalWidth,
  38450. getColumnOffset,
  38451. getRowOffset,
  38452. getRowPosition,
  38453. getRowStartIndexForOffset,
  38454. getRowStopIndexForStartIndex,
  38455. initCache,
  38456. injectToInstance,
  38457. validateProps
  38458. }) => {
  38459. return defineComponent({
  38460. name: name != null ? name : "ElVirtualList",
  38461. props: virtualizedGridProps,
  38462. emits: [ITEM_RENDER_EVT, SCROLL_EVT],
  38463. setup(props, { emit, expose, slots }) {
  38464. const ns = useNamespace("vl");
  38465. validateProps(props);
  38466. const instance = getCurrentInstance();
  38467. const cache = ref(initCache(props, instance));
  38468. injectToInstance == null ? void 0 : injectToInstance(instance, cache);
  38469. const windowRef = ref();
  38470. const hScrollbar = ref();
  38471. const vScrollbar = ref();
  38472. const innerRef = ref(null);
  38473. const states = ref({
  38474. isScrolling: false,
  38475. scrollLeft: isNumber(props.initScrollLeft) ? props.initScrollLeft : 0,
  38476. scrollTop: isNumber(props.initScrollTop) ? props.initScrollTop : 0,
  38477. updateRequested: false,
  38478. xAxisScrollDir: FORWARD,
  38479. yAxisScrollDir: FORWARD
  38480. });
  38481. const getItemStyleCache = useCache();
  38482. const parsedHeight = computed(() => Number.parseInt(`${props.height}`, 10));
  38483. const parsedWidth = computed(() => Number.parseInt(`${props.width}`, 10));
  38484. const columnsToRender = computed(() => {
  38485. const { totalColumn, totalRow, columnCache } = props;
  38486. const { isScrolling, xAxisScrollDir, scrollLeft } = unref(states);
  38487. if (totalColumn === 0 || totalRow === 0) {
  38488. return [0, 0, 0, 0];
  38489. }
  38490. const startIndex = getColumnStartIndexForOffset(props, scrollLeft, unref(cache));
  38491. const stopIndex = getColumnStopIndexForStartIndex(props, startIndex, scrollLeft, unref(cache));
  38492. const cacheBackward = !isScrolling || xAxisScrollDir === BACKWARD ? Math.max(1, columnCache) : 1;
  38493. const cacheForward = !isScrolling || xAxisScrollDir === FORWARD ? Math.max(1, columnCache) : 1;
  38494. return [
  38495. Math.max(0, startIndex - cacheBackward),
  38496. Math.max(0, Math.min(totalColumn - 1, stopIndex + cacheForward)),
  38497. startIndex,
  38498. stopIndex
  38499. ];
  38500. });
  38501. const rowsToRender = computed(() => {
  38502. const { totalColumn, totalRow, rowCache } = props;
  38503. const { isScrolling, yAxisScrollDir, scrollTop } = unref(states);
  38504. if (totalColumn === 0 || totalRow === 0) {
  38505. return [0, 0, 0, 0];
  38506. }
  38507. const startIndex = getRowStartIndexForOffset(props, scrollTop, unref(cache));
  38508. const stopIndex = getRowStopIndexForStartIndex(props, startIndex, scrollTop, unref(cache));
  38509. const cacheBackward = !isScrolling || yAxisScrollDir === BACKWARD ? Math.max(1, rowCache) : 1;
  38510. const cacheForward = !isScrolling || yAxisScrollDir === FORWARD ? Math.max(1, rowCache) : 1;
  38511. return [
  38512. Math.max(0, startIndex - cacheBackward),
  38513. Math.max(0, Math.min(totalRow - 1, stopIndex + cacheForward)),
  38514. startIndex,
  38515. stopIndex
  38516. ];
  38517. });
  38518. const estimatedTotalHeight = computed(() => getEstimatedTotalHeight(props, unref(cache)));
  38519. const estimatedTotalWidth = computed(() => getEstimatedTotalWidth(props, unref(cache)));
  38520. const windowStyle = computed(() => {
  38521. var _a;
  38522. return [
  38523. {
  38524. position: "relative",
  38525. overflow: "hidden",
  38526. WebkitOverflowScrolling: "touch",
  38527. willChange: "transform"
  38528. },
  38529. {
  38530. direction: props.direction,
  38531. height: isNumber(props.height) ? `${props.height}px` : props.height,
  38532. width: isNumber(props.width) ? `${props.width}px` : props.width
  38533. },
  38534. (_a = props.style) != null ? _a : {}
  38535. ];
  38536. });
  38537. const innerStyle = computed(() => {
  38538. const width = `${unref(estimatedTotalWidth)}px`;
  38539. const height = `${unref(estimatedTotalHeight)}px`;
  38540. return {
  38541. height,
  38542. pointerEvents: unref(states).isScrolling ? "none" : void 0,
  38543. width
  38544. };
  38545. });
  38546. const emitEvents = () => {
  38547. const { totalColumn, totalRow } = props;
  38548. if (totalColumn > 0 && totalRow > 0) {
  38549. const [
  38550. columnCacheStart,
  38551. columnCacheEnd,
  38552. columnVisibleStart,
  38553. columnVisibleEnd
  38554. ] = unref(columnsToRender);
  38555. const [rowCacheStart, rowCacheEnd, rowVisibleStart, rowVisibleEnd] = unref(rowsToRender);
  38556. emit(ITEM_RENDER_EVT, {
  38557. columnCacheStart,
  38558. columnCacheEnd,
  38559. rowCacheStart,
  38560. rowCacheEnd,
  38561. columnVisibleStart,
  38562. columnVisibleEnd,
  38563. rowVisibleStart,
  38564. rowVisibleEnd
  38565. });
  38566. }
  38567. const {
  38568. scrollLeft,
  38569. scrollTop,
  38570. updateRequested,
  38571. xAxisScrollDir,
  38572. yAxisScrollDir
  38573. } = unref(states);
  38574. emit(SCROLL_EVT, {
  38575. xAxisScrollDir,
  38576. scrollLeft,
  38577. yAxisScrollDir,
  38578. scrollTop,
  38579. updateRequested
  38580. });
  38581. };
  38582. const onScroll = (e) => {
  38583. const {
  38584. clientHeight,
  38585. clientWidth,
  38586. scrollHeight,
  38587. scrollLeft,
  38588. scrollTop,
  38589. scrollWidth
  38590. } = e.currentTarget;
  38591. const _states = unref(states);
  38592. if (_states.scrollTop === scrollTop && _states.scrollLeft === scrollLeft) {
  38593. return;
  38594. }
  38595. let _scrollLeft = scrollLeft;
  38596. if (isRTL(props.direction)) {
  38597. switch (getRTLOffsetType()) {
  38598. case RTL_OFFSET_NAG:
  38599. _scrollLeft = -scrollLeft;
  38600. break;
  38601. case RTL_OFFSET_POS_DESC:
  38602. _scrollLeft = scrollWidth - clientWidth - scrollLeft;
  38603. break;
  38604. }
  38605. }
  38606. states.value = {
  38607. ..._states,
  38608. isScrolling: true,
  38609. scrollLeft: _scrollLeft,
  38610. scrollTop: Math.max(0, Math.min(scrollTop, scrollHeight - clientHeight)),
  38611. updateRequested: true,
  38612. xAxisScrollDir: getScrollDir(_states.scrollLeft, _scrollLeft),
  38613. yAxisScrollDir: getScrollDir(_states.scrollTop, scrollTop)
  38614. };
  38615. nextTick(() => resetIsScrolling());
  38616. onUpdated();
  38617. emitEvents();
  38618. };
  38619. const onVerticalScroll = (distance, totalSteps) => {
  38620. const height = unref(parsedHeight);
  38621. const offset = (estimatedTotalHeight.value - height) / totalSteps * distance;
  38622. scrollTo({
  38623. scrollTop: Math.min(estimatedTotalHeight.value - height, offset)
  38624. });
  38625. };
  38626. const onHorizontalScroll = (distance, totalSteps) => {
  38627. const width = unref(parsedWidth);
  38628. const offset = (estimatedTotalWidth.value - width) / totalSteps * distance;
  38629. scrollTo({
  38630. scrollLeft: Math.min(estimatedTotalWidth.value - width, offset)
  38631. });
  38632. };
  38633. const { onWheel } = useGridWheel({
  38634. atXStartEdge: computed(() => states.value.scrollLeft <= 0),
  38635. atXEndEdge: computed(() => states.value.scrollLeft >= estimatedTotalWidth.value - unref(parsedWidth)),
  38636. atYStartEdge: computed(() => states.value.scrollTop <= 0),
  38637. atYEndEdge: computed(() => states.value.scrollTop >= estimatedTotalHeight.value - unref(parsedHeight))
  38638. }, (x, y) => {
  38639. var _a, _b, _c, _d;
  38640. (_b = (_a = hScrollbar.value) == null ? void 0 : _a.onMouseUp) == null ? void 0 : _b.call(_a);
  38641. (_d = (_c = vScrollbar.value) == null ? void 0 : _c.onMouseUp) == null ? void 0 : _d.call(_c);
  38642. const width = unref(parsedWidth);
  38643. const height = unref(parsedHeight);
  38644. scrollTo({
  38645. scrollLeft: Math.min(states.value.scrollLeft + x, estimatedTotalWidth.value - width),
  38646. scrollTop: Math.min(states.value.scrollTop + y, estimatedTotalHeight.value - height)
  38647. });
  38648. });
  38649. useEventListener(windowRef, "wheel", onWheel, {
  38650. passive: false
  38651. });
  38652. const scrollTo = ({
  38653. scrollLeft = states.value.scrollLeft,
  38654. scrollTop = states.value.scrollTop
  38655. }) => {
  38656. scrollLeft = Math.max(scrollLeft, 0);
  38657. scrollTop = Math.max(scrollTop, 0);
  38658. const _states = unref(states);
  38659. if (scrollTop === _states.scrollTop && scrollLeft === _states.scrollLeft) {
  38660. return;
  38661. }
  38662. states.value = {
  38663. ..._states,
  38664. xAxisScrollDir: getScrollDir(_states.scrollLeft, scrollLeft),
  38665. yAxisScrollDir: getScrollDir(_states.scrollTop, scrollTop),
  38666. scrollLeft,
  38667. scrollTop,
  38668. updateRequested: true
  38669. };
  38670. nextTick(() => resetIsScrolling());
  38671. onUpdated();
  38672. emitEvents();
  38673. };
  38674. const scrollToItem = (rowIndex = 0, columnIdx = 0, alignment = AUTO_ALIGNMENT) => {
  38675. const _states = unref(states);
  38676. columnIdx = Math.max(0, Math.min(columnIdx, props.totalColumn - 1));
  38677. rowIndex = Math.max(0, Math.min(rowIndex, props.totalRow - 1));
  38678. const scrollBarWidth = getScrollBarWidth(ns.namespace.value);
  38679. const _cache = unref(cache);
  38680. const estimatedHeight = getEstimatedTotalHeight(props, _cache);
  38681. const estimatedWidth = getEstimatedTotalWidth(props, _cache);
  38682. scrollTo({
  38683. scrollLeft: getColumnOffset(props, columnIdx, alignment, _states.scrollLeft, _cache, estimatedWidth > props.width ? scrollBarWidth : 0),
  38684. scrollTop: getRowOffset(props, rowIndex, alignment, _states.scrollTop, _cache, estimatedHeight > props.height ? scrollBarWidth : 0)
  38685. });
  38686. };
  38687. const getItemStyle = (rowIndex, columnIndex) => {
  38688. const { columnWidth, direction, rowHeight } = props;
  38689. const itemStyleCache = getItemStyleCache.value(clearCache && columnWidth, clearCache && rowHeight, clearCache && direction);
  38690. const key = `${rowIndex},${columnIndex}`;
  38691. if (hasOwn(itemStyleCache, key)) {
  38692. return itemStyleCache[key];
  38693. } else {
  38694. const [, left] = getColumnPosition(props, columnIndex, unref(cache));
  38695. const _cache = unref(cache);
  38696. const rtl = isRTL(direction);
  38697. const [height, top] = getRowPosition(props, rowIndex, _cache);
  38698. const [width] = getColumnPosition(props, columnIndex, _cache);
  38699. itemStyleCache[key] = {
  38700. position: "absolute",
  38701. left: rtl ? void 0 : `${left}px`,
  38702. right: rtl ? `${left}px` : void 0,
  38703. top: `${top}px`,
  38704. height: `${height}px`,
  38705. width: `${width}px`
  38706. };
  38707. return itemStyleCache[key];
  38708. }
  38709. };
  38710. const resetIsScrolling = () => {
  38711. states.value.isScrolling = false;
  38712. nextTick(() => {
  38713. getItemStyleCache.value(-1, null, null);
  38714. });
  38715. };
  38716. onMounted(() => {
  38717. if (!isClient)
  38718. return;
  38719. const { initScrollLeft, initScrollTop } = props;
  38720. const windowElement = unref(windowRef);
  38721. if (windowElement) {
  38722. if (isNumber(initScrollLeft)) {
  38723. windowElement.scrollLeft = initScrollLeft;
  38724. }
  38725. if (isNumber(initScrollTop)) {
  38726. windowElement.scrollTop = initScrollTop;
  38727. }
  38728. }
  38729. emitEvents();
  38730. });
  38731. const onUpdated = () => {
  38732. const { direction } = props;
  38733. const { scrollLeft, scrollTop, updateRequested } = unref(states);
  38734. const windowElement = unref(windowRef);
  38735. if (updateRequested && windowElement) {
  38736. if (direction === RTL) {
  38737. switch (getRTLOffsetType()) {
  38738. case RTL_OFFSET_NAG: {
  38739. windowElement.scrollLeft = -scrollLeft;
  38740. break;
  38741. }
  38742. case RTL_OFFSET_POS_ASC: {
  38743. windowElement.scrollLeft = scrollLeft;
  38744. break;
  38745. }
  38746. default: {
  38747. const { clientWidth, scrollWidth } = windowElement;
  38748. windowElement.scrollLeft = scrollWidth - clientWidth - scrollLeft;
  38749. break;
  38750. }
  38751. }
  38752. } else {
  38753. windowElement.scrollLeft = Math.max(0, scrollLeft);
  38754. }
  38755. windowElement.scrollTop = Math.max(0, scrollTop);
  38756. }
  38757. };
  38758. const { resetAfterColumnIndex, resetAfterRowIndex, resetAfter } = instance.proxy;
  38759. expose({
  38760. windowRef,
  38761. innerRef,
  38762. getItemStyleCache,
  38763. scrollTo,
  38764. scrollToItem,
  38765. states,
  38766. resetAfterColumnIndex,
  38767. resetAfterRowIndex,
  38768. resetAfter
  38769. });
  38770. const renderScrollbars = () => {
  38771. const {
  38772. scrollbarAlwaysOn,
  38773. scrollbarStartGap,
  38774. scrollbarEndGap,
  38775. totalColumn,
  38776. totalRow
  38777. } = props;
  38778. const width = unref(parsedWidth);
  38779. const height = unref(parsedHeight);
  38780. const estimatedWidth = unref(estimatedTotalWidth);
  38781. const estimatedHeight = unref(estimatedTotalHeight);
  38782. const { scrollLeft, scrollTop } = unref(states);
  38783. const horizontalScrollbar = h$1(Scrollbar, {
  38784. ref: hScrollbar,
  38785. alwaysOn: scrollbarAlwaysOn,
  38786. startGap: scrollbarStartGap,
  38787. endGap: scrollbarEndGap,
  38788. class: ns.e("horizontal"),
  38789. clientSize: width,
  38790. layout: "horizontal",
  38791. onScroll: onHorizontalScroll,
  38792. ratio: width * 100 / estimatedWidth,
  38793. scrollFrom: scrollLeft / (estimatedWidth - width),
  38794. total: totalRow,
  38795. visible: true
  38796. });
  38797. const verticalScrollbar = h$1(Scrollbar, {
  38798. ref: vScrollbar,
  38799. alwaysOn: scrollbarAlwaysOn,
  38800. startGap: scrollbarStartGap,
  38801. endGap: scrollbarEndGap,
  38802. class: ns.e("vertical"),
  38803. clientSize: height,
  38804. layout: "vertical",
  38805. onScroll: onVerticalScroll,
  38806. ratio: height * 100 / estimatedHeight,
  38807. scrollFrom: scrollTop / (estimatedHeight - height),
  38808. total: totalColumn,
  38809. visible: true
  38810. });
  38811. return {
  38812. horizontalScrollbar,
  38813. verticalScrollbar
  38814. };
  38815. };
  38816. const renderItems = () => {
  38817. var _a;
  38818. const [columnStart, columnEnd] = unref(columnsToRender);
  38819. const [rowStart, rowEnd] = unref(rowsToRender);
  38820. const { data, totalColumn, totalRow, useIsScrolling, itemKey } = props;
  38821. const children = [];
  38822. if (totalRow > 0 && totalColumn > 0) {
  38823. for (let row = rowStart; row <= rowEnd; row++) {
  38824. for (let column = columnStart; column <= columnEnd; column++) {
  38825. const key = itemKey({ columnIndex: column, data, rowIndex: row });
  38826. children.push(h$1(Fragment, { key }, (_a = slots.default) == null ? void 0 : _a.call(slots, {
  38827. columnIndex: column,
  38828. data,
  38829. isScrolling: useIsScrolling ? unref(states).isScrolling : void 0,
  38830. style: getItemStyle(row, column),
  38831. rowIndex: row
  38832. })));
  38833. }
  38834. }
  38835. }
  38836. return children;
  38837. };
  38838. const renderInner = () => {
  38839. const Inner = resolveDynamicComponent(props.innerElement);
  38840. const children = renderItems();
  38841. return [
  38842. h$1(Inner, {
  38843. style: unref(innerStyle),
  38844. ref: innerRef
  38845. }, !isString$1(Inner) ? {
  38846. default: () => children
  38847. } : children)
  38848. ];
  38849. };
  38850. const renderWindow = () => {
  38851. const Container = resolveDynamicComponent(props.containerElement);
  38852. const { horizontalScrollbar, verticalScrollbar } = renderScrollbars();
  38853. const Inner = renderInner();
  38854. return h$1("div", {
  38855. key: 0,
  38856. class: ns.e("wrapper"),
  38857. role: props.role
  38858. }, [
  38859. h$1(Container, {
  38860. class: props.className,
  38861. style: unref(windowStyle),
  38862. onScroll,
  38863. ref: windowRef
  38864. }, !isString$1(Container) ? { default: () => Inner } : Inner),
  38865. horizontalScrollbar,
  38866. verticalScrollbar
  38867. ]);
  38868. };
  38869. return renderWindow;
  38870. }
  38871. });
  38872. };
  38873. var createGrid$1 = createGrid;
  38874. const FixedSizeGrid = createGrid$1({
  38875. name: "ElFixedSizeGrid",
  38876. getColumnPosition: ({ columnWidth }, index) => [
  38877. columnWidth,
  38878. index * columnWidth
  38879. ],
  38880. getRowPosition: ({ rowHeight }, index) => [
  38881. rowHeight,
  38882. index * rowHeight
  38883. ],
  38884. getEstimatedTotalHeight: ({ totalRow, rowHeight }) => rowHeight * totalRow,
  38885. getEstimatedTotalWidth: ({ totalColumn, columnWidth }) => columnWidth * totalColumn,
  38886. getColumnOffset: ({ totalColumn, columnWidth, width }, columnIndex, alignment, scrollLeft, _, scrollBarWidth) => {
  38887. width = Number(width);
  38888. const lastColumnOffset = Math.max(0, totalColumn * columnWidth - width);
  38889. const maxOffset = Math.min(lastColumnOffset, columnIndex * columnWidth);
  38890. const minOffset = Math.max(0, columnIndex * columnWidth - width + scrollBarWidth + columnWidth);
  38891. if (alignment === "smart") {
  38892. if (scrollLeft >= minOffset - width && scrollLeft <= maxOffset + width) {
  38893. alignment = AUTO_ALIGNMENT;
  38894. } else {
  38895. alignment = CENTERED_ALIGNMENT;
  38896. }
  38897. }
  38898. switch (alignment) {
  38899. case START_ALIGNMENT:
  38900. return maxOffset;
  38901. case END_ALIGNMENT:
  38902. return minOffset;
  38903. case CENTERED_ALIGNMENT: {
  38904. const middleOffset = Math.round(minOffset + (maxOffset - minOffset) / 2);
  38905. if (middleOffset < Math.ceil(width / 2)) {
  38906. return 0;
  38907. } else if (middleOffset > lastColumnOffset + Math.floor(width / 2)) {
  38908. return lastColumnOffset;
  38909. } else {
  38910. return middleOffset;
  38911. }
  38912. }
  38913. case AUTO_ALIGNMENT:
  38914. default:
  38915. if (scrollLeft >= minOffset && scrollLeft <= maxOffset) {
  38916. return scrollLeft;
  38917. } else if (minOffset > maxOffset) {
  38918. return minOffset;
  38919. } else if (scrollLeft < minOffset) {
  38920. return minOffset;
  38921. } else {
  38922. return maxOffset;
  38923. }
  38924. }
  38925. },
  38926. getRowOffset: ({ rowHeight, height, totalRow }, rowIndex, align, scrollTop, _, scrollBarWidth) => {
  38927. height = Number(height);
  38928. const lastRowOffset = Math.max(0, totalRow * rowHeight - height);
  38929. const maxOffset = Math.min(lastRowOffset, rowIndex * rowHeight);
  38930. const minOffset = Math.max(0, rowIndex * rowHeight - height + scrollBarWidth + rowHeight);
  38931. if (align === SMART_ALIGNMENT) {
  38932. if (scrollTop >= minOffset - height && scrollTop <= maxOffset + height) {
  38933. align = AUTO_ALIGNMENT;
  38934. } else {
  38935. align = CENTERED_ALIGNMENT;
  38936. }
  38937. }
  38938. switch (align) {
  38939. case START_ALIGNMENT:
  38940. return maxOffset;
  38941. case END_ALIGNMENT:
  38942. return minOffset;
  38943. case CENTERED_ALIGNMENT: {
  38944. const middleOffset = Math.round(minOffset + (maxOffset - minOffset) / 2);
  38945. if (middleOffset < Math.ceil(height / 2)) {
  38946. return 0;
  38947. } else if (middleOffset > lastRowOffset + Math.floor(height / 2)) {
  38948. return lastRowOffset;
  38949. } else {
  38950. return middleOffset;
  38951. }
  38952. }
  38953. case AUTO_ALIGNMENT:
  38954. default:
  38955. if (scrollTop >= minOffset && scrollTop <= maxOffset) {
  38956. return scrollTop;
  38957. } else if (minOffset > maxOffset) {
  38958. return minOffset;
  38959. } else if (scrollTop < minOffset) {
  38960. return minOffset;
  38961. } else {
  38962. return maxOffset;
  38963. }
  38964. }
  38965. },
  38966. getColumnStartIndexForOffset: ({ columnWidth, totalColumn }, scrollLeft) => Math.max(0, Math.min(totalColumn - 1, Math.floor(scrollLeft / columnWidth))),
  38967. getColumnStopIndexForStartIndex: ({ columnWidth, totalColumn, width }, startIndex, scrollLeft) => {
  38968. const left = startIndex * columnWidth;
  38969. const visibleColumnsCount = Math.ceil((width + scrollLeft - left) / columnWidth);
  38970. return Math.max(0, Math.min(totalColumn - 1, startIndex + visibleColumnsCount - 1));
  38971. },
  38972. getRowStartIndexForOffset: ({ rowHeight, totalRow }, scrollTop) => Math.max(0, Math.min(totalRow - 1, Math.floor(scrollTop / rowHeight))),
  38973. getRowStopIndexForStartIndex: ({ rowHeight, totalRow, height }, startIndex, scrollTop) => {
  38974. const top = startIndex * rowHeight;
  38975. const numVisibleRows = Math.ceil((height + scrollTop - top) / rowHeight);
  38976. return Math.max(0, Math.min(totalRow - 1, startIndex + numVisibleRows - 1));
  38977. },
  38978. initCache: () => void 0,
  38979. clearCache: true,
  38980. validateProps: ({ columnWidth, rowHeight }) => {
  38981. }
  38982. });
  38983. var FixedSizeGrid$1 = FixedSizeGrid;
  38984. const { max, min, floor } = Math;
  38985. const ACCESS_SIZER_KEY_MAP = {
  38986. column: "columnWidth",
  38987. row: "rowHeight"
  38988. };
  38989. const ACCESS_LAST_VISITED_KEY_MAP = {
  38990. column: "lastVisitedColumnIndex",
  38991. row: "lastVisitedRowIndex"
  38992. };
  38993. const getItemFromCache = (props, index, gridCache, type) => {
  38994. const [cachedItems, sizer, lastVisited] = [
  38995. gridCache[type],
  38996. props[ACCESS_SIZER_KEY_MAP[type]],
  38997. gridCache[ACCESS_LAST_VISITED_KEY_MAP[type]]
  38998. ];
  38999. if (index > lastVisited) {
  39000. let offset = 0;
  39001. if (lastVisited >= 0) {
  39002. const item = cachedItems[lastVisited];
  39003. offset = item.offset + item.size;
  39004. }
  39005. for (let i = lastVisited + 1; i <= index; i++) {
  39006. const size = sizer(i);
  39007. cachedItems[i] = {
  39008. offset,
  39009. size
  39010. };
  39011. offset += size;
  39012. }
  39013. gridCache[ACCESS_LAST_VISITED_KEY_MAP[type]] = index;
  39014. }
  39015. return cachedItems[index];
  39016. };
  39017. const bs = (props, gridCache, low, high, offset, type) => {
  39018. while (low <= high) {
  39019. const mid = low + floor((high - low) / 2);
  39020. const currentOffset = getItemFromCache(props, mid, gridCache, type).offset;
  39021. if (currentOffset === offset) {
  39022. return mid;
  39023. } else if (currentOffset < offset) {
  39024. low = mid + 1;
  39025. } else {
  39026. high = mid - 1;
  39027. }
  39028. }
  39029. return max(0, low - 1);
  39030. };
  39031. const es = (props, gridCache, idx, offset, type) => {
  39032. const total = type === "column" ? props.totalColumn : props.totalRow;
  39033. let exponent = 1;
  39034. while (idx < total && getItemFromCache(props, idx, gridCache, type).offset < offset) {
  39035. idx += exponent;
  39036. exponent *= 2;
  39037. }
  39038. return bs(props, gridCache, floor(idx / 2), min(idx, total - 1), offset, type);
  39039. };
  39040. const findItem = (props, gridCache, offset, type) => {
  39041. const [cache, lastVisitedIndex] = [
  39042. gridCache[type],
  39043. gridCache[ACCESS_LAST_VISITED_KEY_MAP[type]]
  39044. ];
  39045. const lastVisitedItemOffset = lastVisitedIndex > 0 ? cache[lastVisitedIndex].offset : 0;
  39046. if (lastVisitedItemOffset >= offset) {
  39047. return bs(props, gridCache, 0, lastVisitedIndex, offset, type);
  39048. }
  39049. return es(props, gridCache, max(0, lastVisitedIndex), offset, type);
  39050. };
  39051. const getEstimatedTotalHeight = ({ totalRow }, { estimatedRowHeight, lastVisitedRowIndex, row }) => {
  39052. let sizeOfVisitedRows = 0;
  39053. if (lastVisitedRowIndex >= totalRow) {
  39054. lastVisitedRowIndex = totalRow - 1;
  39055. }
  39056. if (lastVisitedRowIndex >= 0) {
  39057. const item = row[lastVisitedRowIndex];
  39058. sizeOfVisitedRows = item.offset + item.size;
  39059. }
  39060. const unvisitedItems = totalRow - lastVisitedRowIndex - 1;
  39061. const sizeOfUnvisitedItems = unvisitedItems * estimatedRowHeight;
  39062. return sizeOfVisitedRows + sizeOfUnvisitedItems;
  39063. };
  39064. const getEstimatedTotalWidth = ({ totalColumn }, { column, estimatedColumnWidth, lastVisitedColumnIndex }) => {
  39065. let sizeOfVisitedColumns = 0;
  39066. if (lastVisitedColumnIndex > totalColumn) {
  39067. lastVisitedColumnIndex = totalColumn - 1;
  39068. }
  39069. if (lastVisitedColumnIndex >= 0) {
  39070. const item = column[lastVisitedColumnIndex];
  39071. sizeOfVisitedColumns = item.offset + item.size;
  39072. }
  39073. const unvisitedItems = totalColumn - lastVisitedColumnIndex - 1;
  39074. const sizeOfUnvisitedItems = unvisitedItems * estimatedColumnWidth;
  39075. return sizeOfVisitedColumns + sizeOfUnvisitedItems;
  39076. };
  39077. const ACCESS_ESTIMATED_SIZE_KEY_MAP = {
  39078. column: getEstimatedTotalWidth,
  39079. row: getEstimatedTotalHeight
  39080. };
  39081. const getOffset$1 = (props, index, alignment, scrollOffset, cache, type, scrollBarWidth) => {
  39082. const [size, estimatedSizeAssociates] = [
  39083. type === "row" ? props.height : props.width,
  39084. ACCESS_ESTIMATED_SIZE_KEY_MAP[type]
  39085. ];
  39086. const item = getItemFromCache(props, index, cache, type);
  39087. const estimatedSize = estimatedSizeAssociates(props, cache);
  39088. const maxOffset = max(0, min(estimatedSize - size, item.offset));
  39089. const minOffset = max(0, item.offset - size + scrollBarWidth + item.size);
  39090. if (alignment === SMART_ALIGNMENT) {
  39091. if (scrollOffset >= minOffset - size && scrollOffset <= maxOffset + size) {
  39092. alignment = AUTO_ALIGNMENT;
  39093. } else {
  39094. alignment = CENTERED_ALIGNMENT;
  39095. }
  39096. }
  39097. switch (alignment) {
  39098. case START_ALIGNMENT: {
  39099. return maxOffset;
  39100. }
  39101. case END_ALIGNMENT: {
  39102. return minOffset;
  39103. }
  39104. case CENTERED_ALIGNMENT: {
  39105. return Math.round(minOffset + (maxOffset - minOffset) / 2);
  39106. }
  39107. case AUTO_ALIGNMENT:
  39108. default: {
  39109. if (scrollOffset >= minOffset && scrollOffset <= maxOffset) {
  39110. return scrollOffset;
  39111. } else if (minOffset > maxOffset) {
  39112. return minOffset;
  39113. } else if (scrollOffset < minOffset) {
  39114. return minOffset;
  39115. } else {
  39116. return maxOffset;
  39117. }
  39118. }
  39119. }
  39120. };
  39121. const DynamicSizeGrid = createGrid$1({
  39122. name: "ElDynamicSizeGrid",
  39123. getColumnPosition: (props, idx, cache) => {
  39124. const item = getItemFromCache(props, idx, cache, "column");
  39125. return [item.size, item.offset];
  39126. },
  39127. getRowPosition: (props, idx, cache) => {
  39128. const item = getItemFromCache(props, idx, cache, "row");
  39129. return [item.size, item.offset];
  39130. },
  39131. getColumnOffset: (props, columnIndex, alignment, scrollLeft, cache, scrollBarWidth) => getOffset$1(props, columnIndex, alignment, scrollLeft, cache, "column", scrollBarWidth),
  39132. getRowOffset: (props, rowIndex, alignment, scrollTop, cache, scrollBarWidth) => getOffset$1(props, rowIndex, alignment, scrollTop, cache, "row", scrollBarWidth),
  39133. getColumnStartIndexForOffset: (props, scrollLeft, cache) => findItem(props, cache, scrollLeft, "column"),
  39134. getColumnStopIndexForStartIndex: (props, startIndex, scrollLeft, cache) => {
  39135. const item = getItemFromCache(props, startIndex, cache, "column");
  39136. const maxOffset = scrollLeft + props.width;
  39137. let offset = item.offset + item.size;
  39138. let stopIndex = startIndex;
  39139. while (stopIndex < props.totalColumn - 1 && offset < maxOffset) {
  39140. stopIndex++;
  39141. offset += getItemFromCache(props, startIndex, cache, "column").size;
  39142. }
  39143. return stopIndex;
  39144. },
  39145. getEstimatedTotalHeight,
  39146. getEstimatedTotalWidth,
  39147. getRowStartIndexForOffset: (props, scrollTop, cache) => findItem(props, cache, scrollTop, "row"),
  39148. getRowStopIndexForStartIndex: (props, startIndex, scrollTop, cache) => {
  39149. const { totalRow, height } = props;
  39150. const item = getItemFromCache(props, startIndex, cache, "row");
  39151. const maxOffset = scrollTop + height;
  39152. let offset = item.size + item.offset;
  39153. let stopIndex = startIndex;
  39154. while (stopIndex < totalRow - 1 && offset < maxOffset) {
  39155. stopIndex++;
  39156. offset += getItemFromCache(props, stopIndex, cache, "row").size;
  39157. }
  39158. return stopIndex;
  39159. },
  39160. injectToInstance: (instance, cache) => {
  39161. const resetAfter = ({ columnIndex, rowIndex }, forceUpdate) => {
  39162. var _a, _b;
  39163. forceUpdate = isUndefined(forceUpdate) ? true : forceUpdate;
  39164. if (isNumber(columnIndex)) {
  39165. cache.value.lastVisitedColumnIndex = Math.min(cache.value.lastVisitedColumnIndex, columnIndex - 1);
  39166. }
  39167. if (isNumber(rowIndex)) {
  39168. cache.value.lastVisitedRowIndex = Math.min(cache.value.lastVisitedRowIndex, rowIndex - 1);
  39169. }
  39170. (_a = instance.exposed) == null ? void 0 : _a.getItemStyleCache.value(-1, null, null);
  39171. if (forceUpdate)
  39172. (_b = instance.proxy) == null ? void 0 : _b.$forceUpdate();
  39173. };
  39174. const resetAfterColumnIndex = (columnIndex, forceUpdate) => {
  39175. resetAfter({
  39176. columnIndex
  39177. }, forceUpdate);
  39178. };
  39179. const resetAfterRowIndex = (rowIndex, forceUpdate) => {
  39180. resetAfter({
  39181. rowIndex
  39182. }, forceUpdate);
  39183. };
  39184. Object.assign(instance.proxy, {
  39185. resetAfterColumnIndex,
  39186. resetAfterRowIndex,
  39187. resetAfter
  39188. });
  39189. },
  39190. initCache: ({
  39191. estimatedColumnWidth = DEFAULT_DYNAMIC_LIST_ITEM_SIZE,
  39192. estimatedRowHeight = DEFAULT_DYNAMIC_LIST_ITEM_SIZE
  39193. }) => {
  39194. const cache = {
  39195. column: {},
  39196. estimatedColumnWidth,
  39197. estimatedRowHeight,
  39198. lastVisitedColumnIndex: -1,
  39199. lastVisitedRowIndex: -1,
  39200. row: {}
  39201. };
  39202. return cache;
  39203. },
  39204. clearCache: false,
  39205. validateProps: ({ columnWidth, rowHeight }) => {
  39206. }
  39207. });
  39208. var DynamicSizeGrid$1 = DynamicSizeGrid;
  39209. const _sfc_main$O = defineComponent({
  39210. props: {
  39211. item: {
  39212. type: Object,
  39213. required: true
  39214. },
  39215. style: {
  39216. type: Object
  39217. },
  39218. height: Number
  39219. },
  39220. setup() {
  39221. const ns = useNamespace("select");
  39222. return {
  39223. ns
  39224. };
  39225. }
  39226. });
  39227. function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
  39228. return openBlock(), createElementBlock("div", {
  39229. class: normalizeClass(_ctx.ns.be("group", "title")),
  39230. style: normalizeStyle({ ..._ctx.style, lineHeight: `${_ctx.height}px` })
  39231. }, toDisplayString(_ctx.item.label), 7);
  39232. }
  39233. var GroupItem = /* @__PURE__ */ _export_sfc(_sfc_main$O, [["render", _sfc_render$7], ["__file", "group-item.vue"]]);
  39234. function useOption(props, { emit }) {
  39235. return {
  39236. hoverItem: () => {
  39237. if (!props.disabled) {
  39238. emit("hover", props.index);
  39239. }
  39240. },
  39241. selectOptionClick: () => {
  39242. if (!props.disabled) {
  39243. emit("select", props.item, props.index);
  39244. }
  39245. }
  39246. };
  39247. }
  39248. const defaultProps$5 = {
  39249. label: "label",
  39250. value: "value",
  39251. disabled: "disabled",
  39252. options: "options"
  39253. };
  39254. function useProps(props) {
  39255. const aliasProps = computed(() => ({ ...defaultProps$5, ...props.props }));
  39256. const getLabel = (option) => get(option, aliasProps.value.label);
  39257. const getValue = (option) => get(option, aliasProps.value.value);
  39258. const getDisabled = (option) => get(option, aliasProps.value.disabled);
  39259. const getOptions = (option) => get(option, aliasProps.value.options);
  39260. return {
  39261. aliasProps,
  39262. getLabel,
  39263. getValue,
  39264. getDisabled,
  39265. getOptions
  39266. };
  39267. }
  39268. const SelectProps = buildProps({
  39269. allowCreate: Boolean,
  39270. autocomplete: {
  39271. type: definePropType(String),
  39272. default: "none"
  39273. },
  39274. automaticDropdown: Boolean,
  39275. clearable: Boolean,
  39276. clearIcon: {
  39277. type: iconPropType,
  39278. default: circle_close_default
  39279. },
  39280. effect: {
  39281. type: definePropType(String),
  39282. default: "light"
  39283. },
  39284. collapseTags: Boolean,
  39285. collapseTagsTooltip: Boolean,
  39286. maxCollapseTags: {
  39287. type: Number,
  39288. default: 1
  39289. },
  39290. defaultFirstOption: Boolean,
  39291. disabled: Boolean,
  39292. estimatedOptionHeight: {
  39293. type: Number,
  39294. default: void 0
  39295. },
  39296. filterable: Boolean,
  39297. filterMethod: Function,
  39298. height: {
  39299. type: Number,
  39300. default: 274
  39301. },
  39302. itemHeight: {
  39303. type: Number,
  39304. default: 34
  39305. },
  39306. id: String,
  39307. loading: Boolean,
  39308. loadingText: String,
  39309. modelValue: {
  39310. type: definePropType([Array, String, Number, Boolean, Object])
  39311. },
  39312. multiple: Boolean,
  39313. multipleLimit: {
  39314. type: Number,
  39315. default: 0
  39316. },
  39317. name: String,
  39318. noDataText: String,
  39319. noMatchText: String,
  39320. remoteMethod: Function,
  39321. reserveKeyword: {
  39322. type: Boolean,
  39323. default: true
  39324. },
  39325. options: {
  39326. type: definePropType(Array),
  39327. required: true
  39328. },
  39329. placeholder: {
  39330. type: String
  39331. },
  39332. teleported: useTooltipContentProps.teleported,
  39333. persistent: {
  39334. type: Boolean,
  39335. default: true
  39336. },
  39337. popperClass: {
  39338. type: String,
  39339. default: ""
  39340. },
  39341. popperOptions: {
  39342. type: definePropType(Object),
  39343. default: () => ({})
  39344. },
  39345. remote: Boolean,
  39346. size: useSizeProp,
  39347. props: {
  39348. type: definePropType(Object),
  39349. default: () => defaultProps$5
  39350. },
  39351. valueKey: {
  39352. type: String,
  39353. default: "value"
  39354. },
  39355. scrollbarAlwaysOn: Boolean,
  39356. validateEvent: {
  39357. type: Boolean,
  39358. default: true
  39359. },
  39360. offset: {
  39361. type: Number,
  39362. default: 12
  39363. },
  39364. showArrow: {
  39365. type: Boolean,
  39366. default: true
  39367. },
  39368. placement: {
  39369. type: definePropType(String),
  39370. values: Ee,
  39371. default: "bottom-start"
  39372. },
  39373. fallbackPlacements: {
  39374. type: definePropType(Array),
  39375. default: ["bottom-start", "top-start", "right", "left"]
  39376. },
  39377. tagType: { ...tagProps.type, default: "info" },
  39378. tagEffect: { ...tagProps.effect, default: "light" },
  39379. tabindex: {
  39380. type: [String, Number],
  39381. default: 0
  39382. },
  39383. appendTo: String,
  39384. fitInputWidth: {
  39385. type: [Boolean, Number],
  39386. default: true,
  39387. validator(val) {
  39388. return isBoolean(val) || isNumber(val);
  39389. }
  39390. },
  39391. suffixIcon: {
  39392. type: iconPropType,
  39393. default: arrow_down_default
  39394. },
  39395. ...useEmptyValuesProps,
  39396. ...useAriaProps(["ariaLabel"])
  39397. });
  39398. const OptionProps = buildProps({
  39399. data: Array,
  39400. disabled: Boolean,
  39401. hovering: Boolean,
  39402. item: {
  39403. type: definePropType(Object),
  39404. required: true
  39405. },
  39406. index: Number,
  39407. style: Object,
  39408. selected: Boolean,
  39409. created: Boolean
  39410. });
  39411. const selectEmits = {
  39412. [UPDATE_MODEL_EVENT]: (val) => true,
  39413. [CHANGE_EVENT]: (val) => true,
  39414. "remove-tag": (val) => true,
  39415. "visible-change": (visible) => true,
  39416. focus: (evt) => evt instanceof FocusEvent,
  39417. blur: (evt) => evt instanceof FocusEvent,
  39418. clear: () => true
  39419. };
  39420. const optionEmits = {
  39421. hover: (index) => isNumber(index),
  39422. select: (val, index) => true
  39423. };
  39424. const selectV2InjectionKey = Symbol("ElSelectV2Injection");
  39425. const _sfc_main$N = defineComponent({
  39426. props: OptionProps,
  39427. emits: optionEmits,
  39428. setup(props, { emit }) {
  39429. const select = inject(selectV2InjectionKey);
  39430. const ns = useNamespace("select");
  39431. const { hoverItem, selectOptionClick } = useOption(props, { emit });
  39432. const { getLabel } = useProps(select.props);
  39433. return {
  39434. ns,
  39435. hoverItem,
  39436. selectOptionClick,
  39437. getLabel
  39438. };
  39439. }
  39440. });
  39441. function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
  39442. return openBlock(), createElementBlock("li", {
  39443. "aria-selected": _ctx.selected,
  39444. style: normalizeStyle(_ctx.style),
  39445. class: normalizeClass([
  39446. _ctx.ns.be("dropdown", "item"),
  39447. _ctx.ns.is("selected", _ctx.selected),
  39448. _ctx.ns.is("disabled", _ctx.disabled),
  39449. _ctx.ns.is("created", _ctx.created),
  39450. _ctx.ns.is("hovering", _ctx.hovering)
  39451. ]),
  39452. onMousemove: _ctx.hoverItem,
  39453. onClick: withModifiers(_ctx.selectOptionClick, ["stop"])
  39454. }, [
  39455. renderSlot(_ctx.$slots, "default", {
  39456. item: _ctx.item,
  39457. index: _ctx.index,
  39458. disabled: _ctx.disabled
  39459. }, () => [
  39460. createElementVNode("span", null, toDisplayString(_ctx.getLabel(_ctx.item)), 1)
  39461. ])
  39462. ], 46, ["aria-selected", "onMousemove", "onClick"]);
  39463. }
  39464. var OptionItem = /* @__PURE__ */ _export_sfc(_sfc_main$N, [["render", _sfc_render$6], ["__file", "option-item.vue"]]);
  39465. const props = {
  39466. loading: Boolean,
  39467. data: {
  39468. type: Array,
  39469. required: true
  39470. },
  39471. hoveringIndex: Number,
  39472. width: Number
  39473. };
  39474. var ElSelectMenu = defineComponent({
  39475. name: "ElSelectDropdown",
  39476. props,
  39477. setup(props2, {
  39478. slots,
  39479. expose
  39480. }) {
  39481. const select = inject(selectV2InjectionKey);
  39482. const ns = useNamespace("select");
  39483. const {
  39484. getLabel,
  39485. getValue,
  39486. getDisabled
  39487. } = useProps(select.props);
  39488. const cachedHeights = ref([]);
  39489. const listRef = ref();
  39490. const size = computed(() => props2.data.length);
  39491. watch(() => size.value, () => {
  39492. var _a, _b;
  39493. (_b = (_a = select.tooltipRef.value).updatePopper) == null ? void 0 : _b.call(_a);
  39494. });
  39495. const isSized = computed(() => isUndefined(select.props.estimatedOptionHeight));
  39496. const listProps = computed(() => {
  39497. if (isSized.value) {
  39498. return {
  39499. itemSize: select.props.itemHeight
  39500. };
  39501. }
  39502. return {
  39503. estimatedSize: select.props.estimatedOptionHeight,
  39504. itemSize: (idx) => cachedHeights.value[idx]
  39505. };
  39506. });
  39507. const contains = (arr = [], target) => {
  39508. const {
  39509. props: {
  39510. valueKey
  39511. }
  39512. } = select;
  39513. if (!isObject$1(target)) {
  39514. return arr.includes(target);
  39515. }
  39516. return arr && arr.some((item) => {
  39517. return toRaw(get(item, valueKey)) === get(target, valueKey);
  39518. });
  39519. };
  39520. const isEqual = (selected, target) => {
  39521. if (!isObject$1(target)) {
  39522. return selected === target;
  39523. } else {
  39524. const {
  39525. valueKey
  39526. } = select.props;
  39527. return get(selected, valueKey) === get(target, valueKey);
  39528. }
  39529. };
  39530. const isItemSelected = (modelValue, target) => {
  39531. if (select.props.multiple) {
  39532. return contains(modelValue, getValue(target));
  39533. }
  39534. return isEqual(modelValue, getValue(target));
  39535. };
  39536. const isItemDisabled = (modelValue, selected) => {
  39537. const {
  39538. disabled,
  39539. multiple,
  39540. multipleLimit
  39541. } = select.props;
  39542. return disabled || !selected && (multiple ? multipleLimit > 0 && modelValue.length >= multipleLimit : false);
  39543. };
  39544. const isItemHovering = (target) => props2.hoveringIndex === target;
  39545. const scrollToItem = (index) => {
  39546. const list = listRef.value;
  39547. if (list) {
  39548. list.scrollToItem(index);
  39549. }
  39550. };
  39551. const resetScrollTop = () => {
  39552. const list = listRef.value;
  39553. if (list) {
  39554. list.resetScrollTop();
  39555. }
  39556. };
  39557. const exposed = {
  39558. listRef,
  39559. isSized,
  39560. isItemDisabled,
  39561. isItemHovering,
  39562. isItemSelected,
  39563. scrollToItem,
  39564. resetScrollTop
  39565. };
  39566. expose(exposed);
  39567. const Item = (itemProps) => {
  39568. const {
  39569. index,
  39570. data,
  39571. style
  39572. } = itemProps;
  39573. const sized = unref(isSized);
  39574. const {
  39575. itemSize,
  39576. estimatedSize
  39577. } = unref(listProps);
  39578. const {
  39579. modelValue
  39580. } = select.props;
  39581. const {
  39582. onSelect,
  39583. onHover
  39584. } = select;
  39585. const item = data[index];
  39586. if (item.type === "Group") {
  39587. return createVNode(GroupItem, {
  39588. "item": item,
  39589. "style": style,
  39590. "height": sized ? itemSize : estimatedSize
  39591. }, null);
  39592. }
  39593. const isSelected = isItemSelected(modelValue, item);
  39594. const isDisabled = isItemDisabled(modelValue, isSelected);
  39595. const isHovering = isItemHovering(index);
  39596. return createVNode(OptionItem, mergeProps(itemProps, {
  39597. "selected": isSelected,
  39598. "disabled": getDisabled(item) || isDisabled,
  39599. "created": !!item.created,
  39600. "hovering": isHovering,
  39601. "item": item,
  39602. "onSelect": onSelect,
  39603. "onHover": onHover
  39604. }), {
  39605. default: (props3) => {
  39606. var _a;
  39607. return ((_a = slots.default) == null ? void 0 : _a.call(slots, props3)) || createVNode("span", null, [getLabel(item)]);
  39608. }
  39609. });
  39610. };
  39611. const {
  39612. onKeyboardNavigate,
  39613. onKeyboardSelect
  39614. } = select;
  39615. const onForward = () => {
  39616. onKeyboardNavigate("forward");
  39617. };
  39618. const onBackward = () => {
  39619. onKeyboardNavigate("backward");
  39620. };
  39621. const onKeydown = (e) => {
  39622. const {
  39623. code
  39624. } = e;
  39625. const {
  39626. tab,
  39627. esc,
  39628. down,
  39629. up,
  39630. enter,
  39631. numpadEnter
  39632. } = EVENT_CODE;
  39633. if ([esc, down, up, enter, numpadEnter].includes(code)) {
  39634. e.preventDefault();
  39635. e.stopPropagation();
  39636. }
  39637. switch (code) {
  39638. case tab:
  39639. case esc:
  39640. break;
  39641. case down:
  39642. onForward();
  39643. break;
  39644. case up:
  39645. onBackward();
  39646. break;
  39647. case enter:
  39648. case numpadEnter:
  39649. onKeyboardSelect();
  39650. break;
  39651. }
  39652. };
  39653. return () => {
  39654. var _a, _b, _c, _d;
  39655. const {
  39656. data,
  39657. width
  39658. } = props2;
  39659. const {
  39660. height,
  39661. multiple,
  39662. scrollbarAlwaysOn
  39663. } = select.props;
  39664. const isScrollbarAlwaysOn = computed(() => {
  39665. return isIOS ? true : scrollbarAlwaysOn;
  39666. });
  39667. const List = unref(isSized) ? FixedSizeList$1 : DynamicSizeList$1;
  39668. return createVNode("div", {
  39669. "class": [ns.b("dropdown"), ns.is("multiple", multiple)],
  39670. "style": {
  39671. width: `${width}px`
  39672. }
  39673. }, [(_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)) || createVNode(List, mergeProps({
  39674. "ref": listRef
  39675. }, unref(listProps), {
  39676. "className": ns.be("dropdown", "list"),
  39677. "scrollbarAlwaysOn": isScrollbarAlwaysOn.value,
  39678. "data": data,
  39679. "height": height,
  39680. "width": width,
  39681. "total": data.length,
  39682. "onKeydown": onKeydown
  39683. }), {
  39684. default: (props3) => createVNode(Item, props3, null)
  39685. }), (_d = slots.footer) == null ? void 0 : _d.call(slots)]);
  39686. };
  39687. }
  39688. });
  39689. function useAllowCreate(props, states) {
  39690. const { aliasProps, getLabel, getValue } = useProps(props);
  39691. const createOptionCount = ref(0);
  39692. const cachedSelectedOption = ref();
  39693. const enableAllowCreateMode = computed(() => {
  39694. return props.allowCreate && props.filterable;
  39695. });
  39696. function hasExistingOption(query) {
  39697. const hasOption = (option) => getLabel(option) === query;
  39698. return props.options && props.options.some(hasOption) || states.createdOptions.some(hasOption);
  39699. }
  39700. function selectNewOption(option) {
  39701. if (!enableAllowCreateMode.value) {
  39702. return;
  39703. }
  39704. if (props.multiple && option.created) {
  39705. createOptionCount.value++;
  39706. } else {
  39707. cachedSelectedOption.value = option;
  39708. }
  39709. }
  39710. function createNewOption(query) {
  39711. if (enableAllowCreateMode.value) {
  39712. if (query && query.length > 0) {
  39713. if (hasExistingOption(query)) {
  39714. return;
  39715. }
  39716. const newOption = {
  39717. [aliasProps.value.value]: query,
  39718. [aliasProps.value.label]: query,
  39719. created: true,
  39720. [aliasProps.value.disabled]: false
  39721. };
  39722. if (states.createdOptions.length >= createOptionCount.value) {
  39723. states.createdOptions[createOptionCount.value] = newOption;
  39724. } else {
  39725. states.createdOptions.push(newOption);
  39726. }
  39727. } else {
  39728. if (props.multiple) {
  39729. states.createdOptions.length = createOptionCount.value;
  39730. } else {
  39731. const selectedOption = cachedSelectedOption.value;
  39732. states.createdOptions.length = 0;
  39733. if (selectedOption && selectedOption.created) {
  39734. states.createdOptions.push(selectedOption);
  39735. }
  39736. }
  39737. }
  39738. }
  39739. }
  39740. function removeNewOption(option) {
  39741. if (!enableAllowCreateMode.value || !option || !option.created || option.created && props.reserveKeyword && states.inputValue === getLabel(option)) {
  39742. return;
  39743. }
  39744. const idx = states.createdOptions.findIndex((it) => getValue(it) === getValue(option));
  39745. if (~idx) {
  39746. states.createdOptions.splice(idx, 1);
  39747. createOptionCount.value--;
  39748. }
  39749. }
  39750. function clearAllNewOption() {
  39751. if (enableAllowCreateMode.value) {
  39752. states.createdOptions.length = 0;
  39753. createOptionCount.value = 0;
  39754. }
  39755. }
  39756. return {
  39757. createNewOption,
  39758. removeNewOption,
  39759. selectNewOption,
  39760. clearAllNewOption
  39761. };
  39762. }
  39763. const useSelect$1 = (props, emit) => {
  39764. const { t } = useLocale();
  39765. const nsSelect = useNamespace("select");
  39766. const nsInput = useNamespace("input");
  39767. const { form: elForm, formItem: elFormItem } = useFormItem();
  39768. const { inputId } = useFormItemInputId(props, {
  39769. formItemContext: elFormItem
  39770. });
  39771. const { aliasProps, getLabel, getValue, getDisabled, getOptions } = useProps(props);
  39772. const { valueOnClear, isEmptyValue } = useEmptyValues(props);
  39773. const states = reactive({
  39774. inputValue: "",
  39775. cachedOptions: [],
  39776. createdOptions: [],
  39777. hoveringIndex: -1,
  39778. inputHovering: false,
  39779. selectionWidth: 0,
  39780. collapseItemWidth: 0,
  39781. previousQuery: null,
  39782. previousValue: void 0,
  39783. selectedLabel: "",
  39784. menuVisibleOnFocus: false,
  39785. isBeforeHide: false
  39786. });
  39787. const popperSize = ref(-1);
  39788. const selectRef = ref();
  39789. const selectionRef = ref();
  39790. const tooltipRef = ref();
  39791. const tagTooltipRef = ref();
  39792. const inputRef = ref();
  39793. const prefixRef = ref();
  39794. const suffixRef = ref();
  39795. const menuRef = ref();
  39796. const tagMenuRef = ref();
  39797. const collapseItemRef = ref();
  39798. const {
  39799. isComposing,
  39800. handleCompositionStart,
  39801. handleCompositionEnd,
  39802. handleCompositionUpdate
  39803. } = useComposition({
  39804. afterComposition: (e) => onInput(e)
  39805. });
  39806. const { wrapperRef, isFocused, handleBlur } = useFocusController(inputRef, {
  39807. beforeFocus() {
  39808. return selectDisabled.value;
  39809. },
  39810. afterFocus() {
  39811. if (props.automaticDropdown && !expanded.value) {
  39812. expanded.value = true;
  39813. states.menuVisibleOnFocus = true;
  39814. }
  39815. },
  39816. beforeBlur(event) {
  39817. var _a, _b;
  39818. return ((_a = tooltipRef.value) == null ? void 0 : _a.isFocusInsideContent(event)) || ((_b = tagTooltipRef.value) == null ? void 0 : _b.isFocusInsideContent(event));
  39819. },
  39820. afterBlur() {
  39821. var _a;
  39822. expanded.value = false;
  39823. states.menuVisibleOnFocus = false;
  39824. if (props.validateEvent) {
  39825. (_a = elFormItem == null ? void 0 : elFormItem.validate) == null ? void 0 : _a.call(elFormItem, "blur").catch((err) => debugWarn());
  39826. }
  39827. }
  39828. });
  39829. const allOptions = computed(() => filterOptions(""));
  39830. const hasOptions = computed(() => {
  39831. if (props.loading)
  39832. return false;
  39833. return props.options.length > 0 || states.createdOptions.length > 0;
  39834. });
  39835. const filteredOptions = ref([]);
  39836. const expanded = ref(false);
  39837. const selectDisabled = computed(() => props.disabled || (elForm == null ? void 0 : elForm.disabled));
  39838. const needStatusIcon = computed(() => {
  39839. var _a;
  39840. return (_a = elForm == null ? void 0 : elForm.statusIcon) != null ? _a : false;
  39841. });
  39842. const popupHeight = computed(() => {
  39843. const totalHeight = filteredOptions.value.length * props.itemHeight;
  39844. return totalHeight > props.height ? props.height : totalHeight;
  39845. });
  39846. const hasModelValue = computed(() => {
  39847. return props.multiple ? isArray$1(props.modelValue) && props.modelValue.length > 0 : !isEmptyValue(props.modelValue);
  39848. });
  39849. const showClearBtn = computed(() => {
  39850. return props.clearable && !selectDisabled.value && states.inputHovering && hasModelValue.value;
  39851. });
  39852. const iconComponent = computed(() => props.remote && props.filterable ? "" : props.suffixIcon);
  39853. const iconReverse = computed(() => iconComponent.value && nsSelect.is("reverse", expanded.value));
  39854. const validateState = computed(() => (elFormItem == null ? void 0 : elFormItem.validateState) || "");
  39855. const validateIcon = computed(() => {
  39856. if (!validateState.value)
  39857. return;
  39858. return ValidateComponentsMap[validateState.value];
  39859. });
  39860. const debounce$1 = computed(() => props.remote ? 300 : 0);
  39861. const emptyText = computed(() => {
  39862. if (props.loading) {
  39863. return props.loadingText || t("el.select.loading");
  39864. } else {
  39865. if (props.remote && !states.inputValue && !hasOptions.value)
  39866. return false;
  39867. if (props.filterable && states.inputValue && hasOptions.value && filteredOptions.value.length === 0) {
  39868. return props.noMatchText || t("el.select.noMatch");
  39869. }
  39870. if (!hasOptions.value) {
  39871. return props.noDataText || t("el.select.noData");
  39872. }
  39873. }
  39874. return null;
  39875. });
  39876. const filterOptions = (query) => {
  39877. const regexp = new RegExp(escapeStringRegexp(query), "i");
  39878. const isFilterMethodValid = props.filterable && isFunction$1(props.filterMethod);
  39879. const isRemoteMethodValid = props.filterable && props.remote && isFunction$1(props.remoteMethod);
  39880. const isValidOption = (o) => {
  39881. if (isFilterMethodValid || isRemoteMethodValid)
  39882. return true;
  39883. return query ? regexp.test(getLabel(o) || "") : true;
  39884. };
  39885. if (props.loading) {
  39886. return [];
  39887. }
  39888. return [...states.createdOptions, ...props.options].reduce((all, item) => {
  39889. const options = getOptions(item);
  39890. if (isArray$1(options)) {
  39891. const filtered = options.filter(isValidOption);
  39892. if (filtered.length > 0) {
  39893. all.push({
  39894. label: getLabel(item),
  39895. type: "Group"
  39896. }, ...filtered);
  39897. }
  39898. } else if (props.remote || isValidOption(item)) {
  39899. all.push(item);
  39900. }
  39901. return all;
  39902. }, []);
  39903. };
  39904. const updateOptions = () => {
  39905. filteredOptions.value = filterOptions(states.inputValue);
  39906. };
  39907. const allOptionsValueMap = computed(() => {
  39908. const valueMap = /* @__PURE__ */ new Map();
  39909. allOptions.value.forEach((option, index) => {
  39910. valueMap.set(getValueKey(getValue(option)), { option, index });
  39911. });
  39912. return valueMap;
  39913. });
  39914. const filteredOptionsValueMap = computed(() => {
  39915. const valueMap = /* @__PURE__ */ new Map();
  39916. filteredOptions.value.forEach((option, index) => {
  39917. valueMap.set(getValueKey(getValue(option)), { option, index });
  39918. });
  39919. return valueMap;
  39920. });
  39921. const optionsAllDisabled = computed(() => filteredOptions.value.every((option) => getDisabled(option)));
  39922. const selectSize = useFormSize();
  39923. const collapseTagSize = computed(() => selectSize.value === "small" ? "small" : "default");
  39924. const calculatePopperSize = () => {
  39925. var _a;
  39926. if (isNumber(props.fitInputWidth)) {
  39927. popperSize.value = props.fitInputWidth;
  39928. return;
  39929. }
  39930. const width = ((_a = selectRef.value) == null ? void 0 : _a.offsetWidth) || 200;
  39931. if (!props.fitInputWidth && hasOptions.value) {
  39932. nextTick(() => {
  39933. popperSize.value = Math.max(width, calculateLabelMaxWidth());
  39934. });
  39935. } else {
  39936. popperSize.value = width;
  39937. }
  39938. };
  39939. const calculateLabelMaxWidth = () => {
  39940. var _a, _b;
  39941. const canvas = document.createElement("canvas");
  39942. const ctx = canvas.getContext("2d");
  39943. const selector = nsSelect.be("dropdown", "item");
  39944. const dom = ((_b = (_a = menuRef.value) == null ? void 0 : _a.listRef) == null ? void 0 : _b.innerRef) || document;
  39945. const dropdownItemEl = dom.querySelector(`.${selector}`);
  39946. if (dropdownItemEl === null || ctx === null)
  39947. return 0;
  39948. const style = getComputedStyle(dropdownItemEl);
  39949. const padding = Number.parseFloat(style.paddingLeft) + Number.parseFloat(style.paddingRight);
  39950. ctx.font = style.font;
  39951. const maxWidth = filteredOptions.value.reduce((max, option) => {
  39952. const metrics = ctx.measureText(getLabel(option));
  39953. return Math.max(metrics.width, max);
  39954. }, 0);
  39955. return maxWidth + padding;
  39956. };
  39957. const getGapWidth = () => {
  39958. if (!selectionRef.value)
  39959. return 0;
  39960. const style = window.getComputedStyle(selectionRef.value);
  39961. return Number.parseFloat(style.gap || "6px");
  39962. };
  39963. const tagStyle = computed(() => {
  39964. const gapWidth = getGapWidth();
  39965. const maxWidth = collapseItemRef.value && props.maxCollapseTags === 1 ? states.selectionWidth - states.collapseItemWidth - gapWidth : states.selectionWidth;
  39966. return { maxWidth: `${maxWidth}px` };
  39967. });
  39968. const collapseTagStyle = computed(() => {
  39969. return { maxWidth: `${states.selectionWidth}px` };
  39970. });
  39971. const shouldShowPlaceholder = computed(() => {
  39972. if (isArray$1(props.modelValue)) {
  39973. return props.modelValue.length === 0 && !states.inputValue;
  39974. }
  39975. return props.filterable ? !states.inputValue : true;
  39976. });
  39977. const currentPlaceholder = computed(() => {
  39978. var _a;
  39979. const _placeholder = (_a = props.placeholder) != null ? _a : t("el.select.placeholder");
  39980. return props.multiple || !hasModelValue.value ? _placeholder : states.selectedLabel;
  39981. });
  39982. const popperRef = computed(() => {
  39983. var _a, _b;
  39984. return (_b = (_a = tooltipRef.value) == null ? void 0 : _a.popperRef) == null ? void 0 : _b.contentRef;
  39985. });
  39986. const indexRef = computed(() => {
  39987. if (props.multiple) {
  39988. const len = props.modelValue.length;
  39989. if (props.modelValue.length > 0 && filteredOptionsValueMap.value.has(props.modelValue[len - 1])) {
  39990. const { index } = filteredOptionsValueMap.value.get(props.modelValue[len - 1]);
  39991. return index;
  39992. }
  39993. } else {
  39994. if (!isEmptyValue(props.modelValue) && filteredOptionsValueMap.value.has(props.modelValue)) {
  39995. const { index } = filteredOptionsValueMap.value.get(props.modelValue);
  39996. return index;
  39997. }
  39998. }
  39999. return -1;
  40000. });
  40001. const dropdownMenuVisible = computed({
  40002. get() {
  40003. return expanded.value && emptyText.value !== false;
  40004. },
  40005. set(val) {
  40006. expanded.value = val;
  40007. }
  40008. });
  40009. const showTagList = computed(() => {
  40010. if (!props.multiple) {
  40011. return [];
  40012. }
  40013. return props.collapseTags ? states.cachedOptions.slice(0, props.maxCollapseTags) : states.cachedOptions;
  40014. });
  40015. const collapseTagList = computed(() => {
  40016. if (!props.multiple) {
  40017. return [];
  40018. }
  40019. return props.collapseTags ? states.cachedOptions.slice(props.maxCollapseTags) : [];
  40020. });
  40021. const {
  40022. createNewOption,
  40023. removeNewOption,
  40024. selectNewOption,
  40025. clearAllNewOption
  40026. } = useAllowCreate(props, states);
  40027. const toggleMenu = () => {
  40028. if (selectDisabled.value)
  40029. return;
  40030. if (states.menuVisibleOnFocus) {
  40031. states.menuVisibleOnFocus = false;
  40032. } else {
  40033. expanded.value = !expanded.value;
  40034. }
  40035. };
  40036. const onInputChange = () => {
  40037. if (states.inputValue.length > 0 && !expanded.value) {
  40038. expanded.value = true;
  40039. }
  40040. createNewOption(states.inputValue);
  40041. handleQueryChange(states.inputValue);
  40042. };
  40043. const debouncedOnInputChange = debounce(onInputChange, debounce$1.value);
  40044. const handleQueryChange = (val) => {
  40045. if (states.previousQuery === val || isComposing.value) {
  40046. return;
  40047. }
  40048. states.previousQuery = val;
  40049. if (props.filterable && isFunction$1(props.filterMethod)) {
  40050. props.filterMethod(val);
  40051. } else if (props.filterable && props.remote && isFunction$1(props.remoteMethod)) {
  40052. props.remoteMethod(val);
  40053. }
  40054. if (props.defaultFirstOption && (props.filterable || props.remote) && filteredOptions.value.length) {
  40055. nextTick(checkDefaultFirstOption);
  40056. } else {
  40057. nextTick(updateHoveringIndex);
  40058. }
  40059. };
  40060. const checkDefaultFirstOption = () => {
  40061. const optionsInDropdown = filteredOptions.value.filter((n) => !n.disabled && n.type !== "Group");
  40062. const userCreatedOption = optionsInDropdown.find((n) => n.created);
  40063. const firstOriginOption = optionsInDropdown[0];
  40064. states.hoveringIndex = getValueIndex(filteredOptions.value, userCreatedOption || firstOriginOption);
  40065. };
  40066. const emitChange = (val) => {
  40067. if (!isEqual$1(props.modelValue, val)) {
  40068. emit(CHANGE_EVENT, val);
  40069. }
  40070. };
  40071. const update = (val) => {
  40072. emit(UPDATE_MODEL_EVENT, val);
  40073. emitChange(val);
  40074. states.previousValue = props.multiple ? String(val) : val;
  40075. nextTick(() => {
  40076. if (props.multiple && isArray$1(props.modelValue)) {
  40077. const selectedOptions = props.modelValue.map((value) => getOption(value));
  40078. if (!isEqual$1(states.cachedOptions, selectedOptions)) {
  40079. states.cachedOptions = selectedOptions;
  40080. }
  40081. } else {
  40082. initStates(true);
  40083. }
  40084. });
  40085. };
  40086. const getValueIndex = (arr = [], value) => {
  40087. if (!isObject$1(value)) {
  40088. return arr.indexOf(value);
  40089. }
  40090. const valueKey = props.valueKey;
  40091. let index = -1;
  40092. arr.some((item, i) => {
  40093. if (get(item, valueKey) === get(value, valueKey)) {
  40094. index = i;
  40095. return true;
  40096. }
  40097. return false;
  40098. });
  40099. return index;
  40100. };
  40101. const getValueKey = (item) => {
  40102. return isObject$1(item) ? get(item, props.valueKey) : item;
  40103. };
  40104. const handleResize = () => {
  40105. calculatePopperSize();
  40106. };
  40107. const resetSelectionWidth = () => {
  40108. states.selectionWidth = selectionRef.value.getBoundingClientRect().width;
  40109. };
  40110. const resetCollapseItemWidth = () => {
  40111. states.collapseItemWidth = collapseItemRef.value.getBoundingClientRect().width;
  40112. };
  40113. const updateTooltip = () => {
  40114. var _a, _b;
  40115. (_b = (_a = tooltipRef.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a);
  40116. };
  40117. const updateTagTooltip = () => {
  40118. var _a, _b;
  40119. (_b = (_a = tagTooltipRef.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a);
  40120. };
  40121. const onSelect = (option) => {
  40122. if (props.multiple) {
  40123. let selectedOptions = props.modelValue.slice();
  40124. const index = getValueIndex(selectedOptions, getValue(option));
  40125. if (index > -1) {
  40126. selectedOptions = [
  40127. ...selectedOptions.slice(0, index),
  40128. ...selectedOptions.slice(index + 1)
  40129. ];
  40130. states.cachedOptions.splice(index, 1);
  40131. removeNewOption(option);
  40132. } else if (props.multipleLimit <= 0 || selectedOptions.length < props.multipleLimit) {
  40133. selectedOptions = [...selectedOptions, getValue(option)];
  40134. states.cachedOptions.push(option);
  40135. selectNewOption(option);
  40136. }
  40137. update(selectedOptions);
  40138. if (option.created) {
  40139. handleQueryChange("");
  40140. }
  40141. if (props.filterable && !props.reserveKeyword) {
  40142. states.inputValue = "";
  40143. }
  40144. } else {
  40145. states.selectedLabel = getLabel(option);
  40146. update(getValue(option));
  40147. expanded.value = false;
  40148. selectNewOption(option);
  40149. if (!option.created) {
  40150. clearAllNewOption();
  40151. }
  40152. }
  40153. focus();
  40154. };
  40155. const deleteTag = (event, option) => {
  40156. let selectedOptions = props.modelValue.slice();
  40157. const index = getValueIndex(selectedOptions, getValue(option));
  40158. if (index > -1 && !selectDisabled.value) {
  40159. selectedOptions = [
  40160. ...props.modelValue.slice(0, index),
  40161. ...props.modelValue.slice(index + 1)
  40162. ];
  40163. states.cachedOptions.splice(index, 1);
  40164. update(selectedOptions);
  40165. emit("remove-tag", getValue(option));
  40166. removeNewOption(option);
  40167. }
  40168. event.stopPropagation();
  40169. focus();
  40170. };
  40171. const focus = () => {
  40172. var _a;
  40173. (_a = inputRef.value) == null ? void 0 : _a.focus();
  40174. };
  40175. const blur = () => {
  40176. var _a;
  40177. if (expanded.value) {
  40178. expanded.value = false;
  40179. nextTick(() => {
  40180. var _a2;
  40181. return (_a2 = inputRef.value) == null ? void 0 : _a2.blur();
  40182. });
  40183. return;
  40184. }
  40185. (_a = inputRef.value) == null ? void 0 : _a.blur();
  40186. };
  40187. const handleEsc = () => {
  40188. if (states.inputValue.length > 0) {
  40189. states.inputValue = "";
  40190. } else {
  40191. expanded.value = false;
  40192. }
  40193. };
  40194. const getLastNotDisabledIndex = (value) => findLastIndex(value, (it) => !states.cachedOptions.some((option) => getValue(option) === it && getDisabled(option)));
  40195. const handleDel = (e) => {
  40196. if (!props.multiple)
  40197. return;
  40198. if (e.code === EVENT_CODE.delete)
  40199. return;
  40200. if (states.inputValue.length === 0) {
  40201. e.preventDefault();
  40202. const selected = props.modelValue.slice();
  40203. const lastNotDisabledIndex = getLastNotDisabledIndex(selected);
  40204. if (lastNotDisabledIndex < 0)
  40205. return;
  40206. const removeTagValue = selected[lastNotDisabledIndex];
  40207. selected.splice(lastNotDisabledIndex, 1);
  40208. const option = states.cachedOptions[lastNotDisabledIndex];
  40209. states.cachedOptions.splice(lastNotDisabledIndex, 1);
  40210. removeNewOption(option);
  40211. update(selected);
  40212. emit("remove-tag", removeTagValue);
  40213. }
  40214. };
  40215. const handleClear = () => {
  40216. let emptyValue;
  40217. if (isArray$1(props.modelValue)) {
  40218. emptyValue = [];
  40219. } else {
  40220. emptyValue = valueOnClear.value;
  40221. }
  40222. states.selectedLabel = "";
  40223. expanded.value = false;
  40224. update(emptyValue);
  40225. emit("clear");
  40226. clearAllNewOption();
  40227. focus();
  40228. };
  40229. const onKeyboardNavigate = (direction, hoveringIndex = void 0) => {
  40230. const options = filteredOptions.value;
  40231. if (!["forward", "backward"].includes(direction) || selectDisabled.value || options.length <= 0 || optionsAllDisabled.value || isComposing.value) {
  40232. return;
  40233. }
  40234. if (!expanded.value) {
  40235. return toggleMenu();
  40236. }
  40237. if (hoveringIndex === void 0) {
  40238. hoveringIndex = states.hoveringIndex;
  40239. }
  40240. let newIndex = -1;
  40241. if (direction === "forward") {
  40242. newIndex = hoveringIndex + 1;
  40243. if (newIndex >= options.length) {
  40244. newIndex = 0;
  40245. }
  40246. } else if (direction === "backward") {
  40247. newIndex = hoveringIndex - 1;
  40248. if (newIndex < 0 || newIndex >= options.length) {
  40249. newIndex = options.length - 1;
  40250. }
  40251. }
  40252. const option = options[newIndex];
  40253. if (getDisabled(option) || option.type === "Group") {
  40254. return onKeyboardNavigate(direction, newIndex);
  40255. } else {
  40256. states.hoveringIndex = newIndex;
  40257. scrollToItem(newIndex);
  40258. }
  40259. };
  40260. const onKeyboardSelect = () => {
  40261. if (!expanded.value) {
  40262. return toggleMenu();
  40263. } else if (~states.hoveringIndex && filteredOptions.value[states.hoveringIndex]) {
  40264. onSelect(filteredOptions.value[states.hoveringIndex]);
  40265. }
  40266. };
  40267. const onHoverOption = (idx) => {
  40268. states.hoveringIndex = idx != null ? idx : -1;
  40269. };
  40270. const updateHoveringIndex = () => {
  40271. if (!props.multiple) {
  40272. states.hoveringIndex = filteredOptions.value.findIndex((item) => {
  40273. return getValueKey(item) === getValueKey(props.modelValue);
  40274. });
  40275. } else {
  40276. states.hoveringIndex = filteredOptions.value.findIndex((item) => props.modelValue.some((modelValue) => getValueKey(modelValue) === getValueKey(item)));
  40277. }
  40278. };
  40279. const onInput = (event) => {
  40280. states.inputValue = event.target.value;
  40281. if (props.remote) {
  40282. debouncedOnInputChange();
  40283. } else {
  40284. return onInputChange();
  40285. }
  40286. };
  40287. const handleClickOutside = (event) => {
  40288. expanded.value = false;
  40289. if (isFocused.value) {
  40290. const _event = new FocusEvent("focus", event);
  40291. handleBlur(_event);
  40292. }
  40293. };
  40294. const handleMenuEnter = () => {
  40295. states.isBeforeHide = false;
  40296. return nextTick(() => {
  40297. if (~indexRef.value) {
  40298. scrollToItem(states.hoveringIndex);
  40299. }
  40300. });
  40301. };
  40302. const scrollToItem = (index) => {
  40303. menuRef.value.scrollToItem(index);
  40304. };
  40305. const getOption = (value, cachedOptions) => {
  40306. const selectValue = getValueKey(value);
  40307. if (allOptionsValueMap.value.has(selectValue)) {
  40308. const { option } = allOptionsValueMap.value.get(selectValue);
  40309. return option;
  40310. }
  40311. if (cachedOptions && cachedOptions.length) {
  40312. const option = cachedOptions.find((option2) => getValueKey(getValue(option2)) === selectValue);
  40313. if (option) {
  40314. return option;
  40315. }
  40316. }
  40317. return {
  40318. [aliasProps.value.value]: value,
  40319. [aliasProps.value.label]: value
  40320. };
  40321. };
  40322. const initStates = (needUpdateSelectedLabel = false) => {
  40323. if (props.multiple) {
  40324. if (props.modelValue.length > 0) {
  40325. const cachedOptions = states.cachedOptions.slice();
  40326. states.cachedOptions.length = 0;
  40327. states.previousValue = props.modelValue.toString();
  40328. for (const value of props.modelValue) {
  40329. const option = getOption(value, cachedOptions);
  40330. states.cachedOptions.push(option);
  40331. }
  40332. } else {
  40333. states.cachedOptions = [];
  40334. states.previousValue = void 0;
  40335. }
  40336. } else {
  40337. if (hasModelValue.value) {
  40338. states.previousValue = props.modelValue;
  40339. const options = filteredOptions.value;
  40340. const selectedItemIndex = options.findIndex((option) => getValueKey(getValue(option)) === getValueKey(props.modelValue));
  40341. if (~selectedItemIndex) {
  40342. states.selectedLabel = getLabel(options[selectedItemIndex]);
  40343. } else {
  40344. if (!states.selectedLabel || needUpdateSelectedLabel) {
  40345. states.selectedLabel = getValueKey(props.modelValue);
  40346. }
  40347. }
  40348. } else {
  40349. states.selectedLabel = "";
  40350. states.previousValue = void 0;
  40351. }
  40352. }
  40353. clearAllNewOption();
  40354. calculatePopperSize();
  40355. };
  40356. watch(() => props.fitInputWidth, () => {
  40357. calculatePopperSize();
  40358. });
  40359. watch(expanded, (val) => {
  40360. if (val) {
  40361. if (!props.persistent) {
  40362. calculatePopperSize();
  40363. }
  40364. handleQueryChange("");
  40365. } else {
  40366. states.inputValue = "";
  40367. states.previousQuery = null;
  40368. states.isBeforeHide = true;
  40369. createNewOption("");
  40370. }
  40371. emit("visible-change", val);
  40372. });
  40373. watch(() => props.modelValue, (val, oldVal) => {
  40374. var _a;
  40375. const isValEmpty = !val || isArray$1(val) && val.length === 0;
  40376. if (isValEmpty || props.multiple && !isEqual$1(val.toString(), states.previousValue) || !props.multiple && getValueKey(val) !== getValueKey(states.previousValue)) {
  40377. initStates(true);
  40378. }
  40379. if (!isEqual$1(val, oldVal) && props.validateEvent) {
  40380. (_a = elFormItem == null ? void 0 : elFormItem.validate) == null ? void 0 : _a.call(elFormItem, "change").catch((err) => debugWarn());
  40381. }
  40382. }, {
  40383. deep: true
  40384. });
  40385. watch(() => props.options, () => {
  40386. const input = inputRef.value;
  40387. if (!input || input && document.activeElement !== input) {
  40388. initStates();
  40389. }
  40390. }, {
  40391. deep: true,
  40392. flush: "post"
  40393. });
  40394. watch(() => filteredOptions.value, () => {
  40395. calculatePopperSize();
  40396. return menuRef.value && nextTick(menuRef.value.resetScrollTop);
  40397. });
  40398. watchEffect(() => {
  40399. if (states.isBeforeHide)
  40400. return;
  40401. updateOptions();
  40402. });
  40403. watchEffect(() => {
  40404. const { valueKey, options } = props;
  40405. const duplicateValue = /* @__PURE__ */ new Map();
  40406. for (const item of options) {
  40407. const optionValue = getValue(item);
  40408. let v = optionValue;
  40409. if (isObject$1(v)) {
  40410. v = get(optionValue, valueKey);
  40411. }
  40412. if (duplicateValue.get(v)) {
  40413. break;
  40414. } else {
  40415. duplicateValue.set(v, true);
  40416. }
  40417. }
  40418. });
  40419. onMounted(() => {
  40420. initStates();
  40421. });
  40422. useResizeObserver(selectRef, handleResize);
  40423. useResizeObserver(selectionRef, resetSelectionWidth);
  40424. useResizeObserver(menuRef, updateTooltip);
  40425. useResizeObserver(wrapperRef, updateTooltip);
  40426. useResizeObserver(tagMenuRef, updateTagTooltip);
  40427. useResizeObserver(collapseItemRef, resetCollapseItemWidth);
  40428. return {
  40429. inputId,
  40430. collapseTagSize,
  40431. currentPlaceholder,
  40432. expanded,
  40433. emptyText,
  40434. popupHeight,
  40435. debounce: debounce$1,
  40436. allOptions,
  40437. filteredOptions,
  40438. iconComponent,
  40439. iconReverse,
  40440. tagStyle,
  40441. collapseTagStyle,
  40442. popperSize,
  40443. dropdownMenuVisible,
  40444. hasModelValue,
  40445. shouldShowPlaceholder,
  40446. selectDisabled,
  40447. selectSize,
  40448. needStatusIcon,
  40449. showClearBtn,
  40450. states,
  40451. isFocused,
  40452. nsSelect,
  40453. nsInput,
  40454. inputRef,
  40455. menuRef,
  40456. tagMenuRef,
  40457. tooltipRef,
  40458. tagTooltipRef,
  40459. selectRef,
  40460. wrapperRef,
  40461. selectionRef,
  40462. prefixRef,
  40463. suffixRef,
  40464. collapseItemRef,
  40465. popperRef,
  40466. validateState,
  40467. validateIcon,
  40468. showTagList,
  40469. collapseTagList,
  40470. debouncedOnInputChange,
  40471. deleteTag,
  40472. getLabel,
  40473. getValue,
  40474. getDisabled,
  40475. getValueKey,
  40476. handleClear,
  40477. handleClickOutside,
  40478. handleDel,
  40479. handleEsc,
  40480. focus,
  40481. blur,
  40482. handleMenuEnter,
  40483. handleResize,
  40484. resetSelectionWidth,
  40485. updateTooltip,
  40486. updateTagTooltip,
  40487. updateOptions,
  40488. toggleMenu,
  40489. scrollTo: scrollToItem,
  40490. onInput,
  40491. onKeyboardNavigate,
  40492. onKeyboardSelect,
  40493. onSelect,
  40494. onHover: onHoverOption,
  40495. handleCompositionStart,
  40496. handleCompositionEnd,
  40497. handleCompositionUpdate
  40498. };
  40499. };
  40500. var useSelect$2 = useSelect$1;
  40501. const _sfc_main$M = defineComponent({
  40502. name: "ElSelectV2",
  40503. components: {
  40504. ElSelectMenu,
  40505. ElTag,
  40506. ElTooltip,
  40507. ElIcon
  40508. },
  40509. directives: { ClickOutside },
  40510. props: SelectProps,
  40511. emits: selectEmits,
  40512. setup(props, { emit }) {
  40513. const modelValue = computed(() => {
  40514. const { modelValue: rawModelValue, multiple } = props;
  40515. const fallback = multiple ? [] : void 0;
  40516. if (isArray$1(rawModelValue)) {
  40517. return multiple ? rawModelValue : fallback;
  40518. }
  40519. return multiple ? fallback : rawModelValue;
  40520. });
  40521. const API = useSelect$2(reactive({
  40522. ...toRefs(props),
  40523. modelValue
  40524. }), emit);
  40525. const { calculatorRef, inputStyle } = useCalcInputWidth();
  40526. provide(selectV2InjectionKey, {
  40527. props: reactive({
  40528. ...toRefs(props),
  40529. height: API.popupHeight,
  40530. modelValue
  40531. }),
  40532. expanded: API.expanded,
  40533. tooltipRef: API.tooltipRef,
  40534. onSelect: API.onSelect,
  40535. onHover: API.onHover,
  40536. onKeyboardNavigate: API.onKeyboardNavigate,
  40537. onKeyboardSelect: API.onKeyboardSelect
  40538. });
  40539. const selectedLabel = computed(() => {
  40540. if (!props.multiple) {
  40541. return API.states.selectedLabel;
  40542. }
  40543. return API.states.cachedOptions.map((i) => i.label);
  40544. });
  40545. return {
  40546. ...API,
  40547. modelValue,
  40548. selectedLabel,
  40549. calculatorRef,
  40550. inputStyle
  40551. };
  40552. }
  40553. });
  40554. function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
  40555. const _component_el_tag = resolveComponent("el-tag");
  40556. const _component_el_tooltip = resolveComponent("el-tooltip");
  40557. const _component_el_icon = resolveComponent("el-icon");
  40558. const _component_el_select_menu = resolveComponent("el-select-menu");
  40559. const _directive_click_outside = resolveDirective("click-outside");
  40560. return withDirectives((openBlock(), createElementBlock("div", {
  40561. ref: "selectRef",
  40562. class: normalizeClass([_ctx.nsSelect.b(), _ctx.nsSelect.m(_ctx.selectSize)]),
  40563. onMouseenter: ($event) => _ctx.states.inputHovering = true,
  40564. onMouseleave: ($event) => _ctx.states.inputHovering = false
  40565. }, [
  40566. createVNode(_component_el_tooltip, {
  40567. ref: "tooltipRef",
  40568. visible: _ctx.dropdownMenuVisible,
  40569. teleported: _ctx.teleported,
  40570. "popper-class": [_ctx.nsSelect.e("popper"), _ctx.popperClass],
  40571. "gpu-acceleration": false,
  40572. "stop-popper-mouse-event": false,
  40573. "popper-options": _ctx.popperOptions,
  40574. "fallback-placements": _ctx.fallbackPlacements,
  40575. effect: _ctx.effect,
  40576. placement: _ctx.placement,
  40577. pure: "",
  40578. transition: `${_ctx.nsSelect.namespace.value}-zoom-in-top`,
  40579. trigger: "click",
  40580. persistent: _ctx.persistent,
  40581. "append-to": _ctx.appendTo,
  40582. "show-arrow": _ctx.showArrow,
  40583. offset: _ctx.offset,
  40584. onBeforeShow: _ctx.handleMenuEnter,
  40585. onHide: ($event) => _ctx.states.isBeforeHide = false
  40586. }, {
  40587. default: withCtx(() => [
  40588. createElementVNode("div", {
  40589. ref: "wrapperRef",
  40590. class: normalizeClass([
  40591. _ctx.nsSelect.e("wrapper"),
  40592. _ctx.nsSelect.is("focused", _ctx.isFocused),
  40593. _ctx.nsSelect.is("hovering", _ctx.states.inputHovering),
  40594. _ctx.nsSelect.is("filterable", _ctx.filterable),
  40595. _ctx.nsSelect.is("disabled", _ctx.selectDisabled)
  40596. ]),
  40597. onClick: withModifiers(_ctx.toggleMenu, ["prevent"])
  40598. }, [
  40599. _ctx.$slots.prefix ? (openBlock(), createElementBlock("div", {
  40600. key: 0,
  40601. ref: "prefixRef",
  40602. class: normalizeClass(_ctx.nsSelect.e("prefix"))
  40603. }, [
  40604. renderSlot(_ctx.$slots, "prefix")
  40605. ], 2)) : createCommentVNode("v-if", true),
  40606. createElementVNode("div", {
  40607. ref: "selectionRef",
  40608. class: normalizeClass([
  40609. _ctx.nsSelect.e("selection"),
  40610. _ctx.nsSelect.is("near", _ctx.multiple && !_ctx.$slots.prefix && !!_ctx.modelValue.length)
  40611. ])
  40612. }, [
  40613. _ctx.multiple ? renderSlot(_ctx.$slots, "tag", { key: 0 }, () => [
  40614. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.showTagList, (item) => {
  40615. return openBlock(), createElementBlock("div", {
  40616. key: _ctx.getValueKey(_ctx.getValue(item)),
  40617. class: normalizeClass(_ctx.nsSelect.e("selected-item"))
  40618. }, [
  40619. createVNode(_component_el_tag, {
  40620. closable: !_ctx.selectDisabled && !_ctx.getDisabled(item),
  40621. size: _ctx.collapseTagSize,
  40622. type: _ctx.tagType,
  40623. effect: _ctx.tagEffect,
  40624. "disable-transitions": "",
  40625. style: normalizeStyle(_ctx.tagStyle),
  40626. onClose: ($event) => _ctx.deleteTag($event, item)
  40627. }, {
  40628. default: withCtx(() => [
  40629. createElementVNode("span", {
  40630. class: normalizeClass(_ctx.nsSelect.e("tags-text"))
  40631. }, [
  40632. renderSlot(_ctx.$slots, "label", {
  40633. label: _ctx.getLabel(item),
  40634. value: _ctx.getValue(item)
  40635. }, () => [
  40636. createTextVNode(toDisplayString(_ctx.getLabel(item)), 1)
  40637. ])
  40638. ], 2)
  40639. ]),
  40640. _: 2
  40641. }, 1032, ["closable", "size", "type", "effect", "style", "onClose"])
  40642. ], 2);
  40643. }), 128)),
  40644. _ctx.collapseTags && _ctx.modelValue.length > _ctx.maxCollapseTags ? (openBlock(), createBlock(_component_el_tooltip, {
  40645. key: 0,
  40646. ref: "tagTooltipRef",
  40647. disabled: _ctx.dropdownMenuVisible || !_ctx.collapseTagsTooltip,
  40648. "fallback-placements": ["bottom", "top", "right", "left"],
  40649. effect: _ctx.effect,
  40650. placement: "bottom",
  40651. teleported: _ctx.teleported
  40652. }, {
  40653. default: withCtx(() => [
  40654. createElementVNode("div", {
  40655. ref: "collapseItemRef",
  40656. class: normalizeClass(_ctx.nsSelect.e("selected-item"))
  40657. }, [
  40658. createVNode(_component_el_tag, {
  40659. closable: false,
  40660. size: _ctx.collapseTagSize,
  40661. type: _ctx.tagType,
  40662. effect: _ctx.tagEffect,
  40663. style: normalizeStyle(_ctx.collapseTagStyle),
  40664. "disable-transitions": ""
  40665. }, {
  40666. default: withCtx(() => [
  40667. createElementVNode("span", {
  40668. class: normalizeClass(_ctx.nsSelect.e("tags-text"))
  40669. }, " + " + toDisplayString(_ctx.modelValue.length - _ctx.maxCollapseTags), 3)
  40670. ]),
  40671. _: 1
  40672. }, 8, ["size", "type", "effect", "style"])
  40673. ], 2)
  40674. ]),
  40675. content: withCtx(() => [
  40676. createElementVNode("div", {
  40677. ref: "tagMenuRef",
  40678. class: normalizeClass(_ctx.nsSelect.e("selection"))
  40679. }, [
  40680. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.collapseTagList, (selected) => {
  40681. return openBlock(), createElementBlock("div", {
  40682. key: _ctx.getValueKey(_ctx.getValue(selected)),
  40683. class: normalizeClass(_ctx.nsSelect.e("selected-item"))
  40684. }, [
  40685. createVNode(_component_el_tag, {
  40686. class: "in-tooltip",
  40687. closable: !_ctx.selectDisabled && !_ctx.getDisabled(selected),
  40688. size: _ctx.collapseTagSize,
  40689. type: _ctx.tagType,
  40690. effect: _ctx.tagEffect,
  40691. "disable-transitions": "",
  40692. onClose: ($event) => _ctx.deleteTag($event, selected)
  40693. }, {
  40694. default: withCtx(() => [
  40695. createElementVNode("span", {
  40696. class: normalizeClass(_ctx.nsSelect.e("tags-text"))
  40697. }, [
  40698. renderSlot(_ctx.$slots, "label", {
  40699. label: _ctx.getLabel(selected),
  40700. value: _ctx.getValue(selected)
  40701. }, () => [
  40702. createTextVNode(toDisplayString(_ctx.getLabel(selected)), 1)
  40703. ])
  40704. ], 2)
  40705. ]),
  40706. _: 2
  40707. }, 1032, ["closable", "size", "type", "effect", "onClose"])
  40708. ], 2);
  40709. }), 128))
  40710. ], 2)
  40711. ]),
  40712. _: 3
  40713. }, 8, ["disabled", "effect", "teleported"])) : createCommentVNode("v-if", true)
  40714. ]) : createCommentVNode("v-if", true),
  40715. createElementVNode("div", {
  40716. class: normalizeClass([
  40717. _ctx.nsSelect.e("selected-item"),
  40718. _ctx.nsSelect.e("input-wrapper"),
  40719. _ctx.nsSelect.is("hidden", !_ctx.filterable)
  40720. ])
  40721. }, [
  40722. withDirectives(createElementVNode("input", {
  40723. id: _ctx.inputId,
  40724. ref: "inputRef",
  40725. "onUpdate:modelValue": ($event) => _ctx.states.inputValue = $event,
  40726. style: normalizeStyle(_ctx.inputStyle),
  40727. autocomplete: _ctx.autocomplete,
  40728. tabindex: _ctx.tabindex,
  40729. "aria-autocomplete": "list",
  40730. "aria-haspopup": "listbox",
  40731. autocapitalize: "off",
  40732. "aria-expanded": _ctx.expanded,
  40733. "aria-label": _ctx.ariaLabel,
  40734. class: normalizeClass([_ctx.nsSelect.e("input"), _ctx.nsSelect.is(_ctx.selectSize)]),
  40735. disabled: _ctx.selectDisabled,
  40736. role: "combobox",
  40737. readonly: !_ctx.filterable,
  40738. spellcheck: "false",
  40739. type: "text",
  40740. name: _ctx.name,
  40741. onInput: _ctx.onInput,
  40742. onCompositionstart: _ctx.handleCompositionStart,
  40743. onCompositionupdate: _ctx.handleCompositionUpdate,
  40744. onCompositionend: _ctx.handleCompositionEnd,
  40745. onKeydown: [
  40746. withKeys(withModifiers(($event) => _ctx.onKeyboardNavigate("backward"), ["stop", "prevent"]), ["up"]),
  40747. withKeys(withModifiers(($event) => _ctx.onKeyboardNavigate("forward"), ["stop", "prevent"]), ["down"]),
  40748. withKeys(withModifiers(_ctx.onKeyboardSelect, ["stop", "prevent"]), ["enter"]),
  40749. withKeys(withModifiers(_ctx.handleEsc, ["stop", "prevent"]), ["esc"]),
  40750. withKeys(withModifiers(_ctx.handleDel, ["stop"]), ["delete"])
  40751. ],
  40752. onClick: withModifiers(_ctx.toggleMenu, ["stop"])
  40753. }, null, 46, ["id", "onUpdate:modelValue", "autocomplete", "tabindex", "aria-expanded", "aria-label", "disabled", "readonly", "name", "onInput", "onCompositionstart", "onCompositionupdate", "onCompositionend", "onKeydown", "onClick"]), [
  40754. [vModelText, _ctx.states.inputValue]
  40755. ]),
  40756. _ctx.filterable ? (openBlock(), createElementBlock("span", {
  40757. key: 0,
  40758. ref: "calculatorRef",
  40759. "aria-hidden": "true",
  40760. class: normalizeClass(_ctx.nsSelect.e("input-calculator")),
  40761. textContent: toDisplayString(_ctx.states.inputValue)
  40762. }, null, 10, ["textContent"])) : createCommentVNode("v-if", true)
  40763. ], 2),
  40764. _ctx.shouldShowPlaceholder ? (openBlock(), createElementBlock("div", {
  40765. key: 1,
  40766. class: normalizeClass([
  40767. _ctx.nsSelect.e("selected-item"),
  40768. _ctx.nsSelect.e("placeholder"),
  40769. _ctx.nsSelect.is("transparent", !_ctx.hasModelValue || _ctx.expanded && !_ctx.states.inputValue)
  40770. ])
  40771. }, [
  40772. _ctx.hasModelValue ? renderSlot(_ctx.$slots, "label", {
  40773. key: 0,
  40774. label: _ctx.currentPlaceholder,
  40775. value: _ctx.modelValue
  40776. }, () => [
  40777. createElementVNode("span", null, toDisplayString(_ctx.currentPlaceholder), 1)
  40778. ]) : (openBlock(), createElementBlock("span", { key: 1 }, toDisplayString(_ctx.currentPlaceholder), 1))
  40779. ], 2)) : createCommentVNode("v-if", true)
  40780. ], 2),
  40781. createElementVNode("div", {
  40782. ref: "suffixRef",
  40783. class: normalizeClass(_ctx.nsSelect.e("suffix"))
  40784. }, [
  40785. _ctx.iconComponent ? withDirectives((openBlock(), createBlock(_component_el_icon, {
  40786. key: 0,
  40787. class: normalizeClass([_ctx.nsSelect.e("caret"), _ctx.nsInput.e("icon"), _ctx.iconReverse])
  40788. }, {
  40789. default: withCtx(() => [
  40790. (openBlock(), createBlock(resolveDynamicComponent(_ctx.iconComponent)))
  40791. ]),
  40792. _: 1
  40793. }, 8, ["class"])), [
  40794. [vShow, !_ctx.showClearBtn]
  40795. ]) : createCommentVNode("v-if", true),
  40796. _ctx.showClearBtn && _ctx.clearIcon ? (openBlock(), createBlock(_component_el_icon, {
  40797. key: 1,
  40798. class: normalizeClass([
  40799. _ctx.nsSelect.e("caret"),
  40800. _ctx.nsInput.e("icon"),
  40801. _ctx.nsSelect.e("clear")
  40802. ]),
  40803. onClick: withModifiers(_ctx.handleClear, ["prevent", "stop"])
  40804. }, {
  40805. default: withCtx(() => [
  40806. (openBlock(), createBlock(resolveDynamicComponent(_ctx.clearIcon)))
  40807. ]),
  40808. _: 1
  40809. }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true),
  40810. _ctx.validateState && _ctx.validateIcon && _ctx.needStatusIcon ? (openBlock(), createBlock(_component_el_icon, {
  40811. key: 2,
  40812. class: normalizeClass([
  40813. _ctx.nsInput.e("icon"),
  40814. _ctx.nsInput.e("validateIcon"),
  40815. _ctx.nsInput.is("loading", _ctx.validateState === "validating")
  40816. ])
  40817. }, {
  40818. default: withCtx(() => [
  40819. (openBlock(), createBlock(resolveDynamicComponent(_ctx.validateIcon)))
  40820. ]),
  40821. _: 1
  40822. }, 8, ["class"])) : createCommentVNode("v-if", true)
  40823. ], 2)
  40824. ], 10, ["onClick"])
  40825. ]),
  40826. content: withCtx(() => [
  40827. createVNode(_component_el_select_menu, {
  40828. ref: "menuRef",
  40829. data: _ctx.filteredOptions,
  40830. width: _ctx.popperSize,
  40831. "hovering-index": _ctx.states.hoveringIndex,
  40832. "scrollbar-always-on": _ctx.scrollbarAlwaysOn
  40833. }, createSlots({
  40834. default: withCtx((scope) => [
  40835. renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(scope)))
  40836. ]),
  40837. _: 2
  40838. }, [
  40839. _ctx.$slots.header ? {
  40840. name: "header",
  40841. fn: withCtx(() => [
  40842. createElementVNode("div", {
  40843. class: normalizeClass(_ctx.nsSelect.be("dropdown", "header"))
  40844. }, [
  40845. renderSlot(_ctx.$slots, "header")
  40846. ], 2)
  40847. ])
  40848. } : void 0,
  40849. _ctx.$slots.loading && _ctx.loading ? {
  40850. name: "loading",
  40851. fn: withCtx(() => [
  40852. createElementVNode("div", {
  40853. class: normalizeClass(_ctx.nsSelect.be("dropdown", "loading"))
  40854. }, [
  40855. renderSlot(_ctx.$slots, "loading")
  40856. ], 2)
  40857. ])
  40858. } : _ctx.loading || _ctx.filteredOptions.length === 0 ? {
  40859. name: "empty",
  40860. fn: withCtx(() => [
  40861. createElementVNode("div", {
  40862. class: normalizeClass(_ctx.nsSelect.be("dropdown", "empty"))
  40863. }, [
  40864. renderSlot(_ctx.$slots, "empty", {}, () => [
  40865. createElementVNode("span", null, toDisplayString(_ctx.emptyText), 1)
  40866. ])
  40867. ], 2)
  40868. ])
  40869. } : void 0,
  40870. _ctx.$slots.footer ? {
  40871. name: "footer",
  40872. fn: withCtx(() => [
  40873. createElementVNode("div", {
  40874. class: normalizeClass(_ctx.nsSelect.be("dropdown", "footer"))
  40875. }, [
  40876. renderSlot(_ctx.$slots, "footer")
  40877. ], 2)
  40878. ])
  40879. } : void 0
  40880. ]), 1032, ["data", "width", "hovering-index", "scrollbar-always-on"])
  40881. ]),
  40882. _: 3
  40883. }, 8, ["visible", "teleported", "popper-class", "popper-options", "fallback-placements", "effect", "placement", "transition", "persistent", "append-to", "show-arrow", "offset", "onBeforeShow", "onHide"])
  40884. ], 42, ["onMouseenter", "onMouseleave"])), [
  40885. [_directive_click_outside, _ctx.handleClickOutside, _ctx.popperRef]
  40886. ]);
  40887. }
  40888. var Select = /* @__PURE__ */ _export_sfc(_sfc_main$M, [["render", _sfc_render$5], ["__file", "select.vue"]]);
  40889. const ElSelectV2 = withInstall(Select);
  40890. const skeletonProps = buildProps({
  40891. animated: {
  40892. type: Boolean,
  40893. default: false
  40894. },
  40895. count: {
  40896. type: Number,
  40897. default: 1
  40898. },
  40899. rows: {
  40900. type: Number,
  40901. default: 3
  40902. },
  40903. loading: {
  40904. type: Boolean,
  40905. default: true
  40906. },
  40907. throttle: {
  40908. type: definePropType([Number, Object])
  40909. }
  40910. });
  40911. const skeletonItemProps = buildProps({
  40912. variant: {
  40913. type: String,
  40914. values: [
  40915. "circle",
  40916. "rect",
  40917. "h1",
  40918. "h3",
  40919. "text",
  40920. "caption",
  40921. "p",
  40922. "image",
  40923. "button"
  40924. ],
  40925. default: "text"
  40926. }
  40927. });
  40928. const __default__$E = defineComponent({
  40929. name: "ElSkeletonItem"
  40930. });
  40931. const _sfc_main$L = /* @__PURE__ */ defineComponent({
  40932. ...__default__$E,
  40933. props: skeletonItemProps,
  40934. setup(__props) {
  40935. const ns = useNamespace("skeleton");
  40936. return (_ctx, _cache) => {
  40937. return openBlock(), createElementBlock("div", {
  40938. class: normalizeClass([unref(ns).e("item"), unref(ns).e(_ctx.variant)])
  40939. }, [
  40940. _ctx.variant === "image" ? (openBlock(), createBlock(unref(picture_filled_default), { key: 0 })) : createCommentVNode("v-if", true)
  40941. ], 2);
  40942. };
  40943. }
  40944. });
  40945. var SkeletonItem = /* @__PURE__ */ _export_sfc(_sfc_main$L, [["__file", "skeleton-item.vue"]]);
  40946. const __default__$D = defineComponent({
  40947. name: "ElSkeleton"
  40948. });
  40949. const _sfc_main$K = /* @__PURE__ */ defineComponent({
  40950. ...__default__$D,
  40951. props: skeletonProps,
  40952. setup(__props, { expose }) {
  40953. const props = __props;
  40954. const ns = useNamespace("skeleton");
  40955. const uiLoading = useThrottleRender(toRef(props, "loading"), props.throttle);
  40956. expose({
  40957. uiLoading
  40958. });
  40959. return (_ctx, _cache) => {
  40960. return unref(uiLoading) ? (openBlock(), createElementBlock("div", mergeProps({
  40961. key: 0,
  40962. class: [unref(ns).b(), unref(ns).is("animated", _ctx.animated)]
  40963. }, _ctx.$attrs), [
  40964. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.count, (i) => {
  40965. return openBlock(), createElementBlock(Fragment, { key: i }, [
  40966. unref(uiLoading) ? renderSlot(_ctx.$slots, "template", { key: i }, () => [
  40967. createVNode(SkeletonItem, {
  40968. class: normalizeClass(unref(ns).is("first")),
  40969. variant: "p"
  40970. }, null, 8, ["class"]),
  40971. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.rows, (item) => {
  40972. return openBlock(), createBlock(SkeletonItem, {
  40973. key: item,
  40974. class: normalizeClass([
  40975. unref(ns).e("paragraph"),
  40976. unref(ns).is("last", item === _ctx.rows && _ctx.rows > 1)
  40977. ]),
  40978. variant: "p"
  40979. }, null, 8, ["class"]);
  40980. }), 128))
  40981. ]) : createCommentVNode("v-if", true)
  40982. ], 64);
  40983. }), 128))
  40984. ], 16)) : renderSlot(_ctx.$slots, "default", normalizeProps(mergeProps({ key: 1 }, _ctx.$attrs)));
  40985. };
  40986. }
  40987. });
  40988. var Skeleton = /* @__PURE__ */ _export_sfc(_sfc_main$K, [["__file", "skeleton.vue"]]);
  40989. const ElSkeleton = withInstall(Skeleton, {
  40990. SkeletonItem
  40991. });
  40992. const ElSkeletonItem = withNoopInstall(SkeletonItem);
  40993. const sliderContextKey = Symbol("sliderContextKey");
  40994. const sliderProps = buildProps({
  40995. modelValue: {
  40996. type: definePropType([Number, Array]),
  40997. default: 0
  40998. },
  40999. id: {
  41000. type: String,
  41001. default: void 0
  41002. },
  41003. min: {
  41004. type: Number,
  41005. default: 0
  41006. },
  41007. max: {
  41008. type: Number,
  41009. default: 100
  41010. },
  41011. step: {
  41012. type: Number,
  41013. default: 1
  41014. },
  41015. showInput: Boolean,
  41016. showInputControls: {
  41017. type: Boolean,
  41018. default: true
  41019. },
  41020. size: useSizeProp,
  41021. inputSize: useSizeProp,
  41022. showStops: Boolean,
  41023. showTooltip: {
  41024. type: Boolean,
  41025. default: true
  41026. },
  41027. formatTooltip: {
  41028. type: definePropType(Function),
  41029. default: void 0
  41030. },
  41031. disabled: Boolean,
  41032. range: Boolean,
  41033. vertical: Boolean,
  41034. height: String,
  41035. debounce: {
  41036. type: Number,
  41037. default: 300
  41038. },
  41039. rangeStartLabel: {
  41040. type: String,
  41041. default: void 0
  41042. },
  41043. rangeEndLabel: {
  41044. type: String,
  41045. default: void 0
  41046. },
  41047. formatValueText: {
  41048. type: definePropType(Function),
  41049. default: void 0
  41050. },
  41051. tooltipClass: {
  41052. type: String,
  41053. default: void 0
  41054. },
  41055. placement: {
  41056. type: String,
  41057. values: Ee,
  41058. default: "top"
  41059. },
  41060. marks: {
  41061. type: definePropType(Object)
  41062. },
  41063. validateEvent: {
  41064. type: Boolean,
  41065. default: true
  41066. },
  41067. persistent: {
  41068. type: Boolean,
  41069. default: true
  41070. },
  41071. ...useAriaProps(["ariaLabel"])
  41072. });
  41073. const isValidValue$1 = (value) => isNumber(value) || isArray$1(value) && value.every(isNumber);
  41074. const sliderEmits = {
  41075. [UPDATE_MODEL_EVENT]: isValidValue$1,
  41076. [INPUT_EVENT]: isValidValue$1,
  41077. [CHANGE_EVENT]: isValidValue$1
  41078. };
  41079. const useLifecycle = (props, initData, resetSize) => {
  41080. const sliderWrapper = ref();
  41081. onMounted(async () => {
  41082. if (props.range) {
  41083. if (isArray$1(props.modelValue)) {
  41084. initData.firstValue = Math.max(props.min, props.modelValue[0]);
  41085. initData.secondValue = Math.min(props.max, props.modelValue[1]);
  41086. } else {
  41087. initData.firstValue = props.min;
  41088. initData.secondValue = props.max;
  41089. }
  41090. initData.oldValue = [initData.firstValue, initData.secondValue];
  41091. } else {
  41092. if (!isNumber(props.modelValue) || Number.isNaN(props.modelValue)) {
  41093. initData.firstValue = props.min;
  41094. } else {
  41095. initData.firstValue = Math.min(props.max, Math.max(props.min, props.modelValue));
  41096. }
  41097. initData.oldValue = initData.firstValue;
  41098. }
  41099. useEventListener(window, "resize", resetSize);
  41100. await nextTick();
  41101. resetSize();
  41102. });
  41103. return {
  41104. sliderWrapper
  41105. };
  41106. };
  41107. const useMarks = (props) => {
  41108. return computed(() => {
  41109. if (!props.marks) {
  41110. return [];
  41111. }
  41112. const marksKeys = Object.keys(props.marks);
  41113. return marksKeys.map(Number.parseFloat).sort((a, b) => a - b).filter((point) => point <= props.max && point >= props.min).map((point) => ({
  41114. point,
  41115. position: (point - props.min) * 100 / (props.max - props.min),
  41116. mark: props.marks[point]
  41117. }));
  41118. });
  41119. };
  41120. const useSlide = (props, initData, emit) => {
  41121. const { form: elForm, formItem: elFormItem } = useFormItem();
  41122. const slider = shallowRef();
  41123. const firstButton = ref();
  41124. const secondButton = ref();
  41125. const buttonRefs = {
  41126. firstButton,
  41127. secondButton
  41128. };
  41129. const sliderDisabled = computed(() => {
  41130. return props.disabled || (elForm == null ? void 0 : elForm.disabled) || false;
  41131. });
  41132. const minValue = computed(() => {
  41133. return Math.min(initData.firstValue, initData.secondValue);
  41134. });
  41135. const maxValue = computed(() => {
  41136. return Math.max(initData.firstValue, initData.secondValue);
  41137. });
  41138. const barSize = computed(() => {
  41139. return props.range ? `${100 * (maxValue.value - minValue.value) / (props.max - props.min)}%` : `${100 * (initData.firstValue - props.min) / (props.max - props.min)}%`;
  41140. });
  41141. const barStart = computed(() => {
  41142. return props.range ? `${100 * (minValue.value - props.min) / (props.max - props.min)}%` : "0%";
  41143. });
  41144. const runwayStyle = computed(() => {
  41145. return props.vertical ? { height: props.height } : {};
  41146. });
  41147. const barStyle = computed(() => {
  41148. return props.vertical ? {
  41149. height: barSize.value,
  41150. bottom: barStart.value
  41151. } : {
  41152. width: barSize.value,
  41153. left: barStart.value
  41154. };
  41155. });
  41156. const resetSize = () => {
  41157. if (slider.value) {
  41158. initData.sliderSize = slider.value[`client${props.vertical ? "Height" : "Width"}`];
  41159. }
  41160. };
  41161. const getButtonRefByPercent = (percent) => {
  41162. const targetValue = props.min + percent * (props.max - props.min) / 100;
  41163. if (!props.range) {
  41164. return firstButton;
  41165. }
  41166. let buttonRefName;
  41167. if (Math.abs(minValue.value - targetValue) < Math.abs(maxValue.value - targetValue)) {
  41168. buttonRefName = initData.firstValue < initData.secondValue ? "firstButton" : "secondButton";
  41169. } else {
  41170. buttonRefName = initData.firstValue > initData.secondValue ? "firstButton" : "secondButton";
  41171. }
  41172. return buttonRefs[buttonRefName];
  41173. };
  41174. const setPosition = (percent) => {
  41175. const buttonRef = getButtonRefByPercent(percent);
  41176. buttonRef.value.setPosition(percent);
  41177. return buttonRef;
  41178. };
  41179. const setFirstValue = (firstValue) => {
  41180. initData.firstValue = firstValue != null ? firstValue : props.min;
  41181. _emit(props.range ? [minValue.value, maxValue.value] : firstValue != null ? firstValue : props.min);
  41182. };
  41183. const setSecondValue = (secondValue) => {
  41184. initData.secondValue = secondValue;
  41185. if (props.range) {
  41186. _emit([minValue.value, maxValue.value]);
  41187. }
  41188. };
  41189. const _emit = (val) => {
  41190. emit(UPDATE_MODEL_EVENT, val);
  41191. emit(INPUT_EVENT, val);
  41192. };
  41193. const emitChange = async () => {
  41194. await nextTick();
  41195. emit(CHANGE_EVENT, props.range ? [minValue.value, maxValue.value] : props.modelValue);
  41196. };
  41197. const handleSliderPointerEvent = (event) => {
  41198. var _a, _b, _c, _d, _e, _f;
  41199. if (sliderDisabled.value || initData.dragging)
  41200. return;
  41201. resetSize();
  41202. let newPercent = 0;
  41203. if (props.vertical) {
  41204. const clientY = (_c = (_b = (_a = event.touches) == null ? void 0 : _a.item(0)) == null ? void 0 : _b.clientY) != null ? _c : event.clientY;
  41205. const sliderOffsetBottom = slider.value.getBoundingClientRect().bottom;
  41206. newPercent = (sliderOffsetBottom - clientY) / initData.sliderSize * 100;
  41207. } else {
  41208. const clientX = (_f = (_e = (_d = event.touches) == null ? void 0 : _d.item(0)) == null ? void 0 : _e.clientX) != null ? _f : event.clientX;
  41209. const sliderOffsetLeft = slider.value.getBoundingClientRect().left;
  41210. newPercent = (clientX - sliderOffsetLeft) / initData.sliderSize * 100;
  41211. }
  41212. if (newPercent < 0 || newPercent > 100)
  41213. return;
  41214. return setPosition(newPercent);
  41215. };
  41216. const onSliderWrapperPrevent = (event) => {
  41217. var _a, _b;
  41218. if (((_a = buttonRefs["firstButton"].value) == null ? void 0 : _a.dragging) || ((_b = buttonRefs["secondButton"].value) == null ? void 0 : _b.dragging)) {
  41219. event.preventDefault();
  41220. }
  41221. };
  41222. const onSliderDown = async (event) => {
  41223. const buttonRef = handleSliderPointerEvent(event);
  41224. if (buttonRef) {
  41225. await nextTick();
  41226. buttonRef.value.onButtonDown(event);
  41227. }
  41228. };
  41229. const onSliderClick = (event) => {
  41230. const buttonRef = handleSliderPointerEvent(event);
  41231. if (buttonRef) {
  41232. emitChange();
  41233. }
  41234. };
  41235. const onSliderMarkerDown = (position) => {
  41236. if (sliderDisabled.value || initData.dragging)
  41237. return;
  41238. const buttonRef = setPosition(position);
  41239. if (buttonRef) {
  41240. emitChange();
  41241. }
  41242. };
  41243. return {
  41244. elFormItem,
  41245. slider,
  41246. firstButton,
  41247. secondButton,
  41248. sliderDisabled,
  41249. minValue,
  41250. maxValue,
  41251. runwayStyle,
  41252. barStyle,
  41253. resetSize,
  41254. setPosition,
  41255. emitChange,
  41256. onSliderWrapperPrevent,
  41257. onSliderClick,
  41258. onSliderDown,
  41259. onSliderMarkerDown,
  41260. setFirstValue,
  41261. setSecondValue
  41262. };
  41263. };
  41264. const useTooltip = (props, formatTooltip, showTooltip) => {
  41265. const tooltip = ref();
  41266. const tooltipVisible = ref(false);
  41267. const enableFormat = computed(() => {
  41268. return formatTooltip.value instanceof Function;
  41269. });
  41270. const formatValue = computed(() => {
  41271. return enableFormat.value && formatTooltip.value(props.modelValue) || props.modelValue;
  41272. });
  41273. const displayTooltip = debounce(() => {
  41274. showTooltip.value && (tooltipVisible.value = true);
  41275. }, 50);
  41276. const hideTooltip = debounce(() => {
  41277. showTooltip.value && (tooltipVisible.value = false);
  41278. }, 50);
  41279. return {
  41280. tooltip,
  41281. tooltipVisible,
  41282. formatValue,
  41283. displayTooltip,
  41284. hideTooltip
  41285. };
  41286. };
  41287. const useSliderButton = (props, initData, emit) => {
  41288. const {
  41289. disabled,
  41290. min,
  41291. max,
  41292. step,
  41293. showTooltip,
  41294. persistent,
  41295. precision,
  41296. sliderSize,
  41297. formatTooltip,
  41298. emitChange,
  41299. resetSize,
  41300. updateDragging
  41301. } = inject(sliderContextKey);
  41302. const { tooltip, tooltipVisible, formatValue, displayTooltip, hideTooltip } = useTooltip(props, formatTooltip, showTooltip);
  41303. const button = ref();
  41304. const currentPosition = computed(() => {
  41305. return `${(props.modelValue - min.value) / (max.value - min.value) * 100}%`;
  41306. });
  41307. const wrapperStyle = computed(() => {
  41308. return props.vertical ? { bottom: currentPosition.value } : { left: currentPosition.value };
  41309. });
  41310. const handleMouseEnter = () => {
  41311. initData.hovering = true;
  41312. displayTooltip();
  41313. };
  41314. const handleMouseLeave = () => {
  41315. initData.hovering = false;
  41316. if (!initData.dragging) {
  41317. hideTooltip();
  41318. }
  41319. };
  41320. const onButtonDown = (event) => {
  41321. if (disabled.value)
  41322. return;
  41323. event.preventDefault();
  41324. onDragStart(event);
  41325. window.addEventListener("mousemove", onDragging);
  41326. window.addEventListener("touchmove", onDragging);
  41327. window.addEventListener("mouseup", onDragEnd);
  41328. window.addEventListener("touchend", onDragEnd);
  41329. window.addEventListener("contextmenu", onDragEnd);
  41330. button.value.focus();
  41331. };
  41332. const incrementPosition = (amount) => {
  41333. if (disabled.value)
  41334. return;
  41335. initData.newPosition = Number.parseFloat(currentPosition.value) + amount / (max.value - min.value) * 100;
  41336. setPosition(initData.newPosition);
  41337. emitChange();
  41338. };
  41339. const onLeftKeyDown = () => {
  41340. incrementPosition(-step.value);
  41341. };
  41342. const onRightKeyDown = () => {
  41343. incrementPosition(step.value);
  41344. };
  41345. const onPageDownKeyDown = () => {
  41346. incrementPosition(-step.value * 4);
  41347. };
  41348. const onPageUpKeyDown = () => {
  41349. incrementPosition(step.value * 4);
  41350. };
  41351. const onHomeKeyDown = () => {
  41352. if (disabled.value)
  41353. return;
  41354. setPosition(0);
  41355. emitChange();
  41356. };
  41357. const onEndKeyDown = () => {
  41358. if (disabled.value)
  41359. return;
  41360. setPosition(100);
  41361. emitChange();
  41362. };
  41363. const onKeyDown = (event) => {
  41364. let isPreventDefault = true;
  41365. switch (event.code) {
  41366. case EVENT_CODE.left:
  41367. case EVENT_CODE.down:
  41368. onLeftKeyDown();
  41369. break;
  41370. case EVENT_CODE.right:
  41371. case EVENT_CODE.up:
  41372. onRightKeyDown();
  41373. break;
  41374. case EVENT_CODE.home:
  41375. onHomeKeyDown();
  41376. break;
  41377. case EVENT_CODE.end:
  41378. onEndKeyDown();
  41379. break;
  41380. case EVENT_CODE.pageDown:
  41381. onPageDownKeyDown();
  41382. break;
  41383. case EVENT_CODE.pageUp:
  41384. onPageUpKeyDown();
  41385. break;
  41386. default:
  41387. isPreventDefault = false;
  41388. break;
  41389. }
  41390. isPreventDefault && event.preventDefault();
  41391. };
  41392. const getClientXY = (event) => {
  41393. let clientX;
  41394. let clientY;
  41395. if (event.type.startsWith("touch")) {
  41396. clientY = event.touches[0].clientY;
  41397. clientX = event.touches[0].clientX;
  41398. } else {
  41399. clientY = event.clientY;
  41400. clientX = event.clientX;
  41401. }
  41402. return {
  41403. clientX,
  41404. clientY
  41405. };
  41406. };
  41407. const onDragStart = (event) => {
  41408. initData.dragging = true;
  41409. initData.isClick = true;
  41410. const { clientX, clientY } = getClientXY(event);
  41411. if (props.vertical) {
  41412. initData.startY = clientY;
  41413. } else {
  41414. initData.startX = clientX;
  41415. }
  41416. initData.startPosition = Number.parseFloat(currentPosition.value);
  41417. initData.newPosition = initData.startPosition;
  41418. };
  41419. const onDragging = (event) => {
  41420. if (initData.dragging) {
  41421. initData.isClick = false;
  41422. displayTooltip();
  41423. resetSize();
  41424. let diff;
  41425. const { clientX, clientY } = getClientXY(event);
  41426. if (props.vertical) {
  41427. initData.currentY = clientY;
  41428. diff = (initData.startY - initData.currentY) / sliderSize.value * 100;
  41429. } else {
  41430. initData.currentX = clientX;
  41431. diff = (initData.currentX - initData.startX) / sliderSize.value * 100;
  41432. }
  41433. initData.newPosition = initData.startPosition + diff;
  41434. setPosition(initData.newPosition);
  41435. }
  41436. };
  41437. const onDragEnd = () => {
  41438. if (initData.dragging) {
  41439. setTimeout(() => {
  41440. initData.dragging = false;
  41441. if (!initData.hovering) {
  41442. hideTooltip();
  41443. }
  41444. if (!initData.isClick) {
  41445. setPosition(initData.newPosition);
  41446. }
  41447. emitChange();
  41448. }, 0);
  41449. window.removeEventListener("mousemove", onDragging);
  41450. window.removeEventListener("touchmove", onDragging);
  41451. window.removeEventListener("mouseup", onDragEnd);
  41452. window.removeEventListener("touchend", onDragEnd);
  41453. window.removeEventListener("contextmenu", onDragEnd);
  41454. }
  41455. };
  41456. const setPosition = async (newPosition) => {
  41457. if (newPosition === null || Number.isNaN(+newPosition))
  41458. return;
  41459. if (newPosition < 0) {
  41460. newPosition = 0;
  41461. } else if (newPosition > 100) {
  41462. newPosition = 100;
  41463. }
  41464. const lengthPerStep = 100 / ((max.value - min.value) / step.value);
  41465. const steps = Math.round(newPosition / lengthPerStep);
  41466. let value = steps * lengthPerStep * (max.value - min.value) * 0.01 + min.value;
  41467. value = Number.parseFloat(value.toFixed(precision.value));
  41468. if (value !== props.modelValue) {
  41469. emit(UPDATE_MODEL_EVENT, value);
  41470. }
  41471. if (!initData.dragging && props.modelValue !== initData.oldValue) {
  41472. initData.oldValue = props.modelValue;
  41473. }
  41474. await nextTick();
  41475. initData.dragging && displayTooltip();
  41476. tooltip.value.updatePopper();
  41477. };
  41478. watch(() => initData.dragging, (val) => {
  41479. updateDragging(val);
  41480. });
  41481. useEventListener(button, "touchstart", onButtonDown, { passive: false });
  41482. return {
  41483. disabled,
  41484. button,
  41485. tooltip,
  41486. tooltipVisible,
  41487. showTooltip,
  41488. persistent,
  41489. wrapperStyle,
  41490. formatValue,
  41491. handleMouseEnter,
  41492. handleMouseLeave,
  41493. onButtonDown,
  41494. onKeyDown,
  41495. setPosition
  41496. };
  41497. };
  41498. const useStops = (props, initData, minValue, maxValue) => {
  41499. const stops = computed(() => {
  41500. if (!props.showStops || props.min > props.max)
  41501. return [];
  41502. if (props.step === 0) {
  41503. return [];
  41504. }
  41505. const stopCount = (props.max - props.min) / props.step;
  41506. const stepWidth = 100 * props.step / (props.max - props.min);
  41507. const result = Array.from({ length: stopCount - 1 }).map((_, index) => (index + 1) * stepWidth);
  41508. if (props.range) {
  41509. return result.filter((step) => {
  41510. return step < 100 * (minValue.value - props.min) / (props.max - props.min) || step > 100 * (maxValue.value - props.min) / (props.max - props.min);
  41511. });
  41512. } else {
  41513. return result.filter((step) => step > 100 * (initData.firstValue - props.min) / (props.max - props.min));
  41514. }
  41515. });
  41516. const getStopStyle = (position) => {
  41517. return props.vertical ? { bottom: `${position}%` } : { left: `${position}%` };
  41518. };
  41519. return {
  41520. stops,
  41521. getStopStyle
  41522. };
  41523. };
  41524. const useWatch = (props, initData, minValue, maxValue, emit, elFormItem) => {
  41525. const _emit = (val) => {
  41526. emit(UPDATE_MODEL_EVENT, val);
  41527. emit(INPUT_EVENT, val);
  41528. };
  41529. const valueChanged = () => {
  41530. if (props.range) {
  41531. return ![minValue.value, maxValue.value].every((item, index) => item === initData.oldValue[index]);
  41532. } else {
  41533. return props.modelValue !== initData.oldValue;
  41534. }
  41535. };
  41536. const setValues = () => {
  41537. var _a, _b;
  41538. if (props.min > props.max) {
  41539. throwError("Slider", "min should not be greater than max.");
  41540. }
  41541. const val = props.modelValue;
  41542. if (props.range && isArray$1(val)) {
  41543. if (val[1] < props.min) {
  41544. _emit([props.min, props.min]);
  41545. } else if (val[0] > props.max) {
  41546. _emit([props.max, props.max]);
  41547. } else if (val[0] < props.min) {
  41548. _emit([props.min, val[1]]);
  41549. } else if (val[1] > props.max) {
  41550. _emit([val[0], props.max]);
  41551. } else {
  41552. initData.firstValue = val[0];
  41553. initData.secondValue = val[1];
  41554. if (valueChanged()) {
  41555. if (props.validateEvent) {
  41556. (_a = elFormItem == null ? void 0 : elFormItem.validate) == null ? void 0 : _a.call(elFormItem, "change").catch((err) => debugWarn());
  41557. }
  41558. initData.oldValue = val.slice();
  41559. }
  41560. }
  41561. } else if (!props.range && isNumber(val) && !Number.isNaN(val)) {
  41562. if (val < props.min) {
  41563. _emit(props.min);
  41564. } else if (val > props.max) {
  41565. _emit(props.max);
  41566. } else {
  41567. initData.firstValue = val;
  41568. if (valueChanged()) {
  41569. if (props.validateEvent) {
  41570. (_b = elFormItem == null ? void 0 : elFormItem.validate) == null ? void 0 : _b.call(elFormItem, "change").catch((err) => debugWarn());
  41571. }
  41572. initData.oldValue = val;
  41573. }
  41574. }
  41575. }
  41576. };
  41577. setValues();
  41578. watch(() => initData.dragging, (val) => {
  41579. if (!val) {
  41580. setValues();
  41581. }
  41582. });
  41583. watch(() => props.modelValue, (val, oldVal) => {
  41584. if (initData.dragging || isArray$1(val) && isArray$1(oldVal) && val.every((item, index) => item === oldVal[index]) && initData.firstValue === val[0] && initData.secondValue === val[1]) {
  41585. return;
  41586. }
  41587. setValues();
  41588. }, {
  41589. deep: true
  41590. });
  41591. watch(() => [props.min, props.max], () => {
  41592. setValues();
  41593. });
  41594. };
  41595. const sliderButtonProps = buildProps({
  41596. modelValue: {
  41597. type: Number,
  41598. default: 0
  41599. },
  41600. vertical: Boolean,
  41601. tooltipClass: String,
  41602. placement: {
  41603. type: String,
  41604. values: Ee,
  41605. default: "top"
  41606. }
  41607. });
  41608. const sliderButtonEmits = {
  41609. [UPDATE_MODEL_EVENT]: (value) => isNumber(value)
  41610. };
  41611. const __default__$C = defineComponent({
  41612. name: "ElSliderButton"
  41613. });
  41614. const _sfc_main$J = /* @__PURE__ */ defineComponent({
  41615. ...__default__$C,
  41616. props: sliderButtonProps,
  41617. emits: sliderButtonEmits,
  41618. setup(__props, { expose, emit }) {
  41619. const props = __props;
  41620. const ns = useNamespace("slider");
  41621. const initData = reactive({
  41622. hovering: false,
  41623. dragging: false,
  41624. isClick: false,
  41625. startX: 0,
  41626. currentX: 0,
  41627. startY: 0,
  41628. currentY: 0,
  41629. startPosition: 0,
  41630. newPosition: 0,
  41631. oldValue: props.modelValue
  41632. });
  41633. const tooltipPersistent = computed(() => !showTooltip.value ? false : persistent.value);
  41634. const {
  41635. disabled,
  41636. button,
  41637. tooltip,
  41638. showTooltip,
  41639. persistent,
  41640. tooltipVisible,
  41641. wrapperStyle,
  41642. formatValue,
  41643. handleMouseEnter,
  41644. handleMouseLeave,
  41645. onButtonDown,
  41646. onKeyDown,
  41647. setPosition
  41648. } = useSliderButton(props, initData, emit);
  41649. const { hovering, dragging } = toRefs(initData);
  41650. expose({
  41651. onButtonDown,
  41652. onKeyDown,
  41653. setPosition,
  41654. hovering,
  41655. dragging
  41656. });
  41657. return (_ctx, _cache) => {
  41658. return openBlock(), createElementBlock("div", {
  41659. ref_key: "button",
  41660. ref: button,
  41661. class: normalizeClass([unref(ns).e("button-wrapper"), { hover: unref(hovering), dragging: unref(dragging) }]),
  41662. style: normalizeStyle(unref(wrapperStyle)),
  41663. tabindex: unref(disabled) ? -1 : 0,
  41664. onMouseenter: unref(handleMouseEnter),
  41665. onMouseleave: unref(handleMouseLeave),
  41666. onMousedown: unref(onButtonDown),
  41667. onFocus: unref(handleMouseEnter),
  41668. onBlur: unref(handleMouseLeave),
  41669. onKeydown: unref(onKeyDown)
  41670. }, [
  41671. createVNode(unref(ElTooltip), {
  41672. ref_key: "tooltip",
  41673. ref: tooltip,
  41674. visible: unref(tooltipVisible),
  41675. placement: _ctx.placement,
  41676. "fallback-placements": ["top", "bottom", "right", "left"],
  41677. "stop-popper-mouse-event": false,
  41678. "popper-class": _ctx.tooltipClass,
  41679. disabled: !unref(showTooltip),
  41680. persistent: unref(tooltipPersistent)
  41681. }, {
  41682. content: withCtx(() => [
  41683. createElementVNode("span", null, toDisplayString(unref(formatValue)), 1)
  41684. ]),
  41685. default: withCtx(() => [
  41686. createElementVNode("div", {
  41687. class: normalizeClass([unref(ns).e("button"), { hover: unref(hovering), dragging: unref(dragging) }])
  41688. }, null, 2)
  41689. ]),
  41690. _: 1
  41691. }, 8, ["visible", "placement", "popper-class", "disabled", "persistent"])
  41692. ], 46, ["tabindex", "onMouseenter", "onMouseleave", "onMousedown", "onFocus", "onBlur", "onKeydown"]);
  41693. };
  41694. }
  41695. });
  41696. var SliderButton = /* @__PURE__ */ _export_sfc(_sfc_main$J, [["__file", "button.vue"]]);
  41697. const sliderMarkerProps = buildProps({
  41698. mark: {
  41699. type: definePropType([String, Object]),
  41700. default: void 0
  41701. }
  41702. });
  41703. var SliderMarker = defineComponent({
  41704. name: "ElSliderMarker",
  41705. props: sliderMarkerProps,
  41706. setup(props) {
  41707. const ns = useNamespace("slider");
  41708. const label = computed(() => {
  41709. return isString$1(props.mark) ? props.mark : props.mark.label;
  41710. });
  41711. const style = computed(() => isString$1(props.mark) ? void 0 : props.mark.style);
  41712. return () => h$1("div", {
  41713. class: ns.e("marks-text"),
  41714. style: style.value
  41715. }, label.value);
  41716. }
  41717. });
  41718. const __default__$B = defineComponent({
  41719. name: "ElSlider"
  41720. });
  41721. const _sfc_main$I = /* @__PURE__ */ defineComponent({
  41722. ...__default__$B,
  41723. props: sliderProps,
  41724. emits: sliderEmits,
  41725. setup(__props, { expose, emit }) {
  41726. const props = __props;
  41727. const ns = useNamespace("slider");
  41728. const { t } = useLocale();
  41729. const initData = reactive({
  41730. firstValue: 0,
  41731. secondValue: 0,
  41732. oldValue: 0,
  41733. dragging: false,
  41734. sliderSize: 1
  41735. });
  41736. const {
  41737. elFormItem,
  41738. slider,
  41739. firstButton,
  41740. secondButton,
  41741. sliderDisabled,
  41742. minValue,
  41743. maxValue,
  41744. runwayStyle,
  41745. barStyle,
  41746. resetSize,
  41747. emitChange,
  41748. onSliderWrapperPrevent,
  41749. onSliderClick,
  41750. onSliderDown,
  41751. onSliderMarkerDown,
  41752. setFirstValue,
  41753. setSecondValue
  41754. } = useSlide(props, initData, emit);
  41755. const { stops, getStopStyle } = useStops(props, initData, minValue, maxValue);
  41756. const { inputId, isLabeledByFormItem } = useFormItemInputId(props, {
  41757. formItemContext: elFormItem
  41758. });
  41759. const sliderWrapperSize = useFormSize();
  41760. const sliderInputSize = computed(() => props.inputSize || sliderWrapperSize.value);
  41761. const groupLabel = computed(() => {
  41762. return props.ariaLabel || t("el.slider.defaultLabel", {
  41763. min: props.min,
  41764. max: props.max
  41765. });
  41766. });
  41767. const firstButtonLabel = computed(() => {
  41768. if (props.range) {
  41769. return props.rangeStartLabel || t("el.slider.defaultRangeStartLabel");
  41770. } else {
  41771. return groupLabel.value;
  41772. }
  41773. });
  41774. const firstValueText = computed(() => {
  41775. return props.formatValueText ? props.formatValueText(firstValue.value) : `${firstValue.value}`;
  41776. });
  41777. const secondButtonLabel = computed(() => {
  41778. return props.rangeEndLabel || t("el.slider.defaultRangeEndLabel");
  41779. });
  41780. const secondValueText = computed(() => {
  41781. return props.formatValueText ? props.formatValueText(secondValue.value) : `${secondValue.value}`;
  41782. });
  41783. const sliderKls = computed(() => [
  41784. ns.b(),
  41785. ns.m(sliderWrapperSize.value),
  41786. ns.is("vertical", props.vertical),
  41787. { [ns.m("with-input")]: props.showInput }
  41788. ]);
  41789. const markList = useMarks(props);
  41790. useWatch(props, initData, minValue, maxValue, emit, elFormItem);
  41791. const precision = computed(() => {
  41792. const precisions = [props.min, props.max, props.step].map((item) => {
  41793. const decimal = `${item}`.split(".")[1];
  41794. return decimal ? decimal.length : 0;
  41795. });
  41796. return Math.max.apply(null, precisions);
  41797. });
  41798. const { sliderWrapper } = useLifecycle(props, initData, resetSize);
  41799. const { firstValue, secondValue, sliderSize } = toRefs(initData);
  41800. const updateDragging = (val) => {
  41801. initData.dragging = val;
  41802. };
  41803. useEventListener(sliderWrapper, "touchstart", onSliderWrapperPrevent, {
  41804. passive: false
  41805. });
  41806. useEventListener(sliderWrapper, "touchmove", onSliderWrapperPrevent, {
  41807. passive: false
  41808. });
  41809. provide(sliderContextKey, {
  41810. ...toRefs(props),
  41811. sliderSize,
  41812. disabled: sliderDisabled,
  41813. precision,
  41814. emitChange,
  41815. resetSize,
  41816. updateDragging
  41817. });
  41818. expose({
  41819. onSliderClick
  41820. });
  41821. return (_ctx, _cache) => {
  41822. var _a, _b;
  41823. return openBlock(), createElementBlock("div", {
  41824. id: _ctx.range ? unref(inputId) : void 0,
  41825. ref_key: "sliderWrapper",
  41826. ref: sliderWrapper,
  41827. class: normalizeClass(unref(sliderKls)),
  41828. role: _ctx.range ? "group" : void 0,
  41829. "aria-label": _ctx.range && !unref(isLabeledByFormItem) ? unref(groupLabel) : void 0,
  41830. "aria-labelledby": _ctx.range && unref(isLabeledByFormItem) ? (_a = unref(elFormItem)) == null ? void 0 : _a.labelId : void 0
  41831. }, [
  41832. createElementVNode("div", {
  41833. ref_key: "slider",
  41834. ref: slider,
  41835. class: normalizeClass([
  41836. unref(ns).e("runway"),
  41837. { "show-input": _ctx.showInput && !_ctx.range },
  41838. unref(ns).is("disabled", unref(sliderDisabled))
  41839. ]),
  41840. style: normalizeStyle(unref(runwayStyle)),
  41841. onMousedown: unref(onSliderDown),
  41842. onTouchstartPassive: unref(onSliderDown)
  41843. }, [
  41844. createElementVNode("div", {
  41845. class: normalizeClass(unref(ns).e("bar")),
  41846. style: normalizeStyle(unref(barStyle))
  41847. }, null, 6),
  41848. createVNode(SliderButton, {
  41849. id: !_ctx.range ? unref(inputId) : void 0,
  41850. ref_key: "firstButton",
  41851. ref: firstButton,
  41852. "model-value": unref(firstValue),
  41853. vertical: _ctx.vertical,
  41854. "tooltip-class": _ctx.tooltipClass,
  41855. placement: _ctx.placement,
  41856. role: "slider",
  41857. "aria-label": _ctx.range || !unref(isLabeledByFormItem) ? unref(firstButtonLabel) : void 0,
  41858. "aria-labelledby": !_ctx.range && unref(isLabeledByFormItem) ? (_b = unref(elFormItem)) == null ? void 0 : _b.labelId : void 0,
  41859. "aria-valuemin": _ctx.min,
  41860. "aria-valuemax": _ctx.range ? unref(secondValue) : _ctx.max,
  41861. "aria-valuenow": unref(firstValue),
  41862. "aria-valuetext": unref(firstValueText),
  41863. "aria-orientation": _ctx.vertical ? "vertical" : "horizontal",
  41864. "aria-disabled": unref(sliderDisabled),
  41865. "onUpdate:modelValue": unref(setFirstValue)
  41866. }, 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"]),
  41867. _ctx.range ? (openBlock(), createBlock(SliderButton, {
  41868. key: 0,
  41869. ref_key: "secondButton",
  41870. ref: secondButton,
  41871. "model-value": unref(secondValue),
  41872. vertical: _ctx.vertical,
  41873. "tooltip-class": _ctx.tooltipClass,
  41874. placement: _ctx.placement,
  41875. role: "slider",
  41876. "aria-label": unref(secondButtonLabel),
  41877. "aria-valuemin": unref(firstValue),
  41878. "aria-valuemax": _ctx.max,
  41879. "aria-valuenow": unref(secondValue),
  41880. "aria-valuetext": unref(secondValueText),
  41881. "aria-orientation": _ctx.vertical ? "vertical" : "horizontal",
  41882. "aria-disabled": unref(sliderDisabled),
  41883. "onUpdate:modelValue": unref(setSecondValue)
  41884. }, null, 8, ["model-value", "vertical", "tooltip-class", "placement", "aria-label", "aria-valuemin", "aria-valuemax", "aria-valuenow", "aria-valuetext", "aria-orientation", "aria-disabled", "onUpdate:modelValue"])) : createCommentVNode("v-if", true),
  41885. _ctx.showStops ? (openBlock(), createElementBlock("div", { key: 1 }, [
  41886. (openBlock(true), createElementBlock(Fragment, null, renderList(unref(stops), (item, key) => {
  41887. return openBlock(), createElementBlock("div", {
  41888. key,
  41889. class: normalizeClass(unref(ns).e("stop")),
  41890. style: normalizeStyle(unref(getStopStyle)(item))
  41891. }, null, 6);
  41892. }), 128))
  41893. ])) : createCommentVNode("v-if", true),
  41894. unref(markList).length > 0 ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
  41895. createElementVNode("div", null, [
  41896. (openBlock(true), createElementBlock(Fragment, null, renderList(unref(markList), (item, key) => {
  41897. return openBlock(), createElementBlock("div", {
  41898. key,
  41899. style: normalizeStyle(unref(getStopStyle)(item.position)),
  41900. class: normalizeClass([unref(ns).e("stop"), unref(ns).e("marks-stop")])
  41901. }, null, 6);
  41902. }), 128))
  41903. ]),
  41904. createElementVNode("div", {
  41905. class: normalizeClass(unref(ns).e("marks"))
  41906. }, [
  41907. (openBlock(true), createElementBlock(Fragment, null, renderList(unref(markList), (item, key) => {
  41908. return openBlock(), createBlock(unref(SliderMarker), {
  41909. key,
  41910. mark: item.mark,
  41911. style: normalizeStyle(unref(getStopStyle)(item.position)),
  41912. onMousedown: withModifiers(($event) => unref(onSliderMarkerDown)(item.position), ["stop"])
  41913. }, null, 8, ["mark", "style", "onMousedown"]);
  41914. }), 128))
  41915. ], 2)
  41916. ], 64)) : createCommentVNode("v-if", true)
  41917. ], 46, ["onMousedown", "onTouchstartPassive"]),
  41918. _ctx.showInput && !_ctx.range ? (openBlock(), createBlock(unref(ElInputNumber), {
  41919. key: 0,
  41920. ref: "input",
  41921. "model-value": unref(firstValue),
  41922. class: normalizeClass(unref(ns).e("input")),
  41923. step: _ctx.step,
  41924. disabled: unref(sliderDisabled),
  41925. controls: _ctx.showInputControls,
  41926. min: _ctx.min,
  41927. max: _ctx.max,
  41928. precision: unref(precision),
  41929. debounce: _ctx.debounce,
  41930. size: unref(sliderInputSize),
  41931. "onUpdate:modelValue": unref(setFirstValue),
  41932. onChange: unref(emitChange)
  41933. }, null, 8, ["model-value", "class", "step", "disabled", "controls", "min", "max", "precision", "debounce", "size", "onUpdate:modelValue", "onChange"])) : createCommentVNode("v-if", true)
  41934. ], 10, ["id", "role", "aria-label", "aria-labelledby"]);
  41935. };
  41936. }
  41937. });
  41938. var Slider = /* @__PURE__ */ _export_sfc(_sfc_main$I, [["__file", "slider.vue"]]);
  41939. const ElSlider = withInstall(Slider);
  41940. const spaceItemProps = buildProps({
  41941. prefixCls: {
  41942. type: String
  41943. }
  41944. });
  41945. const SpaceItem = defineComponent({
  41946. name: "ElSpaceItem",
  41947. props: spaceItemProps,
  41948. setup(props, { slots }) {
  41949. const ns = useNamespace("space");
  41950. const classes = computed(() => `${props.prefixCls || ns.b()}__item`);
  41951. return () => h$1("div", { class: classes.value }, renderSlot(slots, "default"));
  41952. }
  41953. });
  41954. const SIZE_MAP = {
  41955. small: 8,
  41956. default: 12,
  41957. large: 16
  41958. };
  41959. function useSpace(props) {
  41960. const ns = useNamespace("space");
  41961. const classes = computed(() => [ns.b(), ns.m(props.direction), props.class]);
  41962. const horizontalSize = ref(0);
  41963. const verticalSize = ref(0);
  41964. const containerStyle = computed(() => {
  41965. const wrapKls = props.wrap || props.fill ? { flexWrap: "wrap" } : {};
  41966. const alignment = {
  41967. alignItems: props.alignment
  41968. };
  41969. const gap = {
  41970. rowGap: `${verticalSize.value}px`,
  41971. columnGap: `${horizontalSize.value}px`
  41972. };
  41973. return [wrapKls, alignment, gap, props.style];
  41974. });
  41975. const itemStyle = computed(() => {
  41976. return props.fill ? { flexGrow: 1, minWidth: `${props.fillRatio}%` } : {};
  41977. });
  41978. watchEffect(() => {
  41979. const { size = "small", wrap, direction: dir, fill } = props;
  41980. if (isArray$1(size)) {
  41981. const [h = 0, v = 0] = size;
  41982. horizontalSize.value = h;
  41983. verticalSize.value = v;
  41984. } else {
  41985. let val;
  41986. if (isNumber(size)) {
  41987. val = size;
  41988. } else {
  41989. val = SIZE_MAP[size || "small"] || SIZE_MAP.small;
  41990. }
  41991. if ((wrap || fill) && dir === "horizontal") {
  41992. horizontalSize.value = verticalSize.value = val;
  41993. } else {
  41994. if (dir === "horizontal") {
  41995. horizontalSize.value = val;
  41996. verticalSize.value = 0;
  41997. } else {
  41998. verticalSize.value = val;
  41999. horizontalSize.value = 0;
  42000. }
  42001. }
  42002. }
  42003. });
  42004. return {
  42005. classes,
  42006. containerStyle,
  42007. itemStyle
  42008. };
  42009. }
  42010. const spaceProps = buildProps({
  42011. direction: {
  42012. type: String,
  42013. values: ["horizontal", "vertical"],
  42014. default: "horizontal"
  42015. },
  42016. class: {
  42017. type: definePropType([
  42018. String,
  42019. Object,
  42020. Array
  42021. ]),
  42022. default: ""
  42023. },
  42024. style: {
  42025. type: definePropType([String, Array, Object]),
  42026. default: ""
  42027. },
  42028. alignment: {
  42029. type: definePropType(String),
  42030. default: "center"
  42031. },
  42032. prefixCls: {
  42033. type: String
  42034. },
  42035. spacer: {
  42036. type: definePropType([Object, String, Number, Array]),
  42037. default: null,
  42038. validator: (val) => isVNode(val) || isNumber(val) || isString$1(val)
  42039. },
  42040. wrap: Boolean,
  42041. fill: Boolean,
  42042. fillRatio: {
  42043. type: Number,
  42044. default: 100
  42045. },
  42046. size: {
  42047. type: [String, Array, Number],
  42048. values: componentSizes,
  42049. validator: (val) => {
  42050. return isNumber(val) || isArray$1(val) && val.length === 2 && val.every(isNumber);
  42051. }
  42052. }
  42053. });
  42054. const Space = defineComponent({
  42055. name: "ElSpace",
  42056. props: spaceProps,
  42057. setup(props, { slots }) {
  42058. const { classes, containerStyle, itemStyle } = useSpace(props);
  42059. function extractChildren(children, parentKey = "", extractedChildren = []) {
  42060. const { prefixCls } = props;
  42061. children.forEach((child, loopKey) => {
  42062. if (isFragment(child)) {
  42063. if (isArray$1(child.children)) {
  42064. child.children.forEach((nested, key) => {
  42065. if (isFragment(nested) && isArray$1(nested.children)) {
  42066. extractChildren(nested.children, `${parentKey + key}-`, extractedChildren);
  42067. } else {
  42068. extractedChildren.push(createVNode(SpaceItem, {
  42069. style: itemStyle.value,
  42070. prefixCls,
  42071. key: `nested-${parentKey + key}`
  42072. }, {
  42073. default: () => [nested]
  42074. }, PatchFlags.PROPS | PatchFlags.STYLE, ["style", "prefixCls"]));
  42075. }
  42076. });
  42077. }
  42078. } else if (isValidElementNode(child)) {
  42079. extractedChildren.push(createVNode(SpaceItem, {
  42080. style: itemStyle.value,
  42081. prefixCls,
  42082. key: `LoopKey${parentKey + loopKey}`
  42083. }, {
  42084. default: () => [child]
  42085. }, PatchFlags.PROPS | PatchFlags.STYLE, ["style", "prefixCls"]));
  42086. }
  42087. });
  42088. return extractedChildren;
  42089. }
  42090. return () => {
  42091. var _a;
  42092. const { spacer, direction } = props;
  42093. const children = renderSlot(slots, "default", { key: 0 }, () => []);
  42094. if (((_a = children.children) != null ? _a : []).length === 0)
  42095. return null;
  42096. if (isArray$1(children.children)) {
  42097. let extractedChildren = extractChildren(children.children);
  42098. if (spacer) {
  42099. const len = extractedChildren.length - 1;
  42100. extractedChildren = extractedChildren.reduce((acc, child, idx) => {
  42101. const children2 = [...acc, child];
  42102. if (idx !== len) {
  42103. children2.push(createVNode("span", {
  42104. style: [
  42105. itemStyle.value,
  42106. direction === "vertical" ? "width: 100%" : null
  42107. ],
  42108. key: idx
  42109. }, [
  42110. isVNode(spacer) ? spacer : createTextVNode(spacer, PatchFlags.TEXT)
  42111. ], PatchFlags.STYLE));
  42112. }
  42113. return children2;
  42114. }, []);
  42115. }
  42116. return createVNode("div", {
  42117. class: classes.value,
  42118. style: containerStyle.value
  42119. }, extractedChildren, PatchFlags.STYLE | PatchFlags.CLASS);
  42120. }
  42121. return children.children;
  42122. };
  42123. }
  42124. });
  42125. const ElSpace = withInstall(Space);
  42126. const statisticProps = buildProps({
  42127. decimalSeparator: {
  42128. type: String,
  42129. default: "."
  42130. },
  42131. groupSeparator: {
  42132. type: String,
  42133. default: ","
  42134. },
  42135. precision: {
  42136. type: Number,
  42137. default: 0
  42138. },
  42139. formatter: Function,
  42140. value: {
  42141. type: definePropType([Number, Object]),
  42142. default: 0
  42143. },
  42144. prefix: String,
  42145. suffix: String,
  42146. title: String,
  42147. valueStyle: {
  42148. type: definePropType([String, Object, Array])
  42149. }
  42150. });
  42151. const __default__$A = defineComponent({
  42152. name: "ElStatistic"
  42153. });
  42154. const _sfc_main$H = /* @__PURE__ */ defineComponent({
  42155. ...__default__$A,
  42156. props: statisticProps,
  42157. setup(__props, { expose }) {
  42158. const props = __props;
  42159. const ns = useNamespace("statistic");
  42160. const displayValue = computed(() => {
  42161. const { value, formatter, precision, decimalSeparator, groupSeparator } = props;
  42162. if (isFunction$1(formatter))
  42163. return formatter(value);
  42164. if (!isNumber(value) || Number.isNaN(value))
  42165. return value;
  42166. let [integer, decimal = ""] = String(value).split(".");
  42167. decimal = decimal.padEnd(precision, "0").slice(0, precision > 0 ? precision : 0);
  42168. integer = integer.replace(/\B(?=(\d{3})+(?!\d))/g, groupSeparator);
  42169. return [integer, decimal].join(decimal ? decimalSeparator : "");
  42170. });
  42171. expose({
  42172. displayValue
  42173. });
  42174. return (_ctx, _cache) => {
  42175. return openBlock(), createElementBlock("div", {
  42176. class: normalizeClass(unref(ns).b())
  42177. }, [
  42178. _ctx.$slots.title || _ctx.title ? (openBlock(), createElementBlock("div", {
  42179. key: 0,
  42180. class: normalizeClass(unref(ns).e("head"))
  42181. }, [
  42182. renderSlot(_ctx.$slots, "title", {}, () => [
  42183. createTextVNode(toDisplayString(_ctx.title), 1)
  42184. ])
  42185. ], 2)) : createCommentVNode("v-if", true),
  42186. createElementVNode("div", {
  42187. class: normalizeClass(unref(ns).e("content"))
  42188. }, [
  42189. _ctx.$slots.prefix || _ctx.prefix ? (openBlock(), createElementBlock("div", {
  42190. key: 0,
  42191. class: normalizeClass(unref(ns).e("prefix"))
  42192. }, [
  42193. renderSlot(_ctx.$slots, "prefix", {}, () => [
  42194. createElementVNode("span", null, toDisplayString(_ctx.prefix), 1)
  42195. ])
  42196. ], 2)) : createCommentVNode("v-if", true),
  42197. createElementVNode("span", {
  42198. class: normalizeClass(unref(ns).e("number")),
  42199. style: normalizeStyle(_ctx.valueStyle)
  42200. }, toDisplayString(unref(displayValue)), 7),
  42201. _ctx.$slots.suffix || _ctx.suffix ? (openBlock(), createElementBlock("div", {
  42202. key: 1,
  42203. class: normalizeClass(unref(ns).e("suffix"))
  42204. }, [
  42205. renderSlot(_ctx.$slots, "suffix", {}, () => [
  42206. createElementVNode("span", null, toDisplayString(_ctx.suffix), 1)
  42207. ])
  42208. ], 2)) : createCommentVNode("v-if", true)
  42209. ], 2)
  42210. ], 2);
  42211. };
  42212. }
  42213. });
  42214. var Statistic = /* @__PURE__ */ _export_sfc(_sfc_main$H, [["__file", "statistic.vue"]]);
  42215. const ElStatistic = withInstall(Statistic);
  42216. const countdownProps = buildProps({
  42217. format: {
  42218. type: String,
  42219. default: "HH:mm:ss"
  42220. },
  42221. prefix: String,
  42222. suffix: String,
  42223. title: String,
  42224. value: {
  42225. type: definePropType([Number, Object]),
  42226. default: 0
  42227. },
  42228. valueStyle: {
  42229. type: definePropType([String, Object, Array])
  42230. }
  42231. });
  42232. const countdownEmits = {
  42233. finish: () => true,
  42234. [CHANGE_EVENT]: (value) => isNumber(value)
  42235. };
  42236. const timeUnits = [
  42237. ["Y", 1e3 * 60 * 60 * 24 * 365],
  42238. ["M", 1e3 * 60 * 60 * 24 * 30],
  42239. ["D", 1e3 * 60 * 60 * 24],
  42240. ["H", 1e3 * 60 * 60],
  42241. ["m", 1e3 * 60],
  42242. ["s", 1e3],
  42243. ["S", 1]
  42244. ];
  42245. const getTime = (value) => {
  42246. return isNumber(value) ? new Date(value).getTime() : value.valueOf();
  42247. };
  42248. const formatTime$1 = (timestamp, format) => {
  42249. let timeLeft = timestamp;
  42250. const escapeRegex = /\[([^\]]*)]/g;
  42251. const replacedText = timeUnits.reduce((current, [name, unit]) => {
  42252. const replaceRegex = new RegExp(`${name}+(?![^\\[\\]]*\\])`, "g");
  42253. if (replaceRegex.test(current)) {
  42254. const value = Math.floor(timeLeft / unit);
  42255. timeLeft -= value * unit;
  42256. return current.replace(replaceRegex, (match) => String(value).padStart(match.length, "0"));
  42257. }
  42258. return current;
  42259. }, format);
  42260. return replacedText.replace(escapeRegex, "$1");
  42261. };
  42262. const __default__$z = defineComponent({
  42263. name: "ElCountdown"
  42264. });
  42265. const _sfc_main$G = /* @__PURE__ */ defineComponent({
  42266. ...__default__$z,
  42267. props: countdownProps,
  42268. emits: countdownEmits,
  42269. setup(__props, { expose, emit }) {
  42270. const props = __props;
  42271. let timer;
  42272. const rawValue = ref(0);
  42273. const displayValue = computed(() => formatTime$1(rawValue.value, props.format));
  42274. const formatter = (val) => formatTime$1(val, props.format);
  42275. const stopTimer = () => {
  42276. if (timer) {
  42277. cAF(timer);
  42278. timer = void 0;
  42279. }
  42280. };
  42281. const startTimer = () => {
  42282. const timestamp = getTime(props.value);
  42283. const frameFunc = () => {
  42284. let diff = timestamp - Date.now();
  42285. emit(CHANGE_EVENT, diff);
  42286. if (diff <= 0) {
  42287. diff = 0;
  42288. stopTimer();
  42289. emit("finish");
  42290. } else {
  42291. timer = rAF(frameFunc);
  42292. }
  42293. rawValue.value = diff;
  42294. };
  42295. timer = rAF(frameFunc);
  42296. };
  42297. onMounted(() => {
  42298. rawValue.value = getTime(props.value) - Date.now();
  42299. watch(() => [props.value, props.format], () => {
  42300. stopTimer();
  42301. startTimer();
  42302. }, {
  42303. immediate: true
  42304. });
  42305. });
  42306. onBeforeUnmount(() => {
  42307. stopTimer();
  42308. });
  42309. expose({
  42310. displayValue
  42311. });
  42312. return (_ctx, _cache) => {
  42313. return openBlock(), createBlock(unref(ElStatistic), {
  42314. value: rawValue.value,
  42315. title: _ctx.title,
  42316. prefix: _ctx.prefix,
  42317. suffix: _ctx.suffix,
  42318. "value-style": _ctx.valueStyle,
  42319. formatter
  42320. }, createSlots({
  42321. _: 2
  42322. }, [
  42323. renderList(_ctx.$slots, (_, name) => {
  42324. return {
  42325. name,
  42326. fn: withCtx(() => [
  42327. renderSlot(_ctx.$slots, name)
  42328. ])
  42329. };
  42330. })
  42331. ]), 1032, ["value", "title", "prefix", "suffix", "value-style"]);
  42332. };
  42333. }
  42334. });
  42335. var Countdown = /* @__PURE__ */ _export_sfc(_sfc_main$G, [["__file", "countdown.vue"]]);
  42336. const ElCountdown = withInstall(Countdown);
  42337. const stepsProps = buildProps({
  42338. space: {
  42339. type: [Number, String],
  42340. default: ""
  42341. },
  42342. active: {
  42343. type: Number,
  42344. default: 0
  42345. },
  42346. direction: {
  42347. type: String,
  42348. default: "horizontal",
  42349. values: ["horizontal", "vertical"]
  42350. },
  42351. alignCenter: {
  42352. type: Boolean
  42353. },
  42354. simple: {
  42355. type: Boolean
  42356. },
  42357. finishStatus: {
  42358. type: String,
  42359. values: ["wait", "process", "finish", "error", "success"],
  42360. default: "finish"
  42361. },
  42362. processStatus: {
  42363. type: String,
  42364. values: ["wait", "process", "finish", "error", "success"],
  42365. default: "process"
  42366. }
  42367. });
  42368. const stepsEmits = {
  42369. [CHANGE_EVENT]: (newVal, oldVal) => [newVal, oldVal].every(isNumber)
  42370. };
  42371. const __default__$y = defineComponent({
  42372. name: "ElSteps"
  42373. });
  42374. const _sfc_main$F = /* @__PURE__ */ defineComponent({
  42375. ...__default__$y,
  42376. props: stepsProps,
  42377. emits: stepsEmits,
  42378. setup(__props, { emit }) {
  42379. const props = __props;
  42380. const ns = useNamespace("steps");
  42381. const {
  42382. children: steps,
  42383. addChild: addStep,
  42384. removeChild: removeStep
  42385. } = useOrderedChildren(getCurrentInstance(), "ElStep");
  42386. watch(steps, () => {
  42387. steps.value.forEach((instance, index) => {
  42388. instance.setIndex(index);
  42389. });
  42390. });
  42391. provide("ElSteps", { props, steps, addStep, removeStep });
  42392. watch(() => props.active, (newVal, oldVal) => {
  42393. emit(CHANGE_EVENT, newVal, oldVal);
  42394. });
  42395. return (_ctx, _cache) => {
  42396. return openBlock(), createElementBlock("div", {
  42397. class: normalizeClass([unref(ns).b(), unref(ns).m(_ctx.simple ? "simple" : _ctx.direction)])
  42398. }, [
  42399. renderSlot(_ctx.$slots, "default")
  42400. ], 2);
  42401. };
  42402. }
  42403. });
  42404. var Steps = /* @__PURE__ */ _export_sfc(_sfc_main$F, [["__file", "steps.vue"]]);
  42405. const stepProps = buildProps({
  42406. title: {
  42407. type: String,
  42408. default: ""
  42409. },
  42410. icon: {
  42411. type: iconPropType
  42412. },
  42413. description: {
  42414. type: String,
  42415. default: ""
  42416. },
  42417. status: {
  42418. type: String,
  42419. values: ["", "wait", "process", "finish", "error", "success"],
  42420. default: ""
  42421. }
  42422. });
  42423. const __default__$x = defineComponent({
  42424. name: "ElStep"
  42425. });
  42426. const _sfc_main$E = defineComponent({
  42427. ...__default__$x,
  42428. props: stepProps,
  42429. setup(__props) {
  42430. const props = __props;
  42431. const ns = useNamespace("step");
  42432. const index = ref(-1);
  42433. const lineStyle = ref({});
  42434. const internalStatus = ref("");
  42435. const parent = inject("ElSteps");
  42436. const currentInstance = getCurrentInstance();
  42437. onMounted(() => {
  42438. watch([
  42439. () => parent.props.active,
  42440. () => parent.props.processStatus,
  42441. () => parent.props.finishStatus
  42442. ], ([active]) => {
  42443. updateStatus(active);
  42444. }, { immediate: true });
  42445. });
  42446. onBeforeUnmount(() => {
  42447. parent.removeStep(stepItemState.uid);
  42448. });
  42449. const currentStatus = computed(() => {
  42450. return props.status || internalStatus.value;
  42451. });
  42452. const prevStatus = computed(() => {
  42453. const prevStep = parent.steps.value[index.value - 1];
  42454. return prevStep ? prevStep.currentStatus : "wait";
  42455. });
  42456. const isCenter = computed(() => {
  42457. return parent.props.alignCenter;
  42458. });
  42459. const isVertical = computed(() => {
  42460. return parent.props.direction === "vertical";
  42461. });
  42462. const isSimple = computed(() => {
  42463. return parent.props.simple;
  42464. });
  42465. const stepsCount = computed(() => {
  42466. return parent.steps.value.length;
  42467. });
  42468. const isLast = computed(() => {
  42469. var _a;
  42470. return ((_a = parent.steps.value[stepsCount.value - 1]) == null ? void 0 : _a.uid) === (currentInstance == null ? void 0 : currentInstance.uid);
  42471. });
  42472. const space = computed(() => {
  42473. return isSimple.value ? "" : parent.props.space;
  42474. });
  42475. const containerKls = computed(() => {
  42476. return [
  42477. ns.b(),
  42478. ns.is(isSimple.value ? "simple" : parent.props.direction),
  42479. ns.is("flex", isLast.value && !space.value && !isCenter.value),
  42480. ns.is("center", isCenter.value && !isVertical.value && !isSimple.value)
  42481. ];
  42482. });
  42483. const style = computed(() => {
  42484. const style2 = {
  42485. flexBasis: isNumber(space.value) ? `${space.value}px` : space.value ? space.value : `${100 / (stepsCount.value - (isCenter.value ? 0 : 1))}%`
  42486. };
  42487. if (isVertical.value)
  42488. return style2;
  42489. if (isLast.value) {
  42490. style2.maxWidth = `${100 / stepsCount.value}%`;
  42491. }
  42492. return style2;
  42493. });
  42494. const setIndex = (val) => {
  42495. index.value = val;
  42496. };
  42497. const calcProgress = (status) => {
  42498. const isWait = status === "wait";
  42499. const style2 = {
  42500. transitionDelay: `${isWait ? "-" : ""}${150 * index.value}ms`
  42501. };
  42502. const step = status === parent.props.processStatus || isWait ? 0 : 100;
  42503. style2.borderWidth = step && !isSimple.value ? "1px" : 0;
  42504. style2[parent.props.direction === "vertical" ? "height" : "width"] = `${step}%`;
  42505. lineStyle.value = style2;
  42506. };
  42507. const updateStatus = (activeIndex) => {
  42508. if (activeIndex > index.value) {
  42509. internalStatus.value = parent.props.finishStatus;
  42510. } else if (activeIndex === index.value && prevStatus.value !== "error") {
  42511. internalStatus.value = parent.props.processStatus;
  42512. } else {
  42513. internalStatus.value = "wait";
  42514. }
  42515. const prevChild = parent.steps.value[index.value - 1];
  42516. if (prevChild)
  42517. prevChild.calcProgress(internalStatus.value);
  42518. };
  42519. const stepItemState = reactive({
  42520. uid: currentInstance.uid,
  42521. currentStatus,
  42522. setIndex,
  42523. calcProgress
  42524. });
  42525. parent.addStep(stepItemState);
  42526. return (_ctx, _cache) => {
  42527. return openBlock(), createElementBlock("div", {
  42528. style: normalizeStyle(unref(style)),
  42529. class: normalizeClass(unref(containerKls))
  42530. }, [
  42531. createCommentVNode(" icon & line "),
  42532. createElementVNode("div", {
  42533. class: normalizeClass([unref(ns).e("head"), unref(ns).is(unref(currentStatus))])
  42534. }, [
  42535. !unref(isSimple) ? (openBlock(), createElementBlock("div", {
  42536. key: 0,
  42537. class: normalizeClass(unref(ns).e("line"))
  42538. }, [
  42539. createElementVNode("i", {
  42540. class: normalizeClass(unref(ns).e("line-inner")),
  42541. style: normalizeStyle(lineStyle.value)
  42542. }, null, 6)
  42543. ], 2)) : createCommentVNode("v-if", true),
  42544. createElementVNode("div", {
  42545. class: normalizeClass([unref(ns).e("icon"), unref(ns).is(_ctx.icon || _ctx.$slots.icon ? "icon" : "text")])
  42546. }, [
  42547. renderSlot(_ctx.$slots, "icon", {}, () => [
  42548. _ctx.icon ? (openBlock(), createBlock(unref(ElIcon), {
  42549. key: 0,
  42550. class: normalizeClass(unref(ns).e("icon-inner"))
  42551. }, {
  42552. default: withCtx(() => [
  42553. (openBlock(), createBlock(resolveDynamicComponent(_ctx.icon)))
  42554. ]),
  42555. _: 1
  42556. }, 8, ["class"])) : unref(currentStatus) === "success" ? (openBlock(), createBlock(unref(ElIcon), {
  42557. key: 1,
  42558. class: normalizeClass([unref(ns).e("icon-inner"), unref(ns).is("status")])
  42559. }, {
  42560. default: withCtx(() => [
  42561. createVNode(unref(check_default))
  42562. ]),
  42563. _: 1
  42564. }, 8, ["class"])) : unref(currentStatus) === "error" ? (openBlock(), createBlock(unref(ElIcon), {
  42565. key: 2,
  42566. class: normalizeClass([unref(ns).e("icon-inner"), unref(ns).is("status")])
  42567. }, {
  42568. default: withCtx(() => [
  42569. createVNode(unref(close_default))
  42570. ]),
  42571. _: 1
  42572. }, 8, ["class"])) : !unref(isSimple) ? (openBlock(), createElementBlock("div", {
  42573. key: 3,
  42574. class: normalizeClass(unref(ns).e("icon-inner"))
  42575. }, toDisplayString(index.value + 1), 3)) : createCommentVNode("v-if", true)
  42576. ])
  42577. ], 2)
  42578. ], 2),
  42579. createCommentVNode(" title & description "),
  42580. createElementVNode("div", {
  42581. class: normalizeClass(unref(ns).e("main"))
  42582. }, [
  42583. createElementVNode("div", {
  42584. class: normalizeClass([unref(ns).e("title"), unref(ns).is(unref(currentStatus))])
  42585. }, [
  42586. renderSlot(_ctx.$slots, "title", {}, () => [
  42587. createTextVNode(toDisplayString(_ctx.title), 1)
  42588. ])
  42589. ], 2),
  42590. unref(isSimple) ? (openBlock(), createElementBlock("div", {
  42591. key: 0,
  42592. class: normalizeClass(unref(ns).e("arrow"))
  42593. }, null, 2)) : (openBlock(), createElementBlock("div", {
  42594. key: 1,
  42595. class: normalizeClass([unref(ns).e("description"), unref(ns).is(unref(currentStatus))])
  42596. }, [
  42597. renderSlot(_ctx.$slots, "description", {}, () => [
  42598. createTextVNode(toDisplayString(_ctx.description), 1)
  42599. ])
  42600. ], 2))
  42601. ], 2)
  42602. ], 6);
  42603. };
  42604. }
  42605. });
  42606. var Step = /* @__PURE__ */ _export_sfc(_sfc_main$E, [["__file", "item.vue"]]);
  42607. const ElSteps = withInstall(Steps, {
  42608. Step
  42609. });
  42610. const ElStep = withNoopInstall(Step);
  42611. const switchProps = buildProps({
  42612. modelValue: {
  42613. type: [Boolean, String, Number],
  42614. default: false
  42615. },
  42616. disabled: Boolean,
  42617. loading: Boolean,
  42618. size: {
  42619. type: String,
  42620. validator: isValidComponentSize
  42621. },
  42622. width: {
  42623. type: [String, Number],
  42624. default: ""
  42625. },
  42626. inlinePrompt: Boolean,
  42627. inactiveActionIcon: {
  42628. type: iconPropType
  42629. },
  42630. activeActionIcon: {
  42631. type: iconPropType
  42632. },
  42633. activeIcon: {
  42634. type: iconPropType
  42635. },
  42636. inactiveIcon: {
  42637. type: iconPropType
  42638. },
  42639. activeText: {
  42640. type: String,
  42641. default: ""
  42642. },
  42643. inactiveText: {
  42644. type: String,
  42645. default: ""
  42646. },
  42647. activeValue: {
  42648. type: [Boolean, String, Number],
  42649. default: true
  42650. },
  42651. inactiveValue: {
  42652. type: [Boolean, String, Number],
  42653. default: false
  42654. },
  42655. name: {
  42656. type: String,
  42657. default: ""
  42658. },
  42659. validateEvent: {
  42660. type: Boolean,
  42661. default: true
  42662. },
  42663. beforeChange: {
  42664. type: definePropType(Function)
  42665. },
  42666. id: String,
  42667. tabindex: {
  42668. type: [String, Number]
  42669. },
  42670. ...useAriaProps(["ariaLabel"])
  42671. });
  42672. const switchEmits = {
  42673. [UPDATE_MODEL_EVENT]: (val) => isBoolean(val) || isString$1(val) || isNumber(val),
  42674. [CHANGE_EVENT]: (val) => isBoolean(val) || isString$1(val) || isNumber(val),
  42675. [INPUT_EVENT]: (val) => isBoolean(val) || isString$1(val) || isNumber(val)
  42676. };
  42677. const COMPONENT_NAME$8 = "ElSwitch";
  42678. const __default__$w = defineComponent({
  42679. name: COMPONENT_NAME$8
  42680. });
  42681. const _sfc_main$D = /* @__PURE__ */ defineComponent({
  42682. ...__default__$w,
  42683. props: switchProps,
  42684. emits: switchEmits,
  42685. setup(__props, { expose, emit }) {
  42686. const props = __props;
  42687. const { formItem } = useFormItem();
  42688. const switchSize = useFormSize();
  42689. const ns = useNamespace("switch");
  42690. const { inputId } = useFormItemInputId(props, {
  42691. formItemContext: formItem
  42692. });
  42693. const switchDisabled = useFormDisabled(computed(() => props.loading));
  42694. const isControlled = ref(props.modelValue !== false);
  42695. const input = ref();
  42696. const core = ref();
  42697. const switchKls = computed(() => [
  42698. ns.b(),
  42699. ns.m(switchSize.value),
  42700. ns.is("disabled", switchDisabled.value),
  42701. ns.is("checked", checked.value)
  42702. ]);
  42703. const labelLeftKls = computed(() => [
  42704. ns.e("label"),
  42705. ns.em("label", "left"),
  42706. ns.is("active", !checked.value)
  42707. ]);
  42708. const labelRightKls = computed(() => [
  42709. ns.e("label"),
  42710. ns.em("label", "right"),
  42711. ns.is("active", checked.value)
  42712. ]);
  42713. const coreStyle = computed(() => ({
  42714. width: addUnit(props.width)
  42715. }));
  42716. watch(() => props.modelValue, () => {
  42717. isControlled.value = true;
  42718. });
  42719. const actualValue = computed(() => {
  42720. return isControlled.value ? props.modelValue : false;
  42721. });
  42722. const checked = computed(() => actualValue.value === props.activeValue);
  42723. if (![props.activeValue, props.inactiveValue].includes(actualValue.value)) {
  42724. emit(UPDATE_MODEL_EVENT, props.inactiveValue);
  42725. emit(CHANGE_EVENT, props.inactiveValue);
  42726. emit(INPUT_EVENT, props.inactiveValue);
  42727. }
  42728. watch(checked, (val) => {
  42729. var _a;
  42730. input.value.checked = val;
  42731. if (props.validateEvent) {
  42732. (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "change").catch((err) => debugWarn());
  42733. }
  42734. });
  42735. const handleChange = () => {
  42736. const val = checked.value ? props.inactiveValue : props.activeValue;
  42737. emit(UPDATE_MODEL_EVENT, val);
  42738. emit(CHANGE_EVENT, val);
  42739. emit(INPUT_EVENT, val);
  42740. nextTick(() => {
  42741. input.value.checked = checked.value;
  42742. });
  42743. };
  42744. const switchValue = () => {
  42745. if (switchDisabled.value)
  42746. return;
  42747. const { beforeChange } = props;
  42748. if (!beforeChange) {
  42749. handleChange();
  42750. return;
  42751. }
  42752. const shouldChange = beforeChange();
  42753. const isPromiseOrBool = [
  42754. isPromise(shouldChange),
  42755. isBoolean(shouldChange)
  42756. ].includes(true);
  42757. if (!isPromiseOrBool) {
  42758. throwError(COMPONENT_NAME$8, "beforeChange must return type `Promise<boolean>` or `boolean`");
  42759. }
  42760. if (isPromise(shouldChange)) {
  42761. shouldChange.then((result) => {
  42762. if (result) {
  42763. handleChange();
  42764. }
  42765. }).catch((e) => {
  42766. });
  42767. } else if (shouldChange) {
  42768. handleChange();
  42769. }
  42770. };
  42771. const focus = () => {
  42772. var _a, _b;
  42773. (_b = (_a = input.value) == null ? void 0 : _a.focus) == null ? void 0 : _b.call(_a);
  42774. };
  42775. onMounted(() => {
  42776. input.value.checked = checked.value;
  42777. });
  42778. expose({
  42779. focus,
  42780. checked
  42781. });
  42782. return (_ctx, _cache) => {
  42783. return openBlock(), createElementBlock("div", {
  42784. class: normalizeClass(unref(switchKls)),
  42785. onClick: withModifiers(switchValue, ["prevent"])
  42786. }, [
  42787. createElementVNode("input", {
  42788. id: unref(inputId),
  42789. ref_key: "input",
  42790. ref: input,
  42791. class: normalizeClass(unref(ns).e("input")),
  42792. type: "checkbox",
  42793. role: "switch",
  42794. "aria-checked": unref(checked),
  42795. "aria-disabled": unref(switchDisabled),
  42796. "aria-label": _ctx.ariaLabel,
  42797. name: _ctx.name,
  42798. "true-value": _ctx.activeValue,
  42799. "false-value": _ctx.inactiveValue,
  42800. disabled: unref(switchDisabled),
  42801. tabindex: _ctx.tabindex,
  42802. onChange: handleChange,
  42803. onKeydown: withKeys(switchValue, ["enter"])
  42804. }, null, 42, ["id", "aria-checked", "aria-disabled", "aria-label", "name", "true-value", "false-value", "disabled", "tabindex", "onKeydown"]),
  42805. !_ctx.inlinePrompt && (_ctx.inactiveIcon || _ctx.inactiveText) ? (openBlock(), createElementBlock("span", {
  42806. key: 0,
  42807. class: normalizeClass(unref(labelLeftKls))
  42808. }, [
  42809. _ctx.inactiveIcon ? (openBlock(), createBlock(unref(ElIcon), { key: 0 }, {
  42810. default: withCtx(() => [
  42811. (openBlock(), createBlock(resolveDynamicComponent(_ctx.inactiveIcon)))
  42812. ]),
  42813. _: 1
  42814. })) : createCommentVNode("v-if", true),
  42815. !_ctx.inactiveIcon && _ctx.inactiveText ? (openBlock(), createElementBlock("span", {
  42816. key: 1,
  42817. "aria-hidden": unref(checked)
  42818. }, toDisplayString(_ctx.inactiveText), 9, ["aria-hidden"])) : createCommentVNode("v-if", true)
  42819. ], 2)) : createCommentVNode("v-if", true),
  42820. createElementVNode("span", {
  42821. ref_key: "core",
  42822. ref: core,
  42823. class: normalizeClass(unref(ns).e("core")),
  42824. style: normalizeStyle(unref(coreStyle))
  42825. }, [
  42826. _ctx.inlinePrompt ? (openBlock(), createElementBlock("div", {
  42827. key: 0,
  42828. class: normalizeClass(unref(ns).e("inner"))
  42829. }, [
  42830. _ctx.activeIcon || _ctx.inactiveIcon ? (openBlock(), createBlock(unref(ElIcon), {
  42831. key: 0,
  42832. class: normalizeClass(unref(ns).is("icon"))
  42833. }, {
  42834. default: withCtx(() => [
  42835. (openBlock(), createBlock(resolveDynamicComponent(unref(checked) ? _ctx.activeIcon : _ctx.inactiveIcon)))
  42836. ]),
  42837. _: 1
  42838. }, 8, ["class"])) : _ctx.activeText || _ctx.inactiveText ? (openBlock(), createElementBlock("span", {
  42839. key: 1,
  42840. class: normalizeClass(unref(ns).is("text")),
  42841. "aria-hidden": !unref(checked)
  42842. }, toDisplayString(unref(checked) ? _ctx.activeText : _ctx.inactiveText), 11, ["aria-hidden"])) : createCommentVNode("v-if", true)
  42843. ], 2)) : createCommentVNode("v-if", true),
  42844. createElementVNode("div", {
  42845. class: normalizeClass(unref(ns).e("action"))
  42846. }, [
  42847. _ctx.loading ? (openBlock(), createBlock(unref(ElIcon), {
  42848. key: 0,
  42849. class: normalizeClass(unref(ns).is("loading"))
  42850. }, {
  42851. default: withCtx(() => [
  42852. createVNode(unref(loading_default))
  42853. ]),
  42854. _: 1
  42855. }, 8, ["class"])) : unref(checked) ? renderSlot(_ctx.$slots, "active-action", { key: 1 }, () => [
  42856. _ctx.activeActionIcon ? (openBlock(), createBlock(unref(ElIcon), { key: 0 }, {
  42857. default: withCtx(() => [
  42858. (openBlock(), createBlock(resolveDynamicComponent(_ctx.activeActionIcon)))
  42859. ]),
  42860. _: 1
  42861. })) : createCommentVNode("v-if", true)
  42862. ]) : !unref(checked) ? renderSlot(_ctx.$slots, "inactive-action", { key: 2 }, () => [
  42863. _ctx.inactiveActionIcon ? (openBlock(), createBlock(unref(ElIcon), { key: 0 }, {
  42864. default: withCtx(() => [
  42865. (openBlock(), createBlock(resolveDynamicComponent(_ctx.inactiveActionIcon)))
  42866. ]),
  42867. _: 1
  42868. })) : createCommentVNode("v-if", true)
  42869. ]) : createCommentVNode("v-if", true)
  42870. ], 2)
  42871. ], 6),
  42872. !_ctx.inlinePrompt && (_ctx.activeIcon || _ctx.activeText) ? (openBlock(), createElementBlock("span", {
  42873. key: 1,
  42874. class: normalizeClass(unref(labelRightKls))
  42875. }, [
  42876. _ctx.activeIcon ? (openBlock(), createBlock(unref(ElIcon), { key: 0 }, {
  42877. default: withCtx(() => [
  42878. (openBlock(), createBlock(resolveDynamicComponent(_ctx.activeIcon)))
  42879. ]),
  42880. _: 1
  42881. })) : createCommentVNode("v-if", true),
  42882. !_ctx.activeIcon && _ctx.activeText ? (openBlock(), createElementBlock("span", {
  42883. key: 1,
  42884. "aria-hidden": !unref(checked)
  42885. }, toDisplayString(_ctx.activeText), 9, ["aria-hidden"])) : createCommentVNode("v-if", true)
  42886. ], 2)) : createCommentVNode("v-if", true)
  42887. ], 10, ["onClick"]);
  42888. };
  42889. }
  42890. });
  42891. var Switch = /* @__PURE__ */ _export_sfc(_sfc_main$D, [["__file", "switch.vue"]]);
  42892. const ElSwitch = withInstall(Switch);
  42893. const getCell = function(event) {
  42894. var _a;
  42895. return (_a = event.target) == null ? void 0 : _a.closest("td");
  42896. };
  42897. const orderBy = function(array, sortKey, reverse, sortMethod, sortBy) {
  42898. if (!sortKey && !sortMethod && (!sortBy || isArray$1(sortBy) && !sortBy.length)) {
  42899. return array;
  42900. }
  42901. if (isString$1(reverse)) {
  42902. reverse = reverse === "descending" ? -1 : 1;
  42903. } else {
  42904. reverse = reverse && reverse < 0 ? -1 : 1;
  42905. }
  42906. const getKey = sortMethod ? null : function(value, index) {
  42907. if (sortBy) {
  42908. if (!isArray$1(sortBy)) {
  42909. sortBy = [sortBy];
  42910. }
  42911. return sortBy.map((by) => {
  42912. if (isString$1(by)) {
  42913. return get(value, by);
  42914. } else {
  42915. return by(value, index, array);
  42916. }
  42917. });
  42918. }
  42919. if (sortKey !== "$key") {
  42920. if (isObject$1(value) && "$value" in value)
  42921. value = value.$value;
  42922. }
  42923. return [isObject$1(value) ? get(value, sortKey) : value];
  42924. };
  42925. const compare = function(a, b) {
  42926. if (sortMethod) {
  42927. return sortMethod(a.value, b.value);
  42928. }
  42929. for (let i = 0, len = a.key.length; i < len; i++) {
  42930. if (a.key[i] < b.key[i]) {
  42931. return -1;
  42932. }
  42933. if (a.key[i] > b.key[i]) {
  42934. return 1;
  42935. }
  42936. }
  42937. return 0;
  42938. };
  42939. return array.map((value, index) => {
  42940. return {
  42941. value,
  42942. index,
  42943. key: getKey ? getKey(value, index) : null
  42944. };
  42945. }).sort((a, b) => {
  42946. let order = compare(a, b);
  42947. if (!order) {
  42948. order = a.index - b.index;
  42949. }
  42950. return order * +reverse;
  42951. }).map((item) => item.value);
  42952. };
  42953. const getColumnById = function(table, columnId) {
  42954. let column = null;
  42955. table.columns.forEach((item) => {
  42956. if (item.id === columnId) {
  42957. column = item;
  42958. }
  42959. });
  42960. return column;
  42961. };
  42962. const getColumnByKey = function(table, columnKey) {
  42963. let column = null;
  42964. for (let i = 0; i < table.columns.length; i++) {
  42965. const item = table.columns[i];
  42966. if (item.columnKey === columnKey) {
  42967. column = item;
  42968. break;
  42969. }
  42970. }
  42971. if (!column)
  42972. throwError("ElTable", `No column matching with column-key: ${columnKey}`);
  42973. return column;
  42974. };
  42975. const getColumnByCell = function(table, cell, namespace) {
  42976. const matches = (cell.className || "").match(new RegExp(`${namespace}-table_[^\\s]+`, "gm"));
  42977. if (matches) {
  42978. return getColumnById(table, matches[0]);
  42979. }
  42980. return null;
  42981. };
  42982. const getRowIdentity = (row, rowKey) => {
  42983. if (!row)
  42984. throw new Error("Row is required when get row identity");
  42985. if (isString$1(rowKey)) {
  42986. if (!rowKey.includes(".")) {
  42987. return `${row[rowKey]}`;
  42988. }
  42989. const key = rowKey.split(".");
  42990. let current = row;
  42991. for (const element of key) {
  42992. current = current[element];
  42993. }
  42994. return `${current}`;
  42995. } else if (isFunction$1(rowKey)) {
  42996. return rowKey.call(null, row);
  42997. }
  42998. };
  42999. const getKeysMap = function(array, rowKey, flatten = false, childrenKey = "children") {
  43000. const data = array || [];
  43001. const arrayMap = {};
  43002. data.forEach((row, index) => {
  43003. arrayMap[getRowIdentity(row, rowKey)] = { row, index };
  43004. if (flatten) {
  43005. const children = row[childrenKey];
  43006. if (isArray$1(children)) {
  43007. Object.assign(arrayMap, getKeysMap(children, rowKey, true, childrenKey));
  43008. }
  43009. }
  43010. });
  43011. return arrayMap;
  43012. };
  43013. function mergeOptions(defaults, config) {
  43014. const options = {};
  43015. let key;
  43016. for (key in defaults) {
  43017. options[key] = defaults[key];
  43018. }
  43019. for (key in config) {
  43020. if (hasOwn(config, key)) {
  43021. const value = config[key];
  43022. if (!isUndefined(value)) {
  43023. options[key] = value;
  43024. }
  43025. }
  43026. }
  43027. return options;
  43028. }
  43029. function parseWidth(width) {
  43030. if (width === "")
  43031. return width;
  43032. if (!isUndefined(width)) {
  43033. width = Number.parseInt(width, 10);
  43034. if (Number.isNaN(width)) {
  43035. width = "";
  43036. }
  43037. }
  43038. return width;
  43039. }
  43040. function parseMinWidth(minWidth) {
  43041. if (minWidth === "")
  43042. return minWidth;
  43043. if (!isUndefined(minWidth)) {
  43044. minWidth = parseWidth(minWidth);
  43045. if (Number.isNaN(minWidth)) {
  43046. minWidth = 80;
  43047. }
  43048. }
  43049. return minWidth;
  43050. }
  43051. function parseHeight(height) {
  43052. if (isNumber(height)) {
  43053. return height;
  43054. }
  43055. if (isString$1(height)) {
  43056. if (/^\d+(?:px)?$/.test(height)) {
  43057. return Number.parseInt(height, 10);
  43058. } else {
  43059. return height;
  43060. }
  43061. }
  43062. return null;
  43063. }
  43064. function compose(...funcs) {
  43065. if (funcs.length === 0) {
  43066. return (arg) => arg;
  43067. }
  43068. if (funcs.length === 1) {
  43069. return funcs[0];
  43070. }
  43071. return funcs.reduce((a, b) => (...args) => a(b(...args)));
  43072. }
  43073. function toggleRowStatus(statusArr, row, newVal, tableTreeProps, selectable, rowIndex) {
  43074. let _rowIndex = rowIndex != null ? rowIndex : 0;
  43075. let changed = false;
  43076. const index = statusArr.indexOf(row);
  43077. const included = index !== -1;
  43078. const isRowSelectable = selectable == null ? void 0 : selectable.call(null, row, _rowIndex);
  43079. const toggleStatus = (type) => {
  43080. if (type === "add") {
  43081. statusArr.push(row);
  43082. } else {
  43083. statusArr.splice(index, 1);
  43084. }
  43085. changed = true;
  43086. };
  43087. const getChildrenCount = (row2) => {
  43088. let count = 0;
  43089. const children = (tableTreeProps == null ? void 0 : tableTreeProps.children) && row2[tableTreeProps.children];
  43090. if (children && isArray$1(children)) {
  43091. count += children.length;
  43092. children.forEach((item) => {
  43093. count += getChildrenCount(item);
  43094. });
  43095. }
  43096. return count;
  43097. };
  43098. if (!selectable || isRowSelectable) {
  43099. if (isBoolean(newVal)) {
  43100. if (newVal && !included) {
  43101. toggleStatus("add");
  43102. } else if (!newVal && included) {
  43103. toggleStatus("remove");
  43104. }
  43105. } else {
  43106. included ? toggleStatus("remove") : toggleStatus("add");
  43107. }
  43108. }
  43109. if (!(tableTreeProps == null ? void 0 : tableTreeProps.checkStrictly) && (tableTreeProps == null ? void 0 : tableTreeProps.children) && isArray$1(row[tableTreeProps.children])) {
  43110. row[tableTreeProps.children].forEach((item) => {
  43111. const childChanged = toggleRowStatus(statusArr, item, newVal != null ? newVal : !included, tableTreeProps, selectable, _rowIndex + 1);
  43112. _rowIndex += getChildrenCount(item) + 1;
  43113. if (childChanged) {
  43114. changed = childChanged;
  43115. }
  43116. });
  43117. }
  43118. return changed;
  43119. }
  43120. function walkTreeNode(root, cb, childrenKey = "children", lazyKey = "hasChildren") {
  43121. const isNil = (array) => !(isArray$1(array) && array.length);
  43122. function _walker(parent, children, level) {
  43123. cb(parent, children, level);
  43124. children.forEach((item) => {
  43125. if (item[lazyKey]) {
  43126. cb(item, null, level + 1);
  43127. return;
  43128. }
  43129. const children2 = item[childrenKey];
  43130. if (!isNil(children2)) {
  43131. _walker(item, children2, level + 1);
  43132. }
  43133. });
  43134. }
  43135. root.forEach((item) => {
  43136. if (item[lazyKey]) {
  43137. cb(item, null, 0);
  43138. return;
  43139. }
  43140. const children = item[childrenKey];
  43141. if (!isNil(children)) {
  43142. _walker(item, children, 0);
  43143. }
  43144. });
  43145. }
  43146. const getTableOverflowTooltipProps = (props, innerText, row, column) => {
  43147. const popperOptions = {
  43148. strategy: "fixed",
  43149. ...props.popperOptions
  43150. };
  43151. const tooltipFormatterContent = isFunction$1(column.tooltipFormatter) ? column.tooltipFormatter({
  43152. row,
  43153. column,
  43154. cellValue: getProp(row, column.property).value
  43155. }) : void 0;
  43156. if (isVNode(tooltipFormatterContent)) {
  43157. return {
  43158. slotContent: tooltipFormatterContent,
  43159. content: null,
  43160. ...props,
  43161. popperOptions
  43162. };
  43163. }
  43164. return {
  43165. slotContent: null,
  43166. content: tooltipFormatterContent != null ? tooltipFormatterContent : innerText,
  43167. ...props,
  43168. popperOptions
  43169. };
  43170. };
  43171. let removePopper = null;
  43172. function createTablePopper(props, popperContent, row, column, trigger, table) {
  43173. const tableOverflowTooltipProps = getTableOverflowTooltipProps(props, popperContent, row, column);
  43174. const mergedProps = {
  43175. ...tableOverflowTooltipProps,
  43176. slotContent: void 0
  43177. };
  43178. if ((removePopper == null ? void 0 : removePopper.trigger) === trigger) {
  43179. const comp = removePopper.vm.component;
  43180. merge(comp.props, mergedProps);
  43181. if (tableOverflowTooltipProps.slotContent) {
  43182. comp.slots.content = () => [tableOverflowTooltipProps.slotContent];
  43183. }
  43184. return;
  43185. }
  43186. removePopper == null ? void 0 : removePopper();
  43187. const parentNode = table == null ? void 0 : table.refs.tableWrapper;
  43188. const ns = parentNode == null ? void 0 : parentNode.dataset.prefix;
  43189. const vm = createVNode(ElTooltip, {
  43190. virtualTriggering: true,
  43191. virtualRef: trigger,
  43192. appendTo: parentNode,
  43193. placement: "top",
  43194. transition: "none",
  43195. offset: 0,
  43196. hideAfter: 0,
  43197. ...mergedProps
  43198. }, tableOverflowTooltipProps.slotContent ? {
  43199. content: () => tableOverflowTooltipProps.slotContent
  43200. } : void 0);
  43201. vm.appContext = { ...table.appContext, ...table };
  43202. const container = document.createElement("div");
  43203. render(vm, container);
  43204. vm.component.exposed.onOpen();
  43205. const scrollContainer = parentNode == null ? void 0 : parentNode.querySelector(`.${ns}-scrollbar__wrap`);
  43206. removePopper = () => {
  43207. render(null, container);
  43208. scrollContainer == null ? void 0 : scrollContainer.removeEventListener("scroll", removePopper);
  43209. removePopper = null;
  43210. };
  43211. removePopper.trigger = trigger;
  43212. removePopper.vm = vm;
  43213. scrollContainer == null ? void 0 : scrollContainer.addEventListener("scroll", removePopper);
  43214. }
  43215. function getCurrentColumns(column) {
  43216. if (column.children) {
  43217. return flatMap(column.children, getCurrentColumns);
  43218. } else {
  43219. return [column];
  43220. }
  43221. }
  43222. function getColSpan(colSpan, column) {
  43223. return colSpan + column.colSpan;
  43224. }
  43225. const isFixedColumn = (index, fixed, store, realColumns) => {
  43226. let start = 0;
  43227. let after = index;
  43228. const columns = store.states.columns.value;
  43229. if (realColumns) {
  43230. const curColumns = getCurrentColumns(realColumns[index]);
  43231. const preColumns = columns.slice(0, columns.indexOf(curColumns[0]));
  43232. start = preColumns.reduce(getColSpan, 0);
  43233. after = start + curColumns.reduce(getColSpan, 0) - 1;
  43234. } else {
  43235. start = index;
  43236. }
  43237. let fixedLayout;
  43238. switch (fixed) {
  43239. case "left":
  43240. if (after < store.states.fixedLeafColumnsLength.value) {
  43241. fixedLayout = "left";
  43242. }
  43243. break;
  43244. case "right":
  43245. if (start >= columns.length - store.states.rightFixedLeafColumnsLength.value) {
  43246. fixedLayout = "right";
  43247. }
  43248. break;
  43249. default:
  43250. if (after < store.states.fixedLeafColumnsLength.value) {
  43251. fixedLayout = "left";
  43252. } else if (start >= columns.length - store.states.rightFixedLeafColumnsLength.value) {
  43253. fixedLayout = "right";
  43254. }
  43255. }
  43256. return fixedLayout ? {
  43257. direction: fixedLayout,
  43258. start,
  43259. after
  43260. } : {};
  43261. };
  43262. const getFixedColumnsClass = (namespace, index, fixed, store, realColumns, offset = 0) => {
  43263. const classes = [];
  43264. const { direction, start, after } = isFixedColumn(index, fixed, store, realColumns);
  43265. if (direction) {
  43266. const isLeft = direction === "left";
  43267. classes.push(`${namespace}-fixed-column--${direction}`);
  43268. if (isLeft && after + offset === store.states.fixedLeafColumnsLength.value - 1) {
  43269. classes.push("is-last-column");
  43270. } else if (!isLeft && start - offset === store.states.columns.value.length - store.states.rightFixedLeafColumnsLength.value) {
  43271. classes.push("is-first-column");
  43272. }
  43273. }
  43274. return classes;
  43275. };
  43276. function getOffset(offset, column) {
  43277. return offset + (isNull(column.realWidth) || Number.isNaN(column.realWidth) ? Number(column.width) : column.realWidth);
  43278. }
  43279. const getFixedColumnOffset = (index, fixed, store, realColumns) => {
  43280. const {
  43281. direction,
  43282. start = 0,
  43283. after = 0
  43284. } = isFixedColumn(index, fixed, store, realColumns);
  43285. if (!direction) {
  43286. return;
  43287. }
  43288. const styles = {};
  43289. const isLeft = direction === "left";
  43290. const columns = store.states.columns.value;
  43291. if (isLeft) {
  43292. styles.left = columns.slice(0, start).reduce(getOffset, 0);
  43293. } else {
  43294. styles.right = columns.slice(after + 1).reverse().reduce(getOffset, 0);
  43295. }
  43296. return styles;
  43297. };
  43298. const ensurePosition = (style, key) => {
  43299. if (!style)
  43300. return;
  43301. if (!Number.isNaN(style[key])) {
  43302. style[key] = `${style[key]}px`;
  43303. }
  43304. };
  43305. function useExpand(watcherData) {
  43306. const instance = getCurrentInstance();
  43307. const defaultExpandAll = ref(false);
  43308. const expandRows = ref([]);
  43309. const updateExpandRows = () => {
  43310. const data = watcherData.data.value || [];
  43311. const rowKey = watcherData.rowKey.value;
  43312. if (defaultExpandAll.value) {
  43313. expandRows.value = data.slice();
  43314. } else if (rowKey) {
  43315. const expandRowsMap = getKeysMap(expandRows.value, rowKey);
  43316. expandRows.value = data.reduce((prev, row) => {
  43317. const rowId = getRowIdentity(row, rowKey);
  43318. const rowInfo = expandRowsMap[rowId];
  43319. if (rowInfo) {
  43320. prev.push(row);
  43321. }
  43322. return prev;
  43323. }, []);
  43324. } else {
  43325. expandRows.value = [];
  43326. }
  43327. };
  43328. const toggleRowExpansion = (row, expanded) => {
  43329. const changed = toggleRowStatus(expandRows.value, row, expanded);
  43330. if (changed) {
  43331. instance.emit("expand-change", row, expandRows.value.slice());
  43332. }
  43333. };
  43334. const setExpandRowKeys = (rowKeys) => {
  43335. instance.store.assertRowKey();
  43336. const data = watcherData.data.value || [];
  43337. const rowKey = watcherData.rowKey.value;
  43338. const keysMap = getKeysMap(data, rowKey);
  43339. expandRows.value = rowKeys.reduce((prev, cur) => {
  43340. const info = keysMap[cur];
  43341. if (info) {
  43342. prev.push(info.row);
  43343. }
  43344. return prev;
  43345. }, []);
  43346. };
  43347. const isRowExpanded = (row) => {
  43348. const rowKey = watcherData.rowKey.value;
  43349. if (rowKey) {
  43350. const expandMap = getKeysMap(expandRows.value, rowKey);
  43351. return !!expandMap[getRowIdentity(row, rowKey)];
  43352. }
  43353. return expandRows.value.includes(row);
  43354. };
  43355. return {
  43356. updateExpandRows,
  43357. toggleRowExpansion,
  43358. setExpandRowKeys,
  43359. isRowExpanded,
  43360. states: {
  43361. expandRows,
  43362. defaultExpandAll
  43363. }
  43364. };
  43365. }
  43366. function useCurrent(watcherData) {
  43367. const instance = getCurrentInstance();
  43368. const _currentRowKey = ref(null);
  43369. const currentRow = ref(null);
  43370. const setCurrentRowKey = (key) => {
  43371. instance.store.assertRowKey();
  43372. _currentRowKey.value = key;
  43373. setCurrentRowByKey(key);
  43374. };
  43375. const restoreCurrentRowKey = () => {
  43376. _currentRowKey.value = null;
  43377. };
  43378. const setCurrentRowByKey = (key) => {
  43379. const { data, rowKey } = watcherData;
  43380. let _currentRow = null;
  43381. if (rowKey.value) {
  43382. _currentRow = (unref(data) || []).find((item) => getRowIdentity(item, rowKey.value) === key);
  43383. }
  43384. currentRow.value = _currentRow;
  43385. instance.emit("current-change", currentRow.value, null);
  43386. };
  43387. const updateCurrentRow = (_currentRow) => {
  43388. const oldCurrentRow = currentRow.value;
  43389. if (_currentRow && _currentRow !== oldCurrentRow) {
  43390. currentRow.value = _currentRow;
  43391. instance.emit("current-change", currentRow.value, oldCurrentRow);
  43392. return;
  43393. }
  43394. if (!_currentRow && oldCurrentRow) {
  43395. currentRow.value = null;
  43396. instance.emit("current-change", null, oldCurrentRow);
  43397. }
  43398. };
  43399. const updateCurrentRowData = () => {
  43400. const rowKey = watcherData.rowKey.value;
  43401. const data = watcherData.data.value || [];
  43402. const oldCurrentRow = currentRow.value;
  43403. if (!data.includes(oldCurrentRow) && oldCurrentRow) {
  43404. if (rowKey) {
  43405. const currentRowKey = getRowIdentity(oldCurrentRow, rowKey);
  43406. setCurrentRowByKey(currentRowKey);
  43407. } else {
  43408. currentRow.value = null;
  43409. }
  43410. if (isNull(currentRow.value)) {
  43411. instance.emit("current-change", null, oldCurrentRow);
  43412. }
  43413. } else if (_currentRowKey.value) {
  43414. setCurrentRowByKey(_currentRowKey.value);
  43415. restoreCurrentRowKey();
  43416. }
  43417. };
  43418. return {
  43419. setCurrentRowKey,
  43420. restoreCurrentRowKey,
  43421. setCurrentRowByKey,
  43422. updateCurrentRow,
  43423. updateCurrentRowData,
  43424. states: {
  43425. _currentRowKey,
  43426. currentRow
  43427. }
  43428. };
  43429. }
  43430. function useTree$2(watcherData) {
  43431. const expandRowKeys = ref([]);
  43432. const treeData = ref({});
  43433. const indent = ref(16);
  43434. const lazy = ref(false);
  43435. const lazyTreeNodeMap = ref({});
  43436. const lazyColumnIdentifier = ref("hasChildren");
  43437. const childrenColumnName = ref("children");
  43438. const checkStrictly = ref(false);
  43439. const instance = getCurrentInstance();
  43440. const normalizedData = computed(() => {
  43441. if (!watcherData.rowKey.value)
  43442. return {};
  43443. const data = watcherData.data.value || [];
  43444. return normalize(data);
  43445. });
  43446. const normalizedLazyNode = computed(() => {
  43447. const rowKey = watcherData.rowKey.value;
  43448. const keys = Object.keys(lazyTreeNodeMap.value);
  43449. const res = {};
  43450. if (!keys.length)
  43451. return res;
  43452. keys.forEach((key) => {
  43453. if (lazyTreeNodeMap.value[key].length) {
  43454. const item = { children: [] };
  43455. lazyTreeNodeMap.value[key].forEach((row) => {
  43456. const currentRowKey = getRowIdentity(row, rowKey);
  43457. item.children.push(currentRowKey);
  43458. if (row[lazyColumnIdentifier.value] && !res[currentRowKey]) {
  43459. res[currentRowKey] = { children: [] };
  43460. }
  43461. });
  43462. res[key] = item;
  43463. }
  43464. });
  43465. return res;
  43466. });
  43467. const normalize = (data) => {
  43468. const rowKey = watcherData.rowKey.value;
  43469. const res = {};
  43470. walkTreeNode(data, (parent, children, level) => {
  43471. const parentId = getRowIdentity(parent, rowKey);
  43472. if (isArray$1(children)) {
  43473. res[parentId] = {
  43474. children: children.map((row) => getRowIdentity(row, rowKey)),
  43475. level
  43476. };
  43477. } else if (lazy.value) {
  43478. res[parentId] = {
  43479. children: [],
  43480. lazy: true,
  43481. level
  43482. };
  43483. }
  43484. }, childrenColumnName.value, lazyColumnIdentifier.value);
  43485. return res;
  43486. };
  43487. const updateTreeData = (ifChangeExpandRowKeys = false, ifExpandAll = ((_a) => (_a = instance.store) == null ? void 0 : _a.states.defaultExpandAll.value)()) => {
  43488. var _a2;
  43489. const nested = normalizedData.value;
  43490. const normalizedLazyNode_ = normalizedLazyNode.value;
  43491. const keys = Object.keys(nested);
  43492. const newTreeData = {};
  43493. if (keys.length) {
  43494. const oldTreeData = unref(treeData);
  43495. const rootLazyRowKeys = [];
  43496. const getExpanded = (oldValue, key) => {
  43497. if (ifChangeExpandRowKeys) {
  43498. if (expandRowKeys.value) {
  43499. return ifExpandAll || expandRowKeys.value.includes(key);
  43500. } else {
  43501. return !!(ifExpandAll || (oldValue == null ? void 0 : oldValue.expanded));
  43502. }
  43503. } else {
  43504. const included = ifExpandAll || expandRowKeys.value && expandRowKeys.value.includes(key);
  43505. return !!((oldValue == null ? void 0 : oldValue.expanded) || included);
  43506. }
  43507. };
  43508. keys.forEach((key) => {
  43509. const oldValue = oldTreeData[key];
  43510. const newValue = { ...nested[key] };
  43511. newValue.expanded = getExpanded(oldValue, key);
  43512. if (newValue.lazy) {
  43513. const { loaded = false, loading = false } = oldValue || {};
  43514. newValue.loaded = !!loaded;
  43515. newValue.loading = !!loading;
  43516. rootLazyRowKeys.push(key);
  43517. }
  43518. newTreeData[key] = newValue;
  43519. });
  43520. const lazyKeys = Object.keys(normalizedLazyNode_);
  43521. if (lazy.value && lazyKeys.length && rootLazyRowKeys.length) {
  43522. lazyKeys.forEach((key) => {
  43523. const oldValue = oldTreeData[key];
  43524. const lazyNodeChildren = normalizedLazyNode_[key].children;
  43525. if (rootLazyRowKeys.includes(key)) {
  43526. if (newTreeData[key].children.length !== 0) {
  43527. throw new Error("[ElTable]children must be an empty array.");
  43528. }
  43529. newTreeData[key].children = lazyNodeChildren;
  43530. } else {
  43531. const { loaded = false, loading = false } = oldValue || {};
  43532. newTreeData[key] = {
  43533. lazy: true,
  43534. loaded: !!loaded,
  43535. loading: !!loading,
  43536. expanded: getExpanded(oldValue, key),
  43537. children: lazyNodeChildren,
  43538. level: ""
  43539. };
  43540. }
  43541. });
  43542. }
  43543. }
  43544. treeData.value = newTreeData;
  43545. (_a2 = instance.store) == null ? void 0 : _a2.updateTableScrollY();
  43546. };
  43547. watch(() => expandRowKeys.value, () => {
  43548. updateTreeData(true);
  43549. });
  43550. watch(() => normalizedData.value, () => {
  43551. updateTreeData();
  43552. });
  43553. watch(() => normalizedLazyNode.value, () => {
  43554. updateTreeData();
  43555. });
  43556. const updateTreeExpandKeys = (value) => {
  43557. expandRowKeys.value = value;
  43558. updateTreeData();
  43559. };
  43560. const isUseLazy = (data) => {
  43561. return lazy.value && data && "loaded" in data && !data.loaded;
  43562. };
  43563. const toggleTreeExpansion = (row, expanded) => {
  43564. instance.store.assertRowKey();
  43565. const rowKey = watcherData.rowKey.value;
  43566. const id = getRowIdentity(row, rowKey);
  43567. const data = id && treeData.value[id];
  43568. if (id && data && "expanded" in data) {
  43569. const oldExpanded = data.expanded;
  43570. expanded = isUndefined(expanded) ? !data.expanded : expanded;
  43571. treeData.value[id].expanded = expanded;
  43572. if (oldExpanded !== expanded) {
  43573. instance.emit("expand-change", row, expanded);
  43574. }
  43575. isUseLazy(data) && loadData(row, id, data);
  43576. instance.store.updateTableScrollY();
  43577. }
  43578. };
  43579. const loadOrToggle = (row) => {
  43580. instance.store.assertRowKey();
  43581. const rowKey = watcherData.rowKey.value;
  43582. const id = getRowIdentity(row, rowKey);
  43583. const data = treeData.value[id];
  43584. if (isUseLazy(data)) {
  43585. loadData(row, id, data);
  43586. } else {
  43587. toggleTreeExpansion(row, void 0);
  43588. }
  43589. };
  43590. const loadData = (row, key, treeNode) => {
  43591. const { load } = instance.props;
  43592. if (load && !treeData.value[key].loaded) {
  43593. treeData.value[key].loading = true;
  43594. load(row, treeNode, (data) => {
  43595. if (!isArray$1(data)) {
  43596. throw new TypeError("[ElTable] data must be an array");
  43597. }
  43598. treeData.value[key].loading = false;
  43599. treeData.value[key].loaded = true;
  43600. treeData.value[key].expanded = true;
  43601. if (data.length) {
  43602. lazyTreeNodeMap.value[key] = data;
  43603. }
  43604. instance.emit("expand-change", row, true);
  43605. });
  43606. }
  43607. };
  43608. const updateKeyChildren = (key, data) => {
  43609. const { lazy: lazy2, rowKey } = instance.props;
  43610. if (!lazy2)
  43611. return;
  43612. if (!rowKey)
  43613. throw new Error("[Table] rowKey is required in updateKeyChild");
  43614. if (lazyTreeNodeMap.value[key]) {
  43615. lazyTreeNodeMap.value[key] = data;
  43616. }
  43617. };
  43618. return {
  43619. loadData,
  43620. loadOrToggle,
  43621. toggleTreeExpansion,
  43622. updateTreeExpandKeys,
  43623. updateTreeData,
  43624. updateKeyChildren,
  43625. normalize,
  43626. states: {
  43627. expandRowKeys,
  43628. treeData,
  43629. indent,
  43630. lazy,
  43631. lazyTreeNodeMap,
  43632. lazyColumnIdentifier,
  43633. childrenColumnName,
  43634. checkStrictly
  43635. }
  43636. };
  43637. }
  43638. const sortData = (data, states) => {
  43639. const sortingColumn = states.sortingColumn;
  43640. if (!sortingColumn || isString$1(sortingColumn.sortable)) {
  43641. return data;
  43642. }
  43643. return orderBy(data, states.sortProp, states.sortOrder, sortingColumn.sortMethod, sortingColumn.sortBy);
  43644. };
  43645. const doFlattenColumns = (columns) => {
  43646. const result = [];
  43647. columns.forEach((column) => {
  43648. if (column.children && column.children.length > 0) {
  43649. result.push.apply(result, doFlattenColumns(column.children));
  43650. } else {
  43651. result.push(column);
  43652. }
  43653. });
  43654. return result;
  43655. };
  43656. function useWatcher$1() {
  43657. var _a;
  43658. const instance = getCurrentInstance();
  43659. const { size: tableSize } = toRefs((_a = instance.proxy) == null ? void 0 : _a.$props);
  43660. const rowKey = ref(null);
  43661. const data = ref([]);
  43662. const _data = ref([]);
  43663. const isComplex = ref(false);
  43664. const _columns = ref([]);
  43665. const originColumns = ref([]);
  43666. const columns = ref([]);
  43667. const fixedColumns = ref([]);
  43668. const rightFixedColumns = ref([]);
  43669. const leafColumns = ref([]);
  43670. const fixedLeafColumns = ref([]);
  43671. const rightFixedLeafColumns = ref([]);
  43672. const updateOrderFns = [];
  43673. const leafColumnsLength = ref(0);
  43674. const fixedLeafColumnsLength = ref(0);
  43675. const rightFixedLeafColumnsLength = ref(0);
  43676. const isAllSelected = ref(false);
  43677. const selection = ref([]);
  43678. const reserveSelection = ref(false);
  43679. const selectOnIndeterminate = ref(false);
  43680. const selectable = ref(null);
  43681. const filters = ref({});
  43682. const filteredData = ref(null);
  43683. const sortingColumn = ref(null);
  43684. const sortProp = ref(null);
  43685. const sortOrder = ref(null);
  43686. const hoverRow = ref(null);
  43687. const selectedMap = computed(() => {
  43688. return rowKey.value ? getKeysMap(selection.value, rowKey.value) : void 0;
  43689. });
  43690. watch(data, () => {
  43691. var _a2;
  43692. if (instance.state) {
  43693. scheduleLayout(false);
  43694. const needUpdateFixed = instance.props.tableLayout === "auto";
  43695. if (needUpdateFixed) {
  43696. (_a2 = instance.refs.tableHeaderRef) == null ? void 0 : _a2.updateFixedColumnStyle();
  43697. }
  43698. }
  43699. }, {
  43700. deep: true
  43701. });
  43702. const assertRowKey = () => {
  43703. if (!rowKey.value)
  43704. throw new Error("[ElTable] prop row-key is required");
  43705. };
  43706. const updateChildFixed = (column) => {
  43707. var _a2;
  43708. (_a2 = column.children) == null ? void 0 : _a2.forEach((childColumn) => {
  43709. childColumn.fixed = column.fixed;
  43710. updateChildFixed(childColumn);
  43711. });
  43712. };
  43713. const updateColumns = () => {
  43714. var _a2, _b;
  43715. _columns.value.forEach((column) => {
  43716. updateChildFixed(column);
  43717. });
  43718. fixedColumns.value = _columns.value.filter((column) => column.type !== "selection" && [true, "left"].includes(column.fixed));
  43719. let selectColFixLeft;
  43720. if (((_b = (_a2 = _columns.value) == null ? void 0 : _a2[0]) == null ? void 0 : _b.type) === "selection") {
  43721. const selectColumn = _columns.value[0];
  43722. selectColFixLeft = [true, "left"].includes(selectColumn.fixed) || fixedColumns.value.length && selectColumn.fixed !== "right";
  43723. if (selectColFixLeft) {
  43724. fixedColumns.value.unshift(selectColumn);
  43725. }
  43726. }
  43727. rightFixedColumns.value = _columns.value.filter((column) => column.fixed === "right");
  43728. const notFixedColumns = _columns.value.filter((column) => (selectColFixLeft ? column.type !== "selection" : true) && !column.fixed);
  43729. originColumns.value = [].concat(fixedColumns.value).concat(notFixedColumns).concat(rightFixedColumns.value);
  43730. const leafColumns2 = doFlattenColumns(notFixedColumns);
  43731. const fixedLeafColumns2 = doFlattenColumns(fixedColumns.value);
  43732. const rightFixedLeafColumns2 = doFlattenColumns(rightFixedColumns.value);
  43733. leafColumnsLength.value = leafColumns2.length;
  43734. fixedLeafColumnsLength.value = fixedLeafColumns2.length;
  43735. rightFixedLeafColumnsLength.value = rightFixedLeafColumns2.length;
  43736. columns.value = [].concat(fixedLeafColumns2).concat(leafColumns2).concat(rightFixedLeafColumns2);
  43737. isComplex.value = fixedColumns.value.length > 0 || rightFixedColumns.value.length > 0;
  43738. };
  43739. const scheduleLayout = (needUpdateColumns, immediate = false) => {
  43740. if (needUpdateColumns) {
  43741. updateColumns();
  43742. }
  43743. if (immediate) {
  43744. instance.state.doLayout();
  43745. } else {
  43746. instance.state.debouncedUpdateLayout();
  43747. }
  43748. };
  43749. const isSelected = (row) => {
  43750. if (selectedMap.value) {
  43751. return !!selectedMap.value[getRowIdentity(row, rowKey.value)];
  43752. } else {
  43753. return selection.value.includes(row);
  43754. }
  43755. };
  43756. const clearSelection = () => {
  43757. isAllSelected.value = false;
  43758. const oldSelection = selection.value;
  43759. selection.value = [];
  43760. if (oldSelection.length) {
  43761. instance.emit("selection-change", []);
  43762. }
  43763. };
  43764. const cleanSelection = () => {
  43765. var _a2, _b;
  43766. let deleted;
  43767. if (rowKey.value) {
  43768. deleted = [];
  43769. const childrenKey = (_b = (_a2 = instance == null ? void 0 : instance.store) == null ? void 0 : _a2.states) == null ? void 0 : _b.childrenColumnName.value;
  43770. const dataMap = getKeysMap(data.value, rowKey.value, true, childrenKey);
  43771. for (const key in selectedMap.value) {
  43772. if (hasOwn(selectedMap.value, key) && !dataMap[key]) {
  43773. deleted.push(selectedMap.value[key].row);
  43774. }
  43775. }
  43776. } else {
  43777. deleted = selection.value.filter((item) => !data.value.includes(item));
  43778. }
  43779. if (deleted.length) {
  43780. const newSelection = selection.value.filter((item) => !deleted.includes(item));
  43781. selection.value = newSelection;
  43782. instance.emit("selection-change", newSelection.slice());
  43783. }
  43784. };
  43785. const getSelectionRows = () => {
  43786. return (selection.value || []).slice();
  43787. };
  43788. const toggleRowSelection = (row, selected, emitChange = true, ignoreSelectable = false) => {
  43789. var _a2, _b, _c, _d;
  43790. const treeProps = {
  43791. children: (_b = (_a2 = instance == null ? void 0 : instance.store) == null ? void 0 : _a2.states) == null ? void 0 : _b.childrenColumnName.value,
  43792. checkStrictly: (_d = (_c = instance == null ? void 0 : instance.store) == null ? void 0 : _c.states) == null ? void 0 : _d.checkStrictly.value
  43793. };
  43794. const changed = toggleRowStatus(selection.value, row, selected, treeProps, ignoreSelectable ? void 0 : selectable.value, data.value.indexOf(row));
  43795. if (changed) {
  43796. const newSelection = (selection.value || []).slice();
  43797. if (emitChange) {
  43798. instance.emit("select", newSelection, row);
  43799. }
  43800. instance.emit("selection-change", newSelection);
  43801. }
  43802. };
  43803. const _toggleAllSelection = () => {
  43804. var _a2, _b;
  43805. const value = selectOnIndeterminate.value ? !isAllSelected.value : !(isAllSelected.value || selection.value.length);
  43806. isAllSelected.value = value;
  43807. let selectionChanged = false;
  43808. let childrenCount = 0;
  43809. const rowKey2 = (_b = (_a2 = instance == null ? void 0 : instance.store) == null ? void 0 : _a2.states) == null ? void 0 : _b.rowKey.value;
  43810. const { childrenColumnName } = instance.store.states;
  43811. const treeProps = {
  43812. children: childrenColumnName.value,
  43813. checkStrictly: false
  43814. };
  43815. data.value.forEach((row, index) => {
  43816. const rowIndex = index + childrenCount;
  43817. if (toggleRowStatus(selection.value, row, value, treeProps, selectable.value, rowIndex)) {
  43818. selectionChanged = true;
  43819. }
  43820. childrenCount += getChildrenCount(getRowIdentity(row, rowKey2));
  43821. });
  43822. if (selectionChanged) {
  43823. instance.emit("selection-change", selection.value ? selection.value.slice() : []);
  43824. }
  43825. instance.emit("select-all", (selection.value || []).slice());
  43826. };
  43827. const updateSelectionByRowKey = () => {
  43828. data.value.forEach((row) => {
  43829. const rowId = getRowIdentity(row, rowKey.value);
  43830. const rowInfo = selectedMap.value[rowId];
  43831. if (rowInfo) {
  43832. selection.value[rowInfo.index] = row;
  43833. }
  43834. });
  43835. };
  43836. const updateAllSelected = () => {
  43837. var _a2;
  43838. if (((_a2 = data.value) == null ? void 0 : _a2.length) === 0) {
  43839. isAllSelected.value = false;
  43840. return;
  43841. }
  43842. const { childrenColumnName } = instance.store.states;
  43843. let rowIndex = 0;
  43844. let selectedCount = 0;
  43845. const checkSelectedStatus = (data2) => {
  43846. var _a3;
  43847. for (const row of data2) {
  43848. const isRowSelectable = selectable.value && selectable.value.call(null, row, rowIndex);
  43849. if (!isSelected(row)) {
  43850. if (!selectable.value || isRowSelectable) {
  43851. return false;
  43852. }
  43853. } else {
  43854. selectedCount++;
  43855. }
  43856. rowIndex++;
  43857. if (((_a3 = row[childrenColumnName.value]) == null ? void 0 : _a3.length) && !checkSelectedStatus(row[childrenColumnName.value])) {
  43858. return false;
  43859. }
  43860. }
  43861. return true;
  43862. };
  43863. const isAllSelected_ = checkSelectedStatus(data.value || []);
  43864. isAllSelected.value = selectedCount === 0 ? false : isAllSelected_;
  43865. };
  43866. const getChildrenCount = (rowKey2) => {
  43867. var _a2;
  43868. if (!instance || !instance.store)
  43869. return 0;
  43870. const { treeData } = instance.store.states;
  43871. let count = 0;
  43872. const children = (_a2 = treeData.value[rowKey2]) == null ? void 0 : _a2.children;
  43873. if (children) {
  43874. count += children.length;
  43875. children.forEach((childKey) => {
  43876. count += getChildrenCount(childKey);
  43877. });
  43878. }
  43879. return count;
  43880. };
  43881. const updateFilters = (columns2, values) => {
  43882. if (!isArray$1(columns2)) {
  43883. columns2 = [columns2];
  43884. }
  43885. const filters_ = {};
  43886. columns2.forEach((col) => {
  43887. filters.value[col.id] = values;
  43888. filters_[col.columnKey || col.id] = values;
  43889. });
  43890. return filters_;
  43891. };
  43892. const updateSort = (column, prop, order) => {
  43893. if (sortingColumn.value && sortingColumn.value !== column) {
  43894. sortingColumn.value.order = null;
  43895. }
  43896. sortingColumn.value = column;
  43897. sortProp.value = prop;
  43898. sortOrder.value = order;
  43899. };
  43900. const execFilter = () => {
  43901. let sourceData = unref(_data);
  43902. Object.keys(filters.value).forEach((columnId) => {
  43903. const values = filters.value[columnId];
  43904. if (!values || values.length === 0)
  43905. return;
  43906. const column = getColumnById({
  43907. columns: columns.value
  43908. }, columnId);
  43909. if (column && column.filterMethod) {
  43910. sourceData = sourceData.filter((row) => {
  43911. return values.some((value) => column.filterMethod.call(null, value, row, column));
  43912. });
  43913. }
  43914. });
  43915. filteredData.value = sourceData;
  43916. };
  43917. const execSort = () => {
  43918. data.value = sortData(filteredData.value, {
  43919. sortingColumn: sortingColumn.value,
  43920. sortProp: sortProp.value,
  43921. sortOrder: sortOrder.value
  43922. });
  43923. };
  43924. const execQuery = (ignore = void 0) => {
  43925. if (!(ignore && ignore.filter)) {
  43926. execFilter();
  43927. }
  43928. execSort();
  43929. };
  43930. const clearFilter = (columnKeys) => {
  43931. const { tableHeaderRef } = instance.refs;
  43932. if (!tableHeaderRef)
  43933. return;
  43934. const panels = Object.assign({}, tableHeaderRef.filterPanels);
  43935. const keys = Object.keys(panels);
  43936. if (!keys.length)
  43937. return;
  43938. if (isString$1(columnKeys)) {
  43939. columnKeys = [columnKeys];
  43940. }
  43941. if (isArray$1(columnKeys)) {
  43942. const columns_ = columnKeys.map((key) => getColumnByKey({
  43943. columns: columns.value
  43944. }, key));
  43945. keys.forEach((key) => {
  43946. const column = columns_.find((col) => col.id === key);
  43947. if (column) {
  43948. column.filteredValue = [];
  43949. }
  43950. });
  43951. instance.store.commit("filterChange", {
  43952. column: columns_,
  43953. values: [],
  43954. silent: true,
  43955. multi: true
  43956. });
  43957. } else {
  43958. keys.forEach((key) => {
  43959. const column = columns.value.find((col) => col.id === key);
  43960. if (column) {
  43961. column.filteredValue = [];
  43962. }
  43963. });
  43964. filters.value = {};
  43965. instance.store.commit("filterChange", {
  43966. column: {},
  43967. values: [],
  43968. silent: true
  43969. });
  43970. }
  43971. };
  43972. const clearSort = () => {
  43973. if (!sortingColumn.value)
  43974. return;
  43975. updateSort(null, null, null);
  43976. instance.store.commit("changeSortCondition", {
  43977. silent: true
  43978. });
  43979. };
  43980. const {
  43981. setExpandRowKeys,
  43982. toggleRowExpansion,
  43983. updateExpandRows,
  43984. states: expandStates,
  43985. isRowExpanded
  43986. } = useExpand({
  43987. data,
  43988. rowKey
  43989. });
  43990. const {
  43991. updateTreeExpandKeys,
  43992. toggleTreeExpansion,
  43993. updateTreeData,
  43994. updateKeyChildren,
  43995. loadOrToggle,
  43996. states: treeStates
  43997. } = useTree$2({
  43998. data,
  43999. rowKey
  44000. });
  44001. const {
  44002. updateCurrentRowData,
  44003. updateCurrentRow,
  44004. setCurrentRowKey,
  44005. states: currentData
  44006. } = useCurrent({
  44007. data,
  44008. rowKey
  44009. });
  44010. const setExpandRowKeysAdapter = (val) => {
  44011. setExpandRowKeys(val);
  44012. updateTreeExpandKeys(val);
  44013. };
  44014. const toggleRowExpansionAdapter = (row, expanded) => {
  44015. const hasExpandColumn = columns.value.some(({ type }) => type === "expand");
  44016. if (hasExpandColumn) {
  44017. toggleRowExpansion(row, expanded);
  44018. } else {
  44019. toggleTreeExpansion(row, expanded);
  44020. }
  44021. };
  44022. return {
  44023. assertRowKey,
  44024. updateColumns,
  44025. scheduleLayout,
  44026. isSelected,
  44027. clearSelection,
  44028. cleanSelection,
  44029. getSelectionRows,
  44030. toggleRowSelection,
  44031. _toggleAllSelection,
  44032. toggleAllSelection: null,
  44033. updateSelectionByRowKey,
  44034. updateAllSelected,
  44035. updateFilters,
  44036. updateCurrentRow,
  44037. updateSort,
  44038. execFilter,
  44039. execSort,
  44040. execQuery,
  44041. clearFilter,
  44042. clearSort,
  44043. toggleRowExpansion,
  44044. setExpandRowKeysAdapter,
  44045. setCurrentRowKey,
  44046. toggleRowExpansionAdapter,
  44047. isRowExpanded,
  44048. updateExpandRows,
  44049. updateCurrentRowData,
  44050. loadOrToggle,
  44051. updateTreeData,
  44052. updateKeyChildren,
  44053. states: {
  44054. tableSize,
  44055. rowKey,
  44056. data,
  44057. _data,
  44058. isComplex,
  44059. _columns,
  44060. originColumns,
  44061. columns,
  44062. fixedColumns,
  44063. rightFixedColumns,
  44064. leafColumns,
  44065. fixedLeafColumns,
  44066. rightFixedLeafColumns,
  44067. updateOrderFns,
  44068. leafColumnsLength,
  44069. fixedLeafColumnsLength,
  44070. rightFixedLeafColumnsLength,
  44071. isAllSelected,
  44072. selection,
  44073. reserveSelection,
  44074. selectOnIndeterminate,
  44075. selectable,
  44076. filters,
  44077. filteredData,
  44078. sortingColumn,
  44079. sortProp,
  44080. sortOrder,
  44081. hoverRow,
  44082. ...expandStates,
  44083. ...treeStates,
  44084. ...currentData
  44085. }
  44086. };
  44087. }
  44088. function replaceColumn(array, column) {
  44089. return array.map((item) => {
  44090. var _a;
  44091. if (item.id === column.id) {
  44092. return column;
  44093. } else if ((_a = item.children) == null ? void 0 : _a.length) {
  44094. item.children = replaceColumn(item.children, column);
  44095. }
  44096. return item;
  44097. });
  44098. }
  44099. function sortColumn(array) {
  44100. array.forEach((item) => {
  44101. var _a, _b;
  44102. item.no = (_a = item.getColumnIndex) == null ? void 0 : _a.call(item);
  44103. if ((_b = item.children) == null ? void 0 : _b.length) {
  44104. sortColumn(item.children);
  44105. }
  44106. });
  44107. array.sort((cur, pre) => cur.no - pre.no);
  44108. }
  44109. function useStore() {
  44110. const instance = getCurrentInstance();
  44111. const watcher = useWatcher$1();
  44112. const ns = useNamespace("table");
  44113. const mutations = {
  44114. setData(states, data) {
  44115. const dataInstanceChanged = unref(states._data) !== data;
  44116. states.data.value = data;
  44117. states._data.value = data;
  44118. instance.store.execQuery();
  44119. instance.store.updateCurrentRowData();
  44120. instance.store.updateExpandRows();
  44121. instance.store.updateTreeData(instance.store.states.defaultExpandAll.value);
  44122. if (unref(states.reserveSelection)) {
  44123. instance.store.assertRowKey();
  44124. instance.store.updateSelectionByRowKey();
  44125. } else {
  44126. if (dataInstanceChanged) {
  44127. instance.store.clearSelection();
  44128. } else {
  44129. instance.store.cleanSelection();
  44130. }
  44131. }
  44132. instance.store.updateAllSelected();
  44133. if (instance.$ready) {
  44134. instance.store.scheduleLayout();
  44135. }
  44136. },
  44137. insertColumn(states, column, parent, updateColumnOrder) {
  44138. const array = unref(states._columns);
  44139. let newColumns = [];
  44140. if (!parent) {
  44141. array.push(column);
  44142. newColumns = array;
  44143. } else {
  44144. if (parent && !parent.children) {
  44145. parent.children = [];
  44146. }
  44147. parent.children.push(column);
  44148. newColumns = replaceColumn(array, parent);
  44149. }
  44150. sortColumn(newColumns);
  44151. states._columns.value = newColumns;
  44152. states.updateOrderFns.push(updateColumnOrder);
  44153. if (column.type === "selection") {
  44154. states.selectable.value = column.selectable;
  44155. states.reserveSelection.value = column.reserveSelection;
  44156. }
  44157. if (instance.$ready) {
  44158. instance.store.updateColumns();
  44159. instance.store.scheduleLayout();
  44160. }
  44161. },
  44162. updateColumnOrder(states, column) {
  44163. var _a;
  44164. const newColumnIndex = (_a = column.getColumnIndex) == null ? void 0 : _a.call(column);
  44165. if (newColumnIndex === column.no)
  44166. return;
  44167. sortColumn(states._columns.value);
  44168. if (instance.$ready) {
  44169. instance.store.updateColumns();
  44170. }
  44171. },
  44172. removeColumn(states, column, parent, updateColumnOrder) {
  44173. const array = unref(states._columns) || [];
  44174. if (parent) {
  44175. parent.children.splice(parent.children.findIndex((item) => item.id === column.id), 1);
  44176. nextTick(() => {
  44177. var _a;
  44178. if (((_a = parent.children) == null ? void 0 : _a.length) === 0) {
  44179. delete parent.children;
  44180. }
  44181. });
  44182. states._columns.value = replaceColumn(array, parent);
  44183. } else {
  44184. const index = array.indexOf(column);
  44185. if (index > -1) {
  44186. array.splice(index, 1);
  44187. states._columns.value = array;
  44188. }
  44189. }
  44190. const updateFnIndex = states.updateOrderFns.indexOf(updateColumnOrder);
  44191. updateFnIndex > -1 && states.updateOrderFns.splice(updateFnIndex, 1);
  44192. if (instance.$ready) {
  44193. instance.store.updateColumns();
  44194. instance.store.scheduleLayout();
  44195. }
  44196. },
  44197. sort(states, options) {
  44198. const { prop, order, init } = options;
  44199. if (prop) {
  44200. const column = unref(states.columns).find((column2) => column2.property === prop);
  44201. if (column) {
  44202. column.order = order;
  44203. instance.store.updateSort(column, prop, order);
  44204. instance.store.commit("changeSortCondition", { init });
  44205. }
  44206. }
  44207. },
  44208. changeSortCondition(states, options) {
  44209. const { sortingColumn, sortProp, sortOrder } = states;
  44210. const columnValue = unref(sortingColumn), propValue = unref(sortProp), orderValue = unref(sortOrder);
  44211. if (isNull(orderValue)) {
  44212. states.sortingColumn.value = null;
  44213. states.sortProp.value = null;
  44214. }
  44215. const ignore = { filter: true };
  44216. instance.store.execQuery(ignore);
  44217. if (!options || !(options.silent || options.init)) {
  44218. instance.emit("sort-change", {
  44219. column: columnValue,
  44220. prop: propValue,
  44221. order: orderValue
  44222. });
  44223. }
  44224. instance.store.updateTableScrollY();
  44225. },
  44226. filterChange(_states, options) {
  44227. const { column, values, silent } = options;
  44228. const newFilters = instance.store.updateFilters(column, values);
  44229. instance.store.execQuery();
  44230. if (!silent) {
  44231. instance.emit("filter-change", newFilters);
  44232. }
  44233. instance.store.updateTableScrollY();
  44234. },
  44235. toggleAllSelection() {
  44236. instance.store.toggleAllSelection();
  44237. },
  44238. rowSelectedChanged(_states, row) {
  44239. instance.store.toggleRowSelection(row);
  44240. instance.store.updateAllSelected();
  44241. },
  44242. setHoverRow(states, row) {
  44243. states.hoverRow.value = row;
  44244. },
  44245. setCurrentRow(_states, row) {
  44246. instance.store.updateCurrentRow(row);
  44247. }
  44248. };
  44249. const commit = function(name, ...args) {
  44250. const mutations2 = instance.store.mutations;
  44251. if (mutations2[name]) {
  44252. mutations2[name].apply(instance, [instance.store.states].concat(args));
  44253. } else {
  44254. throw new Error(`Action not found: ${name}`);
  44255. }
  44256. };
  44257. const updateTableScrollY = function() {
  44258. nextTick(() => instance.layout.updateScrollY.apply(instance.layout));
  44259. };
  44260. return {
  44261. ns,
  44262. ...watcher,
  44263. mutations,
  44264. commit,
  44265. updateTableScrollY
  44266. };
  44267. }
  44268. const InitialStateMap = {
  44269. rowKey: "rowKey",
  44270. defaultExpandAll: "defaultExpandAll",
  44271. selectOnIndeterminate: "selectOnIndeterminate",
  44272. indent: "indent",
  44273. lazy: "lazy",
  44274. data: "data",
  44275. ["treeProps.hasChildren"]: {
  44276. key: "lazyColumnIdentifier",
  44277. default: "hasChildren"
  44278. },
  44279. ["treeProps.children"]: {
  44280. key: "childrenColumnName",
  44281. default: "children"
  44282. },
  44283. ["treeProps.checkStrictly"]: {
  44284. key: "checkStrictly",
  44285. default: false
  44286. }
  44287. };
  44288. function createStore(table, props) {
  44289. if (!table) {
  44290. throw new Error("Table is required.");
  44291. }
  44292. const store = useStore();
  44293. store.toggleAllSelection = debounce(store._toggleAllSelection, 10);
  44294. Object.keys(InitialStateMap).forEach((key) => {
  44295. handleValue(getArrKeysValue(props, key), key, store);
  44296. });
  44297. proxyTableProps(store, props);
  44298. return store;
  44299. }
  44300. function proxyTableProps(store, props) {
  44301. Object.keys(InitialStateMap).forEach((key) => {
  44302. watch(() => getArrKeysValue(props, key), (value) => {
  44303. handleValue(value, key, store);
  44304. });
  44305. });
  44306. }
  44307. function handleValue(value, propsKey, store) {
  44308. let newVal = value;
  44309. let storeKey = InitialStateMap[propsKey];
  44310. if (isObject$1(InitialStateMap[propsKey])) {
  44311. storeKey = storeKey.key;
  44312. newVal = newVal || InitialStateMap[propsKey].default;
  44313. }
  44314. store.states[storeKey].value = newVal;
  44315. }
  44316. function getArrKeysValue(props, keys) {
  44317. if (keys.includes(".")) {
  44318. const keyList = keys.split(".");
  44319. let value = props;
  44320. keyList.forEach((key) => {
  44321. value = value[key];
  44322. });
  44323. return value;
  44324. } else {
  44325. return props[keys];
  44326. }
  44327. }
  44328. class TableLayout {
  44329. constructor(options) {
  44330. this.observers = [];
  44331. this.table = null;
  44332. this.store = null;
  44333. this.columns = [];
  44334. this.fit = true;
  44335. this.showHeader = true;
  44336. this.height = ref(null);
  44337. this.scrollX = ref(false);
  44338. this.scrollY = ref(false);
  44339. this.bodyWidth = ref(null);
  44340. this.fixedWidth = ref(null);
  44341. this.rightFixedWidth = ref(null);
  44342. this.gutterWidth = 0;
  44343. for (const name in options) {
  44344. if (hasOwn(options, name)) {
  44345. if (isRef(this[name])) {
  44346. this[name].value = options[name];
  44347. } else {
  44348. this[name] = options[name];
  44349. }
  44350. }
  44351. }
  44352. if (!this.table) {
  44353. throw new Error("Table is required for Table Layout");
  44354. }
  44355. if (!this.store) {
  44356. throw new Error("Store is required for Table Layout");
  44357. }
  44358. }
  44359. updateScrollY() {
  44360. const height = this.height.value;
  44361. if (isNull(height))
  44362. return false;
  44363. const scrollBarRef = this.table.refs.scrollBarRef;
  44364. if (this.table.vnode.el && (scrollBarRef == null ? void 0 : scrollBarRef.wrapRef)) {
  44365. let scrollY = true;
  44366. const prevScrollY = this.scrollY.value;
  44367. scrollY = scrollBarRef.wrapRef.scrollHeight > scrollBarRef.wrapRef.clientHeight;
  44368. this.scrollY.value = scrollY;
  44369. return prevScrollY !== scrollY;
  44370. }
  44371. return false;
  44372. }
  44373. setHeight(value, prop = "height") {
  44374. if (!isClient)
  44375. return;
  44376. const el = this.table.vnode.el;
  44377. value = parseHeight(value);
  44378. this.height.value = Number(value);
  44379. if (!el && (value || value === 0))
  44380. return nextTick(() => this.setHeight(value, prop));
  44381. if (isNumber(value)) {
  44382. el.style[prop] = `${value}px`;
  44383. this.updateElsHeight();
  44384. } else if (isString$1(value)) {
  44385. el.style[prop] = value;
  44386. this.updateElsHeight();
  44387. }
  44388. }
  44389. setMaxHeight(value) {
  44390. this.setHeight(value, "max-height");
  44391. }
  44392. getFlattenColumns() {
  44393. const flattenColumns = [];
  44394. const columns = this.table.store.states.columns.value;
  44395. columns.forEach((column) => {
  44396. if (column.isColumnGroup) {
  44397. flattenColumns.push.apply(flattenColumns, column.columns);
  44398. } else {
  44399. flattenColumns.push(column);
  44400. }
  44401. });
  44402. return flattenColumns;
  44403. }
  44404. updateElsHeight() {
  44405. this.updateScrollY();
  44406. this.notifyObservers("scrollable");
  44407. }
  44408. headerDisplayNone(elm) {
  44409. if (!elm)
  44410. return true;
  44411. let headerChild = elm;
  44412. while (headerChild.tagName !== "DIV") {
  44413. if (getComputedStyle(headerChild).display === "none") {
  44414. return true;
  44415. }
  44416. headerChild = headerChild.parentElement;
  44417. }
  44418. return false;
  44419. }
  44420. updateColumnsWidth() {
  44421. if (!isClient)
  44422. return;
  44423. const fit = this.fit;
  44424. const bodyWidth = this.table.vnode.el.clientWidth;
  44425. let bodyMinWidth = 0;
  44426. const flattenColumns = this.getFlattenColumns();
  44427. const flexColumns = flattenColumns.filter((column) => !isNumber(column.width));
  44428. flattenColumns.forEach((column) => {
  44429. if (isNumber(column.width) && column.realWidth)
  44430. column.realWidth = null;
  44431. });
  44432. if (flexColumns.length > 0 && fit) {
  44433. flattenColumns.forEach((column) => {
  44434. bodyMinWidth += Number(column.width || column.minWidth || 80);
  44435. });
  44436. if (bodyMinWidth <= bodyWidth) {
  44437. this.scrollX.value = false;
  44438. const totalFlexWidth = bodyWidth - bodyMinWidth;
  44439. if (flexColumns.length === 1) {
  44440. flexColumns[0].realWidth = Number(flexColumns[0].minWidth || 80) + totalFlexWidth;
  44441. } else {
  44442. const allColumnsWidth = flexColumns.reduce((prev, column) => prev + Number(column.minWidth || 80), 0);
  44443. const flexWidthPerPixel = totalFlexWidth / allColumnsWidth;
  44444. let noneFirstWidth = 0;
  44445. flexColumns.forEach((column, index) => {
  44446. if (index === 0)
  44447. return;
  44448. const flexWidth = Math.floor(Number(column.minWidth || 80) * flexWidthPerPixel);
  44449. noneFirstWidth += flexWidth;
  44450. column.realWidth = Number(column.minWidth || 80) + flexWidth;
  44451. });
  44452. flexColumns[0].realWidth = Number(flexColumns[0].minWidth || 80) + totalFlexWidth - noneFirstWidth;
  44453. }
  44454. } else {
  44455. this.scrollX.value = true;
  44456. flexColumns.forEach((column) => {
  44457. column.realWidth = Number(column.minWidth);
  44458. });
  44459. }
  44460. this.bodyWidth.value = Math.max(bodyMinWidth, bodyWidth);
  44461. this.table.state.resizeState.value.width = this.bodyWidth.value;
  44462. } else {
  44463. flattenColumns.forEach((column) => {
  44464. if (!column.width && !column.minWidth) {
  44465. column.realWidth = 80;
  44466. } else {
  44467. column.realWidth = Number(column.width || column.minWidth);
  44468. }
  44469. bodyMinWidth += column.realWidth;
  44470. });
  44471. this.scrollX.value = bodyMinWidth > bodyWidth;
  44472. this.bodyWidth.value = bodyMinWidth;
  44473. }
  44474. const fixedColumns = this.store.states.fixedColumns.value;
  44475. if (fixedColumns.length > 0) {
  44476. let fixedWidth = 0;
  44477. fixedColumns.forEach((column) => {
  44478. fixedWidth += Number(column.realWidth || column.width);
  44479. });
  44480. this.fixedWidth.value = fixedWidth;
  44481. }
  44482. const rightFixedColumns = this.store.states.rightFixedColumns.value;
  44483. if (rightFixedColumns.length > 0) {
  44484. let rightFixedWidth = 0;
  44485. rightFixedColumns.forEach((column) => {
  44486. rightFixedWidth += Number(column.realWidth || column.width);
  44487. });
  44488. this.rightFixedWidth.value = rightFixedWidth;
  44489. }
  44490. this.notifyObservers("columns");
  44491. }
  44492. addObserver(observer) {
  44493. this.observers.push(observer);
  44494. }
  44495. removeObserver(observer) {
  44496. const index = this.observers.indexOf(observer);
  44497. if (index !== -1) {
  44498. this.observers.splice(index, 1);
  44499. }
  44500. }
  44501. notifyObservers(event) {
  44502. const observers = this.observers;
  44503. observers.forEach((observer) => {
  44504. var _a, _b;
  44505. switch (event) {
  44506. case "columns":
  44507. (_a = observer.state) == null ? void 0 : _a.onColumnsChange(this);
  44508. break;
  44509. case "scrollable":
  44510. (_b = observer.state) == null ? void 0 : _b.onScrollableChange(this);
  44511. break;
  44512. default:
  44513. throw new Error(`Table Layout don't have event ${event}.`);
  44514. }
  44515. });
  44516. }
  44517. }
  44518. var TableLayout$1 = TableLayout;
  44519. const { CheckboxGroup: ElCheckboxGroup } = ElCheckbox;
  44520. const _sfc_main$C = defineComponent({
  44521. name: "ElTableFilterPanel",
  44522. components: {
  44523. ElCheckbox,
  44524. ElCheckboxGroup,
  44525. ElScrollbar,
  44526. ElTooltip,
  44527. ElIcon,
  44528. ArrowDown: arrow_down_default,
  44529. ArrowUp: arrow_up_default
  44530. },
  44531. directives: { ClickOutside },
  44532. props: {
  44533. placement: {
  44534. type: String,
  44535. default: "bottom-start"
  44536. },
  44537. store: {
  44538. type: Object
  44539. },
  44540. column: {
  44541. type: Object
  44542. },
  44543. upDataColumn: {
  44544. type: Function
  44545. },
  44546. appendTo: {
  44547. type: String
  44548. }
  44549. },
  44550. setup(props) {
  44551. const instance = getCurrentInstance();
  44552. const { t } = useLocale();
  44553. const ns = useNamespace("table-filter");
  44554. const parent = instance == null ? void 0 : instance.parent;
  44555. if (!parent.filterPanels.value[props.column.id]) {
  44556. parent.filterPanels.value[props.column.id] = instance;
  44557. }
  44558. const tooltipVisible = ref(false);
  44559. const tooltip = ref(null);
  44560. const filters = computed(() => {
  44561. return props.column && props.column.filters;
  44562. });
  44563. const filterClassName = computed(() => {
  44564. if (props.column.filterClassName) {
  44565. return `${ns.b()} ${props.column.filterClassName}`;
  44566. }
  44567. return ns.b();
  44568. });
  44569. const filterValue = computed({
  44570. get: () => {
  44571. var _a;
  44572. return (((_a = props.column) == null ? void 0 : _a.filteredValue) || [])[0];
  44573. },
  44574. set: (value) => {
  44575. if (filteredValue.value) {
  44576. if (!isPropAbsent(value)) {
  44577. filteredValue.value.splice(0, 1, value);
  44578. } else {
  44579. filteredValue.value.splice(0, 1);
  44580. }
  44581. }
  44582. }
  44583. });
  44584. const filteredValue = computed({
  44585. get() {
  44586. if (props.column) {
  44587. return props.column.filteredValue || [];
  44588. }
  44589. return [];
  44590. },
  44591. set(value) {
  44592. if (props.column) {
  44593. props.upDataColumn("filteredValue", value);
  44594. }
  44595. }
  44596. });
  44597. const multiple = computed(() => {
  44598. if (props.column) {
  44599. return props.column.filterMultiple;
  44600. }
  44601. return true;
  44602. });
  44603. const isActive = (filter) => {
  44604. return filter.value === filterValue.value;
  44605. };
  44606. const hidden = () => {
  44607. tooltipVisible.value = false;
  44608. };
  44609. const showFilterPanel = (e) => {
  44610. e.stopPropagation();
  44611. tooltipVisible.value = !tooltipVisible.value;
  44612. };
  44613. const hideFilterPanel = () => {
  44614. tooltipVisible.value = false;
  44615. };
  44616. const handleConfirm = () => {
  44617. confirmFilter(filteredValue.value);
  44618. hidden();
  44619. };
  44620. const handleReset = () => {
  44621. filteredValue.value = [];
  44622. confirmFilter(filteredValue.value);
  44623. hidden();
  44624. };
  44625. const handleSelect = (_filterValue) => {
  44626. filterValue.value = _filterValue;
  44627. if (!isPropAbsent(_filterValue)) {
  44628. confirmFilter(filteredValue.value);
  44629. } else {
  44630. confirmFilter([]);
  44631. }
  44632. hidden();
  44633. };
  44634. const confirmFilter = (filteredValue2) => {
  44635. props.store.commit("filterChange", {
  44636. column: props.column,
  44637. values: filteredValue2
  44638. });
  44639. props.store.updateAllSelected();
  44640. };
  44641. watch(tooltipVisible, (value) => {
  44642. if (props.column) {
  44643. props.upDataColumn("filterOpened", value);
  44644. }
  44645. }, {
  44646. immediate: true
  44647. });
  44648. const popperPaneRef = computed(() => {
  44649. var _a, _b;
  44650. return (_b = (_a = tooltip.value) == null ? void 0 : _a.popperRef) == null ? void 0 : _b.contentRef;
  44651. });
  44652. return {
  44653. tooltipVisible,
  44654. multiple,
  44655. filterClassName,
  44656. filteredValue,
  44657. filterValue,
  44658. filters,
  44659. handleConfirm,
  44660. handleReset,
  44661. handleSelect,
  44662. isPropAbsent,
  44663. isActive,
  44664. t,
  44665. ns,
  44666. showFilterPanel,
  44667. hideFilterPanel,
  44668. popperPaneRef,
  44669. tooltip
  44670. };
  44671. }
  44672. });
  44673. function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
  44674. const _component_el_checkbox = resolveComponent("el-checkbox");
  44675. const _component_el_checkbox_group = resolveComponent("el-checkbox-group");
  44676. const _component_el_scrollbar = resolveComponent("el-scrollbar");
  44677. const _component_arrow_up = resolveComponent("arrow-up");
  44678. const _component_arrow_down = resolveComponent("arrow-down");
  44679. const _component_el_icon = resolveComponent("el-icon");
  44680. const _component_el_tooltip = resolveComponent("el-tooltip");
  44681. const _directive_click_outside = resolveDirective("click-outside");
  44682. return openBlock(), createBlock(_component_el_tooltip, {
  44683. ref: "tooltip",
  44684. visible: _ctx.tooltipVisible,
  44685. offset: 0,
  44686. placement: _ctx.placement,
  44687. "show-arrow": false,
  44688. "stop-popper-mouse-event": false,
  44689. teleported: "",
  44690. effect: "light",
  44691. pure: "",
  44692. "popper-class": _ctx.filterClassName,
  44693. persistent: "",
  44694. "append-to": _ctx.appendTo
  44695. }, {
  44696. content: withCtx(() => [
  44697. _ctx.multiple ? (openBlock(), createElementBlock("div", { key: 0 }, [
  44698. createElementVNode("div", {
  44699. class: normalizeClass(_ctx.ns.e("content"))
  44700. }, [
  44701. createVNode(_component_el_scrollbar, {
  44702. "wrap-class": _ctx.ns.e("wrap")
  44703. }, {
  44704. default: withCtx(() => [
  44705. createVNode(_component_el_checkbox_group, {
  44706. modelValue: _ctx.filteredValue,
  44707. "onUpdate:modelValue": ($event) => _ctx.filteredValue = $event,
  44708. class: normalizeClass(_ctx.ns.e("checkbox-group"))
  44709. }, {
  44710. default: withCtx(() => [
  44711. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.filters, (filter) => {
  44712. return openBlock(), createBlock(_component_el_checkbox, {
  44713. key: filter.value,
  44714. value: filter.value
  44715. }, {
  44716. default: withCtx(() => [
  44717. createTextVNode(toDisplayString(filter.text), 1)
  44718. ]),
  44719. _: 2
  44720. }, 1032, ["value"]);
  44721. }), 128))
  44722. ]),
  44723. _: 1
  44724. }, 8, ["modelValue", "onUpdate:modelValue", "class"])
  44725. ]),
  44726. _: 1
  44727. }, 8, ["wrap-class"])
  44728. ], 2),
  44729. createElementVNode("div", {
  44730. class: normalizeClass(_ctx.ns.e("bottom"))
  44731. }, [
  44732. createElementVNode("button", {
  44733. class: normalizeClass({ [_ctx.ns.is("disabled")]: _ctx.filteredValue.length === 0 }),
  44734. disabled: _ctx.filteredValue.length === 0,
  44735. type: "button",
  44736. onClick: _ctx.handleConfirm
  44737. }, toDisplayString(_ctx.t("el.table.confirmFilter")), 11, ["disabled", "onClick"]),
  44738. createElementVNode("button", {
  44739. type: "button",
  44740. onClick: _ctx.handleReset
  44741. }, toDisplayString(_ctx.t("el.table.resetFilter")), 9, ["onClick"])
  44742. ], 2)
  44743. ])) : (openBlock(), createElementBlock("ul", {
  44744. key: 1,
  44745. class: normalizeClass(_ctx.ns.e("list"))
  44746. }, [
  44747. createElementVNode("li", {
  44748. class: normalizeClass([
  44749. _ctx.ns.e("list-item"),
  44750. {
  44751. [_ctx.ns.is("active")]: _ctx.isPropAbsent(_ctx.filterValue)
  44752. }
  44753. ]),
  44754. onClick: ($event) => _ctx.handleSelect(null)
  44755. }, toDisplayString(_ctx.t("el.table.clearFilter")), 11, ["onClick"]),
  44756. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.filters, (filter) => {
  44757. return openBlock(), createElementBlock("li", {
  44758. key: filter.value,
  44759. class: normalizeClass([_ctx.ns.e("list-item"), _ctx.ns.is("active", _ctx.isActive(filter))]),
  44760. label: filter.value,
  44761. onClick: ($event) => _ctx.handleSelect(filter.value)
  44762. }, toDisplayString(filter.text), 11, ["label", "onClick"]);
  44763. }), 128))
  44764. ], 2))
  44765. ]),
  44766. default: withCtx(() => [
  44767. withDirectives((openBlock(), createElementBlock("span", {
  44768. class: normalizeClass([
  44769. `${_ctx.ns.namespace.value}-table__column-filter-trigger`,
  44770. `${_ctx.ns.namespace.value}-none-outline`
  44771. ]),
  44772. onClick: _ctx.showFilterPanel
  44773. }, [
  44774. createVNode(_component_el_icon, null, {
  44775. default: withCtx(() => [
  44776. renderSlot(_ctx.$slots, "filter-icon", {}, () => [
  44777. _ctx.column.filterOpened ? (openBlock(), createBlock(_component_arrow_up, { key: 0 })) : (openBlock(), createBlock(_component_arrow_down, { key: 1 }))
  44778. ])
  44779. ]),
  44780. _: 3
  44781. })
  44782. ], 10, ["onClick"])), [
  44783. [_directive_click_outside, _ctx.hideFilterPanel, _ctx.popperPaneRef]
  44784. ])
  44785. ]),
  44786. _: 3
  44787. }, 8, ["visible", "placement", "popper-class", "append-to"]);
  44788. }
  44789. var FilterPanel = /* @__PURE__ */ _export_sfc(_sfc_main$C, [["render", _sfc_render$4], ["__file", "filter-panel.vue"]]);
  44790. function useLayoutObserver(root) {
  44791. const instance = getCurrentInstance();
  44792. onBeforeMount(() => {
  44793. tableLayout.value.addObserver(instance);
  44794. });
  44795. onMounted(() => {
  44796. onColumnsChange(tableLayout.value);
  44797. onScrollableChange(tableLayout.value);
  44798. });
  44799. onUpdated(() => {
  44800. onColumnsChange(tableLayout.value);
  44801. onScrollableChange(tableLayout.value);
  44802. });
  44803. onUnmounted(() => {
  44804. tableLayout.value.removeObserver(instance);
  44805. });
  44806. const tableLayout = computed(() => {
  44807. const layout = root.layout;
  44808. if (!layout) {
  44809. throw new Error("Can not find table layout.");
  44810. }
  44811. return layout;
  44812. });
  44813. const onColumnsChange = (layout) => {
  44814. var _a;
  44815. const cols = ((_a = root.vnode.el) == null ? void 0 : _a.querySelectorAll("colgroup > col")) || [];
  44816. if (!cols.length)
  44817. return;
  44818. const flattenColumns = layout.getFlattenColumns();
  44819. const columnsMap = {};
  44820. flattenColumns.forEach((column) => {
  44821. columnsMap[column.id] = column;
  44822. });
  44823. for (let i = 0, j = cols.length; i < j; i++) {
  44824. const col = cols[i];
  44825. const name = col.getAttribute("name");
  44826. const column = columnsMap[name];
  44827. if (column) {
  44828. col.setAttribute("width", column.realWidth || column.width);
  44829. }
  44830. }
  44831. };
  44832. const onScrollableChange = (layout) => {
  44833. var _a, _b;
  44834. const cols = ((_a = root.vnode.el) == null ? void 0 : _a.querySelectorAll("colgroup > col[name=gutter]")) || [];
  44835. for (let i = 0, j = cols.length; i < j; i++) {
  44836. const col = cols[i];
  44837. col.setAttribute("width", layout.scrollY.value ? layout.gutterWidth : "0");
  44838. }
  44839. const ths = ((_b = root.vnode.el) == null ? void 0 : _b.querySelectorAll("th.gutter")) || [];
  44840. for (let i = 0, j = ths.length; i < j; i++) {
  44841. const th = ths[i];
  44842. th.style.width = layout.scrollY.value ? `${layout.gutterWidth}px` : "0";
  44843. th.style.display = layout.scrollY.value ? "" : "none";
  44844. }
  44845. };
  44846. return {
  44847. tableLayout: tableLayout.value,
  44848. onColumnsChange,
  44849. onScrollableChange
  44850. };
  44851. }
  44852. const TABLE_INJECTION_KEY = Symbol("ElTable");
  44853. function useEvent(props, emit) {
  44854. const instance = getCurrentInstance();
  44855. const parent = inject(TABLE_INJECTION_KEY);
  44856. const handleFilterClick = (event) => {
  44857. event.stopPropagation();
  44858. return;
  44859. };
  44860. const handleHeaderClick = (event, column) => {
  44861. if (!column.filters && column.sortable) {
  44862. handleSortClick(event, column, false);
  44863. } else if (column.filterable && !column.sortable) {
  44864. handleFilterClick(event);
  44865. }
  44866. parent == null ? void 0 : parent.emit("header-click", column, event);
  44867. };
  44868. const handleHeaderContextMenu = (event, column) => {
  44869. parent == null ? void 0 : parent.emit("header-contextmenu", column, event);
  44870. };
  44871. const draggingColumn = ref(null);
  44872. const dragging = ref(false);
  44873. const dragState = ref({});
  44874. const handleMouseDown = (event, column) => {
  44875. if (!isClient)
  44876. return;
  44877. if (column.children && column.children.length > 0)
  44878. return;
  44879. if (draggingColumn.value && props.border) {
  44880. dragging.value = true;
  44881. const table = parent;
  44882. emit("set-drag-visible", true);
  44883. const tableEl = table == null ? void 0 : table.vnode.el;
  44884. const tableLeft = tableEl.getBoundingClientRect().left;
  44885. const columnEl = instance.vnode.el.querySelector(`th.${column.id}`);
  44886. const columnRect = columnEl.getBoundingClientRect();
  44887. const minLeft = columnRect.left - tableLeft + 30;
  44888. addClass(columnEl, "noclick");
  44889. dragState.value = {
  44890. startMouseLeft: event.clientX,
  44891. startLeft: columnRect.right - tableLeft,
  44892. startColumnLeft: columnRect.left - tableLeft,
  44893. tableLeft
  44894. };
  44895. const resizeProxy = table == null ? void 0 : table.refs.resizeProxy;
  44896. resizeProxy.style.left = `${dragState.value.startLeft}px`;
  44897. document.onselectstart = function() {
  44898. return false;
  44899. };
  44900. document.ondragstart = function() {
  44901. return false;
  44902. };
  44903. const handleMouseMove2 = (event2) => {
  44904. const deltaLeft = event2.clientX - dragState.value.startMouseLeft;
  44905. const proxyLeft = dragState.value.startLeft + deltaLeft;
  44906. resizeProxy.style.left = `${Math.max(minLeft, proxyLeft)}px`;
  44907. };
  44908. const handleMouseUp = () => {
  44909. if (dragging.value) {
  44910. const { startColumnLeft, startLeft } = dragState.value;
  44911. const finalLeft = Number.parseInt(resizeProxy.style.left, 10);
  44912. const columnWidth = finalLeft - startColumnLeft;
  44913. column.width = column.realWidth = columnWidth;
  44914. table == null ? void 0 : table.emit("header-dragend", column.width, startLeft - startColumnLeft, column, event);
  44915. requestAnimationFrame(() => {
  44916. props.store.scheduleLayout(false, true);
  44917. });
  44918. document.body.style.cursor = "";
  44919. dragging.value = false;
  44920. draggingColumn.value = null;
  44921. dragState.value = {};
  44922. emit("set-drag-visible", false);
  44923. }
  44924. document.removeEventListener("mousemove", handleMouseMove2);
  44925. document.removeEventListener("mouseup", handleMouseUp);
  44926. document.onselectstart = null;
  44927. document.ondragstart = null;
  44928. setTimeout(() => {
  44929. removeClass(columnEl, "noclick");
  44930. }, 0);
  44931. };
  44932. document.addEventListener("mousemove", handleMouseMove2);
  44933. document.addEventListener("mouseup", handleMouseUp);
  44934. }
  44935. };
  44936. const handleMouseMove = (event, column) => {
  44937. var _a;
  44938. if (column.children && column.children.length > 0)
  44939. return;
  44940. const el = event.target;
  44941. if (!isElement$1(el)) {
  44942. return;
  44943. }
  44944. const target = el == null ? void 0 : el.closest("th");
  44945. if (!column || !column.resizable || !target)
  44946. return;
  44947. if (!dragging.value && props.border) {
  44948. const rect = target.getBoundingClientRect();
  44949. const bodyStyle = document.body.style;
  44950. const isLastTh = ((_a = target.parentNode) == null ? void 0 : _a.lastElementChild) === target;
  44951. const allowDarg = props.allowDragLastColumn || !isLastTh;
  44952. if (rect.width > 12 && rect.right - event.clientX < 8 && allowDarg) {
  44953. bodyStyle.cursor = "col-resize";
  44954. if (hasClass(target, "is-sortable")) {
  44955. target.style.cursor = "col-resize";
  44956. }
  44957. draggingColumn.value = column;
  44958. } else if (!dragging.value) {
  44959. bodyStyle.cursor = "";
  44960. if (hasClass(target, "is-sortable")) {
  44961. target.style.cursor = "pointer";
  44962. }
  44963. draggingColumn.value = null;
  44964. }
  44965. }
  44966. };
  44967. const handleMouseOut = () => {
  44968. if (!isClient)
  44969. return;
  44970. document.body.style.cursor = "";
  44971. };
  44972. const toggleOrder = ({ order, sortOrders }) => {
  44973. if (order === "")
  44974. return sortOrders[0];
  44975. const index = sortOrders.indexOf(order || null);
  44976. return sortOrders[index > sortOrders.length - 2 ? 0 : index + 1];
  44977. };
  44978. const handleSortClick = (event, column, givenOrder) => {
  44979. var _a;
  44980. event.stopPropagation();
  44981. const order = column.order === givenOrder ? null : givenOrder || toggleOrder(column);
  44982. const target = (_a = event.target) == null ? void 0 : _a.closest("th");
  44983. if (target) {
  44984. if (hasClass(target, "noclick")) {
  44985. removeClass(target, "noclick");
  44986. return;
  44987. }
  44988. }
  44989. if (!column.sortable)
  44990. return;
  44991. const clickTarget = event.currentTarget;
  44992. if (["ascending", "descending"].some((str) => hasClass(clickTarget, str) && !column.sortOrders.includes(str))) {
  44993. return;
  44994. }
  44995. const states = props.store.states;
  44996. let sortProp = states.sortProp.value;
  44997. let sortOrder;
  44998. const sortingColumn = states.sortingColumn.value;
  44999. if (sortingColumn !== column || sortingColumn === column && isNull(sortingColumn.order)) {
  45000. if (sortingColumn) {
  45001. sortingColumn.order = null;
  45002. }
  45003. states.sortingColumn.value = column;
  45004. sortProp = column.property;
  45005. }
  45006. if (!order) {
  45007. sortOrder = column.order = null;
  45008. } else {
  45009. sortOrder = column.order = order;
  45010. }
  45011. states.sortProp.value = sortProp;
  45012. states.sortOrder.value = sortOrder;
  45013. parent == null ? void 0 : parent.store.commit("changeSortCondition");
  45014. };
  45015. return {
  45016. handleHeaderClick,
  45017. handleHeaderContextMenu,
  45018. handleMouseDown,
  45019. handleMouseMove,
  45020. handleMouseOut,
  45021. handleSortClick,
  45022. handleFilterClick
  45023. };
  45024. }
  45025. function useStyle$2(props) {
  45026. const parent = inject(TABLE_INJECTION_KEY);
  45027. const ns = useNamespace("table");
  45028. const getHeaderRowStyle = (rowIndex) => {
  45029. const headerRowStyle = parent == null ? void 0 : parent.props.headerRowStyle;
  45030. if (isFunction$1(headerRowStyle)) {
  45031. return headerRowStyle.call(null, { rowIndex });
  45032. }
  45033. return headerRowStyle;
  45034. };
  45035. const getHeaderRowClass = (rowIndex) => {
  45036. const classes = [];
  45037. const headerRowClassName = parent == null ? void 0 : parent.props.headerRowClassName;
  45038. if (isString$1(headerRowClassName)) {
  45039. classes.push(headerRowClassName);
  45040. } else if (isFunction$1(headerRowClassName)) {
  45041. classes.push(headerRowClassName.call(null, { rowIndex }));
  45042. }
  45043. return classes.join(" ");
  45044. };
  45045. const getHeaderCellStyle = (rowIndex, columnIndex, row, column) => {
  45046. var _a;
  45047. let headerCellStyles = (_a = parent == null ? void 0 : parent.props.headerCellStyle) != null ? _a : {};
  45048. if (isFunction$1(headerCellStyles)) {
  45049. headerCellStyles = headerCellStyles.call(null, {
  45050. rowIndex,
  45051. columnIndex,
  45052. row,
  45053. column
  45054. });
  45055. }
  45056. const fixedStyle = getFixedColumnOffset(columnIndex, column.fixed, props.store, row);
  45057. ensurePosition(fixedStyle, "left");
  45058. ensurePosition(fixedStyle, "right");
  45059. return Object.assign({}, headerCellStyles, fixedStyle);
  45060. };
  45061. const getHeaderCellClass = (rowIndex, columnIndex, row, column) => {
  45062. const fixedClasses = getFixedColumnsClass(ns.b(), columnIndex, column.fixed, props.store, row);
  45063. const classes = [
  45064. column.id,
  45065. column.order,
  45066. column.headerAlign,
  45067. column.className,
  45068. column.labelClassName,
  45069. ...fixedClasses
  45070. ];
  45071. if (!column.children) {
  45072. classes.push("is-leaf");
  45073. }
  45074. if (column.sortable) {
  45075. classes.push("is-sortable");
  45076. }
  45077. const headerCellClassName = parent == null ? void 0 : parent.props.headerCellClassName;
  45078. if (isString$1(headerCellClassName)) {
  45079. classes.push(headerCellClassName);
  45080. } else if (isFunction$1(headerCellClassName)) {
  45081. classes.push(headerCellClassName.call(null, {
  45082. rowIndex,
  45083. columnIndex,
  45084. row,
  45085. column
  45086. }));
  45087. }
  45088. classes.push(ns.e("cell"));
  45089. return classes.filter((className) => Boolean(className)).join(" ");
  45090. };
  45091. return {
  45092. getHeaderRowStyle,
  45093. getHeaderRowClass,
  45094. getHeaderCellStyle,
  45095. getHeaderCellClass
  45096. };
  45097. }
  45098. const getAllColumns = (columns) => {
  45099. const result = [];
  45100. columns.forEach((column) => {
  45101. if (column.children) {
  45102. result.push(column);
  45103. result.push.apply(result, getAllColumns(column.children));
  45104. } else {
  45105. result.push(column);
  45106. }
  45107. });
  45108. return result;
  45109. };
  45110. const convertToRows = (originColumns) => {
  45111. let maxLevel = 1;
  45112. const traverse = (column, parent) => {
  45113. if (parent) {
  45114. column.level = parent.level + 1;
  45115. if (maxLevel < column.level) {
  45116. maxLevel = column.level;
  45117. }
  45118. }
  45119. if (column.children) {
  45120. let colSpan = 0;
  45121. column.children.forEach((subColumn) => {
  45122. traverse(subColumn, column);
  45123. colSpan += subColumn.colSpan;
  45124. });
  45125. column.colSpan = colSpan;
  45126. } else {
  45127. column.colSpan = 1;
  45128. }
  45129. };
  45130. originColumns.forEach((column) => {
  45131. column.level = 1;
  45132. traverse(column, void 0);
  45133. });
  45134. const rows = [];
  45135. for (let i = 0; i < maxLevel; i++) {
  45136. rows.push([]);
  45137. }
  45138. const allColumns = getAllColumns(originColumns);
  45139. allColumns.forEach((column) => {
  45140. if (!column.children) {
  45141. column.rowSpan = maxLevel - column.level + 1;
  45142. } else {
  45143. column.rowSpan = 1;
  45144. column.children.forEach((col) => col.isSubColumn = true);
  45145. }
  45146. rows[column.level - 1].push(column);
  45147. });
  45148. return rows;
  45149. };
  45150. function useUtils$1(props) {
  45151. const parent = inject(TABLE_INJECTION_KEY);
  45152. const columnRows = computed(() => {
  45153. return convertToRows(props.store.states.originColumns.value);
  45154. });
  45155. const isGroup = computed(() => {
  45156. const result = columnRows.value.length > 1;
  45157. if (result && parent) {
  45158. parent.state.isGroup.value = true;
  45159. }
  45160. return result;
  45161. });
  45162. const toggleAllSelection = (event) => {
  45163. event.stopPropagation();
  45164. parent == null ? void 0 : parent.store.commit("toggleAllSelection");
  45165. };
  45166. return {
  45167. isGroup,
  45168. toggleAllSelection,
  45169. columnRows
  45170. };
  45171. }
  45172. var TableHeader = defineComponent({
  45173. name: "ElTableHeader",
  45174. components: {
  45175. ElCheckbox
  45176. },
  45177. props: {
  45178. fixed: {
  45179. type: String,
  45180. default: ""
  45181. },
  45182. store: {
  45183. required: true,
  45184. type: Object
  45185. },
  45186. border: Boolean,
  45187. defaultSort: {
  45188. type: Object,
  45189. default: () => {
  45190. return {
  45191. prop: "",
  45192. order: ""
  45193. };
  45194. }
  45195. },
  45196. appendFilterPanelTo: {
  45197. type: String
  45198. },
  45199. allowDragLastColumn: {
  45200. type: Boolean
  45201. }
  45202. },
  45203. setup(props, { emit }) {
  45204. const instance = getCurrentInstance();
  45205. const parent = inject(TABLE_INJECTION_KEY);
  45206. const ns = useNamespace("table");
  45207. const filterPanels = ref({});
  45208. const { onColumnsChange, onScrollableChange } = useLayoutObserver(parent);
  45209. const isTableLayoutAuto = (parent == null ? void 0 : parent.props.tableLayout) === "auto";
  45210. const saveIndexSelection = reactive(/* @__PURE__ */ new Map());
  45211. const theadRef = ref();
  45212. const updateFixedColumnStyle = () => {
  45213. setTimeout(() => {
  45214. if (saveIndexSelection.size > 0) {
  45215. saveIndexSelection.forEach((column, key) => {
  45216. const el = theadRef.value.querySelector(`.${key.replace(/\s/g, ".")}`);
  45217. if (el) {
  45218. const width = el.getBoundingClientRect().width;
  45219. column.width = width;
  45220. }
  45221. });
  45222. saveIndexSelection.clear();
  45223. }
  45224. });
  45225. };
  45226. watch(saveIndexSelection, updateFixedColumnStyle);
  45227. onMounted(async () => {
  45228. await nextTick();
  45229. await nextTick();
  45230. const { prop, order } = props.defaultSort;
  45231. parent == null ? void 0 : parent.store.commit("sort", { prop, order, init: true });
  45232. updateFixedColumnStyle();
  45233. });
  45234. const {
  45235. handleHeaderClick,
  45236. handleHeaderContextMenu,
  45237. handleMouseDown,
  45238. handleMouseMove,
  45239. handleMouseOut,
  45240. handleSortClick,
  45241. handleFilterClick
  45242. } = useEvent(props, emit);
  45243. const {
  45244. getHeaderRowStyle,
  45245. getHeaderRowClass,
  45246. getHeaderCellStyle,
  45247. getHeaderCellClass
  45248. } = useStyle$2(props);
  45249. const { isGroup, toggleAllSelection, columnRows } = useUtils$1(props);
  45250. instance.state = {
  45251. onColumnsChange,
  45252. onScrollableChange
  45253. };
  45254. instance.filterPanels = filterPanels;
  45255. return {
  45256. ns,
  45257. filterPanels,
  45258. onColumnsChange,
  45259. onScrollableChange,
  45260. columnRows,
  45261. getHeaderRowClass,
  45262. getHeaderRowStyle,
  45263. getHeaderCellClass,
  45264. getHeaderCellStyle,
  45265. handleHeaderClick,
  45266. handleHeaderContextMenu,
  45267. handleMouseDown,
  45268. handleMouseMove,
  45269. handleMouseOut,
  45270. handleSortClick,
  45271. handleFilterClick,
  45272. isGroup,
  45273. toggleAllSelection,
  45274. saveIndexSelection,
  45275. isTableLayoutAuto,
  45276. theadRef,
  45277. updateFixedColumnStyle
  45278. };
  45279. },
  45280. render() {
  45281. const {
  45282. ns,
  45283. isGroup,
  45284. columnRows,
  45285. getHeaderCellStyle,
  45286. getHeaderCellClass,
  45287. getHeaderRowClass,
  45288. getHeaderRowStyle,
  45289. handleHeaderClick,
  45290. handleHeaderContextMenu,
  45291. handleMouseDown,
  45292. handleMouseMove,
  45293. handleSortClick,
  45294. handleMouseOut,
  45295. store,
  45296. $parent,
  45297. saveIndexSelection,
  45298. isTableLayoutAuto
  45299. } = this;
  45300. let rowSpan = 1;
  45301. return h$1("thead", {
  45302. ref: "theadRef",
  45303. class: { [ns.is("group")]: isGroup }
  45304. }, columnRows.map((subColumns, rowIndex) => h$1("tr", {
  45305. class: getHeaderRowClass(rowIndex),
  45306. key: rowIndex,
  45307. style: getHeaderRowStyle(rowIndex)
  45308. }, subColumns.map((column, cellIndex) => {
  45309. if (column.rowSpan > rowSpan) {
  45310. rowSpan = column.rowSpan;
  45311. }
  45312. const _class = getHeaderCellClass(rowIndex, cellIndex, subColumns, column);
  45313. if (isTableLayoutAuto && column.fixed) {
  45314. saveIndexSelection.set(_class, column);
  45315. }
  45316. return h$1("th", {
  45317. class: _class,
  45318. colspan: column.colSpan,
  45319. key: `${column.id}-thead`,
  45320. rowspan: column.rowSpan,
  45321. style: getHeaderCellStyle(rowIndex, cellIndex, subColumns, column),
  45322. onClick: ($event) => {
  45323. if ($event.currentTarget.classList.contains("noclick")) {
  45324. return;
  45325. }
  45326. handleHeaderClick($event, column);
  45327. },
  45328. onContextmenu: ($event) => handleHeaderContextMenu($event, column),
  45329. onMousedown: ($event) => handleMouseDown($event, column),
  45330. onMousemove: ($event) => handleMouseMove($event, column),
  45331. onMouseout: handleMouseOut
  45332. }, [
  45333. h$1("div", {
  45334. class: [
  45335. "cell",
  45336. column.filteredValue && column.filteredValue.length > 0 ? "highlight" : ""
  45337. ]
  45338. }, [
  45339. column.renderHeader ? column.renderHeader({
  45340. column,
  45341. $index: cellIndex,
  45342. store,
  45343. _self: $parent
  45344. }) : column.label,
  45345. column.sortable && h$1("span", {
  45346. onClick: ($event) => handleSortClick($event, column),
  45347. class: "caret-wrapper"
  45348. }, [
  45349. h$1("i", {
  45350. onClick: ($event) => handleSortClick($event, column, "ascending"),
  45351. class: "sort-caret ascending"
  45352. }),
  45353. h$1("i", {
  45354. onClick: ($event) => handleSortClick($event, column, "descending"),
  45355. class: "sort-caret descending"
  45356. })
  45357. ]),
  45358. column.filterable && h$1(FilterPanel, {
  45359. store,
  45360. placement: column.filterPlacement || "bottom-start",
  45361. appendTo: $parent.appendFilterPanelTo,
  45362. column,
  45363. upDataColumn: (key, value) => {
  45364. column[key] = value;
  45365. }
  45366. }, {
  45367. "filter-icon": () => column.renderFilterIcon ? column.renderFilterIcon({
  45368. filterOpened: column.filterOpened
  45369. }) : null
  45370. })
  45371. ])
  45372. ]);
  45373. }))));
  45374. }
  45375. });
  45376. function isGreaterThan(a, b, epsilon = 0.03) {
  45377. return a - b > epsilon;
  45378. }
  45379. function useEvents(props) {
  45380. const parent = inject(TABLE_INJECTION_KEY);
  45381. const tooltipContent = ref("");
  45382. const tooltipTrigger = ref(h$1("div"));
  45383. const handleEvent = (event, row, name) => {
  45384. var _a;
  45385. const table = parent;
  45386. const cell = getCell(event);
  45387. let column;
  45388. const namespace = (_a = table == null ? void 0 : table.vnode.el) == null ? void 0 : _a.dataset.prefix;
  45389. if (cell) {
  45390. column = getColumnByCell({
  45391. columns: props.store.states.columns.value
  45392. }, cell, namespace);
  45393. if (column) {
  45394. table == null ? void 0 : table.emit(`cell-${name}`, row, column, cell, event);
  45395. }
  45396. }
  45397. table == null ? void 0 : table.emit(`row-${name}`, row, column, event);
  45398. };
  45399. const handleDoubleClick = (event, row) => {
  45400. handleEvent(event, row, "dblclick");
  45401. };
  45402. const handleClick = (event, row) => {
  45403. props.store.commit("setCurrentRow", row);
  45404. handleEvent(event, row, "click");
  45405. };
  45406. const handleContextMenu = (event, row) => {
  45407. handleEvent(event, row, "contextmenu");
  45408. };
  45409. const handleMouseEnter = debounce((index) => {
  45410. props.store.commit("setHoverRow", index);
  45411. }, 30);
  45412. const handleMouseLeave = debounce(() => {
  45413. props.store.commit("setHoverRow", null);
  45414. }, 30);
  45415. const getPadding = (el) => {
  45416. const style = window.getComputedStyle(el, null);
  45417. const paddingLeft = Number.parseInt(style.paddingLeft, 10) || 0;
  45418. const paddingRight = Number.parseInt(style.paddingRight, 10) || 0;
  45419. const paddingTop = Number.parseInt(style.paddingTop, 10) || 0;
  45420. const paddingBottom = Number.parseInt(style.paddingBottom, 10) || 0;
  45421. return {
  45422. left: paddingLeft,
  45423. right: paddingRight,
  45424. top: paddingTop,
  45425. bottom: paddingBottom
  45426. };
  45427. };
  45428. const toggleRowClassByCell = (rowSpan, event, toggle) => {
  45429. let node = event.target.parentNode;
  45430. while (rowSpan > 1) {
  45431. node = node == null ? void 0 : node.nextSibling;
  45432. if (!node || node.nodeName !== "TR")
  45433. break;
  45434. toggle(node, "hover-row hover-fixed-row");
  45435. rowSpan--;
  45436. }
  45437. };
  45438. const handleCellMouseEnter = (event, row, tooltipOptions) => {
  45439. var _a, _b, _c;
  45440. const table = parent;
  45441. const cell = getCell(event);
  45442. const namespace = (_a = table == null ? void 0 : table.vnode.el) == null ? void 0 : _a.dataset.prefix;
  45443. let column;
  45444. if (cell) {
  45445. column = getColumnByCell({
  45446. columns: props.store.states.columns.value
  45447. }, cell, namespace);
  45448. if (cell.rowSpan > 1) {
  45449. toggleRowClassByCell(cell.rowSpan, event, addClass);
  45450. }
  45451. const hoverState = table.hoverState = { cell, column, row };
  45452. table == null ? void 0 : table.emit("cell-mouse-enter", hoverState.row, hoverState.column, hoverState.cell, event);
  45453. }
  45454. if (!tooltipOptions) {
  45455. return;
  45456. }
  45457. const cellChild = event.target.querySelector(".cell");
  45458. if (!(hasClass(cellChild, `${namespace}-tooltip`) && cellChild.childNodes.length)) {
  45459. return;
  45460. }
  45461. const range = document.createRange();
  45462. range.setStart(cellChild, 0);
  45463. range.setEnd(cellChild, cellChild.childNodes.length);
  45464. const { width: rangeWidth, height: rangeHeight } = range.getBoundingClientRect();
  45465. const { width: cellChildWidth, height: cellChildHeight } = cellChild.getBoundingClientRect();
  45466. const { top, left, right, bottom } = getPadding(cellChild);
  45467. const horizontalPadding = left + right;
  45468. const verticalPadding = top + bottom;
  45469. if (isGreaterThan(rangeWidth + horizontalPadding, cellChildWidth) || isGreaterThan(rangeHeight + verticalPadding, cellChildHeight) || isGreaterThan(cellChild.scrollWidth, cellChildWidth)) {
  45470. createTablePopper(tooltipOptions, cell.innerText || cell.textContent, row, column, cell, table);
  45471. } else if (((_b = removePopper) == null ? void 0 : _b.trigger) === cell) {
  45472. (_c = removePopper) == null ? void 0 : _c();
  45473. }
  45474. };
  45475. const handleCellMouseLeave = (event) => {
  45476. const cell = getCell(event);
  45477. if (!cell)
  45478. return;
  45479. if (cell.rowSpan > 1) {
  45480. toggleRowClassByCell(cell.rowSpan, event, removeClass);
  45481. }
  45482. const oldHoverState = parent == null ? void 0 : parent.hoverState;
  45483. 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);
  45484. };
  45485. return {
  45486. handleDoubleClick,
  45487. handleClick,
  45488. handleContextMenu,
  45489. handleMouseEnter,
  45490. handleMouseLeave,
  45491. handleCellMouseEnter,
  45492. handleCellMouseLeave,
  45493. tooltipContent,
  45494. tooltipTrigger
  45495. };
  45496. }
  45497. function useStyles$1(props) {
  45498. const parent = inject(TABLE_INJECTION_KEY);
  45499. const ns = useNamespace("table");
  45500. const getRowStyle = (row, rowIndex) => {
  45501. const rowStyle = parent == null ? void 0 : parent.props.rowStyle;
  45502. if (isFunction$1(rowStyle)) {
  45503. return rowStyle.call(null, {
  45504. row,
  45505. rowIndex
  45506. });
  45507. }
  45508. return rowStyle || null;
  45509. };
  45510. const getRowClass = (row, rowIndex) => {
  45511. const classes = [ns.e("row")];
  45512. if ((parent == null ? void 0 : parent.props.highlightCurrentRow) && row === props.store.states.currentRow.value) {
  45513. classes.push("current-row");
  45514. }
  45515. if (props.stripe && rowIndex % 2 === 1) {
  45516. classes.push(ns.em("row", "striped"));
  45517. }
  45518. const rowClassName = parent == null ? void 0 : parent.props.rowClassName;
  45519. if (isString$1(rowClassName)) {
  45520. classes.push(rowClassName);
  45521. } else if (isFunction$1(rowClassName)) {
  45522. classes.push(rowClassName.call(null, {
  45523. row,
  45524. rowIndex
  45525. }));
  45526. }
  45527. return classes;
  45528. };
  45529. const getCellStyle = (rowIndex, columnIndex, row, column) => {
  45530. const cellStyle = parent == null ? void 0 : parent.props.cellStyle;
  45531. let cellStyles = cellStyle != null ? cellStyle : {};
  45532. if (isFunction$1(cellStyle)) {
  45533. cellStyles = cellStyle.call(null, {
  45534. rowIndex,
  45535. columnIndex,
  45536. row,
  45537. column
  45538. });
  45539. }
  45540. const fixedStyle = getFixedColumnOffset(columnIndex, props == null ? void 0 : props.fixed, props.store);
  45541. ensurePosition(fixedStyle, "left");
  45542. ensurePosition(fixedStyle, "right");
  45543. return Object.assign({}, cellStyles, fixedStyle);
  45544. };
  45545. const getCellClass = (rowIndex, columnIndex, row, column, offset) => {
  45546. const fixedClasses = getFixedColumnsClass(ns.b(), columnIndex, props == null ? void 0 : props.fixed, props.store, void 0, offset);
  45547. const classes = [column.id, column.align, column.className, ...fixedClasses];
  45548. const cellClassName = parent == null ? void 0 : parent.props.cellClassName;
  45549. if (isString$1(cellClassName)) {
  45550. classes.push(cellClassName);
  45551. } else if (isFunction$1(cellClassName)) {
  45552. classes.push(cellClassName.call(null, {
  45553. rowIndex,
  45554. columnIndex,
  45555. row,
  45556. column
  45557. }));
  45558. }
  45559. classes.push(ns.e("cell"));
  45560. return classes.filter((className) => Boolean(className)).join(" ");
  45561. };
  45562. const getSpan = (row, column, rowIndex, columnIndex) => {
  45563. let rowspan = 1;
  45564. let colspan = 1;
  45565. const fn = parent == null ? void 0 : parent.props.spanMethod;
  45566. if (isFunction$1(fn)) {
  45567. const result = fn({
  45568. row,
  45569. column,
  45570. rowIndex,
  45571. columnIndex
  45572. });
  45573. if (isArray$1(result)) {
  45574. rowspan = result[0];
  45575. colspan = result[1];
  45576. } else if (isObject$1(result)) {
  45577. rowspan = result.rowspan;
  45578. colspan = result.colspan;
  45579. }
  45580. }
  45581. return { rowspan, colspan };
  45582. };
  45583. const getColspanRealWidth = (columns, colspan, index) => {
  45584. if (colspan < 1) {
  45585. return columns[index].realWidth;
  45586. }
  45587. const widthArr = columns.map(({ realWidth, width }) => realWidth || width).slice(index, index + colspan);
  45588. return Number(widthArr.reduce((acc, width) => Number(acc) + Number(width), -1));
  45589. };
  45590. return {
  45591. getRowStyle,
  45592. getRowClass,
  45593. getCellStyle,
  45594. getCellClass,
  45595. getSpan,
  45596. getColspanRealWidth
  45597. };
  45598. }
  45599. const __default__$v = defineComponent({
  45600. name: "TableTdWrapper"
  45601. });
  45602. const _sfc_main$B = /* @__PURE__ */ defineComponent({
  45603. ...__default__$v,
  45604. props: {
  45605. colspan: {
  45606. type: Number,
  45607. default: 1
  45608. },
  45609. rowspan: {
  45610. type: Number,
  45611. default: 1
  45612. }
  45613. },
  45614. setup(__props) {
  45615. return (_ctx, _cache) => {
  45616. return openBlock(), createElementBlock("td", {
  45617. colspan: __props.colspan,
  45618. rowspan: __props.rowspan
  45619. }, [
  45620. renderSlot(_ctx.$slots, "default")
  45621. ], 8, ["colspan", "rowspan"]);
  45622. };
  45623. }
  45624. });
  45625. var TdWrapper = /* @__PURE__ */ _export_sfc(_sfc_main$B, [["__file", "td-wrapper.vue"]]);
  45626. function useRender$1(props) {
  45627. const parent = inject(TABLE_INJECTION_KEY);
  45628. const ns = useNamespace("table");
  45629. const {
  45630. handleDoubleClick,
  45631. handleClick,
  45632. handleContextMenu,
  45633. handleMouseEnter,
  45634. handleMouseLeave,
  45635. handleCellMouseEnter,
  45636. handleCellMouseLeave,
  45637. tooltipContent,
  45638. tooltipTrigger
  45639. } = useEvents(props);
  45640. const {
  45641. getRowStyle,
  45642. getRowClass,
  45643. getCellStyle,
  45644. getCellClass,
  45645. getSpan,
  45646. getColspanRealWidth
  45647. } = useStyles$1(props);
  45648. const firstDefaultColumnIndex = computed(() => {
  45649. return props.store.states.columns.value.findIndex(({ type }) => type === "default");
  45650. });
  45651. const getKeyOfRow = (row, index) => {
  45652. const rowKey = parent.props.rowKey;
  45653. if (rowKey) {
  45654. return getRowIdentity(row, rowKey);
  45655. }
  45656. return index;
  45657. };
  45658. const rowRender = (row, $index, treeRowData, expanded = false) => {
  45659. const { tooltipEffect, tooltipOptions, store } = props;
  45660. const { indent, columns } = store.states;
  45661. const rowClasses = getRowClass(row, $index);
  45662. let display = true;
  45663. if (treeRowData) {
  45664. rowClasses.push(ns.em("row", `level-${treeRowData.level}`));
  45665. display = treeRowData.display;
  45666. }
  45667. const displayStyle = display ? null : { display: "none" };
  45668. return h$1("tr", {
  45669. style: [displayStyle, getRowStyle(row, $index)],
  45670. class: rowClasses,
  45671. key: getKeyOfRow(row, $index),
  45672. onDblclick: ($event) => handleDoubleClick($event, row),
  45673. onClick: ($event) => handleClick($event, row),
  45674. onContextmenu: ($event) => handleContextMenu($event, row),
  45675. onMouseenter: () => handleMouseEnter($index),
  45676. onMouseleave: handleMouseLeave
  45677. }, columns.value.map((column, cellIndex) => {
  45678. const { rowspan, colspan } = getSpan(row, column, $index, cellIndex);
  45679. if (!rowspan || !colspan) {
  45680. return null;
  45681. }
  45682. const columnData = Object.assign({}, column);
  45683. columnData.realWidth = getColspanRealWidth(columns.value, colspan, cellIndex);
  45684. const data = {
  45685. store: props.store,
  45686. _self: props.context || parent,
  45687. column: columnData,
  45688. row,
  45689. $index,
  45690. cellIndex,
  45691. expanded
  45692. };
  45693. if (cellIndex === firstDefaultColumnIndex.value && treeRowData) {
  45694. data.treeNode = {
  45695. indent: treeRowData.level * indent.value,
  45696. level: treeRowData.level
  45697. };
  45698. if (isBoolean(treeRowData.expanded)) {
  45699. data.treeNode.expanded = treeRowData.expanded;
  45700. if ("loading" in treeRowData) {
  45701. data.treeNode.loading = treeRowData.loading;
  45702. }
  45703. if ("noLazyChildren" in treeRowData) {
  45704. data.treeNode.noLazyChildren = treeRowData.noLazyChildren;
  45705. }
  45706. }
  45707. }
  45708. const baseKey = `${getKeyOfRow(row, $index)},${cellIndex}`;
  45709. const patchKey = columnData.columnKey || columnData.rawColumnKey || "";
  45710. const mergedTooltipOptions = column.showOverflowTooltip && merge({
  45711. effect: tooltipEffect
  45712. }, tooltipOptions, column.showOverflowTooltip);
  45713. return h$1(TdWrapper, {
  45714. style: getCellStyle($index, cellIndex, row, column),
  45715. class: getCellClass($index, cellIndex, row, column, colspan - 1),
  45716. key: `${patchKey}${baseKey}`,
  45717. rowspan,
  45718. colspan,
  45719. onMouseenter: ($event) => handleCellMouseEnter($event, row, mergedTooltipOptions),
  45720. onMouseleave: handleCellMouseLeave
  45721. }, {
  45722. default: () => cellChildren(cellIndex, column, data)
  45723. });
  45724. }));
  45725. };
  45726. const cellChildren = (cellIndex, column, data) => {
  45727. return column.renderCell(data);
  45728. };
  45729. const wrappedRowRender = (row, $index) => {
  45730. const store = props.store;
  45731. const { isRowExpanded, assertRowKey } = store;
  45732. const { treeData, lazyTreeNodeMap, childrenColumnName, rowKey } = store.states;
  45733. const columns = store.states.columns.value;
  45734. const hasExpandColumn = columns.some(({ type }) => type === "expand");
  45735. if (hasExpandColumn) {
  45736. const expanded = isRowExpanded(row);
  45737. const tr = rowRender(row, $index, void 0, expanded);
  45738. const renderExpanded = parent.renderExpanded;
  45739. if (!renderExpanded) {
  45740. console.error("[Element Error]renderExpanded is required.");
  45741. return tr;
  45742. }
  45743. const rows = [[tr]];
  45744. if (parent.props.preserveExpandedContent || expanded) {
  45745. rows[0].push(h$1("tr", {
  45746. key: `expanded-row__${tr.key}`,
  45747. style: { display: expanded ? "" : "none" }
  45748. }, [
  45749. h$1("td", {
  45750. colspan: columns.length,
  45751. class: `${ns.e("cell")} ${ns.e("expanded-cell")}`
  45752. }, [renderExpanded({ row, $index, store, expanded })])
  45753. ]));
  45754. }
  45755. return rows;
  45756. } else if (Object.keys(treeData.value).length) {
  45757. assertRowKey();
  45758. const key = getRowIdentity(row, rowKey.value);
  45759. let cur = treeData.value[key];
  45760. let treeRowData = null;
  45761. if (cur) {
  45762. treeRowData = {
  45763. expanded: cur.expanded,
  45764. level: cur.level,
  45765. display: true
  45766. };
  45767. if (isBoolean(cur.lazy)) {
  45768. if (isBoolean(cur.loaded) && cur.loaded) {
  45769. treeRowData.noLazyChildren = !(cur.children && cur.children.length);
  45770. }
  45771. treeRowData.loading = cur.loading;
  45772. }
  45773. }
  45774. const tmp = [rowRender(row, $index, treeRowData)];
  45775. if (cur) {
  45776. let i = 0;
  45777. const traverse = (children, parent2) => {
  45778. if (!(children && children.length && parent2))
  45779. return;
  45780. children.forEach((node) => {
  45781. const innerTreeRowData = {
  45782. display: parent2.display && parent2.expanded,
  45783. level: parent2.level + 1,
  45784. expanded: false,
  45785. noLazyChildren: false,
  45786. loading: false
  45787. };
  45788. const childKey = getRowIdentity(node, rowKey.value);
  45789. if (isPropAbsent(childKey)) {
  45790. throw new Error("For nested data item, row-key is required.");
  45791. }
  45792. cur = { ...treeData.value[childKey] };
  45793. if (cur) {
  45794. innerTreeRowData.expanded = cur.expanded;
  45795. cur.level = cur.level || innerTreeRowData.level;
  45796. cur.display = !!(cur.expanded && innerTreeRowData.display);
  45797. if (isBoolean(cur.lazy)) {
  45798. if (isBoolean(cur.loaded) && cur.loaded) {
  45799. innerTreeRowData.noLazyChildren = !(cur.children && cur.children.length);
  45800. }
  45801. innerTreeRowData.loading = cur.loading;
  45802. }
  45803. }
  45804. i++;
  45805. tmp.push(rowRender(node, $index + i, innerTreeRowData));
  45806. if (cur) {
  45807. const nodes2 = lazyTreeNodeMap.value[childKey] || node[childrenColumnName.value];
  45808. traverse(nodes2, cur);
  45809. }
  45810. });
  45811. };
  45812. cur.display = true;
  45813. const nodes = lazyTreeNodeMap.value[key] || row[childrenColumnName.value];
  45814. traverse(nodes, cur);
  45815. }
  45816. return tmp;
  45817. } else {
  45818. return rowRender(row, $index, void 0);
  45819. }
  45820. };
  45821. return {
  45822. wrappedRowRender,
  45823. tooltipContent,
  45824. tooltipTrigger
  45825. };
  45826. }
  45827. const defaultProps$3 = {
  45828. store: {
  45829. required: true,
  45830. type: Object
  45831. },
  45832. stripe: Boolean,
  45833. tooltipEffect: String,
  45834. tooltipOptions: {
  45835. type: Object
  45836. },
  45837. context: {
  45838. default: () => ({}),
  45839. type: Object
  45840. },
  45841. rowClassName: [String, Function],
  45842. rowStyle: [Object, Function],
  45843. fixed: {
  45844. type: String,
  45845. default: ""
  45846. },
  45847. highlight: Boolean
  45848. };
  45849. var defaultProps$4 = defaultProps$3;
  45850. var TableBody = defineComponent({
  45851. name: "ElTableBody",
  45852. props: defaultProps$4,
  45853. setup(props) {
  45854. const instance = getCurrentInstance();
  45855. const parent = inject(TABLE_INJECTION_KEY);
  45856. const ns = useNamespace("table");
  45857. const { wrappedRowRender, tooltipContent, tooltipTrigger } = useRender$1(props);
  45858. const { onColumnsChange, onScrollableChange } = useLayoutObserver(parent);
  45859. const hoveredCellList = [];
  45860. watch(props.store.states.hoverRow, (newVal, oldVal) => {
  45861. var _a;
  45862. const el = instance == null ? void 0 : instance.vnode.el;
  45863. const rows = Array.from((el == null ? void 0 : el.children) || []).filter((e) => e == null ? void 0 : e.classList.contains(`${ns.e("row")}`));
  45864. let rowNum = newVal;
  45865. const childNodes = (_a = rows[rowNum]) == null ? void 0 : _a.childNodes;
  45866. if (childNodes == null ? void 0 : childNodes.length) {
  45867. let control = 0;
  45868. const indexes = Array.from(childNodes).reduce((acc, item, index) => {
  45869. var _a2, _b;
  45870. if (((_a2 = childNodes[index]) == null ? void 0 : _a2.colSpan) > 1) {
  45871. control = (_b = childNodes[index]) == null ? void 0 : _b.colSpan;
  45872. }
  45873. if (item.nodeName !== "TD" && control === 0) {
  45874. acc.push(index);
  45875. }
  45876. control > 0 && control--;
  45877. return acc;
  45878. }, []);
  45879. indexes.forEach((rowIndex) => {
  45880. var _a2;
  45881. rowNum = newVal;
  45882. while (rowNum > 0) {
  45883. const preChildNodes = (_a2 = rows[rowNum - 1]) == null ? void 0 : _a2.childNodes;
  45884. if (preChildNodes[rowIndex] && preChildNodes[rowIndex].nodeName === "TD" && preChildNodes[rowIndex].rowSpan > 1) {
  45885. addClass(preChildNodes[rowIndex], "hover-cell");
  45886. hoveredCellList.push(preChildNodes[rowIndex]);
  45887. break;
  45888. }
  45889. rowNum--;
  45890. }
  45891. });
  45892. } else {
  45893. hoveredCellList.forEach((item) => removeClass(item, "hover-cell"));
  45894. hoveredCellList.length = 0;
  45895. }
  45896. if (!props.store.states.isComplex.value || !isClient)
  45897. return;
  45898. rAF(() => {
  45899. const oldRow = rows[oldVal];
  45900. const newRow = rows[newVal];
  45901. if (oldRow && !oldRow.classList.contains("hover-fixed-row")) {
  45902. removeClass(oldRow, "hover-row");
  45903. }
  45904. if (newRow) {
  45905. addClass(newRow, "hover-row");
  45906. }
  45907. });
  45908. });
  45909. onUnmounted(() => {
  45910. var _a;
  45911. (_a = removePopper) == null ? void 0 : _a();
  45912. });
  45913. return {
  45914. ns,
  45915. onColumnsChange,
  45916. onScrollableChange,
  45917. wrappedRowRender,
  45918. tooltipContent,
  45919. tooltipTrigger
  45920. };
  45921. },
  45922. render() {
  45923. const { wrappedRowRender, store } = this;
  45924. const data = store.states.data.value || [];
  45925. return h$1("tbody", { tabIndex: -1 }, [
  45926. data.reduce((acc, row) => {
  45927. return acc.concat(wrappedRowRender(row, acc.length));
  45928. }, [])
  45929. ]);
  45930. }
  45931. });
  45932. function useMapState() {
  45933. const table = inject(TABLE_INJECTION_KEY);
  45934. const store = table == null ? void 0 : table.store;
  45935. const leftFixedLeafCount = computed(() => {
  45936. return store.states.fixedLeafColumnsLength.value;
  45937. });
  45938. const rightFixedLeafCount = computed(() => {
  45939. return store.states.rightFixedColumns.value.length;
  45940. });
  45941. const columnsCount = computed(() => {
  45942. return store.states.columns.value.length;
  45943. });
  45944. const leftFixedCount = computed(() => {
  45945. return store.states.fixedColumns.value.length;
  45946. });
  45947. const rightFixedCount = computed(() => {
  45948. return store.states.rightFixedColumns.value.length;
  45949. });
  45950. return {
  45951. leftFixedLeafCount,
  45952. rightFixedLeafCount,
  45953. columnsCount,
  45954. leftFixedCount,
  45955. rightFixedCount,
  45956. columns: store.states.columns
  45957. };
  45958. }
  45959. function useStyle$1(props) {
  45960. const { columns } = useMapState();
  45961. const ns = useNamespace("table");
  45962. const getCellClasses = (columns2, cellIndex) => {
  45963. const column = columns2[cellIndex];
  45964. const classes = [
  45965. ns.e("cell"),
  45966. column.id,
  45967. column.align,
  45968. column.labelClassName,
  45969. ...getFixedColumnsClass(ns.b(), cellIndex, column.fixed, props.store)
  45970. ];
  45971. if (column.className) {
  45972. classes.push(column.className);
  45973. }
  45974. if (!column.children) {
  45975. classes.push(ns.is("leaf"));
  45976. }
  45977. return classes;
  45978. };
  45979. const getCellStyles = (column, cellIndex) => {
  45980. const fixedStyle = getFixedColumnOffset(cellIndex, column.fixed, props.store);
  45981. ensurePosition(fixedStyle, "left");
  45982. ensurePosition(fixedStyle, "right");
  45983. return fixedStyle;
  45984. };
  45985. return {
  45986. getCellClasses,
  45987. getCellStyles,
  45988. columns
  45989. };
  45990. }
  45991. var TableFooter = defineComponent({
  45992. name: "ElTableFooter",
  45993. props: {
  45994. fixed: {
  45995. type: String,
  45996. default: ""
  45997. },
  45998. store: {
  45999. required: true,
  46000. type: Object
  46001. },
  46002. summaryMethod: Function,
  46003. sumText: String,
  46004. border: Boolean,
  46005. defaultSort: {
  46006. type: Object,
  46007. default: () => {
  46008. return {
  46009. prop: "",
  46010. order: ""
  46011. };
  46012. }
  46013. }
  46014. },
  46015. setup(props) {
  46016. const parent = inject(TABLE_INJECTION_KEY);
  46017. const ns = useNamespace("table");
  46018. const { getCellClasses, getCellStyles, columns } = useStyle$1(props);
  46019. const { onScrollableChange, onColumnsChange } = useLayoutObserver(parent);
  46020. return {
  46021. ns,
  46022. onScrollableChange,
  46023. onColumnsChange,
  46024. getCellClasses,
  46025. getCellStyles,
  46026. columns
  46027. };
  46028. },
  46029. render() {
  46030. const { columns, getCellStyles, getCellClasses, summaryMethod, sumText } = this;
  46031. const data = this.store.states.data.value;
  46032. let sums = [];
  46033. if (summaryMethod) {
  46034. sums = summaryMethod({
  46035. columns,
  46036. data
  46037. });
  46038. } else {
  46039. columns.forEach((column, index) => {
  46040. if (index === 0) {
  46041. sums[index] = sumText;
  46042. return;
  46043. }
  46044. const values = data.map((item) => Number(item[column.property]));
  46045. const precisions = [];
  46046. let notNumber = true;
  46047. values.forEach((value) => {
  46048. if (!Number.isNaN(+value)) {
  46049. notNumber = false;
  46050. const decimal = `${value}`.split(".")[1];
  46051. precisions.push(decimal ? decimal.length : 0);
  46052. }
  46053. });
  46054. const precision = Math.max.apply(null, precisions);
  46055. if (!notNumber) {
  46056. sums[index] = values.reduce((prev, curr) => {
  46057. const value = Number(curr);
  46058. if (!Number.isNaN(+value)) {
  46059. return Number.parseFloat((prev + curr).toFixed(Math.min(precision, 20)));
  46060. } else {
  46061. return prev;
  46062. }
  46063. }, 0);
  46064. } else {
  46065. sums[index] = "";
  46066. }
  46067. });
  46068. }
  46069. return h$1(h$1("tfoot", [
  46070. h$1("tr", {}, [
  46071. ...columns.map((column, cellIndex) => h$1("td", {
  46072. key: cellIndex,
  46073. colspan: column.colSpan,
  46074. rowspan: column.rowSpan,
  46075. class: getCellClasses(columns, cellIndex),
  46076. style: getCellStyles(column, cellIndex)
  46077. }, [
  46078. h$1("div", {
  46079. class: ["cell", column.labelClassName]
  46080. }, [sums[cellIndex]])
  46081. ]))
  46082. ])
  46083. ]));
  46084. }
  46085. });
  46086. function useUtils(store) {
  46087. const setCurrentRow = (row) => {
  46088. store.commit("setCurrentRow", row);
  46089. };
  46090. const getSelectionRows = () => {
  46091. return store.getSelectionRows();
  46092. };
  46093. const toggleRowSelection = (row, selected, ignoreSelectable = true) => {
  46094. store.toggleRowSelection(row, selected, false, ignoreSelectable);
  46095. store.updateAllSelected();
  46096. };
  46097. const clearSelection = () => {
  46098. store.clearSelection();
  46099. };
  46100. const clearFilter = (columnKeys) => {
  46101. store.clearFilter(columnKeys);
  46102. };
  46103. const toggleAllSelection = () => {
  46104. store.commit("toggleAllSelection");
  46105. };
  46106. const toggleRowExpansion = (row, expanded) => {
  46107. store.toggleRowExpansionAdapter(row, expanded);
  46108. };
  46109. const clearSort = () => {
  46110. store.clearSort();
  46111. };
  46112. const sort = (prop, order) => {
  46113. store.commit("sort", { prop, order });
  46114. };
  46115. const updateKeyChildren = (key, data) => {
  46116. store.updateKeyChildren(key, data);
  46117. };
  46118. return {
  46119. setCurrentRow,
  46120. getSelectionRows,
  46121. toggleRowSelection,
  46122. clearSelection,
  46123. clearFilter,
  46124. toggleAllSelection,
  46125. toggleRowExpansion,
  46126. clearSort,
  46127. sort,
  46128. updateKeyChildren
  46129. };
  46130. }
  46131. function useStyle(props, layout, store, table) {
  46132. const isHidden = ref(false);
  46133. const renderExpanded = ref(null);
  46134. const resizeProxyVisible = ref(false);
  46135. const setDragVisible = (visible) => {
  46136. resizeProxyVisible.value = visible;
  46137. };
  46138. const resizeState = ref({
  46139. width: null,
  46140. height: null,
  46141. headerHeight: null
  46142. });
  46143. const isGroup = ref(false);
  46144. const scrollbarViewStyle = {
  46145. display: "inline-block",
  46146. verticalAlign: "middle"
  46147. };
  46148. const tableWidth = ref();
  46149. const tableScrollHeight = ref(0);
  46150. const bodyScrollHeight = ref(0);
  46151. const headerScrollHeight = ref(0);
  46152. const footerScrollHeight = ref(0);
  46153. const appendScrollHeight = ref(0);
  46154. watchEffect(() => {
  46155. layout.setHeight(props.height);
  46156. });
  46157. watchEffect(() => {
  46158. layout.setMaxHeight(props.maxHeight);
  46159. });
  46160. watch(() => [props.currentRowKey, store.states.rowKey], ([currentRowKey, rowKey]) => {
  46161. if (!unref(rowKey) || !unref(currentRowKey))
  46162. return;
  46163. store.setCurrentRowKey(`${currentRowKey}`);
  46164. }, {
  46165. immediate: true
  46166. });
  46167. watch(() => props.data, (data) => {
  46168. table.store.commit("setData", data);
  46169. }, {
  46170. immediate: true,
  46171. deep: true
  46172. });
  46173. watchEffect(() => {
  46174. if (props.expandRowKeys) {
  46175. store.setExpandRowKeysAdapter(props.expandRowKeys);
  46176. }
  46177. });
  46178. const handleMouseLeave = () => {
  46179. table.store.commit("setHoverRow", null);
  46180. if (table.hoverState)
  46181. table.hoverState = null;
  46182. };
  46183. const handleHeaderFooterMousewheel = (event, data) => {
  46184. const { pixelX, pixelY } = data;
  46185. if (Math.abs(pixelX) >= Math.abs(pixelY)) {
  46186. table.refs.bodyWrapper.scrollLeft += data.pixelX / 5;
  46187. }
  46188. };
  46189. const shouldUpdateHeight = computed(() => {
  46190. return props.height || props.maxHeight || store.states.fixedColumns.value.length > 0 || store.states.rightFixedColumns.value.length > 0;
  46191. });
  46192. const tableBodyStyles = computed(() => {
  46193. return {
  46194. width: layout.bodyWidth.value ? `${layout.bodyWidth.value}px` : ""
  46195. };
  46196. });
  46197. const doLayout = () => {
  46198. if (shouldUpdateHeight.value) {
  46199. layout.updateElsHeight();
  46200. }
  46201. layout.updateColumnsWidth();
  46202. if (typeof window === "undefined")
  46203. return;
  46204. requestAnimationFrame(syncPosition);
  46205. };
  46206. onMounted(async () => {
  46207. await nextTick();
  46208. store.updateColumns();
  46209. bindEvents();
  46210. requestAnimationFrame(doLayout);
  46211. const el = table.vnode.el;
  46212. const tableHeader = table.refs.headerWrapper;
  46213. if (props.flexible && el && el.parentElement) {
  46214. el.parentElement.style.minWidth = "0";
  46215. }
  46216. resizeState.value = {
  46217. width: tableWidth.value = el.offsetWidth,
  46218. height: el.offsetHeight,
  46219. headerHeight: props.showHeader && tableHeader ? tableHeader.offsetHeight : null
  46220. };
  46221. store.states.columns.value.forEach((column) => {
  46222. if (column.filteredValue && column.filteredValue.length) {
  46223. table.store.commit("filterChange", {
  46224. column,
  46225. values: column.filteredValue,
  46226. silent: true
  46227. });
  46228. }
  46229. });
  46230. table.$ready = true;
  46231. });
  46232. const setScrollClassByEl = (el, className) => {
  46233. if (!el)
  46234. return;
  46235. const classList = Array.from(el.classList).filter((item) => !item.startsWith("is-scrolling-"));
  46236. classList.push(layout.scrollX.value ? className : "is-scrolling-none");
  46237. el.className = classList.join(" ");
  46238. };
  46239. const setScrollClass = (className) => {
  46240. const { tableWrapper } = table.refs;
  46241. setScrollClassByEl(tableWrapper, className);
  46242. };
  46243. const hasScrollClass = (className) => {
  46244. const { tableWrapper } = table.refs;
  46245. return !!(tableWrapper && tableWrapper.classList.contains(className));
  46246. };
  46247. const syncPosition = function() {
  46248. if (!table.refs.scrollBarRef)
  46249. return;
  46250. if (!layout.scrollX.value) {
  46251. const scrollingNoneClass = "is-scrolling-none";
  46252. if (!hasScrollClass(scrollingNoneClass)) {
  46253. setScrollClass(scrollingNoneClass);
  46254. }
  46255. return;
  46256. }
  46257. const scrollContainer = table.refs.scrollBarRef.wrapRef;
  46258. if (!scrollContainer)
  46259. return;
  46260. const { scrollLeft, offsetWidth, scrollWidth } = scrollContainer;
  46261. const { headerWrapper, footerWrapper } = table.refs;
  46262. if (headerWrapper)
  46263. headerWrapper.scrollLeft = scrollLeft;
  46264. if (footerWrapper)
  46265. footerWrapper.scrollLeft = scrollLeft;
  46266. const maxScrollLeftPosition = scrollWidth - offsetWidth - 1;
  46267. if (scrollLeft >= maxScrollLeftPosition) {
  46268. setScrollClass("is-scrolling-right");
  46269. } else if (scrollLeft === 0) {
  46270. setScrollClass("is-scrolling-left");
  46271. } else {
  46272. setScrollClass("is-scrolling-middle");
  46273. }
  46274. };
  46275. const bindEvents = () => {
  46276. if (!table.refs.scrollBarRef)
  46277. return;
  46278. if (table.refs.scrollBarRef.wrapRef) {
  46279. useEventListener(table.refs.scrollBarRef.wrapRef, "scroll", syncPosition, {
  46280. passive: true
  46281. });
  46282. }
  46283. if (props.fit) {
  46284. useResizeObserver(table.vnode.el, resizeListener);
  46285. } else {
  46286. useEventListener(window, "resize", resizeListener);
  46287. }
  46288. useResizeObserver(table.refs.bodyWrapper, () => {
  46289. var _a, _b;
  46290. resizeListener();
  46291. (_b = (_a = table.refs) == null ? void 0 : _a.scrollBarRef) == null ? void 0 : _b.update();
  46292. });
  46293. };
  46294. const resizeListener = () => {
  46295. var _a, _b, _c, _d;
  46296. const el = table.vnode.el;
  46297. if (!table.$ready || !el)
  46298. return;
  46299. let shouldUpdateLayout = false;
  46300. const {
  46301. width: oldWidth,
  46302. height: oldHeight,
  46303. headerHeight: oldHeaderHeight
  46304. } = resizeState.value;
  46305. const width = tableWidth.value = el.offsetWidth;
  46306. if (oldWidth !== width) {
  46307. shouldUpdateLayout = true;
  46308. }
  46309. const height = el.offsetHeight;
  46310. if ((props.height || shouldUpdateHeight.value) && oldHeight !== height) {
  46311. shouldUpdateLayout = true;
  46312. }
  46313. const tableHeader = props.tableLayout === "fixed" ? table.refs.headerWrapper : (_a = table.refs.tableHeaderRef) == null ? void 0 : _a.$el;
  46314. if (props.showHeader && (tableHeader == null ? void 0 : tableHeader.offsetHeight) !== oldHeaderHeight) {
  46315. shouldUpdateLayout = true;
  46316. }
  46317. tableScrollHeight.value = ((_b = table.refs.tableWrapper) == null ? void 0 : _b.scrollHeight) || 0;
  46318. headerScrollHeight.value = (tableHeader == null ? void 0 : tableHeader.scrollHeight) || 0;
  46319. footerScrollHeight.value = ((_c = table.refs.footerWrapper) == null ? void 0 : _c.offsetHeight) || 0;
  46320. appendScrollHeight.value = ((_d = table.refs.appendWrapper) == null ? void 0 : _d.offsetHeight) || 0;
  46321. bodyScrollHeight.value = tableScrollHeight.value - headerScrollHeight.value - footerScrollHeight.value - appendScrollHeight.value;
  46322. if (shouldUpdateLayout) {
  46323. resizeState.value = {
  46324. width,
  46325. height,
  46326. headerHeight: props.showHeader && (tableHeader == null ? void 0 : tableHeader.offsetHeight) || 0
  46327. };
  46328. doLayout();
  46329. }
  46330. };
  46331. const tableSize = useFormSize();
  46332. const bodyWidth = computed(() => {
  46333. const { bodyWidth: bodyWidth_, scrollY, gutterWidth } = layout;
  46334. return bodyWidth_.value ? `${bodyWidth_.value - (scrollY.value ? gutterWidth : 0)}px` : "";
  46335. });
  46336. const tableLayout = computed(() => {
  46337. if (props.maxHeight)
  46338. return "fixed";
  46339. return props.tableLayout;
  46340. });
  46341. const emptyBlockStyle = computed(() => {
  46342. if (props.data && props.data.length)
  46343. return null;
  46344. let height = "100%";
  46345. if (props.height && bodyScrollHeight.value) {
  46346. height = `${bodyScrollHeight.value}px`;
  46347. }
  46348. const width = tableWidth.value;
  46349. return {
  46350. width: width ? `${width}px` : "",
  46351. height
  46352. };
  46353. });
  46354. const scrollbarStyle = computed(() => {
  46355. if (props.height) {
  46356. return {
  46357. height: "100%"
  46358. };
  46359. }
  46360. if (props.maxHeight) {
  46361. if (!Number.isNaN(Number(props.maxHeight))) {
  46362. return {
  46363. maxHeight: `${props.maxHeight - headerScrollHeight.value - footerScrollHeight.value}px`
  46364. };
  46365. } else {
  46366. return {
  46367. maxHeight: `calc(${props.maxHeight} - ${headerScrollHeight.value + footerScrollHeight.value}px)`
  46368. };
  46369. }
  46370. }
  46371. return {};
  46372. });
  46373. const handleFixedMousewheel = (event, data) => {
  46374. const bodyWrapper = table.refs.bodyWrapper;
  46375. if (Math.abs(data.spinY) > 0) {
  46376. const currentScrollTop = bodyWrapper.scrollTop;
  46377. if (data.pixelY < 0 && currentScrollTop !== 0) {
  46378. event.preventDefault();
  46379. }
  46380. if (data.pixelY > 0 && bodyWrapper.scrollHeight - bodyWrapper.clientHeight > currentScrollTop) {
  46381. event.preventDefault();
  46382. }
  46383. bodyWrapper.scrollTop += Math.ceil(data.pixelY / 5);
  46384. } else {
  46385. bodyWrapper.scrollLeft += Math.ceil(data.pixelX / 5);
  46386. }
  46387. };
  46388. return {
  46389. isHidden,
  46390. renderExpanded,
  46391. setDragVisible,
  46392. isGroup,
  46393. handleMouseLeave,
  46394. handleHeaderFooterMousewheel,
  46395. tableSize,
  46396. emptyBlockStyle,
  46397. handleFixedMousewheel,
  46398. resizeProxyVisible,
  46399. bodyWidth,
  46400. resizeState,
  46401. doLayout,
  46402. tableBodyStyles,
  46403. tableLayout,
  46404. scrollbarViewStyle,
  46405. scrollbarStyle
  46406. };
  46407. }
  46408. function useKeyRender(table) {
  46409. const observer = ref();
  46410. const initWatchDom = () => {
  46411. const el = table.vnode.el;
  46412. const columnsWrapper = el.querySelector(".hidden-columns");
  46413. const config = { childList: true, subtree: true };
  46414. const updateOrderFns = table.store.states.updateOrderFns;
  46415. observer.value = new MutationObserver(() => {
  46416. updateOrderFns.forEach((fn) => fn());
  46417. });
  46418. observer.value.observe(columnsWrapper, config);
  46419. };
  46420. onMounted(() => {
  46421. initWatchDom();
  46422. });
  46423. onUnmounted(() => {
  46424. var _a;
  46425. (_a = observer.value) == null ? void 0 : _a.disconnect();
  46426. });
  46427. }
  46428. var defaultProps$2 = {
  46429. data: {
  46430. type: Array,
  46431. default: () => []
  46432. },
  46433. size: useSizeProp,
  46434. width: [String, Number],
  46435. height: [String, Number],
  46436. maxHeight: [String, Number],
  46437. fit: {
  46438. type: Boolean,
  46439. default: true
  46440. },
  46441. stripe: Boolean,
  46442. border: Boolean,
  46443. rowKey: [String, Function],
  46444. showHeader: {
  46445. type: Boolean,
  46446. default: true
  46447. },
  46448. showSummary: Boolean,
  46449. sumText: String,
  46450. summaryMethod: Function,
  46451. rowClassName: [String, Function],
  46452. rowStyle: [Object, Function],
  46453. cellClassName: [String, Function],
  46454. cellStyle: [Object, Function],
  46455. headerRowClassName: [String, Function],
  46456. headerRowStyle: [Object, Function],
  46457. headerCellClassName: [String, Function],
  46458. headerCellStyle: [Object, Function],
  46459. highlightCurrentRow: Boolean,
  46460. currentRowKey: [String, Number],
  46461. emptyText: String,
  46462. expandRowKeys: Array,
  46463. defaultExpandAll: Boolean,
  46464. defaultSort: Object,
  46465. tooltipEffect: String,
  46466. tooltipOptions: Object,
  46467. spanMethod: Function,
  46468. selectOnIndeterminate: {
  46469. type: Boolean,
  46470. default: true
  46471. },
  46472. indent: {
  46473. type: Number,
  46474. default: 16
  46475. },
  46476. treeProps: {
  46477. type: Object,
  46478. default: () => {
  46479. return {
  46480. hasChildren: "hasChildren",
  46481. children: "children",
  46482. checkStrictly: false
  46483. };
  46484. }
  46485. },
  46486. lazy: Boolean,
  46487. load: Function,
  46488. style: {
  46489. type: Object,
  46490. default: () => ({})
  46491. },
  46492. className: {
  46493. type: String,
  46494. default: ""
  46495. },
  46496. tableLayout: {
  46497. type: String,
  46498. default: "fixed"
  46499. },
  46500. scrollbarAlwaysOn: Boolean,
  46501. flexible: Boolean,
  46502. showOverflowTooltip: [Boolean, Object],
  46503. tooltipFormatter: Function,
  46504. appendFilterPanelTo: String,
  46505. scrollbarTabindex: {
  46506. type: [Number, String],
  46507. default: void 0
  46508. },
  46509. allowDragLastColumn: {
  46510. type: Boolean,
  46511. default: true
  46512. },
  46513. preserveExpandedContent: {
  46514. type: Boolean,
  46515. default: false
  46516. }
  46517. };
  46518. function hColgroup(props) {
  46519. const isAuto = props.tableLayout === "auto";
  46520. let columns = props.columns || [];
  46521. if (isAuto) {
  46522. if (columns.every(({ width }) => isUndefined(width))) {
  46523. columns = [];
  46524. }
  46525. }
  46526. const getPropsData = (column) => {
  46527. const propsData = {
  46528. key: `${props.tableLayout}_${column.id}`,
  46529. style: {},
  46530. name: void 0
  46531. };
  46532. if (isAuto) {
  46533. propsData.style = {
  46534. width: `${column.width}px`
  46535. };
  46536. } else {
  46537. propsData.name = column.id;
  46538. }
  46539. return propsData;
  46540. };
  46541. return h$1("colgroup", {}, columns.map((column) => h$1("col", getPropsData(column))));
  46542. }
  46543. hColgroup.props = ["columns", "tableLayout"];
  46544. const useScrollbar$1 = () => {
  46545. const scrollBarRef = ref();
  46546. const scrollTo = (options, yCoord) => {
  46547. const scrollbar = scrollBarRef.value;
  46548. if (scrollbar) {
  46549. scrollbar.scrollTo(options, yCoord);
  46550. }
  46551. };
  46552. const setScrollPosition = (position, offset) => {
  46553. const scrollbar = scrollBarRef.value;
  46554. if (scrollbar && isNumber(offset) && ["Top", "Left"].includes(position)) {
  46555. scrollbar[`setScroll${position}`](offset);
  46556. }
  46557. };
  46558. const setScrollTop = (top) => setScrollPosition("Top", top);
  46559. const setScrollLeft = (left) => setScrollPosition("Left", left);
  46560. return {
  46561. scrollBarRef,
  46562. scrollTo,
  46563. setScrollTop,
  46564. setScrollLeft
  46565. };
  46566. };
  46567. let tableIdSeed = 1;
  46568. const _sfc_main$A = defineComponent({
  46569. name: "ElTable",
  46570. directives: {
  46571. Mousewheel
  46572. },
  46573. components: {
  46574. TableHeader,
  46575. TableBody,
  46576. TableFooter,
  46577. ElScrollbar,
  46578. hColgroup
  46579. },
  46580. props: defaultProps$2,
  46581. emits: [
  46582. "select",
  46583. "select-all",
  46584. "selection-change",
  46585. "cell-mouse-enter",
  46586. "cell-mouse-leave",
  46587. "cell-contextmenu",
  46588. "cell-click",
  46589. "cell-dblclick",
  46590. "row-click",
  46591. "row-contextmenu",
  46592. "row-dblclick",
  46593. "header-click",
  46594. "header-contextmenu",
  46595. "sort-change",
  46596. "filter-change",
  46597. "current-change",
  46598. "header-dragend",
  46599. "expand-change",
  46600. "scroll"
  46601. ],
  46602. setup(props) {
  46603. const { t } = useLocale();
  46604. const ns = useNamespace("table");
  46605. const table = getCurrentInstance();
  46606. provide(TABLE_INJECTION_KEY, table);
  46607. const store = createStore(table, props);
  46608. table.store = store;
  46609. const layout = new TableLayout$1({
  46610. store: table.store,
  46611. table,
  46612. fit: props.fit,
  46613. showHeader: props.showHeader
  46614. });
  46615. table.layout = layout;
  46616. const isEmpty = computed(() => (store.states.data.value || []).length === 0);
  46617. const {
  46618. setCurrentRow,
  46619. getSelectionRows,
  46620. toggleRowSelection,
  46621. clearSelection,
  46622. clearFilter,
  46623. toggleAllSelection,
  46624. toggleRowExpansion,
  46625. clearSort,
  46626. sort,
  46627. updateKeyChildren
  46628. } = useUtils(store);
  46629. const {
  46630. isHidden,
  46631. renderExpanded,
  46632. setDragVisible,
  46633. isGroup,
  46634. handleMouseLeave,
  46635. handleHeaderFooterMousewheel,
  46636. tableSize,
  46637. emptyBlockStyle,
  46638. handleFixedMousewheel,
  46639. resizeProxyVisible,
  46640. bodyWidth,
  46641. resizeState,
  46642. doLayout,
  46643. tableBodyStyles,
  46644. tableLayout,
  46645. scrollbarViewStyle,
  46646. scrollbarStyle
  46647. } = useStyle(props, layout, store, table);
  46648. const { scrollBarRef, scrollTo, setScrollLeft, setScrollTop } = useScrollbar$1();
  46649. const debouncedUpdateLayout = debounce(doLayout, 50);
  46650. const tableId = `${ns.namespace.value}-table_${tableIdSeed++}`;
  46651. table.tableId = tableId;
  46652. table.state = {
  46653. isGroup,
  46654. resizeState,
  46655. doLayout,
  46656. debouncedUpdateLayout
  46657. };
  46658. const computedSumText = computed(() => {
  46659. var _a;
  46660. return (_a = props.sumText) != null ? _a : t("el.table.sumText");
  46661. });
  46662. const computedEmptyText = computed(() => {
  46663. var _a;
  46664. return (_a = props.emptyText) != null ? _a : t("el.table.emptyText");
  46665. });
  46666. const columns = computed(() => {
  46667. return convertToRows(store.states.originColumns.value)[0];
  46668. });
  46669. useKeyRender(table);
  46670. onBeforeUnmount(() => {
  46671. debouncedUpdateLayout.cancel();
  46672. });
  46673. return {
  46674. ns,
  46675. layout,
  46676. store,
  46677. columns,
  46678. handleHeaderFooterMousewheel,
  46679. handleMouseLeave,
  46680. tableId,
  46681. tableSize,
  46682. isHidden,
  46683. isEmpty,
  46684. renderExpanded,
  46685. resizeProxyVisible,
  46686. resizeState,
  46687. isGroup,
  46688. bodyWidth,
  46689. tableBodyStyles,
  46690. emptyBlockStyle,
  46691. debouncedUpdateLayout,
  46692. handleFixedMousewheel,
  46693. setCurrentRow,
  46694. getSelectionRows,
  46695. toggleRowSelection,
  46696. clearSelection,
  46697. clearFilter,
  46698. toggleAllSelection,
  46699. toggleRowExpansion,
  46700. clearSort,
  46701. doLayout,
  46702. sort,
  46703. updateKeyChildren,
  46704. t,
  46705. setDragVisible,
  46706. context: table,
  46707. computedSumText,
  46708. computedEmptyText,
  46709. tableLayout,
  46710. scrollbarViewStyle,
  46711. scrollbarStyle,
  46712. scrollBarRef,
  46713. scrollTo,
  46714. setScrollLeft,
  46715. setScrollTop,
  46716. allowDragLastColumn: props.allowDragLastColumn
  46717. };
  46718. }
  46719. });
  46720. function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
  46721. const _component_hColgroup = resolveComponent("hColgroup");
  46722. const _component_table_header = resolveComponent("table-header");
  46723. const _component_table_body = resolveComponent("table-body");
  46724. const _component_table_footer = resolveComponent("table-footer");
  46725. const _component_el_scrollbar = resolveComponent("el-scrollbar");
  46726. const _directive_mousewheel = resolveDirective("mousewheel");
  46727. return openBlock(), createElementBlock("div", {
  46728. ref: "tableWrapper",
  46729. class: normalizeClass([
  46730. {
  46731. [_ctx.ns.m("fit")]: _ctx.fit,
  46732. [_ctx.ns.m("striped")]: _ctx.stripe,
  46733. [_ctx.ns.m("border")]: _ctx.border || _ctx.isGroup,
  46734. [_ctx.ns.m("hidden")]: _ctx.isHidden,
  46735. [_ctx.ns.m("group")]: _ctx.isGroup,
  46736. [_ctx.ns.m("fluid-height")]: _ctx.maxHeight,
  46737. [_ctx.ns.m("scrollable-x")]: _ctx.layout.scrollX.value,
  46738. [_ctx.ns.m("scrollable-y")]: _ctx.layout.scrollY.value,
  46739. [_ctx.ns.m("enable-row-hover")]: !_ctx.store.states.isComplex.value,
  46740. [_ctx.ns.m("enable-row-transition")]: (_ctx.store.states.data.value || []).length !== 0 && (_ctx.store.states.data.value || []).length < 100,
  46741. "has-footer": _ctx.showSummary
  46742. },
  46743. _ctx.ns.m(_ctx.tableSize),
  46744. _ctx.className,
  46745. _ctx.ns.b(),
  46746. _ctx.ns.m(`layout-${_ctx.tableLayout}`)
  46747. ]),
  46748. style: normalizeStyle(_ctx.style),
  46749. "data-prefix": _ctx.ns.namespace.value,
  46750. onMouseleave: _ctx.handleMouseLeave
  46751. }, [
  46752. createElementVNode("div", {
  46753. class: normalizeClass(_ctx.ns.e("inner-wrapper"))
  46754. }, [
  46755. createElementVNode("div", {
  46756. ref: "hiddenColumns",
  46757. class: "hidden-columns"
  46758. }, [
  46759. renderSlot(_ctx.$slots, "default")
  46760. ], 512),
  46761. _ctx.showHeader && _ctx.tableLayout === "fixed" ? withDirectives((openBlock(), createElementBlock("div", {
  46762. key: 0,
  46763. ref: "headerWrapper",
  46764. class: normalizeClass(_ctx.ns.e("header-wrapper"))
  46765. }, [
  46766. createElementVNode("table", {
  46767. ref: "tableHeader",
  46768. class: normalizeClass(_ctx.ns.e("header")),
  46769. style: normalizeStyle(_ctx.tableBodyStyles),
  46770. border: "0",
  46771. cellpadding: "0",
  46772. cellspacing: "0"
  46773. }, [
  46774. createVNode(_component_hColgroup, {
  46775. columns: _ctx.store.states.columns.value,
  46776. "table-layout": _ctx.tableLayout
  46777. }, null, 8, ["columns", "table-layout"]),
  46778. createVNode(_component_table_header, {
  46779. ref: "tableHeaderRef",
  46780. border: _ctx.border,
  46781. "default-sort": _ctx.defaultSort,
  46782. store: _ctx.store,
  46783. "append-filter-panel-to": _ctx.appendFilterPanelTo,
  46784. "allow-drag-last-column": _ctx.allowDragLastColumn,
  46785. onSetDragVisible: _ctx.setDragVisible
  46786. }, null, 8, ["border", "default-sort", "store", "append-filter-panel-to", "allow-drag-last-column", "onSetDragVisible"])
  46787. ], 6)
  46788. ], 2)), [
  46789. [_directive_mousewheel, _ctx.handleHeaderFooterMousewheel]
  46790. ]) : createCommentVNode("v-if", true),
  46791. createElementVNode("div", {
  46792. ref: "bodyWrapper",
  46793. class: normalizeClass(_ctx.ns.e("body-wrapper"))
  46794. }, [
  46795. createVNode(_component_el_scrollbar, {
  46796. ref: "scrollBarRef",
  46797. "view-style": _ctx.scrollbarViewStyle,
  46798. "wrap-style": _ctx.scrollbarStyle,
  46799. always: _ctx.scrollbarAlwaysOn,
  46800. tabindex: _ctx.scrollbarTabindex,
  46801. onScroll: ($event) => _ctx.$emit("scroll", $event)
  46802. }, {
  46803. default: withCtx(() => [
  46804. createElementVNode("table", {
  46805. ref: "tableBody",
  46806. class: normalizeClass(_ctx.ns.e("body")),
  46807. cellspacing: "0",
  46808. cellpadding: "0",
  46809. border: "0",
  46810. style: normalizeStyle({
  46811. width: _ctx.bodyWidth,
  46812. tableLayout: _ctx.tableLayout
  46813. })
  46814. }, [
  46815. createVNode(_component_hColgroup, {
  46816. columns: _ctx.store.states.columns.value,
  46817. "table-layout": _ctx.tableLayout
  46818. }, null, 8, ["columns", "table-layout"]),
  46819. _ctx.showHeader && _ctx.tableLayout === "auto" ? (openBlock(), createBlock(_component_table_header, {
  46820. key: 0,
  46821. ref: "tableHeaderRef",
  46822. class: normalizeClass(_ctx.ns.e("body-header")),
  46823. border: _ctx.border,
  46824. "default-sort": _ctx.defaultSort,
  46825. store: _ctx.store,
  46826. "append-filter-panel-to": _ctx.appendFilterPanelTo,
  46827. onSetDragVisible: _ctx.setDragVisible
  46828. }, null, 8, ["class", "border", "default-sort", "store", "append-filter-panel-to", "onSetDragVisible"])) : createCommentVNode("v-if", true),
  46829. createVNode(_component_table_body, {
  46830. context: _ctx.context,
  46831. highlight: _ctx.highlightCurrentRow,
  46832. "row-class-name": _ctx.rowClassName,
  46833. "tooltip-effect": _ctx.tooltipEffect,
  46834. "tooltip-options": _ctx.tooltipOptions,
  46835. "row-style": _ctx.rowStyle,
  46836. store: _ctx.store,
  46837. stripe: _ctx.stripe
  46838. }, null, 8, ["context", "highlight", "row-class-name", "tooltip-effect", "tooltip-options", "row-style", "store", "stripe"]),
  46839. _ctx.showSummary && _ctx.tableLayout === "auto" ? (openBlock(), createBlock(_component_table_footer, {
  46840. key: 1,
  46841. class: normalizeClass(_ctx.ns.e("body-footer")),
  46842. border: _ctx.border,
  46843. "default-sort": _ctx.defaultSort,
  46844. store: _ctx.store,
  46845. "sum-text": _ctx.computedSumText,
  46846. "summary-method": _ctx.summaryMethod
  46847. }, null, 8, ["class", "border", "default-sort", "store", "sum-text", "summary-method"])) : createCommentVNode("v-if", true)
  46848. ], 6),
  46849. _ctx.isEmpty ? (openBlock(), createElementBlock("div", {
  46850. key: 0,
  46851. ref: "emptyBlock",
  46852. style: normalizeStyle(_ctx.emptyBlockStyle),
  46853. class: normalizeClass(_ctx.ns.e("empty-block"))
  46854. }, [
  46855. createElementVNode("span", {
  46856. class: normalizeClass(_ctx.ns.e("empty-text"))
  46857. }, [
  46858. renderSlot(_ctx.$slots, "empty", {}, () => [
  46859. createTextVNode(toDisplayString(_ctx.computedEmptyText), 1)
  46860. ])
  46861. ], 2)
  46862. ], 6)) : createCommentVNode("v-if", true),
  46863. _ctx.$slots.append ? (openBlock(), createElementBlock("div", {
  46864. key: 1,
  46865. ref: "appendWrapper",
  46866. class: normalizeClass(_ctx.ns.e("append-wrapper"))
  46867. }, [
  46868. renderSlot(_ctx.$slots, "append")
  46869. ], 2)) : createCommentVNode("v-if", true)
  46870. ]),
  46871. _: 3
  46872. }, 8, ["view-style", "wrap-style", "always", "tabindex", "onScroll"])
  46873. ], 2),
  46874. _ctx.showSummary && _ctx.tableLayout === "fixed" ? withDirectives((openBlock(), createElementBlock("div", {
  46875. key: 1,
  46876. ref: "footerWrapper",
  46877. class: normalizeClass(_ctx.ns.e("footer-wrapper"))
  46878. }, [
  46879. createElementVNode("table", {
  46880. class: normalizeClass(_ctx.ns.e("footer")),
  46881. cellspacing: "0",
  46882. cellpadding: "0",
  46883. border: "0",
  46884. style: normalizeStyle(_ctx.tableBodyStyles)
  46885. }, [
  46886. createVNode(_component_hColgroup, {
  46887. columns: _ctx.store.states.columns.value,
  46888. "table-layout": _ctx.tableLayout
  46889. }, null, 8, ["columns", "table-layout"]),
  46890. createVNode(_component_table_footer, {
  46891. border: _ctx.border,
  46892. "default-sort": _ctx.defaultSort,
  46893. store: _ctx.store,
  46894. "sum-text": _ctx.computedSumText,
  46895. "summary-method": _ctx.summaryMethod
  46896. }, null, 8, ["border", "default-sort", "store", "sum-text", "summary-method"])
  46897. ], 6)
  46898. ], 2)), [
  46899. [vShow, !_ctx.isEmpty],
  46900. [_directive_mousewheel, _ctx.handleHeaderFooterMousewheel]
  46901. ]) : createCommentVNode("v-if", true),
  46902. _ctx.border || _ctx.isGroup ? (openBlock(), createElementBlock("div", {
  46903. key: 2,
  46904. class: normalizeClass(_ctx.ns.e("border-left-patch"))
  46905. }, null, 2)) : createCommentVNode("v-if", true)
  46906. ], 2),
  46907. withDirectives(createElementVNode("div", {
  46908. ref: "resizeProxy",
  46909. class: normalizeClass(_ctx.ns.e("column-resize-proxy"))
  46910. }, null, 2), [
  46911. [vShow, _ctx.resizeProxyVisible]
  46912. ])
  46913. ], 46, ["data-prefix", "onMouseleave"]);
  46914. }
  46915. var Table = /* @__PURE__ */ _export_sfc(_sfc_main$A, [["render", _sfc_render$3], ["__file", "table.vue"]]);
  46916. const defaultClassNames = {
  46917. selection: "table-column--selection",
  46918. expand: "table__expand-column"
  46919. };
  46920. const cellStarts = {
  46921. default: {
  46922. order: ""
  46923. },
  46924. selection: {
  46925. width: 48,
  46926. minWidth: 48,
  46927. realWidth: 48,
  46928. order: ""
  46929. },
  46930. expand: {
  46931. width: 48,
  46932. minWidth: 48,
  46933. realWidth: 48,
  46934. order: ""
  46935. },
  46936. index: {
  46937. width: 48,
  46938. minWidth: 48,
  46939. realWidth: 48,
  46940. order: ""
  46941. }
  46942. };
  46943. const getDefaultClassName = (type) => {
  46944. return defaultClassNames[type] || "";
  46945. };
  46946. const cellForced = {
  46947. selection: {
  46948. renderHeader({ store, column }) {
  46949. function isDisabled() {
  46950. return store.states.data.value && store.states.data.value.length === 0;
  46951. }
  46952. return h$1(ElCheckbox, {
  46953. disabled: isDisabled(),
  46954. size: store.states.tableSize.value,
  46955. indeterminate: store.states.selection.value.length > 0 && !store.states.isAllSelected.value,
  46956. "onUpdate:modelValue": store.toggleAllSelection,
  46957. modelValue: store.states.isAllSelected.value,
  46958. ariaLabel: column.label
  46959. });
  46960. },
  46961. renderCell({
  46962. row,
  46963. column,
  46964. store,
  46965. $index
  46966. }) {
  46967. return h$1(ElCheckbox, {
  46968. disabled: column.selectable ? !column.selectable.call(null, row, $index) : false,
  46969. size: store.states.tableSize.value,
  46970. onChange: () => {
  46971. store.commit("rowSelectedChanged", row);
  46972. },
  46973. onClick: (event) => event.stopPropagation(),
  46974. modelValue: store.isSelected(row),
  46975. ariaLabel: column.label
  46976. });
  46977. },
  46978. sortable: false,
  46979. resizable: false
  46980. },
  46981. index: {
  46982. renderHeader({ column }) {
  46983. return column.label || "#";
  46984. },
  46985. renderCell({
  46986. column,
  46987. $index
  46988. }) {
  46989. let i = $index + 1;
  46990. const index = column.index;
  46991. if (isNumber(index)) {
  46992. i = $index + index;
  46993. } else if (isFunction$1(index)) {
  46994. i = index($index);
  46995. }
  46996. return h$1("div", {}, [i]);
  46997. },
  46998. sortable: false
  46999. },
  47000. expand: {
  47001. renderHeader({ column }) {
  47002. return column.label || "";
  47003. },
  47004. renderCell({
  47005. row,
  47006. store,
  47007. expanded
  47008. }) {
  47009. const { ns } = store;
  47010. const classes = [ns.e("expand-icon")];
  47011. if (expanded) {
  47012. classes.push(ns.em("expand-icon", "expanded"));
  47013. }
  47014. const callback = function(e) {
  47015. e.stopPropagation();
  47016. store.toggleRowExpansion(row);
  47017. };
  47018. return h$1("div", {
  47019. class: classes,
  47020. onClick: callback
  47021. }, {
  47022. default: () => {
  47023. return [
  47024. h$1(ElIcon, null, {
  47025. default: () => {
  47026. return [h$1(arrow_right_default)];
  47027. }
  47028. })
  47029. ];
  47030. }
  47031. });
  47032. },
  47033. sortable: false,
  47034. resizable: false
  47035. }
  47036. };
  47037. function defaultRenderCell({
  47038. row,
  47039. column,
  47040. $index
  47041. }) {
  47042. var _a;
  47043. const property = column.property;
  47044. const value = property && getProp(row, property).value;
  47045. if (column && column.formatter) {
  47046. return column.formatter(row, column, value, $index);
  47047. }
  47048. return ((_a = value == null ? void 0 : value.toString) == null ? void 0 : _a.call(value)) || "";
  47049. }
  47050. function treeCellPrefix({
  47051. row,
  47052. treeNode,
  47053. store
  47054. }, createPlaceholder = false) {
  47055. const { ns } = store;
  47056. if (!treeNode) {
  47057. if (createPlaceholder) {
  47058. return [
  47059. h$1("span", {
  47060. class: ns.e("placeholder")
  47061. })
  47062. ];
  47063. }
  47064. return null;
  47065. }
  47066. const ele = [];
  47067. const callback = function(e) {
  47068. e.stopPropagation();
  47069. if (treeNode.loading) {
  47070. return;
  47071. }
  47072. store.loadOrToggle(row);
  47073. };
  47074. if (treeNode.indent) {
  47075. ele.push(h$1("span", {
  47076. class: ns.e("indent"),
  47077. style: { "padding-left": `${treeNode.indent}px` }
  47078. }));
  47079. }
  47080. if (isBoolean(treeNode.expanded) && !treeNode.noLazyChildren) {
  47081. const expandClasses = [
  47082. ns.e("expand-icon"),
  47083. treeNode.expanded ? ns.em("expand-icon", "expanded") : ""
  47084. ];
  47085. let icon = arrow_right_default;
  47086. if (treeNode.loading) {
  47087. icon = loading_default;
  47088. }
  47089. ele.push(h$1("div", {
  47090. class: expandClasses,
  47091. onClick: callback
  47092. }, {
  47093. default: () => {
  47094. return [
  47095. h$1(ElIcon, { class: { [ns.is("loading")]: treeNode.loading } }, {
  47096. default: () => [h$1(icon)]
  47097. })
  47098. ];
  47099. }
  47100. }));
  47101. } else {
  47102. ele.push(h$1("span", {
  47103. class: ns.e("placeholder")
  47104. }));
  47105. }
  47106. return ele;
  47107. }
  47108. function getAllAliases(props, aliases) {
  47109. return props.reduce((prev, cur) => {
  47110. prev[cur] = cur;
  47111. return prev;
  47112. }, aliases);
  47113. }
  47114. function useWatcher(owner, props_) {
  47115. const instance = getCurrentInstance();
  47116. const registerComplexWatchers = () => {
  47117. const props = ["fixed"];
  47118. const aliases = {
  47119. realWidth: "width",
  47120. realMinWidth: "minWidth"
  47121. };
  47122. const allAliases = getAllAliases(props, aliases);
  47123. Object.keys(allAliases).forEach((key) => {
  47124. const columnKey = aliases[key];
  47125. if (hasOwn(props_, columnKey)) {
  47126. watch(() => props_[columnKey], (newVal) => {
  47127. let value = newVal;
  47128. if (columnKey === "width" && key === "realWidth") {
  47129. value = parseWidth(newVal);
  47130. }
  47131. if (columnKey === "minWidth" && key === "realMinWidth") {
  47132. value = parseMinWidth(newVal);
  47133. }
  47134. instance.columnConfig.value[columnKey] = value;
  47135. instance.columnConfig.value[key] = value;
  47136. const updateColumns = columnKey === "fixed";
  47137. owner.value.store.scheduleLayout(updateColumns);
  47138. });
  47139. }
  47140. });
  47141. };
  47142. const registerNormalWatchers = () => {
  47143. const props = [
  47144. "label",
  47145. "filters",
  47146. "filterMultiple",
  47147. "filteredValue",
  47148. "sortable",
  47149. "index",
  47150. "formatter",
  47151. "className",
  47152. "labelClassName",
  47153. "filterClassName",
  47154. "showOverflowTooltip",
  47155. "tooltipFormatter"
  47156. ];
  47157. const aliases = {
  47158. property: "prop",
  47159. align: "realAlign",
  47160. headerAlign: "realHeaderAlign"
  47161. };
  47162. const allAliases = getAllAliases(props, aliases);
  47163. Object.keys(allAliases).forEach((key) => {
  47164. const columnKey = aliases[key];
  47165. if (hasOwn(props_, columnKey)) {
  47166. watch(() => props_[columnKey], (newVal) => {
  47167. instance.columnConfig.value[key] = newVal;
  47168. });
  47169. }
  47170. });
  47171. };
  47172. return {
  47173. registerComplexWatchers,
  47174. registerNormalWatchers
  47175. };
  47176. }
  47177. function useRender(props, slots, owner) {
  47178. const instance = getCurrentInstance();
  47179. const columnId = ref("");
  47180. const isSubColumn = ref(false);
  47181. const realAlign = ref();
  47182. const realHeaderAlign = ref();
  47183. const ns = useNamespace("table");
  47184. watchEffect(() => {
  47185. realAlign.value = props.align ? `is-${props.align}` : null;
  47186. realAlign.value;
  47187. });
  47188. watchEffect(() => {
  47189. realHeaderAlign.value = props.headerAlign ? `is-${props.headerAlign}` : realAlign.value;
  47190. realHeaderAlign.value;
  47191. });
  47192. const columnOrTableParent = computed(() => {
  47193. let parent = instance.vnode.vParent || instance.parent;
  47194. while (parent && !parent.tableId && !parent.columnId) {
  47195. parent = parent.vnode.vParent || parent.parent;
  47196. }
  47197. return parent;
  47198. });
  47199. const hasTreeColumn = computed(() => {
  47200. const { store } = instance.parent;
  47201. if (!store)
  47202. return false;
  47203. const { treeData } = store.states;
  47204. const treeDataValue = treeData.value;
  47205. return treeDataValue && Object.keys(treeDataValue).length > 0;
  47206. });
  47207. const realWidth = ref(parseWidth(props.width));
  47208. const realMinWidth = ref(parseMinWidth(props.minWidth));
  47209. const setColumnWidth = (column) => {
  47210. if (realWidth.value)
  47211. column.width = realWidth.value;
  47212. if (realMinWidth.value) {
  47213. column.minWidth = realMinWidth.value;
  47214. }
  47215. if (!realWidth.value && realMinWidth.value) {
  47216. column.width = void 0;
  47217. }
  47218. if (!column.minWidth) {
  47219. column.minWidth = 80;
  47220. }
  47221. column.realWidth = Number(isUndefined(column.width) ? column.minWidth : column.width);
  47222. return column;
  47223. };
  47224. const setColumnForcedProps = (column) => {
  47225. const type = column.type;
  47226. const source = cellForced[type] || {};
  47227. Object.keys(source).forEach((prop) => {
  47228. const value = source[prop];
  47229. if (prop !== "className" && !isUndefined(value)) {
  47230. column[prop] = value;
  47231. }
  47232. });
  47233. const className = getDefaultClassName(type);
  47234. if (className) {
  47235. const forceClass = `${unref(ns.namespace)}-${className}`;
  47236. column.className = column.className ? `${column.className} ${forceClass}` : forceClass;
  47237. }
  47238. return column;
  47239. };
  47240. const checkSubColumn = (children) => {
  47241. if (isArray$1(children)) {
  47242. children.forEach((child) => check(child));
  47243. } else {
  47244. check(children);
  47245. }
  47246. function check(item) {
  47247. var _a;
  47248. if (((_a = item == null ? void 0 : item.type) == null ? void 0 : _a.name) === "ElTableColumn") {
  47249. item.vParent = instance;
  47250. }
  47251. }
  47252. };
  47253. const setColumnRenders = (column) => {
  47254. if (props.renderHeader) ; else if (column.type !== "selection") {
  47255. column.renderHeader = (scope) => {
  47256. instance.columnConfig.value["label"];
  47257. return renderSlot(slots, "header", scope, () => [column.label]);
  47258. };
  47259. }
  47260. if (slots["filter-icon"]) {
  47261. column.renderFilterIcon = (scope) => {
  47262. return renderSlot(slots, "filter-icon", scope);
  47263. };
  47264. }
  47265. let originRenderCell = column.renderCell;
  47266. if (column.type === "expand") {
  47267. column.renderCell = (data) => h$1("div", {
  47268. class: "cell"
  47269. }, [originRenderCell(data)]);
  47270. owner.value.renderExpanded = (data) => {
  47271. return slots.default ? slots.default(data) : slots.default;
  47272. };
  47273. } else {
  47274. originRenderCell = originRenderCell || defaultRenderCell;
  47275. column.renderCell = (data) => {
  47276. let children = null;
  47277. if (slots.default) {
  47278. const vnodes = slots.default(data);
  47279. children = vnodes.some((v) => v.type !== Comment) ? vnodes : originRenderCell(data);
  47280. } else {
  47281. children = originRenderCell(data);
  47282. }
  47283. const { columns } = owner.value.store.states;
  47284. const firstUserColumnIndex = columns.value.findIndex((item) => item.type === "default");
  47285. const shouldCreatePlaceholder = hasTreeColumn.value && data.cellIndex === firstUserColumnIndex;
  47286. const prefix = treeCellPrefix(data, shouldCreatePlaceholder);
  47287. const props2 = {
  47288. class: "cell",
  47289. style: {}
  47290. };
  47291. if (column.showOverflowTooltip) {
  47292. props2.class = `${props2.class} ${unref(ns.namespace)}-tooltip`;
  47293. props2.style = {
  47294. width: `${(data.column.realWidth || Number(data.column.width)) - 1}px`
  47295. };
  47296. }
  47297. checkSubColumn(children);
  47298. return h$1("div", props2, [prefix, children]);
  47299. };
  47300. }
  47301. return column;
  47302. };
  47303. const getPropsData = (...propsKey) => {
  47304. return propsKey.reduce((prev, cur) => {
  47305. if (isArray$1(cur)) {
  47306. cur.forEach((key) => {
  47307. prev[key] = props[key];
  47308. });
  47309. }
  47310. return prev;
  47311. }, {});
  47312. };
  47313. const getColumnElIndex = (children, child) => {
  47314. return Array.prototype.indexOf.call(children, child);
  47315. };
  47316. const updateColumnOrder = () => {
  47317. owner.value.store.commit("updateColumnOrder", instance.columnConfig.value);
  47318. };
  47319. return {
  47320. columnId,
  47321. realAlign,
  47322. isSubColumn,
  47323. realHeaderAlign,
  47324. columnOrTableParent,
  47325. setColumnWidth,
  47326. setColumnForcedProps,
  47327. setColumnRenders,
  47328. getPropsData,
  47329. getColumnElIndex,
  47330. updateColumnOrder
  47331. };
  47332. }
  47333. var defaultProps$1 = {
  47334. type: {
  47335. type: String,
  47336. default: "default"
  47337. },
  47338. label: String,
  47339. className: String,
  47340. labelClassName: String,
  47341. property: String,
  47342. prop: String,
  47343. width: {
  47344. type: [String, Number],
  47345. default: ""
  47346. },
  47347. minWidth: {
  47348. type: [String, Number],
  47349. default: ""
  47350. },
  47351. renderHeader: Function,
  47352. sortable: {
  47353. type: [Boolean, String],
  47354. default: false
  47355. },
  47356. sortMethod: Function,
  47357. sortBy: [String, Function, Array],
  47358. resizable: {
  47359. type: Boolean,
  47360. default: true
  47361. },
  47362. columnKey: String,
  47363. align: String,
  47364. headerAlign: String,
  47365. showOverflowTooltip: {
  47366. type: [Boolean, Object],
  47367. default: void 0
  47368. },
  47369. tooltipFormatter: Function,
  47370. fixed: [Boolean, String],
  47371. formatter: Function,
  47372. selectable: Function,
  47373. reserveSelection: Boolean,
  47374. filterMethod: Function,
  47375. filteredValue: Array,
  47376. filters: Array,
  47377. filterPlacement: String,
  47378. filterMultiple: {
  47379. type: Boolean,
  47380. default: true
  47381. },
  47382. filterClassName: String,
  47383. index: [Number, Function],
  47384. sortOrders: {
  47385. type: Array,
  47386. default: () => {
  47387. return ["ascending", "descending", null];
  47388. },
  47389. validator: (val) => {
  47390. return val.every((order) => ["ascending", "descending", null].includes(order));
  47391. }
  47392. }
  47393. };
  47394. let columnIdSeed = 1;
  47395. var ElTableColumn$1 = defineComponent({
  47396. name: "ElTableColumn",
  47397. components: {
  47398. ElCheckbox
  47399. },
  47400. props: defaultProps$1,
  47401. setup(props, { slots }) {
  47402. const instance = getCurrentInstance();
  47403. const columnConfig = ref({});
  47404. const owner = computed(() => {
  47405. let parent2 = instance.parent;
  47406. while (parent2 && !parent2.tableId) {
  47407. parent2 = parent2.parent;
  47408. }
  47409. return parent2;
  47410. });
  47411. const { registerNormalWatchers, registerComplexWatchers } = useWatcher(owner, props);
  47412. const {
  47413. columnId,
  47414. isSubColumn,
  47415. realHeaderAlign,
  47416. columnOrTableParent,
  47417. setColumnWidth,
  47418. setColumnForcedProps,
  47419. setColumnRenders,
  47420. getPropsData,
  47421. getColumnElIndex,
  47422. realAlign,
  47423. updateColumnOrder
  47424. } = useRender(props, slots, owner);
  47425. const parent = columnOrTableParent.value;
  47426. columnId.value = `${parent.tableId || parent.columnId}_column_${columnIdSeed++}`;
  47427. onBeforeMount(() => {
  47428. isSubColumn.value = owner.value !== parent;
  47429. const type = props.type || "default";
  47430. const sortable = props.sortable === "" ? true : props.sortable;
  47431. const showOverflowTooltip = type === "selection" ? false : isUndefined(props.showOverflowTooltip) ? parent.props.showOverflowTooltip : props.showOverflowTooltip;
  47432. const tooltipFormatter = isUndefined(props.tooltipFormatter) ? parent.props.tooltipFormatter : props.tooltipFormatter;
  47433. const defaults = {
  47434. ...cellStarts[type],
  47435. id: columnId.value,
  47436. type,
  47437. property: props.prop || props.property,
  47438. align: realAlign,
  47439. headerAlign: realHeaderAlign,
  47440. showOverflowTooltip,
  47441. tooltipFormatter,
  47442. filterable: props.filters || props.filterMethod,
  47443. filteredValue: [],
  47444. filterPlacement: "",
  47445. filterClassName: "",
  47446. isColumnGroup: false,
  47447. isSubColumn: false,
  47448. filterOpened: false,
  47449. sortable,
  47450. index: props.index,
  47451. rawColumnKey: instance.vnode.key
  47452. };
  47453. const basicProps = [
  47454. "columnKey",
  47455. "label",
  47456. "className",
  47457. "labelClassName",
  47458. "type",
  47459. "renderHeader",
  47460. "formatter",
  47461. "fixed",
  47462. "resizable"
  47463. ];
  47464. const sortProps = ["sortMethod", "sortBy", "sortOrders"];
  47465. const selectProps = ["selectable", "reserveSelection"];
  47466. const filterProps = [
  47467. "filterMethod",
  47468. "filters",
  47469. "filterMultiple",
  47470. "filterOpened",
  47471. "filteredValue",
  47472. "filterPlacement",
  47473. "filterClassName"
  47474. ];
  47475. let column = getPropsData(basicProps, sortProps, selectProps, filterProps);
  47476. column = mergeOptions(defaults, column);
  47477. const chains = compose(setColumnRenders, setColumnWidth, setColumnForcedProps);
  47478. column = chains(column);
  47479. columnConfig.value = column;
  47480. registerNormalWatchers();
  47481. registerComplexWatchers();
  47482. });
  47483. onMounted(() => {
  47484. var _a;
  47485. const parent2 = columnOrTableParent.value;
  47486. const children = isSubColumn.value ? parent2.vnode.el.children : (_a = parent2.refs.hiddenColumns) == null ? void 0 : _a.children;
  47487. const getColumnIndex = () => getColumnElIndex(children || [], instance.vnode.el);
  47488. columnConfig.value.getColumnIndex = getColumnIndex;
  47489. const columnIndex = getColumnIndex();
  47490. columnIndex > -1 && owner.value.store.commit("insertColumn", columnConfig.value, isSubColumn.value ? parent2.columnConfig.value : null, updateColumnOrder);
  47491. });
  47492. onBeforeUnmount(() => {
  47493. const getColumnIndex = columnConfig.value.getColumnIndex;
  47494. const columnIndex = getColumnIndex ? getColumnIndex() : -1;
  47495. columnIndex > -1 && owner.value.store.commit("removeColumn", columnConfig.value, isSubColumn.value ? parent.columnConfig.value : null, updateColumnOrder);
  47496. });
  47497. instance.columnId = columnId.value;
  47498. instance.columnConfig = columnConfig;
  47499. return;
  47500. },
  47501. render() {
  47502. var _a, _b, _c;
  47503. try {
  47504. const renderDefault = (_b = (_a = this.$slots).default) == null ? void 0 : _b.call(_a, {
  47505. row: {},
  47506. column: {},
  47507. $index: -1
  47508. });
  47509. const children = [];
  47510. if (isArray$1(renderDefault)) {
  47511. for (const childNode of renderDefault) {
  47512. if (((_c = childNode.type) == null ? void 0 : _c.name) === "ElTableColumn" || childNode.shapeFlag & 2) {
  47513. children.push(childNode);
  47514. } else if (childNode.type === Fragment && isArray$1(childNode.children)) {
  47515. childNode.children.forEach((vnode2) => {
  47516. if ((vnode2 == null ? void 0 : vnode2.patchFlag) !== 1024 && !isString$1(vnode2 == null ? void 0 : vnode2.children)) {
  47517. children.push(vnode2);
  47518. }
  47519. });
  47520. }
  47521. }
  47522. }
  47523. const vnode = h$1("div", children);
  47524. return vnode;
  47525. } catch (e) {
  47526. return h$1("div", []);
  47527. }
  47528. }
  47529. });
  47530. const ElTable = withInstall(Table, {
  47531. TableColumn: ElTableColumn$1
  47532. });
  47533. const ElTableColumn = withNoopInstall(ElTableColumn$1);
  47534. var SortOrder = /* @__PURE__ */ ((SortOrder2) => {
  47535. SortOrder2["ASC"] = "asc";
  47536. SortOrder2["DESC"] = "desc";
  47537. return SortOrder2;
  47538. })(SortOrder || {});
  47539. var Alignment = /* @__PURE__ */ ((Alignment2) => {
  47540. Alignment2["CENTER"] = "center";
  47541. Alignment2["RIGHT"] = "right";
  47542. return Alignment2;
  47543. })(Alignment || {});
  47544. var FixedDir = /* @__PURE__ */ ((FixedDir2) => {
  47545. FixedDir2["LEFT"] = "left";
  47546. FixedDir2["RIGHT"] = "right";
  47547. return FixedDir2;
  47548. })(FixedDir || {});
  47549. const oppositeOrderMap = {
  47550. ["asc" /* ASC */]: "desc" /* DESC */,
  47551. ["desc" /* DESC */]: "asc" /* ASC */
  47552. };
  47553. const placeholderSign = Symbol("placeholder");
  47554. const calcColumnStyle = (column, fixedColumn, fixed) => {
  47555. var _a;
  47556. const flex = {
  47557. flexGrow: 0,
  47558. flexShrink: 0,
  47559. ...fixed ? {} : {
  47560. flexGrow: column.flexGrow || 0,
  47561. flexShrink: column.flexShrink || 1
  47562. }
  47563. };
  47564. if (!fixed) {
  47565. flex.flexShrink = 1;
  47566. }
  47567. const style = {
  47568. ...(_a = column.style) != null ? _a : {},
  47569. ...flex,
  47570. flexBasis: "auto",
  47571. width: column.width
  47572. };
  47573. if (!fixedColumn) {
  47574. if (column.maxWidth)
  47575. style.maxWidth = column.maxWidth;
  47576. if (column.minWidth)
  47577. style.minWidth = column.minWidth;
  47578. }
  47579. return style;
  47580. };
  47581. function useColumns(props, columns, fixed) {
  47582. const _columns = computed(() => unref(columns).map((column, index) => {
  47583. var _a, _b;
  47584. return {
  47585. ...column,
  47586. key: (_b = (_a = column.key) != null ? _a : column.dataKey) != null ? _b : index
  47587. };
  47588. }));
  47589. const visibleColumns = computed(() => {
  47590. return unref(_columns).filter((column) => !column.hidden);
  47591. });
  47592. const fixedColumnsOnLeft = computed(() => unref(visibleColumns).filter((column) => column.fixed === "left" || column.fixed === true));
  47593. const fixedColumnsOnRight = computed(() => unref(visibleColumns).filter((column) => column.fixed === "right"));
  47594. const normalColumns = computed(() => unref(visibleColumns).filter((column) => !column.fixed));
  47595. const mainColumns = computed(() => {
  47596. const ret = [];
  47597. unref(fixedColumnsOnLeft).forEach((column) => {
  47598. ret.push({
  47599. ...column,
  47600. placeholderSign
  47601. });
  47602. });
  47603. unref(normalColumns).forEach((column) => {
  47604. ret.push(column);
  47605. });
  47606. unref(fixedColumnsOnRight).forEach((column) => {
  47607. ret.push({
  47608. ...column,
  47609. placeholderSign
  47610. });
  47611. });
  47612. return ret;
  47613. });
  47614. const hasFixedColumns = computed(() => {
  47615. return unref(fixedColumnsOnLeft).length || unref(fixedColumnsOnRight).length;
  47616. });
  47617. const columnsStyles = computed(() => {
  47618. return unref(_columns).reduce((style, column) => {
  47619. style[column.key] = calcColumnStyle(column, unref(fixed), props.fixed);
  47620. return style;
  47621. }, {});
  47622. });
  47623. const columnsTotalWidth = computed(() => {
  47624. return unref(visibleColumns).reduce((width, column) => width + column.width, 0);
  47625. });
  47626. const getColumn = (key) => {
  47627. return unref(_columns).find((column) => column.key === key);
  47628. };
  47629. const getColumnStyle = (key) => {
  47630. return unref(columnsStyles)[key];
  47631. };
  47632. const updateColumnWidth = (column, width) => {
  47633. column.width = width;
  47634. };
  47635. function onColumnSorted(e) {
  47636. var _a;
  47637. const { key } = e.currentTarget.dataset;
  47638. if (!key)
  47639. return;
  47640. const { sortState, sortBy } = props;
  47641. let order = SortOrder.ASC;
  47642. if (isObject$1(sortState)) {
  47643. order = oppositeOrderMap[sortState[key]];
  47644. } else {
  47645. order = oppositeOrderMap[sortBy.order];
  47646. }
  47647. (_a = props.onColumnSort) == null ? void 0 : _a.call(props, { column: getColumn(key), key, order });
  47648. }
  47649. return {
  47650. columns: _columns,
  47651. columnsStyles,
  47652. columnsTotalWidth,
  47653. fixedColumnsOnLeft,
  47654. fixedColumnsOnRight,
  47655. hasFixedColumns,
  47656. mainColumns,
  47657. normalColumns,
  47658. visibleColumns,
  47659. getColumn,
  47660. getColumnStyle,
  47661. updateColumnWidth,
  47662. onColumnSorted
  47663. };
  47664. }
  47665. const useScrollbar = (props, {
  47666. mainTableRef,
  47667. leftTableRef,
  47668. rightTableRef,
  47669. onMaybeEndReached
  47670. }) => {
  47671. const scrollPos = ref({ scrollLeft: 0, scrollTop: 0 });
  47672. function doScroll(params) {
  47673. var _a, _b, _c;
  47674. const { scrollTop } = params;
  47675. (_a = mainTableRef.value) == null ? void 0 : _a.scrollTo(params);
  47676. (_b = leftTableRef.value) == null ? void 0 : _b.scrollToTop(scrollTop);
  47677. (_c = rightTableRef.value) == null ? void 0 : _c.scrollToTop(scrollTop);
  47678. }
  47679. function scrollTo(params) {
  47680. scrollPos.value = params;
  47681. doScroll(params);
  47682. }
  47683. function scrollToTop(scrollTop) {
  47684. scrollPos.value.scrollTop = scrollTop;
  47685. doScroll(unref(scrollPos));
  47686. }
  47687. function scrollToLeft(scrollLeft) {
  47688. var _a, _b;
  47689. scrollPos.value.scrollLeft = scrollLeft;
  47690. (_b = (_a = mainTableRef.value) == null ? void 0 : _a.scrollTo) == null ? void 0 : _b.call(_a, unref(scrollPos));
  47691. }
  47692. function onScroll(params) {
  47693. var _a;
  47694. scrollTo(params);
  47695. (_a = props.onScroll) == null ? void 0 : _a.call(props, params);
  47696. }
  47697. function onVerticalScroll({ scrollTop }) {
  47698. const { scrollTop: currentScrollTop } = unref(scrollPos);
  47699. if (scrollTop !== currentScrollTop)
  47700. scrollToTop(scrollTop);
  47701. }
  47702. function scrollToRow(row, strategy = "auto") {
  47703. var _a;
  47704. (_a = mainTableRef.value) == null ? void 0 : _a.scrollToRow(row, strategy);
  47705. }
  47706. watch(() => unref(scrollPos).scrollTop, (cur, prev) => {
  47707. if (cur > prev)
  47708. onMaybeEndReached();
  47709. });
  47710. return {
  47711. scrollPos,
  47712. scrollTo,
  47713. scrollToLeft,
  47714. scrollToTop,
  47715. scrollToRow,
  47716. onScroll,
  47717. onVerticalScroll
  47718. };
  47719. };
  47720. const useRow = (props, {
  47721. mainTableRef,
  47722. leftTableRef,
  47723. rightTableRef,
  47724. tableInstance,
  47725. ns,
  47726. isScrolling
  47727. }) => {
  47728. const vm = getCurrentInstance();
  47729. const { emit } = vm;
  47730. const isResetting = shallowRef(false);
  47731. const expandedRowKeys = ref(props.defaultExpandedRowKeys || []);
  47732. const lastRenderedRowIndex = ref(-1);
  47733. const resetIndex = shallowRef(null);
  47734. const rowHeights = ref({});
  47735. const pendingRowHeights = ref({});
  47736. const leftTableHeights = shallowRef({});
  47737. const mainTableHeights = shallowRef({});
  47738. const rightTableHeights = shallowRef({});
  47739. const isDynamic = computed(() => isNumber(props.estimatedRowHeight));
  47740. function onRowsRendered(params) {
  47741. var _a;
  47742. (_a = props.onRowsRendered) == null ? void 0 : _a.call(props, params);
  47743. if (params.rowCacheEnd > unref(lastRenderedRowIndex)) {
  47744. lastRenderedRowIndex.value = params.rowCacheEnd;
  47745. }
  47746. }
  47747. function onRowHovered({ hovered, rowKey }) {
  47748. if (isScrolling.value) {
  47749. return;
  47750. }
  47751. const tableRoot = tableInstance.vnode.el;
  47752. const rows = tableRoot.querySelectorAll(`[rowkey="${String(rowKey)}"]`);
  47753. rows.forEach((row) => {
  47754. if (hovered) {
  47755. row.classList.add(ns.is("hovered"));
  47756. } else {
  47757. row.classList.remove(ns.is("hovered"));
  47758. }
  47759. });
  47760. }
  47761. function onRowExpanded({
  47762. expanded,
  47763. rowData,
  47764. rowIndex,
  47765. rowKey
  47766. }) {
  47767. var _a, _b;
  47768. const _expandedRowKeys = [...unref(expandedRowKeys)];
  47769. const currentKeyIndex = _expandedRowKeys.indexOf(rowKey);
  47770. if (expanded) {
  47771. if (currentKeyIndex === -1)
  47772. _expandedRowKeys.push(rowKey);
  47773. } else {
  47774. if (currentKeyIndex > -1)
  47775. _expandedRowKeys.splice(currentKeyIndex, 1);
  47776. }
  47777. expandedRowKeys.value = _expandedRowKeys;
  47778. emit("update:expandedRowKeys", _expandedRowKeys);
  47779. (_a = props.onRowExpand) == null ? void 0 : _a.call(props, {
  47780. expanded,
  47781. rowData,
  47782. rowIndex,
  47783. rowKey
  47784. });
  47785. (_b = props.onExpandedRowsChange) == null ? void 0 : _b.call(props, _expandedRowKeys);
  47786. }
  47787. const flushingRowHeights = debounce(() => {
  47788. var _a, _b, _c, _d;
  47789. isResetting.value = true;
  47790. rowHeights.value = { ...unref(rowHeights), ...unref(pendingRowHeights) };
  47791. resetAfterIndex(unref(resetIndex), false);
  47792. pendingRowHeights.value = {};
  47793. resetIndex.value = null;
  47794. (_a = mainTableRef.value) == null ? void 0 : _a.forceUpdate();
  47795. (_b = leftTableRef.value) == null ? void 0 : _b.forceUpdate();
  47796. (_c = rightTableRef.value) == null ? void 0 : _c.forceUpdate();
  47797. (_d = vm.proxy) == null ? void 0 : _d.$forceUpdate();
  47798. isResetting.value = false;
  47799. }, 0);
  47800. function resetAfterIndex(index, forceUpdate = false) {
  47801. if (!unref(isDynamic))
  47802. return;
  47803. [mainTableRef, leftTableRef, rightTableRef].forEach((tableRef) => {
  47804. const table = unref(tableRef);
  47805. if (table)
  47806. table.resetAfterRowIndex(index, forceUpdate);
  47807. });
  47808. }
  47809. function resetHeights(rowKey, height, rowIdx) {
  47810. const resetIdx = unref(resetIndex);
  47811. if (resetIdx === null) {
  47812. resetIndex.value = rowIdx;
  47813. } else {
  47814. if (resetIdx > rowIdx) {
  47815. resetIndex.value = rowIdx;
  47816. }
  47817. }
  47818. pendingRowHeights.value[rowKey] = height;
  47819. }
  47820. function onRowHeightChange({ rowKey, height, rowIndex }, fixedDir) {
  47821. if (!fixedDir) {
  47822. mainTableHeights.value[rowKey] = height;
  47823. } else {
  47824. if (fixedDir === FixedDir.RIGHT) {
  47825. rightTableHeights.value[rowKey] = height;
  47826. } else {
  47827. leftTableHeights.value[rowKey] = height;
  47828. }
  47829. }
  47830. const maximumHeight = Math.max(...[leftTableHeights, rightTableHeights, mainTableHeights].map((records) => records.value[rowKey] || 0));
  47831. if (unref(rowHeights)[rowKey] !== maximumHeight) {
  47832. resetHeights(rowKey, maximumHeight, rowIndex);
  47833. flushingRowHeights();
  47834. }
  47835. }
  47836. return {
  47837. expandedRowKeys,
  47838. lastRenderedRowIndex,
  47839. isDynamic,
  47840. isResetting,
  47841. rowHeights,
  47842. resetAfterIndex,
  47843. onRowExpanded,
  47844. onRowHovered,
  47845. onRowsRendered,
  47846. onRowHeightChange
  47847. };
  47848. };
  47849. const useData = (props, { expandedRowKeys, lastRenderedRowIndex, resetAfterIndex }) => {
  47850. const depthMap = ref({});
  47851. const flattenedData = computed(() => {
  47852. const depths = {};
  47853. const { data: data2, rowKey } = props;
  47854. const _expandedRowKeys = unref(expandedRowKeys);
  47855. if (!_expandedRowKeys || !_expandedRowKeys.length)
  47856. return data2;
  47857. const array = [];
  47858. const keysSet = /* @__PURE__ */ new Set();
  47859. _expandedRowKeys.forEach((x) => keysSet.add(x));
  47860. let copy = data2.slice();
  47861. copy.forEach((x) => depths[x[rowKey]] = 0);
  47862. while (copy.length > 0) {
  47863. const item = copy.shift();
  47864. array.push(item);
  47865. if (keysSet.has(item[rowKey]) && isArray$1(item.children) && item.children.length > 0) {
  47866. copy = [...item.children, ...copy];
  47867. item.children.forEach((child) => depths[child[rowKey]] = depths[item[rowKey]] + 1);
  47868. }
  47869. }
  47870. depthMap.value = depths;
  47871. return array;
  47872. });
  47873. const data = computed(() => {
  47874. const { data: data2, expandColumnKey } = props;
  47875. return expandColumnKey ? unref(flattenedData) : data2;
  47876. });
  47877. watch(data, (val, prev) => {
  47878. if (val !== prev) {
  47879. lastRenderedRowIndex.value = -1;
  47880. resetAfterIndex(0, true);
  47881. }
  47882. });
  47883. return {
  47884. data,
  47885. depthMap
  47886. };
  47887. };
  47888. const sumReducer = (sum2, num) => sum2 + num;
  47889. const sum = (listLike) => {
  47890. return isArray$1(listLike) ? listLike.reduce(sumReducer, 0) : listLike;
  47891. };
  47892. const tryCall = (fLike, params, defaultRet = {}) => {
  47893. return isFunction$1(fLike) ? fLike(params) : fLike != null ? fLike : defaultRet;
  47894. };
  47895. const enforceUnit = (style) => {
  47896. ["width", "maxWidth", "minWidth", "height"].forEach((key) => {
  47897. style[key] = addUnit(style[key]);
  47898. });
  47899. return style;
  47900. };
  47901. const componentToSlot = (ComponentLike) => isVNode(ComponentLike) ? (props) => h$1(ComponentLike, props) : ComponentLike;
  47902. const useStyles = (props, {
  47903. columnsTotalWidth,
  47904. rowsHeight,
  47905. fixedColumnsOnLeft,
  47906. fixedColumnsOnRight
  47907. }) => {
  47908. const bodyWidth = computed(() => {
  47909. const { fixed, width, vScrollbarSize } = props;
  47910. const ret = width - vScrollbarSize;
  47911. return fixed ? Math.max(Math.round(unref(columnsTotalWidth)), ret) : ret;
  47912. });
  47913. const headerWidth = computed(() => unref(bodyWidth) + props.vScrollbarSize);
  47914. const mainTableHeight = computed(() => {
  47915. const { height = 0, maxHeight = 0, footerHeight: footerHeight2, hScrollbarSize } = props;
  47916. if (maxHeight > 0) {
  47917. const _fixedRowsHeight = unref(fixedRowsHeight);
  47918. const _rowsHeight = unref(rowsHeight);
  47919. const _headerHeight = unref(headerHeight);
  47920. const total = _headerHeight + _fixedRowsHeight + _rowsHeight + hScrollbarSize;
  47921. return Math.min(total, maxHeight - footerHeight2);
  47922. }
  47923. return height - footerHeight2;
  47924. });
  47925. const fixedTableHeight = computed(() => {
  47926. const { maxHeight } = props;
  47927. const tableHeight = unref(mainTableHeight);
  47928. if (isNumber(maxHeight) && maxHeight > 0)
  47929. return tableHeight;
  47930. const totalHeight = unref(rowsHeight) + unref(headerHeight) + unref(fixedRowsHeight);
  47931. return Math.min(tableHeight, totalHeight);
  47932. });
  47933. const mapColumn = (column) => column.width;
  47934. const leftTableWidth = computed(() => sum(unref(fixedColumnsOnLeft).map(mapColumn)));
  47935. const rightTableWidth = computed(() => sum(unref(fixedColumnsOnRight).map(mapColumn)));
  47936. const headerHeight = computed(() => sum(props.headerHeight));
  47937. const fixedRowsHeight = computed(() => {
  47938. var _a;
  47939. return (((_a = props.fixedData) == null ? void 0 : _a.length) || 0) * props.rowHeight;
  47940. });
  47941. const windowHeight = computed(() => {
  47942. return unref(mainTableHeight) - unref(headerHeight) - unref(fixedRowsHeight);
  47943. });
  47944. const rootStyle = computed(() => {
  47945. const { style = {}, height, width } = props;
  47946. return enforceUnit({
  47947. ...style,
  47948. height,
  47949. width
  47950. });
  47951. });
  47952. const footerHeight = computed(() => enforceUnit({ height: props.footerHeight }));
  47953. const emptyStyle = computed(() => ({
  47954. top: addUnit(unref(headerHeight)),
  47955. bottom: addUnit(props.footerHeight),
  47956. width: addUnit(props.width)
  47957. }));
  47958. return {
  47959. bodyWidth,
  47960. fixedTableHeight,
  47961. mainTableHeight,
  47962. leftTableWidth,
  47963. rightTableWidth,
  47964. headerWidth,
  47965. windowHeight,
  47966. footerHeight,
  47967. emptyStyle,
  47968. rootStyle,
  47969. headerHeight
  47970. };
  47971. };
  47972. const useAutoResize = (props) => {
  47973. const sizer = ref();
  47974. const width$ = ref(0);
  47975. const height$ = ref(0);
  47976. let resizerStopper;
  47977. onMounted(() => {
  47978. resizerStopper = useResizeObserver(sizer, ([entry]) => {
  47979. const { width, height } = entry.contentRect;
  47980. const { paddingLeft, paddingRight, paddingTop, paddingBottom } = getComputedStyle(entry.target);
  47981. const left = Number.parseInt(paddingLeft) || 0;
  47982. const right = Number.parseInt(paddingRight) || 0;
  47983. const top = Number.parseInt(paddingTop) || 0;
  47984. const bottom = Number.parseInt(paddingBottom) || 0;
  47985. width$.value = width - left - right;
  47986. height$.value = height - top - bottom;
  47987. }).stop;
  47988. });
  47989. onBeforeUnmount(() => {
  47990. resizerStopper == null ? void 0 : resizerStopper();
  47991. });
  47992. watch([width$, height$], ([width, height]) => {
  47993. var _a;
  47994. (_a = props.onResize) == null ? void 0 : _a.call(props, {
  47995. width,
  47996. height
  47997. });
  47998. });
  47999. return {
  48000. sizer,
  48001. width: width$,
  48002. height: height$
  48003. };
  48004. };
  48005. function useTable(props) {
  48006. const mainTableRef = ref();
  48007. const leftTableRef = ref();
  48008. const rightTableRef = ref();
  48009. const {
  48010. columns,
  48011. columnsStyles,
  48012. columnsTotalWidth,
  48013. fixedColumnsOnLeft,
  48014. fixedColumnsOnRight,
  48015. hasFixedColumns,
  48016. mainColumns,
  48017. onColumnSorted
  48018. } = useColumns(props, toRef(props, "columns"), toRef(props, "fixed"));
  48019. const {
  48020. scrollTo,
  48021. scrollToLeft,
  48022. scrollToTop,
  48023. scrollToRow,
  48024. onScroll,
  48025. onVerticalScroll,
  48026. scrollPos
  48027. } = useScrollbar(props, {
  48028. mainTableRef,
  48029. leftTableRef,
  48030. rightTableRef,
  48031. onMaybeEndReached
  48032. });
  48033. const ns = useNamespace("table-v2");
  48034. const instance = getCurrentInstance();
  48035. const isScrolling = shallowRef(false);
  48036. const {
  48037. expandedRowKeys,
  48038. lastRenderedRowIndex,
  48039. isDynamic,
  48040. isResetting,
  48041. rowHeights,
  48042. resetAfterIndex,
  48043. onRowExpanded,
  48044. onRowHeightChange,
  48045. onRowHovered,
  48046. onRowsRendered
  48047. } = useRow(props, {
  48048. mainTableRef,
  48049. leftTableRef,
  48050. rightTableRef,
  48051. tableInstance: instance,
  48052. ns,
  48053. isScrolling
  48054. });
  48055. const { data, depthMap } = useData(props, {
  48056. expandedRowKeys,
  48057. lastRenderedRowIndex,
  48058. resetAfterIndex
  48059. });
  48060. const rowsHeight = computed(() => {
  48061. const { estimatedRowHeight, rowHeight } = props;
  48062. const _data = unref(data);
  48063. if (isNumber(estimatedRowHeight)) {
  48064. return Object.values(unref(rowHeights)).reduce((acc, curr) => acc + curr, 0);
  48065. }
  48066. return _data.length * rowHeight;
  48067. });
  48068. const {
  48069. bodyWidth,
  48070. fixedTableHeight,
  48071. mainTableHeight,
  48072. leftTableWidth,
  48073. rightTableWidth,
  48074. headerWidth,
  48075. windowHeight,
  48076. footerHeight,
  48077. emptyStyle,
  48078. rootStyle,
  48079. headerHeight
  48080. } = useStyles(props, {
  48081. columnsTotalWidth,
  48082. fixedColumnsOnLeft,
  48083. fixedColumnsOnRight,
  48084. rowsHeight
  48085. });
  48086. const containerRef = ref();
  48087. const showEmpty = computed(() => {
  48088. const noData = unref(data).length === 0;
  48089. return isArray$1(props.fixedData) ? props.fixedData.length === 0 && noData : noData;
  48090. });
  48091. function getRowHeight(rowIndex) {
  48092. const { estimatedRowHeight, rowHeight, rowKey } = props;
  48093. if (!estimatedRowHeight)
  48094. return rowHeight;
  48095. return unref(rowHeights)[unref(data)[rowIndex][rowKey]] || estimatedRowHeight;
  48096. }
  48097. function onMaybeEndReached() {
  48098. const { onEndReached } = props;
  48099. if (!onEndReached)
  48100. return;
  48101. const { scrollTop } = unref(scrollPos);
  48102. const _totalHeight = unref(rowsHeight);
  48103. const clientHeight = unref(windowHeight);
  48104. const heightUntilEnd = _totalHeight - (scrollTop + clientHeight) + props.hScrollbarSize;
  48105. if (unref(lastRenderedRowIndex) >= 0 && _totalHeight === scrollTop + unref(mainTableHeight) - unref(headerHeight)) {
  48106. onEndReached(heightUntilEnd);
  48107. }
  48108. }
  48109. watch(() => props.expandedRowKeys, (val) => expandedRowKeys.value = val, {
  48110. deep: true
  48111. });
  48112. return {
  48113. columns,
  48114. containerRef,
  48115. mainTableRef,
  48116. leftTableRef,
  48117. rightTableRef,
  48118. isDynamic,
  48119. isResetting,
  48120. isScrolling,
  48121. hasFixedColumns,
  48122. columnsStyles,
  48123. columnsTotalWidth,
  48124. data,
  48125. expandedRowKeys,
  48126. depthMap,
  48127. fixedColumnsOnLeft,
  48128. fixedColumnsOnRight,
  48129. mainColumns,
  48130. bodyWidth,
  48131. emptyStyle,
  48132. rootStyle,
  48133. headerWidth,
  48134. footerHeight,
  48135. mainTableHeight,
  48136. fixedTableHeight,
  48137. leftTableWidth,
  48138. rightTableWidth,
  48139. showEmpty,
  48140. getRowHeight,
  48141. onColumnSorted,
  48142. onRowHovered,
  48143. onRowExpanded,
  48144. onRowsRendered,
  48145. onRowHeightChange,
  48146. scrollTo,
  48147. scrollToLeft,
  48148. scrollToTop,
  48149. scrollToRow,
  48150. onScroll,
  48151. onVerticalScroll
  48152. };
  48153. }
  48154. const TableV2InjectionKey = Symbol("tableV2");
  48155. const classType = String;
  48156. const columns = {
  48157. type: definePropType(Array),
  48158. required: true
  48159. };
  48160. const fixedDataType = {
  48161. type: definePropType(Array)
  48162. };
  48163. const dataType = {
  48164. ...fixedDataType,
  48165. required: true
  48166. };
  48167. const expandColumnKey = String;
  48168. const expandKeys = {
  48169. type: definePropType(Array),
  48170. default: () => mutable([])
  48171. };
  48172. const requiredNumber = {
  48173. type: Number,
  48174. required: true
  48175. };
  48176. const rowKey = {
  48177. type: definePropType([String, Number, Symbol]),
  48178. default: "id"
  48179. };
  48180. const styleType = {
  48181. type: definePropType(Object)
  48182. };
  48183. const tableV2RowProps = buildProps({
  48184. class: String,
  48185. columns,
  48186. columnsStyles: {
  48187. type: definePropType(Object),
  48188. required: true
  48189. },
  48190. depth: Number,
  48191. expandColumnKey,
  48192. estimatedRowHeight: {
  48193. ...virtualizedGridProps.estimatedRowHeight,
  48194. default: void 0
  48195. },
  48196. isScrolling: Boolean,
  48197. onRowExpand: {
  48198. type: definePropType(Function)
  48199. },
  48200. onRowHover: {
  48201. type: definePropType(Function)
  48202. },
  48203. onRowHeightChange: {
  48204. type: definePropType(Function)
  48205. },
  48206. rowData: {
  48207. type: definePropType(Object),
  48208. required: true
  48209. },
  48210. rowEventHandlers: {
  48211. type: definePropType(Object)
  48212. },
  48213. rowIndex: {
  48214. type: Number,
  48215. required: true
  48216. },
  48217. rowKey,
  48218. style: {
  48219. type: definePropType(Object)
  48220. }
  48221. });
  48222. const requiredNumberType = {
  48223. type: Number,
  48224. required: true
  48225. };
  48226. const tableV2HeaderProps = buildProps({
  48227. class: String,
  48228. columns,
  48229. fixedHeaderData: {
  48230. type: definePropType(Array)
  48231. },
  48232. headerData: {
  48233. type: definePropType(Array),
  48234. required: true
  48235. },
  48236. headerHeight: {
  48237. type: definePropType([Number, Array]),
  48238. default: 50
  48239. },
  48240. rowWidth: requiredNumberType,
  48241. rowHeight: {
  48242. type: Number,
  48243. default: 50
  48244. },
  48245. height: requiredNumberType,
  48246. width: requiredNumberType
  48247. });
  48248. const tableV2GridProps = buildProps({
  48249. columns,
  48250. data: dataType,
  48251. fixedData: fixedDataType,
  48252. estimatedRowHeight: tableV2RowProps.estimatedRowHeight,
  48253. width: requiredNumber,
  48254. height: requiredNumber,
  48255. headerWidth: requiredNumber,
  48256. headerHeight: tableV2HeaderProps.headerHeight,
  48257. bodyWidth: requiredNumber,
  48258. rowHeight: requiredNumber,
  48259. cache: virtualizedListProps.cache,
  48260. useIsScrolling: Boolean,
  48261. scrollbarAlwaysOn: virtualizedGridProps.scrollbarAlwaysOn,
  48262. scrollbarStartGap: virtualizedGridProps.scrollbarStartGap,
  48263. scrollbarEndGap: virtualizedGridProps.scrollbarEndGap,
  48264. class: classType,
  48265. style: styleType,
  48266. containerStyle: styleType,
  48267. getRowHeight: {
  48268. type: definePropType(Function),
  48269. required: true
  48270. },
  48271. rowKey: tableV2RowProps.rowKey,
  48272. onRowsRendered: {
  48273. type: definePropType(Function)
  48274. },
  48275. onScroll: {
  48276. type: definePropType(Function)
  48277. }
  48278. });
  48279. const tableV2Props = buildProps({
  48280. cache: tableV2GridProps.cache,
  48281. estimatedRowHeight: tableV2RowProps.estimatedRowHeight,
  48282. rowKey,
  48283. headerClass: {
  48284. type: definePropType([
  48285. String,
  48286. Function
  48287. ])
  48288. },
  48289. headerProps: {
  48290. type: definePropType([
  48291. Object,
  48292. Function
  48293. ])
  48294. },
  48295. headerCellProps: {
  48296. type: definePropType([
  48297. Object,
  48298. Function
  48299. ])
  48300. },
  48301. headerHeight: tableV2HeaderProps.headerHeight,
  48302. footerHeight: {
  48303. type: Number,
  48304. default: 0
  48305. },
  48306. rowClass: {
  48307. type: definePropType([String, Function])
  48308. },
  48309. rowProps: {
  48310. type: definePropType([Object, Function])
  48311. },
  48312. rowHeight: {
  48313. type: Number,
  48314. default: 50
  48315. },
  48316. cellProps: {
  48317. type: definePropType([
  48318. Object,
  48319. Function
  48320. ])
  48321. },
  48322. columns,
  48323. data: dataType,
  48324. dataGetter: {
  48325. type: definePropType(Function)
  48326. },
  48327. fixedData: fixedDataType,
  48328. expandColumnKey: tableV2RowProps.expandColumnKey,
  48329. expandedRowKeys: expandKeys,
  48330. defaultExpandedRowKeys: expandKeys,
  48331. class: classType,
  48332. fixed: Boolean,
  48333. style: {
  48334. type: definePropType(Object)
  48335. },
  48336. width: requiredNumber,
  48337. height: requiredNumber,
  48338. maxHeight: Number,
  48339. useIsScrolling: Boolean,
  48340. indentSize: {
  48341. type: Number,
  48342. default: 12
  48343. },
  48344. iconSize: {
  48345. type: Number,
  48346. default: 12
  48347. },
  48348. hScrollbarSize: virtualizedGridProps.hScrollbarSize,
  48349. vScrollbarSize: virtualizedGridProps.vScrollbarSize,
  48350. scrollbarAlwaysOn: virtualizedScrollbarProps.alwaysOn,
  48351. sortBy: {
  48352. type: definePropType(Object),
  48353. default: () => ({})
  48354. },
  48355. sortState: {
  48356. type: definePropType(Object),
  48357. default: void 0
  48358. },
  48359. onColumnSort: {
  48360. type: definePropType(Function)
  48361. },
  48362. onExpandedRowsChange: {
  48363. type: definePropType(Function)
  48364. },
  48365. onEndReached: {
  48366. type: definePropType(Function)
  48367. },
  48368. onRowExpand: tableV2RowProps.onRowExpand,
  48369. onScroll: tableV2GridProps.onScroll,
  48370. onRowsRendered: tableV2GridProps.onRowsRendered,
  48371. rowEventHandlers: tableV2RowProps.rowEventHandlers
  48372. });
  48373. const TableV2Cell = (props, {
  48374. slots
  48375. }) => {
  48376. var _a;
  48377. const {
  48378. cellData,
  48379. style
  48380. } = props;
  48381. const displayText = ((_a = cellData == null ? void 0 : cellData.toString) == null ? void 0 : _a.call(cellData)) || "";
  48382. const defaultSlot = renderSlot(slots, "default", props, () => [displayText]);
  48383. return createVNode("div", {
  48384. "class": props.class,
  48385. "title": displayText,
  48386. "style": style
  48387. }, [defaultSlot]);
  48388. };
  48389. TableV2Cell.displayName = "ElTableV2Cell";
  48390. TableV2Cell.inheritAttrs = false;
  48391. var TableCell = TableV2Cell;
  48392. const HeaderCell = (props, {
  48393. slots
  48394. }) => renderSlot(slots, "default", props, () => {
  48395. var _a, _b;
  48396. return [createVNode("div", {
  48397. "class": props.class,
  48398. "title": (_a = props.column) == null ? void 0 : _a.title
  48399. }, [(_b = props.column) == null ? void 0 : _b.title])];
  48400. });
  48401. HeaderCell.displayName = "ElTableV2HeaderCell";
  48402. HeaderCell.inheritAttrs = false;
  48403. var HeaderCell$1 = HeaderCell;
  48404. const tableV2HeaderRowProps = buildProps({
  48405. class: String,
  48406. columns,
  48407. columnsStyles: {
  48408. type: definePropType(Object),
  48409. required: true
  48410. },
  48411. headerIndex: Number,
  48412. style: { type: definePropType(Object) }
  48413. });
  48414. const TableV2HeaderRow = defineComponent({
  48415. name: "ElTableV2HeaderRow",
  48416. props: tableV2HeaderRowProps,
  48417. setup(props, {
  48418. slots
  48419. }) {
  48420. return () => {
  48421. const {
  48422. columns,
  48423. columnsStyles,
  48424. headerIndex,
  48425. style
  48426. } = props;
  48427. let Cells = columns.map((column, columnIndex) => {
  48428. return slots.cell({
  48429. columns,
  48430. column,
  48431. columnIndex,
  48432. headerIndex,
  48433. style: columnsStyles[column.key]
  48434. });
  48435. });
  48436. if (slots.header) {
  48437. Cells = slots.header({
  48438. cells: Cells.map((node) => {
  48439. if (isArray$1(node) && node.length === 1) {
  48440. return node[0];
  48441. }
  48442. return node;
  48443. }),
  48444. columns,
  48445. headerIndex
  48446. });
  48447. }
  48448. return createVNode("div", {
  48449. "class": props.class,
  48450. "style": style,
  48451. "role": "row"
  48452. }, [Cells]);
  48453. };
  48454. }
  48455. });
  48456. var HeaderRow = TableV2HeaderRow;
  48457. const COMPONENT_NAME$7 = "ElTableV2Header";
  48458. const TableV2Header = defineComponent({
  48459. name: COMPONENT_NAME$7,
  48460. props: tableV2HeaderProps,
  48461. setup(props, {
  48462. slots,
  48463. expose
  48464. }) {
  48465. const ns = useNamespace("table-v2");
  48466. const scrollLeftInfo = inject("tableV2GridScrollLeft");
  48467. const headerRef = ref();
  48468. const headerStyle = computed(() => enforceUnit({
  48469. width: props.width,
  48470. height: props.height
  48471. }));
  48472. const rowStyle = computed(() => enforceUnit({
  48473. width: props.rowWidth,
  48474. height: props.height
  48475. }));
  48476. const headerHeights = computed(() => castArray$1(unref(props.headerHeight)));
  48477. const scrollToLeft = (left) => {
  48478. const headerEl = unref(headerRef);
  48479. nextTick(() => {
  48480. (headerEl == null ? void 0 : headerEl.scroll) && headerEl.scroll({
  48481. left
  48482. });
  48483. });
  48484. };
  48485. const renderFixedRows = () => {
  48486. const fixedRowClassName = ns.e("fixed-header-row");
  48487. const {
  48488. columns,
  48489. fixedHeaderData,
  48490. rowHeight
  48491. } = props;
  48492. return fixedHeaderData == null ? void 0 : fixedHeaderData.map((fixedRowData, fixedRowIndex) => {
  48493. var _a;
  48494. const style = enforceUnit({
  48495. height: rowHeight,
  48496. width: "100%"
  48497. });
  48498. return (_a = slots.fixed) == null ? void 0 : _a.call(slots, {
  48499. class: fixedRowClassName,
  48500. columns,
  48501. rowData: fixedRowData,
  48502. rowIndex: -(fixedRowIndex + 1),
  48503. style
  48504. });
  48505. });
  48506. };
  48507. const renderDynamicRows = () => {
  48508. const dynamicRowClassName = ns.e("dynamic-header-row");
  48509. const {
  48510. columns
  48511. } = props;
  48512. return unref(headerHeights).map((rowHeight, rowIndex) => {
  48513. var _a;
  48514. const style = enforceUnit({
  48515. width: "100%",
  48516. height: rowHeight
  48517. });
  48518. return (_a = slots.dynamic) == null ? void 0 : _a.call(slots, {
  48519. class: dynamicRowClassName,
  48520. columns,
  48521. headerIndex: rowIndex,
  48522. style
  48523. });
  48524. });
  48525. };
  48526. onUpdated(() => {
  48527. if (scrollLeftInfo == null ? void 0 : scrollLeftInfo.value) {
  48528. scrollToLeft(scrollLeftInfo.value);
  48529. }
  48530. });
  48531. expose({
  48532. scrollToLeft
  48533. });
  48534. return () => {
  48535. if (props.height <= 0)
  48536. return;
  48537. return createVNode("div", {
  48538. "ref": headerRef,
  48539. "class": props.class,
  48540. "style": unref(headerStyle),
  48541. "role": "rowgroup"
  48542. }, [createVNode("div", {
  48543. "style": unref(rowStyle),
  48544. "class": ns.e("header")
  48545. }, [renderDynamicRows(), renderFixedRows()])]);
  48546. };
  48547. }
  48548. });
  48549. var Header = TableV2Header;
  48550. const useTableRow = (props) => {
  48551. const {
  48552. isScrolling
  48553. } = inject(TableV2InjectionKey);
  48554. const measured = ref(false);
  48555. const rowRef = ref();
  48556. const measurable = computed(() => {
  48557. return isNumber(props.estimatedRowHeight) && props.rowIndex >= 0;
  48558. });
  48559. const doMeasure = (isInit = false) => {
  48560. const $rowRef = unref(rowRef);
  48561. if (!$rowRef)
  48562. return;
  48563. const {
  48564. columns,
  48565. onRowHeightChange,
  48566. rowKey,
  48567. rowIndex,
  48568. style
  48569. } = props;
  48570. const {
  48571. height
  48572. } = $rowRef.getBoundingClientRect();
  48573. measured.value = true;
  48574. nextTick(() => {
  48575. if (isInit || height !== Number.parseInt(style.height)) {
  48576. const firstColumn = columns[0];
  48577. const isPlaceholder = (firstColumn == null ? void 0 : firstColumn.placeholderSign) === placeholderSign;
  48578. onRowHeightChange == null ? void 0 : onRowHeightChange({
  48579. rowKey,
  48580. height,
  48581. rowIndex
  48582. }, firstColumn && !isPlaceholder && firstColumn.fixed);
  48583. }
  48584. });
  48585. };
  48586. const eventHandlers = computed(() => {
  48587. const {
  48588. rowData,
  48589. rowIndex,
  48590. rowKey,
  48591. onRowHover
  48592. } = props;
  48593. const handlers = props.rowEventHandlers || {};
  48594. const eventHandlers2 = {};
  48595. Object.entries(handlers).forEach(([eventName, handler]) => {
  48596. if (isFunction$1(handler)) {
  48597. eventHandlers2[eventName] = (event) => {
  48598. handler({
  48599. event,
  48600. rowData,
  48601. rowIndex,
  48602. rowKey
  48603. });
  48604. };
  48605. }
  48606. });
  48607. if (onRowHover) {
  48608. [{
  48609. name: "onMouseleave",
  48610. hovered: false
  48611. }, {
  48612. name: "onMouseenter",
  48613. hovered: true
  48614. }].forEach(({
  48615. name,
  48616. hovered
  48617. }) => {
  48618. const existedHandler = eventHandlers2[name];
  48619. eventHandlers2[name] = (event) => {
  48620. onRowHover({
  48621. event,
  48622. hovered,
  48623. rowData,
  48624. rowIndex,
  48625. rowKey
  48626. });
  48627. existedHandler == null ? void 0 : existedHandler(event);
  48628. };
  48629. });
  48630. }
  48631. return eventHandlers2;
  48632. });
  48633. const onExpand = (expanded) => {
  48634. const {
  48635. onRowExpand,
  48636. rowData,
  48637. rowIndex,
  48638. rowKey
  48639. } = props;
  48640. onRowExpand == null ? void 0 : onRowExpand({
  48641. expanded,
  48642. rowData,
  48643. rowIndex,
  48644. rowKey
  48645. });
  48646. };
  48647. onMounted(() => {
  48648. if (unref(measurable)) {
  48649. doMeasure(true);
  48650. }
  48651. });
  48652. return {
  48653. isScrolling,
  48654. measurable,
  48655. measured,
  48656. rowRef,
  48657. eventHandlers,
  48658. onExpand
  48659. };
  48660. };
  48661. const COMPONENT_NAME$6 = "ElTableV2TableRow";
  48662. const TableV2Row = defineComponent({
  48663. name: COMPONENT_NAME$6,
  48664. props: tableV2RowProps,
  48665. setup(props, {
  48666. expose,
  48667. slots,
  48668. attrs
  48669. }) {
  48670. const {
  48671. eventHandlers,
  48672. isScrolling,
  48673. measurable,
  48674. measured,
  48675. rowRef,
  48676. onExpand
  48677. } = useTableRow(props);
  48678. expose({
  48679. onExpand
  48680. });
  48681. return () => {
  48682. const {
  48683. columns,
  48684. columnsStyles,
  48685. expandColumnKey,
  48686. depth,
  48687. rowData,
  48688. rowIndex,
  48689. style
  48690. } = props;
  48691. let ColumnCells = columns.map((column, columnIndex) => {
  48692. const expandable = isArray$1(rowData.children) && rowData.children.length > 0 && column.key === expandColumnKey;
  48693. return slots.cell({
  48694. column,
  48695. columns,
  48696. columnIndex,
  48697. depth,
  48698. style: columnsStyles[column.key],
  48699. rowData,
  48700. rowIndex,
  48701. isScrolling: unref(isScrolling),
  48702. expandIconProps: expandable ? {
  48703. rowData,
  48704. rowIndex,
  48705. onExpand
  48706. } : void 0
  48707. });
  48708. });
  48709. if (slots.row) {
  48710. ColumnCells = slots.row({
  48711. cells: ColumnCells.map((node) => {
  48712. if (isArray$1(node) && node.length === 1) {
  48713. return node[0];
  48714. }
  48715. return node;
  48716. }),
  48717. style,
  48718. columns,
  48719. depth,
  48720. rowData,
  48721. rowIndex,
  48722. isScrolling: unref(isScrolling)
  48723. });
  48724. }
  48725. if (unref(measurable)) {
  48726. const {
  48727. height,
  48728. ...exceptHeightStyle
  48729. } = style || {};
  48730. const _measured = unref(measured);
  48731. return createVNode("div", mergeProps({
  48732. "ref": rowRef,
  48733. "class": props.class,
  48734. "style": _measured ? style : exceptHeightStyle,
  48735. "role": "row"
  48736. }, attrs, unref(eventHandlers)), [ColumnCells]);
  48737. }
  48738. return createVNode("div", mergeProps(attrs, {
  48739. "ref": rowRef,
  48740. "class": props.class,
  48741. "style": style,
  48742. "role": "row"
  48743. }, unref(eventHandlers)), [ColumnCells]);
  48744. };
  48745. }
  48746. });
  48747. var Row = TableV2Row;
  48748. const SortIcon = (props) => {
  48749. const {
  48750. sortOrder
  48751. } = props;
  48752. return createVNode(ElIcon, {
  48753. "size": 14,
  48754. "class": props.class
  48755. }, {
  48756. default: () => [sortOrder === SortOrder.ASC ? createVNode(sort_up_default, null, null) : createVNode(sort_down_default, null, null)]
  48757. });
  48758. };
  48759. var SortIcon$1 = SortIcon;
  48760. const ExpandIcon = (props) => {
  48761. const {
  48762. expanded,
  48763. expandable,
  48764. onExpand,
  48765. style,
  48766. size
  48767. } = props;
  48768. const expandIconProps = {
  48769. onClick: expandable ? () => onExpand(!expanded) : void 0,
  48770. class: props.class
  48771. };
  48772. return createVNode(ElIcon, mergeProps(expandIconProps, {
  48773. "size": size,
  48774. "style": style
  48775. }), {
  48776. default: () => [createVNode(arrow_right_default, null, null)]
  48777. });
  48778. };
  48779. var ExpandIcon$1 = ExpandIcon;
  48780. const COMPONENT_NAME$5 = "ElTableV2Grid";
  48781. const useTableGrid = (props) => {
  48782. const headerRef = ref();
  48783. const bodyRef = ref();
  48784. const scrollLeft = ref(0);
  48785. const totalHeight = computed(() => {
  48786. const {
  48787. data,
  48788. rowHeight,
  48789. estimatedRowHeight
  48790. } = props;
  48791. if (estimatedRowHeight) {
  48792. return;
  48793. }
  48794. return data.length * rowHeight;
  48795. });
  48796. const fixedRowHeight = computed(() => {
  48797. const {
  48798. fixedData,
  48799. rowHeight
  48800. } = props;
  48801. return ((fixedData == null ? void 0 : fixedData.length) || 0) * rowHeight;
  48802. });
  48803. const headerHeight = computed(() => sum(props.headerHeight));
  48804. const gridHeight = computed(() => {
  48805. const {
  48806. height
  48807. } = props;
  48808. return Math.max(0, height - unref(headerHeight) - unref(fixedRowHeight));
  48809. });
  48810. const hasHeader = computed(() => {
  48811. return unref(headerHeight) + unref(fixedRowHeight) > 0;
  48812. });
  48813. const itemKey = ({
  48814. data,
  48815. rowIndex
  48816. }) => data[rowIndex][props.rowKey];
  48817. function onItemRendered({
  48818. rowCacheStart,
  48819. rowCacheEnd,
  48820. rowVisibleStart,
  48821. rowVisibleEnd
  48822. }) {
  48823. var _a;
  48824. (_a = props.onRowsRendered) == null ? void 0 : _a.call(props, {
  48825. rowCacheStart,
  48826. rowCacheEnd,
  48827. rowVisibleStart,
  48828. rowVisibleEnd
  48829. });
  48830. }
  48831. function resetAfterRowIndex(index, forceUpdate2) {
  48832. var _a;
  48833. (_a = bodyRef.value) == null ? void 0 : _a.resetAfterRowIndex(index, forceUpdate2);
  48834. }
  48835. function scrollTo(leftOrOptions, top) {
  48836. const header$ = unref(headerRef);
  48837. const body$ = unref(bodyRef);
  48838. if (isObject$1(leftOrOptions)) {
  48839. header$ == null ? void 0 : header$.scrollToLeft(leftOrOptions.scrollLeft);
  48840. scrollLeft.value = leftOrOptions.scrollLeft;
  48841. body$ == null ? void 0 : body$.scrollTo(leftOrOptions);
  48842. } else {
  48843. header$ == null ? void 0 : header$.scrollToLeft(leftOrOptions);
  48844. scrollLeft.value = leftOrOptions;
  48845. body$ == null ? void 0 : body$.scrollTo({
  48846. scrollLeft: leftOrOptions,
  48847. scrollTop: top
  48848. });
  48849. }
  48850. }
  48851. function scrollToTop(scrollTop) {
  48852. var _a;
  48853. (_a = unref(bodyRef)) == null ? void 0 : _a.scrollTo({
  48854. scrollTop
  48855. });
  48856. }
  48857. function scrollToRow(row, strategy) {
  48858. var _a;
  48859. (_a = unref(bodyRef)) == null ? void 0 : _a.scrollToItem(row, 1, strategy);
  48860. }
  48861. function forceUpdate() {
  48862. var _a, _b;
  48863. (_a = unref(bodyRef)) == null ? void 0 : _a.$forceUpdate();
  48864. (_b = unref(headerRef)) == null ? void 0 : _b.$forceUpdate();
  48865. }
  48866. watch(() => props.bodyWidth, () => {
  48867. var _a;
  48868. if (isNumber(props.estimatedRowHeight))
  48869. (_a = bodyRef.value) == null ? void 0 : _a.resetAfter({
  48870. columnIndex: 0
  48871. }, false);
  48872. });
  48873. return {
  48874. bodyRef,
  48875. forceUpdate,
  48876. fixedRowHeight,
  48877. gridHeight,
  48878. hasHeader,
  48879. headerHeight,
  48880. headerRef,
  48881. totalHeight,
  48882. itemKey,
  48883. onItemRendered,
  48884. resetAfterRowIndex,
  48885. scrollTo,
  48886. scrollToTop,
  48887. scrollToRow,
  48888. scrollLeft
  48889. };
  48890. };
  48891. const TableGrid = defineComponent({
  48892. name: COMPONENT_NAME$5,
  48893. props: tableV2GridProps,
  48894. setup(props, {
  48895. slots,
  48896. expose
  48897. }) {
  48898. const {
  48899. ns
  48900. } = inject(TableV2InjectionKey);
  48901. const {
  48902. bodyRef,
  48903. fixedRowHeight,
  48904. gridHeight,
  48905. hasHeader,
  48906. headerRef,
  48907. headerHeight,
  48908. totalHeight,
  48909. forceUpdate,
  48910. itemKey,
  48911. onItemRendered,
  48912. resetAfterRowIndex,
  48913. scrollTo,
  48914. scrollToTop,
  48915. scrollToRow,
  48916. scrollLeft
  48917. } = useTableGrid(props);
  48918. provide("tableV2GridScrollLeft", scrollLeft);
  48919. expose({
  48920. forceUpdate,
  48921. totalHeight,
  48922. scrollTo,
  48923. scrollToTop,
  48924. scrollToRow,
  48925. resetAfterRowIndex
  48926. });
  48927. const getColumnWidth = () => props.bodyWidth;
  48928. return () => {
  48929. const {
  48930. cache,
  48931. columns,
  48932. data,
  48933. fixedData,
  48934. useIsScrolling,
  48935. scrollbarAlwaysOn,
  48936. scrollbarEndGap,
  48937. scrollbarStartGap,
  48938. style,
  48939. rowHeight,
  48940. bodyWidth,
  48941. estimatedRowHeight,
  48942. headerWidth,
  48943. height,
  48944. width,
  48945. getRowHeight,
  48946. onScroll
  48947. } = props;
  48948. const isDynamicRowEnabled = isNumber(estimatedRowHeight);
  48949. const Grid = isDynamicRowEnabled ? DynamicSizeGrid$1 : FixedSizeGrid$1;
  48950. const _headerHeight = unref(headerHeight);
  48951. return createVNode("div", {
  48952. "role": "table",
  48953. "class": [ns.e("table"), props.class],
  48954. "style": style
  48955. }, [createVNode(Grid, {
  48956. "ref": bodyRef,
  48957. "data": data,
  48958. "useIsScrolling": useIsScrolling,
  48959. "itemKey": itemKey,
  48960. "columnCache": 0,
  48961. "columnWidth": isDynamicRowEnabled ? getColumnWidth : bodyWidth,
  48962. "totalColumn": 1,
  48963. "totalRow": data.length,
  48964. "rowCache": cache,
  48965. "rowHeight": isDynamicRowEnabled ? getRowHeight : rowHeight,
  48966. "width": width,
  48967. "height": unref(gridHeight),
  48968. "class": ns.e("body"),
  48969. "role": "rowgroup",
  48970. "scrollbarStartGap": scrollbarStartGap,
  48971. "scrollbarEndGap": scrollbarEndGap,
  48972. "scrollbarAlwaysOn": scrollbarAlwaysOn,
  48973. "onScroll": onScroll,
  48974. "onItemRendered": onItemRendered,
  48975. "perfMode": false
  48976. }, {
  48977. default: (params) => {
  48978. var _a;
  48979. const rowData = data[params.rowIndex];
  48980. return (_a = slots.row) == null ? void 0 : _a.call(slots, {
  48981. ...params,
  48982. columns,
  48983. rowData
  48984. });
  48985. }
  48986. }), unref(hasHeader) && createVNode(Header, {
  48987. "ref": headerRef,
  48988. "class": ns.e("header-wrapper"),
  48989. "columns": columns,
  48990. "headerData": data,
  48991. "headerHeight": props.headerHeight,
  48992. "fixedHeaderData": fixedData,
  48993. "rowWidth": headerWidth,
  48994. "rowHeight": rowHeight,
  48995. "width": width,
  48996. "height": Math.min(_headerHeight + unref(fixedRowHeight), height)
  48997. }, {
  48998. dynamic: slots.header,
  48999. fixed: slots.row
  49000. })]);
  49001. };
  49002. }
  49003. });
  49004. function _isSlot$5(s) {
  49005. return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
  49006. }
  49007. const MainTable = (props, {
  49008. slots
  49009. }) => {
  49010. const {
  49011. mainTableRef,
  49012. ...rest
  49013. } = props;
  49014. return createVNode(TableGrid, mergeProps({
  49015. "ref": mainTableRef
  49016. }, rest), _isSlot$5(slots) ? slots : {
  49017. default: () => [slots]
  49018. });
  49019. };
  49020. function _isSlot$4(s) {
  49021. return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
  49022. }
  49023. const LeftTable$1 = (props, {
  49024. slots
  49025. }) => {
  49026. if (!props.columns.length)
  49027. return;
  49028. const {
  49029. leftTableRef,
  49030. ...rest
  49031. } = props;
  49032. return createVNode(TableGrid, mergeProps({
  49033. "ref": leftTableRef
  49034. }, rest), _isSlot$4(slots) ? slots : {
  49035. default: () => [slots]
  49036. });
  49037. };
  49038. function _isSlot$3(s) {
  49039. return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
  49040. }
  49041. const LeftTable = (props, {
  49042. slots
  49043. }) => {
  49044. if (!props.columns.length)
  49045. return;
  49046. const {
  49047. rightTableRef,
  49048. ...rest
  49049. } = props;
  49050. return createVNode(TableGrid, mergeProps({
  49051. "ref": rightTableRef
  49052. }, rest), _isSlot$3(slots) ? slots : {
  49053. default: () => [slots]
  49054. });
  49055. };
  49056. function _isSlot$2(s) {
  49057. return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
  49058. }
  49059. const RowRenderer = (props, {
  49060. slots
  49061. }) => {
  49062. const {
  49063. columns,
  49064. columnsStyles,
  49065. depthMap,
  49066. expandColumnKey,
  49067. expandedRowKeys,
  49068. estimatedRowHeight,
  49069. hasFixedColumns,
  49070. rowData,
  49071. rowIndex,
  49072. style,
  49073. isScrolling,
  49074. rowProps,
  49075. rowClass,
  49076. rowKey,
  49077. rowEventHandlers,
  49078. ns,
  49079. onRowHovered,
  49080. onRowExpanded
  49081. } = props;
  49082. const rowKls = tryCall(rowClass, {
  49083. columns,
  49084. rowData,
  49085. rowIndex
  49086. }, "");
  49087. const additionalProps = tryCall(rowProps, {
  49088. columns,
  49089. rowData,
  49090. rowIndex
  49091. });
  49092. const _rowKey = rowData[rowKey];
  49093. const depth = depthMap[_rowKey] || 0;
  49094. const canExpand = Boolean(expandColumnKey);
  49095. const isFixedRow = rowIndex < 0;
  49096. const kls = [ns.e("row"), rowKls, {
  49097. [ns.e(`row-depth-${depth}`)]: canExpand && rowIndex >= 0,
  49098. [ns.is("expanded")]: canExpand && expandedRowKeys.includes(_rowKey),
  49099. [ns.is("fixed")]: !depth && isFixedRow,
  49100. [ns.is("customized")]: Boolean(slots.row)
  49101. }];
  49102. const onRowHover = hasFixedColumns ? onRowHovered : void 0;
  49103. const _rowProps = {
  49104. ...additionalProps,
  49105. columns,
  49106. columnsStyles,
  49107. class: kls,
  49108. depth,
  49109. expandColumnKey,
  49110. estimatedRowHeight: isFixedRow ? void 0 : estimatedRowHeight,
  49111. isScrolling,
  49112. rowIndex,
  49113. rowData,
  49114. rowKey: _rowKey,
  49115. rowEventHandlers,
  49116. style
  49117. };
  49118. const handlerMosueEnter = (e) => {
  49119. onRowHover == null ? void 0 : onRowHover({
  49120. hovered: true,
  49121. rowKey: _rowKey,
  49122. event: e,
  49123. rowData,
  49124. rowIndex
  49125. });
  49126. };
  49127. const handlerMouseLeave = (e) => {
  49128. onRowHover == null ? void 0 : onRowHover({
  49129. hovered: false,
  49130. rowKey: _rowKey,
  49131. event: e,
  49132. rowData,
  49133. rowIndex
  49134. });
  49135. };
  49136. return createVNode(Row, mergeProps(_rowProps, {
  49137. "onRowExpand": onRowExpanded,
  49138. "onMouseenter": handlerMosueEnter,
  49139. "onMouseleave": handlerMouseLeave,
  49140. "rowkey": _rowKey
  49141. }), _isSlot$2(slots) ? slots : {
  49142. default: () => [slots]
  49143. });
  49144. };
  49145. const CellRenderer = ({
  49146. columns,
  49147. column,
  49148. columnIndex,
  49149. depth,
  49150. expandIconProps,
  49151. isScrolling,
  49152. rowData,
  49153. rowIndex,
  49154. style,
  49155. expandedRowKeys,
  49156. ns,
  49157. cellProps: _cellProps,
  49158. expandColumnKey,
  49159. indentSize,
  49160. iconSize,
  49161. rowKey
  49162. }, {
  49163. slots
  49164. }) => {
  49165. const cellStyle = enforceUnit(style);
  49166. if (column.placeholderSign === placeholderSign) {
  49167. return createVNode("div", {
  49168. "class": ns.em("row-cell", "placeholder"),
  49169. "style": cellStyle
  49170. }, null);
  49171. }
  49172. const {
  49173. cellRenderer,
  49174. dataKey,
  49175. dataGetter
  49176. } = column;
  49177. const cellData = isFunction$1(dataGetter) ? dataGetter({
  49178. columns,
  49179. column,
  49180. columnIndex,
  49181. rowData,
  49182. rowIndex
  49183. }) : get(rowData, dataKey != null ? dataKey : "");
  49184. const extraCellProps = tryCall(_cellProps, {
  49185. cellData,
  49186. columns,
  49187. column,
  49188. columnIndex,
  49189. rowIndex,
  49190. rowData
  49191. });
  49192. const cellProps = {
  49193. class: ns.e("cell-text"),
  49194. columns,
  49195. column,
  49196. columnIndex,
  49197. cellData,
  49198. isScrolling,
  49199. rowData,
  49200. rowIndex
  49201. };
  49202. const columnCellRenderer = componentToSlot(cellRenderer);
  49203. const Cell = columnCellRenderer ? columnCellRenderer(cellProps) : renderSlot(slots, "default", cellProps, () => [createVNode(TableCell, cellProps, null)]);
  49204. const kls = [ns.e("row-cell"), column.class, column.align === Alignment.CENTER && ns.is("align-center"), column.align === Alignment.RIGHT && ns.is("align-right")];
  49205. const expandable = rowIndex >= 0 && expandColumnKey && column.key === expandColumnKey;
  49206. const expanded = rowIndex >= 0 && expandedRowKeys.includes(rowData[rowKey]);
  49207. let IconOrPlaceholder;
  49208. const iconStyle = `margin-inline-start: ${depth * indentSize}px;`;
  49209. if (expandable) {
  49210. if (isObject$1(expandIconProps)) {
  49211. IconOrPlaceholder = createVNode(ExpandIcon$1, mergeProps(expandIconProps, {
  49212. "class": [ns.e("expand-icon"), ns.is("expanded", expanded)],
  49213. "size": iconSize,
  49214. "expanded": expanded,
  49215. "style": iconStyle,
  49216. "expandable": true
  49217. }), null);
  49218. } else {
  49219. IconOrPlaceholder = createVNode("div", {
  49220. "style": [iconStyle, `width: ${iconSize}px; height: ${iconSize}px;`].join(" ")
  49221. }, null);
  49222. }
  49223. }
  49224. return createVNode("div", mergeProps({
  49225. "class": kls,
  49226. "style": cellStyle
  49227. }, extraCellProps, {
  49228. "role": "cell"
  49229. }), [IconOrPlaceholder, Cell]);
  49230. };
  49231. CellRenderer.inheritAttrs = false;
  49232. function _isSlot$1(s) {
  49233. return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
  49234. }
  49235. const HeaderRenderer = ({
  49236. columns,
  49237. columnsStyles,
  49238. headerIndex,
  49239. style,
  49240. headerClass,
  49241. headerProps,
  49242. ns
  49243. }, {
  49244. slots
  49245. }) => {
  49246. const param = {
  49247. columns,
  49248. headerIndex
  49249. };
  49250. const kls = [ns.e("header-row"), tryCall(headerClass, param, ""), {
  49251. [ns.is("customized")]: Boolean(slots.header)
  49252. }];
  49253. const extraProps = {
  49254. ...tryCall(headerProps, param),
  49255. columnsStyles,
  49256. class: kls,
  49257. columns,
  49258. headerIndex,
  49259. style
  49260. };
  49261. return createVNode(HeaderRow, extraProps, _isSlot$1(slots) ? slots : {
  49262. default: () => [slots]
  49263. });
  49264. };
  49265. const HeaderCellRenderer = (props, {
  49266. slots
  49267. }) => {
  49268. const {
  49269. column,
  49270. ns,
  49271. style,
  49272. onColumnSorted
  49273. } = props;
  49274. const cellStyle = enforceUnit(style);
  49275. if (column.placeholderSign === placeholderSign) {
  49276. return createVNode("div", {
  49277. "class": ns.em("header-row-cell", "placeholder"),
  49278. "style": cellStyle
  49279. }, null);
  49280. }
  49281. const {
  49282. headerCellRenderer,
  49283. headerClass,
  49284. sortable
  49285. } = column;
  49286. const cellProps = {
  49287. ...props,
  49288. class: ns.e("header-cell-text")
  49289. };
  49290. const columnCellRenderer = componentToSlot(headerCellRenderer);
  49291. const Cell = columnCellRenderer ? columnCellRenderer(cellProps) : renderSlot(slots, "default", cellProps, () => [createVNode(HeaderCell$1, cellProps, null)]);
  49292. const {
  49293. sortBy,
  49294. sortState,
  49295. headerCellProps
  49296. } = props;
  49297. let sorting, sortOrder;
  49298. if (sortState) {
  49299. const order = sortState[column.key];
  49300. sorting = Boolean(oppositeOrderMap[order]);
  49301. sortOrder = sorting ? order : SortOrder.ASC;
  49302. } else {
  49303. sorting = column.key === sortBy.key;
  49304. sortOrder = sorting ? sortBy.order : SortOrder.ASC;
  49305. }
  49306. 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")];
  49307. const cellWrapperProps = {
  49308. ...tryCall(headerCellProps, props),
  49309. onClick: column.sortable ? onColumnSorted : void 0,
  49310. class: cellKls,
  49311. style: cellStyle,
  49312. ["data-key"]: column.key
  49313. };
  49314. return createVNode("div", mergeProps(cellWrapperProps, {
  49315. "role": "columnheader"
  49316. }), [Cell, sortable && createVNode(SortIcon$1, {
  49317. "class": [ns.e("sort-icon"), sorting && ns.is("sorting")],
  49318. "sortOrder": sortOrder
  49319. }, null)]);
  49320. };
  49321. const Footer$1 = (props, {
  49322. slots
  49323. }) => {
  49324. var _a;
  49325. return createVNode("div", {
  49326. "class": props.class,
  49327. "style": props.style
  49328. }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
  49329. };
  49330. Footer$1.displayName = "ElTableV2Footer";
  49331. const Footer = (props, {
  49332. slots
  49333. }) => {
  49334. const defaultSlot = renderSlot(slots, "default", {}, () => [createVNode(ElEmpty, null, null)]);
  49335. return createVNode("div", {
  49336. "class": props.class,
  49337. "style": props.style
  49338. }, [defaultSlot]);
  49339. };
  49340. Footer.displayName = "ElTableV2Empty";
  49341. const Overlay = (props, {
  49342. slots
  49343. }) => {
  49344. var _a;
  49345. return createVNode("div", {
  49346. "class": props.class,
  49347. "style": props.style
  49348. }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
  49349. };
  49350. Overlay.displayName = "ElTableV2Overlay";
  49351. function _isSlot(s) {
  49352. return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
  49353. }
  49354. const COMPONENT_NAME$4 = "ElTableV2";
  49355. const TableV2 = defineComponent({
  49356. name: COMPONENT_NAME$4,
  49357. props: tableV2Props,
  49358. setup(props, {
  49359. slots,
  49360. expose
  49361. }) {
  49362. const ns = useNamespace("table-v2");
  49363. const {
  49364. columnsStyles,
  49365. fixedColumnsOnLeft,
  49366. fixedColumnsOnRight,
  49367. mainColumns,
  49368. mainTableHeight,
  49369. fixedTableHeight,
  49370. leftTableWidth,
  49371. rightTableWidth,
  49372. data,
  49373. depthMap,
  49374. expandedRowKeys,
  49375. hasFixedColumns,
  49376. mainTableRef,
  49377. leftTableRef,
  49378. rightTableRef,
  49379. isDynamic,
  49380. isResetting,
  49381. isScrolling,
  49382. bodyWidth,
  49383. emptyStyle,
  49384. rootStyle,
  49385. headerWidth,
  49386. footerHeight,
  49387. showEmpty,
  49388. scrollTo,
  49389. scrollToLeft,
  49390. scrollToTop,
  49391. scrollToRow,
  49392. getRowHeight,
  49393. onColumnSorted,
  49394. onRowHeightChange,
  49395. onRowHovered,
  49396. onRowExpanded,
  49397. onRowsRendered,
  49398. onScroll,
  49399. onVerticalScroll
  49400. } = useTable(props);
  49401. expose({
  49402. scrollTo,
  49403. scrollToLeft,
  49404. scrollToTop,
  49405. scrollToRow
  49406. });
  49407. provide(TableV2InjectionKey, {
  49408. ns,
  49409. isResetting,
  49410. isScrolling
  49411. });
  49412. return () => {
  49413. const {
  49414. cache,
  49415. cellProps,
  49416. estimatedRowHeight,
  49417. expandColumnKey,
  49418. fixedData,
  49419. headerHeight,
  49420. headerClass,
  49421. headerProps,
  49422. headerCellProps,
  49423. sortBy,
  49424. sortState,
  49425. rowHeight,
  49426. rowClass,
  49427. rowEventHandlers,
  49428. rowKey,
  49429. rowProps,
  49430. scrollbarAlwaysOn,
  49431. indentSize,
  49432. iconSize,
  49433. useIsScrolling,
  49434. vScrollbarSize,
  49435. width
  49436. } = props;
  49437. const _data = unref(data);
  49438. const mainTableProps = {
  49439. cache,
  49440. class: ns.e("main"),
  49441. columns: unref(mainColumns),
  49442. data: _data,
  49443. fixedData,
  49444. estimatedRowHeight,
  49445. bodyWidth: unref(bodyWidth) + vScrollbarSize,
  49446. headerHeight,
  49447. headerWidth: unref(headerWidth),
  49448. height: unref(mainTableHeight),
  49449. mainTableRef,
  49450. rowKey,
  49451. rowHeight,
  49452. scrollbarAlwaysOn,
  49453. scrollbarStartGap: 2,
  49454. scrollbarEndGap: vScrollbarSize,
  49455. useIsScrolling,
  49456. width,
  49457. getRowHeight,
  49458. onRowsRendered,
  49459. onScroll
  49460. };
  49461. const leftColumnsWidth = unref(leftTableWidth);
  49462. const _fixedTableHeight = unref(fixedTableHeight);
  49463. const leftTableProps = {
  49464. cache,
  49465. class: ns.e("left"),
  49466. columns: unref(fixedColumnsOnLeft),
  49467. data: _data,
  49468. fixedData,
  49469. estimatedRowHeight,
  49470. leftTableRef,
  49471. rowHeight,
  49472. bodyWidth: leftColumnsWidth,
  49473. headerWidth: leftColumnsWidth,
  49474. headerHeight,
  49475. height: _fixedTableHeight,
  49476. rowKey,
  49477. scrollbarAlwaysOn,
  49478. scrollbarStartGap: 2,
  49479. scrollbarEndGap: vScrollbarSize,
  49480. useIsScrolling,
  49481. width: leftColumnsWidth,
  49482. getRowHeight,
  49483. onScroll: onVerticalScroll
  49484. };
  49485. const rightColumnsWidth = unref(rightTableWidth);
  49486. const rightColumnsWidthWithScrollbar = rightColumnsWidth + vScrollbarSize;
  49487. const rightTableProps = {
  49488. cache,
  49489. class: ns.e("right"),
  49490. columns: unref(fixedColumnsOnRight),
  49491. data: _data,
  49492. fixedData,
  49493. estimatedRowHeight,
  49494. rightTableRef,
  49495. rowHeight,
  49496. bodyWidth: rightColumnsWidthWithScrollbar,
  49497. headerWidth: rightColumnsWidthWithScrollbar,
  49498. headerHeight,
  49499. height: _fixedTableHeight,
  49500. rowKey,
  49501. scrollbarAlwaysOn,
  49502. scrollbarStartGap: 2,
  49503. scrollbarEndGap: vScrollbarSize,
  49504. width: rightColumnsWidthWithScrollbar,
  49505. style: `--${unref(ns.namespace)}-table-scrollbar-size: ${vScrollbarSize}px`,
  49506. useIsScrolling,
  49507. getRowHeight,
  49508. onScroll: onVerticalScroll
  49509. };
  49510. const _columnsStyles = unref(columnsStyles);
  49511. const tableRowProps = {
  49512. ns,
  49513. depthMap: unref(depthMap),
  49514. columnsStyles: _columnsStyles,
  49515. expandColumnKey,
  49516. expandedRowKeys: unref(expandedRowKeys),
  49517. estimatedRowHeight,
  49518. hasFixedColumns: unref(hasFixedColumns),
  49519. rowProps,
  49520. rowClass,
  49521. rowKey,
  49522. rowEventHandlers,
  49523. onRowHovered,
  49524. onRowExpanded,
  49525. onRowHeightChange
  49526. };
  49527. const tableCellProps = {
  49528. cellProps,
  49529. expandColumnKey,
  49530. indentSize,
  49531. iconSize,
  49532. rowKey,
  49533. expandedRowKeys: unref(expandedRowKeys),
  49534. ns
  49535. };
  49536. const tableHeaderProps = {
  49537. ns,
  49538. headerClass,
  49539. headerProps,
  49540. columnsStyles: _columnsStyles
  49541. };
  49542. const tableHeaderCellProps = {
  49543. ns,
  49544. sortBy,
  49545. sortState,
  49546. headerCellProps,
  49547. onColumnSorted
  49548. };
  49549. const tableSlots = {
  49550. row: (props2) => createVNode(RowRenderer, mergeProps(props2, tableRowProps), {
  49551. row: slots.row,
  49552. cell: (props3) => {
  49553. let _slot;
  49554. return slots.cell ? createVNode(CellRenderer, mergeProps(props3, tableCellProps, {
  49555. "style": _columnsStyles[props3.column.key]
  49556. }), _isSlot(_slot = slots.cell(props3)) ? _slot : {
  49557. default: () => [_slot]
  49558. }) : createVNode(CellRenderer, mergeProps(props3, tableCellProps, {
  49559. "style": _columnsStyles[props3.column.key]
  49560. }), null);
  49561. }
  49562. }),
  49563. header: (props2) => createVNode(HeaderRenderer, mergeProps(props2, tableHeaderProps), {
  49564. header: slots.header,
  49565. cell: (props3) => {
  49566. let _slot2;
  49567. return slots["header-cell"] ? createVNode(HeaderCellRenderer, mergeProps(props3, tableHeaderCellProps, {
  49568. "style": _columnsStyles[props3.column.key]
  49569. }), _isSlot(_slot2 = slots["header-cell"](props3)) ? _slot2 : {
  49570. default: () => [_slot2]
  49571. }) : createVNode(HeaderCellRenderer, mergeProps(props3, tableHeaderCellProps, {
  49572. "style": _columnsStyles[props3.column.key]
  49573. }), null);
  49574. }
  49575. })
  49576. };
  49577. const rootKls = [props.class, ns.b(), ns.e("root"), {
  49578. [ns.is("dynamic")]: unref(isDynamic)
  49579. }];
  49580. const footerProps = {
  49581. class: ns.e("footer"),
  49582. style: unref(footerHeight)
  49583. };
  49584. return createVNode("div", {
  49585. "class": rootKls,
  49586. "style": unref(rootStyle)
  49587. }, [createVNode(MainTable, mainTableProps, _isSlot(tableSlots) ? tableSlots : {
  49588. default: () => [tableSlots]
  49589. }), createVNode(LeftTable$1, leftTableProps, _isSlot(tableSlots) ? tableSlots : {
  49590. default: () => [tableSlots]
  49591. }), createVNode(LeftTable, rightTableProps, _isSlot(tableSlots) ? tableSlots : {
  49592. default: () => [tableSlots]
  49593. }), slots.footer && createVNode(Footer$1, footerProps, {
  49594. default: slots.footer
  49595. }), unref(showEmpty) && createVNode(Footer, {
  49596. "class": ns.e("empty"),
  49597. "style": unref(emptyStyle)
  49598. }, {
  49599. default: slots.empty
  49600. }), slots.overlay && createVNode(Overlay, {
  49601. "class": ns.e("overlay")
  49602. }, {
  49603. default: slots.overlay
  49604. })]);
  49605. };
  49606. }
  49607. });
  49608. var TableV2$1 = TableV2;
  49609. const autoResizerProps = buildProps({
  49610. disableWidth: Boolean,
  49611. disableHeight: Boolean,
  49612. onResize: {
  49613. type: definePropType(Function)
  49614. }
  49615. });
  49616. const AutoResizer = defineComponent({
  49617. name: "ElAutoResizer",
  49618. props: autoResizerProps,
  49619. setup(props, {
  49620. slots
  49621. }) {
  49622. const ns = useNamespace("auto-resizer");
  49623. const {
  49624. height,
  49625. width,
  49626. sizer
  49627. } = useAutoResize(props);
  49628. const style = {
  49629. width: "100%",
  49630. height: "100%"
  49631. };
  49632. return () => {
  49633. var _a;
  49634. return createVNode("div", {
  49635. "ref": sizer,
  49636. "class": ns.b(),
  49637. "style": style
  49638. }, [(_a = slots.default) == null ? void 0 : _a.call(slots, {
  49639. height: height.value,
  49640. width: width.value
  49641. })]);
  49642. };
  49643. }
  49644. });
  49645. const ElTableV2 = withInstall(TableV2$1);
  49646. const ElAutoResizer = withInstall(AutoResizer);
  49647. const tabsRootContextKey = Symbol("tabsRootContextKey");
  49648. const tabBarProps = buildProps({
  49649. tabs: {
  49650. type: definePropType(Array),
  49651. default: () => mutable([])
  49652. }
  49653. });
  49654. const COMPONENT_NAME$3 = "ElTabBar";
  49655. const __default__$u = defineComponent({
  49656. name: COMPONENT_NAME$3
  49657. });
  49658. const _sfc_main$z = /* @__PURE__ */ defineComponent({
  49659. ...__default__$u,
  49660. props: tabBarProps,
  49661. setup(__props, { expose }) {
  49662. const props = __props;
  49663. const instance = getCurrentInstance();
  49664. const rootTabs = inject(tabsRootContextKey);
  49665. if (!rootTabs)
  49666. throwError(COMPONENT_NAME$3, "<el-tabs><el-tab-bar /></el-tabs>");
  49667. const ns = useNamespace("tabs");
  49668. const barRef = ref();
  49669. const barStyle = ref();
  49670. const getBarStyle = () => {
  49671. let offset = 0;
  49672. let tabSize = 0;
  49673. const sizeName = ["top", "bottom"].includes(rootTabs.props.tabPosition) ? "width" : "height";
  49674. const sizeDir = sizeName === "width" ? "x" : "y";
  49675. const position = sizeDir === "x" ? "left" : "top";
  49676. props.tabs.every((tab) => {
  49677. var _a, _b;
  49678. const $el = (_b = (_a = instance.parent) == null ? void 0 : _a.refs) == null ? void 0 : _b[`tab-${tab.uid}`];
  49679. if (!$el)
  49680. return false;
  49681. if (!tab.active) {
  49682. return true;
  49683. }
  49684. offset = $el[`offset${capitalize(position)}`];
  49685. tabSize = $el[`client${capitalize(sizeName)}`];
  49686. const tabStyles = window.getComputedStyle($el);
  49687. if (sizeName === "width") {
  49688. tabSize -= Number.parseFloat(tabStyles.paddingLeft) + Number.parseFloat(tabStyles.paddingRight);
  49689. offset += Number.parseFloat(tabStyles.paddingLeft);
  49690. }
  49691. return false;
  49692. });
  49693. return {
  49694. [sizeName]: `${tabSize}px`,
  49695. transform: `translate${capitalize(sizeDir)}(${offset}px)`
  49696. };
  49697. };
  49698. const update = () => barStyle.value = getBarStyle();
  49699. const saveObserver = [];
  49700. const observerTabs = () => {
  49701. var _a;
  49702. saveObserver.forEach((observer) => observer.stop());
  49703. saveObserver.length = 0;
  49704. const list = (_a = instance.parent) == null ? void 0 : _a.refs;
  49705. if (!list)
  49706. return;
  49707. for (const key in list) {
  49708. if (key.startsWith("tab-")) {
  49709. const _el = list[key];
  49710. if (_el) {
  49711. saveObserver.push(useResizeObserver(_el, update));
  49712. }
  49713. }
  49714. }
  49715. };
  49716. watch(() => props.tabs, async () => {
  49717. await nextTick();
  49718. update();
  49719. observerTabs();
  49720. }, { immediate: true });
  49721. const barObserever = useResizeObserver(barRef, () => update());
  49722. onBeforeUnmount(() => {
  49723. saveObserver.forEach((observer) => observer.stop());
  49724. saveObserver.length = 0;
  49725. barObserever.stop();
  49726. });
  49727. expose({
  49728. ref: barRef,
  49729. update
  49730. });
  49731. return (_ctx, _cache) => {
  49732. return openBlock(), createElementBlock("div", {
  49733. ref_key: "barRef",
  49734. ref: barRef,
  49735. class: normalizeClass([unref(ns).e("active-bar"), unref(ns).is(unref(rootTabs).props.tabPosition)]),
  49736. style: normalizeStyle(barStyle.value)
  49737. }, null, 6);
  49738. };
  49739. }
  49740. });
  49741. var TabBar = /* @__PURE__ */ _export_sfc(_sfc_main$z, [["__file", "tab-bar.vue"]]);
  49742. const tabNavProps = buildProps({
  49743. panes: {
  49744. type: definePropType(Array),
  49745. default: () => mutable([])
  49746. },
  49747. currentName: {
  49748. type: [String, Number],
  49749. default: ""
  49750. },
  49751. editable: Boolean,
  49752. type: {
  49753. type: String,
  49754. values: ["card", "border-card", ""],
  49755. default: ""
  49756. },
  49757. stretch: Boolean
  49758. });
  49759. const tabNavEmits = {
  49760. tabClick: (tab, tabName, ev) => ev instanceof Event,
  49761. tabRemove: (tab, ev) => ev instanceof Event
  49762. };
  49763. const COMPONENT_NAME$2 = "ElTabNav";
  49764. const TabNav = defineComponent({
  49765. name: COMPONENT_NAME$2,
  49766. props: tabNavProps,
  49767. emits: tabNavEmits,
  49768. setup(props, {
  49769. expose,
  49770. emit
  49771. }) {
  49772. const rootTabs = inject(tabsRootContextKey);
  49773. if (!rootTabs)
  49774. throwError(COMPONENT_NAME$2, `<el-tabs><tab-nav /></el-tabs>`);
  49775. const ns = useNamespace("tabs");
  49776. const visibility = useDocumentVisibility();
  49777. const focused = useWindowFocus();
  49778. const navScroll$ = ref();
  49779. const nav$ = ref();
  49780. const el$ = ref();
  49781. const tabBarRef = ref();
  49782. const scrollable = ref(false);
  49783. const navOffset = ref(0);
  49784. const isFocus = ref(false);
  49785. const focusable = ref(true);
  49786. const sizeName = computed(() => ["top", "bottom"].includes(rootTabs.props.tabPosition) ? "width" : "height");
  49787. const navStyle = computed(() => {
  49788. const dir = sizeName.value === "width" ? "X" : "Y";
  49789. return {
  49790. transform: `translate${dir}(-${navOffset.value}px)`
  49791. };
  49792. });
  49793. const scrollPrev = () => {
  49794. if (!navScroll$.value)
  49795. return;
  49796. const containerSize = navScroll$.value[`offset${capitalize(sizeName.value)}`];
  49797. const currentOffset = navOffset.value;
  49798. if (!currentOffset)
  49799. return;
  49800. const newOffset = currentOffset > containerSize ? currentOffset - containerSize : 0;
  49801. navOffset.value = newOffset;
  49802. };
  49803. const scrollNext = () => {
  49804. if (!navScroll$.value || !nav$.value)
  49805. return;
  49806. const navSize = nav$.value[`offset${capitalize(sizeName.value)}`];
  49807. const containerSize = navScroll$.value[`offset${capitalize(sizeName.value)}`];
  49808. const currentOffset = navOffset.value;
  49809. if (navSize - currentOffset <= containerSize)
  49810. return;
  49811. const newOffset = navSize - currentOffset > containerSize * 2 ? currentOffset + containerSize : navSize - containerSize;
  49812. navOffset.value = newOffset;
  49813. };
  49814. const scrollToActiveTab = async () => {
  49815. const nav = nav$.value;
  49816. if (!scrollable.value || !el$.value || !navScroll$.value || !nav)
  49817. return;
  49818. await nextTick();
  49819. const activeTab = el$.value.querySelector(".is-active");
  49820. if (!activeTab)
  49821. return;
  49822. const navScroll = navScroll$.value;
  49823. const isHorizontal = ["top", "bottom"].includes(rootTabs.props.tabPosition);
  49824. const activeTabBounding = activeTab.getBoundingClientRect();
  49825. const navScrollBounding = navScroll.getBoundingClientRect();
  49826. const maxOffset = isHorizontal ? nav.offsetWidth - navScrollBounding.width : nav.offsetHeight - navScrollBounding.height;
  49827. const currentOffset = navOffset.value;
  49828. let newOffset = currentOffset;
  49829. if (isHorizontal) {
  49830. if (activeTabBounding.left < navScrollBounding.left) {
  49831. newOffset = currentOffset - (navScrollBounding.left - activeTabBounding.left);
  49832. }
  49833. if (activeTabBounding.right > navScrollBounding.right) {
  49834. newOffset = currentOffset + activeTabBounding.right - navScrollBounding.right;
  49835. }
  49836. } else {
  49837. if (activeTabBounding.top < navScrollBounding.top) {
  49838. newOffset = currentOffset - (navScrollBounding.top - activeTabBounding.top);
  49839. }
  49840. if (activeTabBounding.bottom > navScrollBounding.bottom) {
  49841. newOffset = currentOffset + (activeTabBounding.bottom - navScrollBounding.bottom);
  49842. }
  49843. }
  49844. newOffset = Math.max(newOffset, 0);
  49845. navOffset.value = Math.min(newOffset, maxOffset);
  49846. };
  49847. const update = () => {
  49848. var _a;
  49849. if (!nav$.value || !navScroll$.value)
  49850. return;
  49851. props.stretch && ((_a = tabBarRef.value) == null ? void 0 : _a.update());
  49852. const navSize = nav$.value[`offset${capitalize(sizeName.value)}`];
  49853. const containerSize = navScroll$.value[`offset${capitalize(sizeName.value)}`];
  49854. const currentOffset = navOffset.value;
  49855. if (containerSize < navSize) {
  49856. scrollable.value = scrollable.value || {};
  49857. scrollable.value.prev = currentOffset;
  49858. scrollable.value.next = currentOffset + containerSize < navSize;
  49859. if (navSize - currentOffset < containerSize) {
  49860. navOffset.value = navSize - containerSize;
  49861. }
  49862. } else {
  49863. scrollable.value = false;
  49864. if (currentOffset > 0) {
  49865. navOffset.value = 0;
  49866. }
  49867. }
  49868. };
  49869. const changeTab = (event) => {
  49870. let step = 0;
  49871. switch (event.code) {
  49872. case EVENT_CODE.left:
  49873. case EVENT_CODE.up:
  49874. step = -1;
  49875. break;
  49876. case EVENT_CODE.right:
  49877. case EVENT_CODE.down:
  49878. step = 1;
  49879. break;
  49880. default:
  49881. return;
  49882. }
  49883. const tabList = Array.from(event.currentTarget.querySelectorAll("[role=tab]:not(.is-disabled)"));
  49884. const currentIndex = tabList.indexOf(event.target);
  49885. let nextIndex = currentIndex + step;
  49886. if (nextIndex < 0) {
  49887. nextIndex = tabList.length - 1;
  49888. } else if (nextIndex >= tabList.length) {
  49889. nextIndex = 0;
  49890. }
  49891. tabList[nextIndex].focus({
  49892. preventScroll: true
  49893. });
  49894. tabList[nextIndex].click();
  49895. setFocus();
  49896. };
  49897. const setFocus = () => {
  49898. if (focusable.value)
  49899. isFocus.value = true;
  49900. };
  49901. const removeFocus = () => isFocus.value = false;
  49902. watch(visibility, (visibility2) => {
  49903. if (visibility2 === "hidden") {
  49904. focusable.value = false;
  49905. } else if (visibility2 === "visible") {
  49906. setTimeout(() => focusable.value = true, 50);
  49907. }
  49908. });
  49909. watch(focused, (focused2) => {
  49910. if (focused2) {
  49911. setTimeout(() => focusable.value = true, 50);
  49912. } else {
  49913. focusable.value = false;
  49914. }
  49915. });
  49916. useResizeObserver(el$, update);
  49917. onMounted(() => setTimeout(() => scrollToActiveTab(), 0));
  49918. onUpdated(() => update());
  49919. expose({
  49920. scrollToActiveTab,
  49921. removeFocus
  49922. });
  49923. return () => {
  49924. const scrollBtn = scrollable.value ? [createVNode("span", {
  49925. "class": [ns.e("nav-prev"), ns.is("disabled", !scrollable.value.prev)],
  49926. "onClick": scrollPrev
  49927. }, [createVNode(ElIcon, null, {
  49928. default: () => [createVNode(arrow_left_default, null, null)]
  49929. })]), createVNode("span", {
  49930. "class": [ns.e("nav-next"), ns.is("disabled", !scrollable.value.next)],
  49931. "onClick": scrollNext
  49932. }, [createVNode(ElIcon, null, {
  49933. default: () => [createVNode(arrow_right_default, null, null)]
  49934. })])] : null;
  49935. const tabs = props.panes.map((pane, index) => {
  49936. var _a, _b, _c, _d;
  49937. const uid = pane.uid;
  49938. const disabled = pane.props.disabled;
  49939. const tabName = (_b = (_a = pane.props.name) != null ? _a : pane.index) != null ? _b : `${index}`;
  49940. const closable = !disabled && (pane.isClosable || props.editable);
  49941. pane.index = `${index}`;
  49942. const btnClose = closable ? createVNode(ElIcon, {
  49943. "class": "is-icon-close",
  49944. "onClick": (ev) => emit("tabRemove", pane, ev)
  49945. }, {
  49946. default: () => [createVNode(close_default, null, null)]
  49947. }) : null;
  49948. const tabLabelContent = ((_d = (_c = pane.slots).label) == null ? void 0 : _d.call(_c)) || pane.props.label;
  49949. const tabindex = !disabled && pane.active ? 0 : -1;
  49950. return createVNode("div", {
  49951. "ref": `tab-${uid}`,
  49952. "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)],
  49953. "id": `tab-${tabName}`,
  49954. "key": `tab-${uid}`,
  49955. "aria-controls": `pane-${tabName}`,
  49956. "role": "tab",
  49957. "aria-selected": pane.active,
  49958. "tabindex": tabindex,
  49959. "onFocus": () => setFocus(),
  49960. "onBlur": () => removeFocus(),
  49961. "onClick": (ev) => {
  49962. removeFocus();
  49963. emit("tabClick", pane, tabName, ev);
  49964. },
  49965. "onKeydown": (ev) => {
  49966. if (closable && (ev.code === EVENT_CODE.delete || ev.code === EVENT_CODE.backspace)) {
  49967. emit("tabRemove", pane, ev);
  49968. }
  49969. }
  49970. }, [...[tabLabelContent, btnClose]]);
  49971. });
  49972. return createVNode("div", {
  49973. "ref": el$,
  49974. "class": [ns.e("nav-wrap"), ns.is("scrollable", !!scrollable.value), ns.is(rootTabs.props.tabPosition)]
  49975. }, [scrollBtn, createVNode("div", {
  49976. "class": ns.e("nav-scroll"),
  49977. "ref": navScroll$
  49978. }, [createVNode("div", {
  49979. "class": [ns.e("nav"), ns.is(rootTabs.props.tabPosition), ns.is("stretch", props.stretch && ["top", "bottom"].includes(rootTabs.props.tabPosition))],
  49980. "ref": nav$,
  49981. "style": navStyle.value,
  49982. "role": "tablist",
  49983. "onKeydown": changeTab
  49984. }, [...[!props.type ? createVNode(TabBar, {
  49985. "ref": tabBarRef,
  49986. "tabs": [...props.panes]
  49987. }, null) : null, tabs]])])]);
  49988. };
  49989. }
  49990. });
  49991. const tabsProps = buildProps({
  49992. type: {
  49993. type: String,
  49994. values: ["card", "border-card", ""],
  49995. default: ""
  49996. },
  49997. closable: Boolean,
  49998. addable: Boolean,
  49999. modelValue: {
  50000. type: [String, Number]
  50001. },
  50002. editable: Boolean,
  50003. tabPosition: {
  50004. type: String,
  50005. values: ["top", "right", "bottom", "left"],
  50006. default: "top"
  50007. },
  50008. beforeLeave: {
  50009. type: definePropType(Function),
  50010. default: () => true
  50011. },
  50012. stretch: Boolean
  50013. });
  50014. const isPaneName = (value) => isString$1(value) || isNumber(value);
  50015. const tabsEmits = {
  50016. [UPDATE_MODEL_EVENT]: (name) => isPaneName(name),
  50017. tabClick: (pane, ev) => ev instanceof Event,
  50018. tabChange: (name) => isPaneName(name),
  50019. edit: (paneName, action) => ["remove", "add"].includes(action),
  50020. tabRemove: (name) => isPaneName(name),
  50021. tabAdd: () => true
  50022. };
  50023. const Tabs = defineComponent({
  50024. name: "ElTabs",
  50025. props: tabsProps,
  50026. emits: tabsEmits,
  50027. setup(props, {
  50028. emit,
  50029. slots,
  50030. expose
  50031. }) {
  50032. var _a;
  50033. const ns = useNamespace("tabs");
  50034. const isVertical = computed(() => ["left", "right"].includes(props.tabPosition));
  50035. const {
  50036. children: panes,
  50037. addChild: sortPane,
  50038. removeChild: unregisterPane
  50039. } = useOrderedChildren(getCurrentInstance(), "ElTabPane");
  50040. const nav$ = ref();
  50041. const currentName = ref((_a = props.modelValue) != null ? _a : "0");
  50042. const setCurrentName = async (value, trigger = false) => {
  50043. var _a2, _b;
  50044. if (currentName.value === value || isUndefined(value))
  50045. return;
  50046. try {
  50047. let canLeave;
  50048. if (props.beforeLeave) {
  50049. const result = props.beforeLeave(value, currentName.value);
  50050. canLeave = result instanceof Promise ? await result : result;
  50051. } else {
  50052. canLeave = true;
  50053. }
  50054. if (canLeave !== false) {
  50055. currentName.value = value;
  50056. if (trigger) {
  50057. emit(UPDATE_MODEL_EVENT, value);
  50058. emit("tabChange", value);
  50059. }
  50060. (_b = (_a2 = nav$.value) == null ? void 0 : _a2.removeFocus) == null ? void 0 : _b.call(_a2);
  50061. }
  50062. } catch (e) {
  50063. }
  50064. };
  50065. const handleTabClick = (tab, tabName, event) => {
  50066. if (tab.props.disabled)
  50067. return;
  50068. emit("tabClick", tab, event);
  50069. setCurrentName(tabName, true);
  50070. };
  50071. const handleTabRemove = (pane, ev) => {
  50072. if (pane.props.disabled || isUndefined(pane.props.name))
  50073. return;
  50074. ev.stopPropagation();
  50075. emit("edit", pane.props.name, "remove");
  50076. emit("tabRemove", pane.props.name);
  50077. };
  50078. const handleTabAdd = () => {
  50079. emit("edit", void 0, "add");
  50080. emit("tabAdd");
  50081. };
  50082. watch(() => props.modelValue, (modelValue) => setCurrentName(modelValue));
  50083. watch(currentName, async () => {
  50084. var _a2;
  50085. await nextTick();
  50086. (_a2 = nav$.value) == null ? void 0 : _a2.scrollToActiveTab();
  50087. });
  50088. provide(tabsRootContextKey, {
  50089. props,
  50090. currentName,
  50091. registerPane: (pane) => {
  50092. panes.value.push(pane);
  50093. },
  50094. sortPane,
  50095. unregisterPane
  50096. });
  50097. expose({
  50098. currentName
  50099. });
  50100. const TabNavRenderer = ({
  50101. render
  50102. }) => {
  50103. return render();
  50104. };
  50105. return () => {
  50106. const addSlot = slots["add-icon"];
  50107. const newButton = props.editable || props.addable ? createVNode("div", {
  50108. "class": [ns.e("new-tab"), isVertical.value && ns.e("new-tab-vertical")],
  50109. "tabindex": "0",
  50110. "onClick": handleTabAdd,
  50111. "onKeydown": (ev) => {
  50112. if ([EVENT_CODE.enter, EVENT_CODE.numpadEnter].includes(ev.code))
  50113. handleTabAdd();
  50114. }
  50115. }, [addSlot ? renderSlot(slots, "add-icon") : createVNode(ElIcon, {
  50116. "class": ns.is("icon-plus")
  50117. }, {
  50118. default: () => [createVNode(plus_default, null, null)]
  50119. })]) : null;
  50120. const header = createVNode("div", {
  50121. "class": [ns.e("header"), isVertical.value && ns.e("header-vertical"), ns.is(props.tabPosition)]
  50122. }, [createVNode(TabNavRenderer, {
  50123. "render": () => {
  50124. const hasLabelSlot = panes.value.some((pane) => pane.slots.label);
  50125. return createVNode(TabNav, {
  50126. ref: nav$,
  50127. currentName: currentName.value,
  50128. editable: props.editable,
  50129. type: props.type,
  50130. panes: panes.value,
  50131. stretch: props.stretch,
  50132. onTabClick: handleTabClick,
  50133. onTabRemove: handleTabRemove
  50134. }, {
  50135. $stable: !hasLabelSlot
  50136. });
  50137. }
  50138. }, null), newButton]);
  50139. const panels = createVNode("div", {
  50140. "class": ns.e("content")
  50141. }, [renderSlot(slots, "default")]);
  50142. return createVNode("div", {
  50143. "class": [ns.b(), ns.m(props.tabPosition), {
  50144. [ns.m("card")]: props.type === "card",
  50145. [ns.m("border-card")]: props.type === "border-card"
  50146. }]
  50147. }, [panels, header]);
  50148. };
  50149. }
  50150. });
  50151. const tabPaneProps = buildProps({
  50152. label: {
  50153. type: String,
  50154. default: ""
  50155. },
  50156. name: {
  50157. type: [String, Number]
  50158. },
  50159. closable: Boolean,
  50160. disabled: Boolean,
  50161. lazy: Boolean
  50162. });
  50163. const COMPONENT_NAME$1 = "ElTabPane";
  50164. const __default__$t = defineComponent({
  50165. name: COMPONENT_NAME$1
  50166. });
  50167. const _sfc_main$y = /* @__PURE__ */ defineComponent({
  50168. ...__default__$t,
  50169. props: tabPaneProps,
  50170. setup(__props) {
  50171. const props = __props;
  50172. const instance = getCurrentInstance();
  50173. const slots = useSlots();
  50174. const tabsRoot = inject(tabsRootContextKey);
  50175. if (!tabsRoot)
  50176. throwError(COMPONENT_NAME$1, "usage: <el-tabs><el-tab-pane /></el-tabs/>");
  50177. const ns = useNamespace("tab-pane");
  50178. const index = ref();
  50179. const isClosable = computed(() => props.closable || tabsRoot.props.closable);
  50180. const active = computedEager(() => {
  50181. var _a;
  50182. return tabsRoot.currentName.value === ((_a = props.name) != null ? _a : index.value);
  50183. });
  50184. const loaded = ref(active.value);
  50185. const paneName = computed(() => {
  50186. var _a;
  50187. return (_a = props.name) != null ? _a : index.value;
  50188. });
  50189. const shouldBeRender = computedEager(() => !props.lazy || loaded.value || active.value);
  50190. watch(active, (val) => {
  50191. if (val)
  50192. loaded.value = true;
  50193. });
  50194. const pane = reactive({
  50195. uid: instance.uid,
  50196. slots,
  50197. props,
  50198. paneName,
  50199. active,
  50200. index,
  50201. isClosable
  50202. });
  50203. tabsRoot.registerPane(pane);
  50204. onMounted(() => {
  50205. tabsRoot.sortPane(pane);
  50206. });
  50207. onUnmounted(() => {
  50208. tabsRoot.unregisterPane(pane.uid);
  50209. });
  50210. return (_ctx, _cache) => {
  50211. return unref(shouldBeRender) ? withDirectives((openBlock(), createElementBlock("div", {
  50212. key: 0,
  50213. id: `pane-${unref(paneName)}`,
  50214. class: normalizeClass(unref(ns).b()),
  50215. role: "tabpanel",
  50216. "aria-hidden": !unref(active),
  50217. "aria-labelledby": `tab-${unref(paneName)}`
  50218. }, [
  50219. renderSlot(_ctx.$slots, "default")
  50220. ], 10, ["id", "aria-hidden", "aria-labelledby"])), [
  50221. [vShow, unref(active)]
  50222. ]) : createCommentVNode("v-if", true);
  50223. };
  50224. }
  50225. });
  50226. var TabPane = /* @__PURE__ */ _export_sfc(_sfc_main$y, [["__file", "tab-pane.vue"]]);
  50227. const ElTabs = withInstall(Tabs, {
  50228. TabPane
  50229. });
  50230. const ElTabPane = withNoopInstall(TabPane);
  50231. const textProps = buildProps({
  50232. type: {
  50233. type: String,
  50234. values: ["primary", "success", "info", "warning", "danger", ""],
  50235. default: ""
  50236. },
  50237. size: {
  50238. type: String,
  50239. values: componentSizes,
  50240. default: ""
  50241. },
  50242. truncated: Boolean,
  50243. lineClamp: {
  50244. type: [String, Number]
  50245. },
  50246. tag: {
  50247. type: String,
  50248. default: "span"
  50249. }
  50250. });
  50251. const __default__$s = defineComponent({
  50252. name: "ElText"
  50253. });
  50254. const _sfc_main$x = /* @__PURE__ */ defineComponent({
  50255. ...__default__$s,
  50256. props: textProps,
  50257. setup(__props) {
  50258. const props = __props;
  50259. const textRef = ref();
  50260. const textSize = useFormSize();
  50261. const ns = useNamespace("text");
  50262. const textKls = computed(() => [
  50263. ns.b(),
  50264. ns.m(props.type),
  50265. ns.m(textSize.value),
  50266. ns.is("truncated", props.truncated),
  50267. ns.is("line-clamp", !isUndefined(props.lineClamp))
  50268. ]);
  50269. const inheritTitle = useAttrs$1().title;
  50270. const bindTitle = () => {
  50271. var _a, _b, _c, _d, _e;
  50272. if (inheritTitle)
  50273. return;
  50274. let shouldAddTitle = false;
  50275. const text = ((_a = textRef.value) == null ? void 0 : _a.textContent) || "";
  50276. if (props.truncated) {
  50277. const width = (_b = textRef.value) == null ? void 0 : _b.offsetWidth;
  50278. const scrollWidth = (_c = textRef.value) == null ? void 0 : _c.scrollWidth;
  50279. if (width && scrollWidth && scrollWidth > width) {
  50280. shouldAddTitle = true;
  50281. }
  50282. } else if (!isUndefined(props.lineClamp)) {
  50283. const height = (_d = textRef.value) == null ? void 0 : _d.offsetHeight;
  50284. const scrollHeight = (_e = textRef.value) == null ? void 0 : _e.scrollHeight;
  50285. if (height && scrollHeight && scrollHeight > height) {
  50286. shouldAddTitle = true;
  50287. }
  50288. }
  50289. if (shouldAddTitle) {
  50290. textRef.value.setAttribute("title", text);
  50291. } else {
  50292. textRef.value.removeAttribute("title");
  50293. }
  50294. };
  50295. onMounted(bindTitle);
  50296. onUpdated(bindTitle);
  50297. return (_ctx, _cache) => {
  50298. return openBlock(), createBlock(resolveDynamicComponent(_ctx.tag), {
  50299. ref_key: "textRef",
  50300. ref: textRef,
  50301. class: normalizeClass(unref(textKls)),
  50302. style: normalizeStyle({ "-webkit-line-clamp": _ctx.lineClamp })
  50303. }, {
  50304. default: withCtx(() => [
  50305. renderSlot(_ctx.$slots, "default")
  50306. ]),
  50307. _: 3
  50308. }, 8, ["class", "style"]);
  50309. };
  50310. }
  50311. });
  50312. var Text = /* @__PURE__ */ _export_sfc(_sfc_main$x, [["__file", "text.vue"]]);
  50313. const ElText = withInstall(Text);
  50314. const timeSelectProps = buildProps({
  50315. format: {
  50316. type: String,
  50317. default: "HH:mm"
  50318. },
  50319. modelValue: String,
  50320. disabled: Boolean,
  50321. editable: {
  50322. type: Boolean,
  50323. default: true
  50324. },
  50325. effect: {
  50326. type: definePropType(String),
  50327. default: "light"
  50328. },
  50329. clearable: {
  50330. type: Boolean,
  50331. default: true
  50332. },
  50333. size: useSizeProp,
  50334. placeholder: String,
  50335. start: {
  50336. type: String,
  50337. default: "09:00"
  50338. },
  50339. end: {
  50340. type: String,
  50341. default: "18:00"
  50342. },
  50343. step: {
  50344. type: String,
  50345. default: "00:30"
  50346. },
  50347. minTime: String,
  50348. maxTime: String,
  50349. includeEndTime: {
  50350. type: Boolean,
  50351. default: false
  50352. },
  50353. name: String,
  50354. prefixIcon: {
  50355. type: definePropType([String, Object]),
  50356. default: () => clock_default
  50357. },
  50358. clearIcon: {
  50359. type: definePropType([String, Object]),
  50360. default: () => circle_close_default
  50361. },
  50362. ...useEmptyValuesProps
  50363. });
  50364. const parseTime = (time) => {
  50365. const values = (time || "").split(":");
  50366. if (values.length >= 2) {
  50367. let hours = Number.parseInt(values[0], 10);
  50368. const minutes = Number.parseInt(values[1], 10);
  50369. const timeUpper = time.toUpperCase();
  50370. if (timeUpper.includes("AM") && hours === 12) {
  50371. hours = 0;
  50372. } else if (timeUpper.includes("PM") && hours !== 12) {
  50373. hours += 12;
  50374. }
  50375. return {
  50376. hours,
  50377. minutes
  50378. };
  50379. }
  50380. return null;
  50381. };
  50382. const compareTime = (time1, time2) => {
  50383. const value1 = parseTime(time1);
  50384. if (!value1)
  50385. return -1;
  50386. const value2 = parseTime(time2);
  50387. if (!value2)
  50388. return -1;
  50389. const minutes1 = value1.minutes + value1.hours * 60;
  50390. const minutes2 = value2.minutes + value2.hours * 60;
  50391. if (minutes1 === minutes2) {
  50392. return 0;
  50393. }
  50394. return minutes1 > minutes2 ? 1 : -1;
  50395. };
  50396. const padTime = (time) => {
  50397. return `${time}`.padStart(2, "0");
  50398. };
  50399. const formatTime = (time) => {
  50400. return `${padTime(time.hours)}:${padTime(time.minutes)}`;
  50401. };
  50402. const nextTime = (time, step) => {
  50403. const timeValue = parseTime(time);
  50404. if (!timeValue)
  50405. return "";
  50406. const stepValue = parseTime(step);
  50407. if (!stepValue)
  50408. return "";
  50409. const next = {
  50410. hours: timeValue.hours,
  50411. minutes: timeValue.minutes
  50412. };
  50413. next.minutes += stepValue.minutes;
  50414. next.hours += stepValue.hours;
  50415. next.hours += Math.floor(next.minutes / 60);
  50416. next.minutes = next.minutes % 60;
  50417. return formatTime(next);
  50418. };
  50419. const __default__$r = defineComponent({
  50420. name: "ElTimeSelect"
  50421. });
  50422. const _sfc_main$w = /* @__PURE__ */ defineComponent({
  50423. ...__default__$r,
  50424. props: timeSelectProps,
  50425. emits: [CHANGE_EVENT, "blur", "focus", "clear", UPDATE_MODEL_EVENT],
  50426. setup(__props, { expose }) {
  50427. const props = __props;
  50428. dayjs.extend(customParseFormat);
  50429. const { Option: ElOption } = ElSelect;
  50430. const nsInput = useNamespace("input");
  50431. const select = ref();
  50432. const _disabled = useFormDisabled();
  50433. const { lang } = useLocale();
  50434. const value = computed(() => props.modelValue);
  50435. const start = computed(() => {
  50436. const time = parseTime(props.start);
  50437. return time ? formatTime(time) : null;
  50438. });
  50439. const end = computed(() => {
  50440. const time = parseTime(props.end);
  50441. return time ? formatTime(time) : null;
  50442. });
  50443. const step = computed(() => {
  50444. const time = parseTime(props.step);
  50445. return time ? formatTime(time) : null;
  50446. });
  50447. const minTime = computed(() => {
  50448. const time = parseTime(props.minTime || "");
  50449. return time ? formatTime(time) : null;
  50450. });
  50451. const maxTime = computed(() => {
  50452. const time = parseTime(props.maxTime || "");
  50453. return time ? formatTime(time) : null;
  50454. });
  50455. const items = computed(() => {
  50456. var _a;
  50457. const result = [];
  50458. const push = (formattedValue, rawValue) => {
  50459. result.push({
  50460. value: formattedValue,
  50461. disabled: compareTime(rawValue, minTime.value || "-1:-1") <= 0 || compareTime(rawValue, maxTime.value || "100:100") >= 0
  50462. });
  50463. };
  50464. if (props.start && props.end && props.step) {
  50465. let current = start.value;
  50466. let currentTime;
  50467. while (current && end.value && compareTime(current, end.value) <= 0) {
  50468. currentTime = dayjs(current, "HH:mm").locale(lang.value).format(props.format);
  50469. push(currentTime, current);
  50470. current = nextTime(current, step.value);
  50471. }
  50472. if (props.includeEndTime && end.value && ((_a = result[result.length - 1]) == null ? void 0 : _a.value) !== end.value) {
  50473. const formattedValue = dayjs(end.value, "HH:mm").locale(lang.value).format(props.format);
  50474. push(formattedValue, end.value);
  50475. }
  50476. }
  50477. return result;
  50478. });
  50479. const blur = () => {
  50480. var _a, _b;
  50481. (_b = (_a = select.value) == null ? void 0 : _a.blur) == null ? void 0 : _b.call(_a);
  50482. };
  50483. const focus = () => {
  50484. var _a, _b;
  50485. (_b = (_a = select.value) == null ? void 0 : _a.focus) == null ? void 0 : _b.call(_a);
  50486. };
  50487. expose({
  50488. blur,
  50489. focus
  50490. });
  50491. return (_ctx, _cache) => {
  50492. return openBlock(), createBlock(unref(ElSelect), {
  50493. ref_key: "select",
  50494. ref: select,
  50495. "model-value": unref(value),
  50496. disabled: unref(_disabled),
  50497. clearable: _ctx.clearable,
  50498. "clear-icon": _ctx.clearIcon,
  50499. size: _ctx.size,
  50500. effect: _ctx.effect,
  50501. placeholder: _ctx.placeholder,
  50502. "default-first-option": "",
  50503. filterable: _ctx.editable,
  50504. "empty-values": _ctx.emptyValues,
  50505. "value-on-clear": _ctx.valueOnClear,
  50506. "onUpdate:modelValue": (event) => _ctx.$emit(unref(UPDATE_MODEL_EVENT), event),
  50507. onChange: (event) => _ctx.$emit(unref(CHANGE_EVENT), event),
  50508. onBlur: (event) => _ctx.$emit("blur", event),
  50509. onFocus: (event) => _ctx.$emit("focus", event),
  50510. onClear: () => _ctx.$emit("clear")
  50511. }, {
  50512. prefix: withCtx(() => [
  50513. _ctx.prefixIcon ? (openBlock(), createBlock(unref(ElIcon), {
  50514. key: 0,
  50515. class: normalizeClass(unref(nsInput).e("prefix-icon"))
  50516. }, {
  50517. default: withCtx(() => [
  50518. (openBlock(), createBlock(resolveDynamicComponent(_ctx.prefixIcon)))
  50519. ]),
  50520. _: 1
  50521. }, 8, ["class"])) : createCommentVNode("v-if", true)
  50522. ]),
  50523. default: withCtx(() => [
  50524. (openBlock(true), createElementBlock(Fragment, null, renderList(unref(items), (item) => {
  50525. return openBlock(), createBlock(unref(ElOption), {
  50526. key: item.value,
  50527. label: item.value,
  50528. value: item.value,
  50529. disabled: item.disabled
  50530. }, null, 8, ["label", "value", "disabled"]);
  50531. }), 128))
  50532. ]),
  50533. _: 1
  50534. }, 8, ["model-value", "disabled", "clearable", "clear-icon", "size", "effect", "placeholder", "filterable", "empty-values", "value-on-clear", "onUpdate:modelValue", "onChange", "onBlur", "onFocus", "onClear"]);
  50535. };
  50536. }
  50537. });
  50538. var TimeSelect = /* @__PURE__ */ _export_sfc(_sfc_main$w, [["__file", "time-select.vue"]]);
  50539. const ElTimeSelect = withInstall(TimeSelect);
  50540. const Timeline = defineComponent({
  50541. name: "ElTimeline",
  50542. setup(_, { slots }) {
  50543. const ns = useNamespace("timeline");
  50544. provide("timeline", slots);
  50545. return () => {
  50546. return h$1("ul", { class: [ns.b()] }, [renderSlot(slots, "default")]);
  50547. };
  50548. }
  50549. });
  50550. var Timeline$1 = Timeline;
  50551. const timelineItemProps = buildProps({
  50552. timestamp: {
  50553. type: String,
  50554. default: ""
  50555. },
  50556. hideTimestamp: Boolean,
  50557. center: Boolean,
  50558. placement: {
  50559. type: String,
  50560. values: ["top", "bottom"],
  50561. default: "bottom"
  50562. },
  50563. type: {
  50564. type: String,
  50565. values: ["primary", "success", "warning", "danger", "info"],
  50566. default: ""
  50567. },
  50568. color: {
  50569. type: String,
  50570. default: ""
  50571. },
  50572. size: {
  50573. type: String,
  50574. values: ["normal", "large"],
  50575. default: "normal"
  50576. },
  50577. icon: {
  50578. type: iconPropType
  50579. },
  50580. hollow: Boolean
  50581. });
  50582. const __default__$q = defineComponent({
  50583. name: "ElTimelineItem"
  50584. });
  50585. const _sfc_main$v = /* @__PURE__ */ defineComponent({
  50586. ...__default__$q,
  50587. props: timelineItemProps,
  50588. setup(__props) {
  50589. const props = __props;
  50590. const ns = useNamespace("timeline-item");
  50591. const defaultNodeKls = computed(() => [
  50592. ns.e("node"),
  50593. ns.em("node", props.size || ""),
  50594. ns.em("node", props.type || ""),
  50595. ns.is("hollow", props.hollow)
  50596. ]);
  50597. return (_ctx, _cache) => {
  50598. return openBlock(), createElementBlock("li", {
  50599. class: normalizeClass([unref(ns).b(), { [unref(ns).e("center")]: _ctx.center }])
  50600. }, [
  50601. createElementVNode("div", {
  50602. class: normalizeClass(unref(ns).e("tail"))
  50603. }, null, 2),
  50604. !_ctx.$slots.dot ? (openBlock(), createElementBlock("div", {
  50605. key: 0,
  50606. class: normalizeClass(unref(defaultNodeKls)),
  50607. style: normalizeStyle({
  50608. backgroundColor: _ctx.color
  50609. })
  50610. }, [
  50611. _ctx.icon ? (openBlock(), createBlock(unref(ElIcon), {
  50612. key: 0,
  50613. class: normalizeClass(unref(ns).e("icon"))
  50614. }, {
  50615. default: withCtx(() => [
  50616. (openBlock(), createBlock(resolveDynamicComponent(_ctx.icon)))
  50617. ]),
  50618. _: 1
  50619. }, 8, ["class"])) : createCommentVNode("v-if", true)
  50620. ], 6)) : createCommentVNode("v-if", true),
  50621. _ctx.$slots.dot ? (openBlock(), createElementBlock("div", {
  50622. key: 1,
  50623. class: normalizeClass(unref(ns).e("dot"))
  50624. }, [
  50625. renderSlot(_ctx.$slots, "dot")
  50626. ], 2)) : createCommentVNode("v-if", true),
  50627. createElementVNode("div", {
  50628. class: normalizeClass(unref(ns).e("wrapper"))
  50629. }, [
  50630. !_ctx.hideTimestamp && _ctx.placement === "top" ? (openBlock(), createElementBlock("div", {
  50631. key: 0,
  50632. class: normalizeClass([unref(ns).e("timestamp"), unref(ns).is("top")])
  50633. }, toDisplayString(_ctx.timestamp), 3)) : createCommentVNode("v-if", true),
  50634. createElementVNode("div", {
  50635. class: normalizeClass(unref(ns).e("content"))
  50636. }, [
  50637. renderSlot(_ctx.$slots, "default")
  50638. ], 2),
  50639. !_ctx.hideTimestamp && _ctx.placement === "bottom" ? (openBlock(), createElementBlock("div", {
  50640. key: 1,
  50641. class: normalizeClass([unref(ns).e("timestamp"), unref(ns).is("bottom")])
  50642. }, toDisplayString(_ctx.timestamp), 3)) : createCommentVNode("v-if", true)
  50643. ], 2)
  50644. ], 2);
  50645. };
  50646. }
  50647. });
  50648. var TimelineItem = /* @__PURE__ */ _export_sfc(_sfc_main$v, [["__file", "timeline-item.vue"]]);
  50649. const ElTimeline = withInstall(Timeline$1, {
  50650. TimelineItem
  50651. });
  50652. const ElTimelineItem = withNoopInstall(TimelineItem);
  50653. const tooltipV2CommonProps = buildProps({
  50654. nowrap: Boolean
  50655. });
  50656. var TooltipV2Sides = /* @__PURE__ */ ((TooltipV2Sides2) => {
  50657. TooltipV2Sides2["top"] = "top";
  50658. TooltipV2Sides2["bottom"] = "bottom";
  50659. TooltipV2Sides2["left"] = "left";
  50660. TooltipV2Sides2["right"] = "right";
  50661. return TooltipV2Sides2;
  50662. })(TooltipV2Sides || {});
  50663. const tooltipV2Sides = Object.values(TooltipV2Sides);
  50664. const tooltipV2ArrowProps = buildProps({
  50665. width: {
  50666. type: Number,
  50667. default: 10
  50668. },
  50669. height: {
  50670. type: Number,
  50671. default: 10
  50672. },
  50673. style: {
  50674. type: definePropType(Object),
  50675. default: null
  50676. }
  50677. });
  50678. const tooltipV2ArrowSpecialProps = buildProps({
  50679. side: {
  50680. type: definePropType(String),
  50681. values: tooltipV2Sides,
  50682. required: true
  50683. }
  50684. });
  50685. const tooltipV2Strategies = ["absolute", "fixed"];
  50686. const tooltipV2Placements = [
  50687. "top-start",
  50688. "top-end",
  50689. "top",
  50690. "bottom-start",
  50691. "bottom-end",
  50692. "bottom",
  50693. "left-start",
  50694. "left-end",
  50695. "left",
  50696. "right-start",
  50697. "right-end",
  50698. "right"
  50699. ];
  50700. const tooltipV2ContentProps = buildProps({
  50701. arrowPadding: {
  50702. type: definePropType(Number),
  50703. default: 5
  50704. },
  50705. effect: {
  50706. type: definePropType(String),
  50707. default: "light"
  50708. },
  50709. contentClass: String,
  50710. placement: {
  50711. type: definePropType(String),
  50712. values: tooltipV2Placements,
  50713. default: "bottom"
  50714. },
  50715. reference: {
  50716. type: definePropType(Object),
  50717. default: null
  50718. },
  50719. offset: {
  50720. type: Number,
  50721. default: 8
  50722. },
  50723. strategy: {
  50724. type: definePropType(String),
  50725. values: tooltipV2Strategies,
  50726. default: "absolute"
  50727. },
  50728. showArrow: Boolean,
  50729. ...useAriaProps(["ariaLabel"])
  50730. });
  50731. const tooltipV2RootProps = buildProps({
  50732. delayDuration: {
  50733. type: Number,
  50734. default: 300
  50735. },
  50736. defaultOpen: Boolean,
  50737. open: {
  50738. type: Boolean,
  50739. default: void 0
  50740. },
  50741. onOpenChange: {
  50742. type: definePropType(Function)
  50743. },
  50744. "onUpdate:open": {
  50745. type: definePropType(Function)
  50746. }
  50747. });
  50748. const EventHandler = {
  50749. type: definePropType(Function)
  50750. };
  50751. const tooltipV2TriggerProps = buildProps({
  50752. onBlur: EventHandler,
  50753. onClick: EventHandler,
  50754. onFocus: EventHandler,
  50755. onMouseDown: EventHandler,
  50756. onMouseEnter: EventHandler,
  50757. onMouseLeave: EventHandler
  50758. });
  50759. const tooltipV2Props = buildProps({
  50760. ...tooltipV2RootProps,
  50761. ...tooltipV2ArrowProps,
  50762. ...tooltipV2TriggerProps,
  50763. ...tooltipV2ContentProps,
  50764. alwaysOn: Boolean,
  50765. fullTransition: Boolean,
  50766. transitionProps: {
  50767. type: definePropType(Object),
  50768. default: null
  50769. },
  50770. teleported: Boolean,
  50771. to: {
  50772. type: definePropType(String),
  50773. default: "body"
  50774. }
  50775. });
  50776. const tooltipV2RootKey = Symbol("tooltipV2");
  50777. const tooltipV2ContentKey = Symbol("tooltipV2Content");
  50778. const TOOLTIP_V2_OPEN = "tooltip_v2.open";
  50779. const __default__$p = defineComponent({
  50780. name: "ElTooltipV2Root"
  50781. });
  50782. const _sfc_main$u = /* @__PURE__ */ defineComponent({
  50783. ...__default__$p,
  50784. props: tooltipV2RootProps,
  50785. setup(__props, { expose }) {
  50786. const props = __props;
  50787. const _open = ref(props.defaultOpen);
  50788. const triggerRef = ref(null);
  50789. const open = computed({
  50790. get: () => isPropAbsent(props.open) ? _open.value : props.open,
  50791. set: (open2) => {
  50792. var _a;
  50793. _open.value = open2;
  50794. (_a = props["onUpdate:open"]) == null ? void 0 : _a.call(props, open2);
  50795. }
  50796. });
  50797. const isOpenDelayed = computed(() => isNumber(props.delayDuration) && props.delayDuration > 0);
  50798. const { start: onDelayedOpen, stop: clearTimer } = useTimeoutFn(() => {
  50799. open.value = true;
  50800. }, computed(() => props.delayDuration), {
  50801. immediate: false
  50802. });
  50803. const ns = useNamespace("tooltip-v2");
  50804. const contentId = useId();
  50805. const onNormalOpen = () => {
  50806. clearTimer();
  50807. open.value = true;
  50808. };
  50809. const onDelayOpen = () => {
  50810. unref(isOpenDelayed) ? onDelayedOpen() : onNormalOpen();
  50811. };
  50812. const onOpen = onNormalOpen;
  50813. const onClose = () => {
  50814. clearTimer();
  50815. open.value = false;
  50816. };
  50817. const onChange = (open2) => {
  50818. var _a;
  50819. if (open2) {
  50820. document.dispatchEvent(new CustomEvent(TOOLTIP_V2_OPEN));
  50821. onOpen();
  50822. }
  50823. (_a = props.onOpenChange) == null ? void 0 : _a.call(props, open2);
  50824. };
  50825. watch(open, onChange);
  50826. onMounted(() => {
  50827. document.addEventListener(TOOLTIP_V2_OPEN, onClose);
  50828. });
  50829. onBeforeUnmount(() => {
  50830. clearTimer();
  50831. document.removeEventListener(TOOLTIP_V2_OPEN, onClose);
  50832. });
  50833. provide(tooltipV2RootKey, {
  50834. contentId,
  50835. triggerRef,
  50836. ns,
  50837. onClose,
  50838. onDelayOpen,
  50839. onOpen
  50840. });
  50841. expose({
  50842. onOpen,
  50843. onClose
  50844. });
  50845. return (_ctx, _cache) => {
  50846. return renderSlot(_ctx.$slots, "default", { open: unref(open) });
  50847. };
  50848. }
  50849. });
  50850. var TooltipV2Root = /* @__PURE__ */ _export_sfc(_sfc_main$u, [["__file", "root.vue"]]);
  50851. const __default__$o = defineComponent({
  50852. name: "ElTooltipV2Arrow"
  50853. });
  50854. const _sfc_main$t = /* @__PURE__ */ defineComponent({
  50855. ...__default__$o,
  50856. props: {
  50857. ...tooltipV2ArrowProps,
  50858. ...tooltipV2ArrowSpecialProps
  50859. },
  50860. setup(__props) {
  50861. const props = __props;
  50862. const { ns } = inject(tooltipV2RootKey);
  50863. const { arrowRef } = inject(tooltipV2ContentKey);
  50864. const arrowStyle = computed(() => {
  50865. const { style, width, height } = props;
  50866. const namespace = ns.namespace.value;
  50867. return {
  50868. [`--${namespace}-tooltip-v2-arrow-width`]: `${width}px`,
  50869. [`--${namespace}-tooltip-v2-arrow-height`]: `${height}px`,
  50870. [`--${namespace}-tooltip-v2-arrow-border-width`]: `${width / 2}px`,
  50871. [`--${namespace}-tooltip-v2-arrow-cover-width`]: width / 2 - 1,
  50872. ...style || {}
  50873. };
  50874. });
  50875. return (_ctx, _cache) => {
  50876. return openBlock(), createElementBlock("span", {
  50877. ref_key: "arrowRef",
  50878. ref: arrowRef,
  50879. style: normalizeStyle(unref(arrowStyle)),
  50880. class: normalizeClass(unref(ns).e("arrow"))
  50881. }, null, 6);
  50882. };
  50883. }
  50884. });
  50885. var TooltipV2Arrow = /* @__PURE__ */ _export_sfc(_sfc_main$t, [["__file", "arrow.vue"]]);
  50886. const visualHiddenProps = buildProps({
  50887. style: {
  50888. type: definePropType([String, Object, Array]),
  50889. default: () => ({})
  50890. }
  50891. });
  50892. const __default__$n = defineComponent({
  50893. name: "ElVisuallyHidden"
  50894. });
  50895. const _sfc_main$s = /* @__PURE__ */ defineComponent({
  50896. ...__default__$n,
  50897. props: visualHiddenProps,
  50898. setup(__props) {
  50899. const props = __props;
  50900. const computedStyle = computed(() => {
  50901. return [
  50902. props.style,
  50903. {
  50904. position: "absolute",
  50905. border: 0,
  50906. width: 1,
  50907. height: 1,
  50908. padding: 0,
  50909. margin: -1,
  50910. overflow: "hidden",
  50911. clip: "rect(0, 0, 0, 0)",
  50912. whiteSpace: "nowrap",
  50913. wordWrap: "normal"
  50914. }
  50915. ];
  50916. });
  50917. return (_ctx, _cache) => {
  50918. return openBlock(), createElementBlock("span", mergeProps(_ctx.$attrs, { style: unref(computedStyle) }), [
  50919. renderSlot(_ctx.$slots, "default")
  50920. ], 16);
  50921. };
  50922. }
  50923. });
  50924. var ElVisuallyHidden = /* @__PURE__ */ _export_sfc(_sfc_main$s, [["__file", "visual-hidden.vue"]]);
  50925. const __default__$m = defineComponent({
  50926. name: "ElTooltipV2Content"
  50927. });
  50928. const _sfc_main$r = /* @__PURE__ */ defineComponent({
  50929. ...__default__$m,
  50930. props: { ...tooltipV2ContentProps, ...tooltipV2CommonProps },
  50931. setup(__props) {
  50932. const props = __props;
  50933. const { triggerRef, contentId } = inject(tooltipV2RootKey);
  50934. const placement = ref(props.placement);
  50935. const strategy = ref(props.strategy);
  50936. const arrowRef = ref(null);
  50937. const { referenceRef, contentRef, middlewareData, x, y, update } = useFloating$1({
  50938. placement,
  50939. strategy,
  50940. middleware: computed(() => {
  50941. const middleware = [offset(props.offset)];
  50942. if (props.showArrow) {
  50943. middleware.push(arrowMiddleware({
  50944. arrowRef
  50945. }));
  50946. }
  50947. return middleware;
  50948. })
  50949. });
  50950. const zIndex = useZIndex().nextZIndex();
  50951. const ns = useNamespace("tooltip-v2");
  50952. const side = computed(() => {
  50953. return placement.value.split("-")[0];
  50954. });
  50955. const contentStyle = computed(() => {
  50956. return {
  50957. position: unref(strategy),
  50958. top: `${unref(y) || 0}px`,
  50959. left: `${unref(x) || 0}px`,
  50960. zIndex
  50961. };
  50962. });
  50963. const arrowStyle = computed(() => {
  50964. if (!props.showArrow)
  50965. return {};
  50966. const { arrow } = unref(middlewareData);
  50967. return {
  50968. [`--${ns.namespace.value}-tooltip-v2-arrow-x`]: `${arrow == null ? void 0 : arrow.x}px` || "",
  50969. [`--${ns.namespace.value}-tooltip-v2-arrow-y`]: `${arrow == null ? void 0 : arrow.y}px` || ""
  50970. };
  50971. });
  50972. const contentClass = computed(() => [
  50973. ns.e("content"),
  50974. ns.is("dark", props.effect === "dark"),
  50975. ns.is(unref(strategy)),
  50976. props.contentClass
  50977. ]);
  50978. watch(arrowRef, () => update());
  50979. watch(() => props.placement, (val) => placement.value = val);
  50980. onMounted(() => {
  50981. watch(() => props.reference || triggerRef.value, (el) => {
  50982. referenceRef.value = el || void 0;
  50983. }, {
  50984. immediate: true
  50985. });
  50986. });
  50987. provide(tooltipV2ContentKey, { arrowRef });
  50988. return (_ctx, _cache) => {
  50989. return openBlock(), createElementBlock("div", {
  50990. ref_key: "contentRef",
  50991. ref: contentRef,
  50992. style: normalizeStyle(unref(contentStyle)),
  50993. "data-tooltip-v2-root": ""
  50994. }, [
  50995. !_ctx.nowrap ? (openBlock(), createElementBlock("div", {
  50996. key: 0,
  50997. "data-side": unref(side),
  50998. class: normalizeClass(unref(contentClass))
  50999. }, [
  51000. renderSlot(_ctx.$slots, "default", {
  51001. contentStyle: unref(contentStyle),
  51002. contentClass: unref(contentClass)
  51003. }),
  51004. createVNode(unref(ElVisuallyHidden), {
  51005. id: unref(contentId),
  51006. role: "tooltip"
  51007. }, {
  51008. default: withCtx(() => [
  51009. _ctx.ariaLabel ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  51010. createTextVNode(toDisplayString(_ctx.ariaLabel), 1)
  51011. ], 64)) : renderSlot(_ctx.$slots, "default", { key: 1 })
  51012. ]),
  51013. _: 3
  51014. }, 8, ["id"]),
  51015. renderSlot(_ctx.$slots, "arrow", {
  51016. style: normalizeStyle(unref(arrowStyle)),
  51017. side: unref(side)
  51018. })
  51019. ], 10, ["data-side"])) : createCommentVNode("v-if", true)
  51020. ], 4);
  51021. };
  51022. }
  51023. });
  51024. var TooltipV2Content = /* @__PURE__ */ _export_sfc(_sfc_main$r, [["__file", "content.vue"]]);
  51025. const forwardRefProps = buildProps({
  51026. setRef: {
  51027. type: definePropType(Function),
  51028. required: true
  51029. },
  51030. onlyChild: Boolean
  51031. });
  51032. var ForwardRef = defineComponent({
  51033. props: forwardRefProps,
  51034. setup(props, {
  51035. slots
  51036. }) {
  51037. const fragmentRef = ref();
  51038. const setRef = composeRefs(fragmentRef, (el) => {
  51039. if (el) {
  51040. props.setRef(el.nextElementSibling);
  51041. } else {
  51042. props.setRef(null);
  51043. }
  51044. });
  51045. return () => {
  51046. var _a;
  51047. const [firstChild] = ((_a = slots.default) == null ? void 0 : _a.call(slots)) || [];
  51048. const child = props.onlyChild ? ensureOnlyChild(firstChild.children) : firstChild.children;
  51049. return createVNode(Fragment, {
  51050. "ref": setRef
  51051. }, [child]);
  51052. };
  51053. }
  51054. });
  51055. const __default__$l = defineComponent({
  51056. name: "ElTooltipV2Trigger"
  51057. });
  51058. const _sfc_main$q = /* @__PURE__ */ defineComponent({
  51059. ...__default__$l,
  51060. props: {
  51061. ...tooltipV2CommonProps,
  51062. ...tooltipV2TriggerProps
  51063. },
  51064. setup(__props) {
  51065. const props = __props;
  51066. const { onClose, onOpen, onDelayOpen, triggerRef, contentId } = inject(tooltipV2RootKey);
  51067. let isMousedown = false;
  51068. const setTriggerRef = (el) => {
  51069. triggerRef.value = el;
  51070. };
  51071. const onMouseup = () => {
  51072. isMousedown = false;
  51073. };
  51074. const onMouseenter = composeEventHandlers(props.onMouseEnter, onDelayOpen);
  51075. const onMouseleave = composeEventHandlers(props.onMouseLeave, onClose);
  51076. const onMousedown = composeEventHandlers(props.onMouseDown, () => {
  51077. onClose();
  51078. isMousedown = true;
  51079. document.addEventListener("mouseup", onMouseup, { once: true });
  51080. });
  51081. const onFocus = composeEventHandlers(props.onFocus, () => {
  51082. if (!isMousedown)
  51083. onOpen();
  51084. });
  51085. const onBlur = composeEventHandlers(props.onBlur, onClose);
  51086. const onClick = composeEventHandlers(props.onClick, (e) => {
  51087. if (e.detail === 0)
  51088. onClose();
  51089. });
  51090. const events = {
  51091. blur: onBlur,
  51092. click: onClick,
  51093. focus: onFocus,
  51094. mousedown: onMousedown,
  51095. mouseenter: onMouseenter,
  51096. mouseleave: onMouseleave
  51097. };
  51098. const setEvents = (el, events2, type) => {
  51099. if (el) {
  51100. Object.entries(events2).forEach(([name, handler]) => {
  51101. el[type](name, handler);
  51102. });
  51103. }
  51104. };
  51105. watch(triggerRef, (triggerEl, previousTriggerEl) => {
  51106. setEvents(triggerEl, events, "addEventListener");
  51107. setEvents(previousTriggerEl, events, "removeEventListener");
  51108. if (triggerEl) {
  51109. triggerEl.setAttribute("aria-describedby", contentId.value);
  51110. }
  51111. });
  51112. onBeforeUnmount(() => {
  51113. setEvents(triggerRef.value, events, "removeEventListener");
  51114. document.removeEventListener("mouseup", onMouseup);
  51115. });
  51116. return (_ctx, _cache) => {
  51117. return _ctx.nowrap ? (openBlock(), createBlock(unref(ForwardRef), {
  51118. key: 0,
  51119. "set-ref": setTriggerRef,
  51120. "only-child": ""
  51121. }, {
  51122. default: withCtx(() => [
  51123. renderSlot(_ctx.$slots, "default")
  51124. ]),
  51125. _: 3
  51126. })) : (openBlock(), createElementBlock("button", mergeProps({
  51127. key: 1,
  51128. ref_key: "triggerRef",
  51129. ref: triggerRef
  51130. }, _ctx.$attrs), [
  51131. renderSlot(_ctx.$slots, "default")
  51132. ], 16));
  51133. };
  51134. }
  51135. });
  51136. var TooltipV2Trigger = /* @__PURE__ */ _export_sfc(_sfc_main$q, [["__file", "trigger.vue"]]);
  51137. const __default__$k = defineComponent({
  51138. name: "ElTooltipV2"
  51139. });
  51140. const _sfc_main$p = /* @__PURE__ */ defineComponent({
  51141. ...__default__$k,
  51142. props: tooltipV2Props,
  51143. setup(__props) {
  51144. const props = __props;
  51145. const refedProps = toRefs(props);
  51146. const arrowProps = reactive(pick(refedProps, Object.keys(tooltipV2ArrowProps)));
  51147. const contentProps = reactive(pick(refedProps, Object.keys(tooltipV2ContentProps)));
  51148. const rootProps = reactive(pick(refedProps, Object.keys(tooltipV2RootProps)));
  51149. const triggerProps = reactive(pick(refedProps, Object.keys(tooltipV2TriggerProps)));
  51150. return (_ctx, _cache) => {
  51151. return openBlock(), createBlock(TooltipV2Root, normalizeProps(guardReactiveProps(rootProps)), {
  51152. default: withCtx(({ open }) => [
  51153. createVNode(TooltipV2Trigger, mergeProps(triggerProps, { nowrap: "" }), {
  51154. default: withCtx(() => [
  51155. renderSlot(_ctx.$slots, "trigger")
  51156. ]),
  51157. _: 3
  51158. }, 16),
  51159. createVNode(unref(ElTeleport$1), {
  51160. to: _ctx.to,
  51161. disabled: !_ctx.teleported
  51162. }, {
  51163. default: withCtx(() => [
  51164. _ctx.fullTransition ? (openBlock(), createBlock(Transition, normalizeProps(mergeProps({ key: 0 }, _ctx.transitionProps)), {
  51165. default: withCtx(() => [
  51166. _ctx.alwaysOn || open ? (openBlock(), createBlock(TooltipV2Content, normalizeProps(mergeProps({ key: 0 }, contentProps)), {
  51167. arrow: withCtx(({ style, side }) => [
  51168. _ctx.showArrow ? (openBlock(), createBlock(TooltipV2Arrow, mergeProps({ key: 0 }, arrowProps, {
  51169. style,
  51170. side
  51171. }), null, 16, ["style", "side"])) : createCommentVNode("v-if", true)
  51172. ]),
  51173. default: withCtx(() => [
  51174. renderSlot(_ctx.$slots, "default")
  51175. ]),
  51176. _: 3
  51177. }, 16)) : createCommentVNode("v-if", true)
  51178. ]),
  51179. _: 2
  51180. }, 1040)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
  51181. _ctx.alwaysOn || open ? (openBlock(), createBlock(TooltipV2Content, normalizeProps(mergeProps({ key: 0 }, contentProps)), {
  51182. arrow: withCtx(({ style, side }) => [
  51183. _ctx.showArrow ? (openBlock(), createBlock(TooltipV2Arrow, mergeProps({ key: 0 }, arrowProps, {
  51184. style,
  51185. side
  51186. }), null, 16, ["style", "side"])) : createCommentVNode("v-if", true)
  51187. ]),
  51188. default: withCtx(() => [
  51189. renderSlot(_ctx.$slots, "default")
  51190. ]),
  51191. _: 3
  51192. }, 16)) : createCommentVNode("v-if", true)
  51193. ], 64))
  51194. ]),
  51195. _: 2
  51196. }, 1032, ["to", "disabled"])
  51197. ]),
  51198. _: 3
  51199. }, 16);
  51200. };
  51201. }
  51202. });
  51203. var TooltipV2 = /* @__PURE__ */ _export_sfc(_sfc_main$p, [["__file", "tooltip.vue"]]);
  51204. const ElTooltipV2 = withInstall(TooltipV2);
  51205. const LEFT_CHECK_CHANGE_EVENT = "left-check-change";
  51206. const RIGHT_CHECK_CHANGE_EVENT = "right-check-change";
  51207. const transferProps = buildProps({
  51208. data: {
  51209. type: definePropType(Array),
  51210. default: () => []
  51211. },
  51212. titles: {
  51213. type: definePropType(Array),
  51214. default: () => []
  51215. },
  51216. buttonTexts: {
  51217. type: definePropType(Array),
  51218. default: () => []
  51219. },
  51220. filterPlaceholder: String,
  51221. filterMethod: {
  51222. type: definePropType(Function)
  51223. },
  51224. leftDefaultChecked: {
  51225. type: definePropType(Array),
  51226. default: () => []
  51227. },
  51228. rightDefaultChecked: {
  51229. type: definePropType(Array),
  51230. default: () => []
  51231. },
  51232. renderContent: {
  51233. type: definePropType(Function)
  51234. },
  51235. modelValue: {
  51236. type: definePropType(Array),
  51237. default: () => []
  51238. },
  51239. format: {
  51240. type: definePropType(Object),
  51241. default: () => ({})
  51242. },
  51243. filterable: Boolean,
  51244. props: {
  51245. type: definePropType(Object),
  51246. default: () => mutable({
  51247. label: "label",
  51248. key: "key",
  51249. disabled: "disabled"
  51250. })
  51251. },
  51252. targetOrder: {
  51253. type: String,
  51254. values: ["original", "push", "unshift"],
  51255. default: "original"
  51256. },
  51257. validateEvent: {
  51258. type: Boolean,
  51259. default: true
  51260. }
  51261. });
  51262. const transferCheckedChangeFn = (value, movedKeys) => [value, movedKeys].every(isArray$1) || isArray$1(value) && isNil(movedKeys);
  51263. const transferEmits = {
  51264. [CHANGE_EVENT]: (value, direction, movedKeys) => [value, movedKeys].every(isArray$1) && ["left", "right"].includes(direction),
  51265. [UPDATE_MODEL_EVENT]: (value) => isArray$1(value),
  51266. [LEFT_CHECK_CHANGE_EVENT]: transferCheckedChangeFn,
  51267. [RIGHT_CHECK_CHANGE_EVENT]: transferCheckedChangeFn
  51268. };
  51269. const CHECKED_CHANGE_EVENT = "checked-change";
  51270. const transferPanelProps = buildProps({
  51271. data: transferProps.data,
  51272. optionRender: {
  51273. type: definePropType(Function)
  51274. },
  51275. placeholder: String,
  51276. title: String,
  51277. filterable: Boolean,
  51278. format: transferProps.format,
  51279. filterMethod: transferProps.filterMethod,
  51280. defaultChecked: transferProps.leftDefaultChecked,
  51281. props: transferProps.props
  51282. });
  51283. const transferPanelEmits = {
  51284. [CHECKED_CHANGE_EVENT]: transferCheckedChangeFn
  51285. };
  51286. const usePropsAlias = (props) => {
  51287. const initProps = {
  51288. label: "label",
  51289. key: "key",
  51290. disabled: "disabled"
  51291. };
  51292. return computed(() => ({
  51293. ...initProps,
  51294. ...props.props
  51295. }));
  51296. };
  51297. const useCheck$1 = (props, panelState, emit) => {
  51298. const propsAlias = usePropsAlias(props);
  51299. const filteredData = computed(() => {
  51300. return props.data.filter((item) => {
  51301. if (isFunction$1(props.filterMethod)) {
  51302. return props.filterMethod(panelState.query, item);
  51303. } else {
  51304. const label = String(item[propsAlias.value.label] || item[propsAlias.value.key]);
  51305. return label.toLowerCase().includes(panelState.query.toLowerCase());
  51306. }
  51307. });
  51308. });
  51309. const checkableData = computed(() => filteredData.value.filter((item) => !item[propsAlias.value.disabled]));
  51310. const checkedSummary = computed(() => {
  51311. const checkedLength = panelState.checked.length;
  51312. const dataLength = props.data.length;
  51313. const { noChecked, hasChecked } = props.format;
  51314. if (noChecked && hasChecked) {
  51315. return checkedLength > 0 ? hasChecked.replace(/\${checked}/g, checkedLength.toString()).replace(/\${total}/g, dataLength.toString()) : noChecked.replace(/\${total}/g, dataLength.toString());
  51316. } else {
  51317. return `${checkedLength}/${dataLength}`;
  51318. }
  51319. });
  51320. const isIndeterminate = computed(() => {
  51321. const checkedLength = panelState.checked.length;
  51322. return checkedLength > 0 && checkedLength < checkableData.value.length;
  51323. });
  51324. const updateAllChecked = () => {
  51325. const checkableDataKeys = checkableData.value.map((item) => item[propsAlias.value.key]);
  51326. panelState.allChecked = checkableDataKeys.length > 0 && checkableDataKeys.every((item) => panelState.checked.includes(item));
  51327. };
  51328. const handleAllCheckedChange = (value) => {
  51329. panelState.checked = value ? checkableData.value.map((item) => item[propsAlias.value.key]) : [];
  51330. };
  51331. watch(() => panelState.checked, (val, oldVal) => {
  51332. updateAllChecked();
  51333. if (panelState.checkChangeByUser) {
  51334. const movedKeys = val.concat(oldVal).filter((v) => !val.includes(v) || !oldVal.includes(v));
  51335. emit(CHECKED_CHANGE_EVENT, val, movedKeys);
  51336. } else {
  51337. emit(CHECKED_CHANGE_EVENT, val);
  51338. panelState.checkChangeByUser = true;
  51339. }
  51340. });
  51341. watch(checkableData, () => {
  51342. updateAllChecked();
  51343. });
  51344. watch(() => props.data, () => {
  51345. const checked = [];
  51346. const filteredDataKeys = filteredData.value.map((item) => item[propsAlias.value.key]);
  51347. panelState.checked.forEach((item) => {
  51348. if (filteredDataKeys.includes(item)) {
  51349. checked.push(item);
  51350. }
  51351. });
  51352. panelState.checkChangeByUser = false;
  51353. panelState.checked = checked;
  51354. });
  51355. watch(() => props.defaultChecked, (val, oldVal) => {
  51356. if (oldVal && val.length === oldVal.length && val.every((item) => oldVal.includes(item)))
  51357. return;
  51358. const checked = [];
  51359. const checkableDataKeys = checkableData.value.map((item) => item[propsAlias.value.key]);
  51360. val.forEach((item) => {
  51361. if (checkableDataKeys.includes(item)) {
  51362. checked.push(item);
  51363. }
  51364. });
  51365. panelState.checkChangeByUser = false;
  51366. panelState.checked = checked;
  51367. }, {
  51368. immediate: true
  51369. });
  51370. return {
  51371. filteredData,
  51372. checkableData,
  51373. checkedSummary,
  51374. isIndeterminate,
  51375. updateAllChecked,
  51376. handleAllCheckedChange
  51377. };
  51378. };
  51379. const useCheckedChange = (checkedState, emit) => {
  51380. const onSourceCheckedChange = (val, movedKeys) => {
  51381. checkedState.leftChecked = val;
  51382. if (!movedKeys)
  51383. return;
  51384. emit(LEFT_CHECK_CHANGE_EVENT, val, movedKeys);
  51385. };
  51386. const onTargetCheckedChange = (val, movedKeys) => {
  51387. checkedState.rightChecked = val;
  51388. if (!movedKeys)
  51389. return;
  51390. emit(RIGHT_CHECK_CHANGE_EVENT, val, movedKeys);
  51391. };
  51392. return {
  51393. onSourceCheckedChange,
  51394. onTargetCheckedChange
  51395. };
  51396. };
  51397. const useComputedData = (props) => {
  51398. const propsAlias = usePropsAlias(props);
  51399. const dataObj = computed(() => props.data.reduce((o, cur) => (o[cur[propsAlias.value.key]] = cur) && o, {}));
  51400. const sourceData = computed(() => props.data.filter((item) => !props.modelValue.includes(item[propsAlias.value.key])));
  51401. const targetData = computed(() => {
  51402. if (props.targetOrder === "original") {
  51403. return props.data.filter((item) => props.modelValue.includes(item[propsAlias.value.key]));
  51404. } else {
  51405. return props.modelValue.reduce((arr, cur) => {
  51406. const val = dataObj.value[cur];
  51407. if (val) {
  51408. arr.push(val);
  51409. }
  51410. return arr;
  51411. }, []);
  51412. }
  51413. });
  51414. return {
  51415. sourceData,
  51416. targetData
  51417. };
  51418. };
  51419. const useMove = (props, checkedState, emit) => {
  51420. const propsAlias = usePropsAlias(props);
  51421. const _emit = (value, direction, movedKeys) => {
  51422. emit(UPDATE_MODEL_EVENT, value);
  51423. emit(CHANGE_EVENT, value, direction, movedKeys);
  51424. };
  51425. const addToLeft = () => {
  51426. const currentValue = props.modelValue.slice();
  51427. checkedState.rightChecked.forEach((item) => {
  51428. const index = currentValue.indexOf(item);
  51429. if (index > -1) {
  51430. currentValue.splice(index, 1);
  51431. }
  51432. });
  51433. _emit(currentValue, "left", checkedState.rightChecked);
  51434. };
  51435. const addToRight = () => {
  51436. let currentValue = props.modelValue.slice();
  51437. const itemsToBeMoved = props.data.filter((item) => {
  51438. const itemKey = item[propsAlias.value.key];
  51439. return checkedState.leftChecked.includes(itemKey) && !props.modelValue.includes(itemKey);
  51440. }).map((item) => item[propsAlias.value.key]);
  51441. currentValue = props.targetOrder === "unshift" ? itemsToBeMoved.concat(currentValue) : currentValue.concat(itemsToBeMoved);
  51442. if (props.targetOrder === "original") {
  51443. currentValue = props.data.filter((item) => currentValue.includes(item[propsAlias.value.key])).map((item) => item[propsAlias.value.key]);
  51444. }
  51445. _emit(currentValue, "right", checkedState.leftChecked);
  51446. };
  51447. return {
  51448. addToLeft,
  51449. addToRight
  51450. };
  51451. };
  51452. const __default__$j = defineComponent({
  51453. name: "ElTransferPanel"
  51454. });
  51455. const _sfc_main$o = /* @__PURE__ */ defineComponent({
  51456. ...__default__$j,
  51457. props: transferPanelProps,
  51458. emits: transferPanelEmits,
  51459. setup(__props, { expose, emit }) {
  51460. const props = __props;
  51461. const slots = useSlots();
  51462. const OptionContent = ({ option }) => option;
  51463. const { t } = useLocale();
  51464. const ns = useNamespace("transfer");
  51465. const panelState = reactive({
  51466. checked: [],
  51467. allChecked: false,
  51468. query: "",
  51469. checkChangeByUser: true
  51470. });
  51471. const propsAlias = usePropsAlias(props);
  51472. const {
  51473. filteredData,
  51474. checkedSummary,
  51475. isIndeterminate,
  51476. handleAllCheckedChange
  51477. } = useCheck$1(props, panelState, emit);
  51478. const hasNoMatch = computed(() => !isEmpty(panelState.query) && isEmpty(filteredData.value));
  51479. const hasFooter = computed(() => !isEmpty(slots.default()[0].children));
  51480. const { checked, allChecked, query } = toRefs(panelState);
  51481. expose({
  51482. query
  51483. });
  51484. return (_ctx, _cache) => {
  51485. return openBlock(), createElementBlock("div", {
  51486. class: normalizeClass(unref(ns).b("panel"))
  51487. }, [
  51488. createElementVNode("p", {
  51489. class: normalizeClass(unref(ns).be("panel", "header"))
  51490. }, [
  51491. createVNode(unref(ElCheckbox), {
  51492. modelValue: unref(allChecked),
  51493. "onUpdate:modelValue": ($event) => isRef(allChecked) ? allChecked.value = $event : null,
  51494. indeterminate: unref(isIndeterminate),
  51495. "validate-event": false,
  51496. onChange: unref(handleAllCheckedChange)
  51497. }, {
  51498. default: withCtx(() => [
  51499. createTextVNode(toDisplayString(_ctx.title) + " ", 1),
  51500. createElementVNode("span", null, toDisplayString(unref(checkedSummary)), 1)
  51501. ]),
  51502. _: 1
  51503. }, 8, ["modelValue", "onUpdate:modelValue", "indeterminate", "onChange"])
  51504. ], 2),
  51505. createElementVNode("div", {
  51506. class: normalizeClass([unref(ns).be("panel", "body"), unref(ns).is("with-footer", unref(hasFooter))])
  51507. }, [
  51508. _ctx.filterable ? (openBlock(), createBlock(unref(ElInput), {
  51509. key: 0,
  51510. modelValue: unref(query),
  51511. "onUpdate:modelValue": ($event) => isRef(query) ? query.value = $event : null,
  51512. class: normalizeClass(unref(ns).be("panel", "filter")),
  51513. size: "default",
  51514. placeholder: _ctx.placeholder,
  51515. "prefix-icon": unref(search_default),
  51516. clearable: "",
  51517. "validate-event": false
  51518. }, null, 8, ["modelValue", "onUpdate:modelValue", "class", "placeholder", "prefix-icon"])) : createCommentVNode("v-if", true),
  51519. withDirectives(createVNode(unref(ElCheckboxGroup$1), {
  51520. modelValue: unref(checked),
  51521. "onUpdate:modelValue": ($event) => isRef(checked) ? checked.value = $event : null,
  51522. "validate-event": false,
  51523. class: normalizeClass([unref(ns).is("filterable", _ctx.filterable), unref(ns).be("panel", "list")])
  51524. }, {
  51525. default: withCtx(() => [
  51526. (openBlock(true), createElementBlock(Fragment, null, renderList(unref(filteredData), (item) => {
  51527. return openBlock(), createBlock(unref(ElCheckbox), {
  51528. key: item[unref(propsAlias).key],
  51529. class: normalizeClass(unref(ns).be("panel", "item")),
  51530. value: item[unref(propsAlias).key],
  51531. disabled: item[unref(propsAlias).disabled],
  51532. "validate-event": false
  51533. }, {
  51534. default: withCtx(() => {
  51535. var _a;
  51536. return [
  51537. createVNode(OptionContent, {
  51538. option: (_a = _ctx.optionRender) == null ? void 0 : _a.call(_ctx, item)
  51539. }, null, 8, ["option"])
  51540. ];
  51541. }),
  51542. _: 2
  51543. }, 1032, ["class", "value", "disabled"]);
  51544. }), 128))
  51545. ]),
  51546. _: 1
  51547. }, 8, ["modelValue", "onUpdate:modelValue", "class"]), [
  51548. [vShow, !unref(hasNoMatch) && !unref(isEmpty)(_ctx.data)]
  51549. ]),
  51550. withDirectives(createElementVNode("div", {
  51551. class: normalizeClass(unref(ns).be("panel", "empty"))
  51552. }, [
  51553. renderSlot(_ctx.$slots, "empty", {}, () => [
  51554. createTextVNode(toDisplayString(unref(hasNoMatch) ? unref(t)("el.transfer.noMatch") : unref(t)("el.transfer.noData")), 1)
  51555. ])
  51556. ], 2), [
  51557. [vShow, unref(hasNoMatch) || unref(isEmpty)(_ctx.data)]
  51558. ])
  51559. ], 2),
  51560. unref(hasFooter) ? (openBlock(), createElementBlock("p", {
  51561. key: 0,
  51562. class: normalizeClass(unref(ns).be("panel", "footer"))
  51563. }, [
  51564. renderSlot(_ctx.$slots, "default")
  51565. ], 2)) : createCommentVNode("v-if", true)
  51566. ], 2);
  51567. };
  51568. }
  51569. });
  51570. var TransferPanel = /* @__PURE__ */ _export_sfc(_sfc_main$o, [["__file", "transfer-panel.vue"]]);
  51571. const __default__$i = defineComponent({
  51572. name: "ElTransfer"
  51573. });
  51574. const _sfc_main$n = /* @__PURE__ */ defineComponent({
  51575. ...__default__$i,
  51576. props: transferProps,
  51577. emits: transferEmits,
  51578. setup(__props, { expose, emit }) {
  51579. const props = __props;
  51580. const slots = useSlots();
  51581. const { t } = useLocale();
  51582. const ns = useNamespace("transfer");
  51583. const { formItem } = useFormItem();
  51584. const checkedState = reactive({
  51585. leftChecked: [],
  51586. rightChecked: []
  51587. });
  51588. const propsAlias = usePropsAlias(props);
  51589. const { sourceData, targetData } = useComputedData(props);
  51590. const { onSourceCheckedChange, onTargetCheckedChange } = useCheckedChange(checkedState, emit);
  51591. const { addToLeft, addToRight } = useMove(props, checkedState, emit);
  51592. const leftPanel = ref();
  51593. const rightPanel = ref();
  51594. const clearQuery = (which) => {
  51595. switch (which) {
  51596. case "left":
  51597. leftPanel.value.query = "";
  51598. break;
  51599. case "right":
  51600. rightPanel.value.query = "";
  51601. break;
  51602. }
  51603. };
  51604. const hasButtonTexts = computed(() => props.buttonTexts.length === 2);
  51605. const leftPanelTitle = computed(() => props.titles[0] || t("el.transfer.titles.0"));
  51606. const rightPanelTitle = computed(() => props.titles[1] || t("el.transfer.titles.1"));
  51607. const panelFilterPlaceholder = computed(() => props.filterPlaceholder || t("el.transfer.filterPlaceholder"));
  51608. watch(() => props.modelValue, () => {
  51609. var _a;
  51610. if (props.validateEvent) {
  51611. (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "change").catch((err) => debugWarn());
  51612. }
  51613. });
  51614. const optionRender = computed(() => (option) => {
  51615. var _a;
  51616. if (props.renderContent)
  51617. return props.renderContent(h$1, option);
  51618. const defaultSlotVNodes = (((_a = slots.default) == null ? void 0 : _a.call(slots, { option })) || []).filter((node) => node.type !== Comment);
  51619. if (defaultSlotVNodes.length) {
  51620. return defaultSlotVNodes;
  51621. }
  51622. return h$1("span", option[propsAlias.value.label] || option[propsAlias.value.key]);
  51623. });
  51624. expose({
  51625. clearQuery,
  51626. leftPanel,
  51627. rightPanel
  51628. });
  51629. return (_ctx, _cache) => {
  51630. return openBlock(), createElementBlock("div", {
  51631. class: normalizeClass(unref(ns).b())
  51632. }, [
  51633. createVNode(TransferPanel, {
  51634. ref_key: "leftPanel",
  51635. ref: leftPanel,
  51636. data: unref(sourceData),
  51637. "option-render": unref(optionRender),
  51638. placeholder: unref(panelFilterPlaceholder),
  51639. title: unref(leftPanelTitle),
  51640. filterable: _ctx.filterable,
  51641. format: _ctx.format,
  51642. "filter-method": _ctx.filterMethod,
  51643. "default-checked": _ctx.leftDefaultChecked,
  51644. props: props.props,
  51645. onCheckedChange: unref(onSourceCheckedChange)
  51646. }, {
  51647. empty: withCtx(() => [
  51648. renderSlot(_ctx.$slots, "left-empty")
  51649. ]),
  51650. default: withCtx(() => [
  51651. renderSlot(_ctx.$slots, "left-footer")
  51652. ]),
  51653. _: 3
  51654. }, 8, ["data", "option-render", "placeholder", "title", "filterable", "format", "filter-method", "default-checked", "props", "onCheckedChange"]),
  51655. createElementVNode("div", {
  51656. class: normalizeClass(unref(ns).e("buttons"))
  51657. }, [
  51658. createVNode(unref(ElButton), {
  51659. type: "primary",
  51660. class: normalizeClass([unref(ns).e("button"), unref(ns).is("with-texts", unref(hasButtonTexts))]),
  51661. disabled: unref(isEmpty)(checkedState.rightChecked),
  51662. onClick: unref(addToLeft)
  51663. }, {
  51664. default: withCtx(() => [
  51665. createVNode(unref(ElIcon), null, {
  51666. default: withCtx(() => [
  51667. createVNode(unref(arrow_left_default))
  51668. ]),
  51669. _: 1
  51670. }),
  51671. !unref(isUndefined)(_ctx.buttonTexts[0]) ? (openBlock(), createElementBlock("span", { key: 0 }, toDisplayString(_ctx.buttonTexts[0]), 1)) : createCommentVNode("v-if", true)
  51672. ]),
  51673. _: 1
  51674. }, 8, ["class", "disabled", "onClick"]),
  51675. createVNode(unref(ElButton), {
  51676. type: "primary",
  51677. class: normalizeClass([unref(ns).e("button"), unref(ns).is("with-texts", unref(hasButtonTexts))]),
  51678. disabled: unref(isEmpty)(checkedState.leftChecked),
  51679. onClick: unref(addToRight)
  51680. }, {
  51681. default: withCtx(() => [
  51682. !unref(isUndefined)(_ctx.buttonTexts[1]) ? (openBlock(), createElementBlock("span", { key: 0 }, toDisplayString(_ctx.buttonTexts[1]), 1)) : createCommentVNode("v-if", true),
  51683. createVNode(unref(ElIcon), null, {
  51684. default: withCtx(() => [
  51685. createVNode(unref(arrow_right_default))
  51686. ]),
  51687. _: 1
  51688. })
  51689. ]),
  51690. _: 1
  51691. }, 8, ["class", "disabled", "onClick"])
  51692. ], 2),
  51693. createVNode(TransferPanel, {
  51694. ref_key: "rightPanel",
  51695. ref: rightPanel,
  51696. data: unref(targetData),
  51697. "option-render": unref(optionRender),
  51698. placeholder: unref(panelFilterPlaceholder),
  51699. filterable: _ctx.filterable,
  51700. format: _ctx.format,
  51701. "filter-method": _ctx.filterMethod,
  51702. title: unref(rightPanelTitle),
  51703. "default-checked": _ctx.rightDefaultChecked,
  51704. props: props.props,
  51705. onCheckedChange: unref(onTargetCheckedChange)
  51706. }, {
  51707. empty: withCtx(() => [
  51708. renderSlot(_ctx.$slots, "right-empty")
  51709. ]),
  51710. default: withCtx(() => [
  51711. renderSlot(_ctx.$slots, "right-footer")
  51712. ]),
  51713. _: 3
  51714. }, 8, ["data", "option-render", "placeholder", "filterable", "format", "filter-method", "title", "default-checked", "props", "onCheckedChange"])
  51715. ], 2);
  51716. };
  51717. }
  51718. });
  51719. var Transfer = /* @__PURE__ */ _export_sfc(_sfc_main$n, [["__file", "transfer.vue"]]);
  51720. const ElTransfer = withInstall(Transfer);
  51721. const NODE_KEY = "$treeNodeId";
  51722. const markNodeData = function(node, data) {
  51723. if (!data || data[NODE_KEY])
  51724. return;
  51725. Object.defineProperty(data, NODE_KEY, {
  51726. value: node.id,
  51727. enumerable: false,
  51728. configurable: false,
  51729. writable: false
  51730. });
  51731. };
  51732. const getNodeKey = (key, data) => data == null ? void 0 : data[key || NODE_KEY];
  51733. const handleCurrentChange = (store, emit, setCurrent) => {
  51734. const preCurrentNode = store.value.currentNode;
  51735. setCurrent();
  51736. const currentNode = store.value.currentNode;
  51737. if (preCurrentNode === currentNode)
  51738. return;
  51739. emit("current-change", currentNode ? currentNode.data : null, currentNode);
  51740. };
  51741. const getChildState = (node) => {
  51742. let all = true;
  51743. let none = true;
  51744. let allWithoutDisable = true;
  51745. for (let i = 0, j = node.length; i < j; i++) {
  51746. const n = node[i];
  51747. if (n.checked !== true || n.indeterminate) {
  51748. all = false;
  51749. if (!n.disabled) {
  51750. allWithoutDisable = false;
  51751. }
  51752. }
  51753. if (n.checked !== false || n.indeterminate) {
  51754. none = false;
  51755. }
  51756. }
  51757. return { all, none, allWithoutDisable, half: !all && !none };
  51758. };
  51759. const reInitChecked = function(node) {
  51760. if (node.childNodes.length === 0 || node.loading)
  51761. return;
  51762. const { all, none, half } = getChildState(node.childNodes);
  51763. if (all) {
  51764. node.checked = true;
  51765. node.indeterminate = false;
  51766. } else if (half) {
  51767. node.checked = false;
  51768. node.indeterminate = true;
  51769. } else if (none) {
  51770. node.checked = false;
  51771. node.indeterminate = false;
  51772. }
  51773. const parent = node.parent;
  51774. if (!parent || parent.level === 0)
  51775. return;
  51776. if (!node.store.checkStrictly) {
  51777. reInitChecked(parent);
  51778. }
  51779. };
  51780. const getPropertyFromData = function(node, prop) {
  51781. const props = node.store.props;
  51782. const data = node.data || {};
  51783. const config = props[prop];
  51784. if (isFunction$1(config)) {
  51785. return config(data, node);
  51786. } else if (isString$1(config)) {
  51787. return data[config];
  51788. } else if (isUndefined(config)) {
  51789. const dataProp = data[prop];
  51790. return dataProp === void 0 ? "" : dataProp;
  51791. }
  51792. };
  51793. let nodeIdSeed = 0;
  51794. class Node {
  51795. constructor(options) {
  51796. this.id = nodeIdSeed++;
  51797. this.text = null;
  51798. this.checked = false;
  51799. this.indeterminate = false;
  51800. this.data = null;
  51801. this.expanded = false;
  51802. this.parent = null;
  51803. this.visible = true;
  51804. this.isCurrent = false;
  51805. this.canFocus = false;
  51806. for (const name in options) {
  51807. if (hasOwn(options, name)) {
  51808. this[name] = options[name];
  51809. }
  51810. }
  51811. this.level = 0;
  51812. this.loaded = false;
  51813. this.childNodes = [];
  51814. this.loading = false;
  51815. if (this.parent) {
  51816. this.level = this.parent.level + 1;
  51817. }
  51818. }
  51819. initialize() {
  51820. const store = this.store;
  51821. if (!store) {
  51822. throw new Error("[Node]store is required!");
  51823. }
  51824. store.registerNode(this);
  51825. const props = store.props;
  51826. if (props && typeof props.isLeaf !== "undefined") {
  51827. const isLeaf = getPropertyFromData(this, "isLeaf");
  51828. if (isBoolean(isLeaf)) {
  51829. this.isLeafByUser = isLeaf;
  51830. }
  51831. }
  51832. if (store.lazy !== true && this.data) {
  51833. this.setData(this.data);
  51834. if (store.defaultExpandAll) {
  51835. this.expanded = true;
  51836. this.canFocus = true;
  51837. }
  51838. } else if (this.level > 0 && store.lazy && store.defaultExpandAll && !this.isLeafByUser) {
  51839. this.expand();
  51840. }
  51841. if (!isArray$1(this.data)) {
  51842. markNodeData(this, this.data);
  51843. }
  51844. if (!this.data)
  51845. return;
  51846. const defaultExpandedKeys = store.defaultExpandedKeys;
  51847. const key = store.key;
  51848. if (key && defaultExpandedKeys && defaultExpandedKeys.includes(this.key)) {
  51849. this.expand(null, store.autoExpandParent);
  51850. }
  51851. if (key && store.currentNodeKey !== void 0 && this.key === store.currentNodeKey) {
  51852. store.currentNode = this;
  51853. store.currentNode.isCurrent = true;
  51854. }
  51855. if (store.lazy) {
  51856. store._initDefaultCheckedNode(this);
  51857. }
  51858. this.updateLeafState();
  51859. if (this.parent && (this.level === 1 || this.parent.expanded === true))
  51860. this.canFocus = true;
  51861. }
  51862. setData(data) {
  51863. if (!isArray$1(data)) {
  51864. markNodeData(this, data);
  51865. }
  51866. this.data = data;
  51867. this.childNodes = [];
  51868. let children;
  51869. if (this.level === 0 && isArray$1(this.data)) {
  51870. children = this.data;
  51871. } else {
  51872. children = getPropertyFromData(this, "children") || [];
  51873. }
  51874. for (let i = 0, j = children.length; i < j; i++) {
  51875. this.insertChild({ data: children[i] });
  51876. }
  51877. }
  51878. get label() {
  51879. return getPropertyFromData(this, "label");
  51880. }
  51881. get key() {
  51882. const nodeKey = this.store.key;
  51883. if (this.data)
  51884. return this.data[nodeKey];
  51885. return null;
  51886. }
  51887. get disabled() {
  51888. return getPropertyFromData(this, "disabled");
  51889. }
  51890. get nextSibling() {
  51891. const parent = this.parent;
  51892. if (parent) {
  51893. const index = parent.childNodes.indexOf(this);
  51894. if (index > -1) {
  51895. return parent.childNodes[index + 1];
  51896. }
  51897. }
  51898. return null;
  51899. }
  51900. get previousSibling() {
  51901. const parent = this.parent;
  51902. if (parent) {
  51903. const index = parent.childNodes.indexOf(this);
  51904. if (index > -1) {
  51905. return index > 0 ? parent.childNodes[index - 1] : null;
  51906. }
  51907. }
  51908. return null;
  51909. }
  51910. contains(target, deep = true) {
  51911. return (this.childNodes || []).some((child) => child === target || deep && child.contains(target));
  51912. }
  51913. remove() {
  51914. const parent = this.parent;
  51915. if (parent) {
  51916. parent.removeChild(this);
  51917. }
  51918. }
  51919. insertChild(child, index, batch) {
  51920. if (!child)
  51921. throw new Error("InsertChild error: child is required.");
  51922. if (!(child instanceof Node)) {
  51923. if (!batch) {
  51924. const children = this.getChildren(true);
  51925. if (!children.includes(child.data)) {
  51926. if (isUndefined(index) || index < 0) {
  51927. children.push(child.data);
  51928. } else {
  51929. children.splice(index, 0, child.data);
  51930. }
  51931. }
  51932. }
  51933. Object.assign(child, {
  51934. parent: this,
  51935. store: this.store
  51936. });
  51937. child = reactive(new Node(child));
  51938. if (child instanceof Node) {
  51939. child.initialize();
  51940. }
  51941. }
  51942. child.level = this.level + 1;
  51943. if (isUndefined(index) || index < 0) {
  51944. this.childNodes.push(child);
  51945. } else {
  51946. this.childNodes.splice(index, 0, child);
  51947. }
  51948. this.updateLeafState();
  51949. }
  51950. insertBefore(child, ref) {
  51951. let index;
  51952. if (ref) {
  51953. index = this.childNodes.indexOf(ref);
  51954. }
  51955. this.insertChild(child, index);
  51956. }
  51957. insertAfter(child, ref) {
  51958. let index;
  51959. if (ref) {
  51960. index = this.childNodes.indexOf(ref);
  51961. if (index !== -1)
  51962. index += 1;
  51963. }
  51964. this.insertChild(child, index);
  51965. }
  51966. removeChild(child) {
  51967. const children = this.getChildren() || [];
  51968. const dataIndex = children.indexOf(child.data);
  51969. if (dataIndex > -1) {
  51970. children.splice(dataIndex, 1);
  51971. }
  51972. const index = this.childNodes.indexOf(child);
  51973. if (index > -1) {
  51974. this.store && this.store.deregisterNode(child);
  51975. child.parent = null;
  51976. this.childNodes.splice(index, 1);
  51977. }
  51978. this.updateLeafState();
  51979. }
  51980. removeChildByData(data) {
  51981. let targetNode = null;
  51982. for (let i = 0; i < this.childNodes.length; i++) {
  51983. if (this.childNodes[i].data === data) {
  51984. targetNode = this.childNodes[i];
  51985. break;
  51986. }
  51987. }
  51988. if (targetNode) {
  51989. this.removeChild(targetNode);
  51990. }
  51991. }
  51992. expand(callback, expandParent) {
  51993. const done = () => {
  51994. if (expandParent) {
  51995. let parent = this.parent;
  51996. while (parent.level > 0) {
  51997. parent.expanded = true;
  51998. parent = parent.parent;
  51999. }
  52000. }
  52001. this.expanded = true;
  52002. if (callback)
  52003. callback();
  52004. this.childNodes.forEach((item) => {
  52005. item.canFocus = true;
  52006. });
  52007. };
  52008. if (this.shouldLoadData()) {
  52009. this.loadData((data) => {
  52010. if (isArray$1(data)) {
  52011. if (this.checked) {
  52012. this.setChecked(true, true);
  52013. } else if (!this.store.checkStrictly) {
  52014. reInitChecked(this);
  52015. }
  52016. done();
  52017. }
  52018. });
  52019. } else {
  52020. done();
  52021. }
  52022. }
  52023. doCreateChildren(array, defaultProps = {}) {
  52024. array.forEach((item) => {
  52025. this.insertChild(Object.assign({ data: item }, defaultProps), void 0, true);
  52026. });
  52027. }
  52028. collapse() {
  52029. this.expanded = false;
  52030. this.childNodes.forEach((item) => {
  52031. item.canFocus = false;
  52032. });
  52033. }
  52034. shouldLoadData() {
  52035. return this.store.lazy === true && this.store.load && !this.loaded;
  52036. }
  52037. updateLeafState() {
  52038. if (this.store.lazy === true && this.loaded !== true && typeof this.isLeafByUser !== "undefined") {
  52039. this.isLeaf = this.isLeafByUser;
  52040. return;
  52041. }
  52042. const childNodes = this.childNodes;
  52043. if (!this.store.lazy || this.store.lazy === true && this.loaded === true) {
  52044. this.isLeaf = !childNodes || childNodes.length === 0;
  52045. return;
  52046. }
  52047. this.isLeaf = false;
  52048. }
  52049. setChecked(value, deep, recursion, passValue) {
  52050. this.indeterminate = value === "half";
  52051. this.checked = value === true;
  52052. if (this.store.checkStrictly)
  52053. return;
  52054. if (!(this.shouldLoadData() && !this.store.checkDescendants)) {
  52055. const { all, allWithoutDisable } = getChildState(this.childNodes);
  52056. if (!this.isLeaf && !all && allWithoutDisable) {
  52057. this.checked = false;
  52058. value = false;
  52059. }
  52060. const handleDescendants = () => {
  52061. if (deep) {
  52062. const childNodes = this.childNodes;
  52063. for (let i = 0, j = childNodes.length; i < j; i++) {
  52064. const child = childNodes[i];
  52065. passValue = passValue || value !== false;
  52066. const isCheck = child.disabled ? child.checked : passValue;
  52067. child.setChecked(isCheck, deep, true, passValue);
  52068. }
  52069. const { half, all: all2 } = getChildState(childNodes);
  52070. if (!all2) {
  52071. this.checked = all2;
  52072. this.indeterminate = half;
  52073. }
  52074. }
  52075. };
  52076. if (this.shouldLoadData()) {
  52077. this.loadData(() => {
  52078. handleDescendants();
  52079. reInitChecked(this);
  52080. }, {
  52081. checked: value !== false
  52082. });
  52083. return;
  52084. } else {
  52085. handleDescendants();
  52086. }
  52087. }
  52088. const parent = this.parent;
  52089. if (!parent || parent.level === 0)
  52090. return;
  52091. if (!recursion) {
  52092. reInitChecked(parent);
  52093. }
  52094. }
  52095. getChildren(forceInit = false) {
  52096. if (this.level === 0)
  52097. return this.data;
  52098. const data = this.data;
  52099. if (!data)
  52100. return null;
  52101. const props = this.store.props;
  52102. let children = "children";
  52103. if (props) {
  52104. children = props.children || "children";
  52105. }
  52106. if (data[children] === void 0) {
  52107. data[children] = null;
  52108. }
  52109. if (forceInit && !data[children]) {
  52110. data[children] = [];
  52111. }
  52112. return data[children];
  52113. }
  52114. updateChildren() {
  52115. const newData = this.getChildren() || [];
  52116. const oldData = this.childNodes.map((node) => node.data);
  52117. const newDataMap = {};
  52118. const newNodes = [];
  52119. newData.forEach((item, index) => {
  52120. const key = item[NODE_KEY];
  52121. const isNodeExists = !!key && oldData.findIndex((data) => data[NODE_KEY] === key) >= 0;
  52122. if (isNodeExists) {
  52123. newDataMap[key] = { index, data: item };
  52124. } else {
  52125. newNodes.push({ index, data: item });
  52126. }
  52127. });
  52128. if (!this.store.lazy) {
  52129. oldData.forEach((item) => {
  52130. if (!newDataMap[item[NODE_KEY]])
  52131. this.removeChildByData(item);
  52132. });
  52133. }
  52134. newNodes.forEach(({ index, data }) => {
  52135. this.insertChild({ data }, index);
  52136. });
  52137. this.updateLeafState();
  52138. }
  52139. loadData(callback, defaultProps = {}) {
  52140. if (this.store.lazy === true && this.store.load && !this.loaded && (!this.loading || Object.keys(defaultProps).length)) {
  52141. this.loading = true;
  52142. const resolve = (children) => {
  52143. this.childNodes = [];
  52144. this.doCreateChildren(children, defaultProps);
  52145. this.loaded = true;
  52146. this.loading = false;
  52147. this.updateLeafState();
  52148. if (callback) {
  52149. callback.call(this, children);
  52150. }
  52151. };
  52152. const reject = () => {
  52153. this.loading = false;
  52154. };
  52155. this.store.load(this, resolve, reject);
  52156. } else {
  52157. if (callback) {
  52158. callback.call(this);
  52159. }
  52160. }
  52161. }
  52162. eachNode(callback) {
  52163. const arr = [this];
  52164. while (arr.length) {
  52165. const node = arr.shift();
  52166. arr.unshift(...node.childNodes);
  52167. callback(node);
  52168. }
  52169. }
  52170. reInitChecked() {
  52171. if (this.store.checkStrictly)
  52172. return;
  52173. reInitChecked(this);
  52174. }
  52175. }
  52176. var Node$1 = Node;
  52177. class TreeStore {
  52178. constructor(options) {
  52179. this.currentNode = null;
  52180. this.currentNodeKey = null;
  52181. for (const option in options) {
  52182. if (hasOwn(options, option)) {
  52183. this[option] = options[option];
  52184. }
  52185. }
  52186. this.nodesMap = {};
  52187. }
  52188. initialize() {
  52189. this.root = new Node$1({
  52190. data: this.data,
  52191. store: this
  52192. });
  52193. this.root.initialize();
  52194. if (this.lazy && this.load) {
  52195. const loadFn = this.load;
  52196. loadFn(this.root, (data) => {
  52197. this.root.doCreateChildren(data);
  52198. this._initDefaultCheckedNodes();
  52199. });
  52200. } else {
  52201. this._initDefaultCheckedNodes();
  52202. }
  52203. }
  52204. filter(value) {
  52205. const filterNodeMethod = this.filterNodeMethod;
  52206. const lazy = this.lazy;
  52207. const traverse = async function(node) {
  52208. const childNodes = node.root ? node.root.childNodes : node.childNodes;
  52209. for (const [index, child] of childNodes.entries()) {
  52210. child.visible = filterNodeMethod.call(child, value, child.data, child);
  52211. if (index % 80 === 0 && index > 0) {
  52212. await nextTick();
  52213. }
  52214. traverse(child);
  52215. }
  52216. if (!node.visible && childNodes.length) {
  52217. let allHidden = true;
  52218. allHidden = !childNodes.some((child) => child.visible);
  52219. if (node.root) {
  52220. node.root.visible = allHidden === false;
  52221. } else {
  52222. node.visible = allHidden === false;
  52223. }
  52224. }
  52225. if (!value)
  52226. return;
  52227. if (node.visible && !node.isLeaf) {
  52228. if (!lazy || node.loaded) {
  52229. node.expand();
  52230. }
  52231. }
  52232. };
  52233. traverse(this);
  52234. }
  52235. setData(newVal) {
  52236. const instanceChanged = newVal !== this.root.data;
  52237. if (instanceChanged) {
  52238. this.nodesMap = {};
  52239. this.root.setData(newVal);
  52240. this._initDefaultCheckedNodes();
  52241. this.setCurrentNodeKey(this.currentNodeKey);
  52242. } else {
  52243. this.root.updateChildren();
  52244. }
  52245. }
  52246. getNode(data) {
  52247. if (data instanceof Node$1)
  52248. return data;
  52249. const key = isObject$1(data) ? getNodeKey(this.key, data) : data;
  52250. return this.nodesMap[key] || null;
  52251. }
  52252. insertBefore(data, refData) {
  52253. const refNode = this.getNode(refData);
  52254. refNode.parent.insertBefore({ data }, refNode);
  52255. }
  52256. insertAfter(data, refData) {
  52257. const refNode = this.getNode(refData);
  52258. refNode.parent.insertAfter({ data }, refNode);
  52259. }
  52260. remove(data) {
  52261. const node = this.getNode(data);
  52262. if (node && node.parent) {
  52263. if (node === this.currentNode) {
  52264. this.currentNode = null;
  52265. }
  52266. node.parent.removeChild(node);
  52267. }
  52268. }
  52269. append(data, parentData) {
  52270. const parentNode = !isPropAbsent(parentData) ? this.getNode(parentData) : this.root;
  52271. if (parentNode) {
  52272. parentNode.insertChild({ data });
  52273. }
  52274. }
  52275. _initDefaultCheckedNodes() {
  52276. const defaultCheckedKeys = this.defaultCheckedKeys || [];
  52277. const nodesMap = this.nodesMap;
  52278. defaultCheckedKeys.forEach((checkedKey) => {
  52279. const node = nodesMap[checkedKey];
  52280. if (node) {
  52281. node.setChecked(true, !this.checkStrictly);
  52282. }
  52283. });
  52284. }
  52285. _initDefaultCheckedNode(node) {
  52286. const defaultCheckedKeys = this.defaultCheckedKeys || [];
  52287. if (defaultCheckedKeys.includes(node.key)) {
  52288. node.setChecked(true, !this.checkStrictly);
  52289. }
  52290. }
  52291. setDefaultCheckedKey(newVal) {
  52292. if (newVal !== this.defaultCheckedKeys) {
  52293. this.defaultCheckedKeys = newVal;
  52294. this._initDefaultCheckedNodes();
  52295. }
  52296. }
  52297. registerNode(node) {
  52298. const key = this.key;
  52299. if (!node || !node.data)
  52300. return;
  52301. if (!key) {
  52302. this.nodesMap[node.id] = node;
  52303. } else {
  52304. const nodeKey = node.key;
  52305. if (nodeKey !== void 0)
  52306. this.nodesMap[node.key] = node;
  52307. }
  52308. }
  52309. deregisterNode(node) {
  52310. const key = this.key;
  52311. if (!key || !node || !node.data)
  52312. return;
  52313. node.childNodes.forEach((child) => {
  52314. this.deregisterNode(child);
  52315. });
  52316. delete this.nodesMap[node.key];
  52317. }
  52318. getCheckedNodes(leafOnly = false, includeHalfChecked = false) {
  52319. const checkedNodes = [];
  52320. const traverse = function(node) {
  52321. const childNodes = node.root ? node.root.childNodes : node.childNodes;
  52322. childNodes.forEach((child) => {
  52323. if ((child.checked || includeHalfChecked && child.indeterminate) && (!leafOnly || leafOnly && child.isLeaf)) {
  52324. checkedNodes.push(child.data);
  52325. }
  52326. traverse(child);
  52327. });
  52328. };
  52329. traverse(this);
  52330. return checkedNodes;
  52331. }
  52332. getCheckedKeys(leafOnly = false) {
  52333. return this.getCheckedNodes(leafOnly).map((data) => (data || {})[this.key]);
  52334. }
  52335. getHalfCheckedNodes() {
  52336. const nodes = [];
  52337. const traverse = function(node) {
  52338. const childNodes = node.root ? node.root.childNodes : node.childNodes;
  52339. childNodes.forEach((child) => {
  52340. if (child.indeterminate) {
  52341. nodes.push(child.data);
  52342. }
  52343. traverse(child);
  52344. });
  52345. };
  52346. traverse(this);
  52347. return nodes;
  52348. }
  52349. getHalfCheckedKeys() {
  52350. return this.getHalfCheckedNodes().map((data) => (data || {})[this.key]);
  52351. }
  52352. _getAllNodes() {
  52353. const allNodes = [];
  52354. const nodesMap = this.nodesMap;
  52355. for (const nodeKey in nodesMap) {
  52356. if (hasOwn(nodesMap, nodeKey)) {
  52357. allNodes.push(nodesMap[nodeKey]);
  52358. }
  52359. }
  52360. return allNodes;
  52361. }
  52362. updateChildren(key, data) {
  52363. const node = this.nodesMap[key];
  52364. if (!node)
  52365. return;
  52366. const childNodes = node.childNodes;
  52367. for (let i = childNodes.length - 1; i >= 0; i--) {
  52368. const child = childNodes[i];
  52369. this.remove(child.data);
  52370. }
  52371. for (let i = 0, j = data.length; i < j; i++) {
  52372. const child = data[i];
  52373. this.append(child, node.data);
  52374. }
  52375. }
  52376. _setCheckedKeys(key, leafOnly = false, checkedKeys) {
  52377. const allNodes = this._getAllNodes().sort((a, b) => a.level - b.level);
  52378. const cache = /* @__PURE__ */ Object.create(null);
  52379. const keys = Object.keys(checkedKeys);
  52380. allNodes.forEach((node) => node.setChecked(false, false));
  52381. const cacheCheckedChild = (node) => {
  52382. node.childNodes.forEach((child) => {
  52383. var _a;
  52384. cache[child.data[key]] = true;
  52385. if ((_a = child.childNodes) == null ? void 0 : _a.length) {
  52386. cacheCheckedChild(child);
  52387. }
  52388. });
  52389. };
  52390. for (let i = 0, j = allNodes.length; i < j; i++) {
  52391. const node = allNodes[i];
  52392. const nodeKey = node.data[key].toString();
  52393. const checked = keys.includes(nodeKey);
  52394. if (!checked) {
  52395. if (node.checked && !cache[nodeKey]) {
  52396. node.setChecked(false, false);
  52397. }
  52398. continue;
  52399. }
  52400. if (node.childNodes.length) {
  52401. cacheCheckedChild(node);
  52402. }
  52403. if (node.isLeaf || this.checkStrictly) {
  52404. node.setChecked(true, false);
  52405. continue;
  52406. }
  52407. node.setChecked(true, true);
  52408. if (leafOnly) {
  52409. node.setChecked(false, false);
  52410. const traverse = function(node2) {
  52411. const childNodes = node2.childNodes;
  52412. childNodes.forEach((child) => {
  52413. if (!child.isLeaf) {
  52414. child.setChecked(false, false);
  52415. }
  52416. traverse(child);
  52417. });
  52418. };
  52419. traverse(node);
  52420. }
  52421. }
  52422. }
  52423. setCheckedNodes(array, leafOnly = false) {
  52424. const key = this.key;
  52425. const checkedKeys = {};
  52426. array.forEach((item) => {
  52427. checkedKeys[(item || {})[key]] = true;
  52428. });
  52429. this._setCheckedKeys(key, leafOnly, checkedKeys);
  52430. }
  52431. setCheckedKeys(keys, leafOnly = false) {
  52432. this.defaultCheckedKeys = keys;
  52433. const key = this.key;
  52434. const checkedKeys = {};
  52435. keys.forEach((key2) => {
  52436. checkedKeys[key2] = true;
  52437. });
  52438. this._setCheckedKeys(key, leafOnly, checkedKeys);
  52439. }
  52440. setDefaultExpandedKeys(keys) {
  52441. keys = keys || [];
  52442. this.defaultExpandedKeys = keys;
  52443. keys.forEach((key) => {
  52444. const node = this.getNode(key);
  52445. if (node)
  52446. node.expand(null, this.autoExpandParent);
  52447. });
  52448. }
  52449. setChecked(data, checked, deep) {
  52450. const node = this.getNode(data);
  52451. if (node) {
  52452. node.setChecked(!!checked, deep);
  52453. }
  52454. }
  52455. getCurrentNode() {
  52456. return this.currentNode;
  52457. }
  52458. setCurrentNode(currentNode) {
  52459. const prevCurrentNode = this.currentNode;
  52460. if (prevCurrentNode) {
  52461. prevCurrentNode.isCurrent = false;
  52462. }
  52463. this.currentNode = currentNode;
  52464. this.currentNode.isCurrent = true;
  52465. }
  52466. setUserCurrentNode(node, shouldAutoExpandParent = true) {
  52467. const key = node[this.key];
  52468. const currNode = this.nodesMap[key];
  52469. this.setCurrentNode(currNode);
  52470. if (shouldAutoExpandParent && this.currentNode.level > 1) {
  52471. this.currentNode.parent.expand(null, true);
  52472. }
  52473. }
  52474. setCurrentNodeKey(key, shouldAutoExpandParent = true) {
  52475. this.currentNodeKey = key;
  52476. if (key === null || key === void 0) {
  52477. this.currentNode && (this.currentNode.isCurrent = false);
  52478. this.currentNode = null;
  52479. return;
  52480. }
  52481. const node = this.getNode(key);
  52482. if (node) {
  52483. this.setCurrentNode(node);
  52484. if (shouldAutoExpandParent && this.currentNode.level > 1) {
  52485. this.currentNode.parent.expand(null, true);
  52486. }
  52487. }
  52488. }
  52489. }
  52490. const _sfc_main$m = defineComponent({
  52491. name: "ElTreeNodeContent",
  52492. props: {
  52493. node: {
  52494. type: Object,
  52495. required: true
  52496. },
  52497. renderContent: Function
  52498. },
  52499. setup(props) {
  52500. const ns = useNamespace("tree");
  52501. const nodeInstance = inject("NodeInstance");
  52502. const tree = inject("RootTree");
  52503. return () => {
  52504. const node = props.node;
  52505. const { data, store } = node;
  52506. return props.renderContent ? props.renderContent(h$1, { _self: nodeInstance, node, data, store }) : renderSlot(tree.ctx.slots, "default", { node, data }, () => [
  52507. h$1("span", { class: ns.be("node", "label") }, [node.label])
  52508. ]);
  52509. };
  52510. }
  52511. });
  52512. var NodeContent = /* @__PURE__ */ _export_sfc(_sfc_main$m, [["__file", "tree-node-content.vue"]]);
  52513. function useNodeExpandEventBroadcast(props) {
  52514. const parentNodeMap = inject("TreeNodeMap", null);
  52515. const currentNodeMap = {
  52516. treeNodeExpand: (node) => {
  52517. if (props.node !== node) {
  52518. props.node.collapse();
  52519. }
  52520. },
  52521. children: []
  52522. };
  52523. if (parentNodeMap) {
  52524. parentNodeMap.children.push(currentNodeMap);
  52525. }
  52526. provide("TreeNodeMap", currentNodeMap);
  52527. return {
  52528. broadcastExpanded: (node) => {
  52529. if (!props.accordion)
  52530. return;
  52531. for (const childNode of currentNodeMap.children) {
  52532. childNode.treeNodeExpand(node);
  52533. }
  52534. }
  52535. };
  52536. }
  52537. const dragEventsKey = Symbol("dragEvents");
  52538. function useDragNodeHandler({ props, ctx, el$, dropIndicator$, store }) {
  52539. const ns = useNamespace("tree");
  52540. const dragState = ref({
  52541. showDropIndicator: false,
  52542. draggingNode: null,
  52543. dropNode: null,
  52544. allowDrop: true,
  52545. dropType: null
  52546. });
  52547. const treeNodeDragStart = ({ event, treeNode }) => {
  52548. if (isFunction$1(props.allowDrag) && !props.allowDrag(treeNode.node)) {
  52549. event.preventDefault();
  52550. return false;
  52551. }
  52552. event.dataTransfer.effectAllowed = "move";
  52553. try {
  52554. event.dataTransfer.setData("text/plain", "");
  52555. } catch (e) {
  52556. }
  52557. dragState.value.draggingNode = treeNode;
  52558. ctx.emit("node-drag-start", treeNode.node, event);
  52559. };
  52560. const treeNodeDragOver = ({ event, treeNode }) => {
  52561. const dropNode = treeNode;
  52562. const oldDropNode = dragState.value.dropNode;
  52563. if (oldDropNode && oldDropNode.node.id !== dropNode.node.id) {
  52564. removeClass(oldDropNode.$el, ns.is("drop-inner"));
  52565. }
  52566. const draggingNode = dragState.value.draggingNode;
  52567. if (!draggingNode || !dropNode)
  52568. return;
  52569. let dropPrev = true;
  52570. let dropInner = true;
  52571. let dropNext = true;
  52572. let userAllowDropInner = true;
  52573. if (isFunction$1(props.allowDrop)) {
  52574. dropPrev = props.allowDrop(draggingNode.node, dropNode.node, "prev");
  52575. userAllowDropInner = dropInner = props.allowDrop(draggingNode.node, dropNode.node, "inner");
  52576. dropNext = props.allowDrop(draggingNode.node, dropNode.node, "next");
  52577. }
  52578. event.dataTransfer.dropEffect = dropInner || dropPrev || dropNext ? "move" : "none";
  52579. if ((dropPrev || dropInner || dropNext) && (oldDropNode == null ? void 0 : oldDropNode.node.id) !== dropNode.node.id) {
  52580. if (oldDropNode) {
  52581. ctx.emit("node-drag-leave", draggingNode.node, oldDropNode.node, event);
  52582. }
  52583. ctx.emit("node-drag-enter", draggingNode.node, dropNode.node, event);
  52584. }
  52585. if (dropPrev || dropInner || dropNext) {
  52586. dragState.value.dropNode = dropNode;
  52587. } else {
  52588. dragState.value.dropNode = null;
  52589. }
  52590. if (dropNode.node.nextSibling === draggingNode.node) {
  52591. dropNext = false;
  52592. }
  52593. if (dropNode.node.previousSibling === draggingNode.node) {
  52594. dropPrev = false;
  52595. }
  52596. if (dropNode.node.contains(draggingNode.node, false)) {
  52597. dropInner = false;
  52598. }
  52599. if (draggingNode.node === dropNode.node || draggingNode.node.contains(dropNode.node)) {
  52600. dropPrev = false;
  52601. dropInner = false;
  52602. dropNext = false;
  52603. }
  52604. const targetPosition = dropNode.$el.querySelector(`.${ns.be("node", "content")}`).getBoundingClientRect();
  52605. const treePosition = el$.value.getBoundingClientRect();
  52606. let dropType;
  52607. const prevPercent = dropPrev ? dropInner ? 0.25 : dropNext ? 0.45 : 1 : -1;
  52608. const nextPercent = dropNext ? dropInner ? 0.75 : dropPrev ? 0.55 : 0 : 1;
  52609. let indicatorTop = -9999;
  52610. const distance = event.clientY - targetPosition.top;
  52611. if (distance < targetPosition.height * prevPercent) {
  52612. dropType = "before";
  52613. } else if (distance > targetPosition.height * nextPercent) {
  52614. dropType = "after";
  52615. } else if (dropInner) {
  52616. dropType = "inner";
  52617. } else {
  52618. dropType = "none";
  52619. }
  52620. const iconPosition = dropNode.$el.querySelector(`.${ns.be("node", "expand-icon")}`).getBoundingClientRect();
  52621. const dropIndicator = dropIndicator$.value;
  52622. if (dropType === "before") {
  52623. indicatorTop = iconPosition.top - treePosition.top;
  52624. } else if (dropType === "after") {
  52625. indicatorTop = iconPosition.bottom - treePosition.top;
  52626. }
  52627. dropIndicator.style.top = `${indicatorTop}px`;
  52628. dropIndicator.style.left = `${iconPosition.right - treePosition.left}px`;
  52629. if (dropType === "inner") {
  52630. addClass(dropNode.$el, ns.is("drop-inner"));
  52631. } else {
  52632. removeClass(dropNode.$el, ns.is("drop-inner"));
  52633. }
  52634. dragState.value.showDropIndicator = dropType === "before" || dropType === "after";
  52635. dragState.value.allowDrop = dragState.value.showDropIndicator || userAllowDropInner;
  52636. dragState.value.dropType = dropType;
  52637. ctx.emit("node-drag-over", draggingNode.node, dropNode.node, event);
  52638. };
  52639. const treeNodeDragEnd = (event) => {
  52640. const { draggingNode, dropType, dropNode } = dragState.value;
  52641. event.preventDefault();
  52642. if (event.dataTransfer) {
  52643. event.dataTransfer.dropEffect = "move";
  52644. }
  52645. if (draggingNode && dropNode) {
  52646. const draggingNodeCopy = { data: draggingNode.node.data };
  52647. if (dropType !== "none") {
  52648. draggingNode.node.remove();
  52649. }
  52650. if (dropType === "before") {
  52651. dropNode.node.parent.insertBefore(draggingNodeCopy, dropNode.node);
  52652. } else if (dropType === "after") {
  52653. dropNode.node.parent.insertAfter(draggingNodeCopy, dropNode.node);
  52654. } else if (dropType === "inner") {
  52655. dropNode.node.insertChild(draggingNodeCopy);
  52656. }
  52657. if (dropType !== "none") {
  52658. store.value.registerNode(draggingNodeCopy);
  52659. if (store.value.key) {
  52660. draggingNode.node.eachNode((node) => {
  52661. var _a;
  52662. (_a = store.value.nodesMap[node.data[store.value.key]]) == null ? void 0 : _a.setChecked(node.checked, !store.value.checkStrictly);
  52663. });
  52664. }
  52665. }
  52666. removeClass(dropNode.$el, ns.is("drop-inner"));
  52667. ctx.emit("node-drag-end", draggingNode.node, dropNode.node, dropType, event);
  52668. if (dropType !== "none") {
  52669. ctx.emit("node-drop", draggingNode.node, dropNode.node, dropType, event);
  52670. }
  52671. }
  52672. if (draggingNode && !dropNode) {
  52673. ctx.emit("node-drag-end", draggingNode.node, null, dropType, event);
  52674. }
  52675. dragState.value.showDropIndicator = false;
  52676. dragState.value.draggingNode = null;
  52677. dragState.value.dropNode = null;
  52678. dragState.value.allowDrop = true;
  52679. };
  52680. provide(dragEventsKey, {
  52681. treeNodeDragStart,
  52682. treeNodeDragOver,
  52683. treeNodeDragEnd
  52684. });
  52685. return {
  52686. dragState
  52687. };
  52688. }
  52689. const _sfc_main$l = defineComponent({
  52690. name: "ElTreeNode",
  52691. components: {
  52692. ElCollapseTransition,
  52693. ElCheckbox,
  52694. NodeContent,
  52695. ElIcon,
  52696. Loading: loading_default
  52697. },
  52698. props: {
  52699. node: {
  52700. type: Node$1,
  52701. default: () => ({})
  52702. },
  52703. props: {
  52704. type: Object,
  52705. default: () => ({})
  52706. },
  52707. accordion: Boolean,
  52708. renderContent: Function,
  52709. renderAfterExpand: Boolean,
  52710. showCheckbox: {
  52711. type: Boolean,
  52712. default: false
  52713. }
  52714. },
  52715. emits: ["node-expand"],
  52716. setup(props, ctx) {
  52717. const ns = useNamespace("tree");
  52718. const { broadcastExpanded } = useNodeExpandEventBroadcast(props);
  52719. const tree = inject("RootTree");
  52720. const expanded = ref(false);
  52721. const childNodeRendered = ref(false);
  52722. const oldChecked = ref();
  52723. const oldIndeterminate = ref();
  52724. const node$ = ref();
  52725. const dragEvents = inject(dragEventsKey);
  52726. const instance = getCurrentInstance();
  52727. provide("NodeInstance", instance);
  52728. if (props.node.expanded) {
  52729. expanded.value = true;
  52730. childNodeRendered.value = true;
  52731. }
  52732. const childrenKey = tree.props.props["children"] || "children";
  52733. watch(() => {
  52734. var _a;
  52735. const children = (_a = props.node.data) == null ? void 0 : _a[childrenKey];
  52736. return children && [...children];
  52737. }, () => {
  52738. props.node.updateChildren();
  52739. });
  52740. watch(() => props.node.indeterminate, (val) => {
  52741. handleSelectChange(props.node.checked, val);
  52742. });
  52743. watch(() => props.node.checked, (val) => {
  52744. handleSelectChange(val, props.node.indeterminate);
  52745. });
  52746. watch(() => props.node.childNodes.length, () => props.node.reInitChecked());
  52747. watch(() => props.node.expanded, (val) => {
  52748. nextTick(() => expanded.value = val);
  52749. if (val) {
  52750. childNodeRendered.value = true;
  52751. }
  52752. });
  52753. const getNodeKey$1 = (node) => {
  52754. return getNodeKey(tree.props.nodeKey, node.data);
  52755. };
  52756. const getNodeClass = (node) => {
  52757. const nodeClassFunc = props.props.class;
  52758. if (!nodeClassFunc) {
  52759. return {};
  52760. }
  52761. let className;
  52762. if (isFunction$1(nodeClassFunc)) {
  52763. const { data } = node;
  52764. className = nodeClassFunc(data, node);
  52765. } else {
  52766. className = nodeClassFunc;
  52767. }
  52768. if (isString$1(className)) {
  52769. return { [className]: true };
  52770. } else {
  52771. return className;
  52772. }
  52773. };
  52774. const handleSelectChange = (checked, indeterminate) => {
  52775. if (oldChecked.value !== checked || oldIndeterminate.value !== indeterminate) {
  52776. tree.ctx.emit("check-change", props.node.data, checked, indeterminate);
  52777. }
  52778. oldChecked.value = checked;
  52779. oldIndeterminate.value = indeterminate;
  52780. };
  52781. const handleClick = (e) => {
  52782. handleCurrentChange(tree.store, tree.ctx.emit, () => {
  52783. var _a;
  52784. const nodeKeyProp = (_a = tree == null ? void 0 : tree.props) == null ? void 0 : _a.nodeKey;
  52785. if (nodeKeyProp) {
  52786. const curNodeKey = getNodeKey$1(props.node);
  52787. tree.store.value.setCurrentNodeKey(curNodeKey);
  52788. } else {
  52789. tree.store.value.setCurrentNode(props.node);
  52790. }
  52791. });
  52792. tree.currentNode.value = props.node;
  52793. if (tree.props.expandOnClickNode) {
  52794. handleExpandIconClick();
  52795. }
  52796. if ((tree.props.checkOnClickNode || props.node.isLeaf && tree.props.checkOnClickLeaf && props.showCheckbox) && !props.node.disabled) {
  52797. handleCheckChange(!props.node.checked);
  52798. }
  52799. tree.ctx.emit("node-click", props.node.data, props.node, instance, e);
  52800. };
  52801. const handleContextMenu = (event) => {
  52802. var _a;
  52803. if ((_a = tree.instance.vnode.props) == null ? void 0 : _a["onNodeContextmenu"]) {
  52804. event.stopPropagation();
  52805. event.preventDefault();
  52806. }
  52807. tree.ctx.emit("node-contextmenu", event, props.node.data, props.node, instance);
  52808. };
  52809. const handleExpandIconClick = () => {
  52810. if (props.node.isLeaf)
  52811. return;
  52812. if (expanded.value) {
  52813. tree.ctx.emit("node-collapse", props.node.data, props.node, instance);
  52814. props.node.collapse();
  52815. } else {
  52816. props.node.expand(() => {
  52817. ctx.emit("node-expand", props.node.data, props.node, instance);
  52818. });
  52819. }
  52820. };
  52821. const handleCheckChange = (value) => {
  52822. props.node.setChecked(value, !(tree == null ? void 0 : tree.props.checkStrictly));
  52823. nextTick(() => {
  52824. const store = tree.store.value;
  52825. tree.ctx.emit("check", props.node.data, {
  52826. checkedNodes: store.getCheckedNodes(),
  52827. checkedKeys: store.getCheckedKeys(),
  52828. halfCheckedNodes: store.getHalfCheckedNodes(),
  52829. halfCheckedKeys: store.getHalfCheckedKeys()
  52830. });
  52831. });
  52832. };
  52833. const handleChildNodeExpand = (nodeData, node, instance2) => {
  52834. broadcastExpanded(node);
  52835. tree.ctx.emit("node-expand", nodeData, node, instance2);
  52836. };
  52837. const handleDragStart = (event) => {
  52838. if (!tree.props.draggable)
  52839. return;
  52840. dragEvents.treeNodeDragStart({ event, treeNode: props });
  52841. };
  52842. const handleDragOver = (event) => {
  52843. event.preventDefault();
  52844. if (!tree.props.draggable)
  52845. return;
  52846. dragEvents.treeNodeDragOver({
  52847. event,
  52848. treeNode: { $el: node$.value, node: props.node }
  52849. });
  52850. };
  52851. const handleDrop = (event) => {
  52852. event.preventDefault();
  52853. };
  52854. const handleDragEnd = (event) => {
  52855. if (!tree.props.draggable)
  52856. return;
  52857. dragEvents.treeNodeDragEnd(event);
  52858. };
  52859. return {
  52860. ns,
  52861. node$,
  52862. tree,
  52863. expanded,
  52864. childNodeRendered,
  52865. oldChecked,
  52866. oldIndeterminate,
  52867. getNodeKey: getNodeKey$1,
  52868. getNodeClass,
  52869. handleSelectChange,
  52870. handleClick,
  52871. handleContextMenu,
  52872. handleExpandIconClick,
  52873. handleCheckChange,
  52874. handleChildNodeExpand,
  52875. handleDragStart,
  52876. handleDragOver,
  52877. handleDrop,
  52878. handleDragEnd,
  52879. CaretRight: caret_right_default
  52880. };
  52881. }
  52882. });
  52883. function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
  52884. const _component_el_icon = resolveComponent("el-icon");
  52885. const _component_el_checkbox = resolveComponent("el-checkbox");
  52886. const _component_loading = resolveComponent("loading");
  52887. const _component_node_content = resolveComponent("node-content");
  52888. const _component_el_tree_node = resolveComponent("el-tree-node");
  52889. const _component_el_collapse_transition = resolveComponent("el-collapse-transition");
  52890. return withDirectives((openBlock(), createElementBlock("div", {
  52891. ref: "node$",
  52892. class: normalizeClass([
  52893. _ctx.ns.b("node"),
  52894. _ctx.ns.is("expanded", _ctx.expanded),
  52895. _ctx.ns.is("current", _ctx.node.isCurrent),
  52896. _ctx.ns.is("hidden", !_ctx.node.visible),
  52897. _ctx.ns.is("focusable", !_ctx.node.disabled),
  52898. _ctx.ns.is("checked", !_ctx.node.disabled && _ctx.node.checked),
  52899. _ctx.getNodeClass(_ctx.node)
  52900. ]),
  52901. role: "treeitem",
  52902. tabindex: "-1",
  52903. "aria-expanded": _ctx.expanded,
  52904. "aria-disabled": _ctx.node.disabled,
  52905. "aria-checked": _ctx.node.checked,
  52906. draggable: _ctx.tree.props.draggable,
  52907. "data-key": _ctx.getNodeKey(_ctx.node),
  52908. onClick: withModifiers(_ctx.handleClick, ["stop"]),
  52909. onContextmenu: _ctx.handleContextMenu,
  52910. onDragstart: withModifiers(_ctx.handleDragStart, ["stop"]),
  52911. onDragover: withModifiers(_ctx.handleDragOver, ["stop"]),
  52912. onDragend: withModifiers(_ctx.handleDragEnd, ["stop"]),
  52913. onDrop: withModifiers(_ctx.handleDrop, ["stop"])
  52914. }, [
  52915. createElementVNode("div", {
  52916. class: normalizeClass(_ctx.ns.be("node", "content")),
  52917. style: normalizeStyle({ paddingLeft: (_ctx.node.level - 1) * _ctx.tree.props.indent + "px" })
  52918. }, [
  52919. _ctx.tree.props.icon || _ctx.CaretRight ? (openBlock(), createBlock(_component_el_icon, {
  52920. key: 0,
  52921. class: normalizeClass([
  52922. _ctx.ns.be("node", "expand-icon"),
  52923. _ctx.ns.is("leaf", _ctx.node.isLeaf),
  52924. {
  52925. expanded: !_ctx.node.isLeaf && _ctx.expanded
  52926. }
  52927. ]),
  52928. onClick: withModifiers(_ctx.handleExpandIconClick, ["stop"])
  52929. }, {
  52930. default: withCtx(() => [
  52931. (openBlock(), createBlock(resolveDynamicComponent(_ctx.tree.props.icon || _ctx.CaretRight)))
  52932. ]),
  52933. _: 1
  52934. }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true),
  52935. _ctx.showCheckbox ? (openBlock(), createBlock(_component_el_checkbox, {
  52936. key: 1,
  52937. "model-value": _ctx.node.checked,
  52938. indeterminate: _ctx.node.indeterminate,
  52939. disabled: !!_ctx.node.disabled,
  52940. onClick: withModifiers(() => {
  52941. }, ["stop"]),
  52942. onChange: _ctx.handleCheckChange
  52943. }, null, 8, ["model-value", "indeterminate", "disabled", "onClick", "onChange"])) : createCommentVNode("v-if", true),
  52944. _ctx.node.loading ? (openBlock(), createBlock(_component_el_icon, {
  52945. key: 2,
  52946. class: normalizeClass([_ctx.ns.be("node", "loading-icon"), _ctx.ns.is("loading")])
  52947. }, {
  52948. default: withCtx(() => [
  52949. createVNode(_component_loading)
  52950. ]),
  52951. _: 1
  52952. }, 8, ["class"])) : createCommentVNode("v-if", true),
  52953. createVNode(_component_node_content, {
  52954. node: _ctx.node,
  52955. "render-content": _ctx.renderContent
  52956. }, null, 8, ["node", "render-content"])
  52957. ], 6),
  52958. createVNode(_component_el_collapse_transition, null, {
  52959. default: withCtx(() => [
  52960. !_ctx.renderAfterExpand || _ctx.childNodeRendered ? withDirectives((openBlock(), createElementBlock("div", {
  52961. key: 0,
  52962. class: normalizeClass(_ctx.ns.be("node", "children")),
  52963. role: "group",
  52964. "aria-expanded": _ctx.expanded
  52965. }, [
  52966. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.node.childNodes, (child) => {
  52967. return openBlock(), createBlock(_component_el_tree_node, {
  52968. key: _ctx.getNodeKey(child),
  52969. "render-content": _ctx.renderContent,
  52970. "render-after-expand": _ctx.renderAfterExpand,
  52971. "show-checkbox": _ctx.showCheckbox,
  52972. node: child,
  52973. accordion: _ctx.accordion,
  52974. props: _ctx.props,
  52975. onNodeExpand: _ctx.handleChildNodeExpand
  52976. }, null, 8, ["render-content", "render-after-expand", "show-checkbox", "node", "accordion", "props", "onNodeExpand"]);
  52977. }), 128))
  52978. ], 10, ["aria-expanded"])), [
  52979. [vShow, _ctx.expanded]
  52980. ]) : createCommentVNode("v-if", true)
  52981. ]),
  52982. _: 1
  52983. })
  52984. ], 42, ["aria-expanded", "aria-disabled", "aria-checked", "draggable", "data-key", "onClick", "onContextmenu", "onDragstart", "onDragover", "onDragend", "onDrop"])), [
  52985. [vShow, _ctx.node.visible]
  52986. ]);
  52987. }
  52988. var ElTreeNode$1 = /* @__PURE__ */ _export_sfc(_sfc_main$l, [["render", _sfc_render$2], ["__file", "tree-node.vue"]]);
  52989. function useKeydown({ el$ }, store) {
  52990. const ns = useNamespace("tree");
  52991. const treeItems = shallowRef([]);
  52992. const checkboxItems = shallowRef([]);
  52993. onMounted(() => {
  52994. initTabIndex();
  52995. });
  52996. onUpdated(() => {
  52997. treeItems.value = Array.from(el$.value.querySelectorAll("[role=treeitem]"));
  52998. checkboxItems.value = Array.from(el$.value.querySelectorAll("input[type=checkbox]"));
  52999. });
  53000. watch(checkboxItems, (val) => {
  53001. val.forEach((checkbox) => {
  53002. checkbox.setAttribute("tabindex", "-1");
  53003. });
  53004. });
  53005. const handleKeydown = (ev) => {
  53006. const currentItem = ev.target;
  53007. if (!currentItem.className.includes(ns.b("node")))
  53008. return;
  53009. const code = ev.code;
  53010. treeItems.value = Array.from(el$.value.querySelectorAll(`.${ns.is("focusable")}[role=treeitem]`));
  53011. const currentIndex = treeItems.value.indexOf(currentItem);
  53012. let nextIndex;
  53013. if ([EVENT_CODE.up, EVENT_CODE.down].includes(code)) {
  53014. ev.preventDefault();
  53015. if (code === EVENT_CODE.up) {
  53016. nextIndex = currentIndex === -1 ? 0 : currentIndex !== 0 ? currentIndex - 1 : treeItems.value.length - 1;
  53017. const startIndex = nextIndex;
  53018. while (true) {
  53019. if (store.value.getNode(treeItems.value[nextIndex].dataset.key).canFocus)
  53020. break;
  53021. nextIndex--;
  53022. if (nextIndex === startIndex) {
  53023. nextIndex = -1;
  53024. break;
  53025. }
  53026. if (nextIndex < 0) {
  53027. nextIndex = treeItems.value.length - 1;
  53028. }
  53029. }
  53030. } else {
  53031. nextIndex = currentIndex === -1 ? 0 : currentIndex < treeItems.value.length - 1 ? currentIndex + 1 : 0;
  53032. const startIndex = nextIndex;
  53033. while (true) {
  53034. if (store.value.getNode(treeItems.value[nextIndex].dataset.key).canFocus)
  53035. break;
  53036. nextIndex++;
  53037. if (nextIndex === startIndex) {
  53038. nextIndex = -1;
  53039. break;
  53040. }
  53041. if (nextIndex >= treeItems.value.length) {
  53042. nextIndex = 0;
  53043. }
  53044. }
  53045. }
  53046. nextIndex !== -1 && treeItems.value[nextIndex].focus();
  53047. }
  53048. if ([EVENT_CODE.left, EVENT_CODE.right].includes(code)) {
  53049. ev.preventDefault();
  53050. currentItem.click();
  53051. }
  53052. const hasInput = currentItem.querySelector('[type="checkbox"]');
  53053. if ([EVENT_CODE.enter, EVENT_CODE.numpadEnter, EVENT_CODE.space].includes(code) && hasInput) {
  53054. ev.preventDefault();
  53055. hasInput.click();
  53056. }
  53057. };
  53058. useEventListener(el$, "keydown", handleKeydown);
  53059. const initTabIndex = () => {
  53060. var _a;
  53061. treeItems.value = Array.from(el$.value.querySelectorAll(`.${ns.is("focusable")}[role=treeitem]`));
  53062. checkboxItems.value = Array.from(el$.value.querySelectorAll("input[type=checkbox]"));
  53063. const checkedItem = el$.value.querySelectorAll(`.${ns.is("checked")}[role=treeitem]`);
  53064. if (checkedItem.length) {
  53065. checkedItem[0].setAttribute("tabindex", "0");
  53066. return;
  53067. }
  53068. (_a = treeItems.value[0]) == null ? void 0 : _a.setAttribute("tabindex", "0");
  53069. };
  53070. }
  53071. const _sfc_main$k = defineComponent({
  53072. name: "ElTree",
  53073. components: { ElTreeNode: ElTreeNode$1 },
  53074. props: {
  53075. data: {
  53076. type: Array,
  53077. default: () => []
  53078. },
  53079. emptyText: {
  53080. type: String
  53081. },
  53082. renderAfterExpand: {
  53083. type: Boolean,
  53084. default: true
  53085. },
  53086. nodeKey: String,
  53087. checkStrictly: Boolean,
  53088. defaultExpandAll: Boolean,
  53089. expandOnClickNode: {
  53090. type: Boolean,
  53091. default: true
  53092. },
  53093. checkOnClickNode: Boolean,
  53094. checkOnClickLeaf: {
  53095. type: Boolean,
  53096. default: true
  53097. },
  53098. checkDescendants: {
  53099. type: Boolean,
  53100. default: false
  53101. },
  53102. autoExpandParent: {
  53103. type: Boolean,
  53104. default: true
  53105. },
  53106. defaultCheckedKeys: Array,
  53107. defaultExpandedKeys: Array,
  53108. currentNodeKey: [String, Number],
  53109. renderContent: Function,
  53110. showCheckbox: {
  53111. type: Boolean,
  53112. default: false
  53113. },
  53114. draggable: {
  53115. type: Boolean,
  53116. default: false
  53117. },
  53118. allowDrag: Function,
  53119. allowDrop: Function,
  53120. props: {
  53121. type: Object,
  53122. default: () => ({
  53123. children: "children",
  53124. label: "label",
  53125. disabled: "disabled"
  53126. })
  53127. },
  53128. lazy: {
  53129. type: Boolean,
  53130. default: false
  53131. },
  53132. highlightCurrent: Boolean,
  53133. load: Function,
  53134. filterNodeMethod: Function,
  53135. accordion: Boolean,
  53136. indent: {
  53137. type: Number,
  53138. default: 18
  53139. },
  53140. icon: {
  53141. type: iconPropType
  53142. }
  53143. },
  53144. emits: [
  53145. "check-change",
  53146. "current-change",
  53147. "node-click",
  53148. "node-contextmenu",
  53149. "node-collapse",
  53150. "node-expand",
  53151. "check",
  53152. "node-drag-start",
  53153. "node-drag-end",
  53154. "node-drop",
  53155. "node-drag-leave",
  53156. "node-drag-enter",
  53157. "node-drag-over"
  53158. ],
  53159. setup(props, ctx) {
  53160. const { t } = useLocale();
  53161. const ns = useNamespace("tree");
  53162. const selectInfo = inject(selectKey, null);
  53163. const store = ref(new TreeStore({
  53164. key: props.nodeKey,
  53165. data: props.data,
  53166. lazy: props.lazy,
  53167. props: props.props,
  53168. load: props.load,
  53169. currentNodeKey: props.currentNodeKey,
  53170. checkStrictly: props.checkStrictly,
  53171. checkDescendants: props.checkDescendants,
  53172. defaultCheckedKeys: props.defaultCheckedKeys,
  53173. defaultExpandedKeys: props.defaultExpandedKeys,
  53174. autoExpandParent: props.autoExpandParent,
  53175. defaultExpandAll: props.defaultExpandAll,
  53176. filterNodeMethod: props.filterNodeMethod
  53177. }));
  53178. store.value.initialize();
  53179. const root = ref(store.value.root);
  53180. const currentNode = ref(null);
  53181. const el$ = ref(null);
  53182. const dropIndicator$ = ref(null);
  53183. const { broadcastExpanded } = useNodeExpandEventBroadcast(props);
  53184. const { dragState } = useDragNodeHandler({
  53185. props,
  53186. ctx,
  53187. el$,
  53188. dropIndicator$,
  53189. store
  53190. });
  53191. useKeydown({ el$ }, store);
  53192. const isEmpty = computed(() => {
  53193. const { childNodes } = root.value;
  53194. const hasFilteredOptions = selectInfo ? selectInfo.hasFilteredOptions !== 0 : false;
  53195. return (!childNodes || childNodes.length === 0 || childNodes.every(({ visible }) => !visible)) && !hasFilteredOptions;
  53196. });
  53197. watch(() => props.currentNodeKey, (newVal) => {
  53198. store.value.setCurrentNodeKey(newVal);
  53199. });
  53200. watch(() => props.defaultCheckedKeys, (newVal) => {
  53201. store.value.setDefaultCheckedKey(newVal);
  53202. });
  53203. watch(() => props.defaultExpandedKeys, (newVal) => {
  53204. store.value.setDefaultExpandedKeys(newVal);
  53205. });
  53206. watch(() => props.data, (newVal) => {
  53207. store.value.setData(newVal);
  53208. }, { deep: true });
  53209. watch(() => props.checkStrictly, (newVal) => {
  53210. store.value.checkStrictly = newVal;
  53211. });
  53212. const filter = (value) => {
  53213. if (!props.filterNodeMethod)
  53214. throw new Error("[Tree] filterNodeMethod is required when filter");
  53215. store.value.filter(value);
  53216. };
  53217. const getNodeKey$1 = (node) => {
  53218. return getNodeKey(props.nodeKey, node.data);
  53219. };
  53220. const getNodePath = (data) => {
  53221. if (!props.nodeKey)
  53222. throw new Error("[Tree] nodeKey is required in getNodePath");
  53223. const node = store.value.getNode(data);
  53224. if (!node)
  53225. return [];
  53226. const path = [node.data];
  53227. let parent = node.parent;
  53228. while (parent && parent !== root.value) {
  53229. path.push(parent.data);
  53230. parent = parent.parent;
  53231. }
  53232. return path.reverse();
  53233. };
  53234. const getCheckedNodes = (leafOnly, includeHalfChecked) => {
  53235. return store.value.getCheckedNodes(leafOnly, includeHalfChecked);
  53236. };
  53237. const getCheckedKeys = (leafOnly) => {
  53238. return store.value.getCheckedKeys(leafOnly);
  53239. };
  53240. const getCurrentNode = () => {
  53241. const currentNode2 = store.value.getCurrentNode();
  53242. return currentNode2 ? currentNode2.data : null;
  53243. };
  53244. const getCurrentKey = () => {
  53245. if (!props.nodeKey)
  53246. throw new Error("[Tree] nodeKey is required in getCurrentKey");
  53247. const currentNode2 = getCurrentNode();
  53248. return currentNode2 ? currentNode2[props.nodeKey] : null;
  53249. };
  53250. const setCheckedNodes = (nodes, leafOnly) => {
  53251. if (!props.nodeKey)
  53252. throw new Error("[Tree] nodeKey is required in setCheckedNodes");
  53253. store.value.setCheckedNodes(nodes, leafOnly);
  53254. };
  53255. const setCheckedKeys = (keys, leafOnly) => {
  53256. if (!props.nodeKey)
  53257. throw new Error("[Tree] nodeKey is required in setCheckedKeys");
  53258. store.value.setCheckedKeys(keys, leafOnly);
  53259. };
  53260. const setChecked = (data, checked, deep) => {
  53261. store.value.setChecked(data, checked, deep);
  53262. };
  53263. const getHalfCheckedNodes = () => {
  53264. return store.value.getHalfCheckedNodes();
  53265. };
  53266. const getHalfCheckedKeys = () => {
  53267. return store.value.getHalfCheckedKeys();
  53268. };
  53269. const setCurrentNode = (node, shouldAutoExpandParent = true) => {
  53270. if (!props.nodeKey)
  53271. throw new Error("[Tree] nodeKey is required in setCurrentNode");
  53272. handleCurrentChange(store, ctx.emit, () => {
  53273. broadcastExpanded(node);
  53274. store.value.setUserCurrentNode(node, shouldAutoExpandParent);
  53275. });
  53276. };
  53277. const setCurrentKey = (key, shouldAutoExpandParent = true) => {
  53278. if (!props.nodeKey)
  53279. throw new Error("[Tree] nodeKey is required in setCurrentKey");
  53280. handleCurrentChange(store, ctx.emit, () => {
  53281. broadcastExpanded();
  53282. store.value.setCurrentNodeKey(key, shouldAutoExpandParent);
  53283. });
  53284. };
  53285. const getNode = (data) => {
  53286. return store.value.getNode(data);
  53287. };
  53288. const remove = (data) => {
  53289. store.value.remove(data);
  53290. };
  53291. const append = (data, parentNode) => {
  53292. store.value.append(data, parentNode);
  53293. };
  53294. const insertBefore = (data, refNode) => {
  53295. store.value.insertBefore(data, refNode);
  53296. };
  53297. const insertAfter = (data, refNode) => {
  53298. store.value.insertAfter(data, refNode);
  53299. };
  53300. const handleNodeExpand = (nodeData, node, instance) => {
  53301. broadcastExpanded(node);
  53302. ctx.emit("node-expand", nodeData, node, instance);
  53303. };
  53304. const updateKeyChildren = (key, data) => {
  53305. if (!props.nodeKey)
  53306. throw new Error("[Tree] nodeKey is required in updateKeyChild");
  53307. store.value.updateChildren(key, data);
  53308. };
  53309. provide("RootTree", {
  53310. ctx,
  53311. props,
  53312. store,
  53313. root,
  53314. currentNode,
  53315. instance: getCurrentInstance()
  53316. });
  53317. provide(formItemContextKey, void 0);
  53318. return {
  53319. ns,
  53320. store,
  53321. root,
  53322. currentNode,
  53323. dragState,
  53324. el$,
  53325. dropIndicator$,
  53326. isEmpty,
  53327. filter,
  53328. getNodeKey: getNodeKey$1,
  53329. getNodePath,
  53330. getCheckedNodes,
  53331. getCheckedKeys,
  53332. getCurrentNode,
  53333. getCurrentKey,
  53334. setCheckedNodes,
  53335. setCheckedKeys,
  53336. setChecked,
  53337. getHalfCheckedNodes,
  53338. getHalfCheckedKeys,
  53339. setCurrentNode,
  53340. setCurrentKey,
  53341. t,
  53342. getNode,
  53343. remove,
  53344. append,
  53345. insertBefore,
  53346. insertAfter,
  53347. handleNodeExpand,
  53348. updateKeyChildren
  53349. };
  53350. }
  53351. });
  53352. function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
  53353. const _component_el_tree_node = resolveComponent("el-tree-node");
  53354. return openBlock(), createElementBlock("div", {
  53355. ref: "el$",
  53356. class: normalizeClass([
  53357. _ctx.ns.b(),
  53358. _ctx.ns.is("dragging", !!_ctx.dragState.draggingNode),
  53359. _ctx.ns.is("drop-not-allow", !_ctx.dragState.allowDrop),
  53360. _ctx.ns.is("drop-inner", _ctx.dragState.dropType === "inner"),
  53361. { [_ctx.ns.m("highlight-current")]: _ctx.highlightCurrent }
  53362. ]),
  53363. role: "tree"
  53364. }, [
  53365. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.root.childNodes, (child) => {
  53366. return openBlock(), createBlock(_component_el_tree_node, {
  53367. key: _ctx.getNodeKey(child),
  53368. node: child,
  53369. props: _ctx.props,
  53370. accordion: _ctx.accordion,
  53371. "render-after-expand": _ctx.renderAfterExpand,
  53372. "show-checkbox": _ctx.showCheckbox,
  53373. "render-content": _ctx.renderContent,
  53374. onNodeExpand: _ctx.handleNodeExpand
  53375. }, null, 8, ["node", "props", "accordion", "render-after-expand", "show-checkbox", "render-content", "onNodeExpand"]);
  53376. }), 128)),
  53377. _ctx.isEmpty ? (openBlock(), createElementBlock("div", {
  53378. key: 0,
  53379. class: normalizeClass(_ctx.ns.e("empty-block"))
  53380. }, [
  53381. renderSlot(_ctx.$slots, "empty", {}, () => {
  53382. var _a;
  53383. return [
  53384. createElementVNode("span", {
  53385. class: normalizeClass(_ctx.ns.e("empty-text"))
  53386. }, toDisplayString((_a = _ctx.emptyText) != null ? _a : _ctx.t("el.tree.emptyText")), 3)
  53387. ];
  53388. })
  53389. ], 2)) : createCommentVNode("v-if", true),
  53390. withDirectives(createElementVNode("div", {
  53391. ref: "dropIndicator$",
  53392. class: normalizeClass(_ctx.ns.e("drop-indicator"))
  53393. }, null, 2), [
  53394. [vShow, _ctx.dragState.showDropIndicator]
  53395. ])
  53396. ], 2);
  53397. }
  53398. var Tree = /* @__PURE__ */ _export_sfc(_sfc_main$k, [["render", _sfc_render$1], ["__file", "tree.vue"]]);
  53399. const ElTree = withInstall(Tree);
  53400. const useSelect = (props, { attrs, emit }, {
  53401. select,
  53402. tree,
  53403. key
  53404. }) => {
  53405. const ns = useNamespace("tree-select");
  53406. watch(() => props.data, () => {
  53407. if (props.filterable) {
  53408. nextTick(() => {
  53409. var _a, _b;
  53410. (_b = tree.value) == null ? void 0 : _b.filter((_a = select.value) == null ? void 0 : _a.states.inputValue);
  53411. });
  53412. }
  53413. }, { flush: "post" });
  53414. const result = {
  53415. ...pick(toRefs(props), Object.keys(ElSelect.props)),
  53416. ...attrs,
  53417. class: computed(() => attrs.class),
  53418. style: computed(() => attrs.style),
  53419. "onUpdate:modelValue": (value) => emit(UPDATE_MODEL_EVENT, value),
  53420. valueKey: key,
  53421. popperClass: computed(() => {
  53422. const classes = [ns.e("popper")];
  53423. if (props.popperClass)
  53424. classes.push(props.popperClass);
  53425. return classes.join(" ");
  53426. }),
  53427. filterMethod: (keyword = "") => {
  53428. var _a;
  53429. if (props.filterMethod) {
  53430. props.filterMethod(keyword);
  53431. } else if (props.remoteMethod) {
  53432. props.remoteMethod(keyword);
  53433. } else {
  53434. (_a = tree.value) == null ? void 0 : _a.filter(keyword);
  53435. }
  53436. }
  53437. };
  53438. return result;
  53439. };
  53440. const component = defineComponent({
  53441. extends: ElOption,
  53442. setup(props, ctx) {
  53443. const result = ElOption.setup(props, ctx);
  53444. delete result.selectOptionClick;
  53445. const vm = getCurrentInstance().proxy;
  53446. nextTick(() => {
  53447. if (!result.select.states.cachedOptions.get(vm.value)) {
  53448. result.select.onOptionCreate(vm);
  53449. }
  53450. });
  53451. watch(() => ctx.attrs.visible, (val) => {
  53452. nextTick(() => {
  53453. result.states.visible = val;
  53454. });
  53455. }, {
  53456. immediate: true
  53457. });
  53458. return result;
  53459. },
  53460. methods: {
  53461. selectOptionClick() {
  53462. this.$el.parentElement.click();
  53463. }
  53464. }
  53465. });
  53466. var TreeSelectOption = component;
  53467. function isValidValue(val) {
  53468. return val || val === 0;
  53469. }
  53470. function isValidArray(val) {
  53471. return isArray$1(val) && val.length;
  53472. }
  53473. function toValidArray(val) {
  53474. return isArray$1(val) ? val : isValidValue(val) ? [val] : [];
  53475. }
  53476. function treeFind(treeData, findCallback, getChildren, resultCallback, parent) {
  53477. for (let i = 0; i < treeData.length; i++) {
  53478. const data = treeData[i];
  53479. if (findCallback(data, i, treeData, parent)) {
  53480. return resultCallback ? resultCallback(data, i, treeData, parent) : data;
  53481. } else {
  53482. const children = getChildren(data);
  53483. if (isValidArray(children)) {
  53484. const find = treeFind(children, findCallback, getChildren, resultCallback, data);
  53485. if (find)
  53486. return find;
  53487. }
  53488. }
  53489. }
  53490. }
  53491. function treeEach(treeData, callback, getChildren, parent) {
  53492. for (let i = 0; i < treeData.length; i++) {
  53493. const data = treeData[i];
  53494. callback(data, i, treeData, parent);
  53495. const children = getChildren(data);
  53496. if (isValidArray(children)) {
  53497. treeEach(children, callback, getChildren, data);
  53498. }
  53499. }
  53500. }
  53501. const useTree$1 = (props, { attrs, slots, emit }, {
  53502. select,
  53503. tree,
  53504. key
  53505. }) => {
  53506. watch(() => props.modelValue, () => {
  53507. if (props.showCheckbox) {
  53508. nextTick(() => {
  53509. const treeInstance = tree.value;
  53510. if (treeInstance && !isEqual$1(treeInstance.getCheckedKeys(), toValidArray(props.modelValue))) {
  53511. treeInstance.setCheckedKeys(toValidArray(props.modelValue));
  53512. }
  53513. });
  53514. }
  53515. }, {
  53516. immediate: true,
  53517. deep: true
  53518. });
  53519. const propsMap = computed(() => ({
  53520. value: key.value,
  53521. label: "label",
  53522. children: "children",
  53523. disabled: "disabled",
  53524. isLeaf: "isLeaf",
  53525. ...props.props
  53526. }));
  53527. const getNodeValByProp = (prop, data) => {
  53528. var _a;
  53529. const propVal = propsMap.value[prop];
  53530. if (isFunction$1(propVal)) {
  53531. return propVal(data, (_a = tree.value) == null ? void 0 : _a.getNode(getNodeValByProp("value", data)));
  53532. } else {
  53533. return data[propVal];
  53534. }
  53535. };
  53536. const defaultExpandedParentKeys = toValidArray(props.modelValue).map((value) => {
  53537. return treeFind(props.data || [], (data) => getNodeValByProp("value", data) === value, (data) => getNodeValByProp("children", data), (data, index, array, parent) => parent && getNodeValByProp("value", parent));
  53538. }).filter((item) => isValidValue(item));
  53539. const cacheOptions = computed(() => {
  53540. if (!props.renderAfterExpand && !props.lazy)
  53541. return [];
  53542. const options = [];
  53543. treeEach(props.data.concat(props.cacheData), (node) => {
  53544. const value = getNodeValByProp("value", node);
  53545. options.push({
  53546. value,
  53547. currentLabel: getNodeValByProp("label", node),
  53548. isDisabled: getNodeValByProp("disabled", node)
  53549. });
  53550. }, (data) => getNodeValByProp("children", data));
  53551. return options;
  53552. });
  53553. const getChildCheckedKeys = () => {
  53554. var _a;
  53555. return (_a = tree.value) == null ? void 0 : _a.getCheckedKeys().filter((checkedKey) => {
  53556. var _a2;
  53557. const node = (_a2 = tree.value) == null ? void 0 : _a2.getNode(checkedKey);
  53558. return !isNil(node) && isEmpty(node.childNodes);
  53559. });
  53560. };
  53561. return {
  53562. ...pick(toRefs(props), Object.keys(ElTree.props)),
  53563. ...attrs,
  53564. nodeKey: key,
  53565. expandOnClickNode: computed(() => {
  53566. return !props.checkStrictly && props.expandOnClickNode;
  53567. }),
  53568. defaultExpandedKeys: computed(() => {
  53569. return props.defaultExpandedKeys ? props.defaultExpandedKeys.concat(defaultExpandedParentKeys) : defaultExpandedParentKeys;
  53570. }),
  53571. renderContent: (h, { node, data, store }) => {
  53572. return h(TreeSelectOption, {
  53573. value: getNodeValByProp("value", data),
  53574. label: getNodeValByProp("label", data),
  53575. disabled: getNodeValByProp("disabled", data),
  53576. visible: node.visible
  53577. }, props.renderContent ? () => props.renderContent(h, { node, data, store }) : slots.default ? () => slots.default({ node, data, store }) : void 0);
  53578. },
  53579. filterNodeMethod: (value, data, node) => {
  53580. if (props.filterNodeMethod)
  53581. return props.filterNodeMethod(value, data, node);
  53582. if (!value)
  53583. return true;
  53584. const regexp = new RegExp(escapeStringRegexp(value), "i");
  53585. return regexp.test(getNodeValByProp("label", data) || "");
  53586. },
  53587. onNodeClick: (data, node, e) => {
  53588. var _a, _b, _c, _d;
  53589. (_a = attrs.onNodeClick) == null ? void 0 : _a.call(attrs, data, node, e);
  53590. if (props.showCheckbox && props.checkOnClickNode)
  53591. return;
  53592. if (!props.showCheckbox && (props.checkStrictly || node.isLeaf)) {
  53593. if (!getNodeValByProp("disabled", data)) {
  53594. const option = (_b = select.value) == null ? void 0 : _b.states.options.get(getNodeValByProp("value", data));
  53595. (_c = select.value) == null ? void 0 : _c.handleOptionSelect(option);
  53596. }
  53597. } else if (props.expandOnClickNode) {
  53598. e.proxy.handleExpandIconClick();
  53599. }
  53600. (_d = select.value) == null ? void 0 : _d.focus();
  53601. },
  53602. onCheck: (data, params) => {
  53603. var _a;
  53604. if (!props.showCheckbox)
  53605. return;
  53606. const dataValue = getNodeValByProp("value", data);
  53607. const dataMap = {};
  53608. treeEach([tree.value.store.root], (node) => dataMap[node.key] = node, (node) => node.childNodes);
  53609. const uncachedCheckedKeys = params.checkedKeys;
  53610. const cachedKeys = props.multiple ? toValidArray(props.modelValue).filter((item) => !(item in dataMap) && !uncachedCheckedKeys.includes(item)) : [];
  53611. const checkedKeys = cachedKeys.concat(uncachedCheckedKeys);
  53612. if (props.checkStrictly) {
  53613. emit(UPDATE_MODEL_EVENT, props.multiple ? checkedKeys : checkedKeys.includes(dataValue) ? dataValue : void 0);
  53614. } else {
  53615. if (props.multiple) {
  53616. const childKeys = getChildCheckedKeys();
  53617. emit(UPDATE_MODEL_EVENT, cachedKeys.concat(childKeys));
  53618. } else {
  53619. const firstLeaf = treeFind([data], (data2) => !isValidArray(getNodeValByProp("children", data2)) && !getNodeValByProp("disabled", data2), (data2) => getNodeValByProp("children", data2));
  53620. const firstLeafKey = firstLeaf ? getNodeValByProp("value", firstLeaf) : void 0;
  53621. const hasCheckedChild = isValidValue(props.modelValue) && !!treeFind([data], (data2) => getNodeValByProp("value", data2) === props.modelValue, (data2) => getNodeValByProp("children", data2));
  53622. emit(UPDATE_MODEL_EVENT, firstLeafKey === props.modelValue || hasCheckedChild ? void 0 : firstLeafKey);
  53623. }
  53624. }
  53625. nextTick(() => {
  53626. var _a2;
  53627. const checkedKeys2 = toValidArray(props.modelValue);
  53628. tree.value.setCheckedKeys(checkedKeys2);
  53629. (_a2 = attrs.onCheck) == null ? void 0 : _a2.call(attrs, data, {
  53630. checkedKeys: tree.value.getCheckedKeys(),
  53631. checkedNodes: tree.value.getCheckedNodes(),
  53632. halfCheckedKeys: tree.value.getHalfCheckedKeys(),
  53633. halfCheckedNodes: tree.value.getHalfCheckedNodes()
  53634. });
  53635. });
  53636. (_a = select.value) == null ? void 0 : _a.focus();
  53637. },
  53638. onNodeExpand: (data, node, e) => {
  53639. var _a;
  53640. (_a = attrs.onNodeExpand) == null ? void 0 : _a.call(attrs, data, node, e);
  53641. nextTick(() => {
  53642. if (!props.checkStrictly && props.lazy && props.multiple && node.checked) {
  53643. const dataMap = {};
  53644. const uncachedCheckedKeys = tree.value.getCheckedKeys();
  53645. treeEach([tree.value.store.root], (node2) => dataMap[node2.key] = node2, (node2) => node2.childNodes);
  53646. const cachedKeys = toValidArray(props.modelValue).filter((item) => !(item in dataMap) && !uncachedCheckedKeys.includes(item));
  53647. const childKeys = getChildCheckedKeys();
  53648. emit(UPDATE_MODEL_EVENT, cachedKeys.concat(childKeys));
  53649. }
  53650. });
  53651. },
  53652. cacheOptions
  53653. };
  53654. };
  53655. var CacheOptions = defineComponent({
  53656. props: {
  53657. data: {
  53658. type: Array,
  53659. default: () => []
  53660. }
  53661. },
  53662. setup(props) {
  53663. const select = inject(selectKey);
  53664. watch(() => props.data, () => {
  53665. var _a;
  53666. props.data.forEach((item) => {
  53667. if (!select.states.cachedOptions.has(item.value)) {
  53668. select.states.cachedOptions.set(item.value, item);
  53669. }
  53670. });
  53671. const inputs = ((_a = select.selectRef) == null ? void 0 : _a.querySelectorAll("input")) || [];
  53672. if (isClient && !Array.from(inputs).includes(document.activeElement)) {
  53673. select.setSelected();
  53674. }
  53675. }, { flush: "post", immediate: true });
  53676. return () => void 0;
  53677. }
  53678. });
  53679. const _sfc_main$j = defineComponent({
  53680. name: "ElTreeSelect",
  53681. inheritAttrs: false,
  53682. props: {
  53683. ...ElSelect.props,
  53684. ...ElTree.props,
  53685. cacheData: {
  53686. type: Array,
  53687. default: () => []
  53688. }
  53689. },
  53690. setup(props, context) {
  53691. const { slots, expose } = context;
  53692. const select = ref();
  53693. const tree = ref();
  53694. const key = computed(() => props.nodeKey || props.valueKey || "value");
  53695. const selectProps = useSelect(props, context, { select, tree, key });
  53696. const { cacheOptions, ...treeProps } = useTree$1(props, context, {
  53697. select,
  53698. tree,
  53699. key
  53700. });
  53701. const methods = reactive({});
  53702. expose(methods);
  53703. onMounted(() => {
  53704. Object.assign(methods, {
  53705. ...pick(tree.value, [
  53706. "filter",
  53707. "updateKeyChildren",
  53708. "getCheckedNodes",
  53709. "setCheckedNodes",
  53710. "getCheckedKeys",
  53711. "setCheckedKeys",
  53712. "setChecked",
  53713. "getHalfCheckedNodes",
  53714. "getHalfCheckedKeys",
  53715. "getCurrentKey",
  53716. "getCurrentNode",
  53717. "setCurrentKey",
  53718. "setCurrentNode",
  53719. "getNode",
  53720. "remove",
  53721. "append",
  53722. "insertBefore",
  53723. "insertAfter"
  53724. ]),
  53725. ...pick(select.value, ["focus", "blur", "selectedLabel"])
  53726. });
  53727. });
  53728. return () => h$1(ElSelect, reactive({
  53729. ...selectProps,
  53730. ref: (ref2) => select.value = ref2
  53731. }), {
  53732. ...slots,
  53733. default: () => [
  53734. h$1(CacheOptions, { data: cacheOptions.value }),
  53735. h$1(ElTree, reactive({
  53736. ...treeProps,
  53737. ref: (ref2) => tree.value = ref2
  53738. }))
  53739. ]
  53740. });
  53741. }
  53742. });
  53743. var TreeSelect = /* @__PURE__ */ _export_sfc(_sfc_main$j, [["__file", "tree-select.vue"]]);
  53744. const ElTreeSelect = withInstall(TreeSelect);
  53745. const ROOT_TREE_INJECTION_KEY = Symbol();
  53746. const EMPTY_NODE = {
  53747. key: -1,
  53748. level: -1,
  53749. data: {}
  53750. };
  53751. var TreeOptionsEnum = /* @__PURE__ */ ((TreeOptionsEnum2) => {
  53752. TreeOptionsEnum2["KEY"] = "id";
  53753. TreeOptionsEnum2["LABEL"] = "label";
  53754. TreeOptionsEnum2["CHILDREN"] = "children";
  53755. TreeOptionsEnum2["DISABLED"] = "disabled";
  53756. TreeOptionsEnum2["CLASS"] = "";
  53757. return TreeOptionsEnum2;
  53758. })(TreeOptionsEnum || {});
  53759. var SetOperationEnum = /* @__PURE__ */ ((SetOperationEnum2) => {
  53760. SetOperationEnum2["ADD"] = "add";
  53761. SetOperationEnum2["DELETE"] = "delete";
  53762. return SetOperationEnum2;
  53763. })(SetOperationEnum || {});
  53764. const itemSize = {
  53765. type: Number,
  53766. default: 26
  53767. };
  53768. const treeProps = buildProps({
  53769. data: {
  53770. type: definePropType(Array),
  53771. default: () => mutable([])
  53772. },
  53773. emptyText: {
  53774. type: String
  53775. },
  53776. height: {
  53777. type: Number,
  53778. default: 200
  53779. },
  53780. props: {
  53781. type: definePropType(Object),
  53782. default: () => mutable({
  53783. children: "children" /* CHILDREN */,
  53784. label: "label" /* LABEL */,
  53785. disabled: "disabled" /* DISABLED */,
  53786. value: "id" /* KEY */,
  53787. class: "" /* CLASS */
  53788. })
  53789. },
  53790. highlightCurrent: {
  53791. type: Boolean,
  53792. default: false
  53793. },
  53794. showCheckbox: {
  53795. type: Boolean,
  53796. default: false
  53797. },
  53798. defaultCheckedKeys: {
  53799. type: definePropType(Array),
  53800. default: () => mutable([])
  53801. },
  53802. checkStrictly: {
  53803. type: Boolean,
  53804. default: false
  53805. },
  53806. defaultExpandedKeys: {
  53807. type: definePropType(Array),
  53808. default: () => mutable([])
  53809. },
  53810. indent: {
  53811. type: Number,
  53812. default: 16
  53813. },
  53814. itemSize,
  53815. icon: {
  53816. type: iconPropType
  53817. },
  53818. expandOnClickNode: {
  53819. type: Boolean,
  53820. default: true
  53821. },
  53822. checkOnClickNode: {
  53823. type: Boolean,
  53824. default: false
  53825. },
  53826. checkOnClickLeaf: {
  53827. type: Boolean,
  53828. default: true
  53829. },
  53830. currentNodeKey: {
  53831. type: definePropType([String, Number])
  53832. },
  53833. accordion: {
  53834. type: Boolean,
  53835. default: false
  53836. },
  53837. filterMethod: {
  53838. type: definePropType(Function)
  53839. },
  53840. perfMode: {
  53841. type: Boolean,
  53842. default: true
  53843. }
  53844. });
  53845. const treeNodeProps = buildProps({
  53846. node: {
  53847. type: definePropType(Object),
  53848. default: () => mutable(EMPTY_NODE)
  53849. },
  53850. expanded: {
  53851. type: Boolean,
  53852. default: false
  53853. },
  53854. checked: {
  53855. type: Boolean,
  53856. default: false
  53857. },
  53858. indeterminate: {
  53859. type: Boolean,
  53860. default: false
  53861. },
  53862. showCheckbox: {
  53863. type: Boolean,
  53864. default: false
  53865. },
  53866. disabled: {
  53867. type: Boolean,
  53868. default: false
  53869. },
  53870. current: {
  53871. type: Boolean,
  53872. default: false
  53873. },
  53874. hiddenExpandIcon: {
  53875. type: Boolean,
  53876. default: false
  53877. },
  53878. itemSize
  53879. });
  53880. const treeNodeContentProps = buildProps({
  53881. node: {
  53882. type: definePropType(Object),
  53883. required: true
  53884. }
  53885. });
  53886. const NODE_CLICK = "node-click";
  53887. const NODE_DROP = "node-drop";
  53888. const NODE_EXPAND = "node-expand";
  53889. const NODE_COLLAPSE = "node-collapse";
  53890. const CURRENT_CHANGE = "current-change";
  53891. const NODE_CHECK = "check";
  53892. const NODE_CHECK_CHANGE = "check-change";
  53893. const NODE_CONTEXTMENU = "node-contextmenu";
  53894. const treeEmits = {
  53895. [NODE_CLICK]: (data, node, e) => data && node && e,
  53896. [NODE_DROP]: (data, node, e) => data && node && e,
  53897. [NODE_EXPAND]: (data, node) => data && node,
  53898. [NODE_COLLAPSE]: (data, node) => data && node,
  53899. [CURRENT_CHANGE]: (data, node) => data && node,
  53900. [NODE_CHECK]: (data, checkedInfo) => data && checkedInfo,
  53901. [NODE_CHECK_CHANGE]: (data, checked) => data && isBoolean(checked),
  53902. [NODE_CONTEXTMENU]: (evt, data, node) => evt && data && node
  53903. };
  53904. const treeNodeEmits = {
  53905. click: (node, e) => !!(node && e),
  53906. drop: (node, e) => !!(node && e),
  53907. toggle: (node) => !!node,
  53908. check: (node, checked) => node && isBoolean(checked)
  53909. };
  53910. function useCheck(props, tree) {
  53911. const checkedKeys = ref(/* @__PURE__ */ new Set());
  53912. const indeterminateKeys = ref(/* @__PURE__ */ new Set());
  53913. const { emit } = getCurrentInstance();
  53914. watch([() => tree.value, () => props.defaultCheckedKeys], () => {
  53915. return nextTick(() => {
  53916. _setCheckedKeys(props.defaultCheckedKeys);
  53917. });
  53918. }, {
  53919. immediate: true
  53920. });
  53921. const updateCheckedKeys = () => {
  53922. if (!tree.value || !props.showCheckbox || props.checkStrictly) {
  53923. return;
  53924. }
  53925. const { levelTreeNodeMap, maxLevel } = tree.value;
  53926. const checkedKeySet = checkedKeys.value;
  53927. const indeterminateKeySet = /* @__PURE__ */ new Set();
  53928. for (let level = maxLevel - 1; level >= 1; --level) {
  53929. const nodes = levelTreeNodeMap.get(level);
  53930. if (!nodes)
  53931. continue;
  53932. nodes.forEach((node) => {
  53933. const children = node.children;
  53934. if (children) {
  53935. let allChecked = true;
  53936. let hasChecked = false;
  53937. for (const childNode of children) {
  53938. const key = childNode.key;
  53939. if (checkedKeySet.has(key)) {
  53940. hasChecked = true;
  53941. } else if (indeterminateKeySet.has(key)) {
  53942. allChecked = false;
  53943. hasChecked = true;
  53944. break;
  53945. } else {
  53946. allChecked = false;
  53947. }
  53948. }
  53949. if (allChecked) {
  53950. checkedKeySet.add(node.key);
  53951. } else if (hasChecked) {
  53952. indeterminateKeySet.add(node.key);
  53953. checkedKeySet.delete(node.key);
  53954. } else {
  53955. checkedKeySet.delete(node.key);
  53956. indeterminateKeySet.delete(node.key);
  53957. }
  53958. }
  53959. });
  53960. }
  53961. indeterminateKeys.value = indeterminateKeySet;
  53962. };
  53963. const isChecked = (node) => checkedKeys.value.has(node.key);
  53964. const isIndeterminate = (node) => indeterminateKeys.value.has(node.key);
  53965. const toggleCheckbox = (node, isChecked2, nodeClick = true, immediateUpdate = true) => {
  53966. const checkedKeySet = checkedKeys.value;
  53967. const toggle = (node2, checked) => {
  53968. checkedKeySet[checked ? SetOperationEnum.ADD : SetOperationEnum.DELETE](node2.key);
  53969. const children = node2.children;
  53970. if (!props.checkStrictly && children) {
  53971. children.forEach((childNode) => {
  53972. if (!childNode.disabled) {
  53973. toggle(childNode, checked);
  53974. }
  53975. });
  53976. }
  53977. };
  53978. toggle(node, isChecked2);
  53979. if (immediateUpdate) {
  53980. updateCheckedKeys();
  53981. }
  53982. if (nodeClick) {
  53983. afterNodeCheck(node, isChecked2);
  53984. }
  53985. };
  53986. const afterNodeCheck = (node, checked) => {
  53987. const { checkedNodes, checkedKeys: checkedKeys2 } = getChecked();
  53988. const { halfCheckedNodes, halfCheckedKeys } = getHalfChecked();
  53989. emit(NODE_CHECK, node.data, {
  53990. checkedKeys: checkedKeys2,
  53991. checkedNodes,
  53992. halfCheckedKeys,
  53993. halfCheckedNodes
  53994. });
  53995. emit(NODE_CHECK_CHANGE, node.data, checked);
  53996. };
  53997. function getCheckedKeys(leafOnly = false) {
  53998. return getChecked(leafOnly).checkedKeys;
  53999. }
  54000. function getCheckedNodes(leafOnly = false) {
  54001. return getChecked(leafOnly).checkedNodes;
  54002. }
  54003. function getHalfCheckedKeys() {
  54004. return getHalfChecked().halfCheckedKeys;
  54005. }
  54006. function getHalfCheckedNodes() {
  54007. return getHalfChecked().halfCheckedNodes;
  54008. }
  54009. function getChecked(leafOnly = false) {
  54010. const checkedNodes = [];
  54011. const keys = [];
  54012. if ((tree == null ? void 0 : tree.value) && props.showCheckbox) {
  54013. const { treeNodeMap } = tree.value;
  54014. checkedKeys.value.forEach((key) => {
  54015. const node = treeNodeMap.get(key);
  54016. if (node && (!leafOnly || leafOnly && node.isLeaf)) {
  54017. keys.push(key);
  54018. checkedNodes.push(node.data);
  54019. }
  54020. });
  54021. }
  54022. return {
  54023. checkedKeys: keys,
  54024. checkedNodes
  54025. };
  54026. }
  54027. function getHalfChecked() {
  54028. const halfCheckedNodes = [];
  54029. const halfCheckedKeys = [];
  54030. if ((tree == null ? void 0 : tree.value) && props.showCheckbox) {
  54031. const { treeNodeMap } = tree.value;
  54032. indeterminateKeys.value.forEach((key) => {
  54033. const node = treeNodeMap.get(key);
  54034. if (node) {
  54035. halfCheckedKeys.push(key);
  54036. halfCheckedNodes.push(node.data);
  54037. }
  54038. });
  54039. }
  54040. return {
  54041. halfCheckedNodes,
  54042. halfCheckedKeys
  54043. };
  54044. }
  54045. function setCheckedKeys(keys) {
  54046. checkedKeys.value.clear();
  54047. indeterminateKeys.value.clear();
  54048. nextTick(() => {
  54049. _setCheckedKeys(keys);
  54050. });
  54051. }
  54052. function setChecked(key, isChecked2) {
  54053. if ((tree == null ? void 0 : tree.value) && props.showCheckbox) {
  54054. const node = tree.value.treeNodeMap.get(key);
  54055. if (node) {
  54056. toggleCheckbox(node, isChecked2, false);
  54057. }
  54058. }
  54059. }
  54060. function _setCheckedKeys(keys) {
  54061. if (tree == null ? void 0 : tree.value) {
  54062. const { treeNodeMap } = tree.value;
  54063. if (props.showCheckbox && treeNodeMap && (keys == null ? void 0 : keys.length) > 0) {
  54064. for (const key of keys) {
  54065. const node = treeNodeMap.get(key);
  54066. if (node && !isChecked(node)) {
  54067. toggleCheckbox(node, true, false, false);
  54068. }
  54069. }
  54070. updateCheckedKeys();
  54071. }
  54072. }
  54073. }
  54074. return {
  54075. updateCheckedKeys,
  54076. toggleCheckbox,
  54077. isChecked,
  54078. isIndeterminate,
  54079. getCheckedKeys,
  54080. getCheckedNodes,
  54081. getHalfCheckedKeys,
  54082. getHalfCheckedNodes,
  54083. setChecked,
  54084. setCheckedKeys
  54085. };
  54086. }
  54087. function useFilter(props, tree) {
  54088. const hiddenNodeKeySet = ref(/* @__PURE__ */ new Set([]));
  54089. const hiddenExpandIconKeySet = ref(/* @__PURE__ */ new Set([]));
  54090. const filterable = computed(() => {
  54091. return isFunction$1(props.filterMethod);
  54092. });
  54093. function doFilter(query) {
  54094. var _a;
  54095. if (!filterable.value) {
  54096. return;
  54097. }
  54098. const expandKeySet = /* @__PURE__ */ new Set();
  54099. const hiddenExpandIconKeys = hiddenExpandIconKeySet.value;
  54100. const hiddenKeys = hiddenNodeKeySet.value;
  54101. const family = [];
  54102. const nodes = ((_a = tree.value) == null ? void 0 : _a.treeNodes) || [];
  54103. const filter = props.filterMethod;
  54104. hiddenKeys.clear();
  54105. function traverse(nodes2) {
  54106. nodes2.forEach((node) => {
  54107. family.push(node);
  54108. if (filter == null ? void 0 : filter(query, node.data, node)) {
  54109. family.forEach((member) => {
  54110. expandKeySet.add(member.key);
  54111. });
  54112. } else if (node.isLeaf) {
  54113. hiddenKeys.add(node.key);
  54114. }
  54115. const children = node.children;
  54116. if (children) {
  54117. traverse(children);
  54118. }
  54119. if (!node.isLeaf) {
  54120. if (!expandKeySet.has(node.key)) {
  54121. hiddenKeys.add(node.key);
  54122. } else if (children) {
  54123. let allHidden = true;
  54124. for (const childNode of children) {
  54125. if (!hiddenKeys.has(childNode.key)) {
  54126. allHidden = false;
  54127. break;
  54128. }
  54129. }
  54130. if (allHidden) {
  54131. hiddenExpandIconKeys.add(node.key);
  54132. } else {
  54133. hiddenExpandIconKeys.delete(node.key);
  54134. }
  54135. }
  54136. }
  54137. family.pop();
  54138. });
  54139. }
  54140. traverse(nodes);
  54141. return expandKeySet;
  54142. }
  54143. function isForceHiddenExpandIcon(node) {
  54144. return hiddenExpandIconKeySet.value.has(node.key);
  54145. }
  54146. return {
  54147. hiddenExpandIconKeySet,
  54148. hiddenNodeKeySet,
  54149. doFilter,
  54150. isForceHiddenExpandIcon
  54151. };
  54152. }
  54153. function useTree(props, emit) {
  54154. const expandedKeySet = ref(new Set(props.defaultExpandedKeys));
  54155. const currentKey = ref();
  54156. const tree = shallowRef();
  54157. const listRef = ref();
  54158. watch(() => props.currentNodeKey, (key) => {
  54159. currentKey.value = key;
  54160. }, {
  54161. immediate: true
  54162. });
  54163. watch(() => props.data, (data) => {
  54164. setData(data);
  54165. }, {
  54166. immediate: true
  54167. });
  54168. const {
  54169. isIndeterminate,
  54170. isChecked,
  54171. toggleCheckbox,
  54172. getCheckedKeys,
  54173. getCheckedNodes,
  54174. getHalfCheckedKeys,
  54175. getHalfCheckedNodes,
  54176. setChecked,
  54177. setCheckedKeys
  54178. } = useCheck(props, tree);
  54179. const { doFilter, hiddenNodeKeySet, isForceHiddenExpandIcon } = useFilter(props, tree);
  54180. const valueKey = computed(() => {
  54181. var _a;
  54182. return ((_a = props.props) == null ? void 0 : _a.value) || TreeOptionsEnum.KEY;
  54183. });
  54184. const childrenKey = computed(() => {
  54185. var _a;
  54186. return ((_a = props.props) == null ? void 0 : _a.children) || TreeOptionsEnum.CHILDREN;
  54187. });
  54188. const disabledKey = computed(() => {
  54189. var _a;
  54190. return ((_a = props.props) == null ? void 0 : _a.disabled) || TreeOptionsEnum.DISABLED;
  54191. });
  54192. const labelKey = computed(() => {
  54193. var _a;
  54194. return ((_a = props.props) == null ? void 0 : _a.label) || TreeOptionsEnum.LABEL;
  54195. });
  54196. const flattenTree = computed(() => {
  54197. var _a;
  54198. const expandedKeys = expandedKeySet.value;
  54199. const hiddenKeys = hiddenNodeKeySet.value;
  54200. const flattenNodes = [];
  54201. const nodes = ((_a = tree.value) == null ? void 0 : _a.treeNodes) || [];
  54202. const stack = [];
  54203. for (let i = nodes.length - 1; i >= 0; --i) {
  54204. stack.push(nodes[i]);
  54205. }
  54206. while (stack.length) {
  54207. const node = stack.pop();
  54208. if (hiddenKeys.has(node.key))
  54209. continue;
  54210. flattenNodes.push(node);
  54211. if (node.children && expandedKeys.has(node.key)) {
  54212. for (let i = node.children.length - 1; i >= 0; --i) {
  54213. stack.push(node.children[i]);
  54214. }
  54215. }
  54216. }
  54217. return flattenNodes;
  54218. });
  54219. const isNotEmpty = computed(() => {
  54220. return flattenTree.value.length > 0;
  54221. });
  54222. function createTree(data) {
  54223. const treeNodeMap = /* @__PURE__ */ new Map();
  54224. const levelTreeNodeMap = /* @__PURE__ */ new Map();
  54225. let maxLevel = 1;
  54226. function traverse(nodes, level = 1, parent = void 0) {
  54227. var _a;
  54228. const siblings = [];
  54229. for (const rawNode of nodes) {
  54230. const value = getKey(rawNode);
  54231. const node = {
  54232. level,
  54233. key: value,
  54234. data: rawNode
  54235. };
  54236. node.label = getLabel(rawNode);
  54237. node.parent = parent;
  54238. const children = getChildren(rawNode);
  54239. node.disabled = getDisabled(rawNode);
  54240. node.isLeaf = !children || children.length === 0;
  54241. if (children && children.length) {
  54242. node.children = traverse(children, level + 1, node);
  54243. }
  54244. siblings.push(node);
  54245. treeNodeMap.set(value, node);
  54246. if (!levelTreeNodeMap.has(level)) {
  54247. levelTreeNodeMap.set(level, []);
  54248. }
  54249. (_a = levelTreeNodeMap.get(level)) == null ? void 0 : _a.push(node);
  54250. }
  54251. if (level > maxLevel) {
  54252. maxLevel = level;
  54253. }
  54254. return siblings;
  54255. }
  54256. const treeNodes = traverse(data);
  54257. return {
  54258. treeNodeMap,
  54259. levelTreeNodeMap,
  54260. maxLevel,
  54261. treeNodes
  54262. };
  54263. }
  54264. function filter(query) {
  54265. const keys = doFilter(query);
  54266. if (keys) {
  54267. expandedKeySet.value = keys;
  54268. }
  54269. }
  54270. function getChildren(node) {
  54271. return node[childrenKey.value];
  54272. }
  54273. function getKey(node) {
  54274. if (!node) {
  54275. return "";
  54276. }
  54277. return node[valueKey.value];
  54278. }
  54279. function getDisabled(node) {
  54280. return node[disabledKey.value];
  54281. }
  54282. function getLabel(node) {
  54283. return node[labelKey.value];
  54284. }
  54285. function toggleExpand(node) {
  54286. const expandedKeys = expandedKeySet.value;
  54287. if (expandedKeys.has(node.key)) {
  54288. collapseNode(node);
  54289. } else {
  54290. expandNode(node);
  54291. }
  54292. }
  54293. function setExpandedKeys(keys) {
  54294. const expandedKeys = /* @__PURE__ */ new Set();
  54295. const nodeMap = tree.value.treeNodeMap;
  54296. keys.forEach((k) => {
  54297. let node = nodeMap.get(k);
  54298. while (node && !expandedKeys.has(node.key)) {
  54299. expandedKeys.add(node.key);
  54300. node = node.parent;
  54301. }
  54302. });
  54303. expandedKeySet.value = expandedKeys;
  54304. }
  54305. function handleNodeClick(node, e) {
  54306. emit(NODE_CLICK, node.data, node, e);
  54307. handleCurrentChange(node);
  54308. if (props.expandOnClickNode) {
  54309. toggleExpand(node);
  54310. }
  54311. if (props.showCheckbox && (props.checkOnClickNode || node.isLeaf && props.checkOnClickLeaf) && !node.disabled) {
  54312. toggleCheckbox(node, !isChecked(node), true);
  54313. }
  54314. }
  54315. function handleNodeDrop(node, e) {
  54316. emit(NODE_DROP, node.data, node, e);
  54317. }
  54318. function handleCurrentChange(node) {
  54319. if (!isCurrent(node)) {
  54320. currentKey.value = node.key;
  54321. emit(CURRENT_CHANGE, node.data, node);
  54322. }
  54323. }
  54324. function handleNodeCheck(node, checked) {
  54325. toggleCheckbox(node, checked);
  54326. }
  54327. function expandNode(node) {
  54328. const keySet = expandedKeySet.value;
  54329. if (tree.value && props.accordion) {
  54330. const { treeNodeMap } = tree.value;
  54331. keySet.forEach((key) => {
  54332. const treeNode = treeNodeMap.get(key);
  54333. if (node && node.level === (treeNode == null ? void 0 : treeNode.level)) {
  54334. keySet.delete(key);
  54335. }
  54336. });
  54337. }
  54338. keySet.add(node.key);
  54339. emit(NODE_EXPAND, node.data, node);
  54340. }
  54341. function collapseNode(node) {
  54342. expandedKeySet.value.delete(node.key);
  54343. emit(NODE_COLLAPSE, node.data, node);
  54344. }
  54345. function isExpanded(node) {
  54346. return expandedKeySet.value.has(node.key);
  54347. }
  54348. function isDisabled(node) {
  54349. return !!node.disabled;
  54350. }
  54351. function isCurrent(node) {
  54352. const current = currentKey.value;
  54353. return current !== void 0 && current === node.key;
  54354. }
  54355. function getCurrentNode() {
  54356. var _a, _b;
  54357. if (!currentKey.value)
  54358. return void 0;
  54359. return (_b = (_a = tree.value) == null ? void 0 : _a.treeNodeMap.get(currentKey.value)) == null ? void 0 : _b.data;
  54360. }
  54361. function getCurrentKey() {
  54362. return currentKey.value;
  54363. }
  54364. function setCurrentKey(key) {
  54365. currentKey.value = key;
  54366. }
  54367. function setData(data) {
  54368. nextTick(() => tree.value = createTree(data));
  54369. }
  54370. function getNode(data) {
  54371. var _a;
  54372. const key = isObject$1(data) ? getKey(data) : data;
  54373. return (_a = tree.value) == null ? void 0 : _a.treeNodeMap.get(key);
  54374. }
  54375. function scrollToNode(key, strategy = "auto") {
  54376. const node = getNode(key);
  54377. if (node && listRef.value) {
  54378. listRef.value.scrollToItem(flattenTree.value.indexOf(node), strategy);
  54379. }
  54380. }
  54381. function scrollTo(offset) {
  54382. var _a;
  54383. (_a = listRef.value) == null ? void 0 : _a.scrollTo(offset);
  54384. }
  54385. return {
  54386. tree,
  54387. flattenTree,
  54388. isNotEmpty,
  54389. listRef,
  54390. getKey,
  54391. getChildren,
  54392. toggleExpand,
  54393. toggleCheckbox,
  54394. isExpanded,
  54395. isChecked,
  54396. isIndeterminate,
  54397. isDisabled,
  54398. isCurrent,
  54399. isForceHiddenExpandIcon,
  54400. handleNodeClick,
  54401. handleNodeDrop,
  54402. handleNodeCheck,
  54403. getCurrentNode,
  54404. getCurrentKey,
  54405. setCurrentKey,
  54406. getCheckedKeys,
  54407. getCheckedNodes,
  54408. getHalfCheckedKeys,
  54409. getHalfCheckedNodes,
  54410. setChecked,
  54411. setCheckedKeys,
  54412. filter,
  54413. setData,
  54414. getNode,
  54415. expandNode,
  54416. collapseNode,
  54417. setExpandedKeys,
  54418. scrollToNode,
  54419. scrollTo
  54420. };
  54421. }
  54422. var ElNodeContent = defineComponent({
  54423. name: "ElTreeNodeContent",
  54424. props: treeNodeContentProps,
  54425. setup(props) {
  54426. const tree = inject(ROOT_TREE_INJECTION_KEY);
  54427. const ns = useNamespace("tree");
  54428. return () => {
  54429. const node = props.node;
  54430. const { data } = node;
  54431. return (tree == null ? void 0 : tree.ctx.slots.default) ? tree.ctx.slots.default({ node, data }) : h$1("span", { class: ns.be("node", "label") }, [node == null ? void 0 : node.label]);
  54432. };
  54433. }
  54434. });
  54435. const __default__$h = defineComponent({
  54436. name: "ElTreeNode"
  54437. });
  54438. const _sfc_main$i = /* @__PURE__ */ defineComponent({
  54439. ...__default__$h,
  54440. props: treeNodeProps,
  54441. emits: treeNodeEmits,
  54442. setup(__props, { emit }) {
  54443. const props = __props;
  54444. const tree = inject(ROOT_TREE_INJECTION_KEY);
  54445. const ns = useNamespace("tree");
  54446. const indent = computed(() => {
  54447. var _a;
  54448. return (_a = tree == null ? void 0 : tree.props.indent) != null ? _a : 16;
  54449. });
  54450. const icon = computed(() => {
  54451. var _a;
  54452. return (_a = tree == null ? void 0 : tree.props.icon) != null ? _a : caret_right_default;
  54453. });
  54454. const getNodeClass = (node) => {
  54455. const nodeClassFunc = tree == null ? void 0 : tree.props.props.class;
  54456. if (!nodeClassFunc)
  54457. return {};
  54458. let className;
  54459. if (isFunction$1(nodeClassFunc)) {
  54460. const { data } = node;
  54461. className = nodeClassFunc(data, node);
  54462. } else {
  54463. className = nodeClassFunc;
  54464. }
  54465. return isString$1(className) ? { [className]: true } : className;
  54466. };
  54467. const handleClick = (e) => {
  54468. emit("click", props.node, e);
  54469. };
  54470. const handleDrop = (e) => {
  54471. emit("drop", props.node, e);
  54472. };
  54473. const handleExpandIconClick = () => {
  54474. emit("toggle", props.node);
  54475. };
  54476. const handleCheckChange = (value) => {
  54477. emit("check", props.node, value);
  54478. };
  54479. const handleContextMenu = (event) => {
  54480. var _a, _b, _c, _d;
  54481. 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"]) {
  54482. event.stopPropagation();
  54483. event.preventDefault();
  54484. }
  54485. tree == null ? void 0 : tree.ctx.emit(NODE_CONTEXTMENU, event, (_d = props.node) == null ? void 0 : _d.data, props.node);
  54486. };
  54487. return (_ctx, _cache) => {
  54488. var _a, _b, _c;
  54489. return openBlock(), createElementBlock("div", {
  54490. ref: "node$",
  54491. class: normalizeClass([
  54492. unref(ns).b("node"),
  54493. unref(ns).is("expanded", _ctx.expanded),
  54494. unref(ns).is("current", _ctx.current),
  54495. unref(ns).is("focusable", !_ctx.disabled),
  54496. unref(ns).is("checked", !_ctx.disabled && _ctx.checked),
  54497. getNodeClass(_ctx.node)
  54498. ]),
  54499. role: "treeitem",
  54500. tabindex: "-1",
  54501. "aria-expanded": _ctx.expanded,
  54502. "aria-disabled": _ctx.disabled,
  54503. "aria-checked": _ctx.checked,
  54504. "data-key": (_a = _ctx.node) == null ? void 0 : _a.key,
  54505. onClick: withModifiers(handleClick, ["stop"]),
  54506. onContextmenu: handleContextMenu,
  54507. onDragover: withModifiers(() => {
  54508. }, ["prevent"]),
  54509. onDragenter: withModifiers(() => {
  54510. }, ["prevent"]),
  54511. onDrop: withModifiers(handleDrop, ["stop"])
  54512. }, [
  54513. createElementVNode("div", {
  54514. class: normalizeClass(unref(ns).be("node", "content")),
  54515. style: normalizeStyle({
  54516. paddingLeft: `${(_ctx.node.level - 1) * unref(indent)}px`,
  54517. height: _ctx.itemSize + "px"
  54518. })
  54519. }, [
  54520. unref(icon) ? (openBlock(), createBlock(unref(ElIcon), {
  54521. key: 0,
  54522. class: normalizeClass([
  54523. unref(ns).is("leaf", !!((_b = _ctx.node) == null ? void 0 : _b.isLeaf)),
  54524. unref(ns).is("hidden", _ctx.hiddenExpandIcon),
  54525. {
  54526. expanded: !((_c = _ctx.node) == null ? void 0 : _c.isLeaf) && _ctx.expanded
  54527. },
  54528. unref(ns).be("node", "expand-icon")
  54529. ]),
  54530. onClick: withModifiers(handleExpandIconClick, ["stop"])
  54531. }, {
  54532. default: withCtx(() => [
  54533. (openBlock(), createBlock(resolveDynamicComponent(unref(icon))))
  54534. ]),
  54535. _: 1
  54536. }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true),
  54537. _ctx.showCheckbox ? (openBlock(), createBlock(unref(ElCheckbox), {
  54538. key: 1,
  54539. "model-value": _ctx.checked,
  54540. indeterminate: _ctx.indeterminate,
  54541. disabled: _ctx.disabled,
  54542. onChange: handleCheckChange,
  54543. onClick: withModifiers(() => {
  54544. }, ["stop"])
  54545. }, null, 8, ["model-value", "indeterminate", "disabled", "onClick"])) : createCommentVNode("v-if", true),
  54546. createVNode(unref(ElNodeContent), { node: _ctx.node }, null, 8, ["node"])
  54547. ], 6)
  54548. ], 42, ["aria-expanded", "aria-disabled", "aria-checked", "data-key", "onClick", "onDragover", "onDragenter", "onDrop"]);
  54549. };
  54550. }
  54551. });
  54552. var ElTreeNode = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["__file", "tree-node.vue"]]);
  54553. const __default__$g = defineComponent({
  54554. name: "ElTreeV2"
  54555. });
  54556. const _sfc_main$h = /* @__PURE__ */ defineComponent({
  54557. ...__default__$g,
  54558. props: treeProps,
  54559. emits: treeEmits,
  54560. setup(__props, { expose, emit }) {
  54561. const props = __props;
  54562. const slots = useSlots();
  54563. const treeNodeSize = computed(() => props.itemSize);
  54564. provide(ROOT_TREE_INJECTION_KEY, {
  54565. ctx: {
  54566. emit,
  54567. slots
  54568. },
  54569. props,
  54570. instance: getCurrentInstance()
  54571. });
  54572. provide(formItemContextKey, void 0);
  54573. const { t } = useLocale();
  54574. const ns = useNamespace("tree");
  54575. const {
  54576. flattenTree,
  54577. isNotEmpty,
  54578. listRef,
  54579. toggleExpand,
  54580. isExpanded,
  54581. isIndeterminate,
  54582. isChecked,
  54583. isDisabled,
  54584. isCurrent,
  54585. isForceHiddenExpandIcon,
  54586. handleNodeClick,
  54587. handleNodeDrop,
  54588. handleNodeCheck,
  54589. toggleCheckbox,
  54590. getCurrentNode,
  54591. getCurrentKey,
  54592. setCurrentKey,
  54593. getCheckedKeys,
  54594. getCheckedNodes,
  54595. getHalfCheckedKeys,
  54596. getHalfCheckedNodes,
  54597. setChecked,
  54598. setCheckedKeys,
  54599. filter,
  54600. setData,
  54601. getNode,
  54602. expandNode,
  54603. collapseNode,
  54604. setExpandedKeys,
  54605. scrollToNode,
  54606. scrollTo
  54607. } = useTree(props, emit);
  54608. expose({
  54609. toggleCheckbox,
  54610. getCurrentNode,
  54611. getCurrentKey,
  54612. setCurrentKey,
  54613. getCheckedKeys,
  54614. getCheckedNodes,
  54615. getHalfCheckedKeys,
  54616. getHalfCheckedNodes,
  54617. setChecked,
  54618. setCheckedKeys,
  54619. filter,
  54620. setData,
  54621. getNode,
  54622. expandNode,
  54623. collapseNode,
  54624. setExpandedKeys,
  54625. scrollToNode,
  54626. scrollTo
  54627. });
  54628. return (_ctx, _cache) => {
  54629. return openBlock(), createElementBlock("div", {
  54630. class: normalizeClass([unref(ns).b(), { [unref(ns).m("highlight-current")]: _ctx.highlightCurrent }]),
  54631. role: "tree"
  54632. }, [
  54633. unref(isNotEmpty) ? (openBlock(), createBlock(unref(FixedSizeList$1), {
  54634. key: 0,
  54635. ref_key: "listRef",
  54636. ref: listRef,
  54637. "class-name": unref(ns).b("virtual-list"),
  54638. data: unref(flattenTree),
  54639. total: unref(flattenTree).length,
  54640. height: _ctx.height,
  54641. "item-size": unref(treeNodeSize),
  54642. "perf-mode": _ctx.perfMode
  54643. }, {
  54644. default: withCtx(({ data, index, style }) => [
  54645. (openBlock(), createBlock(ElTreeNode, {
  54646. key: data[index].key,
  54647. style: normalizeStyle(style),
  54648. node: data[index],
  54649. expanded: unref(isExpanded)(data[index]),
  54650. "show-checkbox": _ctx.showCheckbox,
  54651. checked: unref(isChecked)(data[index]),
  54652. indeterminate: unref(isIndeterminate)(data[index]),
  54653. "item-size": unref(treeNodeSize),
  54654. disabled: unref(isDisabled)(data[index]),
  54655. current: unref(isCurrent)(data[index]),
  54656. "hidden-expand-icon": unref(isForceHiddenExpandIcon)(data[index]),
  54657. onClick: unref(handleNodeClick),
  54658. onToggle: unref(toggleExpand),
  54659. onCheck: unref(handleNodeCheck),
  54660. onDrop: unref(handleNodeDrop)
  54661. }, null, 8, ["style", "node", "expanded", "show-checkbox", "checked", "indeterminate", "item-size", "disabled", "current", "hidden-expand-icon", "onClick", "onToggle", "onCheck", "onDrop"]))
  54662. ]),
  54663. _: 1
  54664. }, 8, ["class-name", "data", "total", "height", "item-size", "perf-mode"])) : (openBlock(), createElementBlock("div", {
  54665. key: 1,
  54666. class: normalizeClass(unref(ns).e("empty-block"))
  54667. }, [
  54668. renderSlot(_ctx.$slots, "empty", {}, () => {
  54669. var _a;
  54670. return [
  54671. createElementVNode("span", {
  54672. class: normalizeClass(unref(ns).e("empty-text"))
  54673. }, toDisplayString((_a = _ctx.emptyText) != null ? _a : unref(t)("el.tree.emptyText")), 3)
  54674. ];
  54675. })
  54676. ], 2))
  54677. ], 2);
  54678. };
  54679. }
  54680. });
  54681. var TreeV2 = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["__file", "tree.vue"]]);
  54682. const ElTreeV2 = withInstall(TreeV2);
  54683. const uploadContextKey = Symbol("uploadContextKey");
  54684. const SCOPE$2 = "ElUpload";
  54685. class UploadAjaxError extends Error {
  54686. constructor(message, status, method, url) {
  54687. super(message);
  54688. this.name = "UploadAjaxError";
  54689. this.status = status;
  54690. this.method = method;
  54691. this.url = url;
  54692. }
  54693. }
  54694. function getError(action, option, xhr) {
  54695. let msg;
  54696. if (xhr.response) {
  54697. msg = `${xhr.response.error || xhr.response}`;
  54698. } else if (xhr.responseText) {
  54699. msg = `${xhr.responseText}`;
  54700. } else {
  54701. msg = `fail to ${option.method} ${action} ${xhr.status}`;
  54702. }
  54703. return new UploadAjaxError(msg, xhr.status, option.method, action);
  54704. }
  54705. function getBody(xhr) {
  54706. const text = xhr.responseText || xhr.response;
  54707. if (!text) {
  54708. return text;
  54709. }
  54710. try {
  54711. return JSON.parse(text);
  54712. } catch (e) {
  54713. return text;
  54714. }
  54715. }
  54716. const ajaxUpload = (option) => {
  54717. if (typeof XMLHttpRequest === "undefined")
  54718. throwError(SCOPE$2, "XMLHttpRequest is undefined");
  54719. const xhr = new XMLHttpRequest();
  54720. const action = option.action;
  54721. if (xhr.upload) {
  54722. xhr.upload.addEventListener("progress", (evt) => {
  54723. const progressEvt = evt;
  54724. progressEvt.percent = evt.total > 0 ? evt.loaded / evt.total * 100 : 0;
  54725. option.onProgress(progressEvt);
  54726. });
  54727. }
  54728. const formData = new FormData();
  54729. if (option.data) {
  54730. for (const [key, value] of Object.entries(option.data)) {
  54731. if (isArray$1(value) && value.length)
  54732. formData.append(key, ...value);
  54733. else
  54734. formData.append(key, value);
  54735. }
  54736. }
  54737. formData.append(option.filename, option.file, option.file.name);
  54738. xhr.addEventListener("error", () => {
  54739. option.onError(getError(action, option, xhr));
  54740. });
  54741. xhr.addEventListener("load", () => {
  54742. if (xhr.status < 200 || xhr.status >= 300) {
  54743. return option.onError(getError(action, option, xhr));
  54744. }
  54745. option.onSuccess(getBody(xhr));
  54746. });
  54747. xhr.open(option.method, action, true);
  54748. if (option.withCredentials && "withCredentials" in xhr) {
  54749. xhr.withCredentials = true;
  54750. }
  54751. const headers = option.headers || {};
  54752. if (headers instanceof Headers) {
  54753. headers.forEach((value, key) => xhr.setRequestHeader(key, value));
  54754. } else {
  54755. for (const [key, value] of Object.entries(headers)) {
  54756. if (isNil(value))
  54757. continue;
  54758. xhr.setRequestHeader(key, String(value));
  54759. }
  54760. }
  54761. xhr.send(formData);
  54762. return xhr;
  54763. };
  54764. const uploadListTypes = ["text", "picture", "picture-card"];
  54765. let fileId = 1;
  54766. const genFileId = () => Date.now() + fileId++;
  54767. const uploadBaseProps = buildProps({
  54768. action: {
  54769. type: String,
  54770. default: "#"
  54771. },
  54772. headers: {
  54773. type: definePropType(Object)
  54774. },
  54775. method: {
  54776. type: String,
  54777. default: "post"
  54778. },
  54779. data: {
  54780. type: definePropType([Object, Function, Promise]),
  54781. default: () => mutable({})
  54782. },
  54783. multiple: Boolean,
  54784. name: {
  54785. type: String,
  54786. default: "file"
  54787. },
  54788. drag: Boolean,
  54789. withCredentials: Boolean,
  54790. showFileList: {
  54791. type: Boolean,
  54792. default: true
  54793. },
  54794. accept: {
  54795. type: String,
  54796. default: ""
  54797. },
  54798. fileList: {
  54799. type: definePropType(Array),
  54800. default: () => mutable([])
  54801. },
  54802. autoUpload: {
  54803. type: Boolean,
  54804. default: true
  54805. },
  54806. listType: {
  54807. type: String,
  54808. values: uploadListTypes,
  54809. default: "text"
  54810. },
  54811. httpRequest: {
  54812. type: definePropType(Function),
  54813. default: ajaxUpload
  54814. },
  54815. disabled: Boolean,
  54816. limit: Number
  54817. });
  54818. const uploadProps = buildProps({
  54819. ...uploadBaseProps,
  54820. beforeUpload: {
  54821. type: definePropType(Function),
  54822. default: NOOP
  54823. },
  54824. beforeRemove: {
  54825. type: definePropType(Function)
  54826. },
  54827. onRemove: {
  54828. type: definePropType(Function),
  54829. default: NOOP
  54830. },
  54831. onChange: {
  54832. type: definePropType(Function),
  54833. default: NOOP
  54834. },
  54835. onPreview: {
  54836. type: definePropType(Function),
  54837. default: NOOP
  54838. },
  54839. onSuccess: {
  54840. type: definePropType(Function),
  54841. default: NOOP
  54842. },
  54843. onProgress: {
  54844. type: definePropType(Function),
  54845. default: NOOP
  54846. },
  54847. onError: {
  54848. type: definePropType(Function),
  54849. default: NOOP
  54850. },
  54851. onExceed: {
  54852. type: definePropType(Function),
  54853. default: NOOP
  54854. },
  54855. crossorigin: {
  54856. type: definePropType(String)
  54857. }
  54858. });
  54859. const uploadListProps = buildProps({
  54860. files: {
  54861. type: definePropType(Array),
  54862. default: () => mutable([])
  54863. },
  54864. disabled: {
  54865. type: Boolean,
  54866. default: false
  54867. },
  54868. handlePreview: {
  54869. type: definePropType(Function),
  54870. default: NOOP
  54871. },
  54872. listType: {
  54873. type: String,
  54874. values: uploadListTypes,
  54875. default: "text"
  54876. },
  54877. crossorigin: {
  54878. type: definePropType(String)
  54879. }
  54880. });
  54881. const uploadListEmits = {
  54882. remove: (file) => !!file
  54883. };
  54884. const __default__$f = defineComponent({
  54885. name: "ElUploadList"
  54886. });
  54887. const _sfc_main$g = /* @__PURE__ */ defineComponent({
  54888. ...__default__$f,
  54889. props: uploadListProps,
  54890. emits: uploadListEmits,
  54891. setup(__props, { emit }) {
  54892. const props = __props;
  54893. const { t } = useLocale();
  54894. const nsUpload = useNamespace("upload");
  54895. const nsIcon = useNamespace("icon");
  54896. const nsList = useNamespace("list");
  54897. const disabled = useFormDisabled();
  54898. const focusing = ref(false);
  54899. const containerKls = computed(() => [
  54900. nsUpload.b("list"),
  54901. nsUpload.bm("list", props.listType),
  54902. nsUpload.is("disabled", props.disabled)
  54903. ]);
  54904. const handleRemove = (file) => {
  54905. emit("remove", file);
  54906. };
  54907. return (_ctx, _cache) => {
  54908. return openBlock(), createBlock(TransitionGroup, {
  54909. tag: "ul",
  54910. class: normalizeClass(unref(containerKls)),
  54911. name: unref(nsList).b()
  54912. }, {
  54913. default: withCtx(() => [
  54914. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.files, (file, index) => {
  54915. return openBlock(), createElementBlock("li", {
  54916. key: file.uid || file.name,
  54917. class: normalizeClass([
  54918. unref(nsUpload).be("list", "item"),
  54919. unref(nsUpload).is(file.status),
  54920. { focusing: focusing.value }
  54921. ]),
  54922. tabindex: "0",
  54923. onKeydown: withKeys(($event) => !unref(disabled) && handleRemove(file), ["delete"]),
  54924. onFocus: ($event) => focusing.value = true,
  54925. onBlur: ($event) => focusing.value = false,
  54926. onClick: ($event) => focusing.value = false
  54927. }, [
  54928. renderSlot(_ctx.$slots, "default", {
  54929. file,
  54930. index
  54931. }, () => [
  54932. _ctx.listType === "picture" || file.status !== "uploading" && _ctx.listType === "picture-card" ? (openBlock(), createElementBlock("img", {
  54933. key: 0,
  54934. class: normalizeClass(unref(nsUpload).be("list", "item-thumbnail")),
  54935. src: file.url,
  54936. crossorigin: _ctx.crossorigin,
  54937. alt: ""
  54938. }, null, 10, ["src", "crossorigin"])) : createCommentVNode("v-if", true),
  54939. file.status === "uploading" || _ctx.listType !== "picture-card" ? (openBlock(), createElementBlock("div", {
  54940. key: 1,
  54941. class: normalizeClass(unref(nsUpload).be("list", "item-info"))
  54942. }, [
  54943. createElementVNode("a", {
  54944. class: normalizeClass(unref(nsUpload).be("list", "item-name")),
  54945. onClick: withModifiers(($event) => _ctx.handlePreview(file), ["prevent"])
  54946. }, [
  54947. createVNode(unref(ElIcon), {
  54948. class: normalizeClass(unref(nsIcon).m("document"))
  54949. }, {
  54950. default: withCtx(() => [
  54951. createVNode(unref(document_default))
  54952. ]),
  54953. _: 1
  54954. }, 8, ["class"]),
  54955. createElementVNode("span", {
  54956. class: normalizeClass(unref(nsUpload).be("list", "item-file-name")),
  54957. title: file.name
  54958. }, toDisplayString(file.name), 11, ["title"])
  54959. ], 10, ["onClick"]),
  54960. file.status === "uploading" ? (openBlock(), createBlock(unref(ElProgress), {
  54961. key: 0,
  54962. type: _ctx.listType === "picture-card" ? "circle" : "line",
  54963. "stroke-width": _ctx.listType === "picture-card" ? 6 : 2,
  54964. percentage: Number(file.percentage),
  54965. style: normalizeStyle(_ctx.listType === "picture-card" ? "" : "margin-top: 0.5rem")
  54966. }, null, 8, ["type", "stroke-width", "percentage", "style"])) : createCommentVNode("v-if", true)
  54967. ], 2)) : createCommentVNode("v-if", true),
  54968. createElementVNode("label", {
  54969. class: normalizeClass(unref(nsUpload).be("list", "item-status-label"))
  54970. }, [
  54971. _ctx.listType === "text" ? (openBlock(), createBlock(unref(ElIcon), {
  54972. key: 0,
  54973. class: normalizeClass([unref(nsIcon).m("upload-success"), unref(nsIcon).m("circle-check")])
  54974. }, {
  54975. default: withCtx(() => [
  54976. createVNode(unref(circle_check_default))
  54977. ]),
  54978. _: 1
  54979. }, 8, ["class"])) : ["picture-card", "picture"].includes(_ctx.listType) ? (openBlock(), createBlock(unref(ElIcon), {
  54980. key: 1,
  54981. class: normalizeClass([unref(nsIcon).m("upload-success"), unref(nsIcon).m("check")])
  54982. }, {
  54983. default: withCtx(() => [
  54984. createVNode(unref(check_default))
  54985. ]),
  54986. _: 1
  54987. }, 8, ["class"])) : createCommentVNode("v-if", true)
  54988. ], 2),
  54989. !unref(disabled) ? (openBlock(), createBlock(unref(ElIcon), {
  54990. key: 2,
  54991. class: normalizeClass(unref(nsIcon).m("close")),
  54992. onClick: ($event) => handleRemove(file)
  54993. }, {
  54994. default: withCtx(() => [
  54995. createVNode(unref(close_default))
  54996. ]),
  54997. _: 2
  54998. }, 1032, ["class", "onClick"])) : createCommentVNode("v-if", true),
  54999. createCommentVNode(" Due to close btn only appears when li gets focused disappears after li gets blurred, thus keyboard navigation can never reach close btn"),
  55000. createCommentVNode(" This is a bug which needs to be fixed "),
  55001. createCommentVNode(" TODO: Fix the incorrect navigation interaction "),
  55002. !unref(disabled) ? (openBlock(), createElementBlock("i", {
  55003. key: 3,
  55004. class: normalizeClass(unref(nsIcon).m("close-tip"))
  55005. }, toDisplayString(unref(t)("el.upload.deleteTip")), 3)) : createCommentVNode("v-if", true),
  55006. _ctx.listType === "picture-card" ? (openBlock(), createElementBlock("span", {
  55007. key: 4,
  55008. class: normalizeClass(unref(nsUpload).be("list", "item-actions"))
  55009. }, [
  55010. createElementVNode("span", {
  55011. class: normalizeClass(unref(nsUpload).be("list", "item-preview")),
  55012. onClick: ($event) => _ctx.handlePreview(file)
  55013. }, [
  55014. createVNode(unref(ElIcon), {
  55015. class: normalizeClass(unref(nsIcon).m("zoom-in"))
  55016. }, {
  55017. default: withCtx(() => [
  55018. createVNode(unref(zoom_in_default))
  55019. ]),
  55020. _: 1
  55021. }, 8, ["class"])
  55022. ], 10, ["onClick"]),
  55023. !unref(disabled) ? (openBlock(), createElementBlock("span", {
  55024. key: 0,
  55025. class: normalizeClass(unref(nsUpload).be("list", "item-delete")),
  55026. onClick: ($event) => handleRemove(file)
  55027. }, [
  55028. createVNode(unref(ElIcon), {
  55029. class: normalizeClass(unref(nsIcon).m("delete"))
  55030. }, {
  55031. default: withCtx(() => [
  55032. createVNode(unref(delete_default))
  55033. ]),
  55034. _: 1
  55035. }, 8, ["class"])
  55036. ], 10, ["onClick"])) : createCommentVNode("v-if", true)
  55037. ], 2)) : createCommentVNode("v-if", true)
  55038. ])
  55039. ], 42, ["onKeydown", "onFocus", "onBlur", "onClick"]);
  55040. }), 128)),
  55041. renderSlot(_ctx.$slots, "append")
  55042. ]),
  55043. _: 3
  55044. }, 8, ["class", "name"]);
  55045. };
  55046. }
  55047. });
  55048. var UploadList = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["__file", "upload-list.vue"]]);
  55049. const uploadDraggerProps = buildProps({
  55050. disabled: {
  55051. type: Boolean,
  55052. default: false
  55053. }
  55054. });
  55055. const uploadDraggerEmits = {
  55056. file: (file) => isArray$1(file)
  55057. };
  55058. const COMPONENT_NAME = "ElUploadDrag";
  55059. const __default__$e = defineComponent({
  55060. name: COMPONENT_NAME
  55061. });
  55062. const _sfc_main$f = /* @__PURE__ */ defineComponent({
  55063. ...__default__$e,
  55064. props: uploadDraggerProps,
  55065. emits: uploadDraggerEmits,
  55066. setup(__props, { emit }) {
  55067. const uploaderContext = inject(uploadContextKey);
  55068. if (!uploaderContext) {
  55069. throwError(COMPONENT_NAME, "usage: <el-upload><el-upload-dragger /></el-upload>");
  55070. }
  55071. const ns = useNamespace("upload");
  55072. const dragover = ref(false);
  55073. const disabled = useFormDisabled();
  55074. const onDrop = (e) => {
  55075. if (disabled.value)
  55076. return;
  55077. dragover.value = false;
  55078. e.stopPropagation();
  55079. const files = Array.from(e.dataTransfer.files);
  55080. const items = e.dataTransfer.items || [];
  55081. files.forEach((file, index) => {
  55082. var _a;
  55083. const item = items[index];
  55084. const entry = (_a = item == null ? void 0 : item.webkitGetAsEntry) == null ? void 0 : _a.call(item);
  55085. if (entry) {
  55086. file.isDirectory = entry.isDirectory;
  55087. }
  55088. });
  55089. emit("file", files);
  55090. };
  55091. const onDragover = () => {
  55092. if (!disabled.value)
  55093. dragover.value = true;
  55094. };
  55095. return (_ctx, _cache) => {
  55096. return openBlock(), createElementBlock("div", {
  55097. class: normalizeClass([unref(ns).b("dragger"), unref(ns).is("dragover", dragover.value)]),
  55098. onDrop: withModifiers(onDrop, ["prevent"]),
  55099. onDragover: withModifiers(onDragover, ["prevent"]),
  55100. onDragleave: withModifiers(($event) => dragover.value = false, ["prevent"])
  55101. }, [
  55102. renderSlot(_ctx.$slots, "default")
  55103. ], 42, ["onDrop", "onDragover", "onDragleave"]);
  55104. };
  55105. }
  55106. });
  55107. var UploadDragger = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__file", "upload-dragger.vue"]]);
  55108. const uploadContentProps = buildProps({
  55109. ...uploadBaseProps,
  55110. beforeUpload: {
  55111. type: definePropType(Function),
  55112. default: NOOP
  55113. },
  55114. onRemove: {
  55115. type: definePropType(Function),
  55116. default: NOOP
  55117. },
  55118. onStart: {
  55119. type: definePropType(Function),
  55120. default: NOOP
  55121. },
  55122. onSuccess: {
  55123. type: definePropType(Function),
  55124. default: NOOP
  55125. },
  55126. onProgress: {
  55127. type: definePropType(Function),
  55128. default: NOOP
  55129. },
  55130. onError: {
  55131. type: definePropType(Function),
  55132. default: NOOP
  55133. },
  55134. onExceed: {
  55135. type: definePropType(Function),
  55136. default: NOOP
  55137. }
  55138. });
  55139. const __default__$d = defineComponent({
  55140. name: "ElUploadContent",
  55141. inheritAttrs: false
  55142. });
  55143. const _sfc_main$e = /* @__PURE__ */ defineComponent({
  55144. ...__default__$d,
  55145. props: uploadContentProps,
  55146. setup(__props, { expose }) {
  55147. const props = __props;
  55148. const ns = useNamespace("upload");
  55149. const disabled = useFormDisabled();
  55150. const requests = shallowRef({});
  55151. const inputRef = shallowRef();
  55152. const uploadFiles = (files) => {
  55153. if (files.length === 0)
  55154. return;
  55155. const { autoUpload, limit, fileList, multiple, onStart, onExceed } = props;
  55156. if (limit && fileList.length + files.length > limit) {
  55157. onExceed(files, fileList);
  55158. return;
  55159. }
  55160. if (!multiple) {
  55161. files = files.slice(0, 1);
  55162. }
  55163. for (const file of files) {
  55164. const rawFile = file;
  55165. rawFile.uid = genFileId();
  55166. onStart(rawFile);
  55167. if (autoUpload)
  55168. upload(rawFile);
  55169. }
  55170. };
  55171. const upload = async (rawFile) => {
  55172. inputRef.value.value = "";
  55173. if (!props.beforeUpload) {
  55174. return doUpload(rawFile);
  55175. }
  55176. let hookResult;
  55177. let beforeData = {};
  55178. try {
  55179. const originData = props.data;
  55180. const beforeUploadPromise = props.beforeUpload(rawFile);
  55181. beforeData = isPlainObject$1(props.data) ? cloneDeep(props.data) : props.data;
  55182. hookResult = await beforeUploadPromise;
  55183. if (isPlainObject$1(props.data) && isEqual$1(originData, beforeData)) {
  55184. beforeData = cloneDeep(props.data);
  55185. }
  55186. } catch (e) {
  55187. hookResult = false;
  55188. }
  55189. if (hookResult === false) {
  55190. props.onRemove(rawFile);
  55191. return;
  55192. }
  55193. let file = rawFile;
  55194. if (hookResult instanceof Blob) {
  55195. if (hookResult instanceof File) {
  55196. file = hookResult;
  55197. } else {
  55198. file = new File([hookResult], rawFile.name, {
  55199. type: rawFile.type
  55200. });
  55201. }
  55202. }
  55203. doUpload(Object.assign(file, {
  55204. uid: rawFile.uid
  55205. }), beforeData);
  55206. };
  55207. const resolveData = async (data, rawFile) => {
  55208. if (isFunction$1(data)) {
  55209. return data(rawFile);
  55210. }
  55211. return data;
  55212. };
  55213. const doUpload = async (rawFile, beforeData) => {
  55214. const {
  55215. headers,
  55216. data,
  55217. method,
  55218. withCredentials,
  55219. name: filename,
  55220. action,
  55221. onProgress,
  55222. onSuccess,
  55223. onError,
  55224. httpRequest
  55225. } = props;
  55226. try {
  55227. beforeData = await resolveData(beforeData != null ? beforeData : data, rawFile);
  55228. } catch (e) {
  55229. props.onRemove(rawFile);
  55230. return;
  55231. }
  55232. const { uid } = rawFile;
  55233. const options = {
  55234. headers: headers || {},
  55235. withCredentials,
  55236. file: rawFile,
  55237. data: beforeData,
  55238. method,
  55239. filename,
  55240. action,
  55241. onProgress: (evt) => {
  55242. onProgress(evt, rawFile);
  55243. },
  55244. onSuccess: (res) => {
  55245. onSuccess(res, rawFile);
  55246. delete requests.value[uid];
  55247. },
  55248. onError: (err) => {
  55249. onError(err, rawFile);
  55250. delete requests.value[uid];
  55251. }
  55252. };
  55253. const request = httpRequest(options);
  55254. requests.value[uid] = request;
  55255. if (request instanceof Promise) {
  55256. request.then(options.onSuccess, options.onError);
  55257. }
  55258. };
  55259. const handleChange = (e) => {
  55260. const files = e.target.files;
  55261. if (!files)
  55262. return;
  55263. uploadFiles(Array.from(files));
  55264. };
  55265. const handleClick = () => {
  55266. if (!disabled.value) {
  55267. inputRef.value.value = "";
  55268. inputRef.value.click();
  55269. }
  55270. };
  55271. const handleKeydown = () => {
  55272. handleClick();
  55273. };
  55274. const abort = (file) => {
  55275. const _reqs = entriesOf(requests.value).filter(file ? ([uid]) => String(file.uid) === uid : () => true);
  55276. _reqs.forEach(([uid, req]) => {
  55277. if (req instanceof XMLHttpRequest)
  55278. req.abort();
  55279. delete requests.value[uid];
  55280. });
  55281. };
  55282. expose({
  55283. abort,
  55284. upload
  55285. });
  55286. return (_ctx, _cache) => {
  55287. return openBlock(), createElementBlock("div", {
  55288. class: normalizeClass([
  55289. unref(ns).b(),
  55290. unref(ns).m(_ctx.listType),
  55291. unref(ns).is("drag", _ctx.drag),
  55292. unref(ns).is("disabled", unref(disabled))
  55293. ]),
  55294. tabindex: unref(disabled) ? "-1" : "0",
  55295. onClick: handleClick,
  55296. onKeydown: withKeys(withModifiers(handleKeydown, ["self"]), ["enter", "space"])
  55297. }, [
  55298. _ctx.drag ? (openBlock(), createBlock(UploadDragger, {
  55299. key: 0,
  55300. disabled: unref(disabled),
  55301. onFile: uploadFiles
  55302. }, {
  55303. default: withCtx(() => [
  55304. renderSlot(_ctx.$slots, "default")
  55305. ]),
  55306. _: 3
  55307. }, 8, ["disabled"])) : renderSlot(_ctx.$slots, "default", { key: 1 }),
  55308. createElementVNode("input", {
  55309. ref_key: "inputRef",
  55310. ref: inputRef,
  55311. class: normalizeClass(unref(ns).e("input")),
  55312. name: _ctx.name,
  55313. disabled: unref(disabled),
  55314. multiple: _ctx.multiple,
  55315. accept: _ctx.accept,
  55316. type: "file",
  55317. onChange: handleChange,
  55318. onClick: withModifiers(() => {
  55319. }, ["stop"])
  55320. }, null, 42, ["name", "disabled", "multiple", "accept", "onClick"])
  55321. ], 42, ["tabindex", "onKeydown"]);
  55322. };
  55323. }
  55324. });
  55325. var UploadContent = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["__file", "upload-content.vue"]]);
  55326. const SCOPE$1 = "ElUpload";
  55327. const revokeFileObjectURL = (file) => {
  55328. var _a;
  55329. if ((_a = file.url) == null ? void 0 : _a.startsWith("blob:")) {
  55330. URL.revokeObjectURL(file.url);
  55331. }
  55332. };
  55333. const useHandlers = (props, uploadRef) => {
  55334. const uploadFiles = useVModel(props, "fileList", void 0, { passive: true });
  55335. const getFile = (rawFile) => uploadFiles.value.find((file) => file.uid === rawFile.uid);
  55336. function abort(file) {
  55337. var _a;
  55338. (_a = uploadRef.value) == null ? void 0 : _a.abort(file);
  55339. }
  55340. function clearFiles(states = ["ready", "uploading", "success", "fail"]) {
  55341. uploadFiles.value = uploadFiles.value.filter((row) => !states.includes(row.status));
  55342. }
  55343. function removeFile(file) {
  55344. uploadFiles.value = uploadFiles.value.filter((uploadFile) => uploadFile.uid !== file.uid);
  55345. }
  55346. const handleError = (err, rawFile) => {
  55347. const file = getFile(rawFile);
  55348. if (!file)
  55349. return;
  55350. console.error(err);
  55351. file.status = "fail";
  55352. removeFile(file);
  55353. props.onError(err, file, uploadFiles.value);
  55354. props.onChange(file, uploadFiles.value);
  55355. };
  55356. const handleProgress = (evt, rawFile) => {
  55357. const file = getFile(rawFile);
  55358. if (!file)
  55359. return;
  55360. props.onProgress(evt, file, uploadFiles.value);
  55361. file.status = "uploading";
  55362. file.percentage = Math.round(evt.percent);
  55363. };
  55364. const handleSuccess = (response, rawFile) => {
  55365. const file = getFile(rawFile);
  55366. if (!file)
  55367. return;
  55368. file.status = "success";
  55369. file.response = response;
  55370. props.onSuccess(response, file, uploadFiles.value);
  55371. props.onChange(file, uploadFiles.value);
  55372. };
  55373. const handleStart = (file) => {
  55374. if (isNil(file.uid))
  55375. file.uid = genFileId();
  55376. const uploadFile = {
  55377. name: file.name,
  55378. percentage: 0,
  55379. status: "ready",
  55380. size: file.size,
  55381. raw: file,
  55382. uid: file.uid
  55383. };
  55384. if (props.listType === "picture-card" || props.listType === "picture") {
  55385. try {
  55386. uploadFile.url = URL.createObjectURL(file);
  55387. } catch (err) {
  55388. debugWarn(SCOPE$1, err.message);
  55389. props.onError(err, uploadFile, uploadFiles.value);
  55390. }
  55391. }
  55392. uploadFiles.value = [...uploadFiles.value, uploadFile];
  55393. props.onChange(uploadFile, uploadFiles.value);
  55394. };
  55395. const handleRemove = async (file) => {
  55396. const uploadFile = file instanceof File ? getFile(file) : file;
  55397. if (!uploadFile)
  55398. throwError(SCOPE$1, "file to be removed not found");
  55399. const doRemove = (file2) => {
  55400. abort(file2);
  55401. removeFile(file2);
  55402. props.onRemove(file2, uploadFiles.value);
  55403. revokeFileObjectURL(file2);
  55404. };
  55405. if (props.beforeRemove) {
  55406. const before = await props.beforeRemove(uploadFile, uploadFiles.value);
  55407. if (before !== false)
  55408. doRemove(uploadFile);
  55409. } else {
  55410. doRemove(uploadFile);
  55411. }
  55412. };
  55413. function submit() {
  55414. uploadFiles.value.filter(({ status }) => status === "ready").forEach(({ raw }) => {
  55415. var _a;
  55416. return raw && ((_a = uploadRef.value) == null ? void 0 : _a.upload(raw));
  55417. });
  55418. }
  55419. watch(() => props.listType, (val) => {
  55420. if (val !== "picture-card" && val !== "picture") {
  55421. return;
  55422. }
  55423. uploadFiles.value = uploadFiles.value.map((file) => {
  55424. const { raw, url } = file;
  55425. if (!url && raw) {
  55426. try {
  55427. file.url = URL.createObjectURL(raw);
  55428. } catch (err) {
  55429. props.onError(err, file, uploadFiles.value);
  55430. }
  55431. }
  55432. return file;
  55433. });
  55434. });
  55435. watch(uploadFiles, (files) => {
  55436. for (const file of files) {
  55437. file.uid || (file.uid = genFileId());
  55438. file.status || (file.status = "success");
  55439. }
  55440. }, { immediate: true, deep: true });
  55441. return {
  55442. uploadFiles,
  55443. abort,
  55444. clearFiles,
  55445. handleError,
  55446. handleProgress,
  55447. handleStart,
  55448. handleSuccess,
  55449. handleRemove,
  55450. submit,
  55451. revokeFileObjectURL
  55452. };
  55453. };
  55454. const __default__$c = defineComponent({
  55455. name: "ElUpload"
  55456. });
  55457. const _sfc_main$d = /* @__PURE__ */ defineComponent({
  55458. ...__default__$c,
  55459. props: uploadProps,
  55460. setup(__props, { expose }) {
  55461. const props = __props;
  55462. const disabled = useFormDisabled();
  55463. const uploadRef = shallowRef();
  55464. const {
  55465. abort,
  55466. submit,
  55467. clearFiles,
  55468. uploadFiles,
  55469. handleStart,
  55470. handleError,
  55471. handleRemove,
  55472. handleSuccess,
  55473. handleProgress,
  55474. revokeFileObjectURL
  55475. } = useHandlers(props, uploadRef);
  55476. const isPictureCard = computed(() => props.listType === "picture-card");
  55477. const uploadContentProps = computed(() => ({
  55478. ...props,
  55479. fileList: uploadFiles.value,
  55480. onStart: handleStart,
  55481. onProgress: handleProgress,
  55482. onSuccess: handleSuccess,
  55483. onError: handleError,
  55484. onRemove: handleRemove
  55485. }));
  55486. onBeforeUnmount(() => {
  55487. uploadFiles.value.forEach(revokeFileObjectURL);
  55488. });
  55489. provide(uploadContextKey, {
  55490. accept: toRef(props, "accept")
  55491. });
  55492. expose({
  55493. abort,
  55494. submit,
  55495. clearFiles,
  55496. handleStart,
  55497. handleRemove
  55498. });
  55499. return (_ctx, _cache) => {
  55500. return openBlock(), createElementBlock("div", null, [
  55501. unref(isPictureCard) && _ctx.showFileList ? (openBlock(), createBlock(UploadList, {
  55502. key: 0,
  55503. disabled: unref(disabled),
  55504. "list-type": _ctx.listType,
  55505. files: unref(uploadFiles),
  55506. crossorigin: _ctx.crossorigin,
  55507. "handle-preview": _ctx.onPreview,
  55508. onRemove: unref(handleRemove)
  55509. }, createSlots({
  55510. append: withCtx(() => [
  55511. createVNode(UploadContent, mergeProps({
  55512. ref_key: "uploadRef",
  55513. ref: uploadRef
  55514. }, unref(uploadContentProps)), {
  55515. default: withCtx(() => [
  55516. _ctx.$slots.trigger ? renderSlot(_ctx.$slots, "trigger", { key: 0 }) : createCommentVNode("v-if", true),
  55517. !_ctx.$slots.trigger && _ctx.$slots.default ? renderSlot(_ctx.$slots, "default", { key: 1 }) : createCommentVNode("v-if", true)
  55518. ]),
  55519. _: 3
  55520. }, 16)
  55521. ]),
  55522. _: 2
  55523. }, [
  55524. _ctx.$slots.file ? {
  55525. name: "default",
  55526. fn: withCtx(({ file, index }) => [
  55527. renderSlot(_ctx.$slots, "file", {
  55528. file,
  55529. index
  55530. })
  55531. ])
  55532. } : void 0
  55533. ]), 1032, ["disabled", "list-type", "files", "crossorigin", "handle-preview", "onRemove"])) : createCommentVNode("v-if", true),
  55534. !unref(isPictureCard) || unref(isPictureCard) && !_ctx.showFileList ? (openBlock(), createBlock(UploadContent, mergeProps({
  55535. key: 1,
  55536. ref_key: "uploadRef",
  55537. ref: uploadRef
  55538. }, unref(uploadContentProps)), {
  55539. default: withCtx(() => [
  55540. _ctx.$slots.trigger ? renderSlot(_ctx.$slots, "trigger", { key: 0 }) : createCommentVNode("v-if", true),
  55541. !_ctx.$slots.trigger && _ctx.$slots.default ? renderSlot(_ctx.$slots, "default", { key: 1 }) : createCommentVNode("v-if", true)
  55542. ]),
  55543. _: 3
  55544. }, 16)) : createCommentVNode("v-if", true),
  55545. _ctx.$slots.trigger ? renderSlot(_ctx.$slots, "default", { key: 2 }) : createCommentVNode("v-if", true),
  55546. renderSlot(_ctx.$slots, "tip"),
  55547. !unref(isPictureCard) && _ctx.showFileList ? (openBlock(), createBlock(UploadList, {
  55548. key: 3,
  55549. disabled: unref(disabled),
  55550. "list-type": _ctx.listType,
  55551. files: unref(uploadFiles),
  55552. crossorigin: _ctx.crossorigin,
  55553. "handle-preview": _ctx.onPreview,
  55554. onRemove: unref(handleRemove)
  55555. }, createSlots({
  55556. _: 2
  55557. }, [
  55558. _ctx.$slots.file ? {
  55559. name: "default",
  55560. fn: withCtx(({ file, index }) => [
  55561. renderSlot(_ctx.$slots, "file", {
  55562. file,
  55563. index
  55564. })
  55565. ])
  55566. } : void 0
  55567. ]), 1032, ["disabled", "list-type", "files", "crossorigin", "handle-preview", "onRemove"])) : createCommentVNode("v-if", true)
  55568. ]);
  55569. };
  55570. }
  55571. });
  55572. var Upload = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["__file", "upload.vue"]]);
  55573. const ElUpload = withInstall(Upload);
  55574. const watermarkProps = buildProps({
  55575. zIndex: {
  55576. type: Number,
  55577. default: 9
  55578. },
  55579. rotate: {
  55580. type: Number,
  55581. default: -22
  55582. },
  55583. width: Number,
  55584. height: Number,
  55585. image: String,
  55586. content: {
  55587. type: definePropType([String, Array]),
  55588. default: "Element Plus"
  55589. },
  55590. font: {
  55591. type: definePropType(Object)
  55592. },
  55593. gap: {
  55594. type: definePropType(Array),
  55595. default: () => [100, 100]
  55596. },
  55597. offset: {
  55598. type: definePropType(Array)
  55599. }
  55600. });
  55601. function toLowercaseSeparator(key) {
  55602. return key.replace(/([A-Z])/g, "-$1").toLowerCase();
  55603. }
  55604. function getStyleStr(style) {
  55605. return Object.keys(style).map((key) => `${toLowercaseSeparator(key)}: ${style[key]};`).join(" ");
  55606. }
  55607. function getPixelRatio() {
  55608. return window.devicePixelRatio || 1;
  55609. }
  55610. const reRendering = (mutation, watermarkElement) => {
  55611. let flag = false;
  55612. if (mutation.removedNodes.length && watermarkElement) {
  55613. flag = Array.from(mutation.removedNodes).includes(watermarkElement);
  55614. }
  55615. if (mutation.type === "attributes" && mutation.target === watermarkElement) {
  55616. flag = true;
  55617. }
  55618. return flag;
  55619. };
  55620. const FontGap = 3;
  55621. function prepareCanvas(width, height, ratio = 1) {
  55622. const canvas = document.createElement("canvas");
  55623. const ctx = canvas.getContext("2d");
  55624. const realWidth = width * ratio;
  55625. const realHeight = height * ratio;
  55626. canvas.setAttribute("width", `${realWidth}px`);
  55627. canvas.setAttribute("height", `${realHeight}px`);
  55628. ctx.save();
  55629. return [ctx, canvas, realWidth, realHeight];
  55630. }
  55631. function useClips() {
  55632. function getClips(content, rotate, ratio, width, height, font, gapX, gapY) {
  55633. const [ctx, canvas, contentWidth, contentHeight] = prepareCanvas(width, height, ratio);
  55634. if (content instanceof HTMLImageElement) {
  55635. ctx.drawImage(content, 0, 0, contentWidth, contentHeight);
  55636. } else {
  55637. const {
  55638. color,
  55639. fontSize,
  55640. fontStyle,
  55641. fontWeight,
  55642. fontFamily,
  55643. textAlign,
  55644. textBaseline
  55645. } = font;
  55646. const mergedFontSize = Number(fontSize) * ratio;
  55647. ctx.font = `${fontStyle} normal ${fontWeight} ${mergedFontSize}px/${height}px ${fontFamily}`;
  55648. ctx.fillStyle = color;
  55649. ctx.textAlign = textAlign;
  55650. ctx.textBaseline = textBaseline;
  55651. const contents = isArray$1(content) ? content : [content];
  55652. contents == null ? void 0 : contents.forEach((item, index) => {
  55653. ctx.fillText(item != null ? item : "", contentWidth / 2, index * (mergedFontSize + FontGap * ratio));
  55654. });
  55655. }
  55656. const angle = Math.PI / 180 * Number(rotate);
  55657. const maxSize = Math.max(width, height);
  55658. const [rCtx, rCanvas, realMaxSize] = prepareCanvas(maxSize, maxSize, ratio);
  55659. rCtx.translate(realMaxSize / 2, realMaxSize / 2);
  55660. rCtx.rotate(angle);
  55661. if (contentWidth > 0 && contentHeight > 0) {
  55662. rCtx.drawImage(canvas, -contentWidth / 2, -contentHeight / 2);
  55663. }
  55664. function getRotatePos(x, y) {
  55665. const targetX = x * Math.cos(angle) - y * Math.sin(angle);
  55666. const targetY = x * Math.sin(angle) + y * Math.cos(angle);
  55667. return [targetX, targetY];
  55668. }
  55669. let left = 0;
  55670. let right = 0;
  55671. let top = 0;
  55672. let bottom = 0;
  55673. const halfWidth = contentWidth / 2;
  55674. const halfHeight = contentHeight / 2;
  55675. const points = [
  55676. [0 - halfWidth, 0 - halfHeight],
  55677. [0 + halfWidth, 0 - halfHeight],
  55678. [0 + halfWidth, 0 + halfHeight],
  55679. [0 - halfWidth, 0 + halfHeight]
  55680. ];
  55681. points.forEach(([x, y]) => {
  55682. const [targetX, targetY] = getRotatePos(x, y);
  55683. left = Math.min(left, targetX);
  55684. right = Math.max(right, targetX);
  55685. top = Math.min(top, targetY);
  55686. bottom = Math.max(bottom, targetY);
  55687. });
  55688. const cutLeft = left + realMaxSize / 2;
  55689. const cutTop = top + realMaxSize / 2;
  55690. const cutWidth = right - left;
  55691. const cutHeight = bottom - top;
  55692. const realGapX = gapX * ratio;
  55693. const realGapY = gapY * ratio;
  55694. const filledWidth = (cutWidth + realGapX) * 2;
  55695. const filledHeight = cutHeight + realGapY;
  55696. const [fCtx, fCanvas] = prepareCanvas(filledWidth, filledHeight);
  55697. function drawImg(targetX = 0, targetY = 0) {
  55698. fCtx.drawImage(rCanvas, cutLeft, cutTop, cutWidth, cutHeight, targetX, targetY, cutWidth, cutHeight);
  55699. }
  55700. drawImg();
  55701. drawImg(cutWidth + realGapX, -cutHeight / 2 - realGapY / 2);
  55702. drawImg(cutWidth + realGapX, +cutHeight / 2 + realGapY / 2);
  55703. return [fCanvas.toDataURL(), filledWidth / ratio, filledHeight / ratio];
  55704. }
  55705. return getClips;
  55706. }
  55707. const __default__$b = defineComponent({
  55708. name: "ElWatermark"
  55709. });
  55710. const _sfc_main$c = /* @__PURE__ */ defineComponent({
  55711. ...__default__$b,
  55712. props: watermarkProps,
  55713. setup(__props) {
  55714. const props = __props;
  55715. const style = {
  55716. position: "relative"
  55717. };
  55718. const color = computed(() => {
  55719. var _a, _b;
  55720. return (_b = (_a = props.font) == null ? void 0 : _a.color) != null ? _b : "rgba(0,0,0,.15)";
  55721. });
  55722. const fontSize = computed(() => {
  55723. var _a, _b;
  55724. return (_b = (_a = props.font) == null ? void 0 : _a.fontSize) != null ? _b : 16;
  55725. });
  55726. const fontWeight = computed(() => {
  55727. var _a, _b;
  55728. return (_b = (_a = props.font) == null ? void 0 : _a.fontWeight) != null ? _b : "normal";
  55729. });
  55730. const fontStyle = computed(() => {
  55731. var _a, _b;
  55732. return (_b = (_a = props.font) == null ? void 0 : _a.fontStyle) != null ? _b : "normal";
  55733. });
  55734. const fontFamily = computed(() => {
  55735. var _a, _b;
  55736. return (_b = (_a = props.font) == null ? void 0 : _a.fontFamily) != null ? _b : "sans-serif";
  55737. });
  55738. const textAlign = computed(() => {
  55739. var _a, _b;
  55740. return (_b = (_a = props.font) == null ? void 0 : _a.textAlign) != null ? _b : "center";
  55741. });
  55742. const textBaseline = computed(() => {
  55743. var _a, _b;
  55744. return (_b = (_a = props.font) == null ? void 0 : _a.textBaseline) != null ? _b : "hanging";
  55745. });
  55746. const gapX = computed(() => props.gap[0]);
  55747. const gapY = computed(() => props.gap[1]);
  55748. const gapXCenter = computed(() => gapX.value / 2);
  55749. const gapYCenter = computed(() => gapY.value / 2);
  55750. const offsetLeft = computed(() => {
  55751. var _a, _b;
  55752. return (_b = (_a = props.offset) == null ? void 0 : _a[0]) != null ? _b : gapXCenter.value;
  55753. });
  55754. const offsetTop = computed(() => {
  55755. var _a, _b;
  55756. return (_b = (_a = props.offset) == null ? void 0 : _a[1]) != null ? _b : gapYCenter.value;
  55757. });
  55758. const getMarkStyle = () => {
  55759. const markStyle = {
  55760. zIndex: props.zIndex,
  55761. position: "absolute",
  55762. left: 0,
  55763. top: 0,
  55764. width: "100%",
  55765. height: "100%",
  55766. pointerEvents: "none",
  55767. backgroundRepeat: "repeat"
  55768. };
  55769. let positionLeft = offsetLeft.value - gapXCenter.value;
  55770. let positionTop = offsetTop.value - gapYCenter.value;
  55771. if (positionLeft > 0) {
  55772. markStyle.left = `${positionLeft}px`;
  55773. markStyle.width = `calc(100% - ${positionLeft}px)`;
  55774. positionLeft = 0;
  55775. }
  55776. if (positionTop > 0) {
  55777. markStyle.top = `${positionTop}px`;
  55778. markStyle.height = `calc(100% - ${positionTop}px)`;
  55779. positionTop = 0;
  55780. }
  55781. markStyle.backgroundPosition = `${positionLeft}px ${positionTop}px`;
  55782. return markStyle;
  55783. };
  55784. const containerRef = shallowRef(null);
  55785. const watermarkRef = shallowRef();
  55786. const stopObservation = ref(false);
  55787. const destroyWatermark = () => {
  55788. if (watermarkRef.value) {
  55789. watermarkRef.value.remove();
  55790. watermarkRef.value = void 0;
  55791. }
  55792. };
  55793. const appendWatermark = (base64Url, markWidth) => {
  55794. var _a;
  55795. if (containerRef.value && watermarkRef.value) {
  55796. stopObservation.value = true;
  55797. watermarkRef.value.setAttribute("style", getStyleStr({
  55798. ...getMarkStyle(),
  55799. backgroundImage: `url('${base64Url}')`,
  55800. backgroundSize: `${Math.floor(markWidth)}px`
  55801. }));
  55802. (_a = containerRef.value) == null ? void 0 : _a.append(watermarkRef.value);
  55803. setTimeout(() => {
  55804. stopObservation.value = false;
  55805. });
  55806. }
  55807. };
  55808. const getMarkSize = (ctx) => {
  55809. let defaultWidth = 120;
  55810. let defaultHeight = 64;
  55811. const { image, content, width, height, rotate } = props;
  55812. if (!image && ctx.measureText) {
  55813. ctx.font = `${Number(fontSize.value)}px ${fontFamily.value}`;
  55814. const contents = isArray$1(content) ? content : [content];
  55815. let maxWidth = 0;
  55816. let maxHeight = 0;
  55817. contents.forEach((item) => {
  55818. const {
  55819. width: width2,
  55820. fontBoundingBoxAscent,
  55821. fontBoundingBoxDescent,
  55822. actualBoundingBoxAscent,
  55823. actualBoundingBoxDescent
  55824. } = ctx.measureText(item);
  55825. const height2 = isUndefined(fontBoundingBoxAscent) ? actualBoundingBoxAscent + actualBoundingBoxDescent : fontBoundingBoxAscent + fontBoundingBoxDescent;
  55826. if (width2 > maxWidth)
  55827. maxWidth = Math.ceil(width2);
  55828. if (height2 > maxHeight)
  55829. maxHeight = Math.ceil(height2);
  55830. });
  55831. defaultWidth = maxWidth;
  55832. defaultHeight = maxHeight * contents.length + (contents.length - 1) * FontGap;
  55833. const angle = Math.PI / 180 * Number(rotate);
  55834. const space = Math.ceil(Math.abs(Math.sin(angle) * defaultHeight) / 2);
  55835. defaultWidth += space;
  55836. }
  55837. return [width != null ? width : defaultWidth, height != null ? height : defaultHeight];
  55838. };
  55839. const getClips = useClips();
  55840. const renderWatermark = () => {
  55841. const canvas = document.createElement("canvas");
  55842. const ctx = canvas.getContext("2d");
  55843. const image = props.image;
  55844. const content = props.content;
  55845. const rotate = props.rotate;
  55846. if (ctx) {
  55847. if (!watermarkRef.value) {
  55848. watermarkRef.value = document.createElement("div");
  55849. }
  55850. const ratio = getPixelRatio();
  55851. const [markWidth, markHeight] = getMarkSize(ctx);
  55852. const drawCanvas = (drawContent) => {
  55853. const [textClips, clipWidth] = getClips(drawContent || "", rotate, ratio, markWidth, markHeight, {
  55854. color: color.value,
  55855. fontSize: fontSize.value,
  55856. fontStyle: fontStyle.value,
  55857. fontWeight: fontWeight.value,
  55858. fontFamily: fontFamily.value,
  55859. textAlign: textAlign.value,
  55860. textBaseline: textBaseline.value
  55861. }, gapX.value, gapY.value);
  55862. appendWatermark(textClips, clipWidth);
  55863. };
  55864. if (image) {
  55865. const img = new Image();
  55866. img.onload = () => {
  55867. drawCanvas(img);
  55868. };
  55869. img.onerror = () => {
  55870. drawCanvas(content);
  55871. };
  55872. img.crossOrigin = "anonymous";
  55873. img.referrerPolicy = "no-referrer";
  55874. img.src = image;
  55875. } else {
  55876. drawCanvas(content);
  55877. }
  55878. }
  55879. };
  55880. onMounted(() => {
  55881. renderWatermark();
  55882. });
  55883. watch(() => props, () => {
  55884. renderWatermark();
  55885. }, {
  55886. deep: true,
  55887. flush: "post"
  55888. });
  55889. onBeforeUnmount(() => {
  55890. destroyWatermark();
  55891. });
  55892. const onMutate = (mutations) => {
  55893. if (stopObservation.value) {
  55894. return;
  55895. }
  55896. mutations.forEach((mutation) => {
  55897. if (reRendering(mutation, watermarkRef.value)) {
  55898. destroyWatermark();
  55899. renderWatermark();
  55900. }
  55901. });
  55902. };
  55903. useMutationObserver(containerRef, onMutate, {
  55904. attributes: true,
  55905. subtree: true,
  55906. childList: true
  55907. });
  55908. return (_ctx, _cache) => {
  55909. return openBlock(), createElementBlock("div", {
  55910. ref_key: "containerRef",
  55911. ref: containerRef,
  55912. style: normalizeStyle([style])
  55913. }, [
  55914. renderSlot(_ctx.$slots, "default")
  55915. ], 4);
  55916. };
  55917. }
  55918. });
  55919. var Watermark = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["__file", "watermark.vue"]]);
  55920. const ElWatermark = withInstall(Watermark);
  55921. const maskProps = buildProps({
  55922. zIndex: {
  55923. type: Number,
  55924. default: 1001
  55925. },
  55926. visible: Boolean,
  55927. fill: {
  55928. type: String,
  55929. default: "rgba(0,0,0,0.5)"
  55930. },
  55931. pos: {
  55932. type: definePropType(Object)
  55933. },
  55934. targetAreaClickable: {
  55935. type: Boolean,
  55936. default: true
  55937. }
  55938. });
  55939. const useTarget = (target, open, gap, mergedMask, scrollIntoViewOptions) => {
  55940. const posInfo = ref(null);
  55941. const getTargetEl = () => {
  55942. let targetEl;
  55943. if (isString$1(target.value)) {
  55944. targetEl = document.querySelector(target.value);
  55945. } else if (isFunction$1(target.value)) {
  55946. targetEl = target.value();
  55947. } else {
  55948. targetEl = target.value;
  55949. }
  55950. return targetEl;
  55951. };
  55952. const updatePosInfo = () => {
  55953. const targetEl = getTargetEl();
  55954. if (!targetEl || !open.value) {
  55955. posInfo.value = null;
  55956. return;
  55957. }
  55958. if (!isInViewPort(targetEl)) {
  55959. targetEl.scrollIntoView(scrollIntoViewOptions.value);
  55960. }
  55961. const { left, top, width, height } = targetEl.getBoundingClientRect();
  55962. posInfo.value = {
  55963. left,
  55964. top,
  55965. width,
  55966. height,
  55967. radius: 0
  55968. };
  55969. };
  55970. onMounted(() => {
  55971. watch([open, target], () => {
  55972. updatePosInfo();
  55973. }, {
  55974. immediate: true
  55975. });
  55976. window.addEventListener("resize", updatePosInfo);
  55977. });
  55978. onBeforeUnmount(() => {
  55979. window.removeEventListener("resize", updatePosInfo);
  55980. });
  55981. const getGapOffset = (index) => {
  55982. var _a;
  55983. return (_a = isArray$1(gap.value.offset) ? gap.value.offset[index] : gap.value.offset) != null ? _a : 6;
  55984. };
  55985. const mergedPosInfo = computed(() => {
  55986. var _a;
  55987. if (!posInfo.value)
  55988. return posInfo.value;
  55989. const gapOffsetX = getGapOffset(0);
  55990. const gapOffsetY = getGapOffset(1);
  55991. const gapRadius = ((_a = gap.value) == null ? void 0 : _a.radius) || 2;
  55992. return {
  55993. left: posInfo.value.left - gapOffsetX,
  55994. top: posInfo.value.top - gapOffsetY,
  55995. width: posInfo.value.width + gapOffsetX * 2,
  55996. height: posInfo.value.height + gapOffsetY * 2,
  55997. radius: gapRadius
  55998. };
  55999. });
  56000. const triggerTarget = computed(() => {
  56001. const targetEl = getTargetEl();
  56002. if (!mergedMask.value || !targetEl || !window.DOMRect) {
  56003. return targetEl || void 0;
  56004. }
  56005. return {
  56006. getBoundingClientRect() {
  56007. var _a, _b, _c, _d;
  56008. return window.DOMRect.fromRect({
  56009. width: ((_a = mergedPosInfo.value) == null ? void 0 : _a.width) || 0,
  56010. height: ((_b = mergedPosInfo.value) == null ? void 0 : _b.height) || 0,
  56011. x: ((_c = mergedPosInfo.value) == null ? void 0 : _c.left) || 0,
  56012. y: ((_d = mergedPosInfo.value) == null ? void 0 : _d.top) || 0
  56013. });
  56014. }
  56015. };
  56016. });
  56017. return {
  56018. mergedPosInfo,
  56019. triggerTarget
  56020. };
  56021. };
  56022. const tourKey = Symbol("ElTour");
  56023. function isInViewPort(element) {
  56024. const viewWidth = window.innerWidth || document.documentElement.clientWidth;
  56025. const viewHeight = window.innerHeight || document.documentElement.clientHeight;
  56026. const { top, right, bottom, left } = element.getBoundingClientRect();
  56027. return top >= 0 && left >= 0 && right <= viewWidth && bottom <= viewHeight;
  56028. }
  56029. const useFloating = (referenceRef, contentRef, arrowRef, placement, strategy, offset$1, zIndex, showArrow) => {
  56030. const x = ref();
  56031. const y = ref();
  56032. const middlewareData = ref({});
  56033. const states = {
  56034. x,
  56035. y,
  56036. placement,
  56037. strategy,
  56038. middlewareData
  56039. };
  56040. const middleware = computed(() => {
  56041. const _middleware = [
  56042. offset(unref(offset$1)),
  56043. flip(),
  56044. shift(),
  56045. overflowMiddleware()
  56046. ];
  56047. if (unref(showArrow) && unref(arrowRef)) {
  56048. _middleware.push(arrow({
  56049. element: unref(arrowRef)
  56050. }));
  56051. }
  56052. return _middleware;
  56053. });
  56054. const update = async () => {
  56055. if (!isClient)
  56056. return;
  56057. const referenceEl = unref(referenceRef);
  56058. const contentEl = unref(contentRef);
  56059. if (!referenceEl || !contentEl)
  56060. return;
  56061. const data = await computePosition(referenceEl, contentEl, {
  56062. placement: unref(placement),
  56063. strategy: unref(strategy),
  56064. middleware: unref(middleware)
  56065. });
  56066. keysOf(states).forEach((key) => {
  56067. states[key].value = data[key];
  56068. });
  56069. };
  56070. const contentStyle = computed(() => {
  56071. if (!unref(referenceRef)) {
  56072. return {
  56073. position: "fixed",
  56074. top: "50%",
  56075. left: "50%",
  56076. transform: "translate3d(-50%, -50%, 0)",
  56077. maxWidth: "100vw",
  56078. zIndex: unref(zIndex)
  56079. };
  56080. }
  56081. const { overflow } = unref(middlewareData);
  56082. return {
  56083. position: unref(strategy),
  56084. zIndex: unref(zIndex),
  56085. top: unref(y) != null ? `${unref(y)}px` : "",
  56086. left: unref(x) != null ? `${unref(x)}px` : "",
  56087. maxWidth: (overflow == null ? void 0 : overflow.maxWidth) ? `${overflow == null ? void 0 : overflow.maxWidth}px` : ""
  56088. };
  56089. });
  56090. const arrowStyle = computed(() => {
  56091. if (!unref(showArrow))
  56092. return {};
  56093. const { arrow: arrow2 } = unref(middlewareData);
  56094. return {
  56095. left: (arrow2 == null ? void 0 : arrow2.x) != null ? `${arrow2 == null ? void 0 : arrow2.x}px` : "",
  56096. top: (arrow2 == null ? void 0 : arrow2.y) != null ? `${arrow2 == null ? void 0 : arrow2.y}px` : ""
  56097. };
  56098. });
  56099. let cleanup;
  56100. onMounted(() => {
  56101. const referenceEl = unref(referenceRef);
  56102. const contentEl = unref(contentRef);
  56103. if (referenceEl && contentEl) {
  56104. cleanup = autoUpdate(referenceEl, contentEl, update);
  56105. }
  56106. watchEffect(() => {
  56107. update();
  56108. });
  56109. });
  56110. onBeforeUnmount(() => {
  56111. cleanup && cleanup();
  56112. });
  56113. return {
  56114. update,
  56115. contentStyle,
  56116. arrowStyle
  56117. };
  56118. };
  56119. const overflowMiddleware = () => {
  56120. return {
  56121. name: "overflow",
  56122. async fn(state) {
  56123. const overflow = await detectOverflow(state);
  56124. let overWidth = 0;
  56125. if (overflow.left > 0)
  56126. overWidth = overflow.left;
  56127. if (overflow.right > 0)
  56128. overWidth = overflow.right;
  56129. const floatingWidth = state.rects.floating.width;
  56130. return {
  56131. data: {
  56132. maxWidth: floatingWidth - overWidth
  56133. }
  56134. };
  56135. }
  56136. };
  56137. };
  56138. const __default__$a = defineComponent({
  56139. name: "ElTourMask",
  56140. inheritAttrs: false
  56141. });
  56142. const _sfc_main$b = /* @__PURE__ */ defineComponent({
  56143. ...__default__$a,
  56144. props: maskProps,
  56145. setup(__props) {
  56146. const props = __props;
  56147. const { ns } = inject(tourKey);
  56148. const radius = computed(() => {
  56149. var _a, _b;
  56150. return (_b = (_a = props.pos) == null ? void 0 : _a.radius) != null ? _b : 2;
  56151. });
  56152. const roundInfo = computed(() => {
  56153. const v = radius.value;
  56154. const baseInfo = `a${v},${v} 0 0 1`;
  56155. return {
  56156. topRight: `${baseInfo} ${v},${v}`,
  56157. bottomRight: `${baseInfo} ${-v},${v}`,
  56158. bottomLeft: `${baseInfo} ${-v},${-v}`,
  56159. topLeft: `${baseInfo} ${v},${-v}`
  56160. };
  56161. });
  56162. const path = computed(() => {
  56163. const width = window.innerWidth;
  56164. const height = window.innerHeight;
  56165. const info = roundInfo.value;
  56166. const _path = `M${width},0 L0,0 L0,${height} L${width},${height} L${width},0 Z`;
  56167. const _radius = radius.value;
  56168. 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;
  56169. });
  56170. const pathStyle = computed(() => {
  56171. return {
  56172. fill: props.fill,
  56173. pointerEvents: "auto",
  56174. cursor: "auto"
  56175. };
  56176. });
  56177. useLockscreen(toRef(props, "visible"), {
  56178. ns
  56179. });
  56180. return (_ctx, _cache) => {
  56181. return _ctx.visible ? (openBlock(), createElementBlock("div", mergeProps({
  56182. key: 0,
  56183. class: unref(ns).e("mask"),
  56184. style: {
  56185. position: "fixed",
  56186. left: 0,
  56187. right: 0,
  56188. top: 0,
  56189. bottom: 0,
  56190. zIndex: _ctx.zIndex,
  56191. pointerEvents: _ctx.pos && _ctx.targetAreaClickable ? "none" : "auto"
  56192. }
  56193. }, _ctx.$attrs), [
  56194. (openBlock(), createElementBlock("svg", { style: {
  56195. width: "100%",
  56196. height: "100%"
  56197. } }, [
  56198. createElementVNode("path", {
  56199. class: normalizeClass(unref(ns).e("hollow")),
  56200. style: normalizeStyle(unref(pathStyle)),
  56201. d: unref(path)
  56202. }, null, 14, ["d"])
  56203. ]))
  56204. ], 16)) : createCommentVNode("v-if", true);
  56205. };
  56206. }
  56207. });
  56208. var ElTourMask = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__file", "mask.vue"]]);
  56209. const tourStrategies = ["absolute", "fixed"];
  56210. const tourPlacements = [
  56211. "top-start",
  56212. "top-end",
  56213. "top",
  56214. "bottom-start",
  56215. "bottom-end",
  56216. "bottom",
  56217. "left-start",
  56218. "left-end",
  56219. "left",
  56220. "right-start",
  56221. "right-end",
  56222. "right"
  56223. ];
  56224. const tourContentProps = buildProps({
  56225. placement: {
  56226. type: definePropType(String),
  56227. values: tourPlacements,
  56228. default: "bottom"
  56229. },
  56230. reference: {
  56231. type: definePropType(Object),
  56232. default: null
  56233. },
  56234. strategy: {
  56235. type: definePropType(String),
  56236. values: tourStrategies,
  56237. default: "absolute"
  56238. },
  56239. offset: {
  56240. type: Number,
  56241. default: 10
  56242. },
  56243. showArrow: Boolean,
  56244. zIndex: {
  56245. type: Number,
  56246. default: 2001
  56247. }
  56248. });
  56249. const tourContentEmits = {
  56250. close: () => true
  56251. };
  56252. const __default__$9 = defineComponent({
  56253. name: "ElTourContent"
  56254. });
  56255. const _sfc_main$a = /* @__PURE__ */ defineComponent({
  56256. ...__default__$9,
  56257. props: tourContentProps,
  56258. emits: tourContentEmits,
  56259. setup(__props, { emit }) {
  56260. const props = __props;
  56261. const placement = ref(props.placement);
  56262. const strategy = ref(props.strategy);
  56263. const contentRef = ref(null);
  56264. const arrowRef = ref(null);
  56265. watch(() => props.placement, () => {
  56266. placement.value = props.placement;
  56267. });
  56268. const { contentStyle, arrowStyle } = useFloating(toRef(props, "reference"), contentRef, arrowRef, placement, strategy, toRef(props, "offset"), toRef(props, "zIndex"), toRef(props, "showArrow"));
  56269. const side = computed(() => {
  56270. return placement.value.split("-")[0];
  56271. });
  56272. const { ns } = inject(tourKey);
  56273. const onCloseRequested = () => {
  56274. emit("close");
  56275. };
  56276. const onFocusoutPrevented = (event) => {
  56277. if (event.detail.focusReason === "pointer") {
  56278. event.preventDefault();
  56279. }
  56280. };
  56281. return (_ctx, _cache) => {
  56282. return openBlock(), createElementBlock("div", {
  56283. ref_key: "contentRef",
  56284. ref: contentRef,
  56285. style: normalizeStyle(unref(contentStyle)),
  56286. class: normalizeClass(unref(ns).e("content")),
  56287. "data-side": unref(side),
  56288. tabindex: "-1"
  56289. }, [
  56290. createVNode(unref(ElFocusTrap), {
  56291. loop: "",
  56292. trapped: "",
  56293. "focus-start-el": "container",
  56294. "focus-trap-el": contentRef.value || void 0,
  56295. onReleaseRequested: onCloseRequested,
  56296. onFocusoutPrevented
  56297. }, {
  56298. default: withCtx(() => [
  56299. renderSlot(_ctx.$slots, "default")
  56300. ]),
  56301. _: 3
  56302. }, 8, ["focus-trap-el"]),
  56303. _ctx.showArrow ? (openBlock(), createElementBlock("span", {
  56304. key: 0,
  56305. ref_key: "arrowRef",
  56306. ref: arrowRef,
  56307. style: normalizeStyle(unref(arrowStyle)),
  56308. class: normalizeClass(unref(ns).e("arrow"))
  56309. }, null, 6)) : createCommentVNode("v-if", true)
  56310. ], 14, ["data-side"]);
  56311. };
  56312. }
  56313. });
  56314. var ElTourContent = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["__file", "content.vue"]]);
  56315. var ElTourSteps = defineComponent({
  56316. name: "ElTourSteps",
  56317. props: {
  56318. current: {
  56319. type: Number,
  56320. default: 0
  56321. }
  56322. },
  56323. emits: ["update-total"],
  56324. setup(props, { slots, emit }) {
  56325. let cacheTotal = 0;
  56326. return () => {
  56327. var _a, _b;
  56328. const children = (_a = slots.default) == null ? void 0 : _a.call(slots);
  56329. const result = [];
  56330. let total = 0;
  56331. function filterSteps(children2) {
  56332. if (!isArray$1(children2))
  56333. return;
  56334. children2.forEach((item) => {
  56335. var _a2;
  56336. const name = (_a2 = (item == null ? void 0 : item.type) || {}) == null ? void 0 : _a2.name;
  56337. if (name === "ElTourStep") {
  56338. result.push(item);
  56339. total += 1;
  56340. }
  56341. });
  56342. }
  56343. if (children.length) {
  56344. filterSteps(flattedChildren((_b = children[0]) == null ? void 0 : _b.children));
  56345. }
  56346. if (cacheTotal !== total) {
  56347. cacheTotal = total;
  56348. emit("update-total", total);
  56349. }
  56350. if (result.length) {
  56351. return result[props.current];
  56352. }
  56353. return null;
  56354. };
  56355. }
  56356. });
  56357. const tourProps = buildProps({
  56358. modelValue: Boolean,
  56359. current: {
  56360. type: Number,
  56361. default: 0
  56362. },
  56363. showArrow: {
  56364. type: Boolean,
  56365. default: true
  56366. },
  56367. showClose: {
  56368. type: Boolean,
  56369. default: true
  56370. },
  56371. closeIcon: {
  56372. type: iconPropType
  56373. },
  56374. placement: tourContentProps.placement,
  56375. contentStyle: {
  56376. type: definePropType([Object])
  56377. },
  56378. mask: {
  56379. type: definePropType([Boolean, Object]),
  56380. default: true
  56381. },
  56382. gap: {
  56383. type: definePropType(Object),
  56384. default: () => ({
  56385. offset: 6,
  56386. radius: 2
  56387. })
  56388. },
  56389. zIndex: {
  56390. type: Number
  56391. },
  56392. scrollIntoViewOptions: {
  56393. type: definePropType([Boolean, Object]),
  56394. default: () => ({
  56395. block: "center"
  56396. })
  56397. },
  56398. type: {
  56399. type: definePropType(String)
  56400. },
  56401. appendTo: {
  56402. type: definePropType([String, Object]),
  56403. default: "body"
  56404. },
  56405. closeOnPressEscape: {
  56406. type: Boolean,
  56407. default: true
  56408. },
  56409. targetAreaClickable: {
  56410. type: Boolean,
  56411. default: true
  56412. }
  56413. });
  56414. const tourEmits = {
  56415. [UPDATE_MODEL_EVENT]: (value) => isBoolean(value),
  56416. ["update:current"]: (current) => isNumber(current),
  56417. close: (current) => isNumber(current),
  56418. finish: () => true,
  56419. change: (current) => isNumber(current)
  56420. };
  56421. const __default__$8 = defineComponent({
  56422. name: "ElTour"
  56423. });
  56424. const _sfc_main$9 = /* @__PURE__ */ defineComponent({
  56425. ...__default__$8,
  56426. props: tourProps,
  56427. emits: tourEmits,
  56428. setup(__props, { emit }) {
  56429. const props = __props;
  56430. const ns = useNamespace("tour");
  56431. const total = ref(0);
  56432. const currentStep = ref();
  56433. const current = useVModel(props, "current", emit, {
  56434. passive: true
  56435. });
  56436. const currentTarget = computed(() => {
  56437. var _a;
  56438. return (_a = currentStep.value) == null ? void 0 : _a.target;
  56439. });
  56440. const kls = computed(() => [
  56441. ns.b(),
  56442. mergedType.value === "primary" ? ns.m("primary") : ""
  56443. ]);
  56444. const mergedPlacement = computed(() => {
  56445. var _a;
  56446. return ((_a = currentStep.value) == null ? void 0 : _a.placement) || props.placement;
  56447. });
  56448. const mergedContentStyle = computed(() => {
  56449. var _a, _b;
  56450. return (_b = (_a = currentStep.value) == null ? void 0 : _a.contentStyle) != null ? _b : props.contentStyle;
  56451. });
  56452. const mergedMask = computed(() => {
  56453. var _a, _b;
  56454. return (_b = (_a = currentStep.value) == null ? void 0 : _a.mask) != null ? _b : props.mask;
  56455. });
  56456. const mergedShowMask = computed(() => !!mergedMask.value && props.modelValue);
  56457. const mergedMaskStyle = computed(() => isBoolean(mergedMask.value) ? void 0 : mergedMask.value);
  56458. const mergedShowArrow = computed(() => {
  56459. var _a, _b;
  56460. return !!currentTarget.value && ((_b = (_a = currentStep.value) == null ? void 0 : _a.showArrow) != null ? _b : props.showArrow);
  56461. });
  56462. const mergedScrollIntoViewOptions = computed(() => {
  56463. var _a, _b;
  56464. return (_b = (_a = currentStep.value) == null ? void 0 : _a.scrollIntoViewOptions) != null ? _b : props.scrollIntoViewOptions;
  56465. });
  56466. const mergedType = computed(() => {
  56467. var _a, _b;
  56468. return (_b = (_a = currentStep.value) == null ? void 0 : _a.type) != null ? _b : props.type;
  56469. });
  56470. const { nextZIndex } = useZIndex();
  56471. const nowZIndex = nextZIndex();
  56472. const mergedZIndex = computed(() => {
  56473. var _a;
  56474. return (_a = props.zIndex) != null ? _a : nowZIndex;
  56475. });
  56476. const { mergedPosInfo: pos, triggerTarget } = useTarget(currentTarget, toRef(props, "modelValue"), toRef(props, "gap"), mergedMask, mergedScrollIntoViewOptions);
  56477. watch(() => props.modelValue, (val) => {
  56478. if (!val) {
  56479. current.value = 0;
  56480. }
  56481. });
  56482. const onEscClose = () => {
  56483. if (props.closeOnPressEscape) {
  56484. emit(UPDATE_MODEL_EVENT, false);
  56485. emit("close", current.value);
  56486. }
  56487. };
  56488. const onUpdateTotal = (val) => {
  56489. total.value = val;
  56490. };
  56491. const slots = useSlots();
  56492. provide(tourKey, {
  56493. currentStep,
  56494. current,
  56495. total,
  56496. showClose: toRef(props, "showClose"),
  56497. closeIcon: toRef(props, "closeIcon"),
  56498. mergedType,
  56499. ns,
  56500. slots,
  56501. updateModelValue(modelValue) {
  56502. emit(UPDATE_MODEL_EVENT, modelValue);
  56503. },
  56504. onClose() {
  56505. emit("close", current.value);
  56506. },
  56507. onFinish() {
  56508. emit("finish");
  56509. },
  56510. onChange() {
  56511. emit(CHANGE_EVENT, current.value);
  56512. }
  56513. });
  56514. return (_ctx, _cache) => {
  56515. return openBlock(), createElementBlock(Fragment, null, [
  56516. createVNode(unref(ElTeleport$1), { to: _ctx.appendTo }, {
  56517. default: withCtx(() => {
  56518. var _a, _b;
  56519. return [
  56520. createElementVNode("div", mergeProps({ class: unref(kls) }, _ctx.$attrs), [
  56521. createVNode(ElTourMask, {
  56522. visible: unref(mergedShowMask),
  56523. fill: (_a = unref(mergedMaskStyle)) == null ? void 0 : _a.color,
  56524. style: normalizeStyle((_b = unref(mergedMaskStyle)) == null ? void 0 : _b.style),
  56525. pos: unref(pos),
  56526. "z-index": unref(mergedZIndex),
  56527. "target-area-clickable": _ctx.targetAreaClickable
  56528. }, null, 8, ["visible", "fill", "style", "pos", "z-index", "target-area-clickable"]),
  56529. _ctx.modelValue ? (openBlock(), createBlock(ElTourContent, {
  56530. key: unref(current),
  56531. reference: unref(triggerTarget),
  56532. placement: unref(mergedPlacement),
  56533. "show-arrow": unref(mergedShowArrow),
  56534. "z-index": unref(mergedZIndex),
  56535. style: normalizeStyle(unref(mergedContentStyle)),
  56536. onClose: onEscClose
  56537. }, {
  56538. default: withCtx(() => [
  56539. createVNode(unref(ElTourSteps), {
  56540. current: unref(current),
  56541. onUpdateTotal
  56542. }, {
  56543. default: withCtx(() => [
  56544. renderSlot(_ctx.$slots, "default")
  56545. ]),
  56546. _: 3
  56547. }, 8, ["current"])
  56548. ]),
  56549. _: 3
  56550. }, 8, ["reference", "placement", "show-arrow", "z-index", "style"])) : createCommentVNode("v-if", true)
  56551. ], 16)
  56552. ];
  56553. }),
  56554. _: 3
  56555. }, 8, ["to"]),
  56556. createCommentVNode(" just for IDE "),
  56557. createCommentVNode("v-if", true)
  56558. ], 64);
  56559. };
  56560. }
  56561. });
  56562. var Tour = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__file", "tour.vue"]]);
  56563. const tourStepProps = buildProps({
  56564. target: {
  56565. type: definePropType([String, Object, Function])
  56566. },
  56567. title: String,
  56568. description: String,
  56569. showClose: {
  56570. type: Boolean,
  56571. default: void 0
  56572. },
  56573. closeIcon: {
  56574. type: iconPropType
  56575. },
  56576. showArrow: {
  56577. type: Boolean,
  56578. default: void 0
  56579. },
  56580. placement: tourContentProps.placement,
  56581. mask: {
  56582. type: definePropType([Boolean, Object]),
  56583. default: void 0
  56584. },
  56585. contentStyle: {
  56586. type: definePropType([Object])
  56587. },
  56588. prevButtonProps: {
  56589. type: definePropType(Object)
  56590. },
  56591. nextButtonProps: {
  56592. type: definePropType(Object)
  56593. },
  56594. scrollIntoViewOptions: {
  56595. type: definePropType([Boolean, Object]),
  56596. default: void 0
  56597. },
  56598. type: {
  56599. type: definePropType(String)
  56600. }
  56601. });
  56602. const tourStepEmits = {
  56603. close: () => true
  56604. };
  56605. const __default__$7 = defineComponent({
  56606. name: "ElTourStep"
  56607. });
  56608. const _sfc_main$8 = /* @__PURE__ */ defineComponent({
  56609. ...__default__$7,
  56610. props: tourStepProps,
  56611. emits: tourStepEmits,
  56612. setup(__props, { emit }) {
  56613. const props = __props;
  56614. const { Close } = CloseComponents;
  56615. const { t } = useLocale();
  56616. const {
  56617. currentStep,
  56618. current,
  56619. total,
  56620. showClose,
  56621. closeIcon,
  56622. mergedType,
  56623. ns,
  56624. slots: tourSlots,
  56625. updateModelValue,
  56626. onClose: tourOnClose,
  56627. onFinish: tourOnFinish,
  56628. onChange
  56629. } = inject(tourKey);
  56630. watch(props, (val) => {
  56631. currentStep.value = val;
  56632. }, {
  56633. immediate: true
  56634. });
  56635. const mergedShowClose = computed(() => {
  56636. var _a;
  56637. return (_a = props.showClose) != null ? _a : showClose.value;
  56638. });
  56639. const mergedCloseIcon = computed(() => {
  56640. var _a, _b;
  56641. return (_b = (_a = props.closeIcon) != null ? _a : closeIcon.value) != null ? _b : Close;
  56642. });
  56643. const filterButtonProps = (btnProps) => {
  56644. if (!btnProps)
  56645. return;
  56646. return omit(btnProps, ["children", "onClick"]);
  56647. };
  56648. const onPrev = () => {
  56649. var _a, _b;
  56650. current.value -= 1;
  56651. if ((_a = props.prevButtonProps) == null ? void 0 : _a.onClick) {
  56652. (_b = props.prevButtonProps) == null ? void 0 : _b.onClick();
  56653. }
  56654. onChange();
  56655. };
  56656. const onNext = () => {
  56657. var _a;
  56658. if (current.value >= total.value - 1) {
  56659. onFinish();
  56660. } else {
  56661. current.value += 1;
  56662. }
  56663. if ((_a = props.nextButtonProps) == null ? void 0 : _a.onClick) {
  56664. props.nextButtonProps.onClick();
  56665. }
  56666. onChange();
  56667. };
  56668. const onFinish = () => {
  56669. onClose();
  56670. tourOnFinish();
  56671. };
  56672. const onClose = () => {
  56673. updateModelValue(false);
  56674. tourOnClose();
  56675. emit("close");
  56676. };
  56677. return (_ctx, _cache) => {
  56678. return openBlock(), createElementBlock(Fragment, null, [
  56679. unref(mergedShowClose) ? (openBlock(), createElementBlock("button", {
  56680. key: 0,
  56681. "aria-label": "Close",
  56682. class: normalizeClass(unref(ns).e("closebtn")),
  56683. type: "button",
  56684. onClick: onClose
  56685. }, [
  56686. createVNode(unref(ElIcon), {
  56687. class: normalizeClass(unref(ns).e("close"))
  56688. }, {
  56689. default: withCtx(() => [
  56690. (openBlock(), createBlock(resolveDynamicComponent(unref(mergedCloseIcon))))
  56691. ]),
  56692. _: 1
  56693. }, 8, ["class"])
  56694. ], 2)) : createCommentVNode("v-if", true),
  56695. createElementVNode("header", {
  56696. class: normalizeClass([unref(ns).e("header"), { "show-close": unref(showClose) }])
  56697. }, [
  56698. renderSlot(_ctx.$slots, "header", {}, () => [
  56699. createElementVNode("span", {
  56700. role: "heading",
  56701. class: normalizeClass(unref(ns).e("title"))
  56702. }, toDisplayString(_ctx.title), 3)
  56703. ])
  56704. ], 2),
  56705. createElementVNode("div", {
  56706. class: normalizeClass(unref(ns).e("body"))
  56707. }, [
  56708. renderSlot(_ctx.$slots, "default", {}, () => [
  56709. createElementVNode("span", null, toDisplayString(_ctx.description), 1)
  56710. ])
  56711. ], 2),
  56712. createElementVNode("footer", {
  56713. class: normalizeClass(unref(ns).e("footer"))
  56714. }, [
  56715. createElementVNode("div", {
  56716. class: normalizeClass(unref(ns).b("indicators"))
  56717. }, [
  56718. unref(tourSlots).indicators ? (openBlock(), createBlock(resolveDynamicComponent(unref(tourSlots).indicators), {
  56719. key: 0,
  56720. current: unref(current),
  56721. total: unref(total)
  56722. }, null, 8, ["current", "total"])) : (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(unref(total), (item, index) => {
  56723. return openBlock(), createElementBlock("span", {
  56724. key: item,
  56725. class: normalizeClass([unref(ns).b("indicator"), index === unref(current) ? "is-active" : ""])
  56726. }, null, 2);
  56727. }), 128))
  56728. ], 2),
  56729. createElementVNode("div", {
  56730. class: normalizeClass(unref(ns).b("buttons"))
  56731. }, [
  56732. unref(current) > 0 ? (openBlock(), createBlock(unref(ElButton), mergeProps({
  56733. key: 0,
  56734. size: "small",
  56735. type: unref(mergedType)
  56736. }, filterButtonProps(_ctx.prevButtonProps), { onClick: onPrev }), {
  56737. default: withCtx(() => {
  56738. var _a, _b;
  56739. return [
  56740. createTextVNode(toDisplayString((_b = (_a = _ctx.prevButtonProps) == null ? void 0 : _a.children) != null ? _b : unref(t)("el.tour.previous")), 1)
  56741. ];
  56742. }),
  56743. _: 1
  56744. }, 16, ["type"])) : createCommentVNode("v-if", true),
  56745. unref(current) <= unref(total) - 1 ? (openBlock(), createBlock(unref(ElButton), mergeProps({
  56746. key: 1,
  56747. size: "small",
  56748. type: unref(mergedType) === "primary" ? "default" : "primary"
  56749. }, filterButtonProps(_ctx.nextButtonProps), { onClick: onNext }), {
  56750. default: withCtx(() => {
  56751. var _a, _b;
  56752. return [
  56753. createTextVNode(toDisplayString((_b = (_a = _ctx.nextButtonProps) == null ? void 0 : _a.children) != null ? _b : unref(current) === unref(total) - 1 ? unref(t)("el.tour.finish") : unref(t)("el.tour.next")), 1)
  56754. ];
  56755. }),
  56756. _: 1
  56757. }, 16, ["type"])) : createCommentVNode("v-if", true)
  56758. ], 2)
  56759. ], 2)
  56760. ], 64);
  56761. };
  56762. }
  56763. });
  56764. var TourStep = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__file", "step.vue"]]);
  56765. const ElTour = withInstall(Tour, {
  56766. TourStep
  56767. });
  56768. const ElTourStep = withNoopInstall(TourStep);
  56769. const anchorProps = buildProps({
  56770. container: {
  56771. type: definePropType([
  56772. String,
  56773. Object
  56774. ])
  56775. },
  56776. offset: {
  56777. type: Number,
  56778. default: 0
  56779. },
  56780. bound: {
  56781. type: Number,
  56782. default: 15
  56783. },
  56784. duration: {
  56785. type: Number,
  56786. default: 300
  56787. },
  56788. marker: {
  56789. type: Boolean,
  56790. default: true
  56791. },
  56792. type: {
  56793. type: definePropType(String),
  56794. default: "default"
  56795. },
  56796. direction: {
  56797. type: definePropType(String),
  56798. default: "vertical"
  56799. },
  56800. selectScrollTop: {
  56801. type: Boolean,
  56802. default: false
  56803. }
  56804. });
  56805. const anchorEmits = {
  56806. change: (href) => isString$1(href),
  56807. click: (e, href) => e instanceof MouseEvent && (isString$1(href) || isUndefined(href))
  56808. };
  56809. const anchorKey = Symbol("anchor");
  56810. const __default__$6 = defineComponent({
  56811. name: "ElAnchor"
  56812. });
  56813. const _sfc_main$7 = /* @__PURE__ */ defineComponent({
  56814. ...__default__$6,
  56815. props: anchorProps,
  56816. emits: anchorEmits,
  56817. setup(__props, { expose, emit }) {
  56818. const props = __props;
  56819. const currentAnchor = ref("");
  56820. const anchorRef = ref(null);
  56821. const markerRef = ref(null);
  56822. const containerEl = ref();
  56823. const links = {};
  56824. let isScrolling = false;
  56825. let currentScrollTop = 0;
  56826. const ns = useNamespace("anchor");
  56827. const cls = computed(() => [
  56828. ns.b(),
  56829. props.type === "underline" ? ns.m("underline") : "",
  56830. ns.m(props.direction)
  56831. ]);
  56832. const addLink = (state) => {
  56833. links[state.href] = state.el;
  56834. };
  56835. const removeLink = (href) => {
  56836. delete links[href];
  56837. };
  56838. const setCurrentAnchor = (href) => {
  56839. const activeHref = currentAnchor.value;
  56840. if (activeHref !== href) {
  56841. currentAnchor.value = href;
  56842. emit(CHANGE_EVENT, href);
  56843. }
  56844. };
  56845. let clearAnimate = null;
  56846. const scrollToAnchor = (href) => {
  56847. if (!containerEl.value)
  56848. return;
  56849. const target = getElement(href);
  56850. if (!target)
  56851. return;
  56852. if (clearAnimate)
  56853. clearAnimate();
  56854. isScrolling = true;
  56855. const scrollEle = getScrollElement(target, containerEl.value);
  56856. const distance = getOffsetTopDistance(target, scrollEle);
  56857. const max = scrollEle.scrollHeight - scrollEle.clientHeight;
  56858. const to = Math.min(distance - props.offset, max);
  56859. clearAnimate = animateScrollTo(containerEl.value, currentScrollTop, to, props.duration, () => {
  56860. setTimeout(() => {
  56861. isScrolling = false;
  56862. }, 20);
  56863. });
  56864. };
  56865. const scrollTo = (href) => {
  56866. if (href) {
  56867. setCurrentAnchor(href);
  56868. scrollToAnchor(href);
  56869. }
  56870. };
  56871. const handleClick = (e, href) => {
  56872. emit("click", e, href);
  56873. scrollTo(href);
  56874. };
  56875. const handleScroll = throttleByRaf(() => {
  56876. if (containerEl.value) {
  56877. currentScrollTop = getScrollTop(containerEl.value);
  56878. }
  56879. const currentHref = getCurrentHref();
  56880. if (isScrolling || isUndefined(currentHref))
  56881. return;
  56882. setCurrentAnchor(currentHref);
  56883. });
  56884. const getCurrentHref = () => {
  56885. if (!containerEl.value)
  56886. return;
  56887. const scrollTop = getScrollTop(containerEl.value);
  56888. const anchorTopList = [];
  56889. for (const href of Object.keys(links)) {
  56890. const target = getElement(href);
  56891. if (!target)
  56892. continue;
  56893. const scrollEle = getScrollElement(target, containerEl.value);
  56894. const distance = getOffsetTopDistance(target, scrollEle);
  56895. anchorTopList.push({
  56896. top: distance - props.offset - props.bound,
  56897. href
  56898. });
  56899. }
  56900. anchorTopList.sort((prev, next) => prev.top - next.top);
  56901. for (let i = 0; i < anchorTopList.length; i++) {
  56902. const item = anchorTopList[i];
  56903. const next = anchorTopList[i + 1];
  56904. if (i === 0 && scrollTop === 0) {
  56905. return props.selectScrollTop ? item.href : "";
  56906. }
  56907. if (item.top <= scrollTop && (!next || next.top > scrollTop)) {
  56908. return item.href;
  56909. }
  56910. }
  56911. };
  56912. const getContainer = () => {
  56913. const el = getElement(props.container);
  56914. if (!el || isWindow$1(el)) {
  56915. containerEl.value = window;
  56916. } else {
  56917. containerEl.value = el;
  56918. }
  56919. };
  56920. useEventListener(containerEl, "scroll", handleScroll);
  56921. const markerStyle = computed(() => {
  56922. if (!anchorRef.value || !markerRef.value || !currentAnchor.value)
  56923. return {};
  56924. const currentLinkEl = links[currentAnchor.value];
  56925. if (!currentLinkEl)
  56926. return {};
  56927. const anchorRect = anchorRef.value.getBoundingClientRect();
  56928. const markerRect = markerRef.value.getBoundingClientRect();
  56929. const linkRect = currentLinkEl.getBoundingClientRect();
  56930. if (props.direction === "horizontal") {
  56931. const left = linkRect.left - anchorRect.left;
  56932. return {
  56933. left: `${left}px`,
  56934. width: `${linkRect.width}px`,
  56935. opacity: 1
  56936. };
  56937. } else {
  56938. const top = linkRect.top - anchorRect.top + (linkRect.height - markerRect.height) / 2;
  56939. return {
  56940. top: `${top}px`,
  56941. opacity: 1
  56942. };
  56943. }
  56944. });
  56945. onMounted(() => {
  56946. getContainer();
  56947. const hash = decodeURIComponent(window.location.hash);
  56948. const target = getElement(hash);
  56949. if (target) {
  56950. scrollTo(hash);
  56951. } else {
  56952. handleScroll();
  56953. }
  56954. });
  56955. watch(() => props.container, () => {
  56956. getContainer();
  56957. });
  56958. provide(anchorKey, {
  56959. ns,
  56960. direction: props.direction,
  56961. currentAnchor,
  56962. addLink,
  56963. removeLink,
  56964. handleClick
  56965. });
  56966. expose({
  56967. scrollTo
  56968. });
  56969. return (_ctx, _cache) => {
  56970. return openBlock(), createElementBlock("div", {
  56971. ref_key: "anchorRef",
  56972. ref: anchorRef,
  56973. class: normalizeClass(unref(cls))
  56974. }, [
  56975. _ctx.marker ? (openBlock(), createElementBlock("div", {
  56976. key: 0,
  56977. ref_key: "markerRef",
  56978. ref: markerRef,
  56979. class: normalizeClass(unref(ns).e("marker")),
  56980. style: normalizeStyle(unref(markerStyle))
  56981. }, null, 6)) : createCommentVNode("v-if", true),
  56982. createElementVNode("div", {
  56983. class: normalizeClass(unref(ns).e("list"))
  56984. }, [
  56985. renderSlot(_ctx.$slots, "default")
  56986. ], 2)
  56987. ], 2);
  56988. };
  56989. }
  56990. });
  56991. var Anchor = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__file", "anchor.vue"]]);
  56992. const anchorLinkProps = buildProps({
  56993. title: String,
  56994. href: String
  56995. });
  56996. const __default__$5 = defineComponent({
  56997. name: "ElAnchorLink"
  56998. });
  56999. const _sfc_main$6 = /* @__PURE__ */ defineComponent({
  57000. ...__default__$5,
  57001. props: anchorLinkProps,
  57002. setup(__props) {
  57003. const props = __props;
  57004. const linkRef = ref(null);
  57005. const {
  57006. ns,
  57007. direction,
  57008. currentAnchor,
  57009. addLink,
  57010. removeLink,
  57011. handleClick: contextHandleClick
  57012. } = inject(anchorKey);
  57013. const cls = computed(() => [
  57014. ns.e("link"),
  57015. ns.is("active", currentAnchor.value === props.href)
  57016. ]);
  57017. const handleClick = (e) => {
  57018. contextHandleClick(e, props.href);
  57019. };
  57020. watch(() => props.href, (val, oldVal) => {
  57021. nextTick(() => {
  57022. if (oldVal)
  57023. removeLink(oldVal);
  57024. if (val) {
  57025. addLink({
  57026. href: val,
  57027. el: linkRef.value
  57028. });
  57029. }
  57030. });
  57031. });
  57032. onMounted(() => {
  57033. const { href } = props;
  57034. if (href) {
  57035. addLink({
  57036. href,
  57037. el: linkRef.value
  57038. });
  57039. }
  57040. });
  57041. onBeforeUnmount(() => {
  57042. const { href } = props;
  57043. if (href) {
  57044. removeLink(href);
  57045. }
  57046. });
  57047. return (_ctx, _cache) => {
  57048. return openBlock(), createElementBlock("div", {
  57049. class: normalizeClass(unref(ns).e("item"))
  57050. }, [
  57051. createElementVNode("a", {
  57052. ref_key: "linkRef",
  57053. ref: linkRef,
  57054. class: normalizeClass(unref(cls)),
  57055. href: _ctx.href,
  57056. onClick: handleClick
  57057. }, [
  57058. renderSlot(_ctx.$slots, "default", {}, () => [
  57059. createTextVNode(toDisplayString(_ctx.title), 1)
  57060. ])
  57061. ], 10, ["href"]),
  57062. _ctx.$slots["sub-link"] && unref(direction) === "vertical" ? (openBlock(), createElementBlock("div", {
  57063. key: 0,
  57064. class: normalizeClass(unref(ns).e("list"))
  57065. }, [
  57066. renderSlot(_ctx.$slots, "sub-link")
  57067. ], 2)) : createCommentVNode("v-if", true)
  57068. ], 2);
  57069. };
  57070. }
  57071. });
  57072. var AnchorLink = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__file", "anchor-link.vue"]]);
  57073. const ElAnchor = withInstall(Anchor, {
  57074. AnchorLink
  57075. });
  57076. const ElAnchorLink = withNoopInstall(AnchorLink);
  57077. const defaultProps = {
  57078. label: "label",
  57079. value: "value",
  57080. disabled: "disabled"
  57081. };
  57082. const segmentedProps = buildProps({
  57083. direction: {
  57084. type: definePropType(String),
  57085. default: "horizontal"
  57086. },
  57087. options: {
  57088. type: definePropType(Array),
  57089. default: () => []
  57090. },
  57091. modelValue: {
  57092. type: [String, Number, Boolean],
  57093. default: void 0
  57094. },
  57095. props: {
  57096. type: definePropType(Object),
  57097. default: () => defaultProps
  57098. },
  57099. block: Boolean,
  57100. size: useSizeProp,
  57101. disabled: Boolean,
  57102. validateEvent: {
  57103. type: Boolean,
  57104. default: true
  57105. },
  57106. id: String,
  57107. name: String,
  57108. ...useAriaProps(["ariaLabel"])
  57109. });
  57110. const segmentedEmits = {
  57111. [UPDATE_MODEL_EVENT]: (val) => isString$1(val) || isNumber(val) || isBoolean(val),
  57112. [CHANGE_EVENT]: (val) => isString$1(val) || isNumber(val) || isBoolean(val)
  57113. };
  57114. const __default__$4 = defineComponent({
  57115. name: "ElSegmented"
  57116. });
  57117. const _sfc_main$5 = /* @__PURE__ */ defineComponent({
  57118. ...__default__$4,
  57119. props: segmentedProps,
  57120. emits: segmentedEmits,
  57121. setup(__props, { emit }) {
  57122. const props = __props;
  57123. const ns = useNamespace("segmented");
  57124. const segmentedId = useId();
  57125. const segmentedSize = useFormSize();
  57126. const _disabled = useFormDisabled();
  57127. const { formItem } = useFormItem();
  57128. const { inputId, isLabeledByFormItem } = useFormItemInputId(props, {
  57129. formItemContext: formItem
  57130. });
  57131. const segmentedRef = ref(null);
  57132. const activeElement = useActiveElement();
  57133. const state = reactive({
  57134. isInit: false,
  57135. width: 0,
  57136. height: 0,
  57137. translateX: 0,
  57138. translateY: 0,
  57139. focusVisible: false
  57140. });
  57141. const handleChange = (item) => {
  57142. const value = getValue(item);
  57143. emit(UPDATE_MODEL_EVENT, value);
  57144. emit(CHANGE_EVENT, value);
  57145. };
  57146. const aliasProps = computed(() => ({ ...defaultProps, ...props.props }));
  57147. const getValue = (item) => {
  57148. return isObject$1(item) ? item[aliasProps.value.value] : item;
  57149. };
  57150. const getLabel = (item) => {
  57151. return isObject$1(item) ? item[aliasProps.value.label] : item;
  57152. };
  57153. const getDisabled = (item) => {
  57154. return !!(_disabled.value || (isObject$1(item) ? item[aliasProps.value.disabled] : false));
  57155. };
  57156. const getSelected = (item) => {
  57157. return props.modelValue === getValue(item);
  57158. };
  57159. const getOption = (value) => {
  57160. return props.options.find((item) => getValue(item) === value);
  57161. };
  57162. const getItemCls = (item) => {
  57163. return [
  57164. ns.e("item"),
  57165. ns.is("selected", getSelected(item)),
  57166. ns.is("disabled", getDisabled(item))
  57167. ];
  57168. };
  57169. const updateSelect = () => {
  57170. if (!segmentedRef.value)
  57171. return;
  57172. const selectedItem = segmentedRef.value.querySelector(".is-selected");
  57173. const selectedItemInput = segmentedRef.value.querySelector(".is-selected input");
  57174. if (!selectedItem || !selectedItemInput) {
  57175. state.width = 0;
  57176. state.height = 0;
  57177. state.translateX = 0;
  57178. state.translateY = 0;
  57179. state.focusVisible = false;
  57180. return;
  57181. }
  57182. const rect = selectedItem.getBoundingClientRect();
  57183. state.isInit = true;
  57184. if (props.direction === "vertical") {
  57185. state.height = rect.height;
  57186. state.translateY = selectedItem.offsetTop;
  57187. } else {
  57188. state.width = rect.width;
  57189. state.translateX = selectedItem.offsetLeft;
  57190. }
  57191. try {
  57192. state.focusVisible = selectedItemInput.matches(":focus-visible");
  57193. } catch (e) {
  57194. }
  57195. };
  57196. const segmentedCls = computed(() => [
  57197. ns.b(),
  57198. ns.m(segmentedSize.value),
  57199. ns.is("block", props.block)
  57200. ]);
  57201. const selectedStyle = computed(() => ({
  57202. width: props.direction === "vertical" ? "100%" : `${state.width}px`,
  57203. height: props.direction === "vertical" ? `${state.height}px` : "100%",
  57204. transform: props.direction === "vertical" ? `translateY(${state.translateY}px)` : `translateX(${state.translateX}px)`,
  57205. display: state.isInit ? "block" : "none"
  57206. }));
  57207. const selectedCls = computed(() => [
  57208. ns.e("item-selected"),
  57209. ns.is("disabled", getDisabled(getOption(props.modelValue))),
  57210. ns.is("focus-visible", state.focusVisible)
  57211. ]);
  57212. const name = computed(() => {
  57213. return props.name || segmentedId.value;
  57214. });
  57215. useResizeObserver(segmentedRef, updateSelect);
  57216. watch(activeElement, updateSelect);
  57217. watch(() => props.modelValue, () => {
  57218. var _a;
  57219. updateSelect();
  57220. if (props.validateEvent) {
  57221. (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "change").catch((err) => debugWarn());
  57222. }
  57223. }, {
  57224. flush: "post"
  57225. });
  57226. return (_ctx, _cache) => {
  57227. return _ctx.options.length ? (openBlock(), createElementBlock("div", {
  57228. key: 0,
  57229. id: unref(inputId),
  57230. ref_key: "segmentedRef",
  57231. ref: segmentedRef,
  57232. class: normalizeClass(unref(segmentedCls)),
  57233. role: "radiogroup",
  57234. "aria-label": !unref(isLabeledByFormItem) ? _ctx.ariaLabel || "segmented" : void 0,
  57235. "aria-labelledby": unref(isLabeledByFormItem) ? unref(formItem).labelId : void 0
  57236. }, [
  57237. createElementVNode("div", {
  57238. class: normalizeClass([unref(ns).e("group"), unref(ns).m(props.direction)])
  57239. }, [
  57240. createElementVNode("div", {
  57241. style: normalizeStyle(unref(selectedStyle)),
  57242. class: normalizeClass(unref(selectedCls))
  57243. }, null, 6),
  57244. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.options, (item, index) => {
  57245. return openBlock(), createElementBlock("label", {
  57246. key: index,
  57247. class: normalizeClass(getItemCls(item))
  57248. }, [
  57249. createElementVNode("input", {
  57250. class: normalizeClass(unref(ns).e("item-input")),
  57251. type: "radio",
  57252. name: unref(name),
  57253. disabled: getDisabled(item),
  57254. checked: getSelected(item),
  57255. onChange: ($event) => handleChange(item)
  57256. }, null, 42, ["name", "disabled", "checked", "onChange"]),
  57257. createElementVNode("div", {
  57258. class: normalizeClass(unref(ns).e("item-label"))
  57259. }, [
  57260. renderSlot(_ctx.$slots, "default", { item }, () => [
  57261. createTextVNode(toDisplayString(getLabel(item)), 1)
  57262. ])
  57263. ], 2)
  57264. ], 2);
  57265. }), 128))
  57266. ], 2)
  57267. ], 10, ["id", "aria-label", "aria-labelledby"])) : createCommentVNode("v-if", true);
  57268. };
  57269. }
  57270. });
  57271. var Segmented = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__file", "segmented.vue"]]);
  57272. const ElSegmented = withInstall(Segmented);
  57273. const filterOption = (pattern, option) => {
  57274. const lowerCase = pattern.toLowerCase();
  57275. const label = option.label || option.value;
  57276. return label.toLowerCase().includes(lowerCase);
  57277. };
  57278. const getMentionCtx = (inputEl, prefix, split) => {
  57279. const { selectionEnd } = inputEl;
  57280. if (selectionEnd === null)
  57281. return;
  57282. const inputValue = inputEl.value;
  57283. const prefixArray = castArray$1(prefix);
  57284. let splitIndex = -1;
  57285. let mentionCtx;
  57286. for (let i = selectionEnd - 1; i >= 0; --i) {
  57287. const char = inputValue[i];
  57288. if (char === split || char === "\n" || char === "\r") {
  57289. splitIndex = i;
  57290. continue;
  57291. }
  57292. if (prefixArray.includes(char)) {
  57293. const end = splitIndex === -1 ? selectionEnd : splitIndex;
  57294. const pattern = inputValue.slice(i + 1, end);
  57295. mentionCtx = {
  57296. pattern,
  57297. start: i + 1,
  57298. end,
  57299. prefix: char,
  57300. prefixIndex: i,
  57301. splitIndex,
  57302. selectionEnd
  57303. };
  57304. break;
  57305. }
  57306. }
  57307. return mentionCtx;
  57308. };
  57309. const getCursorPosition = (element, options = {
  57310. debug: false,
  57311. useSelectionEnd: false
  57312. }) => {
  57313. const selectionStart = element.selectionStart !== null ? element.selectionStart : 0;
  57314. const selectionEnd = element.selectionEnd !== null ? element.selectionEnd : 0;
  57315. const position = options.useSelectionEnd ? selectionEnd : selectionStart;
  57316. const properties = [
  57317. "direction",
  57318. "boxSizing",
  57319. "width",
  57320. "height",
  57321. "overflowX",
  57322. "overflowY",
  57323. "borderTopWidth",
  57324. "borderRightWidth",
  57325. "borderBottomWidth",
  57326. "borderLeftWidth",
  57327. "borderStyle",
  57328. "paddingTop",
  57329. "paddingRight",
  57330. "paddingBottom",
  57331. "paddingLeft",
  57332. "fontStyle",
  57333. "fontVariant",
  57334. "fontWeight",
  57335. "fontStretch",
  57336. "fontSize",
  57337. "fontSizeAdjust",
  57338. "lineHeight",
  57339. "fontFamily",
  57340. "textAlign",
  57341. "textTransform",
  57342. "textIndent",
  57343. "textDecoration",
  57344. "letterSpacing",
  57345. "wordSpacing",
  57346. "tabSize",
  57347. "MozTabSize"
  57348. ];
  57349. if (options.debug) {
  57350. const el = document.querySelector("#input-textarea-caret-position-mirror-div");
  57351. if (el == null ? void 0 : el.parentNode)
  57352. el.parentNode.removeChild(el);
  57353. }
  57354. const div = document.createElement("div");
  57355. div.id = "input-textarea-caret-position-mirror-div";
  57356. document.body.appendChild(div);
  57357. const style = div.style;
  57358. const computed = window.getComputedStyle(element);
  57359. const isInput = element.nodeName === "INPUT";
  57360. style.whiteSpace = isInput ? "nowrap" : "pre-wrap";
  57361. if (!isInput)
  57362. style.wordWrap = "break-word";
  57363. style.position = "absolute";
  57364. if (!options.debug)
  57365. style.visibility = "hidden";
  57366. properties.forEach((prop) => {
  57367. if (isInput && prop === "lineHeight") {
  57368. if (computed.boxSizing === "border-box") {
  57369. const height = Number.parseInt(computed.height);
  57370. const outerHeight = Number.parseInt(computed.paddingTop) + Number.parseInt(computed.paddingBottom) + Number.parseInt(computed.borderTopWidth) + Number.parseInt(computed.borderBottomWidth);
  57371. const targetHeight = outerHeight + Number.parseInt(computed.lineHeight);
  57372. if (height > targetHeight) {
  57373. style.lineHeight = `${height - outerHeight}px`;
  57374. } else if (height === targetHeight) {
  57375. style.lineHeight = computed.lineHeight;
  57376. } else {
  57377. style.lineHeight = "0";
  57378. }
  57379. } else {
  57380. style.lineHeight = computed.height;
  57381. }
  57382. } else {
  57383. style[prop] = computed[prop];
  57384. }
  57385. });
  57386. if (isFirefox()) {
  57387. if (element.scrollHeight > Number.parseInt(computed.height)) {
  57388. style.overflowY = "scroll";
  57389. }
  57390. } else {
  57391. style.overflow = "hidden";
  57392. }
  57393. div.textContent = element.value.slice(0, Math.max(0, position));
  57394. if (isInput && div.textContent) {
  57395. div.textContent = div.textContent.replace(/\s/g, "\xA0");
  57396. }
  57397. const span = document.createElement("span");
  57398. span.textContent = element.value.slice(Math.max(0, position)) || ".";
  57399. span.style.position = "relative";
  57400. span.style.left = `${-element.scrollLeft}px`;
  57401. span.style.top = `${-element.scrollTop}px`;
  57402. div.appendChild(span);
  57403. const relativePosition = {
  57404. top: span.offsetTop + Number.parseInt(computed.borderTopWidth),
  57405. left: span.offsetLeft + Number.parseInt(computed.borderLeftWidth),
  57406. height: Number.parseInt(computed.fontSize) * 1.5
  57407. };
  57408. if (options.debug) {
  57409. span.style.backgroundColor = "#aaa";
  57410. } else {
  57411. document.body.removeChild(div);
  57412. }
  57413. if (relativePosition.left >= element.clientWidth) {
  57414. relativePosition.left = element.clientWidth;
  57415. }
  57416. return relativePosition;
  57417. };
  57418. const mentionProps = buildProps({
  57419. ...inputProps,
  57420. options: {
  57421. type: definePropType(Array),
  57422. default: () => []
  57423. },
  57424. prefix: {
  57425. type: definePropType([String, Array]),
  57426. default: "@",
  57427. validator: (val) => {
  57428. if (isString$1(val))
  57429. return val.length === 1;
  57430. return val.every((v) => isString$1(v) && v.length === 1);
  57431. }
  57432. },
  57433. split: {
  57434. type: String,
  57435. default: " ",
  57436. validator: (val) => val.length === 1
  57437. },
  57438. filterOption: {
  57439. type: definePropType([Boolean, Function]),
  57440. default: () => filterOption,
  57441. validator: (val) => {
  57442. if (val === false)
  57443. return true;
  57444. return isFunction$1(val);
  57445. }
  57446. },
  57447. placement: {
  57448. type: definePropType(String),
  57449. default: "bottom"
  57450. },
  57451. showArrow: Boolean,
  57452. offset: {
  57453. type: Number,
  57454. default: 0
  57455. },
  57456. whole: Boolean,
  57457. checkIsWhole: {
  57458. type: definePropType(Function)
  57459. },
  57460. modelValue: String,
  57461. loading: Boolean,
  57462. popperClass: {
  57463. type: String,
  57464. default: ""
  57465. },
  57466. popperOptions: {
  57467. type: definePropType(Object),
  57468. default: () => ({})
  57469. }
  57470. });
  57471. const mentionEmits = {
  57472. [UPDATE_MODEL_EVENT]: (value) => isString$1(value),
  57473. search: (pattern, prefix) => isString$1(pattern) && isString$1(prefix),
  57474. select: (option, prefix) => isString$1(option.value) && isString$1(prefix),
  57475. focus: (evt) => evt instanceof FocusEvent,
  57476. blur: (evt) => evt instanceof FocusEvent
  57477. };
  57478. const mentionDropdownProps = buildProps({
  57479. options: {
  57480. type: definePropType(Array),
  57481. default: () => []
  57482. },
  57483. loading: Boolean,
  57484. disabled: Boolean,
  57485. contentId: String,
  57486. ariaLabel: String
  57487. });
  57488. const mentionDropdownEmits = {
  57489. select: (option) => isString$1(option.value)
  57490. };
  57491. const __default__$3 = defineComponent({
  57492. name: "ElMentionDropdown"
  57493. });
  57494. const _sfc_main$4 = /* @__PURE__ */ defineComponent({
  57495. ...__default__$3,
  57496. props: mentionDropdownProps,
  57497. emits: mentionDropdownEmits,
  57498. setup(__props, { expose, emit }) {
  57499. const props = __props;
  57500. const ns = useNamespace("mention");
  57501. const { t } = useLocale();
  57502. const hoveringIndex = ref(-1);
  57503. const scrollbarRef = ref();
  57504. const optionRefs = ref();
  57505. const dropdownRef = ref();
  57506. const optionkls = (item, index) => [
  57507. ns.be("dropdown", "item"),
  57508. ns.is("hovering", hoveringIndex.value === index),
  57509. ns.is("disabled", item.disabled || props.disabled)
  57510. ];
  57511. const handleSelect = (item) => {
  57512. if (item.disabled || props.disabled)
  57513. return;
  57514. emit("select", item);
  57515. };
  57516. const handleMouseEnter = (index) => {
  57517. hoveringIndex.value = index;
  57518. };
  57519. const filteredAllDisabled = computed(() => props.disabled || props.options.every((item) => item.disabled));
  57520. const hoverOption = computed(() => props.options[hoveringIndex.value]);
  57521. const selectHoverOption = () => {
  57522. if (!hoverOption.value)
  57523. return;
  57524. emit("select", hoverOption.value);
  57525. };
  57526. const navigateOptions = (direction) => {
  57527. const { options } = props;
  57528. if (options.length === 0 || filteredAllDisabled.value)
  57529. return;
  57530. if (direction === "next") {
  57531. hoveringIndex.value++;
  57532. if (hoveringIndex.value === options.length) {
  57533. hoveringIndex.value = 0;
  57534. }
  57535. } else if (direction === "prev") {
  57536. hoveringIndex.value--;
  57537. if (hoveringIndex.value < 0) {
  57538. hoveringIndex.value = options.length - 1;
  57539. }
  57540. }
  57541. const option = options[hoveringIndex.value];
  57542. if (option.disabled) {
  57543. navigateOptions(direction);
  57544. return;
  57545. }
  57546. nextTick(() => scrollToOption(option));
  57547. };
  57548. const scrollToOption = (option) => {
  57549. var _a, _b, _c, _d;
  57550. const { options } = props;
  57551. const index = options.findIndex((item) => item.value === option.value);
  57552. const target = (_a = optionRefs.value) == null ? void 0 : _a[index];
  57553. if (target) {
  57554. const menu = (_c = (_b = dropdownRef.value) == null ? void 0 : _b.querySelector) == null ? void 0 : _c.call(_b, `.${ns.be("dropdown", "wrap")}`);
  57555. if (menu) {
  57556. scrollIntoView(menu, target);
  57557. }
  57558. }
  57559. (_d = scrollbarRef.value) == null ? void 0 : _d.handleScroll();
  57560. };
  57561. const resetHoveringIndex = () => {
  57562. if (filteredAllDisabled.value || props.options.length === 0) {
  57563. hoveringIndex.value = -1;
  57564. } else {
  57565. hoveringIndex.value = 0;
  57566. }
  57567. };
  57568. watch(() => props.options, resetHoveringIndex, {
  57569. immediate: true
  57570. });
  57571. expose({
  57572. hoveringIndex,
  57573. navigateOptions,
  57574. selectHoverOption,
  57575. hoverOption
  57576. });
  57577. return (_ctx, _cache) => {
  57578. return openBlock(), createElementBlock("div", {
  57579. ref_key: "dropdownRef",
  57580. ref: dropdownRef,
  57581. class: normalizeClass(unref(ns).b("dropdown"))
  57582. }, [
  57583. _ctx.$slots.header ? (openBlock(), createElementBlock("div", {
  57584. key: 0,
  57585. class: normalizeClass(unref(ns).be("dropdown", "header"))
  57586. }, [
  57587. renderSlot(_ctx.$slots, "header")
  57588. ], 2)) : createCommentVNode("v-if", true),
  57589. withDirectives(createVNode(unref(ElScrollbar), {
  57590. id: _ctx.contentId,
  57591. ref_key: "scrollbarRef",
  57592. ref: scrollbarRef,
  57593. tag: "ul",
  57594. "wrap-class": unref(ns).be("dropdown", "wrap"),
  57595. "view-class": unref(ns).be("dropdown", "list"),
  57596. role: "listbox",
  57597. "aria-label": _ctx.ariaLabel,
  57598. "aria-orientation": "vertical"
  57599. }, {
  57600. default: withCtx(() => [
  57601. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.options, (item, index) => {
  57602. return openBlock(), createElementBlock("li", {
  57603. id: `${_ctx.contentId}-${index}`,
  57604. ref_for: true,
  57605. ref_key: "optionRefs",
  57606. ref: optionRefs,
  57607. key: index,
  57608. class: normalizeClass(optionkls(item, index)),
  57609. role: "option",
  57610. "aria-disabled": item.disabled || _ctx.disabled || void 0,
  57611. "aria-selected": hoveringIndex.value === index,
  57612. onMousemove: ($event) => handleMouseEnter(index),
  57613. onClick: withModifiers(($event) => handleSelect(item), ["stop"])
  57614. }, [
  57615. renderSlot(_ctx.$slots, "label", {
  57616. item,
  57617. index
  57618. }, () => {
  57619. var _a;
  57620. return [
  57621. createElementVNode("span", null, toDisplayString((_a = item.label) != null ? _a : item.value), 1)
  57622. ];
  57623. })
  57624. ], 42, ["id", "aria-disabled", "aria-selected", "onMousemove", "onClick"]);
  57625. }), 128))
  57626. ]),
  57627. _: 3
  57628. }, 8, ["id", "wrap-class", "view-class", "aria-label"]), [
  57629. [vShow, _ctx.options.length > 0 && !_ctx.loading]
  57630. ]),
  57631. _ctx.loading ? (openBlock(), createElementBlock("div", {
  57632. key: 1,
  57633. class: normalizeClass(unref(ns).be("dropdown", "loading"))
  57634. }, [
  57635. renderSlot(_ctx.$slots, "loading", {}, () => [
  57636. createTextVNode(toDisplayString(unref(t)("el.mention.loading")), 1)
  57637. ])
  57638. ], 2)) : createCommentVNode("v-if", true),
  57639. _ctx.$slots.footer ? (openBlock(), createElementBlock("div", {
  57640. key: 2,
  57641. class: normalizeClass(unref(ns).be("dropdown", "footer"))
  57642. }, [
  57643. renderSlot(_ctx.$slots, "footer")
  57644. ], 2)) : createCommentVNode("v-if", true)
  57645. ], 2);
  57646. };
  57647. }
  57648. });
  57649. var ElMentionDropdown = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__file", "mention-dropdown.vue"]]);
  57650. const __default__$2 = defineComponent({
  57651. name: "ElMention",
  57652. inheritAttrs: false
  57653. });
  57654. const _sfc_main$3 = /* @__PURE__ */ defineComponent({
  57655. ...__default__$2,
  57656. props: mentionProps,
  57657. emits: mentionEmits,
  57658. setup(__props, { expose, emit }) {
  57659. const props = __props;
  57660. const passInputProps = computed(() => pick(props, Object.keys(inputProps)));
  57661. const ns = useNamespace("mention");
  57662. const disabled = useFormDisabled();
  57663. const contentId = useId();
  57664. const elInputRef = ref();
  57665. const tooltipRef = ref();
  57666. const dropdownRef = ref();
  57667. const visible = ref(false);
  57668. const cursorStyle = ref();
  57669. const mentionCtx = ref();
  57670. const computedPlacement = computed(() => props.showArrow ? props.placement : `${props.placement}-start`);
  57671. const computedFallbackPlacements = computed(() => props.showArrow ? ["bottom", "top"] : ["bottom-start", "top-start"]);
  57672. const filteredOptions = computed(() => {
  57673. const { filterOption, options } = props;
  57674. if (!mentionCtx.value || !filterOption)
  57675. return options;
  57676. return options.filter((option) => filterOption(mentionCtx.value.pattern, option));
  57677. });
  57678. const dropdownVisible = computed(() => {
  57679. return visible.value && (!!filteredOptions.value.length || props.loading);
  57680. });
  57681. const hoveringId = computed(() => {
  57682. var _a;
  57683. return `${contentId.value}-${(_a = dropdownRef.value) == null ? void 0 : _a.hoveringIndex}`;
  57684. });
  57685. const handleInputChange = (value) => {
  57686. emit(UPDATE_MODEL_EVENT, value);
  57687. syncAfterCursorMove();
  57688. };
  57689. const handleInputKeyDown = (event) => {
  57690. var _a, _b, _c, _d;
  57691. if (!("code" in event) || ((_a = elInputRef.value) == null ? void 0 : _a.isComposing))
  57692. return;
  57693. switch (event.code) {
  57694. case EVENT_CODE.left:
  57695. case EVENT_CODE.right:
  57696. syncAfterCursorMove();
  57697. break;
  57698. case EVENT_CODE.up:
  57699. case EVENT_CODE.down:
  57700. if (!visible.value)
  57701. return;
  57702. event.preventDefault();
  57703. (_b = dropdownRef.value) == null ? void 0 : _b.navigateOptions(event.code === EVENT_CODE.up ? "prev" : "next");
  57704. break;
  57705. case EVENT_CODE.enter:
  57706. case EVENT_CODE.numpadEnter:
  57707. if (!visible.value)
  57708. return;
  57709. event.preventDefault();
  57710. if ((_c = dropdownRef.value) == null ? void 0 : _c.hoverOption) {
  57711. (_d = dropdownRef.value) == null ? void 0 : _d.selectHoverOption();
  57712. } else {
  57713. visible.value = false;
  57714. }
  57715. break;
  57716. case EVENT_CODE.esc:
  57717. if (!visible.value)
  57718. return;
  57719. event.preventDefault();
  57720. visible.value = false;
  57721. break;
  57722. case EVENT_CODE.backspace:
  57723. if (props.whole && mentionCtx.value) {
  57724. const { splitIndex, selectionEnd, pattern, prefixIndex, prefix } = mentionCtx.value;
  57725. const inputEl = getInputEl();
  57726. if (!inputEl)
  57727. return;
  57728. const inputValue = inputEl.value;
  57729. const matchOption = props.options.find((item) => item.value === pattern);
  57730. const isWhole = isFunction$1(props.checkIsWhole) ? props.checkIsWhole(pattern, prefix) : matchOption;
  57731. if (isWhole && splitIndex !== -1 && splitIndex + 1 === selectionEnd) {
  57732. event.preventDefault();
  57733. const newValue = inputValue.slice(0, prefixIndex) + inputValue.slice(splitIndex + 1);
  57734. emit(UPDATE_MODEL_EVENT, newValue);
  57735. const newSelectionEnd = prefixIndex;
  57736. nextTick(() => {
  57737. inputEl.selectionStart = newSelectionEnd;
  57738. inputEl.selectionEnd = newSelectionEnd;
  57739. syncDropdownVisible();
  57740. });
  57741. }
  57742. }
  57743. }
  57744. };
  57745. const { wrapperRef } = useFocusController(elInputRef, {
  57746. beforeFocus() {
  57747. return disabled.value;
  57748. },
  57749. afterFocus() {
  57750. syncAfterCursorMove();
  57751. },
  57752. beforeBlur(event) {
  57753. var _a;
  57754. return (_a = tooltipRef.value) == null ? void 0 : _a.isFocusInsideContent(event);
  57755. },
  57756. afterBlur() {
  57757. visible.value = false;
  57758. }
  57759. });
  57760. const handleInputMouseDown = () => {
  57761. syncAfterCursorMove();
  57762. };
  57763. const handleSelect = (item) => {
  57764. if (!mentionCtx.value)
  57765. return;
  57766. const inputEl = getInputEl();
  57767. if (!inputEl)
  57768. return;
  57769. const inputValue = inputEl.value;
  57770. const { split } = props;
  57771. const newEndPart = inputValue.slice(mentionCtx.value.end);
  57772. const alreadySeparated = newEndPart.startsWith(split);
  57773. const newMiddlePart = `${item.value}${alreadySeparated ? "" : split}`;
  57774. const newValue = inputValue.slice(0, mentionCtx.value.start) + newMiddlePart + newEndPart;
  57775. emit(UPDATE_MODEL_EVENT, newValue);
  57776. emit("select", item, mentionCtx.value.prefix);
  57777. const newSelectionEnd = mentionCtx.value.start + newMiddlePart.length + (alreadySeparated ? 1 : 0);
  57778. nextTick(() => {
  57779. inputEl.selectionStart = newSelectionEnd;
  57780. inputEl.selectionEnd = newSelectionEnd;
  57781. inputEl.focus();
  57782. syncDropdownVisible();
  57783. });
  57784. };
  57785. const getInputEl = () => {
  57786. var _a, _b;
  57787. return props.type === "textarea" ? (_a = elInputRef.value) == null ? void 0 : _a.textarea : (_b = elInputRef.value) == null ? void 0 : _b.input;
  57788. };
  57789. const syncAfterCursorMove = () => {
  57790. setTimeout(() => {
  57791. syncCursor();
  57792. syncDropdownVisible();
  57793. nextTick(() => {
  57794. var _a;
  57795. return (_a = tooltipRef.value) == null ? void 0 : _a.updatePopper();
  57796. });
  57797. }, 0);
  57798. };
  57799. const syncCursor = () => {
  57800. const inputEl = getInputEl();
  57801. if (!inputEl)
  57802. return;
  57803. const caretPosition = getCursorPosition(inputEl);
  57804. const inputRect = inputEl.getBoundingClientRect();
  57805. const elInputRect = elInputRef.value.$el.getBoundingClientRect();
  57806. cursorStyle.value = {
  57807. position: "absolute",
  57808. width: 0,
  57809. height: `${caretPosition.height}px`,
  57810. left: `${caretPosition.left + inputRect.left - elInputRect.left}px`,
  57811. top: `${caretPosition.top + inputRect.top - elInputRect.top}px`
  57812. };
  57813. };
  57814. const syncDropdownVisible = () => {
  57815. const inputEl = getInputEl();
  57816. if (document.activeElement !== inputEl) {
  57817. visible.value = false;
  57818. return;
  57819. }
  57820. const { prefix, split } = props;
  57821. mentionCtx.value = getMentionCtx(inputEl, prefix, split);
  57822. if (mentionCtx.value && mentionCtx.value.splitIndex === -1) {
  57823. visible.value = true;
  57824. emit("search", mentionCtx.value.pattern, mentionCtx.value.prefix);
  57825. return;
  57826. }
  57827. visible.value = false;
  57828. };
  57829. expose({
  57830. input: elInputRef,
  57831. tooltip: tooltipRef,
  57832. dropdownVisible
  57833. });
  57834. return (_ctx, _cache) => {
  57835. return openBlock(), createElementBlock("div", {
  57836. ref_key: "wrapperRef",
  57837. ref: wrapperRef,
  57838. class: normalizeClass(unref(ns).b())
  57839. }, [
  57840. createVNode(unref(ElInput), mergeProps(mergeProps(unref(passInputProps), _ctx.$attrs), {
  57841. ref_key: "elInputRef",
  57842. ref: elInputRef,
  57843. "model-value": _ctx.modelValue,
  57844. disabled: unref(disabled),
  57845. role: unref(dropdownVisible) ? "combobox" : void 0,
  57846. "aria-activedescendant": unref(dropdownVisible) ? unref(hoveringId) || "" : void 0,
  57847. "aria-controls": unref(dropdownVisible) ? unref(contentId) : void 0,
  57848. "aria-expanded": unref(dropdownVisible) || void 0,
  57849. "aria-label": _ctx.ariaLabel,
  57850. "aria-autocomplete": unref(dropdownVisible) ? "none" : void 0,
  57851. "aria-haspopup": unref(dropdownVisible) ? "listbox" : void 0,
  57852. onInput: handleInputChange,
  57853. onKeydown: handleInputKeyDown,
  57854. onMousedown: handleInputMouseDown
  57855. }), createSlots({
  57856. _: 2
  57857. }, [
  57858. renderList(_ctx.$slots, (_, name) => {
  57859. return {
  57860. name,
  57861. fn: withCtx((slotProps) => [
  57862. renderSlot(_ctx.$slots, name, normalizeProps(guardReactiveProps(slotProps)))
  57863. ])
  57864. };
  57865. })
  57866. ]), 1040, ["model-value", "disabled", "role", "aria-activedescendant", "aria-controls", "aria-expanded", "aria-label", "aria-autocomplete", "aria-haspopup"]),
  57867. createVNode(unref(ElTooltip), {
  57868. ref_key: "tooltipRef",
  57869. ref: tooltipRef,
  57870. visible: unref(dropdownVisible),
  57871. "popper-class": [unref(ns).e("popper"), _ctx.popperClass],
  57872. "popper-options": _ctx.popperOptions,
  57873. placement: unref(computedPlacement),
  57874. "fallback-placements": unref(computedFallbackPlacements),
  57875. effect: "light",
  57876. pure: "",
  57877. offset: _ctx.offset,
  57878. "show-arrow": _ctx.showArrow
  57879. }, {
  57880. default: withCtx(() => [
  57881. createElementVNode("div", {
  57882. style: normalizeStyle(cursorStyle.value)
  57883. }, null, 4)
  57884. ]),
  57885. content: withCtx(() => {
  57886. var _a;
  57887. return [
  57888. createVNode(ElMentionDropdown, {
  57889. ref_key: "dropdownRef",
  57890. ref: dropdownRef,
  57891. options: unref(filteredOptions),
  57892. disabled: unref(disabled),
  57893. loading: _ctx.loading,
  57894. "content-id": unref(contentId),
  57895. "aria-label": _ctx.ariaLabel,
  57896. onSelect: handleSelect,
  57897. onClick: withModifiers((_a = elInputRef.value) == null ? void 0 : _a.focus, ["stop"])
  57898. }, createSlots({
  57899. _: 2
  57900. }, [
  57901. renderList(_ctx.$slots, (_, name) => {
  57902. return {
  57903. name,
  57904. fn: withCtx((slotProps) => [
  57905. renderSlot(_ctx.$slots, name, normalizeProps(guardReactiveProps(slotProps)))
  57906. ])
  57907. };
  57908. })
  57909. ]), 1032, ["options", "disabled", "loading", "content-id", "aria-label", "onClick"])
  57910. ];
  57911. }),
  57912. _: 3
  57913. }, 8, ["visible", "popper-class", "popper-options", "placement", "fallback-placements", "offset", "show-arrow"])
  57914. ], 2);
  57915. };
  57916. }
  57917. });
  57918. var Mention = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__file", "mention.vue"]]);
  57919. const ElMention = withInstall(Mention);
  57920. var Components = [
  57921. ElAffix,
  57922. ElAlert,
  57923. ElAutocomplete,
  57924. ElAutoResizer,
  57925. ElAvatar,
  57926. ElBacktop,
  57927. ElBadge,
  57928. ElBreadcrumb,
  57929. ElBreadcrumbItem,
  57930. ElButton,
  57931. ElButtonGroup$1,
  57932. ElCalendar,
  57933. ElCard,
  57934. ElCarousel,
  57935. ElCarouselItem,
  57936. ElCascader,
  57937. ElCascaderPanel,
  57938. ElCheckTag,
  57939. ElCheckbox,
  57940. ElCheckboxButton,
  57941. ElCheckboxGroup$1,
  57942. ElCol,
  57943. ElCollapse,
  57944. ElCollapseItem,
  57945. ElCollapseTransition,
  57946. ElColorPicker,
  57947. ElConfigProvider,
  57948. ElContainer,
  57949. ElAside,
  57950. ElFooter,
  57951. ElHeader,
  57952. ElMain,
  57953. ElDatePicker,
  57954. ElDescriptions,
  57955. ElDescriptionsItem,
  57956. ElDialog,
  57957. ElDivider,
  57958. ElDrawer,
  57959. ElDropdown,
  57960. ElDropdownItem,
  57961. ElDropdownMenu,
  57962. ElEmpty,
  57963. ElForm,
  57964. ElFormItem,
  57965. ElIcon,
  57966. ElImage,
  57967. ElImageViewer,
  57968. ElInput,
  57969. ElInputNumber,
  57970. ElInputTag,
  57971. ElLink,
  57972. ElMenu,
  57973. ElMenuItem,
  57974. ElMenuItemGroup,
  57975. ElSubMenu,
  57976. ElPageHeader,
  57977. ElPagination,
  57978. ElPopconfirm,
  57979. ElPopover,
  57980. ElPopper,
  57981. ElProgress,
  57982. ElRadio,
  57983. ElRadioButton,
  57984. ElRadioGroup,
  57985. ElRate,
  57986. ElResult,
  57987. ElRow,
  57988. ElScrollbar,
  57989. ElSelect,
  57990. ElOption,
  57991. ElOptionGroup,
  57992. ElSelectV2,
  57993. ElSkeleton,
  57994. ElSkeletonItem,
  57995. ElSlider,
  57996. ElSpace,
  57997. ElStatistic,
  57998. ElCountdown,
  57999. ElSteps,
  58000. ElStep,
  58001. ElSwitch,
  58002. ElTable,
  58003. ElTableColumn,
  58004. ElTableV2,
  58005. ElTabs,
  58006. ElTabPane,
  58007. ElTag,
  58008. ElText,
  58009. ElTimePicker,
  58010. ElTimeSelect,
  58011. ElTimeline,
  58012. ElTimelineItem,
  58013. ElTooltip,
  58014. ElTooltipV2,
  58015. ElTransfer,
  58016. ElTree,
  58017. ElTreeSelect,
  58018. ElTreeV2,
  58019. ElUpload,
  58020. ElWatermark,
  58021. ElTour,
  58022. ElTourStep,
  58023. ElAnchor,
  58024. ElAnchorLink,
  58025. ElSegmented,
  58026. ElMention
  58027. ];
  58028. const SCOPE = "ElInfiniteScroll";
  58029. const CHECK_INTERVAL = 50;
  58030. const DEFAULT_DELAY = 200;
  58031. const DEFAULT_DISTANCE = 0;
  58032. const attributes = {
  58033. delay: {
  58034. type: Number,
  58035. default: DEFAULT_DELAY
  58036. },
  58037. distance: {
  58038. type: Number,
  58039. default: DEFAULT_DISTANCE
  58040. },
  58041. disabled: {
  58042. type: Boolean,
  58043. default: false
  58044. },
  58045. immediate: {
  58046. type: Boolean,
  58047. default: true
  58048. }
  58049. };
  58050. const getScrollOptions = (el, instance) => {
  58051. return Object.entries(attributes).reduce((acm, [name, option]) => {
  58052. var _a, _b;
  58053. const { type, default: defaultValue } = option;
  58054. const attrVal = el.getAttribute(`infinite-scroll-${name}`);
  58055. let value = (_b = (_a = instance[attrVal]) != null ? _a : attrVal) != null ? _b : defaultValue;
  58056. value = value === "false" ? false : value;
  58057. value = type(value);
  58058. acm[name] = Number.isNaN(value) ? defaultValue : value;
  58059. return acm;
  58060. }, {});
  58061. };
  58062. const destroyObserver = (el) => {
  58063. const { observer } = el[SCOPE];
  58064. if (observer) {
  58065. observer.disconnect();
  58066. delete el[SCOPE].observer;
  58067. }
  58068. };
  58069. const handleScroll = (el, cb) => {
  58070. const { container, containerEl, instance, observer, lastScrollTop } = el[SCOPE];
  58071. const { disabled, distance } = getScrollOptions(el, instance);
  58072. const { clientHeight, scrollHeight, scrollTop } = containerEl;
  58073. const delta = scrollTop - lastScrollTop;
  58074. el[SCOPE].lastScrollTop = scrollTop;
  58075. if (observer || disabled || delta < 0)
  58076. return;
  58077. let shouldTrigger = false;
  58078. if (container === el) {
  58079. shouldTrigger = scrollHeight - (clientHeight + scrollTop) <= distance;
  58080. } else {
  58081. const { clientTop, scrollHeight: height } = el;
  58082. const offsetTop = getOffsetTopDistance(el, containerEl);
  58083. shouldTrigger = scrollTop + clientHeight >= offsetTop + clientTop + height - distance;
  58084. }
  58085. if (shouldTrigger) {
  58086. cb.call(instance);
  58087. }
  58088. };
  58089. function checkFull(el, cb) {
  58090. const { containerEl, instance } = el[SCOPE];
  58091. const { disabled } = getScrollOptions(el, instance);
  58092. if (disabled || containerEl.clientHeight === 0)
  58093. return;
  58094. if (containerEl.scrollHeight <= containerEl.clientHeight) {
  58095. cb.call(instance);
  58096. } else {
  58097. destroyObserver(el);
  58098. }
  58099. }
  58100. const InfiniteScroll = {
  58101. async mounted(el, binding) {
  58102. const { instance, value: cb } = binding;
  58103. if (!isFunction$1(cb)) {
  58104. throwError(SCOPE, "'v-infinite-scroll' binding value must be a function");
  58105. }
  58106. await nextTick();
  58107. const { delay, immediate } = getScrollOptions(el, instance);
  58108. const container = getScrollContainer(el, true);
  58109. const containerEl = container === window ? document.documentElement : container;
  58110. const onScroll = throttle(handleScroll.bind(null, el, cb), delay);
  58111. if (!container)
  58112. return;
  58113. el[SCOPE] = {
  58114. instance,
  58115. container,
  58116. containerEl,
  58117. delay,
  58118. cb,
  58119. onScroll,
  58120. lastScrollTop: containerEl.scrollTop
  58121. };
  58122. if (immediate) {
  58123. const observer = new MutationObserver(throttle(checkFull.bind(null, el, cb), CHECK_INTERVAL));
  58124. el[SCOPE].observer = observer;
  58125. observer.observe(el, { childList: true, subtree: true });
  58126. checkFull(el, cb);
  58127. }
  58128. container.addEventListener("scroll", onScroll);
  58129. },
  58130. unmounted(el) {
  58131. if (!el[SCOPE])
  58132. return;
  58133. const { container, onScroll } = el[SCOPE];
  58134. container == null ? void 0 : container.removeEventListener("scroll", onScroll);
  58135. destroyObserver(el);
  58136. },
  58137. async updated(el) {
  58138. if (!el[SCOPE]) {
  58139. await nextTick();
  58140. } else {
  58141. const { containerEl, cb, observer } = el[SCOPE];
  58142. if (containerEl.clientHeight && observer) {
  58143. checkFull(el, cb);
  58144. }
  58145. }
  58146. }
  58147. };
  58148. var InfiniteScroll$1 = InfiniteScroll;
  58149. const _InfiniteScroll = InfiniteScroll$1;
  58150. _InfiniteScroll.install = (app) => {
  58151. app.directive("InfiniteScroll", _InfiniteScroll);
  58152. };
  58153. const ElInfiniteScroll = _InfiniteScroll;
  58154. function createLoadingComponent(options) {
  58155. let afterLeaveTimer;
  58156. const afterLeaveFlag = ref(false);
  58157. const data = reactive({
  58158. ...options,
  58159. originalPosition: "",
  58160. originalOverflow: "",
  58161. visible: false
  58162. });
  58163. function setText(text) {
  58164. data.text = text;
  58165. }
  58166. function destroySelf() {
  58167. const target = data.parent;
  58168. const ns = vm.ns;
  58169. if (!target.vLoadingAddClassList) {
  58170. let loadingNumber = target.getAttribute("loading-number");
  58171. loadingNumber = Number.parseInt(loadingNumber) - 1;
  58172. if (!loadingNumber) {
  58173. removeClass(target, ns.bm("parent", "relative"));
  58174. target.removeAttribute("loading-number");
  58175. } else {
  58176. target.setAttribute("loading-number", loadingNumber.toString());
  58177. }
  58178. removeClass(target, ns.bm("parent", "hidden"));
  58179. }
  58180. removeElLoadingChild();
  58181. loadingInstance.unmount();
  58182. }
  58183. function removeElLoadingChild() {
  58184. var _a, _b;
  58185. (_b = (_a = vm.$el) == null ? void 0 : _a.parentNode) == null ? void 0 : _b.removeChild(vm.$el);
  58186. }
  58187. function close() {
  58188. var _a;
  58189. if (options.beforeClose && !options.beforeClose())
  58190. return;
  58191. afterLeaveFlag.value = true;
  58192. clearTimeout(afterLeaveTimer);
  58193. afterLeaveTimer = setTimeout(handleAfterLeave, 400);
  58194. data.visible = false;
  58195. (_a = options.closed) == null ? void 0 : _a.call(options);
  58196. }
  58197. function handleAfterLeave() {
  58198. if (!afterLeaveFlag.value)
  58199. return;
  58200. const target = data.parent;
  58201. afterLeaveFlag.value = false;
  58202. target.vLoadingAddClassList = void 0;
  58203. destroySelf();
  58204. }
  58205. const elLoadingComponent = defineComponent({
  58206. name: "ElLoading",
  58207. setup(_, { expose }) {
  58208. const { ns, zIndex } = useGlobalComponentSettings("loading");
  58209. expose({
  58210. ns,
  58211. zIndex
  58212. });
  58213. return () => {
  58214. const svg = data.spinner || data.svg;
  58215. const spinner = h$1("svg", {
  58216. class: "circular",
  58217. viewBox: data.svgViewBox ? data.svgViewBox : "0 0 50 50",
  58218. ...svg ? { innerHTML: svg } : {}
  58219. }, [
  58220. h$1("circle", {
  58221. class: "path",
  58222. cx: "25",
  58223. cy: "25",
  58224. r: "20",
  58225. fill: "none"
  58226. })
  58227. ]);
  58228. const spinnerText = data.text ? h$1("p", { class: ns.b("text") }, [data.text]) : void 0;
  58229. return h$1(Transition, {
  58230. name: ns.b("fade"),
  58231. onAfterLeave: handleAfterLeave
  58232. }, {
  58233. default: withCtx(() => [
  58234. withDirectives(createVNode("div", {
  58235. style: {
  58236. backgroundColor: data.background || ""
  58237. },
  58238. class: [
  58239. ns.b("mask"),
  58240. data.customClass,
  58241. data.fullscreen ? "is-fullscreen" : ""
  58242. ]
  58243. }, [
  58244. h$1("div", {
  58245. class: ns.b("spinner")
  58246. }, [spinner, spinnerText])
  58247. ]), [[vShow, data.visible]])
  58248. ])
  58249. });
  58250. };
  58251. }
  58252. });
  58253. const loadingInstance = createApp(elLoadingComponent);
  58254. const vm = loadingInstance.mount(document.createElement("div"));
  58255. return {
  58256. ...toRefs(data),
  58257. setText,
  58258. removeElLoadingChild,
  58259. close,
  58260. handleAfterLeave,
  58261. vm,
  58262. get $el() {
  58263. return vm.$el;
  58264. }
  58265. };
  58266. }
  58267. let fullscreenInstance = void 0;
  58268. const Loading = function(options = {}) {
  58269. if (!isClient)
  58270. return void 0;
  58271. const resolved = resolveOptions(options);
  58272. if (resolved.fullscreen && fullscreenInstance) {
  58273. return fullscreenInstance;
  58274. }
  58275. const instance = createLoadingComponent({
  58276. ...resolved,
  58277. closed: () => {
  58278. var _a;
  58279. (_a = resolved.closed) == null ? void 0 : _a.call(resolved);
  58280. if (resolved.fullscreen)
  58281. fullscreenInstance = void 0;
  58282. }
  58283. });
  58284. addStyle(resolved, resolved.parent, instance);
  58285. addClassList(resolved, resolved.parent, instance);
  58286. resolved.parent.vLoadingAddClassList = () => addClassList(resolved, resolved.parent, instance);
  58287. let loadingNumber = resolved.parent.getAttribute("loading-number");
  58288. if (!loadingNumber) {
  58289. loadingNumber = "1";
  58290. } else {
  58291. loadingNumber = `${Number.parseInt(loadingNumber) + 1}`;
  58292. }
  58293. resolved.parent.setAttribute("loading-number", loadingNumber);
  58294. resolved.parent.appendChild(instance.$el);
  58295. nextTick(() => instance.visible.value = resolved.visible);
  58296. if (resolved.fullscreen) {
  58297. fullscreenInstance = instance;
  58298. }
  58299. return instance;
  58300. };
  58301. const resolveOptions = (options) => {
  58302. var _a, _b, _c, _d;
  58303. let target;
  58304. if (isString$1(options.target)) {
  58305. target = (_a = document.querySelector(options.target)) != null ? _a : document.body;
  58306. } else {
  58307. target = options.target || document.body;
  58308. }
  58309. return {
  58310. parent: target === document.body || options.body ? document.body : target,
  58311. background: options.background || "",
  58312. svg: options.svg || "",
  58313. svgViewBox: options.svgViewBox || "",
  58314. spinner: options.spinner || false,
  58315. text: options.text || "",
  58316. fullscreen: target === document.body && ((_b = options.fullscreen) != null ? _b : true),
  58317. lock: (_c = options.lock) != null ? _c : false,
  58318. customClass: options.customClass || "",
  58319. visible: (_d = options.visible) != null ? _d : true,
  58320. beforeClose: options.beforeClose,
  58321. closed: options.closed,
  58322. target
  58323. };
  58324. };
  58325. const addStyle = async (options, parent, instance) => {
  58326. const { nextZIndex } = instance.vm.zIndex || instance.vm._.exposed.zIndex;
  58327. const maskStyle = {};
  58328. if (options.fullscreen) {
  58329. instance.originalPosition.value = getStyle(document.body, "position");
  58330. instance.originalOverflow.value = getStyle(document.body, "overflow");
  58331. maskStyle.zIndex = nextZIndex();
  58332. } else if (options.parent === document.body) {
  58333. instance.originalPosition.value = getStyle(document.body, "position");
  58334. await nextTick();
  58335. for (const property of ["top", "left"]) {
  58336. const scroll = property === "top" ? "scrollTop" : "scrollLeft";
  58337. maskStyle[property] = `${options.target.getBoundingClientRect()[property] + document.body[scroll] + document.documentElement[scroll] - Number.parseInt(getStyle(document.body, `margin-${property}`), 10)}px`;
  58338. }
  58339. for (const property of ["height", "width"]) {
  58340. maskStyle[property] = `${options.target.getBoundingClientRect()[property]}px`;
  58341. }
  58342. } else {
  58343. instance.originalPosition.value = getStyle(parent, "position");
  58344. }
  58345. for (const [key, value] of Object.entries(maskStyle)) {
  58346. instance.$el.style[key] = value;
  58347. }
  58348. };
  58349. const addClassList = (options, parent, instance) => {
  58350. const ns = instance.vm.ns || instance.vm._.exposed.ns;
  58351. if (!["absolute", "fixed", "sticky"].includes(instance.originalPosition.value)) {
  58352. addClass(parent, ns.bm("parent", "relative"));
  58353. } else {
  58354. removeClass(parent, ns.bm("parent", "relative"));
  58355. }
  58356. if (options.fullscreen && options.lock) {
  58357. addClass(parent, ns.bm("parent", "hidden"));
  58358. } else {
  58359. removeClass(parent, ns.bm("parent", "hidden"));
  58360. }
  58361. };
  58362. const INSTANCE_KEY = Symbol("ElLoading");
  58363. const createInstance = (el, binding) => {
  58364. var _a, _b, _c, _d;
  58365. const vm = binding.instance;
  58366. const getBindingProp = (key) => isObject$1(binding.value) ? binding.value[key] : void 0;
  58367. const resolveExpression = (key) => {
  58368. const data = isString$1(key) && (vm == null ? void 0 : vm[key]) || key;
  58369. if (data)
  58370. return ref(data);
  58371. else
  58372. return data;
  58373. };
  58374. const getProp = (name) => resolveExpression(getBindingProp(name) || el.getAttribute(`element-loading-${hyphenate(name)}`));
  58375. const fullscreen = (_a = getBindingProp("fullscreen")) != null ? _a : binding.modifiers.fullscreen;
  58376. const options = {
  58377. text: getProp("text"),
  58378. svg: getProp("svg"),
  58379. svgViewBox: getProp("svgViewBox"),
  58380. spinner: getProp("spinner"),
  58381. background: getProp("background"),
  58382. customClass: getProp("customClass"),
  58383. fullscreen,
  58384. target: (_b = getBindingProp("target")) != null ? _b : fullscreen ? void 0 : el,
  58385. body: (_c = getBindingProp("body")) != null ? _c : binding.modifiers.body,
  58386. lock: (_d = getBindingProp("lock")) != null ? _d : binding.modifiers.lock
  58387. };
  58388. el[INSTANCE_KEY] = {
  58389. options,
  58390. instance: Loading(options)
  58391. };
  58392. };
  58393. const updateOptions = (newOptions, originalOptions) => {
  58394. for (const key of Object.keys(originalOptions)) {
  58395. if (isRef(originalOptions[key]))
  58396. originalOptions[key].value = newOptions[key];
  58397. }
  58398. };
  58399. const vLoading = {
  58400. mounted(el, binding) {
  58401. if (binding.value) {
  58402. createInstance(el, binding);
  58403. }
  58404. },
  58405. updated(el, binding) {
  58406. const instance = el[INSTANCE_KEY];
  58407. if (binding.oldValue !== binding.value) {
  58408. if (binding.value && !binding.oldValue) {
  58409. createInstance(el, binding);
  58410. } else if (binding.value && binding.oldValue) {
  58411. if (isObject$1(binding.value))
  58412. updateOptions(binding.value, instance.options);
  58413. } else {
  58414. instance == null ? void 0 : instance.instance.close();
  58415. }
  58416. }
  58417. },
  58418. unmounted(el) {
  58419. var _a;
  58420. (_a = el[INSTANCE_KEY]) == null ? void 0 : _a.instance.close();
  58421. el[INSTANCE_KEY] = null;
  58422. }
  58423. };
  58424. const ElLoading = {
  58425. install(app) {
  58426. app.directive("loading", vLoading);
  58427. app.config.globalProperties.$loading = Loading;
  58428. },
  58429. directive: vLoading,
  58430. service: Loading
  58431. };
  58432. const messageTypes = ["success", "info", "warning", "error"];
  58433. const messageDefaults = mutable({
  58434. customClass: "",
  58435. dangerouslyUseHTMLString: false,
  58436. duration: 3e3,
  58437. icon: void 0,
  58438. id: "",
  58439. message: "",
  58440. onClose: void 0,
  58441. showClose: false,
  58442. type: "info",
  58443. plain: false,
  58444. offset: 16,
  58445. zIndex: 0,
  58446. grouping: false,
  58447. repeatNum: 1,
  58448. appendTo: isClient ? document.body : void 0
  58449. });
  58450. const messageProps = buildProps({
  58451. customClass: {
  58452. type: String,
  58453. default: messageDefaults.customClass
  58454. },
  58455. dangerouslyUseHTMLString: {
  58456. type: Boolean,
  58457. default: messageDefaults.dangerouslyUseHTMLString
  58458. },
  58459. duration: {
  58460. type: Number,
  58461. default: messageDefaults.duration
  58462. },
  58463. icon: {
  58464. type: iconPropType,
  58465. default: messageDefaults.icon
  58466. },
  58467. id: {
  58468. type: String,
  58469. default: messageDefaults.id
  58470. },
  58471. message: {
  58472. type: definePropType([
  58473. String,
  58474. Object,
  58475. Function
  58476. ]),
  58477. default: messageDefaults.message
  58478. },
  58479. onClose: {
  58480. type: definePropType(Function),
  58481. default: messageDefaults.onClose
  58482. },
  58483. showClose: {
  58484. type: Boolean,
  58485. default: messageDefaults.showClose
  58486. },
  58487. type: {
  58488. type: String,
  58489. values: messageTypes,
  58490. default: messageDefaults.type
  58491. },
  58492. plain: {
  58493. type: Boolean,
  58494. default: messageDefaults.plain
  58495. },
  58496. offset: {
  58497. type: Number,
  58498. default: messageDefaults.offset
  58499. },
  58500. zIndex: {
  58501. type: Number,
  58502. default: messageDefaults.zIndex
  58503. },
  58504. grouping: {
  58505. type: Boolean,
  58506. default: messageDefaults.grouping
  58507. },
  58508. repeatNum: {
  58509. type: Number,
  58510. default: messageDefaults.repeatNum
  58511. }
  58512. });
  58513. const messageEmits = {
  58514. destroy: () => true
  58515. };
  58516. const instances = shallowReactive([]);
  58517. const getInstance = (id) => {
  58518. const idx = instances.findIndex((instance) => instance.id === id);
  58519. const current = instances[idx];
  58520. let prev;
  58521. if (idx > 0) {
  58522. prev = instances[idx - 1];
  58523. }
  58524. return { current, prev };
  58525. };
  58526. const getLastOffset = (id) => {
  58527. const { prev } = getInstance(id);
  58528. if (!prev)
  58529. return 0;
  58530. return prev.vm.exposed.bottom.value;
  58531. };
  58532. const getOffsetOrSpace = (id, offset) => {
  58533. const idx = instances.findIndex((instance) => instance.id === id);
  58534. return idx > 0 ? 16 : offset;
  58535. };
  58536. const __default__$1 = defineComponent({
  58537. name: "ElMessage"
  58538. });
  58539. const _sfc_main$2 = /* @__PURE__ */ defineComponent({
  58540. ...__default__$1,
  58541. props: messageProps,
  58542. emits: messageEmits,
  58543. setup(__props, { expose, emit }) {
  58544. const props = __props;
  58545. const { Close } = TypeComponents;
  58546. const isStartTransition = ref(false);
  58547. const { ns, zIndex } = useGlobalComponentSettings("message");
  58548. const { currentZIndex, nextZIndex } = zIndex;
  58549. const messageRef = ref();
  58550. const visible = ref(false);
  58551. const height = ref(0);
  58552. let stopTimer = void 0;
  58553. const badgeType = computed(() => props.type ? props.type === "error" ? "danger" : props.type : "info");
  58554. const typeClass = computed(() => {
  58555. const type = props.type;
  58556. return { [ns.bm("icon", type)]: type && TypeComponentsMap[type] };
  58557. });
  58558. const iconComponent = computed(() => props.icon || TypeComponentsMap[props.type] || "");
  58559. const lastOffset = computed(() => getLastOffset(props.id));
  58560. const offset = computed(() => getOffsetOrSpace(props.id, props.offset) + lastOffset.value);
  58561. const bottom = computed(() => height.value + offset.value);
  58562. const customStyle = computed(() => ({
  58563. top: `${offset.value}px`,
  58564. zIndex: currentZIndex.value
  58565. }));
  58566. function startTimer() {
  58567. if (props.duration === 0)
  58568. return;
  58569. ({ stop: stopTimer } = useTimeoutFn(() => {
  58570. close();
  58571. }, props.duration));
  58572. }
  58573. function clearTimer() {
  58574. stopTimer == null ? void 0 : stopTimer();
  58575. }
  58576. function close() {
  58577. visible.value = false;
  58578. nextTick(() => {
  58579. var _a;
  58580. if (!isStartTransition.value) {
  58581. (_a = props.onClose) == null ? void 0 : _a.call(props);
  58582. emit("destroy");
  58583. }
  58584. });
  58585. }
  58586. function keydown({ code }) {
  58587. if (code === EVENT_CODE.esc) {
  58588. close();
  58589. }
  58590. }
  58591. onMounted(() => {
  58592. startTimer();
  58593. nextZIndex();
  58594. visible.value = true;
  58595. });
  58596. watch(() => props.repeatNum, () => {
  58597. clearTimer();
  58598. startTimer();
  58599. });
  58600. useEventListener(document, "keydown", keydown);
  58601. useResizeObserver(messageRef, () => {
  58602. height.value = messageRef.value.getBoundingClientRect().height;
  58603. });
  58604. expose({
  58605. visible,
  58606. bottom,
  58607. close
  58608. });
  58609. return (_ctx, _cache) => {
  58610. return openBlock(), createBlock(Transition, {
  58611. name: unref(ns).b("fade"),
  58612. onBeforeEnter: ($event) => isStartTransition.value = true,
  58613. onBeforeLeave: _ctx.onClose,
  58614. onAfterLeave: ($event) => _ctx.$emit("destroy"),
  58615. persisted: ""
  58616. }, {
  58617. default: withCtx(() => [
  58618. withDirectives(createElementVNode("div", {
  58619. id: _ctx.id,
  58620. ref_key: "messageRef",
  58621. ref: messageRef,
  58622. class: normalizeClass([
  58623. unref(ns).b(),
  58624. { [unref(ns).m(_ctx.type)]: _ctx.type },
  58625. unref(ns).is("closable", _ctx.showClose),
  58626. unref(ns).is("plain", _ctx.plain),
  58627. _ctx.customClass
  58628. ]),
  58629. style: normalizeStyle(unref(customStyle)),
  58630. role: "alert",
  58631. onMouseenter: clearTimer,
  58632. onMouseleave: startTimer
  58633. }, [
  58634. _ctx.repeatNum > 1 ? (openBlock(), createBlock(unref(ElBadge), {
  58635. key: 0,
  58636. value: _ctx.repeatNum,
  58637. type: unref(badgeType),
  58638. class: normalizeClass(unref(ns).e("badge"))
  58639. }, null, 8, ["value", "type", "class"])) : createCommentVNode("v-if", true),
  58640. unref(iconComponent) ? (openBlock(), createBlock(unref(ElIcon), {
  58641. key: 1,
  58642. class: normalizeClass([unref(ns).e("icon"), unref(typeClass)])
  58643. }, {
  58644. default: withCtx(() => [
  58645. (openBlock(), createBlock(resolveDynamicComponent(unref(iconComponent))))
  58646. ]),
  58647. _: 1
  58648. }, 8, ["class"])) : createCommentVNode("v-if", true),
  58649. renderSlot(_ctx.$slots, "default", {}, () => [
  58650. !_ctx.dangerouslyUseHTMLString ? (openBlock(), createElementBlock("p", {
  58651. key: 0,
  58652. class: normalizeClass(unref(ns).e("content"))
  58653. }, toDisplayString(_ctx.message), 3)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
  58654. createCommentVNode(" Caution here, message could've been compromised, never use user's input as message "),
  58655. createElementVNode("p", {
  58656. class: normalizeClass(unref(ns).e("content")),
  58657. innerHTML: _ctx.message
  58658. }, null, 10, ["innerHTML"])
  58659. ], 2112))
  58660. ]),
  58661. _ctx.showClose ? (openBlock(), createBlock(unref(ElIcon), {
  58662. key: 2,
  58663. class: normalizeClass(unref(ns).e("closeBtn")),
  58664. onClick: withModifiers(close, ["stop"])
  58665. }, {
  58666. default: withCtx(() => [
  58667. createVNode(unref(Close))
  58668. ]),
  58669. _: 1
  58670. }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true)
  58671. ], 46, ["id"]), [
  58672. [vShow, visible.value]
  58673. ])
  58674. ]),
  58675. _: 3
  58676. }, 8, ["name", "onBeforeEnter", "onBeforeLeave", "onAfterLeave"]);
  58677. };
  58678. }
  58679. });
  58680. var MessageConstructor = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__file", "message.vue"]]);
  58681. let seed$1 = 1;
  58682. const normalizeOptions = (params) => {
  58683. const options = !params || isString$1(params) || isVNode(params) || isFunction$1(params) ? { message: params } : params;
  58684. const normalized = {
  58685. ...messageDefaults,
  58686. ...options
  58687. };
  58688. if (!normalized.appendTo) {
  58689. normalized.appendTo = document.body;
  58690. } else if (isString$1(normalized.appendTo)) {
  58691. let appendTo = document.querySelector(normalized.appendTo);
  58692. if (!isElement$1(appendTo)) {
  58693. appendTo = document.body;
  58694. }
  58695. normalized.appendTo = appendTo;
  58696. }
  58697. if (isBoolean(messageConfig.grouping) && !normalized.grouping) {
  58698. normalized.grouping = messageConfig.grouping;
  58699. }
  58700. if (isNumber(messageConfig.duration) && normalized.duration === 3e3) {
  58701. normalized.duration = messageConfig.duration;
  58702. }
  58703. if (isNumber(messageConfig.offset) && normalized.offset === 16) {
  58704. normalized.offset = messageConfig.offset;
  58705. }
  58706. if (isBoolean(messageConfig.showClose) && !normalized.showClose) {
  58707. normalized.showClose = messageConfig.showClose;
  58708. }
  58709. return normalized;
  58710. };
  58711. const closeMessage = (instance) => {
  58712. const idx = instances.indexOf(instance);
  58713. if (idx === -1)
  58714. return;
  58715. instances.splice(idx, 1);
  58716. const { handler } = instance;
  58717. handler.close();
  58718. };
  58719. const createMessage = ({ appendTo, ...options }, context) => {
  58720. const id = `message_${seed$1++}`;
  58721. const userOnClose = options.onClose;
  58722. const container = document.createElement("div");
  58723. const props = {
  58724. ...options,
  58725. id,
  58726. onClose: () => {
  58727. userOnClose == null ? void 0 : userOnClose();
  58728. closeMessage(instance);
  58729. },
  58730. onDestroy: () => {
  58731. render(null, container);
  58732. }
  58733. };
  58734. const vnode = createVNode(MessageConstructor, props, isFunction$1(props.message) || isVNode(props.message) ? {
  58735. default: isFunction$1(props.message) ? props.message : () => props.message
  58736. } : null);
  58737. vnode.appContext = context || message._context;
  58738. render(vnode, container);
  58739. appendTo.appendChild(container.firstElementChild);
  58740. const vm = vnode.component;
  58741. const handler = {
  58742. close: () => {
  58743. vm.exposed.close();
  58744. }
  58745. };
  58746. const instance = {
  58747. id,
  58748. vnode,
  58749. vm,
  58750. handler,
  58751. props: vnode.component.props
  58752. };
  58753. return instance;
  58754. };
  58755. const message = (options = {}, context) => {
  58756. if (!isClient)
  58757. return { close: () => void 0 };
  58758. const normalized = normalizeOptions(options);
  58759. if (normalized.grouping && instances.length) {
  58760. const instance2 = instances.find(({ vnode: vm }) => {
  58761. var _a;
  58762. return ((_a = vm.props) == null ? void 0 : _a.message) === normalized.message;
  58763. });
  58764. if (instance2) {
  58765. instance2.props.repeatNum += 1;
  58766. instance2.props.type = normalized.type;
  58767. return instance2.handler;
  58768. }
  58769. }
  58770. if (isNumber(messageConfig.max) && instances.length >= messageConfig.max) {
  58771. return { close: () => void 0 };
  58772. }
  58773. const instance = createMessage(normalized, context);
  58774. instances.push(instance);
  58775. return instance.handler;
  58776. };
  58777. messageTypes.forEach((type) => {
  58778. message[type] = (options = {}, appContext) => {
  58779. const normalized = normalizeOptions(options);
  58780. return message({ ...normalized, type }, appContext);
  58781. };
  58782. });
  58783. function closeAll$1(type) {
  58784. const instancesToClose = [...instances];
  58785. for (const instance of instancesToClose) {
  58786. if (!type || type === instance.props.type) {
  58787. instance.handler.close();
  58788. }
  58789. }
  58790. }
  58791. message.closeAll = closeAll$1;
  58792. message._context = null;
  58793. var Message = message;
  58794. const ElMessage = withInstallFunction(Message, "$message");
  58795. const _sfc_main$1 = defineComponent({
  58796. name: "ElMessageBox",
  58797. directives: {
  58798. TrapFocus
  58799. },
  58800. components: {
  58801. ElButton,
  58802. ElFocusTrap,
  58803. ElInput,
  58804. ElOverlay,
  58805. ElIcon,
  58806. ...TypeComponents
  58807. },
  58808. inheritAttrs: false,
  58809. props: {
  58810. buttonSize: {
  58811. type: String,
  58812. validator: isValidComponentSize
  58813. },
  58814. modal: {
  58815. type: Boolean,
  58816. default: true
  58817. },
  58818. lockScroll: {
  58819. type: Boolean,
  58820. default: true
  58821. },
  58822. showClose: {
  58823. type: Boolean,
  58824. default: true
  58825. },
  58826. closeOnClickModal: {
  58827. type: Boolean,
  58828. default: true
  58829. },
  58830. closeOnPressEscape: {
  58831. type: Boolean,
  58832. default: true
  58833. },
  58834. closeOnHashChange: {
  58835. type: Boolean,
  58836. default: true
  58837. },
  58838. center: Boolean,
  58839. draggable: Boolean,
  58840. overflow: Boolean,
  58841. roundButton: {
  58842. default: false,
  58843. type: Boolean
  58844. },
  58845. container: {
  58846. type: String,
  58847. default: "body"
  58848. },
  58849. boxType: {
  58850. type: String,
  58851. default: ""
  58852. }
  58853. },
  58854. emits: ["vanish", "action"],
  58855. setup(props, { emit }) {
  58856. const {
  58857. locale,
  58858. zIndex,
  58859. ns,
  58860. size: btnSize
  58861. } = useGlobalComponentSettings("message-box", computed(() => props.buttonSize));
  58862. const { t } = locale;
  58863. const { nextZIndex } = zIndex;
  58864. const visible = ref(false);
  58865. const state = reactive({
  58866. autofocus: true,
  58867. beforeClose: null,
  58868. callback: null,
  58869. cancelButtonText: "",
  58870. cancelButtonClass: "",
  58871. confirmButtonText: "",
  58872. confirmButtonClass: "",
  58873. customClass: "",
  58874. customStyle: {},
  58875. dangerouslyUseHTMLString: false,
  58876. distinguishCancelAndClose: false,
  58877. icon: "",
  58878. closeIcon: "",
  58879. inputPattern: null,
  58880. inputPlaceholder: "",
  58881. inputType: "text",
  58882. inputValue: "",
  58883. inputValidator: void 0,
  58884. inputErrorMessage: "",
  58885. message: "",
  58886. modalFade: true,
  58887. modalClass: "",
  58888. showCancelButton: false,
  58889. showConfirmButton: true,
  58890. type: "",
  58891. title: void 0,
  58892. showInput: false,
  58893. action: "",
  58894. confirmButtonLoading: false,
  58895. cancelButtonLoading: false,
  58896. confirmButtonLoadingIcon: markRaw(loading_default),
  58897. cancelButtonLoadingIcon: markRaw(loading_default),
  58898. confirmButtonDisabled: false,
  58899. editorErrorMessage: "",
  58900. validateError: false,
  58901. zIndex: nextZIndex()
  58902. });
  58903. const typeClass = computed(() => {
  58904. const type = state.type;
  58905. return { [ns.bm("icon", type)]: type && TypeComponentsMap[type] };
  58906. });
  58907. const contentId = useId();
  58908. const inputId = useId();
  58909. const iconComponent = computed(() => {
  58910. const type = state.type;
  58911. return state.icon || type && TypeComponentsMap[type] || "";
  58912. });
  58913. const hasMessage = computed(() => !!state.message);
  58914. const rootRef = ref();
  58915. const headerRef = ref();
  58916. const focusStartRef = ref();
  58917. const inputRef = ref();
  58918. const confirmRef = ref();
  58919. const confirmButtonClasses = computed(() => state.confirmButtonClass);
  58920. watch(() => state.inputValue, async (val) => {
  58921. await nextTick();
  58922. if (props.boxType === "prompt" && val) {
  58923. validate();
  58924. }
  58925. }, { immediate: true });
  58926. watch(() => visible.value, (val) => {
  58927. var _a, _b;
  58928. if (val) {
  58929. if (props.boxType !== "prompt") {
  58930. if (state.autofocus) {
  58931. focusStartRef.value = (_b = (_a = confirmRef.value) == null ? void 0 : _a.$el) != null ? _b : rootRef.value;
  58932. } else {
  58933. focusStartRef.value = rootRef.value;
  58934. }
  58935. }
  58936. state.zIndex = nextZIndex();
  58937. }
  58938. if (props.boxType !== "prompt")
  58939. return;
  58940. if (val) {
  58941. nextTick().then(() => {
  58942. var _a2;
  58943. if (inputRef.value && inputRef.value.$el) {
  58944. if (state.autofocus) {
  58945. focusStartRef.value = (_a2 = getInputElement()) != null ? _a2 : rootRef.value;
  58946. } else {
  58947. focusStartRef.value = rootRef.value;
  58948. }
  58949. }
  58950. });
  58951. } else {
  58952. state.editorErrorMessage = "";
  58953. state.validateError = false;
  58954. }
  58955. });
  58956. const draggable = computed(() => props.draggable);
  58957. const overflow = computed(() => props.overflow);
  58958. useDraggable(rootRef, headerRef, draggable, overflow);
  58959. onMounted(async () => {
  58960. await nextTick();
  58961. if (props.closeOnHashChange) {
  58962. window.addEventListener("hashchange", doClose);
  58963. }
  58964. });
  58965. onBeforeUnmount(() => {
  58966. if (props.closeOnHashChange) {
  58967. window.removeEventListener("hashchange", doClose);
  58968. }
  58969. });
  58970. function doClose() {
  58971. if (!visible.value)
  58972. return;
  58973. visible.value = false;
  58974. nextTick(() => {
  58975. if (state.action)
  58976. emit("action", state.action);
  58977. });
  58978. }
  58979. const handleWrapperClick = () => {
  58980. if (props.closeOnClickModal) {
  58981. handleAction(state.distinguishCancelAndClose ? "close" : "cancel");
  58982. }
  58983. };
  58984. const overlayEvent = useSameTarget(handleWrapperClick);
  58985. const handleInputEnter = (e) => {
  58986. if (state.inputType !== "textarea") {
  58987. e.preventDefault();
  58988. return handleAction("confirm");
  58989. }
  58990. };
  58991. const handleAction = (action) => {
  58992. var _a;
  58993. if (props.boxType === "prompt" && action === "confirm" && !validate()) {
  58994. return;
  58995. }
  58996. state.action = action;
  58997. if (state.beforeClose) {
  58998. (_a = state.beforeClose) == null ? void 0 : _a.call(state, action, state, doClose);
  58999. } else {
  59000. doClose();
  59001. }
  59002. };
  59003. const validate = () => {
  59004. if (props.boxType === "prompt") {
  59005. const inputPattern = state.inputPattern;
  59006. if (inputPattern && !inputPattern.test(state.inputValue || "")) {
  59007. state.editorErrorMessage = state.inputErrorMessage || t("el.messagebox.error");
  59008. state.validateError = true;
  59009. return false;
  59010. }
  59011. const inputValidator = state.inputValidator;
  59012. if (isFunction$1(inputValidator)) {
  59013. const validateResult = inputValidator(state.inputValue);
  59014. if (validateResult === false) {
  59015. state.editorErrorMessage = state.inputErrorMessage || t("el.messagebox.error");
  59016. state.validateError = true;
  59017. return false;
  59018. }
  59019. if (isString$1(validateResult)) {
  59020. state.editorErrorMessage = validateResult;
  59021. state.validateError = true;
  59022. return false;
  59023. }
  59024. }
  59025. }
  59026. state.editorErrorMessage = "";
  59027. state.validateError = false;
  59028. return true;
  59029. };
  59030. const getInputElement = () => {
  59031. var _a, _b;
  59032. const inputRefs = (_a = inputRef.value) == null ? void 0 : _a.$refs;
  59033. return (_b = inputRefs == null ? void 0 : inputRefs.input) != null ? _b : inputRefs == null ? void 0 : inputRefs.textarea;
  59034. };
  59035. const handleClose = () => {
  59036. handleAction("close");
  59037. };
  59038. const onCloseRequested = () => {
  59039. if (props.closeOnPressEscape) {
  59040. handleClose();
  59041. }
  59042. };
  59043. if (props.lockScroll) {
  59044. useLockscreen(visible);
  59045. }
  59046. return {
  59047. ...toRefs(state),
  59048. ns,
  59049. overlayEvent,
  59050. visible,
  59051. hasMessage,
  59052. typeClass,
  59053. contentId,
  59054. inputId,
  59055. btnSize,
  59056. iconComponent,
  59057. confirmButtonClasses,
  59058. rootRef,
  59059. focusStartRef,
  59060. headerRef,
  59061. inputRef,
  59062. confirmRef,
  59063. doClose,
  59064. handleClose,
  59065. onCloseRequested,
  59066. handleWrapperClick,
  59067. handleInputEnter,
  59068. handleAction,
  59069. t
  59070. };
  59071. }
  59072. });
  59073. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  59074. const _component_el_icon = resolveComponent("el-icon");
  59075. const _component_el_input = resolveComponent("el-input");
  59076. const _component_el_button = resolveComponent("el-button");
  59077. const _component_el_focus_trap = resolveComponent("el-focus-trap");
  59078. const _component_el_overlay = resolveComponent("el-overlay");
  59079. return openBlock(), createBlock(Transition, {
  59080. name: "fade-in-linear",
  59081. onAfterLeave: ($event) => _ctx.$emit("vanish"),
  59082. persisted: ""
  59083. }, {
  59084. default: withCtx(() => [
  59085. withDirectives(createVNode(_component_el_overlay, {
  59086. "z-index": _ctx.zIndex,
  59087. "overlay-class": [_ctx.ns.is("message-box"), _ctx.modalClass],
  59088. mask: _ctx.modal
  59089. }, {
  59090. default: withCtx(() => [
  59091. createElementVNode("div", {
  59092. role: "dialog",
  59093. "aria-label": _ctx.title,
  59094. "aria-modal": "true",
  59095. "aria-describedby": !_ctx.showInput ? _ctx.contentId : void 0,
  59096. class: normalizeClass(`${_ctx.ns.namespace.value}-overlay-message-box`),
  59097. onClick: _ctx.overlayEvent.onClick,
  59098. onMousedown: _ctx.overlayEvent.onMousedown,
  59099. onMouseup: _ctx.overlayEvent.onMouseup
  59100. }, [
  59101. createVNode(_component_el_focus_trap, {
  59102. loop: "",
  59103. trapped: _ctx.visible,
  59104. "focus-trap-el": _ctx.rootRef,
  59105. "focus-start-el": _ctx.focusStartRef,
  59106. onReleaseRequested: _ctx.onCloseRequested
  59107. }, {
  59108. default: withCtx(() => [
  59109. createElementVNode("div", {
  59110. ref: "rootRef",
  59111. class: normalizeClass([
  59112. _ctx.ns.b(),
  59113. _ctx.customClass,
  59114. _ctx.ns.is("draggable", _ctx.draggable),
  59115. { [_ctx.ns.m("center")]: _ctx.center }
  59116. ]),
  59117. style: normalizeStyle(_ctx.customStyle),
  59118. tabindex: "-1",
  59119. onClick: withModifiers(() => {
  59120. }, ["stop"])
  59121. }, [
  59122. _ctx.title !== null && _ctx.title !== void 0 ? (openBlock(), createElementBlock("div", {
  59123. key: 0,
  59124. ref: "headerRef",
  59125. class: normalizeClass([_ctx.ns.e("header"), { "show-close": _ctx.showClose }])
  59126. }, [
  59127. createElementVNode("div", {
  59128. class: normalizeClass(_ctx.ns.e("title"))
  59129. }, [
  59130. _ctx.iconComponent && _ctx.center ? (openBlock(), createBlock(_component_el_icon, {
  59131. key: 0,
  59132. class: normalizeClass([_ctx.ns.e("status"), _ctx.typeClass])
  59133. }, {
  59134. default: withCtx(() => [
  59135. (openBlock(), createBlock(resolveDynamicComponent(_ctx.iconComponent)))
  59136. ]),
  59137. _: 1
  59138. }, 8, ["class"])) : createCommentVNode("v-if", true),
  59139. createElementVNode("span", null, toDisplayString(_ctx.title), 1)
  59140. ], 2),
  59141. _ctx.showClose ? (openBlock(), createElementBlock("button", {
  59142. key: 0,
  59143. type: "button",
  59144. class: normalizeClass(_ctx.ns.e("headerbtn")),
  59145. "aria-label": _ctx.t("el.messagebox.close"),
  59146. onClick: ($event) => _ctx.handleAction(_ctx.distinguishCancelAndClose ? "close" : "cancel"),
  59147. onKeydown: withKeys(withModifiers(($event) => _ctx.handleAction(_ctx.distinguishCancelAndClose ? "close" : "cancel"), ["prevent"]), ["enter"])
  59148. }, [
  59149. createVNode(_component_el_icon, {
  59150. class: normalizeClass(_ctx.ns.e("close"))
  59151. }, {
  59152. default: withCtx(() => [
  59153. (openBlock(), createBlock(resolveDynamicComponent(_ctx.closeIcon || "close")))
  59154. ]),
  59155. _: 1
  59156. }, 8, ["class"])
  59157. ], 42, ["aria-label", "onClick", "onKeydown"])) : createCommentVNode("v-if", true)
  59158. ], 2)) : createCommentVNode("v-if", true),
  59159. createElementVNode("div", {
  59160. id: _ctx.contentId,
  59161. class: normalizeClass(_ctx.ns.e("content"))
  59162. }, [
  59163. createElementVNode("div", {
  59164. class: normalizeClass(_ctx.ns.e("container"))
  59165. }, [
  59166. _ctx.iconComponent && !_ctx.center && _ctx.hasMessage ? (openBlock(), createBlock(_component_el_icon, {
  59167. key: 0,
  59168. class: normalizeClass([_ctx.ns.e("status"), _ctx.typeClass])
  59169. }, {
  59170. default: withCtx(() => [
  59171. (openBlock(), createBlock(resolveDynamicComponent(_ctx.iconComponent)))
  59172. ]),
  59173. _: 1
  59174. }, 8, ["class"])) : createCommentVNode("v-if", true),
  59175. _ctx.hasMessage ? (openBlock(), createElementBlock("div", {
  59176. key: 1,
  59177. class: normalizeClass(_ctx.ns.e("message"))
  59178. }, [
  59179. renderSlot(_ctx.$slots, "default", {}, () => [
  59180. !_ctx.dangerouslyUseHTMLString ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.showInput ? "label" : "p"), {
  59181. key: 0,
  59182. for: _ctx.showInput ? _ctx.inputId : void 0
  59183. }, {
  59184. default: withCtx(() => [
  59185. createTextVNode(toDisplayString(!_ctx.dangerouslyUseHTMLString ? _ctx.message : ""), 1)
  59186. ]),
  59187. _: 1
  59188. }, 8, ["for"])) : (openBlock(), createBlock(resolveDynamicComponent(_ctx.showInput ? "label" : "p"), {
  59189. key: 1,
  59190. for: _ctx.showInput ? _ctx.inputId : void 0,
  59191. innerHTML: _ctx.message
  59192. }, null, 8, ["for", "innerHTML"]))
  59193. ])
  59194. ], 2)) : createCommentVNode("v-if", true)
  59195. ], 2),
  59196. withDirectives(createElementVNode("div", {
  59197. class: normalizeClass(_ctx.ns.e("input"))
  59198. }, [
  59199. createVNode(_component_el_input, {
  59200. id: _ctx.inputId,
  59201. ref: "inputRef",
  59202. modelValue: _ctx.inputValue,
  59203. "onUpdate:modelValue": ($event) => _ctx.inputValue = $event,
  59204. type: _ctx.inputType,
  59205. placeholder: _ctx.inputPlaceholder,
  59206. "aria-invalid": _ctx.validateError,
  59207. class: normalizeClass({ invalid: _ctx.validateError }),
  59208. onKeydown: withKeys(_ctx.handleInputEnter, ["enter"])
  59209. }, null, 8, ["id", "modelValue", "onUpdate:modelValue", "type", "placeholder", "aria-invalid", "class", "onKeydown"]),
  59210. createElementVNode("div", {
  59211. class: normalizeClass(_ctx.ns.e("errormsg")),
  59212. style: normalizeStyle({
  59213. visibility: !!_ctx.editorErrorMessage ? "visible" : "hidden"
  59214. })
  59215. }, toDisplayString(_ctx.editorErrorMessage), 7)
  59216. ], 2), [
  59217. [vShow, _ctx.showInput]
  59218. ])
  59219. ], 10, ["id"]),
  59220. createElementVNode("div", {
  59221. class: normalizeClass(_ctx.ns.e("btns"))
  59222. }, [
  59223. _ctx.showCancelButton ? (openBlock(), createBlock(_component_el_button, {
  59224. key: 0,
  59225. loading: _ctx.cancelButtonLoading,
  59226. "loading-icon": _ctx.cancelButtonLoadingIcon,
  59227. class: normalizeClass([_ctx.cancelButtonClass]),
  59228. round: _ctx.roundButton,
  59229. size: _ctx.btnSize,
  59230. onClick: ($event) => _ctx.handleAction("cancel"),
  59231. onKeydown: withKeys(withModifiers(($event) => _ctx.handleAction("cancel"), ["prevent"]), ["enter"])
  59232. }, {
  59233. default: withCtx(() => [
  59234. createTextVNode(toDisplayString(_ctx.cancelButtonText || _ctx.t("el.messagebox.cancel")), 1)
  59235. ]),
  59236. _: 1
  59237. }, 8, ["loading", "loading-icon", "class", "round", "size", "onClick", "onKeydown"])) : createCommentVNode("v-if", true),
  59238. withDirectives(createVNode(_component_el_button, {
  59239. ref: "confirmRef",
  59240. type: "primary",
  59241. loading: _ctx.confirmButtonLoading,
  59242. "loading-icon": _ctx.confirmButtonLoadingIcon,
  59243. class: normalizeClass([_ctx.confirmButtonClasses]),
  59244. round: _ctx.roundButton,
  59245. disabled: _ctx.confirmButtonDisabled,
  59246. size: _ctx.btnSize,
  59247. onClick: ($event) => _ctx.handleAction("confirm"),
  59248. onKeydown: withKeys(withModifiers(($event) => _ctx.handleAction("confirm"), ["prevent"]), ["enter"])
  59249. }, {
  59250. default: withCtx(() => [
  59251. createTextVNode(toDisplayString(_ctx.confirmButtonText || _ctx.t("el.messagebox.confirm")), 1)
  59252. ]),
  59253. _: 1
  59254. }, 8, ["loading", "loading-icon", "class", "round", "disabled", "size", "onClick", "onKeydown"]), [
  59255. [vShow, _ctx.showConfirmButton]
  59256. ])
  59257. ], 2)
  59258. ], 14, ["onClick"])
  59259. ]),
  59260. _: 3
  59261. }, 8, ["trapped", "focus-trap-el", "focus-start-el", "onReleaseRequested"])
  59262. ], 42, ["aria-label", "aria-describedby", "onClick", "onMousedown", "onMouseup"])
  59263. ]),
  59264. _: 3
  59265. }, 8, ["z-index", "overlay-class", "mask"]), [
  59266. [vShow, _ctx.visible]
  59267. ])
  59268. ]),
  59269. _: 3
  59270. }, 8, ["onAfterLeave"]);
  59271. }
  59272. var MessageBoxConstructor = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render], ["__file", "index.vue"]]);
  59273. const messageInstance = /* @__PURE__ */ new Map();
  59274. const getAppendToElement = (props) => {
  59275. let appendTo = document.body;
  59276. if (props.appendTo) {
  59277. if (isString$1(props.appendTo)) {
  59278. appendTo = document.querySelector(props.appendTo);
  59279. }
  59280. if (isElement$1(props.appendTo)) {
  59281. appendTo = props.appendTo;
  59282. }
  59283. if (!isElement$1(appendTo)) {
  59284. appendTo = document.body;
  59285. }
  59286. }
  59287. return appendTo;
  59288. };
  59289. const initInstance = (props, container, appContext = null) => {
  59290. const vnode = createVNode(MessageBoxConstructor, props, isFunction$1(props.message) || isVNode(props.message) ? {
  59291. default: isFunction$1(props.message) ? props.message : () => props.message
  59292. } : null);
  59293. vnode.appContext = appContext;
  59294. render(vnode, container);
  59295. getAppendToElement(props).appendChild(container.firstElementChild);
  59296. return vnode.component;
  59297. };
  59298. const genContainer = () => {
  59299. return document.createElement("div");
  59300. };
  59301. const showMessage = (options, appContext) => {
  59302. const container = genContainer();
  59303. options.onVanish = () => {
  59304. render(null, container);
  59305. messageInstance.delete(vm);
  59306. };
  59307. options.onAction = (action) => {
  59308. const currentMsg = messageInstance.get(vm);
  59309. let resolve;
  59310. if (options.showInput) {
  59311. resolve = { value: vm.inputValue, action };
  59312. } else {
  59313. resolve = action;
  59314. }
  59315. if (options.callback) {
  59316. options.callback(resolve, instance.proxy);
  59317. } else {
  59318. if (action === "cancel" || action === "close") {
  59319. if (options.distinguishCancelAndClose && action !== "cancel") {
  59320. currentMsg.reject("close");
  59321. } else {
  59322. currentMsg.reject("cancel");
  59323. }
  59324. } else {
  59325. currentMsg.resolve(resolve);
  59326. }
  59327. }
  59328. };
  59329. const instance = initInstance(options, container, appContext);
  59330. const vm = instance.proxy;
  59331. for (const prop in options) {
  59332. if (hasOwn(options, prop) && !hasOwn(vm.$props, prop)) {
  59333. if (prop === "closeIcon" && isObject$1(options[prop])) {
  59334. vm[prop] = markRaw(options[prop]);
  59335. } else {
  59336. vm[prop] = options[prop];
  59337. }
  59338. }
  59339. }
  59340. vm.visible = true;
  59341. return vm;
  59342. };
  59343. function MessageBox(options, appContext = null) {
  59344. if (!isClient)
  59345. return Promise.reject();
  59346. let callback;
  59347. if (isString$1(options) || isVNode(options)) {
  59348. options = {
  59349. message: options
  59350. };
  59351. } else {
  59352. callback = options.callback;
  59353. }
  59354. return new Promise((resolve, reject) => {
  59355. const vm = showMessage(options, appContext != null ? appContext : MessageBox._context);
  59356. messageInstance.set(vm, {
  59357. options,
  59358. callback,
  59359. resolve,
  59360. reject
  59361. });
  59362. });
  59363. }
  59364. const MESSAGE_BOX_VARIANTS = ["alert", "confirm", "prompt"];
  59365. const MESSAGE_BOX_DEFAULT_OPTS = {
  59366. alert: { closeOnPressEscape: false, closeOnClickModal: false },
  59367. confirm: { showCancelButton: true },
  59368. prompt: { showCancelButton: true, showInput: true }
  59369. };
  59370. MESSAGE_BOX_VARIANTS.forEach((boxType) => {
  59371. MessageBox[boxType] = messageBoxFactory(boxType);
  59372. });
  59373. function messageBoxFactory(boxType) {
  59374. return (message, title, options, appContext) => {
  59375. let titleOrOpts = "";
  59376. if (isObject$1(title)) {
  59377. options = title;
  59378. titleOrOpts = "";
  59379. } else if (isUndefined(title)) {
  59380. titleOrOpts = "";
  59381. } else {
  59382. titleOrOpts = title;
  59383. }
  59384. return MessageBox(Object.assign({
  59385. title: titleOrOpts,
  59386. message,
  59387. type: "",
  59388. ...MESSAGE_BOX_DEFAULT_OPTS[boxType]
  59389. }, options, {
  59390. boxType
  59391. }), appContext);
  59392. };
  59393. }
  59394. MessageBox.close = () => {
  59395. messageInstance.forEach((_, vm) => {
  59396. vm.doClose();
  59397. });
  59398. messageInstance.clear();
  59399. };
  59400. MessageBox._context = null;
  59401. const _MessageBox = MessageBox;
  59402. _MessageBox.install = (app) => {
  59403. _MessageBox._context = app._context;
  59404. app.config.globalProperties.$msgbox = _MessageBox;
  59405. app.config.globalProperties.$messageBox = _MessageBox;
  59406. app.config.globalProperties.$alert = _MessageBox.alert;
  59407. app.config.globalProperties.$confirm = _MessageBox.confirm;
  59408. app.config.globalProperties.$prompt = _MessageBox.prompt;
  59409. };
  59410. const ElMessageBox = _MessageBox;
  59411. const notificationTypes = [
  59412. "success",
  59413. "info",
  59414. "warning",
  59415. "error"
  59416. ];
  59417. const notificationProps = buildProps({
  59418. customClass: {
  59419. type: String,
  59420. default: ""
  59421. },
  59422. dangerouslyUseHTMLString: Boolean,
  59423. duration: {
  59424. type: Number,
  59425. default: 4500
  59426. },
  59427. icon: {
  59428. type: iconPropType
  59429. },
  59430. id: {
  59431. type: String,
  59432. default: ""
  59433. },
  59434. message: {
  59435. type: definePropType([
  59436. String,
  59437. Object,
  59438. Function
  59439. ]),
  59440. default: ""
  59441. },
  59442. offset: {
  59443. type: Number,
  59444. default: 0
  59445. },
  59446. onClick: {
  59447. type: definePropType(Function),
  59448. default: () => void 0
  59449. },
  59450. onClose: {
  59451. type: definePropType(Function),
  59452. required: true
  59453. },
  59454. position: {
  59455. type: String,
  59456. values: ["top-right", "top-left", "bottom-right", "bottom-left"],
  59457. default: "top-right"
  59458. },
  59459. showClose: {
  59460. type: Boolean,
  59461. default: true
  59462. },
  59463. title: {
  59464. type: String,
  59465. default: ""
  59466. },
  59467. type: {
  59468. type: String,
  59469. values: [...notificationTypes, ""],
  59470. default: ""
  59471. },
  59472. zIndex: Number,
  59473. closeIcon: {
  59474. type: iconPropType,
  59475. default: close_default
  59476. }
  59477. });
  59478. const notificationEmits = {
  59479. destroy: () => true
  59480. };
  59481. const __default__ = defineComponent({
  59482. name: "ElNotification"
  59483. });
  59484. const _sfc_main = /* @__PURE__ */ defineComponent({
  59485. ...__default__,
  59486. props: notificationProps,
  59487. emits: notificationEmits,
  59488. setup(__props, { expose }) {
  59489. const props = __props;
  59490. const { ns, zIndex } = useGlobalComponentSettings("notification");
  59491. const { nextZIndex, currentZIndex } = zIndex;
  59492. const visible = ref(false);
  59493. let timer = void 0;
  59494. const typeClass = computed(() => {
  59495. const type = props.type;
  59496. return type && TypeComponentsMap[props.type] ? ns.m(type) : "";
  59497. });
  59498. const iconComponent = computed(() => {
  59499. if (!props.type)
  59500. return props.icon;
  59501. return TypeComponentsMap[props.type] || props.icon;
  59502. });
  59503. const horizontalClass = computed(() => props.position.endsWith("right") ? "right" : "left");
  59504. const verticalProperty = computed(() => props.position.startsWith("top") ? "top" : "bottom");
  59505. const positionStyle = computed(() => {
  59506. var _a;
  59507. return {
  59508. [verticalProperty.value]: `${props.offset}px`,
  59509. zIndex: (_a = props.zIndex) != null ? _a : currentZIndex.value
  59510. };
  59511. });
  59512. function startTimer() {
  59513. if (props.duration > 0) {
  59514. ({ stop: timer } = useTimeoutFn(() => {
  59515. if (visible.value)
  59516. close();
  59517. }, props.duration));
  59518. }
  59519. }
  59520. function clearTimer() {
  59521. timer == null ? void 0 : timer();
  59522. }
  59523. function close() {
  59524. visible.value = false;
  59525. }
  59526. function onKeydown({ code }) {
  59527. if (code === EVENT_CODE.delete || code === EVENT_CODE.backspace) {
  59528. clearTimer();
  59529. } else if (code === EVENT_CODE.esc) {
  59530. if (visible.value) {
  59531. close();
  59532. }
  59533. } else {
  59534. startTimer();
  59535. }
  59536. }
  59537. onMounted(() => {
  59538. startTimer();
  59539. nextZIndex();
  59540. visible.value = true;
  59541. });
  59542. useEventListener(document, "keydown", onKeydown);
  59543. expose({
  59544. visible,
  59545. close
  59546. });
  59547. return (_ctx, _cache) => {
  59548. return openBlock(), createBlock(Transition, {
  59549. name: unref(ns).b("fade"),
  59550. onBeforeLeave: _ctx.onClose,
  59551. onAfterLeave: ($event) => _ctx.$emit("destroy"),
  59552. persisted: ""
  59553. }, {
  59554. default: withCtx(() => [
  59555. withDirectives(createElementVNode("div", {
  59556. id: _ctx.id,
  59557. class: normalizeClass([unref(ns).b(), _ctx.customClass, unref(horizontalClass)]),
  59558. style: normalizeStyle(unref(positionStyle)),
  59559. role: "alert",
  59560. onMouseenter: clearTimer,
  59561. onMouseleave: startTimer,
  59562. onClick: _ctx.onClick
  59563. }, [
  59564. unref(iconComponent) ? (openBlock(), createBlock(unref(ElIcon), {
  59565. key: 0,
  59566. class: normalizeClass([unref(ns).e("icon"), unref(typeClass)])
  59567. }, {
  59568. default: withCtx(() => [
  59569. (openBlock(), createBlock(resolveDynamicComponent(unref(iconComponent))))
  59570. ]),
  59571. _: 1
  59572. }, 8, ["class"])) : createCommentVNode("v-if", true),
  59573. createElementVNode("div", {
  59574. class: normalizeClass(unref(ns).e("group"))
  59575. }, [
  59576. createElementVNode("h2", {
  59577. class: normalizeClass(unref(ns).e("title")),
  59578. textContent: toDisplayString(_ctx.title)
  59579. }, null, 10, ["textContent"]),
  59580. withDirectives(createElementVNode("div", {
  59581. class: normalizeClass(unref(ns).e("content")),
  59582. style: normalizeStyle(!!_ctx.title ? void 0 : { margin: 0 })
  59583. }, [
  59584. renderSlot(_ctx.$slots, "default", {}, () => [
  59585. !_ctx.dangerouslyUseHTMLString ? (openBlock(), createElementBlock("p", { key: 0 }, toDisplayString(_ctx.message), 1)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
  59586. createCommentVNode(" Caution here, message could've been compromised, never use user's input as message "),
  59587. createElementVNode("p", { innerHTML: _ctx.message }, null, 8, ["innerHTML"])
  59588. ], 2112))
  59589. ])
  59590. ], 6), [
  59591. [vShow, _ctx.message]
  59592. ]),
  59593. _ctx.showClose ? (openBlock(), createBlock(unref(ElIcon), {
  59594. key: 0,
  59595. class: normalizeClass(unref(ns).e("closeBtn")),
  59596. onClick: withModifiers(close, ["stop"])
  59597. }, {
  59598. default: withCtx(() => [
  59599. (openBlock(), createBlock(resolveDynamicComponent(_ctx.closeIcon)))
  59600. ]),
  59601. _: 1
  59602. }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true)
  59603. ], 2)
  59604. ], 46, ["id", "onClick"]), [
  59605. [vShow, visible.value]
  59606. ])
  59607. ]),
  59608. _: 3
  59609. }, 8, ["name", "onBeforeLeave", "onAfterLeave"]);
  59610. };
  59611. }
  59612. });
  59613. var NotificationConstructor = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "notification.vue"]]);
  59614. const notifications = {
  59615. "top-left": [],
  59616. "top-right": [],
  59617. "bottom-left": [],
  59618. "bottom-right": []
  59619. };
  59620. const GAP_SIZE = 16;
  59621. let seed = 1;
  59622. const notify = function(options = {}, context) {
  59623. if (!isClient)
  59624. return { close: () => void 0 };
  59625. if (isString$1(options) || isVNode(options)) {
  59626. options = { message: options };
  59627. }
  59628. const position = options.position || "top-right";
  59629. let verticalOffset = options.offset || 0;
  59630. notifications[position].forEach(({ vm: vm2 }) => {
  59631. var _a;
  59632. verticalOffset += (((_a = vm2.el) == null ? void 0 : _a.offsetHeight) || 0) + GAP_SIZE;
  59633. });
  59634. verticalOffset += GAP_SIZE;
  59635. const id = `notification_${seed++}`;
  59636. const userOnClose = options.onClose;
  59637. const props = {
  59638. ...options,
  59639. offset: verticalOffset,
  59640. id,
  59641. onClose: () => {
  59642. close(id, position, userOnClose);
  59643. }
  59644. };
  59645. let appendTo = document.body;
  59646. if (isElement$1(options.appendTo)) {
  59647. appendTo = options.appendTo;
  59648. } else if (isString$1(options.appendTo)) {
  59649. appendTo = document.querySelector(options.appendTo);
  59650. }
  59651. if (!isElement$1(appendTo)) {
  59652. appendTo = document.body;
  59653. }
  59654. const container = document.createElement("div");
  59655. const vm = createVNode(NotificationConstructor, props, isFunction$1(props.message) ? props.message : isVNode(props.message) ? () => props.message : null);
  59656. vm.appContext = isUndefined(context) ? notify._context : context;
  59657. vm.props.onDestroy = () => {
  59658. render(null, container);
  59659. };
  59660. render(vm, container);
  59661. notifications[position].push({ vm });
  59662. appendTo.appendChild(container.firstElementChild);
  59663. return {
  59664. close: () => {
  59665. vm.component.exposed.visible.value = false;
  59666. }
  59667. };
  59668. };
  59669. notificationTypes.forEach((type) => {
  59670. notify[type] = (options = {}, appContext) => {
  59671. if (isString$1(options) || isVNode(options)) {
  59672. options = {
  59673. message: options
  59674. };
  59675. }
  59676. return notify({ ...options, type }, appContext);
  59677. };
  59678. });
  59679. function close(id, position, userOnClose) {
  59680. const orientedNotifications = notifications[position];
  59681. const idx = orientedNotifications.findIndex(({ vm: vm2 }) => {
  59682. var _a;
  59683. return ((_a = vm2.component) == null ? void 0 : _a.props.id) === id;
  59684. });
  59685. if (idx === -1)
  59686. return;
  59687. const { vm } = orientedNotifications[idx];
  59688. if (!vm)
  59689. return;
  59690. userOnClose == null ? void 0 : userOnClose(vm);
  59691. const removedHeight = vm.el.offsetHeight;
  59692. const verticalPos = position.split("-")[0];
  59693. orientedNotifications.splice(idx, 1);
  59694. const len = orientedNotifications.length;
  59695. if (len < 1)
  59696. return;
  59697. for (let i = idx; i < len; i++) {
  59698. const { el, component } = orientedNotifications[i].vm;
  59699. const pos = Number.parseInt(el.style[verticalPos], 10) - removedHeight - GAP_SIZE;
  59700. component.props.offset = pos;
  59701. }
  59702. }
  59703. function closeAll() {
  59704. for (const orientedNotifications of Object.values(notifications)) {
  59705. orientedNotifications.forEach(({ vm }) => {
  59706. vm.component.exposed.visible.value = false;
  59707. });
  59708. }
  59709. }
  59710. notify.closeAll = closeAll;
  59711. notify._context = null;
  59712. var Notify = notify;
  59713. const ElNotification = withInstallFunction(Notify, "$notify");
  59714. var Plugins = [
  59715. ElInfiniteScroll,
  59716. ElLoading,
  59717. ElMessage,
  59718. ElMessageBox,
  59719. ElNotification,
  59720. ElPopoverDirective
  59721. ];
  59722. var installer = makeInstaller([...Components, ...Plugins]);
  59723. const install = installer.install;
  59724. const version = installer.version;
  59725. export { BAR_MAP, CAROUSEL_ITEM_NAME, CASCADER_PANEL_INJECTION_KEY, CHANGE_EVENT, ClickOutside, CommonPicker, CommonProps, DEFAULT_EMPTY_VALUES, DEFAULT_FORMATS_DATE, DEFAULT_FORMATS_DATEPICKER, DEFAULT_FORMATS_TIME, DEFAULT_VALUE_ON_CLEAR, COLLECTION_INJECTION_KEY as DROPDOWN_COLLECTION_INJECTION_KEY, COLLECTION_ITEM_INJECTION_KEY as DROPDOWN_COLLECTION_ITEM_INJECTION_KEY, DROPDOWN_INJECTION_KEY, DefaultProps, DynamicSizeGrid$1 as DynamicSizeGrid, DynamicSizeList$1 as DynamicSizeList, EVENT_CODE, Effect, ElAffix, ElAlert, ElAnchor, ElAnchorLink, ElAside, ElAutoResizer, ElAutocomplete, ElAvatar, ElBacktop, ElBadge, ElBreadcrumb, ElBreadcrumbItem, ElButton, ElButtonGroup$1 as ElButtonGroup, ElCalendar, ElCard, ElCarousel, ElCarouselItem, ElCascader, ElCascaderPanel, ElCheckTag, ElCheckbox, ElCheckboxButton, ElCheckboxGroup$1 as ElCheckboxGroup, ElCol, ElCollapse, ElCollapseItem, ElCollapseTransition, ElCollection, ElCollectionItem, ElColorPicker, ElConfigProvider, ElContainer, ElCountdown, ElDatePicker, ElDescriptions, ElDescriptionsItem, ElDialog, ElDivider, ElDrawer, ElDropdown, ElDropdownItem, ElDropdownMenu, ElEmpty, ElFooter, ElForm, ElFormItem, ElHeader, ElIcon, ElImage, ElImageViewer, ElInfiniteScroll, ElInput, ElInputNumber, ElInputTag, ElLink, ElLoading, vLoading as ElLoadingDirective, Loading as ElLoadingService, ElMain, ElMention, ElMenu, ElMenuItem, ElMenuItemGroup, ElMessage, ElMessageBox, ElNotification, ElOption, ElOptionGroup, ElOverlay, ElPageHeader, ElPagination, ElPopconfirm, ElPopover, ElPopoverDirective, ElPopper, ElPopperArrow, ElPopperContent, ElPopperTrigger, ElProgress, ElRadio, ElRadioButton, ElRadioGroup, ElRate, ElResult, ElRow, ElScrollbar, ElSegmented, ElSelect, ElSelectV2, ElSkeleton, ElSkeletonItem, ElSlider, ElSpace, ElStatistic, ElStep, ElSteps, ElSubMenu, ElSwitch, ElTabPane, ElTable, ElTableColumn, ElTableV2, ElTabs, ElTag, ElText, ElTimePicker, ElTimeSelect, ElTimeline, ElTimelineItem, ElTooltip, ElTour, ElTourStep, ElTransfer, ElTree, ElTreeSelect, ElTreeV2, ElUpload, ElWatermark, FIRST_KEYS, FIRST_LAST_KEYS, FORWARD_REF_INJECTION_KEY, FixedSizeGrid$1 as FixedSizeGrid, FixedSizeList$1 as FixedSizeList, GAP, ID_INJECTION_KEY, INPUT_EVENT, INSTALLED_KEY, IconComponentMap, IconMap, LAST_KEYS, LEFT_CHECK_CHANGE_EVENT, Mousewheel, POPPER_CONTENT_INJECTION_KEY, POPPER_INJECTION_KEY, RIGHT_CHECK_CHANGE_EVENT, ROOT_PICKER_INJECTION_KEY, RowAlign, RowJustify, SCOPE$3 as SCOPE, SIZE_INJECTION_KEY, SelectProps$1 as SelectProps, TOOLTIP_INJECTION_KEY, TableV2$1 as TableV2, Alignment as TableV2Alignment, FixedDir as TableV2FixedDir, placeholderSign as TableV2Placeholder, SortOrder as TableV2SortOrder, TimePickPanel, TrapFocus, UPDATE_MODEL_EVENT, WEEK_DAYS, ZINDEX_INJECTION_KEY, affixEmits, affixProps, alertEffects, alertEmits, alertProps, anchorEmits, anchorProps, ariaProps, arrowMiddleware, autoResizerProps, autocompleteEmits, autocompleteProps, avatarEmits, avatarProps, backtopEmits, backtopProps, badgeProps, breadcrumbItemProps, breadcrumbKey, breadcrumbProps, buildLocaleContext, buildTimeList, buildTranslator, buttonEmits, buttonGroupContextKey, buttonNativeTypes, buttonProps, buttonTypes, calendarEmits, calendarProps, cardProps, carouselContextKey, carouselEmits, carouselItemProps, carouselProps, cascaderEmits, cascaderProps, checkTagEmits, checkTagProps, checkboxEmits, checkboxGroupContextKey, checkboxGroupEmits, checkboxGroupProps, checkboxProps, colProps, collapseContextKey, collapseEmits, collapseItemProps, collapseProps, colorPickerContextKey, colorPickerEmits, colorPickerProps, componentSizeMap, componentSizes, configProviderContextKey, configProviderProps, countdownEmits, countdownProps, createModelToggleComposable, dateEquals, datePickTypes, datePickerProps, dayOrDaysToDate, dayjs, installer as default, defaultInitialZIndex, defaultNamespace, defaultProps, descriptionItemProps, descriptionProps, dialogEmits, dialogInjectionKey, dialogProps, dividerProps, drawerEmits, drawerProps, dropdownItemProps, dropdownMenuProps, dropdownProps, elPaginationKey, emitChangeFn, emptyProps, emptyValuesContextKey, extractDateFormat, extractTimeFormat, formContextKey, formEmits, formItemContextKey, formItemProps, formItemValidateStates, formMetaProps, formProps, formatter, genFileId, getPositionDataWithUnit, iconProps, imageEmits, imageProps, imageViewerEmits, imageViewerProps, inputEmits, inputNumberEmits, inputNumberProps, inputProps, inputTagEmits, inputTagProps, install, linkEmits, linkProps, localeContextKey, makeInstaller, makeList, mentionEmits, mentionProps, menuEmits, menuItemEmits, menuItemGroupProps, menuItemProps, menuProps, messageConfig, messageDefaults, messageEmits, messageProps, messageTypes, namespaceContextKey, notificationEmits, notificationProps, notificationTypes, overlayEmits, overlayProps, pageHeaderEmits, pageHeaderProps, paginationEmits, paginationProps, parseDate, popconfirmEmits, popconfirmProps, popoverEmits, popoverProps, popperArrowProps, popperContentEmits, popperContentProps, popperCoreConfigProps, popperProps, popperTriggerProps, progressProps, provideGlobalConfig, radioButtonProps, radioEmits, radioGroupEmits, radioGroupKey, radioGroupProps, radioProps, radioPropsBase, rangeArr, rateEmits, rateProps, renderThumbStyle$1 as renderThumbStyle, resultProps, roleTypes, rowContextKey, rowProps, scrollbarContextKey, scrollbarEmits, scrollbarProps, segmentedEmits, segmentedProps, selectEmits$1 as selectEmits, selectGroupKey, selectKey, selectV2InjectionKey, skeletonItemProps, skeletonProps, sliderContextKey, sliderEmits, sliderProps, spaceItemProps, spaceProps, statisticProps, stepProps, stepsEmits, stepsProps, subMenuProps, switchEmits, switchProps, tabBarProps, tabNavEmits, tabNavProps, tabPaneProps, tableV2Props, tableV2RowProps, tabsEmits, tabsProps, tabsRootContextKey, tagEmits, tagProps, textProps, thumbProps, timePickerDefaultProps, timePickerRangeTriggerProps, timePickerRngeTriggerProps, timeSelectProps, timeUnits$1 as timeUnits, timelineItemProps, tooltipEmits, tourContentEmits, tourContentProps, tourEmits, tourPlacements, tourProps, tourStepEmits, tourStepProps, tourStrategies, transferCheckedChangeFn, transferEmits, transferProps, translate, uploadBaseProps, uploadContentProps, uploadContextKey, uploadDraggerEmits, uploadDraggerProps, uploadListEmits, uploadListProps, uploadListTypes, uploadProps, useAriaProps, useAttrs, useCalcInputWidth, useCascaderConfig, useComposition, useCursor, useDelayedRender, useDelayedToggle, useDelayedToggleProps, useDeprecated, useDialog, useDisabled, useDraggable, useEmptyValues, useEmptyValuesProps, useEscapeKeydown, useFloating$1 as useFloating, useFloatingProps, useFocus, useFocusController, useFormDisabled, useFormItem, useFormItemInputId, useFormSize, useForwardRef, useForwardRefDirective, useGetDerivedNamespace, useGlobalComponentSettings, useGlobalConfig, useGlobalSize, useId, useIdInjection, useLocale, useLockscreen, useModal, useModelToggle, useModelToggleEmits, useModelToggleProps, useNamespace, useOrderedChildren, usePopper, usePopperArrowProps, usePopperContainer, usePopperContainerId, usePopperContentEmits, usePopperContentProps, usePopperCoreConfigProps, usePopperProps, usePopperTriggerProps, usePreventGlobal, useProp, useSameTarget, useSize, useSizeProp, useSizeProps, useSpace, useTeleport, useThrottleRender, useTimeout, useTooltipContentProps, useTooltipModelToggle, useTooltipModelToggleEmits, useTooltipModelToggleProps, useTooltipProps, useTooltipTriggerProps, useTransitionFallthrough, useTransitionFallthroughEmits, useZIndex, vLoading, vRepeatClick, valueEquals, version, virtualizedGridProps, virtualizedListProps, virtualizedProps, virtualizedScrollbarProps, watermarkProps, zIndexContextKey };